[Bf-blender-cvs] [7e6288cfe66] blender2.8: Fix T58652: Crash editing shape keys weirdness with instances

Sergey Sharybin noreply at git.blender.org
Fri Dec 14 11:33:23 CET 2018


Commit: 7e6288cfe66096c55fe4bad8421507ed71ae769f
Author: Sergey Sharybin
Date:   Fri Dec 14 11:32:07 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB7e6288cfe66096c55fe4bad8421507ed71ae769f

Fix T58652: Crash editing shape keys weirdness with instances

===================================================================

M	source/blender/blenkernel/intern/library.c

===================================================================

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;
 }



More information about the Bf-blender-cvs mailing list