I wouldn't be surprised if it's a derivative of the FMDL format, perhaps an earlier version.
That's what often happens with sdk formats.
Side note, I don't know if RTB fixed the reading into the future bone thing, but you can loop through all the bones first and save the bone data (name, parent, tfm) to a struct inside an array
and then after all the bones have been parsed you can do another bone loop and loop through the bone data you saved. That way you can parent bones to bones that would otherwise not exist yet. eg:
[spoiler]
[/spoiler]
That's what often happens with sdk formats.
Side note, I don't know if RTB fixed the reading into the future bone thing, but you can loop through all the bones first and save the bone data (name, parent, tfm) to a struct inside an array
and then after all the bones have been parsed you can do another bone loop and loop through the bone data you saved. That way you can parent bones to bones that would otherwise not exist yet. eg:
[spoiler]
Code:
struct BoneStruct
(
BoneParent,
BoneName,
BoneTFM
)
for b = 1 to BoneCount do
(
m11 = readfloat f; m12 = readfloat f; m13 = readfloat f
m21 = readfloat f; m22 = readfloat f; m23 = readfloat f
m31 = readfloat f; m32 = readfloat f; m33 = readfloat f
m41 = readfloat f; m42 = readfloat f; m43 = readfloat f
BoneParent = (readlong f) + BoneIndexStart
BoneFlag = readlong f -- Always 3? except for levels
BoneName = ("Bone"+((b + BoneIndexStart) as string))
print (BoneName+" BoneFlag = "+BoneFlag as string)
tfm = matrix3 [m11,m12,m13] [m21,m22,m23] [m31,m32,m33] [m41,m42,m43]
append BoneData_Array (BoneStruct BoneParent:BoneParent BoneName:BoneName BoneTFM:tfm)
)
for b = 1 to BoneData_Array.count do
(
if (getNodeByName BoneData_Array[b].BoneName) != undefined do (append Bone_Array (getNodeByName BoneData_Array[b].BoneName))
if ((BoneData_Array[b].BoneParent != -1) AND (BoneData_Array[b].BoneParent < b)) then ( BoneData_Array[b].BoneTFM = BoneData_Array[b].BoneTFM * Bone_Array[BoneData_Array[b].BoneParent+1].objecttransform )
else if ((b > 1) AND (BoneData_Array[b].BoneParent > -1)) do (print ("Bone named " + BoneData_Array[b].BoneName as string + " has a parent bone that doesn't exist yet!"))
newBone = bonesys.createbone \
BoneData_Array[b].BoneTFM.row4 \
(BoneData_Array[b].BoneTFM.row4 + 0.01 * (normalize BoneData_Array[b].BoneTFM.row1)) \
(normalize BoneData_Array[b].BoneTFM.row3)
newBone.name = BoneData_Array[b].BoneName
newBone.width = 0.01
newBone.height = 0.01
newBone.transform = BoneData_Array[b].BoneTFM
newBone.setBoneEnable false 0
newBone.wirecolor = yellow
newbone.showlinks = true
newBone.pos.controller = TCB_position ()
newBone.rotation.controller = TCB_rotation ()
if (BoneData_Array[b].BoneParent != -1) then newBone.parent = Bone_Array[(BoneData_Array[b].BoneParent+1)]
append Bone_Array newBone
)
