[Bf-blender-cvs] [6bb459f] master: Fix T40403: Particles disappear after rendering

Sergey Sharybin noreply at git.blender.org
Wed May 28 11:29:56 CEST 2014


Commit: 6bb459f6d7574d5cbe1ed9ad3470b5a802c3f843
Author: Sergey Sharybin
Date:   Wed May 28 15:28:52 2014 +0600
https://developer.blender.org/rB6bb459f6d7574d5cbe1ed9ad3470b5a802c3f843

Fix T40403: Particles disappear after rendering

Read the comment in ensure_curve_cache, it tells it all.

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

M	source/blender/editors/space_view3d/drawobject.c

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

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6df5fd8..7e44a81 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1942,7 +1942,29 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i
 #ifdef SEQUENCER_DAG_WORKAROUND
 static void ensure_curve_cache(Scene *scene, Object *object)
 {
-	if (object->curve_cache == NULL) {
+	bool need_recalc = object->curve_cache == NULL;
+	/* Render thread might have freed the curve cache if the
+	 * object is not visible. If the object is also used for
+	 * particles duplication, then render thread might have
+	 * also created curve_cache with only bevel and path
+	 * filled in.
+	 *
+	 * So check for curve_cache != NULL is not fully correct
+	 * here, we also need to check whether display list is
+	 * empty or not.
+	 *
+	 * The trick below tries to optimie calls to displist
+	 * creation for cases curve is empty. Meaning, if the curve
+	 * is empty (without splies) bevel list would also be empty.
+	 * And the thing is, render thread always leaves bevel list
+	 * in a proper state. So if bevel list is here and display
+	 * list is not we need to make display list.
+	 */
+	if (need_recalc == false) {
+		need_recalc = object->curve_cache->disp.first == NULL &&
+		              object->curve_cache->bev.first != NULL;
+	}
+	if (need_recalc) {
 		switch (object->type) {
 			case OB_CURVE:
 			case OB_SURF:




More information about the Bf-blender-cvs mailing list