浏览代码

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. 二进制
      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()

二进制
tests/test_scenes/action_animation/animation_loop.blend