Selecting the MotionBuilder ActorBodyBone in python

Hello community,

I have a scene with only 2 FBActor,
Actor 1 LongName is Actor1:Actor 1
Actor 2 LongName is Actor2:Actor 2

(not very original I know)

The only way I was able to select the actorBodyBone by script was:

import pyfbsdk

foundComponents = pyfbsdk.FBComponentList()
includeNamespace = True
modelsOnly = False

pyfbsdk.FBFindObjectsByName("ActorBodyBone:Hips", foundComponents, includeNamespace, modelsOnly)

for comp in foundComponents:   
    print(comp.LongName)

And the result is

ActorBodyBone:Hips
ActorBodyBone:Hips

My question is how can I select one specific ActorBodyBone:Hips? is it me or it’s the only object in Mobu that don’t get itterated when multiple instance have the same name?

I try to look at .Children and .Parent, .PropertyList but I can’t find a way to get the Actor, markerset or anything linking the ActorBodyBone and the FBActor.

The reason I am looking into this is that I am trying to select the optical and the actorbodybone to scale both toguether to match a performer size. I can do it manually but in code, I can’t find how to do it.

Thanks a lot

-Marc

For future reference, we could just refer to the same index of the actor from scene as the index of the model PROVIDING nothing has changed their scene connection order.

hips = FBComponentList()
FBFindObjectsByLabelName("ActorBodyBone:Hips", comps)

my_hips = next((h for h in hips if h.Selected), None)

actor = FBSystem().Scene.Actors[list(hips).index(my_hips)]

This would be because objects are collected in the scene connection order which is established on creation.

Would be great to get a more reliable approach however.

1 Like

Thanks i’ll look into it