static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); for(; ot; ot= ot->next) { if(BLI_strcasestr(ot->name, str)) { if(WM_operator_poll((bContext*)C, ot)) { if(0==uiSearchItemAdd(items, ot->name, ot, 0)) break; } } } }
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 (BLI_strcasestr(ot->name, str)) { if (WM_operator_poll((bContext *)C, ot)) { if (0 == uiSearchItemAdd(items, ot->name, ot, 0)) break; } } } BLI_ghashIterator_free(iter); }
/* generic search invoke */ static void node_find_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) { SpaceNode *snode = CTX_wm_space_node(C); bNode *node; for (node = snode->edittree->nodes.first; node; node = node->next) { if (BLI_strcasestr(node->name, str) || BLI_strcasestr(node->label, str)) { char name[256]; if (node->label[0]) BLI_snprintf(name, 256, "%s (%s)", node->name, node->label); else BLI_strncpy(name, node->name, 256); if (false == uiSearchItemAdd(items, name, node, 0)) break; } } }