Browse Source

Replace object.location with matrix_world.translation

pull/290/head
Jrius 3 years ago
parent
commit
7bc99d0726
  1. 2
      korman/exporter/camera.py
  2. 2
      korman/exporter/material.py
  3. 2
      korman/exporter/mesh.py
  4. 5
      korman/properties/modifiers/avatar.py
  5. 4
      korman/properties/modifiers/gui.py
  6. 6
      korman/properties/modifiers/water.py
  7. 2
      korman/properties/prop_camera.py

2
korman/exporter/camera.py

@ -132,7 +132,7 @@ class CameraConverter:
# specifying an actual center allows you to do interesting things like animate the center...
# Fascinating! Therefore, we will expose the Plasma Object...
if props.circle_center is None:
brain.center = hsVector3(*bo.location)
brain.center = hsVector3(*bo.matrix_world.translation)
else:
brain.centerObject = self._mgr.find_create_key(plSceneObject, bl=props.circle_center)
# This flag has no effect in CWE, but I'm using it for correctness' sake

2
korman/exporter/material.py

@ -779,7 +779,7 @@ class MaterialConverter:
# will probably want to steal it for diabolical purposes... In MOUL, root objects are
# allowed, but that introduces a gotcha with regard to animated roots and PotS. Also,
# sharing root objects with a DCM seems to result in bad problems in game O.o
pl_env.position = hsVector3(*viewpt.location)
pl_env.position = hsVector3(*viewpt.matrix_world.translation)
if layer is not None:
layer.UVWSrc = plLayerInterface.kUVWReflect

2
korman/exporter/mesh.py

@ -658,7 +658,7 @@ class MeshConverter(_MeshManager):
# FIXME: Can some of this be generalized?
geospan.props |= (plGeometrySpan.kWaterHeight | plGeometrySpan.kLiteVtxNonPreshaded |
plGeometrySpan.kPropReverseSort | plGeometrySpan.kPropNoShadow)
geospan.waterHeight = bo.location[2]
geospan.waterHeight = bo.matrix_world.translation[2]
return [_GeoSpan(bo, blmat, geospan)], None
else:
geospans = [None] * len(materials)

5
korman/properties/modifiers/avatar.py

@ -64,10 +64,7 @@ class PlasmaLadderModifier(PlasmaModifierProperties):
ladderVec = self.facing_object.matrix_world.translation - bo.matrix_world.translation
else:
# Make our own artificial target -1.0 units back on the local Y axis.
world = bo.matrix_world.copy()
world.invert()
target = bo.location - (mathutils.Vector((0.0, 1.0, 0.0)) * world)
ladderVec = target - bo.matrix_local.translation
ladderVec = mathutils.Vector((0, -1, 0)) * bo.matrix_world.inverted()
mod.ladderView = hsVector3(ladderVec.x, ladderVec.y, 0.0)
mod.ladderView.normalize()

4
korman/properties/modifiers/gui.py

@ -230,7 +230,7 @@ class PlasmaJournalBookModifier(PlasmaModifierProperties, PlasmaModifierLogicWiz
if self.clickable_region is None:
with utils.bmesh_object("{}_Journal_ClkRgn".format(self.key_name)) as (rgn_obj, bm):
bmesh.ops.create_cube(bm, size=(6.0))
bmesh.ops.transform(bm, matrix=mathutils.Matrix.Translation(bo.location - rgn_obj.location),
bmesh.ops.transform(bm, matrix=mathutils.Matrix.Translation(bo.matrix_world.translation - rgn_obj.matrix_world.translation),
space=rgn_obj.matrix_world, verts=bm.verts)
rgn_obj.plasma_object.enabled = True
rgn_obj.hide_render = True
@ -466,7 +466,7 @@ class PlasmaLinkingBookModifier(PlasmaModifierProperties, PlasmaModifierLogicWiz
if self.clickable_region is None:
with utils.bmesh_object("{}_LinkingBook_ClkRgn".format(self.key_name)) as (rgn_obj, bm):
bmesh.ops.create_cube(bm, size=(6.0))
rgn_offset = mathutils.Matrix.Translation(self.clickable.location - bo.location)
rgn_offset = mathutils.Matrix.Translation(self.clickable.matrix_world.translation - bo.matrix_world.translation)
bmesh.ops.transform(bm, matrix=rgn_offset, space=bo.matrix_world, verts=bm.verts)
rgn_obj.plasma_object.enabled = True
rgn_obj.hide_render = True

6
korman/properties/modifiers/water.py

@ -114,7 +114,7 @@ class PlasmaSwimRegion(idprops.IDPropObjectMixin, PlasmaModifierProperties, bpy.
losdbs = ["kLOSDBSwimRegion"]
member_group = "kGroupLOSOnly" if exporter.mgr.getVer() != pvMoul else "kGroupStatic"
if bo.plasma_modifiers.water_basic.enabled:
exporter.physics.generate_flat_proxy(bo, so, z_coord=bo.location[2],
exporter.physics.generate_flat_proxy(bo, so, z_coord=bo.matrix_world.translation[2],
member_group=member_group,
losdbs=losdbs)
else:
@ -258,7 +258,7 @@ class PlasmaWaterModifier(idprops.IDPropMixin, PlasmaModifierProperties, bpy.typ
# Stuff we expose
state = waveset.state
state.rippleScale = self.ripple_scale
state.waterHeight = bo.location[2]
state.waterHeight = bo.matrix_world.translation[2]
state.windDir = wind_dir
state.specVector = hsVector3(self.noise / 100.0, self.specular_start, self.specular_end)
state.specularTint = hsColorRGBA(*self.specular_tint, alpha=self.specular_alpha)
@ -273,7 +273,7 @@ class PlasmaWaterModifier(idprops.IDPropMixin, PlasmaModifierProperties, bpy.typ
state.envCenter = dem.position
state.envRefresh = dem.refreshRate
else:
state.envCenter = hsVector3(*bo.location)
state.envCenter = hsVector3(*bo.matrix_world.translation)
state.envRefresh = 0.0
state.envRadius = self.envmap_radius

2
korman/properties/prop_camera.py

@ -225,7 +225,7 @@ class PlasmaCameraProperties(bpy.types.PropertyGroup):
"""Gets the circle camera radius for this camera when it is attached to the given Object"""
assert bo is not None
if self.circle_center is not None:
vec = bo.location - self.circle_center.location
vec = bo.matrix_world.translation - self.circle_center.matrix_world.translation
return vec.magnitude
return self.circle_radius_value

Loading…
Cancel
Save