Browse Source

Add plAgeGlobalAnim support

Adds SDL Global animation to Korman
pull/219/head
Patrick Dulebohn 4 years ago
parent
commit
32e2553d36
  1. 35
      korman/exporter/animation.py
  2. 3
      korman/properties/modifiers/anim.py
  3. 3
      korman/ui/modifiers/anim.py

35
korman/exporter/animation.py

@ -72,7 +72,11 @@ class AnimationConverter:
# There is a race condition in the client with animation loading. It expects for modifiers
# 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)
atcanim = self._mgr.find_create_object(plATCAnim, so=so)
anim_data = bo.plasma_modifiers.animation
if anim_data.obj_sdl_anim:
atcanim = self._mgr.find_create_object(plAgeGlobalAnim, so=so)
else:
atcanim = self._mgr.find_create_object(plATCAnim, so=so)
# Add the animation data to the ATC
for i in applicators:
@ -89,21 +93,30 @@ class AnimationConverter:
if i is not None:
yield i.frame_range[index]
atcanim.name = "(Entire Animation)"
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 anim_data.obj_sdl_anim:
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)))
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)))
# Marker points
if obj_action is not None:
if obj_action is not None and anim_data.obj_sdl_anim is None:
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 set_anim_params(plAGAnim):
sdl_name = bo.plasma_modifiers.animation.obj_sdl_anim
if sdl_name:
atcanim.globalVarName = sdl_name
else:
# 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:

3
korman/properties/modifiers/anim.py

@ -60,6 +60,9 @@ class PlasmaAnimationModifier(ActionModifier, PlasmaModifierProperties):
description="Marker indicating where the default loop begins")
loop_end = StringProperty(name="Loop End",
description="Marker indicating where the default loop ends")
obj_sdl_anim = StringProperty(name="SDL Animation",
description="Name of the SDL variable to use for this animation",
options=set())
def export(self, exporter, bo, so):
action = self.blender_action

3
korman/ui/modifiers/anim.py

@ -43,6 +43,9 @@ def animation(modifier, layout, context):
col.enabled = modifier.loop
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="")
def animation_filter(modifier, layout, context):
split = layout.split()

Loading…
Cancel
Save