[Bf-blender-cvs] [154ecaa71ca] soc-2021-curves: Cleanup

Dilith Jayakody noreply at git.blender.org
Sun Apr 3 17:34:19 CEST 2022


Commit: 154ecaa71cacb1ae68d8e249071bf471ad2d35c7
Author: Dilith Jayakody
Date:   Fri Mar 18 15:54:25 2022 +0530
Branches: soc-2021-curves
https://developer.blender.org/rB154ecaa71cacb1ae68d8e249071bf471ad2d35c7

Cleanup

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

M	release/datafiles/locale
M	source/blender/editors/curve/curve_intern.h
M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/curve/editcurve_pen.c
M	source/blender/editors/curve/editcurve_query.c
M	source/blender/editors/include/ED_curve.h

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index c2bbd079d7d..352090e78e9 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit c2bbd079d7da9cb87de52122411709405b3f09d9
+Subproject commit 352090e78e9aa0b1b1a4d59bf9502c30c44c7aff
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index f53807c9719..d2916129d42 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -200,14 +200,14 @@ bool ED_curve_pick_vert(struct ViewContext *vc,
                         struct BPoint **r_bp,
                         short *r_handle,
                         struct Base **r_base);
-bool ED_curve_pick_vert_thresholded(struct ViewContext *vc,
-                                    short sel,
-                                    float sel_dist_mul,
-                                    struct Nurb **r_nurb,
-                                    struct BezTriple **r_bezt,
-                                    struct BPoint **r_bp,
-                                    short *r_handle,
-                                    struct Base **r_base);
+bool ED_curve_pick_vert_ex(struct ViewContext *vc,
+                           short sel,
+                           float sel_dist_mul,
+                           struct Nurb **r_nurb,
+                           struct BezTriple **r_bezt,
+                           struct BPoint **r_bp,
+                           short *r_handle,
+                           struct Base **r_base);
 void ED_curve_nurb_vert_selected_find(
     Curve *cu, View3D *v3d, Nurb **r_nu, BezTriple **r_bezt, BPoint **r_bp);
 
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index f9ded62ea64..3ee103ba399 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -4727,13 +4727,14 @@ bool ED_curve_editnurb_select_pick(bContext *C,
                                    const int mval[2],
                                    const struct SelectPick_Params *params)
 {
-  return ED_curve_editnurb_select_pick_thresholded(C, mval, 1.0f, params);
+  return ED_curve_editnurb_select_pick_ex(C, mval, 1.0f, params);
 }
 
-bool ED_curve_editnurb_select_pick_thresholded(bContext *C,
-                                               const int mval[2],
-                                               const float sel_dist_mul,
-                                               const struct SelectPick_Params *params)
+/* \param sel_dist_mul: A multiplier on the default select distance. */
+bool ED_curve_editnurb_select_pick_ex(bContext *C,
+                                      const int mval[2],
+                                      const float sel_dist_mul,
+                                      const struct SelectPick_Params *params)
 {
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
   ViewContext vc;
@@ -4748,8 +4749,7 @@ bool ED_curve_editnurb_select_pick_thresholded(bContext *C,
   ED_view3d_viewcontext_init(C, &vc, depsgraph);
   copy_v2_v2_int(vc.mval, mval);
 
-  bool found = ED_curve_pick_vert_thresholded(
-      &vc, 1, sel_dist_mul, &nu, &bezt, &bp, &hand, &basact);
+  bool found = ED_curve_pick_vert_ex(&vc, 1, sel_dist_mul, &nu, &bezt, &bp, &hand, &basact);
 
   if (params->sel_op == SEL_OP_SET) {
     if ((found && params->select_passthrough) &&
diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index cebb2676527..954725fff82 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -107,7 +107,7 @@ typedef struct CurvePenData {
   bool multi_point;
   /* Whether a point has already been selected. */
   bool selection_made;
-  /* Whether shift-click was pressed. */
+  /* Whether a shift-click occured. */
   bool select_multi;
 
   /* Whether the current handle type of the moved handle is free. */
@@ -127,28 +127,6 @@ typedef struct CurvePenData {
   BPoint *bp;
 } CurvePenData;
 
-/* Enum to choose between shortcuts for the extra functionalities. */
-typedef enum eExtra_key {
-  NONE = 0,
-  SHIFT = 1,
-  CTRL = 2,
-  ALT = 3,
-  CTRL_SHIFT = 4,
-  CTRL_ALT = 5,
-  SHIFT_ALT = 6
-} eExtra_key;
-
-static const EnumPropertyItem prop_extra_key_types[] = {
-    {NONE, "NONE", 0, "None", ""},
-    {SHIFT, "SHIFT", 0, "Shift", ""},
-    {CTRL, "CTRL", 0, "Ctrl", ""},
-    {ALT, "ALT", 0, "Alt", ""},
-    {CTRL_SHIFT, "CTRL_SHIFT", 0, "Ctrl-Shift", ""},
-    {CTRL_ALT, "CTRL_ALT", 0, "Ctrl-Alt", ""},
-    {SHIFT_ALT, "SHIFT_ALT", 0, "Shift-Alt", ""},
-    {0, NULL, 0, NULL, NULL},
-};
-
 static const EnumPropertyItem prop_handle_types[] = {
     {HD_AUTO, "AUTO", 0, "Auto", ""},
     {HD_VECT, "VECTOR", 0, "Vector", ""},
@@ -210,9 +188,9 @@ static void update_location_for_2d_curve(const ViewContext *vc, float location[3
   }
 }
 
-static void screenspace_to_worldspace(const float pos_2d[2],
+static void screenspace_to_worldspace(const ViewContext *vc,
+                                      const float pos_2d[2],
                                       const float depth[3],
-                                      const ViewContext *vc,
                                       float r_pos_3d[3])
 {
   mul_v3_m4v3(r_pos_3d, vc->obedit->obmat, depth);
@@ -220,17 +198,17 @@ static void screenspace_to_worldspace(const float pos_2d[2],
   update_location_for_2d_curve(vc, r_pos_3d);
 }
 
-static void screenspace_to_worldspace_int(const int pos_2d[2],
+static void screenspace_to_worldspace_int(const ViewContext *vc,
+                                          const int pos_2d[2],
                                           const float depth[3],
-                                          const ViewContext *vc,
                                           float r_pos_3d[3])
 {
   const float pos_2d_fl[2] = {UNPACK2(pos_2d)};
-  screenspace_to_worldspace(pos_2d_fl, depth, vc, r_pos_3d);
+  screenspace_to_worldspace(vc, pos_2d_fl, depth, r_pos_3d);
 }
 
-static bool worldspace_to_screenspace(const float pos_3d[3],
-                                      const ViewContext *vc,
+static bool worldspace_to_screenspace(const ViewContext *vc,
+                                      const float pos_3d[3],
                                       float r_pos_2d[2])
 {
   return ED_view3d_project_float_object(
@@ -276,13 +254,13 @@ static void remove_handle_movement_constraints(BezTriple *bezt, const bool f1, c
   }
 }
 
-static void move_bezt_handle_or_vertex_to_location(BezTriple *bezt,
-                                                   const int bezt_idx,
-                                                   const float disp_2d[2],
-                                                   const bool link_handles,
-                                                   const bool lock_angle,
-                                                   const float distance,
-                                                   const ViewContext *vc)
+static void move_bezt_handle_or_vertex_by_displacement(const ViewContext *vc,
+                                                       BezTriple *bezt,
+                                                       const int bezt_idx,
+                                                       const float disp_2d[2],
+                                                       const float distance,
+                                                       const bool link_handles,
+                                                       const bool lock_angle)
 {
   if (lock_angle) {
     float disp_3d[3];
@@ -292,11 +270,11 @@ static void move_bezt_handle_or_vertex_to_location(BezTriple *bezt,
   }
   else {
     float pos[2], dst[2];
-    worldspace_to_screenspace(bezt->vec[bezt_idx], vc, pos);
+    worldspace_to_screenspace(vc, bezt->vec[bezt_idx], pos);
     add_v2_v2v2(dst, pos, disp_2d);
 
     float location[3];
-    screenspace_to_worldspace(dst, bezt->vec[bezt_idx], vc, location);
+    screenspace_to_worldspace(vc, dst, bezt->vec[bezt_idx], location);
     if (bezt_idx == 1) {
       move_bezt_to_location(bezt, location);
     }
@@ -320,10 +298,10 @@ static void move_bezt_handle_or_vertex_to_location(BezTriple *bezt,
   }
 }
 
-static void move_bp_to_location(BPoint *bp, const float mval[2], const ViewContext *vc)
+static void move_bp_to_location(const ViewContext *vc, BPoint *bp, const float mval[2])
 {
   float location[3];
-  screenspace_to_worldspace(mval, bp->vec, vc, location);
+  screenspace_to_worldspace(vc, mval, bp->vec, location);
 
   copy_v3_v3(bp->vec, location);
 }
@@ -332,9 +310,9 @@ static void move_bp_to_location(BPoint *bp, const float mval[2], const ViewConte
  * \param mid_only: Use only the middle point of the three points on a BezTriple.
  * \param bezt_only: Use only points of Bezier splines. */
 static bool get_selected_center(const ListBase *nurbs,
-                                float r_center[3],
                                 const bool mid_only,
-                                const bool bezt_only)
+                                const bool bezt_only,
+                                float r_center[3])
 {
   int end_count = 0;
   zero_v3(r_center);
@@ -381,11 +359,11 @@ static bool get_selected_center(const ListBase *nurbs,
 }
 
 /* Move all selected points by an amount equivalent to the distance moved by mouse. */
-static void move_all_selected_points(ListBase *nurbs,
-                                     const bool bezt_only,
-                                     CurvePenData *cpd,
+static void move_all_selected_points(const ViewContext *vc,
                                      const wmEvent *event,
-                                     const ViewContext *vc)
+                                     CurvePenData *cpd,
+                                     ListBase *nurbs,
+                                     const bool bezt_only)
 {
   const float mval[2] = {UNPACK2(event->xy)};
   const float prev_mval[2] = {UNPACK2(event->prev_xy)};
@@ -399,8 +377,8 @@ static void move_all_selected_points(ListBase *nurbs,
   float distance = 0.0f;
   if (lock_angle) {
     float mval_3

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list