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)
Example #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 get_type(data):
    
    filename = rapi.getLocalFileName(rapi.getInputName())
    if rapi.checkFileExt(filename, '.3DO'):
        return Shaiya3DO(data)
    elif rapi.checkFileExt(filename, '.3DC'):
        return Shaiya3DC(data)
    elif rapi.checkFileExt(filename, '.SMOD'):
        return ShaiyaSMOD(data)
def noepyCheckType(data):
    '''Verify that the format is supported by this plugin. Default yes'''
    
    filename = rapi.getLocalFileName(rapi.getInputName())
    if not ( rapi.checkFileExt(filename, '.3DO') or \
       rapi.checkFileExt(filename, '.3DC') or \
       rapi.checkFileExt(filename, '.SMOD')):
        return 0
    return 1