Fix T39020: Undo/Redo/History buttons missing in "Edit mode"

Remotely based on patch by kevindietrich (Kévin Dietrich), but using
a single generic panel here, as suggested by UI team.

Note we add this panel in all modes (only one tweak in scuplt mode,
where there is no history menu generated it seems, unlike other
'paint-like' modes), we can decide to move it into its own tab later.

Differential Revision: https://developer.blender.org/D733
This commit is contained in:
Bastien Montagne 2014-08-26 15:41:12 +02:00
parent f4eaff82b2
commit f34685d8a1
Notes: blender-bot 2023-02-14 11:03:48 +01:00
Referenced by issue #39020, Undo/Redo/History buttons missing in "Edit mode"
1 changed files with 25 additions and 42 deletions

View File

@ -35,14 +35,6 @@ class View3DPanel():
# **************** standard tool clusters ******************
# History/Repeat tools
def draw_repeat_tools(context, layout):
col = layout.column(align=True)
col.label(text="Repeat:")
col.operator("screen.repeat_last")
col.operator("screen.repeat_history", text="History...")
# Keyframing tools
def draw_keyframing_tools(context, layout):
col = layout.column(align=True)
@ -106,24 +98,6 @@ class VIEW3D_PT_tools_object(View3DPanel, Panel):
row.operator("object.shade_flat", text="Flat")
class VIEW3D_PT_tools_objectmode(View3DPanel, Panel):
bl_category = "Tools"
bl_context = "objectmode"
bl_label = "History"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
row = col.row(align=True)
row.operator("ed.undo")
row.operator("ed.redo")
col.operator("ed.undo_history")
draw_repeat_tools(context, layout)
class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
bl_category = "Create"
bl_context = "objectmode"
@ -362,8 +336,6 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
col.operator_menu_enum("mesh.merge", "type")
col.operator("mesh.remove_doubles")
draw_repeat_tools(context, layout)
class VIEW3D_PT_tools_meshweight(View3DPanel, Panel):
bl_category = "Tools"
@ -541,8 +513,6 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
col.operator("curve.smooth")
col.operator("object.vertex_random")
draw_repeat_tools(context, layout)
class VIEW3D_PT_tools_add_curve_edit(View3DPanel, Panel):
bl_category = "Create"
@ -597,8 +567,6 @@ class VIEW3D_PT_tools_surfaceedit(View3DPanel, Panel):
col.label(text="Deform:")
col.operator("object.vertex_random")
draw_repeat_tools(context, layout)
class VIEW3D_PT_tools_add_surface_edit(View3DPanel, Panel):
bl_category = "Create"
@ -635,8 +603,6 @@ class VIEW3D_PT_tools_textedit(View3DPanel, Panel):
col.operator("font.style_toggle", text="Italic").style = 'ITALIC'
col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE'
draw_repeat_tools(context, layout)
# ********** default tools for editmode_armature ****************
@ -678,8 +644,6 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel, Panel):
col.label(text="Deform:")
col.operator("object.vertex_random")
draw_repeat_tools(context, layout)
class VIEW3D_PT_tools_armatureedit_options(View3DPanel, Panel):
bl_category = "Options"
@ -713,8 +677,6 @@ class VIEW3D_PT_tools_mballedit(View3DPanel, Panel):
col.label(text="Deform:")
col.operator("object.vertex_random")
draw_repeat_tools(context, layout)
class VIEW3D_PT_tools_add_mball_edit(View3DPanel, Panel):
bl_category = "Create"
@ -753,8 +715,6 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel):
col.label(text="Deform:")
col.operator("object.vertex_random")
draw_repeat_tools(context, layout)
# ********** default tools for pose-mode ****************
@ -797,8 +757,6 @@ class VIEW3D_PT_tools_posemode(View3DPanel, Panel):
row.operator("pose.paths_calculate", text="Calculate")
row.operator("pose.paths_clear", text="Clear")
draw_repeat_tools(context, layout)
class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
bl_category = "Options"
@ -1777,5 +1735,30 @@ class VIEW3D_PT_tools_grease_pencil(GreasePencilPanel, Panel):
bl_category = "Grease Pencil"
# Note: moved here so that it's always in last position in 'Tools' panels!
class VIEW3D_PT_tools_history(View3DPanel, Panel):
bl_category = "Tools"
# No bl_context, we are always available!
bl_label = "History"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
obj = context.object
col = layout.column(align=True)
row = col.row(align=True)
row.operator("ed.undo")
row.operator("ed.redo")
if obj is None or obj.mode not in {'SCULPT'}:
# Sculpt mode does not generate an undo menu it seems...
col.operator("ed.undo_history")
col = layout.column(align=True)
col.label(text="Repeat:")
col.operator("screen.repeat_last")
col.operator("screen.repeat_history", text="History...")
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)