4 class TextureButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "texture"
9 def poll(self, context):
10 return (context.texture != None and context.texture.type != 'NONE')
12 class TEXTURE_PT_preview(TextureButtonsPanel):
13 __idname__= "TEXTURE_PT_preview"
16 def draw(self, context):
25 layout.template_preview(tex, parent=ma)
27 layout.template_preview(tex, parent=la)
29 layout.template_preview(tex, parent=wo)
31 layout.template_preview(tex, parent=br)
33 layout.template_preview(tex)
35 class TEXTURE_PT_context_texture(TextureButtonsPanel):
36 __idname__= "TEXTURE_PT_context_texture"
39 def poll(self, context):
40 return (context.material or context.world or context.lamp or context.brush or context.texture)
42 def draw(self, context):
50 space = context.space_data
51 slot = context.texture_slot
53 if ma or la or wo or br:
56 row.template_list(ma, "textures", ma, "active_texture_index", type="ICONS")
58 row.template_list(la, "textures", la, "active_texture_index", type="ICONS")
60 row.template_list(wo, "textures", wo, "active_texture_index", type="ICONS")
62 row.template_list(br, "textures", br, "active_texture_index", type="ICONS")
64 split = layout.split(percentage=0.65)
66 if ma or la or wo or br:
68 split.template_ID(slot, "texture", new="texture.new")
72 split.template_ID(space, "pin_id")
74 if not space.pin_id and \
75 (context.sculpt_object or context.vertex_paint_object or \
76 context.weight_paint_object or context.texture_paint_object):
77 split.itemR(space, "brush_texture", text="Brush", toggle=True)
84 split = layout.split(percentage=0.2)
87 col.itemL(text="Type:")
89 col.itemR(tex, "type", text="")
91 class TEXTURE_PT_mapping(TextureButtonsPanel):
92 __idname__= "TEXTURE_PT_mapping"
95 def poll(self, context):
96 return (context.texture_slot and context.texture and context.texture.type != 'NONE')
98 def draw(self, context):
100 ma = context.material
104 tex = context.texture_slot
105 textype = context.texture
108 split = layout.split(percentage=0.3)
110 col.itemL(text="Coordinates:")
112 col.itemR(tex, "texture_coordinates", text="")
114 if tex.texture_coordinates == 'ORCO':
117 if ob and ob.type == 'MESH':
118 split = layout.split(percentage=0.3)
119 split.itemL(text="Mesh:")
120 split.itemR(ob.data, "texco_mesh", text="")
122 elif tex.texture_coordinates == 'UV':
123 split = layout.split(percentage=0.3)
124 split.itemL(text="Layer:")
125 split.itemR(tex, "uv_layer", text="")
126 elif tex.texture_coordinates == 'OBJECT':
127 split = layout.split(percentage=0.3)
128 split.itemL(text="Object:")
129 split.itemR(tex, "object", text="")
132 split = layout.split(percentage=0.3)
134 col.itemL(text="Projection:")
136 col.itemR(tex, "mapping", text="")
138 split = layout.split()
141 if tex.texture_coordinates in ('ORCO', 'UV'):
142 col.itemR(tex, "from_dupli")
143 elif tex.texture_coordinates == 'OBJECT':
144 col.itemR(tex, "from_original")
150 row.itemR(tex, "x_mapping", text="")
151 row.itemR(tex, "y_mapping", text="")
152 row.itemR(tex, "z_mapping", text="")
155 row.column().itemR(tex, "offset")
156 row.column().itemR(tex, "size")
158 class TEXTURE_PT_influence(TextureButtonsPanel):
159 __idname__= "TEXTURE_PT_influence"
160 __label__ = "Influence"
162 def poll(self, context):
163 return (context.texture_slot and context.texture and context.texture.type != 'NONE' and (not context.brush))
165 def draw(self, context):
168 ma = context.material
172 textype = context.texture
173 tex = context.texture_slot
175 def factor_but(layout, active, toggle, factor, name):
176 row = layout.row(align=True)
177 row.itemR(tex, toggle, text="")
180 sub.itemR(tex, factor, text=name, slider=True)
183 split = layout.split()
187 col.itemL(text="Diffuse:")
188 factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity")
189 factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color")
190 factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha")
191 factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency")
193 col.itemL(text="Specular:")
194 factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity")
195 factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color")
196 factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness")
199 col.itemL(text="Shading:")
200 factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient")
201 factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit")
202 factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror")
203 factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror")
205 col.itemL(text="Geometry:")
206 factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal")
207 factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp")
208 factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace")
210 #colsub = col.column()
211 #colsub.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
212 #colsub.itemR(tex, "default_value", text="Amount", slider=True)
215 factor_but(row, tex.map_color, "map_color", "color_factor", "Color")
216 factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
218 split = layout.split()
220 factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
221 factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
224 factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up")
225 factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
228 split = layout.split()
232 col.itemR(tex, "blend_type", text="Blend")
233 col.itemR(tex, "rgb_to_intensity")
234 colsub = col.column()
235 colsub.active = tex.rgb_to_intensity
236 colsub.itemR(tex, "color", text="")
239 col.itemR(tex, "negate", text="Negative")
240 col.itemR(tex, "stencil")
242 col.itemR(tex, "default_value", text="DVar", slider=True)
244 class TEXTURE_PT_colors(TextureButtonsPanel):
245 __idname__= "TEXTURE_PT_colors"
247 __default_closed__ = True
249 def draw(self, context):
251 tex = context.texture
253 layout.itemR(tex, "use_color_ramp", text="Ramp")
254 if tex.use_color_ramp:
255 layout.template_color_ramp(tex.color_ramp, expand=True)
257 split = layout.split()
259 col.itemR(tex, "rgb_factor", text="Multiply RGB")
262 col.itemL(text="Adjust:")
263 col.itemR(tex, "brightness")
264 col.itemR(tex, "contrast")
266 class TEXTURE_PT_clouds(TextureButtonsPanel):
267 __idname__= "TEXTURE_PT_clouds"
270 def poll(self, context):
271 tex = context.texture
272 return (tex and tex.type == 'CLOUDS')
274 def draw(self, context):
276 tex = context.texture
278 layout.itemR(tex, "stype", expand=True)
279 layout.itemL(text="Noise:")
280 layout.itemR(tex, "noise_type", text="Type", expand=True)
281 layout.itemR(tex, "noise_basis", text="Basis")
283 col = layout.column_flow()
284 col.itemR(tex, "noise_size", text="Size")
285 col.itemR(tex, "noise_depth", text="Depth")
286 col.itemR(tex, "nabla", text="Nabla")
288 class TEXTURE_PT_wood(TextureButtonsPanel):
289 __idname__= "TEXTURE_PT_wood"
292 def poll(self, context):
293 tex = context.texture
294 return (tex and tex.type == 'WOOD')
296 def draw(self, context):
298 tex = context.texture
300 layout.itemR(tex, "noisebasis2", expand=True)
301 layout.itemR(tex, "stype", expand=True)
303 col = layout.column()
304 col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
305 col.itemL(text="Noise:")
306 col.row().itemR(tex, "noise_type", text="Type", expand=True)
307 col.itemR(tex, "noise_basis", text="Basis")
309 col = layout.column_flow()
310 col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
311 col.itemR(tex, "noise_size", text="Size")
312 col.itemR(tex, "turbulence")
313 col.itemR(tex, "nabla")
315 class TEXTURE_PT_marble(TextureButtonsPanel):
316 __idname__= "TEXTURE_PT_marble"
319 def poll(self, context):
320 tex = context.texture
321 return (tex and tex.type == 'MARBLE')
323 def draw(self, context):
325 tex = context.texture
327 layout.itemR(tex, "stype", expand=True)
328 layout.itemR(tex, "noisebasis2", expand=True)
329 layout.itemL(text="Noise:")
330 layout.itemR(tex, "noise_type", text="Type", expand=True)
331 layout.itemR(tex, "noise_basis", text="Basis")
333 col = layout.column_flow()
334 col.itemR(tex, "noise_size", text="Size")
335 col.itemR(tex, "noise_depth", text="Depth")
336 col.itemR(tex, "turbulence")
337 col.itemR(tex, "nabla")
339 class TEXTURE_PT_magic(TextureButtonsPanel):
340 __idname__= "TEXTURE_PT_magic"
343 def poll(self, context):
344 tex = context.texture
345 return (tex and tex.type == 'MAGIC')
347 def draw(self, context):
349 tex = context.texture
352 row.itemR(tex, "noise_depth", text="Depth")
353 row.itemR(tex, "turbulence")
355 class TEXTURE_PT_blend(TextureButtonsPanel):
356 __idname__= "TEXTURE_PT_blend"
359 def poll(self, context):
360 tex = context.texture
361 return (tex and tex.type == 'BLEND')
363 def draw(self, context):
365 tex = context.texture
367 layout.itemR(tex, "progression")
368 layout.itemR(tex, "flip_axis")
370 class TEXTURE_PT_stucci(TextureButtonsPanel):
371 __idname__= "TEXTURE_PT_stucci"
374 def poll(self, context):
375 tex = context.texture
376 return (tex and tex.type == 'STUCCI')
378 def draw(self, context):
380 tex = context.texture
382 layout.itemR(tex, "stype", expand=True)
383 layout.itemL(text="Noise:")
384 layout.itemR(tex, "noise_type", text="Type", expand=True)
385 layout.itemR(tex, "noise_basis", text="Basis")
388 row.itemR(tex, "noise_size", text="Size")
389 row.itemR(tex, "turbulence")
391 class TEXTURE_PT_image(TextureButtonsPanel):
392 __idname__= "TEXTURE_PT_image"
395 def poll(self, context):
396 tex = context.texture
397 return (tex and tex.type == 'IMAGE')
399 def draw(self, context):
401 tex = context.texture
403 layout.template_texture_image(tex)
405 class TEXTURE_PT_image_sampling(TextureButtonsPanel):
406 __idname__= "TEXTURE_PT_image_sampling"
407 __label__ = "Image Sampling"
408 __default_closed__ = True
410 def poll(self, context):
411 tex = context.texture
412 return (tex and tex.type == 'IMAGE')
414 def draw(self, context):
416 tex = context.texture
417 slot = context.texture_slot
419 split = layout.split()
423 sub.itemR(tex, "flip_axis")
424 sub.itemR(tex, "normal_map")
427 row.active = tex.normal_map
428 row.itemR(slot, "normal_map_space", text="")
433 sub.itemL(text="Alpha:")
434 sub.itemR(tex, "use_alpha", text="Use")
435 sub.itemR(tex, "calculate_alpha", text="Calculate")
436 sub.itemR(tex, "invert_alpha", text="Invert")
438 sub.itemL(text="Flip:")
439 sub.itemR(tex, "flip_axis", text="X/Y Axis")
442 sub.itemL(text="Filter:")
443 sub.itemR(tex, "filter", text="")
444 sub.itemR(tex, "mipmap")
446 row.itemR(tex, "mipmap_gauss", text="Gauss")
447 row.active = tex.mipmap
448 sub.itemR(tex, "interpolation")
449 if tex.mipmap and tex.filter != 'DEFAULT':
450 if tex.filter == 'FELINE':
451 sub.itemR(tex, "filter_probes", text="Probes")
453 sub.itemR(tex, "filter_eccentricity", text="Eccentricity")
455 class TEXTURE_PT_image_mapping(TextureButtonsPanel):
456 __idname__= "TEXTURE_PT_image_mapping"
457 __label__ = "Image Mapping"
458 __default_closed__ = True
460 def poll(self, context):
461 tex = context.texture
462 return (tex and tex.type == 'IMAGE')
464 def draw(self, context):
466 tex = context.texture
468 layout.itemR(tex, "extension")
470 split = layout.split()
472 if tex.extension == 'REPEAT':
473 sub = split.column(align=True)
474 sub.itemL(text="Repeat:")
475 sub.itemR(tex, "repeat_x", text="X")
476 sub.itemR(tex, "repeat_y", text="Y")
477 sub = split.column(align=True)
478 sub.itemL(text="Mirror:")
479 sub.itemR(tex, "mirror_x", text="X")
480 sub.itemR(tex, "mirror_y", text="Y")
481 elif tex.extension == 'CHECKER':
482 sub = split.column(align=True)
484 row.itemR(tex, "checker_even", text="Even")
485 row.itemR(tex, "checker_odd", text="Odd")
487 sub.itemR(tex, "checker_distance", text="Distance")
491 split = layout.split()
493 sub = split.column(align=True)
494 #sub.itemR(tex, "crop_rectangle")
495 sub.itemL(text="Crop Minimum:")
496 sub.itemR(tex, "crop_min_x", text="X")
497 sub.itemR(tex, "crop_min_y", text="Y")
498 sub = split.column(align=True)
499 sub.itemL(text="Crop Maximum:")
500 sub.itemR(tex, "crop_max_x", text="X")
501 sub.itemR(tex, "crop_max_y", text="Y")
503 class TEXTURE_PT_plugin(TextureButtonsPanel):
504 __idname__= "TEXTURE_PT_plugin"
507 def poll(self, context):
508 tex = context.texture
509 return (tex and tex.type == 'PLUGIN')
511 def draw(self, context):
513 tex = context.texture
515 layout.itemL(text="Nothing yet")
517 class TEXTURE_PT_envmap(TextureButtonsPanel):
518 __idname__= "TEXTURE_PT_envmap"
519 __label__ = "Environment Map"
521 def poll(self, context):
522 tex = context.texture
523 return (tex and tex.type == 'ENVIRONMENT_MAP')
525 def draw(self, context):
527 tex = context.texture
529 layout.itemL(text="Nothing yet")
531 class TEXTURE_PT_musgrave(TextureButtonsPanel):
532 __idname__= "TEXTURE_PT_musgrave"
533 __label__ = "Musgrave"
535 def poll(self, context):
536 tex = context.texture
537 return (tex and tex.type == 'MUSGRAVE')
539 def draw(self, context):
541 tex = context.texture
543 layout.itemR(tex, "musgrave_type")
545 split = layout.split()
548 sub.itemR(tex, "highest_dimension", text="Dimension")
549 sub.itemR(tex, "lacunarity")
550 sub.itemR(tex, "octaves")
552 if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
553 sub.itemR(tex, "offset")
554 if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
555 sub.itemR(tex, "gain")
556 sub.itemR(tex, "noise_intensity", text="Intensity")
558 layout.itemL(text="Noise:")
560 layout.itemR(tex, "noise_basis", text="Basis")
563 row.itemR(tex, "noise_size", text="Size")
564 row.itemR(tex, "nabla")
566 class TEXTURE_PT_voronoi(TextureButtonsPanel):
567 __idname__= "TEXTURE_PT_voronoi"
568 __label__ = "Voronoi"
570 def poll(self, context):
571 tex = context.texture
572 return (tex and tex.type == 'VORONOI')
574 def draw(self, context):
576 tex = context.texture
578 layout.itemR(tex, "distance_metric")
579 layout.itemR(tex, "coloring")
581 split = layout.split()
585 sub.itemR(tex, "noise_intensity", text="Intensity")
586 if tex.distance_metric == 'MINKOVSKY':
587 sub.itemR(tex, "minkovsky_exponent", text="Exponent")
589 sub.itemR(tex, "feature_weights", slider=True)
591 layout.itemL(text="Noise:")
594 row.itemR(tex, "noise_size", text="Size")
595 row.itemR(tex, "nabla")
597 class TEXTURE_PT_distortednoise(TextureButtonsPanel):
598 __idname__= "TEXTURE_PT_distortednoise"
599 __label__ = "Distorted Noise"
601 def poll(self, context):
602 tex = context.texture
603 return (tex and tex.type == 'DISTORTED_NOISE')
605 def draw(self, context):
607 tex = context.texture
609 layout.itemR(tex, "noise_distortion")
610 layout.itemR(tex, "noise_basis", text="Basis")
612 split = layout.split()
615 sub.itemR(tex, "distortion_amount", text="Distortion")
616 sub.itemR(tex, "noise_size", text="Size")
619 sub.itemR(tex, "nabla")
621 bpy.types.register(TEXTURE_PT_context_texture)
622 bpy.types.register(TEXTURE_PT_preview)
623 bpy.types.register(TEXTURE_PT_clouds)
624 bpy.types.register(TEXTURE_PT_wood)
625 bpy.types.register(TEXTURE_PT_marble)
626 bpy.types.register(TEXTURE_PT_magic)
627 bpy.types.register(TEXTURE_PT_blend)
628 bpy.types.register(TEXTURE_PT_stucci)
629 bpy.types.register(TEXTURE_PT_image)
630 bpy.types.register(TEXTURE_PT_image_sampling)
631 bpy.types.register(TEXTURE_PT_image_mapping)
632 bpy.types.register(TEXTURE_PT_plugin)
633 bpy.types.register(TEXTURE_PT_envmap)
634 bpy.types.register(TEXTURE_PT_musgrave)
635 bpy.types.register(TEXTURE_PT_voronoi)
636 bpy.types.register(TEXTURE_PT_distortednoise)
637 bpy.types.register(TEXTURE_PT_colors)
638 bpy.types.register(TEXTURE_PT_mapping)
639 bpy.types.register(TEXTURE_PT_influence)