[Bf-blender-cvs] [1dddb47e48c] master: Fix T63052: Crash on "Grease Pencil Fill" without Grease Pencil Object
Antonioya
noreply at git.blender.org
Thu Mar 28 16:48:38 CET 2019
Commit: 1dddb47e48ca0661d343a21100de8219bf85ae6a
Author: Antonioya
Date: Thu Mar 28 16:48:32 2019 +0100
Branches: master
https://developer.blender.org/rB1dddb47e48ca0661d343a21100de8219bf85ae6a
Fix T63052: Crash on "Grease Pencil Fill" without Grease Pencil Object
Changed poll function to verify if the context is valid.
Also cleanup return values.
===================================================================
M source/blender/editors/gpencil/gpencil_fill.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index acbf329b783..5966684d30c 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1150,19 +1150,27 @@ static void gpencil_fill_draw_3d(const bContext *C, ARegion *UNUSED(ar), void *a
/* check if context is suitable for filling */
static bool gpencil_fill_poll(bContext *C)
{
+ Object *obact = CTX_data_active_object(C);
+
if (ED_operator_regionactive(C)) {
ScrArea *sa = CTX_wm_area(C);
if (sa->spacetype == SPACE_VIEW3D) {
- return 1;
+ if ((obact == NULL) ||
+ (obact->type != OB_GPENCIL) ||
+ (obact->mode != OB_MODE_PAINT_GPENCIL)) {
+ return false;
+ }
+
+ return true;
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not valid for filling operator");
- return 0;
+ return false;
}
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not set");
- return 0;
+ return true;
}
}
More information about the Bf-blender-cvs
mailing list