Skip to content

Commit

Permalink
Merge branch 'feature/structure-review' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonHough committed Dec 22, 2023
2 parents 5a8164c + f9c70c6 commit 714e580
Show file tree
Hide file tree
Showing 440 changed files with 307 additions and 209 deletions.

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEditor;
using UnityEngine;

namespace ReadyPlayerMe.AvatarCreator
namespace ReadyPlayerMe.AvatarCreator.Editor
{
[CustomPropertyDrawer(typeof(AssetTypeFilterAttribute))]
public class AssetTypeFilterDrawer : PropertyDrawer
Expand All @@ -27,14 +27,14 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
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());

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());

Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions Editor/AvatarCreator/ReadyPlayerMe.AvatarCreator.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "ReadyPlayerMe.AvatarCreator.Editor",
"rootNamespace": "",
"references": [
"ReadyPlayerMe.Core",
"ReadyPlayerMe.AvatarCreator"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

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

2 changes: 1 addition & 1 deletion Runtime/Extras.meta → Editor/Core.meta

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

File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
8 changes: 8 additions & 0 deletions Editor/Core/Scripts.meta

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

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions Editor/Core/Scripts/Extensions.meta

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

16 changes: 16 additions & 0 deletions Editor/Core/Scripts/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -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"));
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions Editor/Core/Scripts/Processors.meta

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

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -28,7 +28,7 @@ public void OnPreprocessBuild(BuildReport report)

if (addShaderVariants)
{
ShaderVariantHelper.AddPreloadShaderVariants();
GraphicsSettingsUtility.AddPreloadShaderVariants();
}
else
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"rootNamespace": "",
"references": [
"ReadyPlayerMe.Core",
"ReadyPlayerMe.Core.AvatarCreator"
"ReadyPlayerMe.AvatarCreator"
],
"includePlatforms": [
"Editor"
Expand Down
8 changes: 8 additions & 0 deletions Editor/Core/Scripts/Settings.meta

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

Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -35,7 +35,7 @@ private static void CreateAvatarLoaderSettings()
var newSettings = ScriptableObject.CreateInstance<AvatarLoaderSettings>();
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();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
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";
private const string SHADER_VARIANT_FOLDER = "Assets/Ready Player Me/Core/Runtime/Core/Shaders";
#else
private const string SHADER_VARIANT_FOLDER = "Packages/com.readyplayerme.core/Shaders";
private const string SHADER_VARIANT_FOLDER = "Packages/com.readyplayerme.core/Runtime/Core/Shaders";
#endif

private const string SHADER_VARIANTS_STANDARD = "glTFastShaderVariants";
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions Editor/Core/Scripts/UI/CustomEditors.meta

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

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEditor;

namespace ReadyPlayerMe.Core
namespace ReadyPlayerMe.Core.Editor
{
[CustomEditor(typeof(AvatarData))]
public class AvatarDataEditor : UnityEditor.Editor
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using ReadyPlayerMe.Core;
using UnityEditor;
using UnityEditor;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Core.Editor
{
[CustomEditor(typeof(EyeAnimationHandler))]
public class EyeAnimationHandlerEditor : Editor
public class EyeAnimationHandlerEditor : UnityEditor.Editor
{
private const string BLINK_DURATION = "blinkDuration";
private const string BLINK_INTERVAL = "blinkInterval";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using ReadyPlayerMe.Core;
using UnityEditor;
using UnityEditor;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Core.Editor
{
[CustomEditor(typeof(VoiceHandler))]
public class VoiceHandlerEditor : Editor
public class VoiceHandlerEditor : UnityEditor.Editor
{
private const string AUDIO_CLIP = "AudioClip";
private const string PROPERTY_PATH = "AudioSource";
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private void Completed(object sender, CompletionEventArgs args)
SDKLogger.LogWarning(TAG, "Enable Avatar Caching to generate a prefab in the project folder.");
return;
}
GameObject avatar = EditorUtilities.CreateAvatarPrefab(args.Metadata, path);
var avatar = PrefabHelper.CreateAvatarPrefab(args.Metadata, path);
if (useEyeAnimations) avatar.AddComponent<EyeAnimationHandler>();
if (useVoiceToAnim) avatar.AddComponent<VoiceHandler>();
DestroyImmediate(args.Avatar, true);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public AvatarUrlTemplate()
urlField.RegisterValueChangedCallback(OnValueChanged);

errorLabel = this.Q<Label>(ERROR_LABEL);
errorLabel.visible = !EditorUtilities.IsUrlShortcodeValid(url);
errorLabel.visible = !url.IsUrlShortcodeValid();
errorLabel.RegisterCallback<MouseDownEvent>(_ =>
{
AnalyticsEditorLogger.EventLogger.LogFindOutMore(HelpSubject.LoadingAvatars);
Expand All @@ -54,7 +54,7 @@ public AvatarUrlTemplate()

private void OnValueChanged(ChangeEvent<string> evt)
{
errorLabel.visible = !(!string.IsNullOrEmpty(evt.newValue) && EditorUtilities.IsUrlShortcodeValid(evt.newValue));
errorLabel.visible = !(!string.IsNullOrEmpty(evt.newValue) && evt.newValue.IsUrlShortcodeValid());
EditorPrefs.SetString(URL_SAVE_KEY, evt.newValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private static string ExtractSubdomain(string url)

private bool IsValidSubdomain()
{
return !partnerSubdomain.All(char.IsWhiteSpace) && !partnerSubdomain.Contains('/') && !EditorUtilities.IsUrlShortcodeValid(partnerSubdomain);
return !partnerSubdomain.All(char.IsWhiteSpace) && !partnerSubdomain.Contains('/') && !partnerSubdomain.IsUrlShortcodeValid();
}

private void SaveSubdomain()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace ReadyPlayerMe.Core.Editor
{
public class AnimationExtractor : UnityEditor.Editor
public class FBXAnimationExtractor : UnityEditor.Editor
{
private static string FBX_FILE = ".fbx";
private const string FBX_FILE_SUFFIX = ".fbx";
private const string PREVIEW_ANIM_PREFIX = "__preview__";
private const string ASSET_ANIM_SUFFIX = ".anim";

Expand All @@ -30,7 +30,7 @@ private static string[] ExtractAnimations()
{
return null;
}
return paths.Where(path => path.Contains(FBX_FILE)).ToArray();
return paths.Where(path => path.Contains(FBX_FILE_SUFFIX)).ToArray();
;
}

Expand Down Expand Up @@ -108,11 +108,11 @@ private static void DeleteFbxFiles(string[] animationFilePaths)
[MenuItem("Assets/Extract Animations", true), MenuItem("Assets/Extract Animations and Delete File", true)]
private static bool ExtractAnimationsValidation()
{
Object activeObject = Selection.activeObject;
var activeObject = Selection.activeObject;
if (!activeObject) return false;

var assetPath = AssetDatabase.GetAssetPath(activeObject);
var isFbx = Path.GetExtension(assetPath).ToLower() == FBX_FILE;
var isFbx = Path.GetExtension(assetPath).ToLower() == FBX_FILE_SUFFIX;
var isGameObject = activeObject is GameObject;

return isGameObject && isFbx;
Expand Down
File renamed without changes.
Loading

0 comments on commit 714e580

Please sign in to comment.