From 0c155267e46a2139fdceb528a9aa54c00039035a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marein=20K=C3=B6nings?= Date: Fri, 17 Feb 2017 18:30:16 +0100 Subject: [PATCH 1/2] fix for missing axes in position animation fix animation exporter not being able to handle position animation with missing axes (e.g. an animation with only a curve for the X axis) --- korman/exporter/animation.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/korman/exporter/animation.py b/korman/exporter/animation.py index 385df77..3a1b82c 100644 --- a/korman/exporter/animation.py +++ b/korman/exporter/animation.py @@ -319,9 +319,14 @@ class AnimationConverter: pos = kwargs.get(pos_path) scale = kwargs.get(scale_path) + # Since only some position curves may be supplied, construct dict with all positions + # TODO: probably the same is needed for scale but I don't need it now! + allpos = dict(enumerate(pos_default)) + allpos.update(pos) + matrix = hsMatrix44() # Note: scale and pos are dicts, so we can't unpack - matrix.setTranslate(hsVector3(pos[0], pos[1], pos[2])) + matrix.setTranslate(hsVector3(allpos[0], allpos[1], allpos[2])) matrix.setScale(hsVector3(scale[0], scale[1], scale[2])) return matrix From 28264156a05cbda189d379cfe3334956ffd56045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marein=20K=C3=B6nings?= Date: Sat, 18 Feb 2017 19:05:19 +0100 Subject: [PATCH 2/2] fix for missing axes in scale animation --- korman/exporter/animation.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/korman/exporter/animation.py b/korman/exporter/animation.py index 3a1b82c..b1e9dc1 100644 --- a/korman/exporter/animation.py +++ b/korman/exporter/animation.py @@ -320,14 +320,15 @@ class AnimationConverter: scale = kwargs.get(scale_path) # Since only some position curves may be supplied, construct dict with all positions - # TODO: probably the same is needed for scale but I don't need it now! allpos = dict(enumerate(pos_default)) + allscale = dict(enumerate(scale_default)) allpos.update(pos) + allscale.update(scale) matrix = hsMatrix44() # Note: scale and pos are dicts, so we can't unpack matrix.setTranslate(hsVector3(allpos[0], allpos[1], allpos[2])) - matrix.setScale(hsVector3(scale[0], scale[1], scale[2])) + matrix.setScale(hsVector3(allscale[0], allscale[1], allscale[2])) return matrix fcurves = [i for i in fcurves if i.data_path == pos_path or i.data_path == scale_path] @@ -672,7 +673,10 @@ class AnimationConverter: continue for i in range(chan_values): if i not in chan_keyframes.values: - fcurve = grouped_fcurves[chan][i] + if i in grouped_fcurves[chan]: + fcurve = grouped_fcurves[chan][i] + else: + fcurve = defaults[chan][i] if isinstance(fcurve, bpy.types.FCurve): chan_keyframes.values[i] = fcurve.evaluate(chan_keyframes.frame_num_blender) else: