Very interesting. I tried to find the script editor and access the current script typed in the QTextEdit, but the string returned is always empty. It would be really cool to be able to do this and write a python script, which saves and loads the current text in the script editor, so we don't loose test code if nuke goes away.

On 03/18/2013 12:41 AM, Ben Dickson wrote:
Aha, that's exactly what I'm looking for - thanks Nathan :D

https://gist.github.com/dbr/5167728

On 15/03/13 05:07, Nathan Rusch wrote:
I played around with something similar to dump the viewer's GL texture
to a file. The ugliest part is grabbing the widget you want, as the
hierarchy of widgets in the UI will be completely different depending on
the the Nuke layout. I haven't tried all the tricks in the book, but at
this point, I think the only way to grab to the one you want is to
recurse through the object hierarchy until you find the one you want:

from PySide import QtGui

def findDagWidget():
stack = QtGui.qApp.topLevelWidgets()
while stack:
widget = stack.pop()
if widget.windowTitle() == 'Node Graph':
# You should probably be a little safer with this return, but the actual
DAG widget
# seems to be here consistently... if not, it should be the only child
of 'widget'
# that's a QWidget instance.
return widget.children()[-1]
stack.extend(c for c in widget.children() if c.isWidgetType())


Also, in the case of Viewer widgets, any layout changes destroy the
underlying C++ object. This may not be the case with the DAG, since I
think there can only be one per group, but I would definitely play with
that. Also, if you're just installing an event handler, that shouldn't
be much of an issue.

I've tested simple keypress and PaintEvent handlers, and both seem to
work fine. I can send along the basic code if you're interested, but I
imagine you're probably familiar with what you want to do at that point.

Anyway, hope this helps some.

-Nathan


-----Original Message----- From: Ben Dickson
Sent: Thursday, March 14, 2013 2:07 AM
To: Nuke Python discussion
Subject: [Nuke-python] PySide painting over nodegraph?

Almost certain the answer is "nope", but:

Is it possible to do custom drawing on the node graph? In the same way
you can have a PySide knob in a node or Panel, and implement a custom
'paint' method for that knob

I'm looking for some hacky method of doing this (since there's no
supported way), maybe along the lines of an eventFilter to intercept the
paint event from the nodegraph widget. Any ideas?



--
check out www.pointcloud9.com

Sebastian Elsner - Pipeline Technical Director - RISE

t: +49 30 20180300 flor...@risefx.com
f: +49 30 61651074 www.risefx.com

RISE FX GmbH
Schlesische Strasse 28, Aufgang B, 10997 Berlin
c/o action concept, An der Hasenkaule 1-7, 50354 Hürth
Geschaeftsfuehrer: Sven Pannicke, Robert Pinnow
Handelsregister Berlin HRB 106667 B

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to