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-28 08:27:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-02-28 12:04:21 +0300
commit9e9cb9fce9c74d32b4f7fad9fdbcbbc59acc53b9 (patch)
tree2b31b3db0c7d89558cfe14b6a924ff2e0f1f5c1e /source/blender/editors/sculpt_paint
parentc0d6627dc5fd069ec31c116e98e1817a0fe20ebb (diff)
Workspace: sync object-modes to other workspaces
When changing the mode of an object, apply this to all other workspaces that share the same active object. Also use copy the object-mode when duplicating workspaces.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c6
3 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 1cb37fc10cd..5595f81dd4e 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1376,6 +1376,7 @@ static int texture_paint_toggle_poll(bContext *C)
static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
{
+ wmWindowManager *wm = CTX_wm_manager(C);
WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
@@ -1450,6 +1451,8 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
toggle_paint_cursor(C, 1);
}
+ ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
+
GPU_drawobject_free(ob->derivedFinal);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 8ce0af068d6..e028c752b88 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -55,6 +55,8 @@
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_deform.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_object_deform.h"
@@ -1089,6 +1091,8 @@ static void ed_vwpaintmode_enter_generic(
}
vertex_paint_init_session(eval_ctx, scene, ob);
+
+ ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
}
void ED_object_vpaintmode_enter_ex(
@@ -1174,6 +1178,8 @@ static void ed_vwpaintmode_exit_generic(
ED_mesh_mirror_spatial_table(NULL, NULL, NULL, NULL, 'e');
ED_mesh_mirror_topo_table(NULL, NULL, 'e');
}
+
+ ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
}
void ED_object_vpaintmode_exit_ex(WorkSpace *workspace, Object *ob)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 8df3d4e9f90..debc719a5d9 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -60,6 +60,7 @@
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_library.h"
+#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_modifier.h"
@@ -5669,6 +5670,8 @@ void ED_object_sculptmode_exit_ex(
/* Leave sculptmode */
workspace->object_mode &= ~mode_flag;
+ ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
+
BKE_sculptsession_free(ob);
paint_cursor_delete_textures();
@@ -5691,6 +5694,7 @@ void ED_object_sculptmode_exit(bContext *C)
static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
{
+ wmWindowManager *wm = CTX_wm_manager(C);
WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
@@ -5800,6 +5804,8 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
}
}
+ ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
+
/* VBO no longer valid */
if (ob->derivedFinal) {
GPU_drawobject_free(ob->derivedFinal);