Hello,

I'm getting mad with selection tests in the Maya API! Here is the
following code:

____

import maya.OpenMaya as moma
import maya.cmds as mcmd

ActiveSelList = moma.MSelectionList()
moma.MGlobal.getActiveSelectionList(ActiveSelList)
if ActiveSelList.isEmpty():
    print "Empty List"
else:
    # Check Selection not empty
    List = []
    ActiveSelList.getSelectionStrings(List)
    print List

    SelNode = moma.MObject()
    ActiveSelList.getDependNode( 0, SelNode )

    print moma.MGlobal.isSelected(SelNode)
____

This code returns false !!!!
The documentation of "bool MGlobal::isSelected" states clearly that
the MObject passed argument must be a dependency node. That's what I'm
doing with getDependNode....

I'm obviously missing something, but I really don't know why! Help! :)

Thanks a lot!

PS: Something fun, if I add the two following lines in the code
snippet:

    moma.MGlobal.select(SelNode, moma.MGlobal.kReplaceList)
    print moma.MGlobal.isSelected(SelNode)

the object becomes unselected in the viewport, and the print returns
True

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to