From 9244d3abc7995a583a780c1908632dd5607ca31e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 6 Jul 2024 14:44:29 -0500 Subject: [PATCH] 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. --- korman/properties/modifiers/water.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/korman/properties/modifiers/water.py b/korman/properties/modifiers/water.py index 9b39587..45f8196 100644 --- a/korman/properties/modifiers/water.py +++ b/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",