示例#1
0
def compileMesh(path):
    if type(path) is bytes:
        path = path.decode('utf-8')
    name = os.path.basename(path)
    obj = module3d.Object3D(name)

    obj.path = path

    try:
        npzpath = os.path.splitext(path)[0] + '.npz'
        #print ('Compiling mesh to binary: {}'.format(npzpath))
        try:
            files3d.loadTextMesh(obj, path)
        except:
            print('Could not load OBJ file {}. Perhaps it mixes tris and quads.'.format(path))
            #import traceback
            #traceback.print_exc(file=sys.stdout)
            return False
        files3d.saveBinaryMesh(obj, npzpath)
    except:
        print('compile_models was unable to save compiled mesh for file {}'.format(path))
        #import traceback
        #traceback.print_exc(file=sys.stdout)
        return False
        
    return True
def compileMesh(path):
    name = os.path.basename(path)
    obj = module3d.Object3D(name)

    obj.path = path

    try:
        npzpath = os.path.splitext(path)[0] + '.npz'
        #print ('Compiling mesh to binary: %s' % npzpath)
        try:
            files3d.loadTextMesh(obj, path)
        except:
            print(
                'Could not load OBJ file %s. Perhaps it mixes tris and quads.'
                % path)
            #import traceback
            #traceback.print_exc(file=sys.stdout)
            return False
        files3d.saveBinaryMesh(obj, npzpath)
    except:
        print('Unable to save compiled mesh for file %s' % path)
        #import traceback
        #traceback.print_exc(file=sys.stdout)
        return False

    return True
示例#3
0
def compileMesh(path):
    name = os.path.basename(path)
    obj = module3d.Object3D(name)

    obj.path = path

    try:
        npzpath = os.path.splitext(path)[0] + '.npz'
        #print 'Compiling mesh to binary: %s' % npzpath
        try:
            files3d.loadTextMesh(obj, path)
        except:
            print 'Could not load OBJ file %s. Perhaps it mixes tris and quads.' % path
            #import traceback
            #traceback.print_exc(file=sys.stdout)
            return False
        files3d.saveBinaryMesh(obj, npzpath)
    except:
        print 'Unable to save compiled mesh for file %s' % path
        #import traceback
        #traceback.print_exc(file=sys.stdout)
        return False
        
    return True