diff options
author | Bastien Montagne <bastien@blender.org> | 2020-04-22 12:37:36 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-04-22 12:37:36 +0300 |
commit | 21f811cb6d3a4fbf8767b3fb0a2c272437c371ed (patch) | |
tree | c55443d6bd8747a35739cce92423fad05ac97e61 | |
parent | 8845b27dce8908de398cd7b0e0d08fb4be90e005 (diff) | |
parent | 1998154ff4035d57cfc16ffa89ce550b2d998def (diff) |
Merge branch 'blender-v2.83-release'
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 7 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 6 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 2 |
4 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index f6e80d66ad1..0eaf7cf2f41 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -210,8 +210,9 @@ ViewLayer *BKE_view_layer_add(Scene *scene, case VIEWLAYER_ADD_COPY: { /* Allocate and copy view layer data */ view_layer_new = MEM_callocN(sizeof(ViewLayer), "View Layer"); - BLI_addtail(&scene->view_layers, view_layer_new); + *view_layer_new = *view_layer_source; BKE_view_layer_copy_data(scene, scene, view_layer_new, view_layer_source, 0); + BLI_addtail(&scene->view_layers, view_layer_new); BLI_strncpy_utf8(view_layer_new->name, name, sizeof(view_layer_new->name)); break; @@ -467,6 +468,10 @@ void BKE_view_layer_copy_data(Scene *scene_dst, LayerCollection *lc_scene_dst = view_layer_dst->layer_collections.first; lc_scene_dst->collection = scene_dst->master_collection; + + if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { + id_us_plus((ID *)view_layer_dst->mat_override); + } } void BKE_view_layer_rename(Main *bmain, Scene *scene, ViewLayer *view_layer, const char *newname) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6b59dfbd10b..4cbf01873e9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9712,10 +9712,10 @@ static bool read_libblock_undo_restore( const int id_tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_UNDO_OLD_ID_REUSED; read_libblock_undo_restore_identical(fd, main, id, id_old, id_tag); - /* Insert into library map for lookup by newly read datablocks (with pointer - * value bhead->old) or existing datablocks in memory (pointer value id_old). */ + /* Insert into library map for lookup by newly read datablocks (with pointer value bhead->old). + * Note that existing datablocks in memory (which pointer value would be id_old) are not + * remapped anymore, so no need to store this info here. */ oldnewmap_insert(fd->libmap, bhead->old, id_old, bhead->code); - oldnewmap_insert(fd->libmap, id_old, id_old, bhead->code); *r_id_old = id_old; return true; @@ -9786,11 +9786,11 @@ static BHead *read_libblock(FileData *fd, * direct_link_library() may remove it from there in case of duplicates. */ BLI_addtail(lb, id); - /* Insert into library map for lookup by newly read datablocks (with pointer - * value bhead->old) or existing datablocks in memory (pointer value id_old). */ + /* Insert into library map for lookup by newly read datablocks (with pointer value bhead->old). + * Note that existing datablocks in memory (which pointer value would be id_old) are not remapped + * remapped anymore, so no need to store this info here. */ ID *id_target = id_old ? id_old : id; oldnewmap_insert(fd->libmap, bhead->old, id_target, bhead->code); - oldnewmap_insert(fd->libmap, id_old, id_target, bhead->code); if (r_id) { *r_id = id_target; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index a613603fff9..204df4abd10 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2588,6 +2588,12 @@ static void write_lightcache(WriteData *wd, LightCache *cache) static void write_scene(WriteData *wd, Scene *sce, const void *id_address) { + if (wd->use_memfile) { + /* Clean up, important in undo case to reduce false detection of changed datablocks. */ + /* XXX This UI data should not be stored in Scene at all... */ + memset(&sce->cursor, 0, sizeof(sce->cursor)); + } + /* write LibData */ writestruct_at_address(wd, ID_SCE, Scene, 1, id_address, sce); write_iddata(wd, &sce->id); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index e3184ac413f..632903448fb 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1129,8 +1129,8 @@ void UI_icons_free(void) #ifndef WITH_HEADLESS free_icons_textures(); free_iconfile_list(&iconfilelist); - BKE_icons_free(); #endif + BKE_icons_free(); } void UI_icons_free_drawinfo(void *drawinfo) |