Scripting help

Hi:

Does anyone knows how to change the selection on a script?

I’m trying to make a script that copies some info from one layer to another, but the script lines
selection.addToSelection(node)
only adds the selection when the script ends, not when it is running.

Is there a way of refreshing the timeline selection list “on the fly”

Thanks in advance

Mauricio

I want to run trough the rig and it’s animation and save it module by module in several files, to do it I have to “change” selection “on the fly”. So I can use the createTemplateFromSelection to store the modules.
So I can paste it on another version of the rig using the module’s name, not it’s order on the timeline.

It may be better to contact support for this since this will get a bit complicated due to the databases keeping track of assets. I’m not sure that the existing scripting can do this interactively and doing a file-system copy/paste will not work because the software does not have a mechanism to re-read drawings while the software is running (for example if your script replaced one existing drawing with a different one of the same name).

I’m trying to do a script that pastes the animation into layers based on the layer’s name not it’s order.
This way you can copy animation from one rig to another even if the network does not exactly match.
This would be useful to reuse animation between different versions of the same rig.

The way it is today, If you drag a template from labrary to a rig that don’t quite match, ToonBoom does not allow the operation and if you try to copy/paste some animation from one rig to another rig that has any difference, ToonBoom will paste animation on wrong layers. because the paste is done by layer order on the timeline, not by layer name.
So from the layer that has a change and the layers below, the drawings, keyframes, etc… Are all scrambled up.

That’s what I’m trying to solve with this script.

You already have the ability to duplicate layers/elements and also a library to save selected parts of your network to. Remember that after you select something and make a template for it, there is actually a physical (template) folder for it in the library. Wouldn’t it be simpler to save templates and bring these into new scenes rather than scripting something for functionality that already exists in the software?

I’m perhaps not fully understanding what precisely you are intending or need.
Can you explain what it is you need to accomplish in more detail?

You can’t change selection interactively while the script is already running as far as I’m aware. Perhaps if you explain more what your script is attempting to achieve, there might be another solution.