This commit is contained in:
2025-11-13 17:40:28 +08:00
parent 962ab49609
commit 10156da245
5503 changed files with 805282 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll information contained herein is, and remains the property of
PICO Technology Co., Ltd. The intellectual and technical concepts
contained herein are proprietary to PICO Technology Co., Ltd. and may be
covered by patents, patents in process, and are protected by trade secret or
copyright law. Dissemination of this information or reproduction of this
material is strictly forbidden unless prior written permission is obtained from
PICO Technology Co., Ltd.
*******************************************************************************/
#if UNITY_EDITOR
using System.IO;
using UnityEditor;
using UnityEngine;
namespace Unity.XR.PXR.Debugger
{
[InitializeOnLoad]
public class PXR_PicoDebuggerSetup
{
static PXR_PicoDebuggerSetup()
{
EditorApplication.update += Init_PXR_PicoDebuggerSetup;
}
static void Init_PXR_PicoDebuggerSetup()
{
string currentPanelPath = $"{PXR_DebuggerConst.sdkPackageName}Assets/Debugger/Prefabs/DebuggerPanel.prefab";
string targetPanelPath = "Assets/Resources/PXR_DebuggerPanel.prefab";
string currentEntryPath = $"{PXR_DebuggerConst.sdkPackageName}Assets/Debugger/Prefabs/PICODebugger.prefab";
string targetEntryPath = "Assets/Resources/PXR_PICODebugger.prefab";
if(!File.Exists(targetEntryPath)){
if (!Directory.Exists("Assets/Resources"))
{
AssetDatabase.CreateFolder("Assets", "Resources");
}
if (AssetDatabase.LoadAssetAtPath<GameObject>(currentEntryPath) == null)
{
Debug.LogError("Prefab not found at path: " + currentEntryPath);
}
AssetDatabase.CopyAsset(currentEntryPath, targetEntryPath);
AssetDatabase.SaveAssets();
}
if(!File.Exists(targetPanelPath)){
if (!Directory.Exists("Assets/Resources"))
{
AssetDatabase.CreateFolder("Assets", "Resources");
}
if (AssetDatabase.LoadAssetAtPath<GameObject>(currentPanelPath) == null)
{
Debug.LogError("Prefab not found at path: " + currentPanelPath);
}
AssetDatabase.CopyAsset(currentPanelPath, targetPanelPath);
AssetDatabase.SaveAssets();
}
// EditorApplication.update -= Init_PXR_PicoDebuggerSetup;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,109 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll information contained herein is, and remains the property of
PICO Technology Co., Ltd. The intellectual and technical concepts
contained herein are proprietary to PICO Technology Co., Ltd. and may be
covered by patents, patents in process, and are protected by trade secret or
copyright law. Dissemination of this information or reproduction of this
material is strictly forbidden unless prior written permission is obtained from
PICO Technology Co., Ltd.
*******************************************************************************/
#if UNITY_EDITOR
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using System;
namespace Unity.XR.PXR.Debugger
{
// Generate a setting item in the editor project settings screen
static class SettingToolEditor
{
[SettingsProvider]
public static SettingsProvider CreateMyCustomSettingsProvider()
{
var config = PXR_PicoDebuggerSO.Instance;
var provider = new SettingsProvider("Project/PICO Debugger", SettingsScope.Project)
{
label = "PICO Debugger",
activateHandler = (obj, rootElement) =>
{
var visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>($"{PXR_Utils.sdkPackageName}Assets/Debugger/UI/PICODebuggerPanel.uxml");
var rootVisualElement = visualTree.Instantiate();
rootElement.Add(rootVisualElement);
var isOpenToggle = rootVisualElement.Q<Toggle>("IsOpen");
var debuggerlaucherButtonDropdown = rootVisualElement.Q<DropdownField>("DebuggerLaucherButton");
var startPositionDropdown = rootVisualElement.Q<DropdownField>("StartPosition");
var maxInfoCountSlider = rootVisualElement.Q<Slider>("MaxInfoCount");
var rulerClearButtonDropdown = rootVisualElement.Q<DropdownField>("RulerClearButton");
isOpenToggle.value = config.isOpen;
isOpenToggle.RegisterValueChangedCallback(evt =>
{
config.isOpen = evt.newValue;
EditorUtility.SetDirty(config); // Mark as dirty to save the changes
if(config.isOpen){
PXR_AppLog.PXR_OnEvent($"{PXR_AppLog.strPICODebugger}", PXR_AppLog.strPICODebugger_Enable,"enable");
}
});
debuggerlaucherButtonDropdown.choices = Enum.GetNames(typeof(LauncherButton)).ToList();
debuggerlaucherButtonDropdown.choices = Enum.GetNames(typeof(LauncherButton)).Where(name => name != config.rulerClearButton.ToString()).ToList();
debuggerlaucherButtonDropdown.index = (int)config.debuggerLauncherButton;
debuggerlaucherButtonDropdown.RegisterValueChangedCallback(evt =>
{
config.debuggerLauncherButton = (LauncherButton)Enum.Parse(typeof(LauncherButton), evt.newValue);
rulerClearButtonDropdown.choices = Enum.GetNames(typeof(LauncherButton)).Where(name => name != config.debuggerLauncherButton.ToString()).ToList();
EditorUtility.SetDirty(config);
PXR_AppLog.PXR_OnEvent($"{PXR_AppLog.strPICODebugger}", PXR_AppLog.strPICODebugger_LauncherButton,$"{config.debuggerLauncherButton}");
});
startPositionDropdown.choices = Enum.GetNames(typeof(StartPosiion)).ToList();
startPositionDropdown.index = (int)config.startPosition;
startPositionDropdown.RegisterValueChangedCallback(evt =>
{
config.startPosition = (StartPosiion)Enum.Parse(typeof(StartPosiion), evt.newValue);
EditorUtility.SetDirty(config);
PXR_AppLog.PXR_OnEvent($"{PXR_AppLog.strPICODebugger}",$"{PXR_AppLog.strPICODebugger_InitialPosition}",$"{config.startPosition}");
});
// var isFollowingToggle = rootVisualElement.Q<Toggle>("isFollowing");
// var isFollowingProperty = settings.FindProperty("isFollowing");
// var isLookAtCameraToggle = rootVisualElement.Q<Toggle>("isLookAtCamera");
// var isLookAtCameraProperty = settings.FindProperty("isLookAtCamera");
maxInfoCountSlider.value = config.maxInfoCount;
maxInfoCountSlider.RegisterValueChangedCallback(evt =>
{
config.maxInfoCount = Mathf.RoundToInt(evt.newValue);
EditorUtility.SetDirty(config);
PXR_AppLog.PXR_OnEvent($"{PXR_AppLog.strPICODebugger}",$"{PXR_AppLog.strPICODebugger_MaxLogCount}", $"{config.maxInfoCount}");
});
rulerClearButtonDropdown.choices = Enum.GetNames(typeof(LauncherButton)).Where(name => name != config.debuggerLauncherButton.ToString()).ToList();
rulerClearButtonDropdown.index = (int)config.rulerClearButton;
rulerClearButtonDropdown.RegisterValueChangedCallback(evt =>
{
config.rulerClearButton = (LauncherButton)Enum.Parse(typeof(LauncherButton), evt.newValue);
debuggerlaucherButtonDropdown.choices = Enum.GetNames(typeof(LauncherButton)).Where(name => name != config.rulerClearButton.ToString()).ToList();
EditorUtility.SetDirty(config);
PXR_AppLog.PXR_OnEvent($"{PXR_AppLog.strPICODebugger}",$"{PXR_AppLog.strPICODebugger_RulerResetButton}", $"{config.rulerClearButton}");
});
AssetDatabase.Refresh();
},
keywords = new HashSet<string>(new[] { "PICO", "Debugger Tool" })
};
return provider;
}
}
}
#endif

View File

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