[Bf-blender-cvs] [c6a0669] depsgraph_refactor: Depsgraph: Fix some stupid issues

Sergey Sharybin noreply at git.blender.org
Fri Jan 2 13:38:46 CET 2015


Commit: c6a06692fea970304802e2dd4563b74ce68ce9e4
Author: Sergey Sharybin
Date:   Fri Jan 2 17:37:01 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBc6a06692fea970304802e2dd4563b74ce68ce9e4

Depsgraph: Fix some stupid issues

- Adding empty would crash.
  This is because of missing ob->data NULL check in id type tagging.

- Fixed wrong assert statements in graph rebuild.

- Silenced error about using char for array indices.
  Not sure why it's needed since chars are unsigned in blender any
  way. Could be some mismatch in C++/C flags, need to investigate
  further.

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

M	source/blender/depsgraph/intern/depsgraph_build.cpp
M	source/blender/depsgraph/intern/depsgraph_query.cpp
M	source/blender/depsgraph/intern/depsgraph_tag.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 338bb58..764e6cf 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -632,10 +632,12 @@ void DEG_scene_relations_update(Main *bmain, Scene *scene)
 /* Rebuild dependency graph only for a given scene. */
 void DEG_scene_relations_rebuild(Main *bmain, Scene *scene)
 {
-	BLI_assert(graph->entry_tags.size() == NULL);
-	BLI_assert(graph->id_tags.size() == NULL);
-	DEG_graph_free(scene->depsgraph);
-	scene->depsgraph = NULL;
+	if (scene->depsgraph != NULL) {
+		BLI_assert(scene->depsgraph->entry_tags.size() == 0);
+		BLI_assert(scene->depsgraph->id_tags.size() == 0);
+		DEG_graph_free(scene->depsgraph);
+		scene->depsgraph = NULL;
+	}
 	DEG_scene_relations_update(bmain, scene);
 }
 
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cpp b/source/blender/depsgraph/intern/depsgraph_query.cpp
index 68443a9..41dbcc1 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_query.cpp
@@ -205,5 +205,5 @@ DepsNode *DEG_copy_node(DepsgraphCopyContext *dcc, const DepsNode *src)
 
 bool DEG_id_type_tagged(Main *bmain, short idtype)
 {
-	return bmain->id_tag_update[((char *)&idtype)[0]] != 0;
+	return bmain->id_tag_update[((unsigned char *)&idtype)[0]] != 0;
 }
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cpp b/source/blender/depsgraph/intern/depsgraph_tag.cpp
index 6dc34f9..5be80a4 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cpp
@@ -150,9 +150,11 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, short flag)
 		if (scene->depsgraph) {
 			if (flag & OB_RECALC_DATA && GS(id->name) == ID_OB) {
 				Object *object = (Object*)id;
-				DEG_graph_id_tag_update(bmain,
-				                        scene->depsgraph,
-				                        (ID*)object->data);
+				if (object->data != NULL) {
+					DEG_graph_id_tag_update(bmain,
+					                        scene->depsgraph,
+					                        (ID*)object->data);
+				}
 			}
 			DEG_graph_id_tag_update(bmain, scene->depsgraph, id);
 		}
@@ -175,7 +177,7 @@ void DEG_id_type_tag(Main *bmain, short idtype)
 	/* We tag based on first ID type character to avoid
 	 * looping over all ID's in case there are no tags.
 	 */
-	bmain->id_tag_update[((char *)&idtype)[0]] = 1;
+	bmain->id_tag_update[((unsigned char *)&idtype)[0]] = 1;
 }
 
 /* Update Flushing ---------------------------------- */
@@ -336,7 +338,7 @@ void DEG_ids_check_recalc(Main *bmain, Scene *scene, bool time)
 		/* We tag based on first ID type character to avoid
 		 * looping over all ID's in case there are no tags.
 		 */
-		if (id && bmain->id_tag_update[id->name[0]]) {
+		if (id && bmain->id_tag_update[(unsigned char)id->name[0]]) {
 			updated = true;
 			break;
 		}
@@ -364,7 +366,7 @@ void DEG_ids_clear_recalc(Main *bmain)
 		/* We tag based on first ID type character to avoid
 		 * looping over all ID's in case there are no tags.
 		 */
-		if (id && bmain->id_tag_update[id->name[0]]) {
+		if (id && bmain->id_tag_update[(unsigned char)id->name[0]]) {
 			for (; id; id = (ID *)id->next) {
 				id->flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA);




More information about the Bf-blender-cvs mailing list