Page 1 of 1

New layer flipping layer script....

Posted: Sun May 06, 2007 9:21 am
by heyvern
Rasheed created a great layer script for flipping layers based on the location of two or more bones. It was a great solution for easily animating layer depth... changing order of layers for things like arms and legs etc.

However there were some problems with it and I have been wracking my brain trying to figure out a better solution.

I finally got it! This solution only places a key for the controlled layers on the first frame and works great. It works EXACTLY the same as Rasheed's original script.

Here is where it is located.

HV_FlipByBones
viewtopic.php?t=7842

-vern

Posted: Sun May 06, 2007 11:30 am
by Genete
Thank you again (like always) for share your development scripts.
I'm sorry but I don't notice any special change between Rasheed's version and yours. Maybe It is better for a heavy file (more bones) and with the example I cannot feel the difference.

You know that I'm not capable of understanding and modifying the scripts that you (and Rasheed) have created and, for that, I will be very happy if you can integrate this code to the rotatetrans code you did for me in another thread.
I'm sure that integrate the Rotateslaves function and the ControlledRBones into this flipby bones version can be possible. Also the way that now the script works now that only put a keyframe on the slaves when the master one have a keyframe will save a lot of computer CPU.

For my workflow (translate a bone using springy mechanisms) it could be a very big improvement to have flipbybones and rotatetrans together in the same embedded script.
A new feature that I will eternally thank to you.... :wink:

Thank you very much in advance.

Genete

Posted: Sun May 06, 2007 4:30 pm
by heyvern
Rasheed's script didn't work 100% correctly.

In my case it conflicted with the other code I'm using to rotate the arms and torso of my body rig.

It wasn't putting in key frames properly. It worked best by putting keys on every frame for the controlled layers.

This script works perfectly in all cases and only places one key frame.
No key frames are created at all beyond frame 1. The only reason Rasheed was forced to place keys in his version was due to the fact that you couldn't change a layer's translation without adding a key.

I found that if I change the layers translation at frame 1 dynamically it is almost identical to changing it on each frame but without a key. Sort of like cheating.

------
For my body rig I am using a combination of... rotatetrans... transrotate... flipbybones... all at the same time.

The arms and legs layers swap z positions as the body turns. The arms and legs also move based on several springy bone systems.

The tricky part is how the chest and back areas distort on the turn to left and right.

This area has to be able to change as it turns AND it also has to BEND. I can't use a standard body skeleton. The springy rigs have to be children of the bones in the spine to control side to side distortion AND still be able to bend the spine smoothly.

-vern

Posted: Sun May 06, 2007 10:14 pm
by Genete
So, could you share that rotatetrans-transrotate-flipbybones script with all the forum members?? :roll:

Posted: Mon May 07, 2007 2:17 am
by heyvern
I will when I get a chance to... put it back together so to speak. ;)

The problem at the moment with my combined "RotateTrans" and "TransRotate" script is that it is what I call a "targeted" script.

It has no checking or looping through bones at all. Everything is targeted to specific bones for the document. I use the actual bone IDs and eliminated a majority of unnecessary code.

To put this back together for universal use I would have to study both scripts and try to combine all the bone checking and variables. For my use I just hard coded the bone IDs and do specific things for each bone.

This saves me tons of time and effort. My version of the FlipByBones was simple to modify for general use since I just plugged in some replacement code for the actual functionality. The other scripts would have two things happening at once and would need some looking at to figure the best way to handle that.

When I get a chance I will see what I can do. The best idea would be to incorporate ALL these scripts into a utility script so they can be used at any time by calling them from a single layer script.

-vern

Posted: Mon May 07, 2007 6:03 am
by Genete
heyvern wrote:I will when I get a chance to... put it back together so to speak. ;)

The problem at the moment with my combined "RotateTrans" and "TransRotate" script is that it is what I call a "targeted" script.

It has no checking or looping through bones at all. Everything is targeted to specific bones for the document. I use the actual bone IDs and eliminated a majority of unnecessary code.

To put this back together for universal use I would have to study both scripts and try to combine all the bone checking and variables. For my use I just hard coded the bone IDs and do specific things for each bone.

This saves me tons of time and effort. My version of the FlipByBones was simple to modify for general use since I just plugged in some replacement code for the actual functionality. The other scripts would have two things happening at once and would need some looking at to figure the best way to handle that.

When I get a chance I will see what I can do. The best idea would be to incorporate ALL these scripts into a utility script so they can be used at any time by calling them from a single layer script.

-vern
But this is perfect!! A customized script is the one I'm searching for! I just change the code where the name of the bone is mentioned and that's all!!
I think it is stupid to loop through all the bone list if you really only need one or two bones.