[Bf-blender-cvs] [acb1f241782] greasepencil-object: GP: Remove temporarily chord primitive

Antonioya noreply at git.blender.org
Tue Dec 25 10:47:18 CET 2018


Commit: acb1f2417829f80bab6dedb8b147bd28d4d31822
Author: Antonioya
Date:   Tue Dec 25 10:47:02 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBacb1f2417829f80bab6dedb8b147bd28d4d31822

GP: Remove temporarily chord primitive

As this primitive is not defined completely, we remove it now and we can add later. Keep this primitive in the source code can produce errors when move more stable options to master.

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	release/scripts/startup/bl_ui/space_topbar.py
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/editors/gpencil/gpencil_primitive.c

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 807f0346dd5..61d59502a98 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -5707,20 +5707,6 @@ def km_3d_view_tool_paint_gpencil_arc(params):
         ]},
     )
 
-def km_3d_view_tool_paint_gpencil_chord(params):
-    return (
-        "3D View Tool: Paint Gpencil, Chord",
-        {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
-        {"items": [
-            ("gpencil.primitive", {"type": params.tool_tweak, "value": 'ANY'},
-             {"properties": [("type", 'CHORD'), ("wait_for_input", False)]}),
-            ("gpencil.primitive", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
-             {"properties": [("type", 'CHORD'), ("wait_for_input", False)]}),
-            ("gpencil.primitive", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True},
-             {"properties": [("type", 'CHORD'), ("wait_for_input", False)]}),
-        ]},
-    )
-
 def km_3d_view_tool_paint_gpencil_curve(params):
     return (
         "3D View Tool: Paint Gpencil, Curve",
@@ -6041,7 +6027,6 @@ def generate_keymaps(params=None):
         km_3d_view_tool_paint_gpencil_circle(params),
         km_3d_view_tool_paint_gpencil_arc(params),
         km_3d_view_tool_paint_gpencil_curve(params),
-        km_3d_view_tool_paint_gpencil_chord(params),
         km_3d_view_tool_edit_gpencil_select(params),
         km_3d_view_tool_edit_gpencil_select_box(params),
         km_3d_view_tool_edit_gpencil_select_circle(params),
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 75cac4bdb88..be335469418 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -647,7 +647,6 @@ class GPENCIL_MT_gpencil_draw_specials(Menu):
         layout.operator("gpencil.primitive", text="Circle", icon='ANTIALIASED').type = 'CIRCLE'
         layout.operator("gpencil.primitive", text="Arc", icon='SPHERECURVE').type = 'ARC'
         layout.operator("gpencil.primitive", text="Curve", icon='CURVE_BEZCURVE').type = 'CURVE'
-        layout.operator("gpencil.primitive", text="Chord", icon='SPHERECURVE').type = 'CHORD'
 
 
 class GPENCIL_MT_gpencil_draw_delete(Menu):
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 5fc59901b33..e7883ce0bac 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1100,16 +1100,6 @@ class _defs_gpencil_paint:
             keymap=(),
         )
 
-    @ToolDef.from_fn
-    def chord():
-        return dict(
-            text="Chord",
-            icon="ops.gpencil.primitive_chord",
-            cursor='CROSSHAIR',
-            widget=None,
-            keymap=(),
-        )
-
     @ToolDef.from_fn
     def curve():
         return dict(
@@ -1626,7 +1616,6 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
             _defs_gpencil_paint.line,
             _defs_gpencil_paint.arc,
             _defs_gpencil_paint.curve,
-            _defs_gpencil_paint.chord,
             _defs_gpencil_paint.box,
             _defs_gpencil_paint.circle,
         ],
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 6f9bbf51c09..6f80b4394b6 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -301,7 +301,7 @@ class _draw_left_context_mode:
                 return
 
             is_paint = True
-            if (tool.name in {"Line", "Box", "Circle", "Arc", "Curve", "Chord"}):
+            if (tool.name in {"Line", "Box", "Circle", "Arc", "Curve"}):
                 is_paint = False
             elif (not tool.has_datablock):
                 return
@@ -376,7 +376,7 @@ class _draw_left_context_mode:
 
                 draw_color_selector()
 
-                if tool.name in {"Arc", "Curve", "Line", "Box", "Circle", "Chord"}:
+                if tool.name in {"Arc", "Curve", "Line", "Box", "Circle"}:
                     settings = context.tool_settings.gpencil_sculpt
                     row = layout.row(align=True)
                     row.prop(settings, "use_thickness_curve", text="", icon='CURVE_DATA')
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 2d7e96eaac0..991cd52f523 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -386,7 +386,6 @@ enum {
 	GP_STROKE_CIRCLE = 2,
 	GP_STROKE_ARC = 3,
 	GP_STROKE_CURVE = 4,
-	GP_STROKE_CHORD = 5
 };
 
 
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 3aa439b30a9..eafac281305 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -233,7 +233,7 @@ static void gp_primitive_update_cps(tGPDprimitive *tgpi)
 		copy_v2_v2(tgpi->cp1, tgpi->midpoint);
 		copy_v2_v2(tgpi->cp2, tgpi->cp1);
 	}
-	else if (tgpi->type == GP_STROKE_CURVE || tgpi->type == GP_STROKE_CHORD) {
+	else if (tgpi->type == GP_STROKE_CURVE) {
 		mid_v2_v2v2(tgpi->midpoint, tgpi->start, tgpi->end);
 		copy_v2_v2(tgpi->cp1, tgpi->midpoint);
 		copy_v2_v2(tgpi->cp2, tgpi->cp1);
@@ -433,9 +433,6 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi
 			IFACE_("Arc: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center, M: Flip, E: extrude"),
 			UI_MAX_DRAW_STR);
 	}
-	else if (tgpi->type == GP_STROKE_CHORD) {
-		BLI_strncpy(msg_str, IFACE_("Chord: ESC to cancel, Enter/RMB to confirm, WHEEL/+- to adjust edge number, Shift to square, Alt to center, M: Flip"), UI_MAX_DRAW_STR);
-	}
 	else if (tgpi->type == GP_STROKE_CURVE) {
 		BLI_strncpy(
 			msg_str,
@@ -443,7 +440,7 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi
 			UI_MAX_DRAW_STR);
 	}
 
-	if (ELEM(tgpi->type, GP_STROKE_CIRCLE, GP_STROKE_ARC, GP_STROKE_CHORD, GP_STROKE_LINE, GP_STROKE_BOX)) {
+	if (ELEM(tgpi->type, GP_STROKE_CIRCLE, GP_STROKE_ARC, GP_STROKE_LINE, GP_STROKE_BOX)) {
 		if (hasNumInput(&tgpi->num)) {
 			char str_offs[NUM_STR_REP_LEN];
 
@@ -557,63 +554,6 @@ static void gp_primitive_line(tGPDprimitive *tgpi, tGPspoint *points2D)
 	}
 }
 
-/* create a chord */
-static void gp_primitive_chord(tGPDprimitive *tgpi, tGPspoint *points2D)
-{
-	const int totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges);
-	float cp[2];
-	float point[2];
-	float center[2];
-
-	copy_v2_v2(cp, tgpi->cp1);
-	mid_v2_v2v2(tgpi->midpoint, tgpi->start, tgpi->end);
-	closest_to_line_v2(point, cp, tgpi->start, tgpi->end);
-
-	center[0] = tgpi->midpoint[0] + cp[0] - point[0];
-	center[1] = tgpi->midpoint[1] + cp[1] - point[1];
-
-	float cross = cross_tri_v2(tgpi->start, center, tgpi->end);
-	float stepangle;
-	float step;
-
-	if (!tgpi->flip) {
-		float fcenter[2];
-		gp_reflect_point_v2_v2v2v2(fcenter, center, tgpi->start, tgpi->end);
-		stepangle = angle_v2v2v2(tgpi->start, fcenter, tgpi->end);
-		if (cross < 0.0f) {
-			stepangle = (M_PI * 2.0f) - stepangle;
-		}
-		step = stepangle / (float)(tgpi->tot_edges - 1);
-		step = -step;
-	}
-	else {
-		stepangle = angle_v2v2v2(tgpi->start, center, tgpi->end); ;
-		if (cross > 0.0f) {
-			stepangle = (M_PI * 2.0f) - stepangle;
-		}
-		step = stepangle / (float)(tgpi->tot_edges - 1);
-	}
-
-	float a = tgpi->tot_stored_edges ? step : 0.0f;
-
-	for (int i = tgpi->tot_stored_edges; i < totpoints; i++) {
-		tGPspoint *p2d = &points2D[i];
-		gp_rotate_v2_v2v2fl(&p2d->x, tgpi->start, center, a);
-		a += step;
-	}
-	float color[4];
-	UI_GetThemeColor4fv(TH_ACTIVE_VERT, color);
-	gp_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL);
-	if (tgpi->tot_stored_edges) {
-		UI_GetThemeColor4fv(TH_REDALERT, color);
-		gp_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL);
-	}
-	else
-		gp_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL);
-	UI_GetThemeColor4fv(TH_GP_VERTEX_SELECT, color);
-	gp_primitive_set_cp(tgpi, center, color, BIG_SIZE_CTL * 0.9f);
-}
-
 /* create an arc */
 static void gp_primitive_arc(tGPDprimitive *tgpi, tGPspoint *points2D)
 {
@@ -760,9 +700,6 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
 		case GP_STROKE_ARC:
 			gp_primitive_arc(tgpi, points2D);
 			break;
-		case GP_STROKE_CHORD:
-			gp_primitive_chord(tgpi, points2D);
-			break;
 		case GP_STROKE_CURVE:
 			gp_primitive_bezier(tgpi, points2D);
 		default:
@@ -1171,7 +1108,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
 	/* set parameters */
 	tgpi->type = RNA_enum_get(op->ptr, "type");
 
-	if (ELEM(tgpi->type, GP_STROKE_ARC, GP_STROKE_CURVE, GP_STROKE_CHORD)) {
+	if (ELEM(tgpi->type, GP_STROKE_ARC, GP_STROKE_CURVE)) {
 		tgpi->curve = true;
 	}
 	else {
@@ -1395,7 +1332,7 @@ static void gpencil_primitive_edit_event_handling(bContext *C, wmOperator *op, w
 		{
 			if ((event->val == KM_PRESS) &&
 			    (tgpi->curve) &&
-			    (ELEM(tgpi->orign_type, GP_STROKE_ARC, GP_STROKE_CHORD) ))
+			    (ELEM(tgpi->orign_type, GP_STROKE_ARC) ))
 			{
 				tgpi->flip ^= 1;
 				gp_primitive_update_cps(tgpi);
@@ -1808,7 +1745,6 @@ void GPENCIL_OT_primitive(wmOperatorType *ot)
 		{GP_STROKE_LINE, "LINE", 0, "Line", ""},
 		{GP_STROKE_CIRCLE, "CIRCLE", 0, "Circle", ""},
 		{GP_STROKE_ARC, "ARC", 0, "Arc", ""},
-		{GP_STROKE_CHORD, "CHORD", 0, "Chord", ""},
 		{GP_STROKE_CURVE, "CURVE", 0, "Curve", ""},
 		{0, NULL, 0, NULL, NULL}
 	};



More information about the Bf-blender-cvs mailing list