From e15eccfac5c56caaa2c60a18d491ef539368fa17 Mon Sep 17 00:00:00 2001 From: jb Date: Wed, 10 Feb 2016 22:26:46 +0100 Subject: [PATCH] Move animated physical code into anim post_export + remove a useless test --- korman/exporter/material.py | 2 +- korman/exporter/physics.py | 8 -------- korman/properties/modifiers/anim.py | 9 +++++++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 7a938b9..66c5636 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -166,7 +166,7 @@ class MaterialConverter: if slot.use_stencil: hsgmat.compFlags |= hsGMaterial.kCompNeedsBlendChannel state.blendFlags |= hsGMatState.kBlendAlpha | hsGMatState.kBlendAlphaMult | hsGMatState.kBlendNoTexColor - if slot.texture and slot.texture.type == "BLEND": + if slot.texture.type == "BLEND": state.clampFlags |= hsGMatState.kClampTexture state.ZFlags |= hsGMatState.kZNoZWrite layer.ambient = hsColorRGBA(1.0, 1.0, 1.0, 1.0) diff --git a/korman/exporter/physics.py b/korman/exporter/physics.py index 2db134f..69d5e89 100644 --- a/korman/exporter/physics.py +++ b/korman/exporter/physics.py @@ -77,14 +77,6 @@ class PhysicsConverter: physical.sceneNode = self._mgr.get_scene_node(bl=bo) getattr(self, "_export_{}".format(bounds))(bo, physical) - - if self._exporter().has_coordiface(bo): - if not physical.mass: - # ...Since the object has a coordinate interface but isn't a kickable, it's likely going to be animated. In such case, - # we must warn Plasma to have the collisions follow the object's coordinates as well. - physical.mass = 1. - simIface.setProperty(plSimulationInterface.kPinned, True) - physical.setProperty(plSimulationInterface.kPinned, True) else: simIface = so.sim.object physical = simIface.physical.object diff --git a/korman/properties/modifiers/anim.py b/korman/properties/modifiers/anim.py index aaa0156..35bc254 100644 --- a/korman/properties/modifiers/anim.py +++ b/korman/properties/modifiers/anim.py @@ -143,6 +143,15 @@ class PlasmaAnimationModifier(PlasmaModifierProperties): # If the mass is zero, then we will fail to animate. Fix that. if phys.mass == 0.0: phys.mass = 1.0 + + # On CC and Prime, set kPinned so it doesn't fall through + if bpy.context.scene.world.plasma_age.version in ["pvPots", "pvPrime"]: + sim.setProperty(plSimulationInterface.kPinned, True) + phys.setProperty(plSimulationInterface.kPinned, True) + + # Do the same for children objects + for child in so.coord.object.children: + self.post_export(exporter, None, child.object) class AnimGroupObject(bpy.types.PropertyGroup):