Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2012-09-25 16:10:27 +0400
committerJoshua Leung <aligorith@gmail.com>2012-09-25 16:10:27 +0400
commit7f6b4a28e827684df23da6997ccbb38e7b6933d4 (patch)
tree31a15fcba38db11ed935e55c8e83db192d2678ed /source/blender/editors/gpencil
parent456a78961c62f0b1b1647df8f6165493050f551e (diff)
Bugfix [#32647] PolyLine tool for Grease Pencil was broken
This was broken in r.46589, although it doesn't seem that these changes have any relevance to the main fix being performed there. The problem was that the offending changes made the Grease Pencil modal handler exit when an RMB event occurs meant that the operator was exiting after the initial click, meaning that it was only possible to draw single dots at a time when using the hotkey version of PolyLine. The toolbox version however was unaffected. I've noted this specific problem in the code as a warning.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 8ba4985ffc4..5909c4fc270 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1736,25 +1736,32 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
//printf("\tGP - handle modal event...\n");
- /* exit painting mode (and/or end current stroke) */
- if (ELEM5(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY, RIGHTMOUSE)) {
+ /* exit painting mode (and/or end current stroke)
+ * NOTE: cannot do RIGHTMOUSE (as is standard for cancelling) as that would break polyline [#32647]
+ */
+ if (ELEM4(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY)) {
/* exit() ends the current stroke before cleaning up */
//printf("\t\tGP - end of paint op + end of stroke\n");
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
- /* toggle painting mode upon mouse-button movement */
- if (event->type == LEFTMOUSE) {
+ /* toggle painting mode upon mouse-button movement
+ * - LEFTMOUSE = standard drawing (all) / straight line drawing (all) / polyline (toolbox only)
+ * - RIGHTMOUSE = polyline (hotkey) / eraser (all)
+ * (Disabling RIGHTMOUSE case here results in bugs like [#32647])
+ */
+ if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE)) {
/* if painting, end stroke */
if (p->status == GP_STATUS_PAINTING) {
int sketch = 0;
+
/* basically, this should be mouse-button up = end stroke
* BUT what happens next depends on whether we 'painting sessions' is enabled
*/
sketch |= GPENCIL_SKETCH_SESSIONS_ON(p->scene);
/* polyline drawing is also 'sketching' -- all knots should be added during one session */
- sketch |= p->paintmode == GP_PAINTMODE_DRAW_POLY;
+ sketch |= (p->paintmode == GP_PAINTMODE_DRAW_POLY);
if (sketch) {
/* end stroke only, and then wait to resume painting soon */