Page 1 of 1

Selecting a different skeleton

Posted: Thu Feb 12, 2015 7:31 am
by GaryC
I'm trying to adapt a script that matches the movement two bones from the same skeleton, intending to change it so that the bones don't need to be in the same folder as each other, but could be in neighbouring switch folders instead and still have one affect the other. However the documentation doesn't seem to mention any way of targeting a skeleton layer/object or casting from a layer to a skeleton.

Does anyone know a way it can be done? I tried some possible method names but I kept being told they were null so I'm not sure what to check next.

Re: Selecting a different skeleton

Posted: Thu Feb 12, 2015 4:32 pm
by dkwroot
So, basically you're creating a bone rig in a child layer and you want to synchronize the bones across other child layers.

Code: Select all

SWITCH LAYER
   BONE LAYER A
   BONE LAYER B
   BONE LAYER C
My first question is "Why not just build the skeleton in the parent layer?" In other words, instead of building the skeleton in the Bone Layers, just make them in the switch.

I've already created a bone group tool that makes managing groups of bones easy so that should eliminate any clutter issues.

Re: Selecting a different skeleton

Posted: Fri Feb 13, 2015 1:18 am
by GaryC
Actually the structure is more like this:

Code: Select all

SWITCH LAYER A
   BONE LAYER A
   BONE LAYER B

SWITCH LAYER B
   BONE LAYER A
   BONE LAYER B
The idea is to have two versions of the one leg so that it can be both in front of and behind other layers and it's easy to toggle them from one to the other and they'll still match each others movements.

Re: Selecting a different skeleton

Posted: Fri Feb 13, 2015 1:35 am
by dkwroot

Code: Select all

CHARACTER BONE --PUT BONES HERE
   SWITCH LAYER A
      BONE LAYER A
      BONE LAYER B
   SWITCH LAYER B
      BONE LAYER A
      BONE LAYER B
Why not just put the bones in the top layer and control from there? If you try to implement unnecessary code, it'll just slow down your project file.

Re: Selecting a different skeleton

Posted: Fri Feb 13, 2015 7:34 am
by GaryC
Because of the way the character is designed there's a bunch of bones on that layer already. We do have a way of making it work with the original script and a compromise on the layer structure, it just seems odd that I can't find a way to make Anime Studio look at the bones of a layer I found by code.

Re: Selecting a different skeleton

Posted: Fri Feb 13, 2015 2:51 pm
by dkwroot
GaryC wrote:Because of the way the character is designed there's a bunch of bones on that layer already.
This is why I suggested bone groups. You can hide and reveal groups of bones at a time, solving the bone clutter issue.
GaryC wrote:We do have a way of making it work with the original script and a compromise on the layer structure,
You could just use layer sorting or depth sorting and avoid having duplicate layers lagging your project file.
GaryC wrote:it just seems odd that I can't find a way to make Anime Studio look at the bones of a layer I found by code.
You can, you just have to find a bone layer and then cycle through the bones to find the one you're searching for. You'll have to change the active layer though.

Code: Select all

moho:SetSelLayer(bonelayer)
moho:Skeleton():Bone(id)