Access Graph Editor Qt Widget ?

330 views
Skip to first unread message

melmas...@gmail.com

unread,
Jul 22, 2018, 12:34:58 PM7/22/18
to gaffer-dev
Hi,

I'm trying to add Houdini Like 'C' shortcut in Gaffer, it all works well except for positioning :



I'm trying to get the Graph Editor's geometry, for now it uses mouse position but It's disturbing.

Thanks

John Haddon

unread,
Jul 22, 2018, 4:36:22 PM7/22/18
to gaffe...@googlegroups.com
Nice!

A bit of background : Gaffer's UIs are built using Qt (and OpenGL), but the GafferUI API intentionally hides the Qt-ness of things, so that we have the option of changing the backend implementation in the future. GafferUI actually started life backed by Gtk, so we have already been through one such change, but in reality I think you're safe to assume we'll be on Qt for a good while.

So, you have two options :

- Use the official `GafferUI.Widget.bound()` method. This returns an `imath.Box2i()` object.
- Use the protected `GafferUI.Widget._qtWidget()` method to get access to the underlying QWidget, and use Qt directly from there.

Cheers...
John

--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

melmas...@gmail.com

unread,
Jul 22, 2018, 5:22:46 PM7/22/18
to gaffer-dev

Thanks !!

I'm not able to access the GraphEditor object.

My script is a menu command, so calling menu.ancestor(GafferUI.GraphEditor) returns None.

What are the ways to access GafferUI's active window parts (Graph Editor, Viewer ... ) ?
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.

John Haddon

unread,
Jul 23, 2018, 9:05:03 AM7/23/18
to gaffe...@googlegroups.com
On Sun, Jul 22, 2018 at 10:22 PM, <melmas...@gmail.com> wrote:

Thanks !!

I'm not able to access the GraphEditor object.

My script is a menu command, so calling menu.ancestor(GafferUI.GraphEditor) returns None.

Ah, I see. First, you need to know that there can be any number of GraphEditors in the current layout, so it's a little tricky to decide which one the user is currently interested in. Fortunately, there's a `GafferUI.EditMenu.scope()` method which does just that. You can see an example of it being used in `GafferUI.EditMenu.arrange()`.

What are the ways to access GafferUI's active window parts (Graph Editor, Viewer ... ) ?

The most general way is to connect to `Editor.instanceCreatedSignal()`. This signal is emitted whenever a new editor is created. I've added an example of using it to add a GraphEditor shortcut, here :


Hope that helps...
Cheers...
John

melmas...@gmail.com

unread,
Jul 24, 2018, 8:25:22 AM7/24/18
to gaffer-dev
Those two tips are really useful.

This makes me think is there a list of Gaffer default callbacks ?
I'm especially interested in those:
- On node created
                 deleted
                 input changed
                 Plug value changed
- On viewer changed
....etc...

Do you take pull request for the contrib folder of Gaffer ?
I'm about to finish a few useful scripts like this one to tailor my experience and I was thinking of creating a "mel" folder in the contrib with those once I've cleaned them

Alex Fuller

unread,
Aug 8, 2018, 3:07:50 PM8/8/18
to gaffer-dev
Not to change the subject or anything, but really Gaffer used GTK in the past? Far out, at least it wasn't motif or fltk :) . A GafferUI based around dear IMGUI I've thought about, but it kind of feels like it's really wrapped around pyside I thought.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.

melmas...@gmail.com

unread,
Feb 18, 2019, 3:16:10 PM2/18/19
to gaffer-dev
Is there a list of Gaffer default callbacks ?
I'm especially interested in those:
- On node created
                 deleted
                 input changed
                 Plug value changed
- On viewer changed
....etc...

Thanks

Reply all
Reply to author
Forward
0 new messages