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

buttons_data_modifier.py « ui « scripts « release - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 754e8ce106e4e494e42f88d102769fb965e5aa6d (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

import bpy

class DataButtonsPanel(bpy.types.Panel):
	__space_type__ = 'PROPERTIES'
	__region_type__ = 'WINDOW'
	__context__ = "modifier"
	
class DATA_PT_modifiers(DataButtonsPanel):
	__label__ = "Modifiers"

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

		row = layout.row()
		row.item_menu_enumO("object.modifier_add", "type")
		row.itemL()

		for md in ob.modifiers:
			box = layout.template_modifier(md)
			if box:
				# match enum type to our functions, avoids a lookup table.
				getattr(self, md.type)(box, ob, md)
	
	# the mt.type enum is (ab)used for a lookup on function names
	# ...to avoid lengthy if statements
	# so each type must have a function here.

	def ARMATURE(self, layout, ob, md):
		layout.itemR(md, "object")
		
		split = layout.split(percentage=0.5)
		split.itemL(text="Vertex Group:")
		sub = split.split(percentage=0.7)
		sub.item_pointerR(md, "vertex_group", ob, "vertex_groups", text="")
		subsub = sub.row()
		subsub.active = md.vertex_group
		subsub.itemR(md, "invert")
		
		layout.itemS()
		
		split = layout.split()

		col = split.column()
		col.itemL(text="Bind To:")
		col.itemR(md, "use_vertex_groups", text="Vertex Groups")
		col.itemR(md, "use_bone_envelopes", text="Bone Envelopes")
		
		col = split.column()
		col.itemL(text="Deformation:")
		col.itemR(md, "quaternion")
		col.itemR(md, "multi_modifier")
		
	def ARRAY(self, layout, ob, md):
		layout.itemR(md, "fit_type")
		if md.fit_type == 'FIXED_COUNT':
			layout.itemR(md, "count")
		elif md.fit_type == 'FIT_LENGTH':
			layout.itemR(md, "length")
		elif md.fit_type == 'FIT_CURVE':
			layout.itemR(md, "curve")

		layout.itemS()
		
		split = layout.split()
		
		col = split.column()
		col.itemR(md, "constant_offset")
		sub = col.column()
		sub.active = md.constant_offset
		sub.itemR(md, "constant_offset_displacement", text="")

		col.itemS()

		col.itemR(md, "merge_adjacent_vertices", text="Merge")
		sub = col.column()
		sub.active = md.merge_adjacent_vertices
		sub.itemR(md, "merge_end_vertices", text="First Last")
		sub.itemR(md, "merge_distance", text="Distance")
		
		col = split.column()
		col.itemR(md, "relative_offset")
		sub = col.column()
		sub.active = md.relative_offset
		sub.itemR(md, "relative_offset_displacement", text="")

		col.itemS()

		col.itemR(md, "add_offset_object")
		sub = col.column()
		sub.active = md.add_offset_object
		sub.itemR(md, "offset_object", text="")

		layout.itemS()
		
		col = layout.column()
		col.itemR(md, "start_cap")
		col.itemR(md, "end_cap")
	
	def BEVEL(self, layout, ob, md):
		row = layout.row()
		row.itemR(md, "width")
		row.itemR(md, "only_vertices")
		
		layout.itemL(text="Limit Method:")
		layout.row().itemR(md, "limit_method", expand=True)
		if md.limit_method == 'ANGLE':
			layout.itemR(md, "angle")
		elif md.limit_method == 'WEIGHT':
			layout.row().itemR(md, "edge_weight_method", expand=True)
			
	def BOOLEAN(self, layout, ob, md):
		layout.itemR(md, "operation")
		layout.itemR(md, "object")
		
	def BUILD(self, layout, ob, md):
		split = layout.split()
		
		col = split.column()
		col.itemR(md, "start")
		col.itemR(md, "length")

		col = split.column()
		col.itemR(md, "randomize")
		sub = col.column()
		sub.active = md.randomize
		sub.itemR(md, "seed")

	def CAST(self, layout, ob, md):
		layout.itemR(md, "cast_type")
		layout.itemR(md, "object")
		if md.object:
			layout.itemR(md, "use_transform")
		
		flow = layout.column_flow()
		flow.itemR(md, "x")
		flow.itemR(md, "y")
		flow.itemR(md, "z")
		flow.itemR(md, "factor")
		flow.itemR(md, "radius")
		flow.itemR(md, "size")

		layout.itemR(md, "from_radius")
		
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		
	def CLOTH(self, layout, ob, md):
		layout.itemL(text="See Cloth panel.")
		
	def COLLISION(self, layout, ob, md):
		layout.itemL(text="See Collision panel.")
		
	def CURVE(self, layout, ob, md):
		layout.itemR(md, "object")
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "deform_axis")
		
	def DECIMATE(self, layout, ob, md):
		layout.itemR(md, "ratio")
		layout.itemR(md, "face_count")
		
	def DISPLACE(self, layout, ob, md):
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "texture")
		layout.itemR(md, "midlevel")
		layout.itemR(md, "strength")
		layout.itemR(md, "direction")
		layout.itemR(md, "texture_coordinates")
		if md.texture_coordinates == 'OBJECT':
			layout.itemR(md, "texture_coordinate_object", text="Object")
		elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
			layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures")
	
	def EDGE_SPLIT(self, layout, ob, md):
		split = layout.split()
		
		col = split.column()
		col.itemR(md, "use_edge_angle", text="Edge Angle")
		sub = col.column()
		sub.active = md.use_edge_angle
		sub.itemR(md, "split_angle")
		
		col = split.column()
		col.itemR(md, "use_sharp", text="Sharp Edges")
		
	def EXPLODE(self, layout, ob, md):
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "protect")

		flow = layout.column_flow(2)
		flow.itemR(md, "split_edges")
		flow.itemR(md, "unborn")
		flow.itemR(md, "alive")
		flow.itemR(md, "dead")

		layout.itemO("object.explode_refresh", text="Refresh");
		
	def FLUID_SIMULATION(self, layout, ob, md):
		layout.itemL(text="See Fluid panel.")
		
	def HOOK(self, layout, ob, md):
		col = layout.column()
		col.itemR(md, "object")
		if md.object and md.object.type == 'ARMATURE':
			layout.item_pointerR(md, "subtarget", md.object.data, "bones", text="Bone")
		
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")

		split = layout.split()
		split.itemR(md, "falloff")
		split.itemR(md, "force", slider=True)

		layout.itemS()

		row = layout.row()
		row.itemO("object.hook_reset", text="Reset")
		row.itemO("object.hook_recenter", text="Recenter")

		if ob.mode == 'EDIT':
			row = layout.row()
			row.itemO("object.hook_select", text="Select")
			row.itemO("object.hook_assign", text="Assign")
		
	def LATTICE(self, layout, ob, md):
		layout.itemR(md, "object")
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		
	def MASK(self, layout, ob, md):
		layout.itemR(md, "mode")
		if md.mode == 'ARMATURE':
			layout.itemR(md, "armature")
		elif md.mode == 'VERTEX_GROUP':
			layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "inverse")
		
	def MESH_DEFORM(self, layout, ob, md):
		layout.itemR(md, "object")
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "invert")

		layout.itemS()
		
		if md.is_bound:
			layout.itemO("object.meshdeform_bind", text="Unbind")
		else:
			layout.itemO("object.meshdeform_bind", text="Bind")
			row = layout.row()
			row.itemR(md, "precision")
			row.itemR(md, "dynamic")
		
	def MIRROR(self, layout, ob, md):
		layout.itemR(md, "merge_limit")
		split = layout.split()
		
		col = split.column()
		col.itemR(md, "x")
		col.itemR(md, "y")
		col.itemR(md, "z")
		
		col = split.column()
		col.itemL(text="Textures:")
		col.itemR(md, "mirror_u")
		col.itemR(md, "mirror_v")
		
		col = split.column()
		col.itemR(md, "clip", text="Do Clipping")
		col.itemR(md, "mirror_vertex_groups", text="Vertex Group")
		
		layout.itemR(md, "mirror_object")
		
	def MULTIRES(self, layout, ob, md):
		layout.itemR(md, "subdivision_type")
		
		row = layout.row()
		row.itemO("object.multires_subdivide", text="Subdivide")
		row.itemO("object.multires_higher_levels_delete", text="Delete Higher")

		layout.itemR(md, "level")
	
	def PARTICLE_INSTANCE(self, layout, ob, md):
		layout.itemR(md, "object")
		layout.itemR(md, "particle_system_number")
		
		flow = layout.column_flow()
		flow.itemR(md, "normal")
		flow.itemR(md, "children")
		flow.itemR(md, "size")
		flow.itemR(md, "path")
		if md.path:
			flow.itemR(md, "keep_shape")
		flow.itemR(md, "unborn")
		flow.itemR(md, "alive")
		flow.itemR(md, "dead")
		flow.itemL(md, "")
		if md.path:
			flow.itemR(md, "axis", text="")
		
		if md.path:
			row = layout.row()
			row.itemR(md, "position", slider=True)
			row.itemR(md, "random_position", text = "Random", slider=True)
		
	def PARTICLE_SYSTEM(self, layout, ob, md):
		layout.itemL(text="See Particle panel.")
		
	def SHRINKWRAP(self, layout, ob, md):
		layout.itemR(md, "target")
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "offset")
		layout.itemR(md, "subsurf_levels")
		layout.itemR(md, "mode")
		if md.mode == 'PROJECT':
			layout.itemR(md, "subsurf_levels")
			layout.itemR(md, "auxiliary_target")
		
			row = layout.row()
			row.itemR(md, "x")
			row.itemR(md, "y")
			row.itemR(md, "z")
		
			flow = layout.column_flow()
			flow.itemR(md, "negative")
			flow.itemR(md, "positive")
			flow.itemR(md, "cull_front_faces")
			flow.itemR(md, "cull_back_faces")
		elif md.mode == 'NEAREST_SURFACEPOINT':
			layout.itemR(md, "keep_above_surface")
		
	def SIMPLE_DEFORM(self, layout, ob, md):
		layout.itemR(md, "mode")
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "origin")
		layout.itemR(md, "relative")
		layout.itemR(md, "factor")
		layout.itemR(md, "limits")
		if md.mode in ('TAPER', 'STRETCH'):
			layout.itemR(md, "lock_x_axis")
			layout.itemR(md, "lock_y_axis")
			
	def SMOKE(self, layout, ob, md):
		layout.itemL(text="See Smoke panel.")
	
	def SMOOTH(self, layout, ob, md):
		split = layout.split()
		
		col = split.column()
		col.itemR(md, "x")
		col.itemR(md, "y")
		col.itemR(md, "z")
		
		col = split.column()
		col.itemR(md, "factor")
		col.itemR(md, "repeat")
		
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		
	def SOFT_BODY(self, layout, ob, md):
		layout.itemL(text="See Soft Body panel.")
	
	def SUBSURF(self, layout, ob, md):
		layout.row().itemR(md, "subdivision_type", expand=True)
		
		flow = layout.column_flow()
		flow.itemR(md, "levels", text="Preview")
		flow.itemR(md, "render_levels", text="Render")
		flow.itemR(md, "optimal_draw", text="Optimal Display")
		flow.itemR(md, "subsurf_uv")

	def SURFACE(self, layout, ob, md):
		layout.itemL(text="See Fields panel.")
	
	def UV_PROJECT(self, layout, ob, md):
		if ob.type == 'MESH':
			layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures")
			layout.itemR(md, "image")
			layout.itemR(md, "override_image")

			split = layout.split()

			col = split.column()
			col.itemL(text="Aspect Ratio:")

			sub = col.column(align=True)
			sub.itemR(md, "horizontal_aspect_ratio", text="Horizontal")
			sub.itemR(md, "vertical_aspect_ratio", text="Vertical")

			col = split.column()
			col.itemL(text="Projectors:")

			sub = col.column(align=True)
			sub.itemR(md, "num_projectors", text="Number")
			for proj in md.projectors:
				sub.itemR(proj, "object", text="")
		
	def WAVE(self, layout, ob, md):
		split = layout.split()
		
		col = split.column()
		col.itemL(text="Motion:")
		col.itemR(md, "x")
		col.itemR(md, "y")
		col.itemR(md, "cyclic")
		
		col = split.column()
		col.itemR(md, "normals")
		sub = col.column()
		sub.active = md.normals
		sub.itemR(md, "x_normal", text="X")
		sub.itemR(md, "y_normal", text="Y")
		sub.itemR(md, "z_normal", text="Z")
		
		split = layout.split()

		col = split.column()
		col.itemL(text="Time:")
		sub = col.column(align=True)
		sub.itemR(md, "time_offset", text="Offset")
		sub.itemR(md, "lifetime", text="Life")
		col.itemR(md, "damping_time", text="Damping")
		
		col = split.column()
		col.itemL(text="Position:")
		sub = col.column(align=True)
		sub.itemR(md, "start_position_x", text="X")
		sub.itemR(md, "start_position_y", text="Y")
		col.itemR(md, "falloff_radius", text="Falloff")
		
		layout.itemS()
		
		layout.itemR(md, "start_position_object")
		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
		layout.itemR(md, "texture")
		layout.itemR(md, "texture_coordinates")
		if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
			layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures")
		elif md.texture_coordinates == 'OBJECT':
			layout.itemR(md, "texture_coordinates_object")
		
		layout.itemS()
		
		flow = layout.column_flow()
		flow.itemR(md, "speed", slider=True)
		flow.itemR(md, "height", slider=True)
		flow.itemR(md, "width", slider=True)
		flow.itemR(md, "narrowness", slider=True)

bpy.types.register(DATA_PT_modifiers)