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