mirror of
https://github.com/H-uru/korman.git
synced 2025-07-14 22:36:52 +00:00
Add an operator to reset modifiers to default
This commit is contained in:
@ -131,6 +131,36 @@ class ModifierRemoveOperator(ModifierOperator, bpy.types.Operator):
|
|||||||
return context.window_manager.invoke_props_dialog(self)
|
return context.window_manager.invoke_props_dialog(self)
|
||||||
|
|
||||||
|
|
||||||
|
class ModifierResetOperator(ModifierOperator, bpy.types.Operator):
|
||||||
|
bl_idname = "object.plasma_modifier_reset"
|
||||||
|
bl_label = "Reset the modifier to its default state?"
|
||||||
|
bl_description = "Reset the modifier to its default state"
|
||||||
|
|
||||||
|
active_modifier = IntProperty(name="Modifier Display Order",
|
||||||
|
default=-1,
|
||||||
|
options={"HIDDEN"})
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
assert self.active_modifier >= 0
|
||||||
|
for i in context.object.plasma_modifiers.modifiers:
|
||||||
|
if i.display_order == self.active_modifier:
|
||||||
|
mod = i
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise IndexError(self.active_modifier)
|
||||||
|
|
||||||
|
props = set(mod.keys()) - {"display_order", "display_name"}
|
||||||
|
for i in props:
|
||||||
|
mod.property_unset(i)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
return context.window_manager.invoke_props_dialog(self)
|
||||||
|
|
||||||
|
|
||||||
class ModifierMoveOperator(ModifierOperator):
|
class ModifierMoveOperator(ModifierOperator):
|
||||||
def swap_modifier_ids(self, mods, s1, s2):
|
def swap_modifier_ids(self, mods, s1, s2):
|
||||||
done = 0
|
done = 0
|
||||||
|
@ -77,6 +77,7 @@ class PlasmaModifiersPanel(ModifierButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
row.operator("object.plasma_modifier_move_up", text="", icon="TRIA_UP").active_modifier = modifier.display_order
|
row.operator("object.plasma_modifier_move_up", text="", icon="TRIA_UP").active_modifier = modifier.display_order
|
||||||
row.operator("object.plasma_modifier_move_down", text="", icon="TRIA_DOWN").active_modifier = modifier.display_order
|
row.operator("object.plasma_modifier_move_down", text="", icon="TRIA_DOWN").active_modifier = modifier.display_order
|
||||||
|
row.operator("object.plasma_modifier_reset", text="", icon="FILE_REFRESH").active_modifier = modifier.display_order
|
||||||
row.operator("object.plasma_modifier_remove", text="", icon="X").active_modifier = modifier.display_order
|
row.operator("object.plasma_modifier_remove", text="", icon="X").active_modifier = modifier.display_order
|
||||||
|
|
||||||
# Now we return the modifier box, which is populated with the modifier specific properties
|
# Now we return the modifier box, which is populated with the modifier specific properties
|
||||||
|
Reference in New Issue
Block a user