Skip to content

Commit

Permalink
feat: disable export_try_sparse_sk because UniVRM 0.115.0 doesn't s…
Browse files Browse the repository at this point in the history
…upport it

#381 (comment)
  • Loading branch information
saturday06 committed Dec 5, 2023
1 parent 85f7c41 commit 6a3f1c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/io_scene_vrm/exporter/gltf2_addon_vrm_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,9 @@ def export_vrm(self) -> Optional[bytes]:
use_selection=True,
export_animations=True,
export_rest_position_armature=False,
# UniVRM 0.115.0 doesn't support `export_try_sparse_sk`
# https://github.com/saturday06/VRM-Addon-for-Blender/issues/381#issuecomment-1838365762
export_try_sparse_sk=False,
)
except RuntimeError:
logger.exception("Failed to export VRM with animations")
Expand All @@ -2046,6 +2049,9 @@ def export_vrm(self) -> Optional[bytes]:
use_selection=True,
export_animations=False,
export_rest_position_armature=False,
# UniVRM 0.115.0 doesn't support `export_try_sparse_sk`
# https://github.com/saturday06/VRM-Addon-for-Blender/issues/381#issuecomment-1838365762
export_try_sparse_sk=False,
)
extra_name_assigned_glb = filepath.read_bytes()
finally:
Expand Down
14 changes: 14 additions & 0 deletions src/io_scene_vrm/external/io_scene_gltf2_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def export_scene_gltf(
use_selection: bool,
export_animations: bool,
export_rest_position_armature: bool,
export_try_sparse_sk: bool,
) -> set[str]:
if bpy.app.version < (3, 6, 0):
return bpy.ops.export_scene.gltf(
Expand All @@ -130,6 +131,18 @@ def export_scene_gltf(
export_animations=export_animations,
)

if bpy.app.version < (4,):
return bpy.ops.export_scene.gltf(
filepath=filepath,
check_existing=check_existing,
export_format=export_format,
export_extras=export_extras,
export_current_frame=export_current_frame,
use_selection=use_selection,
export_animations=export_animations,
export_rest_position_armature=export_rest_position_armature,
)

return bpy.ops.export_scene.gltf(
filepath=filepath,
check_existing=check_existing,
Expand All @@ -139,4 +152,5 @@ def export_scene_gltf(
use_selection=use_selection,
export_animations=export_animations,
export_rest_position_armature=export_rest_position_armature,
export_try_sparse_sk=export_try_sparse_sk,
)

0 comments on commit 6a3f1c8

Please sign in to comment.