-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from didimoinc/release/4.0.1
Release/4.0.1
- Loading branch information
Showing
2,107 changed files
with
75,672 additions
and
2,822,434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,91 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using JetBrains.Annotations; | ||
using Unity.EditorCoroutines.Editor; | ||
using UnityEditor; | ||
using UnityEditor.PackageManager; | ||
using UnityEditor.PackageManager.Requests; | ||
using UnityEditor.PackageManager.UI; | ||
using UnityEngine; | ||
using UnityEngine.SceneManagement; | ||
using PackageInfo = UnityEditor.PackageManager.PackageInfo; | ||
|
||
namespace Didimo.Core.Editor | ||
{ | ||
public static class PackageUtility | ||
{ | ||
public static async Task ImportSampleAndLoadScene(string packageName, string sampleName, string scenePath, [CanBeNull] Action<bool> onCompletion = null) | ||
public static async Task<Sample?> GetSample(string packageName, string sampleName) | ||
{ | ||
try | ||
{ | ||
EditorUtility.DisplayProgressBar("Importing sample...", "Please wait while we import the sample", 0); | ||
EditorUtility.DisplayProgressBar("Fetching sample...", "Please wait while we fetch the sample", 0); | ||
ListRequest request = Client.List(); | ||
|
||
while (!request.IsCompleted) await Task.Delay(100); | ||
if (request.Status == StatusCode.Failure) | ||
{ | ||
onCompletion?.Invoke(false); | ||
return; | ||
return null; | ||
} | ||
|
||
PackageInfo package = request.Result.First(p => p.name == packageName); | ||
EditorUtility.DisplayProgressBar("Importing sample...", "Please wait while we import the sample", .5f); | ||
|
||
Sample sample = Sample.FindByPackage(package.name, package.version).FirstOrDefault(s => string.IsNullOrEmpty(sampleName) || s.displayName == sampleName); | ||
string importPath = sample.importPath.Replace("\\", "/").Remove(0, Application.dataPath.Length + 1); | ||
sample.Import(); | ||
string path = $"Assets/{importPath}/{scenePath}"; | ||
|
||
SceneAsset obj = AssetDatabase.LoadAssetAtPath(path, typeof(SceneAsset)) as SceneAsset; | ||
Selection.activeObject = obj; | ||
EditorGUIUtility.PingObject(obj); | ||
return sample; | ||
} | ||
finally | ||
{ | ||
EditorUtility.ClearProgressBar(); | ||
} | ||
} | ||
|
||
public static bool ImportSample(Sample sample) | ||
{ | ||
try | ||
{ | ||
EditorUtility.DisplayProgressBar("Importing sample...", "Please wait while we import the sample", 1); | ||
|
||
sample.Import(); | ||
AssetDatabase.Refresh(); | ||
|
||
UnityEditor.SceneManagement.EditorSceneManager.OpenScene(path); | ||
onCompletion?.Invoke(true); | ||
EditorUtility.DisplayProgressBar("Importing sample...", "Please wait while we import the sample", 1); | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.LogException(e); | ||
onCompletion?.Invoke(false); | ||
return false; | ||
} | ||
finally | ||
{ | ||
EditorUtility.ClearProgressBar(); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public static string GetSceneAssetPath(Sample sample, string scenePath) | ||
{ | ||
string importPath = sample.importPath.Replace("\\", "/").Remove(0, Application.dataPath.Length + 1); | ||
return $"Assets/{importPath}/{scenePath}"; | ||
} | ||
|
||
public static bool LoadSceneFromSample(Sample sample, string scenePath) | ||
{ | ||
try | ||
{ | ||
string path = GetSceneAssetPath(sample, scenePath); | ||
|
||
SceneAsset obj = AssetDatabase.LoadAssetAtPath(path, typeof(SceneAsset)) as SceneAsset; | ||
Selection.activeObject = obj; | ||
EditorGUIUtility.PingObject(obj); | ||
|
||
UnityEditor.SceneManagement.EditorSceneManager.OpenScene(path); | ||
return true; | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.LogException(e); | ||
return false; | ||
} | ||
} | ||
} | ||
} |
8 changes: 0 additions & 8 deletions
8
com.didimo.sdk.core/Runtime/Content/Fullbody/Hairs/didimo_yx413530azacfvozxu_hairs.meta
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...o.sdk.core/Runtime/Content/Fullbody/Hairs/didimo_yx413530azacfvozxu_hairs/BaseballHat.mtl
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
....core/Runtime/Content/Fullbody/Hairs/didimo_yx413530azacfvozxu_hairs/BaseballHat.mtl.meta
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.