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