Cleanup: Fix Cycles Apache header.
[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     )
58
59 enum_aperture_types = (
60     ('RADIUS', "Radius", "Directly change the size of the aperture"),
61     ('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
62     )
63
64 enum_panorama_types = (
65     ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
66     ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
67     ('FISHEYE_EQUISOLID', "Fisheye Equisolid",
68                           "Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
69     )
70
71 enum_curve_primitives = (
72     ('TRIANGLES', "Triangles", "Create triangle geometry around strands"),
73     ('LINE_SEGMENTS', "Line Segments", "Use line segment primitives"),
74     ('CURVE_SEGMENTS', "Curve Segments", "Use segmented cardinal curve primitives"),
75     )
76
77 enum_triangle_curves = (
78     ('CAMERA_TRIANGLES', "Planes", "Create individual triangles forming planes that face camera"),
79     ('TESSELLATED_TRIANGLES', "Tessellated", "Create mesh surrounding each strand"),
80     )
81
82 enum_curve_shape = (
83     ('RIBBONS', "Ribbons", "Ignore thickness of each strand"),
84     ('THICK', "Thick", "Use thickness of strand when rendering"),
85     )
86
87 enum_tile_order = (
88     ('CENTER', "Center", "Render from center to the edges"),
89     ('RIGHT_TO_LEFT', "Right to Left", "Render from right to left"),
90     ('LEFT_TO_RIGHT', "Left to Right", "Render from left to right"),
91     ('TOP_TO_BOTTOM', "Top to Bottom", "Render from top to bottom"),
92     ('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"),
93     )
94
95 enum_use_layer_samples = (
96     ('USE', "Use", "Per render layer number of samples override scene samples"),
97     ('BOUNDED', "Bounded", "Bound per render layer number of samples by global samples"),
98     ('IGNORE', "Ignore", "Ignore per render layer number of samples"),
99     )
100
101 enum_sampling_pattern = (
102     ('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
103     ('CORRELATED_MUTI_JITTER', "Correlated Multi-Jitter", "Use Correlated Multi-Jitter random sampling pattern"),
104     )
105
106 enum_integrator = (
107     ('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"),
108     ('PATH', "Path Tracing", "Pure path tracing integrator"),
109     )
110
111 enum_volume_sampling = (
112     ('DISTANCE', "Distance", "Use distance sampling, best for dense volumes with lights far away"),
113     ('EQUIANGULAR', "Equiangular", "Use equiangular sampling, best for volumes with low density with light inside or near the volume"),
114     ('MULTIPLE_IMPORTANCE', "Multiple Importance", "Combine distance and equi-angular sampling for volumes where neither method is ideal"),
115     )
116
117 enum_volume_interpolation = (
118     ('LINEAR', "Linear", "Good smoothness and speed"),
119     ('CUBIC', 'Cubic', 'Smoothed high quality interpolation, but slower')
120     )
121
122
123 class CyclesRenderSettings(bpy.types.PropertyGroup):
124     @classmethod
125     def register(cls):
126         bpy.types.Scene.cycles = PointerProperty(
127                 name="Cycles Render Settings",
128                 description="Cycles render settings",
129                 type=cls,
130                 )
131         cls.device = EnumProperty(
132                 name="Device",
133                 description="Device to use for rendering",
134                 items=enum_devices,
135                 default='CPU',
136                 )
137         cls.feature_set = EnumProperty(
138                 name="Feature Set",
139                 description="Feature set to use for rendering",
140                 items=enum_feature_set,
141                 default='SUPPORTED',
142                 )
143         cls.shading_system = BoolProperty(
144                 name="Open Shading Language",
145                 description="Use Open Shading Language (CPU rendering only)",
146                 )
147
148         cls.progressive = EnumProperty(
149                 name="Integrator",
150                 description="Method to sample lights and materials",
151                 items=enum_integrator,
152                 default='PATH',
153                 )
154
155         cls.use_square_samples = BoolProperty(
156                 name="Square Samples",
157                 description="Square sampling values for easier artist control",
158                 default=False,
159                 )
160
161         cls.samples = IntProperty(
162                 name="Samples",
163                 description="Number of samples to render for each pixel",
164                 min=1, max=2147483647,
165                 default=10,
166                 )
167         cls.preview_samples = IntProperty(
168                 name="Preview Samples",
169                 description="Number of samples to render in the viewport, unlimited if 0",
170                 min=0, max=2147483647,
171                 default=10,
172                 )
173         cls.preview_pause = BoolProperty(
174                 name="Pause Preview",
175                 description="Pause all viewport preview renders",
176                 default=False,
177                 )
178         cls.preview_active_layer = BoolProperty(
179                 name="Preview Active Layer",
180                 description="Preview active render layer in viewport",
181                 default=False,
182                 )
183
184         cls.aa_samples = IntProperty(
185                 name="AA Samples",
186                 description="Number of antialiasing samples to render for each pixel",
187                 min=1, max=10000,
188                 default=4,
189                 )
190         cls.preview_aa_samples = IntProperty(
191                 name="AA Samples",
192                 description="Number of antialiasing samples to render in the viewport, unlimited if 0",
193                 min=0, max=10000,
194                 default=4,
195                 )
196         cls.diffuse_samples = IntProperty(
197                 name="Diffuse Samples",
198                 description="Number of diffuse bounce samples to render for each AA sample",
199                 min=1, max=10000,
200                 default=1,
201                 )
202         cls.glossy_samples = IntProperty(
203                 name="Glossy Samples",
204                 description="Number of glossy bounce samples to render for each AA sample",
205                 min=1, max=10000,
206                 default=1,
207                 )
208         cls.transmission_samples = IntProperty(
209                 name="Transmission Samples",
210                 description="Number of transmission bounce samples to render for each AA sample",
211                 min=1, max=10000,
212                 default=1,
213                 )
214         cls.ao_samples = IntProperty(
215                 name="Ambient Occlusion Samples",
216                 description="Number of ambient occlusion samples to render for each AA sample",
217                 min=1, max=10000,
218                 default=1,
219                 )
220         cls.mesh_light_samples = IntProperty(
221                 name="Mesh Light Samples",
222                 description="Number of mesh emission light samples to render for each AA sample",
223                 min=1, max=10000,
224                 default=1,
225                 )
226
227         cls.subsurface_samples = IntProperty(
228                 name="Subsurface Samples",
229                 description="Number of subsurface scattering samples to render for each AA sample",
230                 min=1, max=10000,
231                 default=1,
232                 )
233
234         cls.volume_samples = IntProperty(
235                 name="Volume Samples",
236                 description="Number of volume scattering samples to render for each AA sample",
237                 min=1, max=10000,
238                 default=0,
239                 )
240
241         cls.sampling_pattern = EnumProperty(
242                 name="Sampling Pattern",
243                 description="Random sampling pattern used by the integrator",
244                 items=enum_sampling_pattern,
245                 default='SOBOL',
246                 )
247
248         cls.use_layer_samples = EnumProperty(
249                 name="Layer Samples",
250                 description="How to use per render layer sample settings",
251                 items=enum_use_layer_samples,
252                 default='USE',
253                 )
254
255         cls.sample_all_lights_direct = BoolProperty(
256                 name="Sample All Direct Lights",
257                 description="Sample all lights (for direct samples), rather than randomly picking one",
258                 default=True,
259                 )
260
261         cls.sample_all_lights_indirect = BoolProperty(
262                 name="Sample All Indirect Lights",
263                 description="Sample all lights (for indirect samples), rather than randomly picking one",
264                 default=True,
265                 )
266
267         cls.caustics_reflective = BoolProperty(
268                 name="Reflective Caustics",
269                 description="Use reflective caustics, resulting in a brighter image (more noise but added realism)",
270                 default=True,
271                 )
272
273         cls.caustics_refractive = BoolProperty(
274                 name="Refractive Caustics",
275                 description="Use refractive caustics, resulting in a brighter image (more noise but added realism)",
276                 default=True,
277                 )
278
279         cls.blur_glossy = FloatProperty(
280                 name="Filter Glossy",
281                 description="Adaptively blur glossy shaders after blurry bounces, "
282                             "to reduce noise at the cost of accuracy",
283                 min=0.0, max=10.0,
284                 default=0.0,
285                 )
286
287         cls.min_bounces = IntProperty(
288                 name="Min Bounces",
289                 description="Minimum number of bounces, setting this lower "
290                             "than the maximum enables probabilistic path "
291                             "termination (faster but noisier)",
292                 min=0, max=1024,
293                 default=3,
294                 )
295         cls.max_bounces = IntProperty(
296                 name="Max Bounces",
297                 description="Total maximum number of bounces",
298                 min=0, max=1024,
299                 default=12,
300                 )
301
302         cls.diffuse_bounces = IntProperty(
303                 name="Diffuse Bounces",
304                 description="Maximum number of diffuse reflection bounces, bounded by total maximum",
305                 min=0, max=1024,
306                 default=4,
307                 )
308         cls.glossy_bounces = IntProperty(
309                 name="Glossy Bounces",
310                 description="Maximum number of glossy reflection bounces, bounded by total maximum",
311                 min=0, max=1024,
312                 default=4,
313                 )
314         cls.transmission_bounces = IntProperty(
315                 name="Transmission Bounces",
316                 description="Maximum number of transmission bounces, bounded by total maximum",
317                 min=0, max=1024,
318                 default=12,
319                 )
320         cls.volume_bounces = IntProperty(
321                 name="Volume Bounces",
322                 description="Maximum number of volumetric scattering events",
323                 min=0, max=1024,
324                 default=0,
325                 )
326
327         cls.transparent_min_bounces = IntProperty(
328                 name="Transparent Min Bounces",
329                 description="Minimum number of transparent bounces, setting "
330                             "this lower than the maximum enables "
331                             "probabilistic path termination (faster but "
332                             "noisier)",
333                 min=0, max=1024,
334                 default=8,
335                 )
336         cls.transparent_max_bounces = IntProperty(
337                 name="Transparent Max Bounces",
338                 description="Maximum number of transparent bounces",
339                 min=0, max=1024,
340                 default=8,
341                 )
342         cls.use_transparent_shadows = BoolProperty(
343                 name="Transparent Shadows",
344                 description="Use transparency of surfaces for rendering shadows",
345                 default=True,
346                 )
347
348         cls.volume_step_size = FloatProperty(
349                 name="Step Size",
350                 description="Distance between volume shader samples when rendering the volume "
351                             "(lower values give more accurate and detailed results, but also increased render time)",
352                 default=0.1,
353                 min=0.0000001, max=100000.0, soft_min=0.01, soft_max=1.0
354                 )
355
356         cls.volume_max_steps = IntProperty(
357                 name="Max Steps",
358                 description="Maximum number of steps through the volume before giving up, "
359                             "to avoid extremely long render times with big objects or small step sizes",
360                 default=1024,
361                 min=2, max=65536
362                 )
363
364         cls.film_exposure = FloatProperty(
365                 name="Exposure",
366                 description="Image brightness scale",
367                 min=0.0, max=10.0,
368                 default=1.0,
369                 )
370         cls.film_transparent = BoolProperty(
371                 name="Transparent",
372                 description="World background is transparent with premultiplied alpha",
373                 default=False,
374                 )
375
376         cls.filter_type = EnumProperty(
377                 name="Filter Type",
378                 description="Pixel filter type",
379                 items=enum_filter_types,
380                 default='GAUSSIAN',
381                 )
382         cls.filter_width = FloatProperty(
383                 name="Filter Width",
384                 description="Pixel filter width",
385                 min=0.01, max=10.0,
386                 default=1.5,
387                 )
388
389         cls.seed = IntProperty(
390                 name="Seed",
391                 description="Seed value for integrator to get different noise patterns",
392                 min=0, max=2147483647,
393                 default=0,
394                 )
395
396         cls.sample_clamp_direct = FloatProperty(
397                 name="Clamp Direct",
398                 description="If non-zero, the maximum value for a direct sample, "
399                             "higher values will be scaled down to avoid too "
400                             "much noise and slow convergence at the cost of accuracy",
401                 min=0.0, max=1e8,
402                 default=0.0,
403                 )
404
405         cls.sample_clamp_indirect = FloatProperty(
406                 name="Clamp Indirect",
407                 description="If non-zero, the maximum value for an indirect 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.debug_tile_size = IntProperty(
415                 name="Tile Size",
416                 description="",
417                 min=1, max=4096,
418                 default=1024,
419                 )
420
421         cls.preview_start_resolution = IntProperty(
422                 name="Start Resolution",
423                 description="Resolution to start rendering preview at, "
424                             "progressively increasing it to the full viewport size",
425                 min=8, max=16384,
426                 default=64,
427                 )
428
429         cls.debug_reset_timeout = FloatProperty(
430                 name="Reset timeout",
431                 description="",
432                 min=0.01, max=10.0,
433                 default=0.1,
434                 )
435         cls.debug_cancel_timeout = FloatProperty(
436                 name="Cancel timeout",
437                 description="",
438                 min=0.01, max=10.0,
439                 default=0.1,
440                 )
441         cls.debug_text_timeout = FloatProperty(
442                 name="Text timeout",
443                 description="",
444                 min=0.01, max=10.0,
445                 default=1.0,
446                 )
447
448         cls.debug_bvh_type = EnumProperty(
449                 name="Viewport BVH Type",
450                 description="Choose between faster updates, or faster render",
451                 items=enum_bvh_types,
452                 default='DYNAMIC_BVH',
453                 )
454         cls.debug_use_spatial_splits = BoolProperty(
455                 name="Use Spatial Splits",
456                 description="Use BVH spatial splits: longer builder time, faster render",
457                 default=False,
458                 )
459         cls.use_qbvh = BoolProperty(
460                 name="Use QBVH",
461                 description="Use QBVH acceleration structure",
462                 default=True,
463                 )
464         cls.use_cache = BoolProperty(
465                 name="Cache BVH",
466                 description="Cache last built BVH to disk for faster re-render if no geometry changed",
467                 default=False,
468                 )
469         cls.tile_order = EnumProperty(
470                 name="Tile Order",
471                 description="Tile order for rendering",
472                 items=enum_tile_order,
473                 default='CENTER',
474                 options=set(),  # Not animatable!
475                 )
476         cls.use_progressive_refine = BoolProperty(
477                 name="Progressive Refine",
478                 description="Instead of rendering each tile until it is finished, "
479                             "refine the whole image progressively "
480                             "(this renders somewhat slower, "
481                             "but time can be saved by manually stopping the render when the noise is low enough)",
482                 default=False,
483                 )
484
485         cls.bake_type = EnumProperty(
486             name="Bake Type",
487             default='COMBINED',
488             description="Type of pass to bake",
489             items = (
490                 ('COMBINED', "Combined", ""),
491                 ('AO', "Ambient Occlusion", ""),
492                 ('SHADOW', "Shadow", ""),
493                 ('NORMAL', "Normal", ""),
494                 ('UV', "UV", ""),
495                 ('EMIT', "Emit", ""),
496                 ('ENVIRONMENT', "Environment", ""),
497                 ('DIFFUSE_DIRECT', "Diffuse Direct", ""),
498                 ('DIFFUSE_INDIRECT', "Diffuse Indirect", ""),
499                 ('DIFFUSE_COLOR', "Diffuse Color", ""),
500                 ('GLOSSY_DIRECT', "Glossy Direct", ""),
501                 ('GLOSSY_INDIRECT', "Glossy Indirect", ""),
502                 ('GLOSSY_COLOR', "Glossy Color", ""),
503                 ('TRANSMISSION_DIRECT', "Transmission Direct", ""),
504                 ('TRANSMISSION_INDIRECT', "Transmission Indirect", ""),
505                 ('TRANSMISSION_COLOR', "Transmission Color", ""),
506                 ('SUBSURFACE_DIRECT', "Subsurface Direct", ""),
507                 ('SUBSURFACE_INDIRECT', "Subsurface Indirect", ""),
508                 ('SUBSURFACE_COLOR', "Subsurface Color", ""),
509                 ),
510             )
511
512     @classmethod
513     def unregister(cls):
514         del bpy.types.Scene.cycles
515
516
517 class CyclesCameraSettings(bpy.types.PropertyGroup):
518     @classmethod
519     def register(cls):
520         import math
521
522         bpy.types.Camera.cycles = PointerProperty(
523                 name="Cycles Camera Settings",
524                 description="Cycles camera settings",
525                 type=cls,
526                 )
527
528         cls.aperture_type = EnumProperty(
529                 name="Aperture Type",
530                 description="Use F/stop number or aperture radius",
531                 items=enum_aperture_types,
532                 default='RADIUS',
533                 )
534         cls.aperture_fstop = FloatProperty(
535                 name="Aperture F/stop",
536                 description="F/stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
537                 min=0.0, soft_min=0.1, soft_max=64.0,
538                 default=5.6,
539                 step=10,
540                 precision=1,
541                 )
542         cls.aperture_size = FloatProperty(
543                 name="Aperture Size",
544                 description="Radius of the aperture for depth of field (higher values give more defocus)",
545                 min=0.0, soft_max=10.0,
546                 default=0.0,
547                 step=1,
548                 precision=4,
549                 subtype='DISTANCE',
550                 )
551         cls.aperture_blades = IntProperty(
552                 name="Aperture Blades",
553                 description="Number of blades in aperture for polygonal bokeh (at least 3)",
554                 min=0, max=100,
555                 default=0,
556                 )
557         cls.aperture_rotation = FloatProperty(
558                 name="Aperture Rotation",
559                 description="Rotation of blades in aperture",
560                 soft_min=-math.pi, soft_max=math.pi,
561                 subtype='ANGLE',
562                 default=0,
563                 )
564         cls.aperture_ratio = FloatProperty(
565                 name="Aperture Ratio",
566                 description="Distortion to simulate anamorphic lens bokeh",
567                 min=0.01, soft_min=1.0, soft_max=2.0,
568                 default=1.0,
569                 precision=4,
570                 )
571         cls.panorama_type = EnumProperty(
572                 name="Panorama Type",
573                 description="Distortion to use for the calculation",
574                 items=enum_panorama_types,
575                 default='FISHEYE_EQUISOLID',
576                 )
577         cls.fisheye_fov = FloatProperty(
578                 name="Field of View",
579                 description="Field of view for the fisheye lens",
580                 min=0.1745, soft_max=2.0 * math.pi, max=10.0 * math.pi,
581                 subtype='ANGLE',
582                 default=math.pi,
583                 )
584         cls.fisheye_lens = FloatProperty(
585                 name="Fisheye Lens",
586                 description="Lens focal length (mm)",
587                 min=0.01, soft_max=15.0, max=100.0,
588                 default=10.5,
589                 )
590
591     @classmethod
592     def unregister(cls):
593         del bpy.types.Camera.cycles
594
595
596 class CyclesMaterialSettings(bpy.types.PropertyGroup):
597     @classmethod
598     def register(cls):
599         bpy.types.Material.cycles = PointerProperty(
600                 name="Cycles Material Settings",
601                 description="Cycles material settings",
602                 type=cls,
603                 )
604         cls.sample_as_light = BoolProperty(
605                 name="Multiple Importance Sample",
606                 description="Use multiple importance sampling for this material, "
607                             "disabling may reduce overall noise for large "
608                             "objects that emit little light compared to other light sources",
609                 default=True,
610                 )
611         cls.use_transparent_shadow = BoolProperty(
612                 name="Transparent Shadows",
613                 description="Use transparent shadows for this material if it contains a Transparent BSDF, "
614                             "disabling will render faster but not give accurate shadows",
615                 default=True,
616                 )
617         cls.homogeneous_volume = BoolProperty(
618                 name="Homogeneous Volume",
619                 description="When using volume rendering, assume volume has the same density everywhere "
620                             "(not using any textures), for faster rendering",
621                 default=False,
622                 )
623         cls.volume_sampling = EnumProperty(
624                 name="Volume Sampling",
625                 description="Sampling method to use for volumes",
626                 items=enum_volume_sampling,
627                 default='DISTANCE',
628                 )
629
630         cls.volume_interpolation = EnumProperty(
631                 name="Volume Interpolation",
632                 description="Interpolation method to use for volumes",
633                 items=enum_volume_interpolation,
634                 default='LINEAR',
635                 )
636
637     @classmethod
638     def unregister(cls):
639         del bpy.types.Material.cycles
640
641
642 class CyclesLampSettings(bpy.types.PropertyGroup):
643     @classmethod
644     def register(cls):
645         bpy.types.Lamp.cycles = PointerProperty(
646                 name="Cycles Lamp Settings",
647                 description="Cycles lamp settings",
648                 type=cls,
649                 )
650         cls.cast_shadow = BoolProperty(
651                 name="Cast Shadow",
652                 description="Lamp casts shadows",
653                 default=True,
654                 )
655         cls.samples = IntProperty(
656                 name="Samples",
657                 description="Number of light samples to render for each AA sample",
658                 min=1, max=10000,
659                 default=1,
660                 )
661         cls.max_bounces = IntProperty(
662                 name="Max Bounces",
663                 description="Maximum number of bounces the light will contribute to the render",
664                 min=0, max=1024,
665                 default=1024,
666                 )
667         cls.use_multiple_importance_sampling = BoolProperty(
668                 name="Multiple Importance Sample",
669                 description="Use multiple importance sampling for the lamp, "
670                             "reduces noise for area lamps and sharp glossy materials",
671                 default=False,
672                 )
673
674     @classmethod
675     def unregister(cls):
676         del bpy.types.Lamp.cycles
677
678
679 class CyclesWorldSettings(bpy.types.PropertyGroup):
680     @classmethod
681     def register(cls):
682         bpy.types.World.cycles = PointerProperty(
683                 name="Cycles World Settings",
684                 description="Cycles world settings",
685                 type=cls,
686                 )
687         cls.sample_as_light = BoolProperty(
688                 name="Multiple Importance Sample",
689                 description="Use multiple importance sampling for the environment, "
690                             "enabling for non-solid colors is recommended",
691                 default=False,
692                 )
693         cls.sample_map_resolution = IntProperty(
694                 name="Map Resolution",
695                 description="Importance map size is resolution x resolution; "
696                             "higher values potentially produce less noise, at the cost of memory and speed",
697                 min=4, max=8096,
698                 default=256,
699                 )
700         cls.samples = IntProperty(
701                 name="Samples",
702                 description="Number of light samples to render for each AA sample",
703                 min=1, max=10000,
704                 default=4,
705                 )
706         cls.homogeneous_volume = BoolProperty(
707                 name="Homogeneous Volume",
708                 description="When using volume rendering, assume volume has the same density everywhere"
709                             "(not using any textures), for faster rendering",
710                 default=False,
711                 )
712         cls.volume_sampling = EnumProperty(
713                 name="Volume Sampling",
714                 description="Sampling method to use for volumes",
715                 items=enum_volume_sampling,
716                 default='EQUIANGULAR',
717                 )
718
719         cls.volume_interpolation = EnumProperty(
720                 name="Volume Interpolation",
721                 description="Interpolation method to use for volumes",
722                 items=enum_volume_interpolation,
723                 default='LINEAR',
724                 )
725
726     @classmethod
727     def unregister(cls):
728         del bpy.types.World.cycles
729
730
731 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
732     @classmethod
733     def register(cls):
734         bpy.types.Object.cycles_visibility = PointerProperty(
735                 name="Cycles Visibility Settings",
736                 description="Cycles visibility settings",
737                 type=cls,
738                 )
739
740         bpy.types.World.cycles_visibility = PointerProperty(
741                 name="Cycles Visibility Settings",
742                 description="Cycles visibility settings",
743                 type=cls,
744                 )
745
746         cls.camera = BoolProperty(
747                 name="Camera",
748                 description="Object visibility for camera rays",
749                 default=True,
750                 )
751         cls.diffuse = BoolProperty(
752                 name="Diffuse",
753                 description="Object visibility for diffuse reflection rays",
754                 default=True,
755                 )
756         cls.glossy = BoolProperty(
757                 name="Glossy",
758                 description="Object visibility for glossy reflection rays",
759                 default=True,
760                 )
761         cls.transmission = BoolProperty(
762                 name="Transmission",
763                 description="Object visibility for transmission rays",
764                 default=True,
765                 )
766         cls.shadow = BoolProperty(
767                 name="Shadow",
768                 description="Object visibility for shadow rays",
769                 default=True,
770                 )
771         cls.scatter = BoolProperty(
772                 name="Volume Scatter",
773                 description="Object visibility for volume scatter rays",
774                 default=True,
775                 )
776
777     @classmethod
778     def unregister(cls):
779         del bpy.types.Object.cycles_visibility
780         del bpy.types.World.cycles_visibility
781
782
783 class CyclesMeshSettings(bpy.types.PropertyGroup):
784     @classmethod
785     def register(cls):
786         bpy.types.Mesh.cycles = PointerProperty(
787                 name="Cycles Mesh Settings",
788                 description="Cycles mesh settings",
789                 type=cls,
790                 )
791         bpy.types.Curve.cycles = PointerProperty(
792                 name="Cycles Mesh Settings",
793                 description="Cycles mesh settings",
794                 type=cls,
795                 )
796         bpy.types.MetaBall.cycles = PointerProperty(
797                 name="Cycles Mesh Settings",
798                 description="Cycles mesh settings",
799                 type=cls,
800                 )
801
802         cls.displacement_method = EnumProperty(
803                 name="Displacement Method",
804                 description="Method to use for the displacement",
805                 items=enum_displacement_methods,
806                 default='BUMP',
807                 )
808         cls.use_subdivision = BoolProperty(
809                 name="Use Subdivision",
810                 description="Subdivide mesh for rendering",
811                 default=False,
812                 )
813         cls.dicing_rate = FloatProperty(
814                 name="Dicing Rate",
815                 description="",
816                 min=0.001, max=1000.0,
817                 default=1.0,
818                 )
819
820     @classmethod
821     def unregister(cls):
822         del bpy.types.Mesh.cycles
823         del bpy.types.Curve.cycles
824         del bpy.types.MetaBall.cycles
825
826
827 class CyclesObjectBlurSettings(bpy.types.PropertyGroup):
828
829     @classmethod
830     def register(cls):
831
832         bpy.types.Object.cycles = PointerProperty(
833                 name="Cycles Object Settings",
834                 description="Cycles object settings",
835                 type=cls,
836                 )
837
838         cls.use_motion_blur = BoolProperty(
839                 name="Use Motion Blur",
840                 description="Use motion blur for this object",
841                 default=True,
842                 )
843
844         cls.use_deform_motion = BoolProperty(
845                 name="Use Deformation Motion",
846                 description="Use deformation motion blur for this object",
847                 default=True,
848                 )
849
850         cls.motion_steps = IntProperty(
851                 name="Motion Steps",
852                 description="Control accuracy of deformation motion blur, more steps gives more memory usage (actual number of steps is 2^(steps - 1))",
853                 min=1, soft_max=8,
854                 default=1,
855                 )
856
857     @classmethod
858     def unregister(cls):
859         del bpy.types.Object.cycles
860
861
862 class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
863     @classmethod
864     def register(cls):
865         bpy.types.Scene.cycles_curves = PointerProperty(
866                 name="Cycles Hair Rendering Settings",
867                 description="Cycles hair rendering settings",
868                 type=cls,
869                 )
870         cls.primitive = EnumProperty(
871                 name="Primitive",
872                 description="Type of primitive used for hair rendering",
873                 items=enum_curve_primitives,
874                 default='LINE_SEGMENTS',
875                 )
876         cls.shape = EnumProperty(
877                 name="Shape",
878                 description="Form of hair",
879                 items=enum_curve_shape,
880                 default='THICK',
881                 )
882         cls.cull_backfacing = BoolProperty(
883                 name="Cull back-faces",
884                 description="Do not test the back-face of each strand",
885                 default=True,
886                 )
887         cls.use_curves = BoolProperty(
888                 name="Use Cycles Hair Rendering",
889                 description="Activate Cycles hair rendering for particle system",
890                 default=True,
891                 )
892         cls.resolution = IntProperty(
893                 name="Resolution",
894                 description="Resolution of generated mesh",
895                 min=3, max=64,
896                 default=3,
897                 )
898         cls.minimum_width = FloatProperty(
899                 name="Minimal width",
900                 description="Minimal pixel width for strands (0 - deactivated)",
901                 min=0.0, max=100.0,
902                 default=0.0,
903                 )
904         cls.maximum_width = FloatProperty(
905                 name="Maximal width",
906                 description="Maximum extension that strand radius can be increased by",
907                 min=0.0, max=100.0,
908                 default=0.1,
909                 )
910         cls.subdivisions = IntProperty(
911                 name="Subdivisions",
912                 description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
913                 min=0, max=24,
914                 default=4,
915                 )
916
917     @classmethod
918     def unregister(cls):
919         del bpy.types.Scene.cycles_curves
920
921
922 class CyclesCurveSettings(bpy.types.PropertyGroup):
923     @classmethod
924     def register(cls):
925         bpy.types.ParticleSettings.cycles = PointerProperty(
926                 name="Cycles Hair Settings",
927                 description="Cycles hair settings",
928                 type=cls,
929                 )
930         cls.radius_scale = FloatProperty(
931                 name="Radius Scaling",
932                 description="Multiplier of width properties",
933                 min=0.0, max=1000.0,
934                 default=0.01,
935                 )
936         cls.root_width = FloatProperty(
937                 name="Root Size",
938                 description="Strand's width at root",
939                 min=0.0, max=1000.0,
940                 default=1.0,
941                 )
942         cls.tip_width = FloatProperty(
943                 name="Tip Multiplier",
944                 description="Strand's width at tip",
945                 min=0.0, max=1000.0,
946                 default=0.0,
947                 )
948         cls.shape = FloatProperty(
949                 name="Strand Shape",
950                 description="Strand shape parameter",
951                 min=-1.0, max=1.0,
952                 default=0.0,
953                 )
954         cls.use_closetip = BoolProperty(
955                 name="Close tip",
956                 description="Set tip radius to zero",
957                 default=True,
958                 )
959
960     @classmethod
961     def unregister(cls):
962         del bpy.types.ParticleSettings.cycles
963
964
965 def register():
966     bpy.utils.register_class(CyclesRenderSettings)
967     bpy.utils.register_class(CyclesCameraSettings)
968     bpy.utils.register_class(CyclesMaterialSettings)
969     bpy.utils.register_class(CyclesLampSettings)
970     bpy.utils.register_class(CyclesWorldSettings)
971     bpy.utils.register_class(CyclesVisibilitySettings)
972     bpy.utils.register_class(CyclesMeshSettings)
973     bpy.utils.register_class(CyclesCurveRenderSettings)
974     bpy.utils.register_class(CyclesCurveSettings)
975
976
977 def unregister():
978     bpy.utils.unregister_class(CyclesRenderSettings)
979     bpy.utils.unregister_class(CyclesCameraSettings)
980     bpy.utils.unregister_class(CyclesMaterialSettings)
981     bpy.utils.unregister_class(CyclesLampSettings)
982     bpy.utils.unregister_class(CyclesWorldSettings)
983     bpy.utils.unregister_class(CyclesMeshSettings)
984     bpy.utils.unregister_class(CyclesVisibilitySettings)
985     bpy.utils.unregister_class(CyclesCurveRenderSettings)
986     bpy.utils.unregister_class(CyclesCurveSettings)