rename BLI_getQuotedStr --> BLI_str_quoted_substrN to make it more clear its doing an allocation.
This commit is contained in:
@@ -285,12 +285,12 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix,
|
|||||||
for (fcu = src->first; fcu; fcu = fcu->next) {
|
for (fcu = src->first; fcu; fcu = fcu->next) {
|
||||||
/* check if quoted string matches the path */
|
/* check if quoted string matches the path */
|
||||||
if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) {
|
if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) {
|
||||||
char *quotedName = BLI_getQuotedStr(fcu->rna_path, dataPrefix);
|
char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix);
|
||||||
|
|
||||||
if (quotedName) {
|
if (quotedName) {
|
||||||
/* check if the quoted name matches the required name */
|
/* check if the quoted name matches the required name */
|
||||||
if (strcmp(quotedName, dataName) == 0) {
|
if (strcmp(quotedName, dataName) == 0) {
|
||||||
LinkData *ld = MEM_callocN(sizeof(LinkData), "list_find_data_fcurves");
|
LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
|
||||||
|
|
||||||
ld->data = fcu;
|
ld->data = fcu;
|
||||||
BLI_addtail(dst, ld);
|
BLI_addtail(dst, ld);
|
||||||
|
@@ -105,7 +105,7 @@ __attribute__((nonnull))
|
|||||||
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
|
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
|
||||||
* data we want...
|
* data we want...
|
||||||
*/
|
*/
|
||||||
char *BLI_getQuotedStr(const char *str, const char *prefix)
|
char *BLI_str_quoted_substrN(const char *str, const char *prefix)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
__attribute__((warn_unused_result))
|
__attribute__((warn_unused_result))
|
||||||
__attribute__((nonnull))
|
__attribute__((nonnull))
|
||||||
|
@@ -168,8 +168,10 @@ escape_finish:
|
|||||||
*
|
*
|
||||||
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
|
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
|
||||||
* data we want...
|
* data we want...
|
||||||
|
*
|
||||||
|
* TODO, return the offset and a length so as to avoid doing an allocation.
|
||||||
*/
|
*/
|
||||||
char *BLI_getQuotedStr(const char *str, const char *prefix)
|
char *BLI_str_quoted_substrN(const char *str, const char *prefix)
|
||||||
{
|
{
|
||||||
size_t prefixLen = strlen(prefix);
|
size_t prefixLen = strlen(prefix);
|
||||||
char *startMatch, *endMatch;
|
char *startMatch, *endMatch;
|
||||||
|
@@ -178,7 +178,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
|||||||
char *bone_name;
|
char *bone_name;
|
||||||
|
|
||||||
/* get bone-name, and check if this bone is selected */
|
/* get bone-name, and check if this bone is selected */
|
||||||
bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
|
bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
|
||||||
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
|
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
|
||||||
if (bone_name) MEM_freeN(bone_name);
|
if (bone_name) MEM_freeN(bone_name);
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
|||||||
char *seq_name;
|
char *seq_name;
|
||||||
|
|
||||||
/* get strip name, and check if this strip is selected */
|
/* get strip name, and check if this strip is selected */
|
||||||
seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
|
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
|
||||||
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
|
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
|
||||||
if (seq_name) MEM_freeN(seq_name);
|
if (seq_name) MEM_freeN(seq_name);
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
|||||||
char *node_name;
|
char *node_name;
|
||||||
|
|
||||||
/* get strip name, and check if this strip is selected */
|
/* get strip name, and check if this strip is selected */
|
||||||
node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
|
node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
|
||||||
node = nodeFindNodebyName(ntree, node_name);
|
node = nodeFindNodebyName(ntree, node_name);
|
||||||
if (node_name) MEM_freeN(node_name);
|
if (node_name) MEM_freeN(node_name);
|
||||||
|
|
||||||
|
@@ -880,7 +880,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
|
|||||||
char *bone_name;
|
char *bone_name;
|
||||||
|
|
||||||
/* get bone-name, and check if this bone is selected */
|
/* get bone-name, and check if this bone is selected */
|
||||||
bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
|
bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
|
||||||
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
|
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
|
||||||
if (bone_name) MEM_freeN(bone_name);
|
if (bone_name) MEM_freeN(bone_name);
|
||||||
|
|
||||||
@@ -916,7 +916,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
|
|||||||
char *seq_name;
|
char *seq_name;
|
||||||
|
|
||||||
/* get strip name, and check if this strip is selected */
|
/* get strip name, and check if this strip is selected */
|
||||||
seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
|
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
|
||||||
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
|
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
|
||||||
if (seq_name) MEM_freeN(seq_name);
|
if (seq_name) MEM_freeN(seq_name);
|
||||||
|
|
||||||
@@ -936,7 +936,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
|
|||||||
char *node_name;
|
char *node_name;
|
||||||
|
|
||||||
/* get strip name, and check if this strip is selected */
|
/* get strip name, and check if this strip is selected */
|
||||||
node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
|
node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
|
||||||
node = nodeFindNodebyName(ntree, node_name);
|
node = nodeFindNodebyName(ntree, node_name);
|
||||||
if (node_name) MEM_freeN(node_name);
|
if (node_name) MEM_freeN(node_name);
|
||||||
|
|
||||||
|
@@ -104,8 +104,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
|||||||
*/
|
*/
|
||||||
if (strstr(fcu->rna_path, "bones") && strstr(fcu->rna_path, "constraints")) {
|
if (strstr(fcu->rna_path, "bones") && strstr(fcu->rna_path, "constraints")) {
|
||||||
/* perform string 'chopping' to get "Bone Name : Constraint Name" */
|
/* perform string 'chopping' to get "Bone Name : Constraint Name" */
|
||||||
char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
|
char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
|
||||||
char *constName = BLI_getQuotedStr(fcu->rna_path, "constraints[");
|
char *constName = BLI_str_quoted_substrN(fcu->rna_path, "constraints[");
|
||||||
|
|
||||||
/* assemble the string to display in the UI... */
|
/* assemble the string to display in the UI... */
|
||||||
structname = BLI_sprintfN("%s : %s", pchanName, constName);
|
structname = BLI_sprintfN("%s : %s", pchanName, constName);
|
||||||
|
@@ -694,7 +694,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
|
|||||||
/* only items related to this object will be relevant */
|
/* only items related to this object will be relevant */
|
||||||
if ((ksp->id == &ob->id) && (ksp->rna_path != NULL)) {
|
if ((ksp->id == &ob->id) && (ksp->rna_path != NULL)) {
|
||||||
if (strstr(ksp->rna_path, "bones")) {
|
if (strstr(ksp->rna_path, "bones")) {
|
||||||
char *boneName = BLI_getQuotedStr(ksp->rna_path, "bones[");
|
char *boneName = BLI_str_quoted_substrN(ksp->rna_path, "bones[");
|
||||||
|
|
||||||
if (boneName) {
|
if (boneName) {
|
||||||
bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName);
|
bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName);
|
||||||
|
@@ -4880,7 +4880,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
|
|||||||
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
||||||
/* only insert keyframes for this F-Curve if it affects the current bone */
|
/* only insert keyframes for this F-Curve if it affects the current bone */
|
||||||
if (strstr(fcu->rna_path, "bones")) {
|
if (strstr(fcu->rna_path, "bones")) {
|
||||||
char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
|
char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
|
||||||
|
|
||||||
/* only if bone name matches too...
|
/* only if bone name matches too...
|
||||||
* NOTE: this will do constraints too, but those are ok to do here too?
|
* NOTE: this will do constraints too, but those are ok to do here too?
|
||||||
|
Reference in New Issue
Block a user