Scale bones on Y and X axis?

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Víctor Paredes
Site Admin
Posts: 5818
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

slice11217 wrote:I've done this, successfully, using a separate bone for width scaling that's independent of the length scale. I agree with Vern though, it would be much better to have it all encompassed in one bone.
how? do you wrote the script already?
slice11217
Posts: 279
Joined: Thu Mar 30, 2006 6:12 pm
Location: Verona, New Jersey

Post by slice11217 »

selgin wrote:how? do you wrote the script already?
No script, just add a bone to a parent bone and attach the desired points to it. Then scale it as needed. It's not the best in the world, but it is an effective workaround.
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

slice11217 wrote:
selgin wrote:how? do you wrote the script already?
No script, just add a bone to a parent bone and attach the desired points to it. Then scale it as needed. It's not the best in the world, but it is an effective workaround.
Yes, that is what I've done as well.

In my imaginary script the "second" bone "theoretically" wouldn't have any influence on points. The script would actually get the points controlled by the primary bone and scale the points. Since I haven't actually tried this yet I don't know exactly how well this would work.

The other problem is that the bone being "scaled" wouldn't actually scale on the X axis since AS doesn't support this. If it has child bones they wouldn't move as if the bone is scaling which could be a problem.

-----

Holy cow had another epiphany! When a bone is scaled "down" on the Y axis it gets "fat" by proportion. I might be able to calculate the LENGTH of the bone based on both scale percentages, scale the bone down/up and increase/decrease the length.

Let you know if I come up with anything.

-vern
User avatar
Víctor Paredes
Site Admin
Posts: 5818
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

vern, I was thinking in the bus and have an idea. what if you name some bones with an extension (.sca o whatever), and a layer script recognize them and when one of them is scaled, the script scale the points in x axis too, but inverted (I mean, if height increase, width decrease).

Is that possible?
ok, you hadn't much control over the x scale, but it would be enough useful for squash and stretch.
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

selgin wrote:vern, I was thinking in the bus and have an idea. what if you name some bones with an extension (.sca o whatever), and a layer script recognize them and when one of them is scaled, the script scale the points in x axis too, but inverted (I mean, if height increase, width decrease).

Is that possible?
ok, you hadn't much control over the x scale, but it would be enough useful for squash and stretch.
Yes that would be a piece of cake. Any time you base one value on the opposite or the same as another value it's easy to do. However, there is the issue of child bones. If you scale the X axis of points controlled by one bone it SHOULD push child bones "away" on the X just as it does with normal Y scaling.

That is the one little tricky part that might be an issue. I'll try to do a quick sample to test this out.

-vern
User avatar
Víctor Paredes
Site Admin
Posts: 5818
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

heyvern wrote:Yes that would be a piece of cake. Any time you base one value on the opposite or the same as another value it's easy to do. However, there is the issue of child bones. If you scale the X axis of points controlled by one bone it SHOULD push child bones "away" on the X just as it does with normal Y scaling.

That is the one little tricky part that might be an issue. I'll try to do a quick sample to test this out.
Vern :oops:... have you some new?
is it really possible?
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Been busy lately. Haven't had time for scripting. I am getting withdrawal symptoms so I might be jumping back in soon. This should be my first choice because it is fairly simple and could be very useful.

I still get frustrated with layer scripts... with only one per layer it's so limiting.

p.s.
The storm on Tuesday that suspended game 5 of the world series knocked down a tree in my back yard... which hit the neighbor's fence... and made a mess. A big dead tree. The tree split, half in my yard, half in the neighbors. Not much damage really but I will be out there with a chain saw for a little while. :(

-vern
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Well... I tried... but I can't figure out easily, how to select the points controlled by a bone. I can select the points if there is BINDING but I can't figure out the fPtMatrix in the script ref to determine which points are effected.

The fPtMatrix is the "grid" of influence of a bone over the points. This is the "matrix" that determines which points get moved by a bone based on region or flexible binding. Then you add in things like binding and points that are "released" and that just makes it more confusing.

I am pretty sure it can be done, but it's not as easy as I thought originally. I think what needs to be done is to duplicate and "rotate" that matrix as an "imaginary" extra bone and "add" that influence to the original bone. All the code is there. Adding, multiplying, subtracting of matrices is in the script interface. It's just a matter of figuring it out. I worked with AS/lua matrices while working with Genete on his 3D bone rig and also working on my bone group scripts and I did exactly what I described.

I hope those brain cells are still in there. I may have put them in the back somewhere when I started watching reruns of "The Love Boat" on the internet and needed more space.

;)

-vern
User avatar
Víctor Paredes
Site Admin
Posts: 5818
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

thank you vern for your efforts. I think that if this script could be done it would be a great feature, but seems to be nobody think so :(

if you have any idea, let me know. i'm not a scripter (i'm really wishing being it), but maybe could help.
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I haven't given up. It CAN be done... it's just not going to be "easy" like I thought. Working with matrices is really hard (for me. I am math challenged) so it takes a bit more effort to understand the concepts.

-vern
Post Reply