[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49761] trunk/blender/intern/cycles/ blender: Fix for particle object rendering in Cycles.

Lukas Toenne lukas.toenne at googlemail.com
Fri Aug 10 12:15:45 CEST 2012


Revision: 49761
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49761
Author:   lukastoenne
Date:     2012-08-10 10:15:45 +0000 (Fri, 10 Aug 2012)
Log Message:
-----------
Fix for particle object rendering in Cycles. On object sync the object first has to determine if a particle update is needed (which depends on dupli objects and their meshes), before deciding to skip the actual syncing.

Modified Paths:
--------------
    trunk/blender/intern/cycles/blender/blender_object.cpp
    trunk/blender/intern/cycles/blender/blender_particles.cpp
    trunk/blender/intern/cycles/blender/blender_sync.h

Modified: trunk/blender/intern/cycles/blender/blender_object.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_object.cpp	2012-08-10 09:58:58 UTC (rev 49760)
+++ trunk/blender/intern/cycles/blender/blender_object.cpp	2012-08-10 10:15:45 UTC (rev 49761)
@@ -247,8 +247,11 @@
 		scene->object_manager->tag_update(scene);
 	}
 
+	/* updated dupli objects require particle sync */
+	bool need_particle_update = object_need_particle_update(b_ob);
+
 	/* object sync */
-	if(object_updated || (object->mesh && object->mesh->need_update)) {
+	if(object_updated || (object->mesh && object->mesh->need_update) || need_particle_update) {
 		object->name = b_ob.name().c_str();
 		object->pass_id = b_ob.pass_index();
 		object->tfm = tfm;
@@ -275,7 +278,7 @@
 		object->particle_id = particle_id;
 
 		/* particle sync */
-		if (object_use_particles(b_ob))
+		if (need_particle_update)
 			sync_particles(object, b_ob);
 	
 		object->tag_update(scene);

Modified: trunk/blender/intern/cycles/blender/blender_particles.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_particles.cpp	2012-08-10 09:58:58 UTC (rev 49760)
+++ trunk/blender/intern/cycles/blender/blender_particles.cpp	2012-08-10 10:15:45 UTC (rev 49761)
@@ -31,7 +31,7 @@
 
 /* Particles Sync */
 
-bool BlenderSync::object_use_particles(BL::Object b_ob)
+bool BlenderSync::object_need_particle_update(BL::Object b_ob)
 {
 	/* Particle data is only needed for
 	 * a) Billboard render mode if object's own material uses particle info
@@ -39,7 +39,7 @@
 	 *
 	 * Note: Meshes have to be synced at this point!
 	 */
-	bool use_particles = false;
+	bool need_update = false;
 	
 	BL::Object::particle_systems_iterator b_psys;
 	for (b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
@@ -54,7 +54,7 @@
 			BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob.data();
 			Mesh *mesh = mesh_map.find(key);
 			if (mesh) {
-				use_particles |= mesh->need_attribute(scene, ATTR_STD_PARTICLE);
+				need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
 			}
 			break;
 		}
@@ -66,7 +66,7 @@
 				BL::ID key = (BKE_object_is_modified(b_dupli_ob))? b_dupli_ob: b_dupli_ob.data();
 				Mesh *mesh = mesh_map.find(key);
 				if (mesh) {
-					use_particles |= mesh->need_attribute(scene, ATTR_STD_PARTICLE);
+					need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
 				}
 			}
 			break;
@@ -80,7 +80,7 @@
 					BL::ID key = (BKE_object_is_modified(*b_gob))? *b_gob: b_gob->data();
 					Mesh *mesh = mesh_map.find(key);
 					if (mesh) {
-						use_particles |= mesh->need_attribute(scene, ATTR_STD_PARTICLE);
+						need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
 					}
 				}
 			}
@@ -93,7 +93,7 @@
 		}
 	}
 	
-	return use_particles;
+	return need_update;
 }
 
 static bool use_particle_system(BL::ParticleSystem b_psys)

Modified: trunk/blender/intern/cycles/blender/blender_sync.h
===================================================================
--- trunk/blender/intern/cycles/blender/blender_sync.h	2012-08-10 09:58:58 UTC (rev 49760)
+++ trunk/blender/intern/cycles/blender/blender_sync.h	2012-08-10 10:15:45 UTC (rev 49761)
@@ -92,7 +92,7 @@
 	bool BKE_object_is_modified(BL::Object b_ob);
 	bool object_is_mesh(BL::Object b_ob);
 	bool object_is_light(BL::Object b_ob);
-	bool object_use_particles(BL::Object b_ob);
+	bool object_need_particle_update(BL::Object b_ob);
 	int object_count_particles(BL::Object b_ob);
 
 	/* variables */




More information about the Bf-blender-cvs mailing list