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