version 2.5.0

This commit is contained in:
Sean Lu
2024-12-06 15:44:37 +08:00
parent dfdcd0fd7f
commit 2bfa2ad4c7
966 changed files with 238216 additions and 77239 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5e0cbfbe15682c542acc5675d4503f72
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
// Copyright HTC Corporation All Rights Reserved.
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using VIVE.OpenXR.CompositionLayer;
namespace VIVE.OpenXR.Editor.CompositionLayer
{
[CustomEditor(typeof(ViveCompositionLayerExtraSettings))]
internal class ViveCompositionLayerEditorExtraSettings : UnityEditor.Editor
{
//private SerializedProperty SettingsEditorEnableSharpening;
static string PropertyName_SharpeningEnable = "SettingsEditorEnableSharpening";
static GUIContent Label_SharpeningEnable = new GUIContent("Enable Sharpening", "Enable Sharpening.");
SerializedProperty Property_SharpeningEnable;
static string PropertyName_SharpeningLevel = "SettingsEditorSharpeningLevel";
static GUIContent Label_SharpeningLevel = new GUIContent("Sharpening Level", "Select Sharpening Level.");
SerializedProperty Property_SharpeningLevel;
static string PropertyName_SharpeningMode = "SettingsEditorSharpeningMode";
static GUIContent Label_SharpeningMode = new GUIContent("Sharpening Mode", "Select Sharpening Mode.");
SerializedProperty Property_SharpeningMode;
void OnEnable()
{
Property_SharpeningEnable = serializedObject.FindProperty(PropertyName_SharpeningEnable);
Property_SharpeningMode = serializedObject.FindProperty(PropertyName_SharpeningMode);
Property_SharpeningLevel = serializedObject.FindProperty(PropertyName_SharpeningLevel);
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(Property_SharpeningEnable, new GUIContent(Label_SharpeningEnable));
EditorGUILayout.PropertyField(Property_SharpeningMode, new GUIContent(Label_SharpeningMode));
EditorGUILayout.PropertyField(Property_SharpeningLevel, new GUIContent(Label_SharpeningLevel));
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a3dfbc6bb6d75454db700d2326157424
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 050772d662d04514ca3bb28fbe82ecd7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
// Copyright HTC Corporation All Rights Reserved.
#if UNITY_EDITOR
using UnityEditor;
using VIVE.OpenXR.FrameSynchronization;
namespace VIVE.OpenXR.Editor.FrameSynchronization
{
[CustomEditor(typeof(ViveFrameSynchronization))]
public class ViveFrameSynchronizationEditor : UnityEditor.Editor
{
SerializedProperty m_SynchronizationMode;
private void OnEnable()
{
m_SynchronizationMode = serializedObject.FindProperty("m_SynchronizationMode");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(m_SynchronizationMode);
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d25b2e9fff2d6724b865e0fbd609da9d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a8bd17374612cce468393aa1acc9fa89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,184 @@
// Copyright HTC Corporation All Rights Reserved.
using UnityEngine;
using VIVE.OpenXR.Interaction;
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine.XR.OpenXR;
using UnityEngine.XR.OpenXR.Features;
namespace VIVE.OpenXR.Editor.Interaction
{
[CustomEditor(typeof(ViveInteractions))]
public class ViveInteractionsEditor : UnityEditor.Editor
{
SerializedProperty m_ViveHandInteraction, m_ViveWristTracker, m_ViveXRTracker;
#if UNITY_ANDROID
SerializedProperty m_KHRHandInteraction;
#endif
private void OnEnable()
{
m_ViveHandInteraction = serializedObject.FindProperty("m_ViveHandInteraction");
m_ViveWristTracker = serializedObject.FindProperty("m_ViveWristTracker");
m_ViveXRTracker = serializedObject.FindProperty("m_ViveXRTracker");
#if UNITY_ANDROID
m_KHRHandInteraction = serializedObject.FindProperty("m_KHRHandInteraction");
#endif
}
public override void OnInspectorGUI()
{
serializedObject.Update();
#region GUI
GUIStyle boxStyleInfo = new GUIStyle(EditorStyles.helpBox);
boxStyleInfo.fontSize = 12;
boxStyleInfo.wordWrap = true;
GUIStyle boxStyleWarning = new GUIStyle(EditorStyles.helpBox);
boxStyleWarning.fontSize = 12;
boxStyleWarning.fontStyle = FontStyle.Bold;
boxStyleInfo.wordWrap = true;
// ViveHandInteraction
GUILayout.BeginHorizontal();
GUILayout.Space(20);
GUILayout.Label(
"The VIVE Hand Interaction feature enables hand selection and squeezing functions of XR_HTC_hand_interaction extension.\n" +
"Please note that enabling this feature impacts runtime performance.",
boxStyleInfo);
GUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_ViveHandInteraction);
// ViveWristTracker
GUILayout.Space(20);
GUILayout.BeginHorizontal();
GUILayout.Space(20);
GUILayout.Label(
"The VIVE Wrist Tracker feature enables wrist tracker pose and button functions of XR_HTC_vive_wrist_tracker_interaction extension.\n" +
"Please note that enabling this feature impacts runtime performance.",
boxStyleInfo);
GUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_ViveWristTracker);
// ViveXrTracker
GUILayout.Space(20);
GUILayout.BeginHorizontal();
GUILayout.Space(20);
GUILayout.Label(
"The VIVE XR Tracker feature enables ultimate tracker pose and button functions.\n" +
"WARNING:\n" +
"Please be aware that enabling this feature significantly affects runtime performance.",
boxStyleWarning);
GUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_ViveXRTracker);
#if UNITY_ANDROID
// ViveHandInteractionExt
GUILayout.Space(20);
GUILayout.BeginHorizontal();
GUILayout.Space(20);
GUILayout.Label(
"The KHR Hand Interaction feature enables hand functions of XR_EXT_hand_interaction extension.\n" +
"Please note that enabling this feature impacts runtime performance.",
boxStyleInfo);
GUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_KHRHandInteraction);
#endif
#endregion
ViveInteractions myScript = target as ViveInteractions;
if (myScript.enabled)
{
bool viveHandInteraction = myScript.UseViveHandInteraction();
bool viveWristTracker = myScript.UseViveWristTracker();
bool viveXrTracker = myScript.UseViveXrTracker();
bool khrHandInteraction = myScript.UseKhrHandInteraction();
OpenXRSettings settings = null;
#if UNITY_ANDROID
settings = OpenXRSettings.GetSettingsForBuildTargetGroup(BuildTargetGroup.Android);
#elif UNITY_STANDALONE
settings = OpenXRSettings.GetSettingsForBuildTargetGroup(BuildTargetGroup.Standalone);
#endif
if (settings != null)
{
bool addPathEnumeration = false;
foreach (var feature in settings.GetFeatures<OpenXRInteractionFeature>())
{
if (feature is Hand.ViveHandInteraction) { feature.enabled = viveHandInteraction; }
if (feature is Tracker.ViveWristTracker) { feature.enabled = viveWristTracker; }
if (feature is Tracker.ViveXRTracker)
{
feature.enabled = viveXrTracker;
addPathEnumeration = viveXrTracker;
}
if (feature is Hand.ViveHandInteractionExt) { feature.enabled = khrHandInteraction; }
}
foreach (var feature in settings.GetFeatures<OpenXRFeature>())
{
if (addPathEnumeration && feature is VivePathEnumeration) { feature.enabled = true; }
}
}
}
serializedObject.ApplyModifiedProperties();
}
}
/*public class ViveInteractionsBuildHook : OpenXRFeatureBuildHooks
{
public override int callbackOrder => 1;
public override Type featureType => typeof(VIVEFocus3Feature);
protected override void OnPostGenerateGradleAndroidProjectExt(string path)
{
}
protected override void OnPostprocessBuildExt(BuildReport report)
{
}
protected override void OnPreprocessBuildExt(BuildReport report)
{
var settings = OpenXRSettings.GetSettingsForBuildTargetGroup(BuildTargetGroup.Android);
if (settings != null)
{
foreach (var feature in settings.GetFeatures<OpenXRFeature>())
{
if (feature is ViveInteractions && feature.enabled)
{
bool viveHandInteraction= ((ViveInteractions)feature).UseViveHandInteraction();
bool viveWristTracker = ((ViveInteractions)feature).UseViveWristTracker();
bool viveXrTracker = ((ViveInteractions)feature).UseViveXrTracker();
bool khrHandInteraction = ((ViveInteractions)feature).UseKhrHandInteraction();
Debug.LogFormat($"ViveInteractionsBuildHook() viveHandInteraction: {viveHandInteraction}, viveWristTracker: {viveWristTracker}, viveXrTracker: {viveXrTracker}, khrHandInteraction: {khrHandInteraction}");
EnableInteraction(viveHandInteraction, viveWristTracker, viveXrTracker, khrHandInteraction);
break;
}
}
}
}
private static void EnableInteraction(
bool viveHandInteraction = false,
bool viveWristTracker = false,
bool viveXrTracker = false,
bool khrHandInteraction = false)
{
var settings = OpenXRSettings.GetSettingsForBuildTargetGroup(BuildTargetGroup.Android);
if (settings == null) { return; }
foreach (var feature in settings.GetFeatures<OpenXRInteractionFeature>())
{
if (feature is Hand.ViveHandInteraction) { feature.enabled = viveHandInteraction; Debug.LogFormat($"EnableInteraction() ViveHandInteraction: {feature.enabled}"); }
if (feature is Tracker.ViveWristTracker) { feature.enabled = viveWristTracker; Debug.LogFormat($"EnableInteraction() ViveWristTracker: {feature.enabled}"); }
if (feature is Tracker.ViveXRTracker) { feature.enabled = viveXrTracker; Debug.LogFormat($"EnableInteraction() ViveXRTracker: {feature.enabled}"); }
if (feature is Hand.ViveHandInteractionExt) { feature.enabled = khrHandInteraction; Debug.LogFormat($"EnableInteraction() ViveHandInteractionExt: {feature.enabled}"); }
}
}
}*/
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c7e32703a3206194580e534565abcf91
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,44 @@
// Copyright HTC Corporation All Rights Reserved.
#if UNITY_EDITOR
using UnityEditor;
namespace VIVE.OpenXR.Editor
{
[CustomEditor(typeof(VIVERig))]
public class VIVERigEditor : UnityEditor.Editor
{
SerializedProperty m_TrackingOrigin, m_CameraOffset, m_CameraHeight, m_ActionAsset;
private void OnEnable()
{
m_TrackingOrigin = serializedObject.FindProperty("m_TrackingOrigin");
m_CameraOffset = serializedObject.FindProperty("m_CameraOffset");
m_CameraHeight = serializedObject.FindProperty("m_CameraHeight");
m_ActionAsset = serializedObject.FindProperty("m_ActionAsset");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
VIVERig myScript = target as VIVERig;
EditorGUILayout.PropertyField(m_TrackingOrigin);
EditorGUILayout.PropertyField(m_CameraOffset);
EditorGUILayout.HelpBox(
"Set the height of camera when the Tracking Origin is Device.",
MessageType.Info);
EditorGUILayout.PropertyField(m_CameraHeight);
#if ENABLE_INPUT_SYSTEM
EditorGUILayout.PropertyField(m_ActionAsset);
#endif
serializedObject.ApplyModifiedProperties();
if (UnityEngine.GUI.changed)
EditorUtility.SetDirty((VIVERig)target);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4766014dc7f94c8468710cc3fd265f90
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: