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:
authorTon Roosendaal <ton@blender.org>2010-12-19 16:50:31 +0300
committerTon Roosendaal <ton@blender.org>2010-12-19 16:50:31 +0300
commit686420b15d2f4feda760bd19c93394df71ddfb1d (patch)
tree2abbdada12bfc039a4fcf7106a61752d69bd9592
parentf043caf1c1360fc511eba1a88c576759fd14dea9 (diff)
Option "Make Single user" now also makes animations local.
Note that the menu option "Animation" only was working for Object level animations, so I've changed the many name accordingly.
-rw-r--r--source/blender/blenkernel/intern/material.c3
-rw-r--r--source/blender/editors/object/object_relations.c92
2 files changed, 15 insertions, 80 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 420aca12a20..30df1887077 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -203,9 +203,6 @@ Material *copy_material(Material *ma)
man= copy_libblock(ma);
-#if 0 // XXX old animation system
- id_us_plus((ID *)man->ipo);
-#endif // XXX old animation system
id_lib_extern((ID *)man->group);
for(a=0; a<MAX_MTEX; a++) {
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 2b45299aefa..47eafd2b6bb 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1444,17 +1444,17 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag)
if(ob->id.lib==NULL && (base->flag & flag)==flag ) {
id= ob->data;
- if(id && id->us>1 && id->lib==0) {
+ if(id && id->us>1 && id->lib==NULL) {
ob->recalc= OB_RECALC_DATA;
+ BKE_copy_animdata_id_action(id);
+
switch(ob->type) {
case OB_LAMP:
- 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]) {
- ID_NEW(la->mtex[a]->object);
- }
+ ob->data= la= copy_lamp(ob->data);
+ for(a=0; a<MAX_MTEX; a++) {
+ if(la->mtex[a]) {
+ ID_NEW(la->mtex[a]->object);
}
}
break;
@@ -1495,52 +1495,6 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag)
}
-#if 0 // XXX old animation system
- id= (ID *)ob->action;
- if (id && id->us>1 && id->lib==NULL){
- if(id->newid){
- ob->action= (bAction *)id->newid;
- id_us_plus(id->newid);
- }
- else {
- ob->action= copy_action(ob->action);
- id->us--;
- id->newid=(ID *)ob->action;
- }
- }
- id= (ID *)ob->ipo;
- if(id && id->us>1 && id->lib==NULL) {
- if(id->newid) {
- ob->ipo= (Ipo *)id->newid;
- id_us_plus(id->newid);
- }
- else {
- ob->ipo= copy_ipo(ob->ipo);
- id->us--;
- id->newid= (ID *)ob->ipo;
- }
- ipo_idnew(ob->ipo); /* drivers */
- }
- /* other ipos */
- switch(ob->type) {
- case OB_LAMP:
- la= ob->data;
- 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:
- cam= ob->data;
- if(cam->ipo && cam->ipo->id.us>1) {
- cam->ipo->id.us--;
- cam->ipo= copy_ipo(cam->ipo);
- ipo_idnew(cam->ipo); /* drivers */
- }
- break;
- }
-#endif // XXX old animation system
}
}
@@ -1551,29 +1505,18 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag)
}
}
-void single_ipo_users(Scene *UNUSED(scene), int UNUSED(flag))
+static void single_object_action_users(Scene *scene, int flag)
{
-#if 0 // XXX old animation system
Object *ob;
Base *base;
- ID *id;
for(base= FIRSTBASE; base; base= base->next) {
ob= base->object;
if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
ob->recalc= OB_RECALC_DATA;
-
- id= (ID *)ob->ipo;
- if(id && id->us>1 && id->lib==NULL) {
- ob->ipo= copy_ipo(ob->ipo);
- id->us--;
- ipo_idnew(ob->ipo); /* drivers */
- }
+ BKE_copy_animdata_id_action(&ob->id);
}
}
-#endif // XXX old animation system
- // TODO, something like this but must check users first.
- // BKE_copy_animdata_id_action((ID *)obn->data);
}
static void single_mat_users(Scene *scene, int flag, int do_textures)
@@ -1595,17 +1538,11 @@ static void single_mat_users(Scene *scene, int flag, int do_textures)
if(ma->id.us>1) {
man= copy_material(ma);
-
+ BKE_copy_animdata_id_action(&man->id);
+
man->id.us= 0;
assign_material(ob, man, a);
-
-#if 0 // XXX old animation system
- if(ma->ipo) {
- man->ipo= copy_ipo(ma->ipo);
- ma->ipo->id.us--;
- ipo_idnew(ma->ipo); /* drivers */
- }
-#endif // XXX old animation system
+
if(do_textures) {
for(b=0; b<MAX_MTEX; b++) {
if(ma->mtex[b] && ma->mtex[b]->tex) {
@@ -1638,6 +1575,7 @@ void do_single_tex_user(Tex **from)
}
else if(tex->id.us>1) {
texn= copy_texture(tex);
+ BKE_copy_animdata_id_action(&texn->id);
tex->id.newid= (ID *)texn;
tex->id.us--;
*from= texn;
@@ -1878,7 +1816,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
single_mat_users(scene, flag, TRUE);
if(RNA_boolean_get(op->ptr, "animation"))
- single_ipo_users(scene, flag);
+ single_object_action_users(scene, flag);
clear_id_newpoins();
@@ -1913,7 +1851,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data");
RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each datablock");
RNA_def_boolean(ot->srna, "texture", 0, "Textures", "Make textures local to each material");
- RNA_def_boolean(ot->srna, "animation", 0, "Animation Data", "Make animation data local to each object");
+ RNA_def_boolean(ot->srna, "animation", 0, "Object Animation", "Make animation data local to each object");
}
static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event)