From e7827e0c52ea2819508f99590f30d956b5306ed6 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 8 Jul 2015 20:51:05 -0400 Subject: [PATCH] Don't truncate matrix44 controllers --- korman/exporter/animation.py | 9 +++++++-- korman/exporter/material.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/korman/exporter/animation.py b/korman/exporter/animation.py index b8e1d54..7e961dc 100644 --- a/korman/exporter/animation.py +++ b/korman/exporter/animation.py @@ -14,6 +14,7 @@ # along with Korman. If not, see . import bpy +import itertools import math import mathutils from PyHSPlasma import * @@ -54,8 +55,12 @@ class AnimationConverter: # a lot of temporary objects, but until I see profiling results that this is terrible, I prefer # to have code that makes sense. keyframes = [] - for pos, scale in zip(pos_keyframes, scale_keyframes): - if pos.frame_num == scale.frame_num: + for pos, scale in itertools.zip_longest(pos_keyframes, scale_keyframes, fillvalue=None): + if pos is None: + keyframes.append((None, scale)) + elif scale is None: + keyframes.append((pos, scale)) + elif pos.frame_num == scale.frame_num: keyframes.append((pos, scale)) elif pos.frame_num < scale.frame_num: keyframes.append((pos, None)) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index b460791..563151d 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -349,8 +349,8 @@ class MaterialConverter: return None def _export_layer_transform_animation(self, bm, tex_slot, base_layer, fcurves): - pos_fcurves = (i for i in fcurves if i.data_path.find("offset") != -1) - scale_fcurves = (i for i in fcurves if i.data_path.find("scale") != -1) + pos_fcurves = [i for i in fcurves if i.data_path.find("offset") != -1] + scale_fcurves = [i for i in fcurves if i.data_path.find("scale") != -1] # Plasma uses the controller to generate a matrix44... so we have to produce a leaf controller ctrl = self._exporter().animation.make_matrix44_controller(pos_fcurves, scale_fcurves, tex_slot.offset, tex_slot.scale)