[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45753] branches/soc-2011-tomato: Cycles: per render layer Samples control, leaving it to 0 will use the common

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Apr 18 17:23:14 CEST 2012


Revision: 45753
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45753
Author:   blendix
Date:     2012-04-18 15:23:13 +0000 (Wed, 18 Apr 2012)
Log Message:
-----------
Cycles: per render layer Samples control, leaving it to 0 will use the common
scene setting.

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/cycles/blender/addon/ui.py
    branches/soc-2011-tomato/intern/cycles/blender/blender_session.cpp
    branches/soc-2011-tomato/intern/cycles/blender/blender_sync.cpp
    branches/soc-2011-tomato/intern/cycles/blender/blender_sync.h
    branches/soc-2011-tomato/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_scene.c

Modified: branches/soc-2011-tomato/intern/cycles/blender/addon/ui.py
===================================================================
--- branches/soc-2011-tomato/intern/cycles/blender/addon/ui.py	2012-04-18 15:21:46 UTC (rev 45752)
+++ branches/soc-2011-tomato/intern/cycles/blender/addon/ui.py	2012-04-18 15:23:13 UTC (rev 45753)
@@ -192,6 +192,7 @@
         col.prop(rl, "material_override", text="")
 
         col = split.column()
+        col.prop(rl, "samples")
         col.prop(rl, "use_sky", "Use Environment")
 
         split = layout.split()

Modified: branches/soc-2011-tomato/intern/cycles/blender/blender_session.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/blender/blender_session.cpp	2012-04-18 15:21:46 UTC (rev 45752)
+++ branches/soc-2011-tomato/intern/cycles/blender/blender_session.cpp	2012-04-18 15:23:13 UTC (rev 45753)
@@ -218,12 +218,13 @@
 		scene->film->passes = passes;
 		scene->film->tag_update(scene);
 
-		/* update session */
-		session->reset(buffer_params, session_params.samples);
-
 		/* update scene */
 		sync->sync_data(b_v3d, b_iter->name().c_str());
 
+		/* update session */
+		int samples = sync->get_layer_samples();
+		session->reset(buffer_params, (samples == 0)? session_params.samples: samples);
+
 		/* render */
 		session->start();
 		session->wait();

Modified: branches/soc-2011-tomato/intern/cycles/blender/blender_sync.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/blender/blender_sync.cpp	2012-04-18 15:21:46 UTC (rev 45752)
+++ branches/soc-2011-tomato/intern/cycles/blender/blender_sync.cpp	2012-04-18 15:23:13 UTC (rev 45753)
@@ -210,6 +210,7 @@
 			render_layer.holdout_layer = 0;
 			render_layer.material_override = PointerRNA_NULL;
 			render_layer.use_background = true;
+			render_layer.samples = 0;
 			return;
 		}
 	}
@@ -228,6 +229,7 @@
 			render_layer.layer |= render_layer.holdout_layer;
 			render_layer.material_override = b_rlay->material_override();
 			render_layer.use_background = b_rlay->use_sky();
+			render_layer.samples = b_rlay->samples();
 		}
 
 		first_layer = false;

Modified: branches/soc-2011-tomato/intern/cycles/blender/blender_sync.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/blender/blender_sync.h	2012-04-18 15:21:46 UTC (rev 45752)
+++ branches/soc-2011-tomato/intern/cycles/blender/blender_sync.h	2012-04-18 15:23:13 UTC (rev 45753)
@@ -57,6 +57,7 @@
 	void sync_data(BL::SpaceView3D b_v3d, const char *layer = 0);
 	void sync_camera(BL::Object b_override, int width, int height);
 	void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
+	int get_layer_samples() { return render_layer.samples; }
 
 	/* get parameters */
 	static SceneParams get_scene_params(BL::Scene b_scene, bool background);
@@ -108,7 +109,8 @@
 		RenderLayerInfo()
 		: scene_layer(0), layer(0), holdout_layer(0),
 		  material_override(PointerRNA_NULL),
-		  use_background(true)
+		  use_background(true),
+		  samples(0)
 		{}
 
 		string name;
@@ -117,6 +119,7 @@
 		uint holdout_layer;
 		BL::Material material_override;
 		bool use_background;
+		int samples;
 	} render_layer;
 };
 

Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_scene_types.h	2012-04-18 15:21:46 UTC (rev 45752)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_scene_types.h	2012-04-18 15:23:13 UTC (rev 45753)
@@ -183,6 +183,9 @@
 	
 	int passflag;			/* pass_xor has to be after passflag */
 	int pass_xor;
+
+	int samples;
+	int pad;
 } SceneRenderLayer;
 
 /* srl->layflag */

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_scene.c	2012-04-18 15:21:46 UTC (rev 45752)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_scene.c	2012-04-18 15:23:13 UTC (rev 45753)
@@ -1912,6 +1912,12 @@
 	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
+	if(scene) {
+		prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
+		RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting");
+		RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	}
+
 	/* layer options */
 	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);




More information about the Bf-blender-cvs mailing list