Usual i18n tweaks & fixes...
[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-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.tile_order = EnumProperty(
467                 name="Tile Order",
468                 description="Tile order for rendering",
469                 items=enum_tile_order,
470                 default='CENTER',
471                 options=set(),  # Not animatable!
472                 )
473         cls.use_progressive_refine = BoolProperty(
474                 name="Progressive Refine",
475                 description="Instead of rendering each tile until it is finished, "
476                             "refine the whole image progressively "
477                             "(this renders somewhat slower, "
478                             "but time can be saved by manually stopping the render when the noise is low enough)",
479                 default=False,
480                 )
481
482         cls.bake_type = EnumProperty(
483             name="Bake Type",
484             default='COMBINED',
485             description="Type of pass to bake",
486             items=(
487                 ('COMBINED', "Combined", ""),
488                 ('AO', "Ambient Occlusion", ""),
489                 ('SHADOW', "Shadow", ""),
490                 ('NORMAL', "Normal", ""),
491                 ('UV', "UV", ""),
492                 ('EMIT', "Emit", ""),
493                 ('ENVIRONMENT', "Environment", ""),
494                 ('DIFFUSE_DIRECT', "Diffuse Direct", ""),
495                 ('DIFFUSE_INDIRECT', "Diffuse Indirect", ""),
496                 ('DIFFUSE_COLOR', "Diffuse Color", ""),
497                 ('GLOSSY_DIRECT', "Glossy Direct", ""),
498                 ('GLOSSY_INDIRECT', "Glossy Indirect", ""),
499                 ('GLOSSY_COLOR', "Glossy Color", ""),
500                 ('TRANSMISSION_DIRECT', "Transmission Direct", ""),
501                 ('TRANSMISSION_INDIRECT', "Transmission Indirect", ""),
502                 ('TRANSMISSION_COLOR', "Transmission Color", ""),
503                 ('SUBSURFACE_DIRECT', "Subsurface Direct", ""),
504                 ('SUBSURFACE_INDIRECT', "Subsurface Indirect", ""),
505                 ('SUBSURFACE_COLOR', "Subsurface Color", ""),
506                 ),
507             )
508
509         cls.use_camera_cull = BoolProperty(
510                 name="Use Camera Cull",
511                 description="Allow objects to be culled based on the camera frustum",
512                 default=False,
513                 )
514
515         cls.camera_cull_margin = FloatProperty(
516                 name="Camera Cull Margin",
517                 description="Margin for the camera space culling",
518                 default=0.1,
519                 min=0.0, max=5.0
520                 )
521
522         cls.motion_blur_position = EnumProperty(
523             name="Motion Blur Position",
524             default='CENTER',
525             description="Offset for the shutter's time interval, allows to change the motion blur trails",
526             items=(
527                 ('START', "Start on Frame", "The shutter opens at the current frame"),
528                 ('CENTER', "Center on Frame", "The shutter is open during the current frame"),
529                 ('END', "End on Frame", "The shutter closes at the current frame"),
530                 ),
531             )
532
533     @classmethod
534     def unregister(cls):
535         del bpy.types.Scene.cycles
536
537
538 class CyclesCameraSettings(bpy.types.PropertyGroup):
539     @classmethod
540     def register(cls):
541         import math
542
543         bpy.types.Camera.cycles = PointerProperty(
544                 name="Cycles Camera Settings",
545                 description="Cycles camera settings",
546                 type=cls,
547                 )
548
549         cls.aperture_type = EnumProperty(
550                 name="Aperture Type",
551                 description="Use f-stop number or aperture radius",
552                 items=enum_aperture_types,
553                 default='RADIUS',
554                 )
555         cls.aperture_fstop = FloatProperty(
556                 name="Aperture f-stop",
557                 description="F-stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
558                 min=0.0, soft_min=0.1, soft_max=64.0,
559                 default=5.6,
560                 step=10,
561                 precision=1,
562                 )
563         cls.aperture_size = FloatProperty(
564                 name="Aperture Size",
565                 description="Radius of the aperture for depth of field (higher values give more defocus)",
566                 min=0.0, soft_max=10.0,
567                 default=0.0,
568                 step=1,
569                 precision=4,
570                 subtype='DISTANCE',
571                 )
572         cls.aperture_blades = IntProperty(
573                 name="Aperture Blades",
574                 description="Number of blades in aperture for polygonal bokeh (at least 3)",
575                 min=0, max=100,
576                 default=0,
577                 )
578         cls.aperture_rotation = FloatProperty(
579                 name="Aperture Rotation",
580                 description="Rotation of blades in aperture",
581                 soft_min=-math.pi, soft_max=math.pi,
582                 subtype='ANGLE',
583                 default=0,
584                 )
585         cls.aperture_ratio = FloatProperty(
586                 name="Aperture Ratio",
587                 description="Distortion to simulate anamorphic lens bokeh",
588                 min=0.01, soft_min=1.0, soft_max=2.0,
589                 default=1.0,
590                 precision=4,
591                 )
592         cls.panorama_type = EnumProperty(
593                 name="Panorama Type",
594                 description="Distortion to use for the calculation",
595                 items=enum_panorama_types,
596                 default='FISHEYE_EQUISOLID',
597                 )
598         cls.fisheye_fov = FloatProperty(
599                 name="Field of View",
600                 description="Field of view for the fisheye lens",
601                 min=0.1745, soft_max=2.0 * math.pi, max=10.0 * math.pi,
602                 subtype='ANGLE',
603                 default=math.pi,
604                 )
605         cls.fisheye_lens = FloatProperty(
606                 name="Fisheye Lens",
607                 description="Lens focal length (mm)",
608                 min=0.01, soft_max=15.0, max=100.0,
609                 default=10.5,
610                 )
611         cls.latitude_min = FloatProperty(
612                 name="Min Latitude",
613                 description="Minimum latitude (vertical angle) for the equirectangular lens",
614                 min=-0.5 * math.pi, max=0.5 * math.pi,
615                 subtype='ANGLE',
616                 default=-0.5 * math.pi,
617                 )
618         cls.latitude_max = FloatProperty(
619                 name="Max Latitude",
620                 description="Maximum latitude (vertical angle) for the equirectangular lens",
621                 min=-0.5 * math.pi, max=0.5 * math.pi,
622                 subtype='ANGLE',
623                 default=0.5 * math.pi,
624                 )
625         cls.longitude_min = FloatProperty(
626                 name="Min Longitude",
627                 description="Minimum longitude (horizontal angle) for the equirectangular lens",
628                 min=-math.pi, max=math.pi,
629                 subtype='ANGLE',
630                 default=-math.pi,
631                 )
632         cls.longitude_max = FloatProperty(
633                 name="Max Longitude",
634                 description="Maximum longitude (horizontal angle) for the equirectangular lens",
635                 min=-math.pi, max=math.pi,
636                 subtype='ANGLE',
637                 default=math.pi,
638                 )
639
640     @classmethod
641     def unregister(cls):
642         del bpy.types.Camera.cycles
643
644
645 class CyclesMaterialSettings(bpy.types.PropertyGroup):
646     @classmethod
647     def register(cls):
648         bpy.types.Material.cycles = PointerProperty(
649                 name="Cycles Material Settings",
650                 description="Cycles material settings",
651                 type=cls,
652                 )
653         cls.sample_as_light = BoolProperty(
654                 name="Multiple Importance Sample",
655                 description="Use multiple importance sampling for this material, "
656                             "disabling may reduce overall noise for large "
657                             "objects that emit little light compared to other light sources",
658                 default=True,
659                 )
660         cls.use_transparent_shadow = BoolProperty(
661                 name="Transparent Shadows",
662                 description="Use transparent shadows for this material if it contains a Transparent BSDF, "
663                             "disabling will render faster but not give accurate shadows",
664                 default=True,
665                 )
666         cls.homogeneous_volume = BoolProperty(
667                 name="Homogeneous Volume",
668                 description="When using volume rendering, assume volume has the same density everywhere "
669                             "(not using any textures), for faster rendering",
670                 default=False,
671                 )
672         cls.volume_sampling = EnumProperty(
673                 name="Volume Sampling",
674                 description="Sampling method to use for volumes",
675                 items=enum_volume_sampling,
676                 default='DISTANCE',
677                 )
678
679         cls.volume_interpolation = EnumProperty(
680                 name="Volume Interpolation",
681                 description="Interpolation method to use for smoke/fire volumes",
682                 items=enum_volume_interpolation,
683                 default='LINEAR',
684                 )
685
686     @classmethod
687     def unregister(cls):
688         del bpy.types.Material.cycles
689
690
691 class CyclesLampSettings(bpy.types.PropertyGroup):
692     @classmethod
693     def register(cls):
694         bpy.types.Lamp.cycles = PointerProperty(
695                 name="Cycles Lamp Settings",
696                 description="Cycles lamp settings",
697                 type=cls,
698                 )
699         cls.cast_shadow = BoolProperty(
700                 name="Cast Shadow",
701                 description="Lamp casts shadows",
702                 default=True,
703                 )
704         cls.samples = IntProperty(
705                 name="Samples",
706                 description="Number of light samples to render for each AA sample",
707                 min=1, max=10000,
708                 default=1,
709                 )
710         cls.max_bounces = IntProperty(
711                 name="Max Bounces",
712                 description="Maximum number of bounces the light will contribute to the render",
713                 min=0, max=1024,
714                 default=1024,
715                 )
716         cls.use_multiple_importance_sampling = BoolProperty(
717                 name="Multiple Importance Sample",
718                 description="Use multiple importance sampling for the lamp, "
719                             "reduces noise for area lamps and sharp glossy materials",
720                 default=False,
721                 )
722         cls.is_portal = BoolProperty(
723                 name="Is Portal",
724                 description="Use this area lamp to guide sampling of the background, "
725                             "note that this will make the lamp invisible",
726                 default=False,
727                 )
728
729     @classmethod
730     def unregister(cls):
731         del bpy.types.Lamp.cycles
732
733
734 class CyclesWorldSettings(bpy.types.PropertyGroup):
735     @classmethod
736     def register(cls):
737         bpy.types.World.cycles = PointerProperty(
738                 name="Cycles World Settings",
739                 description="Cycles world settings",
740                 type=cls,
741                 )
742         cls.sample_as_light = BoolProperty(
743                 name="Multiple Importance Sample",
744                 description="Use multiple importance sampling for the environment, "
745                             "enabling for non-solid colors is recommended",
746                 default=False,
747                 )
748         cls.sample_map_resolution = IntProperty(
749                 name="Map Resolution",
750                 description="Importance map size is resolution x resolution; "
751                             "higher values potentially produce less noise, at the cost of memory and speed",
752                 min=4, max=8192,
753                 default=256,
754                 )
755         cls.samples = IntProperty(
756                 name="Samples",
757                 description="Number of light samples to render for each AA sample",
758                 min=1, max=10000,
759                 default=4,
760                 )
761         cls.max_bounces = IntProperty(
762                 name="Max Bounces",
763                 description="Maximum number of bounces the background light will contribute to the render",
764                 min=0, max=1024,
765                 default=1024,
766                 )
767         cls.homogeneous_volume = BoolProperty(
768                 name="Homogeneous Volume",
769                 description="When using volume rendering, assume volume has the same density everywhere"
770                             "(not using any textures), for faster rendering",
771                 default=False,
772                 )
773         cls.volume_sampling = EnumProperty(
774                 name="Volume Sampling",
775                 description="Sampling method to use for volumes",
776                 items=enum_volume_sampling,
777                 default='EQUIANGULAR',
778                 )
779
780         cls.volume_interpolation = EnumProperty(
781                 name="Volume Interpolation",
782                 description="Interpolation method to use for volumes",
783                 items=enum_volume_interpolation,
784                 default='LINEAR',
785                 )
786
787     @classmethod
788     def unregister(cls):
789         del bpy.types.World.cycles
790
791
792 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
793     @classmethod
794     def register(cls):
795         bpy.types.Object.cycles_visibility = PointerProperty(
796                 name="Cycles Visibility Settings",
797                 description="Cycles visibility settings",
798                 type=cls,
799                 )
800
801         bpy.types.World.cycles_visibility = PointerProperty(
802                 name="Cycles Visibility Settings",
803                 description="Cycles visibility settings",
804                 type=cls,
805                 )
806
807         cls.camera = BoolProperty(
808                 name="Camera",
809                 description="Object visibility for camera rays",
810                 default=True,
811                 )
812         cls.diffuse = BoolProperty(
813                 name="Diffuse",
814                 description="Object visibility for diffuse reflection rays",
815                 default=True,
816                 )
817         cls.glossy = BoolProperty(
818                 name="Glossy",
819                 description="Object visibility for glossy reflection rays",
820                 default=True,
821                 )
822         cls.transmission = BoolProperty(
823                 name="Transmission",
824                 description="Object visibility for transmission rays",
825                 default=True,
826                 )
827         cls.shadow = BoolProperty(
828                 name="Shadow",
829                 description="Object visibility for shadow rays",
830                 default=True,
831                 )
832         cls.scatter = BoolProperty(
833                 name="Volume Scatter",
834                 description="Object visibility for volume scatter rays",
835                 default=True,
836                 )
837
838     @classmethod
839     def unregister(cls):
840         del bpy.types.Object.cycles_visibility
841         del bpy.types.World.cycles_visibility
842
843
844 class CyclesMeshSettings(bpy.types.PropertyGroup):
845     @classmethod
846     def register(cls):
847         bpy.types.Mesh.cycles = PointerProperty(
848                 name="Cycles Mesh Settings",
849                 description="Cycles mesh settings",
850                 type=cls,
851                 )
852         bpy.types.Curve.cycles = PointerProperty(
853                 name="Cycles Mesh Settings",
854                 description="Cycles mesh settings",
855                 type=cls,
856                 )
857         bpy.types.MetaBall.cycles = PointerProperty(
858                 name="Cycles Mesh Settings",
859                 description="Cycles mesh settings",
860                 type=cls,
861                 )
862
863         cls.displacement_method = EnumProperty(
864                 name="Displacement Method",
865                 description="Method to use for the displacement",
866                 items=enum_displacement_methods,
867                 default='BUMP',
868                 )
869         cls.use_subdivision = BoolProperty(
870                 name="Use Subdivision",
871                 description="Subdivide mesh for rendering",
872                 default=False,
873                 )
874         cls.dicing_rate = FloatProperty(
875                 name="Dicing Rate",
876                 description="",
877                 min=0.001, max=1000.0,
878                 default=1.0,
879                 )
880
881     @classmethod
882     def unregister(cls):
883         del bpy.types.Mesh.cycles
884         del bpy.types.Curve.cycles
885         del bpy.types.MetaBall.cycles
886
887
888 class CyclesObjectBlurSettings(bpy.types.PropertyGroup):
889
890     @classmethod
891     def register(cls):
892
893         bpy.types.Object.cycles = PointerProperty(
894                 name="Cycles Object Settings",
895                 description="Cycles object settings",
896                 type=cls,
897                 )
898
899         cls.use_motion_blur = BoolProperty(
900                 name="Use Motion Blur",
901                 description="Use motion blur for this object",
902                 default=True,
903                 )
904
905         cls.use_deform_motion = BoolProperty(
906                 name="Use Deformation Motion",
907                 description="Use deformation motion blur for this object",
908                 default=True,
909                 )
910
911         cls.motion_steps = IntProperty(
912                 name="Motion Steps",
913                 description="Control accuracy of deformation motion blur, more steps gives more memory usage (actual number of steps is 2^(steps - 1))",
914                 min=1, soft_max=8,
915                 default=1,
916                 )
917
918         cls.use_camera_cull = BoolProperty(
919                 name="Use Camera Cull",
920                 description="Allow this object and its duplicators to be culled by camera space culling",
921                 default=False,
922                 )
923
924     @classmethod
925     def unregister(cls):
926         del bpy.types.Object.cycles
927
928
929 class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
930     @classmethod
931     def register(cls):
932         bpy.types.Scene.cycles_curves = PointerProperty(
933                 name="Cycles Hair Rendering Settings",
934                 description="Cycles hair rendering settings",
935                 type=cls,
936                 )
937         cls.primitive = EnumProperty(
938                 name="Primitive",
939                 description="Type of primitive used for hair rendering",
940                 items=enum_curve_primitives,
941                 default='LINE_SEGMENTS',
942                 )
943         cls.shape = EnumProperty(
944                 name="Shape",
945                 description="Form of hair",
946                 items=enum_curve_shape,
947                 default='THICK',
948                 )
949         cls.cull_backfacing = BoolProperty(
950                 name="Cull back-faces",
951                 description="Do not test the back-face of each strand",
952                 default=True,
953                 )
954         cls.use_curves = BoolProperty(
955                 name="Use Cycles Hair Rendering",
956                 description="Activate Cycles hair rendering for particle system",
957                 default=True,
958                 )
959         cls.resolution = IntProperty(
960                 name="Resolution",
961                 description="Resolution of generated mesh",
962                 min=3, max=64,
963                 default=3,
964                 )
965         cls.minimum_width = FloatProperty(
966                 name="Minimal width",
967                 description="Minimal pixel width for strands (0 - deactivated)",
968                 min=0.0, max=100.0,
969                 default=0.0,
970                 )
971         cls.maximum_width = FloatProperty(
972                 name="Maximal width",
973                 description="Maximum extension that strand radius can be increased by",
974                 min=0.0, max=100.0,
975                 default=0.1,
976                 )
977         cls.subdivisions = IntProperty(
978                 name="Subdivisions",
979                 description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
980                 min=0, max=24,
981                 default=4,
982                 )
983
984     @classmethod
985     def unregister(cls):
986         del bpy.types.Scene.cycles_curves
987
988
989 class CyclesCurveSettings(bpy.types.PropertyGroup):
990     @classmethod
991     def register(cls):
992         bpy.types.ParticleSettings.cycles = PointerProperty(
993                 name="Cycles Hair Settings",
994                 description="Cycles hair settings",
995                 type=cls,
996                 )
997         cls.radius_scale = FloatProperty(
998                 name="Radius Scaling",
999                 description="Multiplier of width properties",
1000                 min=0.0, max=1000.0,
1001                 default=0.01,
1002                 )
1003         cls.root_width = FloatProperty(
1004                 name="Root Size",
1005                 description="Strand's width at root",
1006                 min=0.0, max=1000.0,
1007                 default=1.0,
1008                 )
1009         cls.tip_width = FloatProperty(
1010                 name="Tip Multiplier",
1011                 description="Strand's width at tip",
1012                 min=0.0, max=1000.0,
1013                 default=0.0,
1014                 )
1015         cls.shape = FloatProperty(
1016                 name="Strand Shape",
1017                 description="Strand shape parameter",
1018                 min=-1.0, max=1.0,
1019                 default=0.0,
1020                 )
1021         cls.use_closetip = BoolProperty(
1022                 name="Close tip",
1023                 description="Set tip radius to zero",
1024                 default=True,
1025                 )
1026
1027     @classmethod
1028     def unregister(cls):
1029         del bpy.types.ParticleSettings.cycles
1030
1031
1032 def register():
1033     bpy.utils.register_class(CyclesRenderSettings)
1034     bpy.utils.register_class(CyclesCameraSettings)
1035     bpy.utils.register_class(CyclesMaterialSettings)
1036     bpy.utils.register_class(CyclesLampSettings)
1037     bpy.utils.register_class(CyclesWorldSettings)
1038     bpy.utils.register_class(CyclesVisibilitySettings)
1039     bpy.utils.register_class(CyclesMeshSettings)
1040     bpy.utils.register_class(CyclesCurveRenderSettings)
1041     bpy.utils.register_class(CyclesCurveSettings)
1042
1043
1044 def unregister():
1045     bpy.utils.unregister_class(CyclesRenderSettings)
1046     bpy.utils.unregister_class(CyclesCameraSettings)
1047     bpy.utils.unregister_class(CyclesMaterialSettings)
1048     bpy.utils.unregister_class(CyclesLampSettings)
1049     bpy.utils.unregister_class(CyclesWorldSettings)
1050     bpy.utils.unregister_class(CyclesMeshSettings)
1051     bpy.utils.unregister_class(CyclesVisibilitySettings)
1052     bpy.utils.unregister_class(CyclesCurveRenderSettings)
1053     bpy.utils.unregister_class(CyclesCurveSettings)