home *** CD-ROM | disk | FTP | other *** search
- if (heapSize < 20000000) then
- heapSize = 200000000
- gname = getOpenFileName \
- caption:"Open .fbx from Bones folder" \
- types:"Warframe_Bones (*.fbx)|*.fbx" \
- historyCategory:"WarframeObjectPresets"
- g = fopen gname "rb"
- fname = getOpenFileName \
- caption:"Open .fbx from Mesh folder" \
- types:"Warframe (*.fbx)|*.fbx" \
- historyCategory:"WarframeObjectPresets"
- f = fopen fname "rb"
-
-
-
- fn readHalfFloat fstream = (
- hf=readshort fstream #unsigned
- sign = bit.get hf 16
- exponent = (bit.shift (bit.and hf (bit.hexasint "7C00")) -10) as integer - 16
- fraction = bit.and hf (bit.hexasint "03FF")
- if sign==true then sign = 1 else sign = 0
- exponentF = exponent + 127
- outputAsFloat = bit.or (bit.or (bit.shift fraction 13) \
- (bit.shift exponentF 23)) (bit.shift sign 31)
- return bit.intasfloat outputasfloat*2
- )
-
- fn ReadFixedString bstream fixedLen =
- (
- local str = ""
- for i = 1 to fixedLen do
- (
- str += bit.intAsChar (ReadByte bstream #unsigned)
- )
- str
- )
-
- clearlistener()
-
- struct weight_data
- (
- boneids,weights
- )
- struct face_info_struct
- (
- FacePos,FaceCount
- )
- clearlistener()
-
- BoneNamesArray = #()
- BoneNamesArray1 = #()
- boneparent_array = #()
- UsedBoneCountArray = #()
- FaceArray = #()
- BNArr = #()
-
-
- fseek g 0x10 #seek_set
- skelCount = readlong g
- modelPathS = readlong g
- modelPath = ReadFixedString g modelPathS
- materialS = readlong g
- materialname = ReadFixedString g materialS
- fseek g 0x6f #seek_cur
- BoneCount = readlong g
- for a = 1 to BoneCount do (
- BoneNameSize = readlong g
- BoneName = ReadFixedString g BoneNameSize
- append BoneNamesArray BoneName
- )
- TotalFaces = readlong g
- UsedBones = readlong g
- NumVert = readlong g
- NumMorph = readlong g
- fseek g 0x4 #seek_cur
- parse = readlong g
- if parse!=2 then fseek g 0x3D #seek_cur
- if parse==2 then fseek g 0x5D #seek_cur
- BoneCount1 = readlong g
- for a = 1 to BoneCount1 do (
- BoneNameSize1 = readlong g
- BoneName1 = ReadFixedString g BoneNameSize1
- append BoneNamesArray1 BoneName1
- boneparent=readshort g
- boneId=readshort g
- append boneparent_array boneparent
- )
-
- fseek g 0xA2 #seek_cur
- MeshCount=readlong g
- for a = 1 to MeshCount do (
- fseek g 0x20 #seek_cur
- NameSize=readlong g
- meshname = ReadFixedString g NameSize
- FacePos=readlong g
- Lod_1=readlong g
- Lod_2=readlong g
- Lod_3=readlong g
- Lod_4=readlong g
- FaceCount=readlong g
- Lod_1_Count=readlong g
- Lod_2_Count=readlong g
- Lod_3_Count=readlong g
- Lod_4_Count=readlong g
- fseek g 0x34 #seek_cur
- append FaceArray (face_info_struct FacePos:FacePos FaceCount:FaceCount)
- )
-
- print FaceArray
-
- Print ("Last Read @ 0x"+((bit.intAsHex(ftell g))as string))
-
-
- BNArr = #()
- fseek f 0x2 #seek_set
- for a = 1 to BoneCount do (
- b11 = Readfloat f; b12 = Readfloat f; b13 = Readfloat f; b14 = Readfloat f
- b21 = Readfloat f; b22 = Readfloat f; b23 = Readfloat f; b24 = Readfloat f
- b31 = Readfloat f; b32 = Readfloat f; b33 = Readfloat f; b34 = Readfloat f
- b41 = Readfloat f; b42 = Readfloat f; b43 = Readfloat f; b44 = Readfloat f
- )
-
- Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
-
- BNArr1 = #()
- for a = 1 to BoneCount1 do ( --second bones section
- c11 = Readfloat f; c12 = Readfloat f; c13 = Readfloat f; c14 = Readfloat f*-1
- c21 = Readfloat f; c22 = Readfloat f; c23 = Readfloat f; c24 = Readfloat f
- c31 = Readfloat f; c32 = Readfloat f; c33 = Readfloat f; c34 = Readfloat f
- c41 = Readfloat f; c42 = Readfloat f; c43 = Readfloat f; c44 = Readfloat f
-
- tfm2 = (quat c11 c12 c13 c14) as matrix3
- tfm2.row4 = ([c21,c22,c23]*100)
- print tfm2
- if (boneparent_array[a] != 0) do (
- tfm2 = tfm2 * BNArr1[(boneparent_array[a] +1)].objecttransform
- )
-
- if (getNodeByName BoneNamesArray1[a]) != undefined do (
- append BNArr1 (getNodeByName BoneNamesArray1[a])
- )
- if (getNodeByName BoneNamesArray1[a]) == undefined do (
-
- newBone2 = bonesys.createbone \
- tfm2.row4 \
- (tfm2.row4 + 0.01 * (normalize tfm2.row1)) \
- (normalize tfm2.row3)
- newBone2.name = BoneNamesArray1[a]
- newBone2.width = 0.01
- newBone2.height = 0.01
- newBone2.transform = tfm2
- newBone2.setBoneEnable false 0
- newBone2.wirecolor = white
- newbone2.showlinks = true
- newBone2.pos.controller = TCB_position ()
- newBone2.rotation.controller = TCB_rotation ()
- if (boneparent_array[a] != -1) then
- newBone2.parent = BNArr1[(boneparent_array[a] + 1)]
- append BNArr1 newBone2
- )
- )
-
- Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
-
- fclose g
- fclose f