static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) { GHashIterator iter; for (WM_operatortype_iter(&iter); !BLI_ghashIterator_done(&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 (false == UI_search_item_add(items, ot->name, ot, 0)) break; } } } }
static PyObject *pyop_dir(PyObject *UNUSED(self)) { GHashIterator iter; PyObject *list; int i; WM_operatortype_iter(&iter); list = PyList_New(BLI_ghash_len(iter.gh)); for (i = 0; !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter), i++) { wmOperatorType *ot = BLI_ghashIterator_getValue(&iter); PyList_SET_ITEM(list, i, PyUnicode_FromString(ot->idname)); } return list; }
static PyObject *pyop_dir(PyObject *UNUSED(self)) { GHashIterator *iter = WM_operatortype_iter(); PyObject *list = PyList_New(0), *name; for ( ; !BLI_ghashIterator_done(iter); BLI_ghashIterator_step(iter)) { wmOperatorType *ot = BLI_ghashIterator_getValue(iter); name = PyUnicode_FromString(ot->idname); PyList_Append(list, name); Py_DECREF(name); } BLI_ghashIterator_free(iter); return list; }
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); }