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