Fix tool not being initialized switching windows
This commit is contained in:
parent
5429536904
commit
dcf0860dab
|
@ -6729,6 +6729,8 @@ static void direct_link_area(FileData *fd, ScrArea *area)
|
|||
area->butspacetype = SPACE_EMPTY; /* Should always be unset so that rna_Area_type_get works correctly */
|
||||
area->region_active_win = -1;
|
||||
|
||||
area->flag &= ~AREA_FLAG_ACTIVE_TOOL_UPDATE;
|
||||
|
||||
area->global = newdataadr(fd, area->global);
|
||||
|
||||
/* if we do not have the spacetype registered we cannot
|
||||
|
|
|
@ -1639,7 +1639,11 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
|
|||
region_azones_add(screen, sa, ar, ar->alignment & ~RGN_SPLIT_PREV);
|
||||
}
|
||||
|
||||
WM_toolsystem_refresh_screen_area(workspace, view_layer, sa);
|
||||
|
||||
if ((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) {
|
||||
WM_toolsystem_refresh_screen_area(workspace, view_layer, sa);
|
||||
sa->flag |= AREA_FLAG_ACTIVE_TOOL_UPDATE;
|
||||
}
|
||||
}
|
||||
|
||||
static void region_update_rect(ARegion *ar)
|
||||
|
|
|
@ -368,7 +368,7 @@ enum {
|
|||
#endif
|
||||
/* update size of regions within the area */
|
||||
AREA_FLAG_REGION_SIZE_UPDATE = (1 << 3),
|
||||
// AREA_FLAG_DEPRECATED_4 = (1 << 4),
|
||||
AREA_FLAG_ACTIVE_TOOL_UPDATE = (1 << 4),
|
||||
// AREA_FLAG_DEPRECATED_5 = (1 << 5),
|
||||
/* used to check if we should switch back to prevspace (of a different type) */
|
||||
AREA_FLAG_TEMP_TYPE = (1 << 6),
|
||||
|
|
|
@ -86,11 +86,11 @@ int WM_toolsystem_mode_from_spacetype(
|
|||
struct ViewLayer *view_layer, struct ScrArea *sa, int space_type);
|
||||
bool WM_toolsystem_key_from_context(
|
||||
struct ViewLayer *view_layer, struct ScrArea *sa, bToolKey *tkey);
|
||||
void WM_toolsystem_update_from_context(
|
||||
struct bContext *C,
|
||||
struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa);
|
||||
|
||||
void WM_toolsystem_update_from_context_view3d(struct bContext *C);
|
||||
void WM_toolsystem_update_from_context(
|
||||
struct bContext *C, struct WorkSpace *workspace, struct ViewLayer *view_layer,
|
||||
struct ScrArea *sa);
|
||||
|
||||
bool WM_toolsystem_active_tool_is_brush(const struct bContext *C);
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
#include "WM_toolsystem.h"
|
||||
#include "wm.h"
|
||||
#include "wm_draw.h"
|
||||
#include "wm_window.h"
|
||||
|
@ -542,6 +543,11 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
|
|||
|
||||
ED_area_update_region_sizes(wm, win, sa);
|
||||
|
||||
if (sa->flag & AREA_FLAG_ACTIVE_TOOL_UPDATE) {
|
||||
WM_toolsystem_update_from_context(C, CTX_wm_workspace(C), CTX_data_view_layer(C), sa);
|
||||
sa->flag &= ~AREA_FLAG_ACTIVE_TOOL_UPDATE;
|
||||
}
|
||||
|
||||
/* Then do actual drawing of regions. */
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->visible && ar->do_draw) {
|
||||
|
|
|
@ -851,6 +851,18 @@ void WM_toolsystem_update_from_context_view3d(bContext *C)
|
|||
toolsystem_reinit_ensure_toolref(C, workspace, &tkey, NULL);
|
||||
}
|
||||
|
||||
void WM_toolsystem_update_from_context(
|
||||
bContext *C, WorkSpace *workspace, ViewLayer *view_layer,
|
||||
ScrArea *sa)
|
||||
{
|
||||
const bToolKey tkey = {
|
||||
.space_type = sa->spacetype,
|
||||
.mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype),
|
||||
};
|
||||
toolsystem_reinit_ensure_toolref(C, workspace, &tkey, NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For paint modes to support non-brush tools.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue