Skip to content

Commit

Permalink
[Gesture Manager 3.9.0] Release~
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackStartx committed Mar 31, 2024
1 parent 2cd14c2 commit 4e710a8
Show file tree
Hide file tree
Showing 56 changed files with 425 additions and 501 deletions.
4 changes: 2 additions & 2 deletions .v3rsion
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
3.8.9
https://github.com/BlackStartx/VRC-Gesture-Manager/releases/tag/v3.8.9
3.9.0
https://github.com/BlackStartx/VRC-Gesture-Manager/releases/tag/v3.9.0
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion Scripts/Editor/Data/GestureManagerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BlackStartX.GestureManager.Editor.Lib;
using BlackStartX.GestureManager.Editor.Library;
using UnityEditor;
using UnityEngine;

Expand Down
64 changes: 32 additions & 32 deletions Scripts/Editor/Data/GestureManagerStyles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,118 +32,118 @@ public static class GestureManagerStyles
private static Texture _plusTextureLgt;
private static Texture _plusTexturePro;

internal static GUIStyle TitleStyle => _titleStyle ?? (_titleStyle = new GUIStyle(GUI.skin.label)
internal static GUIStyle TitleStyle => _titleStyle ??= new GUIStyle(GUI.skin.label)
{
fontSize = 15,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(10, 10, 10, 10)
});
};

internal static GUIStyle GuiHandTitle => _guiHandTitle ?? (_guiHandTitle = new GUIStyle(GUI.skin.label)
internal static GUIStyle GuiHandTitle => _guiHandTitle ??= new GUIStyle(GUI.skin.label)
{
fontSize = 12,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(10, 10, 10, 10)
});
};

internal static GUIStyle GuiDebugTitle => _guiDebugTitle ?? (_guiDebugTitle = new GUIStyle(GUI.skin.label)
internal static GUIStyle GuiDebugTitle => _guiDebugTitle ??= new GUIStyle(GUI.skin.label)
{
fontSize = 12,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter
});
};

internal static GUIStyle MiddleStyle => _middleStyle ?? (_middleStyle = new GUIStyle(GUI.skin.label)
internal static GUIStyle MiddleStyle => _middleStyle ??= new GUIStyle(GUI.skin.label)
{
fontSize = 12,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(5, 5, 5, 5)
});
};

internal static GUIStyle SettingsText => _settingsText ?? (_settingsText = new GUIStyle(GUI.skin.label)
internal static GUIStyle SettingsText => _settingsText ??= new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(5, 5, 5, 12)
});
};

internal static GUIStyle MiddleError => _middleError ?? (_middleError = new GUIStyle(GUI.skin.label)
internal static GUIStyle MiddleError => _middleError ??= new GUIStyle(GUI.skin.label)
{
fontSize = 12,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
active = { textColor = Color.red },
normal = { textColor = Color.red },
padding = new RectOffset(5, 5, 5, 5)
});
};

internal static GUIStyle EmoteError => _emoteError ?? (_emoteError = new GUIStyle(EditorStyles.helpBox)
internal static GUIStyle EmoteError => _emoteError ??= new GUIStyle(EditorStyles.helpBox)
{
padding = new RectOffset(5, 5, 5, 5),
margin = new RectOffset(5, 5, 5, 5)
});
};

internal static GUIStyle TextError => _textError ?? (_textError = new GUIStyle(GUI.skin.label)
internal static GUIStyle TextError => _textError ??= new GUIStyle(GUI.skin.label)
{
active = { textColor = Color.red },
normal = { textColor = Color.red },
fontSize = 13,
alignment = TextAnchor.MiddleCenter
});
};

internal static GUIStyle TextWarningHeader => _textWarningHeader ?? (_textWarningHeader = new GUIStyle(GUI.skin.label)
internal static GUIStyle TextWarningHeader => _textWarningHeader ??= new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.MiddleCenter,
fontSize = 14
});
};

internal static GUIStyle TextWarning => _textWarning ?? (_textWarning = new GUIStyle(GUI.skin.label)
internal static GUIStyle TextWarning => _textWarning ??= new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.MiddleCenter
});
};

internal static GUIStyle Header => _header ?? (_header = new GUIStyle(GUI.skin.label)
internal static GUIStyle Header => _header ??= new GUIStyle(GUI.skin.label)
{
fontSize = 15,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(10, 10, 10, 10)
});
};

internal static GUIStyle ToolHeader => _toolHeader ?? (_toolHeader = new GUIStyle(GUI.skin.label)
internal static GUIStyle ToolHeader => _toolHeader ??= new GUIStyle(GUI.skin.label)
{
fontSize = 15,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(10, 10, 5, 5)
});
};

internal static GUIStyle ToolSubHeader => _toolSubHeader ?? (_toolSubHeader = new GUIStyle(GUI.skin.label)
internal static GUIStyle ToolSubHeader => _toolSubHeader ??= new GUIStyle(GUI.skin.label)
{
fontSize = 15,
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(10, 10, 10, 5)
});
};

public static GUIStyle HeaderButton => _headerButton ?? (_headerButton = new GUIStyle(GUI.skin.button)
public static GUIStyle HeaderButton => _headerButton ??= new GUIStyle(GUI.skin.button)
{
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
margin = new RectOffset(0, 10, 12, 0)
});
};

private static GUIStyle BottomStyle => _bottomStyle ?? (_bottomStyle = new GUIStyle(GUI.skin.label)
private static GUIStyle BottomStyle => _bottomStyle ??= new GUIStyle(GUI.skin.label)
{
fontSize = 11,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleRight,
padding = new RectOffset(5, 5, 5, 5)
});
};

internal static GUIStyle Centered => _centered ?? (_centered = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter });
internal static GUIStyle PlusButton => _plusButton ?? (_plusButton = new GUIStyle { margin = new RectOffset(0, 20, 3, 3) });
internal static GUIStyle Centered => _centered ??= new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter };
internal static GUIStyle PlusButton => _plusButton ??= new GUIStyle { margin = new RectOffset(0, 20, 3, 3) };

internal static Texture GearTexture => !_gearTexture ? _gearTexture = EditorGUIUtility.IconContent("d_Settings").image : _gearTexture;
internal static Texture BackTexture => !_backTexture ? _backTexture = EditorGUIUtility.IconContent("d_tab_prev").image : _backTexture;
Expand Down
12 changes: 6 additions & 6 deletions Scripts/Editor/GestureManagerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Threading.Tasks;
using BlackStartX.GestureManager.Data;
using BlackStartX.GestureManager.Editor.Data;
using BlackStartX.GestureManager.Editor.Lib;
using BlackStartX.GestureManager.Editor.Library;
using BlackStartX.GestureManager.Editor.Modules;
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -92,7 +92,7 @@ private void TryInitialize()
private IEnumerator TryInitializeRoutine(ModuleBase module)
{
yield return null;
module = module ?? GetValidDescriptor();
module ??= GetValidDescriptor();
if (module != null) Manager.SetModule(module);
}

Expand Down Expand Up @@ -211,22 +211,22 @@ private static void DiscordPopup(string discord)
* Layout Builders
*/

internal static void OnCheckBoxGuiHand(ModuleBase module, GestureHand hand, int position, Action<int> click)
internal static void OnCheckBoxGuiHand(ModuleBase module, GestureHand hand, int position, Action<int> click, Func<int, bool> overridden = null)
{
for (var i = 1; i < 8; i++)
using (new GUILayout.HorizontalScope())
if (OnCheckBoxGuiHandAnimation(module, i, position, click, out var isOn))
if (OnCheckBoxGuiHandAnimation(module, i, position, click, out var isOn, overridden))
module.OnNewHand(hand, isOn ? i : 0);
}

private static bool OnCheckBoxGuiHandAnimation(ModuleBase module, int i, int position, Action<int> click, out bool isOn)
private static bool OnCheckBoxGuiHandAnimation(ModuleBase module, int i, int position, Action<int> click, out bool isOn, Func<int, bool> overridden)
{
GUILayout.Label(module.GetGestureTextNameByIndex(i));
GUILayout.FlexibleSpace();
isOn = position == i;
var isDifferent = isOn != (isOn = GUILayout.Toggle(isOn, ""));
if (click == null) return isDifferent;
if (!module.HasGestureBeenOverridden(i)) OverrideButton(i, click);
if (overridden?.Invoke(i) ?? false) OverrideButton(i, click);
else GUILayout.Space(35);
return isDifferent;
}
Expand Down
28 changes: 0 additions & 28 deletions Scripts/Editor/Library/GmgAnimationHelper.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Scripts/Editor/Library/GmgAnimationHelper.cs.meta

This file was deleted.

7 changes: 0 additions & 7 deletions Scripts/Editor/Library/GmgAnimatorControllerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ namespace BlackStartX.GestureManager.Editor.Library
{
public static class GmgAnimatorControllerHelper
{
public static IEnumerable<KeyValuePair<AnimationClip, AnimationClip>> GetOverrides(AnimatorOverrideController overrideController)
{
var overrides = new List<KeyValuePair<AnimationClip, AnimationClip>>();
overrideController.GetOverrides(overrides);
return overrides;
}

public static AnimatorController CreateControllerWith(IEnumerable<AnimationClip> clips)
{
var controller = CreateControllerWith(new AnimationClip { name = "[SELECT YOUR ANIMATION!]" });
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/Library/GmgEditorExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEditor.UIElements;

namespace BlackStartX.GestureManager.Editor.Lib
namespace BlackStartX.GestureManager.Editor.Library
{
public static class GmgEditorExtensions
{
Expand Down
8 changes: 4 additions & 4 deletions Scripts/Editor/Library/GmgLayoutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using UnityEditor;
using UnityEngine;

namespace BlackStartX.GestureManager.Editor.Lib
namespace BlackStartX.GestureManager.Editor.Library
{
public static class GmgLayoutHelper
{
Expand All @@ -16,7 +16,7 @@ public struct Toolbar
{
private GUIContent[] _contents;

public GUIContent[] Contents(IEnumerable<(string, Action)> field) => _contents ?? (_contents = field.Select(tuple => new GUIContent(tuple.Item1)).ToArray());
public GUIContent[] Contents(IEnumerable<(string, Action)> field) => _contents ??= field.Select(tuple => new GUIContent(tuple.Item1)).ToArray();
public int Selected;
}

Expand All @@ -34,7 +34,7 @@ private static void MyToolbar(ref int toolbar, GUIContent[] contents, (string, A

private static void GuiLabel(Color? color, string text, GUIStyle style = null, params GUILayoutOption[] options)
{
style = style ?? GUI.skin.label;
style ??= GUI.skin.label;
if (color != null)
{
var textColor = GUI.contentColor;
Expand Down Expand Up @@ -84,7 +84,7 @@ public static bool UnityFieldEnterListener<T1, T2>(T1 initialText, T2 argument,
_unityFieldEnterListenerName = controlName;
GUI.SetNextControlName(controlName);
GUI.FocusControl(controlName);
if (_unityFieldEnterListenerData == null) _unityFieldEnterListenerData = initialText;
_unityFieldEnterListenerData ??= initialText;
var t = field(rect, _unityFieldEnterListenerData is T1 d ? d : default);
if (isEnter) onEscape(argument, _unityFieldEnterListenerData is T1 data ? data : default);
else _unityFieldEnterListenerData = t;
Expand Down
15 changes: 5 additions & 10 deletions Scripts/Editor/Modules/ModuleHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,15 @@ public static class ModuleHelper
{
public static ModuleBase GetModuleFor(GameObject gameObject) => GetModuleFor(gameObject.GetComponent<GmgAvatarDescriptor>());

public static ModuleBase GetModuleFor(GmgAvatarDescriptor descriptorComponent)
public static ModuleBase GetModuleFor(GmgAvatarDescriptor descriptorComponent) => descriptorComponent switch
{
switch (descriptorComponent)
{
#if VRC_SDK_VRCSDK2
case VRCSDK2.VRC_AvatarDescriptor descriptorV2:
return new Vrc2.ModuleVrc2(descriptorV2);
VRCSDK2.VRC_AvatarDescriptor descriptorV2 => new Vrc2.ModuleVrc2(descriptorV2),
#endif
#if VRC_SDK_VRCSDK3
case VRC.SDK3.Avatars.Components.VRCAvatarDescriptor descriptorV3:
return new Vrc3.ModuleVrc3(descriptorV3);
VRC.SDK3.Avatars.Components.VRCAvatarDescriptor descriptorV3 => new Vrc3.ModuleVrc3(descriptorV3),
#endif
default: return null;
}
}
_ => null
};
}
}
Loading

0 comments on commit 4e710a8

Please sign in to comment.