UI: reorganize proportional editing options
authorCampbell Barton <ideasman42@gmail.com>
Tue, 30 Apr 2019 03:42:18 +0000 (13:42 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 30 Apr 2019 04:48:39 +0000 (14:48 +1000)
- Move connected & projected into individual toggles.
- Top-level proportional editing button now only toggles.
- Use popover for proportional edit-mode falloff and options.

Note that it's no longer possible to toggle connected via key bindings,
although this could be supported again if it's needed.

Resolves T58081

20 files changed:
release/scripts/presets/keyconfig/keymap_data/blender_default.py
release/scripts/startup/bl_ui/properties_grease_pencil_common.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/armature/armature_ops.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/gpencil/gpencil_ops.c
source/blender/editors/mask/mask_edit.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/metaball/mball_ops.c
source/blender/editors/object/object_ops.c
source/blender/editors/space_action/action_ops.c
source/blender/editors/space_graph/graph_ops.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_ops.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_scene.c

index a0798ab..97dd074 100644 (file)
@@ -261,11 +261,11 @@ def _template_items_uv_select_mode(params):
 def _template_items_proportional_editing(*, connected=False):
     return [
         op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}),
-        ("wm.context_toggle_enum", {"type": 'O', "value": 'PRESS'},
-         {"properties": [("data_path", 'tool_settings.proportional_edit'), ("value_1", 'DISABLED'), ("value_2", 'ENABLED')]}),
+        ("wm.context_toggle", {"type": 'O', "value": 'PRESS'},
+         {"properties": [("data_path", 'tool_settings.use_proportional_edit')]}),
         *(() if not connected else (
-            ("wm.context_toggle_enum", {"type": 'O', "value": 'PRESS', "alt": True},
-             {"properties": [("data_path", 'tool_settings.proportional_edit'), ("value_1", 'DISABLED'), ("value_2", 'CONNECTED')]}),
+            ("wm.context_toggle", {"type": 'O', "value": 'PRESS', "alt": True},
+             {"properties": [("data_path", 'tool_settings.use_proportional_connected')]}),
         ))
     ]
 
index 14c616d..734828b 100644 (file)
@@ -386,7 +386,7 @@ class GPENCIL_MT_pie_tool_palette(Menu):
                 row.operator("transform.resize", text="Scale", icon='MAN_SCALE')
                 row = col.row(align=True)
                 row.label(text="Proportional Edit:")
-                row.prop(context.tool_settings, "proportional_edit", text="", icon_only=True)
+                row.prop(context.tool_settings, "use_proportional_edit", text="", icon_only=True)
                 row.prop(context.tool_settings, "proportional_edit_falloff", text="", icon_only=True)
 
                 # NW - Select (Non-Modal)
@@ -808,7 +808,7 @@ class GreasePencilToolsPanel:
 
         layout.label(text="Proportional Edit:")
         row = layout.row()
-        row.prop(context.tool_settings, "proportional_edit", text="")
+        row.prop(context.tool_settings, "use_proportional_edit", text="")
         row.prop(context.tool_settings, "proportional_edit_falloff", text="")
 
         layout.separator()
index 1db1eea..8bffeed 100644 (file)
@@ -265,20 +265,6 @@ class IMAGE_MT_uvs_showhide(Menu):
         layout.operator("uv.hide", text="Hide Unselected").unselected = True
 
 
-class IMAGE_MT_uvs_proportional(Menu):
-    bl_label = "Proportional Editing"
-
-    def draw(self, context):
-        layout = self.layout
-
-        layout.props_enum(context.tool_settings, "proportional_edit")
-
-        layout.separator()
-
-        layout.label(text="Falloff:")
-        layout.props_enum(context.tool_settings, "proportional_edit_falloff")
-
-
 class IMAGE_MT_uvs_transform(Menu):
     bl_label = "Transform"
 
@@ -538,10 +524,9 @@ class IMAGE_HT_tool_header(Header):
 
             # Proportional Editing
             row = layout.row(align=True)
-            row.prop(tool_settings, "proportional_edit", icon_only=True)
-            # if tool_settings.proportional_edit != 'DISABLED':
+            row.prop(tool_settings, "use_proportional_edit", icon_only=True)
             sub = row.row(align=True)
-            sub.active = tool_settings.proportional_edit != 'DISABLED'
+            sub.active = tool_settings.use_proportional_edit
             sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
 
         layout.separator_spacer()
@@ -1588,7 +1573,6 @@ classes = (
     IMAGE_MT_image_invert,
     IMAGE_MT_uvs,
     IMAGE_MT_uvs_showhide,
-    IMAGE_MT_uvs_proportional,
     IMAGE_MT_uvs_transform,
     IMAGE_MT_uvs_snap,
     IMAGE_MT_uvs_mirror,
index bc21daa..b6494e3 100644 (file)
@@ -125,8 +125,8 @@ class SEQUENCER_HT_header(Header):
             # Proportional editing
             if gpd and gpd.use_stroke_edit_mode:
                 row = layout.row(align=True)
-                row.prop(tool_settings, "proportional_edit", icon_only=True)
-                if tool_settings.proportional_edit != 'DISABLED':
+                row.prop(tool_settings, "use_proportional_edit", icon_only=True)
+                if tool_settings.use_proportional_edit:
                     row.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
 
 
index fd45012..b6e2467 100644 (file)
@@ -466,29 +466,29 @@ class VIEW3D_HT_header(Header):
             )
 
         # Proportional editing
-        gpd = context.gpencil_data
-        if object_mode in {'EDIT', 'PARTICLE_EDIT'}:
-            row = layout.row(align=True)
-            row.prop(tool_settings, "proportional_edit", icon_only=True)
-            sub = row.row(align=True)
-            sub.active = tool_settings.proportional_edit != 'DISABLED'
-            sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
-
-        elif object_mode == 'OBJECT':
+        if object_mode in {'EDIT', 'PARTICLE_EDIT', 'SCULPT_GPENCIL', 'EDIT_GPENCIL', 'OBJECT'}:
             row = layout.row(align=True)
-            row.prop(tool_settings, "use_proportional_edit_objects", icon_only=True)
-            sub = row.row(align=True)
-            sub.active = tool_settings.use_proportional_edit_objects
-            sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
+            kw = {}
+            if object_mode == 'OBJECT':
+                attr = "use_proportional_edit_objects"
+            else:
+                attr = "use_proportional_edit"
 
-        elif gpd is not None and obj.type == 'GPENCIL':
-            if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode:
-                row = layout.row(align=True)
-                row.prop(tool_settings, "proportional_edit", icon_only=True)
+                if tool_settings.use_proportional_connected:
+                    kw["icon"] = 'PROP_CON'
+                elif tool_settings.use_proportional_projected:
+                    kw["icon"] = 'PROP_PROJECTED'
 
-                sub = row.row(align=True)
-                sub.active = tool_settings.proportional_edit != 'DISABLED'
-                sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
+            row.prop(tool_settings, attr, icon_only=True, **kw)
+            sub = row.row(align=True)
+            sub.active = getattr(tool_settings, attr)
+            sub.prop_with_popover(
+                tool_settings,
+                "proportional_edit_falloff",
+                text="",
+                icon_only=True,
+                panel="VIEW3D_PT_proportional_edit",
+            )
 
         # grease pencil
         if object_mode == 'PAINT_GPENCIL':
@@ -5761,6 +5761,27 @@ class VIEW3D_PT_snapping(Panel):
         row.prop(tool_settings, "use_snap_scale", text="Scale", toggle=True)
 
 
+class VIEW3D_PT_proportional_edit(Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'HEADER'
+    bl_label = "Proportional Editing"
+    bl_ui_units_x = 8
+
+    def draw(self, context):
+        layout = self.layout
+        tool_settings = context.tool_settings
+        col = layout.column()
+
+        if context.mode != 'OBJECT':
+            col.prop(tool_settings, "use_proportional_connected")
+            sub = col.column()
+            sub.active = not tool_settings.use_proportional_connected
+            sub.prop(tool_settings, "use_proportional_projected")
+            col.separator()
+
+        col.prop(tool_settings, "proportional_edit_falloff", expand=True)
+
+
 class VIEW3D_PT_transform_orientations(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
@@ -6479,6 +6500,7 @@ classes = (
     VIEW3D_PT_overlay_sculpt,
     VIEW3D_PT_pivot_point,
     VIEW3D_PT_snapping,
+    VIEW3D_PT_proportional_edit,
     VIEW3D_PT_gpencil_origin,
     VIEW3D_PT_gpencil_lock,
     VIEW3D_PT_gpencil_guide,
index 3401c6e..b53ae81 100644 (file)
@@ -161,7 +161,7 @@ void ED_operatormacros_armature(void)
       OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
 
   ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move",
                                     "Extrude",
@@ -170,7 +170,7 @@ void ED_operatormacros_armature(void)
   otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
   RNA_boolean_set(otmacro->ptr, "forked", false);
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
 
   /* XXX would it be nicer to just be able to have standard extrude_move,
    * but set the forked property separate?
@@ -182,7 +182,7 @@ void ED_operatormacros_armature(void)
   otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
   RNA_boolean_set(otmacro->ptr, "forked", true);
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
 }
 
 void ED_keymap_armature(wmKeyConfig *keyconf)
index 782b093..3d2ac00 100644 (file)
@@ -147,7 +147,7 @@ void ED_operatormacros_curve(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "CURVE_OT_duplicate");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("CURVE_OT_extrude_move",
@@ -156,7 +156,7 @@ void ED_operatormacros_curve(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "CURVE_OT_extrude");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 }
 
index fce8fa7..db4c601 100644 (file)
@@ -362,7 +362,7 @@ void ED_operatormacros_gpencil(void)
   WM_operatortype_macro_define(ot, "GPENCIL_OT_duplicate");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
   RNA_boolean_set(otmacro->ptr, "gpencil_strokes", true);
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   /* Extrude + Move = Interactively add new points */
@@ -373,7 +373,7 @@ void ED_operatormacros_gpencil(void)
   WM_operatortype_macro_define(ot, "GPENCIL_OT_extrude");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
   RNA_boolean_set(otmacro->ptr, "gpencil_strokes", true);
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 }
 
index 454e7e2..0c5591e 100644 (file)
@@ -520,6 +520,6 @@ void ED_operatormacros_mask(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "MASK_OT_duplicate");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 }
index 8a51b9b..ed5e6c3 100644 (file)
@@ -242,7 +242,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_rip_move",
@@ -251,7 +251,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_rip_edge_move",
@@ -260,7 +260,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "MESH_OT_rip_edge");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move",
@@ -269,7 +269,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_extrude_context_move",
@@ -278,7 +278,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_context");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_extrude_region_shrink_fatten",
@@ -287,7 +287,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move",
@@ -296,7 +296,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move",
@@ -305,7 +305,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move",
@@ -314,7 +314,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_polybuild_face_at_cursor_move",
@@ -323,7 +323,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "MESH_OT_polybuild_face_at_cursor");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 
   ot = WM_operatortype_append_macro("MESH_OT_polybuild_split_at_cursor_move",
@@ -332,7 +332,7 @@ void ED_operatormacros_mesh(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "MESH_OT_polybuild_split_at_cursor");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   RNA_boolean_set(otmacro->ptr, "mirror", false);
 }
 
index 4de2779..c203ca5 100644 (file)
@@ -59,7 +59,7 @@ void ED_operatormacros_metaball(void)
                                     OPTYPE_UNDO | OPTYPE_REGISTER);
   WM_operatortype_macro_define(ot, "MBALL_OT_duplicate_metaelems");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-  RNA_enum_set(otmacro->ptr, "proportional", 0);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
 }
 
 void ED_keymap_metaball(wmKeyConfig *keyconf)
index 8e3f916..afc0297 100644 (file)
@@ -271,7 +271,7 @@ void ED_operatormacros_object(void)
   if (ot) {
     WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
     otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-    RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
+    RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   }
 
   /* grr, should be able to pass options on... */
@@ -283,7 +283,7 @@ void ED_operatormacros_object(void)
     otmacro = WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
     RNA_boolean_set(otmacro->ptr, "linked", true);
     otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-    RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
+    RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
   }
 }
 
index b91ac3c..cba86ac 100644 (file)
@@ -102,7 +102,7 @@ void ED_operatormacros_action(void)
   WM_operatortype_macro_define(ot, "ACTION_OT_duplicate");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
   RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
-  RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
 }
 
 /* ************************** registration - keymaps **********************************/
index 79df476..5c7035a 100644 (file)
@@ -494,7 +494,7 @@ void ED_operatormacros_graph(void)
   WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
   RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
-  RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
+  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
 }
 
 /* ************************** registration - keymaps **********************************/
index c80a0ea..edbc0f9 100644 (file)
@@ -2101,20 +2101,16 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
     }
   }
 
-  /* convert flag to enum */
-  switch (t->flag & T_PROP_EDIT_ALL) {
-    case T_PROP_EDIT:
-      proportional = PROP_EDIT_ON;
-      break;
-    case (T_PROP_EDIT | T_PROP_CONNECTED):
-      proportional = PROP_EDIT_CONNECTED;
-      break;
-    case (T_PROP_EDIT | T_PROP_PROJECTED):
-      proportional = PROP_EDIT_PROJECTED;
-      break;
-    default:
-      proportional = PROP_EDIT_OFF;
-      break;
+  if (t->flag & T_PROP_EDIT_ALL) {
+    if (t->flag & T_PROP_EDIT) {
+      proportional |= PROP_EDIT_USE;
+    }
+    if (t->flag & T_PROP_CONNECTED) {
+      proportional |= PROP_EDIT_CONNECTED;
+    }
+    if (t->flag & T_PROP_PROJECTED) {
+      proportional |= PROP_EDIT_PROJECTED;
+    }
   }
 
   // If modal, save settings back in scene if not set as operator argument
@@ -2123,7 +2119,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
 
     /* skip saving proportional edit if it was not actually used */
     if (!(t->options & CTX_NO_PET)) {
-      if ((prop = RNA_struct_find_property(op->ptr, "proportional")) &&
+      if ((prop = RNA_struct_find_property(op->ptr, "use_proportional_edit")) &&
           !RNA_property_is_set(op->ptr, prop)) {
         if (t->spacetype == SPACE_GRAPH) {
           ts->proportional_fcurve = proportional;
@@ -2132,13 +2128,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
           ts->proportional_action = proportional;
         }
         else if (t->obedit_type != -1) {
-          ts->proportional = proportional;
+          ts->proportional_edit = proportional;
         }
         else if (t->options & CTX_MASK) {
-          ts->proportional_mask = (proportional != PROP_EDIT_OFF);
+          ts->proportional_mask = proportional != 0;
         }
         else {
-          ts->proportional_objects = (proportional != PROP_EDIT_OFF);
+          ts->proportional_objects = proportional != 0;
         }
       }
 
index 7f049f4..d3079ae 100644 (file)
@@ -1239,16 +1239,17 @@ void resetTransRestrictions(TransInfo *t)
 
 static int initTransInfo_edit_pet_to_flag(const int proportional)
 {
-  switch (proportional) {
-    case PROP_EDIT_ON:
-      return T_PROP_EDIT;
-    case PROP_EDIT_CONNECTED:
-      return T_PROP_EDIT | T_PROP_CONNECTED;
-    case PROP_EDIT_PROJECTED:
-      return T_PROP_EDIT | T_PROP_PROJECTED;
-    default:
-      return 0;
+  int flag = 0;
+  if (proportional & PROP_EDIT_USE) {
+    flag |= T_PROP_EDIT;
   }
+  if (proportional & PROP_EDIT_CONNECTED) {
+    flag |= T_PROP_CONNECTED;
+  }
+  if (proportional & PROP_EDIT_PROJECTED) {
+    flag |= T_PROP_PROJECTED;
+  }
+  return flag;
 }
 
 void initTransDataContainers_FromObjectData(TransInfo *t,
@@ -1651,9 +1652,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
   }
 
   /* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
-  if (op && (prop = RNA_struct_find_property(op->ptr, "proportional"))) {
+  if (op && (prop = RNA_struct_find_property(op->ptr, "use_proportional_edit"))) {
     if (RNA_property_is_set(op->ptr, prop)) {
-      t->flag |= initTransInfo_edit_pet_to_flag(RNA_property_enum_get(op->ptr, prop));
+      int proportional = PROP_EDIT_USE;
+      if (RNA_boolean_get(op->ptr, "use_proportional_connected")) {
+        proportional |= PROP_EDIT_CONNECTED;
+      }
+      if (RNA_boolean_get(op->ptr, "use_proportional_projected")) {
+        proportional |= PROP_EDIT_PROJECTED;
+      }
+      t->flag |= initTransInfo_edit_pet_to_flag(proportional);
     }
     else {
       /* use settings from scene only if modal */
@@ -1666,16 +1674,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
             t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_action);
           }
           else if (t->obedit_type != -1) {
-            t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional);
+            t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_edit);
           }
           else if (t->options & CTX_GPENCIL_STROKES) {
-            t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional);
+            t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_edit);
           }
           else if (t->options & CTX_MASK) {
             if (ts->proportional_mask) {
               t->flag |= T_PROP_EDIT;
 
-              if (ts->proportional == PROP_EDIT_CONNECTED) {
+              if (ts->proportional_edit & PROP_EDIT_CONNECTED) {
                 t->flag |= T_PROP_CONNECTED;
               }
             }
index b4c539f..0c2f778 100644 (file)
@@ -547,10 +547,9 @@ static bool transform_poll_property(const bContext *UNUSED(C),
 
   /* Proportional Editing. */
   {
-    PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "proportional");
-    if (prop_pet && (prop_pet != prop) &&
-        (RNA_property_enum_get(op->ptr, prop_pet) == PROP_EDIT_OFF)) {
-      if (STRPREFIX(prop_id, "proportional")) {
+    PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "use_proportional_edit");
+    if (prop_pet && (prop_pet != prop) && (RNA_property_boolean_get(op->ptr, prop_pet) == false)) {
+      if (STRPREFIX(prop_id, "proportional") || STRPREFIX(prop_id, "use_proportional")) {
         return false;
       }
     }
@@ -610,12 +609,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
   }
 
   if (flags & P_PROPORTIONAL) {
-    RNA_def_enum(ot->srna,
-                 "proportional",
-                 rna_enum_proportional_editing_items,
-                 0,
-                 "Proportional Editing",
-                 "");
+    RNA_def_boolean(ot->srna, "use_proportional_edit", 0, "Proportional Editing", "");
     prop = RNA_def_enum(ot->srna,
                         "proportional_edit_falloff",
                         rna_enum_proportional_falloff_items,
@@ -633,6 +627,9 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
                   "",
                   0.001f,
                   100.0f);
+
+    RNA_def_boolean(ot->srna, "use_proportional_connected", 0, "Connected", "");
+    RNA_def_boolean(ot->srna, "use_proportional_projected", 0, "Projected (2D)", "");
   }
 
   if (flags & P_SNAP) {
index 28eb481..e3285a5 100644 (file)
@@ -1467,7 +1467,7 @@ typedef struct ToolSettings {
   char snap_target;
   char snap_transform_mode_flag;
 
-  char proportional, prop_mode;
+  char proportional_edit, prop_mode;
   /** Proportional edit, object mode. */
   char proportional_objects;
   /** Proportional edit, mask editing. */
@@ -2078,11 +2078,12 @@ enum {
 #define PROP_INVSQUARE 7
 #define PROP_MODE_MAX 8
 
-/* ToolSettings.proportional */
-#define PROP_EDIT_OFF 0
-#define PROP_EDIT_ON 1
-#define PROP_EDIT_CONNECTED 2
-#define PROP_EDIT_PROJECTED 3
+/** #ToolSettings.proportional_edit & similarly named members. */
+enum {
+  PROP_EDIT_USE = (1 << 0),
+  PROP_EDIT_CONNECTED = (1 << 1),
+  PROP_EDIT_PROJECTED = (1 << 2),
+};
 
 /* ToolSettings.weightuser */
 enum {
index 463d612..5679154 100644 (file)
@@ -44,7 +44,6 @@ extern const EnumPropertyItem rna_enum_metaelem_type_items[];
 
 extern const EnumPropertyItem rna_enum_proportional_falloff_items[];
 extern const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[];
-extern const EnumPropertyItem rna_enum_proportional_editing_items[];
 extern const EnumPropertyItem rna_enum_snap_target_items[];
 extern const EnumPropertyItem rna_enum_snap_element_items[];
 extern const EnumPropertyItem rna_enum_snap_node_element_items[];
index 8802eb0..bb42c04 100644 (file)
@@ -148,22 +148,6 @@ const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[] = {
     {0, NULL, 0, NULL, NULL},
 };
 
-const EnumPropertyItem rna_enum_proportional_editing_items[] = {
-    {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
-    {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
-    {PROP_EDIT_PROJECTED,
-     "PROJECTED",
-     ICON_PROP_PROJECTED,
-     "Projected (2D)",
-     "Proportional Editing using screen space locations"},
-    {PROP_EDIT_CONNECTED,
-     "CONNECTED",
-     ICON_PROP_CON,
-     "Connected",
-     "Proportional Editing using connected geometry only"},
-    {0, NULL, 0, NULL, NULL},
-};
-
 /* keep for operators, not used here */
 const EnumPropertyItem rna_enum_mesh_select_mode_items[] = {
     {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
@@ -2798,19 +2782,29 @@ static void rna_def_tool_settings(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
 
   /* Transform */
-  prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_sdna(prop, NULL, "proportional");
-  RNA_def_property_enum_items(prop, rna_enum_proportional_editing_items);
-  RNA_def_property_ui_text(prop,
-                           "Proportional Editing",
-                           "Proportional Editing mode, allows transforms with distance fall-off");
+  prop = RNA_def_property(srna, "use_proportional_edit", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_USE);
+  RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional edit mode");
+  RNA_def_property_ui_icon(prop, ICON_PROP_ON, 0);
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
   prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
   RNA_def_property_ui_text(
       prop, "Proportional Editing Objects", "Proportional editing object mode");
-  RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
+  RNA_def_property_ui_icon(prop, ICON_PROP_ON, 0);
+  RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+  prop = RNA_def_property(srna, "use_proportional_projected", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_PROJECTED);
+  RNA_def_property_ui_text(
+      prop, "Projected from View", "Proportional Editing using screen space locations");
+  RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+  prop = RNA_def_property(srna, "use_proportional_connected", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_CONNECTED);
+  RNA_def_property_ui_text(
+      prop, "Connected Only", "Proportional Editing using connected geometry only");
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
   prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);