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