[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14848] trunk/blender/source/blender/src/ editarmature.c: Bugfix #11293: IPO-Driver Links Lost on Renaming Bones
Joshua Leung
aligorith at gmail.com
Thu May 15 10:05:56 CEST 2008
Revision: 14848
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14848
Author: aligorith
Date: 2008-05-15 10:05:56 +0200 (Thu, 15 May 2008)
Log Message:
-----------
Bugfix #11293: IPO-Driver Links Lost on Renaming Bones
IPO's were not being checked for drivers that linked to bones that were renamed when fixing dependencies after renaming bones. Note: PyDrivers will not benefit from this.
Modified Paths:
--------------
trunk/blender/source/blender/src/editarmature.c
Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c 2008-05-15 06:47:54 UTC (rev 14847)
+++ trunk/blender/source/blender/src/editarmature.c 2008-05-15 08:05:56 UTC (rev 14848)
@@ -55,6 +55,8 @@
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_modifier_types.h"
+#include "DNA_ipo_types.h"
+#include "DNA_curve_types.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -3850,7 +3852,7 @@
}
#define MAXBONENAME 32
-/* helper call for below */
+/* helper call for armature_bone_rename */
static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldname, char *newname)
{
bConstraint *curcon;
@@ -3882,6 +3884,7 @@
void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
{
Object *ob;
+ Ipo *ipo;
char newname[MAXBONENAME];
char oldname[MAXBONENAME];
@@ -3905,7 +3908,7 @@
else return;
}
else {
- Bone *bone= get_named_bone (arm, oldname);
+ Bone *bone= get_named_bone(arm, oldname);
if (bone) {
unique_bone_name (arm, newname);
@@ -3914,7 +3917,7 @@
else return;
}
- /* do entire dbase */
+ /* do entire dbase - objects */
for (ob= G.main->object.first; ob; ob= ob->id.next) {
/* we have the object using the armature */
if (arm==ob->data) {
@@ -3936,7 +3939,7 @@
if (ob->pose) {
bPoseChannel *pchan = get_pose_channel(ob->pose, oldname);
if (pchan)
- BLI_strncpy (pchan->name, newname, MAXBONENAME);
+ BLI_strncpy(pchan->name, newname, MAXBONENAME);
}
/* check all nla-strips too */
@@ -3982,6 +3985,28 @@
}
}
}
+
+ /* do entire db - ipo's for the drivers */
+ for (ipo= G.main->ipo.first; ipo; ipo= ipo->id.next) {
+ IpoCurve *icu;
+
+ /* check each curve's driver */
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ IpoDriver *icd= icu->driver;
+
+ if ((icd) && (icd->ob)) {
+ ob= icd->ob;
+
+ if (icu->driver->type == IPO_DRIVER_TYPE_NORMAL) {
+ if (!strcmp(oldname, icd->name))
+ BLI_strncpy(icd->name, newname, MAXBONENAME);
+ }
+ else {
+ /* TODO: pydrivers need to be treated differently */
+ }
+ }
+ }
+ }
}
}
More information about the Bf-blender-cvs
mailing list