Commit: 00b3f863b8c4493fb7c93c799c3cdc6f11abb6de
Author: Hans Goudey
Date:   Sat Dec 24 16:09:16 2022 -0500
Branches: master
https://developer.blender.org/rB00b3f863b8c4493fb7c93c799c3cdc6f11abb6de

Curves: Remove option to disable selection

Remove the redundant option to disable selection in order to simplify
the tools and UI, both conceptually and internally.

It was possible to disable curves selection completely by clicking on
the active selection domain. However, that was redundant compared to
just selecting everything by pressing "A". The remaining potential use
could have been saving a selection for later, but that can be done with
more complete attribute editing tools in the future.

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

M       release/scripts/presets/keyconfig/keymap_data/blender_default.py
M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/blenloader/intern/versioning_300.cc
M       source/blender/draw/engines/overlay/overlay_sculpt_curves.cc
M       source/blender/editors/curves/intern/curves_ops.cc
M       source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
M       source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
M       source/blender/makesdna/DNA_curves_types.h
M       source/blender/makesrna/intern/rna_curves.c

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index e6b8cc12b29..7712f75fc64 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -5621,8 +5621,6 @@ def km_sculpt_curves(params):
          {"properties": [("mode", 'SMOOTH')]}),
         ("curves.set_selection_domain", {"type": 'ONE', "value": 'PRESS'}, 
{"properties": [("domain", 'POINT')]}),
         ("curves.set_selection_domain", {"type": 'TWO', "value": 'PRESS'}, 
{"properties": [("domain", 'CURVE')]}),
-        ("curves.disable_selection", {"type": 'ONE', "value": 'PRESS', "alt": 
True}, None),
-        ("curves.disable_selection", {"type": 'TWO', "value": 'PRESS', "alt": 
True}, None),
         *_template_paint_radial_control("curves_sculpt"),
         *_template_items_select_actions(params, "sculpt_curves.select_all"),
         ("sculpt_curves.min_distance_edit", {"type": 'R', "value": 'PRESS', 
"shift": True}, {}),
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 4feb92e71df..0eba15e4267 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -721,18 +721,9 @@ class VIEW3D_HT_header(Header):
                 curves = obj.data
 
                 row = layout.row(align=True)
-
-                # Combine the "use selection" toggle with the "set domain" 
operators
-                # to allow turning selection off directly.
                 domain = curves.selection_domain
-                if domain == 'POINT':
-                    row.prop(curves, "use_sculpt_selection", text="", 
icon='CURVE_BEZCIRCLE')
-                else:
-                    row.operator("curves.set_selection_domain", text="", 
icon='CURVE_BEZCIRCLE').domain = 'POINT'
-                if domain == 'CURVE':
-                    row.prop(curves, "use_sculpt_selection", text="", 
icon='CURVE_PATH')
-                else:
-                    row.operator("curves.set_selection_domain", text="", 
icon='CURVE_PATH').domain = 'CURVE'
+                row.operator("curves.set_selection_domain", text="", 
icon='CURVE_BEZCIRCLE', depress=(domain == 'POINT')).domain = 'POINT'
+                row.operator("curves.set_selection_domain", text="", 
icon='CURVE_PATH', depress=(domain == 'CURVE')).domain = 'CURVE'
 
         # Grease Pencil
         if obj and obj.type == 'GPENCIL' and context.gpencil_data:
diff --git a/source/blender/blenloader/intern/versioning_300.cc 
b/source/blender/blenloader/intern/versioning_300.cc
index 90bca21cbe3..11392d04991 100644
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@ -3846,5 +3846,9 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, 
Main *bmain)
    */
   {
     /* Keep this block, even when empty. */
+    const int CV_SCULPT_SELECTION_ENABLED = (1 << 1);
+    LISTBASE_FOREACH (Curves *, curves_id, &bmain->hair_curves) {
+      curves_id->flag &= ~CV_SCULPT_SELECTION_ENABLED;
+    }
   }
 }
diff --git a/source/blender/draw/engines/overlay/overlay_sculpt_curves.cc 
b/source/blender/draw/engines/overlay/overlay_sculpt_curves.cc
index 68de5dcd11d..73edf9dc5d3 100644
--- a/source/blender/draw/engines/overlay/overlay_sculpt_curves.cc
+++ b/source/blender/draw/engines/overlay/overlay_sculpt_curves.cc
@@ -31,10 +31,6 @@ void OVERLAY_sculpt_curves_cache_init(OVERLAY_Data *vedata)
 
 static bool everything_selected(const Curves &curves_id)
 {
-  if (!(curves_id.flag & CV_SCULPT_SELECTION_ENABLED)) {
-    /* When the selection is disabled, conceptually everything is selected. */
-    return true;
-  }
   const blender::bke::CurvesGeometry &curves = 
blender::bke::CurvesGeometry::wrap(
       curves_id.geometry);
   blender::VArray<float> selection;
diff --git a/source/blender/editors/curves/intern/curves_ops.cc 
b/source/blender/editors/curves/intern/curves_ops.cc
index 01909c304cd..880470ea66f 100644
--- a/source/blender/editors/curves/intern/curves_ops.cc
+++ b/source/blender/editors/curves/intern/curves_ops.cc
@@ -744,13 +744,12 @@ static int curves_set_selection_domain_exec(bContext *C, 
wmOperator *op)
   const eAttrDomain domain = eAttrDomain(RNA_enum_get(op->ptr, "domain"));
 
   for (Curves *curves_id : get_unique_editable_curves(*C)) {
-    if (curves_id->selection_domain == domain && (curves_id->flag & 
CV_SCULPT_SELECTION_ENABLED)) {
+    if (curves_id->selection_domain == domain) {
       continue;
     }
 
     const eAttrDomain old_domain = eAttrDomain(curves_id->selection_domain);
     curves_id->selection_domain = domain;
-    curves_id->flag |= CV_SCULPT_SELECTION_ENABLED;
 
     CurvesGeometry &curves = CurvesGeometry::wrap(curves_id->geometry);
     bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
@@ -802,38 +801,6 @@ static void CURVES_OT_set_selection_domain(wmOperatorType 
*ot)
   RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE));
 }
 
-namespace disable_selection {
-
-static int curves_disable_selection_exec(bContext *C, wmOperator * /*op*/)
-{
-  for (Curves *curves_id : get_unique_editable_curves(*C)) {
-    curves_id->flag &= ~CV_SCULPT_SELECTION_ENABLED;
-
-    /* Use #ID_RECALC_GEOMETRY instead of #ID_RECALC_SELECT because it is 
handled as a generic
-     * attribute for now. */
-    DEG_id_tag_update(&curves_id->id, ID_RECALC_GEOMETRY);
-    WM_event_add_notifier(C, NC_GEOM | ND_DATA, curves_id);
-  }
-
-  WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, nullptr);
-
-  return OPERATOR_FINISHED;
-}
-
-}  // namespace disable_selection
-
-static void CURVES_OT_disable_selection(wmOperatorType *ot)
-{
-  ot->name = "Disable Selection";
-  ot->idname = __func__;
-  ot->description = "Disable the drawing of influence of selection in sculpt 
mode";
-
-  ot->exec = disable_selection::curves_disable_selection_exec;
-  ot->poll = editable_curves_poll;
-
-  ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
 static bool varray_contains_nonzero(const VArray<float> &data)
 {
   bool contains_nonzero = false;
@@ -1035,6 +1002,5 @@ void ED_operatortypes_curves()
   WM_operatortype_append(CURVES_OT_snap_curves_to_surface);
   WM_operatortype_append(CURVES_OT_set_selection_domain);
   WM_operatortype_append(SCULPT_CURVES_OT_select_all);
-  WM_operatortype_append(CURVES_OT_disable_selection);
   WM_operatortype_append(CURVES_OT_surface_set);
 }
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
index a955a074df2..7ae92a99919 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
@@ -26,9 +26,6 @@ static VArray<float> get_curves_selection(const 
CurvesGeometry &curves, const eA
 
 VArray<float> get_curves_selection(const Curves &curves_id)
 {
-  if (!(curves_id.flag & CV_SCULPT_SELECTION_ENABLED)) {
-    return VArray<float>::ForSingle(1.0f, 
CurvesGeometry::wrap(curves_id.geometry).curves_num());
-  }
   return get_curves_selection(CurvesGeometry::wrap(curves_id.geometry),
                               eAttrDomain(curves_id.selection_domain));
 }
@@ -49,9 +46,6 @@ static VArray<float> get_point_selection(const CurvesGeometry 
&curves, const eAt
 
 VArray<float> get_point_selection(const Curves &curves_id)
 {
-  if (!(curves_id.flag & CV_SCULPT_SELECTION_ENABLED)) {
-    return VArray<float>::ForSingle(1.0f, 
CurvesGeometry::wrap(curves_id.geometry).points_num());
-  }
   return get_point_selection(CurvesGeometry::wrap(curves_id.geometry),
                              eAttrDomain(curves_id.selection_domain));
 }
@@ -97,9 +91,6 @@ static IndexMask retrieve_selected_curves(const 
CurvesGeometry &curves,
 
 IndexMask retrieve_selected_curves(const Curves &curves_id, Vector<int64_t> 
&r_indices)
 {
-  if (!(curves_id.flag & CV_SCULPT_SELECTION_ENABLED)) {
-    return CurvesGeometry::wrap(curves_id.geometry).curves_range();
-  }
   return retrieve_selected_curves(CurvesGeometry::wrap(curves_id.geometry),
                                   eAttrDomain(curves_id.selection_domain),
                                   r_indices);
@@ -142,9 +133,6 @@ static IndexMask retrieve_selected_points(const 
CurvesGeometry &curves,
 
 IndexMask retrieve_selected_points(const Curves &curves_id, Vector<int64_t> 
&r_indices)
 {
-  if (!(curves_id.flag & CV_SCULPT_SELECTION_ENABLED)) {
-    return CurvesGeometry::wrap(curves_id.geometry).points_range();
-  }
   return retrieve_selected_points(CurvesGeometry::wrap(curves_id.geometry),
                                   eAttrDomain(curves_id.selection_domain),
                                   r_indices);
diff --git 
a/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
index cc5a5e7ae8a..3e2803ae5b7 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
@@ -81,7 +81,6 @@ struct SelectionPaintOperationExecutor {
 
     curves_id_ = static_cast<Curves *>(object_->data);
     curves_ = &CurvesGeometry::wrap(curves_id_->geometry);
-    curves_id_->flag |= CV_SCULPT_SELECTION_ENABLED;
     if (curves_->curves_num() == 0) {
       return;
     }
diff --git a/source/blender/makesdna/DNA_curves_types.h 
b/source/blender/makesdna/DNA_curves_types.h
index 847a4b8a02c..fea994e2739 100644
--- a/source/blender/makesdna/DNA_curves_types.h
+++ b/source/blender/makesdna/DNA_curves_types.h
@@ -180,7 +180,6 @@ typedef struct Curves {
 /** #Curves.flag */
 enum {
   HA_DS_EXPAND = (1 << 0),
-  CV_SCULPT_SELECTION_ENABLED = (1 << 1),
 };
 
 /** #Curves.symmetry */
diff --git a/source/blender/makesrna/intern/rna_curves.c 
b/source/blender/makesrna/intern/rna_curves.c
index bd4575a1740..f19f632519f 100644
--- a/source/blender/makesrna/intern/rna_curves.c
+++ b/source/blender/makesrna/intern/rna_curves.c
@@ -414,12 +414,6 @@ static void rna_def_curves(BlenderRNA *brna)
   RNA_def_property_clear_flag(prop, PROP_ANIMATABL

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to