SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SHIII Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=195)
-   -   [WIP] Silent Animator (https://www.subsim.com/radioroom/showthread.php?t=120316)

TheDarkWraith 08-13-07 12:19 AM

[WIP] Silent Animator
 
I was having trouble resizing the flag in my flag mod and seeing the animations so after some time of hammering out where the animations were, their size, how many keyframes, timing, etc. I wrote a little app to import/export each keyframe of the animations to view. This app also lets you adust the base mesh vertices and the timing of the individual keyframes. It's still a WIP and I have to finish the import/export of the keyframes still. I also need to find a way of converting to/from integers to Float32 in Visual Basic, can anyone give me some pointers here?
You first load in the .obj file from a previous Pack3D export. You then open up the .dat file containing the animations and the app takes the ID from the .obj file and searches for the type A/5 node containing this ID as the parent ID in the .dat file. It then determines the animation ID from this and deciphers the type 6/0 node with the animation ID and stores all the timings and keyframes data.
Soon to be coded will be the exporting/importing ability of the keyframes. What I intend to do is you pick a keyframe and push the export button and it writes a .obj file with this keyframe data. You then edit this .obj in Wings3D or whatever and when you're finished you import it back into the app. Currently the app lists the number of keyframes found only.
The timings code is already complete except for conversions from Integer to Float32 and back (currently all values are in Integer format). You can view and edit all the timing information found for that ID.
The app also contains a running history block so that you can view everything that has taken place in case you need to make corrections. You have the ability to save this history file.

Here's a screenie of it so far:


http://static.filefront.com/images/p...asoyildugv.jpg

Racerboy :|\\

wildchild 08-13-07 01:03 AM

not bad hope it works for you:know:

JScones 08-13-07 03:42 AM

Quote:

Originally Posted by Racerboy
I also need to find a way of converting to/from integers to Float32 in Visual Basic, can anyone give me some pointers here?

Type conversion is a very fundamental part of programming, in any language. A quick google will tell you all you need to know, let alone looking at your VB help file. However, on the assumption that this tool will be helpful to other modellers, here's something to get you started:

In VB6 and VB .NET:
float (or any numeric type, boolean, string or object) to integer: intval = CInt(fltval)
integer (or any numeric type, boolean, string or object) to float32: sngval = CSng(intval)

Alternatively for better performance in VB .NET (but to the detriment of locale setting consideration, albeit not an issue here):
float to integer: intval = [System.]Convert.ToInt32(fltval)
integer to float32: sngval = [System.]Convert.ToSingle(intval)

You can now search your VB help file for other conversion keywords/methods.

Of course, converting a float to an integer and then back to a float again will give you a different result to what you started with.

Also, VB will implicitly convert from integer to float, but avoid this. It's sloppy coding and one of many things that sets VB apart from other more "strongly typed" languages. Always use Option Explicit and Option Strict to minimise variable/object related errors arising from typos and conversions.

TheDarkWraith 08-14-07 12:22 AM

ok all, this IS HUGE!!! I got the export function complete in Silent Animator and was able to extract all 25 keyframes that make the flag animate!! :rock: :rock: :rock: They were extracted from the DAT file. Here is a screenshot showing what all 25 animation frames look like. They go in order from left to right (1-25):

http://static.filefront.com/images/p...fxjbetbbzl.jpg

A BIG thanks to JScones for giving me a little info and pointers for the stump I was in. :up:
Does anyone realize what the potential of this is???? We should be able to create/modify animations now.
I have to code the import function for this yet but I'm amazed myself at what this app can do that I have created - it actually worked :doh:

Racerboy :|\\

Hunter 08-14-07 01:41 AM

Is it possible to do something with animation of the trap container?

ref 08-14-07 06:50 AM

Quote:

Originally Posted by Racerboy
ok all, this IS HUGE!!! I got the export function complete in Silent Animator and was able to extract all 25 keyframes that make the flag animate!! :rock: :rock: :rock:

Very good work Racerboy :up: , now we are talking...

Ref

TheDarkWraith 08-14-07 08:51 AM

Quote:

Originally Posted by Hunter
Is it possible to do something with animation of the trap container?

What DAT file is it located in? I'll extract it and see what the animation frames look like and post a screenie.

TheDarkWraith 08-14-07 09:20 AM

There's one missing piece to the puzzle and a couple of assumptions that I made that I would like to run by everyone in the hopes that someone has the answer. Given this:

06 00 00 00 00 00 00 00 7E 2A 00 00 B1 D7 95 73
7E 24 7B 01
00 00 00 00 00 00 00 00 05 00 19 00
00 00 00 00 00 00 AB AA AA 3D 01 00


06 00 00 00 00 00 00 00 = Type 6/0 node (animation)
7E 2A 00 00 = size of this node
B1 D7 95 73 7E 24 7B 01 = Node ID
00 00 00 00 00 00 00 00 = 3D Model ID
05 00 = ??????? ( I haven't figured this missing piece of the puzzle out :damn: )
19 00 = Number of Timings (I'm assuming this is a 2 byte value and not 4 because of next)
00 00 00 00 = Float value for Timing #0x0 (I'm assuming this is Timing #0)
00 = Tag for Timing #0x0
00 = Seperation byte between timings
AB AA AA 3D = Float value for Timing #0x1
01 = Tag for Timing #0x1
00 = Seperation byte between timings
and it repeats the above 4 until Timing #0x18 which shows:

AB AA 02 40 17 00 00 00 08 40 18 00 19 00 00 00
D2 00 00 00 3B C5 EC 36 DA FE A0 3D 7F 7F 7F 7F
FE 7F

AB AA 02 40 = Float value for Timing #0x17
17 = Tag for Timing #0x17
00 = Seperation byte between timings
00 00 08 40 = Float value for Timing #0x18 (since zero based from my assumption above this is the last timing value)
18 = Tag for Timing #0x18 (last timing value)
00 = Seperation byte between timings
19 00 00 00 = Number of KeyFrames
D2 00 00 00 = KeyFrame size

And then the rest of the hex deals with the hard coded animation keyframes. I just need to figure out this last remaining piece of the puzzle to decode this entire 6/0 node. I'm hoping someone has the answer or can figure it out ;)

mkubani 08-14-07 09:31 AM

Sounds good! Good luck!!!

VipertheSniper 08-14-07 01:02 PM

Quote:

Originally Posted by Racerboy
There's one missing piece to the puzzle and a couple of assumptions that I made that I would like to run by everyone in the hopes that someone has the answer. Given this:

06 00 00 00 00 00 00 00 7E 2A 00 00 B1 D7 95 73
7E 24 7B 01
00 00 00 00 00 00 00 00 05 00 19 00
00 00 00 00 00 00 AB AA AA 3D 01 00


06 00 00 00 00 00 00 00 = Type 6/0 node (animation)
7E 2A 00 00 = size of this node
B1 D7 95 73 7E 24 7B 01 = Node ID
00 00 00 00 00 00 00 00 = 3D Model ID
05 00 = ??????? ( I haven't figured this missing piece of the puzzle out :damn: )
19 00 = Number of Timings (I'm assuming this is a 2 byte value and not 4 because of next)
00 00 00 00 = Float value for Timing #0x0 (I'm assuming this is Timing #0)
00 = Tag for Timing #0x0
00 = Seperation byte between timings
AB AA AA 3D = Float value for Timing #0x1
01 = Tag for Timing #0x1
00 = Seperation byte between timings
and it repeats the above 4 until Timing #0x18 which shows:

AB AA 02 40 17 00 00 00 08 40 18 00 19 00 00 00
D2 00 00 00 3B C5 EC 36 DA FE A0 3D 7F 7F 7F 7F
FE 7F

AB AA 02 40 = Float value for Timing #0x17
17 = Tag for Timing #0x17
00 = Seperation byte between timings
00 00 08 40 = Float value for Timing #0x18 (since zero based from my assumption above this is the last timing value)
18 = Tag for Timing #0x18 (last timing value)
00 = Seperation byte between timings
19 00 00 00 = Number of KeyFrames
D2 00 00 00 = KeyFrame size

And then the rest of the hex deals with the hard coded animation keyframes. I just need to figure out this last remaining piece of the puzzle to decode this entire 6/0 node. I'm hoping someone has the answer or can figure it out ;)

This just a guess, as I've absolutely no modding experience whatsoever, but is the animation speed determined through any of those values? If not maybe those magenta colored numbers set the animation speed?

TheDarkWraith 08-14-07 01:21 PM

The animation speed through the KeyFrames is determined by each KeyFrame's timing value. That is the xx xx xx xx float value followed by the xx timing number followed by the 00 seperation byte.
That 05 00 still has me stumped....:damn:

ref 08-14-07 01:35 PM

Quote:

Originally Posted by Racerboy
00 = Tag for Timing #0x0
00 = Seperation byte between timings

I think that you can probably join those two instead of two 1 byte values use a word (two byte integer) for the keyframe number.

How did you convert the word values of the vertices that follow to floats ?

Ref

TheDarkWraith 08-14-07 01:50 PM

Quote:

Originally Posted by ref
Quote:

Originally Posted by Racerboy
00 = Tag for Timing #0x0
00 = Seperation byte between timings

I think that you can probably join those two instead of two 1 byte values use a word (two byte integer) for the keyframe number.

How did you convert the word values of the vertices that follow to floats ?

Ref

Ref,

You are probably correct, the designers may have given the Timing Tags two bytes. I'll change Silent Animator to look for two bytes for the Timing Tags.
At the start of each keyframe there are two floats. The first float is the scale value, the second float is the offset value. What follows them are the vertices: two bytes for vertice x, two bytes for vertice y, and two bytes for vertice z. This is repeated for x amount of vertices.
I'll use vertice x as an example:

take the two bytes for vertice x and convert them to an UInt16 value
Multiply this by the float value of the first float in the keyframe
add the second float value of the keyframe to this
you now have the float32 value for this vertice

now do this for all the axis's of the vertices, for every vertice in that keyframe, then for every keyframe for that node. Hence why I made Silent Animator :yep:

Racerboy :|\\

ref 08-14-07 03:05 PM

Thanks for the tip, that's a very good catch, I've looked at the animations a long time ago, but never had the time to investigate in deep due to the amount of work with GWX.

Ref

Anvart 08-14-07 04:50 PM

Quote:

Originally Posted by Racerboy
The animation speed through the KeyFrames is determined by each KeyFrame's timing value. That is the xx xx xx xx float value followed by the xx timing number followed by the 00 seperation byte.
That 05 00 still has me stumped....:damn: http://img172.imageshack.us/img172/4669/hahalz9.gif

Animation type ...


All times are GMT -5. The time now is 09:39 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.