static void AddRotationComponentIfAbsent(GameObject go, Vector3ShortcutGroup group, List <RotationOscEventHandler> components) { go.GetComponents(components); var found = false; foreach (var c in components) { if (c.Handlers == null) { continue; } if (c.Handlers[0].Shortcut != group.X) { continue; } if (c.Handlers[1].Shortcut != group.Y) { continue; } if (c.Handlers[2].Shortcut != group.Z) { continue; } found = true; break; } if (!found) { var component = go.AddComponent <RotationOscEventHandler>(); component.Setup(); component.SetHandlers(group); } }
void DrawVector3Group(Vector3ShortcutGroup group) { DrawGroupedShortcut(group.X, m_XLabel); MaybeSeparator(); DrawGroupedShortcut(group.Y, m_YLabel); MaybeSeparator(); DrawGroupedShortcut(group.Z, m_ZLabel); }
void FindVector3Groups() { if (!ResolinkEditorSettings.Instance.GroupVector3s) { return; } ClearXyzShortcuts(); k_Vector3Groups.Clear(); k_Vector3ShortcutPrefixes.Clear(); foreach (var shortcut in m_Shortcuts) { foreach (var regex in Regexes.Vector3.All) { if (regex.IsMatch(shortcut.Input.Path)) { AssignToVectorFieldList(shortcut); break; } } } AddToVector3PrefixSet(k_XShortcuts); AddToVector3PrefixSet(k_YShortcuts); AddToVector3PrefixSet(k_ZShortcuts); foreach (var prefix in k_Vector3ShortcutPrefixes) { if (!AllVector3ComponentsFound(prefix)) { continue; } var group = new Vector3ShortcutGroup { X = s_XShortcut, Y = s_YShortcut, Z = s_ZShortcut }; k_Vector3Groups.Add(group); m_Shortcuts.Remove(s_XShortcut); m_Shortcuts.Remove(s_YShortcut); m_Shortcuts.Remove(s_ZShortcut); } }
public void SetHandlers(Vector3ShortcutGroup group) { Handlers[0].Shortcut = group.X; Handlers[1].Shortcut = group.Y; Handlers[2].Shortcut = group.Z; }