Skip to content

Commit

Permalink
Update VRC-ASL-Gestures_Installer.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaakDl authored and IsaakDl committed Jul 2, 2022
1 parent e867f7b commit 8a09a5e
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions Editor/VRC-ASL-Gestures_Installer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using VRC.SDK3.Avatars.ScriptableObjects;
using System.Linq;
using System.Collections.Generic;
using UnityEngine.UIElements;

namespace I5UCC.VRCASLGestures
{
Expand All @@ -19,13 +20,16 @@ public class VRCASLGestures : EditorWindow
private int DominantHand = 0;

private GUIStyle titleStyle = null;
private GUIStyle titleStyle2 = null;
private GUIStyle errorStyle = null;
private GUIStyle highlightedStyle = null;

private AnimatorController animatorToAdd = null;
private VRCExpressionParameters parametersToAdd = null;
private VRCExpressionsMenu menuToAdd = null;

private bool showInfo = false;

private readonly string[] controllerPath =
{
"Assets/VRC-ASL_Gestures/IndexVR/Thumbparams/ASLGestures_Index_Thumbparams.controller",
Expand Down Expand Up @@ -87,6 +91,17 @@ private void OnGUI()
}
};


titleStyle2 = new GUIStyle()
{
fontSize = 23,
fixedHeight = 28,
fontStyle = FontStyle.Bold,
normal = {
textColor = Color.white
}
};

highlightedStyle = new GUIStyle()
{
fontStyle = FontStyle.Bold,
Expand All @@ -110,9 +125,14 @@ private void OnGUI()

private void DrawSimple()
{
EditorGUILayout.LabelField("Avatar", titleStyle);
Texture banner = (Texture)AssetDatabase.LoadAssetAtPath("Assets/VRC-ASL_Gestures/VRC ASL.png", typeof(Texture));
GUI.DrawTexture(new Rect(20, 10, 60, 60), banner, ScaleMode.StretchToFill, true, 10.0F);
EditorGUILayout.Space(12);
EditorGUILayout.LabelField("\tVRC-ASL_Gestures", titleStyle2);
EditorGUILayout.Space(35);
EditorGUILayout.LabelField("Avatar (Drag and Drop avatar here)", titleStyle);
EditorGUILayout.Space();
targetAvatar = EditorGUILayout.ObjectField(targetAvatar, typeof(VRCAvatarDescriptor), true) as VRCAvatarDescriptor;
targetAvatar = EditorGUILayout.ObjectField(targetAvatar, typeof(VRCAvatarDescriptor), true, GUILayout.Height(30)) as VRCAvatarDescriptor;
EditorGUILayout.Space();

if (targetAvatar)
Expand All @@ -132,7 +152,7 @@ private void DrawSimple()

UseThumbparams = EditorGUILayout.Popup(UseThumbparams, new string[2] {
"No",
"Yes"
"Yes (Requires ThumbparamsOSC)"
});

if (UseThumbparams == 0)
Expand All @@ -155,15 +175,23 @@ private void DrawSimple()
else
TotalCost = cost[type];

EditorGUILayout.LabelField("To add or merge:", highlightedStyle);
EditorGUILayout.LabelField(controllerPath[type].Substring(controllerPath[type].LastIndexOf("/") + 1));
EditorGUILayout.LabelField(parameterPath[type].Substring(parameterPath[type].LastIndexOf("/") + 1));
EditorGUILayout.LabelField(menuPath[type].Substring(menuPath[type].LastIndexOf("/") + 1));
showInfo = EditorGUILayout.Foldout(showInfo, "More Information", true);


if (showInfo)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("To add or merge:", highlightedStyle);
EditorGUILayout.LabelField(controllerPath[type].Substring(controllerPath[type].LastIndexOf("/") + 1));
EditorGUILayout.LabelField(parameterPath[type].Substring(parameterPath[type].LastIndexOf("/") + 1));
EditorGUILayout.LabelField(menuPath[type].Substring(menuPath[type].LastIndexOf("/") + 1));
EditorGUILayout.Space();
}

EditorGUILayout.Space();
EditorGUILayout.LabelField("Parameters needed: " + cost[type].ToString(), highlightedStyle);
EditorGUILayout.LabelField("Total Parameters: " + TotalCost.ToString() + "/256", highlightedStyle);


if (TotalCost <= 256 && (targetAvatar.expressionsMenu == null || targetAvatar.expressionsMenu.controls.Count != 8))
{
animatorToAdd = AssetDatabase.LoadAssetAtPath(controllerPath[type], typeof(AnimatorController)) as AnimatorController;
Expand Down

0 comments on commit 8a09a5e

Please sign in to comment.