def load_single_model(data, mdlList):
    '''Loads a single model. For testing purposes'''
    
    if rapi.checkFileExt(rapi.getInputName(), ".mbn"):
        bs = NoeBitStream(data)
        idstring = bs.readUInt()
        numFiles = bs.readUInt()
        bs.read('2L')
        filesizes = []
        for i in range(numFiles):
            unk, size, crc, null = bs.read('4L')
            filesizes.append(size)
            
        for i in range(numFiles):
            size = filesizes[i]
            mdl = bs.readBytes(size)
            parser = mdl_parser(mdl)
            parser.parse_file()
            mdl = rapi.rpgConstructModel()
            mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
            mdlList.append(mdl)            
        
    elif rapi.checkFileExt(rapi.getInputName(), ".mdl"):
        parser = mdl_parser(data)
        parser.parse_file()
        mdl = rapi.rpgConstructModel()
        mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
        mdlList.append(mdl)
Exemplo n.º 2
0
def load_single_model(data, mdlList):
    '''Loads a single model. For testing purposes'''

    if rapi.checkFileExt(rapi.getInputName(), ".mbn"):
        bs = NoeBitStream(data)
        idstring = bs.readUInt()
        numFiles = bs.readUInt()
        bs.read('2L')
        filesizes = []
        for i in range(numFiles):
            unk, size, crc, null = bs.read('4L')
            filesizes.append(size)

        for i in range(numFiles):
            size = filesizes[i]
            mdl = bs.readBytes(size)
            parser = mdl_parser(mdl)
            parser.parse_file()
            mdl = rapi.rpgConstructModel()
            mdl.setModelMaterials(
                NoeModelMaterials(parser.texList, parser.matList))
            mdlList.append(mdl)

    elif rapi.checkFileExt(rapi.getInputName(), ".mdl"):
        parser = mdl_parser(data)
        parser.parse_file()
        mdl = rapi.rpgConstructModel()
        mdl.setModelMaterials(NoeModelMaterials(parser.texList,
                                                parser.matList))
        mdlList.append(mdl)
def noepyLoadModel(data, mdlList):
   ctx = rapi.rpgCreateContext()
   parser = Teatime_ODF(data)
   parser.parse_file()
   mdl = rapi.rpgConstructModel()
   mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
   mdlList.append(mdl)
   
   mdl2 = rapi.rpgConstructModel()
   mdlList.append(mdl2)
   return 1
def load_all_models(mdlList):
    '''Load all models'''

    #carry over from previous models
    matList = []
    texList = []
    
    ##load face
    #facePath = "E:\\My Documents\\Workspace\\sample\\Age of Wushu\\g_face.xmod"
    #f = open(facePath, 'rb')
    #data2 = f.read()
    #parser = AgeOfWushu_XMOD(data2)
    #parser.parse_file()
    #material = NoeMaterial("g_face", "E:\\My Documents\\Workspace\\sample\\Age of Wushu\\g_face_1.dds")
    #matList.append(material)
    
    #load the outfit
    
    dirPath = rapi.getDirForFilePath(rapi.getInputName())
    fileList = [file for file in os.listdir(dirPath) if file.lower().endswith(".xmod")]    
    for file in fileList:
        f = open(dirPath + file, 'rb')
        data2 = f.read()
        parser = AgeOfWushu_XMOD(data2)
        parser.parse_file()
        matList.extend(parser.matList)
        texList.extend(parser.texList)
        mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdlList.append(mdl)    
 def parse(self):
     
     self.data.seek(4,1)
     self.numModel   = self.data.readUInt()
     self.data.seek(43,0)
     self.SkipChunk()
     self.data.seek(10,1)
     self.numMesh    = self.data.readUInt()
     
     for i in range (self.numMesh):
         self.data.seek(9,1)
         self.data.readBytes(self.data.readUByte())
         self.data.seek(23,1)
         self.data.readBytes(self.data.readUByte())
         self.Vertices()
         self.Triangles()
         self.DrawCall()
         self.data.seek(5,1)
     self.BoneMap()
     self.ReadAnimations()
     self.ReadBones()
     
     self.ReadMaterials()
     
     self.CreateModel()
     
     mdl = rapi.rpgConstructModel()
     mdl.setBones(self.boneList)
     mdl.setModelMaterials(NoeModelMaterials(self.texList, self.matList))
     self.mdl = mdl
     return
Exemplo n.º 6
0
    def parse(self):

        self.data.seek(4, 1)
        self.numModel = self.data.readUInt()
        self.data.seek(43, 0)
        self.SkipChunk()
        self.data.seek(10, 1)
        self.numMesh = self.data.readUInt()

        for i in range(self.numMesh):
            self.data.seek(9, 1)
            self.data.readBytes(self.data.readUByte())
            self.data.seek(23, 1)
            self.data.readBytes(self.data.readUByte())
            self.Vertices()
            self.Triangles()
            self.DrawCall()
            self.data.seek(5, 1)
        self.BoneMap()
        self.ReadAnimations()
        self.ReadBones()

        self.ReadMaterials()

        self.CreateModel()

        mdl = rapi.rpgConstructModel()
        mdl.setBones(self.boneList)
        mdl.setModelMaterials(NoeModelMaterials(self.texList, self.matList))
        self.mdl = mdl
        return
Exemplo n.º 7
0
def load_all_models(mdlList):
    '''Load all models in the selected model's directory'''

    #carry over from previous models
    matList = []
    texList = []
    boneList = []

    dirPath = rapi.getDirForFilePath(rapi.getInputName())
    fileList = [
        file for file in os.listdir(dirPath) if file.lower().endswith(".xac")
    ]
    for filename in fileList:
        f = open(dirPath + filename, 'rb')
        data2 = f.read()
        parser = SanaeParser(data2)
        parser.parse_file(filename)
        matList.extend(parser.matList)
        texList.extend(parser.texList)
        boneList.extend(parser.boneList)
        mdl = rapi.rpgConstructModel()

    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdl.setBones(boneList)
    mdlList.append(mdl)
Exemplo n.º 8
0
def load_all_models(mdlList):
    '''Load all models'''

    #carry over from previous models
    matList = []
    texList = []

    dirPath = rapi.getDirForFilePath(rapi.getInputName())
    fileList = [
        file for file in os.listdir(dirPath) if file.lower().endswith(".msh")
    ]
    for file in fileList:
        f = open(dirPath + file, 'rb')
        data2 = f.read()
        modelType = get_type(data2)
        if modelType == 0:
            parser = SanaeParser(data2)
        else:
            parser = RFParser(data2)
        parser.parse_file()
        matList.extend(parser.matList)
        texList.extend(parser.texList)
        mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdlList.append(mdl)
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    

    parser = SanaeParser(data)
    parser.parse_file()
    ctx = rapi.rpgCreateContext()
    
    for i in range(len(parser.vertBuffs)):
        
        vertBuff, numVerts = parser.vertBuffs[i]
        idxBuff, numIdx, matNum = parser.idxBuffs[i]
        matList = [parser.matList[matNum]]
        texList = [parser.texList[matNum]]
        matName = matList[0].name
        
        rapi.rpgReset()
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)        
        rapi.rpgSetMaterial(matName)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)    
        
        
        mdl = rapi.rpgConstructModel()
        
        mdl.setModelMaterials(NoeModelMaterials(texList, matList))
        mdl.setBones(parser.boneList)
        mdl.setAnims(parser.animList)
        mdlList.append(mdl)
    return 1
def load_all_models(mdlList):
    '''Load all models'''

    #carry over from previous models
    matList = []
    texList = []
    
    ##load face
    #facePath = "E:\\My Documents\\Workspace\\sample\\Age of Wushu\\g_face.xmod"
    #f = open(facePath, 'rb')
    #data2 = f.read()
    #parser = AgeOfWushu_XMOD(data2)
    #parser.parse_file()
    #material = NoeMaterial("g_face", "E:\\My Documents\\Workspace\\sample\\Age of Wushu\\g_face_1.dds")
    #matList.append(material)
    
    #load the outfit
    
    dirPath = rapi.getDirForFilePath(rapi.getInputName())
    fileList = [file for file in os.listdir(dirPath) if file.lower().endswith(".xmod")]    
    for file in fileList:
        f = open(dirPath + file, 'rb')
        data2 = f.read()
        parser = AgeOfWushu_XMOD(data2)
        parser.parse_file()
        matList.extend(parser.matList)
        texList.extend(parser.texList)
        mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdlList.append(mdl)    
Exemplo n.º 11
0
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    
    ctx = rapi.rpgCreateContext()
    filename = rapi.getLocalFileName(rapi.getInputName())
    fileID = ''.join(c for c in filename if c.isdigit())    
    bs = NoeBitStream(data)
    idstring = bs.readUInt()
    idstring2 = bs.readUInt()
    
    if idstring == 1213416781: #MESH
        if idstring2 == 1:
            parser = StaticParser1(data)
        elif idstring2 == 2:
            parser = StaticParser2(data)
    else:
        parser = SanaeParser(data)
    print(idstring)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    
    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    
    #build meshes
    for pose in parser.vertGroups.keys():
        print(pose, len(parser.vertGroups[pose]))
    vertBuffs = parser.vertGroups["walk"]
    for i in range(len(vertBuffs)):
        idxBuff, numIdx, matNum = parser.idxBuffs[i%len(parser.idxBuffs)]
        vertBuff = vertBuffs[i]
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
        
        matName = parser.matList[matNum].name
        rapi.rpgSetMaterial(matName)
        rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)    
    
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''

    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()

    #build meshes
    for pose in parser.vertGroups.keys():
        print(pose, len(parser.vertGroups[pose]))
    vertBuffs = parser.vertGroups["walk"]
    for i in range(len(vertBuffs)):
        idxBuff, numIdx, matNum = parser.idxBuffs[i % len(parser.idxBuffs)]
        vertBuff = vertBuffs[i]
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)

        matName = parser.matList[matNum].name
        rapi.rpgSetMaterial(matName)
        rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx,
                                noesis.RPGEO_TRIANGLE, 1)

    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''

    parser = SanaeParser(data)
    parser.parse_file()
    ctx = rapi.rpgCreateContext()

    for i in range(len(parser.vertBuffs)):

        vertBuff, numVerts = parser.vertBuffs[i]
        idxBuff, numIdx, matNum = parser.idxBuffs[i]
        matList = [parser.matList[matNum]]
        texList = [parser.texList[matNum]]
        matName = matList[0].name

        rapi.rpgReset()
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
        rapi.rpgSetMaterial(matName)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx,
                                noesis.RPGEO_TRIANGLE, 1)

        mdl = rapi.rpgConstructModel()

        mdl.setModelMaterials(NoeModelMaterials(texList, matList))
        mdl.setBones(parser.boneList)
        mdl.setAnims(parser.animList)
        mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    parser = TouhouSkyArena_MDL(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data,mdlList):
    ctx = rapi.rpgCreateContext()
    model = P3D(data)
    
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(model.texList, model.matList))
    mdlList.append(mdl)
    return 1
Exemplo n.º 17
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    model = P3D(data)

    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(model.texList, model.matList))
    mdlList.append(mdl)
    return 1
def load_single_model(data, mdlList):
    '''Loads a single model. For testing purposes'''
    
    parser = SanaeParser(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)       
Exemplo n.º 19
0
def load_single_model(data, mdlList):
    '''Loads a single model. For testing purposes'''

    parser = SanaeParser(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
Exemplo n.º 20
0
def load_single_model(data, mdlList):
    '''Loads a single model. For testing purposes'''
    
    filename, ext = os.path.splitext(rapi.getLocalFileName(rapi.getInputName()))
    parser = SanaeParser(data)
    parser.parse_file(filename)
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)       
def load_single_model(data, mdlList):
    '''Loads a single model. For testing purposes'''
    
    filename, ext = os.path.splitext(rapi.getLocalFileName(rapi.getInputName()))
    parser = SanaeParser(data)
    parser.parse_file(filename)
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)       
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    parser = Illusion_XX(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdlList.append(mdl)
    return 1
Exemplo n.º 23
0
def load_single_model(data, mdlList):
    '''Loads a single model. For testing purposes'''
    
    filename = rapi.getExtensionlessName(rapi.getInputName())
    parser = SanaeParser(data, filename)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)       
Exemplo n.º 24
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    parser = Illusion_XX(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Load the model'''
    
    ctx = rapi.rpgCreateContext()
    parser = DragonOath_MESH(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
    return 1
Exemplo n.º 26
0
def noepyLoadModel(data, mdlList):

    ctx = rapi.rpgCreateContext()
    filename = rapi.getLocalFileName(rapi.getInputName())
    parser = SanaeParser(data, filename)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Load the model'''
    
    ctx = rapi.rpgCreateContext()
    parser = TalesOfFantasy_SKEM(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdlList.append(mdl)
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    return 1
Exemplo n.º 28
0
def noepyLoadModel(data, mdlList):
    '''Load the model'''

    ctx = rapi.rpgCreateContext()
    parser = DragonOath_MESH(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
    return 1
Exemplo n.º 29
0
def noepyLoadModel(data, mdlList):
    '''Load the model'''
    
    ctx = rapi.rpgCreateContext()
    parser = TalesOfFantasy_SM(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdlList.append(mdl)
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    return 1
Exemplo n.º 30
0
def noepyLoadModel(data, mdlList):
    '''Load the model'''
    
    ctx = rapi.rpgCreateContext()
    parser = DirectX_XBIN(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    #mdl.setBones(parser.boneList)
    mdlList.append(mdl)
    return 1
 def __init__(self,data):
     self.data        = NoeBitStream(data)
     self.data.seek(16)
     self.numMesh     = self.data.readUByte()
     self.numBones    = self.data.readUByte()
     self.data.seek(10,1)
     self.bone_ptr    = self.data.readUInt()
     self.data.seek(16,1)
     print('numMesh: %d\nnumBones: %d'%(self.numMesh,self.numBones))
     for i in range(self.numMesh):sM = subMesh(self.data,i)
     self.mdl = rapi.rpgConstructModel()
Exemplo n.º 32
0
 def __init__(self, data):
     self.data = NoeBitStream(data)
     self.data.seek(16)
     self.numMesh = self.data.readUByte()
     self.numBones = self.data.readUByte()
     self.data.seek(10, 1)
     self.bone_ptr = self.data.readUInt()
     self.data.seek(16, 1)
     print('numMesh: %d\nnumBones: %d' % (self.numMesh, self.numBones))
     for i in range(self.numMesh):
         sM = subMesh(self.data, i)
     self.mdl = rapi.rpgConstructModel()
def noepyLoadModel(data, mdlList):
    """Load the model"""

    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
Exemplo n.º 34
0
def noepyLoadModel(data,mdlList):
    ctx = rapi.rpgCreateContext()
    pfFile = PFfile(data)
    rapi.setPreviewOption('setAngOfs',"0 90 180")
    try:
        pfFile.Bones = rapi.multiplyBones(pfFile.Bones)
        mdl = rapi.rpgConstructModel()
        mdl.setModelMaterials(NoeModelMaterials(pfFile.texList, pfFile.matList))
        mdl.setBones(pfFile.Bones)
        mdlList.append(mdl)
    except:pass
    rapi.rpgClearBufferBinds()
    return 1
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    
    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
Exemplo n.º 36
0
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''

    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
   ctx = rapi.rpgCreateContext()
   
   #parse file
   parser = CrucisFatalFake_LMD(data)
   parser.parse_file()
   
   #build model
   mdl = rapi.rpgConstructModel()
   mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
   mdlList.append(mdl)
   
   rapi.rpgClearBufferBinds()  
   return 1
Exemplo n.º 38
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    pfFile = PFfile(data)
    rapi.setPreviewOption('setAngOfs', "0 90 180")
    try:
        pfFile.Bones = rapi.multiplyBones(pfFile.Bones)
        mdl = rapi.rpgConstructModel()
        mdl.setModelMaterials(NoeModelMaterials(pfFile.texList,
                                                pfFile.matList))
        mdl.setBones(pfFile.Bones)
        mdlList.append(mdl)
    except:
        pass
    rapi.rpgClearBufferBinds()
    return 1
Exemplo n.º 39
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    wzm = WZM(data)
    mdl = rapi.rpgConstructModel()
    texList = []
    Bones = []
    Anims = []
    matList = wzm.matList
    Bones = rapi.multiplyBones(wzm.skeleton.Bones)
    Anims = wzm.ParseAnims()
    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdl.setBones(Bones)
    mdl.setAnims(Anims)
    mdlList.append(mdl)
    return 1
Exemplo n.º 40
0
 def __parse__(self):
     self.magic = self.data.read('4B')
     while not self.data.checkEOF():
         section = self.data.readUInt()
         if not section in self.SECTION:
             self.SECTION[99]()
         else:
             self.SECTION[section]()
         
     self.mdl = rapi.rpgConstructModel()
     self.mdl.setModelMaterials(NoeModelMaterials(self.texList, self.matList))
     self.mdl.setBones(self.boneList)
     #self.Animations()
     #self.mdl.setAnims(self.Animations())
     return
def noepyLoadModel(data,mdlList):
    ctx = rapi.rpgCreateContext()
    wzm = WZM(data)
    mdl = rapi.rpgConstructModel()
    texList = []
    Bones = []
    Anims = []
    matList = wzm.matList
    Bones = rapi.multiplyBones(wzm.skeleton.Bones)
    Anims = wzm.ParseAnims()
    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdl.setBones(Bones)
    mdl.setAnims(Anims)
    mdlList.append(mdl)
    return 1
Exemplo n.º 42
0
def psaLoadModel(data, mdlList):
	ctx = rapi.rpgCreateContext()
	bs = NoeBitStream(data)
	bs.setEndian(NOE_BIGENDIAN)
	rapi.rpgSetOption(noesis.RPGOPT_BIGENDIAN, 1)
	rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)
	IdMagic = bs.readBytes(4).decode("ASCII")
	version = bs.readUInt()
	modelCount = bs.readUInt()
	fvfTableOffset = bs.readUInt()
	bs.seek(fvfTableOffset, NOESEEK_ABS)
	for i in range(0, modelCount):
		bs.seek(fvfTableOffset + (0x80 * i), NOESEEK_ABS)
		bs.seek(0x08, NOESEEK_REL)
		vertexCount = bs.readUShort()
		indexCount = bs.readUShort()
		#print('Index Count: ' + str(indexCount))
		bs.seek(0x04, NOESEEK_REL)
		indexOffset = bs.readUInt()
		#print('Index Offset: ' + str(indexOffset))
		indexSize = bs.readUShort()
		unk01 = bs.readUShort()
		vertexOffset = bs.readUInt()
		unkown01Offset = bs.readUInt()
		vertexSize = bs.readUShort()
		bs.seek(0x5E, NOESEEK_REL)
		bs.seek(indexOffset, NOESEEK_ABS)
		edgeData = bs.readBytes(indexSize)
		edgeDecomp = rapi.decompressEdgeIndices(edgeData, indexCount)
		for i in range(0, indexCount): #decompressEdgeIndices returns indices in little-endian, so swap back to big because rpg is in bigendian mode
			t = edgeDecomp[i*2]
			edgeDecomp[i*2] = edgeDecomp[i*2 + 1]
			edgeDecomp[i*2 + 1] = t
			
		bs.seek(vertexOffset, NOESEEK_ABS)
		vertexSize = 16 * vertexCount
		vertbuff = bs.readBytes(vertexSize)
		rapi.rpgBindPositionBufferOfs(vertbuff, noesis.RPGEODATA_FLOAT, 16, 0)
		#print(outputIndices[len(outputIndices) - 1])
		#print(outputIndices)
		rapi.rpgSetName(str(i))
		#rapi.rpgCommitTriangles(None, noesis.RPGEODATA_USHORT, (vertexSize // 16), noesis.RPGEO_POINTS, 1)
		rapi.rpgCommitTriangles(edgeDecomp, noesis.RPGEODATA_USHORT, indexCount, noesis.RPGEO_TRIANGLE, 1)
	mdl = rapi.rpgConstructModel()
	mdlList.append(mdl)
	rapi.rpgClearBufferBinds()	
	return 1
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    
    ctx = rapi.rpgCreateContext()
    inputName = rapi.getInputName()
    with codecs.open(inputName, 'rb', encoding="Shift-JIS") as file:
        parser = SanaeParser(file)
        parser.parse_file()
    #parser = SanaeParser(data)
    #parser.parse_file()        
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    
    bs = NoeBitStream(data)
    if noeStrFromBytes(bs.readBytes(3)) == "UJV":
        data = zlib_decompress(bs)
    
    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
Exemplo n.º 45
0
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''

    bs = NoeBitStream(data)
    if noeStrFromBytes(bs.readBytes(3)) == "UJV":
        data = zlib_decompress(bs)

    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
Exemplo n.º 46
0
def noepyLoadModel(data, mdlList):
    '''Load the model'''

    ctx = rapi.rpgCreateContext()

    #check for compression
    bs = NoeBitStream(data)
    idstring = noeStrFromBytes(bs.readBytes(4))
    if idstring == "ZLB":
        data = zlib_decompress(bs)

    parser = RanceQuest_POL(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''

    ctx = rapi.rpgCreateContext()
    inputName = rapi.getInputName()
    with codecs.open(inputName, 'rb', encoding="Shift-JIS") as file:
        parser = SanaeParser(file)
        parser.parse_file()
    #parser = SanaeParser(data)
    #parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
def noepyLoadModel(data, mdlList):
    '''Load the model'''
    
    ctx = rapi.rpgCreateContext()

    #check for compression
    bs = NoeBitStream(data)
    idstring = noeStrFromBytes(bs.readBytes(4))
    if idstring == "ZLB":
        data = zlib_decompress(bs)
    
    parser = RanceQuest_POL(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
    return 1
Exemplo n.º 49
0
 def MakeModel(self):
     tex = self.GetMaterial()
     bList = self.GetBones()
     print(len(self.subMesh[0][2]),self.subMesh[0][1])
     print(self.vertSize,self.numVert)
     for i in range(len(self.vertBuffer)):
         pass
     rapi.rpgBindPositionBufferOfs(self.vertBuffer[0], noesis.RPGEODATA_FLOAT, self.vertSize[0], 0)
     rapi.rpgBindUV1BufferOfs(self.vertBuffer[1], noesis.RPGEODATA_FLOAT, self.vertSize[1], 0)
     if tex !=0:
         material = NoeMaterial(tex,tex)
         rapi.rpgSetMaterial(tex)
         self.matList.append(material)
     rapi.rpgCommitTriangles(self.subMesh[0][2], noesis.RPGEODATA_USHORT, self.subMesh[0][1], noesis.RPGEO_TRIANGLE, 1)
     #rapi.rpgCommitTriangles(None, noesis.RPGEODATA_USHORT, self.numVert, noesis.RPGEO_POINTS, 1)
     mdl = rapi.rpgConstructModel()
     mdl.setBones(self.boneList)
     return mdl
Exemplo n.º 50
0
	def parse_file(self):
		self.HEADER()
		i0			= self.data.readUInt()
		dwFlags	   = self.data.readUInt()
		self.numBones = self.data.readUInt()
		offset		= self.Serialise()
		print(self.data.tell())
		if offset != 0:
			self.BONES()
		self.data.seek(offset)
		pad0 = self.data.read('2I')
		self.data.seek(92 + 4 + 8+8,1)
		self.GeoSet()
		try:
			mdl = rapi.rpgConstructModel()
			mdl.setBones(self.boneList)
			return mdl
		except:return
def load_all_models(mdlList):
    '''Load all models'''

    #carry over from previous models
    matList = []
    texList = []

    dirPath = rapi.getDirForFilePath(rapi.getInputName())
    fileList = [file for file in os.listdir(dirPath) if file.lower().endswith(".gm2")]
    for file in fileList:
        f = open(dirPath + file, 'rb')
        data2 = f.read()
        parser = SanaeParser(data2)
        parser.parse_file()
        matList.extend(parser.matList)
        texList.extend(parser.texList)
        mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdlList.append(mdl)    
Exemplo n.º 52
0
 def parse_file(self):
     self.HEADER()
     i0 = self.data.readUInt()
     dwFlags = self.data.readUInt()
     self.numBones = self.data.readUInt()
     offset = self.Serialise()
     print(self.data.tell())
     if offset != 0:
         self.BONES()
     self.data.seek(offset)
     pad0 = self.data.read('2I')
     self.data.seek(92 + 4 + 8 + 8, 1)
     self.GeoSet()
     try:
         mdl = rapi.rpgConstructModel()
         mdl.setBones(self.boneList)
         return mdl
     except:
         return