Page 1 of 1

"add keyframe" for all channel

Posted: Wed May 23, 2007 2:07 pm
by maxuser
hellow all! i am new here.
when i need a new key? i click "add keyframe" for each channel.
Image
it is possible click it once for all channel, thanks for your time

Posted: Wed May 23, 2007 2:24 pm
by Genete
Yes it is possible.
I have one script that removes all the keyframes for the current frame (the oposite).
Search for "key all" in the Scripting forum and you w¡ll find it. The one I have was posted by Touched. Now I havoen't time to do it for you. :wink:
Genete

Posted: Thu May 24, 2007 12:43 am
by Víctor Paredes
what about this, my super request:
viewtopic.php?t=8380
(add a keyframe of the current tool with a button)
(a button which could have a shortcut...)

could someone invert touched's script?

Posted: Mon May 28, 2007 10:56 am
by Touched
My script was an inversion of the js_key_all script found here:
http://animatic.no-ip.com/pub/dev/moho/

Took me a while to find it again. Search wasn't showing any useful results. Google did a better job.

Maxuser managed to bring me back to the forum after an absence. :) The developments with DK's 3D rig sort of overwhelmed me. Now I need to catch up on what I missed.

Posted: Mon May 28, 2007 12:02 pm
by maxuser
Touched, thank you very much, i download this script, but may be i do something wrong, see image:

Image

there is no keys above layer translation
thank`s! and sorry if i disturb you :oops:

Posted: Mon May 28, 2007 12:11 pm
by Touched
Are there any shapes on the layer you're trying to keyframe in your test? It can't key the shape channels without there being some shapes to key.

That being said, there are 2 or 3 channels that the script doesn't affect, and I don't know the names of the variables in Anime Studio to modify the script to affect them. But I haven't had a need to key those channels anyway.

Also, if you intend the keys to interpolate, make sure you uncheck the box that says "step mode", which is enabled by default.

Posted: Mon May 28, 2007 12:53 pm
by maxuser
ok, you are wright, i find "keyskeleton" :!:
"keyskeleton"+"key all" is great and it is just what i want!
thank you! :D

Posted: Mon May 28, 2007 1:03 pm
by heyvern
there are 2 or 3 channels that the script doesn't affect, and I don't know the names of the variables in Anime Studio to modify the script to affect them.
Not that it's important. I'm just curious what those channels are?

-vern

Posted: Mon May 28, 2007 1:51 pm
by Touched
Hmm, bone dynamics, lock, and point curvature, I think are the only ones. Possibly line width too.

Posted: Tue May 29, 2007 12:10 pm
by keisern
Switch layer is also one of the channels that are missing. Would love to find that for my own script.

Posted: Tue May 29, 2007 12:50 pm
by Genete
keisern wrote:Switch layer is also one of the channels that are missing. Would love to find that for my own script.
How do you think it is possible to key a switch layer? Which value will you use? The last one in the time line? Next one?. IMHO keyframe a switch layer is not possible. Keyframe the layers inside the switch layer is other story.
-G

Posted: Tue May 29, 2007 1:25 pm
by heyvern
As far as I know bone dynamics don't even change when keyed. I tried before and never noticed a difference. I could be wrong.

I have tried and tried to key bone lock using a script to no avail. I believe it is "missing" from lua access in AS. I could read if it was on or off... but couldn't set it. It could be there was a different way to do it but I couldn't find it... and let me tell you... I know ALL the stuff about bones with scripting. ;)

That was the only thing in my bone slave script that absolutely wouldn't copy from one bone to another bone.

I haven't tried scripting any of the vector properties yet.

Thanks for satisfying my curiosity.

------------

Scripting switches is tricky but easy once you get the code to do it. I wrote a script that keys a switch based on bone rotation values so you can change a switch automatically without even touching it. I rotate a bone and it cycles through the switch layers in real time... pretty cool. Different bones can control different switches.

The trick is getting all the layer names. Unlike other group type layers in AS with lua, you can only set a switch layer based on the name not the layer ID. So you have to count all the layers in the switch first as if it were a regular bone or group layer, then get the names from the layer ID then switch back to treating as a switch layer and use the name to pick which one you want to set.

It's a bit of a pain but you only have to figure it out once. I guess I should post that script for you guys. I kind of forgot about it since I don't use switches very much these days.

-vern

Posted: Wed May 30, 2007 3:08 pm
by keisern
Genete wrote:
keisern wrote:Switch layer is also one of the channels that are missing. Would love to find that for my own script.
How do you think it is possible to key a switch layer? Which value will you use? The last one in the time line? Next one?. IMHO keyframe a switch layer is not possible. Keyframe the layers inside the switch layer is other story.
-G
I've done a script deleting/removing keyframes, that is why I need to know the switch channel name.

Posted: Wed May 30, 2007 7:21 pm
by heyvern
My script is a work in progress. I need to make it "universal". Right now it is targeted for a specific file while I do testing. This piece of code works pretty good.

Here is a portion of the code I use to handle switches:


In this first part I am checking a bone layer for any switch layers (testlayer). If there are any I create two variables, one that treats the layer as a group (group2) and one that treats it as a switch (subSwitch). There is some other stuff in there for my rotation/switching code.

Code: Select all

        for i = 0, layerCount - 1 do
            local testlayer = group:Layer(i)                
            if (testlayer:LayerType() == MOHO.LT_SWITCH) then
                group2 = moho:LayerAsGroup(testlayer)
                subSwitch = moho:LayerAsSwitch(testlayer)
                Lcount = group2:CountLayers()
                SWunits = 180 / Lcount
            end
        end
-------------------------------------

In this bit I create a local variable (swLayers) for each layer ID that is treating the switch as a group. You can't get layer ID's from a switch so I am getting the ID from it as just a "regular" group layer. That is why I created the two variables above. Each one is based on the same layer but they have different properties because they are referenced differently.

At the end is where the magic happens. After it determines the name of the switch sub layer (SWname) from the group layer ID (swLayers) it then sets a key for that switch layer using the name of the layer.

Code: Select all

        for b = 1, Lcount do 
            local swLayers = group2:Layer(b - 1)
            local swUnit = b * SWunits
            local SWname = swLayers:Name()
            if ( keySwitch ~= nil ) then
                if (keySwitch > swUnit) then
                    subSwitch:SwitchValues():SetValue(moho.frame, SWname)
                end
The basic concept is that a switch layer is also a group layer. Group layers have completely different properties than switch layers. Sometimes you need both so you have to change how they are referenced. The key is the code moho:LayerAsSwitch(testlayer) or moho:LayerAsGroup(testlayer).

That is how a switch layer can just be a regular old bone layer or turn into a magical switch layer. ;)

I learned all of this right here on the forum from many people and by looking at the scripts already available.

-vern

Posted: Wed May 30, 2007 8:33 pm
by human
Truth is, if scripts were carefully documented with comments, more of us could get involved in helping with them.

I'd love to help, but it would take too long to get up to speed if the scripts only contain pure code-and nomenclature hasn't been carefully thought out to be as clear as possible,