From 740da9c92b31311bb5ee4ef97f72c6e527576e71 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 2 Dec 2017 21:51:30 -0500 Subject: [PATCH] Don't export plOmniSqApplicator to PotS or ABM This is unimplemented and causes the game to crash when dereferencing a null controller. --- korman/exporter/animation.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/korman/exporter/animation.py b/korman/exporter/animation.py index 0bea4e4..fd1ac63 100644 --- a/korman/exporter/animation.py +++ b/korman/exporter/animation.py @@ -188,20 +188,23 @@ class AnimationConverter: applicator.channel = channel yield applicator elif falloff == "INVERSE_SQUARE": - def convert_quadratic_atten(distance, energy): - intens = abs(energy[0]) - atten_end = distance[0] if lamp.use_sphere else distance[0] * 2 - return light_converter.convert_attenuation_quadratic(intens, atten_end) - - keyframes = self._process_fcurves([distance_fcurve, energy_fcurve], convert_quadratic_atten, - {"distance": lamp.distance, "energy": lamp.energy}) - if keyframes: - channel = plScalarControllerChannel() - channel.controller = self._make_scalar_leaf_controller(keyframes, False) - applicator = plOmniSqApplicator() - applicator.channelName = name - applicator.channel = channel - yield applicator + if self._mgr.getVer() >= pvMoul: + def convert_quadratic_atten(distance, energy): + intens = abs(energy[0]) + atten_end = distance[0] if lamp.use_sphere else distance[0] * 2 + return light_converter.convert_attenuation_quadratic(intens, atten_end) + + keyframes = self._process_fcurves([distance_fcurve, energy_fcurve], convert_quadratic_atten, + {"distance": lamp.distance, "energy": lamp.energy}) + if keyframes: + channel = plScalarControllerChannel() + channel.controller = self._make_scalar_leaf_controller(keyframes, False) + applicator = plOmniSqApplicator() + applicator.channelName = name + applicator.channel = channel + yield applicator + else: + self._exporter().report.port("Lamp Falloff '{}' animations only partially supported for this version of Plasma", falloff, indent=3) else: self._exporter().report.warn("Lamp Falloff '{}' animations are not supported".format(falloff), ident=3)