Hi all
I'm trying to write a script to display a node editor, populate it with a
given list of nodes and frame them. Unfortunately when running in python,
maya mostly only completes the first step of displaying the scriptedPanel
node editor I'm making. Occasionally when running this code I do get a node
editor with the nodes added, but not framed.
Even though I have the name of said editor, the commands to add nodes and
frame them do nothing when everything is run in one execution. If I run
them separately and individually it works great!
I've tried using evalDeferred and utils.executeInMainThreadWithResult() to
create the window first then run the nodeEditor commands, but no luck
there.
Any thoughts on how to approach this problem?
Thanks!
Enter code here...
nodes_to_display = cmds.ls(sl=True)
title = 'Custom Node Editor Window'
h = 700
w = 950
window_name = cmds.window(title, height=h, width=w)
form_layout = cmds.formLayout()
custom_node_editor = cmds.scriptedPanel(type="nodeEditorPanel", label="My
Node Editor")
cmds.formLayout(form_layout, e=True, af=[(custom_node_editor, s, 0) for s
in ("top", "bottom", "left", "right")])
cmds.showWindow(window_name)
editor_name = custom_node_editor + "NodeEditorEd"
print "Clear node editor"
cmds.nodeEditor(editor_name, e=True, rootNode='')
print "adding nodes"
for node in nodes_to_display:
cmds.nodeEditor(editor_name, e=True, addNode=node)
print "layout nodes"
cmds.nodeEditor(editor_name, e=True, layout=True)
print "frame nodes"
cmds.nodeEditor(editor_name, e=True, frameAll=True)
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/5af628e9-65f8-44ff-9c38-e1bbfeb4176d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.