I have a script where the user selects a vertex, and should store the name of the mesh that vertex belongs to.
However I'm unaware of a way to elegantly get that information. It's printed out nice, e.g. pPipe1.vtx[242]
. But getting just the pPipe1 transform node name doesn't seem super straightforward. Would rather not resort to cutting off characters in the string. That seems bad practice.
The ugly way is the easy way - if you string split the vertex entries on period you'll get the transform parents. However you can also pass vertex entries to
cmds.ls(o=True)
which strips off attribute and component names and returns only objects: