[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52827] trunk/blender: Fix #33454: cycles wasn't hiding the original object used for dupliverts or

Brecht Van Lommel brechtvanlommel at pandora.be
Sun Dec 9 13:43:44 CET 2012


Revision: 52827
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52827
Author:   blendix
Date:     2012-12-09 12:43:40 +0000 (Sun, 09 Dec 2012)
Log Message:
-----------
Fix #33454: cycles wasn't hiding the original object used for dupliverts or
duplifaces like blender internal.

Modified Paths:
--------------
    trunk/blender/intern/cycles/blender/blender_object.cpp
    trunk/blender/source/blender/blenkernel/intern/anim.c
    trunk/blender/source/blender/makesrna/intern/rna_object.c

Modified: trunk/blender/intern/cycles/blender/blender_object.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_object.cpp	2012-12-09 11:57:06 UTC (rev 52826)
+++ trunk/blender/intern/cycles/blender/blender_object.cpp	2012-12-09 12:43:40 UTC (rev 52827)
@@ -310,6 +310,13 @@
 	return object;
 }
 
+static bool object_dupli_hide_original(BL::Object::dupli_type_enum dupli_type)
+{
+	return (dupli_type == BL::Object::dupli_type_VERTS ||
+	        dupli_type == BL::Object::dupli_type_FACES ||
+	        dupli_type == BL::Object::dupli_type_FRAMES);
+}
+
 /* Object Loop */
 
 void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
@@ -371,6 +378,12 @@
 									emitter_hide = false;
 						}
 
+						/* hide original object for duplis */
+						BL::Object parent = b_dup_ob.parent();
+						if(parent && object_dupli_hide_original(parent.dupli_type()))
+							if(b_dup->type() == BL::DupliObject::type_GROUP)
+								dup_hide = true;
+
 						if(!(b_dup->hide() || dup_hide || emitter_hide)) {
 							/* the persistent_id allows us to match dupli objects
 							 * between frames and updates */
@@ -399,11 +412,15 @@
 				/* check if we should render or hide particle emitter */
 				BL::Object::particle_systems_iterator b_psys;
 
-				for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) {
+				for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
 					if(b_psys->settings().use_render_emitter())
 						hide = false;
-				}
 
+				/* hide original object for duplis */
+				BL::Object parent = b_ob->parent();
+				if(parent && object_dupli_hide_original(parent.dupli_type()))
+					hide = true;
+
 				if(!hide) {
 					/* object itself */
 					Transform tfm = get_transform(b_ob->matrix_world());

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c	2012-12-09 11:57:06 UTC (rev 52826)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c	2012-12-09 12:43:40 UTC (rev 52827)
@@ -1257,6 +1257,7 @@
 	float (*obmat)[4], (*oldobmat)[4];
 	int a, b, hair = 0;
 	int totpart, totchild, totgroup = 0 /*, pa_num */;
+	int dupli_type_hack = !BKE_scene_use_new_shading_nodes(scene);
 
 	int no_draw_flag = PARS_UNEXIST;
 
@@ -1474,6 +1475,13 @@
 				}
 			}
 			else {
+				int dupli_type = OB_DUPLIPARTS;
+
+				/* blender internal needs this to be set to dupligroup to render
+				 * groups correctly, but we don't want this hack for cycles */
+				if(dupli_type_hack && GS(id->name) == ID_GR)
+					dupli_type = OB_DUPLIGROUP;
+
 				/* to give ipos in object correct offset */
 				BKE_object_where_is_calc_time(scene, ob, ctime - pa_time);
 
@@ -1527,7 +1535,7 @@
 				if (part->draw & PART_DRAW_GLOBAL_OB)
 					add_v3_v3v3(mat[3], mat[3], vec);
 
-				dob = new_dupli_object(lb, ob, mat, ob->lay, persistent_id, level, a, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, (flag & DUPLILIST_ANIMATED));
+				dob = new_dupli_object(lb, ob, mat, ob->lay, persistent_id, level, a, dupli_type, (flag & DUPLILIST_ANIMATED));
 				dob->particle_system = psys;
 				copy_m4_m4(dob->omat, oldobmat);
 				if (flag & DUPLILIST_FOR_RENDER)

Modified: trunk/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object.c	2012-12-09 11:57:06 UTC (rev 52826)
+++ trunk/blender/source/blender/makesrna/intern/rna_object.c	2012-12-09 12:43:40 UTC (rev 52827)
@@ -94,6 +94,15 @@
 	{0, NULL, 0, NULL, NULL}
 };
 
+static EnumPropertyItem dupli_items[] = {
+	{0, "NONE", 0, "None", ""},
+	{OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
+	{OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
+	{OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
+	{OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
+	{0, NULL, 0, NULL, NULL}
+};
+
 static EnumPropertyItem collision_bounds_items[] = {
 	{OB_BOUND_BOX, "BOX", 0, "Box", ""},
 	{OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
@@ -2019,15 +2028,7 @@
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static EnumPropertyItem dupli_items[] = {
-		{0, "NONE", 0, "None", ""},
-		{OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
-		{OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
-		{OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
-		{OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
-		{0, NULL, 0, NULL, NULL}
-	};
-		
+	
 	/* XXX: this RNA enum define is currently duplicated for objects,
 	 *      since there is some text here which is not applicable */
 	static EnumPropertyItem prop_rotmode_items[] = {
@@ -2681,6 +2682,11 @@
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
+
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, dupli_items);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Dupli Type", "Duplicator type that generated this dupli object");
 }
 
 static void rna_def_object_base(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list