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:
-rw-r--r--source/blender/blenloader/intern/readfile.c3
-rw-r--r--source/blender/editors/include/ED_util.h1
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/editors/util/ed_util.c22
-rw-r--r--source/blender/windowmanager/intern/wm_files.c3
6 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6dcfb7f0ec7..be3e3c25b05 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3887,9 +3887,6 @@ static void direct_link_object(FileData *fd, Object *ob)
/* weak weak... this was only meant as draw flag, now is used in give_base too */
ob->flag &= ~OB_FROMGROUP;
- /* editmode doesn't get saved in files, so should get cleared when reloading... */
- ob->mode &= ~(OB_MODE_EDIT|OB_MODE_PARTICLE_EDIT);
-
ob->disp.first=ob->disp.last= NULL;
ob->adt= newdataadr(fd, ob->adt);
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index cc4f906ad37..7bf3ec88a4b 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -37,6 +37,7 @@ struct wmOperatorType;
/* ed_util.c */
+void ED_editors_init (struct bContext *C);
void ED_editors_exit (struct bContext *C);
/* ************** Undo ************************ */
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 2332f08c021..8fb2f402a64 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -2054,6 +2054,8 @@ void ED_object_toggle_modes(bContext *C, int mode)
WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL);
if(mode & OB_MODE_POSE)
WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
+ if(mode & OB_MODE_EDIT)
+ WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
}
/************************ Game Properties ***********************/
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 7bfb7716c9c..a3c21a690c1 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1123,8 +1123,6 @@ static int set_wpaint(bContext *C, wmOperator *op) /* toggle */
/* for switching to/from mode */
static int paint_poll_test(bContext *C)
{
- if(ED_operator_view3d_active(C)==0)
- return 0;
if(CTX_data_edit_object(C))
return 0;
if(CTX_data_active_object(C)==NULL)
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)
{
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index f79b083857e..ff5797b1e69 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -296,6 +296,9 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
// refresh_interface_font();
+ CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
+ ED_editors_init(C);
+
CTX_wm_window_set(C, NULL); /* exits queues */
#ifndef DISABLE_PYTHON
/* run any texts that were loaded in and flagged as modules */