Skip to content

Commit 470eb51

Browse files
committed
update to v3.4.0
1 parent 3831bd5 commit 470eb51

119 files changed

Lines changed: 10261 additions & 5785 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
-6 KB
Binary file not shown.
-6 KB
Binary file not shown.

Editor/BuildingBlocks/PXR_BuildingBlocks.cs

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
using UnityEngine.XR.Interaction.Toolkit;
1414
using UnityEngine.XR.Interaction.Toolkit.Inputs;
1515
using UnityEngine.XR.Interaction.Toolkit.UI;
16+
using UnityEngine.Rendering;
17+
using System.IO;
1618

1719
#if PICO_OPENXR_SDK
1820
using UnityEngine.XR.OpenXR;
@@ -546,6 +548,7 @@ class PXR_BuildingBlocksXRHandTracking : IBuildingBlock
546548
static string handRightName = $"{PXR_Utils.BuildingBlock} {k_Id} Right";
547549

548550
private static bool isExecuting = false;
551+
private static string ImportPendingKey = PXR_Utils.ProjectName+PXR_Utils.SceneName+"PXR_BuildingBlocksXRHandTracking";
549552

550553
static void DoInterestingStuff()
551554
{
@@ -572,11 +575,33 @@ static void DoInterestingStuff()
572575
// if no samples, add.
573576
if (PXR_Utils.TryFindSample(PXR_Utils.xrHandPackageName, PXR_Utils.xrHandVersion, PXR_Utils.xrHandVisualizerSampleName, out var visualizerSample))
574577
{
575-
visualizerSample.Import(Sample.ImportOptions.OverridePreviousImports);
578+
if (!Directory.Exists(visualizerSample.importPath)){
579+
EditorPrefs.SetBool(ImportPendingKey, true);
580+
visualizerSample.Import(Sample.ImportOptions.OverridePreviousImports);
581+
}else{
582+
GenerateXRHands();
583+
}
576584
}
577585
}
578586

587+
#endif
588+
}
589+
#if XR_HAND
590+
[InitializeOnLoadMethod]
591+
private static void OnDomainReloadXRHandHandler()
592+
{
593+
if(EditorPrefs.GetBool(ImportPendingKey, false)){
594+
Debug.Log("Detected post-import reload, continuing logic..." + EditorPrefs.GetBool(ImportPendingKey, false));
595+
EditorApplication.delayCall += ()=>{
596+
GenerateXRHands();
597+
};
598+
}
599+
}
600+
private static void GenerateXRHands(){
579601
// Get XROrigin
602+
bool isURP = GraphicsSettings.currentRenderPipeline != null && GraphicsSettings.currentRenderPipeline.GetType().Name.Contains("Universal");
603+
var xrHandPackage = UnityEditor.PackageManager.PackageInfo.FindForAssembly(typeof(UnityEngine.XR.Hands.XRHand).Assembly);
604+
if (xrHandPackage != null) PXR_Utils.xrHandVersion = xrHandPackage.version;
580605
GameObject cameraOrigin = PXR_Utils.CheckAndCreateXROrigin();
581606
PXR_ProjectSetting.GetProjectConfig().handTracking = true;
582607
PXR_ProjectSetting.SaveAssets();
@@ -595,6 +620,12 @@ static void DoInterestingStuff()
595620
leftHand.transform.localPosition = Vector3.zero;
596621
leftHand.transform.localRotation = Quaternion.identity;
597622
leftHand.transform.localScale = Vector3.one;
623+
var leftHandSkin = leftHand.transform.GetComponentInChildren<SkinnedMeshRenderer>(true);
624+
if(leftHandSkin != null && leftHandSkin.sharedMaterial != null){
625+
var material = new Material(leftHandSkin.sharedMaterial);
626+
material.shader = isURP?Shader.Find("Universal Render Pipeline/Lit"):Shader.Find("Standard");
627+
leftHandSkin.material = material;
628+
}
598629
leftHand.SetActive(true);
599630
leftHand.name = handLeftName;
600631
}
@@ -615,6 +646,12 @@ static void DoInterestingStuff()
615646
rightHand.transform.localPosition = Vector3.zero;
616647
rightHand.transform.localRotation = Quaternion.identity;
617648
rightHand.transform.localScale = Vector3.one;
649+
var rightHandSkin = rightHand.transform.GetComponentInChildren<SkinnedMeshRenderer>(true);
650+
if(rightHandSkin != null && rightHandSkin.sharedMaterial != null){
651+
var material = new Material(rightHandSkin.sharedMaterial);
652+
material.shader = isURP?Shader.Find("Universal Render Pipeline/Lit"):Shader.Find("Standard");
653+
rightHandSkin.material = material;
654+
}
618655
rightHand.SetActive(true);
619656
rightHand.name = handRightName;
620657
}
@@ -626,9 +663,8 @@ static void DoInterestingStuff()
626663
EditorSceneManager.MarkSceneDirty(cameraOrigin.scene);
627664
EditorSceneManager.SaveScene(cameraOrigin.scene);
628665
isExecuting = false;
629-
#endif
630666
}
631-
667+
#endif
632668
public void ExecuteBuildingBlock() => DoInterestingStuff();
633669

634670
// Each building block should have an accompanying MenuItem as a good practice, we add them here.

Editor/Debugger/PXR_PicoDebuggerSetup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ static PXR_PicoDebuggerSetup()
2626
static void Init_PXR_PicoDebuggerSetup()
2727
{
2828
string currentPanelPath = $"{PXR_DebuggerConst.sdkPackageName}Assets/Debugger/Prefabs/DebuggerPanel.prefab";
29-
string targetPanelPath = "Assets/Resources/DebuggerPanel.prefab";
29+
string targetPanelPath = "Assets/Resources/PXR_DebuggerPanel.prefab";
3030
string currentEntryPath = $"{PXR_DebuggerConst.sdkPackageName}Assets/Debugger/Prefabs/PICODebugger.prefab";
31-
string targetEntryPath = "Assets/Resources/PICODebugger.prefab";
31+
string targetEntryPath = "Assets/Resources/PXR_PICODebugger.prefab";
3232
if(!File.Exists(targetEntryPath)){
3333
if (!Directory.Exists("Assets/Resources"))
3434
{

Editor/PXR_BuildProcessor.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ internal class PXR_BuildHooks : IPreprocessBuildWithReport, IPostprocessBuildWit
191191
{
192192
{ "xr-usable-core-mask-enabled", "1"},
193193
{ "xr-require-backbuffer-textures", "0" },
194-
{ "xr-hide-memoryless-render-texture", "1" }
194+
{ "xr-hide-memoryless-render-texture", "1" },
195+
{ "xr-vulkan-extension-fragment-density-map-enabled", "1"}
195196
};
196197

197198
public void OnPreprocessBuild(BuildReport report)
@@ -325,7 +326,7 @@ public void OnPostGenerateGradleAndroidProject(string path)
325326
string usesPermissionTagName = "uses-permission";
326327

327328
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","pvr.app.type"}},new Dictionary<string, string>{{"value","vr"}});
328-
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","pxr.sdk.version_code"}},new Dictionary<string, string>{{"value", "5140"}});
329+
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","pxr.sdk.version_code"}},new Dictionary<string, string>{{"value", "5150"}});
329330
doc.InsertAttributeInTargetTag(applicationTagPath,null, new Dictionary<string, string>() {{"requestLegacyExternalStorage", "true"}});
330331
#if PICO_OPENXR_SDK
331332
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","use.pxr.sdk"}},new Dictionary<string, string>{{"value", "2"}});
@@ -499,11 +500,13 @@ public void OnPostGenerateGradleAndroidProject(string path)
499500
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "enable_cloud_anchor" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().sharedAnchor ? "1" : "0" } });
500501
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "enable_mesh_anchor" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().spatialMesh ? "1" : "0" } });
501502
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "enable_scene_anchor" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().sceneCapture ? "1" : "0" } });
503+
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "enable_plane_detection" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().planeDetection ? "1" : "0" } });
502504
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "pvr.SuperResolution" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().superResolution ? "1" : "0" } });
503505
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "pvr.NormalSharpening" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().normalSharpening ? "1" : "0" } });
504506
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "pvr.QualitySharpening" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().qualitySharpening ? "1" : "0" } });
505507
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "pvr.FixedFoveatedSharpening" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().fixedFoveatedSharpening ? "1" : "0" } });
506508
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "pvr.SelfAdaptiveSharpening" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().selfAdaptiveSharpening ? "1" : "0" } });
509+
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "pvr.app.secure_mr" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().secureMR ? "1" : "0" } });
507510
doc.CreateElementInTag(manifestTagPath,usesPermissionTagName,new Dictionary<string, string>{{"name","android.permission.WRITE_SETTINGS"}});
508511

509512
if (PXR_ProjectSetting.GetProjectConfig().eyeTracking || PXR_ProjectSetting.GetProjectConfig().enableETFR)
@@ -513,7 +516,7 @@ public void OnPostGenerateGradleAndroidProject(string path)
513516
doc.InsertAttributeInTargetTag(metaDataTagPath, new Dictionary<string, string> { { "name", "eyetracking_calibration" } }, new Dictionary<string, string> { { "value", PXR_ProjectSetting.GetProjectConfig().eyetrackingCalibration ? "true" : "false" } });
514517
}
515518

516-
if (PXR_ProjectSetting.GetProjectConfig().spatialAnchor || PXR_ProjectSetting.GetProjectConfig().sceneCapture || PXR_ProjectSetting.GetProjectConfig().spatialMesh || PXR_ProjectSetting.GetProjectConfig().sharedAnchor)
519+
if (PXR_ProjectSetting.GetProjectConfig().sceneCapture || PXR_ProjectSetting.GetProjectConfig().spatialMesh || PXR_ProjectSetting.GetProjectConfig().planeDetection)
517520
{
518521
doc.CreateElementInTag(manifestTagPath, usesPermissionTagName,
519522
new Dictionary<string, string> { { "name", "com.picovr.permission.SPATIAL_DATA" } });

Editor/PXR_ManagerEditor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public override void OnInspectorGUI()
299299
{
300300
projectConfig.meshLod = (PxrMeshLod)EditorGUILayout.EnumPopup(" LOD", projectConfig.meshLod);
301301
}
302+
projectConfig.planeDetection = EditorGUILayout.Toggle("Plane Detection", projectConfig.planeDetection);
302303
EditorGUILayout.EndVertical();
303304
//mr safeguard
304305

@@ -308,6 +309,10 @@ public override void OnInspectorGUI()
308309
"MR safety, if you choose this option, your application will adopt MR safety policies during runtime. If not selected, it will continue to use VR safety policies by default.";
309310
projectConfig.mrSafeguard = EditorGUILayout.Toggle(mrSafeguardContent, projectConfig.mrSafeguard);
310311

312+
var secureMRContent = new GUIContent();
313+
secureMRContent.text = "SecureMR";
314+
projectConfig.secureMR = EditorGUILayout.Toggle(secureMRContent, projectConfig.secureMR);
315+
311316
//Super Resolution
312317
var superresolutionContent = new GUIContent();
313318
superresolutionContent.text = "Super Resolution";

Editor/PXR_Metadata.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ private class PXR_LoaderMetadata : IXRLoaderMetadata
3939

4040
private static readonly List<BuildTargetGroup> SupportedBuildTargets = new List<BuildTargetGroup>()
4141
{
42-
BuildTargetGroup.Android,
43-
BuildTargetGroup.Standalone
42+
BuildTargetGroup.Android
4443
};
4544
}
4645

Editor/PXR_Utils.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Unity.XR.CoreUtils.Capabilities.Editor;
2020
using UnityEngine.XR.Management;
2121
using Unity.XR.CoreUtils.Capabilities;
22+
using System.IO;
2223

2324
#if UNITY_OPENXR
2425
using UnityEngine.XR.OpenXR;
@@ -68,6 +69,19 @@ internal static class PXR_Utils
6869
public static string xriHandsInteractionDemoSampleName = "Hands Interaction Demo";
6970
public static string xri2HandsSetupPefabName = "XR Interaction Hands Setup";
7071
public static string xri3HandsSetupPefabName = "XR Origin Hands (XR Rig)";
72+
public static string ProjectName{
73+
get
74+
{
75+
return Path.GetFileName(Path.GetDirectoryName(Application.dataPath));
76+
}
77+
}
78+
79+
public static string SceneName{
80+
get
81+
{
82+
return SceneManager.GetActiveScene().name;
83+
}
84+
}
7185
public static PackageVersion XRICurPackageVersion
7286
{
7387
get

Editor/Unity.XR.PICO.Editor.asmdef

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
"expression": "",
4848
"define": "UNITY_OPENXR"
4949
},
50+
{
51+
"name": "com.unity.xr.openxr",
52+
"expression": "1.16.0",
53+
"define": "UNITY_OPENXR_1_16_0"
54+
},
5055
{
5156
"name": "com.unity.xr.arfoundation",
5257
"expression": "[5.1.2,6.0.0]",
@@ -64,4 +69,4 @@
6469
}
6570
],
6671
"noEngineReferences": false
67-
}
72+
}

Enterprise.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)