Prechádzať zdrojové kódy

fix fps calculation, it should not be cached

Jason0214 6 rokov pred
rodič
commit
8053e642d0

+ 3 - 3
io_scene_godot/converters/animation/serializer.py

@@ -432,8 +432,6 @@ def build_linear_interp_value_track(track_path, action_strip, converter,
 
 
 class AnimationResource(InternalResource):
 class AnimationResource(InternalResource):
     """Internal resource with type Animation"""
     """Internal resource with type Animation"""
-    fps = bpy.context.scene.render.fps
-
     def __init__(self, name):
     def __init__(self, name):
         super().__init__('Animation', name)
         super().__init__('Animation', name)
         self['step'] = 0.1
         self['step'] = 0.1
@@ -444,7 +442,9 @@ class AnimationResource(InternalResource):
         """add a track to animation resource"""
         """add a track to animation resource"""
         node_path_str = track.path.to_string()
         node_path_str = track.path.to_string()
         track_length = (
         track_length = (
-            track.frame_end() - bpy.context.scene.frame_start) / self.fps
+            (track.frame_end() - bpy.context.scene.frame_start) /
+            bpy.context.scene.render.fps
+        )
         if track_length > self['length']:
         if track_length > self['length']:
             self['length'] = track_length
             self['length'] = track_length