Browse Source

Partially revert physical tweak

pull/6/head
Adam Johnson 10 years ago
parent
commit
48b09e97c2
  1. 7
      korman/exporter/convert.py
  2. 11
      korman/exporter/physics.py

7
korman/exporter/convert.py

@ -79,17 +79,10 @@ class Exporter:
print("\nExported {}.age in {:.2f} seconds".format(self.age_name, end-start)) print("\nExported {}.age in {:.2f} seconds".format(self.age_name, end-start))
def _collect_objects(self): def _collect_objects(self):
apply_xform = bpy.ops.object.transform_apply
for obj in bpy.data.objects: for obj in bpy.data.objects:
if obj.plasma_object.enabled: if obj.plasma_object.enabled:
self._objects.append(obj) self._objects.append(obj)
# For our own sanity, we should apply any scale transform this object has.
# Physicals often have issues with unapplied scale transforms. Other transforms
# will be saved to the DSpan or CoordInterface.
context = {"object": obj, "selected_editable_objects": [obj]}
apply_xform(context, scale=True)
def _export_age_info(self): def _export_age_info(self):
# Make life slightly easier... # Make life slightly easier...
age_info = bpy.context.scene.world.plasma_age age_info = bpy.context.scene.world.plasma_age

11
korman/exporter/physics.py

@ -32,9 +32,14 @@ class PhysicsConverter:
physical.rot = utils.quaternion(mat.to_quaternion()) physical.rot = utils.quaternion(mat.to_quaternion())
physical.pos = utils.vector3(mat.to_translation()) physical.pos = utils.vector3(mat.to_translation())
# Vertices are simple. Note that all scale transforms were applied by the exporter long # Physicals can't have scale...
# before we got here. Yay! scale = mat.to_scale()
vertices = [hsVector3(i.co.x, i.co.y, i.co.z) for i in mesh.vertices] if scale[0] == 1.0 and scale[1] == 1.0 and scale[2] == 1.0:
# Whew, don't need to do any math!
vertices = [hsVector3(i.co.x, i.co.y, i.co.z) for i in mesh.vertices]
else:
# Dagnabbit...
vertices = [hsVector3(i.co.x * scale.x, i.co.y * scale.y, i.co.z * scale.z) for i in mesh.vertices]
if indices: if indices:
indices = [] indices = []

Loading…
Cancel
Save