All you need to do is to edit the draw function and add whatever properties you want. Since you have access to the ‘context’ in the draw call, you can access to everything in the blend file (for example, context.blenddata will give you total access to bpy.data)…
Probably it might be better to create different operators each for each type of data (object matrix, object modifiers, scene data, world data, etc), and another operator just to let you choose which data you want to see and tweak.
for example, mixing the Transform data and the Modifiers in the same popup:
import bpy
class SimpleOperator(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.simple_operator"
bl_label = "Edit Modifier"
bl_options = {'REGISTER', 'UNDO'}
def modifiers_cb(self, context):
return [(md.name, md.name, '') for md in context.object.modifiers]
modifier = bpy.props.EnumProperty(items=modifiers_cb)
@classmethod
def poll(cls, context):
return (context.active_object is not None and
context.active_object.type == 'MESH')
def execute(self, context):
return {'FINISHED'}
def draw(self, context):
layout = self.layout
ob = context.active_object
#### Transform Data ####
row = layout.row()
row.column().prop(ob, "location")
if ob.rotation_mode == 'QUATERNION':
row.column().prop(ob, "rotation_quaternion", text="Rotation")
elif ob.rotation_mode == 'AXIS_ANGLE':
row.column().prop(ob, "rotation_axis_angle", text="Rotation")
else:
row.column().prop(ob, "rotation_euler", text="Rotation")
row.column().prop(ob, "scale")
layout.prop(ob, "rotation_mode")
#### Modifier Data ####
md = ob.modifiers.get(self.modifier)
md_self = bpy.types.DATA_PT_modifiers
box = layout.template_modifier(md)
if box:
# match enum type to our functions, avoids a lookup table.
getattr(md_self, md.type)(md_self, box, ob, md)
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
class customMenu ( bpy.types.Menu ):
bl_label = "Custom Modifier Menu"
bl_idname = "view3d.modifier_menu"
def draw ( self, context ):
layout = self.layout
# Adding a modifier menu----------------------------------------------
layout.operator_menu_enum ( "object.modifier_add", "type", icon="ZOOMIN" )
layout.separator()
# Adding a smooth/flat shader -----------------------------------------
layout.operator ( "object.shade_smooth", "Smooth Shading", icon='SOLID' )
layout.operator ( "object.shade_flat", "Flat Shading", icon='MESH_UVSPHERE' )
layout.separator()
# Adding existing Modifiers ( if any )
row = layout.row()
row.operator_context = 'INVOKE_DEFAULT'
row.operator_menu_enum("object.simple_operator", "modifier", icon="MODIFIER")
def register():
bpy.utils.register_module(__name__)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()