From 8fa211dd81a6767cef8913dd05189ec8ad3a12a5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 1 Oct 2012 17:40:02 +0000 Subject: Fix [#32719] "New object align to view" option doesn't work on lamps and force fields There was strange context changes in the Add menu... Now everything uses the EXEC_REGION_WIN one (no need to invoke here, and metaballs have a strange specific invoke func...). This fixes the problem when using Add menu from a 3D view. Obviously, it still doesn't work when used from Info window's header, but that can't be helped for now (and never worked for any kind of object). Anyway, imho all this "add object" code could use some review/cleanup, both on py menu and C ops side, but this is obviously postponed to after 2.64! --- release/scripts/startup/bl_ui/space_info.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 04ea6b818ac..a67c30e2b85 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -272,7 +272,9 @@ class INFO_MT_add(Menu): # note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context. - layout.operator_context = 'EXEC_AREA' + # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents + # "align_view" to work on first call (see [#32719]). + layout.operator_context = 'EXEC_REGION_WIN' #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH') layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH') @@ -282,7 +284,7 @@ class INFO_MT_add(Menu): #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE') layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE') layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META') - layout.operator_context = 'INVOKE_REGION_WIN' +# layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT') layout.separator() @@ -295,7 +297,7 @@ class INFO_MT_add(Menu): layout.separator() layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA') - layout.operator_context = 'EXEC_AREA' +# layout.operator_context = 'EXEC_AREA' layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP') layout.separator() -- cgit v1.2.3