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