Fix T47377: Newer file crashes at render on official 2.76b version
[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_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=10000,
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=10000,
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=10000,
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=10000,
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=10000,
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=10000,
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=10000,
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=10000,
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=10000,
241                 default=0,
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
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.film_exposure = FloatProperty(
368                 name="Exposure",
369                 description="Image brightness scale",
370                 min=0.0, max=10.0,
371                 default=1.0,
372                 )
373         cls.film_transparent = BoolProperty(
374                 name="Transparent",
375                 description="World background is transparent with premultiplied alpha",
376                 default=False,
377                 )
378
379         # Really annoyingly, we have to keep it around for a few releases,
380         # otherwise forward compatibility breaks in really bad manner: CRASH!
381         #
382         # TODO(sergey): Remove this during 2.8x series of Blender.
383         cls.filter_type = EnumProperty(
384                 name="Filter Type",
385                 description="Pixel filter type",
386                 items=enum_filter_types,
387                 default='BLACKMAN_HARRIS',
388                 )
389
390         cls.pixel_filter_type = EnumProperty(
391                 name="Filter Type",
392                 description="Pixel filter type",
393                 items=enum_filter_types,
394                 default='BLACKMAN_HARRIS',
395                 )
396
397         cls.filter_width = FloatProperty(
398                 name="Filter Width",
399                 description="Pixel filter width",
400                 min=0.01, max=10.0,
401                 default=1.5,
402                 )
403
404         cls.seed = IntProperty(
405                 name="Seed",
406                 description="Seed value for integrator to get different noise patterns",
407                 min=0, max=2147483647,
408                 default=0,
409                 )
410
411         cls.use_animated_seed = BoolProperty(
412                 name="Use Animated Seed",
413                 description="Use different seed values (and hence noise patterns) at different frames",
414                 default=False,
415                 )
416
417         cls.sample_clamp_direct = FloatProperty(
418                 name="Clamp Direct",
419                 description="If non-zero, the maximum value for a direct sample, "
420                             "higher values will be scaled down to avoid too "
421                             "much noise and slow convergence at the cost of accuracy",
422                 min=0.0, max=1e8,
423                 default=0.0,
424                 )
425
426         cls.sample_clamp_indirect = FloatProperty(
427                 name="Clamp Indirect",
428                 description="If non-zero, the maximum value for an indirect sample, "
429                             "higher values will be scaled down to avoid too "
430                             "much noise and slow convergence at the cost of accuracy",
431                 min=0.0, max=1e8,
432                 default=0.0,
433                 )
434
435         cls.debug_tile_size = IntProperty(
436                 name="Tile Size",
437                 description="",
438                 min=1, max=4096,
439                 default=1024,
440                 )
441
442         cls.preview_start_resolution = IntProperty(
443                 name="Start Resolution",
444                 description="Resolution to start rendering preview at, "
445                             "progressively increasing it to the full viewport size",
446                 min=8, max=16384,
447                 default=64,
448                 )
449
450         cls.debug_reset_timeout = FloatProperty(
451                 name="Reset timeout",
452                 description="",
453                 min=0.01, max=10.0,
454                 default=0.1,
455                 )
456         cls.debug_cancel_timeout = FloatProperty(
457                 name="Cancel timeout",
458                 description="",
459                 min=0.01, max=10.0,
460                 default=0.1,
461                 )
462         cls.debug_text_timeout = FloatProperty(
463                 name="Text timeout",
464                 description="",
465                 min=0.01, max=10.0,
466                 default=1.0,
467                 )
468
469         cls.debug_bvh_type = EnumProperty(
470                 name="Viewport BVH Type",
471                 description="Choose between faster updates, or faster render",
472                 items=enum_bvh_types,
473                 default='DYNAMIC_BVH',
474                 )
475         cls.debug_use_spatial_splits = BoolProperty(
476                 name="Use Spatial Splits",
477                 description="Use BVH spatial splits: longer builder time, faster render",
478                 default=False,
479                 )
480         cls.tile_order = EnumProperty(
481                 name="Tile Order",
482                 description="Tile order for rendering",
483                 items=enum_tile_order,
484                 default='HILBERT_SPIRAL',
485                 options=set(),  # Not animatable!
486                 )
487         cls.use_progressive_refine = BoolProperty(
488                 name="Progressive Refine",
489                 description="Instead of rendering each tile until it is finished, "
490                             "refine the whole image progressively "
491                             "(this renders somewhat slower, "
492                             "but time can be saved by manually stopping the render when the noise is low enough)",
493                 default=False,
494                 )
495
496         cls.bake_type = EnumProperty(
497             name="Bake Type",
498             default='COMBINED',
499             description="Type of pass to bake",
500             items=(
501                 ('COMBINED', "Combined", ""),
502                 ('AO', "Ambient Occlusion", ""),
503                 ('SHADOW', "Shadow", ""),
504                 ('NORMAL', "Normal", ""),
505                 ('UV', "UV", ""),
506                 ('EMIT', "Emit", ""),
507                 ('ENVIRONMENT', "Environment", ""),
508                 ('DIFFUSE', "Diffuse", ""),
509                 ('GLOSSY', "Glossy", ""),
510                 ('TRANSMISSION', "Transmission", ""),
511                 ('SUBSURFACE', "Subsurface", ""),
512                 ),
513             )
514
515         cls.use_camera_cull = BoolProperty(
516                 name="Use Camera Cull",
517                 description="Allow objects to be culled based on the camera frustum",
518                 default=False,
519                 )
520
521         cls.camera_cull_margin = FloatProperty(
522                 name="Camera Cull Margin",
523                 description="Margin for the camera space culling",
524                 default=0.1,
525                 min=0.0, max=5.0
526                 )
527
528         cls.motion_blur_position = EnumProperty(
529             name="Motion Blur Position",
530             default='CENTER',
531             description="Offset for the shutter's time interval, allows to change the motion blur trails",
532             items=(
533                 ('START', "Start on Frame", "The shutter opens at the current frame"),
534                 ('CENTER', "Center on Frame", "The shutter is open during the current frame"),
535                 ('END', "End on Frame", "The shutter closes at the current frame"),
536                 ),
537             )
538
539         cls.rolling_shutter_type = EnumProperty(
540             name="Shutter Type",
541             default='NONE',
542             description="Type of rolling shutter effect matching CMOS-based cameras",
543             items=(
544                 ('NONE', "None", "No rolling shutter effect used"),
545                 ('TOP', "Top-Bottom", "Sensor is being scanned from top to bottom")
546                 # TODO(seergey): Are there real cameras with different scanning direction?
547                 ),
548             )
549
550         cls.rolling_shutter_duration = FloatProperty(
551             name="Rolling Shutter Duration",
552             description="Scanline \"exposure\" time for the rolling shutter effect",
553             default=0.1,
554             min=0.0, max=1.0,
555             )
556
557         # Various fine-tuning debug flags
558
559         def devices_update_callback(self, context):
560             import _cycles
561             scene = context.scene.as_pointer()
562             return _cycles.debug_flags_update(scene)
563
564         cls.debug_use_cpu_avx2 = BoolProperty(name="AVX2", default=True)
565         cls.debug_use_cpu_avx = BoolProperty(name="AVX", default=True)
566         cls.debug_use_cpu_sse41 = BoolProperty(name="SSE41", default=True)
567         cls.debug_use_cpu_sse3 = BoolProperty(name="SSE3", default=True)
568         cls.debug_use_cpu_sse2 = BoolProperty(name="SSE2", default=True)
569         cls.debug_use_qbvh = BoolProperty(name="QBVH", default=True)
570
571         cls.debug_opencl_kernel_type = EnumProperty(
572             name="OpenCL Kernel Type",
573             default='DEFAULT',
574             items=(
575                 ('DEFAULT', "Default", ""),
576                 ('MEGA', "Mega", ""),
577                 ('SPLIT', "Split", ""),
578                 ),
579             update=devices_update_callback
580             )
581
582         cls.debug_opencl_device_type = EnumProperty(
583             name="OpenCL Device Type",
584             default='ALL',
585             items=(
586                 ('NONE', "None", ""),
587                 ('ALL', "All", ""),
588                 ('DEFAULT', "Default", ""),
589                 ('CPU', "CPU", ""),
590                 ('GPU', "GPU", ""),
591                 ('ACCELERATOR', "Accelerator", ""),
592                 ),
593             update=devices_update_callback
594             )
595
596         cls.debug_use_opencl_debug = BoolProperty(name="Debug OpenCL", default=False)
597
598     @classmethod
599     def unregister(cls):
600         del bpy.types.Scene.cycles
601
602
603 class CyclesCameraSettings(bpy.types.PropertyGroup):
604     @classmethod
605     def register(cls):
606         import math
607
608         bpy.types.Camera.cycles = PointerProperty(
609                 name="Cycles Camera Settings",
610                 description="Cycles camera settings",
611                 type=cls,
612                 )
613
614         cls.aperture_type = EnumProperty(
615                 name="Aperture Type",
616                 description="Use f-stop number or aperture radius",
617                 items=enum_aperture_types,
618                 default='RADIUS',
619                 )
620         cls.aperture_fstop = FloatProperty(
621                 name="Aperture f-stop",
622                 description="F-stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
623                 min=0.0, soft_min=0.1, soft_max=64.0,
624                 default=5.6,
625                 step=10,
626                 precision=1,
627                 )
628         cls.aperture_size = FloatProperty(
629                 name="Aperture Size",
630                 description="Radius of the aperture for depth of field (higher values give more defocus)",
631                 min=0.0, soft_max=10.0,
632                 default=0.0,
633                 step=1,
634                 precision=4,
635                 subtype='DISTANCE',
636                 )
637         cls.aperture_blades = IntProperty(
638                 name="Aperture Blades",
639                 description="Number of blades in aperture for polygonal bokeh (at least 3)",
640                 min=0, max=100,
641                 default=0,
642                 )
643         cls.aperture_rotation = FloatProperty(
644                 name="Aperture Rotation",
645                 description="Rotation of blades in aperture",
646                 soft_min=-math.pi, soft_max=math.pi,
647                 subtype='ANGLE',
648                 default=0,
649                 )
650         cls.aperture_ratio = FloatProperty(
651                 name="Aperture Ratio",
652                 description="Distortion to simulate anamorphic lens bokeh",
653                 min=0.01, soft_min=1.0, soft_max=2.0,
654                 default=1.0,
655                 precision=4,
656                 )
657         cls.panorama_type = EnumProperty(
658                 name="Panorama Type",
659                 description="Distortion to use for the calculation",
660                 items=enum_panorama_types,
661                 default='FISHEYE_EQUISOLID',
662                 )
663         cls.fisheye_fov = FloatProperty(
664                 name="Field of View",
665                 description="Field of view for the fisheye lens",
666                 min=0.1745, soft_max=2.0 * math.pi, max=10.0 * math.pi,
667                 subtype='ANGLE',
668                 default=math.pi,
669                 )
670         cls.fisheye_lens = FloatProperty(
671                 name="Fisheye Lens",
672                 description="Lens focal length (mm)",
673                 min=0.01, soft_max=15.0, max=100.0,
674                 default=10.5,
675                 )
676         cls.latitude_min = FloatProperty(
677                 name="Min Latitude",
678                 description="Minimum latitude (vertical angle) for the equirectangular lens",
679                 min=-0.5 * math.pi, max=0.5 * math.pi,
680                 subtype='ANGLE',
681                 default=-0.5 * math.pi,
682                 )
683         cls.latitude_max = FloatProperty(
684                 name="Max Latitude",
685                 description="Maximum latitude (vertical angle) for the equirectangular lens",
686                 min=-0.5 * math.pi, max=0.5 * math.pi,
687                 subtype='ANGLE',
688                 default=0.5 * math.pi,
689                 )
690         cls.longitude_min = FloatProperty(
691                 name="Min Longitude",
692                 description="Minimum longitude (horizontal angle) for the equirectangular lens",
693                 min=-math.pi, max=math.pi,
694                 subtype='ANGLE',
695                 default=-math.pi,
696                 )
697         cls.longitude_max = FloatProperty(
698                 name="Max Longitude",
699                 description="Maximum longitude (horizontal angle) for the equirectangular lens",
700                 min=-math.pi, max=math.pi,
701                 subtype='ANGLE',
702                 default=math.pi,
703                 )
704
705     @classmethod
706     def unregister(cls):
707         del bpy.types.Camera.cycles
708
709
710 class CyclesMaterialSettings(bpy.types.PropertyGroup):
711     @classmethod
712     def register(cls):
713         bpy.types.Material.cycles = PointerProperty(
714                 name="Cycles Material Settings",
715                 description="Cycles material settings",
716                 type=cls,
717                 )
718         cls.sample_as_light = BoolProperty(
719                 name="Multiple Importance Sample",
720                 description="Use multiple importance sampling for this material, "
721                             "disabling may reduce overall noise for large "
722                             "objects that emit little light compared to other light sources",
723                 default=True,
724                 )
725         cls.use_transparent_shadow = BoolProperty(
726                 name="Transparent Shadows",
727                 description="Use transparent shadows for this material if it contains a Transparent BSDF, "
728                             "disabling will render faster but not give accurate shadows",
729                 default=True,
730                 )
731         cls.homogeneous_volume = BoolProperty(
732                 name="Homogeneous Volume",
733                 description="When using volume rendering, assume volume has the same density everywhere "
734                             "(not using any textures), for faster rendering",
735                 default=False,
736                 )
737         cls.volume_sampling = EnumProperty(
738                 name="Volume Sampling",
739                 description="Sampling method to use for volumes",
740                 items=enum_volume_sampling,
741                 default='MULTIPLE_IMPORTANCE',
742                 )
743
744         cls.volume_interpolation = EnumProperty(
745                 name="Volume Interpolation",
746                 description="Interpolation method to use for smoke/fire volumes",
747                 items=enum_volume_interpolation,
748                 default='LINEAR',
749                 )
750
751     @classmethod
752     def unregister(cls):
753         del bpy.types.Material.cycles
754
755
756 class CyclesLampSettings(bpy.types.PropertyGroup):
757     @classmethod
758     def register(cls):
759         bpy.types.Lamp.cycles = PointerProperty(
760                 name="Cycles Lamp Settings",
761                 description="Cycles lamp settings",
762                 type=cls,
763                 )
764         cls.cast_shadow = BoolProperty(
765                 name="Cast Shadow",
766                 description="Lamp casts shadows",
767                 default=True,
768                 )
769         cls.samples = IntProperty(
770                 name="Samples",
771                 description="Number of light samples to render for each AA sample",
772                 min=1, max=10000,
773                 default=1,
774                 )
775         cls.max_bounces = IntProperty(
776                 name="Max Bounces",
777                 description="Maximum number of bounces the light will contribute to the render",
778                 min=0, max=1024,
779                 default=1024,
780                 )
781         cls.use_multiple_importance_sampling = BoolProperty(
782                 name="Multiple Importance Sample",
783                 description="Use multiple importance sampling for the lamp, "
784                             "reduces noise for area lamps and sharp glossy materials",
785                 default=True,
786                 )
787         cls.is_portal = BoolProperty(
788                 name="Is Portal",
789                 description="Use this area lamp to guide sampling of the background, "
790                             "note that this will make the lamp invisible",
791                 default=False,
792                 )
793
794     @classmethod
795     def unregister(cls):
796         del bpy.types.Lamp.cycles
797
798
799 class CyclesWorldSettings(bpy.types.PropertyGroup):
800     @classmethod
801     def register(cls):
802         bpy.types.World.cycles = PointerProperty(
803                 name="Cycles World Settings",
804                 description="Cycles world settings",
805                 type=cls,
806                 )
807         cls.sample_as_light = BoolProperty(
808                 name="Multiple Importance Sample",
809                 description="Use multiple importance sampling for the environment, "
810                             "enabling for non-solid colors is recommended",
811                 default=True,
812                 )
813         cls.sample_map_resolution = IntProperty(
814                 name="Map Resolution",
815                 description="Importance map size is resolution x resolution; "
816                             "higher values potentially produce less noise, at the cost of memory and speed",
817                 min=4, max=8192,
818                 default=1024,
819                 )
820         cls.samples = IntProperty(
821                 name="Samples",
822                 description="Number of light samples to render for each AA sample",
823                 min=1, max=10000,
824                 default=1,
825                 )
826         cls.max_bounces = IntProperty(
827                 name="Max Bounces",
828                 description="Maximum number of bounces the background light will contribute to the render",
829                 min=0, max=1024,
830                 default=1024,
831                 )
832         cls.homogeneous_volume = BoolProperty(
833                 name="Homogeneous Volume",
834                 description="When using volume rendering, assume volume has the same density everywhere"
835                             "(not using any textures), for faster rendering",
836                 default=False,
837                 )
838         cls.volume_sampling = EnumProperty(
839                 name="Volume Sampling",
840                 description="Sampling method to use for volumes",
841                 items=enum_volume_sampling,
842                 default='EQUIANGULAR',
843                 )
844
845         cls.volume_interpolation = EnumProperty(
846                 name="Volume Interpolation",
847                 description="Interpolation method to use for volumes",
848                 items=enum_volume_interpolation,
849                 default='LINEAR',
850                 )
851
852     @classmethod
853     def unregister(cls):
854         del bpy.types.World.cycles
855
856
857 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
858     @classmethod
859     def register(cls):
860         bpy.types.Object.cycles_visibility = PointerProperty(
861                 name="Cycles Visibility Settings",
862                 description="Cycles visibility settings",
863                 type=cls,
864                 )
865
866         bpy.types.World.cycles_visibility = PointerProperty(
867                 name="Cycles Visibility Settings",
868                 description="Cycles visibility settings",
869                 type=cls,
870                 )
871
872         cls.camera = BoolProperty(
873                 name="Camera",
874                 description="Object visibility for camera rays",
875                 default=True,
876                 )
877         cls.diffuse = BoolProperty(
878                 name="Diffuse",
879                 description="Object visibility for diffuse reflection rays",
880                 default=True,
881                 )
882         cls.glossy = BoolProperty(
883                 name="Glossy",
884                 description="Object visibility for glossy reflection rays",
885                 default=True,
886                 )
887         cls.transmission = BoolProperty(
888                 name="Transmission",
889                 description="Object visibility for transmission rays",
890                 default=True,
891                 )
892         cls.shadow = BoolProperty(
893                 name="Shadow",
894                 description="Object visibility for shadow rays",
895                 default=True,
896                 )
897         cls.scatter = BoolProperty(
898                 name="Volume Scatter",
899                 description="Object visibility for volume scatter rays",
900                 default=True,
901                 )
902
903     @classmethod
904     def unregister(cls):
905         del bpy.types.Object.cycles_visibility
906         del bpy.types.World.cycles_visibility
907
908
909 class CyclesMeshSettings(bpy.types.PropertyGroup):
910     @classmethod
911     def register(cls):
912         bpy.types.Mesh.cycles = PointerProperty(
913                 name="Cycles Mesh Settings",
914                 description="Cycles mesh settings",
915                 type=cls,
916                 )
917         bpy.types.Curve.cycles = PointerProperty(
918                 name="Cycles Mesh Settings",
919                 description="Cycles mesh settings",
920                 type=cls,
921                 )
922         bpy.types.MetaBall.cycles = PointerProperty(
923                 name="Cycles Mesh Settings",
924                 description="Cycles mesh settings",
925                 type=cls,
926                 )
927
928         cls.displacement_method = EnumProperty(
929                 name="Displacement Method",
930                 description="Method to use for the displacement",
931                 items=enum_displacement_methods,
932                 default='BUMP',
933                 )
934         cls.use_subdivision = BoolProperty(
935                 name="Use Subdivision",
936                 description="Subdivide mesh for rendering",
937                 default=False,
938                 )
939         cls.dicing_rate = FloatProperty(
940                 name="Dicing Rate",
941                 description="",
942                 min=0.001, max=1000.0,
943                 default=1.0,
944                 )
945
946     @classmethod
947     def unregister(cls):
948         del bpy.types.Mesh.cycles
949         del bpy.types.Curve.cycles
950         del bpy.types.MetaBall.cycles
951
952
953 class CyclesObjectBlurSettings(bpy.types.PropertyGroup):
954
955     @classmethod
956     def register(cls):
957
958         bpy.types.Object.cycles = PointerProperty(
959                 name="Cycles Object Settings",
960                 description="Cycles object settings",
961                 type=cls,
962                 )
963
964         cls.use_motion_blur = BoolProperty(
965                 name="Use Motion Blur",
966                 description="Use motion blur for this object",
967                 default=True,
968                 )
969
970         cls.use_deform_motion = BoolProperty(
971                 name="Use Deformation Motion",
972                 description="Use deformation motion blur for this object",
973                 default=True,
974                 )
975
976         cls.motion_steps = IntProperty(
977                 name="Motion Steps",
978                 description="Control accuracy of deformation motion blur, more steps gives more memory usage (actual number of steps is 2^(steps - 1))",
979                 min=1, soft_max=8,
980                 default=1,
981                 )
982
983         cls.use_camera_cull = BoolProperty(
984                 name="Use Camera Cull",
985                 description="Allow this object and its duplicators to be culled by camera space culling",
986                 default=False,
987                 )
988
989     @classmethod
990     def unregister(cls):
991         del bpy.types.Object.cycles
992
993
994 class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
995     @classmethod
996     def register(cls):
997         bpy.types.Scene.cycles_curves = PointerProperty(
998                 name="Cycles Hair Rendering Settings",
999                 description="Cycles hair rendering settings",
1000                 type=cls,
1001                 )
1002         cls.primitive = EnumProperty(
1003                 name="Primitive",
1004                 description="Type of primitive used for hair rendering",
1005                 items=enum_curve_primitives,
1006                 default='LINE_SEGMENTS',
1007                 )
1008         cls.shape = EnumProperty(
1009                 name="Shape",
1010                 description="Form of hair",
1011                 items=enum_curve_shape,
1012                 default='THICK',
1013                 )
1014         cls.cull_backfacing = BoolProperty(
1015                 name="Cull back-faces",
1016                 description="Do not test the back-face of each strand",
1017                 default=True,
1018                 )
1019         cls.use_curves = BoolProperty(
1020                 name="Use Cycles Hair Rendering",
1021                 description="Activate Cycles hair rendering for particle system",
1022                 default=True,
1023                 )
1024         cls.resolution = IntProperty(
1025                 name="Resolution",
1026                 description="Resolution of generated mesh",
1027                 min=3, max=64,
1028                 default=3,
1029                 )
1030         cls.minimum_width = FloatProperty(
1031                 name="Minimal width",
1032                 description="Minimal pixel width for strands (0 - deactivated)",
1033                 min=0.0, max=100.0,
1034                 default=0.0,
1035                 )
1036         cls.maximum_width = FloatProperty(
1037                 name="Maximal width",
1038                 description="Maximum extension that strand radius can be increased by",
1039                 min=0.0, max=100.0,
1040                 default=0.1,
1041                 )
1042         cls.subdivisions = IntProperty(
1043                 name="Subdivisions",
1044                 description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
1045                 min=0, max=24,
1046                 default=4,
1047                 )
1048
1049     @classmethod
1050     def unregister(cls):
1051         del bpy.types.Scene.cycles_curves
1052
1053
1054 class CyclesCurveSettings(bpy.types.PropertyGroup):
1055     @classmethod
1056     def register(cls):
1057         bpy.types.ParticleSettings.cycles = PointerProperty(
1058                 name="Cycles Hair Settings",
1059                 description="Cycles hair settings",
1060                 type=cls,
1061                 )
1062         cls.radius_scale = FloatProperty(
1063                 name="Radius Scaling",
1064                 description="Multiplier of width properties",
1065                 min=0.0, max=1000.0,
1066                 default=0.01,
1067                 )
1068         cls.root_width = FloatProperty(
1069                 name="Root Size",
1070                 description="Strand's width at root",
1071                 min=0.0, max=1000.0,
1072                 default=1.0,
1073                 )
1074         cls.tip_width = FloatProperty(
1075                 name="Tip Multiplier",
1076                 description="Strand's width at tip",
1077                 min=0.0, max=1000.0,
1078                 default=0.0,
1079                 )
1080         cls.shape = FloatProperty(
1081                 name="Strand Shape",
1082                 description="Strand shape parameter",
1083                 min=-1.0, max=1.0,
1084                 default=0.0,
1085                 )
1086         cls.use_closetip = BoolProperty(
1087                 name="Close tip",
1088                 description="Set tip radius to zero",
1089                 default=True,
1090                 )
1091
1092     @classmethod
1093     def unregister(cls):
1094         del bpy.types.ParticleSettings.cycles
1095
1096
1097 def register():
1098     bpy.utils.register_class(CyclesRenderSettings)
1099     bpy.utils.register_class(CyclesCameraSettings)
1100     bpy.utils.register_class(CyclesMaterialSettings)
1101     bpy.utils.register_class(CyclesLampSettings)
1102     bpy.utils.register_class(CyclesWorldSettings)
1103     bpy.utils.register_class(CyclesVisibilitySettings)
1104     bpy.utils.register_class(CyclesMeshSettings)
1105     bpy.utils.register_class(CyclesCurveRenderSettings)
1106     bpy.utils.register_class(CyclesCurveSettings)
1107
1108
1109 def unregister():
1110     bpy.utils.unregister_class(CyclesRenderSettings)
1111     bpy.utils.unregister_class(CyclesCameraSettings)
1112     bpy.utils.unregister_class(CyclesMaterialSettings)
1113     bpy.utils.unregister_class(CyclesLampSettings)
1114     bpy.utils.unregister_class(CyclesWorldSettings)
1115     bpy.utils.unregister_class(CyclesMeshSettings)
1116     bpy.utils.unregister_class(CyclesVisibilitySettings)
1117     bpy.utils.unregister_class(CyclesCurveRenderSettings)
1118     bpy.utils.unregister_class(CyclesCurveSettings)