JK and MotS Editing >> Editing Tools >> Key "Converter"     (Moderator: Admins) Previous Topic | Next Topic
Page 1 of 1
 Author 
 Post 
Post 03-Aug-2006 17:36        

Right here I'm going to document my idea for a program that can generate key files from other key files, for a model of a different hierarchy. Here are the key points:

1. Convert animations for use with a different sized model. IE- give Yoda all kyles keys. No animating him from scratch!

2. Key merging: After applying the animation information to the new hierarchy, the keys are merged together, into one key that can handle both models. IE- the entry yo_rhand is given the same rotation info as k_rhand, and they are listed in the same key file. Viola, multi model supported keys.

Note that Hell_Raiser has already completed the first portion of this! It works quite well too. However, he never got to the merging part, so I'm putting it here if anyone wants to take a crack at it.

Ok, here's the technical info:

MESH NAME K_Hip
ENTRIES 8

# num:   frame:   flags:           x:           y:           z:           p:           y:           r:
#                                 dx:          dy:          dz:          dp:          dy:          dr:
   0:        0   0x0002  -0.00004620   0.00132850  -0.01027900 358.33435059 340.30004883   3.53612566
                          0.00000000   0.00000000   0.00000000   0.04208810  -0.39522010  -0.09138282
   1:        7   0x0002  -0.00004620   0.00132850  -0.01027900 358.62896729 337.53350830   2.89644599
                          0.00000000   0.00000000   0.00000000   0.03528214  -0.34541321  -0.08073643
   2:       15   0x0002  -0.00004620   0.00132850  -0.01027900 358.91122437 334.77020264   2.25055456
                          0.00000000   0.00000000   0.00000000   0.15553938  -0.39578685  -0.32150781
   3:       22   0x0002  -0.00004620   0.00132850  -0.01027900   0.00000000 331.99969482   0.00000000
                          0.00000000   0.00000000   0.00000000   0.20986007   0.16923523  -0.45383835
   4:       30   0x0002  -0.00004620   0.00132850  -0.01027900   1.67888057 333.35357666 356.36929321
                          0.00000000   0.00000000   0.00000000   0.00147748   0.18572126   0.00067139
   5:       37   0x0002  -0.00004620   0.00132850  -0.01027900   1.68922293 334.65362549 356.37399292
                          0.00000000   0.00000000   0.00000000  -0.12534526   0.59429061   0.25685775
   6:       44   0x0002  -0.00004620   0.00132850  -0.01027900   0.81180620 338.81365967 358.17199707
                          0.00000000   0.00000000   0.00000000  -0.15422058   0.52371979   0.34176636
   7:       52   0x0002  -0.00004620   0.00132850  -0.01027900 359.57803345 343.00341797   0.90611845
                          0.00000000   0.00000000   0.00000000  -0.17766899  -0.38619560   0.37571535


Here is a key entry. The last three entries in each line (p,y,r, dp,dy,dr) are our animation rotations. The x, y, and z entries are the pivot positions. (dx, dy, dz are best zeroed out)

To convert a key, we want to keep the animation rotations, but change the pivot points. Fortunately, the x,y,z values are stored in the 3do!

# num: flags: type: mesh: parent: child:  sibling:  numChildren: x:   y:  z:  pitch: yaw: roll: pivotx: pivoty: pivotz: hnodename:
 2:  0x0000 0x00010       10        0       8        -1             2   0.000004   0.001329  -0.017829   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000  k_hip


Here is the hip entry in the 3do hierchy. The XYZ position is right there, pretty handy

MERGING

Ideally, the program should be able open a 3do to obtain the new pivot info, Then the key you want to convert (or folder of keys) to read an entry with the same extension (yo_forearm, k_forearm) Create the new node entries listed at the bottom of the key, and finally update the NODES count at the top of the key.

[bah, code tags wrap , well you can always copy/paste it]
Post 04-Feb-2008 21:21        

Wow, I made this post two years ago.

And now ive programmed it myself

Well, almost anyway. All that's left is to make it read a directory of files and convert them all, right now it does it one at a time. Anyone know how to do this?

Hell Raiser, if you read this, how did key scaling work in your program? Right now, mine only scales one node, the torso, since it seems to be required. It works like:

3do1 position - 3do2 position = value

key torso position - value = new scaled entry

And the hip position remains the same.
Giraffe
Site Developer
Post 07-Feb-2008 12:49        

That would depend entirely on what language you've written the tool in. The basic idea is the same, however:

1) get a list of all filenames in a folder
2) loop over the list, converting a file on each iteration
Post 08-Feb-2008 15:36        

I've written it in C++

At the moments, ive hit a really annoying problem. I'm using FindFirstFile() and FindNextFile to loop through the files in the directory. Unfortunately, both of those retrieve the filename in type LPCSTR, and ifstream reads in type char. So I need to do some sort of conversion first.
Post 11-Feb-2008 18:55        

Nevermind, It took a few days, but I finally figured that one out.

The newest problem, is that the keys seems to be fine, but they wont work in JK. Level wont load when i use them. If I load them into puppet jedi and save them, they work.

The only difference appears to be the some of whitespace. I wrote a function that will separate the entries into perfectly alligned rows. I'm gonna test it tonight.
*** Post commands are unavailable for guests. ***