tweak to WM_operatortype_find to perform better when called with empty strings (as the keymap editor does a lot)

This commit is contained in:
Campbell Barton 2011-09-02 08:01:01 +00:00
parent e6ff3df5b9
commit 1d9ddcd319

@ -108,21 +108,28 @@ static GHash *global_ops_hash= NULL;
wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
{
wmOperatorType *ot;
char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax
WM_operator_bl_idname(idname_bl, idname);
if(idname[0]) {
wmOperatorType *ot;
/* needed to support python style names without the _OT_ syntax */
char idname_bl[OP_MAX_TYPENAME];
WM_operator_bl_idname(idname_bl, idname);
if (idname_bl[0]) {
ot= BLI_ghash_lookup(global_ops_hash, idname_bl);
if(ot) {
return ot;
}
if(!quiet) {
printf("search for unknown operator '%s', '%s'\n", idname_bl, idname);
}
}
if(!quiet)
printf("search for unknown operator %s, %s\n", idname_bl, idname);
else {
if(!quiet) {
printf("search for empty operator\n");
}
}
return NULL;
}