Search code examples
3dsmaxmaxscript

Getting (selecting) CAT Object for given bone with MaxScript


I have an CAT hierarchy and an selected bone: enter image description here

I want to select the CAT Object that is related to it (the "triangle" on screen).

I know I can go from given bone to root bone via parents this way:

local firstBoneName = (skinOps.GetBoneName (ePoly.modifiers[#skin]) 1 0)
local boneParent = getNodeByName firstBoneName 
while (boneParent.parent != undefined) do (
    boneParent = (boneParent.parent)
)

So now I have this (the root bone that has no parent): enter image description here

But I want to select this: enter image description here

How can I go from one to another?


Solution

  • This should work, when you already have the boneParent:

    root = for obj in (getClassInstances CATParent) where obj.rootHub.node == boneParent do exit with obj.node