Bugfixes for Adding Objects:

* Auto enter EditMode for adding Armatures was broken
* Adding a camera no longer tries to enter editmode, even though that's invalid...
This commit is contained in:
Joshua Leung
2009-11-04 09:45:37 +00:00
parent 7fad20eff8
commit de7da7c779
3 changed files with 10 additions and 2 deletions

View File

@@ -187,7 +187,9 @@ class INFO_MT_add(bpy.types.Menu):
layout.itemO("object.text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
layout.itemS()
layout.operator_context = "INVOKE_SCREEN"
layout.itemO("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
layout.item_enumO("object.add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
layout.item_enumO("object.add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')
@@ -195,6 +197,9 @@ class INFO_MT_add(bpy.types.Menu):
layout.itemS()
layout.item_enumO("object.add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
layout.operator_context = "EXEC_SCREEN"
layout.item_menu_enumO("object.lamp_add", "type", 'LAMP', text="Lamp", icon='ICON_OUTLINER_OB_LAMP')
layout.itemS()

View File

@@ -561,6 +561,7 @@ void OBJECT_OT_text_add(wmOperatorType *ot)
ot->idname= "OBJECT_OT_text_add";
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
ot->exec= object_add_text_exec;
ot->poll= ED_operator_scene_editable;
@@ -579,7 +580,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
ED_object_add_generic_get_opts(op, &view_align, &enter_editmode);
if ((obedit==NULL) || (obedit->type != OB_ARMATURE)) {
obedit= ED_object_add_type(C, OB_ARMATURE, view_align, TRUE);
ED_object_add_type(C, OB_ARMATURE, view_align, TRUE);
ED_object_enter_editmode(C, 0);
obedit= CTX_data_edit_object(C);
newob = 1;
@@ -615,6 +616,7 @@ void OBJECT_OT_armature_add(wmOperatorType *ot)
ot->idname= "OBJECT_OT_armature_add";
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
ot->exec= object_armature_add_exec;
ot->poll= ED_operator_scene_editable;

View File

@@ -471,6 +471,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
}
else {
scene->obedit= NULL; // XXX for context
ob->mode &= ~OB_MODE_EDIT;
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
}