static int buttons_context_path_brush(ButsContextPath *path) { Scene *scene; Brush *br = NULL; PointerRNA *ptr = &path->ptr[path->len - 1]; /* if we already have a (pinned) brush, we're done */ if (RNA_struct_is_a(ptr->type, &RNA_Brush)) { return 1; } /* if we have a scene, use the toolsettings brushes */ else if (buttons_context_path_scene(path)) { scene = path->ptr[path->len - 1].data; if (scene) br = BKE_paint_brush(BKE_paint_get_active(scene)); if (br) { RNA_id_pointer_create((ID *)br, &path->ptr[path->len]); path->len++; return 1; } } /* no path to a brush possible */ return 0; }
void BKE_paint_invalidate_cursor_overlay (Scene *scene, CurveMapping *curve) { Paint *p = BKE_paint_get_active(scene); Brush *br = p->brush; if (br && br->curve == curve) overlay_flags |= PAINT_INVALID_OVERLAY_CURVE; }
void BKE_paint_invalidate_overlay_tex (Scene *scene, const Tex *tex) { Paint *p = BKE_paint_get_active(scene); Brush *br = p->brush; if (!br) return; if (br->mtex.tex == tex) overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY; if (br->mask_mtex.tex == tex) overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY; }
static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, ViewLayer *view_layer) { View3D *v3d = draw_ctx->v3d; if ((v3d->flag2 & V3D_HIDE_OVERLAYS) || (v3d->overlay.flag & V3D_OVERLAY_HIDE_CURSOR)) { return false; } /* don't draw cursor in paint modes, but with a few exceptions */ if (draw_ctx->object_mode & OB_MODE_ALL_PAINT) { /* exception: object is in weight paint and has deforming armature in pose mode */ if (draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) { if (BKE_object_pose_armature_get(draw_ctx->obact) != NULL) { return true; } } /* exception: object in texture paint mode, clone brush, use_clone_layer disabled */ else if (draw_ctx->object_mode & OB_MODE_TEXTURE_PAINT) { const Paint *p = BKE_paint_get_active(scene, view_layer); if (p && p->brush && p->brush->imagepaint_tool == PAINT_TOOL_CLONE) { if ((scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) == 0) { return true; } } } /* no exception met? then don't draw cursor! */ return false; } else if (draw_ctx->object_mode & OB_MODE_WEIGHT_GPENCIL) { /* grease pencil hide always in some modes */ return false; } return true; }