I looked at AceWell's edited script and tried to edit some lines in there to see if UVs work in my script, I'm really not sure I added them correctly or even wrote in the numbers where needed correctly.
Below is the script I have in progress:
Code: Select all
from inc_noesis import *
import noesis
import rapi
def registerNoesisTypes():
handle = noesis.register("Sudden Attack", ".ltb")
noesis.setHandlerTypeCheck(handle, noepyCheckType)
noesis.setHandlerLoadModel(handle, noepyLoadModel)
noesis.logPopup()
return 1
def noepyCheckType(data):
return 1
class ltb_format:
def __init__(self, data):
self.vertex_count = 0
self.face_count = 0
self.vertArray = []
self.faceArray = []
self.setUVs = []
def ReadFromFile(self, f):
f.seek(0xA9, NOESEEK_ABS)
self.vertex_count = f.readUInt()
self.face_count = f.readUInt()
self.vertArray = [ NoeVec3() ] * self.vertex_count
self.faceArray = [ 0 ] * (self.face_count * 3)
#vertBuff = f.readBytes(self.vertex_count * 0x44)
#rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 68, 0)
#rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 68, 20)
#rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 68, 36)
#faceBuff = f.readBytes(self.face_count * 2)
f.seek(0xCB, NOESEEK_ABS)
for i in range(0, self.vertex_count):
f.seek(0xCB + (i * 68)), NOESEEK_ABS
self.vertArray[i] = NoeVec3((f.readFloat(), f.readFloat(), f.readFloat()))
f.seek(0xCB + (self.vertex_count * 68), NOESEEK_ABS)
for i in range(0, self.face_count * 3):
self.faceArray[i] = f.readUShort()
print(f.tell())
def noepyLoadModel(data, mdlList):
ctx = rapi.rpgCreateContext()
f = NoeBitStream(data)
ltb = ltb_format(data)
ltb.ReadFromFile(f)
msh = NoeMesh ([], [], "mesh0", "mat0")
msh.setIndices(ltb.faceArray)
msh.setPositions(ltb.vertArray)
mdlList.append(NoeModel([msh], [], []))
return 1
I also have used hex2obj on these models before so I kind of know the basics of the files, I just don't know how to interpret that into a Noesis script.
I have uploaded two samples, hyuna_s1 is the file I began with for the script, chorong is a file that has multiple meshes. https://1drv.ms/u/s!AoEEkLgybKv7hEhbCrI5kXH75i13
I would also like to try and get bones/weights at some point but I don't want to get ahead of myself yet.
Thanks to anyone that helps.