diff options
Diffstat (limited to 'source/blender/editors/physics/dynamicpaint_ops.c')
-rw-r--r-- | source/blender/editors/physics/dynamicpaint_ops.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index b0c14ef3623..c10604b0edd 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -42,7 +42,6 @@ #include "BKE_context.h" #include "BKE_deform.h" #include "BKE_object_deform.h" -#include "BKE_depsgraph.h" #include "BKE_dynamicpaint.h" #include "BKE_global.h" #include "BKE_main.h" @@ -50,6 +49,9 @@ #include "BKE_report.h" #include "BKE_screen.h" +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" + #include "ED_mesh.h" #include "ED_screen.h" #include "ED_object.h" @@ -135,7 +137,7 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) } dynamicPaint_resetPreview(canvas); - DAG_id_tag_update(&obj_ctx->id, OB_RECALC_DATA); + DEG_id_tag_update(&obj_ctx->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obj_ctx); return OPERATOR_FINISHED; @@ -181,8 +183,8 @@ static int type_toggle_exec(bContext *C, wmOperator *op) } /* update dependency */ - DAG_id_tag_update(&cObject->id, OB_RECALC_DATA); - DAG_relations_tag_update(CTX_data_main(C)); + DEG_id_tag_update(&cObject->id, OB_RECALC_DATA); + DEG_relations_tag_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, cObject); return OPERATOR_FINISHED; @@ -286,11 +288,15 @@ typedef struct DynamicPaintBakeJob { struct Main *bmain; Scene *scene; + SceneLayer *scene_layer; + Depsgraph *depsgraph; Object *ob; DynamicPaintSurface *surface; DynamicPaintCanvasSettings *canvas; + EvaluationContext *eval_ctx; + int success; double start; } DynamicPaintBakeJob; @@ -310,6 +316,8 @@ static void dpaint_bake_endjob(void *customdata) dynamicPaint_freeSurfaceData(job->surface); + MEM_freeN(job->eval_ctx); + G.is_rendering = false; BKE_spacedata_draw_locks(false); @@ -357,7 +365,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job) frame = surface->start_frame; orig_frame = scene->r.cfra; scene->r.cfra = (int)frame; - ED_update_for_newframe(job->bmain, scene, 1); + ED_update_for_newframe(job->bmain, scene, job->scene_layer, job->depsgraph); /* Init surface */ if (!dynamicPaint_createUVSurface(scene, surface, job->progress, job->do_update)) { @@ -383,8 +391,8 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job) /* calculate a frame */ scene->r.cfra = (int)frame; - ED_update_for_newframe(job->bmain, scene, 1); - if (!dynamicPaint_calculateFrame(surface, scene, cObject, frame)) { + ED_update_for_newframe(job->bmain, scene, job->scene_layer, job->depsgraph); + if (!dynamicPaint_calculateFrame(surface, job->eval_ctx, scene, cObject, frame)) { job->success = 0; return; } @@ -452,6 +460,10 @@ static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op) DynamicPaintCanvasSettings *canvas; Object *ob = ED_object_context(C); Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); + EvaluationContext *eval_ctx = MEM_mallocN(sizeof(*eval_ctx), "EvaluationContext"); + + CTX_data_eval_ctx(C, eval_ctx); DynamicPaintSurface *surface; @@ -479,9 +491,12 @@ static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op) DynamicPaintBakeJob *job = MEM_mallocN(sizeof(DynamicPaintBakeJob), "DynamicPaintBakeJob"); job->bmain = CTX_data_main(C); job->scene = scene; + job->scene_layer = sl; + job->depsgraph = CTX_data_depsgraph(C); job->ob = ob; job->canvas = canvas; job->surface = surface; + job->eval_ctx = eval_ctx; wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Dynamic Paint Bake", WM_JOB_PROGRESS, |