diff options
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index d60ef28efda..56c22df3b02 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -142,8 +142,16 @@ static void brush_free_data(ID *id) static void brush_make_local(Main *bmain, ID *id, const int flags) { + if (!ID_IS_LINKED(id)) { + return; + } + Brush *brush = (Brush *)id; const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; + const bool force_local = (flags & LIB_ID_MAKELOCAL_FORCE_LOCAL) != 0; + const bool force_copy = (flags & LIB_ID_MAKELOCAL_FORCE_COPY) != 0; + BLI_assert(force_copy == false || force_copy != force_local); + bool is_local = false, is_lib = false; /* - only lib users: do nothing (unless force_local is set) @@ -151,19 +159,17 @@ static void brush_make_local(Main *bmain, ID *id, const int flags) * - mixed: make copy */ - if (!ID_IS_LINKED(brush)) { - return; - } - if (brush->clone.image) { /* Special case: ima always local immediately. Clone image should only have one user anyway. */ BKE_lib_id_make_local(bmain, &brush->clone.image->id, false, 0); } - BKE_library_ID_test_usages(bmain, brush, &is_local, &is_lib); + if (!force_local && !force_copy) { + BKE_library_ID_test_usages(bmain, brush, &is_local, &is_lib); + } - if (lib_local || is_local) { - if (!is_lib) { + if (lib_local || is_local || force_copy || force_local) { + if (!is_lib || force_local) { BKE_lib_id_clear_library_data(bmain, &brush->id); BKE_lib_id_expand_local(bmain, &brush->id); |