Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-11-27 21:42:56 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-11-27 21:50:07 +0300
commite9875fc82cfeb37e9ee382ce74be88ba2c1fd500 (patch)
treed54d1a5475a667165a06ac6b89e5e0c0cc50a4e7 /source/blender/blenloader
parent9c546c70d703b33fa6c5a2cfb70809bef7ba0723 (diff)
Fix local view undo (T58051)
Like in 2.7x we don't restore the previous view zoom. This goes along the fact that we don't store viewport navigation transformations either.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index b5e2f0146dd..53476adf2ce 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7392,7 +7392,7 @@ static void lib_link_clipboard_restore(struct IDNameLib_Map *id_map)
BKE_sequencer_base_recursive_apply(&seqbase_clipboard, lib_link_seq_clipboard_cb, id_map);
}
-static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene)
+static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene, ViewLayer *view_layer)
{
bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
@@ -7406,12 +7406,12 @@ static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene)
}
if (v3d->localvd) {
- Base *base;
+ Base *base = NULL;
v3d->localvd->camera = scene->camera;
/* Localview can become invalid during undo/redo steps, so we exit it when no could be found. */
- for (base = screen->scene->base.first; base; base = base->next) {
+ for (base = view_layer->object_bases.first; base; base = base->next) {
if (base->local_view_bits & v3d->local_view_uuid) {
break;
}
@@ -7420,6 +7420,16 @@ static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene)
MEM_freeN(v3d->localvd);
v3d->localvd = NULL;
v3d->local_view_uuid = 0;
+
+ for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = ar->regiondata;
+ if (rv3d->localvd) {
+ MEM_freeN(rv3d->localvd);
+ rv3d->localvd = NULL;
+ }
+ }
+ }
}
}
}
@@ -7673,7 +7683,7 @@ void blo_lib_link_restore(Main *newmain, wmWindowManager *curwm, Scene *curscene
/* keep cursor location through undo */
copy_v3_v3(win->scene->cursor.location, oldscene->cursor.location);
copy_qt_qt(win->scene->cursor.rotation, oldscene->cursor.rotation);
- lib_link_window_scene_data_restore(win, win->scene);
+ lib_link_window_scene_data_restore(win, win->scene, cur_view_layer);
BLI_assert(win->screen == NULL);
}