Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- from bpy.types import Panel
- from bpy.app.translations import pgettext_iface as iface_
- class ModifierButtonsPanel():
- bl_space_type = 'PROPERTIES'
- bl_region_type = 'WINDOW'
- bl_context = "modifier"
- bl_options = {'HIDE_HEADER'}
- class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
- bl_label = "Modifiers"
- def draw(self, context):
- layout = self.layout
- ob = context.object
- layout.operator_menu_enum("object.modifier_add", "type")
- 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):
- split = layout.split()
- col = split.column()
- col.label(text="Object:")
- col.prop(md, "object", text="")
- col.prop(md, "use_deform_preserve_volume")
- col = split.column()
- col.label(text="Bind To:")
- col.prop(md, "use_vertex_groups", text="Vertex Groups")
- col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
- layout.separator()
- split = layout.split()
- row = split.row(align=True)
- row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
- sub = row.row(align=True)
- sub.active = bool(md.vertex_group)
- sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
- split.prop(md, "use_multi_modifier")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement