diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 19:20:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 19:21:14 +0300 |
commit | 1c24c04e6023f2d2a328dfcdc9f86cd381d029a3 (patch) | |
tree | 7a5af59ce078cb66fb17ec33cf111ffc8d5fb328 /source/blender/editors/physics | |
parent | 57329304b061efe756e3a4ce1b828e9a7c7f7030 (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/physics')
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 26 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_object.c | 8 |
2 files changed, 13 insertions, 21 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 14bcba3416f..51abb5b2eaa 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -42,7 +42,6 @@ #include "DNA_view3d_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" -#include "DNA_workspace_types.h" #include "BLI_math.h" #include "BLI_lasso_2d.h" @@ -93,12 +92,10 @@ int PE_poll(bContext *C) { - const WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene= CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob= CTX_data_active_object(C); - if (!scene || !view_layer || !ob || !(workspace->object_mode & OB_MODE_PARTICLE_EDIT)) { + if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT)) { return 0; } return (PE_get_current(scene, ob) != NULL); @@ -106,12 +103,11 @@ int PE_poll(bContext *C) int PE_hair_poll(bContext *C) { - const WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); PTCacheEdit *edit; - if (!scene || !ob || !(workspace->object_mode & OB_MODE_PARTICLE_EDIT)) { + if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT)) { return 0; } edit= PE_get_current(scene, ob); @@ -295,7 +291,7 @@ PTCacheEdit *PE_create_current(const EvaluationContext *eval_ctx, Scene *scene, void PE_current_changed(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { - if (eval_ctx->object_mode == OB_MODE_PARTICLE_EDIT) { + if (ob->mode == OB_MODE_PARTICLE_EDIT) { PE_create_current(eval_ctx, scene, ob); } } @@ -4459,25 +4455,23 @@ static int particle_edit_toggle_poll(bContext *C) static int particle_edit_toggle_exec(bContext *C, wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - struct WorkSpace *workspace = CTX_wm_workspace(C); - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_PARTICLE_EDIT; - const bool is_mode_set = (eval_ctx.object_mode & mode_flag) != 0; + const bool is_mode_set = (ob->mode & mode_flag) != 0; if (!is_mode_set) { - if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) { + if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { return OPERATOR_CANCELLED; } } if (!is_mode_set) { PTCacheEdit *edit; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); - workspace->object_mode |= mode_flag; + ob->mode |= mode_flag; edit= PE_create_current(&eval_ctx, scene, ob); /* mesh may have changed since last entering editmode. @@ -4489,12 +4483,12 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL); } else { - workspace->object_mode &= ~mode_flag; + ob->mode &= ~mode_flag; toggle_particle_cursor(C, 0); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); } - ED_workspace_object_mode_sync_from_object(wm, workspace, ob); + // ED_workspace_object_mode_sync_from_object(wm, workspace, ob); DEG_id_tag_update(&ob->id, OB_RECALC_DATA); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index ce4137b182d..1fae5b70aff 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -110,25 +110,23 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot) static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)) { - WorkSpace *workspace = CTX_wm_workspace(C); Object *ob = ED_object_context(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - eObjectMode mode_orig; + int mode_orig; if (!scene || !ob) return OPERATOR_CANCELLED; - mode_orig = workspace->object_mode; + mode_orig = ob->mode; object_remove_particle_system(scene, ob); /* possible this isn't the active object * object_remove_particle_system() clears the mode on the last psys */ if (mode_orig & OB_MODE_PARTICLE_EDIT) { - if ((workspace->object_mode & OB_MODE_PARTICLE_EDIT) == 0) { + if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) { if (view_layer->basact && view_layer->basact->object == ob) { - workspace->object_mode &= ~OB_MODE_PARTICLE_EDIT; WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); } } |