How to use the yoga.model.optimize function in yoga

To help you get started, we’ve selected a few yoga examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wanadev / yoga / test / test_model.py View on Github external
def test_output_file_path(self, tmpdir):
        output_path = os.path.join(str(tmpdir), "output1.glb")
        yoga.model.optimize("test/models/model.fbx", output_path)
        output = open(output_path, "rb")
        assert output.read().startswith(_MAGIC_GLB)
github wanadev / yoga / test / test_model.py View on Github external
def test_input_file_path(self):
        output = io.BytesIO()
        yoga.model.optimize("test/models/model.fbx", output)
        output.seek(0)
        assert output.read().startswith(_MAGIC_GLB)
github wanadev / yoga / test / test_model.py View on Github external
def test_input_file_format(self, model_path):
        output = io.BytesIO()
        yoga.model.optimize(model_path, output)
        output.seek(0)
        assert output.read().startswith(_MAGIC_GLB)
github wanadev / yoga / test / test_model.py View on Github external
def test_input_bytesio(self):
        with pytest.raises(RuntimeError):
            input_ = io.BytesIO(open("test/models/model.fbx", "rb").read())
            output = io.BytesIO()
            yoga.model.optimize(input_, output)
github wanadev / yoga / test / test_model.py View on Github external
def test_textures_dictionary(self):
        input_ = open("test/models/model.fbx", "rb")
        output = io.BytesIO()
        yoga.model.optimize(input_, output, {}, {
            "diffuse.jpg": open("test/models/diffuse.jpg", "rb")
        })
        input_.close()
        output.seek(0)
        assert output.read().startswith(_MAGIC_GLB)
github wanadev / yoga / test / test_model.py View on Github external
def test_textures_empty_dictionary(self):
        with pytest.raises(RuntimeError):
            input_ = open("test/models/model.fbx", "rb")
            output = io.BytesIO()
            yoga.model.optimize(input_, output, {}, {})
github wanadev / yoga / test / test_model.py View on Github external
def test_output_file(self, tmpdir):
        output_path = os.path.join(str(tmpdir), "output2.glb")
        output = open(output_path, "wb")
        yoga.model.optimize("test/models/model.fbx", output)
        output.close()
        output = open(output_path, "rb")
        assert output.read().startswith(_MAGIC_GLB)
github wanadev / yoga / test / test_model.py View on Github external
def test_output_bytesio(self):
        output = io.BytesIO()
        yoga.model.optimize("test/models/model.fbx", output)
        output.seek(0)
        assert output.read().startswith(_MAGIC_GLB)
github wanadev / yoga / test / test_model.py View on Github external
def test_input_file(self):
        input_ = open("test/models/model.fbx", "rb")
        output = io.BytesIO()
        yoga.model.optimize(input_, output)
        input_.close()
        output.seek(0)
        assert output.read().startswith(_MAGIC_GLB)