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