Alsair wrote:
As for the export handler, lets say I have a bsc converted to obj file, how would the obj file contain the same original bone name's? Since in order to convert it back to .bsc I would need that data as well.
Is there a reason it has to be .obj and not .fbx or .dae?
You could create an extra NoeBitStream() and write the bone data into that one. Then write the buffer from that stream into a file.
Here's an example of how I rewrote custom texture into the format of a dds. (not what I should have done back then, but ignore that.)
Code: Select all
def WriteFixedDDS(self):
file=NoeBitStream()
file.writeBytes(b"\x44\x44\x53\x20")
file.writeBytes(noePack("<1i",self.header['defaultSize']))
file.writeBytes(noePack("<1i",self.header['flags']))
file.writeBytes(noePack("<1i",self.header['height']))
file.writeBytes(noePack("<1i",self.header['width']))
file.writeBytes(noePack("<1i",self.header['linearSize']))
file.writeBytes(noePack("<1i",self.header['depth']))
file.writeBytes(noePack("<1i",self.header['mipmapCount']))
file.writeBytes(noePack("<11i",*self.header['reserved1']))
file.writeBytes(noePack("<1i",self.header['pixelFormat']['defaultSize']))
file.writeBytes(noePack("<1i",self.header['pixelFormat']['flags']))
if "DXT" in self.header['pixelFormat']['fourCC']:
file.writeBytes(b"\x44\x58\x54") #write "DXT"
file.writeBytes(struct.pack('b',48+int(self.header['pixelFormat']['fourCC'][-1]))) #write 1-5
else:
file.writeBytes(b"\x00\x00\x00\x00")
file.writeBytes(noePack("<1i",self.header['pixelFormat']['RGBBitCount']))
file.writeBytes(noePack("<1i",self.header['pixelFormat']['RBitMask']))
file.writeBytes(noePack("<1i",self.header['pixelFormat']['GBitMask']))
file.writeBytes(noePack("<1i",self.header['pixelFormat']['BBitMask']))
try:file.writeBytes(noePack("<1i",self.header['pixelFormat']['ABitMask']))
except: file.writeBytes(b"\x00\x00\x00\xFF")
file.writeBytes(noePack("<1i",self.header['caps1']))
file.writeBytes(noePack("<1i",self.header['caps2']))
file.writeBytes(noePack("<1i",self.header['caps3']))
file.writeBytes(noePack("<1i",self.header['caps4']))
file.writeBytes(noePack("<1i",self.header['reserved2']))
self.Images[0].reverse()
for l in range(self.Layers):
for m in range(self.header['mipmapCount']):
file.writeBytes(self.Images[l][m])
return file
with this function you could for example write that buffer to a file with:
Code: Select all
bitstream = WriteFixedDDS()# ignore the fact the function was part of a class
texture = open('texture.dds','wb')
texture.write(bitstream.getBuffer())
texture.close()
In inc_noesis.py you'll find: noePack = struct.pack
so for more info you can reference the struct module.
In order for this to work, in your export script(obj >bsc) you'll need to put a check where if the inputfile has extension .obj you open a prompt (ex: rapi.loadPairedFileOptional("Skeleton File","objskel") ) and read the skeleton from there or make it autoread it defined on whatever you wish.
That's how I would do it, not sure if it's the best method.