Import_3ds: Improved distance cue node setup
[blender-addons.git] / render_povray / scenography_properties.py
blob7a3ae1764da22decf99551559b9e9bbd8a55189f
1 # SPDX-FileCopyrightText: 2021-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 """Declare stage set and surrounding (camera, lights, environment) properties controllable in UI"""
6 import bpy
7 from bpy.utils import register_class, unregister_class
8 from bpy.types import PropertyGroup
9 from bpy.props import (
10 FloatVectorProperty,
11 StringProperty,
12 BoolProperty,
13 IntProperty,
14 FloatProperty,
15 EnumProperty,
16 PointerProperty,
19 from .shading_properties import (
20 brush_texture_update,
23 # ---------------------------------------------------------------- #
24 # Camera POV properties.
25 # ---------------------------------------------------------------- #
28 class RenderPovSettingsCamera(PropertyGroup):
30 """Declare camera properties controllable in UI and translated to POV."""
32 # DOF Toggle
33 dof_enable: BoolProperty(
34 name="Depth Of Field", description="Enable POV Depth Of Field ", default=False
37 # Aperture (Intensity of the Blur)
38 dof_aperture: FloatProperty(
39 name="Aperture",
40 description="Similar to a real camera's aperture effect over focal blur (though not "
41 "in physical units and independent of focal length). "
42 "Increase to get more blur",
43 min=0.01,
44 max=1.00,
45 default=0.50,
48 # Aperture adaptive sampling
49 dof_samples_min: IntProperty(
50 name="Samples Min",
51 description="Minimum number of rays to use for each pixel",
52 min=1,
53 max=128,
54 default=3,
57 dof_samples_max: IntProperty(
58 name="Samples Max",
59 description="Maximum number of rays to use for each pixel",
60 min=1,
61 max=128,
62 default=9,
65 dof_variance: IntProperty(
66 name="Variance",
67 description="Minimum threshold (fractional value) for adaptive DOF sampling (up "
68 "increases quality and render time). The value for the variance should "
69 "be in the range of the smallest displayable color difference",
70 min=1,
71 max=100000,
72 soft_max=10000,
73 default=8192,
76 dof_confidence: FloatProperty(
77 name="Confidence",
78 description="Probability to reach the real color value. Larger confidence values "
79 "will lead to more samples, slower traces and better images",
80 min=0.01,
81 max=0.99,
82 default=0.20,
85 normal_enable: BoolProperty(name="Perturbated Camera", default=False)
87 cam_normal: FloatProperty(name="Normal Strength", min=0.0, max=1.0, default=0.001)
89 normal_patterns: EnumProperty(
90 name="Pattern",
91 description="",
92 items=(
93 ("agate", "Agate", ""),
94 ("boxed", "Boxed", ""),
95 ("bumps", "Bumps", ""),
96 ("cells", "Cells", ""),
97 ("crackle", "Crackle", ""),
98 ("dents", "Dents", ""),
99 ("granite", "Granite", ""),
100 ("leopard", "Leopard", ""),
101 ("marble", "Marble", ""),
102 ("onion", "Onion", ""),
103 ("pavement", "Pavement", ""),
104 ("planar", "Planar", ""),
105 ("quilted", "Quilted", ""),
106 ("ripples", "Ripples", ""),
107 ("radial", "Radial", ""),
108 ("spherical", "Spherical", ""),
109 ("spiral1", "Spiral1", ""),
110 ("spiral2", "Spiral2", ""),
111 ("spotted", "Spotted", ""),
112 ("square", "Square", ""),
113 ("tiling", "Tiling", ""),
114 ("waves", "Waves", ""),
115 ("wood", "Wood", ""),
116 ("wrinkles", "Wrinkles", ""),
118 default="agate",
121 turbulence: FloatProperty(name="Turbulence", min=0.0, max=100.0, default=0.1)
123 scale: FloatProperty(name="Scale", min=0.0, default=1.0)
125 # ----------------------------------- CustomPOV Code ----------------------------------- #
126 # Only DUMMIES below for now:
127 replacement_text: StringProperty(
128 name="Texts in blend file",
129 description="Type the declared name in custom POV code or an external .inc "
130 "it points at. camera {} expected",
131 default="",
135 # ---------------------------------------------------------------- #
136 # Light POV properties.
137 # ---------------------------------------------------------------- #
138 class RenderPovSettingsLight(PropertyGroup):
140 """Declare light properties controllable in UI and translated to POV."""
142 # former Space properties from removed Blender Internal
143 use_limited_texture_context: BoolProperty(
144 name="",
145 description="Use the limited version of texture user (for ‘old shading’ mode)",
146 default=True,
149 texture_context: EnumProperty(
150 name="Texture context",
151 description="Type of texture data to display and edit",
152 items=(
153 ("MATERIAL", "", "Show material textures", "MATERIAL", 0), # "Show material textures"
154 ("WORLD", "", "Show world textures", "WORLD", 1), # "Show world textures"
155 ("LAMP", "", "Show lamp textures", "LIGHT", 2), # "Show lamp textures"
157 "PARTICLES",
159 "Show particles textures",
160 "PARTICLES",
162 ), # "Show particles textures"
164 "LINESTYLE",
166 "Show linestyle textures",
167 "LINE_DATA",
169 ), # "Show linestyle textures"
171 "OTHER",
173 "Show other data textures",
174 "TEXTURE_DATA",
176 ), # "Show other data textures"
178 default="MATERIAL",
181 shadow_method: EnumProperty(
182 name="Shadow",
183 description="",
184 items=(
185 ("NOSHADOW", "No Shadow", "No Shadow"),
186 ("RAY_SHADOW", "Ray Shadow", "Ray Shadow, Use ray tracing for shadow"),
188 default="RAY_SHADOW",
191 active_texture_index: IntProperty(name="Index for texture_slots", default=0)
193 use_halo: BoolProperty(
194 name="Halo", description="Render spotlight with a volumetric halo", default=False
197 halo_intensity: FloatProperty(
198 name="Halo intensity",
199 description="Brightness of the spotlight halo cone",
200 soft_min=0.0,
201 soft_max=1.0,
202 default=1.0,
205 shadow_ray_samples_x: IntProperty(
206 name="Number of samples taken extra (samples x samples)", min=1, soft_max=64, default=1
209 shadow_ray_samples_y: IntProperty(
210 name="Number of samples taken extra (samples x samples)", min=1, soft_max=64, default=1
213 shadow_ray_sample_method: EnumProperty(
214 name="",
215 description="Method for generating shadow samples: Adaptive QMC is fastest,"
216 "Constant QMC is less noisy but slower",
217 items=(
218 ("ADAPTIVE_QMC", "", "Halton samples distribution", "", 0),
219 ("CONSTANT_QMC", "", "QMC samples distribution", "", 1),
221 "CONSTANT_JITTERED",
223 "Uses POV jitter keyword",
226 ), # "Show other data textures"
228 default="CONSTANT_JITTERED",
231 use_jitter: BoolProperty(
232 name="Jitter",
233 description="Use noise for sampling (Constant Jittered sampling)",
234 default=False,
238 # ---------------------------------------------------------------- #
239 # World POV properties.
240 # ---------------------------------------------------------------- #
241 class RenderPovSettingsWorld(PropertyGroup):
243 """Declare world properties controllable in UI and translated to POV."""
245 # former Space properties from removed Blender Internal
246 use_limited_texture_context: BoolProperty(
247 name="",
248 description="Use the limited version of texture user (for ‘old shading’ mode)",
249 default=True,
252 texture_context: EnumProperty(
253 name="Texture context",
254 description="Type of texture data to display and edit",
255 items=(
256 ("MATERIAL", "", "Show material textures", "MATERIAL", 0), # "Show material textures"
257 ("WORLD", "", "Show world textures", "WORLD", 1), # "Show world textures"
258 ("LIGHT", "", "Show lamp textures", "LIGHT", 2), # "Show lamp textures"
260 "PARTICLES",
262 "Show particles textures",
263 "PARTICLES",
265 ), # "Show particles textures"
267 "LINESTYLE",
269 "Show linestyle textures",
270 "LINE_DATA",
272 ), # "Show linestyle textures"
274 "OTHER",
276 "Show other data textures",
277 "TEXTURE_DATA",
279 ), # "Show other data textures"
281 default="MATERIAL",
284 use_sky_blend: BoolProperty(
285 name="Blend Sky",
286 description="Render background with natural progression from horizon to zenith",
287 default=False,
290 use_sky_paper: BoolProperty(
291 name="Paper Sky", description="Flatten blend or texture coordinates", default=False
294 use_sky_real: BoolProperty(
295 name="Real Sky",
296 description="Render background with a real horizon, relative to the camera angle",
297 default=False,
300 horizon_color: FloatVectorProperty(
301 name="Horizon Color",
302 description="Color at the horizon",
303 precision=4,
304 step=0.01,
305 min=0,
306 soft_max=1,
307 default=(0.050876, 0.050876, 0.050876),
308 options={"ANIMATABLE"},
309 subtype="COLOR",
312 zenith_color: FloatVectorProperty(
313 name="Zenith Color",
314 description="Color at the zenith",
315 precision=4,
316 step=0.01,
317 min=0,
318 soft_max=1,
319 default=(0.0, 0.0, 0.0),
320 options={"ANIMATABLE"},
321 subtype="COLOR",
324 ambient_color: FloatVectorProperty(
325 name="Ambient Color",
326 description="Ambient color of the world",
327 precision=4,
328 step=0.01,
329 min=0,
330 soft_max=1,
331 default=(0.0, 0.0, 0.0),
332 options={"ANIMATABLE"},
333 subtype="COLOR",
335 active_texture_index: IntProperty(
336 name="Index for texture_slots", default=0, update=brush_texture_update
340 classes = (
341 RenderPovSettingsCamera,
342 RenderPovSettingsLight,
343 RenderPovSettingsWorld,
347 def register():
348 for cls in classes:
349 register_class(cls)
351 bpy.types.Camera.pov = PointerProperty(type=RenderPovSettingsCamera)
352 bpy.types.Light.pov = PointerProperty(type=RenderPovSettingsLight)
353 bpy.types.World.pov = PointerProperty(type=RenderPovSettingsWorld)
356 def unregister():
357 del bpy.types.Camera.pov
358 del bpy.types.Light.pov
359 del bpy.types.World.pov
361 for cls in reversed(classes):
362 unregister_class(cls)