code cleanup:
[blender.git] / intern / cycles / blender / addon / properties.py
1 #
2 # Copyright 2011, Blender Foundation.
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18
19 # <pep8 compliant>
20
21 import bpy
22 from bpy.props import (BoolProperty,
23                        EnumProperty,
24                        FloatProperty,
25                        IntProperty,
26                        PointerProperty)
27
28 # enums
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 enum_feature_set = (
35     ('SUPPORTED', "Supported", "Only use finished and supported features"),
36     ('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future"),
37     )
38
39 enum_displacement_methods = (
40     ('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"),
41     ('TRUE', "True", "Use true displacement only, requires fine subdivision"),
42     ('BOTH', "Both", "Combination of displacement and bump mapping"),
43     )
44
45 enum_bvh_types = (
46     ('DYNAMIC_BVH', "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
47     ('STATIC_BVH', "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
48     )
49
50 enum_filter_types = (
51     ('BOX', "Box", "Box filter"),
52     ('GAUSSIAN', "Gaussian", "Gaussian filter"),
53     )
54
55 enum_aperture_types = (
56     ('RADIUS', "Radius", "Directly change the size of the aperture"),
57     ('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
58     )
59
60 enum_panorama_types = (
61     ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
62     ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
63     ('FISHEYE_EQUISOLID', "Fisheye Equisolid",
64                           "Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
65     )
66
67 enum_curve_presets = (
68     ('CUSTOM', "Custom", "Set general parameters"),
69     ('TANGENT_SHADING', "Tangent Normal", "Use planar geometry and tangent normals"),
70     ('TRUE_NORMAL', "True Normal", "Use true normals (good for thin strands)"),
71     ('ACCURATE_PRESET', "Accurate", "Use best settings (suitable for glass materials)"),
72     )
73
74 enum_curve_primitives = (
75     ('TRIANGLES', "Triangles", "Create triangle geometry around strands"),
76     ('LINE_SEGMENTS', "Line Segments", "Use line segment primitives"),
77     ('CURVE_SEGMENTS', "Curve Segments", "Use segmented cardinal curve primitives"),
78     ('CURVE_RIBBONS', "Curve Ribbons", "Use smooth cardinal curve ribbon primitives"),
79     )
80
81 enum_triangle_curves = (
82     ('CAMERA_TRIANGLES', "Planes", "Create individual triangles forming planes that face camera"),
83     ('RIBBON_TRIANGLES', "Ribbons", "Create individual triangles forming ribbon"),
84     ('TESSELLATED_TRIANGLES', "Tessellated", "Create mesh surrounding each strand"),
85     )
86
87 enum_line_curves = (
88     ('ACCURATE', "Accurate", "Always take into consideration strand width for intersections"),
89     ('QT_CORRECTED', "Corrected", "Ignore width for initial intersection and correct later"),
90     ('ENDCORRECTED', "Correct found", "Ignore width for all intersections and only correct closest"),
91     ('QT_UNCORRECTED', "Uncorrected", "Calculate intersections without considering width"),
92     )
93
94 enum_curves_interpolation = (
95     ('LINEAR', "Linear interpolation", "Use Linear interpolation between segments"),
96     ('CARDINAL', "Cardinal interpolation", "Use cardinal interpolation between segments"),
97     ('BSPLINE', "B-spline interpolation", "Use b-spline interpolation between segments"),
98     )
99
100 enum_tile_order = (
101     ('CENTER', "Center", "Render from center to the edges"),
102     ('RIGHT_TO_LEFT', "Right to Left", "Render from right to left"),
103     ('LEFT_TO_RIGHT', "Left to Right", "Render from left to right"),
104     ('TOP_TO_BOTTOM', "Top to Bottom", "Render from top to bottom"),
105     ('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"),
106     )
107
108
109 class CyclesRenderSettings(bpy.types.PropertyGroup):
110     @classmethod
111     def register(cls):
112         bpy.types.Scene.cycles = PointerProperty(
113                 name="Cycles Render Settings",
114                 description="Cycles render settings",
115                 type=cls,
116                 )
117         cls.device = EnumProperty(
118                 name="Device",
119                 description="Device to use for rendering",
120                 items=enum_devices,
121                 default='CPU',
122                 )
123         cls.feature_set = EnumProperty(
124                 name="Feature Set",
125                 description="Feature set to use for rendering",
126                 items=enum_feature_set,
127                 default='SUPPORTED',
128                 )
129         cls.shading_system = BoolProperty(
130                 name="Open Shading Language",
131                 description="Use Open Shading Language (CPU rendering only)",
132                 )
133
134         cls.progressive = BoolProperty(
135                 name="Progressive",
136                 description="Use progressive sampling of lighting",
137                 default=True,
138                 )
139
140         cls.samples = IntProperty(
141                 name="Samples",
142                 description="Number of samples to render for each pixel",
143                 min=1, max=2147483647,
144                 default=10,
145                 )
146         cls.preview_samples = IntProperty(
147                 name="Preview Samples",
148                 description="Number of samples to render in the viewport, unlimited if 0",
149                 min=0, max=2147483647,
150                 default=10,
151                 )
152         cls.preview_pause = BoolProperty(
153                 name="Pause Preview",
154                 description="Pause all viewport preview renders",
155                 default=False,
156                 )
157         cls.preview_active_layer = BoolProperty(
158                 name="Preview Active Layer",
159                 description="Preview active render layer in viewport",
160                 default=False,
161                 )
162
163         cls.aa_samples = IntProperty(
164                 name="AA Samples",
165                 description="Number of antialiasing samples to render for each pixel",
166                 min=1, max=10000,
167                 default=4,
168                 )
169         cls.preview_aa_samples = IntProperty(
170                 name="AA Samples",
171                 description="Number of antialiasing samples to render in the viewport, unlimited if 0",
172                 min=0, max=10000,
173                 default=4,
174                 )
175         cls.diffuse_samples = IntProperty(
176                 name="Diffuse Samples",
177                 description="Number of diffuse bounce samples to render for each AA sample",
178                 min=1, max=10000,
179                 default=1,
180                 )
181         cls.glossy_samples = IntProperty(
182                 name="Glossy Samples",
183                 description="Number of glossy bounce samples to render for each AA sample",
184                 min=1, max=10000,
185                 default=1,
186                 )
187         cls.transmission_samples = IntProperty(
188                 name="Transmission Samples",
189                 description="Number of transmission bounce samples to render for each AA sample",
190                 min=1, max=10000,
191                 default=1,
192                 )
193         cls.ao_samples = IntProperty(
194                 name="Ambient Occlusion Samples",
195                 description="Number of ambient occlusion samples to render for each AA sample",
196                 min=1, max=10000,
197                 default=1,
198                 )
199         cls.mesh_light_samples = IntProperty(
200                 name="Mesh Light Samples",
201                 description="Number of mesh emission light samples to render for each AA sample",
202                 min=1, max=10000,
203                 default=1,
204                 )
205
206         cls.no_caustics = BoolProperty(
207                 name="No Caustics",
208                 description="Leave out caustics, resulting in a darker image with less noise",
209                 default=False,
210                 )
211         cls.blur_glossy = FloatProperty(
212                 name="Filter Glossy",
213                 description="Adaptively blur glossy shaders after blurry bounces, "
214                             "to reduce noise at the cost of accuracy",
215                 min=0.0, max=10.0,
216                 default=0.0,
217                 )
218
219         cls.min_bounces = IntProperty(
220                 name="Min Bounces",
221                 description="Minimum number of bounces, setting this lower "
222                             "than the maximum enables probabilistic path "
223                             "termination (faster but noisier)",
224                 min=0, max=1024,
225                 default=3,
226                 )
227         cls.max_bounces = IntProperty(
228                 name="Max Bounces",
229                 description="Total maximum number of bounces",
230                 min=0, max=1024,
231                 default=8,
232                 )
233
234         cls.diffuse_bounces = IntProperty(
235                 name="Diffuse Bounces",
236                 description="Maximum number of diffuse reflection bounces, bounded by total maximum",
237                 min=0, max=1024,
238                 default=128,
239                 )
240         cls.glossy_bounces = IntProperty(
241                 name="Glossy Bounces",
242                 description="Maximum number of glossy reflection bounces, bounded by total maximum",
243                 min=0, max=1024,
244                 default=128,
245                 )
246         cls.transmission_bounces = IntProperty(
247                 name="Transmission Bounces",
248                 description="Maximum number of transmission bounces, bounded by total maximum",
249                 min=0, max=1024,
250                 default=128,
251                 )
252
253         cls.transparent_min_bounces = IntProperty(
254                 name="Transparent Min Bounces",
255                 description="Minimum number of transparent bounces, setting "
256                             "this lower than the maximum enables "
257                             "probabilistic path termination (faster but "
258                             "noisier)",
259                 min=0, max=1024,
260                 default=8,
261                 )
262         cls.transparent_max_bounces = IntProperty(
263                 name="Transparent Max Bounces",
264                 description="Maximum number of transparent bounces",
265                 min=0, max=1024,
266                 default=8,
267                 )
268         cls.use_transparent_shadows = BoolProperty(
269                 name="Transparent Shadows",
270                 description="Use transparency of surfaces for rendering shadows",
271                 default=True,
272                 )
273
274         cls.film_exposure = FloatProperty(
275                 name="Exposure",
276                 description="Image brightness scale",
277                 min=0.0, max=10.0,
278                 default=1.0,
279                 )
280         cls.film_transparent = BoolProperty(
281                 name="Transparent",
282                 description="World background is transparent with premultiplied alpha",
283                 default=False,
284                 )
285
286         cls.filter_type = EnumProperty(
287                 name="Filter Type",
288                 description="Pixel filter type",
289                 items=enum_filter_types,
290                 default='GAUSSIAN',
291                 )
292         cls.filter_width = FloatProperty(
293                 name="Filter Width",
294                 description="Pixel filter width",
295                 min=0.01, max=10.0,
296                 default=1.5,
297                 )
298
299         cls.seed = IntProperty(
300                 name="Seed",
301                 description="Seed value for integrator to get different noise patterns",
302                 min=0, max=2147483647,
303                 default=0,
304                 )
305
306         cls.sample_clamp = FloatProperty(
307                 name="Clamp",
308                 description="If non-zero, the maximum value for a sample, "
309                             "higher values will be scaled down to avoid too "
310                             "much noise and slow convergence at the cost of accuracy",
311                 min=0.0, max=1e8,
312                 default=0.0,
313                 )
314
315         cls.debug_tile_size = IntProperty(
316                 name="Tile Size",
317                 description="",
318                 min=1, max=4096,
319                 default=1024,
320                 )
321
322         cls.preview_start_resolution = IntProperty(
323                 name="Start Resolution",
324                 description="Resolution to start rendering preview at, "
325                             "progressively increasing it to the full viewport size",
326                 min=8, max=16384,
327                 default=64,
328                 )
329
330         cls.debug_reset_timeout = FloatProperty(
331                 name="Reset timeout",
332                 description="",
333                 min=0.01, max=10.0,
334                 default=0.1,
335                 )
336         cls.debug_cancel_timeout = FloatProperty(
337                 name="Cancel timeout",
338                 description="",
339                 min=0.01, max=10.0,
340                 default=0.1,
341                 )
342         cls.debug_text_timeout = FloatProperty(
343                 name="Text timeout",
344                 description="",
345                 min=0.01, max=10.0,
346                 default=1.0,
347                 )
348
349         cls.debug_bvh_type = EnumProperty(
350                 name="Viewport BVH Type",
351                 description="Choose between faster updates, or faster render",
352                 items=enum_bvh_types,
353                 default='DYNAMIC_BVH',
354                 )
355         cls.debug_use_spatial_splits = BoolProperty(
356                 name="Use Spatial Splits",
357                 description="Use BVH spatial splits: longer builder time, faster render",
358                 default=False,
359                 )
360         cls.use_cache = BoolProperty(
361                 name="Cache BVH",
362                 description="Cache last built BVH to disk for faster re-render if no geometry changed",
363                 default=False,
364                 )
365         cls.tile_order = EnumProperty(
366                 name="Tile Order",
367                 description="Tile order for rendering",
368                 items=enum_tile_order,
369                 default='CENTER',
370                 )
371         cls.use_progressive_refine = BoolProperty(
372                 name="Progressive Refine",
373                 description="Instead of rendering each tile until it is finished, "
374                             "refine the whole image progressively "
375                             "(this renders somewhat slower, "
376                             "but time can be saved by manually stopping the render when the noise is low enough)",
377                 default=False,
378                 )
379
380     @classmethod
381     def unregister(cls):
382         del bpy.types.Scene.cycles
383
384
385 class CyclesCameraSettings(bpy.types.PropertyGroup):
386     @classmethod
387     def register(cls):
388         import math
389
390         bpy.types.Camera.cycles = PointerProperty(
391                 name="Cycles Camera Settings",
392                 description="Cycles camera settings",
393                 type=cls,
394                 )
395
396         cls.aperture_type = EnumProperty(
397                 name="Aperture Type",
398                 description="Use F/stop number or aperture radius",
399                 items=enum_aperture_types,
400                 default='RADIUS',
401                 )
402         cls.aperture_fstop = FloatProperty(
403                 name="Aperture F/stop",
404                 description="F/stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
405                 min=0.0, soft_min=0.1, soft_max=64.0,
406                 default=5.6,
407                 step=10,
408                 precision=1,
409                 )
410         cls.aperture_size = FloatProperty(
411                 name="Aperture Size",
412                 description="Radius of the aperture for depth of field (higher values give more defocus)",
413                 min=0.0, soft_max=10.0,
414                 default=0.0,
415                 step=1,
416                 precision=4,
417                 )
418         cls.aperture_blades = IntProperty(
419                 name="Aperture Blades",
420                 description="Number of blades in aperture for polygonal bokeh (at least 3)",
421                 min=0, max=100,
422                 default=0,
423                 )
424         cls.aperture_rotation = FloatProperty(
425                 name="Aperture Rotation",
426                 description="Rotation of blades in aperture",
427                 soft_min=-math.pi, soft_max=math.pi,
428                 subtype='ANGLE',
429                 default=0,
430                 )
431         cls.panorama_type = EnumProperty(
432                 name="Panorama Type",
433                 description="Distortion to use for the calculation",
434                 items=enum_panorama_types,
435                 default='FISHEYE_EQUISOLID',
436                 )
437         cls.fisheye_fov = FloatProperty(
438                 name="Field of View",
439                 description="Field of view for the fisheye lens",
440                 min=0.1745, soft_max=2 * math.pi, max=10.0 * math.pi,
441                 subtype='ANGLE',
442                 default=math.pi,
443                 )
444         cls.fisheye_lens = FloatProperty(
445                 name="Fisheye Lens",
446                 description="Lens focal length (mm)",
447                 min=0.01, soft_max=15.0, max=100.0,
448                 default=10.5,
449                 )
450
451     @classmethod
452     def unregister(cls):
453         del bpy.types.Camera.cycles
454
455
456 class CyclesMaterialSettings(bpy.types.PropertyGroup):
457     @classmethod
458     def register(cls):
459         bpy.types.Material.cycles = PointerProperty(
460                 name="Cycles Material Settings",
461                 description="Cycles material settings",
462                 type=cls,
463                 )
464         cls.sample_as_light = BoolProperty(
465                 name="Sample as Lamp",
466                 description="Use direct light sampling for this material, "
467                             "disabling may reduce overall noise for large "
468                             "objects that emit little light compared to other light sources",
469                 default=True,
470                 )
471         cls.homogeneous_volume = BoolProperty(
472                 name="Homogeneous Volume",
473                 description="When using volume rendering, assume volume has the same density everywhere, "
474                             "for faster rendering",
475                 default=False,
476                 )
477
478     @classmethod
479     def unregister(cls):
480         del bpy.types.Material.cycles
481
482
483 class CyclesLampSettings(bpy.types.PropertyGroup):
484     @classmethod
485     def register(cls):
486         bpy.types.Lamp.cycles = PointerProperty(
487                 name="Cycles Lamp Settings",
488                 description="Cycles lamp settings",
489                 type=cls,
490                 )
491         cls.cast_shadow = BoolProperty(
492                 name="Cast Shadow",
493                 description="Lamp casts shadows",
494                 default=True,
495                 )
496         cls.samples = IntProperty(
497                 name="Samples",
498                 description="Number of light samples to render for each AA sample",
499                 min=1, max=10000,
500                 default=1,
501                 )
502
503     @classmethod
504     def unregister(cls):
505         del bpy.types.Lamp.cycles
506
507
508 class CyclesWorldSettings(bpy.types.PropertyGroup):
509     @classmethod
510     def register(cls):
511         bpy.types.World.cycles = PointerProperty(
512                 name="Cycles World Settings",
513                 description="Cycles world settings",
514                 type=cls,
515                 )
516         cls.sample_as_light = BoolProperty(
517                 name="Sample as Lamp",
518                 description="Use direct light sampling for the environment, "
519                             "enabling for non-solid colors is recommended",
520                 default=False,
521                 )
522         cls.sample_map_resolution = IntProperty(
523                 name="Map Resolution",
524                 description="Importance map size is resolution x resolution; "
525                             "higher values potentially produce less noise, at the cost of memory and speed",
526                 min=4, max=8096,
527                 default=256,
528                 )
529         cls.samples = IntProperty(
530                 name="Samples",
531                 description="Number of light samples to render for each AA sample",
532                 min=1, max=10000,
533                 default=4,
534                 )
535
536     @classmethod
537     def unregister(cls):
538         del bpy.types.World.cycles
539
540
541 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
542     @classmethod
543     def register(cls):
544         bpy.types.Object.cycles_visibility = PointerProperty(
545                 name="Cycles Visibility Settings",
546                 description="Cycles visibility settings",
547                 type=cls,
548                 )
549
550         cls.camera = BoolProperty(
551                 name="Camera",
552                 description="Object visibility for camera rays",
553                 default=True,
554                 )
555         cls.diffuse = BoolProperty(
556                 name="Diffuse",
557                 description="Object visibility for diffuse reflection rays",
558                 default=True,
559                 )
560         cls.glossy = BoolProperty(
561                 name="Glossy",
562                 description="Object visibility for glossy reflection rays",
563                 default=True,
564                 )
565         cls.transmission = BoolProperty(
566                 name="Transmission",
567                 description="Object visibility for transmission rays",
568                 default=True,
569                 )
570         cls.shadow = BoolProperty(
571                 name="Shadow",
572                 description="Object visibility for shadow rays",
573                 default=True,
574                 )
575
576     @classmethod
577     def unregister(cls):
578         del bpy.types.Object.cycles_visibility
579
580
581 class CyclesMeshSettings(bpy.types.PropertyGroup):
582     @classmethod
583     def register(cls):
584         bpy.types.Mesh.cycles = PointerProperty(
585                 name="Cycles Mesh Settings",
586                 description="Cycles mesh settings",
587                 type=cls,
588                 )
589         bpy.types.Curve.cycles = PointerProperty(
590                 name="Cycles Mesh Settings",
591                 description="Cycles mesh settings",
592                 type=cls,
593                 )
594         bpy.types.MetaBall.cycles = PointerProperty(
595                 name="Cycles Mesh Settings",
596                 description="Cycles mesh settings",
597                 type=cls,
598                 )
599
600         cls.displacement_method = EnumProperty(
601                 name="Displacement Method",
602                 description="Method to use for the displacement",
603                 items=enum_displacement_methods,
604                 default='BUMP',
605                 )
606         cls.use_subdivision = BoolProperty(
607                 name="Use Subdivision",
608                 description="Subdivide mesh for rendering",
609                 default=False,
610                 )
611         cls.dicing_rate = FloatProperty(
612                 name="Dicing Rate",
613                 description="",
614                 min=0.001, max=1000.0,
615                 default=1.0,
616                 )
617
618     @classmethod
619     def unregister(cls):
620         del bpy.types.Mesh.cycles
621         del bpy.types.Curve.cycles
622         del bpy.types.MetaBall.cycles
623
624
625 class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
626     @classmethod
627     def register(cls):
628         bpy.types.Scene.cycles_curves = PointerProperty(
629                 name="Cycles Hair Rendering Settings",
630                 description="Cycles hair rendering settings",
631                 type=cls,
632                 )
633         cls.preset = EnumProperty(
634                 name="Mode",
635                 description="Hair rendering mode",
636                 items=enum_curve_presets,
637                 default='TRUE_NORMAL',
638                 )
639         cls.primitive = EnumProperty(
640                 name="Primitive",
641                 description="Type of primitive used for hair rendering",
642                 items=enum_curve_primitives,
643                 default='LINE_SEGMENTS',
644                 )
645         cls.triangle_method = EnumProperty(
646                 name="Mesh Geometry",
647                 description="Method for creating triangle geometry",
648                 items=enum_triangle_curves,
649                 default='CAMERA_TRIANGLES',
650                 )
651         cls.line_method = EnumProperty(
652                 name="Intersection Method",
653                 description="Method for line segment intersection",
654                 items=enum_line_curves,
655                 default='ACCURATE',
656                 )
657         cls.interpolation = EnumProperty(
658                 name="Interpolation",
659                 description="Interpolation method",
660                 items=enum_curves_interpolation,
661                 default='BSPLINE',
662                 )
663         cls.use_backfacing = BoolProperty(
664                 name="Check back-faces",
665                 description="Test back-faces of strands",
666                 default=False,
667                 )
668         cls.use_encasing = BoolProperty(
669                 name="Exclude encasing",
670                 description="Ignore strands encasing a ray's initial location",
671                 default=True,
672                 )
673         cls.use_tangent_normal_geometry = BoolProperty(
674                 name="Tangent normal geometry",
675                 description="Use the tangent normal for actual normal",
676                 default=False,
677                 )
678         cls.use_tangent_normal = BoolProperty(
679                 name="Tangent normal default",
680                 description="Use the tangent normal for all normals",
681                 default=False,
682                 )
683         cls.use_tangent_normal_correction = BoolProperty(
684                 name="Strand slope correction",
685                 description="Correct the tangent normal for the strand's slope",
686                 default=False,
687                 )
688         cls.use_cache = BoolProperty(
689                 name="Export Cached data",
690                 default=True,
691                 )
692         cls.use_parents = BoolProperty(
693                 name="Use parent strands",
694                 description="Use parents with children",
695                 default=False,
696                 )
697         cls.use_smooth = BoolProperty(
698                 name="Smooth Strands",
699                 description="Use vertex normals",
700                 default=True,
701                 )
702         cls.use_joined = BoolProperty(
703                 name="Join",
704                 description="Fill gaps between segments (requires more memory)",
705                 default=False,
706                 )
707         cls.use_curves = BoolProperty(
708                 name="Use Cycles Hair Rendering",
709                 description="Activate Cycles hair rendering for particle system",
710                 default=True,
711                 )
712         cls.segments = IntProperty(
713                 name="Segments",
714                 description="Number of segments between path keys (note that this combines with the 'draw step' value)",
715                 min=1, max=64,
716                 default=1,
717                 )
718         cls.resolution = IntProperty(
719                 name="Resolution",
720                 description="Resolution of generated mesh",
721                 min=3, max=64,
722                 default=3,
723                 )
724         cls.normalmix = FloatProperty(
725                 name="Normal mix",
726                 description="Scale factor for tangent normal removal (zero gives ray normal)",
727                 min=0, max=2.0,
728                 default=1,
729                 )
730         cls.encasing_ratio = FloatProperty(
731                 name="Encasing ratio",
732                 description="Scale factor for encasing strand width",
733                 min=0, max=100.0,
734                 default=1.01,
735                 )
736         cls.subdivisions = IntProperty(
737                 name="Subdivisions",
738                 description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
739                 min=0, max=24,
740                 default=3,
741                 )
742
743     @classmethod
744     def unregister(cls):
745         del bpy.types.Scene.cycles_curves
746
747
748 class CyclesCurveSettings(bpy.types.PropertyGroup):
749     @classmethod
750     def register(cls):
751         bpy.types.ParticleSettings.cycles = PointerProperty(
752                 name="Cycles Hair Settings",
753                 description="Cycles hair settings",
754                 type=cls,
755                 )
756         cls.root_width = FloatProperty(
757                 name="Root Size Multiplier",
758                 description="Multiplier of particle size for the strand's width at root",
759                 min=0.0, max=1000.0,
760                 default=1.0,
761                 )
762         cls.tip_width = FloatProperty(
763                 name="Tip Size Multiplier",
764                 description="Multiplier of particle size for the strand's width at tip",
765                 min=0.0, max=1000.0,
766                 default=0.0,
767                 )
768         cls.shape = FloatProperty(
769                 name="Strand Shape",
770                 description="Strand shape parameter",
771                 min=-1.0, max=1.0,
772                 default=0.0,
773                 )
774         cls.use_closetip = BoolProperty(
775                 name="Close tip",
776                 description="Set tip radius to zero",
777                 default=True,
778                 )
779
780     @classmethod
781     def unregister(cls):
782         del bpy.types.ParticleSettings.cycles
783
784
785 def register():
786     bpy.utils.register_class(CyclesRenderSettings)
787     bpy.utils.register_class(CyclesCameraSettings)
788     bpy.utils.register_class(CyclesMaterialSettings)
789     bpy.utils.register_class(CyclesLampSettings)
790     bpy.utils.register_class(CyclesWorldSettings)
791     bpy.utils.register_class(CyclesVisibilitySettings)
792     bpy.utils.register_class(CyclesMeshSettings)
793     bpy.utils.register_class(CyclesCurveRenderSettings)
794     bpy.utils.register_class(CyclesCurveSettings)
795
796
797 def unregister():
798     bpy.utils.unregister_class(CyclesRenderSettings)
799     bpy.utils.unregister_class(CyclesCameraSettings)
800     bpy.utils.unregister_class(CyclesMaterialSettings)
801     bpy.utils.unregister_class(CyclesLampSettings)
802     bpy.utils.unregister_class(CyclesWorldSettings)
803     bpy.utils.unregister_class(CyclesMeshSettings)
804     bpy.utils.unregister_class(CyclesVisibilitySettings)
805     bpy.utils.unregister_class(CyclesCurveRenderSettings)
806     bpy.utils.unregister_class(CyclesCurveSettings)