Skip to content

Commit 0dc5c37

Browse files
committed
feat: cleanup and improve debug ui
1 parent ffd51c7 commit 0dc5c37

4 files changed

Lines changed: 15 additions & 25 deletions

File tree

Assets/Scripts/GLTF/WearableLoader.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,6 @@ public static async Awaitable<GameObject> LoadGLB(string category, string mainFi
6161

6262
return (mainTexture, maskTexture);
6363

64-
// using var mainTexWebRequest =
65-
// UnityWebRequestTexture.GetTexture(new Uri(string.Format(APIService.API_CATALYST, files[mainFile])),
66-
// true);
67-
//
68-
// await mainTexWebRequest.SendWebRequest();
69-
//
70-
// if (mainTexWebRequest.result != UnityWebRequest.Result.Success)
71-
// {
72-
// Debug.LogError($"Failed to load main texture: {mainTexWebRequest.error}");
73-
// return null;
74-
// }
75-
//
76-
// var mainTexture = DownloadHandlerTexture.GetContent(mainTexWebRequest);
77-
// return texture;
78-
7964
async Awaitable<Texture2D> LoadTexture(string file)
8065
{
8166
using var webRequest =

Assets/Scripts/PreviewLoader.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ private void SetupFacialFeatures(GameObject bodyGO)
217217
{
218218
if (!bodyGO) return;
219219

220-
// TODO: Shouldn't be here
221-
222220
var meshRenderers = bodyGO.GetComponentsInChildren<SkinnedMeshRenderer>(false);
223221

224222
var eyebrows = meshRenderers.FirstOrDefault(mr => mr.name.EndsWith("Eyebrows"));
@@ -283,7 +281,6 @@ private async Task LoadWearable(string category, WearableDefinition wd, AvatarCo
283281
if (WearablesConstants.FACIAL_FEATURES.Contains(category))
284282
{
285283
// This is a facial feature, only comes as a texture
286-
// TODO: Assert.IsTrue(wd.MainFile.EndsWith(".glb"), "Only GLB files are supported");
287284
var tex = await WearableLoader.LoadFacialFeature(wd.MainFile, wd.Files);
288285
if (tex != null)
289286
{
@@ -336,7 +333,6 @@ private void CenterMeshes(Transform root)
336333
root.position -= centerOffset;
337334
}
338335

339-
340336
private static async Awaitable<List<string>> GetUrns(PreviewConfiguration config)
341337
{
342338
if (config.Urns.Count > 0) return config.Urns;

Assets/Scripts/UIPresenter.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Linq;
3+
using System.Reflection;
34
using UnityEngine;
45
using UnityEngine.UIElements;
56
using Utils;
@@ -179,6 +180,7 @@ private void EnableDebug()
179180
// @formatter:off
180181
var dropdownOptions = new List<(string name, string url)>
181182
{
183+
("From URL", null),
182184
("Profile", "https://example.com/?mode=profile&profile=0x3f574d05ec670fe2c92305480b175654ca512005&background=039dfc"),
183185
("Authentication", "https://example.com/?mode=authentication&profile=0x3f574d05ec670fe2c92305480b175654ca512005&background=039dfc"),
184186
("Market Wearable", "https://example.com/?mode=marketplace&profile=0x3f574d05ec670fe2c92305480b175654ca512005&contract=0x1b4e20251ec5da51c749f96a4993f3cebf066853&item=0&background=039dfc"),
@@ -193,24 +195,30 @@ private void EnableDebug()
193195

194196
var dropdown = debugPanel.Q<DropdownField>("URLDropdown");
195197
dropdown.choices = dropdownOptions.Select(o => o.name).ToList();
198+
dropdown.index = 0;
196199
dropdown.RegisterValueChangedCallback(evt =>
197200
{
198201
var selected = dropdownOptions.Find(o => o.name == evt.newValue);
199202
bootstrap.ParseFromURL(selected.url);
200203
bootstrap.InvokeReload();
201204
});
202205

203-
var methodNameField = debugPanel.Q<TextField>("MethodName");
206+
var methodNameDropdown = debugPanel.Q<DropdownField>("MethodNameDropdown");
207+
methodNameDropdown.choices = typeof(JSBridge)
208+
.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance).Select(m => m.Name)
209+
.ToList();
210+
methodNameDropdown.index = 0;
211+
204212
var parameterField = debugPanel.Q<TextField>("Parameter");
205213
debugPanel.Q<Button>("InvokeButton").clicked += () =>
206214
{
207215
if (string.IsNullOrEmpty(parameterField.value))
208216
{
209-
GameObject.Find("JSBridge").SendMessage(methodNameField.value);
217+
GameObject.Find("JSBridge").SendMessage(methodNameDropdown.value);
210218
}
211219
else
212220
{
213-
GameObject.Find("JSBridge").SendMessage(methodNameField.value, parameterField.value);
221+
GameObject.Find("JSBridge").SendMessage(methodNameDropdown.value, parameterField.value);
214222
}
215223
};
216224

Assets/UI/DefaultUI.uxml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323
</engine:VisualElement>
2424
<engine:VisualElement name="DebugPanel" picking-mode="Ignore" style="flex-direction: column; font-size: 22px; justify-content: flex-end; align-items: stretch; position: absolute; top: 0; left: 0; bottom: 0; right: 0; display: none;">
2525
<engine:Button text="Hide" name="HideButton" style="width: 93px; align-self: flex-end;" />
26-
<engine:VisualElement style="flex-direction: row;">
27-
<engine:TextField placeholder-text="MethodName" name="MethodName" style="flex-grow: 1; flex-basis: 1px;" />
26+
<engine:VisualElement style="flex-direction: row; height: 50px;">
27+
<engine:DropdownField name="MethodNameDropdown" choices="Method" index="0" style="flex-grow: 1; flex-basis: 1px; margin-left: 0;" />
28+
<engine:TextField placeholder-text="MethodName" name="MethodName" style="flex-grow: 1; flex-basis: 1px; display: none;" />
2829
<engine:TextField placeholder-text="Parameter" name="Parameter" style="flex-grow: 1; flex-basis: 1px;" />
2930
<engine:Button text="Invoke" name="InvokeButton" />
3031
</engine:VisualElement>
31-
<engine:DropdownField name="URLDropdown" style="margin-left: 0;" />
32+
<engine:DropdownField name="URLDropdown" choices="From URL" index="0" style="margin-left: 0;" />
3233
</engine:VisualElement>
3334
</engine:UXML>

0 commit comments

Comments
 (0)