Author Topic: Convert joints to bones(done)  (Read 10594 times)

EgyLynx

  • Enlightened One (+200)
  • *
  • Posts: 298
    • View Profile
Re: Convert joints to bones(done)
« Reply #45 on: September 19, 2016, 03:33:00 pm »
oh... nice, in deed...

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones(done)
« Reply #46 on: September 19, 2016, 08:21:28 pm »
Currently there  is no use. Well, just trying to find a way to make animations.
Maybe a modder can find it useful.

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones(done)
« Reply #47 on: September 20, 2016, 01:06:18 pm »
Just keep a note here. Warning: it is long and dry.





Here's how I did that (assume you know python or at least the basis of coding):

0. You need blender 2.49, I know it is old, but for now the script hasn't been updated for new versions.

1. Download the model rips from this topic.

2. Check this link for required files: https://drive.google.com/open?id=0B5GvuiubpnUZMTZGZmlySFJqSFU
   
import_ccpose.py is the script to import character poses. You need to edit a few lines.

Change the path below to where you extract your model rips. It should has a "Battle Models" folder, replace the path below to that on your disk.
Code: [Select]
    mdlroot = "D:\\Chrono\\CC Models\\Battle Models\\"
The lines below also need to change if you want to load a model which is not Serge.
Code: [Select]
    imptype = 'battle_model'
    ind = 0

When the script is done, the model you get is deformed, it is normal because we only need the skeleton, the mesh is there for you to have an general idea of how it looks.

Now you can pose the bones in pose mode and action editor, I will not talk about details here. If you check the action editor panel, you will see Serge has 28 animations (DefaultAction, DefaultAction.001, .... , DefaultAction.027), do not rename them.

Check the text editor, there should be 3 texts.
Text: empty, you can paste your script here
import_ccpose.py: the script you just ran
Animation Note: it contains a list, which is important later.

3. To export animations from the blend file, find anim_export_blender2.4.txt from the download link.

Replace the line has animFrames with the contents from Animation Note. The frames are just place holders, it tells the script how many frames each animation has, you can change the numbers to anything and it won't make a difference, as long as the lengths are correct.

Run it in blender, for example, copy and paste the text in the text editor, and run python script. Wait for it to complete, it depends on how good your computer is. On my old home pc, the window may freeze for a while, but on another computer, it finishes in about 1 seceond.

A new text is create if the script finished without errors. It is called Animations.

Note: if you want to copy content of the new text, you'd better click the wrap words button above the text editor panel. Because if you dont, the window will freeze because the line is too long, as far as I know, a good cpu makes little difference here.

4. Final step, edit anim_export_blender2.4.html
(Yeah I know, but I prefer javascript over python when writing complex things. )

Copy the content in the newly generated text Animations, and replace the first two lines of the javascript (namely, frm0 and animSet).

Now edit the line below:
Code: [Select]
pack_anim([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]);
The list contains the animations you want to pack, in this case, 0 to 21 are the animations in Serge's mdl file, when 22 to 27 are his attack animations. Preview the html in a web browser and you get the hex strings you can use in a hex editor.

For example, Serge.mdl stores its animations at 0x5228, copy the hex values and replace the contents behind that position.  For more information on animations, check the wiki page: https://www.chronocompendium.com/Term/Anim.html

Serge's animations are in a drp file. Seach for "0600000020000000" in the hex editor, that is where the animation data begin.