Skip to content

Commit 9244d3a

Browse files
committed
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.
1 parent 7363930 commit 9244d3a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

korman/properties/modifiers/water.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ class PlasmaWaterModifier(idprops.IDPropMixin, PlasmaModifierProperties, bpy.typ
182182
bl_description = "Basic water properties"
183183
bl_object_types = {"MESH"}
184184

185-
wind_object = PointerProperty(name="Wind Object",
186-
description="Object whose Y axis represents the wind direction",
185+
wind_object = PointerProperty(name="Reference Object",
186+
description="Object whose Y axis represents the wind direction and whose Z axis represents the water height",
187187
type=bpy.types.Object,
188188
poll=idprops.poll_empty_objects)
189189
wind_speed = FloatProperty(name="Wind Speed",
@@ -244,15 +244,9 @@ def copy_material(self):
244244

245245
def export(self, exporter, bo, so):
246246
waveset = exporter.mgr.find_create_object(plWaveSet7, name=bo.name, so=so)
247-
if self.wind_object:
248-
if exporter.has_coordiface(self.wind_object):
249-
waveset.refObj = exporter.mgr.find_create_key(plSceneObject, bl=self.wind_object)
250-
waveset.setFlag(plWaveSet7.kHasRefObject, True)
251-
252-
# This is much like what happened in PyPRP
253-
speed = self.wind_speed
254-
matrix = self.wind_object.matrix_world
255-
wind_dir = hsVector3(matrix[1][0] * speed, matrix[1][1] * speed, matrix[1][2] * speed)
247+
if self.wind_object is not None:
248+
waveset.refObj = exporter.mgr.find_create_key(plSceneObject, bl=self.wind_object)
249+
waveset.setFlag(plWaveSet7.kHasRefObject, True)
256250
else:
257251
# Stolen shamelessly from PyPRP
258252
wind_dir = hsVector3(0.0871562, 0.996195, 0.0)
@@ -296,6 +290,10 @@ def export(self, exporter, bo, so):
296290
if not mods.water_shore.enabled:
297291
mods.water_shore.convert_default(state)
298292

293+
def harvest_actors(self):
294+
if self.wind_object is not None:
295+
yield self.wind_object.name
296+
299297
@classmethod
300298
def _idprop_mapping(cls):
301299
return {"wind_object": "wind_object_name",

0 commit comments

Comments
 (0)