[Bf-blender-cvs] [cefa6ca4823] greasepencil-object: Add Ctrl keymap while fill for free drawing
Antonio Vazquez
noreply at git.blender.org
Thu Jan 11 16:11:16 CET 2018
Commit: cefa6ca48232fd5d7e2374cc0cb886636df84d26
Author: Antonio Vazquez
Date: Thu Jan 11 16:11:06 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBcefa6ca48232fd5d7e2374cc0cb886636df84d26
Add Ctrl keymap while fill for free drawing
If press Ctrl key while using a fill brush, the brush is used as a normal drawing brush and the artist can draw any shape freely.
===================================================================
M source/blender/editors/gpencil/gpencil_ops.c
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 1aee76c9564..a61f39458fc 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -459,6 +459,13 @@ static void ed_keymap_gpencil_painting_fill(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_fill", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "on_back", true);
+
+ /* if press alternative key, the brush now it's for drawing */
+ kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
+ RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW);
+ RNA_boolean_set(kmi->ptr, "wait_for_input", false);
+ /* disable straight lines with Ctrl because there is a conflict of keymaps */
+ RNA_boolean_set(kmi->ptr, "no_straight", true);
}
/* Stroke Painting Keymap - Only when paintmode is enabled */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 8e6367a2544..5c752520c27 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2188,7 +2188,7 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event)
p->mval[1] = event->mval[1] + 1;
/* verify key status for straight lines */
- if (event->ctrl > 0) {
+ if ((event->ctrl > 0) && (RNA_boolean_get(op->ptr, "no_straight") == false)) {
if (p->straight[0] == 0) {
int dx = abs(p->mval[0] - p->mvalo[0]);
int dy = abs(p->mval[1] - p->mvalo[1]);
@@ -2910,4 +2910,7 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
/* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ prop = RNA_def_boolean(ot->srna, "no_straight", false, "No Straight lines", "Disable Ctrl key for straight lines");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
More information about the Bf-blender-cvs
mailing list