[Bf-blender-cvs] [2abb28f2c2f] undo-experiments-idnames: undoexp: Tag renamed ID undo steps as 'full barrier'.

Bastien Montagne noreply at git.blender.org
Thu Jan 9 11:26:00 CET 2020


Commit: 2abb28f2c2f8d57f6a7042aa61a3a0496eb36e65
Author: Bastien Montagne
Date:   Wed Jan 8 15:51:20 2020 +0100
Branches: undo-experiments-idnames
https://developer.blender.org/rB2abb28f2c2f8d57f6a7042aa61a3a0496eb36e65

undoexp: Tag renamed ID undo steps as 'full barrier'.

I.E. re-using data from old bmain is forbidden around an ID renaming.

This is a bit over-protective in most cases, since renaming an ID does
change its memfile data. So renamed ID should be reloaded from memfile
anyway.

But the problems might come (in some specific scenarii involving 'name
switching' between two IDs) from name-based lookup. Those could lead to
remapping some ID pointers in unchanged data-blocks to the wrong ID...

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

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

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

diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index e051dc946cb..49faeb7aa0d 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2429,6 +2429,9 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const char *name)
     BKE_id_new_name_validate(lb, idtest, NULL);
     bmain->is_memfile_undo_written = false;
   }
+
+  /* ID renaming requires an 'undo barrier'. */
+  bmain->use_memfile_full_barrier = true;
 }
 
 /**
@@ -2440,6 +2443,9 @@ void BKE_libblock_rename(Main *bmain, ID *id, const char *name)
   if (BKE_id_new_name_validate(lb, id, name)) {
     bmain->is_memfile_undo_written = false;
   }
+
+  /* ID renaming requires an 'undo barrier'. */
+  bmain->use_memfile_full_barrier = true;
 }
 
 /**



More information about the Bf-blender-cvs mailing list