[Bf-blender-cvs] [0960d21] soc-2013-depsgraph_mt: Address review from Brecht

Sergey Sharybin noreply at git.blender.org
Fri Dec 13 11:21:02 CET 2013


Commit: 0960d2114af40663869e030e69faa4bba04c0f3a
Author: Sergey Sharybin
Date:   Fri Dec 13 16:17:11 2013 +0600
http://developer.blender.org/rB0960d2114af40663869e030e69faa4bba04c0f3a

Address review from Brecht

* Removed residual of derivedRender code from convertblender.c
* Added check for oldcreen->scene != screen->scene before rebuilding
  the DAG when changing the scene.
* Made blender compilable with smoke disabled.
* Typo fixes.

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

M	source/blender/blenkernel/intern/smoke.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/render/intern/source/pipeline.c
M	source/creator/creator.c

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

diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 80a1a45..56fabb9 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -166,7 +166,7 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s
 void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity),
                           int *UNUSED(border_colli), float *UNUSED(burning_rate), float *UNUSED(flame_smoke), float *UNUSED(flame_smoke_color),
                           float *UNUSED(flame_vorticity), float *UNUSED(flame_ignition_temp), float *UNUSED(flame_max_temp)) {}
-struct DerivedMesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) { return NULL; }
+struct DerivedMesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm), bool UNUSED(for_render)) { return NULL; }
 float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; }
 void flame_get_spectrum(unsigned char *UNUSED(spec), int UNUSED(width), float UNUSED(t1), float UNUSED(t2)) {}
 
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 3ca12f7..7ec037d 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1505,6 +1505,7 @@ void ED_screen_set(bContext *C, bScreen *sc)
 	if (oldscreen != sc) {
 		wmTimer *wt = oldscreen->animtimer;
 		ScrArea *sa;
+		Scene *oldscene = oldscreen->scene;
 
 		/* remove handlers referencing areas in old screen */
 		for (sa = oldscreen->areabase.first; sa; sa = sa->next) {
@@ -1542,11 +1543,10 @@ void ED_screen_set(bContext *C, bScreen *sc)
 		 * Quite the same happens when setting screen's scene,
 		 * so perhaps this is in fact correct thing to do.
 		 */
-		/* TODO(sergey): Check whether DAG is actually need to
-		 *               be rebuilt.
-		 */
-		BKE_scene_set_background(bmain, sc->scene);
-		DAG_on_visible_update(bmain, FALSE);
+		if (oldscene != sc->scene) {
+			BKE_scene_set_background(bmain, sc->scene);
+			DAG_on_visible_update(bmain, FALSE);
+		}
 	}
 }
 
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 91c7eb9..849a6f6 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1586,19 +1586,6 @@ static bool rlayer_node_uses_alpha(bNodeTree *ntree, bNode *node)
 	return false;
 }
 
-static bool allow_render_mesh_object(Object *ob)
-{
-	/* override not showing object when duplis are used with particles */
-	if (ob->transflag & OB_DUPLIPARTS) {
-		/* pass */  /* let particle system(s) handle showing vs. not showing */
-	}
-	else if ((ob->transflag & OB_DUPLI) && !(ob->transflag & OB_DUPLIFRAMES)) {
-		return false;
-	}
-
-	return true;
-}
-
 /* Issue here is that it's possible that object which is used by boolean,
  * array or shrinkwrap modifiers weren't displayed in the viewport before
  * rendering. This leads to situations when apply() of this modifiers
@@ -1613,15 +1600,33 @@ static bool allow_render_mesh_object(Object *ob)
  * properly without hacks from their side.
  *                                                  - sergey -
  */
-#define DEOSGRAPH_WORKAROUND_HACK
+#define DEPSGRAPH_WORKAROUND_HACK
 
-#ifdef DEOSGRAPH_WORKAROUND_HACK
-static void tag_dependend_objects_for_render(Scene *scene)
+static bool allow_render_mesh_object(Object *ob)
+{
+	/* override not showing object when duplis are used with particles */
+	if (ob->transflag & OB_DUPLIPARTS) {
+		/* pass */  /* let particle system(s) handle showing vs. not showing */
+	}
+	else if ((ob->transflag & OB_DUPLI) && !(ob->transflag & OB_DUPLIFRAMES)) {
+		return false;
+	}
+
+	return true;
+}
+
+#ifdef DEPSGRAPH_WORKAROUND_HACK
+static void tag_dependend_objects_for_render(Scene *scene, int renderlay)
 {
 	Scene *sce_iter;
 	Base *base;
 	for (SETLOOPER(scene, sce_iter, base)) {
 		Object *object = base->object;
+
+		if ((base->lay & renderlay) == 0) {
+			continue;
+		}
+
 		if (object->type == OB_MESH) {
 			if (allow_render_mesh_object(object)) {
 				ModifierData *md;
@@ -1667,27 +1672,30 @@ static void tag_scenes_for_render(Render *re)
 {
 	bNode *node;
 	Scene *sce;
+#ifdef DEPSGRAPH_WORKAROUND_HACK
+	int renderlay = re->lay;
+#endif
 	
 	for (sce = re->main->scene.first; sce; sce = sce->id.next) {
 		sce->id.flag &= ~LIB_DOIT;
-#ifdef DEOSGRAPH_WORKAROUND_HACK
-		tag_dependend_objects_for_render(sce);
+#ifdef DEPSGRAPH_WORKAROUND_HACK
+		tag_dependend_objects_for_render(sce, renderlay);
 #endif
 	}
 	
 #ifdef WITH_FREESTYLE
 	for (sce = re->freestyle_bmain.scene.first; sce; sce = sce->id.next) {
 		sce->id.flag &= ~LIB_DOIT;
-#ifdef DEOSGRAPH_WORKAROUND_HACK
-		tag_dependend_objects_for_render(sce);
+#ifdef DEPSGRAPH_WORKAROUND_HACK
+		tag_dependend_objects_for_render(sce, renderlay);
 #endif
 	}
 #endif
 
 	if (RE_GetCamera(re) && composite_needs_render(re->scene, 1)) {
 		re->scene->id.flag |= LIB_DOIT;
-#ifdef DEOSGRAPH_WORKAROUND_HACK
-		tag_dependend_objects_for_render(re->scene);
+#ifdef DEPSGRAPH_WORKAROUND_HACK
+		tag_dependend_objects_for_render(re->scene, renderlay);
 #endif
 	}
 	
@@ -1717,8 +1725,8 @@ static void tag_scenes_for_render(Render *re)
 					if ((node->id->flag & LIB_DOIT) == 0) {
 						node->flag |= NODE_TEST;
 						node->id->flag |= LIB_DOIT;
-#ifdef DEOSGRAPH_WORKAROUND_HACK
-						tag_dependend_objects_for_render((Scene *) node->id);
+#ifdef DEPSGRAPH_WORKAROUND_HACK
+						tag_dependend_objects_for_render((Scene *) node->id, renderlay);
 #endif
 					}
 				}
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 7f6c756..2c61dab 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1258,6 +1258,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
 		 * pointcache works */
 		if (retval != BKE_READ_FILE_FAIL) {
 			wmWindowManager *wm = CTX_wm_manager(C);
+			Main *bmain = CTX_data_main(C);
 
 			/* special case, 2.4x files */
 			if (wm == NULL && CTX_data_main(C)->wm.first == NULL) {
@@ -1273,8 +1274,8 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
 			G.relbase_valid = 1;
 			if (CTX_wm_manager(C) == NULL) CTX_wm_manager_set(C, wm);  /* reset wm */
 
-			DAG_on_visible_update(CTX_data_main(C), TRUE);
-			BKE_scene_update_tagged(CTX_data_main(C), CTX_data_scene(C));
+			DAG_on_visible_update(bmain, TRUE);
+			BKE_scene_update_tagged(bmain->evaluation_context, bmain, CTX_data_scene(C));
 		}
 		else {
 			/* failed to load file, stop processing arguments */




More information about the Bf-blender-cvs mailing list