From 9c6fe810a3cae2a5498f5760822b7a7e4a82bf4f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 9 Nov 2015 20:59:42 +0100 Subject: Fake user: add BKE_library helpers to set/clear that flag. Since it also involves usercount manipulation, safer and cleaner to do it in BKE_library... --- source/blender/editors/interface/interface_templates.c | 2 +- source/blender/editors/space_action/action_data.c | 5 +---- source/blender/editors/space_outliner/outliner_tools.c | 10 ++-------- 3 files changed, 4 insertions(+), 13 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 1238b883e9a..c606dd67f29 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -275,7 +275,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) if (id && CTX_wm_window(C)->eventstate->shift) { /* only way to force-remove data (on save) */ - id->flag &= ~LIB_FAKEUSER; + id_fake_user_clear(id); id->us = 0; } diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index 8ce126b439e..a3be7791f9a 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -581,10 +581,7 @@ void ED_animedit_unlink_action(bContext *C, ID *id, AnimData *adt, bAction *act, } /* Clear Fake User */ - if (act->id.flag & LIB_FAKEUSER) { - act->id.flag &= ~LIB_FAKEUSER; - id_us_min(&act->id); - } + id_fake_user_clear(&act->id); } /* If in Tweak Mode, don't unlink. Instead, this diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index c0464c84061..313a75f373a 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -421,10 +421,7 @@ static void id_fake_user_set_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeE { ID *id = tselem->id; - if ((id) && ((id->flag & LIB_FAKEUSER) == 0)) { - id->flag |= LIB_FAKEUSER; - id_us_plus(id); - } + id_fake_user_set(id); } static void id_fake_user_clear_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), @@ -432,10 +429,7 @@ static void id_fake_user_clear_cb(bContext *UNUSED(C), Scene *UNUSED(scene), Tre { ID *id = tselem->id; - if ((id) && (id->flag & LIB_FAKEUSER)) { - id->flag &= ~LIB_FAKEUSER; - id_us_min(id); - } + id_fake_user_clear(id); } static void id_select_linked_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), -- cgit v1.2.3