Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions korman/properties/modifiers/water.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,36 @@ 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(idprops.IDPropObjectMixin, bpy.types.PropertyGroup):
display_name = StringProperty(name="Display Name")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been migrating toward having these lists display the actual name of the object or "[Empty]" if unset. IMO, it makes things less tedious.

buoy_object = PointerProperty(name="Buoy Object",
description="Object that float on water",
type=bpy.types.Object,
poll=idprops.poll_mesh_objects)

@classmethod
def _idprop_mapping(cls):
return {"buoy_object": "object_name"}
Comment thread
dpogue marked this conversation as resolved.
Outdated


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):
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".format(self.key_name, i.display_name))
Comment thread
dpogue marked this conversation as resolved.
Outdated
waveset.addBuoy(exporter.mgr.find_create_key(plSceneObject, bl=i.buoy_object))
16 changes: 16 additions & 0 deletions korman/ui/modifiers/water.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,19 @@ 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):
layout.prop(item, "display_name", emboss=False, text="", 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
if modifier.buoys:
buoy = modifier.buoys[modifier.active_buoy_index]
layout.prop(buoy, "buoy_object", icon="MESH_DATA")