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.
This commit is contained in:
Dalai Felinto
2018-11-27 16:42:56 -02:00
parent 9c546c70d7
commit e9875fc82c

View File

@@ -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);
}