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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-04-07 12:27:13 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-04-07 12:27:13 +0400
commit45ce1c003d7d28b2beb5dbf465f523c5bc41bc55 (patch)
treea03f36a0c8513d837d2d4e8db40b6d022b40d546 /source/blender/editors/util
parentf4e312dd1b53d3fa4c65f47bfb9972bbb9f5abab (diff)
Modes are now toggled on using operators on load if the file was saved in
that mode. This ensures proper initialization happens like creating the cursor or building an acceleration structure. It also means edit and particle mode are now saveable. Not sure yet if this is a good feature, though personally I like being able to load my exact state again after saving, but maybe entering edit mode is too slow in some cases? It's easy to make it work only for the sculpt/paint modes again if wanted. This fixes bug #21004 about a missing sculpt cursor on load.
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/ed_util.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 19bd18ade1f..0c9ce9648c7 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -43,6 +43,7 @@
#include "ED_armature.h"
#include "ED_mesh.h"
+#include "ED_object.h"
#include "ED_sculpt.h"
#include "ED_util.h"
@@ -50,6 +51,27 @@
/* ********* 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;
+
+ /* 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;
+
+ if(ob == obact)
+ ED_object_toggle_modes(C, mode);
+ }
+ }
+}
+
/* frees all editmode stuff */
void ED_editors_exit(bContext *C)
{