Seems like it, but without a solution to create the editor and control it
in a single run I'm at a loss :)


-Chad

On Tue, May 9, 2017 at 3:37 PM, Justin Israel <[email protected]>
wrote:

>
>
> On Wed, May 10, 2017 at 10:21 AM Chad Fox <[email protected]> wrote:
>
>> Hey Justin
>>
>> Thanks for the suggestion. Looks like this works without a hitch when run
>> in Maya, but I'm sad to say that as soon as I put it in a module and called
>> it to display some nodes I was checking, it did not work at all. it just
>> opened the custom node editor and displayed the last thing I had in my
>> normal node editor.
>>
>> Is it possible to do something like this with open maya? I would assume
>> so, I'm seeing no reference to creating maya windows like the node editor
>> in the API documentation.
>>
>> Thoughts?
>>
>
> Not sure. Seems like it wouldn't be necessary to have this as a first
> class Maya API concept if you can create one through MEL or Python.
>
>
>>
>> -Chad
>>
>> On Fri, May 5, 2017 at 10:25 PM, Justin Israel <[email protected]>
>> wrote:
>>
>>>
>>>
>>> On Sat, May 6, 2017 at 10:11 AM Chad_Fox <[email protected]> wrote:
>>>
>>>> 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?
>>>>
>>>
>>> It seems to work for me if I either put a cmds.refresh() between the
>>> showWindow() and the layout/frame of the nodes, or you can use
>>>
>>>     cmds.evalDeferred(functools.partial(setupNodeEditor, editor_name))
>>>
>>> and put the layout/frame into a setupNodeEditor(name) function.
>>>
>>>
>>>>
>>>> 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
>>>> <https://groups.google.com/d/msgid/python_inside_maya/5af628e9-65f8-44ff-9c38-e1bbfeb4176d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> 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/CAPGFgA1jKsiwKEZbDE3LYeraqdP7M
>>> iFUcc0e465AHgGoSPXqTQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1jKsiwKEZbDE3LYeraqdP7MiFUcc0e465AHgGoSPXqTQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>
>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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/CAJ4oLs5020oddtb-w0dbSPFnbx9hX6qQo-
>> mQ2tSccr748JcOAg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAJ4oLs5020oddtb-w0dbSPFnbx9hX6qQo-mQ2tSccr748JcOAg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAPGFgA0SiVjahngAjEg2tQRYNM4yQ
> 4kh8qKiR3RCxm60Lrzb5Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0SiVjahngAjEg2tQRYNM4yQ4kh8qKiR3RCxm60Lrzb5Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAJ4oLs4yu0adQjU5iTJ0AmqaZaf6jr4w73UWpP%2BwrW%2BcAO1rGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to