forked from bartvdbraak/blender
94902dac97
* template_modifier creates the modifier box, and returns a layout to put the buttons in. * Only the armature modifier is now done with python code, all other modifiers use C code. To convert a modifier to python, remove the corresponding C code and create a function in DATA_PT_modifiers. * Some modifiers still require some RNA work to get it working well, especially to make pointers editable. Mostly that is a matter of defining an own _set callback and put some of the modifier C code into it. * Still various buttons that don't work, like for hooks or mesh deform binding. * Fix for crashing decimate modifier (still disabled). * Removed UI_BUT_NO_HILITE, HMENU. * Make uiLayoutBox work with align.
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
|
|
import bpy
|
|
|
|
class DataButtonsPanel(bpy.types.Panel):
|
|
__space_type__ = "BUTTONS_WINDOW"
|
|
__region_type__ = "WINDOW"
|
|
__context__ = "modifier"
|
|
|
|
def poll(self, context):
|
|
ob = context.active_object
|
|
return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
|
|
|
|
class DATA_PT_modifiers(DataButtonsPanel):
|
|
__idname__ = "DATA_PT_modifiers"
|
|
__label__ = "Modifiers"
|
|
|
|
def draw(self, context):
|
|
ob = context.active_object
|
|
layout = self.layout
|
|
|
|
if not ob:
|
|
return
|
|
|
|
row = layout.row()
|
|
row.item_menu_enumO("OBJECT_OT_modifier_add", "type")
|
|
row.itemL();
|
|
|
|
for md in ob.modifiers:
|
|
box = layout.template_modifier(context, md)
|
|
|
|
if md.expanded:
|
|
if md.type == 'ARMATURE':
|
|
self.armature(box, md)
|
|
|
|
def armature(self, layout, md):
|
|
layout.itemR(md, "object")
|
|
row = layout.row()
|
|
row.itemR(md, "vertex_group")
|
|
row.itemR(md, "invert")
|
|
flow = layout.column_flow()
|
|
flow.itemR(md, "use_vertex_groups")
|
|
flow.itemR(md, "use_bone_envelopes")
|
|
flow.itemR(md, "quaternion")
|
|
flow.itemR(md, "multi_modifier")
|
|
|
|
bpy.types.register(DATA_PT_modifiers)
|
|
|