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