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:
authorJulian Eisel <julian@blender.org>2020-08-14 17:57:57 +0300
committerJeroen Bakker <jeroen@blender.org>2020-08-26 11:55:17 +0300
commit3a5ef928961b1324f3524199fd6fca9cb8c98549 (patch)
tree52cdc7300b7cdb65b4253c00093c307a080436a6
parentfe492d922d6d2f13bd04369c8a349c87e0b59233 (diff)
Fix constant lighting change in VR view when rotating head
We have to explicitly enable fixed world space lighting. This was in fact already done, but overridden by the code to sync the 3D View shading settings to the VR view.
-rw-r--r--source/blender/blenloader/intern/versioning_280.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 6c2098f06cf..7e6939f2114 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4935,8 +4935,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
const View3D *v3d_default = DNA_struct_default_get(View3D);
wm->xr.session_settings.shading = v3d_default->shading;
- /* Don't rotate light with the viewer by default, make it fixed. */
- wm->xr.session_settings.shading.flag |= V3D_SHADING_WORLD_ORIENTATION;
wm->xr.session_settings.draw_flags = (V3D_OFSDRAW_SHOW_GRIDFLOOR |
V3D_OFSDRAW_SHOW_ANNOTATION);
wm->xr.session_settings.clip_start = v3d_default->clip_start;
@@ -5087,6 +5085,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
* \note Keep this message at the bottom of the function.
*/
{
+ for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
+ /* Don't rotate light with the viewer by default, make it fixed. Shading settings can't be
+ * edited and this flag should always be set. So we can always execute this. */
+ wm->xr.session_settings.shading.flag |= V3D_SHADING_WORLD_ORIENTATION;
+ }
+
/* Keep this block, even when empty. */
}
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index b90f7aa870e..b49d388019e 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1728,6 +1728,8 @@ void ED_view3d_xr_shading_update(wmWindowManager *wm, const View3D *v3d, const S
{
if (v3d->runtime.flag & V3D_RUNTIME_XR_SESSION_ROOT) {
View3DShading *xr_shading = &wm->xr.session_settings.shading;
+ /* Flags that shouldn't be overridden by the 3D View shading. */
+ const int flag_copy = V3D_SHADING_WORLD_ORIENTATION;
BLI_assert(WM_xr_session_exists(&wm->xr));
@@ -1745,7 +1747,9 @@ void ED_view3d_xr_shading_update(wmWindowManager *wm, const View3D *v3d, const S
}
/* Copy shading from View3D to VR view. */
+ const int old_xr_shading_flag = xr_shading->flag;
*xr_shading = v3d->shading;
+ xr_shading->flag = (xr_shading->flag & ~flag_copy) | (old_xr_shading_flag & flag_copy);
if (v3d->shading.prop) {
xr_shading->prop = IDP_CopyProperty(xr_shading->prop);
}