diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-04 07:22:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-04 09:59:54 +0300 |
commit | e6194e735791b42feb51e810a4910a41d999d3bf (patch) | |
tree | 95889982ba8c6bc88f5bdfb2eded77159d81ca89 /source/blender/blenkernel/intern/action_bones.cc | |
parent | 716682365c6bcc1b5f757232ce1d2499b0d062a9 (diff) |
RNA: support extracting names from paths without allocating memory
Support extracting identifiers RNA paths into fixed size buffer
since the maximum size of the identifier is known all cases.
- Add BLI_str_unescape_ex to support limiting the destination buffer.
- Add BLI_str_quoted_substr to copy values into a fixed size buffer.
Diffstat (limited to 'source/blender/blenkernel/intern/action_bones.cc')
-rw-r--r-- | source/blender/blenkernel/intern/action_bones.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/action_bones.cc b/source/blender/blenkernel/intern/action_bones.cc index b8d185e6a81..1f2b7360b70 100644 --- a/source/blender/blenkernel/intern/action_bones.cc +++ b/source/blender/blenkernel/intern/action_bones.cc @@ -28,6 +28,7 @@ #include "DNA_action_types.h" #include "DNA_anim_types.h" +#include "DNA_armature_types.h" #include "MEM_guardedalloc.h" @@ -36,12 +37,11 @@ namespace blender::bke { void BKE_action_find_fcurves_with_bones(const bAction *action, FoundFCurveCallback callback) { LISTBASE_FOREACH (FCurve *, fcu, &action->curves) { - char *bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones["); - if (!bone_name) { + char bone_name[MAXBONENAME]; + if (!BLI_str_quoted_substr(fcu->rna_path, "pose.bones[", bone_name, sizeof(bone_name))) { continue; } callback(fcu, bone_name); - MEM_freeN(bone_name); } } |