How can I disable an animation track ( ex: The transalation)

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
atomix
Posts: 4
Joined: Fri Jan 20, 2012 9:11 pm

How can I disable an animation track ( ex: The transalation)

Post by atomix »

Hi all,

I'm new to AS and the forum.. and using AS8.

I really want to animate separate keyframe in one track at a time ( ex: I just want to see the ball move , not to change its color _) It's there any way I can do that? ( may be with scripting, did anyone do something similar..)

I search though the forum and found one topic , but seems like it didn't tell the solution yet...

viewtopic.php?t=12430&postdays=0&postorder=asc&start=0

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

Thought #1 : if I can't simply "disable" the keyframe of one track or even disable any keyframe at all in AS, I 've read somewhere

( exactly here: viewtopic.php?t=13935 )

what he did to save and modify the keyframes data is : he copy the keyframe to an invisible temporary track( or layer???)

Can you guys give me some advice, direction for doing such a request... I'm very appriciated that!!!

I'm not a Lua programer but a very strong Java programer so scripting will not be the hard part for me, I just want to ask if I could find an existing solution somewhere, or some direction ! Thank again!
User avatar
Víctor Paredes
Site Admin
Posts: 5815
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

I'm not sure if I understood, but try with this:
go to the program preferences and uncheck "consolidate timeline channels", that will let you look each channel with its own keyframes.
Image Image Image Image Image Image
Moho co-owner

Previously Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
atomix
Posts: 4
Joined: Fri Jan 20, 2012 9:11 pm

Post by atomix »

selgin wrote:I'm not sure if I understood, but try with this:
go to the program preferences and uncheck "consolidate timeline channels", that will let you look each channel with its own keyframes.
Oh, Sorry for my very bad English !

I 've already known that I can "see" separated animation track, what I'm asking is how to disable/enable those tracks ( ex: Layer Translation, Shape Color ...etc)

Any script's property of the Keyframe object let me disable a single keyfreme or a whole track ?

Thank for quick reply.
User avatar
Rai López
Posts: 2292
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

Hi there... If I've understood it well, I suppose that (in its most simple incarnation) the layer/embedded script could start to look like follows:

Code: Select all

function LayerScript(moho)
	if (moho.frame ~= 0) then
		local currentLayer = moho.layer
		local zeroTrans = currentLayer.fTranslation:GetValue(0)
		local zeroScale = currentLayer.fScale:GetValue(0)
		local zeroRotX = currentLayer.fRotationX:GetValue(0)
		local zeroRotY = currentLayer.fRotationY:GetValue(0)
		local zeroRotZ = currentLayer.fRotationZ:GetValue(0)

	--LAYER TRANSLATION CHANNEL:
		currentLayer.fTranslation.value.x = zeroTrans.x
		currentLayer.fTranslation.value.y = zeroTrans.y
		currentLayer.fTranslation.value.z = zeroTrans.z

	--LAYER SCALE CHANNEL:
		--currentLayer.fScale.value.x = zeroScale.x
		--currentLayer.fScale.value.y = zeroScale.y
		--currentLayer.fScale.value.z = zeroScale.z

	--LAYER ROTATION CHANNEL:
		--currentLayer.fRotationX.value = zeroRotX
		--currentLayer.fRotationY.value = zeroRotY
		--currentLayer.fRotationZ.value = zeroRotZ
	end
end
So the above uncommented lines representing layer translation channels would force layer to stay "freezed" at its zero frame position, meanwhile its entire channel keyframes remain unaltered and ready to act again as soon as the corresponding channel line of code be commented or the script entirely removed.

Well, that's for the main layer transform channels but I think any other layer channel could be added similarly; point or bone animation channels, however, would require some more work, like iterations, etc....

I have separated axis in order to allow a little more control, so you can play to comment (--) whatever you want to experiment with different results and get the rough idea. Of course this is the very basics (more concretely the very basics of "my" personal starting point) so not sure if other ways could be possible or even more advisable. Of course it could/should be developed to something more advanced and/or flexible, but... well that would require time xP
...
atomix
Posts: 4
Joined: Fri Jan 20, 2012 9:11 pm

Post by atomix »

Thank for your detail instrustion, really appriciate that!

Now I think I've get the idea, let me repeat once again:

1. Create a layer/embedded script

2. Let all the value of the current keyframe ( if ~=0 ) to be exatly equal to the value of frame "ZERO" in the current track.

3. Apply the script to the current layer??? ( is that right)

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

If I want to have a button in the timeline to toogle the layer, is it possible, or I should make an extra menu/toolbar like

viewtopic.php?t=16862

Anyway, thank so much for your advise
User avatar
Rai López
Posts: 2292
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

You're welcome :)

Well, that's basically the steps and behavior; the little trick here is to apply the frame 0 values (or whichever you want) at current frame "on the fly", I mean, not storing the value or affecting keyframes in any way, and fortunately that's precisely what that fWhatever kind of functions seems to do.

About to add a button or something so... well, only tool scripts can add buttons to the toolbar (in any case in Timeline), but if you try to use a tool script instead an embedded one for this matter, well, let's say that (in the hypothetical case it could be achieved) you'd start to move into the unofficial terrain and things would start to become much more complicated...

There is only one "official" (not sure if it could be considered like that) chance to add some UI controls to an embedded script, as you could start to study from :arrow: HERE but I think there is unresolved issues (I remember some "undo" problems, i.e.) and, anyway, I'm not totally sure if that would be useful for this particular case.

Well, besides that and as I still said, the solution could be much more complete and advanced (all you want or need indeed) cause precisely now ASP has much more and incredible ways to deal with animation channels than ever before (see "List Channel" menu script to get an idea). But the ways you can interact with embedded scripts are definitely limited, and you should make use of your imagination (using objects name to store customizable data, i.e.) or even some hacks to do the job (I always have wanted to study in deep the possibilities to stay some kind of tools and embedded scripts communication), but I think it's necessary to know very well how scripting interface and ASP works together and what are the "limits" to start with such a complicated stuff...


So... well, that was my thoughts and hope them help in some way,
Greetings & welcomed BTW :)
...
atomix
Posts: 4
Joined: Fri Jan 20, 2012 9:11 pm

Post by atomix »

This work definitely needs our imagination :p ...

Anyway, my thoughts about the function :

1. Make an toolbar script to toogle the "Frezze/Unfrezze Current Animation Track"

2. This tool script, then do one of below functions:

A) in the first attemp is just simply add/remove an embedded script named "FrezzeAniTrack" ...

-------(?) this solution will hurt because it also remove any other embedded script ( because there is only one embedded script for one layer, am I right? )

-------> but it's still quickest way I test out the function by now.

B) I still think of the other way:
to store animation track key frames in one "invisible-temp" layer - or may be an "in-memory" layer , and then I deal with naming the two layers and copy 'n paste work.

-------------------------------------------------------------
I will take a look at the "official" embedded UI and the "List Channel" script, may be I will find something useful. Thank in advance, you 're so kind! :p

==============================================

Edit: anyway, what make it so HARDDDDD to make a "embedded script" interact with a toolbar,

I saw that in the translate tool, when I move the cursor, the X, and Y parameter still stay the same until I realease the button... is that the evidence of
"we can't refresh the toolbar, just it refresh itself by asking a global var"

In other programing language (I came from java and C#) ... we just do:
onMouseMove(){
...
global.ui.toolbar.find("MyToolbar").setParam("X",mouse.X); ??
}

or something like that? Is it possible in AS scripting?
User avatar
Rai López
Posts: 2292
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

Hiii... Well, just in case someone still be interested, I've been working on this subject in a way which possibilities I always had wanted to explore since MC posted that "embedded UI" first approach; well, this is a simple way to interact with eScripts, and could be many and with much more possibilities... but, for this particular "Freeze Channels" case, this kind of control where there is no need to store data or settings can be more then enough. Just, a screen capture:
      • Image
Basically it consists in a simple (ridiculously simple indeed) tool acting like a button in order to have a handy way to call any available embedded script (eScript) dialogue window, and that's all. Once (correctly!) installed, this "Lost Fiddle Button" will appears in tools palette as soon as a layer with a compatible eScript be selected in layers palette, like, in this case, the "Freeze Channels" one. Here are both: Please, read the included "Readme" file for install instructions and in order to get a basic idea. And... well, keep in mind this is still a very rough and preliminary "proof of concept" that I've simply preferred to share before it falls into oblivion due to I'm not able to find the time to continue working on it right now... So well, handle with care! and all that stuff...


Greetings,
Ramón López.

PS: Yeah, atomix, I think that treat to get a "Toolbar" solution instead a "Dialogue" one for this cases can be much more complicated and, in someway, even limited (although I admit it would be coolest!); so I opted for the second one instead. Anyway, although maybe you be still aware, there is no such refresh/update limitation that you said, just try and have a look inside "lm_line_width.lua" tool to get an idea, it works differently as you suggested above (java & C#), but it's definitely possible (sorry for the delay about the info).
...
Post Reply