Adapt my code from the archive to this:
alien = LoadAnimMesh("alien.b3d")
ent = alien
While ent
DebugLog EntityName(ent)
ent = NextChild(ent)
Wend
Function NextChild(ent)
If CountChildren(ent)>0
Return GetChild(ent,1)
EndIf
Local foundunused=False
Local foundent = 0, parent,sibling
While foundunused=False And ent<>0
parent = GetParent(ent)
If parent<>0
If CountChildren(parent)>1
If GetChild(parent,CountChildren(parent))<>ent
For siblingcnt = 1 To CountChildren(parent)
sibling = GetChild(parent,siblingcnt)
If sibling=ent
foundunused = True
foundent = GetChild(parent,siblingcnt+1)
EndIf
Next
EndIf
EndIf
EndIf
ent = parent
Wend
Return foundent
End Function There are other ways, but I like mine.
|