diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-08-09 15:32:55 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-08-09 15:32:55 +0400 |
commit | dd75ec490761640571a0d8e53a0d439091f2736f (patch) | |
tree | 25b3966862febbf3ee8c81ed45f7045c99f84016 /release/scripts/ui/properties_data_modifier.py | |
parent | 02b0967bd11dd6fd2454b37182d9f94ea451b603 (diff) | |
parent | c026b8066ddc1c42144d2e5132384ea7c1211050 (diff) |
Merged changes in the trunk up to revision 31190.
Diffstat (limited to 'release/scripts/ui/properties_data_modifier.py')
-rw-r--r-- | release/scripts/ui/properties_data_modifier.py | 242 |
1 files changed, 85 insertions, 157 deletions
diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py index 37764e20854..2847810f417 100644 --- a/release/scripts/ui/properties_data_modifier.py +++ b/release/scripts/ui/properties_data_modifier.py @@ -19,47 +19,41 @@ # <pep8 compliant> import bpy -narrowui = bpy.context.user_preferences.view.properties_width_check -narrowmod = 260 - -class DataButtonsPanel(bpy.types.Panel): +class ModifierButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "modifier" -class DATA_PT_modifiers(DataButtonsPanel): +class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel): bl_label = "Modifiers" def draw(self, context): layout = self.layout ob = context.object - wide_ui = context.region.width > narrowui - compact_mod = context.region.width < narrowmod layout.operator_menu_enum("object.modifier_add", "type") for md in ob.modifiers: - box = layout.template_modifier(md, compact=compact_mod) + box = layout.template_modifier(md) if box: # match enum type to our functions, avoids a lookup table. - getattr(self, md.type)(box, ob, md, wide_ui) + 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, wide_ui): + def ARMATURE(self, layout, ob, md): split = layout.split() col = split.column() col.label(text="Object:") col.prop(md, "object", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Vertex Group::") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") sub = col.column() @@ -73,18 +67,13 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "use_vertex_groups", text="Vertex Groups") col.prop(md, "use_bone_envelopes", text="Bone Envelopes") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Deformation:") col.prop(md, "quaternion") col.prop(md, "multi_modifier") - def ARRAY(self, layout, ob, md, wide_ui): - if wide_ui: - layout.prop(md, "fit_type") - else: - layout.prop(md, "fit_type", text="") - + def ARRAY(self, layout, ob, md): + layout.prop(md, "fit_type") if md.fit_type == 'FIXED_COUNT': layout.prop(md, "count") @@ -111,8 +100,7 @@ class DATA_PT_modifiers(DataButtonsPanel): sub.prop(md, "merge_end_vertices", text="First Last") sub.prop(md, "merge_distance", text="Distance") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "relative_offset") sub = col.column() sub.active = md.relative_offset @@ -131,14 +119,13 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "start_cap") col.prop(md, "end_cap") - def BEVEL(self, layout, ob, md, wide_ui): + def BEVEL(self, layout, ob, md): split = layout.split() col = split.column() col.prop(md, "width") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "only_vertices") layout.label(text="Limit Method:") @@ -148,40 +135,35 @@ class DATA_PT_modifiers(DataButtonsPanel): elif md.limit_method == 'WEIGHT': layout.row().prop(md, "edge_weight_method", expand=True) - def BOOLEAN(self, layout, ob, md, wide_ui): + def BOOLEAN(self, layout, ob, md): split = layout.split() col = split.column() col.label(text="Operation:") col.prop(md, "operation", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Object:") col.prop(md, "object", text="") - def BUILD(self, layout, ob, md, wide_ui): + def BUILD(self, layout, ob, md): split = layout.split() col = split.column() col.prop(md, "frame_start") col.prop(md, "length") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "randomize") sub = col.column() sub.active = md.randomize sub.prop(md, "seed") - def CAST(self, layout, ob, md, wide_ui): + def CAST(self, layout, ob, md): split = layout.split(percentage=0.25) - if wide_ui: - split.label(text="Cast Type:") - split.prop(md, "cast_type", text="") - else: - layout.prop(md, "cast_type", text="") + split.label(text="Cast Type:") + split.prop(md, "cast_type", text="") split = layout.split(percentage=0.25) @@ -201,37 +183,35 @@ class DATA_PT_modifiers(DataButtonsPanel): col = split.column() col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Control Object:") col.prop(md, "object", text="") if md.object: col.prop(md, "use_transform") - def CLOTH(self, layout, ob, md, wide_ui): + def CLOTH(self, layout, ob, md): layout.label(text="See Cloth panel.") - def COLLISION(self, layout, ob, md, wide_ui): + def COLLISION(self, layout, ob, md): layout.label(text="See Collision panel.") - def CURVE(self, layout, ob, md, wide_ui): + def CURVE(self, layout, ob, md): split = layout.split() col = split.column() col.label(text="Object:") col.prop(md, "object", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") layout.label(text="Deformation Axis:") layout.row().prop(md, "deform_axis", expand=True) - def DECIMATE(self, layout, ob, md, wide_ui): + def DECIMATE(self, layout, ob, md): layout.prop(md, "ratio") layout.label(text="Face Count: %s" % str(md.face_count)) - def DISPLACE(self, layout, ob, md, wide_ui): + def DISPLACE(self, layout, ob, md): split = layout.split() col = split.column() @@ -240,8 +220,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Direction:") col.prop(md, "direction", text="") col.label(text="Texture Coordinates:") @@ -258,11 +237,10 @@ class DATA_PT_modifiers(DataButtonsPanel): col = split.column() col.prop(md, "midlevel") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "strength") - def EDGE_SPLIT(self, layout, ob, md, wide_ui): + def EDGE_SPLIT(self, layout, ob, md): split = layout.split() col = split.column() @@ -271,11 +249,10 @@ class DATA_PT_modifiers(DataButtonsPanel): sub.active = md.use_edge_angle sub.prop(md, "split_angle") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "use_sharp", text="Sharp Edges") - def EXPLODE(self, layout, ob, md, wide_ui): + def EXPLODE(self, layout, ob, md): split = layout.split() col = split.column() @@ -285,8 +262,7 @@ class DATA_PT_modifiers(DataButtonsPanel): sub.active = bool(md.vertex_group) sub.prop(md, "protect") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "split_edges") col.prop(md, "unborn") col.prop(md, "alive") @@ -295,10 +271,10 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.operator("object.explode_refresh", text="Refresh") - def FLUID_SIMULATION(self, layout, ob, md, wide_ui): + def FLUID_SIMULATION(self, layout, ob, md): layout.label(text="See Fluid panel.") - def HOOK(self, layout, ob, md, wide_ui): + def HOOK(self, layout, ob, md): split = layout.split() col = split.column() @@ -307,8 +283,7 @@ class DATA_PT_modifiers(DataButtonsPanel): if md.object and md.object.type == 'ARMATURE': col.label(text="Bone:") col.prop_object(md, "subtarget", md.object.data, "bones", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") @@ -319,10 +294,8 @@ class DATA_PT_modifiers(DataButtonsPanel): col = split.column() col.prop(md, "falloff") col.prop(md, "force", slider=True) - if wide_ui: - col = split.column() - else: - col.separator() + + col = split.column() col.operator("object.hook_reset", text="Reset") col.operator("object.hook_recenter", text="Recenter") @@ -332,26 +305,24 @@ class DATA_PT_modifiers(DataButtonsPanel): row.operator("object.hook_select", text="Select") row.operator("object.hook_assign", text="Assign") - def LATTICE(self, layout, ob, md, wide_ui): + def LATTICE(self, layout, ob, md): split = layout.split() col = split.column() col.label(text="Object:") col.prop(md, "object", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") - def MASK(self, layout, ob, md, wide_ui): + def MASK(self, layout, ob, md): split = layout.split() col = split.column() col.label(text="Mode:") col.prop(md, "mode", text="") - if wide_ui: - col = split.column() + col = split.column() if md.mode == 'ARMATURE': col.label(text="Armature:") col.prop(md, "armature", text="") @@ -363,15 +334,14 @@ class DATA_PT_modifiers(DataButtonsPanel): sub.active = bool(md.vertex_group) sub.prop(md, "invert") - def MESH_DEFORM(self, layout, ob, md, wide_ui): + def MESH_DEFORM(self, layout, ob, md): split = layout.split() col = split.column() sub = col.column() sub.label(text="Object:") sub.prop(md, "object", text="") sub.active = not md.is_bound - if wide_ui: - col = split.column() + col = split.column() col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") @@ -391,16 +361,12 @@ class DATA_PT_modifiers(DataButtonsPanel): col = split.column() col.prop(md, "precision") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "dynamic") - def MIRROR(self, layout, ob, md, wide_ui): + def MIRROR(self, layout, ob, md): layout.prop(md, "merge_limit") - if wide_ui: - split = layout.split(percentage=0.25) - else: - split = layout.split(percentage=0.4) + split = layout.split(percentage=0.25) col = split.column() col.label(text="Axis:") @@ -408,11 +374,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "y") col.prop(md, "z") - if wide_ui: - col = split.column() - else: - subsplit = layout.split() - col = subsplit.column() + col = split.column() col.label(text="Options:") col.prop(md, "clip", text="Clipping") col.prop(md, "mirror_vertex_groups", text="Vertex Groups") @@ -426,11 +388,8 @@ class DATA_PT_modifiers(DataButtonsPanel): col.label(text="Mirror Object:") col.prop(md, "mirror_object", text="") - def MULTIRES(self, layout, ob, md, wide_ui): - if wide_ui: - layout.row().prop(md, "subdivision_type", expand=True) - else: - layout.row().prop(md, "subdivision_type", text="") + def MULTIRES(self, layout, ob, md): + layout.row().prop(md, "subdivision_type", expand=True) split = layout.split() col = split.column() @@ -438,8 +397,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "sculpt_levels", text="Sculpt") col.prop(md, "render_levels", text="Render") - if wide_ui: - col = split.column() + col = split.column() col.enabled = ob.mode != 'EDIT' col.operator("object.multires_subdivide", text="Subdivide") @@ -460,7 +418,7 @@ class DATA_PT_modifiers(DataButtonsPanel): row.operator("object.multires_external_save", text="Save External...") row.label() - def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui): + def PARTICLE_INSTANCE(self, layout, ob, md): layout.prop(md, "object") layout.prop(md, "particle_system_number", text="Particle System") @@ -471,8 +429,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "children") col.prop(md, "size") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Show Particles When:") col.prop(md, "alive") col.prop(md, "unborn") @@ -488,15 +445,14 @@ class DATA_PT_modifiers(DataButtonsPanel): col.row().prop(md, "axis", expand=True) col.prop(md, "keep_shape") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "position", slider=True) col.prop(md, "random_position", text="Random", slider=True) - def PARTICLE_SYSTEM(self, layout, ob, md, wide_ui): + def PARTICLE_SYSTEM(self, layout, ob, md): layout.label(text="See Particle panel.") - def SCREW(self, layout, ob, md, wide_ui): + def SCREW(self, layout, ob, md): split = layout.split() col = split.column() @@ -506,8 +462,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "steps") col.prop(md, "render_steps") - if wide_ui: - col = split.column() + col = split.column() row = col.row() row.active = (md.object is None or md.use_object_screw_offset == False) row.prop(md, "screw_offset") @@ -518,13 +473,12 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "use_normal_flip") col.prop(md, "iterations") - def SHRINKWRAP(self, layout, ob, md, wide_ui): + def SHRINKWRAP(self, layout, ob, md): split = layout.split() col = split.column() col.label(text="Target:") col.prop(md, "target", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") @@ -534,15 +488,12 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "offset") col.prop(md, "subsurf_levels") - if wide_ui: - col = split.column() - col.label(text="Mode:") + col = split.column() + col.label(text="Mode:") col.prop(md, "mode", text="") - if wide_ui: - split = layout.split(percentage=0.25) - else: - split = layout.split(percentage=0.35) + split = layout.split(percentage=0.25) + col = split.column() if md.mode == 'PROJECT': @@ -556,11 +507,8 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "negative") col.prop(md, "positive") - if wide_ui: - col = split.column() - else: - subsplit = layout.split() - col = subsplit.column() + col = split.column() + col.label(text="Cull Faces:") col.prop(md, "cull_front_faces", text="Front") col.prop(md, "cull_back_faces", text="Back") @@ -571,15 +519,14 @@ class DATA_PT_modifiers(DataButtonsPanel): elif md.mode == 'NEAREST_SURFACEPOINT': layout.prop(md, "keep_above_surface") - def SIMPLE_DEFORM(self, layout, ob, md, wide_ui): + def SIMPLE_DEFORM(self, layout, ob, md): split = layout.split() col = split.column() col.label(text="Mode:") col.prop(md, "mode", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") @@ -592,8 +539,7 @@ class DATA_PT_modifiers(DataButtonsPanel): sub.active = (md.origin != "") sub.prop(md, "relative") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Deform:") col.prop(md, "factor") col.prop(md, "limits", slider=True) @@ -601,10 +547,10 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "lock_x_axis") col.prop(md, "lock_y_axis") - def SMOKE(self, layout, ob, md, wide_ui): + def SMOKE(self, layout, ob, md): layout.label(text="See Smoke panel.") - def SMOOTH(self, layout, ob, md, wide_ui): + def SMOOTH(self, layout, ob, md): split = layout.split(percentage=0.25) col = split.column() @@ -619,10 +565,10 @@ class DATA_PT_modifiers(DataButtonsPanel): col.label(text="Vertex Group:") col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") - def SOFT_BODY(self, layout, ob, md, wide_ui): + def SOFT_BODY(self, layout, ob, md): layout.label(text="See Soft Body panel.") - def SOLIDIFY(self, layout, ob, md, wide_ui): + def SOLIDIFY(self, layout, ob, md): split = layout.split() @@ -635,8 +581,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "edge_crease_outer", text="Outer") col.prop(md, "edge_crease_rim", text="Rim") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "offset") colsub = col.column() @@ -655,11 +600,8 @@ class DATA_PT_modifiers(DataButtonsPanel): # col.label(text="Vertex Group:") # col.prop_object(md, "vertex_group", ob, "vertex_groups", text="") - def SUBSURF(self, layout, ob, md, wide_ui): - if wide_ui: - layout.row().prop(md, "subdivision_type", expand=True) - else: - layout.row().prop(md, "subdivision_type", text="") + def SUBSURF(self, layout, ob, md): + layout.row().prop(md, "subdivision_type", expand=True) split = layout.split() col = split.column() @@ -667,16 +609,15 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "levels", text="View") col.prop(md, "render_levels", text="Render") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Options:") col.prop(md, "subsurf_uv") col.prop(md, "optimal_display") - def SURFACE(self, layout, ob, md, wide_ui): + def SURFACE(self, layout, ob, md): layout.label(text="See Fields panel.") - def UV_PROJECT(self, layout, ob, md, wide_ui): + def UV_PROJECT(self, layout, ob, md): if ob.type == 'MESH': split = layout.split() @@ -684,8 +625,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.label(text="Image:") col.prop(md, "image", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="UV Layer:") col.prop_object(md, "uv_layer", ob.data, "uv_textures", text="") @@ -696,8 +636,7 @@ class DATA_PT_modifiers(DataButtonsPanel): for proj in md.projectors: col.prop(proj, "object", text="") - if wide_ui: - col = split.column() + col = split.column() sub = col.column(align=True) sub.prop(md, "aspect_x", text="Aspect X") sub.prop(md, "aspect_y", text="Aspect Y") @@ -706,7 +645,7 @@ class DATA_PT_modifiers(DataButtonsPanel): sub.prop(md, "scale_x", text="Scale X") sub.prop(md, "scale_y", text="Scale Y") - def WAVE(self, layout, ob, md, wide_ui): + def WAVE(self, layout, ob, md): split = layout.split() col = split.column() @@ -715,8 +654,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "y") col.prop(md, "cyclic") - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "normals") sub = col.column() sub.active = md.normals @@ -733,8 +671,7 @@ class DATA_PT_modifiers(DataButtonsPanel): sub.prop(md, "lifetime", text="Life") col.prop(md, "damping_time", text="Damping") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Position:") sub = col.column(align=True) sub.prop(md, "start_position_x", text="X") @@ -760,26 +697,17 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "speed", slider=True) col.prop(md, "height", slider=True) - if wide_ui: - col = split.column() + col = split.column() col.prop(md, "width", slider=True) col.prop(md, "narrowness", slider=True) -classes = [ - DATA_PT_modifiers] - - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() |