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:
authorCampbell Barton <ideasman42@gmail.com>2018-04-05 19:20:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-05 19:21:14 +0300
commit1c24c04e6023f2d2a328dfcdc9f86cd381d029a3 (patch)
tree7a5af59ce078cb66fb17ec33cf111ffc8d5fb328 /source/blender/editors/util
parent57329304b061efe756e3a4ce1b828e9a7c7f7030 (diff)
Remove workspace object mode, reverts changes w/ 2.8
This caused too many problems syncing object modes with multiple objects/windows/workspaces, see: D3130 for details.
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/ed_util.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 4bec0d9f114..d3a9c22bc73 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -42,7 +42,6 @@
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_packedFile_types.h"
-#include "DNA_workspace_types.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
@@ -75,8 +74,6 @@
#include "ED_space_api.h"
#include "ED_util.h"
-#include "DEG_depsgraph.h"
-
#include "GPU_immediate.h"
#include "UI_interface.h"
@@ -92,6 +89,7 @@
void ED_editors_init(bContext *C)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
if (wm->undo_stack == NULL) {
@@ -107,33 +105,22 @@ void ED_editors_init(bContext *C)
/* 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. */
- {
- wmWindow *win_orig = CTX_wm_window(C);
- CTX_wm_window_set(C, NULL);
- for (wmWindow *win = wm->windows.first; win; win = win->next) {
- WorkSpace *workspace = WM_window_get_active_workspace(win);
- Scene *scene = WM_window_get_active_scene(win);
- ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
- Object *obact = view_layer ? OBACT(view_layer) : NULL;
- eObjectMode object_mode = workspace->object_mode;
- workspace->object_mode = OB_MODE_OBJECT;
- if (view_layer && obact) {
- const ID *data = obact->data;
- if (!ELEM(object_mode, OB_MODE_OBJECT, OB_MODE_POSE)) {
- if (!ID_IS_LINKED(obact) && !(data && ID_IS_LINKED(data))) {
- CTX_wm_window_set(C, win);
- ED_object_mode_toggle(C, object_mode);
- CTX_wm_window_set(C, NULL);
- }
- }
- else if (object_mode == OB_MODE_POSE) {
- if (!ID_IS_LINKED(obact) && (obact->type == OB_ARMATURE)) {
- workspace->object_mode = object_mode;
- }
+ Object *obact = CTX_data_active_object(C);
+ if (obact != NULL) {
+ for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ int mode = ob->mode;
+
+ if (mode == OB_MODE_OBJECT) {
+ /* pass */
+ }
+ else {
+ ID *data = ob->data;
+ ob->mode = OB_MODE_OBJECT;
+ if ((ob == obact) && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data))) {
+ ED_object_mode_toggle(C, mode);
}
}
}
- CTX_wm_window_set(C, win_orig);
}
/* image editor paint mode */
@@ -195,16 +182,11 @@ bool ED_editors_flush_edits(const bContext *C, bool for_render)
Object *ob;
Main *bmain = CTX_data_main(C);
- eObjectMode object_mode = WM_windows_object_mode_get(bmain->wm.first);
- if ((object_mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) == 0) {
- return has_edited;
- }
-
/* loop through all data to find edit mode or object mode, because during
* exiting we might not have a context for edit object and multiple sculpt
* objects can exist at the same time */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (object_mode & OB_MODE_SCULPT) {
+ if (ob->mode & OB_MODE_SCULPT) {
/* Don't allow flushing while in the middle of a stroke (frees data in use).
* Auto-save prevents this from happening but scripts may cause a flush on saving: T53986. */
if ((ob->sculpt && ob->sculpt->cache) == 0) {
@@ -223,7 +205,7 @@ bool ED_editors_flush_edits(const bContext *C, bool for_render)
}
}
}
- else if (object_mode & OB_MODE_EDIT) {
+ else if (ob->mode & OB_MODE_EDIT) {
/* get editmode results */
has_edited = true;
ED_object_editmode_load(ob);