[Bf-blender-cvs] [f818ff411a0] blender2.8: Cycles: use viewport duplicator visibility on preview

Dalai Felinto noreply at git.blender.org
Wed Jun 6 17:09:52 CEST 2018


Commit: f818ff411a03ae1d8e93ac21b7dc790abcd10ee0
Author: Dalai Felinto
Date:   Wed Jun 6 16:43:37 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBf818ff411a03ae1d8e93ac21b7dc790abcd10ee0

Cycles: use viewport duplicator visibility on preview

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

M	intern/cycles/blender/blender_object.cpp

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

diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 3c38c7a4584..8ed3eafb488 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -482,7 +482,8 @@ static bool object_render_hide_original(BL::Object::type_enum ob_type,
 static bool object_render_hide(BL::Object& b_ob,
                                bool top_level,
                                bool parent_hide,
-                               bool& hide_triangles)
+                               bool& hide_triangles,
+                               BL::Depsgraph::mode_enum depsgraph_mode)
 {
 	/* check if we should render or hide particle emitter */
 	BL::Object::particle_systems_iterator b_psys;
@@ -501,11 +502,16 @@ static bool object_render_hide(BL::Object& b_ob,
 		has_particles = true;
 	}
 
+	/* Both mode_PREVIEW and mode_VIEWPORT are treated the same here.*/
+	const bool show_duplicator = depsgraph_mode == BL::Depsgraph::mode_RENDER
+	                             ? b_ob.show_duplicator_for_render()
+	                             : b_ob.show_duplicator_for_viewport();
+
 	if(has_particles) {
-		show_emitter = b_ob.show_duplicator_for_render();
+		show_emitter = show_duplicator;
 		hide_emitter = !show_emitter;
 	} else if(b_ob.is_duplicator()) {
-		if(top_level || b_ob.show_duplicator_for_render()) {
+		if(top_level || show_duplicator) {
 			hide_as_dupli_parent = true;
 		}
 	}
@@ -563,6 +569,8 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
 	bool cancel = false;
 	bool use_portal = false;
 
+	BL::Depsgraph::mode_enum depsgraph_mode = b_depsgraph.mode();
+
 	BL::Depsgraph::object_instances_iterator b_instance_iter;
 	for(b_depsgraph.object_instances.begin(b_instance_iter);
 	    b_instance_iter != b_depsgraph.object_instances.end() && !cancel;
@@ -582,7 +590,7 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
 		/* test if object needs to be hidden */
 		bool hide_tris;
 
-		 if(!object_render_hide(b_ob, true, true, hide_tris)) {
+		 if(!object_render_hide(b_ob, true, true, hide_tris, depsgraph_mode)) {
 			/* object itself */
 			sync_object(b_depsgraph,
 			            b_instance,



More information about the Bf-blender-cvs mailing list