If this forum isnt for people to come in and ask questions, then what is it for? I
No thats not what im saying, im saying you just should say that its not apparent in your post that you did any deep introspection on the subject. Its should allways show that you have actually done some reasearch before you ask. It just doesnt show, i was just pointing that out to you.
Besides it woula actually be much more productive to talk about strategies with you instead of port this please.
Looking at the fullPathName, you would think that pathCount would return 5, not 1.
Well no thast not what its meant to do. I grant you his code doesnt make sense but thats just pseudocde wirtten in c form which I agree is bad. But that might also be acorruption on his side. Pseudocode shows the idea its not even supposed to work.
But yes his code is sortof smarter than nowayfra's tough he too didnt read the manual.
Instad of using pathCount() he should have used length() and offcourse write out the path.pop() an it would have worked So he was actually one step away form the right answer provided that you knew how to input a name to the api functions in first place.
Api code in python to show your mel codes spirit (port yourself back to c should be trivial):
import maya.OpenMaya as om
list = om.MSelectionList()
list.add("joint5")
list.add("joint2")
child = om.MDagPath()
list.getDagPath(0,child)
paren = om.MDagPath()
list.getDagPath(1,paren)
pathCnt = child.length()
print pathCnt
# never compare while (paren != child)
# or you might make a long loop that will fail by accident!
while (pathCnt > 0):
print child.fullPathName()
child.pop()
if paren==child:
break;
pathCnt -= 1
print child.fullPathName()
PS: its not entirely usefull to port mel to api because they dont overalp in function