From b9db5476696ff537290982586872b8a4d4b5f5a7 Mon Sep 17 00:00:00 2001 From: Patrick Dulebohn Date: Fri, 9 Oct 2020 18:16:24 -0400 Subject: [PATCH] Even more added fixes More Hoikas suggestions that should get things ready for review. --- korman/exporter/animation.py | 40 ++++++++++++----------------- korman/properties/modifiers/anim.py | 6 ++--- korman/ui/modifiers/anim.py | 10 +++++--- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/korman/exporter/animation.py b/korman/exporter/animation.py index 4d06a45..623bd03 100644 --- a/korman/exporter/animation.py +++ b/korman/exporter/animation.py @@ -73,10 +73,7 @@ class AnimationConverter: # to be listed on the SceneObject in a specific order. D'OH! So, always use these funcs. agmod, agmaster = self.get_anigraph_objects(bo, so) anim_mod = bo.plasma_modifiers.animation - if anim_mod.obj_sdl_anim: - atcanim = self._mgr.find_create_object(plAgeGlobalAnim, so=so) - else: - atcanim = self._mgr.find_create_object(plATCAnim, so=so) + atcanim = self._mgr.find_create_object(anim_mod.anim_type, so=so) # Add the animation data to the ATC for i in applicators: @@ -93,26 +90,23 @@ class AnimationConverter: if i is not None: yield i.frame_range[index] atcanim.name = "(Entire Animation)" - def anim_range_type(plAGAnim): - if anim_mod.obj_sdl_anim: - atcanim.start = self._convert_frame_time(min(get_ranges(obj_action, data_action, index=0))) - atcanim.end = self._convert_frame_time(max(get_ranges(obj_action, data_action, index=1))) - atcanim.globalVarName = anim_mod.obj_sdl_anim - else: - atcanim.start = self._convert_frame_time(min(get_ranges(obj_action, data_action, index=0))) - atcanim.end = self._convert_frame_time(max(get_ranges(obj_action, data_action, index=1))) - # Fixme? Not sure if we really need to expose this... - atcanim.easeInMin = 1.0 - atcanim.easeInMax = 1.0 - atcanim.easeInLength = 1.0 - atcanim.easeOutMin = 1.0 - atcanim.easeOutMax = 1.0 - atcanim.easeOutLength = 1.0 - + sdl_name = bo.plasma_modifiers.animation.obj_sdl_anim + atcanim.start = self._convert_frame_time(min(get_ranges(obj_action, data_action, index=0))) + atcanim.end = self._convert_frame_time(max(get_ranges(obj_action, data_action, index=1))) + if isinstance(atcanim, plAgeGlobalAnim): + atcanim.globalVarName = anim_mod.obj_sdl_anim + if isinstance(atcanim, plATCAnim): # Marker points - if obj_action is not None and anim_mod is None: - for marker in obj_action.pose_markers: - atcanim.setMarker(marker.name, self._convert_frame_time(marker.frame)) + if obj_action is not None and not anim_data.obj_sdl_anim: + for marker in obj_action.pose_markers: + atcanim.setMarker(marker.name, self._convert_frame_time(marker.frame)) + # Fixme? Not sure if we really need to expose this... + atcanim.easeInMin = 1.0 + atcanim.easeInMax = 1.0 + atcanim.easeInLength = 1.0 + atcanim.easeOutMin = 1.0 + atcanim.easeOutMax = 1.0 + atcanim.easeOutLength = 1.0 def _convert_camera_animation(self, bo, so, obj_fcurves, data_fcurves): if data_fcurves: diff --git a/korman/properties/modifiers/anim.py b/korman/properties/modifiers/anim.py index 5625b2d..1bcd989 100644 --- a/korman/properties/modifiers/anim.py +++ b/korman/properties/modifiers/anim.py @@ -71,10 +71,8 @@ class PlasmaAnimationModifier(ActionModifier, PlasmaModifierProperties): def export(self, exporter, bo, so): action = self.blender_action anim_mod = bo.plasma_modifiers.animation - anim = exporter.mgr.find_create_object(anim_mod.anim_type, so=so) - if isinstance(anim, plAgeGlobalAnim): - atcanim = exporter.mgr.find_create_object(plAgeGlobalAnim, so=so) - else: + atcanim = exporter.mgr.find_create_object(anim_mod.anim_type, so=so) + if not isinstance(atcanim, plAgeGlobalAnim): atcanim = exporter.mgr.find_create_object(plATCAnim, so=so) atcanim.autoStart = self.auto_start atcanim.loop = self.loop diff --git a/korman/ui/modifiers/anim.py b/korman/ui/modifiers/anim.py index 5decd6d..2903e65 100644 --- a/korman/ui/modifiers/anim.py +++ b/korman/ui/modifiers/anim.py @@ -32,6 +32,7 @@ def animation(modifier, layout, context): return split = layout.split() + col = layout.column() col = split.column() col.prop(modifier, "auto_start") col = split.column() @@ -40,12 +41,13 @@ def animation(modifier, layout, context): if action: layout.prop_search(modifier, "initial_marker", action, "pose_markers", icon="PMARKER") col = layout.column() - col.enabled = modifier.loop + col.enabled = modifier.loop and not modifier.obj_sdl_anim col.prop_search(modifier, "loop_start", action, "pose_markers", icon="PMARKER") col.prop_search(modifier, "loop_end", action, "pose_markers", icon="PMARKER") - - col.label("SDL Animation:") - col.prop(modifier, "obj_sdl_anim", text="") + col = layout.column() + col.label("SDL Animation:") + col.prop(modifier, "obj_sdl_anim", text="") + def animation_filter(modifier, layout, context): split = layout.split()