Esempio n. 1
0
def main():
    parser = argparse.ArgumentParser(
        description=
        'A tool for creating BAM files from Panda3D supported file formats')

    parser.add_argument('src', type=str, help='source path')
    parser.add_argument('dst', type=str, help='destination path')

    args = parser.parse_args()

    src = p3d.Filename.from_os_specific(os.path.abspath(args.src))
    dst = p3d.Filename.from_os_specific(os.path.abspath(args.dst))

    dst.make_dir()

    loader = p3d.Loader.get_global_ptr()
    options = p3d.LoaderOptions()
    options.flags |= p3d.LoaderOptions.LF_no_cache

    scene = p3d.NodePath(loader.load_sync(src, options))

    # Update texture paths
    converted_textures = set()
    for node in scene.find_all_matches('**/+GeomNode'):
        make_texpath_relative(node, src.get_dirname(), converted_textures)

    scene.write_bam_file(dst)
Esempio n. 2
0
    def load_file(path, options, _record=None):
        settings = BlendLoader.global_settings
        if not settings.blender_dir and not blenderutils.blender_exists():
            blender_dir = blenderutils.locate_blenderdir()
            settings = settings._replace(blender_dir=blender_dir)

        loader = p3d.Loader.get_global_ptr()
        with tempfile.NamedTemporaryFile(suffix='.bam') as bamfile:
            bamfilepath = p3d.Filename.from_os_specific(bamfile.name)
            bamfilepath.make_true_case()
            convert(settings, path.get_dirname(), [path],
                    bamfilepath.to_os_specific())

            options = p3d.LoaderOptions(options)
            options.flags |= p3d.LoaderOptions.LF_no_cache
            return loader.load_sync(bamfilepath, options=options)
Esempio n. 3
0
def main():
    parser = argparse.ArgumentParser(
        description=
        'A tool for creating BAM files from Panda3D supported file formats')

    parser.add_argument('src', type=str, help='source path')
    parser.add_argument('dst', type=str, help='destination path')

    args = parser.parse_args()

    src = p3d.Filename.from_os_specific(os.path.abspath(args.src))
    dst = p3d.Filename.from_os_specific(os.path.abspath(args.dst))

    loader = p3d.Loader.get_global_ptr()
    options = p3d.LoaderOptions()
    options.flags |= p3d.LoaderOptions.LF_no_cache

    p3d.NodePath(loader.load_sync(src, options)).write_bam_file(dst)
Esempio n. 4
0
 def __init__(self):
     self.libraries = []
     self._loader = p3d.Loader.get_global_ptr()
     self._loader_opts = p3d.LoaderOptions()
def test_no_texture_filter_option(pool, pre_filter, image_rgb_path):
    register_filter(pool, pre_filter)

    texture = pool.load_texture(image_rgb_path, 3, False, core.LoaderOptions(0, core.LoaderOptions.TF_no_filters))
    assert isinstance(texture, core.Texture)
    assert texture.get_name() != 'preloaded'