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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-20 17:28:49 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-20 17:28:49 +0300
commit939c3ba9cbd0557b93de443e06b7e970984b288a (patch)
tree8ff26b2c95d2d88d2daf2a4a66e476ca68f99e2e /source
parent9790647ce6f0b99834e7199dd1ce1ef37a0c28ca (diff)
Fix for proxy fix: copy drivers on synchronize now does proper relinking
of driver targets, sharing code with make proxy.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/intern/armature.c14
-rw-r--r--source/blender/blenkernel/intern/object.c61
3 files changed, 38 insertions, 38 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index d0c2052f0d6..9d763ea78a8 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -67,6 +67,7 @@ void object_link_modifiers(struct Object *ob, struct Object *from);
void object_free_modifiers(struct Object *ob);
void object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
+void object_copy_proxy_drivers(struct Object *ob, struct Object *target);
void unlink_object(struct Scene *scene, struct Object *ob);
int exist_object(struct Object *obtest);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 498fb12aa9d..f9d6e07b6d7 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -61,7 +61,6 @@
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
-#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
@@ -1573,15 +1572,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
pchan->custom= pchanp->custom;
}
}
-
- /* copy drivers */
- adt= BKE_animdata_from_id(&ob->id);
- fromadt= BKE_animdata_from_id(&from->id);
- if(!adt)
- adt= BKE_id_add_animdata(&ob->id);
-
- free_fcurves(&adt->drivers);
- copy_fcurves(&adt->drivers, &fromadt->drivers);
}
static int rebuild_pose_bone(bPose *pose, Bone *bone, bPoseChannel *parchan, int counter)
@@ -1644,8 +1634,10 @@ void armature_rebuild_pose(Object *ob, bArmature *arm)
// printf("rebuild pose %s, %d bones\n", ob->id.name, counter);
/* synchronize protected layers with proxy */
- if(ob->proxy)
+ if(ob->proxy) {
+ object_copy_proxy_drivers(ob, ob->proxy);
pose_proxy_synchronize(ob, ob->proxy, arm->layer_protected);
+ }
update_pose_constraint_flags(ob->pose); // for IK detection for example
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 13e86dd3576..fd4f98e0a17 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1453,6 +1453,38 @@ static void armature_set_id_extern(Object *ob)
}
+void object_copy_proxy_drivers(Object *ob, Object *target)
+{
+ if ((target->adt) && (target->adt->drivers.first)) {
+ FCurve *fcu;
+
+ /* add new animdata block */
+ if(!ob->adt)
+ ob->adt= BKE_id_add_animdata(&ob->id);
+
+ /* make a copy of all the drivers (for now), then correct any links that need fixing */
+ free_fcurves(&ob->adt->drivers);
+ copy_fcurves(&ob->adt->drivers, &target->adt->drivers);
+
+ for (fcu= ob->adt->drivers.first; fcu; fcu= fcu->next) {
+ ChannelDriver *driver= fcu->driver;
+ DriverVar *dvar;
+
+ for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
+ /* all drivers */
+ DRIVER_TARGETS_LOOPER(dvar)
+ {
+ if ((Object *)dtar->id == target)
+ dtar->id= (ID *)ob;
+ else
+ id_lib_extern((ID *)dtar->id);
+ }
+ DRIVER_TARGETS_LOOPER_END
+ }
+ }
+ }
+}
+
/* proxy rule: lib_object->proxy_from == the one we borrow from, set temporally while object_update */
/* local_object->proxy == pointer to library object, saved in files and read */
/* local_object->proxy_group == pointer to group dupli-object, saved in files and read */
@@ -1489,33 +1521,8 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
copy_m4_m4(ob->parentinv, target->parentinv);
/* 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;
- DriverVar *dvar;
-
- for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
- /* all drivers */
- DRIVER_TARGETS_LOOPER(dvar)
- {
- if ((Object *)dtar->id == target)
- dtar->id= (ID *)ob;
- else
- id_lib_extern((ID *)dtar->id);
- }
- DRIVER_TARGETS_LOOPER_END
- }
- }
- }
-
+ object_copy_proxy_drivers(ob, target);
+
/* skip constraints? */
// FIXME: this is considered by many as a bug