1 # SPDX-License-Identifier: GPL-2.0-or-later
3 """Declare stage set and surrounding (camera, lights, environment) properties controllable in UI"""
5 from bpy
.utils
import register_class
, unregister_class
6 from bpy
.types
import PropertyGroup
7 from bpy
.props
import (
17 from .shading_properties
import (
21 # ---------------------------------------------------------------- #
22 # Camera POV properties.
23 # ---------------------------------------------------------------- #
26 class RenderPovSettingsCamera(PropertyGroup
):
28 """Declare camera properties controllable in UI and translated to POV."""
31 dof_enable
: BoolProperty(
32 name
="Depth Of Field", description
="Enable POV Depth Of Field ", default
=False
35 # Aperture (Intensity of the Blur)
36 dof_aperture
: FloatProperty(
38 description
="Similar to a real camera's aperture effect over focal blur (though not "
39 "in physical units and independent of focal length). "
40 "Increase to get more blur",
46 # Aperture adaptive sampling
47 dof_samples_min
: IntProperty(
49 description
="Minimum number of rays to use for each pixel",
55 dof_samples_max
: IntProperty(
57 description
="Maximum number of rays to use for each pixel",
63 dof_variance
: IntProperty(
65 description
="Minimum threshold (fractional value) for adaptive DOF sampling (up "
66 "increases quality and render time). The value for the variance should "
67 "be in the range of the smallest displayable color difference",
74 dof_confidence
: FloatProperty(
76 description
="Probability to reach the real color value. Larger confidence values "
77 "will lead to more samples, slower traces and better images",
83 normal_enable
: BoolProperty(name
="Perturbated Camera", default
=False)
85 cam_normal
: FloatProperty(name
="Normal Strength", min=0.0, max=1.0, default
=0.001)
87 normal_patterns
: EnumProperty(
91 ("agate", "Agate", ""),
92 ("boxed", "Boxed", ""),
93 ("bumps", "Bumps", ""),
94 ("cells", "Cells", ""),
95 ("crackle", "Crackle", ""),
96 ("dents", "Dents", ""),
97 ("granite", "Granite", ""),
98 ("leopard", "Leopard", ""),
99 ("marble", "Marble", ""),
100 ("onion", "Onion", ""),
101 ("pavement", "Pavement", ""),
102 ("planar", "Planar", ""),
103 ("quilted", "Quilted", ""),
104 ("ripples", "Ripples", ""),
105 ("radial", "Radial", ""),
106 ("spherical", "Spherical", ""),
107 ("spiral1", "Spiral1", ""),
108 ("spiral2", "Spiral2", ""),
109 ("spotted", "Spotted", ""),
110 ("square", "Square", ""),
111 ("tiling", "Tiling", ""),
112 ("waves", "Waves", ""),
113 ("wood", "Wood", ""),
114 ("wrinkles", "Wrinkles", ""),
119 turbulence
: FloatProperty(name
="Turbulence", min=0.0, max=100.0, default
=0.1)
121 scale
: FloatProperty(name
="Scale", min=0.0, default
=1.0)
123 # ----------------------------------- CustomPOV Code ----------------------------------- #
124 # Only DUMMIES below for now:
125 replacement_text
: StringProperty(
126 name
="Texts in blend file",
127 description
="Type the declared name in custom POV code or an external .inc "
128 "it points at. camera {} expected",
133 # ---------------------------------------------------------------- #
134 # Light POV properties.
135 # ---------------------------------------------------------------- #
136 class RenderPovSettingsLight(PropertyGroup
):
138 """Declare light properties controllable in UI and translated to POV."""
140 # former Space properties from removed Blender Internal
141 use_limited_texture_context
: BoolProperty(
143 description
="Use the limited version of texture user (for ‘old shading’ mode)",
147 texture_context
: EnumProperty(
148 name
="Texture context",
149 description
="Type of texture data to display and edit",
151 ("MATERIAL", "", "Show material textures", "MATERIAL", 0), # "Show material textures"
152 ("WORLD", "", "Show world textures", "WORLD", 1), # "Show world textures"
153 ("LAMP", "", "Show lamp textures", "LIGHT", 2), # "Show lamp textures"
157 "Show particles textures",
160 ), # "Show particles textures"
164 "Show linestyle textures",
167 ), # "Show linestyle textures"
171 "Show other data textures",
174 ), # "Show other data textures"
179 shadow_method
: EnumProperty(
183 ("NOSHADOW", "No Shadow", "No Shadow"),
184 ("RAY_SHADOW", "Ray Shadow", "Ray Shadow, Use ray tracing for shadow"),
186 default
="RAY_SHADOW",
189 active_texture_index
: IntProperty(name
="Index for texture_slots", default
=0)
191 use_halo
: BoolProperty(
192 name
="Halo", description
="Render spotlight with a volumetric halo", default
=False
195 halo_intensity
: FloatProperty(
196 name
="Halo intensity",
197 description
="Brightness of the spotlight halo cone",
203 shadow_ray_samples_x
: IntProperty(
204 name
="Number of samples taken extra (samples x samples)", min=1, soft_max
=64, default
=1
207 shadow_ray_samples_y
: IntProperty(
208 name
="Number of samples taken extra (samples x samples)", min=1, soft_max
=64, default
=1
211 shadow_ray_sample_method
: EnumProperty(
213 description
="Method for generating shadow samples: Adaptive QMC is fastest,"
214 "Constant QMC is less noisy but slower",
216 ("ADAPTIVE_QMC", "", "Halton samples distribution", "", 0),
217 ("CONSTANT_QMC", "", "QMC samples distribution", "", 1),
221 "Uses POV jitter keyword",
224 ), # "Show other data textures"
226 default
="CONSTANT_JITTERED",
229 use_jitter
: BoolProperty(
231 description
="Use noise for sampling (Constant Jittered sampling)",
236 # ---------------------------------------------------------------- #
237 # World POV properties.
238 # ---------------------------------------------------------------- #
239 class RenderPovSettingsWorld(PropertyGroup
):
241 """Declare world properties controllable in UI and translated to POV."""
243 # former Space properties from removed Blender Internal
244 use_limited_texture_context
: BoolProperty(
246 description
="Use the limited version of texture user (for ‘old shading’ mode)",
250 texture_context
: EnumProperty(
251 name
="Texture context",
252 description
="Type of texture data to display and edit",
254 ("MATERIAL", "", "Show material textures", "MATERIAL", 0), # "Show material textures"
255 ("WORLD", "", "Show world textures", "WORLD", 1), # "Show world textures"
256 ("LIGHT", "", "Show lamp textures", "LIGHT", 2), # "Show lamp textures"
260 "Show particles textures",
263 ), # "Show particles textures"
267 "Show linestyle textures",
270 ), # "Show linestyle textures"
274 "Show other data textures",
277 ), # "Show other data textures"
282 use_sky_blend
: BoolProperty(
284 description
="Render background with natural progression from horizon to zenith",
288 use_sky_paper
: BoolProperty(
289 name
="Paper Sky", description
="Flatten blend or texture coordinates", default
=False
292 use_sky_real
: BoolProperty(
294 description
="Render background with a real horizon, relative to the camera angle",
298 horizon_color
: FloatVectorProperty(
299 name
="Horizon Color",
300 description
="Color at the horizon",
305 default
=(0.050876, 0.050876, 0.050876),
306 options
={"ANIMATABLE"},
310 zenith_color
: FloatVectorProperty(
312 description
="Color at the zenith",
317 default
=(0.0, 0.0, 0.0),
318 options
={"ANIMATABLE"},
322 ambient_color
: FloatVectorProperty(
323 name
="Ambient Color",
324 description
="Ambient color of the world",
329 default
=(0.0, 0.0, 0.0),
330 options
={"ANIMATABLE"},
333 active_texture_index
: IntProperty(
334 name
="Index for texture_slots", default
=0, update
=brush_texture_update
339 RenderPovSettingsCamera
,
340 RenderPovSettingsLight
,
341 RenderPovSettingsWorld
,
349 bpy
.types
.Camera
.pov
= PointerProperty(type=RenderPovSettingsCamera
)
350 bpy
.types
.Light
.pov
= PointerProperty(type=RenderPovSettingsLight
)
351 bpy
.types
.World
.pov
= PointerProperty(type=RenderPovSettingsWorld
)
355 del bpy
.types
.Camera
.pov
356 del bpy
.types
.Light
.pov
357 del bpy
.types
.World
.pov
359 for cls
in reversed(classes
):
360 unregister_class(cls
)