[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50994] trunk/blender/release/scripts/ startup/bl_ui/space_info.py: Fix [#32719] "New object align to view" option doesn't work on lamps and force fields

Bastien Montagne montagne29 at wanadoo.fr
Mon Oct 1 19:40:02 CEST 2012


Revision: 50994
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50994
Author:   mont29
Date:     2012-10-01 17:40:02 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
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!

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_info.py

Modified: trunk/blender/release/scripts/startup/bl_ui/space_info.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_info.py	2012-10-01 17:38:22 UTC (rev 50993)
+++ trunk/blender/release/scripts/startup/bl_ui/space_info.py	2012-10-01 17:40:02 UTC (rev 50994)
@@ -272,7 +272,9 @@
 
         # 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 @@
         #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 @@
         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()
 




More information about the Bf-blender-cvs mailing list