From 9276a6f9fabcf4a3810e0bd57e15d807b41880d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 3 Feb 2008 21:24:48 +0000 Subject: Added single user ipos option - useful when you make linked duplicates with many objects and want them a unique ipo. --- source/blender/include/BDR_editobject.h | 1 + source/blender/src/editobject.c | 29 ++++++++++++++++++++++++++++- source/blender/src/header_view3d.c | 6 +++++- 3 files changed, 34 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/include/BDR_editobject.h b/source/blender/include/BDR_editobject.h index 9e65a049bfc..df7c41a6b12 100644 --- a/source/blender/include/BDR_editobject.h +++ b/source/blender/include/BDR_editobject.h @@ -97,6 +97,7 @@ void single_object_users(int flag); void new_id_matar(struct Material **matar, int totcol); void single_obdata_users(int flag); void single_mat_users(int flag); +void single_ipo_users(int flag); void do_single_tex_user(struct Tex **from); void single_tex_users_expand(void); void single_mat_users_expand(void); diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 6945573af71..62b9b4a9978 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -4337,6 +4337,29 @@ void single_obdata_users(int flag) } } +void single_ipo_users(int flag) +{ + Object *ob; + Base *base; + Ipo *ma, *man; + ID *id; + + base= FIRSTBASE; + while(base) { + 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 */ + } + } + base= base->next; + } +} void single_mat_users(int flag) { @@ -4517,7 +4540,7 @@ void single_user(void) clear_id_newpoins(); - nr= pupmenu("Make Single User%t|Object|Object & ObData|Object & ObData & Materials+Tex|Materials+Tex"); + nr= pupmenu("Make Single User%t|Object|Object & ObData|Object & ObData & Materials+Tex|Materials+Tex|Ipos"); if(nr>0) { if(nr==1) single_object_users(1); @@ -4535,6 +4558,10 @@ void single_user(void) else if(nr==4) { single_mat_users(1); } + else if(nr==5) { + single_ipo_users(1); + } + clear_id_newpoins(); diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index c99e40c55bc..0a394d68d7a 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -2086,6 +2086,9 @@ static void do_view3d_edit_object_singleusermenu(void *arg, int event) case 4: /* Materials+Tex */ single_mat_users(1); break; + case 5: /* Ipo */ + single_ipo_users(1); + break; } clear_id_newpoins(); @@ -2106,7 +2109,8 @@ static uiBlock *view3d_edit_object_singleusermenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object|U, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object & ObData|U, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object & ObData & Materials+Tex|U, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials+Tex|U, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials+Tex|U, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Ipos|U, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); -- cgit v1.2.3