Hi,
I have a question about setting parent-children relation between objects when loading them from blender.
Currently we can load only selected layers of the blend file.
But one object can be a parent of the other which is in a different layer (the layer we do not load).
To show it in an example lets assume we have 4 objects: A, B, C and D.
A and B are in layer 1.
C and D are in layer 2.
A is a root object. B is its child. C is a child of B, and D is a child of C.
A → B → C → D
If we decide to load only layer 1, objects B and D will not be loaded.
Shall I attach object C to A then ??
Or maybe not attach it at all.
And we need to remember that object B can have some rotations that will affect C.
If the B is not loaded - they won’t be applied.
So maybe forcing transformations loading would be good.
It’s generally not difficult to implement any option
I just do not know which would be better so please give me a clue.
I don’t think layers should be linked to nodes… Its a different concept really thats not covered for simple import of models… Isn’t there a way to just export the data from visible layers? That must be saved somewhere in the blend file no?
That is exactly what I am doing. Exporting data from visible layers.
The problem is that the object on one layer may have his parent in a different layer.
So naturally its parent won’t be loaded and thus some relations may be lost.
I have an idea how to solve problem with lost transformations.
I’m just afraid that we will have problems with features like animations if they happen to be depended on objects not loaded to the scene.
I think you can go along the “visual” logic here. E.g. a skeleton is not visible but might be linked to a visible object (e.g. “Geometry”). Then it should be loaded. All visual objects on layers won’t be imported, they should be leafs in the tree anyway. If no visual object references the non-visual objects on hidden layers, they are not imported as well. Think thats possible?
What you can do is load all objects, but then hide (setCullHint) any models in non visible layers
I don’t think thats a good idea for the model loader.
Hiding objects will not be efficient.
Probably objects from layers not loaded will not be needed so there is no point in loading them.
I’d rather do as Normen suggested.
I will not load ‘nodes’ from invisible layers. I will load everything that is not visible.
And I will load invisible objects’ transforms so that they affect their loaded children.
The only question is: where shall I attach children whose parents were not imported?
In the example I gave you, if B is not loaded shall I attach C to A or to the root node?
Its kinda silly that blender allows hiding nodes and keeping visual children… But yeah, go along the “visual” theme there as well, so import the “hidden” node too, to keep the graph structure (and possibly avoid problems when the user moves the node to a visible layer.