[Bf-blender-cvs] [4e6bd046d5f] soc-2021-curves: Renamed tool from edit tool to pen tool

dilithjay noreply at git.blender.org
Sun Jun 13 17:25:09 CEST 2021


Commit: 4e6bd046d5f2533502ec61a1c55bd68c130ebc38
Author: dilithjay
Date:   Sun Jun 13 20:54:50 2021 +0530
Branches: soc-2021-curves
https://developer.blender.org/rB4e6bd046d5f2533502ec61a1c55bd68c130ebc38

Renamed tool from edit tool to pen tool

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	source/blender/editors/curve/curve_intern.h
M	source/blender/editors/curve/curve_ops.c
M	source/blender/editors/curve/editcurve_tool.c

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 2e58783a86f..8d3c4eba292 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4276,7 +4276,7 @@ def km_curve(params):
         ("curve.dissolve_verts", {"type": 'X', "value": 'PRESS', "ctrl": True}, None),
         ("curve.dissolve_verts", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None),
         ("curve.tilt_clear", {"type": 'T', "value": 'PRESS', "alt": True}, None),
-        ("curve.edit", {"type": 'X', "value": 'PRESS', "alt": True}, None),
+        ("curve.pen", {"type": 'X', "value": 'PRESS', "alt": True}, None),
         ("transform.tilt", {"type": 'T', "value": 'PRESS', "ctrl": True}, None),
         ("transform.transform", {"type": 'S', "value": 'PRESS', "alt": True},
          {"properties": [("mode", 'CURVE_SHRINKFATTEN')]}),
@@ -6462,14 +6462,14 @@ def km_3d_view_tool_edit_curve_draw(params):
     )
 
 
-def km_3d_view_tool_edit_curve_edit(params):
+def km_3d_view_tool_edit_curve_pen(params):
     return (
-        "3D View Tool: Edit Curve, Edit Curve",
+        "3D View Tool: Edit Curve, Curve Pen",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": [
-            ("curve.edit", {"type": params.tool_mouse, "value": 'PRESS'},
+            ("curve.pen", {"type": params.tool_mouse, "value": 'PRESS'},
              {"properties": [("wait_for_input", False)]}),
-            ("curve.edit", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True},
+            ("curve.pen", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True},
              {"properties": [("ctrl", True)]}),
         ]},
     )
@@ -7251,7 +7251,7 @@ def generate_keymaps(params=None):
         km_3d_view_tool_edit_mesh_rip_region(params),
         km_3d_view_tool_edit_mesh_rip_edge(params),
         km_3d_view_tool_edit_curve_draw(params),
-        km_3d_view_tool_edit_curve_edit(params),
+        km_3d_view_tool_edit_curve_pen(params),
         km_3d_view_tool_edit_curve_radius(params),
         km_3d_view_tool_edit_curve_tilt(params),
         km_3d_view_tool_edit_curve_randomize(params),
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index d53072985c9..e582c1aa0c8 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1192,11 +1192,11 @@ class _defs_edit_curve:
         )
 
     @ToolDef.from_fn
-    def edit():
+    def pen():
         return dict(
-            idname="builtin.edit",
-            label="Edit Curve",
-            cursor='PAINT_BRUSH',
+            idname="builtin.pen",
+            label="Curve Pen",
+            cursor='CROSSHAIR',
             icon="ops.curve.draw",
             widget=None,
             keymap=(),
@@ -2802,7 +2802,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
             _defs_transform.shear,
             _defs_edit_curve.curve_vertex_randomize,
             None,
-            _defs_edit_curve.edit,
+            _defs_edit_curve.pen,
         ],
         'EDIT_SURFACE': [
             *_tools_default,
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index ab70effe8c9..ff83698910e 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -198,5 +198,5 @@ void ED_curve_nurb_vert_selected_find(
 void CURVE_OT_draw(struct wmOperatorType *ot);
 
 /* editcurve_tool.c */
-void CURVE_OT_edit(struct wmOperatorType *ot);
+void CURVE_OT_pen(struct wmOperatorType *ot);
 // struct wmKeyMap *edit_curve_tool_modal_keymap(struct wmKeyConfig *keyconf);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index bd54e4202f6..174b095584e 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -127,7 +127,7 @@ void ED_operatortypes_curve(void)
   WM_operatortype_append(CURVE_OT_spin);
   WM_operatortype_append(CURVE_OT_vertex_add);
   WM_operatortype_append(CURVE_OT_draw);
-  WM_operatortype_append(CURVE_OT_edit);
+  WM_operatortype_append(CURVE_OT_pen);
   WM_operatortype_append(CURVE_OT_extrude);
   WM_operatortype_append(CURVE_OT_cyclic_toggle);
 
diff --git a/source/blender/editors/curve/editcurve_tool.c b/source/blender/editors/curve/editcurve_tool.c
index 868bc67743a..e78c3013352 100644
--- a/source/blender/editors/curve/editcurve_tool.c
+++ b/source/blender/editors/curve/editcurve_tool.c
@@ -518,7 +518,11 @@ static void move_bezt_handles_to_mouse(BezTriple *bezt,
   }
 }
 
-static int curve_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
+static float *get_closest_point_on_segment(BezTriple *bezt, float *point)
+{
+}
+
+static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
   bool extend = RNA_boolean_get(op->ptr, "extend");
   bool deselect = RNA_boolean_get(op->ptr, "deselect");
@@ -539,7 +543,7 @@ static int curve_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
   int mval[2];
 
   RNA_int_get_array(op->ptr, "location", mval);
-
+  printf("Modal\n");
   view3d_operator_needs_opengl(C);
   BKE_object_update_select_id(CTX_data_main(C));
 
@@ -709,6 +713,7 @@ static int curve_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
 
                 float screen_co[2];
                 bool prev_acute = true;
+                /* Convert point to screen coordinates */
                 ED_view3d_project_float_object(
                     vc.region, points, screen_co, V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN);
 
@@ -864,34 +869,36 @@ static int curve_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
   return ret;
 }
 
-static int curve_edit_exec(bContext *C, wmOperator *op)
+static int curve_pen_exec(bContext *C, wmOperator *op)
 {
+  printf("exec\n");
 }
 
-static int curve_edit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int curve_pen_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
   RNA_int_set_array(op->ptr, "location", event->mval);
 
-  int ret = curve_edit_modal(C, op, event);
+  int ret = curve_pen_modal(C, op, event);
   BLI_assert(ret == OPERATOR_RUNNING_MODAL);
   if (ret == OPERATOR_RUNNING_MODAL) {
     WM_event_add_modal_handler(C, op);
   }
+  printf("invoke\n");
   // return view3d_select_invoke(C, op, event);
   return ret;
 }
 
-void CURVE_OT_edit(wmOperatorType *ot)
+void CURVE_OT_pen(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Edit Curve";
-  ot->idname = "CURVE_OT_edit";
+  ot->name = "Curve Pen";
+  ot->idname = "CURVE_OT_pen";
   ot->description = "Edit curves with less shortcuts";
 
   /* api callbacks */
-  ot->exec = curve_edit_exec;
-  ot->invoke = curve_edit_invoke;
-  ot->modal = curve_edit_modal;
+  ot->exec = curve_pen_exec;
+  ot->invoke = curve_pen_invoke;
+  ot->modal = curve_pen_modal;
   ot->poll = ED_operator_view3d_active;
 
   /* flags */



More information about the Bf-blender-cvs mailing list