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