How do I get the attached props from a parent?


https://forum.reallusion.com/Topic548695.aspx
Print Topic | Close Window

By Kelleytoons - Last Year
So... I thought I knew this, but apparently either I've forgotten or I've never known.

When I get an avatar I get ALL the mesh names of the clothing and even props attached to it with:
mesh_list = avatar.GetMeshNames()
but this does not work for a prop, which if it had attached children and I:
mesh_list = prop.GetMeshNames()
only gives me the parent props mesh names.

Is there no way to do this?  I searched the API (both 7 and 8) and found only mentions in passing of how they might have had some references to prop's children but no actual language on how to do it.
By Victor.Soupday - Last Year
I've been dealing with props recently for the datalink to Blender:

This is what I use to find all the attached lights, camera's, props, clothing, accessories and hair to an avatar or prop

attached = RScene.FindChildObjects(object,
                                    EObjectType_Light |
                                    EObjectType_Camera |
                                    EObjectType_Prop |
                                    EObjectType_Cloth |
                                    EObjectType_Accessory |
                                    EObjectType_Hair)

It seems to be recursive so it will also find sub props of sub props.

By Kelleytoons - Last Year
Thanks for replying, Victor, but that doesn't seem to be working for me (so I suspect I'm doing something wrong).

I'm calling it as:

prop_name = "Car Body"
other_props = RLPy.RScene.FindChildObjects(prop_name, RLPy.EObjectType_Prop)

but it throws an error in FindChildObjects, even though that prop exists and has lots of children.  Any clue as to what I'm not doing right?
By Victor.Soupday - Last Year
FindChildObjects is called with the prop object itself, not it's name. So it would be:

prop_name = "Car Body"
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, prop_name)
other_props = RLPy.RScene.FindChildObjects(prop, RLPy.EObjectType_Prop)

By Kelleytoons - Last Year
Thanks, Victor - I could have sworn I called it that way the first time (and when I couldn't get it to work I changed it to name) but apparently I did not for it all works now.