d5f475bcdc89ec0d94d863ab8484606aa77a1d2f
[blender-staging.git] / release / scripts / ui / properties_texture.py
1 # This software is distributable under the terms of the GNU
2 # General Public License (GPL) v2, the text of which can be found at
3 # http://www.gnu.org/copyleft/gpl.html. Installing, importing or otherwise
4 # using this module constitutes acceptance of the terms of this License.
5
6 import bpy
7
8 def active_node_mat(mat):
9     if mat:
10         mat_node = mat.active_node_material
11         if mat_node:
12             return mat_node
13         else:
14             return mat
15
16     return None
17
18 def context_tex_datablock(context):
19
20         idblock = active_node_mat(context.material)
21         if idblock: return idblock
22
23         idblock =       context.lamp
24         if idblock: return idblock
25
26         idblock =       context.world
27         if idblock: return idblock
28
29         idblock =       context.brush
30         return idblock
31
32 class TextureButtonsPanel(bpy.types.Panel):
33     bl_space_type = 'PROPERTIES'
34     bl_region_type = 'WINDOW'
35     bl_context = "texture"
36
37     def poll(self, context):
38         tex = context.texture
39         return (tex and (tex.type != 'NONE' or tex.use_nodes))
40
41 class TEXTURE_PT_preview(TextureButtonsPanel):
42     bl_label = "Preview"
43
44     def draw(self, context):
45         layout = self.layout
46
47         tex = context.texture
48         slot = context.texture_slot
49
50         idblock = context_tex_datablock(context)
51
52         if idblock:
53             layout.template_preview(tex, parent=idblock, slot=slot)
54         else:
55             layout.template_preview(tex, slot=slot)
56
57 class TEXTURE_PT_context_texture(TextureButtonsPanel):
58     bl_label = ""
59     bl_show_header = False
60
61     def poll(self, context):
62         return (context.material or context.world or context.lamp or context.brush or context.texture)
63
64     def draw(self, context):
65         layout = self.layout
66
67         tex = context.texture
68
69         idblock = context_tex_datablock(context)
70
71         space = context.space_data
72
73         if idblock:
74             row = layout.row()
75
76             row.template_list(idblock, "textures", idblock, "active_texture_index", rows=2)
77
78             col = row.column(align=True)
79             col.item_enumO("texture.slot_move", "type", 'UP', text="", icon='ICON_TRIA_UP')
80             col.item_enumO("texture.slot_move", "type", 'DOWN', text="", icon='ICON_TRIA_DOWN')
81
82
83         split = layout.split(percentage=0.65)
84
85         if idblock:
86             split.template_ID(idblock, "active_texture", new="texture.new")
87         elif tex:
88             split.template_ID(space, "pin_id")
89
90         if (not space.pin_id) and (
91             context.sculpt_object or
92             context.vertex_paint_object or
93             context.weight_paint_object or
94             context.texture_paint_object
95         ):
96             split.itemR(space, "brush_texture", text="Brush", toggle=True)
97
98         if tex:
99             layout.itemR(tex, "use_nodes")
100
101             split = layout.split(percentage=0.2)
102
103             if tex.use_nodes:
104                 slot = context.texture_slot
105
106                 if slot:
107                     split.itemL(text="Output:")
108                     split.itemR(slot, "output_node", text="")
109
110             else:
111                 split.itemL(text="Type:")
112                 split.itemR(tex, "type", text="")
113
114 class TEXTURE_PT_colors(TextureButtonsPanel):
115     bl_label = "Colors"
116     bl_default_closed = True
117
118     def draw(self, context):
119         layout = self.layout
120
121         tex = context.texture
122
123         layout.itemR(tex, "use_color_ramp", text="Ramp")
124         if tex.use_color_ramp:
125             layout.template_color_ramp(tex, "color_ramp", expand=True)
126
127         split = layout.split()
128
129         col = split.column()
130         col.itemL(text="RGB Multiply:")
131         sub = col.column(align=True)
132         sub.itemR(tex, "factor_red", text="R")
133         sub.itemR(tex, "factor_green", text="G")
134         sub.itemR(tex, "factor_blue", text="B")
135
136         col = split.column()
137         col.itemL(text="Adjust:")
138         col.itemR(tex, "brightness")
139         col.itemR(tex, "contrast")
140
141 # Texture Slot Panels #
142
143 class TextureSlotPanel(TextureButtonsPanel):
144     def poll(self, context):
145         return (
146             context.texture_slot and
147             TextureButtonsPanel.poll(self, context)
148         )
149
150 class TEXTURE_PT_mapping(TextureSlotPanel):
151     bl_label = "Mapping"
152
153     def draw(self, context):
154         layout = self.layout
155
156         idblock = context_tex_datablock(context)
157
158         tex = context.texture_slot
159         textype = context.texture
160
161         if type(idblock) != bpy.types.Brush:
162             split = layout.split(percentage=0.3)
163             col = split.column()
164             col.itemL(text="Coordinates:")
165             col = split.column()
166             col.itemR(tex, "texture_coordinates", text="")
167
168             if tex.texture_coordinates == 'ORCO':
169                 """
170                 ob = context.object
171                 if ob and ob.type == 'MESH':
172                     split = layout.split(percentage=0.3)
173                     split.itemL(text="Mesh:")
174                     split.itemR(ob.data, "texco_mesh", text="")
175                 """
176             elif tex.texture_coordinates == 'UV':
177                 split = layout.split(percentage=0.3)
178                 split.itemL(text="Layer:")
179                 ob = context.object
180                 if ob and ob.type == 'MESH': split.item_pointerR(tex, "uv_layer", ob.data, "uv_textures", text="")
181                 else: split.itemR(tex, "uv_layer", text="")
182             elif tex.texture_coordinates == 'OBJECT':
183                 split = layout.split(percentage=0.3)
184                 split.itemL(text="Object:")
185                 split.itemR(tex, "object", text="")
186
187         if type(idblock) == bpy.types.Brush:
188             layout.itemR(tex, "map_mode", expand=True)
189
190             row = layout.row()
191             row.active = tex.map_mode in ('FIXED', 'TILED')
192             row.itemR(tex, "angle")
193
194             row = layout.row()
195             row.active = tex.map_mode in ('TILED', '3D')
196             row.column().itemR(tex, "size")
197         else:
198             if type(idblock) == bpy.types.Material:
199                 split = layout.split(percentage=0.3)
200                 split.itemL(text="Projection:")
201                 split.itemR(tex, "mapping", text="")
202
203                 split = layout.split()
204
205                 col = split.column()
206                 if tex.texture_coordinates in ('ORCO', 'UV'):
207                     col.itemR(tex, "from_dupli")
208                 elif tex.texture_coordinates == 'OBJECT':
209                     col.itemR(tex, "from_original")
210                 else:
211                     col.itemL()
212
213                 col = split.column()
214                 row = col.row()
215                 row.itemR(tex, "x_mapping", text="")
216                 row.itemR(tex, "y_mapping", text="")
217                 row.itemR(tex, "z_mapping", text="")
218
219             # any non brush
220             row = layout.row()
221             row.column().itemR(tex, "offset")
222             row.column().itemR(tex, "size")
223
224
225 class TEXTURE_PT_influence(TextureSlotPanel):
226     bl_label = "Influence"
227     def poll(self, context):
228         return context.texture_slot
229
230
231     def draw(self, context):
232
233         layout = self.layout
234
235         idblock = context_tex_datablock(context)
236
237         textype = context.texture
238         tex = context.texture_slot
239
240         def factor_but(layout, active, toggle, factor, name):
241             row = layout.row(align=True)
242             row.itemR(tex, toggle, text="")
243             sub = row.row()
244             sub.active = active
245             sub.itemR(tex, factor, text=name, slider=True)
246
247         if type(idblock) == bpy.types.Material:
248             if idblock.type in ('SURFACE', 'HALO', 'WIRE'):
249                 split = layout.split()
250
251                 col = split.column()
252                 col.itemL(text="Diffuse:")
253                 factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity")
254                 factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color")
255                 factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha")
256                 factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency")
257
258                 col.itemL(text="Specular:")
259                 factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity")
260                 factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color")
261                 factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness")
262
263                 col = split.column()
264                 col.itemL(text="Shading:")
265                 factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient")
266                 factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit")
267                 factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror")
268                 factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror")
269
270                 col.itemL(text="Geometry:")
271                 factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal")
272                 factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp")
273                 factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace")
274
275                 #sub = col.column()
276                 #sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
277                 #sub.itemR(tex, "default_value", text="Amount", slider=True)
278             elif idblock.type == 'VOLUME':
279                 split = layout.split()
280
281                 col = split.column()
282                 factor_but(col, tex.map_density, "map_density", "density_factor", "Density")
283                 factor_but(col, tex.map_emission, "map_emission", "emission_factor", "Emission")
284                 factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering")
285                 factor_but(col, tex.map_reflection, "map_reflection", "reflection_factor", "Reflection")
286
287                 col = split.column()
288                 col.itemL(text=" ")
289                 factor_but(col, tex.map_alpha, "map_coloremission", "coloremission_factor", "Emission Color")
290                 factor_but(col, tex.map_colortransmission, "map_colortransmission", "colortransmission_factor", "Transmission Color")
291                 factor_but(col, tex.map_colorreflection, "map_colorreflection", "colorreflection_factor", "Reflection Color")
292
293         elif type(idblock) == bpy.types.Lamp:
294             row = layout.row()
295             factor_but(row, tex.map_color, "map_color", "color_factor", "Color")
296             factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
297
298         elif type(idblock) == bpy.types.World:
299             split = layout.split()
300
301             col = split.column()
302             factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
303             factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
304
305             col = split.column()
306             factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up")
307             factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
308
309         layout.itemS()
310
311         split = layout.split()
312
313         col = split.column()
314         col.itemR(tex, "blend_type", text="Blend")
315         col.itemR(tex, "rgb_to_intensity")
316         sub = col.column()
317         sub.active = tex.rgb_to_intensity
318         sub.itemR(tex, "color", text="")
319
320         col = split.column()
321         col.itemR(tex, "negate", text="Negative")
322         col.itemR(tex, "stencil")
323
324         if type(idblock) in (bpy.types.Material, bpy.types.World):
325             col.itemR(tex, "default_value", text="DVar", slider=True)
326
327 # Texture Type Panels #
328
329 class TextureTypePanel(TextureButtonsPanel):
330     def poll(self, context):
331         tex = context.texture
332         return (tex and tex.type == self.tex_type and not tex.use_nodes)
333
334 class TEXTURE_PT_clouds(TextureTypePanel):
335     bl_label = "Clouds"
336     tex_type = 'CLOUDS'
337
338     def draw(self, context):
339         layout = self.layout
340
341         tex = context.texture
342
343         layout.itemR(tex, "stype", expand=True)
344         layout.itemL(text="Noise:")
345         layout.itemR(tex, "noise_type", text="Type", expand=True)
346         layout.itemR(tex, "noise_basis", text="Basis")
347
348         flow = layout.column_flow()
349         flow.itemR(tex, "noise_size", text="Size")
350         flow.itemR(tex, "noise_depth", text="Depth")
351         flow.itemR(tex, "nabla", text="Nabla")
352
353 class TEXTURE_PT_wood(TextureTypePanel):
354     bl_label = "Wood"
355     tex_type = 'WOOD'
356
357     def draw(self, context):
358         layout = self.layout
359
360         tex = context.texture
361
362         layout.itemR(tex, "noisebasis2", expand=True)
363         layout.itemR(tex, "stype", expand=True)
364
365         col = layout.column()
366         col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
367         col.itemL(text="Noise:")
368         col.row().itemR(tex, "noise_type", text="Type", expand=True)
369         col.itemR(tex, "noise_basis", text="Basis")
370
371         flow = layout.column_flow()
372         flow.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
373         flow.itemR(tex, "noise_size", text="Size")
374         flow.itemR(tex, "turbulence")
375         flow.itemR(tex, "nabla")
376
377 class TEXTURE_PT_marble(TextureTypePanel):
378     bl_label = "Marble"
379     tex_type = 'MARBLE'
380
381     def draw(self, context):
382         layout = self.layout
383
384         tex = context.texture
385
386         layout.itemR(tex, "stype", expand=True)
387         layout.itemR(tex, "noisebasis2", expand=True)
388         layout.itemL(text="Noise:")
389         layout.itemR(tex, "noise_type", text="Type", expand=True)
390         layout.itemR(tex, "noise_basis", text="Basis")
391
392         flow = layout.column_flow()
393         flow.itemR(tex, "noise_size", text="Size")
394         flow.itemR(tex, "noise_depth", text="Depth")
395         flow.itemR(tex, "turbulence")
396         flow.itemR(tex, "nabla")
397
398 class TEXTURE_PT_magic(TextureTypePanel):
399     bl_label = "Magic"
400     tex_type = 'MAGIC'
401
402     def draw(self, context):
403         layout = self.layout
404
405         tex = context.texture
406
407         row = layout.row()
408         row.itemR(tex, "noise_depth", text="Depth")
409         row.itemR(tex, "turbulence")
410
411 class TEXTURE_PT_blend(TextureTypePanel):
412     bl_label = "Blend"
413     tex_type = 'BLEND'
414
415     def draw(self, context):
416         layout = self.layout
417
418         tex = context.texture
419
420         layout.itemR(tex, "progression")
421         sub = layout.row()
422
423         sub.active = (tex.progression in ('LINEAR', 'QUADRATIC', 'EASING', 'RADIAL'))
424         sub.itemR(tex, "flip_axis", expand=True)
425
426 class TEXTURE_PT_stucci(TextureTypePanel):
427     bl_label = "Stucci"
428     tex_type = 'STUCCI'
429
430     def draw(self, context):
431         layout = self.layout
432
433         tex = context.texture
434
435         layout.itemR(tex, "stype", expand=True)
436         layout.itemL(text="Noise:")
437         layout.itemR(tex, "noise_type", text="Type", expand=True)
438         layout.itemR(tex, "noise_basis", text="Basis")
439
440         row = layout.row()
441         row.itemR(tex, "noise_size", text="Size")
442         row.itemR(tex, "turbulence")
443
444 class TEXTURE_PT_image(TextureTypePanel):
445     bl_label = "Image"
446     tex_type = 'IMAGE'
447
448     def draw(self, context):
449         layout = self.layout
450
451         tex = context.texture
452
453         layout.template_image(tex, "image", tex.image_user)
454
455 class TEXTURE_PT_image_sampling(TextureTypePanel):
456     bl_label = "Image Sampling"
457     bl_default_closed = True
458     tex_type = 'IMAGE'
459
460     def draw(self, context):
461         layout = self.layout
462
463         tex = context.texture
464         slot = context.texture_slot
465
466         split = layout.split()
467
468         col = split.column()
469         col.itemL(text="Alpha:")
470         col.itemR(tex, "use_alpha", text="Use")
471         col.itemR(tex, "calculate_alpha", text="Calculate")
472         col.itemR(tex, "invert_alpha", text="Invert")
473
474         col.itemL(text="Flip:")
475         col.itemR(tex, "flip_axis", text="X/Y Axis")
476
477         col = split.column()
478         col.itemR(tex, "normal_map")
479         row = col.row()
480         row.active = tex.normal_map
481         row.itemR(tex, "normal_space", text="")
482
483         col.itemL(text="Filter:")
484         col.itemR(tex, "filter", text="")
485         col.itemR(tex, "mipmap")
486
487         row = col.row()
488         row.active = tex.mipmap
489         row.itemR(tex, "mipmap_gauss", text="Gauss")
490
491         col.itemR(tex, "interpolation")
492         if tex.mipmap and tex.filter != 'DEFAULT':
493             if tex.filter == 'FELINE':
494                 col.itemR(tex, "filter_probes", text="Probes")
495             else:
496                 col.itemR(tex, "filter_eccentricity", text="Eccentricity")
497
498 class TEXTURE_PT_image_mapping(TextureTypePanel):
499     bl_label = "Image Mapping"
500     bl_default_closed = True
501     tex_type = 'IMAGE'
502
503     def draw(self, context):
504         layout = self.layout
505
506         tex = context.texture
507
508         layout.itemR(tex, "extension")
509
510         split = layout.split()
511
512         if tex.extension == 'REPEAT':
513             col = split.column(align=True)
514             col.itemL(text="Repeat:")
515             col.itemR(tex, "repeat_x", text="X")
516             col.itemR(tex, "repeat_y", text="Y")
517
518             col = split.column(align=True)
519             col.itemL(text="Mirror:")
520             col.itemR(tex, "mirror_x", text="X")
521             col.itemR(tex, "mirror_y", text="Y")
522             layout.itemS()
523
524         elif tex.extension == 'CHECKER':
525             col = split.column(align=True)
526             row = col.row()
527             row.itemR(tex, "checker_even", text="Even")
528             row.itemR(tex, "checker_odd", text="Odd")
529
530             split.itemR(tex, "checker_distance", text="Distance")
531             layout.itemS()
532
533         split = layout.split()
534
535         col = split.column(align=True)
536         #col.itemR(tex, "crop_rectangle")
537         col.itemL(text="Crop Minimum:")
538         col.itemR(tex, "crop_min_x", text="X")
539         col.itemR(tex, "crop_min_y", text="Y")
540
541         col = split.column(align=True)
542         col.itemL(text="Crop Maximum:")
543         col.itemR(tex, "crop_max_x", text="X")
544         col.itemR(tex, "crop_max_y", text="Y")
545
546 class TEXTURE_PT_plugin(TextureTypePanel):
547     bl_label = "Plugin"
548     tex_type = 'PLUGIN'
549
550     def draw(self, context):
551         layout = self.layout
552
553         tex = context.texture
554
555         layout.itemL(text="Nothing yet")
556
557 class TEXTURE_PT_envmap(TextureTypePanel):
558     bl_label = "Environment Map"
559     tex_type = 'ENVIRONMENT_MAP'
560
561     def draw(self, context):
562         layout = self.layout
563
564         tex = context.texture
565
566         layout.itemL(text="Nothing yet")
567
568 class TEXTURE_PT_musgrave(TextureTypePanel):
569     bl_label = "Musgrave"
570     tex_type = 'MUSGRAVE'
571
572     def draw(self, context):
573         layout = self.layout
574
575         tex = context.texture
576
577         layout.itemR(tex, "musgrave_type")
578
579         split = layout.split()
580
581         col = split.column()
582         col.itemR(tex, "highest_dimension", text="Dimension")
583         col.itemR(tex, "lacunarity")
584         col.itemR(tex, "octaves")
585
586         col = split.column()
587         if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
588             col.itemR(tex, "offset")
589         if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
590             col.itemR(tex, "gain")
591             col.itemR(tex, "noise_intensity", text="Intensity")
592
593         layout.itemL(text="Noise:")
594
595         layout.itemR(tex, "noise_basis", text="Basis")
596
597         row = layout.row()
598         row.itemR(tex, "noise_size", text="Size")
599         row.itemR(tex, "nabla")
600
601 class TEXTURE_PT_voronoi(TextureTypePanel):
602     bl_label = "Voronoi"
603     tex_type = 'VORONOI'
604
605     def draw(self, context):
606         layout = self.layout
607
608         tex = context.texture
609
610         split = layout.split()
611
612         col = split.column()
613         col.itemL(text="Distance Metric:")
614         col.itemR(tex, "distance_metric", text="")
615         sub = col.column()
616         sub.active = tex.distance_metric == 'MINKOVSKY'
617         sub.itemR(tex, "minkovsky_exponent", text="Exponent")
618         col.itemL(text="Coloring:")
619         col.itemR(tex, "coloring", text="")
620         col.itemR(tex, "noise_intensity", text="Intensity")
621
622         col = split.column(align=True)
623         col.itemL(text="Feature Weights:")
624         col.itemR(tex, "weight_1", text="1", slider=True)
625         col.itemR(tex, "weight_2", text="2", slider=True)
626         col.itemR(tex, "weight_3", text="3", slider=True)
627         col.itemR(tex, "weight_4", text="4", slider=True)
628
629         layout.itemL(text="Noise:")
630
631         row = layout.row()
632         row.itemR(tex, "noise_size", text="Size")
633         row.itemR(tex, "nabla")
634
635 class TEXTURE_PT_distortednoise(TextureTypePanel):
636     bl_label = "Distorted Noise"
637     tex_type = 'DISTORTED_NOISE'
638
639     def draw(self, context):
640         layout = self.layout
641
642         tex = context.texture
643
644         layout.itemR(tex, "noise_distortion")
645         layout.itemR(tex, "noise_basis", text="Basis")
646
647         flow = layout.column_flow()
648         flow.itemR(tex, "distortion", text="Distortion")
649         flow.itemR(tex, "noise_size", text="Size")
650         flow.itemR(tex, "nabla")
651
652 class TEXTURE_PT_voxeldata(TextureButtonsPanel):
653     bl_label = "Voxel Data"
654
655     def poll(self, context):
656         tex = context.texture
657         return (tex and tex.type == 'VOXEL_DATA')
658
659     def draw(self, context):
660         layout = self.layout
661
662         tex = context.texture
663         vd = tex.voxeldata
664
665         layout.itemR(vd, "file_format")
666         if vd.file_format in ['BLENDER_VOXEL', 'RAW_8BIT']:
667             layout.itemR(vd, "source_path")
668         if vd.file_format == 'RAW_8BIT':
669             layout.itemR(vd, "resolution")
670         elif vd.file_format == 'SMOKE':
671             layout.itemR(vd, "domain_object")
672
673         layout.itemR(vd, "still")
674         row = layout.row()
675         row.active = vd.still
676         row.itemR(vd, "still_frame_number")
677
678         layout.itemR(vd, "interpolation")
679         layout.itemR(vd, "extension")
680         layout.itemR(vd, "intensity")
681
682 class TEXTURE_PT_pointdensity(TextureButtonsPanel):
683     bl_label = "Point Density"
684
685     def poll(self, context):
686         tex = context.texture
687         return (tex and tex.type == 'POINT_DENSITY')
688
689     def draw(self, context):
690         layout = self.layout
691
692         tex = context.texture
693         pd = tex.pointdensity
694
695         layout.itemR(pd, "point_source", expand=True)
696
697         split = layout.split()
698
699         col = split.column()
700         if pd.point_source == 'PARTICLE_SYSTEM':
701             col.itemL(text="Object:")
702             col.itemR(pd, "object", text="")
703
704             sub = col.column()
705             sub.enabled = pd.object
706             if pd.object:
707                 sub.itemL(text="System:")
708                 sub.item_pointerR(pd, "particle_system", pd.object, "particle_systems", text="")
709             sub.itemL(text="Cache:")
710             sub.itemR(pd, "particle_cache", text="")
711         else:
712             col.itemL(text="Object:")
713             col.itemR(pd, "object", text="")
714             col.itemL(text="Cache:")
715             col.itemR(pd, "vertices_cache", text="")
716
717         col.itemS()
718
719         col.itemL(text="Color Source:")
720         col.itemR(pd, "color_source", text="")
721         if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_VELOCITY'):
722             col.itemR(pd, "speed_scale")
723         if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'):
724             layout.template_color_ramp(pd, "color_ramp", expand=True)
725
726         col = split.column()
727         col.itemL()
728         col.itemR(pd, "radius")
729         col.itemL(text="Falloff:")
730         col.itemR(pd, "falloff", text="")
731         if pd.falloff == 'SOFT':
732             col.itemR(pd, "falloff_softness")
733
734 class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
735     bl_label = "Turbulence"
736
737     def poll(self, context):
738         tex = context.texture
739         return (tex and tex.type == 'POINT_DENSITY')
740
741     def draw_header(self, context):
742         layout = self.layout
743
744         tex = context.texture
745         pd = tex.pointdensity
746
747         layout.itemR(pd, "turbulence", text="")
748
749     def draw(self, context):
750         layout = self.layout
751
752         tex = context.texture
753         pd = tex.pointdensity
754         layout.active = pd.turbulence
755
756         split = layout.split()
757
758         col = split.column()
759         col.itemL(text="Influence:")
760         col.itemR(pd, "turbulence_influence", text="")
761         col.itemL(text="Noise Basis:")
762         col.itemR(pd, "noise_basis", text="")
763
764         col = split.column()
765         col.itemL()
766         col.itemR(pd, "turbulence_size")
767         col.itemR(pd, "turbulence_depth")
768         col.itemR(pd, "turbulence_strength")
769
770 bpy.types.register(TEXTURE_PT_context_texture)
771 bpy.types.register(TEXTURE_PT_preview)
772
773 bpy.types.register(TEXTURE_PT_clouds) # Texture Type Panels
774 bpy.types.register(TEXTURE_PT_wood)
775 bpy.types.register(TEXTURE_PT_marble)
776 bpy.types.register(TEXTURE_PT_magic)
777 bpy.types.register(TEXTURE_PT_blend)
778 bpy.types.register(TEXTURE_PT_stucci)
779 bpy.types.register(TEXTURE_PT_image)
780 bpy.types.register(TEXTURE_PT_image_sampling)
781 bpy.types.register(TEXTURE_PT_image_mapping)
782 bpy.types.register(TEXTURE_PT_plugin)
783 bpy.types.register(TEXTURE_PT_envmap)
784 bpy.types.register(TEXTURE_PT_musgrave)
785 bpy.types.register(TEXTURE_PT_voronoi)
786 bpy.types.register(TEXTURE_PT_distortednoise)
787 bpy.types.register(TEXTURE_PT_voxeldata)
788 bpy.types.register(TEXTURE_PT_pointdensity)
789 bpy.types.register(TEXTURE_PT_pointdensity_turbulence)
790
791 bpy.types.register(TEXTURE_PT_colors)
792 bpy.types.register(TEXTURE_PT_mapping)
793 bpy.types.register(TEXTURE_PT_influence)
794