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-05-18 10:35:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-18 10:40:52 +0300
commit987d1df57159afd57f33d7e58681be2fcdebda16 (patch)
treef782562c40bc1bf3fe23a455779f7e30d4cd8559 /source/blender/editors
parent8faa59441371311a435b80487fe81eb60ea2e4fe (diff)
Tool System: store the active tool in ScrArea
Without this we need to have the context to get the (space_type, mode) args for an active tool lookup. For event handling & poll its more convenient to have direct access.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c5
-rw-r--r--source/blender/editors/screen/area.c7
-rw-r--r--source/blender/editors/transform/transform_manipulator_3d.c10
3 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index 95bf8e89b0e..4841de3c856 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -419,9 +419,8 @@ static void manipulator_mesh_extrude_orientation_matrix_set(
static bool manipulator_mesh_extrude_poll(const bContext *C, wmManipulatorGroupType *wgt)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
- const bToolKey tkey = { .space_type = SPACE_VIEW3D, .mode = CTX_MODE_EDIT_MESH, };
- bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_find(workspace, &tkey);
+ ScrArea *sa = CTX_wm_area(C);
+ bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
if ((tref_rt == NULL) ||
!STREQ(wgt->idname, tref_rt->manipulator_group) ||
!ED_operator_editmesh_view3d((bContext *)C))
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 24d6b7c6ecf..4c5ba38984b 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1393,7 +1393,10 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
/* called in screen_refresh, or screens_init, also area size changes */
void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
{
- const bScreen *screen = WM_window_get_active_screen(win);
+ WorkSpace *workspace = WM_window_get_active_workspace(win);
+ const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
+ Scene *scene = WM_window_get_active_scene(win);
+
const int window_size_x = WM_window_pixels_x(win);
const int window_size_y = WM_window_pixels_y(win);
ARegion *ar;
@@ -1452,6 +1455,8 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
/* Some AZones use View2D data which is only updated in region init, so call that first! */
region_azones_add(screen, sa, ar, ar->alignment & ~RGN_SPLIT_PREV);
}
+
+ WM_toolsystem_refresh_screen_area(workspace, scene, sa);
}
static void region_update_rect(ARegion *ar)
diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c
index c24291953c8..8b635bb26db 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -1282,15 +1282,9 @@ static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup
{
/* TODO: support mixing modes again? - it's supported but tool system makes it unobvious. */
man->twtype = 0;
- WorkSpace *workspace = CTX_wm_workspace(C);
- Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
- const bToolKey tkey = {
- .space_type = sa->spacetype,
- .mode = WM_toolsystem_mode_from_spacetype(workspace, scene, NULL, sa->spacetype),
- };
- bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_find(workspace, &tkey);
- wmKeyMap *km = WM_keymap_find_all(C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW);
+ bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
+ wmKeyMap *km = tref_rt ? WM_keymap_find_all(C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW) : NULL;
/* Weak, check first event */
wmKeyMapItem *kmi = km ? km->items.first : NULL;