public void GenerateLabels() { if (m_Labels == null || m_Labels.Length != m_Map.Shortcuts.Count) { m_Labels = new string[m_Map.Shortcuts.Count]; } m_VersionContent = new GUIContent(m_Map.Version.ToString()); m_LabelsWithTips = new GUIContent[m_Map.Shortcuts.Count]; for (int i = 0; i < m_Labels.Length; i++) { var shortcut = m_Map.Shortcuts[i]; m_Labels[i] = shortcut.Output.Path; m_LabelsWithTips[i] = new GUIContent(shortcut.Output.Path, k_DataTypePrefix + shortcut.TypeName); } m_ColorGroupContents = new GUIContent[m_Map.ColorGroups.Count]; for (int i = 0; i < m_ColorGroupContents.Length; i++) { var group = m_Map.ColorGroups[i]; var prefix = OscMapParser.PrefixFromShortcut(group.Red); m_ColorGroupContents[i] = new GUIContent(prefix, k_ColorGroupTip); } m_Vector2GroupContents = new GUIContent[m_Map.Vector2Groups.Count]; for (int i = 0; i < m_Vector2GroupContents.Length; i++) { var group = m_Map.Vector2Groups[i]; var prefix = OscMapParser.RemoveLastChar(group.X.Input.Path); m_Vector2GroupContents[i] = new GUIContent(prefix, k_Vec2GroupTip); } m_Vector3GroupContents = new GUIContent[m_Map.Vector3Groups.Count]; for (int i = 0; i < m_Vector3GroupContents.Length; i++) { var group = m_Map.Vector3Groups[i]; var prefix = OscMapParser.RemoveLastChar(group.X.Input.Path); m_Vector3GroupContents[i] = new GUIContent(prefix, k_Vec3GroupTip); } }
public void OnGUI() { using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel(m_ResolumeTypeContent); s_PreviousResolumeType = s_ResolumeType; s_ResolumeType = (ResolumeType)EditorGUILayout.EnumPopup(s_ResolumeType, m_SmallColumnWidth); if (s_PreviousResolumeType != s_ResolumeType) { s_OscMapPath = ""; } } s_OscMapPath = GetMapPath(); s_OscMapFileName = GetFileName(s_OscMapPath); EditorGUILayout.LabelField(s_OscMapPath); EditorGUILayout.Space(); var valid = s_OscMapPath.EndsWith(".xml"); using (new EditorGUI.DisabledScope(!valid)) { if (GUILayout.Button("Create OSC Map Asset")) { const string label = "Select Asset Creation Path"; s_AssetPath = ProjectRelative( EditorUtility.SaveFilePanel(label, Application.dataPath, s_OscMapFileName, "asset")); if (s_AssetPath == "" || !s_AssetPath.Contains("Assets")) { Debug.LogWarning("invalid asset creation path chosen"); return; } var parser = OscMapParser.LoadAsset(); parser.OutputPath = s_AssetPath; parser.ParseFile(s_OscMapPath); } } }