Cleanup: quiet float argument to in type warning
[blender-addons.git] / render_povray / render_properties.py
blob0013f6f45487bbe0383492bc5c20068b377e84ae
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 """Declare rendering properties controllable in UI"""
5 import bpy
6 from bpy.utils import register_class, unregister_class
7 from bpy.types import PropertyGroup, Scene
8 from bpy.props import (
9 BoolProperty,
10 IntProperty,
11 FloatProperty,
12 FloatVectorProperty,
13 StringProperty,
14 EnumProperty,
15 PointerProperty,
19 # ---------------------------------------------------------------- #
20 # Scene POV properties.
21 # ---------------------------------------------------------------- #
22 class RenderPovSettingsScene(PropertyGroup):
24 """Declare scene level properties controllable in UI and translated to POV"""
26 # Linux SDL-window enable
27 sdl_window_enable: BoolProperty(
28 name="Enable SDL window", description="Enable the SDL window in Linux OS", default=True
30 # File Options
31 text_block: StringProperty(
32 name="Text Scene Name",
33 description="Name of POV scene to use. "
34 "Set when clicking Run to render current text only",
35 maxlen=1024,
37 tempfiles_enable: BoolProperty(
38 name="Enable Tempfiles",
39 description="Enable the OS-Tempfiles. Otherwise set the path where to save the files",
40 default=True,
42 pov_editor: BoolProperty(
43 name="POV editor",
44 description="Don't Close POV editor after rendering (Overridden by /EXIT command)",
45 default=False,
47 deletefiles_enable: BoolProperty(
48 name="Delete files",
49 description="Delete files after rendering. Doesn't work with the image",
50 default=True,
52 scene_name: StringProperty(
53 name="Scene Name",
54 description="Name of POV scene to create. Empty name will use "
55 "the name of the blend file",
56 maxlen=1024,
58 scene_path: StringProperty(
59 name="Export scene path",
60 # Bug in POV-Ray RC3
61 # description="Path to directory where the exported scene "
62 # "(POV and INI) is created",
63 description="Path to directory where the files are created",
64 maxlen=1024,
65 subtype="DIR_PATH",
67 renderimage_path: StringProperty(
68 name="Rendered image path",
69 description="Full path to directory where the rendered image is saved",
70 maxlen=1024,
71 subtype="DIR_PATH",
73 list_lf_enable: BoolProperty(
74 name="LF in lists",
75 description="Enable line breaks in lists (vectors and indices). "
76 "Disabled: lists are exported in one line",
77 default=False,
80 # Not a real pov option, just to know if we should write
81 radio_enable: BoolProperty(
82 name="Enable Radiosity", description="Enable POV radiosity calculation", default=True
85 radio_display_advanced: BoolProperty(
86 name="Advanced Options", description="Show advanced options", default=False
89 media_enable: BoolProperty(
90 name="Enable Media", description="Enable POV atmospheric media", default=False
93 media_samples: IntProperty(
94 name="Samples",
95 description="Number of samples taken from camera to first object "
96 "encountered along ray path for media calculation",
97 min=1,
98 max=100,
99 default=35,
102 media_scattering_type: EnumProperty(
103 name="Scattering Type",
104 description="Scattering model",
105 items=(
107 "1",
108 "1 Isotropic",
109 "The simplest form of scattering because it is independent of direction.",
112 "2",
113 "2 Mie haze ",
114 "For relatively small particles such as "
115 "minuscule water droplets of fog, cloud "
116 "particles, and particles responsible "
117 "for the polluted sky. In this model the"
118 " scattering is extremely directional in"
119 " the forward direction i.e. the amount "
120 "of scattered light is largest when the "
121 "incident light is anti-parallel to the "
122 "viewing direction (the light goes "
123 "directly to the viewer). It is smallest"
124 " when the incident light is parallel to"
125 " the viewing direction. ",
127 ("3", "3 Mie murky", "Like haze but much more directional"),
129 "4",
130 "4 Rayleigh",
131 "For extremely small particles such as "
132 "molecules of the air. The amount of "
133 "scattered light depends on the incident"
134 " light angle. It is largest when the "
135 "incident light is parallel or "
136 "anti-parallel to the viewing direction "
137 "and smallest when the incident light is "
138 "perpendicular to viewing direction.",
141 "5",
142 "5 Henyey-Greenstein",
143 "The default eccentricity value "
144 "of zero defines isotropic "
145 "scattering while positive "
146 "values lead to scattering in "
147 "the direction of the light and "
148 "negative values lead to "
149 "scattering in the opposite "
150 "direction of the light. Larger "
151 "values of e (or smaller values "
152 "in the negative case) increase "
153 "the directional property of the"
154 " scattering.",
157 default="1",
160 media_diffusion_scale: FloatProperty(
161 name="Scale",
162 description="Scale factor of Media Diffusion Color",
163 precision=6,
164 step=0.00000001,
165 min=0.000000001,
166 max=1.0,
167 default=1.0,
170 media_diffusion_color: FloatVectorProperty(
171 name="Media Diffusion Color",
172 description="The atmospheric media color",
173 precision=4,
174 step=0.01,
175 min=0,
176 soft_max=1,
177 default=(0.001, 0.001, 0.001),
178 options={"ANIMATABLE"},
179 subtype="COLOR",
182 media_absorption_scale: FloatProperty(
183 name="Scale",
184 description="Scale factor of Media Absorption Color. "
185 "use 1/depth of media volume in meters",
186 precision=6,
187 step=0.000001,
188 min=0.000000001,
189 max=1.0,
190 default=0.00002,
193 media_absorption_color: FloatVectorProperty(
194 name="Media Absorption Color",
195 description="The atmospheric media absorption color",
196 precision=4,
197 step=0.01,
198 min=0,
199 soft_max=1,
200 default=(0.0, 0.0, 0.0),
201 options={"ANIMATABLE"},
202 subtype="COLOR",
205 media_eccentricity: FloatProperty(
206 name="Media Eccenticity Factor",
207 description="Positive values lead"
208 " to scattering in the direction of the light and negative "
209 "values lead to scattering in the opposite direction of the "
210 "light. Larger values of e (or smaller values in the negative"
211 " case) increase the directional property of the scattering",
212 precision=2,
213 step=0.01,
214 min=-1.0,
215 max=1.0,
216 default=0.0,
217 options={"ANIMATABLE"},
220 baking_enable: BoolProperty(
221 name="Enable Baking", description="Enable POV texture baking", default=False
224 indentation_character: EnumProperty(
225 name="Indentation",
226 description="Select the indentation type",
227 items=(
228 ("NONE", "None", "No indentation"),
229 ("TAB", "Tabs", "Indentation with tabs"),
230 ("SPACE", "Spaces", "Indentation with spaces"),
232 default="SPACE",
235 indentation_spaces: IntProperty(
236 name="Quantity of spaces",
237 description="The number of spaces for indentation",
238 min=1,
239 max=10,
240 default=4,
243 comments_enable: BoolProperty(
244 name="Enable Comments", description="Add comments to pov file", default=True
247 # Real pov options
248 command_line_switches: StringProperty(
249 name="Command Line Switches",
250 description="Command line switches consist of a + (plus) or - "
251 "(minus) sign, followed by one or more alphabetic "
252 "characters and possibly a numeric value",
253 maxlen=500,
256 antialias_enable: BoolProperty(
257 name="Anti-Alias", description="Enable Anti-Aliasing", default=True
260 antialias_method: EnumProperty(
261 name="Method",
262 description="AA-sampling method. Type 1 is an adaptive, "
263 "non-recursive, super-sampling (as in the plain old render "
264 "bigger and scale down trick. Type 2 is a slightly "
265 "more efficient adaptive and recursive super-sampling. "
266 "Type 3 is a stochastic halton based super-sampling method so "
267 "rather artifact free and sampling rays so depth of field can "
268 "use them at no additional cost, as do area lights and "
269 "subsurface scattering materials, making it the best "
270 "quality / time trade-off in complex scenes",
271 items=(
272 ("0", "non-recursive AA", "Type 1 Sampling in POV"),
273 ("1", "recursive AA", "Type 2 Sampling in POV"),
274 ("2", "stochastic AA", "Type 3 Sampling in POV"),
276 default="1",
279 antialias_confidence: FloatProperty(
280 name="Antialias Confidence",
281 description="how surely the computed color "
282 "of a given pixel is indeed"
283 "within the threshold error margin",
284 min=0.0001,
285 max=1.0000,
286 default=0.9900,
287 precision=4,
290 antialias_depth: IntProperty(
291 name="Antialias Depth", description="Depth of pixel for sampling", min=1, max=9, default=2
294 antialias_threshold: FloatProperty(
295 name="Antialias Threshold",
296 description="Tolerance for sub-pixels",
297 min=0.0,
298 max=1.0,
299 soft_min=0.05,
300 soft_max=0.5,
301 default=0.03,
304 jitter_enable: BoolProperty(
305 name="Jitter",
306 description="Enable Jittering. Adds noise into the sampling "
307 "process (it should be avoided to use jitter in "
308 "animation)",
309 default=False,
312 jitter_amount: FloatProperty(
313 name="Jitter Amount",
314 description="Amount of jittering",
315 min=0.0,
316 max=1.0,
317 soft_min=0.01,
318 soft_max=1.0,
319 default=1.0,
322 antialias_gamma: FloatProperty(
323 name="Antialias Gamma",
324 description="POV-Ray compares gamma-adjusted values for super "
325 "sampling. Antialias Gamma sets the Gamma before "
326 "comparison",
327 min=0.0,
328 max=5.0,
329 soft_min=0.01,
330 soft_max=2.5,
331 default=2.5,
334 alpha_filter: FloatProperty(
335 name="Alpha",
336 description="User defined color associated background alpha",
337 min=0.0,
338 max=1.0,
339 soft_min=0.01,
340 soft_max=1.0,
341 default=0.75,
344 alpha_mode: EnumProperty(
345 name="Alpha",
346 description="Representation of alpha information in the RGBA pixels",
347 items=(
348 ("SKY", "Sky", "Transparent pixels are filled with sky color"),
349 ("STRAIGHT", "Straight", "Transparent pixels are not premultiplied"),
351 "TRANSPARENT",
352 "Transparent",
353 "World background has user defined premultiplied alpha",
356 default="SKY",
359 use_shadows: BoolProperty(
360 name="Shadows", description="Calculate shadows while rendering", default=True
363 max_trace_level: IntProperty(
364 name="Max Trace Level",
365 description="Number of reflections/refractions allowed on ray " "path",
366 min=1,
367 max=256,
368 default=5,
371 adc_bailout_enable: BoolProperty(name="Enable", description="", default=False)
373 adc_bailout: FloatProperty(
374 name="ADC Bailout",
375 description="Adaptive Depth Control (ADC) to stop computing additional"
376 "reflected or refracted rays when their contribution is insignificant."
377 "The default value is 1/255, or approximately 0.0039, since a change "
378 "smaller than that could not be visible in a 24 bit image. Generally "
379 "this value is fine and should be left alone."
380 "Setting adc_bailout to 0 will disable ADC, relying completely on "
381 "max_trace_level to set an upper limit on the number of rays spawned. ",
382 min=0.0,
383 max=1000.0,
384 default=0.00392156862745,
385 precision=3,
388 ambient_light_enable: BoolProperty(name="Enable", description="", default=False)
390 ambient_light: FloatVectorProperty(
391 name="Ambient Light",
392 description="Ambient light is used to simulate the effect of inter-diffuse reflection",
393 precision=4,
394 step=0.01,
395 min=0,
396 soft_max=1,
397 default=(1, 1, 1),
398 options={"ANIMATABLE"},
399 subtype="COLOR",
401 global_settings_advanced: BoolProperty(name="Advanced", description="", default=False)
403 irid_wavelength_enable: BoolProperty(name="Enable", description="", default=False)
405 irid_wavelength: FloatVectorProperty(
406 name="Irid Wavelength",
407 description=(
408 "Iridescence calculations depend upon the dominant "
409 "wavelengths of the primary colors of red, green and blue light"
411 precision=4,
412 step=0.01,
413 min=0,
414 soft_max=1,
415 default=(0.25, 0.18, 0.14),
416 options={"ANIMATABLE"},
417 subtype="COLOR",
420 number_of_waves_enable: BoolProperty(name="Enable", description="", default=False)
422 number_of_waves: IntProperty(
423 name="Number Waves",
424 description=(
425 "The waves and ripples patterns are generated by summing a series of waves, "
426 "each with a slightly different center and size"
428 min=1,
429 max=10,
430 default=1000,
433 noise_generator_enable: BoolProperty(name="Enable", description="", default=False)
435 noise_generator: IntProperty(
436 name="Noise Generator",
437 description="There are three noise generators implemented",
438 min=1,
439 max=3,
440 default=2,
443 # -------- PHOTONS -------- #
444 photon_enable: BoolProperty(name="Photons", description="Enable global photons", default=False)
446 photon_enable_count: BoolProperty(
447 name="Spacing / Count", description="Enable count photons", default=False
450 photon_count: IntProperty(
451 name="Count", description="Photons count", min=1, max=100000000, default=20000
454 photon_spacing: FloatProperty(
455 name="Spacing",
456 description="Average distance between photons on surfaces. half "
457 "this get four times as many surface photons",
458 min=0.001,
459 max=1.000,
460 soft_min=0.001,
461 soft_max=1.000,
462 precision=3,
463 default=0.005,
466 photon_max_trace_level: IntProperty(
467 name="Max Trace Level",
468 description="Number of reflections/refractions allowed on ray " "path",
469 min=1,
470 max=256,
471 default=5,
474 photon_adc_bailout: FloatProperty(
475 name="ADC Bailout",
476 description="The adc_bailout for photons. Use adc_bailout = "
477 "0.01 / brightest_ambient_object for good results",
478 min=0.0,
479 max=1000.0,
480 soft_min=0.0,
481 soft_max=1.0,
482 precision=3,
483 default=0.1,
486 photon_gather_min: IntProperty(
487 name="Gather Min",
488 description="Minimum number of photons gathered" "for each point",
489 min=1,
490 max=256,
491 default=20,
494 photon_gather_max: IntProperty(
495 name="Gather Max",
496 description="Maximum number of photons gathered for each point",
497 min=1,
498 max=256,
499 default=100,
502 photon_map_file_save_load: EnumProperty(
503 name="Operation",
504 description="Load or Save photon map file",
505 items=(("NONE", "None", ""), ("save", "Save", ""), ("load", "Load", "")),
506 default="NONE",
509 photon_map_filename: StringProperty(name="Filename", description="", maxlen=1024)
511 photon_map_dir: StringProperty(
512 name="Directory", description="", maxlen=1024, subtype="DIR_PATH"
515 photon_map_file: StringProperty(name="File", description="", maxlen=1024, subtype="FILE_PATH")
517 # -------- RADIOSITY -------- #
518 radio_adc_bailout: FloatProperty(
519 name="ADC Bailout",
520 description="The adc_bailout for radiosity rays. Use "
521 "adc_bailout = 0.01 / brightest_ambient_object for good results",
522 min=0.0,
523 max=1000.0,
524 soft_min=0.0,
525 soft_max=1.0,
526 default=0.0039,
527 precision=4,
530 radio_always_sample: BoolProperty(
531 name="Always Sample",
532 description="Only use the data from the pretrace step and not gather "
533 "any new samples during the final radiosity pass",
534 default=False,
537 radio_brightness: FloatProperty(
538 name="Brightness",
539 description="Amount objects are brightened before being returned "
540 "upwards to the rest of the system",
541 min=0.0,
542 max=1000.0,
543 soft_min=0.0,
544 soft_max=10.0,
545 default=1.0,
548 radio_count: IntProperty(
549 name="Ray Count",
550 description="Number of rays for each new radiosity value to be calculated "
551 "(halton sequence over 1600)",
552 min=1,
553 max=10000,
554 soft_max=1600,
555 default=35,
558 radio_error_bound: FloatProperty(
559 name="Error Bound",
560 description="One of the two main speed/quality tuning values, "
561 "lower values are more accurate",
562 min=0.0,
563 max=1000.0,
564 soft_min=0.1,
565 soft_max=10.0,
566 default=10.0,
569 radio_gray_threshold: FloatProperty(
570 name="Gray Threshold",
571 description="One of the two main speed/quality tuning values, "
572 "lower values are more accurate",
573 min=0.0,
574 max=1.0,
575 soft_min=0,
576 soft_max=1,
577 default=0.0,
580 radio_low_error_factor: FloatProperty(
581 name="Low Error Factor",
582 description="Just enough samples is slightly blotchy. Low error changes error "
583 "tolerance for less critical last refining pass",
584 min=0.000001,
585 max=1.0,
586 soft_min=0.000001,
587 soft_max=1.0,
588 default=0.5,
591 radio_media: BoolProperty(
592 name="Media", description="Radiosity estimation can be affected by media", default=True
595 radio_subsurface: BoolProperty(
596 name="Subsurface",
597 description="Radiosity estimation can be affected by Subsurface Light Transport",
598 default=False,
601 radio_minimum_reuse: FloatProperty(
602 name="Minimum Reuse",
603 description="Fraction of the screen width which sets the minimum radius of reuse "
604 "for each sample point (At values higher than 2% expect errors)",
605 min=0.0,
606 max=1.0,
607 soft_min=0.1,
608 soft_max=0.1,
609 default=0.015,
610 precision=3,
613 radio_maximum_reuse: FloatProperty(
614 name="Maximum Reuse",
615 description="The maximum reuse parameter works in conjunction with, and is similar to that of minimum reuse, "
616 "the only difference being that it is an upper bound rather than a lower one",
617 min=0.0,
618 max=1.0,
619 default=0.2,
620 precision=3,
623 radio_nearest_count: IntProperty(
624 name="Nearest Count",
625 description="Number of old ambient values blended together to "
626 "create a new interpolated value",
627 min=1,
628 max=20,
629 default=1,
632 radio_normal: BoolProperty(
633 name="Normals", description="Radiosity estimation can be affected by normals", default=False
636 radio_recursion_limit: IntProperty(
637 name="Recursion Limit",
638 description="how many recursion levels are used to calculate "
639 "the diffuse inter-reflection",
640 min=1,
641 max=20,
642 default=1,
645 radio_pretrace_start: FloatProperty(
646 name="Pretrace Start",
647 description="Fraction of the screen width which sets the size of the "
648 "blocks in the mosaic preview first pass",
649 min=0.005,
650 max=1.00,
651 soft_min=0.02,
652 soft_max=1.0,
653 default=0.04,
655 # XXX TODO set automatically to pretrace_end = 8 / max (image_width, image_height)
656 # for non advanced mode
657 radio_pretrace_end: FloatProperty(
658 name="Pretrace End",
659 description="Fraction of the screen width which sets the size of the blocks "
660 "in the mosaic preview last pass",
661 min=0.000925,
662 max=1.00,
663 soft_min=0.01,
664 soft_max=1.00,
665 default=0.004,
666 precision=3,
670 classes = (RenderPovSettingsScene,)
673 def register():
674 for cls in classes:
675 register_class(cls)
676 Scene.pov = PointerProperty(type=RenderPovSettingsScene)
679 def unregister():
680 del Scene.pov
681 for cls in reversed(classes):
682 unregister_class(cls)