[SOLVED] Get certain attribute of all script instances currently running

I wrote an animation controller, that will be attached to each animated model in a later stage of the project. The number of animated models will vary. One mode of the controller is sequential play of all animations. For that, the controller has a play position attribute. How can I get all these attributes to check which is the highest one at runtime?

Cheers, Patrick

I just found the solution myself. In case anyone has a similar issue:

Return an array of all animated models:

this.animatedModels = this.app.root.find(function(node) {
        return node.animation;
    });

Get each position attribute from the returned array:

this.animatedModels.forEach(function(animation) {
        console.log(animation.animation.entity.script.animationController.position);
    });

Then you can push the attributes onto another array and get max/min values or sort it.

1 Like