[Bf-blender-cvs] [e9875fc82cf] blender2.8: Fix local view undo (T58051)

Dalai Felinto noreply at git.blender.org
Tue Nov 27 20:00:25 CET 2018


Commit: e9875fc82cfeb37e9ee382ce74be88ba2c1fd500
Author: Dalai Felinto
Date:   Tue Nov 27 16:42:56 2018 -0200
Branches: blender2.8
https://developer.blender.org/rBe9875fc82cfeb37e9ee382ce74be88ba2c1fd500

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.

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

M	source/blender/blenloader/intern/readfile.c

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

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



More information about the Bf-blender-cvs mailing list