From a8b49cc6adef231ebf6f4eba0debc5f6ad9df56b Mon Sep 17 00:00:00 2001 From: artum Date: Fri, 16 Sep 2022 20:23:22 +0200 Subject: [PATCH] Fix flashback sequence after update (#523) * Fix flashback sequence, some childs aren't available where we previously reparented them * Update project version, force Legacy VR installation * Bump version for release --- NomaiVR/EffectFixes/LoopTransitionFix.cs | 17 ++++++++++++++++- NomaiVR/manifest.json | 2 +- .../Editor/SteamVR_AutoEnableVR_2019plus.cs | 15 +-------------- Unity/ProjectSettings/ProjectVersion.txt | 4 ++-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/NomaiVR/EffectFixes/LoopTransitionFix.cs b/NomaiVR/EffectFixes/LoopTransitionFix.cs index 955a08d..ad496cd 100644 --- a/NomaiVR/EffectFixes/LoopTransitionFix.cs +++ b/NomaiVR/EffectFixes/LoopTransitionFix.cs @@ -1,4 +1,5 @@ using NomaiVR.Helpers; +using System.Collections.Generic; using UnityEngine; namespace NomaiVR.EffectFixes @@ -11,6 +12,7 @@ namespace NomaiVR.EffectFixes public class Patch : NomaiVRPatch { private static Transform focus; + private static List toReparent; public override void ApplyPatches() { @@ -26,10 +28,14 @@ namespace NomaiVR.EffectFixes Postfix(nameof(Flashback.Start), nameof(PostFlashbackRecorderAwake)); } - private static void PostFlashbackRecorderAwake(Transform ____screenTransform, ref Vector3 ____origScreenScale) + private static void PostFlashbackRecorderAwake(Flashback __instance, Transform ____screenTransform, ref Vector3 ____origScreenScale) { var scale = ____screenTransform.localScale; ____origScreenScale = ____screenTransform.localScale = new Vector3(scale.x * 0.75f, scale.y * 1.5f, scale.z); + + toReparent = new List(__instance.transform.childCount); + foreach (Transform child in __instance.transform) + toReparent.Add(child); } private static void PostUpdateMemoryLink() @@ -70,6 +76,8 @@ namespace NomaiVR.EffectFixes screen.SetParent(focus, false); screen.localRotation = Quaternion.identity; screen.localScale = scale; + + toReparent = null; } private static void PatchTriggerFlashback(Flashback __instance, Transform ____maskTransform, Transform ____screenTransform) @@ -82,6 +90,12 @@ namespace NomaiVR.EffectFixes parent = new GameObject("VrFlashbackWrapper").transform; parent.position = __instance.transform.position; parent.rotation = __instance.transform.rotation; + + foreach (Transform child in toReparent) + { + child.parent = parent; + } + foreach (Transform child in __instance.transform) { child.parent = parent; @@ -97,6 +111,7 @@ namespace NomaiVR.EffectFixes parent.rotation = __instance.transform.rotation; ____maskTransform.parent = parent; + toReparent = null; } private static void FlashbackUpdate(Flashback __instance, Transform ____maskTransform) diff --git a/NomaiVR/manifest.json b/NomaiVR/manifest.json index f2bd20f..f5a515c 100644 --- a/NomaiVR/manifest.json +++ b/NomaiVR/manifest.json @@ -8,7 +8,7 @@ "title": "Before playing NomaiVR, some information:", "body": "- Click the NomaiVR readme button in the Mod Manager for information about troubleshooting, requirements, performance, how to uninstall, etc.\n\n- Some VR controllers will have missing icons. Message us if you want to help us add icons for these devices.\n\n- If you have the game on Steam:\n--- Right-click Outer Wilds on your Steam library\n--- Select 'Properties...'\n--- Disable 'Use Desktop Game Theatre.'" }, - "version": "2.8.0", + "version": "2.8.2", "owmlVersion": "2.3.0", "requireVR": true } diff --git a/Unity/Assets/SteamVR/Editor/SteamVR_AutoEnableVR_2019plus.cs b/Unity/Assets/SteamVR/Editor/SteamVR_AutoEnableVR_2019plus.cs index bc5ed4b..c85c39c 100644 --- a/Unity/Assets/SteamVR/Editor/SteamVR_AutoEnableVR_2019plus.cs +++ b/Unity/Assets/SteamVR/Editor/SteamVR_AutoEnableVR_2019plus.cs @@ -95,20 +95,7 @@ namespace Valve.VR private static void ShowDialog() { - int shouldInstall = UnityEditor.EditorUtility.DisplayDialogComplex("SteamVR", "The SteamVR Unity Plugin can be used with the legacy Unity VR API (Unity 5.4 - 2019) or with the Unity XR API (2019+). Would you like to install in legacy VR mode or for Unity XR?", "Legacy VR", "Cancel", "Unity XR"); - - switch (shouldInstall) - { - case 0: //legacy vr - SteamVR_AutoEnableVR_UnityPackage.InstallAndEnableUnityVR(); - break; - case 1: //cancel - break; - case 2: //unity xr - SteamVR_AutoEnableVR_UnityXR.InstallAndEnableUnityXR(); - break; - } - + SteamVR_AutoEnableVR_UnityPackage.InstallAndEnableUnityVR(); End(); } diff --git a/Unity/ProjectSettings/ProjectVersion.txt b/Unity/ProjectSettings/ProjectVersion.txt index b6a81cb..3fe8773 100644 --- a/Unity/ProjectSettings/ProjectVersion.txt +++ b/Unity/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2019.4.27f1 -m_EditorVersionWithRevision: 2019.4.27f1 (23dc10685eb4) +m_EditorVersion: 2019.4.39f1 +m_EditorVersionWithRevision: 2019.4.39f1 (78d14dfa024b)