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:
authorJoshua Leung <aligorith@gmail.com>2012-08-30 19:06:13 +0400
committerJoshua Leung <aligorith@gmail.com>2012-08-30 19:06:13 +0400
commitc4622c405e40a119ae213255022c5e1303af103f (patch)
treebd3b14f85701f3dc88314dc038ab0e81ec215076 /source/blender/blenkernel/intern/anim_sys.c
parentdfd54c61d1441d6c55dedaac0f2045bd388dc754 (diff)
Bugfix [#32249] Groups in Dopesheet and Action editor don't get updated after
bone renaming * Renaming F-Curves now checks if the corresponding F-Curve's group can also be renamed accordingly. * Changed the RNA updates for bone renaming so that they properly update the channel lists
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 8e8c98a38e4..37b49349b8a 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -621,15 +621,30 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
}
/* Check RNA-Paths for a list of F-Curves */
-static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, char *oldName, char *newName, ListBase *curves, int verify_paths)
+static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
+ const char *oldKey, const char *newKey, ListBase *curves, int verify_paths)
{
FCurve *fcu;
/* we need to check every curve... */
for (fcu = curves->first; fcu; fcu = fcu->next) {
- /* firstly, handle the F-Curve's own path */
- if (fcu->rna_path)
- fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldName, newName, fcu->rna_path, verify_paths);
+ if (fcu->rna_path) {
+ char *old_path = fcu->rna_path;
+
+ /* firstly, handle the F-Curve's own path */
+ fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
+
+ /* if path changed and the F-Curve is grouped, check if its group also needs renaming
+ * (i.e. F-Curve is first of a bone's F-Curves; hence renaming this should also trigger rename)
+ */
+ if (fcu->rna_path != old_path) {
+ bActionGroup *agrp = fcu->grp;
+
+ if ((agrp) && strcmp(oldName, agrp->name)==0) {
+ BLI_strncpy(agrp->name, newName, sizeof(agrp->name));
+ }
+ }
+ }
}
}
@@ -675,7 +690,8 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix
}
/* Fix all RNA-Paths for Actions linked to NLA Strips */
-static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, char *oldName, char *newName, ListBase *strips, int verify_paths)
+static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
+ const char *oldKey, const char *newKey, ListBase *strips, int verify_paths)
{
NlaStrip *strip;
@@ -683,11 +699,11 @@ static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, char *ol
for (strip = strips->first; strip; strip = strip->next) {
/* fix strip's action */
if (strip->act)
- fcurves_path_rename_fix(owner_id, prefix, oldName, newName, &strip->act->curves, verify_paths);
+ fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->act->curves, verify_paths);
/* ignore own F-Curves, since those are local... */
/* check sub-strips (if metas) */
- nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, &strip->strips, verify_paths);
+ nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths);
}
}
@@ -717,16 +733,16 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
/* Active action and temp action */
if (adt->action)
- fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->action->curves, verify_paths);
+ fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->action->curves, verify_paths);
if (adt->tmpact)
- fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->tmpact->curves, verify_paths);
+ fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->tmpact->curves, verify_paths);
/* Drivers - Drivers are really F-Curves */
drivers_path_rename_fix(owner_id, ref_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths);
/* NLA Data - Animation Data for Strips */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next)
- nlastrips_path_rename_fix(owner_id, prefix, oldN, newN, &nlt->strips, verify_paths);
+ nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &nlt->strips, verify_paths);
/* free the temp names */
MEM_freeN(oldN);