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