Welcome to mirror list, hosted at ThFree Co, Russian Federation.

buttons_texture.py « ui « release - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4771a550555796cc47b90a611a2cf4352aaac12a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561

import bpy

class TextureButtonsPanel(bpy.types.Panel):
	__space_type__ = "BUTTONS_WINDOW"
	__region_type__ = "WINDOW"
	__context__ = "texture"
	
	def poll(self, context):
		return (context.texture != None and context.texture.type != 'NONE')
		
class TEXTURE_PT_preview(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_preview"
	__label__ = "Preview"

	def poll(self, context):
		return (context.material or context.world or context.lamp or context.texture)

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.template_preview(tex)

class TEXTURE_PT_context(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_context"
	__label__ = " "

	def poll(self, context):
		return (context.material or context.world or context.lamp or context.texture)

	def draw(self, context):
		layout = self.layout

		tex = context.texture
		ma = context.material
		la = context.lamp
		wo = context.world
		space = context.space_data
		slot = context.texture_slot

		row = layout.row()
		if ma:
			row.template_list(ma, "textures", ma, "active_texture_index")
			col = row.column(align=True)
			col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="")
			#col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
		elif la:
			row.template_list(la, "textures", la, "active_texture_index")
			col = row.column(align=True)
			col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="")
			#col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
		elif wo:
			row.template_list(wo, "textures", wo, "active_texture_index")
			col = row.column(align=True)
			col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="")
			#col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")


		split = layout.split(percentage=0.65)

		if ma or la or wo:
			if slot:
				split.template_ID(slot, "texture", new="TEXTURE_OT_new")
			else:
				split.itemS()


		elif tex:
			split.template_ID(space, "pin_id")
			split.itemS()
			
			layout.itemS()
		
		if tex:
			split = layout.split(percentage=0.2)
		
			col = split.column()
			col.itemL(text="Type:")
			col = split.column()
			col.itemR(tex, "type", text="")
		

class TEXTURE_PT_texture(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_texture"
	__label__ = "Texture"

	def poll(self, context):
		return (context.material or context.world or context.lamp or context.texture)

	def draw(self, context):
		layout = self.layout
		
		tex = context.texture



class TEXTURE_PT_mapping(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_mapping"
	__label__ = "Mapping"
	
	def poll(self, context):
		return (context.texture_slot and context.texture and context.texture.type != 'NONE')

	def draw(self, context):
		layout = self.layout
		tex = context.texture_slot
		textype = context.texture

		split = layout.split(percentage=0.3)
		col = split.column()
		col.itemL(text="Coordinates:")
		col = split.column()
		col.itemR(tex, "texture_coordinates", text="")

		if tex.texture_coordinates == 'UV':
			row = layout.row()
			row.itemR(tex, "uv_layer")
		elif tex.texture_coordinates == 'OBJECT':
			row = layout.row()
			row.itemR(tex, "object")
		
		if textype.type in ('IMAGE', 'ENVIRONMENT_MAP'):
			split = layout.split(percentage=0.3)
			col = split.column()
			col.itemL(text="Projection:")
			col = split.column()
			col.itemR(tex, "mapping", text="")

		split = layout.split()
		
		col = split.column()
		col.itemR(tex, "from_dupli")
		
		col = split.column()
		row = col.row()
		row.itemR(tex, "x_mapping", text="")
		row.itemR(tex, "y_mapping", text="")
		row.itemR(tex, "z_mapping", text="")

		row = layout.row()
		row.column().itemR(tex, "offset")
		row.column().itemR(tex, "size")

class TEXTURE_PT_influence(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_influence"
	__label__ = "Influence"
	
	def poll(self, context):
		return (context.texture_slot and context.texture and context.texture.type != 'NONE')

	def draw(self, context):
		layout = self.layout
		
		textype = context.texture
		tex = context.texture_slot
		
		split = layout.split()
		
		col = split.column()
		col.itemR(tex, "map_color", text="Diffuse Color")
		colsub = col.column()
		colsub.active = tex.map_color
		colsub.itemR(tex, "color_factor", text="Opacity", slider=True)
		colsub.itemR(tex, "blend_type")
		if textype.type == 'IMAGE':
			col.itemR(tex, "no_rgb")
			
			colsub = col.column()
			colsub.active = tex.no_rgb
			colsub.itemR(tex, "color")
		else:
			col.itemR(tex, "color")
			
		col.itemR(tex, "map_colorspec")
		col.itemR(tex, "map_normal")
		colsub = col.column()
		colsub.active = tex.map_normal
		colsub.itemR(tex, "normal_factor", text="Amount", slider=True)
		col.itemR(tex, "normal_map_space")
		col.itemR(tex, "map_warp")
		colsub = col.column()
		colsub.active = tex.map_warp
		colsub.itemR(tex, "warp_factor", text="Amount", slider=True)	
		col.itemR(tex, "map_displacement")
		colsub = col.column()
		colsub.active = tex.map_displacement
		colsub.itemR(tex, "displacement_factor", text="Amount", slider=True)
		col = split.column()
		col.itemR(tex, "map_mirror")
		col.itemR(tex, "map_reflection")
		col.itemR(tex, "map_specularity")
		col.itemR(tex, "map_ambient")
		col.itemR(tex, "map_hardness")
		col.itemR(tex, "map_raymir")
		col.itemR(tex, "map_alpha")
		col.itemR(tex, "map_emit")
		col.itemR(tex, "map_translucency")

		colsub = col.column()
		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
		colsub.itemR(tex, "default_value", text="Amount", slider=True)
		
		row = layout.row()
		row.itemR(tex, "stencil")
		row.itemR(tex, "negate", text="Negative")

class TEXTURE_PT_colors(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_colors"
	__label__ = "Colors"
	__default_closed__ = True

	def draw(self, context):
		layout = self.layout
		tex = context.texture

		if tex.color_ramp:
			layout.template_color_ramp(tex.color_ramp, expand=True)
		else:
			split = layout.split()
			col = split.column()
			col.itemR(tex, "rgb_factor", text="Multiply RGB")

		col = split.column()
		col.itemL(text="Adjust:")
		col.itemR(tex, "brightness")
		col.itemR(tex, "contrast")

class TEXTURE_PT_clouds(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_clouds"
	__label__ = "Clouds"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'CLOUDS')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.itemR(tex, "stype", expand=True)
		layout.itemL(text="Noise:")
		layout.itemR(tex, "noise_type", text="Type", expand=True)
		layout.itemR(tex, "noise_basis", text="Basis")
		
		col = layout.column_flow()
		col.itemR(tex, "noise_size", text="Size")
		col.itemR(tex, "noise_depth", text="Depth")
		col.itemR(tex, "nabla", text="Nabla")

class TEXTURE_PT_wood(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_wood"
	__label__ = "Wood"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'WOOD')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.itemR(tex, "noisebasis2", expand=True)
		layout.itemR(tex, "stype", expand=True)
		
		col = layout.column()
		col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
		col.itemL(text="Noise:")
		col.row().itemR(tex, "noise_type", text="Type", expand=True)
		col.itemR(tex, "noise_basis", text="Basis")
		
		col = layout.column_flow()
		col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
		col.itemR(tex, "noise_size", text="Size")
		col.itemR(tex, "turbulence")
		col.itemR(tex, "nabla")
		
class TEXTURE_PT_marble(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_marble"
	__label__ = "Marble"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'MARBLE')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.itemR(tex, "stype", expand=True)
		layout.itemR(tex, "noisebasis2", expand=True)
		layout.itemL(text="Noise:")
		layout.itemR(tex, "noise_type", text="Type", expand=True)
		layout.itemR(tex, "noise_basis", text="Basis")
		
		col = layout.column_flow()	
		col.itemR(tex, "noise_size", text="Size")
		col.itemR(tex, "noise_depth", text="Depth")
		col.itemR(tex, "turbulence")
		col.itemR(tex, "nabla")

class TEXTURE_PT_magic(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_magic"
	__label__ = "Magic"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'MAGIC')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
			
		row = layout.row()
		row.itemR(tex, "noise_depth", text="Depth")
		row.itemR(tex, "turbulence")

class TEXTURE_PT_blend(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_blend"
	__label__ = "Blend"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'BLEND')

	def draw(self, context):
		layout = self.layout
		tex = context.texture

		layout.itemR(tex, "progression")
		layout.itemR(tex, "flip_axis")
			
class TEXTURE_PT_stucci(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_stucci"
	__label__ = "Stucci"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'STUCCI')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.itemR(tex, "stype", expand=True)
		layout.itemL(text="Noise:")
		layout.itemR(tex, "noise_type", text="Type", expand=True)
		layout.itemR(tex, "noise_basis", text="Basis")
		
		row = layout.row()
		row.itemR(tex, "noise_size", text="Size")
		row.itemR(tex, "turbulence")
		
class TEXTURE_PT_image(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_image"
	__label__ = "Image/Movie"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'IMAGE')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		split = layout.split()
		
		sub = split.column()   		
		sub.itemR(tex, "flip_axis")
		sub.itemR(tex, "normal_map")
		sub.itemL(text="Filter:")
		sub.itemR(tex, "mipmap")
		sub.itemR(tex, "mipmap_gauss")
		sub.itemR(tex, "interpolation")
		sub = split.column() 
		sub.itemL(text="Alpha:")
		sub.itemR(tex, "use_alpha")
		sub.itemR(tex, "calculate_alpha")
		sub.itemR(tex, "invert_alpha")

class TEXTURE_PT_crop(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_crop"
	__label__ = "Crop"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'IMAGE')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
				
		split = layout.split()
		
		sub = split.column()
		#sub.itemR(tex, "crop_rectangle")
		sub.itemL(text="Crop Minimum:")
		sub.itemR(tex, "crop_min_x", text="X")
		sub.itemR(tex, "crop_min_y", text="Y")
		sub = split.column()
		sub.itemL(text="Crop Maximum:")
		sub.itemR(tex, "crop_max_x", text="X")
		sub.itemR(tex, "crop_max_y", text="Y")
		
		layout.itemR(tex, "extension")
		
		split = layout.split()
		
		sub = split.column()
		if tex.extension == 'REPEAT': 
			sub.itemL(text="Repeat:")
			sub.itemR(tex, "repeat_x", text="X")
			sub.itemR(tex, "repeat_y", text="Y")
			sub = split.column()
			sub.itemL(text="Mirror:")
			sub.itemR(tex, "mirror_x", text="X")
			sub.itemR(tex, "mirror_y", text="Y")
		elif tex.extension == 'CHECKER': 
			sub.itemR(tex, "checker_even", text="Even")
			sub.itemR(tex, "checker_odd", text="Odd")
			sub = split.column()
			sub.itemR(tex, "checker_distance", text="Distance")
	
class TEXTURE_PT_plugin(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_plugin"
	__label__ = "Plugin"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'PLUGIN')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.itemL(text="Nothing yet")
		
class TEXTURE_PT_envmap(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_envmap"
	__label__ = "Environment Map"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'ENVIRONMENT_MAP')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.itemL(text="Nothing yet")
		
class TEXTURE_PT_musgrave(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_musgrave"
	__label__ = "Musgrave"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'MUSGRAVE')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
		
		layout.itemR(tex, "musgrave_type")	
		
		split = layout.split()
		
		sub = split.column()
		sub.itemR(tex, "highest_dimension", text="Dimension")
		sub.itemR(tex, "lacunarity")
		sub.itemR(tex, "octaves")
		sub = split.column() 
		if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
			sub.itemR(tex, "offset")
		if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
			sub.itemR(tex, "gain")
			sub.itemR(tex, "noise_intensity", text="Intensity")
		
		layout.itemL(text="Noise:")
		
		layout.itemR(tex, "noise_basis", text="Basis")
		
		row = layout.row()
		row.itemR(tex, "noise_size", text="Size")
		row.itemR(tex, "nabla")

class TEXTURE_PT_voronoi(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_voronoi"
	__label__ = "Voronoi"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'VORONOI')

	def draw(self, context):
		layout = self.layout
		tex = context.texture
	
		layout.itemR(tex, "distance_metric")
		layout.itemR(tex, "coloring")
		
		split = layout.split()
		
		sub = split.column()   
		
		sub.itemR(tex, "noise_intensity", text="Intensity")
		if tex.distance_metric == 'MINKOVSKY':
			sub.itemR(tex, "minkovsky_exponent", text="Exponent")
		sub = split.column()
		sub.itemR(tex, "feature_weights", slider=True)
		
		layout.itemL(text="Noise:")
		
		row = layout.row()
		row.itemR(tex, "noise_size", text="Size")
		row.itemR(tex, "nabla")
			
class TEXTURE_PT_distortednoise(TextureButtonsPanel):
	__idname__= "TEXTURE_PT_distortednoise"
	__label__ = "Distorted Noise"
	
	def poll(self, context):
		tex = context.texture
		return (tex and tex.type == 'DISTORTED_NOISE')

	def draw(self, context):
		layout = self.layout
		tex = context.texture

		layout.itemR(tex, "noise_distortion")
		layout.itemR(tex, "noise_basis", text="Basis")
		
		split = layout.split()
		
		sub = split.column()
		sub.itemR(tex, "distortion_amount", text="Distortion")
		sub.itemR(tex, "noise_size", text="Size")
		
		sub = split.column()
		sub.itemR(tex, "nabla")	

bpy.types.register(TEXTURE_PT_context)
bpy.types.register(TEXTURE_PT_preview)
bpy.types.register(TEXTURE_PT_texture)
bpy.types.register(TEXTURE_PT_clouds)
bpy.types.register(TEXTURE_PT_wood)
bpy.types.register(TEXTURE_PT_marble)
bpy.types.register(TEXTURE_PT_magic)
bpy.types.register(TEXTURE_PT_blend)
bpy.types.register(TEXTURE_PT_stucci)
bpy.types.register(TEXTURE_PT_image)
bpy.types.register(TEXTURE_PT_crop)
bpy.types.register(TEXTURE_PT_plugin)
bpy.types.register(TEXTURE_PT_envmap)
bpy.types.register(TEXTURE_PT_musgrave)
bpy.types.register(TEXTURE_PT_voronoi)
bpy.types.register(TEXTURE_PT_distortednoise)
bpy.types.register(TEXTURE_PT_colors)
bpy.types.register(TEXTURE_PT_mapping)
bpy.types.register(TEXTURE_PT_influence)