Skip to content

Commit

Permalink
Fix #409.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Hoikas committed Jul 6, 2024
1 parent 7363930 commit 9244d3a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions korman/properties/modifiers/water.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -244,15 +244,9 @@ def copy_material(self):

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)
Expand Down Expand Up @@ -296,6 +290,10 @@ def export(self, exporter, bo, so):
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",
Expand Down

0 comments on commit 9244d3a

Please sign in to comment.