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>2009-08-03 16:11:50 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-03 16:11:50 +0400
commitcd905eef702555b27d4d90983b079a1a62c31fb8 (patch)
tree8a25eb9de2f06ccc46c1e624a31de2386b238d22
parent28909178d96ff04c22091ccd992314617352e1f0 (diff)
2.5 - Make Proxy Tweaks
* Drivers are now copied across and relinked as appropriate * Drawtype is also copied now (especially useful for rigs)
-rw-r--r--source/blender/blenkernel/intern/object.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index e463d007a2d..150a5aa97aa 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -91,6 +91,7 @@
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
+#include "BKE_fcurve.h"
#include "BKE_group.h"
#include "BKE_icons.h"
#include "BKE_key.h"
@@ -1402,11 +1403,32 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
ob->parent= target->parent; /* libdata */
Mat4CpyMat4(ob->parentinv, target->parentinv);
-#if 0 // XXX old animation system
- ob->ipo= target->ipo; /* libdata */
-#endif // XXX old animation system
- /* skip constraints, constraintchannels, nla? */
+ /* copy animdata stuff - drivers only for now... */
+ if ((target->adt) && (target->adt->drivers.first)) {
+ FCurve *fcu;
+
+ /* add new animdata block */
+ ob->adt= BKE_id_add_animdata(&ob->id);
+
+ /* make a copy of all the drivers (for now), then correct any links that need fixing */
+ copy_fcurves(&ob->adt->drivers, &target->adt->drivers);
+
+ for (fcu= ob->adt->drivers.first; fcu; fcu= fcu->next) {
+ ChannelDriver *driver= fcu->driver;
+ DriverTarget *dtar;
+
+ for (dtar= driver->targets.first; dtar; dtar= dtar->next) {
+ if ((Object *)dtar->id == target)
+ dtar->id= (ID *)ob;
+ else
+ id_lib_extern((ID *)dtar->id);
+ }
+ }
+ }
+
+ /* skip constraints? */
+ // FIXME: this is considered by many as a bug
/* set object type and link to data */
ob->type= target->type;
@@ -1442,6 +1464,9 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
armature_set_id_extern(ob);
}
+
+ /* copy drawtype info */
+ ob->dt= target->dt;
}