Browse Source

Bring more sanity to animation exporter

Rearrange a few things and some sanity checks.
pull/219/head
Patrick Dulebohn 4 years ago
parent
commit
6bb0b32a3c
  1. 29
      korman/exporter/animation.py

29
korman/exporter/animation.py

@ -22,7 +22,7 @@ import weakref
from . import utils from . import utils
class AnimationConverter: class AnimationConverter(plAGAnim):
def __init__(self, exporter): def __init__(self, exporter):
self._exporter = weakref.ref(exporter) self._exporter = weakref.ref(exporter)
self._bl_fps = bpy.context.scene.render.fps self._bl_fps = bpy.context.scene.render.fps
@ -75,7 +75,7 @@ class AnimationConverter:
anim_data = bo.plasma_modifiers.animation anim_data = bo.plasma_modifiers.animation
if anim_data.obj_sdl_anim: if anim_data.obj_sdl_anim:
atcanim = self._mgr.find_create_object(plAgeGlobalAnim, so=so) atcanim = self._mgr.find_create_object(plAgeGlobalAnim, so=so)
else: elif anim_data.obj_sdl_anim is None:
atcanim = self._mgr.find_create_object(plATCAnim, so=so) atcanim = self._mgr.find_create_object(plATCAnim, so=so)
# Add the animation data to the ATC # Add the animation data to the ATC
@ -96,7 +96,7 @@ class AnimationConverter:
if anim_data.obj_sdl_anim: if anim_data.obj_sdl_anim:
atcanim.start = self._convert_frame_time(min(get_ranges(obj_action, index=0))) atcanim.start = self._convert_frame_time(min(get_ranges(obj_action, index=0)))
atcanim.end = self._convert_frame_time(max(get_ranges(obj_action, index=1))) atcanim.end = self._convert_frame_time(max(get_ranges(obj_action, index=1)))
else: elif anim_data.obj_sdl_anim is None:
atcanim.start = self._convert_frame_time(min(get_ranges(obj_action, data_action, index=0))) 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.end = self._convert_frame_time(max(get_ranges(obj_action, data_action, index=1)))
@ -105,18 +105,17 @@ class AnimationConverter:
for marker in obj_action.pose_markers: for marker in obj_action.pose_markers:
atcanim.setMarker(marker.name, self._convert_frame_time(marker.frame)) atcanim.setMarker(marker.name, self._convert_frame_time(marker.frame))
def set_anim_params(plAGAnim): sdl_name = bo.plasma_modifiers.animation.obj_sdl_anim
sdl_name = bo.plasma_modifiers.animation.obj_sdl_anim if sdl_name:
if sdl_name: atcanim.globalVarName = sdl_name
atcanim.globalVarName = sdl_name elif sdl_name is None:
else: # Fixme? Not sure if we really need to expose this...
# Fixme? Not sure if we really need to expose this... atcanim.easeInMin = 1.0
atcanim.easeInMin = 1.0 atcanim.easeInMax = 1.0
atcanim.easeInMax = 1.0 atcanim.easeInLength = 1.0
atcanim.easeInLength = 1.0 atcanim.easeOutMin = 1.0
atcanim.easeOutMin = 1.0 atcanim.easeOutMax = 1.0
atcanim.easeOutMax = 1.0 atcanim.easeOutLength = 1.0
atcanim.easeOutLength = 1.0
def _convert_camera_animation(self, bo, so, obj_fcurves, data_fcurves): def _convert_camera_animation(self, bo, so, obj_fcurves, data_fcurves):
if data_fcurves: if data_fcurves:

Loading…
Cancel
Save