Please help me to get bone from file has extension is BON

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Please help me to get bone from file has extension is BON

Post by yulgangvn »

Currently I use hex editor app to read file and can get bone hierarchy and bone matrix trasnform.How can I re-create it in blender by python

Or someone is worked with this format can help me?

this is sample file : https://1drv.ms/u/s!AtK3xgihMkhwhIVto_bKWfc6VTh33A
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

Matrix of the bone is relative to the armature , not to bone parent .

Blender importer for bon file (tested only with one file).

You need:
http://download.blender.org/release/Ble ... indows.exe
and
https://www.python.org/ftp/python/2.6.6 ... -2.6.6.msi

Unpack archive, doubleclick on file "Blender249.blend" , press alt+p in Blender Text Window and import .bon.


Code: Select all

def bonParser(filename,g):
   skeleton=Skeleton()
   skeleton.ARMATURESPACE=True
   skeleton.NICE=True
   
   boneCount=g.i(1)[0]
   boneNameList=[]
   for m in range(boneCount):
      bone=Bone()
      skeleton.boneList.append(bone)
      tm=g.tell()
      bone.name=g.find('\x00')
      boneNameList.append(bone.name)
      g.seek(tm+50)
      bone.parentName=g.find('\x00')
      g.seek(tm+100)
      bone.matrix=Matrix4x4(g.f(16))
      
   boneList=[]   
   for bone in skeleton.boneList:
      if bone.parentName not in boneNameList:
         parentBone=Bone()
         parentBone.name=bone.parentName
         parentBone.matrix=Matrix().resize4x4()
         boneList.append(parentBone)
   for bone in boneList:      
      skeleton.boneList.append(bone)
      
   skeleton.draw()   
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

Szkaradek123 wrote:Matrix of the bone is relative to the armature , not to bone parent .

Blender importer for bon file (tested only with one file).

You need:
http://download.blender.org/release/Ble ... indows.exe
and
https://www.python.org/ftp/python/2.6.6 ... -2.6.6.msi

Unpack archive, doubleclick on file "Blender249.blend" , press alt+p in Blender Text Window and import .bon.


Code: Select all

def bonParser(filename,g):
   skeleton=Skeleton()
   skeleton.ARMATURESPACE=True
   skeleton.NICE=True
   
   boneCount=g.i(1)[0]
   boneNameList=[]
   for m in range(boneCount):
      bone=Bone()
      skeleton.boneList.append(bone)
      tm=g.tell()
      bone.name=g.find('\x00')
      boneNameList.append(bone.name)
      g.seek(tm+50)
      bone.parentName=g.find('\x00')
      g.seek(tm+100)
      bone.matrix=Matrix4x4(g.f(16))
      
   boneList=[]   
   for bone in skeleton.boneList:
      if bone.parentName not in boneNameList:
         parentBone=Bone()
         parentBone.name=bone.parentName
         parentBone.matrix=Matrix().resize4x4()
         boneList.append(parentBone)
   for bone in boneList:      
      skeleton.boneList.append(bone)
      
   skeleton.draw()   


Thank you very much.. You save my life.Here is animation file: https://1drv.ms/u/s!AtK3xgihMkhwhIlUm_7FKujPWn-Jxg, could you help me get animation ?

P/s: I can't run script
CannotRunScript.PNG
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

As i wrote:


You need:
http://download.blender.org/release/Ble ... indows.exe
and
https://www.python.org/ftp/python/2.6.6 ... -2.6.6.msi


Unpack archive, doubleclick on file "Blender249.blend" , press alt+p in Blender Text Window and import .bon.

And "ani file" does not fit to "bon file".
"Ani" file has bone "Bip01 Neck1" which is not in bon file .

And i have problem with rotation keys. I don't know what type it is.

Rotation

Code: Select all

offset 3357   (11,)        ######## - key count
offset 3361   [0.0, 0.0] ######## - time
offset 3365   (-0.97588253021240234, -4.6065071046541561e-07, -0.21829633414745331, 3.1415913105010986) # radians ?????
offset 3381   [0.15625, 0.0]
offset 3385   (2.0031460934433198e-08, 1.0, 3.6694978167162162e-09, 0.029197974130511284)
offset 3401   [0.3125, 0.0]
offset 3405   (1.3139072940759888e-08, 1.0, 1.9584116550674935e-09, 0.037050992250442505)
offset 3421   [0.46875, 0.0]
offset 3425   (8.1481852376441566e-09, 1.0, 9.0176321965174111e-10, 0.039286412298679352)
offset 3441   [0.625, 0.0]
offset 3445   (1.8020564311882481e-06, 1.0, -4.6126743313834595e-07, 0.032986730337142944)
offset 3461   [0.78125, 0.0]
offset 3465   (-1.2346002442598092e-08, 1.0, -6.2354416074938968e-10, 0.014109005220234394)
offset 3481   [0.9375, 0.0]
offset 3485   (2.3728041469439631e-06, -1.0, 2.2426193027058616e-06, 0.013823917135596275)
offset 3501   [1.09375, 0.0]
offset 3505   (-2.4321852976072478e-08, -1.0, -1.7826937703802059e-09, 0.032507974654436111)
offset 3521   [1.25, 0.0]
offset 3525   (-2.3854214603602486e-08, -1.0, -2.612486005304504e-09, 0.039032895117998123)
offset 3541   [1.40625, 0.0]
offset 3545   (-2.524057585162609e-08, -1.0, -3.7381147066639642e-09, 0.03725004568696022)
offset 3561   [1.5625, 0.0]
offset 3565   (2.4400367237831233e-07, -1.0, 4.4598614579172136e-08, 0.030016295611858368)


Position

Code: Select all

offset 2493   (11,) ###### - key count
offset 2497   [0.0, 0.0] ###### - time
offset 2501   (-0.30377408862113953, 0.46636691689491272, 0.001073727267794311) ##### simple x,y,z
offset 2513   [0.15625, 0.0]
offset 2517   (-0.30355304479598999, 0.46636688709259033, -0.010900695808231831)
offset 2529   [0.3125, 0.0]
offset 2533   (-0.30270016193389893, 0.46636685729026794, -0.024829886853694916)
offset 2545   [0.46875, 0.0]
offset 2549   (-0.30129677057266235, 0.46636682748794556, -0.038024269044399261)
offset 2561   [0.625, 0.0]
offset 2565   (-0.29987254738807678, 0.46636679768562317, -0.047837965190410614)
offset 2577   [0.78125, 0.0]
offset 2581   (-0.29922506213188171, 0.46636679768562317, -0.051681872457265854)
offset 2593   [0.9375, 0.0]
offset 2597   (-0.29985949397087097, 0.46636679768562317, -0.047917898744344711)
offset 2609   [1.09375, 0.0]
offset 2613   (-0.30126595497131348, 0.46636682748794556, -0.038264472037553787)
offset 2625   [1.25, 0.0]
offset 2629   (-0.30266934633255005, 0.46636685729026794, -0.025192132219672203)
offset 2641   [1.40625, 0.0]
offset 2645   (-0.30354040861129761, 0.46636688709259033, -0.011223673820495605)
offset 2657   [1.5625, 0.0]
offset 2661   (-0.30377408862113953, 0.46636691689491272, 0.001073727267794311)



Here is full log
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

You are so pro..Can we make friend?
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

This is animation file I think it belong to the bone I posted : https://1drv.ms/u/s!AtK3xgihMkhwhIlV0tV3w3YfIO45Iw

Could we re-create animation in blender by python?
I made a tool to read out data like attachment image
Animation.PNG
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

Rotation is propably axis-angle type like:
https://www.andre-gaschler.com/rotationconverter/

I used this rotation type but still have no good result.

Can you tell me game name or paste link to game ?

Update:

Scion of Fate ?

http://forum.xentax.com/viewtopic.php?f=16&t=18833
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

Szkaradek123 wrote:Rotation is propably axis-angle type like:
https://www.andre-gaschler.com/rotationconverter/

I used this rotation type but still have no good result.

Can you tell me game name or paste link to game ?

Update:

Scion of Fate ?

http://forum.xentax.com/viewtopic.php?f=16&t=18833


Yes game is Scion Of Fate...

Could you try format X Z Y W ?, the float number read from binary is follow format X Z Y W..NOT X Y Z W

Beside, when I read data I see a matrix transform follow each bone, that matrix stand for what?..Is it object need to be posed before begin setup animation?

P/s: I still can not run ur script, I'm using blender 2.79
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

x,y,z,w is true only when:

x*x+y*y+z*z+w*w=1.0

i think we must digging in game files for information about connection between skin, bon and ani file names.

Why you are using Blender 279 when i wrote to you , you need to use Blender 249 ?
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

for "BoneN00002.bon" you need animation files with "00002" in name but not with "000002".



... Beside, when I read data I see a matrix transform follow each bone, that matrix stand for what?..Is it object need to be posed before begin setup animation?" ....

You're right . It is setup pose.
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

Szkaradek123 wrote:for "BoneN00002.bon" you need animation files with "00002" in name but not with "000002".



... Beside, when I read data I see a matrix transform follow each bone, that matrix stand for what?..Is it object need to be posed before begin setup animation?" ....

You're right . It is setup pose.


The ani files was named different with bone file...I think the ani I give you is match with Bone N00002 because number of bone in ani file is same with number of bone in BoneN00002(27 bones)...

Do you have any social account like Skype or facebook? We can make friend
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

Installed blender 249 and Python 2.6.. But cannot run script
CannotRunScript.PNG
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

I can't make animation with Blender.

Here is progress : (you can use files from "15410" folder)
- first import "bon" file
- in 3d Blender View select armature (RMB)
- if you have selected armature import than "skin" file
- last import "ani" file for setup pose (play animation for a while)
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

I still cannot runt script .. error is No module named newGameLib

Could you convert to Blender 279..I'm not familiar with 249
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

No i don't.
Blender 279 Api is diffrent.
Try copy "newgamelib" to folder where is "blender.exe"
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

I imported Ani but I just see bone change posture not include mesh
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

press button "play" for a while
yulgangvn
Posts: 21
Joined: Tue Jan 01, 2019 9:55 am

Re: Please help me to get bone from file has extension is BON

Post by yulgangvn »

All ani file which inlcuded in folder are sub-action of 1 animation or each file is seperate animation?
Szkaradek123
Posts: 124
Joined: Sat Aug 29, 2015 1:13 pm

Re: Please help me to get bone from file has extension is BON

Post by Szkaradek123 »

To know, you must to import animation .
Propably they are separate.