Browse Source

Merge pull request #54 from MareinK/animation-missing-axes

fix animation exporter not being able to handle missing axes
pull/66/head
Adam Johnson 8 years ago committed by GitHub
parent
commit
9d3254111a
  1. 15
      korman/exporter/animation.py

15
korman/exporter/animation.py

@ -319,10 +319,16 @@ class AnimationConverter:
pos = kwargs.get(pos_path) pos = kwargs.get(pos_path)
scale = kwargs.get(scale_path) scale = kwargs.get(scale_path)
# Since only some position curves may be supplied, construct dict with all positions
allpos = dict(enumerate(pos_default))
allscale = dict(enumerate(scale_default))
allpos.update(pos)
allscale.update(scale)
matrix = hsMatrix44() matrix = hsMatrix44()
# Note: scale and pos are dicts, so we can't unpack # 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])) matrix.setScale(hsVector3(allscale[0], allscale[1], allscale[2]))
return matrix return matrix
fcurves = [i for i in fcurves if i.data_path == pos_path or i.data_path == scale_path] fcurves = [i for i in fcurves if i.data_path == pos_path or i.data_path == scale_path]
@ -667,7 +673,10 @@ class AnimationConverter:
continue continue
for i in range(chan_values): for i in range(chan_values):
if i not in chan_keyframes.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): if isinstance(fcurve, bpy.types.FCurve):
chan_keyframes.values[i] = fcurve.evaluate(chan_keyframes.frame_num_blender) chan_keyframes.values[i] = fcurve.evaluate(chan_keyframes.frame_num_blender)
else: else:

Loading…
Cancel
Save