Hello,
I’m building my own menu and I would like to simplify it using buttons inside the menu… is it possible?
To show you what I’m trying to archive check the following picture:
Anyone knows how to code it?
Thanks in advance
Hello,
I’m building my own menu and I would like to simplify it using buttons inside the menu… is it possible?
To show you what I’m trying to archive check the following picture:
Anyone knows how to code it?
Thanks in advance
no, operators inside of menus are shown as menu entries, not as buttons. The transform manipulator buttons aren’t buttons (=operators) btw., they are boolean properties of the view3d space.
this is the most you can get with current API:
import bpy
class SimpleCustomMenu(bpy.types.Menu):
bl_label = "Simple Custom Menu"
bl_idname = "OBJECT_MT_simple_custom_menu"
def draw(self, context):
layout = self.layout
for area in context.screen.areas:
if area.type == 'VIEW_3D':
space_data = area.spaces[0]
break
layout.prop(space_data, "show_manipulator")
layout.separator()
layout.prop(space_data, "use_manipulator_translate")
layout.prop(space_data, "use_manipulator_rotate")
layout.prop(space_data, "use_manipulator_scale")
def register():
bpy.utils.register_class(SimpleCustomMenu)
def unregister():
bpy.utils.unregister_class(SimpleCustomMenu)
if __name__ == "__main__":
register()
# The menu can also be called from scripts
bpy.ops.wm.call_menu(name=SimpleCustomMenu.bl_idname)