[Bf-blender-cvs] [59562e5b259] blender2.8: Fix Cycles particle info node not working.

Brecht Van Lommel noreply at git.blender.org
Wed Apr 4 13:19:04 CEST 2018


Commit: 59562e5b259ccc1e02e4f943394ca9db5ac938c7
Author: Brecht Van Lommel
Date:   Wed Apr 4 13:16:56 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB59562e5b259ccc1e02e4f943394ca9db5ac938c7

Fix Cycles particle info node not working.

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

M	intern/cycles/blender/blender_object.cpp
M	intern/cycles/blender/blender_particles.cpp
M	intern/cycles/blender/blender_sync.h
M	source/blender/makesrna/intern/rna_depsgraph.c

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

diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index be4214ede65..86c42e88e24 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -437,6 +437,9 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
 			object->dupli_generated = 0.5f*get_float3(b_dupli_iter->orco()) - make_float3(0.5f, 0.5f, 0.5f);
 			object->dupli_uv = get_float2(b_dupli_iter->uv());
 			object->random_id = b_dupli_iter->random_id();
+
+			/* Sync possible particle data. */
+			sync_dupli_particle(b_ob, *b_dupli_iter, object);
 		}
 		else {
 			object->dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
diff --git a/intern/cycles/blender/blender_particles.cpp b/intern/cycles/blender/blender_particles.cpp
index 00f8cb3cf1b..e365061722e 100644
--- a/intern/cycles/blender/blender_particles.cpp
+++ b/intern/cycles/blender/blender_particles.cpp
@@ -28,7 +28,7 @@ CCL_NAMESPACE_BEGIN
 /* Utilities */
 
 bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
-                                      BL::DupliObject& b_dup,
+                                      BL::DepsgraphIter& b_dup,
                                       Object *object)
 {
 	/* test if this dupli was generated from a particle sytem */
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 2ea86ba1133..80316757798 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -152,7 +152,7 @@ private:
 
 	/* particles */
 	bool sync_dupli_particle(BL::Object& b_ob,
-	                         BL::DupliObject& b_dup,
+	                         BL::DepsgraphIter& b_dup,
 	                         Object *object);
 
 	/* Images. */
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index bb20fcb271f..04e7f64712e 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -81,6 +81,14 @@ static PointerRNA rna_DepsgraphIter_parent_get(PointerRNA *ptr)
 	return rna_pointer_inherit_refine(ptr, &RNA_Object, dupli_parent);
 }
 
+static PointerRNA rna_DepsgraphIter_particle_system_get(PointerRNA *ptr)
+{
+	BLI_Iterator *iterator = ptr->data;
+	DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+	return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem,
+		deg_iter->dupli_object_current->particle_system);
+}
+
 static void rna_DepsgraphIter_persistent_id_get(PointerRNA *ptr, int *persistent_id)
 {
 	BLI_Iterator *iterator = ptr->data;
@@ -277,6 +285,12 @@ static void rna_def_depsgraph_iter(BlenderRNA *brna)
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, "rna_DepsgraphIter_parent_get", NULL, NULL, NULL);
 
+	prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+	RNA_def_property_struct_type(prop, "ParticleSystem");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Particle System", "Particle system that this object was instanced from");
+	RNA_def_property_pointer_funcs(prop, "rna_DepsgraphIter_particle_system_get", NULL, NULL, NULL);
+
 	prop = RNA_def_property(srna, "persistent_id", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Persistent ID",
 	                         "Persistent identifier for inter-frame matching of objects with motion blur");



More information about the Bf-blender-cvs mailing list