1 # This program is free software; you can redistribute it and/or
2 # modify it under the terms of the GNU General Public License
3 # as published by the Free Software Foundation; either version 2
4 # of the License, or (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software Foundation,
13 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 Cycles: Samples per Scene
17 When working in production, it's often more convenient to do lighting and
18 compositing in different scenes (so you can later append the comp scene
19 to bring together nodes, settings, lamps, RenderLayers).
21 This would lead to work with more than one scene. When doing render tests
22 you want to know at a glance how many samples the other scenes have,
23 without manually switching. This is the idea behind the feature.
25 Find it on the Sampling panel, on Render properties.
26 Developed during Caminandes Open Movie Project
30 from amaranth
import utils
31 from bpy
.props
import (
37 def render_cycles_scene_samples(self
, context
):
42 if utils
.cycles_exists():
44 list_sampling
= scene
.amaranth_cycles_list_sampling
47 #if (len(scene.render.layers) > 1) or (len(bpy.data.scenes) > 1):
48 if (len(scene
.render
.views
) > 1) or (len(bpy
.data
.scenes
) > 1):
51 row
= box
.row(align
=True)
52 col
= row
.column(align
=True)
54 row
= col
.row(align
=True)
55 row
.alignment
= "LEFT"
56 row
.prop(scene
, "amaranth_cycles_list_sampling",
57 icon
="%s" % "TRIA_DOWN" if list_sampling
else "TRIA_RIGHT",
61 #if len(scene.render.layers) == 1 and render.layers[0].samples == 0:
62 if len(scene
.render
.views
) == 1 and render
.view_layers
[0].samples
== 0:
66 #col.label(text="RenderLayers:", icon="RENDERLAYERS")
67 col
.label(text
="View Layers:", icon
="RENDERLAYERS")
69 #for rl in scene.render.layers:
70 for rl
in scene
.view_layers
:
71 row
= col
.row(align
=True)
72 row
.label(text
=rl
.name
, icon
="BLANK1")
74 rl
, "samples", text
="%s" %
75 "Samples" if rl
.samples
> 0 else "Automatic (%s)" %
78 if (len(bpy
.data
.scenes
) > 1):
81 col
.label(text
="Scenes:", icon
="SCENE_DATA")
83 if utils
.cycles_exists():
84 for s
in bpy
.data
.scenes
:
86 row
= col
.row(align
=True)
87 if s
.render
.engine
== "CYCLES":
91 row
.label(text
=s
.name
)
92 row
.prop(cscene
, "samples", icon
="BLANK1")
95 text
="Scene: '%s' is not using Cycles" %
98 for s
in bpy
.data
.scenes
:
100 row
= col
.row(align
=True)
101 if s
.render
.engine
== "CYCLES":
104 row
.label(text
=s
.name
, icon
="BLANK1")
105 row
.prop(cscene
, "aa_samples",
109 text
="Scene: '%s' is not using Cycles" %
114 scene
= bpy
.types
.Scene
115 if utils
.cycles_exists():
116 scene
.amaranth_cycles_list_sampling
= bpy
.props
.BoolProperty(
119 # Note: add versioning code to address changes introduced in 2.79.1
120 from cycles
import properties
as _cycles_props
121 _cycles_props
.CyclesRenderSettings
.use_samples_final
= BoolProperty(
122 name
="Use Final Render Samples",
123 description
="Use current shader samples as final render samples",
129 wm
= bpy
.context
.window_manager
130 for p
in ("amarath_cycles_list_sampling", "use_samples_final"):
137 if utils
.cycles_exists():
138 bpy
.types
.CYCLES_RENDER_PT_sampling
.append(render_cycles_scene_samples
)
142 if utils
.cycles_exists():
143 bpy
.types
.CYCLES_RENDER_PT_sampling
.remove(render_cycles_scene_samples
)