For this my preference would be using PyMel doing something like this
import pymel.core as pm
selections = pm.ls(sl=True)
for node in set(selections):
allParents = node.getAllParents()
print allParents
Hope that helps!
On Thursday, September 13, 2018 at 1:21:24 PM UTC-7, yann19 wrote:
>
> Hi all,
>
> What is the best way that I can break apart and check all the nodes within
> a given node's full path?
> I am trying to check the list of nodes within the path, and should the
> node/path fulfills a certain node type, it will stop iterating and store
> that selection..
>
> So far I have tried the following:
> 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
>
> It seems to work for my cause but wondering if there is a better way to
> deal with this?
>
>
>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/59c307ec-ca68-42f0-861e-5b5b20caa890%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.