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