Revert "Fix T58683: Reload Scripts breaks toolbar button formatting."

This reverts commit ba90d2efa5.

This can be resolved without adding a boolean to all operator types
to check if it's "WM_OT_tool_set_by_id".
This commit is contained in:
Campbell Barton 2019-10-01 01:36:02 +10:00
parent 6a6ac502f2
commit 68c2f7a2d0
Notes: blender-bot 2023-02-14 04:43:53 +01:00
Referenced by issue #58683, Toolbar buttons change color and icons become off-centered after using the Reload Scripts operator
3 changed files with 11 additions and 8 deletions

View File

@ -139,7 +139,17 @@ bool ui_but_has_array_value(const uiBut *but)
bool UI_but_is_tool(const uiBut *but)
{
return but->optype && but->optype->is_tool_button;
/* very evil! */
if (but->optype != NULL) {
static wmOperatorType *ot = NULL;
if (ot == NULL) {
ot = WM_operatortype_find("WM_OT_tool_set_by_id", false);
}
if (but->optype == ot) {
return true;
}
}
return false;
}
bool UI_but_has_tooltip_label(const uiBut *but)

View File

@ -773,8 +773,6 @@ typedef struct wmOperatorType {
/** Flag last for padding */
short flag;
/** Is the operator used by tool buttons, hack for fast checking. */
bool is_tool_button;
} wmOperatorType;
/**

View File

@ -20,8 +20,6 @@
* Operator Registry.
*/
#include <string.h>
#include "MEM_guardedalloc.h"
#include "CLG_log.h"
@ -129,9 +127,6 @@ static void wm_operatortype_append__end(wmOperatorType *ot)
ot->srna, ot->name, ot->description ? ot->description : UNDOCUMENTED_OPERATOR_TIP);
RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname);
/* A hack for efficiently detecting buttons with this specific operator. */
ot->is_tool_button = STREQ(ot->idname, "WM_OT_tool_set_by_id");
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
}