Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

Is it possible to obtain node by its name? #1977

Closed jmeli496 closed 6 years ago

jmeli496 commented 6 years ago

I have a model created in Blender consisting of multiple named nodes (e.g "Top_Part", "Glass", "Whatever01"). I am exporting this model to FBX and then loading it to GVRSceneObject using AssetLoader.loadModel. I would like to be able to access specific node by its name (which was set in the Blender). I tried using the GVRSceneObject.getName() (in combination with iterating through all the children) to achieve this but it returns an empty string.

Is it possible to obtain a specific node by its name?

Thanks for the help.

dsazulay commented 6 years ago

Try using the method getSceneObjectByName

GVRSceneObject obj = context.getAssetLoader().loadModel("model.fbx"); obj.getSceneObjectByName("name");

jmeli496 commented 6 years ago

Thank you very much. It worked. I guess my problem was that each child of the root object contains one more child which is the node I am trying to find. I have one more question though. Why are those empty nodes (that only contains another single node) even present? Are they useful in any way?

Nevertheless, Thank You! You saved my day.

liaxim commented 6 years ago

@jmeli496 I believe those extra nodes are introduced by assimp - the asset import library we use to read in FBXs (https://github.com/assimp/assimp).

liaxim commented 6 years ago

@jmeli496 Do you have other questions? Can we close this issue if not?