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/blenlib/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/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 0a6831558d1..776f2d085df 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -374,6 +374,27 @@ void *BLI_findstring(ListBase *listbase, const char *id, int offset) return NULL; } +void *BLI_findstring_ptr(ListBase *listbase, const char *id, int offset) +{ + Link *link= NULL; + const char *id_iter; + + if (listbase == NULL) return NULL; + + link= listbase->first; + while (link) { + /* exact copy of BLI_findstring(), except for this line */ + id_iter= *((const char **)(((const char *)link) + offset)); + + if(id[0] == id_iter[0] && strcmp(id, id_iter)==0) + return link; + + link= link->next; + } + + return NULL; +} + int BLI_findstringindex(ListBase *listbase, const char *id, int offset) { Link *link= NULL; |