|
|
@ -220,11 +220,13 @@ class ModifierRemoveOperator(ModifierOperator, bpy.types.Operator): |
|
|
|
return {"FINISHED"} |
|
|
|
return {"FINISHED"} |
|
|
|
|
|
|
|
|
|
|
|
def invoke(self, context, event): |
|
|
|
def invoke(self, context, event): |
|
|
|
assert self.active_modifier >= -1 |
|
|
|
|
|
|
|
mods = context.object.plasma_modifiers |
|
|
|
mods = context.object.plasma_modifiers |
|
|
|
self.mods2delete.clear() |
|
|
|
self.mods2delete.clear() |
|
|
|
|
|
|
|
|
|
|
|
want2delete = OrderedSet() |
|
|
|
want2delete = OrderedSet() |
|
|
|
|
|
|
|
if self.active_modifier == -1: |
|
|
|
|
|
|
|
want2delete.update((i.pl_id for i in context.object.plasma_modifiers.modifiers)) |
|
|
|
|
|
|
|
else: |
|
|
|
want2delete.add(self._get_modifier(context).pl_id) |
|
|
|
want2delete.add(self._get_modifier(context).pl_id) |
|
|
|
|
|
|
|
|
|
|
|
# Here's the rub |
|
|
|
# Here's the rub |
|
|
@ -249,8 +251,8 @@ class ModifierRemoveOperator(ModifierOperator, bpy.types.Operator): |
|
|
|
|
|
|
|
|
|
|
|
class ModifierResetOperator(ModifierOperator, bpy.types.Operator): |
|
|
|
class ModifierResetOperator(ModifierOperator, bpy.types.Operator): |
|
|
|
bl_idname = "object.plasma_modifier_reset" |
|
|
|
bl_idname = "object.plasma_modifier_reset" |
|
|
|
bl_label = "Reset the modifier to its default state?" |
|
|
|
bl_label = "Reset the modifier(s) to the default state?" |
|
|
|
bl_description = "Reset the modifier to its default state" |
|
|
|
bl_description = "Reset the modifier(s) to the default state" |
|
|
|
|
|
|
|
|
|
|
|
active_modifier = IntProperty(name="Modifier Display Order", |
|
|
|
active_modifier = IntProperty(name="Modifier Display Order", |
|
|
|
default=-1, |
|
|
|
default=-1, |
|
|
@ -260,13 +262,18 @@ class ModifierResetOperator(ModifierOperator, bpy.types.Operator): |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def execute(self, context): |
|
|
|
def execute(self, context): |
|
|
|
assert self.active_modifier >= 0 |
|
|
|
if self.active_modifier == -1: |
|
|
|
mod = self._get_modifier(context) |
|
|
|
for i in context.object.plasma_modifiers.modifiers: |
|
|
|
props = set(mod.keys()) - {"display_order", "display_name"} |
|
|
|
self._reset(i) |
|
|
|
for i in props: |
|
|
|
else: |
|
|
|
mod.property_unset(i) |
|
|
|
self._reset(self._get_modifier(context)) |
|
|
|
return {"FINISHED"} |
|
|
|
return {"FINISHED"} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _reset(self, modifier): |
|
|
|
|
|
|
|
props = set(modifier.keys()) - {"display_order", "display_name"} |
|
|
|
|
|
|
|
for i in props: |
|
|
|
|
|
|
|
modifier.property_unset(i) |
|
|
|
|
|
|
|
|
|
|
|
def invoke(self, context, event): |
|
|
|
def invoke(self, context, event): |
|
|
|
return context.window_manager.invoke_props_dialog(self) |
|
|
|
return context.window_manager.invoke_props_dialog(self) |
|
|
|
|
|
|
|
|
|
|
|