diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index aebd0c10e9c..1ae13fcaec0 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -588,13 +588,15 @@ static Brush *image_paint_brush(bContext *C) static int image_paint_poll(bContext *C) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); Object *obact; - if (!image_paint_brush(C)) + if (!image_paint_brush(C)) { return 0; - + } obact = CTX_data_active_object(C); - if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) { + if ((obact && eval_ctx.object_mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) { return 1; } else { @@ -1469,11 +1471,13 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot) static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op)) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; Brush *br; Object *ob = CTX_data_active_object(C); - if (!(ob && (ob->mode & OB_MODE_VERTEX_PAINT))) { + if (!(ob && (eval_ctx.object_mode & OB_MODE_VERTEX_PAINT))) { br = image_paint_brush(C); } else { @@ -1504,8 +1508,12 @@ static int brush_colors_flip_poll(bContext *C) } else { Object *ob = CTX_data_active_object(C); - if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) { - return 1; + if (ob) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + if (eval_ctx.object_mode & OB_MODE_VERTEX_PAINT) { + return 1; + } } } return 0; @@ -1545,10 +1553,13 @@ void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op) static int texture_paint_poll(bContext *C) { - if (texture_paint_toggle_poll(C)) - if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT) + if (texture_paint_toggle_poll(C)) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + if (eval_ctx.object_mode & OB_MODE_TEXTURE_PAINT) { return 1; - + } + } return 0; } @@ -1559,16 +1570,22 @@ int image_texture_paint_poll(bContext *C) int facemask_paint_poll(bContext *C) { - return BKE_paint_select_face_test(CTX_data_active_object(C)); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + return BKE_paint_select_face_test(&eval_ctx, CTX_data_active_object(C)); } int vert_paint_poll(bContext *C) { - return BKE_paint_select_vert_test(CTX_data_active_object(C)); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + return BKE_paint_select_vert_test(&eval_ctx, CTX_data_active_object(C)); } int mask_paint_poll(bContext *C) { - return BKE_paint_select_elem_test(CTX_data_active_object(C)); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + return BKE_paint_select_elem_test(&eval_ctx, CTX_data_active_object(C)); } |