Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.68 KB | None | 0 0
  1. import bpy
  2. from bpy.types import Panel
  3. from bpy.app.translations import pgettext_iface as iface_
  4.  
  5.  
  6. class ModifierButtonsPanel():
  7.     bl_space_type = 'PROPERTIES'
  8.     bl_region_type = 'WINDOW'
  9.     bl_context = "modifier"
  10.     bl_options = {'HIDE_HEADER'}
  11.  
  12.  
  13. class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
  14.     bl_label = "Modifiers"
  15.  
  16.     def draw(self, context):
  17.         layout = self.layout
  18.  
  19.         ob = context.object
  20.  
  21.         layout.operator_menu_enum("object.modifier_add", "type")
  22.  
  23.         for md in ob.modifiers:
  24.             box = layout.template_modifier(md)
  25.             if box:
  26.                 # match enum type to our functions, avoids a lookup table.
  27.                 getattr(self, md.type)(box, ob, md)
  28.  
  29.     # the mt.type enum is (ab)used for a lookup on function names
  30.     # ...to avoid lengthy if statements
  31.     # so each type must have a function here.
  32.  
  33.     def ARMATURE(self, layout, ob, md):
  34.         split = layout.split()
  35.  
  36.         col = split.column()
  37.         col.label(text="Object:")
  38.         col.prop(md, "object", text="")
  39.         col.prop(md, "use_deform_preserve_volume")
  40.  
  41.         col = split.column()
  42.         col.label(text="Bind To:")
  43.         col.prop(md, "use_vertex_groups", text="Vertex Groups")
  44.         col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
  45.  
  46.         layout.separator()
  47.  
  48.         split = layout.split()
  49.  
  50.         row = split.row(align=True)
  51.         row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
  52.         sub = row.row(align=True)
  53.         sub.active = bool(md.vertex_group)
  54.         sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
  55.  
  56.         split.prop(md, "use_multi_modifier")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement