diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e5f3d027..f0d5a034 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -37,7 +37,6 @@ If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - Ready Player Me Core version - - Ready Player Me Avatar Loader version - Ready Player Me WebView version - glTFast version - Unity Editor version [e.g. 2021.2.1f1] diff --git a/.github/latest.md b/.github/latest.md index 708c9229..a2873be8 100644 --- a/.github/latest.md +++ b/.github/latest.md @@ -2,8 +2,38 @@ ## Changelog ### Updated -- replaced API URLs with model URLs for shortcodes by @rk132 in [#152](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/152) -- updated render api and samples @rYuuk in [#147](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/147) +- refactor and extracted shared logic from network packages @harrisonhough in [#148](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/148) +- replaced api urls in samples with models urls by @rk132 in [#152](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/152) +- added com.unity.cloud.gltfast as a dependency and removed auto install of gltfast from git url by @harrisonhough in [#155](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/155) +- updated to GLTFast 6.0.1 by @harrisonhough in by @harrisonhough in [#157](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/157) +- replaced use of ienumerator coroutines with async/await by @rYuuk in [#172](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/172) +- request class names updated to be more uniform by @MaxAndreassenRPM in [#173](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/173) +- endpoint classes removed and refactored by @MaxAndreassenRPM in [#174](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/174) +- added avatar creator POC sample using new elements by @ryuuk in [#182](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/182) +- removed "I don't have an account" checkbox from setup guide by @rk132 in [#184](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/184) +- restructure of avatar creator samples by @rYuuk in [#185](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/185) +- class and folder restructure to match Unity package standards by @harrisonhough in [#190](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/190) +- namespaces added to some scripts to meet asset store requirements by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) +- Ready Player Me top toolbar menu is under `Tools/Ready Player Me` to comply with Asset Store requirements by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) +- samples renamed for Asset Store version of package and paths updated accordingly by @harrisonhough in [#198](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/198) +- quick start sample animations updated by @rYuuk in [#200](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/200) +- draco compression package version updated by @harrisonhough in [#202](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/202) ### Added -- Added app id to setup guide by @ryuuk in [#145](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/145) \ No newline at end of file +- add gender select element for Avatar Creator by @harrisonhough in [#159](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/159) +- basic login element for Avatar Creator by @harrisonhough in [#160](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/160) +- photo capture element for Avatar Creator by @ryuuk in [#162](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/162) +- avatar template element for Avatar Creator by @harrisonhough in [#164](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/164) +- selfie element for Avatar Creator by @ryuuk in [#166](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/166) +- asset panel element for Avatar Creator by @harrisonhough in [#175](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/175) +- account creation element for Avatar Creator by @ryuuk in [#178](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/178) +- avatar preview element for Avatar Creator by @ryuuk in [#181](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/181) + +- fixed some issues related to paths like in the Graphics Setting Utility by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) +- shader override property added to avatar config by @ryuuk in [#199](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/199) + +### Fixed +- fix for handling pasted url text in subdomain field by @harrisonhough in [#183](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/183) +- added permission and orientation fix to photo capture element by @ryuuk in [#192](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/192) +- added Panel Switcher clear functionality to fix issues related to relaunching the creator by @ryuuk in [#194](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/194) +- namespaces added to some scripts to meet asset store requirements by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) \ No newline at end of file diff --git a/.github/workflows/pr-test-runner.yml b/.github/workflows/pr-test-runner.yml index 9f809d35..69d97c82 100644 --- a/.github/workflows/pr-test-runner.yml +++ b/.github/workflows/pr-test-runner.yml @@ -2,7 +2,7 @@ name: Run Tests on: pull_request: - types: [ opened, reopened ] + types: [ opened, reopened, edited ] workflow_dispatch: jobs: diff --git a/.gitignore b/.gitignore index a27e6a7a..4eaed01b 100644 --- a/.gitignore +++ b/.gitignore @@ -53,7 +53,6 @@ sysinfo.txt # Builds *.apk -*.unitypackage # Crashlytics generated file crashlytics-build.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index 543fe614..86defb01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,45 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [5.0.0] - 2024.01.12 + +### Updated +- refactor and extracted shared logic from network packages @harrisonhough in [#148](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/148) +- replaced api urls in samples with models urls by @rk132 in [#152](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/152) +- added com.unity.cloud.gltfast as a dependency and removed auto install of gltfast from git url by @harrisonhough in [#155](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/155) +- updated to GLTFast 6.0.1 by @harrisonhough in by @harrisonhough in [#157](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/157) +- replaced use of ienumerator coroutines with async/await by @rYuuk in [#172](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/172) +- request class names updated to be more uniform by @MaxAndreassenRPM in [#173](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/173) +- endpoint classes removed and refactored by @MaxAndreassenRPM in [#174](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/174) +- added avatar creator POC sample using new elements by @ryuuk in [#182](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/182) +- removed "I don't have an account" checkbox from setup guide by @rk132 in [#184](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/184) +- restructure of avatar creator samples by @rYuuk in [#185](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/185) +- class and folder restructure to match Unity package standards by @harrisonhough in [#190](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/190) +- namespaces added to some scripts to meet asset store requirements by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) +- Ready Player Me top toolbar menu is under `Tools/Ready Player Me` to comply with Asset Store requirements by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) +- samples renamed for Asset Store version of package and paths updated accordingly by @harrisonhough in [#198](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/198) +- quick start sample animations updated by @rYuuk in [#200](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/200) +- draco compression package version updated by @harrisonhough in [#202](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/202) + +### Added +- add gender select element for Avatar Creator by @harrisonhough in [#159](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/159) +- basic login element for Avatar Creator by @harrisonhough in [#160](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/160) +- photo capture element for Avatar Creator by @ryuuk in [#162](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/162) +- avatar template element for Avatar Creator by @harrisonhough in [#164](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/164) +- selfie element for Avatar Creator by @ryuuk in [#166](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/166) +- asset panel element for Avatar Creator by @harrisonhough in [#175](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/175) +- account creation element for Avatar Creator by @ryuuk in [#178](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/178) +- avatar preview element for Avatar Creator by @ryuuk in [#181](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/181) + +- fixed some issues related to paths like in the Graphics Setting Utility by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) +- shader override property added to avatar config by @ryuuk in [#199](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/199) + +### Fixed +- fix for handling pasted url text in subdomain field by @harrisonhough in [#183](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/183) +- added permission and orientation fix to photo capture element by @ryuuk in [#192](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/192) +- added Panel Switcher clear functionality to fix issues related to relaunching the creator by @ryuuk in [#194](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/194) +- namespaces added to some scripts to meet asset store requirements by @harrisonhough in [#195](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/195) + ## [4.1.2] - 2023.12.20 ### Fixed diff --git a/Editor/UI/AvatarConfigEditor.meta b/Editor/AvatarCreator.meta similarity index 77% rename from Editor/UI/AvatarConfigEditor.meta rename to Editor/AvatarCreator.meta index 8178eac7..1c1296fe 100644 --- a/Editor/UI/AvatarConfigEditor.meta +++ b/Editor/AvatarCreator.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f6de29755e9e4c446b1c5eb3407cb2d3 +guid: 3cd7b15d18039474489020dd9d3daf34 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Editor/AvatarCreator/AssetTypeFilterDrawer.cs b/Editor/AvatarCreator/AssetTypeFilterDrawer.cs new file mode 100644 index 00000000..33667484 --- /dev/null +++ b/Editor/AvatarCreator/AssetTypeFilterDrawer.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace ReadyPlayerMe.AvatarCreator.Editor +{ + [CustomPropertyDrawer(typeof(AssetTypeFilterAttribute))] + public class AssetTypeFilterDrawer : PropertyDrawer + { + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + var assetTypeAttribute = attribute as AssetTypeFilterAttribute; + + if (property.propertyType == SerializedPropertyType.Enum) + { + EditorGUI.BeginProperty(position, label, property); + + EditorGUI.BeginChangeCheck(); + + // Get the current enum value + var currentEnumValue = (AssetType) property.enumValueIndex; + + var filteredEnumNames = new List(); + foreach (var enumName in Enum.GetNames(typeof(AssetType))) + { + var enumFieldInfo = typeof(AssetType).GetField(enumName); + var enumAttribute = (AssetTypeFilterAttribute) Attribute.GetCustomAttribute(enumFieldInfo, typeof(AssetTypeFilterAttribute)); + if (enumAttribute == null) continue; + + var filter = (AssetFilter) Enum.Parse(typeof(AssetFilter), enumAttribute.filter.ToString()); + if (filter == assetTypeAttribute?.filter) + { + filteredEnumNames.Add(enumName); + } + } + + // Display the dropdown with filtered enum values + var newIndex = EditorGUI.Popup(position, label.text, Array.IndexOf(filteredEnumNames.ToArray(), currentEnumValue.ToString()), filteredEnumNames.ToArray()); + + // Set the new enum value if it has changed + if (EditorGUI.EndChangeCheck()) + { + property.enumValueIndex = (int) Enum.Parse(typeof(AssetType), filteredEnumNames[newIndex]); + } + + EditorGUI.EndProperty(); + } + else + { + EditorGUI.LabelField(position, label.text, "Use AssetType with Enum."); + } + } + + } +} diff --git a/Editor/AvatarCreator/AssetTypeFilterDrawer.cs.meta b/Editor/AvatarCreator/AssetTypeFilterDrawer.cs.meta new file mode 100644 index 00000000..4786e068 --- /dev/null +++ b/Editor/AvatarCreator/AssetTypeFilterDrawer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6add29e0a6c64d6786c6742dfbd87acf +timeCreated: 1702392584 \ No newline at end of file diff --git a/Samples~/AvatarCreatorSamples/Editor/ReadyPlayerMe.Core.AvatarCreatorSample.Editor.asmdef b/Editor/AvatarCreator/ReadyPlayerMe.AvatarCreator.Editor.asmdef similarity index 70% rename from Samples~/AvatarCreatorSamples/Editor/ReadyPlayerMe.Core.AvatarCreatorSample.Editor.asmdef rename to Editor/AvatarCreator/ReadyPlayerMe.AvatarCreator.Editor.asmdef index cf5303cf..0e3cbfd4 100644 --- a/Samples~/AvatarCreatorSamples/Editor/ReadyPlayerMe.Core.AvatarCreatorSample.Editor.asmdef +++ b/Editor/AvatarCreator/ReadyPlayerMe.AvatarCreator.Editor.asmdef @@ -1,10 +1,9 @@ { - "name": "ReadyPlayerMe.Core.AvatarCreatorSample.Editor", + "name": "ReadyPlayerMe.AvatarCreator.Editor", "rootNamespace": "", "references": [ - "ReadyPlayerMe.Core.AvatarCreator", "ReadyPlayerMe.Core", - "ReadyPlayerMe.Core.AvatarCreatorSample" + "ReadyPlayerMe.AvatarCreator" ], "includePlatforms": [ "Editor" @@ -17,4 +16,4 @@ "defineConstraints": [], "versionDefines": [], "noEngineReferences": false -} +} \ No newline at end of file diff --git a/Samples~/AvatarCreatorSamples/Scripts/ReadyPlayerMe.Core.AvatarCreatorSample.asmdef.meta b/Editor/AvatarCreator/ReadyPlayerMe.AvatarCreator.Editor.asmdef.meta similarity index 76% rename from Samples~/AvatarCreatorSamples/Scripts/ReadyPlayerMe.Core.AvatarCreatorSample.asmdef.meta rename to Editor/AvatarCreator/ReadyPlayerMe.AvatarCreator.Editor.asmdef.meta index 9d76910f..6fc8d458 100644 --- a/Samples~/AvatarCreatorSamples/Scripts/ReadyPlayerMe.Core.AvatarCreatorSample.asmdef.meta +++ b/Editor/AvatarCreator/ReadyPlayerMe.AvatarCreator.Editor.asmdef.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a17cca4edcc7a8b4c8aaa0fe38801f7d +guid: 0ed01c010d356f94b99818818dbd9430 AssemblyDefinitionImporter: externalObjects: {} userData: diff --git a/Samples~/AvatarCreatorSamples/Materials.meta b/Editor/Core.meta similarity index 77% rename from Samples~/AvatarCreatorSamples/Materials.meta rename to Editor/Core.meta index f19f8098..291287ee 100644 --- a/Samples~/AvatarCreatorSamples/Materials.meta +++ b/Editor/Core.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cf60dcc22fb37f54789a17856d1b0b94 +guid: 17b21c922120b25458033294675f03ec folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Editor/Resources.meta b/Editor/Core/Resources.meta similarity index 100% rename from Editor/Resources.meta rename to Editor/Core/Resources.meta diff --git a/Editor/Resources/Banner.png b/Editor/Core/Resources/Banner.png similarity index 100% rename from Editor/Resources/Banner.png rename to Editor/Core/Resources/Banner.png diff --git a/Editor/Resources/Banner.png.meta b/Editor/Core/Resources/Banner.png.meta similarity index 100% rename from Editor/Resources/Banner.png.meta rename to Editor/Core/Resources/Banner.png.meta diff --git a/Editor/Core/Resources/rpm_error_icon.png b/Editor/Core/Resources/rpm_error_icon.png new file mode 100644 index 00000000..64e4031f Binary files /dev/null and b/Editor/Core/Resources/rpm_error_icon.png differ diff --git a/Editor/Resources/rpm_error_icon.png.meta b/Editor/Core/Resources/rpm_error_icon.png.meta similarity index 95% rename from Editor/Resources/rpm_error_icon.png.meta rename to Editor/Core/Resources/rpm_error_icon.png.meta index b1ce2af7..f2d2b996 100644 --- a/Editor/Resources/rpm_error_icon.png.meta +++ b/Editor/Core/Resources/rpm_error_icon.png.meta @@ -6,8 +6,8 @@ TextureImporter: serializedVersion: 11 mipmaps: mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 + enableMipMap: 0 + sRGBTexture: 1 linearTexture: 0 fadeOut: 0 borderMipMap: 0 @@ -23,6 +23,7 @@ TextureImporter: isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 + vTOnly: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -49,14 +50,17 @@ TextureImporter: spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 - alphaIsTransparency: 0 + alphaIsTransparency: 1 spriteTessellationDetail: -1 - textureType: 0 + textureType: 8 textureShape: 1 singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 + ignorePngGamma: 0 applyGammaDecoding: 0 platformSettings: - serializedVersion: 3 diff --git a/Runtime/Extras.meta b/Editor/Core/Scripts.meta similarity index 77% rename from Runtime/Extras.meta rename to Editor/Core/Scripts.meta index 364620e7..738e8066 100644 --- a/Runtime/Extras.meta +++ b/Editor/Core/Scripts.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ee5960b117b962f44b349c21290a5273 +guid: 05e3bb89ec0ad464c9a480276df7c651 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Editor/Analytics.meta b/Editor/Core/Scripts/Analytics.meta similarity index 100% rename from Editor/Analytics.meta rename to Editor/Core/Scripts/Analytics.meta diff --git a/Editor/Analytics/AmplitudeEditorLogger.cs b/Editor/Core/Scripts/Analytics/AmplitudeEditorLogger.cs similarity index 100% rename from Editor/Analytics/AmplitudeEditorLogger.cs rename to Editor/Core/Scripts/Analytics/AmplitudeEditorLogger.cs diff --git a/Editor/Analytics/AmplitudeEditorLogger.cs.meta b/Editor/Core/Scripts/Analytics/AmplitudeEditorLogger.cs.meta similarity index 100% rename from Editor/Analytics/AmplitudeEditorLogger.cs.meta rename to Editor/Core/Scripts/Analytics/AmplitudeEditorLogger.cs.meta diff --git a/Editor/Analytics/AnalyticsEditorLogger.cs b/Editor/Core/Scripts/Analytics/AnalyticsEditorLogger.cs similarity index 100% rename from Editor/Analytics/AnalyticsEditorLogger.cs rename to Editor/Core/Scripts/Analytics/AnalyticsEditorLogger.cs diff --git a/Editor/Analytics/AnalyticsEditorLogger.cs.meta b/Editor/Core/Scripts/Analytics/AnalyticsEditorLogger.cs.meta similarity index 100% rename from Editor/Analytics/AnalyticsEditorLogger.cs.meta rename to Editor/Core/Scripts/Analytics/AnalyticsEditorLogger.cs.meta diff --git a/Editor/Analytics/Constants.cs b/Editor/Core/Scripts/Analytics/Constants.cs similarity index 100% rename from Editor/Analytics/Constants.cs rename to Editor/Core/Scripts/Analytics/Constants.cs diff --git a/Editor/Analytics/Constants.cs.meta b/Editor/Core/Scripts/Analytics/Constants.cs.meta similarity index 100% rename from Editor/Analytics/Constants.cs.meta rename to Editor/Core/Scripts/Analytics/Constants.cs.meta diff --git a/Editor/Analytics/HelpSubject.cs b/Editor/Core/Scripts/Analytics/HelpSubject.cs similarity index 100% rename from Editor/Analytics/HelpSubject.cs rename to Editor/Core/Scripts/Analytics/HelpSubject.cs diff --git a/Editor/Analytics/HelpSubject.cs.meta b/Editor/Core/Scripts/Analytics/HelpSubject.cs.meta similarity index 100% rename from Editor/Analytics/HelpSubject.cs.meta rename to Editor/Core/Scripts/Analytics/HelpSubject.cs.meta diff --git a/Editor/Analytics/IAnalyticsEditorLogger.cs b/Editor/Core/Scripts/Analytics/IAnalyticsEditorLogger.cs similarity index 100% rename from Editor/Analytics/IAnalyticsEditorLogger.cs rename to Editor/Core/Scripts/Analytics/IAnalyticsEditorLogger.cs diff --git a/Editor/Analytics/IAnalyticsEditorLogger.cs.meta b/Editor/Core/Scripts/Analytics/IAnalyticsEditorLogger.cs.meta similarity index 100% rename from Editor/Analytics/IAnalyticsEditorLogger.cs.meta rename to Editor/Core/Scripts/Analytics/IAnalyticsEditorLogger.cs.meta diff --git a/Editor/Core/Scripts/Extensions.meta b/Editor/Core/Scripts/Extensions.meta new file mode 100644 index 00000000..9f93ab5d --- /dev/null +++ b/Editor/Core/Scripts/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 56a89e876009bc043b3211c63f594371 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Core/Scripts/Extensions/StringExtensions.cs b/Editor/Core/Scripts/Extensions/StringExtensions.cs new file mode 100644 index 00000000..3c7b734a --- /dev/null +++ b/Editor/Core/Scripts/Extensions/StringExtensions.cs @@ -0,0 +1,16 @@ +using System; +using System.Text.RegularExpressions; + +namespace ReadyPlayerMe.Core.Editor +{ + public static class StringExtensions + { + private const string SHORT_CODE_REGEX = "^[A-Z0-9]{6}$"; + + public static bool IsUrlShortcodeValid(this string urlString) + { + return !string.IsNullOrEmpty(urlString) && + (Regex.Match(urlString, SHORT_CODE_REGEX).Length > 0 || Uri.IsWellFormedUriString(urlString, UriKind.Absolute) && urlString.EndsWith(".glb")); + } + } +} diff --git a/Editor/Utils/EditorUtilities.cs.meta b/Editor/Core/Scripts/Extensions/StringExtensions.cs.meta similarity index 100% rename from Editor/Utils/EditorUtilities.cs.meta rename to Editor/Core/Scripts/Extensions/StringExtensions.cs.meta diff --git a/Editor/Module Management.meta b/Editor/Core/Scripts/ModuleManagement.meta similarity index 100% rename from Editor/Module Management.meta rename to Editor/Core/Scripts/ModuleManagement.meta diff --git a/Editor/Utils/EntryPoint.cs b/Editor/Core/Scripts/ModuleManagement/EntryPoint.cs similarity index 89% rename from Editor/Utils/EntryPoint.cs rename to Editor/Core/Scripts/ModuleManagement/EntryPoint.cs index c9a533c3..06cc6426 100644 --- a/Editor/Utils/EntryPoint.cs +++ b/Editor/Core/Scripts/ModuleManagement/EntryPoint.cs @@ -37,6 +37,12 @@ private static void Update() AnalyticsEditorLogger.EventLogger.LogOpenProject(); AnalyticsEditorLogger.EventLogger.IdentifyUser(); Startup?.Invoke(); + EditorApplication.quitting += OnQuit; + } + + private static void OnQuit() + { + AnalyticsEditorLogger.EventLogger.LogCloseProject(); } } } diff --git a/Editor/Utils/EntryPoint.cs.meta b/Editor/Core/Scripts/ModuleManagement/EntryPoint.cs.meta similarity index 100% rename from Editor/Utils/EntryPoint.cs.meta rename to Editor/Core/Scripts/ModuleManagement/EntryPoint.cs.meta diff --git a/Editor/Module Management/ModuleInfo.cs b/Editor/Core/Scripts/ModuleManagement/ModuleInfo.cs similarity index 100% rename from Editor/Module Management/ModuleInfo.cs rename to Editor/Core/Scripts/ModuleManagement/ModuleInfo.cs diff --git a/Editor/Module Management/ModuleInfo.cs.meta b/Editor/Core/Scripts/ModuleManagement/ModuleInfo.cs.meta similarity index 100% rename from Editor/Module Management/ModuleInfo.cs.meta rename to Editor/Core/Scripts/ModuleManagement/ModuleInfo.cs.meta diff --git a/Editor/Module Management/ModuleInstaller.cs b/Editor/Core/Scripts/ModuleManagement/ModuleInstaller.cs similarity index 88% rename from Editor/Module Management/ModuleInstaller.cs rename to Editor/Core/Scripts/ModuleManagement/ModuleInstaller.cs index f894ea0b..def4b57a 100644 --- a/Editor/Module Management/ModuleInstaller.cs +++ b/Editor/Core/Scripts/ModuleManagement/ModuleInstaller.cs @@ -22,8 +22,6 @@ public static class ModuleInstaller private const int THREAD_SLEEP_TIME = 100; private const string PROGRESS_BAR_TITLE = "Ready Player Me"; - private const string GLTFAST_NAME = "com.atteneder.gltfast"; - private const string WEBVIEW_NAME = "webview"; private const string MODULE_INSTALLATION_SUCCESS_MESSAGE = "All the modules are installed successfully. Ready Player Me avatar system is ready to use."; @@ -33,30 +31,18 @@ public static class ModuleInstaller private const float TIMEOUT_FOR_MODULE_INSTALLATION = 20f; - private static bool modulesInstalled; - static ModuleInstaller() { Events.registeringPackages -= OnRegisteringPackages; Events.registeringPackages += OnRegisteringPackages; -# if RPM_DEVELOPMENT - modulesInstalled = true; -#endif - if (!modulesInstalled) - { - InstallModules(); - EditorApplication.delayCall += DelayCreateCoreSettings; - } - -#if !GLTFAST - if (IsModuleInstalled(GLTFAST_NAME)) - { - DefineSymbolHelper.AddSymbols(); - } -#endif +#if !READY_PLAYER_ME + InstallModules(); + EditorApplication.delayCall += DelayCreateCoreSettings; + DefineSymbolHelper.AddSymbols(); +#endif } - + /// /// Called when a package is about to be added, removed or changed. /// @@ -75,6 +61,7 @@ private static void DelayCreateCoreSettings() { EditorApplication.delayCall -= DelayCreateCoreSettings; CoreSettingsLoader.EnsureSettingsExist(); + } /// @@ -85,8 +72,7 @@ private static void InstallModules() EditorUtility.DisplayProgressBar(PROGRESS_BAR_TITLE, INSTALLING_MODULES, 0); Thread.Sleep(THREAD_SLEEP_TIME); - ModuleInfo[] missingModules = GetMissingModuleNames(); - + var missingModules = GetMissingModuleNames(); if (missingModules.Length > 0) { var installedModuleCount = 0f; @@ -102,7 +88,6 @@ private static void InstallModules() Thread.Sleep(THREAD_SLEEP_TIME); } EditorUtility.ClearProgressBar(); - modulesInstalled = true; } /// @@ -134,11 +119,6 @@ private static ModuleInfo[] GetMissingModuleNames() { PackageInfo[] installed = GetPackageList(); var missingModules = ModuleList.Modules.Where(m => installed.All(i => m.name != i.name)).ToList(); - - if(!missingModules.Any(module => module.name.Contains(GLTFAST_NAME))) - { - missingModules = missingModules.Where(module => !module.name.Contains(WEBVIEW_NAME)).ToList(); - } return missingModules.ToArray(); } diff --git a/Editor/Module Management/ModuleInstaller.cs.meta b/Editor/Core/Scripts/ModuleManagement/ModuleInstaller.cs.meta similarity index 100% rename from Editor/Module Management/ModuleInstaller.cs.meta rename to Editor/Core/Scripts/ModuleManagement/ModuleInstaller.cs.meta diff --git a/Editor/Module Management/ModuleList.cs b/Editor/Core/Scripts/ModuleManagement/ModuleList.cs similarity index 87% rename from Editor/Module Management/ModuleList.cs rename to Editor/Core/Scripts/ModuleManagement/ModuleList.cs index 94861f26..32f999bd 100644 --- a/Editor/Module Management/ModuleList.cs +++ b/Editor/Core/Scripts/ModuleManagement/ModuleList.cs @@ -14,7 +14,7 @@ public static class ModuleList name = "com.readyplayerme.core", gitUrl = "https://github.com/readyplayerme/rpm-unity-sdk-core.git", branch = "", - version = "4.1.0" + version = "5.0.0" }; /// @@ -22,19 +22,12 @@ public static class ModuleList /// public static readonly ModuleInfo[] Modules = { - new ModuleInfo - { - name = "com.atteneder.gltfast", - gitUrl = "https://github.com/atteneder/glTFast.git", - branch = "v5.0.0", - version = "5.0.0" - }, new ModuleInfo { name = "com.readyplayerme.webview", gitUrl = "https://github.com/readyplayerme/rpm-unity-sdk-webview.git", branch = "", - version = "2.0.0" + version = "2.1.3" } }; @@ -45,8 +38,8 @@ public static class ModuleList { name = "com.atteneder.draco", gitUrl = "https://github.com/atteneder/DracoUnity.git", - branch = "v4.0.2", - version = "4.0.2" + branch = "", + version = "4.1.0" }; /// diff --git a/Editor/Module Management/ModuleList.cs.meta b/Editor/Core/Scripts/ModuleManagement/ModuleList.cs.meta similarity index 100% rename from Editor/Module Management/ModuleList.cs.meta rename to Editor/Core/Scripts/ModuleManagement/ModuleList.cs.meta diff --git a/Editor/Module Management/ModuleUpdater.cs b/Editor/Core/Scripts/ModuleManagement/ModuleUpdater.cs similarity index 99% rename from Editor/Module Management/ModuleUpdater.cs rename to Editor/Core/Scripts/ModuleManagement/ModuleUpdater.cs index c07dd967..277ec207 100644 --- a/Editor/Module Management/ModuleUpdater.cs +++ b/Editor/Core/Scripts/ModuleManagement/ModuleUpdater.cs @@ -51,7 +51,7 @@ static ModuleUpdater() /// /// Check for Ready Player Me package updates. /// - [MenuItem("Ready Player Me/Check For Updates", priority = 23)] + [MenuItem("Tools/Ready Player Me/Check For Updates", priority = 23)] public static void CheckForUpdates() { AnalyticsEditorLogger.EventLogger.LogCheckForUpdates(); diff --git a/Editor/Module Management/ModuleUpdater.cs.meta b/Editor/Core/Scripts/ModuleManagement/ModuleUpdater.cs.meta similarity index 100% rename from Editor/Module Management/ModuleUpdater.cs.meta rename to Editor/Core/Scripts/ModuleManagement/ModuleUpdater.cs.meta diff --git a/Editor/Utils/PackageManager.meta b/Editor/Core/Scripts/PackageManager.meta similarity index 100% rename from Editor/Utils/PackageManager.meta rename to Editor/Core/Scripts/PackageManager.meta diff --git a/Editor/Utils/PackageManager/PackageManagerEventListener.cs b/Editor/Core/Scripts/PackageManager/PackageManagerEventListener.cs similarity index 100% rename from Editor/Utils/PackageManager/PackageManagerEventListener.cs rename to Editor/Core/Scripts/PackageManager/PackageManagerEventListener.cs diff --git a/Editor/Utils/PackageManager/PackageManagerEventListener.cs.meta b/Editor/Core/Scripts/PackageManager/PackageManagerEventListener.cs.meta similarity index 100% rename from Editor/Utils/PackageManager/PackageManagerEventListener.cs.meta rename to Editor/Core/Scripts/PackageManager/PackageManagerEventListener.cs.meta diff --git a/Editor/Utils/PackageManager/PackageManagerHelper.cs b/Editor/Core/Scripts/PackageManager/PackageManagerHelper.cs similarity index 100% rename from Editor/Utils/PackageManager/PackageManagerHelper.cs rename to Editor/Core/Scripts/PackageManager/PackageManagerHelper.cs diff --git a/Editor/Utils/PackageManager/PackageManagerHelper.cs.meta b/Editor/Core/Scripts/PackageManager/PackageManagerHelper.cs.meta similarity index 100% rename from Editor/Utils/PackageManager/PackageManagerHelper.cs.meta rename to Editor/Core/Scripts/PackageManager/PackageManagerHelper.cs.meta diff --git a/Editor/Core/Scripts/Processors.meta b/Editor/Core/Scripts/Processors.meta new file mode 100644 index 00000000..3ed49b0f --- /dev/null +++ b/Editor/Core/Scripts/Processors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dc95a31f3c977d74d95cba569605dbf1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/BuildPostProcessor.cs b/Editor/Core/Scripts/Processors/BuildPostProcessor.cs similarity index 100% rename from Editor/BuildPostProcessor.cs rename to Editor/Core/Scripts/Processors/BuildPostProcessor.cs diff --git a/Editor/BuildPostProcessor.cs.meta b/Editor/Core/Scripts/Processors/BuildPostProcessor.cs.meta similarity index 100% rename from Editor/BuildPostProcessor.cs.meta rename to Editor/Core/Scripts/Processors/BuildPostProcessor.cs.meta diff --git a/Editor/BuildPreprocessor.cs b/Editor/Core/Scripts/Processors/BuildPreprocessor.cs similarity index 90% rename from Editor/BuildPreprocessor.cs rename to Editor/Core/Scripts/Processors/BuildPreprocessor.cs index 27329de5..d4d06a6b 100644 --- a/Editor/BuildPreprocessor.cs +++ b/Editor/Core/Scripts/Processors/BuildPreprocessor.cs @@ -19,7 +19,7 @@ public class BuildPreprocessor : IPreprocessBuildWithReport public void OnPreprocessBuild(BuildReport report) { - if (!Application.isBatchMode && ShaderVariantHelper.IsMissingVariants()) + if (!Application.isBatchMode && GraphicsSettingsUtility.IsMissingVariants()) { var addShaderVariants = EditorUtility.DisplayDialog(BUILD_WARNING, SUBDOMAIN_WARNING, @@ -28,7 +28,7 @@ public void OnPreprocessBuild(BuildReport report) if (addShaderVariants) { - ShaderVariantHelper.AddPreloadShaderVariants(); + GraphicsSettingsUtility.AddPreloadShaderVariants(); } else { diff --git a/Editor/BuildPreprocessor.cs.meta b/Editor/Core/Scripts/Processors/BuildPreprocessor.cs.meta similarity index 100% rename from Editor/BuildPreprocessor.cs.meta rename to Editor/Core/Scripts/Processors/BuildPreprocessor.cs.meta diff --git a/Editor/Postprocessor.cs b/Editor/Core/Scripts/Processors/ModelAssetProcessor.cs similarity index 93% rename from Editor/Postprocessor.cs rename to Editor/Core/Scripts/Processors/ModelAssetProcessor.cs index b30ed33b..1fd4c6dd 100644 --- a/Editor/Postprocessor.cs +++ b/Editor/Core/Scripts/Processors/ModelAssetProcessor.cs @@ -2,7 +2,7 @@ namespace ReadyPlayerMe.Core.Editor { - public class Postprocessor : AssetPostprocessor + public class ModelAssetProcessor : AssetPostprocessor { private const string ANIMATION_ASSET_PATH = "Assets/Ready Player Me/Animations"; diff --git a/Editor/Postprocessor.cs.meta b/Editor/Core/Scripts/Processors/ModelAssetProcessor.cs.meta similarity index 100% rename from Editor/Postprocessor.cs.meta rename to Editor/Core/Scripts/Processors/ModelAssetProcessor.cs.meta diff --git a/Editor/ReadyPlayerMe.Core.Editor.asmdef b/Editor/Core/Scripts/ReadyPlayerMe.Core.Editor.asmdef similarity index 84% rename from Editor/ReadyPlayerMe.Core.Editor.asmdef rename to Editor/Core/Scripts/ReadyPlayerMe.Core.Editor.asmdef index a58ad14b..5cc3d39a 100644 --- a/Editor/ReadyPlayerMe.Core.Editor.asmdef +++ b/Editor/Core/Scripts/ReadyPlayerMe.Core.Editor.asmdef @@ -2,7 +2,8 @@ "name": "ReadyPlayerMe.Core.Editor", "rootNamespace": "", "references": [ - "ReadyPlayerMe.Core" + "ReadyPlayerMe.Core", + "ReadyPlayerMe.AvatarCreator" ], "includePlatforms": [ "Editor" diff --git a/Editor/ReadyPlayerMe.Core.Editor.asmdef.meta b/Editor/Core/Scripts/ReadyPlayerMe.Core.Editor.asmdef.meta similarity index 100% rename from Editor/ReadyPlayerMe.Core.Editor.asmdef.meta rename to Editor/Core/Scripts/ReadyPlayerMe.Core.Editor.asmdef.meta diff --git a/Samples~/WebGLSample/Ready Player Me/Resources/Settings.meta b/Editor/Core/Scripts/Settings.meta similarity index 77% rename from Samples~/WebGLSample/Ready Player Me/Resources/Settings.meta rename to Editor/Core/Scripts/Settings.meta index 89724065..358776c9 100644 --- a/Samples~/WebGLSample/Ready Player Me/Resources/Settings.meta +++ b/Editor/Core/Scripts/Settings.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0321f22102b7f0c42ae0f300e8e31ecf +guid: 52273617608987047a79eb2417aab281 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Editor/EditorAssetGenerator.cs b/Editor/Core/Scripts/Settings/AvatarLoaderSettingsCreator.cs similarity index 86% rename from Editor/EditorAssetGenerator.cs rename to Editor/Core/Scripts/Settings/AvatarLoaderSettingsCreator.cs index d0bac7f9..c8fb7a9c 100644 --- a/Editor/EditorAssetGenerator.cs +++ b/Editor/Core/Scripts/Settings/AvatarLoaderSettingsCreator.cs @@ -4,17 +4,17 @@ namespace ReadyPlayerMe.Core.Editor { [InitializeOnLoad] - public class EditorAssetGenerator + public class AvatarLoaderSettingsCreator { private const string SETTINGS_SAVE_FOLDER = "Ready Player Me/Resources/Settings"; private const string AVATAR_LOADER_ASSET_NAME = "AvatarLoaderSettings.asset"; - static EditorAssetGenerator() + static AvatarLoaderSettingsCreator() { EditorApplication.delayCall += CreateSettingsAssets; } - ~EditorAssetGenerator() + ~AvatarLoaderSettingsCreator() { EditorApplication.delayCall -= CreateSettingsAssets; } @@ -35,7 +35,7 @@ private static void CreateAvatarLoaderSettings() var newSettings = ScriptableObject.CreateInstance(); newSettings.AvatarConfig = null; newSettings.GLTFDeferAgent = null; - newSettings.AvatarCachingEnabled = DefaultSettings.AvatarCachingEnabled; + newSettings.AvatarCachingEnabled = true; AssetDatabase.CreateAsset(newSettings, $"Assets/{SETTINGS_SAVE_FOLDER}/{AVATAR_LOADER_ASSET_NAME}"); AssetDatabase.SaveAssets(); diff --git a/Editor/EditorAssetGenerator.cs.meta b/Editor/Core/Scripts/Settings/AvatarLoaderSettingsCreator.cs.meta similarity index 100% rename from Editor/EditorAssetGenerator.cs.meta rename to Editor/Core/Scripts/Settings/AvatarLoaderSettingsCreator.cs.meta diff --git a/Editor/Utils/CoreSettingsLoader.cs b/Editor/Core/Scripts/Settings/CoreSettingsLoader.cs similarity index 100% rename from Editor/Utils/CoreSettingsLoader.cs rename to Editor/Core/Scripts/Settings/CoreSettingsLoader.cs diff --git a/Editor/Utils/CoreSettingsLoader.cs.meta b/Editor/Core/Scripts/Settings/CoreSettingsLoader.cs.meta similarity index 100% rename from Editor/Utils/CoreSettingsLoader.cs.meta rename to Editor/Core/Scripts/Settings/CoreSettingsLoader.cs.meta diff --git a/Editor/Utils/CoreSettingsSetter.cs b/Editor/Core/Scripts/Settings/CoreSettingsSetter.cs similarity index 100% rename from Editor/Utils/CoreSettingsSetter.cs rename to Editor/Core/Scripts/Settings/CoreSettingsSetter.cs diff --git a/Editor/Utils/CoreSettingsSetter.cs.meta b/Editor/Core/Scripts/Settings/CoreSettingsSetter.cs.meta similarity index 100% rename from Editor/Utils/CoreSettingsSetter.cs.meta rename to Editor/Core/Scripts/Settings/CoreSettingsSetter.cs.meta diff --git a/Editor/ShaderVariantHelper.cs b/Editor/Core/Scripts/Settings/GraphicsSettingsUtility.cs similarity index 81% rename from Editor/ShaderVariantHelper.cs rename to Editor/Core/Scripts/Settings/GraphicsSettingsUtility.cs index 4e474a55..c9bc84c7 100644 --- a/Editor/ShaderVariantHelper.cs +++ b/Editor/Core/Scripts/Settings/GraphicsSettingsUtility.cs @@ -1,3 +1,4 @@ +using System.IO; using UnityEditor; using UnityEngine; using UnityEngine.Rendering; @@ -5,17 +6,14 @@ namespace ReadyPlayerMe.Core.Editor { public enum RenderPipeline { Standard, URP, HDRP } - public static class ShaderVariantHelper + public static class GraphicsSettingsUtility { - private const string TAG = nameof(ShaderVariantHelper); + private const string TAG = nameof(GraphicsSettingsUtility); private const string PRELOADED_SHADER_PROPERTY = "m_PreloadedShaders"; private const string GRAPHICS_SETTING_PATH = "ProjectSettings/GraphicsSettings.asset"; -#if RPM_DEVELOPMENT - private const string SHADER_VARIANT_FOLDER = "Assets/Ready Player Me/Core/Shaders"; -#else - private const string SHADER_VARIANT_FOLDER = "Packages/com.readyplayerme.core/Shaders"; -#endif + private const string SHADER_VARIANT_ASSETS_FOLDER = "Assets/Ready Player Me/Core/Runtime/Core/Shaders"; + private const string SHADER_VARIANT_PACKAGES_FOLDER = "Packages/com.readyplayerme.core/Runtime/Core/Shaders"; private const string SHADER_VARIANTS_STANDARD = "glTFastShaderVariants"; private const string SHADER_VARIANTS_URP = "glTFastShaderVariantsURP"; @@ -30,12 +28,10 @@ public static class ShaderVariantHelper [InitializeOnLoadMethod] private static void InitializeOnLoad() { -#if GLTFAST if (SessionState.GetBool(SHADER_SESSION_CHECK, false)) return; SessionState.SetBool(SHADER_SESSION_CHECK, true); EditorApplication.update += CheckAndUpdatePreloadShaders; -#endif } private static void CheckAndUpdatePreloadShaders() @@ -53,6 +49,11 @@ public static void AddPreloadShaderVariants(bool checkForMissingVariants = false var newArrayIndex = shaderPreloadArray.arraySize; var shaderVariants = AssetDatabase.LoadAssetAtPath(GetTargetShaderPath()); + if (shaderVariants == null) + { + Debug.LogWarning($"Shader variants not found at {GetTargetShaderPath()}"); + return; + } if (checkForMissingVariants) { var shadersMissing = true; @@ -70,7 +71,6 @@ public static void AddPreloadShaderVariants(bool checkForMissingVariants = false if (!shadersMissing) return; } - shaderPreloadArray.InsertArrayElementAtIndex(newArrayIndex); SerializedProperty shaderInArray = shaderPreloadArray.GetArrayElementAtIndex(newArrayIndex); shaderInArray.objectReferenceValue = shaderVariants; @@ -79,7 +79,6 @@ public static void AddPreloadShaderVariants(bool checkForMissingVariants = false AssetDatabase.SaveAssets(); } - public static bool IsMissingVariants() { var graphicsSettings = AssetDatabase.LoadAssetAtPath(GRAPHICS_SETTING_PATH); @@ -106,15 +105,17 @@ public static bool IsMissingVariants() private static string GetTargetShaderPath() { - switch (GetCurrentRenderPipeline()) + var shaderFolderPath = SHADER_VARIANT_PACKAGES_FOLDER; + if (!Directory.Exists(shaderFolderPath)) { - case RenderPipeline.URP: - return $"{SHADER_VARIANT_FOLDER}/{SHADER_VARIANTS_URP}{SHADER_VARIANTS_EXTENSION}"; - case RenderPipeline.HDRP: - return $"{SHADER_VARIANT_FOLDER}/{SHADER_VARIANTS_HDRP}{SHADER_VARIANTS_EXTENSION}"; - default: - return $"{SHADER_VARIANT_FOLDER}/{SHADER_VARIANTS_STANDARD}{SHADER_VARIANTS_EXTENSION}"; + shaderFolderPath = SHADER_VARIANT_ASSETS_FOLDER; } + return GetCurrentRenderPipeline() switch + { + RenderPipeline.URP => $"{shaderFolderPath}/{SHADER_VARIANTS_URP}{SHADER_VARIANTS_EXTENSION}", + RenderPipeline.HDRP => $"{shaderFolderPath}/{SHADER_VARIANTS_HDRP}{SHADER_VARIANTS_EXTENSION}", + _ => $"{shaderFolderPath}/{SHADER_VARIANTS_STANDARD}{SHADER_VARIANTS_EXTENSION}" + }; } private static RenderPipeline GetCurrentRenderPipeline() diff --git a/Editor/ShaderVariantHelper.cs.meta b/Editor/Core/Scripts/Settings/GraphicsSettingsUtility.cs.meta similarity index 100% rename from Editor/ShaderVariantHelper.cs.meta rename to Editor/Core/Scripts/Settings/GraphicsSettingsUtility.cs.meta diff --git a/Editor/UI.meta b/Editor/Core/Scripts/UI.meta similarity index 100% rename from Editor/UI.meta rename to Editor/Core/Scripts/UI.meta diff --git a/Editor/Core/Scripts/UI/CustomEditors.meta b/Editor/Core/Scripts/UI/CustomEditors.meta new file mode 100644 index 00000000..af9a6723 --- /dev/null +++ b/Editor/Core/Scripts/UI/CustomEditors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 669755add08ba044d9ffb4e764476d9d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Core/Scripts/UI/CustomEditors/AvatarConfigEditor.cs b/Editor/Core/Scripts/UI/CustomEditors/AvatarConfigEditor.cs new file mode 100644 index 00000000..464b9428 --- /dev/null +++ b/Editor/Core/Scripts/UI/CustomEditors/AvatarConfigEditor.cs @@ -0,0 +1,381 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEditor.UIElements; +using UnityEngine; +using UnityEngine.UIElements; + +namespace ReadyPlayerMe.Core.Editor +{ + [CustomEditor(typeof(AvatarConfig))] + public class AvatarConfigEditor : UnityEditor.Editor + { + private const string DIALOG_TITLE = "Read Player Me"; + private const string DIALOG_MESSAGE = "Do you want to install {0} Unity Package: {1} ?"; + private const string DIALOG_OK = "Ok"; + private const string DIALOG_CANCEL = "Cancel"; + private const string ADD_MORPH_TARGET = "Add Morph Target"; + private const string DELETE_MORPH_TARGET = "Delete Morph Target"; + private const string REMOVE_BUTTON_TEXT = "Remove"; + private const string MESH_OPT_PACKAGE_NAME = "com.unity.meshopt.decompress"; + + [SerializeField] private VisualTreeAsset visualTreeAsset; + + private AvatarConfig avatarConfigTarget; + private List