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:
-rw-r--r--source/blender/blenkernel/BKE_ipo.h1
-rw-r--r--source/blender/blenkernel/intern/ipo.c14
-rw-r--r--source/blender/src/editobject.c14
3 files changed, 25 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h
index 7c8c0186397..2a6065eb4f1 100644
--- a/source/blender/blenkernel/BKE_ipo.h
+++ b/source/blender/blenkernel/BKE_ipo.h
@@ -60,6 +60,7 @@ void free_ipo(struct Ipo *ipo);
void ipo_default_v2d_cur(int blocktype, struct rctf *cur);
struct Ipo *add_ipo(char *name, int idcode);
struct Ipo *copy_ipo(struct Ipo *ipo);
+void ipo_idnew(struct Ipo *ipo);
void make_local_obipo(struct Ipo *ipo);
void make_local_matipo(struct Ipo *ipo);
void make_local_keyipo(struct Ipo *ipo);
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index b84410b12e7..1757317b849 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -287,6 +287,20 @@ Ipo *copy_ipo(Ipo *ipo)
return ipon;
}
+/* uses id->newid to match pointers with other copied data */
+void ipo_idnew(Ipo *ipo)
+{
+ if(ipo) {
+ IpoCurve *icu;
+
+ for(icu= ipo->curve.first; icu; icu= icu->next) {
+ if(icu->driver) {
+ ID_NEW(icu->driver->ob);
+ }
+ }
+ }
+}
+
void make_local_obipo(Ipo *ipo)
{
Object *ob;
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 04a6b037ba0..1152d880c5a 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -4079,7 +4079,7 @@ void single_obdata_users(int flag)
switch(ob->type) {
case OB_LAMP:
- if(id && id->us>1 && id->lib==0) {
+ if(id && id->us>1 && id->lib==NULL) {
ob->data= la= copy_lamp(ob->data);
for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) {
@@ -4092,7 +4092,9 @@ void single_obdata_users(int flag)
ob->data= copy_camera(ob->data);
break;
case OB_MESH:
- ob->data= copy_mesh(ob->data);
+ me= ob->data= copy_mesh(ob->data);
+ if(me && me->key)
+ ipo_idnew(me->key->ipo); /* drivers */
break;
case OB_MBALL:
ob->data= copy_mball(ob->data);
@@ -4124,7 +4126,7 @@ void single_obdata_users(int flag)
}
id= (ID *)ob->action;
- if (id && id->us>1 && id->lib==0){
+ if (id && id->us>1 && id->lib==NULL){
if(id->newid){
ob->action= (bAction *)id->newid;
id_us_plus(id->newid);
@@ -4136,7 +4138,7 @@ void single_obdata_users(int flag)
}
}
id= (ID *)ob->ipo;
- if(id && id->us>1 && id->lib==0) {
+ if(id && id->us>1 && id->lib==NULL) {
if(id->newid) {
ob->ipo= (Ipo *)id->newid;
id_us_plus(id->newid);
@@ -4146,6 +4148,7 @@ void single_obdata_users(int flag)
id->us--;
id->newid= (ID *)ob->ipo;
}
+ ipo_idnew(ob->ipo); /* drivers */
}
/* other ipos */
switch(ob->type) {
@@ -4154,6 +4157,7 @@ void single_obdata_users(int flag)
if(la->ipo && la->ipo->id.us>1) {
la->ipo->id.us--;
la->ipo= copy_ipo(la->ipo);
+ ipo_idnew(la->ipo); /* drivers */
}
break;
case OB_CAMERA:
@@ -4161,6 +4165,7 @@ void single_obdata_users(int flag)
if(cam->ipo && cam->ipo->id.us>1) {
cam->ipo->id.us--;
cam->ipo= copy_ipo(cam->ipo);
+ ipo_idnew(cam->ipo); /* drivers */
}
break;
}
@@ -4205,6 +4210,7 @@ void single_mat_users(int flag)
if(ma->ipo) {
man->ipo= copy_ipo(ma->ipo);
ma->ipo->id.us--;
+ ipo_idnew(ma->ipo); /* drivers */
}
for(b=0; b<MAX_MTEX; b++) {