Skip to content

Commit

Permalink
2022 upgrade
Browse files Browse the repository at this point in the history
2019 was giving me errors with newton soft so I just said fuck it 2022 upgrade and it fixed it :)
  • Loading branch information
Happyrobot33 committed Mar 2, 2024
1 parent 195b48e commit 345757f
Show file tree
Hide file tree
Showing 27 changed files with 770 additions and 214 deletions.
8 changes: 8 additions & 0 deletions Assets/XR.meta

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

8 changes: 8 additions & 0 deletions Assets/XR/Loaders.meta

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

14 changes: 14 additions & 0 deletions Assets/XR/Loaders/OculusLoader.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 03bc68f14d65e7747a59d5ff74bd199b, type: 3}
m_Name: OculusLoader
m_EditorClassIdentifier:
8 changes: 8 additions & 0 deletions Assets/XR/Loaders/OculusLoader.asset.meta

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

8 changes: 8 additions & 0 deletions Assets/XR/Settings.meta

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

32 changes: 32 additions & 0 deletions Assets/XR/Settings/OculusSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c353a8f1e58cf884584123914fe63cd5, type: 3}
m_Name: OculusSettings
m_EditorClassIdentifier:
m_StereoRenderingModeDesktop: 1
m_StereoRenderingModeAndroid: 2
SharedDepthBuffer: 1
DepthSubmission: 0
DashSupport: 1
LowOverheadMode: 0
OptimizeBufferDiscards: 1
PhaseSync: 0
SymmetricProjection: 1
SubsampledLayout: 0
FoveatedRenderingMethod: 0
LateLatching: 0
LateLatchingDebug: 0
EnableTrackingOriginStageMode: 0
SpaceWarp: 0
TargetQuest2: 1
TargetQuestPro: 0
SystemSplashScreen: {fileID: 0}
8 changes: 8 additions & 0 deletions Assets/XR/Settings/OculusSettings.asset.meta

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

78 changes: 78 additions & 0 deletions Assets/XR/XRGeneralSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-7012520608237198431
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d236b7d11115f2143951f1e14045df39, type: 3}
m_Name: Android Settings
m_EditorClassIdentifier:
m_LoaderManagerInstance: {fileID: 0}
m_InitManagerOnStart: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2dc886499c26824283350fa532d087d, type: 3}
m_Name: XRGeneralSettings
m_EditorClassIdentifier:
Keys: 010000000700000004000000
Values:
- {fileID: 3410140295571951628}
- {fileID: -7012520608237198431}
- {fileID: 3577145650821638139}
--- !u!114 &3410140295571951628
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d236b7d11115f2143951f1e14045df39, type: 3}
m_Name: Standalone Settings
m_EditorClassIdentifier:
m_LoaderManagerInstance: {fileID: 3954984812971645292}
m_InitManagerOnStart: 0
--- !u!114 &3577145650821638139
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d236b7d11115f2143951f1e14045df39, type: 3}
m_Name: iPhone Settings
m_EditorClassIdentifier:
m_LoaderManagerInstance: {fileID: 0}
m_InitManagerOnStart: 0
--- !u!114 &3954984812971645292
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4c3631f5e58749a59194e0cf6baf6d5, type: 3}
m_Name: Standalone Providers
m_EditorClassIdentifier:
m_RequiresSettingsUpdate: 0
m_AutomaticLoading: 0
m_AutomaticRunning: 0
m_Loaders:
- {fileID: 11400000, guid: 6f4bc6bbac5dbaf45acfab97ec6cf8aa, type: 2}
8 changes: 8 additions & 0 deletions Assets/XR/XRGeneralSettings.asset.meta

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

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEditor.VersionControl;
using UnityEngine;
using UnityEngine.UIElements;
using VRC.PackageManagement.Core.Types.Packages;
using YamlDotNet.Serialization.NodeTypeResolvers;

namespace VRC.PackageManagement.PackageMaker
{
Expand All @@ -23,6 +21,9 @@ public class PackageMakerWindow : EditorWindow
private TextField _packageIDField;
private Button _actionButton;
private EnumField _targetVRCPackageField;
private TextField _authorNameField;
private TextField _authorEmailField;
private TextField _authorUrlField;
private static string _projectDir;
private PackageMakerWindowData _windowData;

Expand All @@ -34,6 +35,9 @@ private void LoadDataFromSave()
}
_packageIDField.SetValueWithoutNotify(_windowData.packageID);
_targetVRCPackageField.SetValueWithoutNotify(_windowData.relatedPackage);
_authorEmailField.SetValueWithoutNotify(_windowData.authorEmail);
_authorNameField.SetValueWithoutNotify(_windowData.authorName);
_authorUrlField.SetValueWithoutNotify(_windowData.authorUrl);

RefreshActionButtonState();
}
Expand Down Expand Up @@ -101,7 +105,9 @@ private void RefreshActionButtonState()
{
_actionButton.SetEnabled(
StringIsValidAssetFolder(_windowData.targetAssetFolder) &&
!string.IsNullOrWhiteSpace(_windowData.packageID)
!string.IsNullOrWhiteSpace(_windowData.packageID) &&
_authorNameField.value != null &&
IsValidEmail(_authorEmailField.value)
);
}

Expand All @@ -122,6 +128,7 @@ private void CreateGUI()
// Create Target Asset folder and register for drag and drop events
_rootView.Add(CreateTargetFolderElement());
_rootView.Add(CreatePackageIDElement());
_rootView.Add(CreateAuthorElement());
_rootView.Add(CreateTargetVRCPackageElement());
_rootView.Add(CreateActionButton());

Expand All @@ -133,8 +140,7 @@ public enum VRCPackageEnum
None = 0,
Worlds = 1,
Avatars = 2,
Base = 3,
UdonSharp = 4,
Base = 3
}

private VisualElement CreateTargetVRCPackageElement()
Expand Down Expand Up @@ -206,6 +212,59 @@ private VisualElement CreatePackageIDElement()
return box;
}

private VisualElement CreateAuthorElement()
{
// Construct author fields
_authorNameField = new TextField("Author Name");
_authorEmailField = new TextField("Author Email");
_authorUrlField = new TextField("Author URL (optional)");

// Save name to window data and toggle the Action Button if its status changed
_authorNameField.RegisterValueChangedCallback((evt) =>
{
_windowData.authorName = evt.newValue;
Debug.Log($"Window author name is {evt.newValue}");
RefreshActionButtonState();
});

// Save email to window data if valid and toggle the Action Button if its status changed
_authorEmailField.RegisterValueChangedCallback((evt) =>
{
// Only save email if it appears valid
if (IsValidEmail(evt.newValue))
{
_windowData.authorEmail = evt.newValue;
}
RefreshActionButtonState();
});

// Save url to window data, doesn't affect action button state
_authorUrlField.RegisterValueChangedCallback((evt) =>
{
_windowData.authorUrl = evt.newValue;
});

// Add new fields to layout
var box = new Box();
box.Add(_authorNameField);
box.Add(_authorEmailField);
box.Add(_authorUrlField);
return box;
}

private bool IsValidEmail(string evtNewValue)
{
try
{
var addr = new System.Net.Mail.MailAddress(evtNewValue);
return addr.Address == evtNewValue;
}
catch
{
return false;
}
}

private Regex packageIdRegex = new Regex("[^a-z0-9.]");
private void OnPackageIDChanged(ChangeEvent<string> evt)
{
Expand Down Expand Up @@ -327,21 +386,31 @@ private void DoMigration(string corePath, string targetDir)
packageType = "com.vrchat.base";
break;
case VRCPackageEnum.Worlds:
packageType = "com.vrchat.clientsim"; // we want ClientSim too, need to specify that for now
break;
case VRCPackageEnum.UdonSharp:
packageType = "com.vrchat.udonsharp";
packageType = "com.vrchat.worlds";
break;
}

string parentDir = new DirectoryInfo(targetDir)?.Parent.FullName;
Core.Utilities.CreateStarterPackage(_windowData.packageID, parentDir, packageType);
var packageDir = Core.Utilities.CreateStarterPackage(_windowData.packageID, parentDir, packageType);

// Modify manifest to add author
// Todo: add support for passing author into CreateStarterPackage
var manifest =
VRCPackageManifest.GetManifestAtPath(Path.Combine(packageDir, VRCPackageManifest.Filename)) as
VRCPackageManifest;
manifest.author = new Author()
{
email = _windowData.authorEmail,
name = _windowData.authorName,
url = _windowData.authorUrl
};
manifest.Save();

var allFiles = GetAllFiles(corePath).ToList();
MoveFilesToPackageDir(allFiles, corePath, targetDir);

// Clear target asset folder since it should no longer exist
_windowData.targetAssetFolder = "";

}

private static IEnumerable<string> GetAllFiles(string path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ public class PackageMakerWindowData : ScriptableObject
public static string defaultAssetPath = Path.Combine("Assets", "PackageMakerWindowData.asset");
public string targetAssetFolder;
public string packageID;

public string authorName;
public string authorEmail;
public string authorUrl;
public PackageMakerWindow.VRCPackageEnum relatedPackage;

public static PackageMakerWindowData GetOrCreate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ public static List<string> GetAffectedPackageList(IVRCPackage package)

public static void ForceRefresh ()
{
MethodInfo method = typeof( UnityEditor.PackageManager.Client ).GetMethod( "Resolve", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.DeclaredOnly );
if( method != null )
method.Invoke( null, null );

UnityEditor.PackageManager.Client.Resolve();
AssetDatabase.Refresh();
}

Expand Down
Loading

0 comments on commit 345757f

Please sign in to comment.