Browse Source

Merge 532b712ca6 into 29b03a5f08

pull/256/merge
Darryl Pogue 3 months ago committed by GitHub
parent
commit
9b9f22ae0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      korman/idprops.py
  2. 35
      korman/properties/modifiers/water.py
  3. 23
      korman/ui/modifiers/water.py

3
korman/idprops.py

@ -127,6 +127,9 @@ def poll_camera_objects(self, value):
def poll_drawable_objects(self, value):
return value.type == "MESH" and any(value.data.materials)
def poll_dynamic_objects(self, value):
return value.plasma_modifiers.collision.enabled and value.plasma_modifiers.collision.dynamic
def poll_empty_objects(self, value):
return value.type == "EMPTY"

35
korman/properties/modifiers/water.py

@ -475,3 +475,38 @@ class PlasmaWaveTexState(PlasmaWaveState, PlasmaModifierProperties):
def export(self, exporter, bo, so):
waveset = exporter.mgr.find_create_object(plWaveSet7, name=bo.name, so=so)
self.convert_wavestate(waveset.state.texState)
class PlasmaBuoyObject(bpy.types.PropertyGroup):
buoy_object = PointerProperty(name="Buoy Object",
description="Object that float on water",
options=set(),
type=bpy.types.Object,
poll=idprops.poll_dynamic_objects)
class PlasmaWaterBuoyModifier(PlasmaModifierProperties):
pl_depends = {"water_basic"}
pl_id = "water_buoy"
bl_category = "Water"
bl_label = "Water Buoys"
bl_description = ""
buoys = CollectionProperty(type=PlasmaBuoyObject)
active_buoy_index = IntProperty(options={"HIDDEN"})
def export(self, exporter, bo, so):
if exporter.mgr.getVer() != pvMoul:
exporter.report.warning("Not supported on this version of Plasma", indent=3)
return
else:
exporter.report.port("This will only function on MOUL", indent=3)
waveset = exporter.mgr.find_create_object(plWaveSet7, name=bo.name, so=so)
waveset.setFlag(plWaveSet7.kHasBuoys, True)
for i in self.buoys:
if i.buoy_object is None:
raise ExportError("'{}': Buoy Object for '{}' is invalid", self.key_name, i.buoy_object.name)
waveset.addBuoy(exporter.mgr.find_create_key(plSceneObject, bl=i.buoy_object))

23
korman/ui/modifiers/water.py

@ -135,3 +135,26 @@ def water_shore(modifier, layout, context):
col.prop(modifier, "finger")
col.prop(modifier, "edge_opacity")
col.prop(modifier, "edge_radius")
class BuoyListUI(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_property, index=0, flt_flag=0):
if item.buoy_object is None:
layout.label("[No Object Specified]", icon="ERROR")
else:
layout.label(item.buoy_object.name, icon="MOD_CAST")
def water_buoy(modifier, layout, context):
ui_list.draw_modifier_list(layout, "BuoyListUI", modifier, "buoys",
"active_buoy_index", name_prefix="Buoy",
name_prop="display_name", rows=2, maxrows=3)
# Display the active buoy
try:
buoy_ref = modifier.buoys[modifier.active_buoy_index]
except:
pass
else:
layout.alert = buoy_ref.buoy_object is None
layout.prop(buoy_ref, "buoy_object")

Loading…
Cancel
Save