diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-01 19:06:44 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-01 19:09:09 +0300 |
commit | 9ed522db735b1d798a5d68c6bf547e8123d33a4b (patch) | |
tree | b8e08f92ea02f1a6e73c2883e5f55d296cd3cadf /source/blender/editors | |
parent | dbb479b998a63bec22ebc3173b22420c955892dd (diff) |
Fix more cases of evaluated mesh being built for non-COW objects.
Diffstat (limited to 'source/blender/editors')
8 files changed, 58 insertions, 23 deletions
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index c68c2720b0b..06385ab0cee 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -53,6 +53,7 @@ #include "BKE_subsurf.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "ED_armature.h" #include "ED_mesh.h" @@ -249,7 +250,7 @@ static void envelope_bone_weighting( } static void add_verts_to_dgroups( - ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par, + ReportList *reports, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, Object *par, int heat, const bool mirror) { /* This functions implements the automatic computation of vertex group @@ -375,7 +376,9 @@ static void add_verts_to_dgroups( if (wpmode) { /* if in weight paint mode, use final verts from evaluated mesh */ - Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH); BKE_mesh_foreach_mapped_vert_coords_get(me_eval, verts, mesh->totvert); vertsfilled = 1; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 1ba49537afd..0450b1d1ca7 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -664,7 +664,10 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) selme = (Mesh *)ob_iter->data; if (selme->totvert == me->totvert) { - me_deformed = mesh_get_eval_deform(depsgraph, scene, ob_iter, CD_MASK_BAREMESH); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob_iter); + + me_deformed = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH); if (!me_deformed) { continue; diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 7b65d4c4f47..3533e4fe55c 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -47,6 +47,7 @@ #include "BKE_report.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "RNA_access.h" #include "RNA_define.h" @@ -133,13 +134,15 @@ static const EnumPropertyItem *dt_layers_select_src_itemf( } else if (data_type == DT_TYPE_UV) { Object *ob_src = CTX_data_active_object(C); - Scene *scene = CTX_data_scene(C); if (ob_src) { Mesh *me_eval; int num_data, i; - me_eval = mesh_get_eval_final(depsgraph, scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPUV); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src); + + me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPUV); num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPUV); RNA_enum_item_add_separator(&item, &totitem); @@ -153,13 +156,15 @@ static const EnumPropertyItem *dt_layers_select_src_itemf( } else if (data_type == DT_TYPE_VCOL) { Object *ob_src = CTX_data_active_object(C); - Scene *scene = CTX_data_scene(C); if (ob_src) { Mesh *me_eval; int num_data, i; - me_eval = mesh_get_eval_final(depsgraph, scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPCOL); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src); + + me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPCOL); num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPCOL); RNA_enum_item_add_separator(&item, &totitem); @@ -338,9 +343,9 @@ static bool data_transfer_exec_is_object_valid( static int data_transfer_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *ob_src = ED_object_active_context(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); ListBase ctx_objects; CollectionPointerLink *ctx_ob_dst; @@ -404,12 +409,15 @@ static int data_transfer_exec(bContext *C, wmOperator *op) } if (data_transfer_exec_is_object_valid(op, ob_src, ob_dst, reverse_transfer)) { + Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src); + if (space_transform) { - BLI_SPACE_TRANSFORM_SETUP(space_transform, ob_dst, ob_src); + Object *ob_dst_eval = DEG_get_evaluated_object(depsgraph, ob_dst); + BLI_SPACE_TRANSFORM_SETUP(space_transform, ob_dst_eval, ob_src_eval); } if (BKE_object_data_transfer_mesh( - depsgraph, scene, ob_src, ob_dst, data_type, use_create, + depsgraph, scene_eval, ob_src_eval, ob_dst, data_type, use_create, map_vert_mode, map_edge_mode, map_loop_mode, map_poly_mode, space_transform, use_auto_transform, max_distance, ray_radius, islands_precision, @@ -605,9 +613,9 @@ static bool datalayout_transfer_poll(bContext *C) static int datalayout_transfer_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *ob_act = ED_object_active_context(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); DataTransferModifierData *dtmd; dtmd = (DataTransferModifierData *)edit_modifier_property_get(op, ob_act, eModifierType_DataTransfer); @@ -624,7 +632,9 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BKE_object_data_transfer_layout(depsgraph, scene, ob_src, ob_dst, dtmd->data_types, use_delete, + Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src); + + BKE_object_data_transfer_layout(depsgraph, scene_eval, ob_src_eval, ob_dst, dtmd->data_types, use_delete, dtmd->layers_select_src, dtmd->layers_select_dst); DEG_id_tag_update(&ob_dst->id, OB_RECALC_DATA); @@ -649,12 +659,14 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op) layers_select_dst[fromto_idx] = layers_dst; } + Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src); + data_transfer_exec_preprocess_objects(C, op, ob_src, &ctx_objects, false); for (ctx_ob_dst = ctx_objects.first; ctx_ob_dst; ctx_ob_dst = ctx_ob_dst->next) { Object *ob_dst = ctx_ob_dst->ptr.data; if (data_transfer_exec_is_object_valid(op, ob_src, ob_dst, false)) { - BKE_object_data_transfer_layout(depsgraph, scene, ob_src, ob_dst, data_type, use_delete, + BKE_object_data_transfer_layout(depsgraph, scene_eval, ob_src_eval, ob_dst, data_type, use_delete, layers_select_src, layers_select_dst); } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 7923e300377..b0047d5db8e 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1741,7 +1741,10 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain, int *emap_mem; int v; - me_eval_deform = mesh_get_eval_deform(depsgraph, scene, skin_ob, CD_MASK_BAREMESH); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, skin_ob); + + me_eval_deform = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH); mvert = me_eval_deform->mvert; /* add vertex weights to original mesh */ diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 09d3beadb2a..dcf6cfab407 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3564,7 +3564,7 @@ static void intersect_dm_quad_weights(const float v1[3], const float v2[3], cons } /** Check intersection with an evaluated mesh. */ -static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *mesh, +static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, Mesh *mesh, float *vert_cos, const float co1[3], const float co2[3], float *min_d, int *min_face, float *min_w, @@ -3580,9 +3580,12 @@ static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *scene, Object *o if (mesh == NULL) { psys_disable_all(ob); - mesh = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + + mesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH); if (mesh == NULL) { - mesh = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); + mesh = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH); } psys_enable_all(ob); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c index 31ae12c112a..5fe96483044 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c @@ -44,6 +44,7 @@ #include "BKE_mesh_runtime.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "ED_screen.h" #include "ED_view3d.h" @@ -103,11 +104,13 @@ static void vpaint_proj_dm_map_cosnos_init__map_cb( } static void vpaint_proj_dm_map_cosnos_init( - struct Depsgraph *depsgraph, Scene *scene, Object *ob, + struct Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, struct VertProjHandle *vp_handle) { + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); Mesh *me = ob->data; - Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX); + Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX); memset(vp_handle->vcosnos, 0, sizeof(*vp_handle->vcosnos) * me->totvert); BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, MESH_FOREACH_USE_NORMAL); @@ -168,10 +171,11 @@ static void vpaint_proj_dm_map_cosnos_update( { struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl}; - Scene *scene = vp_handle->scene; Object *ob = vp_handle->ob; + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); Mesh *me = ob->data; - Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX); + Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX); /* quick sanity check - we shouldn't have to run this if there are no modifiers */ BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 46eb3995ea3..464b7b8ad2e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -60,6 +60,7 @@ #include "BKE_colortools.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "WM_api.h" #include "WM_types.h" @@ -786,7 +787,10 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) ED_view3d_init_mats_rv3d(ob, ar->regiondata); - Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, scene->customdata_mask | CD_MASK_ORIGINDEX); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + + Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, scene->customdata_mask | CD_MASK_ORIGINDEX); if (data.is_init) { data.vert_visit = BLI_BITMAP_NEW(me->totvert, __func__); diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 3d0b0a7a348..c7552d2887e 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -119,7 +119,10 @@ void meshobject_foreachScreenVert( foreachScreenObjectVert_userData data; Mesh *me; - me = mesh_get_eval_deform(vc->depsgraph, vc->scene, vc->obact, CD_MASK_BAREMESH); + Scene *scene_eval = DEG_get_evaluated_scene(vc->depsgraph); + Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact); + + me = mesh_get_eval_deform(vc->depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); |