Page 1 of 2

Negative frames? Frames less than 0? They exist!

Posted: Tue Jul 15, 2008 10:35 pm
by heyvern
Very strange. I accidentally wrote some code that sends the time to frame -4.

That isn't the weird bit. The weird part is that it WORKED! the timeline frame marker "vanished" but the bone tools were working. I was able to rotate bones (it looked VERY strange) and advance frames using the arrow key (can't go back though). The only way to get to the negative frames is through a script. The negative value keys are real and stay. You just can't see them.

The negative frames are "reversed". So frame 0 is the "end" point. The negative frames move towards frame 0 as if it were a key frame.

The only benefit I can see of this is the bone offset tool. This tool works on negative frames exactly the same as frame 0... but... no bone envelopes. No bubbles around the bones. If you modify offset on negative frames it changes it on frame 0 as well.

This is like... bizarro world. Do you think Mike left in access to these mysterious frames on purpose? For some possible later feature?

-vern

Posted: Tue Jul 15, 2008 10:48 pm
by synthsin75
Mmm, might be able to store the poses for Genete's pose array script in these negative frames. :wink: :lol:

Will the timeline play right on through frame zero?

Posted: Tue Jul 15, 2008 11:12 pm
by heyvern
HOLY FREAKING COW!!!!!!

That's IT! The holy grail of variable storage in a FILE!! Use the negative key frames to store custom data!

The AS interface NEVER EVER EVER goes anywhere near those negative frames. The user would never have to worry about odd things happening because frame 0 overrides anything that happens on negative frames.

Custom data can be stored as key frame channels ON NEGATIVE FRAMES and read back in. Once you hit frame 0 any keys set before it go back to normal. You can access the key channels without going to the key frame.

HOLY FREAKING COW!

-vern

Posted: Tue Jul 15, 2008 11:33 pm
by synthsin75
Sounds very exciting, but I don't get it. Please explain it.

You can store custom variables as any keyframe in the file?!

How would that be used?

Posted: Wed Jul 16, 2008 12:06 am
by heyvern
The problem I have with a lot of my scripts is storing data that can be read back in the next time the file is opened. To do this I have to write a text file to the same folder as the AS file and then read it back in when the file is opened. This is a pain and it clutters everything up. It also means you have two or more files to keep track of.

I've been pestering Mike to allow for writing custom "user" data to the AS file format to store scripted information (like bone groups).

By having access to an UNLIMITED number of frames and channels that are basically "invisible" to the user I can store that custom data in the animation channels of any layer.

Each animation channel (rotation, translation, bone translation, point translation, etc etc) has it's values stored in a "table" in the AS file format as numeric or string values.

What I could do is store simple information in those channels on negative keys. When the AS file is opened it checks if there is a key on say, frame -1, if there is my script would know there is info stored there to be read in. Every layer has the EXACT SAME CHANNELS. All layers have the same basic animation channels, translation, rotation etc etc. This is where I can store the data. All files MUST have at least 1 layer. There is no option. I can always write the data to the first layer when the file is saved. If that layer gets deleted... uh... er... haven't thought this through yet. Probably it would keep the data in memory and just write it again to the first layers frames.

I've already tested this. Any animation done on a negative frame is "reset" on frame 0. Frame 0 automatically gets a key frame when the document is created so keys on negative frames just "animate" like normal key frames using frame 0 as the "next" key frame for interpolation.

Frame 0 will "erase" or "reset" all the data stored on negative key frames. Since the user can never see those negative frames it's all happening mysteriously in the background, hidden away.

-venr

Posted: Wed Jul 16, 2008 1:16 am
by synthsin75

Code: Select all

mesh
			[
				points 18
					[
						keys 1
							0 1 0.1 0.5 0.439266 -1.118996
					]
So in the table 'mesh={}' each index ([]) can store something other than the above information? Custom info can be written in the AS file here?

Posted: Wed Jul 16, 2008 4:51 am
by heyvern
No not "custom" information that is "different" it would still need to be numbers, or whatever type of info normally goes in that channel, like "true" or "false" for certain values like visibility, or similar things. The trick would be to write data to those channels that make sense to the script when read back in.

For example, the Action Commander. Where to save that info? If you have your own actions and want a list of key commands for them saved with the file, a script could save the number or "key" values for each sequential action to a channel. When read back in it would associate an action with a value.

Think of this... every "key" has a numeric value. All key boards have the same ascii code which is a numeric representation of that letter or character. It would be fairly simple to convert "letters" to numbers (this is built in to AS and lua. Converting characters to numbers and numbers to characters) and store the ACTUAL NAMES of actions in these negative key frames.

Right now there is no way to get the name of an action. But with this "trick" those names could be STORED IN THE FILE!!!

I'm digging this idea.

-vern

Posted: Wed Jul 16, 2008 5:08 am
by synthsin75
I don't know how hard the conversion may be, or what limit this method may have on stored info, but it sounds like you could potentially store anything at all. Sounds like you'd have to concat a lot of converted pieces to read it. Maybe some special argument to the 'io.read' function? Read it in as a table index? Sounds very promising. :wink:

Posted: Wed Jul 16, 2008 6:03 am
by heyvern
I've discovered that lua is FAST AS LIGHTENING working with strings! My goodness. It can load a lot of stuff into a string, convert it to a table... do all kinds of magic to it VERY FAST. Like... in a split second.

Most of the slow downs with scripting in AS have to do with AS itself.

In this case it would be fairly simple to create a function to covert strings back and forth into key values for channels. The tricky hard part will be figuring out exactly how this should be done.

Should it be all on one frame using multiple channels? Or should it be spread over many frames? fewer the frames the better. there should be a limit so you don't have to keep checking further an further back in the time line. Of course some value could be used to indicate how many keys are used to store the info.

I want to test this with my Action Commander first.

-vern

Posted: Wed Jul 16, 2008 7:20 am
by heyvern
Holy cow! Now I'm trippin'!

Using scripting ONLY I can set the START AND END FRAMES TO A NEGATIVE VALUE!

I have no idea what this could be used for... but wow. I feel like Alice through the looking glass. It's like entering a bizarre backwards alternate AS universe. I hit the play button and the frame counter runs "down" to zero in negative numbers and you can't see the frame marker. It's off to the left of the time line in "limbo".

-vern

Posted: Wed Jul 16, 2008 9:12 am
by rylleman
Sound like you have found something very useful here Heyvern!

Posted: Wed Jul 16, 2008 3:14 pm
by heyvern
I feel like Alexander Graham Bell. I successfully wrote a string of text into negative keys (rotation channel), then saved the file, closed it, opened it, and read it back out as a string. The concept works but it's still very rough.

For the historians, my famous first words transmitted by negative key frame channel values were:
"Eat my shorts"
;)

-vern

Posted: Wed Jul 16, 2008 9:52 pm
by synthsin75
:lol: :lol: That's hillarious!

Posted: Wed Jul 16, 2008 11:04 pm
by chucky
Yay! Bring on the " action commander" You should stick a flag in the ground in this Negativeland of yours Vern, and claim it for your fellow animators, unless of course there are any indigenous programmers hanging around in there. :roll:

Posted: Thu Jul 17, 2008 12:34 am
by heyvern
chucky wrote:ou should stick a flag in the ground in this Negativeland of yours Vern, and claim it for your fellow animators, unless of course there are any indigenous programmers hanging around in there. :roll:
No there aren't any programmers here... just a lof of socks... and old pens.

;)

There is of course the fear that Mike will "fix" this bug. That could prove to be disconcerting if I'm in "negativeland" when the looking glass is broken.

-vern