forked from bartvdbraak/blender
operator spacebar search menu wasn't ignoring internal operators,
turns out there were copy-pasted functions for operator search popups which were identical except that one skipped internal ops. de-duplicate so both work the same now.
This commit is contained in:
parent
77fdf426d6
commit
302856f4b1
@ -817,6 +817,7 @@ void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *pt
|
|||||||
void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management);
|
void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management);
|
||||||
void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
|
void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
|
||||||
void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
|
void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
|
||||||
|
void uiOperatorSearch_But(uiBut *but);
|
||||||
void uiTemplateOperatorSearch(uiLayout *layout);
|
void uiTemplateOperatorSearch(uiLayout *layout);
|
||||||
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
|
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
|
||||||
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
|
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
|
||||||
|
@ -2785,6 +2785,9 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
|
|||||||
for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||||
wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
|
wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
|
||||||
|
|
||||||
|
if ((ot->flag & OPTYPE_INTERNAL) && (G.debug & G_DEBUG_WM) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (BLI_strcasestr(ot->name, str)) {
|
if (BLI_strcasestr(ot->name, str)) {
|
||||||
if (WM_operator_poll((bContext *)C, ot)) {
|
if (WM_operator_poll((bContext *)C, ot)) {
|
||||||
char name[256];
|
char name[256];
|
||||||
@ -2810,6 +2813,11 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
|
|||||||
BLI_ghashIterator_free(iter);
|
BLI_ghashIterator_free(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiOperatorSearch_But(uiBut *but)
|
||||||
|
{
|
||||||
|
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void uiTemplateOperatorSearch(uiLayout *layout)
|
void uiTemplateOperatorSearch(uiLayout *layout)
|
||||||
{
|
{
|
||||||
uiBlock *block;
|
uiBlock *block;
|
||||||
@ -2820,7 +2828,7 @@ void uiTemplateOperatorSearch(uiLayout *layout)
|
|||||||
uiBlockSetCurLayout(block, layout);
|
uiBlockSetCurLayout(block, layout);
|
||||||
|
|
||||||
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, 0, "");
|
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, 0, "");
|
||||||
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
|
uiOperatorSearch_But(but);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************* Running Jobs Template **************************/
|
/************************* Running Jobs Template **************************/
|
||||||
|
@ -1523,49 +1523,6 @@ static void WM_OT_splash(wmOperatorType *ot)
|
|||||||
|
|
||||||
|
|
||||||
/* ***************** Search menu ************************* */
|
/* ***************** Search menu ************************* */
|
||||||
static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2)
|
|
||||||
{
|
|
||||||
wmOperatorType *ot = arg2;
|
|
||||||
|
|
||||||
if (ot)
|
|
||||||
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
|
|
||||||
{
|
|
||||||
GHashIterator *iter = WM_operatortype_iter();
|
|
||||||
|
|
||||||
for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
|
||||||
wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
|
|
||||||
|
|
||||||
if ((ot->flag & OPTYPE_INTERNAL) && (G.debug & G_DEBUG_WM) == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (BLI_strcasestr(ot->name, str)) {
|
|
||||||
if (WM_operator_poll((bContext *)C, ot)) {
|
|
||||||
char name[256];
|
|
||||||
int len = strlen(ot->name);
|
|
||||||
|
|
||||||
/* display name for menu, can hold hotkey */
|
|
||||||
BLI_strncpy(name, ot->name, sizeof(name));
|
|
||||||
|
|
||||||
/* check for hotkey */
|
|
||||||
if (len < sizeof(name) - 6) {
|
|
||||||
if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE,
|
|
||||||
&name[len + 1], sizeof(name) - len - 1))
|
|
||||||
{
|
|
||||||
name[len] = '|';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 == uiSearchItemAdd(items, name, ot, 0))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BLI_ghashIterator_free(iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op))
|
static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op))
|
||||||
{
|
{
|
||||||
static char search[256] = "";
|
static char search[256] = "";
|
||||||
@ -1578,7 +1535,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_
|
|||||||
uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
|
uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
|
||||||
|
|
||||||
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
|
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
|
||||||
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
|
uiOperatorSearch_But(but);
|
||||||
|
|
||||||
/* fake button, it holds space for search items */
|
/* fake button, it holds space for search items */
|
||||||
uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
|
uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user