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