diff options
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 782f2be4a34..7d3c298eac9 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -362,25 +362,31 @@ void ED_object_exit_editmode(bContext *C, int flag) void ED_object_enter_editmode(bContext *C, int flag) { Scene *scene= CTX_data_scene(C); - Base *base= CTX_data_active_base(C); + Base *base= NULL; Object *ob; ScrArea *sa= CTX_wm_area(C); View3D *v3d= NULL; int ok= 0; if(scene->id.lib) return; - if(base==NULL) return; if(sa && sa->spacetype==SPACE_VIEW3D) v3d= sa->spacedata.first; - if(v3d && (base->lay & v3d->lay)==0) return; + if((flag & EM_IGNORE_LAYER)==0) { + base= CTX_data_active_base(C); /* active layer checked here for view3d */ + + if(base==NULL) return; + else if(v3d && (base->lay & v3d->lay)==0) return; else if(!v3d && (base->lay & scene->lay)==0) return; + } + else { + base= scene->basact; + } - ob = base->object; + if (ELEM3(NULL, base, base->object, base->object->data)) return; - if(ob==NULL) return; - if(ob->data==NULL) return; + ob = base->object; if (object_data_is_libdata(ob)) { error_libdata(); @@ -462,6 +468,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); } @@ -1595,14 +1602,12 @@ void copy_attr_menu(Scene *scene, View3D *v3d) static int shade_smooth_exec(bContext *C, wmOperator *op) { - Object *ob; Curve *cu; Nurb *nu; int clear= (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0); int done= 0; - CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { - ob= base->object; + CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if(ob->type==OB_MESH) { mesh_set_smooth_flag(ob, !clear); @@ -1858,7 +1863,6 @@ void auto_timeoffs(Scene *scene, View3D *v3d) void ofs_timeoffs(Scene *scene, View3D *v3d) { - Base *base; float offset=0.0f; if(BASACT==0 || v3d==NULL) return; @@ -1866,13 +1870,12 @@ void ofs_timeoffs(Scene *scene, View3D *v3d) // XXX if(fbutton(&offset, -10000.0f, 10000.0f, 10, 10, "Offset")==0) return; /* make array of all bases, xco yco (screen) */ - for(base= FIRSTBASE; base; base= base->next) { - if(TESTBASELIB(v3d, base)) { - base->object->sf += offset; - if (base->object->sf < -MAXFRAMEF) base->object->sf = -MAXFRAMEF; - else if (base->object->sf > MAXFRAMEF) base->object->sf = MAXFRAMEF; + CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { + ob->sf += offset; + if (ob->sf < -MAXFRAMEF) ob->sf = -MAXFRAMEF; + else if (ob->sf > MAXFRAMEF) ob->sf = MAXFRAMEF; } - } + CTX_DATA_END; } |