diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-03-26 23:17:50 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-03-26 23:17:50 +0300 |
commit | 5183788fd6376db26182c88a2d8e2f7e300d5cc3 (patch) | |
tree | 7c0c4c2b85765214e102f0dcad130aed8075b499 /source/blender | |
parent | 0599a5646887fa7b2ac20b027c697356ce34c408 (diff) |
Fix for bug #8746: the fake user button for datablocks was not a toggle
button, while it should be.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_brush.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 23 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 2 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 2 | ||||
-rw-r--r-- | source/blender/src/headerbuttons.c | 15 |
5 files changed, 21 insertions, 23 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 2c0034ad234..6ef67bc4190 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -48,7 +48,7 @@ void free_brush(struct Brush *brush); int brush_set_nr(struct Brush **current_brush, int nr); int brush_delete(struct Brush **current_brush); void brush_check_exists(struct Brush **brush); -void brush_toggle_fake_user(struct Brush *brush); +void brush_toggled_fake_user(struct Brush *brush); int brush_texture_set_nr(struct Brush *brush, int nr); int brush_texture_delete(struct Brush *brush); int brush_clone_image_set_nr(struct Brush *brush, int nr); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index ca2f7b114d5..18d56f40d8e 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -73,7 +73,8 @@ Brush *add_brush(char *name) brush->clone.alpha= 0.5; /* enable fake user by default */ - brush_toggle_fake_user(brush); + brush->id.flag |= LIB_FAKEUSER; + brush_toggled_fake_user(brush); return brush; } @@ -95,8 +96,10 @@ Brush *copy_brush(Brush *brush) } /* enable fake user by default */ - if (!(brushn->id.flag & LIB_FAKEUSER)) - brush_toggle_fake_user(brushn); + if (!(brushn->id.flag & LIB_FAKEUSER)) { + brushn->id.flag |= LIB_FAKEUSER; + brush_toggled_fake_user(brushn); + } return brushn; } @@ -148,8 +151,10 @@ void make_local_brush(Brush *brush) new_id(0, (ID *)brush, 0); /* enable fake user by default */ - if (!(brush->id.flag & LIB_FAKEUSER)) - brush_toggle_fake_user(brush); + if (!(brush->id.flag & LIB_FAKEUSER)) { + brush->id.flag |= LIB_FAKEUSER; + brush_toggled_fake_user(brush); + } } else if(local && lib) { brushn= copy_brush(brush); @@ -203,16 +208,14 @@ int brush_delete(Brush **current_brush) return 0; } -void brush_toggle_fake_user(Brush *brush) +void brush_toggled_fake_user(Brush *brush) { ID *id= (ID*)brush; if(id) { if(id->flag & LIB_FAKEUSER) { - id->flag -= LIB_FAKEUSER; - id->us--; - } else { - id->flag |= LIB_FAKEUSER; id_us_plus(id); + } else { + id->us--; } } } diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 74401aaa8e4..cc6919a4a19 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -5915,7 +5915,7 @@ void do_fpaintbuts(unsigned short event) } break; case B_BRUSHKEEPDATA: - brush_toggle_fake_user(settings->imapaint.brush); + brush_toggled_fake_user(settings->imapaint.brush); allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWIMAGE, 0); break; diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 5bb9ffcba4e..09ac146dc67 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -296,7 +296,7 @@ void do_image_buttons(unsigned short event) } break; case B_KEEPDATA: - brush_toggle_fake_user(settings->imapaint.brush); + brush_toggled_fake_user(settings->imapaint.brush); allqueue(REDRAWIMAGE, 0); allqueue(REDRAWBUTSEDIT, 0); break; diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 43ca45ffb67..b5c22c9bc1b 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -384,10 +384,7 @@ int std_libbuttons(uiBlock *block, short xco, short yco, } if(keepbut) { - if(id->flag & LIB_FAKEUSER) - uiDefBut(block, BUT, keepbut, "F", xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Don't save this datablock even if it has no users"); - else - uiDefBut(block, BUT, keepbut, "F", xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Saves this datablock even if it has no users"); + uiDefButBitS(block, TOG, LIB_FAKEUSER, keepbut, "F", xco,yco,XIC,YIC, &id->flag, 0, 0, 0, 0, "Saves this datablock even if it has no users"); xco+= XIC; } } @@ -1649,13 +1646,11 @@ void do_global_buttons(unsigned short event) id= (ID *)G.saction->action; }/* similar for other spacetypes ? */ if (id) { - if( id->flag & LIB_FAKEUSER) { - id->flag -= LIB_FAKEUSER; - id->us--; - } else { - id->flag |= LIB_FAKEUSER; + /* flag was already toggled, just need to update user count */ + if(id->flag & LIB_FAKEUSER) id->us++; - } + else + id->us--; } allqueue(REDRAWHEADERS, 0); |