[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50280] trunk/blender/source/blender: Bugfix [#32249] Groups in Dopesheet and Action editor don' t get updated after
Joshua Leung
aligorith at gmail.com
Thu Aug 30 17:06:13 CEST 2012
Revision: 50280
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50280
Author: aligorith
Date: 2012-08-30 15:06:13 +0000 (Thu, 30 Aug 2012)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/anim_sys.c
trunk/blender/source/blender/makesrna/intern/rna_armature.c
Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c 2012-08-30 15:02:20 UTC (rev 50279)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c 2012-08-30 15:06:13 UTC (rev 50280)
@@ -621,15 +621,30 @@
}
/* 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 @@
}
/* 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 @@
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 @@
/* 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);
Modified: trunk/blender/source/blender/makesrna/intern/rna_armature.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_armature.c 2012-08-30 15:02:20 UTC (rev 50279)
+++ trunk/blender/source/blender/makesrna/intern/rna_armature.c 2012-08-30 15:06:13 UTC (rev 50280)
@@ -146,6 +146,18 @@
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
}
+/* called whenever a bone is renamed */
+static void rna_Bone_update_renamed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ /* redraw view */
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+
+ /* update animation channels */
+ WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);
+}
+
static void rna_Bone_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id = ptr->id.data;
@@ -470,7 +482,7 @@
RNA_def_struct_name_property(srna, prop);
if (editbone) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
else RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+ RNA_def_property_update(prop, 0, "rna_Bone_update_renamed");
/* flags */
prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
More information about the Bf-blender-cvs
mailing list