[Bf-blender-cvs] [f34685d] master: Fix T39020: Undo/Redo/History buttons missing in "Edit mode"

Bastien Montagne noreply at git.blender.org
Tue Aug 26 16:47:09 CEST 2014


Commit: f34685d8a1a644540e2b80383b407dc2303cf827
Author: Bastien Montagne
Date:   Tue Aug 26 15:41:12 2014 +0200
Branches: master
https://developer.blender.org/rBf34685d8a1a644540e2b80383b407dc2303cf827

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

===================================================================

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index d3dc631..e91ec59 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -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__)




More information about the Bf-blender-cvs mailing list