diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-06-02 20:02:38 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-06-03 00:00:57 +0300 |
commit | 0731b88ddbbef2ca53c45b93e58c39d4ec1ce1b3 (patch) | |
tree | dd2abe4f3af80aa5732c9750ddf6e982db7417b8 /source/blender/collada/BCAnimationCurve.cpp | |
parent | 820e4d4303906020136b9a81ee0e878caee1f199 (diff) |
refactor collada: Added utility functions bc_string_before() and bc_string_after()
Diffstat (limited to 'source/blender/collada/BCAnimationCurve.cpp')
-rw-r--r-- | source/blender/collada/BCAnimationCurve.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/collada/BCAnimationCurve.cpp b/source/blender/collada/BCAnimationCurve.cpp index 3ba2570ac42..57aa2f1bf29 100644 --- a/source/blender/collada/BCAnimationCurve.cpp +++ b/source/blender/collada/BCAnimationCurve.cpp @@ -132,7 +132,31 @@ const bool BCAnimationCurve::is_of_animation_type(BC_animation_type type) const const std::string BCAnimationCurve::get_channel_target() const { const std::string path = curve_key.get_path(); - return bc_string_after(path, '.'); + + if (bc_startswith(path, "pose.bones")) { + return bc_string_after(path, "pose.bones"); + } + return bc_string_after(path, "."); +} + +const std::string BCAnimationCurve::get_channel_type() const +{ + const std::string channel = get_channel_target(); + return bc_string_after(channel, "."); +} + +const std::string BCAnimationCurve::get_channel_posebone() const +{ + const std::string channel = get_channel_target(); + std::string pose_bone_name = bc_string_before(channel, "."); + if (pose_bone_name == channel) { + pose_bone_name = ""; + } + else { + pose_bone_name = bc_string_after(pose_bone_name, "\"["); + pose_bone_name = bc_string_before(pose_bone_name, "]\""); + } + return pose_bone_name; } const std::string BCAnimationCurve::get_animation_name(Object *ob) const |