Smarter "Copy Current frame..."
Moderators: Víctor Paredes, Belgarath, slowtiger
- Víctor Paredes
- Site Admin
- Posts: 5765
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Smarter "Copy Current frame..."
Hi. Do you know if there's a script that works in a similar way to the "Copy current frame..." option in the Animation menu?
I need to copy a frame of a very complex character into another frame.
The menu feature works if I check the "Copy entire animation" option, but it's far to be ideal, since it adds keyframes for all the channels of all the layers. And that is a lot of channels in a lot of layers...
What I'm looking for is a script that would only create keyframes for channels that already have animation and ignore the rest.
Do you know if any script with a similar behavior?
Thank you very much.
I need to copy a frame of a very complex character into another frame.
The menu feature works if I check the "Copy entire animation" option, but it's far to be ideal, since it adds keyframes for all the channels of all the layers. And that is a lot of channels in a lot of layers...
What I'm looking for is a script that would only create keyframes for channels that already have animation and ignore the rest.
Do you know if any script with a similar behavior?
Thank you very much.
Moho Product Manager
Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
Re: Smarter "Copy Current frame..."
So, as I see it, a menu/button script that will open a dialog with just "From frame: __ to frame __", and by clicking OK will copy all animated channels for the selected layer(s) only, including all sub-layers, right?
I could try to make it, just not sure if I have enough time this upcoming weekend...
I could try to make it, just not sure if I have enough time this upcoming weekend...
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
- hayasidist
- Posts: 3700
- Joined: Wed Feb 16, 2011 8:12 pm
- Location: Kent, England
Re: Smarter "Copy Current frame..."
Since I've been working on channels recently I've got quite a few bits of code hanging around --- here's a snippet as a starter ... Only for Moho 12 or later
It gets the "all channels" channel for a layer and for every subchannel that is of non-zero duration sets a key at the target.
so you'll need to iterate over all layers (e.g. http://www.mohoscripting.com/index.php? ... ippet&id=1 ) and whatever UI you fancy..
It gets the "all channels" channel for a layer and for every subchannel that is of non-zero duration sets a key at the target.
Code: Select all
for j = 0, ctChannels-1 do
local chInfo = MOHO.MohoLayerChannel:new_local()
moho.layer:GetChannelInfo(j, chInfo)
local ch
local subChans = chInfo.subChannelCount
if chInfo.channelID == CHANNEL_LAYER_ALL then
for k = 0, subChans - 1 do
ch = moho.layer:Channel(j, k, moho.document)
local chDet
if ch:Duration() > 0 then
if ch:ChannelType() == MOHO.CHANNEL_BOOL then
chDet = moho:ChannelAsAnimBool(ch)
elseif ch:ChannelType() == MOHO.CHANNEL_COLOR then
chDet = moho:ChannelAsAnimColor(ch)
elseif ch:ChannelType() == MOHO.CHANNEL_STRING then
chDet = moho:ChannelAsAnimString(ch)
elseif ch:ChannelType() == MOHO.CHANNEL_VAL then
chDet = moho:ChannelAsAnimVal(ch)
elseif ch:ChannelType() == MOHO.CHANNEL_VEC2 then
chDet = moho:ChannelAsAnimVec2(ch)
elseif ch:ChannelType() == MOHO.CHANNEL_VEC3 then
chDet = moho:ChannelAsAnimVec3(ch)
end
local val = ch.value -- value at current frame (or use chDet:GetValue(inframe) )
chDet:SetValue(outframe, val)
end
end
end
end
- Víctor Paredes
- Site Admin
- Posts: 5765
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Re: Smarter "Copy Current frame..."
Yes, it's exactly that. Thank you very much for your message and I'm sorry i didn't answer you before.Stan wrote:So, as I see it, a menu/button script that will open a dialog with just "From frame: __ to frame __", and by clicking OK will copy all animated channels for the selected layer(s) only, including all sub-layers, right?
I could try to make it, just not sure if I have enough time this upcoming weekend...
Don't worry about writing the scripts (but huge thanks for the offer), we will see what can be done here.
It was I wasn't sure something similar was done in the past.
This is great. Thank you very much for the help! We will explore the idea.hayasidist wrote:Since I've been working on channels recently I've got quite a few bits of code hanging around --- here's a snippet as a starter ... Only for Moho 12 or later
Moho Product Manager
Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
Re: Smarter "Copy Current frame..."
Victor, if you just need the speed, there is a quick method MohoLayer:CopyFrame(fromFrame, toFrame, recursive). It copies every single channel, but does it very fast and easy.
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
Re: Smarter "Copy Current frame..."
Here is the tool that Stan mentioned above. It is our first collaboration.
http://revival.ru/test/ae_keytools.zip
To copy channel values go to source frame, press the COPY button, then go to target frame and press PASTE.
Keys will be created in animated channels only and in all the sub-layers if the "Child Layers" checkbox is checked.
It also can add new keyframes with ADD button using strange but useful logic (it is mainly for those animators who did not add keyframes before animating and found their previous animation destructed by new keyframes added later)
http://revival.ru/test/ae_keytools.zip
To copy channel values go to source frame, press the COPY button, then go to target frame and press PASTE.
Keys will be created in animated channels only and in all the sub-layers if the "Child Layers" checkbox is checked.
It also can add new keyframes with ADD button using strange but useful logic (it is mainly for those animators who did not add keyframes before animating and found their previous animation destructed by new keyframes added later)
- Víctor Paredes
- Site Admin
- Posts: 5765
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Re: Smarter "Copy Current frame..."
Thank you very much A.Evseeva!A.Evseeva wrote:Here is the tool that Stan mentioned above. It is our first collaboration.
http://revival.ru/test/ae_keytools.zip
I'm sorry I couldn't reply before. The script seems to be working perfectly and it's exactly what we needed.
Thank you very much again for your generosity.
Moho Product Manager
Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
Re: Smarter "Copy Current frame..."
Good info in this thread!
I actually needed something like this last night. Will give some of these suggestions a try soon.
I actually needed something like this last night. Will give some of these suggestions a try soon.
NEW! Visit our Little Green Dog Channel on YouTube!
D.R. Greenlaw
Artist/Partner - Little Green Dog
Little Green Dog on Vimeo | Greenlaw's Demo Reel 2020 Edtion
D.R. Greenlaw
Artist/Partner - Little Green Dog
Little Green Dog on Vimeo | Greenlaw's Demo Reel 2020 Edtion
- Víctor Paredes
- Site Admin
- Posts: 5765
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Re: Smarter "Copy Current frame..."
Hi, I just came to say I'm using this script a lot. Thanks again!
Moho Product Manager
Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
- Víctor Paredes
- Site Admin
- Posts: 5765
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Re: Smarter "Copy Current frame..."
Hi, I was wondering if there's a chance the copy/paste option of this script could work between different opened files.
Many times I need to use a pose of exactly the same character, but from a different file.
Do you know if that would be possible?
Thank you very much. And, again, this is script is fantastic. Currently I'm using it in every single scene I animate
Many times I need to use a pose of exactly the same character, but from a different file.
Do you know if that would be possible?
Thank you very much. And, again, this is script is fantastic. Currently I'm using it in every single scene I animate
Moho Product Manager
Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
Re: Smarter "Copy Current frame..."
It already can do this for selected layer. I will try to add this feature for sublayers. Possible problem is assigning sublayers one to another if layer order was changed.
Re: Smarter "Copy Current frame..."
Uploaded a new version which can copy-paste between open files including sublayers.
http://revival.ru/public_soft/lua/ae_keytools.zip
http://revival.ru/public_soft/lua/ae_keytools.zip
Re: Smarter "Copy Current frame..."
Brilliant! Thanks for sharing.A.Evseeva wrote:Uploaded a new version which can copy-paste between open files including sublayers.
http://revival.ru/public_soft/lua/ae_keytools.zip
- Víctor Paredes
- Site Admin
- Posts: 5765
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Re: Smarter "Copy Current frame..."
Thank you very much! I'm having some issues testing it in this project (but it's probably because these characters are very complex). I will try again when I get some timeA.Evseeva wrote:Uploaded a new version which can copy-paste between open files including sublayers.
http://revival.ru/public_soft/lua/ae_keytools.zip
Moho Product Manager
Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
Re: Smarter "Copy Current frame..."
Released a new version: http://revival.ru/public_soft/lua/moho_ ... l=keytools
new features:
- an option to select all the keys on all layers
- an option to exclude reference layers from this and other operations
- button to copy and paste key options (such as easy handles) from one key to another
new features:
- an option to select all the keys on all layers
- an option to exclude reference layers from this and other operations
- button to copy and paste key options (such as easy handles) from one key to another