diff options
Diffstat (limited to 'source/blender/editors/object/object_add.c')
-rw-r--r-- | source/blender/editors/object/object_add.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index d2c859565a3..4abd80a18e8 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -223,19 +223,17 @@ void ED_object_base_init_transform(bContext *C, Base *base, const float loc[3], { Object *ob = base->object; Scene *scene = CTX_data_scene(C); - EvaluationContext eval_ctx; + Depsgraph *depsgraph = CTX_data_depsgraph(C); if (!scene) return; - CTX_data_eval_ctx(C, &eval_ctx); - if (loc) copy_v3_v3(ob->loc, loc); if (rot) copy_v3_v3(ob->rot, rot); - BKE_object_where_is_calc(&eval_ctx, scene, ob); + BKE_object_where_is_calc(depsgraph, scene, ob); } /* Uses context to figure out transform for primitive. @@ -1431,6 +1429,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, { Main *bmain = CTX_data_main(C); ViewLayer *view_layer = CTX_data_view_layer(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); ListBase *lb_duplis; DupliObject *dob; GHash *dupli_gh, *parent_gh = NULL; @@ -1439,7 +1438,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, return; } - lb_duplis = object_duplilist(bmain->eval_ctx, scene, base->object); + lb_duplis = object_duplilist(depsgraph, scene, base->object); dupli_gh = BLI_ghash_ptr_new(__func__); if (use_hierarchy) { @@ -1638,24 +1637,24 @@ static const EnumPropertyItem convert_target_items[] = { {0, NULL, 0, NULL, NULL} }; -static void convert_ensure_curve_cache(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Object *ob) +static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Object *ob) { if (ob->curve_cache == NULL) { /* Force creation. This is normally not needed but on operator * redo we might end up with an object which isn't evaluated yet. */ if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) { - BKE_displist_make_curveTypes(eval_ctx, scene, ob, false); + BKE_displist_make_curveTypes(depsgraph, scene, ob, false); } else if (ob->type == OB_MBALL) { - BKE_displist_make_mball(bmain->eval_ctx, scene, ob); + BKE_displist_make_mball(depsgraph, scene, ob); } } } -static void curvetomesh(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Object *ob) +static void curvetomesh(Depsgraph *depsgraph, Scene *scene, Object *ob) { - convert_ensure_curve_cache(eval_ctx, bmain, scene, ob); + convert_ensure_curve_cache(depsgraph, scene, ob); BKE_mesh_from_nurbs(ob); /* also does users */ if (ob->type == OB_MESH) { @@ -1700,9 +1699,9 @@ static Base *duplibase_for_convert(Main *bmain, Scene *scene, ViewLayer *view_la static int convert_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - EvaluationContext eval_ctx; Base *basen = NULL, *basact = NULL; Object *ob1, *newob, *obact = CTX_data_active_object(C); DerivedMesh *dm; @@ -1714,8 +1713,6 @@ static int convert_exec(bContext *C, wmOperator *op) bool keep_original = RNA_boolean_get(op->ptr, "keep_original"); int a, mballConverted = 0; - CTX_data_eval_ctx(C, &eval_ctx); - /* don't forget multiple users! */ { @@ -1766,7 +1763,6 @@ static int convert_exec(bContext *C, wmOperator *op) DEG_id_tag_update(&base->object->id, OB_RECALC_DATA); } - Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); uint64_t customdata_mask_prev = scene->customdata_mask; scene->customdata_mask |= CD_MASK_MESH; BKE_scene_graph_update_tagged(depsgraph, bmain); @@ -1810,7 +1806,7 @@ static int convert_exec(bContext *C, wmOperator *op) newob = ob; } - BKE_mesh_to_curve(&eval_ctx, scene, newob); + BKE_mesh_to_curve(depsgraph, scene, newob); if (newob->type == OB_CURVE) { BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */ @@ -1840,7 +1836,7 @@ static int convert_exec(bContext *C, wmOperator *op) /* note: get the mesh from the original, not from the copy in some * cases this doesnt give correct results (when MDEF is used for eg) */ - dm = mesh_get_derived_final(&eval_ctx, scene, newob, CD_MASK_MESH); + dm = mesh_get_derived_final(depsgraph, scene, newob, CD_MASK_MESH); DM_to_mesh(dm, newob->data, newob, CD_MASK_MESH, true); @@ -1912,7 +1908,7 @@ static int convert_exec(bContext *C, wmOperator *op) BKE_curve_curve_dimension_update(cu); if (target == OB_MESH) { - curvetomesh(&eval_ctx, bmain, scene, newob); + curvetomesh(depsgraph, scene, newob); /* meshes doesn't use displist */ BKE_object_free_curve_cache(newob); @@ -1936,7 +1932,7 @@ static int convert_exec(bContext *C, wmOperator *op) newob = ob; } - curvetomesh(&eval_ctx, bmain, scene, newob); + curvetomesh(depsgraph, scene, newob); /* meshes doesn't use displist */ BKE_object_free_curve_cache(newob); @@ -1974,7 +1970,7 @@ static int convert_exec(bContext *C, wmOperator *op) for (a = 0; a < newob->totcol; a++) id_us_plus((ID *)me->mat[a]); } - convert_ensure_curve_cache(&eval_ctx, bmain, scene, baseob); + convert_ensure_curve_cache(depsgraph, scene, baseob); BKE_mesh_from_metaball(&baseob->curve_cache->disp, newob->data); if (obact->type == OB_MBALL) { |