Skip to content

Commit

Permalink
Update v33
Browse files Browse the repository at this point in the history
  • Loading branch information
Morbeavus committed Nov 10, 2022
1 parent db574a8 commit a9c5fc5
Show file tree
Hide file tree
Showing 56 changed files with 4,156 additions and 2,635 deletions.
343 changes: 287 additions & 56 deletions Editor/OVRBuild.cs

Large diffs are not rendered by default.

82 changes: 0 additions & 82 deletions Editor/OVREngineConfigurationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ static void OnDelayCall()

OVRPlugin.AddCustomMetadata("build_target", EditorUserBuildSettings.activeBuildTarget.ToString());
EnforceAndroidSettings();
EnforceInputManagerBindings();
}

static void OnUpdate()
Expand Down Expand Up @@ -197,86 +196,5 @@ private static void EnforceInstallLocation()
if (PlayerSettings.Android.preferredInstallLocation != AndroidPreferredInstallLocation.Auto)
PlayerSettings.Android.preferredInstallLocation = AndroidPreferredInstallLocation.Auto;
}

private static void EnforceInputManagerBindings()
{
try
{
BindAxis(new Axis() { name = "Oculus_CrossPlatform_Button2", positiveButton = "joystick button 0", gravity = 1000f, sensitivity = 1000f, type = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_Button4", positiveButton = "joystick button 2", gravity = 1000f, sensitivity = 1000f, type = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_PrimaryThumbstick", positiveButton = "joystick button 8", gravity = 0f, dead = 0f, sensitivity = 0.1f, type = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_SecondaryThumbstick", positiveButton = "joystick button 9", gravity = 0f, dead = 0f, sensitivity = 0.1f, type = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_PrimaryIndexTrigger", dead = 0.19f, type = 2, axis = 8, joyNum = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_SecondaryIndexTrigger", dead = 0.19f, type = 2, axis = 9, joyNum = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_PrimaryHandTrigger", dead = 0.19f, type = 2, axis = 10, joyNum = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_SecondaryHandTrigger", dead = 0.19f, type = 2, axis = 11, joyNum = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_PrimaryThumbstickHorizontal", dead = 0.19f, type = 2, axis = 0, joyNum = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_PrimaryThumbstickVertical", dead = 0.19f, type = 2, axis = 1, joyNum = 0, invert = true });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_SecondaryThumbstickHorizontal", dead = 0.19f, type = 2, axis = 3, joyNum = 0 });
BindAxis(new Axis() { name = "Oculus_CrossPlatform_SecondaryThumbstickVertical", dead = 0.19f, type = 2, axis = 4, joyNum = 0, invert = true });
}
catch
{
Debug.LogError("Failed to apply Oculus input manager bindings.");
}
}

private class Axis
{
public string name = String.Empty;
public string descriptiveName = String.Empty;
public string descriptiveNegativeName = String.Empty;
public string negativeButton = String.Empty;
public string positiveButton = String.Empty;
public string altNegativeButton = String.Empty;
public string altPositiveButton = String.Empty;
public float gravity = 0.0f;
public float dead = 0.001f;
public float sensitivity = 1.0f;
public bool snap = false;
public bool invert = false;
public int type = 2;
public int axis = 0;
public int joyNum = 0;
}

private static void BindAxis(Axis axis)
{
SerializedObject serializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]);
SerializedProperty axesProperty = serializedObject.FindProperty("m_Axes");

SerializedProperty axisIter = axesProperty.Copy();
axisIter.Next(true);
axisIter.Next(true);
while (axisIter.Next(false))
{
if (axisIter.FindPropertyRelative("m_Name").stringValue == axis.name)
{
// Axis already exists. Don't create binding.
return;
}
}

axesProperty.arraySize++;
serializedObject.ApplyModifiedProperties();

SerializedProperty axisProperty = axesProperty.GetArrayElementAtIndex(axesProperty.arraySize - 1);
axisProperty.FindPropertyRelative("m_Name").stringValue = axis.name;
axisProperty.FindPropertyRelative("descriptiveName").stringValue = axis.descriptiveName;
axisProperty.FindPropertyRelative("descriptiveNegativeName").stringValue = axis.descriptiveNegativeName;
axisProperty.FindPropertyRelative("negativeButton").stringValue = axis.negativeButton;
axisProperty.FindPropertyRelative("positiveButton").stringValue = axis.positiveButton;
axisProperty.FindPropertyRelative("altNegativeButton").stringValue = axis.altNegativeButton;
axisProperty.FindPropertyRelative("altPositiveButton").stringValue = axis.altPositiveButton;
axisProperty.FindPropertyRelative("gravity").floatValue = axis.gravity;
axisProperty.FindPropertyRelative("dead").floatValue = axis.dead;
axisProperty.FindPropertyRelative("sensitivity").floatValue = axis.sensitivity;
axisProperty.FindPropertyRelative("snap").boolValue = axis.snap;
axisProperty.FindPropertyRelative("invert").boolValue = axis.invert;
axisProperty.FindPropertyRelative("type").intValue = axis.type;
axisProperty.FindPropertyRelative("axis").intValue = axis.axis;
axisProperty.FindPropertyRelative("joyNum").intValue = axis.joyNum;
serializedObject.ApplyModifiedProperties();
}
}

4 changes: 2 additions & 2 deletions Editor/OVRGradleGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class OVRGradleGeneration
static private System.Guid buildGuid;

#if UNITY_ANDROID
private const string prefName = "OVRAutoIncrementVersionCode_Enabled";
public const string prefName = "OVRAutoIncrementVersionCode_Enabled";
private const string menuItemAutoIncVersion = "Oculus/Tools/Auto Increment Version Code";
static bool autoIncrementVersion = false;
#endif
Expand All @@ -76,7 +76,7 @@ static void OnDelayCall()

#if UNITY_ANDROID
[MenuItem(menuItemAutoIncVersion)]
static void ToggleUtilities()
public static void ToggleUtilities()
{
autoIncrementVersion = !autoIncrementVersion;
Menu.SetChecked(menuItemAutoIncVersion, autoIncrementVersion);
Expand Down
4 changes: 3 additions & 1 deletion Editor/OVRLint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ public enum eRecordType
private static List<FixRecord> mRecordsRuntimeAndroid = new List<FixRecord>();

bool mShowRecordsStaticCommon = false;
bool mShowRecordsStaticAndroid = false;
bool mShowRecordsRuntimeCommon = false;
#if UNITY_ANDROID
bool mShowRecordsStaticAndroid = false;
bool mShowRecordsRuntimeAndroid = false;
#endif

private static List<FixRecord> mRuntimeEditModeRequiredRecords = new List<FixRecord>();

Expand Down
53 changes: 52 additions & 1 deletion Editor/OVRSystemProfilerPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ limitations under the License.
using UnityEngine;
using UnityEditor;
using System.Text;
using System.IO;

public class OVRSystemProfilerPanel : EditorWindow {
[MenuItem("Oculus/Tools/Oculus Profiler Panel")]
[MenuItem("Oculus/Tools/(Deprecated) Oculus Profiler Panel", false, 200000)]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(OVRSystemProfilerPanel), false, "Oculus Profiler");
Expand All @@ -54,10 +55,60 @@ public static void ShowWindow()

string androidSdkRootPath;
OVRADBTool adbTool;

private static GUIStyle odhCalloutBackgroundStyle;
private static GUIStyle odhCalloutTextStyle;

// The actual window code goes here
void OnGUI()
{
if (odhCalloutBackgroundStyle == null)
{
odhCalloutBackgroundStyle = new GUIStyle(EditorStyles.helpBox);
var odhCalloutBackgroundStyleTex = new Texture2D(1, 1);
odhCalloutBackgroundStyleTex.SetPixel(0, 0, new Color(0.9f, 0.8f, 0.2f, 0.2f));
odhCalloutBackgroundStyleTex.Apply();
odhCalloutBackgroundStyle.normal.background = odhCalloutBackgroundStyleTex;
}

if (odhCalloutTextStyle == null)
{
odhCalloutTextStyle = new GUIStyle(EditorStyles.label);
odhCalloutTextStyle.richText = true;
odhCalloutTextStyle.wordWrap = true;
}

// ODH Callout Section
GUILayout.BeginHorizontal(odhCalloutBackgroundStyle);
var script = MonoScript.FromScriptableObject(this);
string assetPath = AssetDatabase.GetAssetPath(script);
string editorPath = Path.GetDirectoryName(assetPath);
string odhIconPath = Path.Combine(editorPath, "Textures\\odh_icon.png");
Texture ODHIcon = (Texture)EditorGUIUtility.Load(odhIconPath);
GUILayout.Box(ODHIcon, GUILayout.Width(60.0f), GUILayout.Height(60.0f));

GUILayout.BeginVertical();

EditorGUILayout.LabelField("<b>This tool is deprecated.</b> Oculus recommends profiling builds through the Metrics section of "
+ "<b>Oculus Developer Hub</b>, a desktop companion tool that streamlines the Quest development workflow.",
odhCalloutTextStyle);
GUIContent ODHLabel = new GUIContent("Download Oculus Developer Hub");
#if UNITY_2021_1_OR_NEWER
if (EditorGUILayout.LinkButton(ODHLabel))
#else
if (GUILayout.Button(ODHLabel, GUILayout.ExpandWidth(false)))
#endif
{
#if UNITY_EDITOR_WIN
Application.OpenURL("https://developer.oculus.com/downloads/package/oculus-developer-hub-win/?source=unity");
#elif UNITY_EDITOR_OSX
Application.OpenURL("https://developer.oculus.com/downloads/package/oculus-developer-hub-mac/?source=unity");
#endif
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(15.0f);

showAndroidOptions = EditorGUILayout.Foldout(showAndroidOptions, "Android Tools");

if (showAndroidOptions)
Expand Down
28 changes: 28 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,31 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------

Notices for file(s):
Scripts/OVRGLTFLoader.cs
Scripts/OVRGLTFAccessor.cs

The MIT License (MIT)

Copyright (c) 2017 AltspaceVR

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Binary file removed Plugins/1.64.0/Android/OVRPlugin.aar.disabled
Binary file not shown.
Binary file removed Plugins/1.64.0/AndroidOpenXR/OVRPlugin.aar.disabled
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion Plugins/1.64.0.meta → Plugins/1.65.0.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Plugins/1.65.0/Android/OVRPlugin.aar.disabled
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Plugins/1.64.0/Win.meta → Plugins/1.65.0/Win.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Plugins/1.64.0/Win64.meta → Plugins/1.65.0/Win64.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions Scripts/Composition/OVRComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public abstract class OVRComposition {
public OVRCameraRig cameraRig = null;

protected OVRComposition(GameObject parentObject, Camera mainCamera, OVRMixedRealityCaptureConfiguration configuration) {

RefreshCameraRig(parentObject, mainCamera);
RefreshCameraRig(parentObject, mainCamera);
}

public abstract OVRManager.CompositionMethod CompositionMethod();
Expand All @@ -39,19 +38,19 @@ public virtual void RecenterPose() { }
protected bool usingLastAttachedNodePose = false;
protected OVRPose lastAttachedNodePose = new OVRPose(); // Sometimes the attach node pose is not readable (lose tracking, low battery, etc.) Use the last pose instead when it happens

public void RefreshCameraRig(GameObject parentObject, Camera mainCamera)
{
OVRCameraRig cameraRig = mainCamera.GetComponentInParent<OVRCameraRig>();
if (cameraRig == null)
{
cameraRig = parentObject.GetComponent<OVRCameraRig>();
}
cameraInTrackingSpace = (cameraRig != null && cameraRig.trackingSpace != null);
this.cameraRig = cameraRig;
Debug.Log(cameraRig == null ? "[OVRComposition] CameraRig not found" : "[OVRComposition] CameraRig found");
}

public OVRPose ComputeCameraWorldSpacePose(OVRPlugin.CameraExtrinsics extrinsics)
public void RefreshCameraRig(GameObject parentObject, Camera mainCamera)
{
OVRCameraRig cameraRig = mainCamera.GetComponentInParent<OVRCameraRig>();
if (cameraRig == null)
{
cameraRig = parentObject.GetComponent<OVRCameraRig>();
}
cameraInTrackingSpace = (cameraRig != null && cameraRig.trackingSpace != null);
this.cameraRig = cameraRig;
Debug.Log(cameraRig == null ? "[OVRComposition] CameraRig not found" : "[OVRComposition] CameraRig found");
}

public OVRPose ComputeCameraWorldSpacePose(OVRPlugin.CameraExtrinsics extrinsics)
{
OVRPose trackingSpacePose = ComputeCameraTrackingSpacePose(extrinsics);
OVRPose worldSpacePose = OVRExtensions.ToWorldSpacePose(trackingSpacePose);
Expand Down
12 changes: 6 additions & 6 deletions Scripts/Composition/OVRCompositionUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public static void SafeDestroy(GameObject obj)

public static void SafeDestroy(ref GameObject obj)
{
if (obj != null)
{
SafeDestroy(obj);
obj = null;
}
}
if (obj != null)
{
SafeDestroy(obj);
obj = null;
}
}

public static OVRPlugin.CameraDevice ConvertCameraDevice(OVRManager.CameraDevice cameraDevice)
{
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Composition/OVRDirectComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ private void RefreshCameraObjects(GameObject parentObject, Camera mainCamera, OV
#if USING_MRC_COMPATIBLE_URP_VERSION
var directCamData = directCompositionCamera.GetUniversalAdditionalCameraData();
if (directCamData != null)
{
{
directCamData.allowXRRendering = false;
}
}
#elif USING_URP
Debug.LogError("Using URP with MRC is only supported with URP version 10.0.0 or higher. Consider using Unity 2020 or higher.");
#else
Expand Down
Loading

0 comments on commit a9c5fc5

Please sign in to comment.