Commit: 59a0a143ddb50e2835125a69f20e597f5dab4d91
Author: Campbell Barton
Date:   Tue Jan 29 14:28:55 2019 +1100
Branches: master
https://developer.blender.org/rB59a0a143ddb50e2835125a69f20e597f5dab4d91

Library: tag memfile undo for writing after rename

Needed for T60809 fix.

===================================================================

M       source/blender/blenkernel/intern/library.c

===================================================================

diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 957004c496f..7392dc23119 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1646,8 +1646,11 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, const 
bool id_in_mainlist)
 
        id->lib = NULL;
        id->tag &= ~(LIB_TAG_INDIRECT | LIB_TAG_EXTERN);
-       if (id_in_mainlist)
-               new_id(which_libbase(bmain, GS(id->name)), id, NULL);
+       if (id_in_mainlist) {
+               if (new_id(which_libbase(bmain, GS(id->name)), id, NULL)) {
+                       bmain->is_memfile_undo_written = false;
+               }
+       }
 
        /* Internal bNodeTree blocks inside datablocks also stores id->lib, 
make sure this stays in sync. */
        if ((ntree = ntreeFromID(id))) {
@@ -2015,9 +2018,11 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const 
char *name)
 
        /* search for id */
        idtest = BLI_findstring(lb, name + 2, offsetof(ID, name) + 2);
-
-       if (idtest && !new_id(lb, idtest, idtest->name + 2)) {
-               id_sort_by_name(lb, idtest);
+       if (idtest != NULL) {
+               if (!new_id(lb, idtest, idtest->name + 2)) {
+                       id_sort_by_name(lb, idtest);
+               }
+               bmain->is_memfile_undo_written = false;
        }
 }
 
@@ -2027,7 +2032,9 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const 
char *name)
 void BKE_libblock_rename(Main *bmain, ID *id, const char *name)
 {
        ListBase *lb = which_libbase(bmain, GS(id->name));
-       new_id(lb, id, name);
+       if (new_id(lb, id, name)) {
+               bmain->is_memfile_undo_written = false;
+       }
 }
 
 /**

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to