At stackexhange Zeffii posted this:
It recreates the modifiers in a panel in the tool shelve
import bpy
from bpy.types import Menu, Panel, UIList
from bl_ui.properties_data_modifier import DATA_PT_modifiers as PT_MOD
@classmethod
def poll(cls, context):
return (context.object is not None)
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)
def make_panel(name, poll, draw, funcs):
overwrites = {
“bl_space_type”: “VIEW_3D”,
“bl_region_type”: “TOOLS”,
“bl_label”: “Test”,
“bl_context”: “objectmode”,
“bl_category”: “Test”,
“poll”: poll,
“draw”: draw
}
for f in dir(funcs):
if f.isupper():
overwrites[f] = getattr(funcs, f)
return type(name, (Panel,), overwrites)
RigPanel = make_panel(“OpenStudioAddRigPanel”, poll, draw, funcs=PT_MOD)
def register():
bpy.utils.register_class(RigPanel)
def unregister():
bpy.utils.unregister_class(RigPanel)
if name == “main”:
register()
print(“Add Rig loaded”)