Sun Position: remove show_daylight_savings preference
[blender-addons.git] / render_povray / scenography_properties.py
blobca9320b5daa027e5a7013fb8f15bbf51dc8c1fe4
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 """Declare stage set and surrounding (camera, lights, environment) properties controllable in UI"""
4 import bpy
5 from bpy.utils import register_class, unregister_class
6 from bpy.types import PropertyGroup
7 from bpy.props import (
8 FloatVectorProperty,
9 StringProperty,
10 BoolProperty,
11 IntProperty,
12 FloatProperty,
13 EnumProperty,
14 PointerProperty,
17 from .shading_properties import (
18 brush_texture_update,
21 # ---------------------------------------------------------------- #
22 # Camera POV properties.
23 # ---------------------------------------------------------------- #
26 class RenderPovSettingsCamera(PropertyGroup):
28 """Declare camera properties controllable in UI and translated to POV."""
30 # DOF Toggle
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(
37 name="Aperture",
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",
41 min=0.01,
42 max=1.00,
43 default=0.50,
46 # Aperture adaptive sampling
47 dof_samples_min: IntProperty(
48 name="Samples Min",
49 description="Minimum number of rays to use for each pixel",
50 min=1,
51 max=128,
52 default=3,
55 dof_samples_max: IntProperty(
56 name="Samples Max",
57 description="Maximum number of rays to use for each pixel",
58 min=1,
59 max=128,
60 default=9,
63 dof_variance: IntProperty(
64 name="Variance",
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",
68 min=1,
69 max=100000,
70 soft_max=10000,
71 default=8192,
74 dof_confidence: FloatProperty(
75 name="Confidence",
76 description="Probability to reach the real color value. Larger confidence values "
77 "will lead to more samples, slower traces and better images",
78 min=0.01,
79 max=0.99,
80 default=0.20,
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(
88 name="Pattern",
89 description="",
90 items=(
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", ""),
116 default="agate",
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",
129 default="",
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(
142 name="",
143 description="Use the limited version of texture user (for ‘old shading’ mode)",
144 default=True,
147 texture_context: EnumProperty(
148 name="Texture context",
149 description="Type of texture data to display and edit",
150 items=(
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"
155 "PARTICLES",
157 "Show particles textures",
158 "PARTICLES",
160 ), # "Show particles textures"
162 "LINESTYLE",
164 "Show linestyle textures",
165 "LINE_DATA",
167 ), # "Show linestyle textures"
169 "OTHER",
171 "Show other data textures",
172 "TEXTURE_DATA",
174 ), # "Show other data textures"
176 default="MATERIAL",
179 shadow_method: EnumProperty(
180 name="Shadow",
181 description="",
182 items=(
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",
198 soft_min=0.0,
199 soft_max=1.0,
200 default=1.0,
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(
212 name="",
213 description="Method for generating shadow samples: Adaptive QMC is fastest,"
214 "Constant QMC is less noisy but slower",
215 items=(
216 ("ADAPTIVE_QMC", "", "Halton samples distribution", "", 0),
217 ("CONSTANT_QMC", "", "QMC samples distribution", "", 1),
219 "CONSTANT_JITTERED",
221 "Uses POV jitter keyword",
224 ), # "Show other data textures"
226 default="CONSTANT_JITTERED",
229 use_jitter: BoolProperty(
230 name="Jitter",
231 description="Use noise for sampling (Constant Jittered sampling)",
232 default=False,
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(
245 name="",
246 description="Use the limited version of texture user (for ‘old shading’ mode)",
247 default=True,
250 texture_context: EnumProperty(
251 name="Texture context",
252 description="Type of texture data to display and edit",
253 items=(
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"
258 "PARTICLES",
260 "Show particles textures",
261 "PARTICLES",
263 ), # "Show particles textures"
265 "LINESTYLE",
267 "Show linestyle textures",
268 "LINE_DATA",
270 ), # "Show linestyle textures"
272 "OTHER",
274 "Show other data textures",
275 "TEXTURE_DATA",
277 ), # "Show other data textures"
279 default="MATERIAL",
282 use_sky_blend: BoolProperty(
283 name="Blend Sky",
284 description="Render background with natural progression from horizon to zenith",
285 default=False,
288 use_sky_paper: BoolProperty(
289 name="Paper Sky", description="Flatten blend or texture coordinates", default=False
292 use_sky_real: BoolProperty(
293 name="Real Sky",
294 description="Render background with a real horizon, relative to the camera angle",
295 default=False,
298 horizon_color: FloatVectorProperty(
299 name="Horizon Color",
300 description="Color at the horizon",
301 precision=4,
302 step=0.01,
303 min=0,
304 soft_max=1,
305 default=(0.050876, 0.050876, 0.050876),
306 options={"ANIMATABLE"},
307 subtype="COLOR",
310 zenith_color: FloatVectorProperty(
311 name="Zenith Color",
312 description="Color at the zenith",
313 precision=4,
314 step=0.01,
315 min=0,
316 soft_max=1,
317 default=(0.0, 0.0, 0.0),
318 options={"ANIMATABLE"},
319 subtype="COLOR",
322 ambient_color: FloatVectorProperty(
323 name="Ambient Color",
324 description="Ambient color of the world",
325 precision=4,
326 step=0.01,
327 min=0,
328 soft_max=1,
329 default=(0.0, 0.0, 0.0),
330 options={"ANIMATABLE"},
331 subtype="COLOR",
333 active_texture_index: IntProperty(
334 name="Index for texture_slots", default=0, update=brush_texture_update
338 classes = (
339 RenderPovSettingsCamera,
340 RenderPovSettingsLight,
341 RenderPovSettingsWorld,
345 def register():
346 for cls in classes:
347 register_class(cls)
349 bpy.types.Camera.pov = PointerProperty(type=RenderPovSettingsCamera)
350 bpy.types.Light.pov = PointerProperty(type=RenderPovSettingsLight)
351 bpy.types.World.pov = PointerProperty(type=RenderPovSettingsWorld)
354 def unregister():
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)