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