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 =appFile(data)
	mdl=parser.parse_file()
	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)'''
    

    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):
    '''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
Esempio n. 7
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    #noesis.logPopup()
    file = MSH(data)
    mdlList.append(file.mdl)
    rapi.rpgClearBufferBinds()
    return 1
Esempio n. 8
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    parser = appFile(data)
    mdl = parser.parse_file()
    mdlList.append(mdl)
    rapi.rpgClearBufferBinds()
    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
Esempio n. 10
0
def noepyLoadModel(data, mdlList):
    
    ctx = rapi.rpgCreateContext()
    
    file = MODEL(data)
    mdlList.append(file.mdl)
    rapi.rpgClearBufferBinds()
    return 1
Esempio n. 11
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 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):
    '''Load the model'''
    
    ctx = rapi.rpgCreateContext()
    if MODE == 1:
        load_all_models(mdlList)
    else:
        load_single_model(data, mdlList)
    return 1
Esempio n. 14
0
def noepyLoadModel(data, mdlList):
    '''Load the model'''

    ctx = rapi.rpgCreateContext()
    if MODE == 1:
        load_all_models(mdlList)
    else:
        load_single_model(data, mdlList)
    return 1
Esempio n. 15
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    mesh = TLMesh(data)
    mesh.Parser()
    mdl=mesh.MakeModel()
    mdlList.append(mdl)
    print(mdlList)
    rapi.rpgClearBufferBinds()
    return 1
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
Esempio n. 17
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
Esempio n. 18
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 = DragonOath_MESH(data)
    parser.parse_file()
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdlList.append(mdl)
    return 1
Esempio n. 20
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
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
Esempio n. 22
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
def noepyLoadModel(data, mdlList):
    
    ctx = rapi.rpgCreateContext()
    global dirPath
    global fileName
    dirPath     = rapi.getDirForFilePath(rapi.getInputName())
    fileName    = rapi.getLocalFileName(rapi.getInputName()) 
    file = GOBJ(data)
    mdlList.append(file.mdl)
    rapi.rpgClearBufferBinds()
    return 1
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 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
Esempio n. 26
0
def noepyLoadModel(data, mdlList):

    ctx = rapi.rpgCreateContext()
    global dirPath
    global fileName
    dirPath = rapi.getDirForFilePath(rapi.getInputName())
    fileName = rapi.getLocalFileName(rapi.getInputName())
    file = GOBJ(data)
    mdlList.append(file.mdl)
    rapi.rpgClearBufferBinds()
    return 1
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
def fateLoadModel(data, mdlList):
    dlog("")
    dlog("=== Load .mdl ===")
    rapi.rpgCreateContext()
    bs = NoeBitStream(data)

    bs.seekAbs(4)
    sectCount = bs.readInt()
    bs.readInt()

    sectOffsets = []
    sectSizes = []
    for _ in range(sectCount):
        sectOffsets.append(bs.readInt())
    for _ in range(sectCount):
        sectSizes.append(bs.readInt())

    impl = fateGetPlatformImpl(bs, sectOffsets[0], sectOffsets[1])
    mesh = Mesh(bs, sectOffsets[0], impl)
    brntre = None
    boneSection = None
    if mesh.bonesExist:
        if len(sectOffsets) < 5:
            warn(
                "Mesh has bones info but section describing them does not exist"
            )
        else:
            brntre = Brntre(bs, sectOffsets[3])
            boneSection = BoneSection(bs, sectOffsets[4])
    gpr = Gpr(bs, sectOffsets[1], mesh, boneSection, brntre, impl)

    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(mesh.textures, mesh.materials))
    if boneSection is not None:
        mdl.setBones(boneSection.noeBones)
    mdlList.append(mdl)

    dlog("=== Done ===")
    return 1
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
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
def noepyLoadModel(data,mdlList):
    ctx = rapi.rpgCreateContext()
    
    model       = POE()
    matList     = model.matList
    texList     = model.texList
    bones       = model.bones
    anims       = model.anims

    mdl = rapi.rpgConstructModelSlim()
    mdl.setModelMaterials(NoeModelMaterials(texList, matList))
    mdl.setBones(bones)
    mdl.setAnims(anims)
    mdlList.append(mdl)
    return 1
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
Esempio n. 35
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
Esempio n. 36
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
Esempio n. 37
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)'''
    
    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
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):
    '''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
Esempio n. 42
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
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
Esempio n. 44
0
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    model = ShenmueMt5(data)
    model.parse()
    rapi.rpgClearBufferBinds()
    noeMat = NoeModelMaterials(model.noeTextures, model.noeMaterials)
    rapi.rpgBindPositionBuffer(model.vertex_list, noesis.RPGEODATA_FLOAT, 0x0C)
    rapi.rpgBindNormalBuffer(model.normal_list, noesis.RPGEODATA_FLOAT, 0x0C)
    rapi.rpgBindUV1Buffer(model.uv_list, noesis.RPGEODATA_FLOAT, 0x08)

    for strip in model.polygon_list:
        rapi.rpgSetMaterial("material[%s]"%strip['texId'])
        rapi.rpgCommitTriangles(strip['face'], noesis.RPGEODATA_USHORT, int(len(strip['face'])/2), noesis.RPGEO_TRIANGLE, 0)
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(noeMat)
    mdlList.append(mdl)
    rapi.setPreviewOption("noTextureLoad", "1")
    rapi.rpgOptimize()
    return 1
def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    bs = NoeBitStream(data)

    MagicNumber = int(bs.readUInt())
    bs.seek(5, NOESEEK_ABS)
    VertHeader = int(bs.readUInt() * 16 + 9)
    VertBuffer = VertHeader + 0x2f

    if MagicNumber == 0x476:
        VertBuffer += 0x13

    bs.seek(VertHeader + 4, NOESEEK_ABS)
    VertCount = int(bs.readUInt())
    VertStride = int(bs.readUInt())

    vertArray = [NoeVec3()] * VertCount
    uvArray = [NoeVec3()] * VertCount

    for i in range(VertCount):
        bs.seek(VertBuffer + i * VertStride, NOESEEK_ABS)
        vertArray[i] = NoeVec3(
            (bs.readFloat(), bs.readFloat(), bs.readFloat()))
        uvArray[i] = NoeVec3((bs.readFloat(), bs.readFloat(), 0.0))

    bs.seek(VertBuffer + VertCount * VertStride, NOESEEK_ABS)

    IdxCount = bs.readUInt()

    bs.seek(0xc, NOESEEK_REL)

    faceArray = []

    for i in range(IdxCount):
        faceArray.append(bs.readUShort())

    meshes = []
    msh = NoeMesh(faceArray, vertArray)
    msh.setUVs(uvArray)
    meshes.append(msh)
    mdlList.append(NoeModel(meshes))

    return 1
Esempio n. 46
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()
    inputName = rapi.getLocalFileName(rapi.getInputName())
    filename, ext = os.path.splitext(inputName)
    if ext == ".blk":
        parser = BLKParser(data)
    elif ext == ".cmx":
        parser = CMXParser(data)
    elif ext == ".msh":
        parser = MSHParser(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)'''
    
    ctx = rapi.rpgCreateContext()
    inputName = rapi.getLocalFileName(rapi.getInputName())
    filename, ext = os.path.splitext(inputName)
    if ext == ".blk":
        parser = BLKParser(data)
    elif ext == ".cmx":
        parser = CMXParser(data)
    elif ext == ".msh":
        parser = MSHParser(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
Esempio n. 48
0
def noepyLoadModel(data, mdlList):
    bs = NoeBitStream(data)
    if bs.readInt() != NOEPY_HEADER:
        return 0
    if bs.readInt() != NOEPY_VERSION:
        return 0

    #no need to explicitly free the context (created contexts are auto-freed after the handler), but DO NOT hold any references to it outside of this method
    ctx = rapi.rpgCreateContext()

    numMeshes = bs.readInt()
    for i in range(0, numMeshes):
        meshName = bs.readString()
        meshMat = bs.readString()
        numIdx = bs.readInt()
        numPos = bs.readInt()
        numNrm = bs.readInt()
        numUVs = bs.readInt()
        numTan = bs.readInt()
        numClr = bs.readInt()
        numWeights = bs.readInt()
        numBoneRefs = bs.readInt()
        if numBoneRefs > 0:
            boneMap = bs.read("i" * numBoneRefs)
            rapi.rpgSetBoneMap(boneMap)  #set the bone map

        rapi.rpgSetName(meshName)
        rapi.rpgSetMaterial(meshMat)

        triangles = bs.readBytes(numIdx * 4)
        positions = bs.readBytes(numPos * 12)
        normals = bs.readBytes(numPos * 12) if numNrm == numPos else None
        uvs = bs.readBytes(numPos * 12) if numUVs == numPos else None
        tans = bs.readBytes(numPos * 48) if numTan == numPos else None
        colors = bs.readBytes(numPos * 16) if numClr == numPos else None

        rapi.rpgBindPositionBuffer(positions, noesis.RPGEODATA_FLOAT, 12)
        rapi.rpgBindNormalBuffer(normals, noesis.RPGEODATA_FLOAT, 12)
        rapi.rpgBindUV1Buffer(uvs, noesis.RPGEODATA_FLOAT, 12)
        rapi.rpgBindColorBuffer(colors, noesis.RPGEODATA_FLOAT, 16, 4)
        if numWeights > 0:
            vwList = []
            for j in range(0, numWeights):
                vwNum = bs.readInt()
                bidx = []
                bwgt = []
                for k in range(0, vwNum):
                    bidx.append(bs.readInt())
                for k in range(0, vwNum):
                    bwgt.append(bs.readFloat())
                vwList.append(NoeVertWeight(bidx, bwgt))
            fw = NoeFlatWeights(vwList)
            rapi.rpgBindBoneIndexBuffer(fw.flatW[:fw.weightValOfs],
                                        noesis.RPGEODATA_INT,
                                        4 * fw.weightsPerVert,
                                        fw.weightsPerVert)
            rapi.rpgBindBoneWeightBuffer(fw.flatW[fw.weightValOfs:],
                                         noesis.RPGEODATA_FLOAT,
                                         4 * fw.weightsPerVert,
                                         fw.weightsPerVert)
        numMorphFrames = bs.readInt()
        for j in range(0, numMorphFrames):
            numMFPos = bs.readInt()
            numMFNrm = bs.readInt()
            morphPosAr = bs.readBytes(numMFPos * 12)
            rapi.rpgFeedMorphTargetPositions(morphPosAr,
                                             noesis.RPGEODATA_FLOAT, 12)
            if numMFNrm > 0:
                morphNrmAr = bs.readBytes(numMFNrm * 12)
                rapi.rpgFeedMorphTargetNormals(morphNrmAr,
                                               noesis.RPGEODATA_FLOAT, 12)
            rapi.rpgCommitMorphFrame(numMFPos)
        rapi.rpgCommitMorphFrameSet()

        rapi.rpgCommitTriangles(triangles, noesis.RPGEODATA_INT, numIdx,
                                noesis.RPGEO_TRIANGLE, 1)
        rapi.rpgClearBufferBinds(
        )  #reset in case a subsequent mesh doesn't have the same components

    mdl = rapi.rpgConstructModel()

    bones = []
    numBones = bs.readInt()
    for i in range(0, numBones):
        bone = noepyReadBone(bs)
        bones.append(bone)

    anims = []
    numAnims = bs.readInt()
    for i in range(0, numAnims):
        animName = bs.readString()
        numAnimBones = bs.readInt()
        animBones = []
        for j in range(0, numAnimBones):
            animBone = noepyReadBone(bs)
            animBones.append(animBone)
        animNumFrames = bs.readInt()
        animFrameRate = bs.readFloat()
        numFrameMats = bs.readInt()
        animFrameMats = []
        for j in range(0, numFrameMats):
            frameMat = NoeMat43.fromBytes(bs.readBytes(48))
            animFrameMats.append(frameMat)
        anim = NoeAnim(animName, animBones, animNumFrames, animFrameMats,
                       animFrameRate)
        anims.append(anim)

    mdl.setBones(bones)
    mdl.setAnims(anims)
    mdlList.append(
        mdl)  #important, don't forget to put your loaded model in the mdlList
    return 1
Esempio n. 49
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)
		# read EDGE indices header
		numIndices = bs.readUShort()
		#print('Num Indices: ' + str(numIndices))
		indexBase = bs.readUShort()
		#print('Base Index: ' + str(indexBase))
		sequenceSize = bs.readUShort()
		#print('Sequence Size: ' + str(sequenceSize))
		indexBitSize = bs.readUByte()
		#print('Index Bit Size: ' + str(indexBitSize))
		bs.readUByte() # padding
		# setup sequence bit stream
		sequenceCount = sequenceSize * 8
		#print('Sequence Count: ' + str(sequenceCount))
		sequenceBytes = bs.readBytes(sequenceSize)
		spec = ['data', {"count" : sequenceCount, "spec" : ["value", 1]}]
		reader = BitReader(spec, BitReader.BIG_ENDIAN)
		sequenceStream = reader.read(sequenceBytes)
		# setup triangle bit stream
		triangleCount = indexCount // 3
		#print('Triangle Count: ' + str(triangleCount))
		triangleSize = ((triangleCount * 2) + 7) // 8
		#print('Trangle Size: ' + str(triangleSize))
		triangleBytes = bs.readBytes(triangleSize)
		spec = ['data', {"count" : triangleCount, "spec" : ["value", 2]}]
		reader = BitReader(spec, BitReader.BIG_ENDIAN)
		triangleStream = reader.read(triangleBytes)
		# setup indices bit stream
		indicesSize = ((numIndices * indexBitSize) + 7) // 8
		#print('Indices Size: ' + str(indicesSize))
		#print('Indices Offset: ' + str(bs.getOffset()))
		indicesBytes = bs.readBytes(indicesSize)
		spec = ['data', {"count" : numIndices, "spec" : ["value", indexBitSize]}]
		reader = BitReader(spec, BitReader.BIG_ENDIAN)
		indicesStream = reader.read(indicesBytes)
		# indicesStream = NoeBitStream(indicesBytes)
		# indicesStream.setEndian(NOE_BIGENDIAN)
		# read delta compressed indices
		deltaIndices = array('H')
		for i in range(0, numIndices):
			value = indicesStream.data[i].value
			if i == 1:
				pass
				#print('Index Bit Value: ' + str(value) + ' Index: ' + str(i))
			value -= indexBase
			if i > 7:
				value += deltaIndices[i - 8]
			deltaIndices.append(value)
		# create sequence indices
		inputIndices = array('H')
		sequencedIndex = 0
		unorderedIndex = 0
		for i in range(0, sequenceCount):
			value = sequenceStream.data[i].value
			if value == 0:
				inputIndices.append(sequencedIndex)
				sequencedIndex += 1
			else:
				inputIndices.append(deltaIndices[unorderedIndex])
				unorderedIndex += 1
		# create triangle indices
		outputIndices = array('H')
		currentIndex = 0
		triangleIndices = [0, 0, 0]
		# triangleIndices = {0:0, 1:0, 2:0}
		for i in range(0, triangleCount):
			value = triangleStream.data[i].value
			if value == 0:
				triangleIndices[1] = triangleIndices[2]
				triangleIndices[2] = inputIndices[currentIndex]
				currentIndex += 1
			elif value == 1:
				triangleIndices[0] = triangleIndices[2]
				triangleIndices[2] = inputIndices[currentIndex]
				currentIndex += 1
			elif value == 2:
				tempIndex = triangleIndices[0]
				triangleIndices[0] = triangleIndices[1]
				triangleIndices[1] = tempIndex
				triangleIndices[2] = inputIndices[currentIndex]
				currentIndex += 1
			else: # value == 3:
				triangleIndices[0] = inputIndices[currentIndex]
				currentIndex += 1
				triangleIndices[1] = inputIndices[currentIndex]
				currentIndex += 1
				triangleIndices[2] = inputIndices[currentIndex]
				currentIndex += 1
			outputIndices.append(triangleIndices[0])
			outputIndices.append(triangleIndices[1])
			outputIndices.append(triangleIndices[2])
		bs.seek(vertexOffset, NOESEEK_ABS)
		vertexSize = 16 * vertexCount
		vertbuff = bs.readBytes(vertexSize)
		rapi.rpgBindPositionBufferOfs(vertbuff, noesis.RPGEODATA_FLOAT, 16, 0)
		faceBuff = struct.pack(">" + 'h'*len(outputIndices), *outputIndices)
		#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(faceBuff, noesis.RPGEODATA_USHORT, len(outputIndices), noesis.RPGEO_TRIANGLE, 1)
	mdl = rapi.rpgConstructModel()
	mdlList.append(mdl)
	rapi.rpgClearBufferBinds()	
	return 1
def noepyLoadModel(data, mdlList):
	bs = NoeBitStream(data)
	if bs.readInt() != NOEPY_HEADER:
		return 0
	if bs.readInt() != NOEPY_VERSION:
		return 0

	#no need to explicitly free the context (created contexts are auto-freed after the handler), but DO NOT hold any references to it outside of this method
	ctx = rapi.rpgCreateContext()

	numMeshes = bs.readInt()
	for i in range(0, numMeshes):
		meshName = bs.readString()
		meshMat = bs.readString()
		numIdx = bs.readInt()
		numPos = bs.readInt()
		numNrm = bs.readInt()
		numUVs = bs.readInt()
		numTan = bs.readInt()
		numClr = bs.readInt()
		numWeights = bs.readInt()
		numBoneRefs = bs.readInt()
		if numBoneRefs > 0:
			boneMap = bs.read("i"*numBoneRefs)
			rapi.rpgSetBoneMap(boneMap) #set the bone map

		rapi.rpgSetName(meshName)
		rapi.rpgSetMaterial(meshMat)

		triangles = bs.readBytes(numIdx * 4)
		positions = bs.readBytes(numPos * 12)
		normals = bs.readBytes(numPos * 12) if numNrm == numPos else None
		uvs = bs.readBytes(numPos * 12) if numUVs == numPos else None
		tans = bs.readBytes(numPos * 48) if numTan == numPos else None
		colors = bs.readBytes(numPos * 16) if numClr == numPos else None

		rapi.rpgBindPositionBuffer(positions, noesis.RPGEODATA_FLOAT, 12)
		rapi.rpgBindNormalBuffer(normals, noesis.RPGEODATA_FLOAT, 12)
		rapi.rpgBindUV1Buffer(uvs, noesis.RPGEODATA_FLOAT, 12)
		rapi.rpgBindColorBuffer(colors, noesis.RPGEODATA_FLOAT, 16, 4)
		if numWeights > 0:
			vwList = []
			for j in range(0, numWeights):
				vwNum = bs.readInt()
				bidx = []
				bwgt = []
				for k in range(0, vwNum):
					bidx.append(bs.readInt())
				for k in range(0, vwNum):
					bwgt.append(bs.readFloat())
				vwList.append(NoeVertWeight(bidx, bwgt))
			fw = NoeFlatWeights(vwList)
			rapi.rpgBindBoneIndexBuffer(fw.flatW[:fw.weightValOfs], noesis.RPGEODATA_INT, 4*fw.weightsPerVert, fw.weightsPerVert)
			rapi.rpgBindBoneWeightBuffer(fw.flatW[fw.weightValOfs:], noesis.RPGEODATA_FLOAT, 4*fw.weightsPerVert, fw.weightsPerVert)
		numMorphFrames = bs.readInt()
		for j in range(0, numMorphFrames):
			numMFPos = bs.readInt()
			numMFNrm = bs.readInt()
			morphPosAr = bs.readBytes(numMFPos * 12)
			rapi.rpgFeedMorphTargetPositions(morphPosAr, noesis.RPGEODATA_FLOAT, 12)
			if numMFNrm > 0:
				morphNrmAr = bs.readBytes(numMFNrm * 12)
				rapi.rpgFeedMorphTargetNormals(morphNrmAr, noesis.RPGEODATA_FLOAT, 12)
			rapi.rpgCommitMorphFrame(numMFPos)
		rapi.rpgCommitMorphFrameSet()

		rapi.rpgCommitTriangles(triangles, noesis.RPGEODATA_INT, numIdx, noesis.RPGEO_TRIANGLE, 1)
		rapi.rpgClearBufferBinds() #reset in case a subsequent mesh doesn't have the same components

	mdl = rapi.rpgConstructModel()

	bones = []
	numBones = bs.readInt()
	for i in range(0, numBones):
		bone = noepyReadBone(bs)
		bones.append(bone)

	anims = []
	numAnims = bs.readInt()
	for i in range(0, numAnims):
		animName = bs.readString()
		numAnimBones = bs.readInt()
		animBones = []
		for j in range(0, numAnimBones):
			animBone = noepyReadBone(bs)
			animBones.append(animBone)
		animNumFrames = bs.readInt()
		animFrameRate = bs.readFloat()
		numFrameMats = bs.readInt()
		animFrameMats = []
		for j in range(0, numFrameMats):
			frameMat = NoeMat43.fromBytes(bs.readBytes(48))
			animFrameMats.append(frameMat)
		anim = NoeAnim(animName, animBones, animNumFrames, animFrameMats, animFrameRate)
		anims.append(anim)

	mdl.setBones(bones)
	mdl.setAnims(anims)
	mdlList.append(mdl)			#important, don't forget to put your loaded model in the mdlList
	return 1
Esempio n. 51
0
def noepyXmlLoadModel(data, mdlList):
	ctx = rapi.rpgCreateContext()
	bs = NoeBitStream(data)
	rapi.rpgClearBufferBinds()	
	return 1