[Bf-blender-cvs] [f777983] master: Add missing particle system tagging on update to the new depsgraph

Sergey Sharybin noreply at git.blender.org
Thu May 28 10:52:02 CEST 2015


Commit: f777983d5bf18daebb3f9940061f22a9641da759
Author: Sergey Sharybin
Date:   Thu May 28 13:49:23 2015 +0500
Branches: master
https://developer.blender.org/rBf777983d5bf18daebb3f9940061f22a9641da759

Add missing particle system tagging on update to the new depsgraph

It's not ideal and mimics weak legacy code, but so close to bcon4 we'd better
not start re-considering the way how particle works..

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

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

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

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 65109ff..4736de5 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -62,6 +62,14 @@ extern "C" {
 /* *********************** */
 /* Update Tagging/Flushing */
 
+/* Legacy depsgraph did some special trickery for things like particle systems
+ * when tagging ID for an update. Ideally that tagging needs to become obsolete
+ * in favor of havng dedicated node for that which gets tagged, but for until
+ * design of those areas is more clear we'll do the same legacy code here.
+ *                                                                  - sergey -
+ */
+#define DEPSGRAPH_USE_LEGACY_TAGGING
+
 /* Data-Based Tagging ------------------------------- */
 
 static void lib_id_recalc_tag(Main *bmain, ID *id)
@@ -108,6 +116,33 @@ static void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
 	}
 }
 
+#ifdef DEPSGRAPH_USE_LEGACY_TAGGING
+static void depsgraph_legacy_handle_update_tag(Main *bmain, ID *id, short flag)
+{
+	if (flag) {
+		Object *object;
+		short idtype = GS(id->name);
+		if (idtype == ID_PA) {
+			ParticleSystem *psys;
+			for (object = (Object *)bmain->object.first;
+			     object != NULL;
+			     object = (Object *)object->id.next)
+			{
+				for (psys = (ParticleSystem *)object->particlesystem.first;
+				     psys != NULL;
+				     psys = (ParticleSystem *)psys->next)
+				{
+					if (&psys->part->id == id) {
+						DEG_id_tag_update_ex(bmain, &object->id, flag & OB_RECALC_ALL);
+						psys->recalc |= (flag & PSYS_RECALC);
+					}
+				}
+			}
+		}
+	}
+}
+#endif
+
 /* Tag all nodes in ID-block for update.
  * This is a crude measure, but is most convenient for old code.
  */
@@ -189,6 +224,14 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, short flag)
 			}
 		}
 	}
+
+#ifdef DEPSGRAPH_USE_LEGACY_TAGGING
+	/* Special handling from the legacy depsgraph.
+	 * TODO(sergey): Need to get rid of those once all the areas
+	 * are re-formulated in terms of franular nodes.
+	 */
+	depsgraph_legacy_handle_update_tag(bmain, id, flag);
+#endif
 }
 
 /* Tag given ID type for update. */




More information about the Bf-blender-cvs mailing list