From 73bbba9de5210ae7f895ae82bd2524eb76e3a38c Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 30 Sep 2022 13:13:57 -0700 Subject: begin unity-native port --- TaSTT.cs | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ osc_ctrl.py | 4 ++-- 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 TaSTT.cs diff --git a/TaSTT.cs b/TaSTT.cs new file mode 100644 index 0000000..d9901d6 --- /dev/null +++ b/TaSTT.cs @@ -0,0 +1,78 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEditor.Animations; +using UnityEngine; +using VRC.SDK3.Avatars.Components; +using VRC.SDK3.Avatars.ScriptableObjects; + +namespace TaSTT +{ + public class TaSTT : EditorWindow + { + private static TaSTT instance_; + private GameObject avatar_root_; + private AnimatorController fx_controller_; + + [MenuItem("Window/TaSTT")] + private static void ShowWindow() + { + instance_ = GetWindow(); + instance_.titleContent = new GUIContent("TaSTT"); + } + + private void Draw() + { + GUILayout.Label("TaSTT: A free VRChat STT"); + GUILayout.Label("Made with love by yum_food"); + GUILayout.Label(""); + + avatar_root_ = (GameObject)EditorGUILayout.ObjectField( + new GUIContent("Avatar Root"), avatar_root_, + typeof(GameObject), true); + fx_controller_ = (AnimatorController)EditorGUILayout.ObjectField( + new GUIContent("FX Controller"), fx_controller_, + typeof(AnimatorController), true); + + if (GUILayout.Button("Create animations!")) + { + if (avatar_root_ == null || !fx_controller_ == null) + { + // TODO(yum_food) why doesn't EditorGUILayout.HelpBox() work here? + Debug.LogError("Avatar root or FX controller are not set! Cannot create animations."); + return; + } + // TODO(yum_food) + } + if (GUILayout.Button("Create FX layer!")) + { + if (!avatar_root_ == null || !fx_controller_ == null) + { + Debug.LogError("Avatar root or FX controller are not set! Cannot create FX layer."); + return; + } + // TODO(yum_food) + } + } + + private static void CreateAnimations() + { + VRCAvatarDescriptor descriptor = avatar_root_.GetComponent(); + if (descriptor == null) + { + Debug.LogError("Failed to get avatar descriptor"); + return; + } + AnimationClip anim = new AnimationClip(); + clip.frameRate = 1f; + } + + private void OnGUI() + { + if (instance_ != null) + { + Draw(); + } + } + } +} diff --git a/osc_ctrl.py b/osc_ctrl.py index 918b636..21386c4 100644 --- a/osc_ctrl.py +++ b/osc_ctrl.py @@ -26,7 +26,7 @@ for row in range(0, 6): addr="/avatar/parameters/TaSTT_Col" client.send_message(addr, col) - time.sleep(0.01) + time.sleep(.5) addr="/avatar/parameters/TaSTT_Active" client.send_message(addr, True) @@ -35,7 +35,7 @@ for row in range(0, 6): client.send_message(addr, (seed + row * 14 + col) % 65) print("sent {} at {},{}".format((seed + row * 14 + col) % 65, row, col)) - time.sleep(0.01) + time.sleep(.5) addr="/avatar/parameters/TaSTT_Active" client.send_message(addr, False) -- cgit v1.2.3