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-02-08 13:14:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-02-08 13:14:26 +0300
commit345c6298e995ea618c34282ba6d7ab5af032f191 (patch)
treef4fbc4798e17d0f19efc28b51a41425d0c552be8 /source/blender/editors/physics
parent14a19fed788af0cf3695eb5def92510841056e08 (diff)
Object Mode: move to workspace struct
- Read-only access can often use EvaluationContext.object_mode - Write access to go to WorkSpace.object_mode. - Some TODO's remain (marked as "TODO/OBMODE") - Add-ons will need updating (context.active_object.mode -> context.workspace.object_mode) - There will be small/medium issues that still need resolving this does work on a basic level though. See D3037
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c14
-rw-r--r--source/blender/editors/physics/particle_object.c8
2 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index aeb7f0b9222..63eee657c3a 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -43,6 +43,7 @@
#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.h"
@@ -4784,26 +4785,27 @@ static int particle_edit_toggle_poll(bContext *C)
static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
{
+ 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 = (ob->mode & mode_flag) != 0;
+ const bool is_mode_set = (eval_ctx.object_mode & mode_flag) != 0;
BKE_report(op->reports, RPT_INFO, "Particles are changing, editing is not possible");
return OPERATOR_CANCELLED;
if (!is_mode_set) {
- if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
+ if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) {
return OPERATOR_CANCELLED;
}
}
if (!is_mode_set) {
PTCacheEdit *edit;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
- ob->mode |= mode_flag;
+ workspace->object_mode |= mode_flag;
edit= PE_create_current(&eval_ctx, scene, ob);
/* mesh may have changed since last entering editmode.
@@ -4815,7 +4817,7 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL);
}
else {
- ob->mode &= ~mode_flag;
+ workspace->object_mode &= ~mode_flag;
toggle_particle_cursor(C, 0);
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 1536c15525f..7a22a0d81d9 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -133,23 +133,25 @@ 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);
- int mode_orig;
+ eObjectMode mode_orig;
if (!scene || !ob)
return OPERATOR_CANCELLED;
- mode_orig = ob->mode;
+ mode_orig = workspace->object_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 ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
+ if ((workspace->object_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);
}
}