return cmds.ls(root_node, long=True)
You return the first item of the list that you build up. If you want all of
them, why don't you just return all of them?
On Thu, 22 Sep 2016, 5:43 AM yann19 <yangki...@gmail.com> wrote:
> So I did a new code (after some more thinking...) Do feel free to
> criticize and give pointers..
> I tested a few scenarios and it seems to work, at least I think it did..
> However now I am bumping into another problem.
> Say, I have 2 same hierarchy of Root as seen in the attachment but the
> root nodes of these 2 are called 'Root1' and 'Root2' respectively.
> If I select |Root1|locator1|pCube1 and |Root2|locator2|pCube2, it will
> returns me "|Root1" as the result. But if I inverse my selection, "|Root2"
> will be my output result.
> What is the best way to get around it? Is putting in more checking or
> if-else statements a viable solution?
> Sorry for the spam of questions and codes..
> def get_selection():
> sel = cmds.ls(selection=True, long=True)
> stkLevel_node = cmds.ls(sel, type="stkLevel")
> if stkLevel_node:
> if len(stkLevel_node) > 1:
> cmds.warning("Please select 1 stkLevel node only")
> return stkLevel_node
> root_node = 
> for sel_path in sel:
> split_sel_path = sel_path.split('|')
> if split_sel_path not in root_node:
> return cmds.ls(root_node, long=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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> 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 view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.