Cleanup: better not split UI strings when possible...
[blender.git] / intern / cycles / blender / addon / properties.py
1 #
2 # Copyright 2011-2013 Blender Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 # <pep8 compliant>
18
19 import bpy
20 from bpy.props import (BoolProperty,
21                        EnumProperty,
22                        FloatProperty,
23                        IntProperty,
24                        PointerProperty)
25
26 # enums
27
28 import _cycles
29
30 enum_devices = (
31     ('CPU', "CPU", "Use CPU for rendering"),
32     ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"),
33     )
34
35 if _cycles.with_network:
36     enum_devices += (('NETWORK', "Networked Device", "Use networked device for rendering"),)
37
38 enum_feature_set = (
39     ('SUPPORTED', "Supported", "Only use finished and supported features"),
40     ('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future", 'ERROR', 1),
41     )
42
43 enum_displacement_methods = (
44     ('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"),
45     ('TRUE', "True", "Use true displacement only, requires fine subdivision"),
46     ('BOTH', "Both", "Combination of displacement and bump mapping"),
47     )
48
49 enum_bvh_types = (
50     ('DYNAMIC_BVH', "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
51     ('STATIC_BVH', "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
52     )
53
54 enum_filter_types = (
55     ('BOX', "Box", "Box filter"),
56     ('GAUSSIAN', "Gaussian", "Gaussian filter"),
57     ('BLACKMAN_HARRIS', "Blackman-Harris", "Blackman-Harris filter"),
58     )
59
60 enum_aperture_types = (
61     ('RADIUS', "Radius", "Directly change the size of the aperture"),
62     ('FSTOP', "F-stop", "Change the size of the aperture by f-stop"),
63     )
64
65 enum_panorama_types = (
66     ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
67     ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
68     ('FISHEYE_EQUISOLID', "Fisheye Equisolid",
69                           "Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
70     ('MIRRORBALL', "Mirror Ball", "Uses the mirror ball mapping"),
71     )
72
73 enum_curve_primitives = (
74     ('TRIANGLES', "Triangles", "Create triangle geometry around strands"),
75     ('LINE_SEGMENTS', "Line Segments", "Use line segment primitives"),
76     ('CURVE_SEGMENTS', "Curve Segments", "Use segmented cardinal curve primitives"),
77     )
78
79 enum_triangle_curves = (
80     ('CAMERA_TRIANGLES', "Planes", "Create individual triangles forming planes that face camera"),
81     ('TESSELLATED_TRIANGLES', "Tessellated", "Create mesh surrounding each strand"),
82     )
83
84 enum_curve_shape = (
85     ('RIBBONS', "Ribbons", "Ignore thickness of each strand"),
86     ('THICK', "Thick", "Use thickness of strand when rendering"),
87     )
88
89 enum_tile_order = (
90     ('CENTER', "Center", "Render from center to the edges"),
91     ('RIGHT_TO_LEFT', "Right to Left", "Render from right to left"),
92     ('LEFT_TO_RIGHT', "Left to Right", "Render from left to right"),
93     ('TOP_TO_BOTTOM', "Top to Bottom", "Render from top to bottom"),
94     ('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"),
95     ('HILBERT_SPIRAL', "Hilbert Spiral", "Render in a Hilbert Spiral"),
96     )
97
98 enum_use_layer_samples = (
99     ('USE', "Use", "Per render layer number of samples override scene samples"),
100     ('BOUNDED', "Bounded", "Bound per render layer number of samples by global samples"),
101     ('IGNORE', "Ignore", "Ignore per render layer number of samples"),
102     )
103
104 enum_sampling_pattern = (
105     ('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
106     ('CORRELATED_MUTI_JITTER', "Correlated Multi-Jitter", "Use Correlated Multi-Jitter random sampling pattern"),
107     )
108
109 enum_integrator = (
110     ('BRANCHED_PATH', "Branched Path Tracing", "Path tracing integrator that branches on the first bounce, giving more control over the number of light and material samples"),
111     ('PATH', "Path Tracing", "Pure path tracing integrator"),
112     )
113
114 enum_volume_sampling = (
115     ('DISTANCE', "Distance", "Use distance sampling, best for dense volumes with lights far away"),
116     ('EQUIANGULAR', "Equiangular", "Use equiangular sampling, best for volumes with low density with light inside or near the volume"),
117     ('MULTIPLE_IMPORTANCE', "Multiple Importance", "Combine distance and equi-angular sampling for volumes where neither method is ideal"),
118     )
119
120 enum_volume_interpolation = (
121     ('LINEAR', "Linear", "Good smoothness and speed"),
122     ('CUBIC', "Cubic", "Smoothed high quality interpolation, but slower")
123     )
124
125
126 class CyclesRenderSettings(bpy.types.PropertyGroup):
127     @classmethod
128     def register(cls):
129         bpy.types.Scene.cycles = PointerProperty(
130                 name="Cycles Render Settings",
131                 description="Cycles render settings",
132                 type=cls,
133                 )
134         cls.device = EnumProperty(
135                 name="Device",
136                 description="Device to use for rendering",
137                 items=enum_devices,
138                 default='CPU',
139                 )
140         cls.feature_set = EnumProperty(
141                 name="Feature Set",
142                 description="Feature set to use for rendering",
143                 items=enum_feature_set,
144                 default='SUPPORTED',
145                 )
146         cls.shading_system = BoolProperty(
147                 name="Open Shading Language",
148                 description="Use Open Shading Language (CPU rendering only)",
149                 )
150
151         cls.progressive = EnumProperty(
152                 name="Integrator",
153                 description="Method to sample lights and materials",
154                 items=enum_integrator,
155                 default='PATH',
156                 )
157
158         cls.use_square_samples = BoolProperty(
159                 name="Square Samples",
160                 description="Square sampling values for easier artist control",
161                 default=False,
162                 )
163
164         cls.samples = IntProperty(
165                 name="Samples",
166                 description="Number of samples to render for each pixel",
167                 min=1, max=2147483647,
168                 default=128,
169                 )
170         cls.preview_samples = IntProperty(
171                 name="Preview Samples",
172                 description="Number of samples to render in the viewport, unlimited if 0",
173                 min=0, max=2147483647,
174                 default=32,
175                 )
176         cls.preview_pause = BoolProperty(
177                 name="Pause Preview",
178                 description="Pause all viewport preview renders",
179                 default=False,
180                 )
181         cls.preview_active_layer = BoolProperty(
182                 name="Preview Active Layer",
183                 description="Preview active render layer in viewport",
184                 default=False,
185                 )
186
187         cls.aa_samples = IntProperty(
188                 name="AA Samples",
189                 description="Number of antialiasing samples to render for each pixel",
190                 min=1, max=2097151,
191                 default=4,
192                 )
193         cls.preview_aa_samples = IntProperty(
194                 name="AA Samples",
195                 description="Number of antialiasing samples to render in the viewport, unlimited if 0",
196                 min=0, max=2097151,
197                 default=4,
198                 )
199         cls.diffuse_samples = IntProperty(
200                 name="Diffuse Samples",
201                 description="Number of diffuse bounce samples to render for each AA sample",
202                 min=1, max=1024,
203                 default=1,
204                 )
205         cls.glossy_samples = IntProperty(
206                 name="Glossy Samples",
207                 description="Number of glossy bounce samples to render for each AA sample",
208                 min=1, max=1024,
209                 default=1,
210                 )
211         cls.transmission_samples = IntProperty(
212                 name="Transmission Samples",
213                 description="Number of transmission bounce samples to render for each AA sample",
214                 min=1, max=1024,
215                 default=1,
216                 )
217         cls.ao_samples = IntProperty(
218                 name="Ambient Occlusion Samples",
219                 description="Number of ambient occlusion samples to render for each AA sample",
220                 min=1, max=1024,
221                 default=1,
222                 )
223         cls.mesh_light_samples = IntProperty(
224                 name="Mesh Light Samples",
225                 description="Number of mesh emission light samples to render for each AA sample",
226                 min=1, max=1024,
227                 default=1,
228                 )
229
230         cls.subsurface_samples = IntProperty(
231                 name="Subsurface Samples",
232                 description="Number of subsurface scattering samples to render for each AA sample",
233                 min=1, max=1024,
234                 default=1,
235                 )
236
237         cls.volume_samples = IntProperty(
238                 name="Volume Samples",
239                 description="Number of volume scattering samples to render for each AA sample",
240                 min=1, max=1024,
241                 default=1,
242                 )
243
244         cls.sampling_pattern = EnumProperty(
245                 name="Sampling Pattern",
246                 description="Random sampling pattern used by the integrator",
247                 items=enum_sampling_pattern,
248                 default='SOBOL',
249                 )
250
251         cls.use_layer_samples = EnumProperty(
252                 name="Layer Samples",
253                 description="How to use per render layer sample settings",
254                 items=enum_use_layer_samples,
255                 default='USE',
256                 )
257
258         cls.sample_all_lights_direct = BoolProperty(
259                 name="Sample All Direct Lights",
260                 description="Sample all lights (for direct samples), rather than randomly picking one",
261                 default=True,
262                 )
263
264         cls.sample_all_lights_indirect = BoolProperty(
265                 name="Sample All Indirect Lights",
266                 description="Sample all lights (for indirect samples), rather than randomly picking one",
267                 default=True,
268                 )
269
270         cls.caustics_reflective = BoolProperty(
271                 name="Reflective Caustics",
272                 description="Use reflective caustics, resulting in a brighter image (more noise but added realism)",
273                 default=True,
274                 )
275
276         cls.caustics_refractive = BoolProperty(
277                 name="Refractive Caustics",
278                 description="Use refractive caustics, resulting in a brighter image (more noise but added realism)",
279                 default=True,
280                 )
281
282         cls.blur_glossy = FloatProperty(
283                 name="Filter Glossy",
284                 description="Adaptively blur glossy shaders after blurry bounces, "
285                             "to reduce noise at the cost of accuracy",
286                 min=0.0, max=10.0,
287                 default=0.0,
288                 )
289
290         cls.min_bounces = IntProperty(
291                 name="Min Bounces",
292                 description="Minimum number of bounces, setting this lower "
293                             "than the maximum enables probabilistic path "
294                             "termination (faster but noisier)",
295                 min=0, max=1024,
296                 default=3,
297                 )
298         cls.max_bounces = IntProperty(
299                 name="Max Bounces",
300                 description="Total maximum number of bounces",
301                 min=0, max=1024,
302                 default=12,
303                 )
304
305         cls.diffuse_bounces = IntProperty(
306                 name="Diffuse Bounces",
307                 description="Maximum number of diffuse reflection bounces, bounded by total maximum",
308                 min=0, max=1024,
309                 default=4,
310                 )
311         cls.glossy_bounces = IntProperty(
312                 name="Glossy Bounces",
313                 description="Maximum number of glossy reflection bounces, bounded by total maximum",
314                 min=0, max=1024,
315                 default=4,
316                 )
317         cls.transmission_bounces = IntProperty(
318                 name="Transmission Bounces",
319                 description="Maximum number of transmission bounces, bounded by total maximum",
320                 min=0, max=1024,
321                 default=12,
322                 )
323         cls.volume_bounces = IntProperty(
324                 name="Volume Bounces",
325                 description="Maximum number of volumetric scattering events",
326                 min=0, max=1024,
327                 default=0,
328                 )
329
330         cls.transparent_min_bounces = IntProperty(
331                 name="Transparent Min Bounces",
332                 description="Minimum number of transparent bounces, setting "
333                             "this lower than the maximum enables "
334                             "probabilistic path termination (faster but "
335                             "noisier)",
336                 min=0, max=1024,
337                 default=8,
338                 )
339         cls.transparent_max_bounces = IntProperty(
340                 name="Transparent Max Bounces",
341                 description="Maximum number of transparent bounces",
342                 min=0, max=1024,
343                 default=8,
344                 )
345         cls.use_transparent_shadows = BoolProperty(
346                 name="Transparent Shadows",
347                 description="Use transparency of surfaces for rendering shadows",
348                 default=True,
349                 )
350
351         cls.volume_step_size = FloatProperty(
352                 name="Step Size",
353                 description="Distance between volume shader samples when rendering the volume "
354                             "(lower values give more accurate and detailed results, but also increased render time)",
355                 default=0.1,
356                 min=0.0000001, max=100000.0, soft_min=0.01, soft_max=1.0, precision=4
357                 )
358
359         cls.volume_max_steps = IntProperty(
360                 name="Max Steps",
361                 description="Maximum number of steps through the volume before giving up, "
362                             "to avoid extremely long render times with big objects or small step sizes",
363                 default=1024,
364                 min=2, max=65536
365                 )
366
367         cls.dicing_rate = FloatProperty(
368                 name="Dicing Rate",
369                 description="Size of a micropolygon in pixels",
370                 min=0.1, max=1000.0,
371                 default=1.0,
372                 )
373         cls.preview_dicing_rate = FloatProperty(
374                 name="Preview Dicing Rate",
375                 description="Size of a micropolygon in pixels during preview render",
376                 min=0.1, max=1000.0,
377                 default=8.0,
378                 )
379
380         cls.max_subdivisions = IntProperty(
381                 name="Max Subdivisions",
382                 description="Stop subdividing when this level is reached even if the dice rate would produce finer tessellation",
383                 min=0, max=16,
384                 default=12,
385                 )
386
387         cls.film_exposure = FloatProperty(
388                 name="Exposure",
389                 description="Image brightness scale",
390                 min=0.0, max=10.0,
391                 default=1.0,
392                 )
393         cls.film_transparent = BoolProperty(
394                 name="Transparent",
395                 description="World background is transparent with premultiplied alpha",
396                 default=False,
397                 )
398
399         # Really annoyingly, we have to keep it around for a few releases,
400         # otherwise forward compatibility breaks in really bad manner: CRASH!
401         #
402         # TODO(sergey): Remove this during 2.8x series of Blender.
403         cls.filter_type = EnumProperty(
404                 name="Filter Type",
405                 description="Pixel filter type",
406                 items=enum_filter_types,
407                 default='BLACKMAN_HARRIS',
408                 )
409
410         cls.pixel_filter_type = EnumProperty(
411                 name="Filter Type",
412                 description="Pixel filter type",
413                 items=enum_filter_types,
414                 default='BLACKMAN_HARRIS',
415                 )
416
417         cls.filter_width = FloatProperty(
418                 name="Filter Width",
419                 description="Pixel filter width",
420                 min=0.01, max=10.0,
421                 default=1.5,
422                 )
423
424         cls.seed = IntProperty(
425                 name="Seed",
426                 description="Seed value for integrator to get different noise patterns",
427                 min=0, max=2147483647,
428                 default=0,
429                 )
430
431         cls.use_animated_seed = BoolProperty(
432                 name="Use Animated Seed",
433                 description="Use different seed values (and hence noise patterns) at different frames",
434                 default=False,
435                 )
436
437         cls.sample_clamp_direct = FloatProperty(
438                 name="Clamp Direct",
439                 description="If non-zero, the maximum value for a direct sample, "
440                             "higher values will be scaled down to avoid too "
441                             "much noise and slow convergence at the cost of accuracy",
442                 min=0.0, max=1e8,
443                 default=0.0,
444                 )
445
446         cls.sample_clamp_indirect = FloatProperty(
447                 name="Clamp Indirect",
448                 description="If non-zero, the maximum value for an indirect sample, "
449                             "higher values will be scaled down to avoid too "
450                             "much noise and slow convergence at the cost of accuracy",
451                 min=0.0, max=1e8,
452                 default=0.0,
453                 )
454
455         cls.debug_tile_size = IntProperty(
456                 name="Tile Size",
457                 description="",
458                 min=1, max=4096,
459                 default=1024,
460                 )
461
462         cls.preview_start_resolution = IntProperty(
463                 name="Start Resolution",
464                 description="Resolution to start rendering preview at, "
465                             "progressively increasing it to the full viewport size",
466                 min=8, max=16384,
467                 default=64,
468                 )
469
470         cls.debug_reset_timeout = FloatProperty(
471                 name="Reset timeout",
472                 description="",
473                 min=0.01, max=10.0,
474                 default=0.1,
475                 )
476         cls.debug_cancel_timeout = FloatProperty(
477                 name="Cancel timeout",
478                 description="",
479                 min=0.01, max=10.0,
480                 default=0.1,
481                 )
482         cls.debug_text_timeout = FloatProperty(
483                 name="Text timeout",
484                 description="",
485                 min=0.01, max=10.0,
486                 default=1.0,
487                 )
488
489         cls.debug_bvh_type = EnumProperty(
490                 name="Viewport BVH Type",
491                 description="Choose between faster updates, or faster render",
492                 items=enum_bvh_types,
493                 default='DYNAMIC_BVH',
494                 )
495         cls.debug_use_spatial_splits = BoolProperty(
496                 name="Use Spatial Splits",
497                 description="Use BVH spatial splits: longer builder time, faster render",
498                 default=False,
499                 )
500         cls.debug_use_hair_bvh = BoolProperty(
501                 name="Use Hair BVH",
502                 description="Use special type BVH optimized for hair (uses more ram but renders faster)",
503                 default=True,
504                 )
505         cls.tile_order = EnumProperty(
506                 name="Tile Order",
507                 description="Tile order for rendering",
508                 items=enum_tile_order,
509                 default='HILBERT_SPIRAL',
510                 options=set(),  # Not animatable!
511                 )
512         cls.use_progressive_refine = BoolProperty(
513                 name="Progressive Refine",
514                 description="Instead of rendering each tile until it is finished, "
515                             "refine the whole image progressively "
516                             "(this renders somewhat slower, "
517                             "but time can be saved by manually stopping the render when the noise is low enough)",
518                 default=False,
519                 )
520
521         cls.bake_type = EnumProperty(
522             name="Bake Type",
523             default='COMBINED',
524             description="Type of pass to bake",
525             items=(
526                 ('COMBINED', "Combined", ""),
527                 ('AO', "Ambient Occlusion", ""),
528                 ('SHADOW', "Shadow", ""),
529                 ('NORMAL', "Normal", ""),
530                 ('UV', "UV", ""),
531                 ('EMIT', "Emit", ""),
532                 ('ENVIRONMENT', "Environment", ""),
533                 ('DIFFUSE', "Diffuse", ""),
534                 ('GLOSSY', "Glossy", ""),
535                 ('TRANSMISSION', "Transmission", ""),
536                 ('SUBSURFACE', "Subsurface", ""),
537                 ),
538             )
539
540         cls.use_camera_cull = BoolProperty(
541                 name="Use Camera Cull",
542                 description="Allow objects to be culled based on the camera frustum",
543                 default=False,
544                 )
545
546         cls.camera_cull_margin = FloatProperty(
547                 name="Camera Cull Margin",
548                 description="Margin for the camera space culling",
549                 default=0.1,
550                 min=0.0, max=5.0
551                 )
552
553         cls.motion_blur_position = EnumProperty(
554             name="Motion Blur Position",
555             default='CENTER',
556             description="Offset for the shutter's time interval, allows to change the motion blur trails",
557             items=(
558                 ('START', "Start on Frame", "The shutter opens at the current frame"),
559                 ('CENTER', "Center on Frame", "The shutter is open during the current frame"),
560                 ('END', "End on Frame", "The shutter closes at the current frame"),
561                 ),
562             )
563
564         cls.rolling_shutter_type = EnumProperty(
565             name="Shutter Type",
566             default='NONE',
567             description="Type of rolling shutter effect matching CMOS-based cameras",
568             items=(
569                 ('NONE', "None", "No rolling shutter effect used"),
570                 ('TOP', "Top-Bottom", "Sensor is being scanned from top to bottom")
571                 # TODO(seergey): Are there real cameras with different scanning direction?
572                 ),
573             )
574
575         cls.rolling_shutter_duration = FloatProperty(
576             name="Rolling Shutter Duration",
577             description="Scanline \"exposure\" time for the rolling shutter effect",
578             default=0.1,
579             min=0.0, max=1.0,
580             )
581
582         # Various fine-tuning debug flags
583
584         def devices_update_callback(self, context):
585             import _cycles
586             scene = context.scene.as_pointer()
587             return _cycles.debug_flags_update(scene)
588
589         cls.debug_use_cpu_avx2 = BoolProperty(name="AVX2", default=True)
590         cls.debug_use_cpu_avx = BoolProperty(name="AVX", default=True)
591         cls.debug_use_cpu_sse41 = BoolProperty(name="SSE41", default=True)
592         cls.debug_use_cpu_sse3 = BoolProperty(name="SSE3", default=True)
593         cls.debug_use_cpu_sse2 = BoolProperty(name="SSE2", default=True)
594         cls.debug_use_qbvh = BoolProperty(name="QBVH", default=True)
595
596         cls.debug_use_cuda_adaptive_compile = BoolProperty(name="Adaptive Compile", default=False)
597
598         cls.debug_opencl_kernel_type = EnumProperty(
599             name="OpenCL Kernel Type",
600             default='DEFAULT',
601             items=(
602                 ('DEFAULT', "Default", ""),
603                 ('MEGA', "Mega", ""),
604                 ('SPLIT', "Split", ""),
605                 ),
606             update=devices_update_callback
607             )
608
609         cls.debug_opencl_device_type = EnumProperty(
610             name="OpenCL Device Type",
611             default='ALL',
612             items=(
613                 ('NONE', "None", ""),
614                 ('ALL', "All", ""),
615                 ('DEFAULT', "Default", ""),
616                 ('CPU', "CPU", ""),
617                 ('GPU', "GPU", ""),
618                 ('ACCELERATOR', "Accelerator", ""),
619                 ),
620             update=devices_update_callback
621             )
622
623         cls.debug_use_opencl_debug = BoolProperty(name="Debug OpenCL", default=False)
624
625     @classmethod
626     def unregister(cls):
627         del bpy.types.Scene.cycles
628
629
630 class CyclesCameraSettings(bpy.types.PropertyGroup):
631     @classmethod
632     def register(cls):
633         import math
634
635         bpy.types.Camera.cycles = PointerProperty(
636                 name="Cycles Camera Settings",
637                 description="Cycles camera settings",
638                 type=cls,
639                 )
640
641         cls.aperture_type = EnumProperty(
642                 name="Aperture Type",
643                 description="Use f-stop number or aperture radius",
644                 items=enum_aperture_types,
645                 default='RADIUS',
646                 )
647         cls.aperture_fstop = FloatProperty(
648                 name="Aperture f-stop",
649                 description="F-stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
650                 min=0.0, soft_min=0.1, soft_max=64.0,
651                 default=5.6,
652                 step=10,
653                 precision=1,
654                 )
655         cls.aperture_size = FloatProperty(
656                 name="Aperture Size",
657                 description="Radius of the aperture for depth of field (higher values give more defocus)",
658                 min=0.0, soft_max=10.0,
659                 default=0.0,
660                 step=1,
661                 precision=4,
662                 subtype='DISTANCE',
663                 )
664         cls.aperture_blades = IntProperty(
665                 name="Aperture Blades",
666                 description="Number of blades in aperture for polygonal bokeh (at least 3)",
667                 min=0, max=100,
668                 default=0,
669                 )
670         cls.aperture_rotation = FloatProperty(
671                 name="Aperture Rotation",
672                 description="Rotation of blades in aperture",
673                 soft_min=-math.pi, soft_max=math.pi,
674                 subtype='ANGLE',
675                 default=0,
676                 )
677         cls.aperture_ratio = FloatProperty(
678                 name="Aperture Ratio",
679                 description="Distortion to simulate anamorphic lens bokeh",
680                 min=0.01, soft_min=1.0, soft_max=2.0,
681                 default=1.0,
682                 precision=4,
683                 )
684         cls.panorama_type = EnumProperty(
685                 name="Panorama Type",
686                 description="Distortion to use for the calculation",
687                 items=enum_panorama_types,
688                 default='FISHEYE_EQUISOLID',
689                 )
690         cls.fisheye_fov = FloatProperty(
691                 name="Field of View",
692                 description="Field of view for the fisheye lens",
693                 min=0.1745, soft_max=2.0 * math.pi, max=10.0 * math.pi,
694                 subtype='ANGLE',
695                 default=math.pi,
696                 )
697         cls.fisheye_lens = FloatProperty(
698                 name="Fisheye Lens",
699                 description="Lens focal length (mm)",
700                 min=0.01, soft_max=15.0, max=100.0,
701                 default=10.5,
702                 )
703         cls.latitude_min = FloatProperty(
704                 name="Min Latitude",
705                 description="Minimum latitude (vertical angle) for the equirectangular lens",
706                 min=-0.5 * math.pi, max=0.5 * math.pi,
707                 subtype='ANGLE',
708                 default=-0.5 * math.pi,
709                 )
710         cls.latitude_max = FloatProperty(
711                 name="Max Latitude",
712                 description="Maximum latitude (vertical angle) for the equirectangular lens",
713                 min=-0.5 * math.pi, max=0.5 * math.pi,
714                 subtype='ANGLE',
715                 default=0.5 * math.pi,
716                 )
717         cls.longitude_min = FloatProperty(
718                 name="Min Longitude",
719                 description="Minimum longitude (horizontal angle) for the equirectangular lens",
720                 min=-math.pi, max=math.pi,
721                 subtype='ANGLE',
722                 default=-math.pi,
723                 )
724         cls.longitude_max = FloatProperty(
725                 name="Max Longitude",
726                 description="Maximum longitude (horizontal angle) for the equirectangular lens",
727                 min=-math.pi, max=math.pi,
728                 subtype='ANGLE',
729                 default=math.pi,
730                 )
731
732     @classmethod
733     def unregister(cls):
734         del bpy.types.Camera.cycles
735
736
737 class CyclesMaterialSettings(bpy.types.PropertyGroup):
738     @classmethod
739     def register(cls):
740         bpy.types.Material.cycles = PointerProperty(
741                 name="Cycles Material Settings",
742                 description="Cycles material settings",
743                 type=cls,
744                 )
745         cls.sample_as_light = BoolProperty(
746                 name="Multiple Importance Sample",
747                 description="Use multiple importance sampling for this material, "
748                             "disabling may reduce overall noise for large "
749                             "objects that emit little light compared to other light sources",
750                 default=True,
751                 )
752         cls.use_transparent_shadow = BoolProperty(
753                 name="Transparent Shadows",
754                 description="Use transparent shadows for this material if it contains a Transparent BSDF, "
755                             "disabling will render faster but not give accurate shadows",
756                 default=True,
757                 )
758         cls.homogeneous_volume = BoolProperty(
759                 name="Homogeneous Volume",
760                 description="When using volume rendering, assume volume has the same density everywhere "
761                             "(not using any textures), for faster rendering",
762                 default=False,
763                 )
764         cls.volume_sampling = EnumProperty(
765                 name="Volume Sampling",
766                 description="Sampling method to use for volumes",
767                 items=enum_volume_sampling,
768                 default='MULTIPLE_IMPORTANCE',
769                 )
770
771         cls.volume_interpolation = EnumProperty(
772                 name="Volume Interpolation",
773                 description="Interpolation method to use for smoke/fire volumes",
774                 items=enum_volume_interpolation,
775                 default='LINEAR',
776                 )
777
778     @classmethod
779     def unregister(cls):
780         del bpy.types.Material.cycles
781
782
783 class CyclesLampSettings(bpy.types.PropertyGroup):
784     @classmethod
785     def register(cls):
786         bpy.types.Lamp.cycles = PointerProperty(
787                 name="Cycles Lamp Settings",
788                 description="Cycles lamp settings",
789                 type=cls,
790                 )
791         cls.cast_shadow = BoolProperty(
792                 name="Cast Shadow",
793                 description="Lamp casts shadows",
794                 default=True,
795                 )
796         cls.samples = IntProperty(
797                 name="Samples",
798                 description="Number of light samples to render for each AA sample",
799                 min=1, max=10000,
800                 default=1,
801                 )
802         cls.max_bounces = IntProperty(
803                 name="Max Bounces",
804                 description="Maximum number of bounces the light will contribute to the render",
805                 min=0, max=1024,
806                 default=1024,
807                 )
808         cls.use_multiple_importance_sampling = BoolProperty(
809                 name="Multiple Importance Sample",
810                 description="Use multiple importance sampling for the lamp, "
811                             "reduces noise for area lamps and sharp glossy materials",
812                 default=True,
813                 )
814         cls.is_portal = BoolProperty(
815                 name="Is Portal",
816                 description="Use this area lamp to guide sampling of the background, "
817                             "note that this will make the lamp invisible",
818                 default=False,
819                 )
820
821     @classmethod
822     def unregister(cls):
823         del bpy.types.Lamp.cycles
824
825
826 class CyclesWorldSettings(bpy.types.PropertyGroup):
827     @classmethod
828     def register(cls):
829         bpy.types.World.cycles = PointerProperty(
830                 name="Cycles World Settings",
831                 description="Cycles world settings",
832                 type=cls,
833                 )
834         cls.sample_as_light = BoolProperty(
835                 name="Multiple Importance Sample",
836                 description="Use multiple importance sampling for the environment, "
837                             "enabling for non-solid colors is recommended",
838                 default=True,
839                 )
840         cls.sample_map_resolution = IntProperty(
841                 name="Map Resolution",
842                 description="Importance map size is resolution x resolution; "
843                             "higher values potentially produce less noise, at the cost of memory and speed",
844                 min=4, max=8192,
845                 default=1024,
846                 )
847         cls.samples = IntProperty(
848                 name="Samples",
849                 description="Number of light samples to render for each AA sample",
850                 min=1, max=10000,
851                 default=1,
852                 )
853         cls.max_bounces = IntProperty(
854                 name="Max Bounces",
855                 description="Maximum number of bounces the background light will contribute to the render",
856                 min=0, max=1024,
857                 default=1024,
858                 )
859         cls.homogeneous_volume = BoolProperty(
860                 name="Homogeneous Volume",
861                 description="When using volume rendering, assume volume has the same density everywhere"
862                             "(not using any textures), for faster rendering",
863                 default=False,
864                 )
865         cls.volume_sampling = EnumProperty(
866                 name="Volume Sampling",
867                 description="Sampling method to use for volumes",
868                 items=enum_volume_sampling,
869                 default='EQUIANGULAR',
870                 )
871
872         cls.volume_interpolation = EnumProperty(
873                 name="Volume Interpolation",
874                 description="Interpolation method to use for volumes",
875                 items=enum_volume_interpolation,
876                 default='LINEAR',
877                 )
878
879     @classmethod
880     def unregister(cls):
881         del bpy.types.World.cycles
882
883
884 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
885     @classmethod
886     def register(cls):
887         bpy.types.Object.cycles_visibility = PointerProperty(
888                 name="Cycles Visibility Settings",
889                 description="Cycles visibility settings",
890                 type=cls,
891                 )
892
893         bpy.types.World.cycles_visibility = PointerProperty(
894                 name="Cycles Visibility Settings",
895                 description="Cycles visibility settings",
896                 type=cls,
897                 )
898
899         cls.camera = BoolProperty(
900                 name="Camera",
901                 description="Object visibility for camera rays",
902                 default=True,
903                 )
904         cls.diffuse = BoolProperty(
905                 name="Diffuse",
906                 description="Object visibility for diffuse reflection rays",
907                 default=True,
908                 )
909         cls.glossy = BoolProperty(
910                 name="Glossy",
911                 description="Object visibility for glossy reflection rays",
912                 default=True,
913                 )
914         cls.transmission = BoolProperty(
915                 name="Transmission",
916                 description="Object visibility for transmission rays",
917                 default=True,
918                 )
919         cls.shadow = BoolProperty(
920                 name="Shadow",
921                 description="Object visibility for shadow rays",
922                 default=True,
923                 )
924         cls.scatter = BoolProperty(
925                 name="Volume Scatter",
926                 description="Object visibility for volume scatter rays",
927                 default=True,
928                 )
929
930     @classmethod
931     def unregister(cls):
932         del bpy.types.Object.cycles_visibility
933         del bpy.types.World.cycles_visibility
934
935
936 class CyclesMeshSettings(bpy.types.PropertyGroup):
937     @classmethod
938     def register(cls):
939         bpy.types.Mesh.cycles = PointerProperty(
940                 name="Cycles Mesh Settings",
941                 description="Cycles mesh settings",
942                 type=cls,
943                 )
944         bpy.types.Curve.cycles = PointerProperty(
945                 name="Cycles Mesh Settings",
946                 description="Cycles mesh settings",
947                 type=cls,
948                 )
949         bpy.types.MetaBall.cycles = PointerProperty(
950                 name="Cycles Mesh Settings",
951                 description="Cycles mesh settings",
952                 type=cls,
953                 )
954
955         cls.displacement_method = EnumProperty(
956                 name="Displacement Method",
957                 description="Method to use for the displacement",
958                 items=enum_displacement_methods,
959                 default='BUMP',
960                 )
961
962     @classmethod
963     def unregister(cls):
964         del bpy.types.Mesh.cycles
965         del bpy.types.Curve.cycles
966         del bpy.types.MetaBall.cycles
967
968
969 class CyclesObjectSettings(bpy.types.PropertyGroup):
970     @classmethod
971     def register(cls):
972         bpy.types.Object.cycles = PointerProperty(
973                 name="Cycles Object Settings",
974                 description="Cycles object settings",
975                 type=cls,
976                 )
977
978         cls.use_motion_blur = BoolProperty(
979                 name="Use Motion Blur",
980                 description="Use motion blur for this object",
981                 default=True,
982                 )
983
984         cls.use_deform_motion = BoolProperty(
985                 name="Use Deformation Motion",
986                 description="Use deformation motion blur for this object",
987                 default=True,
988                 )
989
990         cls.motion_steps = IntProperty(
991                 name="Motion Steps",
992                 description="Control accuracy of deformation motion blur, more steps gives more memory usage (actual number of steps is 2^(steps - 1))",
993                 min=1, soft_max=8,
994                 default=1,
995                 )
996
997         cls.use_camera_cull = BoolProperty(
998                 name="Use Camera Cull",
999                 description="Allow this object and its duplicators to be culled by camera space culling",
1000                 default=False,
1001                 )
1002
1003         cls.use_adaptive_subdivision = BoolProperty(
1004                 name="Use Adaptive Subdivision",
1005                 description="Use adaptive render time subdivision",
1006                 default=False,
1007                 )
1008
1009         cls.dicing_rate = FloatProperty(
1010                 name="Dicing Rate",
1011                 description="Multiplier for scene dicing rate",
1012                 min=0.1, max=1000.0,
1013                 default=1.0,
1014                 )
1015
1016     @classmethod
1017     def unregister(cls):
1018         del bpy.types.Object.cycles
1019
1020
1021 class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
1022     @classmethod
1023     def register(cls):
1024         bpy.types.Scene.cycles_curves = PointerProperty(
1025                 name="Cycles Hair Rendering Settings",
1026                 description="Cycles hair rendering settings",
1027                 type=cls,
1028                 )
1029         cls.primitive = EnumProperty(
1030                 name="Primitive",
1031                 description="Type of primitive used for hair rendering",
1032                 items=enum_curve_primitives,
1033                 default='LINE_SEGMENTS',
1034                 )
1035         cls.shape = EnumProperty(
1036                 name="Shape",
1037                 description="Form of hair",
1038                 items=enum_curve_shape,
1039                 default='THICK',
1040                 )
1041         cls.cull_backfacing = BoolProperty(
1042                 name="Cull back-faces",
1043                 description="Do not test the back-face of each strand",
1044                 default=True,
1045                 )
1046         cls.use_curves = BoolProperty(
1047                 name="Use Cycles Hair Rendering",
1048                 description="Activate Cycles hair rendering for particle system",
1049                 default=True,
1050                 )
1051         cls.resolution = IntProperty(
1052                 name="Resolution",
1053                 description="Resolution of generated mesh",
1054                 min=3, max=64,
1055                 default=3,
1056                 )
1057         cls.minimum_width = FloatProperty(
1058                 name="Minimal width",
1059                 description="Minimal pixel width for strands (0 - deactivated)",
1060                 min=0.0, max=100.0,
1061                 default=0.0,
1062                 )
1063         cls.maximum_width = FloatProperty(
1064                 name="Maximal width",
1065                 description="Maximum extension that strand radius can be increased by",
1066                 min=0.0, max=100.0,
1067                 default=0.1,
1068                 )
1069         cls.subdivisions = IntProperty(
1070                 name="Subdivisions",
1071                 description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
1072                 min=0, max=24,
1073                 default=4,
1074                 )
1075
1076     @classmethod
1077     def unregister(cls):
1078         del bpy.types.Scene.cycles_curves
1079
1080
1081 class CyclesCurveSettings(bpy.types.PropertyGroup):
1082     @classmethod
1083     def register(cls):
1084         bpy.types.ParticleSettings.cycles = PointerProperty(
1085                 name="Cycles Hair Settings",
1086                 description="Cycles hair settings",
1087                 type=cls,
1088                 )
1089         cls.radius_scale = FloatProperty(
1090                 name="Radius Scaling",
1091                 description="Multiplier of width properties",
1092                 min=0.0, max=1000.0,
1093                 default=0.01,
1094                 )
1095         cls.root_width = FloatProperty(
1096                 name="Root Size",
1097                 description="Strand's width at root",
1098                 min=0.0, max=1000.0,
1099                 default=1.0,
1100                 )
1101         cls.tip_width = FloatProperty(
1102                 name="Tip Multiplier",
1103                 description="Strand's width at tip",
1104                 min=0.0, max=1000.0,
1105                 default=0.0,
1106                 )
1107         cls.shape = FloatProperty(
1108                 name="Strand Shape",
1109                 description="Strand shape parameter",
1110                 min=-1.0, max=1.0,
1111                 default=0.0,
1112                 )
1113         cls.use_closetip = BoolProperty(
1114                 name="Close tip",
1115                 description="Set tip radius to zero",
1116                 default=True,
1117                 )
1118
1119     @classmethod
1120     def unregister(cls):
1121         del bpy.types.ParticleSettings.cycles
1122
1123
1124 def register():
1125     bpy.utils.register_class(CyclesRenderSettings)
1126     bpy.utils.register_class(CyclesCameraSettings)
1127     bpy.utils.register_class(CyclesMaterialSettings)
1128     bpy.utils.register_class(CyclesLampSettings)
1129     bpy.utils.register_class(CyclesWorldSettings)
1130     bpy.utils.register_class(CyclesVisibilitySettings)
1131     bpy.utils.register_class(CyclesMeshSettings)
1132     bpy.utils.register_class(CyclesObjectSettings)
1133     bpy.utils.register_class(CyclesCurveRenderSettings)
1134     bpy.utils.register_class(CyclesCurveSettings)
1135
1136
1137 def unregister():
1138     bpy.utils.unregister_class(CyclesRenderSettings)
1139     bpy.utils.unregister_class(CyclesCameraSettings)
1140     bpy.utils.unregister_class(CyclesMaterialSettings)
1141     bpy.utils.unregister_class(CyclesLampSettings)
1142     bpy.utils.unregister_class(CyclesWorldSettings)
1143     bpy.utils.unregister_class(CyclesMeshSettings)
1144     bpy.utils.unregister_class(CyclesObjectSettings)
1145     bpy.utils.unregister_class(CyclesVisibilitySettings)
1146     bpy.utils.unregister_class(CyclesCurveRenderSettings)
1147     bpy.utils.unregister_class(CyclesCurveSettings)