Added single column support to modifiers

Tiny cleanups and improvements in some modifier layouts
This commit is contained in:
William Reynish
2009-11-16 16:07:22 +00:00
parent d6c0680268
commit ca5a912c3e
2 changed files with 245 additions and 137 deletions

View File

@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
narrowui = 180
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
@@ -33,31 +34,37 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout = self.layout
ob = context.object
col2 = context.region.width > narrowui
row = layout.row()
row.item_menu_enumO("object.modifier_add", "type")
row.itemL()
if col2:
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)
getattr(self, md.type)(box, ob, md, col2)
# 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")
def ARMATURE(self, layout, ob, md, col2):
if col2:
layout.itemR(md, "object")
else:
layout.itemR(md, "object", text="")
split = layout.split(percentage=0.5)
split.itemL(text="Vertex Group:")
sub = split.split(percentage=0.7)
row = layout.row()
if col2:
row.itemL(text="Vertex Group:")
sub = row.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")
subsub.itemR(md, "invert", text="Inv")
layout.itemS()
@@ -68,13 +75,19 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "use_vertex_groups", text="Vertex Groups")
col.itemR(md, "use_bone_envelopes", text="Bone Envelopes")
col = split.column()
if col2:
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")
def ARRAY(self, layout, ob, md, col2):
if col2:
layout.itemR(md, "fit_type")
else:
layout.itemR(md, "fit_type", text="")
if md.fit_type == 'FIXED_COUNT':
layout.itemR(md, "count")
elif md.fit_type == 'FIT_LENGTH':
@@ -100,7 +113,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.itemR(md, "merge_end_vertices", text="First Last")
sub.itemR(md, "merge_distance", text="Distance")
col = split.column()
if col2:
col = split.column()
col.itemR(md, "relative_offset")
sub = col.column()
sub.active = md.relative_offset
@@ -119,10 +133,15 @@ class DATA_PT_modifiers(DataButtonsPanel):
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")
def BEVEL(self, layout, ob, md, col2):
split = layout.split()
col = split.column()
col.itemR(md, "width")
if col2:
col = split.column()
col.itemR(md, "only_vertices")
layout.itemL(text="Limit Method:")
layout.row().itemR(md, "limit_method", expand=True)
@@ -131,61 +150,76 @@ class DATA_PT_modifiers(DataButtonsPanel):
elif md.limit_method == 'WEIGHT':
layout.row().itemR(md, "edge_weight_method", expand=True)
def BOOLEAN(self, layout, ob, md):
def BOOLEAN(self, layout, ob, md, col2):
layout.itemR(md, "operation")
layout.itemR(md, "object")
def BUILD(self, layout, ob, md):
def BUILD(self, layout, ob, md, col2):
split = layout.split()
col = split.column()
col.itemR(md, "start")
col.itemR(md, "length")
col = split.column()
if col2:
col = split.column()
col.itemR(md, "randomize")
sub = col.column()
sub.active = md.randomize
sub.itemR(md, "seed")
def CAST(self, layout, ob, md):
def CAST(self, layout, ob, md, col2):
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")
split = layout.split()
col = split.column()
col.itemR(md, "x")
col.itemR(md, "y")
col.itemR(md, "z")
if col2:
col = split.column()
col.itemR(md, "factor")
col.itemR(md, "radius")
col.itemR(md, "size")
layout.itemR(md, "from_radius")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
def CLOTH(self, layout, ob, md):
def CLOTH(self, layout, ob, md, col2):
layout.itemL(text="See Cloth panel.")
def COLLISION(self, layout, ob, md):
def COLLISION(self, layout, ob, md, col2):
layout.itemL(text="See Collision panel.")
def CURVE(self, layout, ob, md):
def CURVE(self, layout, ob, md, col2):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "deform_axis")
def DECIMATE(self, layout, ob, md):
def DECIMATE(self, layout, ob, md, col2):
layout.itemR(md, "ratio")
layout.itemR(md, "face_count")
def DISPLACE(self, layout, ob, md):
def DISPLACE(self, layout, ob, md, col2):
split = layout.split()
col = split.column()
col.itemR(md, "midlevel")
if col2:
col = split.column()
col.itemR(md, "strength")
layout.itemS()
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':
@@ -193,7 +227,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
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):
def EDGE_SPLIT(self, layout, ob, md, col2):
split = layout.split()
col = split.column()
@@ -202,25 +236,31 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = md.use_edge_angle
sub.itemR(md, "split_angle")
col = split.column()
if col2:
col = split.column()
col.itemR(md, "use_sharp", text="Sharp Edges")
def EXPLODE(self, layout, ob, md):
def EXPLODE(self, layout, ob, md, col2):
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")
split = layout.split()
col = split.column()
col.itemR(md, "split_edges")
col.itemR(md, "unborn")
if col2:
col = split.column()
col.itemR(md, "alive")
col.itemR(md, "dead")
layout.itemO("object.explode_refresh", text="Refresh")
def FLUID_SIMULATION(self, layout, ob, md):
def FLUID_SIMULATION(self, layout, ob, md, col2):
layout.itemL(text="See Fluid panel.")
def HOOK(self, layout, ob, md):
def HOOK(self, layout, ob, md, col2):
col = layout.column()
col.itemR(md, "object")
if md.object and md.object.type == 'ARMATURE':
@@ -229,25 +269,35 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
split = layout.split()
split.itemR(md, "falloff")
split.itemR(md, "force", slider=True)
col = split.column()
col.itemR(md, "falloff")
if col2:
col = split.column()
col.itemR(md, "force", slider=True)
layout.itemS()
row = layout.row()
row.itemO("object.hook_reset", text="Reset")
row.itemO("object.hook_recenter", text="Recenter")
split = layout.split()
col = split.column()
col.itemO("object.hook_reset", text="Reset")
if col2:
col = split.column()
col.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):
def LATTICE(self, layout, ob, md, col2):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
def MASK(self, layout, ob, md):
def MASK(self, layout, ob, md, col2):
layout.itemR(md, "mode")
if md.mode == 'ARMATURE':
layout.itemR(md, "armature")
@@ -255,7 +305,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "inverse")
def MESH_DEFORM(self, layout, ob, md):
def MESH_DEFORM(self, layout, ob, md, col2):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "invert")
@@ -266,12 +316,17 @@ class DATA_PT_modifiers(DataButtonsPanel):
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")
split = layout.split()
def MIRROR(self, layout, ob, md):
layout.itemR(md, "merge_limit")
col = split.column()
col.itemR(md, "precision")
if col2:
col = split.column()
col.itemR(md, "dynamic")
def MIRROR(self, layout, ob, md, col2):
split = layout.split()
col = split.column()
@@ -279,60 +334,92 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "y")
col.itemR(md, "z")
col = split.column()
if col2:
col = split.column()
col.itemL(text="Textures:")
col.itemR(md, "mirror_u")
col.itemR(md, "mirror_v")
col.itemR(md, "mirror_u", text="U")
col.itemR(md, "mirror_v", text="V")
layout.itemR(md, "merge_limit")
split = layout.split()
col = split.column()
col.itemR(md, "clip", text="Do Clipping")
col.itemR(md, "mirror_vertex_groups", text="Vertex Group")
col.itemR(md, "clip")
if col2:
col = split.column()
col.itemR(md, "mirror_vertex_groups", text="Vertex Groups")
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")
def MULTIRES(self, layout, ob, md, col2):
if col2:
layout.row().itemR(md, "subdivision_type", expand=True)
else:
layout.row().itemR(md, "subdivision_type", text="")
layout.itemR(md, "level")
split = layout.split()
def PARTICLE_INSTANCE(self, layout, ob, md):
col = split.column()
col.itemO("object.multires_subdivide", text="Subdivide")
if col2:
col = split.column()
col.itemO("object.multires_higher_levels_delete", text="Delete Higher")
def PARTICLE_INSTANCE(self, layout, ob, md, col2):
layout.itemR(md, "object")
layout.itemR(md, "particle_system_number")
layout.itemR(md, "particle_system_number", text="Particle System")
split = layout.split()
col = split.column()
col.itemL(text="Create From:")
col.itemR(md, "normal")
col.itemR(md, "children")
col.itemR(md, "size")
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 col2:
col = split.column()
col.itemL(text="Show Particles When:")
col.itemR(md, "alive")
col.itemR(md, "unborn")
col.itemR(md, "dead")
layout.itemS()
layout.itemR(md, "path", text="Create Along Paths")
split = layout.split()
split.active = md.path
col = split.column()
col.row().itemR(md, "axis", expand=True)
col.itemR(md, "keep_shape")
if col2:
col = split.column()
col.itemR(md, "position", slider=True)
col.itemR(md, "random_position", text="Random", slider=True)
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):
def PARTICLE_SYSTEM(self, layout, ob, md, col2):
layout.itemL(text="See Particle panel.")
def SHRINKWRAP(self, layout, ob, md):
def SHRINKWRAP(self, layout, ob, md, col2):
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")
split = layout.split()
col = split.column()
col.itemR(md, "offset")
if col2:
col = split.column()
col.itemR(md, "subsurf_levels")
if col2:
layout.itemR(md, "mode")
else:
layout.itemR(md, "mode", text="")
if md.mode == 'PROJECT':
layout.itemR(md, "subsurf_levels")
layout.itemR(md, "auxiliary_target")
row = layout.row()
@@ -340,29 +427,35 @@ class DATA_PT_modifiers(DataButtonsPanel):
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")
split = layout.split()
col = split.column()
col.itemL(text="Direction:")
col.itemR(md, "negative")
col.itemR(md, "positive")
col = split.column()
col.itemL(text="Cull Faces:")
col.itemR(md, "cull_front_faces", text="Front")
col.itemR(md, "cull_back_faces", text="Back")
elif md.mode == 'NEAREST_SURFACEPOINT':
layout.itemR(md, "keep_above_surface")
def SIMPLE_DEFORM(self, layout, ob, md):
def SIMPLE_DEFORM(self, layout, ob, md, col2):
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")
layout.itemR(md, "limits", slider=True)
if md.mode in ('TAPER', 'STRETCH'):
layout.itemR(md, "lock_x_axis")
layout.itemR(md, "lock_y_axis")
def SMOKE(self, layout, ob, md):
def SMOKE(self, layout, ob, md, col2):
layout.itemL(text="See Smoke panel.")
def SMOOTH(self, layout, ob, md):
def SMOOTH(self, layout, ob, md, col2):
split = layout.split()
col = split.column()
@@ -370,51 +463,59 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "y")
col.itemR(md, "z")
col = split.column()
if col2:
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):
def SOFT_BODY(self, layout, ob, md, col2):
layout.itemL(text="See Soft Body panel.")
def SUBSURF(self, layout, ob, md):
layout.row().itemR(md, "subdivision_type", expand=True)
def SUBSURF(self, layout, ob, md, col2):
if col2:
layout.row().itemR(md, "subdivision_type", expand=True)
else:
layout.row().itemR(md, "subdivision_type", text="")
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")
split = layout.split()
col = split.column()
col.itemL(text="Subdivisions:")
col.itemR(md, "levels", text="View")
col.itemR(md, "render_levels", text="Render")
if col2:
col = split.column()
col.itemL(text="Options:")
col.itemR(md, "optimal_draw", text="Optimal Display")
col.itemR(md, "subsurf_uv")
def SURFACE(self, layout, ob, md):
def SURFACE(self, layout, ob, md, col2):
layout.itemL(text="See Fields panel.")
def UV_PROJECT(self, layout, ob, md):
def UV_PROJECT(self, layout, ob, md, col2):
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:")
col.itemR(md, "override_image")
col.itemR(md, "num_projectors", text="Projectors")
for proj in md.projectors:
col.itemR(proj, "object", text="")
if col2:
col = split.column()
sub = col.column(align=True)
sub.itemL(text="Aspect Ratio:")
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):
def WAVE(self, layout, ob, md, col2):
split = layout.split()
col = split.column()
@@ -423,7 +524,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "y")
col.itemR(md, "cyclic")
col = split.column()
if col2:
col = split.column()
col.itemR(md, "normals")
sub = col.column()
sub.active = md.normals
@@ -440,7 +542,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.itemR(md, "lifetime", text="Life")
col.itemR(md, "damping_time", text="Damping")
col = split.column()
if col2:
col = split.column()
col.itemL(text="Position:")
sub = col.column(align=True)
sub.itemR(md, "start_position_x", text="X")
@@ -460,10 +563,15 @@ class DATA_PT_modifiers(DataButtonsPanel):
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)
split = layout.split()
col = split.column()
col.itemR(md, "speed", slider=True)
col.itemR(md, "height", slider=True)
if col2:
col = split.column()
col.itemR(md, "width", slider=True)
col.itemR(md, "narrowness", slider=True)
bpy.types.register(DATA_PT_modifiers)

View File

@@ -516,7 +516,7 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
prop= RNA_def_property(srna, "subsurf_uv", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv);
RNA_def_property_ui_text(prop, "Subsurf UV", "Use subsurf to subdivide UVs.");
RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs.");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}