diff options
Diffstat (limited to 'source/blender/editors/util/ed_util.c')
-rw-r--r-- | source/blender/editors/util/ed_util.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 19bd18ade1f..0d3d8a48b60 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -38,11 +38,11 @@ #include "BLI_editVert.h" #include "BKE_context.h" -#include "BKE_global.h" #include "BKE_main.h" #include "ED_armature.h" #include "ED_mesh.h" +#include "ED_object.h" #include "ED_sculpt.h" #include "ED_util.h" @@ -50,16 +50,43 @@ /* ********* general editor util funcs, not BKE stuff please! ********* */ +void ED_editors_init(bContext *C) +{ + Main *bmain= CTX_data_main(C); + Scene *sce= CTX_data_scene(C); + Object *ob, *obact= (sce && sce->basact)? sce->basact->object: NULL; + ID *data; + + /* toggle on modes for objects that were saved with these enabled. for + e.g. linked objects we have to ensure that they are actually the + active object in this scene. */ + for(ob=bmain->object.first; ob; ob=ob->id.next) { + int mode= ob->mode; + + if(mode && (mode != OB_MODE_POSE)) { + ob->mode= 0; + data= ob->data; + + if(ob == obact && !ob->id.lib && !(data && data->lib)) + ED_object_toggle_modes(C, mode); + } + } +} + /* frees all editmode stuff */ void ED_editors_exit(bContext *C) { + Main *bmain= CTX_data_main(C); Scene *sce; + + if(!bmain) + return; /* frees all editmode undos */ undo_editmode_clear(); ED_undo_paint_free(); - for(sce=G.main->scene.first; sce; sce= sce->id.next) { + for(sce=bmain->scene.first; sce; sce= sce->id.next) { if(sce->obedit) { Object *ob= sce->obedit; |