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