Skip to content

Commit

Permalink
Fix ref texture mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Moguri committed Mar 31, 2024
1 parent ad49d45 commit b38a191
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions blend2bam/blender_scripts/exportgltf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def export_physics(gltf_data, settings):


def fix_image_uri(gltf_data):
bpy.ops.file.make_paths_absolute()
blender_imgs = {
(os.path.basename(i.filepath) or i.name).rsplit('.', 1)[0]: i
for i in bpy.data.images
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
]
dependencies = [
"panda3d",
"panda3d-gltf ~= 1.1.0",
"panda3d-gltf ~= 1.2",
]
requires-python = ">= 3.8"

Expand Down
Binary file added tests/assets/grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/textured_cube.blend
Binary file not shown.
30 changes: 30 additions & 0 deletions tests/test_textures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from pathlib import Path
import sys

import pytest

import blend2bam.cli


TESTDIR = Path(__file__).parent.absolute()

@pytest.mark.parametrize('mode', ['ref', 'copy', 'embed'])
def test_textures_mode(tmpdir, mode):
tmpdir = Path(tmpdir)
src = TESTDIR / 'assets' / 'textured_cube.blend'
dst = tmpdir / 'output.bam'
sys.argv = [
'python',
f'--textures={mode}',
src.as_posix(),
dst.as_posix(),
]
blend2bam.cli.main()

outputs = [i.name for i in tmpdir.iterdir()]

print(outputs)
if mode == 'copy':
assert 'grid.png' in outputs
else:
assert outputs == ['output.bam']

0 comments on commit b38a191

Please sign in to comment.