WM: suppress assertion when switching tools

Changing the object mode outside the 3D view would trigger this
assertion. This was harmless, only assert for space types that
define the tools mode.
This commit is contained in:
Campbell Barton 2022-05-06 17:44:32 +10:00
parent 693aa573db
commit 62450e8485
2 changed files with 7 additions and 1 deletions

View File

@ -28,6 +28,11 @@ struct wmOperatorType;
#define WM_TOOLSYSTEM_SPACE_MASK \
((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ))
/**
* Space-types that define their own "mode" (as returned by #WM_toolsystem_mode_from_spacetype).
*/
#define WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE ((1 << SPACE_IMAGE) | (1 << SPACE_SEQ))
/* Values that define a category of active tool. */
typedef struct bToolKey {
int space_type;

View File

@ -636,7 +636,8 @@ bToolRef *WM_toolsystem_ref_set_by_id_ex(
/* Some contexts use the current space type (image editor for e.g.),
* ensure this is set correctly or there is no area. */
#ifndef NDEBUG
{
/* Exclude this check for some space types where the space type isn't used. */
if ((1 << tkey->space_type) & WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE) {
ScrArea *area = CTX_wm_area(C);
BLI_assert(area == NULL || area->spacetype == tkey->space_type);
}