Replies: 1 comment
-
|
So you're wanting to use the descriptions associated with parts of the model to create the parts data structure. It seems like a nice goal if it can be realized. It is actually crucial to the functionality of attachables that the attachable object itself is a separate child from the children. In other words, the model of It should be easy to add parts to descriptions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
An attachable component calls
attachableand ensures that the first child is the render module and the second child calls the children of the component.The
attachable()module then uses pure magic to position the shape with a proper transformation, sets up the variables, and calls child(0) to render the shape. After this, it sets the given geometry as the current geometry and calls the remaining children.Recently Adrian introduced parts. Parts are descriptors for a part of a component. Children of the component can get these descriptors by name and make them current with
attach_part(name). The archetypal example is the "inside" of a tube. This is very useful when you build components that consists of other components.For example, I have the following composite that consists of 3 other components.
However, I need to synchronize the part definitions with the render functions. Worse, the offsets that are so wonderfully calculated by
attach()during render I must now repeat without support.I wonder if we could rearrange attachable like this:
Being to call the children while the stack contains all the context would simplify (I think) a lot of things. It would save an enormous amount of redundancy and make attachable much more attractive to use.
The only missing sore is that the attachable still needs the geometry so I still have to calculate the bounding box. However, since attachable needs to position child 0, it seems inevitable.
I might be missing something (again) that makes it impossible but I think it would clean up my code a lot. Actually, it would make me basically turn every component into an attachable!
And when I am here ... a minor issues. When your restore a descriptor, the parts are no longer there. It would be convenient if the parts were connected to the descriptor. So if you restore a descriptor, the parts of that descriptor are current.
Beta Was this translation helpful? Give feedback.
All reactions