Miscellaneous Forums > Scripting and Reverse Engineering

[FF8 steam]Character importer

<< < (7/7)

red_evilspirit:
I write script like this, is it right ?

--- Code: --- bs.seek(animofs, NOESEEK_ABS)
animCount = bs.readShort()
framCount = bs.readShort()
boneCount = bs.readShort()
coordinatesOffset = bs.readBytes(6)
gido = []
for i in range(0,boneCount):
byte1 = bs.readByte()
byte2 = bs.readByte()
byte3 = bs.readByte()
byte4 = bs.readByte()
rotation1 = (byte1 << 0x02) | ((byte4 & 0x03) << 0x0A)
rotation2 = (byte2 << 0x02) | ((byte4 & 0x0C) << 0x08)
rotation3 = (byte3 << 0x02) | ((byte4 & 0x30) << 0x06)
xyz = {
"x": rotation1,
"y": rotation2,
"z": rotation3
}
gido.append(xyz)

--- End code ---
when i dump 'xyz', all number is really big :(

Shunsq:
Hello red,
Sorry for the late reaction,
Your reading program is ok for chara.one file. The rotations are written on 12 bits, which give you a max angle of 4095 for each rotation.
For some reason blender understands that 4095 equals 180 degrees. That means  2048 is 90 deg and so on.
In my code i don't do any conversion to radians or degrees. I read the raw value and apply it to the bone rotations in pose mode.

On the contrary the data is different in the mch file.
The mch only contains the bone hierarchy, their length and a T pose.
I still have big issues to find a code that creates a good T pose for all characters.Today i extract 2 bytes for each rotations then i convert to degree, then to euler angles.

Just so you know, you don't need the T pose to anim the character. That means that even if the  T pose is a total mess, the bones will magically anim perfectly in posemode.

red_evilspirit:
I thought i can get T-pose with that code.
By the way, can you show me the structure of chara.one file?
Does it like http://wiki.ffrtt.ru/index.php/FF8/FileFormat_ONE

Navigation

[0] Message Index

[*] Previous page

Go to full version