Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-10-05 16:59:09 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-10-05 16:59:09 +0400
commit00ce0c9aae04a461d96dc626bc6651a3ba0211cf (patch)
treed328c4b59f348770cdaf16c2c3fe093b44a2eeba /release/scripts/startup/bl_ui/space_info.py
parenteb46c080a2d3b71beb626517e30ae2b5f2e60425 (diff)
Clean up in "add object" code:
* Get rid of ED_object_add_generic_invoke() and all invoke callbacks using it, it was doing nothing exec() callbacks would not do. In fact, its only action (setting part of common add ops properties, like loc, layers, etc.) was needed too by direct exec call, so it was done twice in case of using invoke()! * Replace custom invoke code for metaballs by WM_menu_invoke helper (as already used by lamps). * Add a new OBJECT_OT_empty_add op, to allow direct addition of empties of a given drawtype. * And some general code cleanup (like trailing spaces, empty lines, ...). Did quite a bunch of tests/verifications, but obviously could not tackle all possible scenarios... Anyway, if any, bugs should arize quite quickly (but I don’t expect any! :p ).
Diffstat (limited to 'release/scripts/startup/bl_ui/space_info.py')
-rw-r--r--release/scripts/startup/bl_ui/space_info.py51
1 files changed, 23 insertions, 28 deletions
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index de58b5d1aaf..9ab2a772df0 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -192,7 +192,7 @@ class INFO_MT_mesh_add(Menu):
def draw(self, context):
layout = self.layout
- layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
@@ -203,7 +203,7 @@ class INFO_MT_mesh_add(Menu):
layout.separator()
layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
- layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
+ layout.operator("mesh.primitive_torus_add", icon='MESH_TORUS', text="Torus")
class INFO_MT_curve_add(Menu):
@@ -213,7 +213,7 @@ class INFO_MT_curve_add(Menu):
def draw(self, context):
layout = self.layout
- layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
@@ -221,22 +221,6 @@ class INFO_MT_curve_add(Menu):
layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
-class INFO_MT_edit_curve_add(Menu):
- bl_idname = "INFO_MT_edit_curve_add"
- bl_label = "Add"
-
- def draw(self, context):
- is_surf = context.active_object.type == 'SURFACE'
-
- layout = self.layout
- layout.operator_context = 'INVOKE_REGION_WIN'
-
- if is_surf:
- INFO_MT_surface_add.draw(self, context)
- else:
- INFO_MT_curve_add.draw(self, context)
-
-
class INFO_MT_surface_add(Menu):
bl_idname = "INFO_MT_surface_add"
bl_label = "Surface"
@@ -244,7 +228,7 @@ class INFO_MT_surface_add(Menu):
def draw(self, context):
layout = self.layout
- layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
@@ -253,6 +237,22 @@ class INFO_MT_surface_add(Menu):
layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
+class INFO_MT_edit_curve_add(Menu):
+ bl_idname = "INFO_MT_edit_curve_add"
+ bl_label = "Add"
+
+ def draw(self, context):
+ is_surf = context.active_object.type == 'SURFACE'
+
+ layout = self.layout
+ layout.operator_context = 'EXEC_REGION_WIN'
+
+ if is_surf:
+ INFO_MT_surface_add.draw(self, context)
+ else:
+ INFO_MT_curve_add.draw(self, context)
+
+
class INFO_MT_armature_add(Menu):
bl_idname = "INFO_MT_armature_add"
bl_label = "Armature"
@@ -260,7 +260,7 @@ class INFO_MT_armature_add(Menu):
def draw(self, context):
layout = self.layout
- layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
@@ -284,23 +284,18 @@ 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("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
layout.separator()
layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
- # XXX Quick fix for [#32764].
- layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
- layout.operator("object.add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'EMPTY'
- layout.operator_context = 'EXEC_REGION_WIN'
+ layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
layout.separator()
layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
layout.separator()
layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
-# layout.operator_context = 'EXEC_AREA'
layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
layout.separator()
@@ -308,7 +303,7 @@ class INFO_MT_add(Menu):
layout.separator()
if(len(bpy.data.groups) > 10):
- layout.operator_context = 'INVOKE_DEFAULT'
+ layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
else:
layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')