diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-10-12 15:27:34 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-10-12 15:27:34 +0400 |
commit | 237cd688aaead5592393db58cf2e39e2ab3ce9b2 (patch) | |
tree | 9a03690d8ea68f67a4d552ce7e4db7650f31c3a2 /source/blender/blenlib/intern/string.c | |
parent | b4a113669d8fecad28369b3d777aa285addacf46 (diff) |
Animation Editors: 'Only Selected' filtering option now works on Pose Channels too
* Only F-Curves and Drivers that affect selected bones will be visible when this happens.
* Moved the function to grab text within a pair of "" following some prefix to blenlib.
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r-- | source/blender/blenlib/intern/string.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index de4b53cbd93..405f8c6db97 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -100,6 +100,30 @@ char *BLI_sprintfN(const char *format, ...) return n; } +/* Makes a copy of the text within the "" that appear after some text 'blahblah' + * i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples" + * + * - str: is the entire string to chop + * - prefix: is the part of the string to leave out + * + * Assume that the strings returned must be freed afterwards, and that the inputs will contain + * data we want... + */ +char *BLI_getQuotedStr (const char *str, const char *prefix) +{ + int prefixLen = strlen(prefix); + char *startMatch, *endMatch; + + /* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */ + startMatch= strstr(str, prefix) + prefixLen + 1; + + /* get the end point (i.e. where the next occurance of " is after the starting point) */ + endMatch= strchr(startMatch, '"'); // " NOTE: this comment here is just so that my text editor still shows the functions ok... + + /* return the slice indicated */ + return BLI_strdupn(startMatch, (int)(endMatch-startMatch)); +} + /* Replaces all occurances of oldText with newText in str, returning a new string that doesn't * contain the 'replaced' occurances. */ |