Browse Source

Fix #409.

This clarifies that the "wind object" on the water modifier also controls
the water height. The user visible field has been renamed to "Reference
Object" and the description has been updated to match what is actually
happening. We no longer encode any value for the wind direction into the
PRP if a reference object is specified. Instead, we export the object's
CI and let the engine figure it out at runtime.
pull/416/head
Adam Johnson 5 months ago
parent
commit
9244d3abc7
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 20
      korman/properties/modifiers/water.py

20
korman/properties/modifiers/water.py

@ -182,8 +182,8 @@ class PlasmaWaterModifier(idprops.IDPropMixin, PlasmaModifierProperties, bpy.typ
bl_description = "Basic water properties"
bl_object_types = {"MESH"}
wind_object = PointerProperty(name="Wind Object",
description="Object whose Y axis represents the wind direction",
wind_object = PointerProperty(name="Reference Object",
description="Object whose Y axis represents the wind direction and whose Z axis represents the water height",
type=bpy.types.Object,
poll=idprops.poll_empty_objects)
wind_speed = FloatProperty(name="Wind Speed",
@ -244,15 +244,9 @@ class PlasmaWaterModifier(idprops.IDPropMixin, PlasmaModifierProperties, bpy.typ
def export(self, exporter, bo, so):
waveset = exporter.mgr.find_create_object(plWaveSet7, name=bo.name, so=so)
if self.wind_object:
if exporter.has_coordiface(self.wind_object):
waveset.refObj = exporter.mgr.find_create_key(plSceneObject, bl=self.wind_object)
waveset.setFlag(plWaveSet7.kHasRefObject, True)
# This is much like what happened in PyPRP
speed = self.wind_speed
matrix = self.wind_object.matrix_world
wind_dir = hsVector3(matrix[1][0] * speed, matrix[1][1] * speed, matrix[1][2] * speed)
if self.wind_object is not None:
waveset.refObj = exporter.mgr.find_create_key(plSceneObject, bl=self.wind_object)
waveset.setFlag(plWaveSet7.kHasRefObject, True)
else:
# Stolen shamelessly from PyPRP
wind_dir = hsVector3(0.0871562, 0.996195, 0.0)
@ -296,6 +290,10 @@ class PlasmaWaterModifier(idprops.IDPropMixin, PlasmaModifierProperties, bpy.typ
if not mods.water_shore.enabled:
mods.water_shore.convert_default(state)
def harvest_actors(self):
if self.wind_object is not None:
yield self.wind_object.name
@classmethod
def _idprop_mapping(cls):
return {"wind_object": "wind_object_name",

Loading…
Cancel
Save