for node in set(selections):
node_split = node.split('|') split_len = len(node_split) for num in range(split_len):
# I need to use +2, if using a +1, a "|" will be returned... num = num + 2
item = "|" + "|".join(node_split[1:num]) if cmds.nodeType(item) == "customType": print item
Possible to do it not without the use of pymel?
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/cc239786-e3dc-4fc1-8bac-5181846b3274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def node_type_iteration(path_lists): for path in set(path_lists): current_object = cmds.listRelatives(path, parent = True, fullPath = True ) or [] while current_object: # Set the condition here... if cmds.nodeType(current_object[0]) == "customType": return current_object[0] else: current_object = cmds.listRelatives( current_object, parent = True, fullPath = True ) return None
If I understand the goal, then something like this might work.
from maya import cmds
cmds.listRelatives("|group1", type="nurbsCurve", allDescendents=True)
If there’s a nurbsCurve
on any path starting with |group1
, then this would return it.
Test scene
cmds.file(new=True, force=True)
circle = cmds.circle()
cube = cmds.polyCube()
cmds.select(circle + cube)
group = cmds.group()
found = cmds.listRelatives(group, type="nurbsCurve", allDescendents=True)
assert found[0] == cmds.listRelatives(circle[0], shapes=True)[0]
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/22cd722a-e097-4366-9791-f4afa7ab491a%40googlegroups.com.