def test_cli_pipeline_egg(tmpdir): if blenderutils.is_blender_28(): pytest.skip('EGG pipeline not supported with blender 2.8') run_cli_test(tmpdir, extra_args=[ '--pipeline', 'egg' ]) assert not os.path.exists(os.path.join(tmpdir, 'test.egg'))
def test_cli_pipeline_egg(): if blenderutils.is_blender_28(): pytest.skip('EGG pipeline not supported with blender 2.8') shutil.rmtree(DSTDIR, ignore_errors=True) args = [ 'python', os.path.join(SRCDIR, 'physics.blend'), os.path.join(DSTDIR, 'output.bam'), '--pipeline', 'egg' ] sys.argv = args blend2bam.cli.main() assert os.path.exists(DSTDIR) assert not os.path.exists(os.path.join(DSTDIR, 'test.egg')) assert os.path.exists(os.path.join(DSTDIR, 'output.bam'))
def __init__(self, settings=None): super().__init__(settings) gltf_settings = { 'physics_engine': self.settings.physics_engine, 'skip_axis_conversion': True, 'no_srgb': self.settings.no_srgb, 'textures': self.settings.textures, } gltf2bam_version = [int(i) for i in gltf.__version__.split('.')] if self.settings.material_mode == 'legacy' and \ blenderutils.is_blender_28(self.settings.blender_dir): if gltf2bam_version[0] == 0 and gltf2bam_version[1] < 9: raise RuntimeError( 'panda3d-gltf >= 0.9 is required to use legacy material-mode' ' with Blender 2.80+') if gltf2bam_version[0] != 0 or gltf2bam_version[1] >= 11: gltf_settings['animations'] = self.settings.animations elif self.settings.animations != 'embed': raise RuntimeError( 'panda3d-gltf >= 0.11 is required for animation options other' ' than "embed"') self.gltf_settings = gltf.GltfSettings(**gltf_settings)
import os import shutil import pytest import blend2bam import blend2bam.blend2egg import blend2bam.egg2bam from blend2bam import blenderutils TESTDIR = os.path.dirname(os.path.abspath(__file__)) SRCDIR = os.path.join(TESTDIR, 'assets') DSTDIR = os.path.join(TESTDIR, 'export') if blenderutils.is_blender_28(): pytest.skip('EGG pipeline not supported with blender 2.8', allow_module_level=True) def test_blend2egg_single(): converter = blend2bam.blend2egg.ConverterBlend2Egg() src = os.path.join(SRCDIR, 'test.blend') dst = os.path.join(DSTDIR, 'output.egg') shutil.rmtree(DSTDIR, ignore_errors=True) converter.convert_single(src, dst) assert os.path.exists(DSTDIR) assert os.path.exists(dst) def test_blend2egg_batch():