Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Maya lost parent reference edit after importing nested reference (https://simplymaya.com/forum/showthread.php?t=62313)

golubevcg 16-03-2021 12:09 PM

Maya lost parent reference edit after importing nested reference
 
Hello everyone!
Bumped into a little problem.
I have a set, in which i have nested references.
And after i import this nested references i have just referenceses without nesting.

But in my ui script i need to show groups, in which reference files exists,
and here i stuck with a little problem. Before importing nested references i can acces parent reference edits
easily with Open Maya (i need to use OpenMaya because of the speed)

After i import nested refrences i can’t access parent reference edit, it look like it do not exists.
The only way they are returning it is:

cmds.referenceQuery
Here - they returned with no problem.
I take parent from edits because refernce file can be unloaded and it will not be in outliner.

Any one had something in common? maybe there is other way to “take” this parent information?
currently i do it this way:

import maya.OpenMaya as om

selList=om.MSelectionList()
root=om.MObject()
selList.add(ref)
selList.getDependNode(0,root)
it = om.MItEdits(root, root, 1)
parent=""
while not it.isDone():
edit = it.edit()
if 4 == edit.editType():
parent = edit.getString().rsplit(" ", 1)[1].replace(""", "")
break
it.next()
return parent


All times are GMT. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Simply Maya 2018