"add keyframe" for all channel

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
maxuser
Posts: 7
Joined: Wed May 23, 2007 1:46 pm

"add keyframe" for all channel

Post 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
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post 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
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post 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?
User avatar
Touched
Posts: 504
Joined: Mon Dec 11, 2006 7:33 am
Location: Sunny California
Contact:

Post 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.
maxuser
Posts: 7
Joined: Wed May 23, 2007 1:46 pm

Post 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:
User avatar
Touched
Posts: 504
Joined: Mon Dec 11, 2006 7:33 am
Location: Sunny California
Contact:

Post 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.
maxuser
Posts: 7
Joined: Wed May 23, 2007 1:46 pm

Post by maxuser »

ok, you are wright, i find "keyskeleton" :!:
"keyskeleton"+"key all" is great and it is just what i want!
thank you! :D
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post 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
User avatar
Touched
Posts: 504
Joined: Mon Dec 11, 2006 7:33 am
Location: Sunny California
Contact:

Post by Touched »

Hmm, bone dynamics, lock, and point curvature, I think are the only ones. Possibly line width too.
keisern
Posts: 38
Joined: Mon May 01, 2006 11:05 am
Location: Norway
Contact:

Post by keisern »

Switch layer is also one of the channels that are missing. Would love to find that for my own script.
Halvseint, animated talkshow on NRK
www.nrk.no/halvseint
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post 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
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post 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
keisern
Posts: 38
Joined: Mon May 01, 2006 11:05 am
Location: Norway
Contact:

Post 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.
Halvseint, animated talkshow on NRK
www.nrk.no/halvseint
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post 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
human
Posts: 688
Joined: Tue Jan 02, 2007 7:53 pm

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