diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2017-08-19 14:02:03 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2017-08-19 14:02:03 +0300 |
commit | 45f0f3dc0457a53a25103784f0e0d100c7a17cbe (patch) | |
tree | 94767d8e4fa6ea23f2bbd2274f239ecbbdc5931a /source/blender/editors/sculpt_paint | |
parent | 0d67f8d5c46fcc97cbb0544ef7d8c3c0056025c4 (diff) | |
parent | 9a262ed47ecb1c9f43053b0653364c59d9595fdf (diff) |
Merge branch 'blender2.8' into strand_editmode
Diffstat (limited to 'source/blender/editors/sculpt_paint')
5 files changed, 25 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 8c6b3b0106c..d2115aae2ac 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -766,7 +766,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo /* initialize from context */ if (CTX_wm_region_view3d(C)) { SceneLayer *sl = CTX_data_scene_layer(C); - Object *ob = OBACT_NEW; + Object *ob = OBACT_NEW(sl); bool uvs, mat, tex, stencil; if (!BKE_paint_proj_mesh_data_check(scene, ob, &uvs, &mat, &tex, &stencil)) { BKE_paint_data_warning(op->reports, uvs, mat, tex, stencil); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 65f4618e43e..2ffd9757f92 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5027,6 +5027,7 @@ void paint_proj_stroke( /* clone gets special treatment here to avoid going through image initialization */ if (ps_handle->is_clone_cursor_pick) { + EvaluationContext eval_ctx; Scene *scene = ps_handle->scene; struct Depsgraph *graph = CTX_data_depsgraph(C); View3D *v3d = CTX_wm_view3d(C); @@ -5036,7 +5037,9 @@ void paint_proj_stroke( view3d_operator_needs_opengl(C); - if (!ED_view3d_autodist(C, graph, ar, v3d, mval_i, cursor, false, NULL)) { + CTX_data_eval_ctx(C, &eval_ctx); + + if (!ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval_i, cursor, false, NULL)) { return; } @@ -5323,7 +5326,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) int orig_brush_size; IDProperty *idgroup; IDProperty *view_data = NULL; - Object *ob = OBACT_NEW; + Object *ob = OBACT_NEW(sl); bool uvs, mat, tex; if (ob == NULL || ob->type != OB_MESH) { diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index f8c8d8fb41e..17ecb309e27 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -348,13 +348,15 @@ static void imapaint_pick_uv(EvaluationContext *eval_ctx, Scene *scene, Object * } /* returns 0 if not found, otherwise 1 */ -static int imapaint_pick_face(const bContext *C, ViewContext *vc, const int mval[2], unsigned int *r_index, unsigned int totpoly) +static int imapaint_pick_face( + const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mval[2], + unsigned int *r_index, unsigned int totpoly) { if (totpoly == 0) return 0; /* sample only on the exact position */ - *r_index = ED_view3d_backbuf_sample(C, vc, mval[0], mval[1]); + *r_index = ED_view3d_backbuf_sample(eval_ctx, vc, mval[0], mval[1]); if ((*r_index) == 0 || (*r_index) > (unsigned int)totpoly) { return 0; @@ -447,7 +449,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr if (CTX_wm_view3d(C) && texpaint_proj) { /* first try getting a colour directly from the mesh faces if possible */ SceneLayer *sl = CTX_data_scene_layer(C); - Object *ob = OBACT_NEW; + Object *ob = OBACT_NEW(sl); bool sample_success = false; ImagePaintSettings *imapaint = &scene->toolsettings->imapaint; bool use_material = (imapaint->mode == IMAGEPAINT_MODE_MATERIAL); @@ -466,7 +468,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr view3d_operator_needs_opengl(C); - if (imapaint_pick_face(C, &vc, mval, &faceindex, totpoly)) { + if (imapaint_pick_face(&eval_ctx, &vc, mval, &faceindex, totpoly)) { Image *image; if (use_material) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index b395ac5c49d..321ce1fe306 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -814,7 +814,9 @@ static unsigned int vpaint_blend(VPaint *vp, unsigned int col, unsigned int colo } -static int sample_backbuf_area(const bContext *C, ViewContext *vc, int *indexar, int totpoly, int x, int y, float size) +static int sample_backbuf_area( + const EvaluationContext *eval_ctx, ViewContext *vc, + int *indexar, int totpoly, int x, int y, float size) { struct ImBuf *ibuf; int a, tot = 0, index; @@ -823,7 +825,7 @@ static int sample_backbuf_area(const bContext *C, ViewContext *vc, int *indexar, * brushes with size > 64, why is this here? */ /*if (size > 64.0) size = 64.0;*/ - ibuf = ED_view3d_backbuf_read(C, vc, x - size, y - size, x + size, y + size); + ibuf = ED_view3d_backbuf_read(eval_ctx, vc, x - size, y - size, x + size, y + size); if (ibuf) { unsigned int *rt = ibuf->rect; @@ -2162,6 +2164,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P VPaint *wp = ts->wpaint; Brush *brush = BKE_paint_brush(&wp->paint); struct WPaintData *wpd = paint_stroke_mode_data(stroke); + EvaluationContext eval_ctx; ViewContext *vc; Object *ob; Mesh *me; @@ -2201,9 +2204,12 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P me = ob->data; indexar = wpd->indexar; + view3d_operator_needs_opengl(C); ED_view3d_init_mats_rv3d(ob, vc->rv3d); + CTX_data_eval_ctx(C, &eval_ctx); + /* load projection matrix */ mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat); @@ -2243,7 +2249,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* Ugly x2, we need this so hidden faces don't draw */ me->editflag |= ME_EDIT_PAINT_FACE_SEL; } - totindex = sample_backbuf_area(C, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); + totindex = sample_backbuf_area(&eval_ctx, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); me->editflag = editflag_prev; if (use_face_sel && me->totpoly) { @@ -2799,6 +2805,7 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Mesh *me, static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) { + EvaluationContext eval_ctx; Scene *scene = CTX_data_scene(C); ToolSettings *ts = CTX_data_tool_settings(C); struct VPaintData *vpd = paint_stroke_mode_data(stroke); @@ -2827,7 +2834,8 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat); /* which faces are involved */ - totindex = sample_backbuf_area(C, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); + CTX_data_eval_ctx(C, &eval_ctx); + totindex = sample_backbuf_area(&eval_ctx, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); if ((me->editflag & ME_EDIT_PAINT_FACE_SEL) && me->mpoly) { for (index = 0; index < totindex; index++) { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ac1c16f1d76..236aa5a1c6a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4734,7 +4734,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st * Could be optimized later, but currently don't think it's so * much common scenario. * - * Same applies to the DAG_id_tag_update() invoked from + * Same applies to the DEG_id_tag_update() invoked from * sculpt_flush_update(). */ if (ss->modifiers_active) { |