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