Hi:
Im stucking with a problem,I wrote a simple script to achieve a ruslet,but unfortunate it didn't going very well.So I really wanna u my pal help me out!
I wanna achieve this effect:when I select a model form my scene,and execute my script it will automatic spot ReferenceItem and select them in ReferenceEditor window.
Show below:
import maya.cmds as cmds
import maya.mel as mel
def selMesh_toRefNode(selObject):
re_referenceNode_name=str()
if selObject !=None:
if cmds.referenceQuery(selectObject,isNodeReferenced=True):
re_referenceNode_name = cmds.referenceQuery(selectObject,referenceNode=True)
return re_referenceNode_name
def selRefNode_RefEditor():
if 'referenceEditorPanel1Window' not in cmds.lsUI(windows=True):
mel.eval('ReferenceEditor;')
try:
selectObject = cmds.ls(selection=True)[0]
get_RefNode = selMesh_toRefNode(selectObject)
except IndexError:
print 'No select'
allRefNode_List = cmds.ls(references =True)
RefNum = allRefNode_List.index(get_RefNode)
mel.eval('sceneEditor -e -selectItem '+ str(RefNum) +'$gReferenceEditorPanel;')
selRefNode_RefEditor()
Here the issue comes:If reference got very complicated,this litte script is not so useful.IMO,I wanna find all the items that referenced in my scene in ReferenceEditor with PyQt.And treat all the items as string.So that I can easy use "mel.eval('sceneEditor -e -selectItem '+ str(RefNum) +'$gReferenceEditorPanel;')" this little one to select there index number to get what I want.Right pal?
Well,I know the way(maybe right maybe not),But I just cant get the right result.So,help me out of the circle Please!!!
Best Regards