Skip to content

Commit

Permalink
Allow opening the PDA in external views as well
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyOThan committed Sep 29, 2022
1 parent 10fff62 commit 81cd502
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions KerbalVR_Mod/KerbalVR/KerbalVR_UISystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void OnPartActionUIDismiss(Part data)

private void OnPartActionUIShown(UIPartActionWindow window, Part part)
{
if (Core.IsVrRunning && Scene.IsFirstPersonEVA())
if (Core.IsVrRunning)
{
window.gameObject.SetLayerRecursive(0);
window.rectTransform.anchoredPosition3D = Vector3.zero;
Expand Down Expand Up @@ -143,7 +143,7 @@ public void ActivatePDACanvas(Hand hand)
IEnumerator ConfigureHandheldCanvases(Canvas[] canvases, bool running)
{
yield return null; // wait a frame so that ThroughTheEyes knows whether we are in first person or not
bool pdaMode = running && Scene.IsFirstPersonEVA();
bool pdaMode = running;

foreach (var canvas in canvases)
{
Expand Down Expand Up @@ -176,14 +176,12 @@ IEnumerator ConfigureHandheldCanvases(Canvas[] canvases, bool running)
private IEnumerator ConfigureHeadsUpCanvas(Canvas canvas, bool running)
{
yield return null; // wait a frame so that ThroughTheEyes knows whether we are in first person or not
bool hudMode = running && Scene.IsFirstPersonEVA();
bool hudMode = running;

if (canvas == null) yield break;

if (hudMode)
{
var eva = Scene.GetKerbalEVA();

// TODO: this doesn't actually attach it to the skeleton, so it doesn't move with the helmet. I tried attaching to the bone, but that didn't work:
// eva.helmetTransform
// For now, just use the flightcamera transform so that the canvas doesn't get deleted along with the kerbal when boarding
Expand Down Expand Up @@ -643,8 +641,8 @@ public override bool ShouldActivateModule()
{
if (!Core.IsVrRunning) return false;

// temporary - we might eventually want to use fingertips for UI interactions in other scenes
if (HighLogic.LoadedSceneIsFlight)
// temporary - we might eventually want to use fingertips for UI interactions in other scenes or even in IVA (maybe AppCanvas?)
if (HighLogic.LoadedSceneIsFlight && !Scene.IsInIVA())
{
var left = InteractionSystem.Instance.LeftHand.UIHand;
var right = InteractionSystem.Instance.RightHand.UIHand;
Expand Down

0 comments on commit 81cd502

Please sign in to comment.