Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-01-08 00:25:33 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-01-09 14:16:58 +0300
commit2f16098d208058dce7701d6e49ed9052445553f5 (patch)
tree781ff394a933cd75dd65cba5505eff466c798b4b /source/blender/blenlib/intern/string.c
parent95847f6ac7ce074501d0f7f2b874ef4036601dc4 (diff)
Gooseberry animation request: Paste flipped pose in action
and graph editor. This was a tricky commit that was not so straightforward to make work. The information for bones is not easy to come by in the animation curves, however we do have some string manipulation tricks to make it happen. Testing in gooseberry worked for the rigs there, commiting to master now
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r--source/blender/blenlib/intern/string.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 765e2ea127b..365e555f9a9 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -773,6 +773,35 @@ int BLI_str_index_in_array(const char *__restrict str, const char **__restrict s
return -1;
}
+bool BLI_strn_ends_with(const char *str,const char *end, int slength)
+{
+ size_t elength = strlen(end);
+
+ if (elength < slength) {
+ const char *iter = str + slength - elength;
+ while (*iter) {
+ if (*iter++ != *end++) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Find if a string ends with another string.
+ *
+ * \param str The string to search within.
+ * \param end The string we look for at the end.
+ * \return If str ends with end.
+ */
+bool BLI_str_ends_with(const char *str,const char *end)
+{
+ size_t slength = strlen(str);
+ return BLI_strn_ends_with(str, end, slength);
+}
+
/**
* Find the first char matching one of the chars in \a delim, from left.
*