[Bf-blender-cvs] [56f6938b5e8] blender2.8: Depsgraph: More fixes for shape keys

Sergey Sharybin noreply at git.blender.org
Wed Feb 7 14:17:10 CET 2018


Commit: 56f6938b5e8bad59fa422341b830555ddec466e9
Author: Sergey Sharybin
Date:   Wed Feb 7 14:15:24 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB56f6938b5e8bad59fa422341b830555ddec466e9

Depsgraph: More fixes for shape keys

Made shape keys to work for meshes. Also added missing code for curves.

Curves and lattices will not have shape keys visible, since modifiers support
is still to be done for them.

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

M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 851b666a00a..0dc1391d3a6 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -40,12 +40,15 @@
 #include "BLI_task.h"
 
 extern "C" {
+#include "DNA_curve_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_particle_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_windowmanager_types.h"
 
-
 #include "BKE_idcode.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
@@ -295,11 +298,50 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
                                     ID *id,
                                     eDepsgraph_Tag tag)
 {
-	if (tag == DEG_TAG_GEOMETRY && GS(id->name) == ID_OB) {
-		Object *object = (Object *)id;
-		ID *data_id = (ID *)object->data;
-		if (data_id != NULL) {
-			DEG_id_tag_update_ex(bmain, data_id, 0);
+	if (tag == DEG_TAG_GEOMETRY || tag == 0) {
+		switch (GS(id->name)) {
+			case ID_OB:
+			{
+				Object *object = (Object *)id;
+				ID *data_id = (ID *)object->data;
+				if (data_id != NULL) {
+					DEG_id_tag_update_ex(bmain, data_id, 0);
+				}
+				break;
+			}
+			/* TODO(sergey): Shape keys are annoying, maybe we should find a
+			 * way to chain geometry evaluation to them, so we don't need extra
+			 * tagging here.
+			 */
+			case ID_ME:
+			{
+				Mesh *mesh = (Mesh *)id;
+				ID *key_id = &mesh->key->id;
+				if (key_id != NULL) {
+					DEG_id_tag_update_ex(bmain, key_id, 0);
+				}
+				break;
+			}
+			case ID_LT:
+			{
+				Lattice *lattice = (Lattice *)id;
+				ID *key_id = &lattice->key->id;
+				if (key_id != NULL) {
+					DEG_id_tag_update_ex(bmain, key_id, 0);
+				}
+				break;
+			}
+			case ID_CU:
+			{
+				Curve *curve = (Curve *)id;
+				ID *key_id = &curve->key->id;
+				if (key_id != NULL) {
+					DEG_id_tag_update_ex(bmain, key_id, 0);
+				}
+				break;
+			}
+			default:
+				break;
 		}
 	}
 }
@@ -365,6 +407,7 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)
 		if (id_node != NULL) {
 			id_node->tag_update(graph);
 		}
+		deg_graph_id_tag_legacy_compat(bmain, id, (eDepsgraph_Tag)0);
 	}
 	int current_flag = flag;
 	while (current_flag != 0) {
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 290fb15443a..4ccf712e7d1 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
@@ -63,6 +63,7 @@ extern "C" {
 #include "DNA_object_types.h"
 
 #ifdef NESTED_ID_NASTY_WORKAROUND
+#  include "DNA_curve_types.h"
 #  include "DNA_key_types.h"
 #  include "DNA_lamp_types.h"
 #  include "DNA_lattice_types.h"
@@ -92,6 +93,7 @@ namespace {
 
 #ifdef NESTED_ID_NASTY_WORKAROUND
 union NestedIDHackTempStorage {
+	Curve curve;
 	FreestyleLineStyle linestyle;
 	Lamp lamp;
 	Lattice lattice;
@@ -120,8 +122,9 @@ void nested_id_hack_discard_pointers(ID *id_cow)
 		SPECIAL_CASE(ID_TE, Tex, nodetree)
 		SPECIAL_CASE(ID_WO, World, nodetree)
 
-		SPECIAL_CASE(ID_ME, Mesh, key)
+		SPECIAL_CASE(ID_CU, Curve, key)
 		SPECIAL_CASE(ID_LT, Lattice, key)
+		SPECIAL_CASE(ID_ME, Mesh, key)
 
 #  undef SPECIAL_CASE
 
@@ -153,8 +156,9 @@ const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage *storage
 		SPECIAL_CASE(ID_TE, Tex, nodetree, tex)
 		SPECIAL_CASE(ID_WO, World, nodetree, world)
 
-		SPECIAL_CASE(ID_ME, Mesh, key, mesh)
+		SPECIAL_CASE(ID_CU, Curve, key, curve)
 		SPECIAL_CASE(ID_LT, Lattice, key, lattice)
+		SPECIAL_CASE(ID_ME, Mesh, key, mesh)
 
 #  undef SPECIAL_CASE
 
@@ -186,8 +190,9 @@ void nested_id_hack_restore_pointers(const ID *old_id, ID *new_id)
 		SPECIAL_CASE(ID_TE, Tex, nodetree)
 		SPECIAL_CASE(ID_WO, World, nodetree)
 
-		SPECIAL_CASE(ID_ME, Mesh, key)
+		SPECIAL_CASE(ID_CU, Curve, key)
 		SPECIAL_CASE(ID_LT, Lattice, key)
+		SPECIAL_CASE(ID_ME, Mesh, key)
 
 #undef SPECIAL_CASE
 		default:
@@ -223,8 +228,9 @@ void ntree_hack_remap_pointers(const Depsgraph *depsgraph, ID *id_cow)
 		SPECIAL_CASE(ID_TE, Tex, nodetree, bNodeTree)
 		SPECIAL_CASE(ID_WO, World, nodetree, bNodeTree)
 
-		SPECIAL_CASE(ID_ME, Mesh, key, Key)
+		SPECIAL_CASE(ID_CU, Curve, key, Key)
 		SPECIAL_CASE(ID_LT, Lattice, key, Key)
+		SPECIAL_CASE(ID_ME, Mesh, key, Key)
 
 #undef SPECIAL_CASE
 		default:



More information about the Bf-blender-cvs mailing list