[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52774] trunk/blender/source/blender: operator spacebar search menu wasn't ignoring internal operators,
Campbell Barton
ideasman42 at gmail.com
Tue Dec 4 19:22:41 CET 2012
Revision: 52774
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52774
Author: campbellbarton
Date: 2012-12-04 18:22:41 +0000 (Tue, 04 Dec 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/UI_interface.h
trunk/blender/source/blender/editors/interface/interface_templates.c
trunk/blender/source/blender/windowmanager/intern/wm_operators.c
Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h 2012-12-04 17:54:32 UTC (rev 52773)
+++ trunk/blender/source/blender/editors/include/UI_interface.h 2012-12-04 18:22:41 UTC (rev 52774)
@@ -817,6 +817,7 @@
void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management);
void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
+void uiOperatorSearch_But(uiBut *but);
void uiTemplateOperatorSearch(uiLayout *layout);
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c 2012-12-04 17:54:32 UTC (rev 52773)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c 2012-12-04 18:22:41 UTC (rev 52774)
@@ -2785,6 +2785,9 @@
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];
@@ -2810,6 +2813,11 @@
BLI_ghashIterator_free(iter);
}
+void uiOperatorSearch_But(uiBut *but)
+{
+ uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
+}
+
void uiTemplateOperatorSearch(uiLayout *layout)
{
uiBlock *block;
@@ -2820,7 +2828,7 @@
uiBlockSetCurLayout(block, layout);
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 **************************/
Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2012-12-04 17:54:32 UTC (rev 52773)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2012-12-04 18:22:41 UTC (rev 52774)
@@ -1523,49 +1523,6 @@
/* ***************** 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 char search[256] = "";
@@ -1578,7 +1535,7 @@
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, "");
- uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
+ uiOperatorSearch_But(but);
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
More information about the Bf-blender-cvs
mailing list