[Bf-blender-cvs] [dd9855ed508] greasepencil-object: Colorpicker must be only in active window
Antonio Vazquez
noreply at git.blender.org
Thu Mar 8 11:03:14 CET 2018
Commit: dd9855ed5089d01d9716fc2ad56b9dcbb27cd209
Author: Antonio Vazquez
Date: Thu Mar 8 11:02:59 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBdd9855ed5089d01d9716fc2ad56b9dcbb27cd209
Colorpicker must be only in active window
When there are multiwindows, the color picker only must work in the region that originated the operator.
===================================================================
M source/blender/editors/gpencil/gpencil_colorpick.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c b/source/blender/editors/gpencil/gpencil_colorpick.c
index e4816d00435..313db4dbefa 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -160,11 +160,18 @@ static void gp_draw_pattern_box(int xmin, int ymin, int xmax, int ymax)
}
/* draw a toolbar with all colors of the palette */
-static void gpencil_draw_color_table(const bContext *UNUSED(C), tGPDpick *tgpk)
+static void gpencil_draw_color_table(const bContext *C, tGPDpick *tgpk)
{
if (!tgpk->palette) {
return;
}
+
+ /* draw only in the region that originated operator. This is required for multiwindow */
+ ARegion *ar = CTX_wm_region(C);
+ if (ar != tgpk->ar) {
+ return;
+ }
+
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
float background[4];
float line[4];
@@ -485,6 +492,7 @@ static int gpencil_colorpick_index_from_mouse(const tGPDpick *tgpk, const wmEven
static int gpencil_colorpick_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPDpick *tgpk = op->customdata;
+ ARegion *ar = CTX_wm_region(C);
int estate = OPERATOR_RUNNING_MODAL;
@@ -495,7 +503,8 @@ static int gpencil_colorpick_modal(bContext *C, wmOperator *op, const wmEvent *e
break;
case LEFTMOUSE:
- if (!BLI_rcti_isect_pt_v(&tgpk->panel, event->mval)) {
+ /* only in the region that originated operator. This is required for multiwindow */
+ if ((!BLI_rcti_isect_pt_v(&tgpk->panel, event->mval)) || (ar != tgpk->ar)) {
/* if click out of panel, end */
estate = OPERATOR_CANCELLED;
}
@@ -509,7 +518,7 @@ static int gpencil_colorpick_modal(bContext *C, wmOperator *op, const wmEvent *e
break;
case MOUSEMOVE:
- if (BLI_rcti_isect_pt_v(&tgpk->panel, event->mval)) {
+ if ((BLI_rcti_isect_pt_v(&tgpk->panel, event->mval)) && (ar == tgpk->ar)) {
int index = gpencil_colorpick_index_from_mouse(tgpk, event);
if (index != -1) {
/* don't update active color if we move outside the grid */
More information about the Bf-blender-cvs
mailing list