Skip to content

Commit

Permalink
Merge branch 'release/v3.4.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rYuuk authored Oct 24, 2023
2 parents 7a4fd34 + 93584e5 commit 92c84cd
Show file tree
Hide file tree
Showing 23 changed files with 241 additions and 193 deletions.
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
# the repo. Unless a later match takes precedence,
# @HarrisonHough, @rYuuk will be requested for
# review when someone opens a pull request.
* @HarrisonHough @rYuuk

* @readyplayerme/onboarding-integrations
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
testMode:
- editmode
unityVersion:
- 2020.3.0f1
- 2020.3.16f1
steps:
- name: Checkout empty unity project repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- playmode
- editmode
unityVersion:
- 2020.3.0f1
- 2020.3.16f1
steps:
- name: Checkout Unity-SDK Repository
uses: actions/checkout@v3
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ sysinfo.txt
# Crashlytics generated file
crashlytics-build.properties


.idea/

# Samples meta files
**/Samples~.meta
**/Samples.meta
23 changes: 16 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.3.0] - 2023.20.05
## [3.4.0] - 2023.10.24

### Added
- breaking change popup @ryuuk in [#136](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/136)

### Updated
- disable use demo toggle in setup guide [#131](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/131)
- refactor define symbol add and remove logic [#133](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/133)

## [3.3.0] - 2023.10.05

### Added
- moved core iframe and url logic from WebView package @harrisonhough in [#125](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/125)
Expand Down Expand Up @@ -95,7 +104,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- discussion link to README.md

### Updated
- OpenUPM installation added to README.md
- openUPM installation added to README.md

## [1.0.0] - 2023.02.20

Expand All @@ -104,7 +113,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- don't ask again option for update check

### Updated
- PartnerSubdomainSettings refactored to a CoreSettings scriptable object
- partnerSubdomainSettings refactored to a CoreSettings scriptable object

### Fixed
- core settings asset now automatically created if it is missing
Expand All @@ -116,10 +125,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- optional sdk logging

### Updated
- PartnerSubdomainSettings refactored to a CoreSettings scriptable object
- partnerSubdomainSettings refactored to a CoreSettings scriptable object

### Fixed
- Various bug fixes and improvements
- various bug fixes and improvements

## [0.1.0] - 2023.01.22

Expand All @@ -134,7 +143,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- module installer and updater for handling package installation

### Updated
- A big refactor of code and classes
- a big refactor of code and classes

### Fixed
- Various bug fixes and improvements
- various bug fixes and improvements
56 changes: 18 additions & 38 deletions Editor/Module Management/ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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_SYMBOL = "GLTFAST";
private const string READY_PLAYER_ME_SYMBOL = "READY_PLAYER_ME";
private const string GLTFAST_NAME = "com.atteneder.gltfast";
private const string WEBVIEW_NAME = "webview";

Expand All @@ -39,6 +37,8 @@ public static class ModuleInstaller

static ModuleInstaller()
{
Events.registeringPackages -= OnRegisteringPackages;
Events.registeringPackages += OnRegisteringPackages;
# if RPM_DEVELOPMENT
modulesInstalled = true;
#endif
Expand All @@ -47,16 +47,29 @@ static ModuleInstaller()
InstallModules();
EditorApplication.delayCall += DelayCreateCoreSettings;
}

#if !GLTFAST
if (IsModuleInstalled(GLTFAST_NAME))
{
AddGltfastSymbol();
AddScriptingDefineSymbolToAllBuildTargetGroups(READY_PLAYER_ME_SYMBOL);
DefineSymbolHelper.AddSymbols();
}
#endif

}

/// <summary>
/// Called when a package is about to be added, removed or changed.
/// </summary>
/// <param name="args">Describes the <c>PackageInfo</c> entries of packages currently registering.</param>
private static void OnRegisteringPackages(PackageRegistrationEventArgs args)
{
// Core module uninstalled
if (args.removed != null && args.removed.Any(p => p.name == ModuleList.Core.name))
{
DefineSymbolHelper.RemoveSymbols();
ProjectPrefs.SetBool(ProjectPrefs.FIRST_TIME_SETUP_DONE, false);
}
}

private static void DelayCreateCoreSettings()
{
Expand Down Expand Up @@ -158,39 +171,6 @@ public static PackageInfo[] GetPackageList()
return listRequest.Result.ToArray();
}

public static void AddGltfastSymbol()
{
AddScriptingDefineSymbolToAllBuildTargetGroups(GLTFAST_SYMBOL);
}

private static void AddScriptingDefineSymbolToAllBuildTargetGroups(string defineSymbol)
{
foreach (BuildTarget target in Enum.GetValues(typeof(BuildTarget)))
{
BuildTargetGroup group = BuildPipeline.GetBuildTargetGroup(target);

if (group == BuildTargetGroup.Unknown)
{
continue;
}

List<string> defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';').Select(d => d.Trim()).ToList();

if (defineSymbols.Contains(defineSymbol)) continue;
defineSymbols.Add(defineSymbol);
try
{
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, string.Join(";", defineSymbols.ToArray()));
}
catch (Exception e)
{
Debug.LogWarning("Could not set RPM " + defineSymbol + " defines for build target: " + target + " group: " + group + " " + e);
}
}

CompilationPipeline.RequestScriptCompilation();
}

/// <summary>
/// Check all modules installed successfully
/// </summary>
Expand Down
25 changes: 20 additions & 5 deletions Editor/Module Management/ModuleUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private class Release

private const string AVATAR_LOADER_PACKAGE = "com.readyplayerme.avatarloader";


static ModuleUpdater()
{
EntryPoint.Startup += () => Check(true);
Expand All @@ -52,7 +51,7 @@ static ModuleUpdater()
/// <summary>
/// Check for Ready Player Me package updates.
/// </summary>
[MenuItem("Ready Player Me/Check For Updates")]
[MenuItem("Ready Player Me/Check For Updates", priority = 23)]
public static void CheckForUpdates()
{
AnalyticsEditorLogger.EventLogger.LogCheckForUpdates();
Expand Down Expand Up @@ -81,7 +80,6 @@ private static void Check(bool isStartup = false)
.Split(new[] { ".git" }, StringSplitOptions.None)[0]
.Replace(GITHUB_WEBSITE, GITHUB_API_URL) + "/releases";


var packageUrl = repoUrl.Split('#')[0];

// Experimental or prerelease packages might look like 0.1.0-exp.1, remove after dash to parse with Version
Expand Down Expand Up @@ -149,8 +147,7 @@ private static void DisplayUpdateDialog(string packageName, Version currentVersi
{
// Update
case 0:
packageUrl += "#v" + latestVersion;
UpdateModule(packageName, packageUrl, currentVersion, latestVersion);
CheckIfMajorRelease(packageName, currentVersion, latestVersion, packageUrl);
break;
// Cancel
case 1:
Expand All @@ -163,6 +160,23 @@ private static void DisplayUpdateDialog(string packageName, Version currentVersi
}
}

private static void CheckIfMajorRelease(string packageName, Version currentVersion, Version latestVersion,
string packageUrl)
{
if (latestVersion.Major > currentVersion.Major)
{
BreakingChangeDialog.ShowDialog(() =>
{
UpdateModule(packageName, packageUrl, currentVersion, latestVersion);
});

}
else
{
UpdateModule(packageName, packageUrl, currentVersion, latestVersion);
}
}

/// <summary>
/// Update the specified module by removing the current version and then adding the specified version.
/// </summary>
Expand All @@ -172,6 +186,7 @@ private static void DisplayUpdateDialog(string packageName, Version currentVersi
/// <param name="latest">The new version of the package.</param>
private static void UpdateModule(string name, string url, Version current, Version latest)
{
url += "#v" + latest;
CleanRedundantAvatarLoader();
RemoveRequest removeRequest = Client.Remove(name);
while (!removeRequest.IsCompleted) Thread.Sleep(MILLISECONDS_TIMEOUT);
Expand Down

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

47 changes: 47 additions & 0 deletions Editor/UI/BreakingChangeDialog/BreakingChangeDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

namespace ReadyPlayerMe.Core.Editor
{
public class BreakingChangeDialog : EditorWindow
{
private const string MIGRATION_GUIDE_URL = "https://docs.readyplayer.me/ready-player-me/integration-guides/unity/troubleshooting/updating-from-earlier-versions";
private const string TITLE = "Update Packages";

[SerializeField] private VisualTreeAsset visualTreeAsset;

private static Action updateClicked;

public static void ShowDialog(Action onUpdate)
{
updateClicked = onUpdate;

var window = GetWindow<BreakingChangeDialog>();
window.titleContent = new GUIContent(TITLE);
window.minSize = new Vector2(500, 140);
window.maxSize = new Vector2(500, 140);
window.ShowModalUtility();
}

public void CreateGUI()
{
visualTreeAsset.CloneTree(rootVisualElement);

var migrationLink = rootVisualElement.Q<Label>("MigrationLink");
migrationLink.RegisterCallback<MouseUpEvent>(x =>
{
Application.OpenURL(MIGRATION_GUIDE_URL);
});

rootVisualElement.Q<Button>("UpdateButton").clicked += () =>
{
updateClicked?.Invoke();
Close();
};

rootVisualElement.Q<Button>("CancelButton").clicked += Close;
}
}
}
14 changes: 14 additions & 0 deletions Editor/UI/BreakingChangeDialog/BreakingChangeDialog.cs.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/UI/BreakingChangeDialog/BreakingChangeDialog.uxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<Style src="../EditorWindows/CommonStyle.uss" />
<ui:VisualElement style="flex-direction: row; align-items: stretch; justify-content: flex-start; margin-left: 20px; margin-right: 20px; margin-top: 20px; margin-bottom: 20px; flex-shrink: 0;">
<ui:VisualElement name="IconContainer" style="width: 60px; height: 60px; flex-direction: row; align-items: center; justify-content: center; background-color: rgb(0, 0, 0);">
<ui:VisualElement name="Icon" style="background-image: resource(&apos;rpm_logo&apos;); width: 50px; height: 50px; flex-direction: row; flex-shrink: 0; -unity-background-scale-mode: scale-to-fit; background-color: rgba(0, 0, 0, 0);" />
</ui:VisualElement>
<ui:VisualElement name="Description" style="align-items: flex-start; justify-content: center; margin-left: 10px; flex-shrink: 0;">
<ui:Label text="This is a breaking change! Do you still want to update? " name="Text" style="margin-top: 0; margin-right: 0; margin-left: 0; margin-bottom: 0; white-space: normal; -unity-text-align: middle-left;" />
<ui:Label text="Link to Migration Guide" name="MigrationLink" class="link" style="margin-top: 5px; margin-right: 0; margin-left: 0; margin-bottom: 0; white-space: normal; -unity-text-align: middle-left; color: rgb(0, 104, 255);" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="Buttons" style="flex-direction: row-reverse; padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; flex-shrink: 0; height: 44px;">
<ui:Button text="Cancel" display-tooltip-when-elided="true" name="CancelButton" />
<ui:Button text="Update" display-tooltip-when-elided="true" name="UpdateButton" style="white-space: nowrap;" />
</ui:VisualElement>
</ui:UXML>
10 changes: 10 additions & 0 deletions Editor/UI/BreakingChangeDialog/BreakingChangeDialog.uxml.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 @@ -25,11 +25,11 @@ public class AvatarLoaderEditor : EditorWindow
private bool useEyeAnimations;
private bool useVoiceToAnim;

[MenuItem("Ready Player Me/Avatar Loader", priority = 0)]
[MenuItem("Ready Player Me/Avatar Loader", priority = 1)]
public static void ShowWindow()
{
#if !GLTFAST
ModuleInstaller.AddGltfastSymbol();
DefineSymbolHelper.AddSymbols();
#endif
var window = GetWindow<AvatarLoaderEditor>();
window.titleContent = new GUIContent(AVATAR_LOADER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class IntegrationGuide : EditorWindow

[SerializeField] private VisualTreeAsset visualTreeAsset;

[MenuItem("Ready Player Me/Integration Guide")]
[MenuItem("Ready Player Me/Integration Guide", priority = 12)]
public static void ShowWindow()
{
var window = GetWindow<IntegrationGuide>();
Expand Down
2 changes: 1 addition & 1 deletion Editor/UI/EditorWindows/SetupGuide/SetupGuide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class SetupGuide : EditorWindow
private Button finishSetupButton;
private Button openQuickStartButton;

[MenuItem("Ready Player Me/Setup Guide")]
[MenuItem("Ready Player Me/Setup Guide", priority = 12)]
public static void ShowWindow()
{
var window = GetWindow<SetupGuide>();
Expand Down
2 changes: 1 addition & 1 deletion Editor/UI/EditorWindows/SetupGuide/SetupGuide.uxml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ui:Label tabindex="-1" text="(https://studio.readyplayer.me)" display-tooltip-when-elided="true" name="StudioUrl" class="link" style="margin-left: 15px; margin-right: 15px; white-space: normal; margin-top: 0; color: rgb(0, 104, 255);" />
</ui:VisualElement>
<ReadyPlayerMe.Core.Editor.SubdomainTemplate class="SubdomainTemplate" style="margin-top: 15px; flex-shrink: 0;" />
<ui:Toggle label="I don&apos;t have an account. Use demo subdomain instead." name="UseDemoSubdomainToggle" style="margin-left: 15px; margin-right: 15px; flex-direction: row-reverse; align-items: center; justify-content: space-between; align-self: flex-start; margin-top: 15px; margin-bottom: 15px;" />
<ui:Toggle label="I don&apos;t have an account. Use demo subdomain instead." name="UseDemoSubdomainToggle" style="margin-left: 15px; margin-right: 15px; flex-direction: row-reverse; align-items: center; justify-content: space-between; align-self: flex-start; margin-top: 15px; margin-bottom: 15px; display: none;" />
</ui:VisualElement>
<ui:VisualElement name="AnalyticsPanel" style="flex-grow: 0; background-color: rgba(0, 0, 0, 0); margin-top: 0; height: 230px; flex-shrink: 0; display: flex; width: 500px;">
<ui:VisualElement name="Heading" class="heading" style="flex-grow: 0; background-color: rgba(0, 0, 0, 0);">
Expand Down
Binary file removed Editor/UI/Visuals/rpm_editor_window_banner.png
Binary file not shown.
Loading

0 comments on commit 92c84cd

Please sign in to comment.