소스 검색

Change _loop suffix to -loop.

This is a breaking change.

For consistency with other exporters, we should use the suffix "-loop",
not "_loop", to indicate that an animation is looping. If we detect the
suffix "_loop" or any variation on the capitilization, we will print a
warning.

While we could be more flexible with the suffix and not break existing
exports, this would set the precedent for needing to support multiple
suffixes in other areas too. It seems safer to get strict as soon as we
can.

Fixes #310.
Relates to https://github.com/godotengine/godot/issues/32678.
Ryan Roden-Corrent 5 년 전
부모
커밋
088a64ecdf
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      io_scene_godot/converters/animation/serializer.py
  2. BIN
      tests/test_scenes/action_animation/animation_loop.blend

+ 6 - 1
io_scene_godot/converters/animation/serializer.py

@@ -4,6 +4,7 @@ import re
 import math
 import bpy
 import mathutils
+import logging
 from ...structures import (NodeTemplate, NodePath, Array, Map,
                            InternalResource)
 
@@ -493,7 +494,11 @@ class AnimationResource(InternalResource):
         super().__init__('Animation', name)
         self['step'] = 0.1
         self['length'] = 0
-        self['loop'] = name.endswith("_loop")
+
+        suffix = (re.search("[-_]loop", name, re.IGNORECASE) or [''])[0]
+        self['loop'] = suffix == "-loop"
+        if suffix and suffix != "-loop":
+            logging.warning("Unknown suffix %s, did you mean '-loop'?", suffix)
 
         # helper attributes, not exported to ESCN
         self.tracks = collections.OrderedDict()

BIN
tests/test_scenes/action_animation/animation_loop.blend