[Bf-blender-cvs] [b2a569dd683] blender2.8: UI: use pie menu for snap, pivot and proportional editing.

William Reynish noreply at git.blender.org
Wed Sep 26 18:24:52 CEST 2018


Commit: b2a569dd68357e535c79c8a4a74947773f21023f
Author: William Reynish
Date:   Wed Sep 26 17:32:11 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb2a569dd68357e535c79c8a4a74947773f21023f

UI: use pie menu for snap, pivot and proportional editing.

* Proportional pie menu at shift+O.
* Snap pie menu at shift+S.
* Pivot pie menu at comma. Previous comma, ctrl+comma, period
  and ctrl+period shortcuts for specific pivot types were removed.

Ref T56881.

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

M	release/scripts/startup/bl_ui/space_clip.py
M	release/scripts/startup/bl_ui/space_dopesheet.py
M	release/scripts/startup/bl_ui/space_graph.py
M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_nla.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/object/object_ops.c
M	source/blender/editors/space_action/action_ops.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/editors/space_graph/graph_ops.c
M	source/blender/editors/space_image/space_image.c
M	source/blender/editors/space_nla/nla_ops.c
M	source/blender/editors/space_view3d/view3d_ops.c
M	source/blender/editors/transform/transform_ops.c
M	source/blender/editors/uvedit/uvedit_ops.c

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

diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 0a2207019eb..81feab206ed 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1438,6 +1438,19 @@ class CLIP_MT_stabilize_2d_rotation_specials(Menu):
 
         layout.operator("clip.stabilize_2d_rotation_select")
 
+class CLIP_MT_pivot_pie(Menu):
+    bl_label = "Pivot Point"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        pie.prop_enum(context.space_data, "pivot_point", value='BOUNDING_BOX_CENTER')
+        pie.prop_enum(context.space_data, "pivot_point", value='CURSOR')
+        pie.prop_enum(context.space_data, "pivot_point", value='INDIVIDUAL_ORIGINS')
+        pie.prop_enum(context.space_data, "pivot_point", value='MEDIAN_POINT')
+
+
 
 classes = (
     CLIP_UL_tracking_objects,
@@ -1494,6 +1507,7 @@ classes = (
     CLIP_MT_track_color_specials,
     CLIP_MT_stabilize_2d_specials,
     CLIP_MT_stabilize_2d_rotation_specials,
+    CLIP_MT_pivot_pie,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index d10f96b8e81..cf2afd3ab61 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -621,6 +621,19 @@ class DOPESHEET_MT_channel_specials(Menu):
         layout.operator("anim.channels_delete")
 
 
+class DOPESHEET_MT_snap_pie(Menu):
+    bl_label = "Snap"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        pie.operator("action.snap", text="Current Frame").type = 'CFRA'
+        pie.operator("action.snap", text="Nearest Frame").type = 'NEAREST_FRAME'
+        pie.operator("action.snap", text="Nearest Second").type = 'NEAREST_SECOND'
+        pie.operator("action.snap", text="Nearest Marker").type = 'NEAREST_MARKER'
+
+
 classes = (
     DOPESHEET_HT_header,
     DOPESHEET_HT_editor_buttons,
@@ -636,6 +649,7 @@ classes = (
     DOPESHEET_MT_delete,
     DOPESHEET_MT_specials,
     DOPESHEET_MT_channel_specials,
+    DOPESHEET_MT_snap_pie,
     DOPESHEET_PT_filters,
 )
 
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index 9b3708ce5b1..78da2215be0 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -354,6 +354,33 @@ class GRAPH_MT_specials(Menu):
         layout.operator_menu_enum("graph.snap", "type", text="Snap")
 
 
+class GRAPH_MT_pivot_pie(Menu):
+    bl_label = "Pivot Point"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        pie.prop_enum(context.space_data, "pivot_point", value='BOUNDING_BOX_CENTER')
+        pie.prop_enum(context.space_data, "pivot_point", value='CURSOR')
+        pie.prop_enum(context.space_data, "pivot_point", value='INDIVIDUAL_ORIGINS')
+
+
+class GRAPH_MT_snap_pie(Menu):
+    bl_label = "Snap"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        pie.operator("graph.snap", text="Current Frame").type = 'CFRA'
+        pie.operator("graph.snap", text="Cursor Value").type = 'VALUE'
+        pie.operator("graph.snap", text="Nearest Frame").type = 'NEAREST_FRAME'
+        pie.operator("graph.snap", text="Nearest Second").type = 'NEAREST_SECOND'
+        pie.operator("graph.snap", text="Nearest Marker").type = 'NEAREST_MARKER'
+        pie.operator("graph.snap", text="Flatten Handles").type = 'HORIZONTAL'
+
+
 class GRAPH_MT_channel_specials(Menu):
     bl_label = "F-Curve Channel Context Menu"
 
@@ -407,6 +434,8 @@ classes = (
     GRAPH_MT_delete,
     GRAPH_MT_specials,
     GRAPH_MT_channel_specials,
+    GRAPH_MT_pivot_pie,
+    GRAPH_MT_snap_pie,
     GRAPH_PT_filters,
 )
 
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 3c61adc7cac..50b9585b06a 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -488,6 +488,36 @@ class IMAGE_MT_specials(Menu):
             layout.menu("IMAGE_MT_uvs_snap")
 
 
+class IMAGE_MT_pivot_pie(Menu):
+    bl_label = "Pivot Point"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        pie.prop_enum(context.space_data, "pivot_point", value='CENTER')
+        pie.prop_enum(context.space_data, "pivot_point", value='CURSOR')
+        pie.prop_enum(context.space_data, "pivot_point", value='INDIVIDUAL_ORIGINS')
+        pie.prop_enum(context.space_data, "pivot_point", value='MEDIAN')
+
+
+class IMAGE_MT_uvs_snap_pie(Menu):
+    bl_label = "Snap"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        layout.operator_context = 'EXEC_REGION_WIN'
+
+        pie.operator("uv.snap_selected", text="Selected to Pixels", icon='RESTRICT_SELECT_OFF').target = 'PIXELS'
+        pie.operator("uv.snap_cursor", text="Cursor to Pixels", icon='CURSOR').target = 'PIXELS'
+        pie.operator("uv.snap_cursor", text="Cursor to Selected", icon='CURSOR').target = 'SELECTED'
+        pie.operator("uv.snap_selected", text="Selected to Cursor", icon='RESTRICT_SELECT_OFF').target = 'CURSOR'
+        pie.operator("uv.snap_selected", text="Selected to Cursor (Offset)", icon='RESTRICT_SELECT_OFF').target = 'CURSOR_OFFSET'
+        pie.operator("uv.snap_selected", text="Selected to Adjacent Unselected", icon='RESTRICT_SELECT_OFF').target = 'ADJACENT_UNSELECTED'
+
+
 class IMAGE_HT_header(Header):
     bl_space_type = 'IMAGE_EDITOR'
 
@@ -1468,6 +1498,8 @@ classes = (
     IMAGE_MT_uvs_weldalign,
     IMAGE_MT_uvs_select_mode,
     IMAGE_MT_specials,
+    IMAGE_MT_pivot_pie,
+    IMAGE_MT_uvs_snap_pie,
     IMAGE_HT_header,
     MASK_MT_editor_menus,
     IMAGE_PT_mask,
diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py
index c876f1f5a76..69413d46c1f 100644
--- a/release/scripts/startup/bl_ui/space_nla.py
+++ b/release/scripts/startup/bl_ui/space_nla.py
@@ -232,6 +232,18 @@ class NLA_MT_edit_transform(Menu):
         layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
         layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
 
+class NLA_MT_snap_pie(Menu):
+    bl_label = "Snap"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        pie.operator("nla.snap", text="Current Frame").type = 'CFRA'
+        pie.operator("nla.snap", text="Nearest Frame").type = 'NEAREST_FRAME'
+        pie.operator("nla.snap", text="Nearest Second").type = 'NEAREST_SECOND'
+        pie.operator("nla.snap", text="Nearest Marker").type = 'NEAREST_MARKER'
+
 
 classes = (
     NLA_HT_header,
@@ -242,6 +254,7 @@ classes = (
     NLA_MT_marker,
     NLA_MT_add,
     NLA_MT_edit_transform,
+    NLA_MT_snap_pie,
     NLA_PT_filters,
 )
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index cc961fe2ce0..ae915a68ec2 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3785,6 +3785,64 @@ class VIEW3D_MT_shading_pie(Menu):
         pie.prop_enum(view.shading, "type", value='RENDERED')
 
 
+class VIEW3D_MT_pivot_pie(Menu):
+    bl_label = "Pivot Point"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+        obj = context.active_object
+        mode = context.mode
+
+        pie.prop_enum(context.scene.tool_settings, "transform_pivot_point", value='BOUNDING_BOX_CENTER')
+        pie.prop_enum(context.scene.tool_settings, "transform_pivot_point", value='CURSOR')
+        pie.prop_enum(context.scene.tool_settings, "transform_pivot_point", value='INDIVIDUAL_ORIGINS')
+        pie.prop_enum(context.scene.tool_settings, "transform_pivot_point", value='MEDIAN_POINT')
+        pie.prop_enum(context.scene.tool_settings, "transform_pivot_point", value='ACTIVE_ELEMENT')
+        if (obj is None) or (mode in {'OBJECT', 'POSE', 'WEIGHT_PAINT'}):
+            pie.prop(context.scene.tool_settings, "use_transform_pivot_point_align", text="Center Points Only")
+
+
+
+class VIEW3D_MT_orientations_pie(Menu):
+    bl_label = "Orientation"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+        scene = context.scene
+        orientation = scene.current_orientation
+
+        pie.prop(scene, "transform_orientation", expand=True)
+
+
+class VIEW3D_MT_snap_pie(Menu):
+    bl_label = "Snap"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        pie.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid", icon='CURSOR')
+        pie.operator("view3d.snap_selected_to_grid", text="Selection to Grid", icon='RESTRICT_SELECT_OFF')
+        pie.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected", icon='CURSOR')
+        pie.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor", icon='RESTRICT_SELECT_OFF').use_offset = False
+        pie.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Keep Offset)", icon='RESTRICT_SELECT_OFF').use_offset = True
+        pie.operator("view3d.snap_selected_to_active", text="Selection to Active", icon='RESTRICT_SELECT_OFF')
+        pie.operator("view3d.snap_cursor_to_center", text="Cursor to Center", icon='CURSOR')
+        pie.operator("view3d.snap_cursor_to_active", text="Cursor to Active", icon='CURSOR')
+
+class VIEW3D_MT_proportional_editing_falloff_pie(Menu):
+    bl_label = "Proportional Editing Falloff"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+        tool_settings = context.scene.tool_settings
+
+        pie.prop(tool_settings, "proportional_edit_falloff", expand=True)
+
+
 # ********** Panel **********
 
 
@@ -5182,6 +5240,10 @@ classes = (
     VIEW3D_MT_object_mode_pie,
     VIEW3D_MT_view_pie,
     VIEW3D_MT_shading_pie,
+    VIEW3D_M

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list