diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-12-14 13:32:07 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-12-14 13:33:18 +0300 |
commit | 7e6288cfe66096c55fe4bad8421507ed71ae769f (patch) | |
tree | c2542781ffe4017418dac5d25be01d136ff93713 /source/blender/blenkernel/intern/library.c | |
parent | 285cfef695e18a63eba81a385f9fd82bcbccdabc (diff) |
Fix T58652: Crash editing shape keys weirdness with instances
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 55322dbc333..23d431b9325 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -109,6 +109,7 @@ #include "BKE_library_remap.h" #include "BKE_linestyle.h" #include "BKE_mesh.h" +#include "BKE_mesh_runtime.h" #include "BKE_material.h" #include "BKE_main.h" #include "BKE_mball.h" @@ -517,6 +518,31 @@ static int id_copy_libmanagement_cb(void *user_data, ID *UNUSED(id_self), ID **i return IDWALK_RET_NOP; } +static void id_copy_clear_runtime_if_needed(ID *id, int UNUSED(flag)) +{ + if (id == NULL) { + return; + } + /* TODO(sergey): Think of having a flag which will allow to share runtime + * fields of the ID.*/ + switch ((ID_Type)GS(id->name)) { + case ID_OB: + { + Object *object = (Object *)id; + BKE_object_runtime_reset(object); + break; + } + case ID_ME: + { + Mesh *mesh = (Mesh *)id; + BKE_mesh_runtime_reset(mesh); + break; + } + default: + break; + } +} + /** * Generic entry point for copying a datablock (new API). * @@ -682,6 +708,8 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con (*r_newid)->lib = id->lib; } + id_copy_clear_runtime_if_needed(*r_newid, flag); + return true; } |