From a23995f42a662533f24764f9051a70b224aa77d7 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 13 May 2018 16:49:05 +0200 Subject: Fix/workaround crash when appending workspace in edit mode Linking/appending in edit mode currently isn't supported. For workspaces it should probably be, but we can look into supporting this later. For now gray out buttons in "Add Workspace" menu while in edit mode. --- source/blender/editors/screen/workspace_edit.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/editors/screen/workspace_edit.c') diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index c8aa4560dc4..bd4381f4099 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -331,6 +331,12 @@ static void WORKSPACE_OT_workspace_delete(wmOperatorType *ot) ot->exec = workspace_delete_exec; } +static int workspace_append_activate_poll(bContext *C) +{ + wmOperatorType *ot = WM_operatortype_find("WM_OT_append", false); + return WM_operator_poll(C, ot); +} + static int workspace_append(bContext *C, const char *directory, const char *idname) { wmOperatorType *ot = WM_operatortype_find("WM_OT_append", false); @@ -384,6 +390,7 @@ static void WORKSPACE_OT_append_activate(wmOperatorType *ot) /* api callbacks */ ot->exec = workspace_append_activate_exec; + ot->poll = workspace_append_activate_poll; RNA_def_string(ot->srna, "idname", NULL, MAX_ID_NAME - 2, "Identifier", "Name of the workspace to append and activate"); -- cgit v1.2.3 From edf6676a77b30290918e60547544bc1a6f7a8838 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 May 2018 18:41:11 +0200 Subject: Tool System: per space/mode tool support This patch adds support for: - Per space-type tools (3D view and edit). - Per mode tools (object, edit, weight-paint .. etc). The top-bar shows the last activated tools options, this is a design issue with using a global topbar to show per-space settings. See D3395 --- source/blender/editors/screen/workspace_edit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/screen/workspace_edit.c') diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index bd4381f4099..fe52e945399 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -201,8 +201,8 @@ bool ED_workspace_change( BLI_assert(BKE_workspace_view_layer_get(workspace_new, CTX_data_scene(C)) != NULL); BLI_assert(CTX_wm_workspace(C) == workspace_new); - WM_toolsystem_unlink(C, workspace_old); - WM_toolsystem_link(C, workspace_new); + WM_toolsystem_unlink_all(C, workspace_old); + WM_toolsystem_link_all(C, workspace_new); return true; } @@ -224,7 +224,7 @@ WorkSpace *ED_workspace_duplicate( bmain, workspace_old->id.name + 2, scene, BKE_workspace_view_layer_get(workspace_old, scene)); - workspace_new->tool = workspace_old->tool; + /* TODO(campbell): tools */ for (WorkSpaceLayout *layout_old = layouts_old->first; layout_old; layout_old = layout_old->next) { WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(workspace_new, layout_old, win); -- cgit v1.2.3 From f9547ab3133654f7dac805f9d61c49183fa2046c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 May 2018 17:32:38 +0200 Subject: Fix tools not being initialized on startup --- source/blender/editors/screen/workspace_edit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/screen/workspace_edit.c') diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index fe52e945399..35d916e403d 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -202,7 +202,7 @@ bool ED_workspace_change( BLI_assert(CTX_wm_workspace(C) == workspace_new); WM_toolsystem_unlink_all(C, workspace_old); - WM_toolsystem_link_all(C, workspace_new); + WM_toolsystem_reinit_all(C, win); return true; } -- cgit v1.2.3 From 44f78c95be133db75d439d4e4d5d6fdd5720f463 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 May 2018 08:20:46 +0200 Subject: Cleanup: move toolsystem into own include Many files using the window manager don't access the tool-system. This avoids rebuilding many files when the tool-system changes. --- source/blender/editors/screen/workspace_edit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/editors/screen/workspace_edit.c') diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 35d916e403d..a054949df22 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -65,6 +65,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "WM_toolsystem.h" #include "screen_intern.h" -- cgit v1.2.3 From 03a80facfc78178632086179e36f1c67128d5c09 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 24 May 2018 17:28:35 +0200 Subject: Fix T55183, fix T55174: crashes with workspace / view layer relation. Don't store pointers to ViewLayer in the workspace, only names. Add specific relation type since the generic mechanism makes the code hard to follow. Integrate with pointer restore for undo and library remapping code to avoid data going out of sync. Also add relation automatically if there doesn't exists one yet in BKE_workspace_view_layer_get, because in general it's really hard to ensure it will exist when making arbitrary scene changes. Differential Revision: https://developer.blender.org/D3432 --- source/blender/editors/screen/workspace_edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/screen/workspace_edit.c') diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index a054949df22..d54996bad59 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -110,7 +110,7 @@ static void workspace_change_update_view_layer( WorkSpace *workspace_new, const WorkSpace *workspace_old, Scene *scene) { - if (!BKE_workspace_view_layer_get(workspace_new, scene)) { + if (!BKE_workspace_view_layer_exists(workspace_new, scene)) { BKE_workspace_view_layer_set(workspace_new, BKE_workspace_view_layer_get(workspace_old, scene), scene); } } @@ -199,7 +199,7 @@ bool ED_workspace_change( screen_change_update(C, win, screen_new); workspace_change_update(workspace_new, workspace_old, C, wm); - BLI_assert(BKE_workspace_view_layer_get(workspace_new, CTX_data_scene(C)) != NULL); + BLI_assert(BKE_workspace_view_layer_exists(workspace_new, CTX_data_scene(C)) != NULL); BLI_assert(CTX_wm_workspace(C) == workspace_new); WM_toolsystem_unlink_all(C, workspace_old); -- cgit v1.2.3 From 0ee478567570d4bb85b39d043b800a11694ffe5e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 6 Jun 2018 16:32:09 +0200 Subject: Cleanup: get rid of just-added G.main usage. Was just added to ease merging of master, proper code now! --- source/blender/editors/screen/workspace_edit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/screen/workspace_edit.c') diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index d54996bad59..a044a7d377a 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -131,7 +131,7 @@ static bool workspace_change_find_new_layout_cb(const WorkSpaceLayout *layout, v } static WorkSpaceLayout *workspace_change_get_new_layout( - WorkSpace *workspace_new, wmWindow *win) + Main *bmain, WorkSpace *workspace_new, wmWindow *win) { /* ED_workspace_duplicate may have stored a layout to activate once the workspace gets activated. */ WorkSpaceLayout *layout_new; @@ -155,7 +155,7 @@ static WorkSpaceLayout *workspace_change_get_new_layout( NULL, false); if (!layout_temp) { /* fallback solution: duplicate layout */ - layout_temp = ED_workspace_layout_duplicate(workspace_new, layout_new, win); + layout_temp = ED_workspace_layout_duplicate(bmain, workspace_new, layout_new, win); } layout_new = layout_temp; } @@ -177,7 +177,7 @@ bool ED_workspace_change( { Main *bmain = CTX_data_main(C); WorkSpace *workspace_old = WM_window_get_active_workspace(win); - WorkSpaceLayout *layout_new = workspace_change_get_new_layout(workspace_new, win); + WorkSpaceLayout *layout_new = workspace_change_get_new_layout(bmain, workspace_new, win); bScreen *screen_new = BKE_workspace_layout_screen_get(layout_new); bScreen *screen_old = BKE_workspace_active_screen_get(win->workspace_hook); @@ -228,7 +228,7 @@ WorkSpace *ED_workspace_duplicate( /* TODO(campbell): tools */ for (WorkSpaceLayout *layout_old = layouts_old->first; layout_old; layout_old = layout_old->next) { - WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(workspace_new, layout_old, win); + WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(bmain, workspace_new, layout_old, win); if (layout_active_old == layout_old) { win->workspace_hook->temp_layout_store = layout_new; -- cgit v1.2.3