How to know top-level jit.anim.node?

TFL's icon

I was working on an abstraction that would need to know if a given jit.gl object has a jit.anim.node attached to it (either with a cord or @anim attribute), and if it has, which is its top-level one.

Turns out the answer is far more complicated than expected, because from my testings I found out that:

  • jit.world has two hidden, implicit levels of jit.anim.node (lets call them world_anim and its parent world_anim_master)

  • any jit.gl object with no user-created, explicitely linked jit.anim.node will have its own implicit jit.anim.node

  • any jit.anim.node with no explicitly linked parent jit.anim.node will be linked to the implicit world_anim

I made some fancy js code to programmatically determine what is the top-level user-created jit.anim.node for a given jit.gl object knowing that these implicit world_anim and world_anim_master exist. It works when the gl object has user-created anim.node attached to it, but sadly not if there is none, as I cannot guess if the name coming from its @anim attribute is the name of a user-created or implicitly created jit.anim.node.

That raises a few questions:

  • What are these implicit jit.anim.node made for? Speaking about the context-wide world_anim anc world_anim_master, but also the ones created for lonely jit.gl objects.

  • Can I make use of them (changing their attributes, using their functions) without breaking other features? Or is it safer to add my own jit.anim.node in-between?

  • What can I do to know if a jit.gl object has a user-created jit.anim.node connected to it, whether it is by patch cord or @anim attribute?

My hope is that the answer to that last question is not really important and I can use the implicitly created jit.anim.node for that jit.gl object, but it will depend on the answer from the second question.

Here's a patch demonstrating my investigations:

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon
  • What are these implicit jit.anim.node made for? Speaking about the context-wide world_anim anc world_anim_master, but also the ones created for lonely jit.gl objects.

implicit nodes handle transformations when no explicit node is bound. if an explicit node is bound the implicit node is removed from the hierarchy and ignored.

  • Can I make use of them (changing their attributes, using their functions) without breaking other features? Or is it safer to add my own jit.anim.node in-between?

Without knowing more details I would say for the most part yes, you can make use of them through jit.proxy, as long as you are not mucking about with the hierarchy (don't modify their anim attributes, probably not a good idea to modify their parent* or world* attributes, though querying any of those will be fine).

  • What can I do to know if a jit.gl object has a user-created jit.anim.node connected to it, whether it is by patch cord or @anim attribute?

My advice would be to name your explicit nodes using some naming convention that you can test for in your js, e.g. @name tfl_anim_01 or whatever.

Happy to dive deeper if you can provide more info on what your goals are.