Selecting a different skeleton

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Selecting a different skeleton

Post 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.
dkwroot
Posts: 680
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Selecting a different skeleton

Post 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.
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Re: Selecting a different skeleton

Post 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.
dkwroot
Posts: 680
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Selecting a different skeleton

Post 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.
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Re: Selecting a different skeleton

Post 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.
dkwroot
Posts: 680
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Selecting a different skeleton

Post 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)
Post Reply