diff options
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index c2b85caad66..48166567354 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -43,6 +43,7 @@ #include "BKE_curve.h" #include "BKE_global.h" #include "BKE_gpencil.h" +#include "BKE_gpencil_update_cache.h" #include "BKE_idprop.h" #include "BKE_layer.h" #include "BKE_lib_id.h" @@ -646,8 +647,8 @@ void set_particle_system_modifiers_loaded(Object *object_cow) void reset_particle_system_edit_eval(const Depsgraph *depsgraph, Object *object_cow) { - /* Inactive (and render) dependency graphs are living in own little bubble, should not care about - * edit mode at all. */ + /* Inactive (and render) dependency graphs are living in their own little bubble, should not care + * about edit mode at all. */ if (!DEG_is_active(reinterpret_cast<const ::Depsgraph *>(depsgraph))) { return; } @@ -708,25 +709,6 @@ void update_animation_data_after_copy(const ID *id_orig, ID *id_cow) update_nla_tracks_orig_pointers(&anim_data_orig->nla_tracks, &anim_data_cow->nla_tracks); } -/* Some builders (like motion path one) will ignore proxies from being built. This code makes it so - * proxy and proxy_group pointers never point to an original objects, preventing evaluation code - * from assign evaluated pointer to an original proxy->proxy_from. */ -void update_proxy_pointers_after_copy(const Depsgraph *depsgraph, - const Object *object_orig, - Object *object_cow) -{ - if (object_cow->proxy != nullptr) { - if (!deg_check_id_in_depsgraph(depsgraph, &object_orig->proxy->id)) { - object_cow->proxy = nullptr; - } - } - if (object_cow->proxy_group != nullptr) { - if (!deg_check_id_in_depsgraph(depsgraph, &object_orig->proxy_group->id)) { - object_cow->proxy_group = nullptr; - } - } -} - /* Do some special treatment of data transfer from original ID to its * CoW complementary part. * @@ -756,11 +738,7 @@ void update_id_after_copy(const Depsgraph *depsgraph, } BKE_pose_pchan_index_rebuild(object_cow->pose); } - if (object_cow->type == OB_GPENCIL) { - BKE_gpencil_update_orig_pointers(object_orig, object_cow); - } update_particles_after_copy(depsgraph, object_orig, object_cow); - update_proxy_pointers_after_copy(depsgraph, object_orig, object_cow); break; } case ID_SCE: { @@ -912,6 +890,13 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, const IDNode update_edit_mode_pointers(depsgraph, id_orig, id_cow); return id_cow; } + /* In case we don't need to do a copy-on-write, we can use the update cache of the grease + * pencil data to do an update-on-write.*/ + if (id_type == ID_GD && BKE_gpencil_can_avoid_full_copy_on_write( + (const ::Depsgraph *)depsgraph, (bGPdata *)id_orig)) { + BKE_gpencil_update_on_write((bGPdata *)id_orig, (bGPdata *)id_cow); + return id_cow; + } } RuntimeBackup backup(depsgraph); |