Arfanu Posted July 12 Posted July 12 I triying to build readed skeleton to noesis but for some reason isnt working why? Can anyone check code and fix? fmt_fmlb (4) (1).py
Engineers Solution shak-otay Posted July 13 Engineers Solution Posted July 13 (edited) First: wrong sub forum! That's not a graphic's format problem. 2nd: So this is Durik's script which you seem to have patched wrongly? (Since Durik's script usually work like a charm...) --------------------------------- To get rid of this annoying "RuntimeError: Invalid type provided for bone matrix" I made these changes (without knowing what I did exactly): elif ntype == 10: bs.seek(80, NOESEEK_REL); trfm = NoeMat44.fromBytes(bs.readBytes(0x40)).toMat43() #trfm = NoeMat44.fromBytes(bs.readBytes(64)) bs.seek(80, NOESEEK_REL) print("trfm:", trfm) #bone = NoeBone(pidx, trfm, bonename) bone = NoeBone(len(bones), bonename, trfm, "dummy", -1) bones.append(bone) (Be sure to replace the string "dummy" by a parent bonename variable, btw.) Result: Edited July 13 by shak-otay 1
Arfanu Posted July 13 Author Posted July 13 Ok thanks the parent variable is pidx but dont worry i rename but thanks 1
Moderators ikskoks Posted July 13 Moderators Posted July 13 5 hours ago, shak-otay said: First: wrong sub forum! That's not a graphic's format problem. I moved this topic.
Engineers Durik256 Posted July 13 Engineers Posted July 13 (edited) I don't understand why you clone topics (and from different accounts). *( I already wrote to you that it is worth indicating the original author, even if you edit the original plugin) having the complete structure that I researched and provided to you, you still did it your way and incorrectly I made some minor edits (in reading nodes and creating bones), creating one model with a skeleton and meshes (and not all as separate models). Spoiler # edited plugin # orig researcher Durik256 # orig topic https://reshax.com/topic/959-looney-tunes-dash/?do=findComment&comment=4845 from inc_noesis import * def registerNoesisTypes(): handle = noesis.register("3d looney tunes dash", ".fmlb") noesis.setHandlerTypeCheck(handle, noepyCheckType) noesis.setHandlerLoadModel(handle, noepyLoadModel) noesis.logPopup() return 1 def noepyCheckType(data): bs = NoeBitStream(data) if noeAsciiFromBytes(bs.readBytes(4)) != '_FML': return 0 return 1 def noepyLoadModel(data, mdlList): bs = NoeBitStream(data) bs.seek(16) # _FML + ver? count = bs.readInt() data_offset = bs.readInt() unk = bs.readInt() bs.seek(20, NOESEEK_REL) # END> + 16bytes unk print("count:", count, "offset:", data_offset, "unk:", unk) skeletons = [] subMeshes = [] for x in range(count): type = bs.readUByte() bs.seek(11, NOESEEK_REL) name = searchString(bs) bs.seek(19 - len(name), NOESEEK_REL) bs.seek(44, NOESEEK_REL) offset = bs.readInt() + data_offset bs.seek(8, NOESEEK_REL) print("type", type, name, offset) if type == 102: skeletons.append(Skeleton(name, offset)) elif type == 107: subMeshes.append(SubMesh(name, offset)) mdl = NoeModel() #if not len(skeletons): # print("Dont have skeleton") # return 0 for skel in skeletons: bs.seek(skel.offset) print(bs.getOffset()) name = searchString(bs) bs.seek(63 - len(name), NOESEEK_REL) ndCount = bs.readInt() bs.seek(156, NOESEEK_REL) print(name, "ndcount:", ndCount) bones = [] for _ in range(ndCount): ntype = bs.readInt() bonename = bs.read(64).split(b'\x00')[0].decode()#searchString(bs) #bs.seek(63 - len(bonename), NOESEEK_REL) bs.seek(16 + 28 + 16 + 4, NOESEEK_REL) #+ 2 #pidx = bs.readShort() #tag = bs.readShort() #bs.seek(2 + 4, NOESEEK_REL) index = bs.readShort() dep = bs.readShort() strLen = bs.readShort() strLen2 = bs.readShort() unk = bs.readUInt() print("ntype:", ntype, "bonename:", bonename, "index:", index, "dep:", dep) if ntype == 1: #bs.seek(80 + tag, NOESEEK_REL) bs.seek(64 + 16 + strLen, 1) elif ntype == 2: #bs.seek(144, NOESEEK_REL) bs.seek(64 + 16 + 64, 1) elif ntype == 3: #bs.seek(208 + tag, NOESEEK_REL) bs.seek(64 + 144 + strLen, 1) elif ntype == 3: bs.seek(strLen, 1) elif ntype == 5: bs.seek(4, 1) ccou = bs.readInt() for _ in range(ccou): bs.seek(16, 1) elif ntype == 6: bs.seek(64+strLen2, 1) elif ntype == 7: bs.seek(strLen, 1) elif ntype == 8: bs.seek(strLen + 64 + 16 + 64, 1) elif ntype == 9: bs.seek(16+24, NOESEEK_REL) elif ntype == 10: bs.seek(80, NOESEEK_REL) trfm = NoeMat44.fromBytes(bs.readBytes(64)).toMat43() bs.seek(80, NOESEEK_REL) print("trfm:", trfm) #bone = NoeBone(pidx, trfm, bonename) bone = NoeBone(index, bonename, trfm) bones.append(bone) elif ntype == 12: bs.seek(strLen, 1) elif ntype == 13: bs.seek(64+64+4+4, 1) elif ntype == 14: bs.seek(strLen + 64+16, 1) if bones: #mdl = NoeModel() mdl.setBones(bones) #mdlList.append(mdl) #if not len(subMeshes): # print("Dont have mesh") # return 0 meshes = [] for sm in subMeshes: bs.seek(sm.offset) print(bs.getOffset()) name = searchString(bs) bs.seek(69 - len(name), NOESEEK_REL) iCount = bs.readInt() vCount = bs.readInt() unk1 = bs.readInt() unk2 = bs.readInt() bs.seek(126, NOESEEK_REL) print(name, "iCount", iCount, "vCount", vCount, unk1, unk2) indices = [bs.readUShort() for _ in range(iCount)] vert = [] if bs.readShort() != 0: bs.seek(-2, NOESEEK_REL) for _ in range(vCount): vert.append(NoeVec3.fromBytes(bs.readBytes(12))) mesh = NoeMesh(indices, vert, name)#, "mat_0") #mdl = NoeModel([mesh]) #mdlList.append(mdl) meshes.append(mesh) mdlList.append(mdl) mdl.setMeshes(meshes) print(bs.getOffset()) return 1 def searchString(bs): bytes = [] byte = None while byte != 0: byte = bs.readUByte() bytes.append(byte) return noeAsciiFromBytes(bytes) class SubMesh: def __init__(self, name, offset): self.name = name self.offset = offset class Skeleton: def __init__(self, name, offset): self.name = name self.offset = offset as I wrote earlier. the game has a text analogue of fmlb, in fml format. looking inside it you can understand the structure in more detail. for example, the parameter "dep" (which you removed in the plugin) is responsible for the depth of the node, on its basis you can specify the parents of the bones by building the correct hierarchy *(I think that's enough info for now. So this is the last message regarding fmlb.) Edited July 13 by Durik256
Arfanu Posted July 14 Author Posted July 14 Ok ok but you finally implemented support for skeletons and thats if suficient for the moment very thanks and i prommes this is the last post about fmlb files starting now every new request related to fmlb files i going to post here forever
Arfanu Posted July 14 Author Posted July 14 I can load skeletons but i have problems loading bone weights fmt_fmlb (3) (1).py
Engineers Durik256 Posted July 20 Engineers Posted July 20 (edited) On 7/14/2025 at 7:00 PM, Arfanu said: I can load skeletons but i have problems loading bone weights 1. you are constructing the skeleton hierarchy incorrectly 2.you constantly ignore the structure that I provided you (see message above). if you look into it, you will see that there are 4 bytes for indexes "wi-vec4(ubyte)" 3. the error says in plain text: "unwanted object". look in "inc_noeis.py" >> "class NoeVertWeight:" fast fix u code: (without checking for functionality) Spoiler bs.seek(idoffs) boneIndices = [[ #NoeVec3(( bs.readUByte(), bs.readUByte(), bs.readUByte() + bs.readUByte() * 0 # read and skip 4 indx #)) for _ in range(vCount) ] for _ in range(vCount) ] print(boneIndices) bs.seek(woffs) boneWeights = [[ #NoeVec3(( bs.readHalfFloat(), bs.readHalfFloat(), bs.readHalfFloat() #)) for _ in range(vCount) ] for _ in range(vCount) ] #combine indices and weights NoeVertWeightList = [] for x in range(vCount): NoeVertWeightList.append(NoeVertWeight(boneIndices[x], boneWeights[x])) *(and you need to build a bone map for bone indices) Edited July 20 by Durik256 1
Engineers shak-otay Posted July 20 Engineers Posted July 20 (edited) @Durik256: without you, we would be lost. Thanks for your support and patience! btw, I saw two lines elif ntype == 3: in your fmlb code. Shouldn't the 2nd one compare to '4'? Edited July 20 by shak-otay 1
Engineers Durik256 Posted July 21 Engineers Posted July 21 13 hours ago, shak-otay said: in your fmlb code. Shouldn't the 2nd one compare to '4'? yes you are right, it is a mistake) but these are quick edits of the topic author's code, that is, not the final version, he should have written his code based on this, and noticed what you noticed
Arfanu Posted July 23 Author Posted July 23 Here is the updated script (uncompleted) by #Durik256,every updated or news can be sended in this post fmt_fmlb.zip
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now