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:
authorCampbell Barton <ideasman42@gmail.com>2010-04-29 19:31:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-04-29 19:31:53 +0400
commit610c4befd4ea1d2798c4196785570ddce76f324a (patch)
tree0c59677e2b5fca9a0201adc56fbefb100a24c5a4 /source
parent6662440867f0ca909339bbb95295c8db95ba0005 (diff)
option to copy constraints without making their ID references direct links.
needed because proxies are causing libs to be linked directly when they should be kept indirect (likely slowing load times though I didnt time this)
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_constraint.h2
-rw-r--r--source/blender/blenkernel/intern/action.c4
-rw-r--r--source/blender/blenkernel/intern/armature.c4
-rw-r--r--source/blender/blenkernel/intern/constraint.c13
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/editors/armature/poseobject.c4
-rw-r--r--source/blender/editors/object/object_constraint.c2
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp2
9 files changed, 20 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 94863e15e46..64e9636cae7 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -122,7 +122,7 @@ bConstraintTypeInfo *get_constraint_typeinfo(int type);
void unique_constraint_name(struct bConstraint *con, struct ListBase *list);
void free_constraints(struct ListBase *list);
-void copy_constraints(struct ListBase *dst, const struct ListBase *src);
+void copy_constraints(struct ListBase *dst, const struct ListBase *src, int do_extern);
void relink_constraints(struct ListBase *list);
void id_loop_constraints(struct ListBase *list, ConstraintIDFunc func, void *userdata);
void free_constraint_data(struct bConstraint *con);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 253da25b871..c5705a0f619 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -493,7 +493,7 @@ void copy_pose (bPose **dst, bPose *src, int copycon)
for (pchan=outPose->chanbase.first; pchan; pchan=pchan->next) {
// TODO: rename this argument...
if (copycon) {
- copy_constraints(&listb, &pchan->constraints); // copy_constraints NULLs listb
+ copy_constraints(&listb, &pchan->constraints, TRUE); // copy_constraints NULLs listb
pchan->constraints= listb;
pchan->path= NULL; // XXX remove this line when the new motionpaths are ready... (depreceated code)
pchan->mpath= NULL; /* motion paths should not get copied yet... */
@@ -667,7 +667,7 @@ void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_
pchan->iklinweight= pchan_from->iklinweight;
/* constraints */
- copy_constraints(&pchan->constraints, &pchan_from->constraints);
+ copy_constraints(&pchan->constraints, &pchan_from->constraints, TRUE);
/* id-properties */
if(pchan->prop) {
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index a2dbaa9d666..4f9b9435a80 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1568,9 +1568,11 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
* 1. extract constraints not from proxy (CONSTRAINT_PROXY_LOCAL) from pchan's constraints
* 2. copy proxy-pchan's constraints on-to new
* 3. add extracted local constraints back on top
+ *
+ * note for copy_constraints: when copying constraints, disable 'do_extern' otherwise we get the libs direct linked in this blend.
*/
extract_proxylocal_constraints(&proxylocal_constraints, &pchan->constraints);
- copy_constraints(&pchanw.constraints, &pchanp->constraints);
+ copy_constraints(&pchanw.constraints, &pchanp->constraints, FALSE);
addlisttolist(&pchanw.constraints, &proxylocal_constraints);
/* constraints - set target ob pointer to own object */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 18504bab59b..a3f1cb0cb0c 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4131,7 +4131,7 @@ static void con_extern_cb(bConstraint *con, ID **idpoin, void *userdata)
}
/* duplicate all of the constraints in a constraint stack */
-void copy_constraints (ListBase *dst, const ListBase *src)
+void copy_constraints (ListBase *dst, const ListBase *src, int do_extern)
{
bConstraint *con, *srccon;
@@ -4149,10 +4149,13 @@ void copy_constraints (ListBase *dst, const ListBase *src)
/* perform custom copying operations if needed */
if (cti->copy_data)
cti->copy_data(con, srccon);
-
- /* go over used ID-links for this constraint to ensure that they are valid for proxies */
- if (cti->id_looper)
- cti->id_looper(con, con_extern_cb, NULL);
+
+ /* for proxies we dont want to make extern */
+ if(do_extern) {
+ /* go over used ID-links for this constraint to ensure that they are valid for proxies */
+ if (cti->id_looper)
+ cti->id_looper(con, con_extern_cb, NULL);
+ }
}
}
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ce064a78cff..baa1caee49b 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1282,7 +1282,7 @@ Object *copy_object(Object *ob)
armature_rebuild_pose(obn, obn->data);
}
defgroup_copy_list(&obn->defbase, &ob->defbase);
- copy_constraints(&obn->constraints, &ob->constraints);
+ copy_constraints(&obn->constraints, &ob->constraints, TRUE);
obn->mode = 0;
obn->sculpt = NULL;
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index dcd59a3185a..24c3aff9a6a 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -691,7 +691,7 @@ void pose_copy_menu(Scene *scene)
/* copy constraints to tmpbase and apply 'local' tags before
* appending to list of constraints for this channel
*/
- copy_constraints(&tmp_constraints, &pchanact->constraints);
+ copy_constraints(&tmp_constraints, &pchanact->constraints, TRUE);
if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
bConstraint *con;
@@ -800,7 +800,7 @@ void pose_copy_menu(Scene *scene)
/* copy constraints to tmpbase and apply 'local' tags before
* appending to list of constraints for this channel
*/
- copy_constraints(&tmp_constraints, &const_copy);
+ copy_constraints(&tmp_constraints, &const_copy, TRUE);
if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
bConstraint *con;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 83da8add62e..eef7919af9f 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1256,7 +1256,7 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
if(ob != ob_iter) {
if (ob->data != ob_iter->data){
- copy_constraints(&ob_iter->constraints, &ob->constraints);
+ copy_constraints(&ob_iter->constraints, &ob->constraints, TRUE);
}
if(ob_iter->totcol==ob->totcol) {
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 6631f5fc0d2..53d614626ad 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1450,7 +1450,7 @@ void copy_attr(Scene *scene, View3D *v3d, short event)
}
else if(event==22) {
/* Copy the constraint channels over */
- copy_constraints(&base->object->constraints, &ob->constraints);
+ copy_constraints(&base->object->constraints, &ob->constraints, TRUE);
do_scene_sort= 1;
}
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 35ee3ac1ca3..78f16dd6982 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -108,7 +108,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
if (copy_constraint) {
ListBase listb;
// copy all constraint for backward compatibility
- copy_constraints(&listb, &pchan->constraints); // copy_constraints NULLs listb
+ copy_constraints(&listb, &pchan->constraints, FALSE); // copy_constraints NULLs listb, no need to make extern for this operation.
pchan->constraints= listb;
} else {
pchan->constraints.first = NULL;