diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-13 10:30:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-13 10:30:04 +0400 |
commit | bf52b68dcd1864fd35309f9aae19f146da5b774e (patch) | |
tree | aea9cce847b38dce0f76e61991d490c71e51502c /source/blender/windowmanager/intern | |
parent | e50ef6da2dba248ef9fcf14a10d67ef003649e5a (diff) |
minor changes to rna/python.
- raise an exception when python calls is_property_set(name) or is_property_hidden(name) and the property does not exist.
- added BLI_findstring_ptr(), which finds a named item in a listbase where that name is a pointer to a string.
- replaced inline for loops with calls to BLI_findstring_ptr() and IDP_GetPropertyFromGroup().
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 9 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index fcf8951d796..8d36711032b 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -26,7 +26,8 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "string.h" +#include <string.h> +#include <stddef.h> #include "DNA_windowmanager_types.h" @@ -149,9 +150,9 @@ MenuType *WM_menutype_find(const char *idname, int quiet) MenuType* mt; if (idname[0]) { - for(mt=menutypes.first; mt; mt=mt->next) - if(strcmp(idname, mt->idname)==0) - return mt; + mt= BLI_findstring(&menutypes, idname, offsetof(MenuType, idname)); + if(mt) + return mt; } if(!quiet) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index fef7f737c8a..23994905b96 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -103,11 +103,11 @@ wmOperatorType *WM_operatortype_find(const char *idname, int quiet) 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_bl[0]) { - for(ot= global_ops.first; ot; ot= ot->next) { - if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0) - return ot; + ot= BLI_findstring_ptr(&global_ops, idname_bl, offsetof(wmOperatorType, idname)); + if(ot) { + return ot; } } |