Пример #1
0
        public void DrawShortcut(ResolumeOscShortcut shortcut)
        {
            DrawType(shortcut);

            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(m_InputPathContent, m_LeftColumnWidth);
                EditorGUILayout.LabelField(shortcut.Input.Path, EditorStyles.miniLabel);
            }

            DrawUniqueId(shortcut);

            if (shortcut.SubTargets == null || shortcut.SubTargets.Length == 0)
            {
                EditorGUILayout.EndFoldoutHeaderGroup();
                return;
            }

            if (m_ShowSubTargets)
            {
                DrawSubTargetsIfAny(shortcut.SubTargets);
            }

            EditorGUILayout.EndFoldoutHeaderGroup();
        }
Пример #2
0
        static void AddShortcutComponentIfAbsent <T>(GameObject go, ResolumeOscShortcut shortcut, List <T> components)
            where T : OscEventHandler
        {
            go.GetComponents(components);
            var found = false;

            foreach (var c in components)
            {
                if (c.Shortcut.Input.Path != shortcut.Input.Path)
                {
                    continue;
                }

                c.Shortcut = shortcut;
                found      = true;
                break;
            }

            if (!found)
            {
                go.SetActive(false);
                var component = go.AddComponent <T>();
                component.Shortcut = shortcut;
                go.SetActive(true);
            }
        }
Пример #3
0
        public static bool IsTimeEvent(this ResolumeOscShortcut shortcut)
        {
            const string tempoController = "tempocontroller";
            var          inputPath       = shortcut.Input.Path;

            return(inputPath.Contains(tempoController));
        }
Пример #4
0
        public static bool IsLayerEvent(this ResolumeOscShortcut shortcut, bool excludeDashboard = true)
        {
            var inputPath   = shortcut.Input.Path;
            var dashboardOk = !excludeDashboard || !inputPath.Contains("dashboard");

            return(inputPath.IndexOf(compLayers, StringComparison.CurrentCulture) == 0 && dashboardOk);
        }
Пример #5
0
        public static bool IsCompositionDashboardEvent(this ResolumeOscShortcut shortcut)
        {
            const string compDashboard = "composition/dashboard";
            var          inputPath     = shortcut.Input.Path;

            return(inputPath.Contains(compDashboard));
        }
Пример #6
0
        public static bool IsCompositionLayerDashboardEvent(this ResolumeOscShortcut shortcut)
        {
            var inputPath = shortcut.Input.Path;

            return(inputPath.IndexOf(compLayers, StringComparison.CurrentCulture) == 0 &&
                   inputPath.Contains("dashboard"));
        }
Пример #7
0
        public static bool IsApplicationUiEvent(this ResolumeOscShortcut shortcut)
        {
            const string applicationUI = "application/ui";
            var          inputPath     = shortcut.Input.Path;

            return(inputPath.Contains(applicationUI));
        }
Пример #8
0
        public static string PrefixFromShortcut(ResolumeOscShortcut shortcut)
        {
            var inPath    = shortcut.Input.Path;
            var lastSplit = inPath.LastIndexOf('/');

            return(inPath.Substring(0, lastSplit));
        }
Пример #9
0
 void DrawType(ResolumeOscShortcut shortcut)
 {
     using (new EditorGUILayout.HorizontalScope())
     {
         EditorGUILayout.LabelField(m_TypeContent, m_LeftColumnWidth);
         EditorGUILayout.LabelField(shortcut.TypeName, EditorStyles.miniLabel);
     }
 }
Пример #10
0
        public static bool IsClipTransportEvent(this ResolumeOscShortcut shortcut)
        {
            var notCuepoint   = !shortcut.Input.Path.Contains(k_Cuepoints);
            var containsTrans = shortcut.Input.Path.Contains("/transport");
            var isOnLayers    = shortcut.Input.Path.Contains("/layers");

            return(notCuepoint && containsTrans && isOnLayers);
        }
Пример #11
0
        public static bool IsLayerEffectEvent(this ResolumeOscShortcut shortcut)
        {
            var inputPath   = shortcut.Input.Path;
            var dashboardOk = !inputPath.Contains("dashboard");
            var hasEffects  = inputPath.Contains("/effects/") || inputPath.Contains("/effect/");
            var hasLayer    = inputPath.Contains("/layers/");

            return(dashboardOk && hasEffects && hasLayer);
        }
Пример #12
0
 void HandleEndElementByName()
 {
     switch (m_Reader.Name)
     {
     case k_ShortCut:
         m_Shortcuts.Add(m_CurrentShortcut);
         m_CurrentShortcut = null;
         break;
     }
 }
Пример #13
0
 void DrawUniqueId(ResolumeOscShortcut shortcut)
 {
     if (m_ShowUniqueIds)
     {
         using (new EditorGUILayout.HorizontalScope())
         {
             EditorGUILayout.LabelField(m_IdContent, m_LeftColumnWidth);
             EditorGUILayout.LabelField(shortcut.UniqueId.ToString(), EditorStyles.miniLabel);
         }
     }
 }
Пример #14
0
        public static bool IsCompositionEvent(this ResolumeOscShortcut shortcut, bool excludeDashboard = true)
        {
            var inputPath = shortcut.Input.Path;

            if (inputPath.Contains("/composition/layers"))
            {
                return(false);
            }

            var dashboardOk = !excludeDashboard || !inputPath.Contains("dashboard");

            return(inputPath.IndexOf("/composition", StringComparison.CurrentCulture) == 0 && dashboardOk);
        }
Пример #15
0
        static void AssignToVectorFieldList(ResolumeOscShortcut shortcut)
        {
            var inPath = shortcut.Input.Path;

            if (inPath.EndsWith("x"))
            {
                k_XShortcuts.Add(shortcut);
            }
            else if (inPath.EndsWith("y"))
            {
                k_YShortcuts.Add(shortcut);
            }
            else if (inPath.EndsWith("z"))
            {
                k_ZShortcuts.Add(shortcut);
            }
        }
Пример #16
0
 void ComponentForShortcut(GameObject go, ResolumeOscShortcut shortcut)
 {
     if (shortcut.TypeName == typeof(int).Name)
     {
         AddShortcutComponentIfAbsent(go, shortcut, k_IntHandlerComponents);
     }
     else if (shortcut.TypeName == typeof(float).Name)
     {
         AddShortcutComponentIfAbsent(go, shortcut, k_FloatHandlerComponents);
     }
     else if (shortcut.TypeName == typeof(bool).Name)
     {
         AddShortcutComponentIfAbsent(go, shortcut, k_BoolHandlerComponents);
     }
     else if (shortcut.TypeName == typeof(string).Name)
     {
         AddShortcutComponentIfAbsent(go, shortcut, k_StringHandlerComponents);
     }
 }
Пример #17
0
        GameObject ObjectForShortcut(ResolumeOscShortcut shortcut)
        {
            if (shortcut.IsTimeEvent())
            {
                return(TempoController);
            }
            if (shortcut.IsClipTransportEvent())
            {
                return(ClipTransport);
            }
            if (shortcut.IsCueEvent())
            {
                return(ClipCuepoints);
            }
            if (shortcut.IsLayerEffectEvent())
            {
                return(CompositionLayerEffects);
            }
            if (shortcut.IsLayerEvent())
            {
                return(CompositionLayer);
            }
            if (shortcut.IsCompositionDashboardEvent())
            {
                return(CompositionDashboard);
            }
            if (shortcut.IsCompositionLayerDashboardEvent())
            {
                return(CompositionLayerDashboard);
            }
            if (shortcut.IsCompositionEvent())
            {
                return(Composition);
            }
            if (shortcut.IsApplicationUiEvent())
            {
                return(ApplicationUI);
            }

            return(null);
        }
Пример #18
0
        void HandleNodeByName()
        {
            switch (m_Reader.Name)
            {
            case k_VersionInfoNodeName:
                m_Version = ParseVersion();
                break;

            case k_ShortCut:
                m_CurrentShortcut = NewShortcut();
                break;

            case k_ShortCutPath:
                ParseShortcutPath();
                break;

            case k_SubTargetNodeName:
                // on initial parsing, we don't group sub-targets that we find in multiple Shortcut nodes
                m_CurrentShortcut.SubTargets = new[] { ParseSubTarget() };
                break;
            }
        }
Пример #19
0
 public static bool IsCueEvent(this ResolumeOscShortcut shortcut)
 {
     return(shortcut.Input.Path.Contains(k_Cuepoints));
 }
Пример #20
0
        static bool PrefixFoundInList(string prefix, List <ResolumeOscShortcut> shortcuts, ref ResolumeOscShortcut colorRef)
        {
            foreach (var shortcut in shortcuts)
            {
                if (shortcut.Input.Path.StartsWith(prefix))
                {
                    colorRef = shortcut;
                    return(true);
                }
            }

            return(false);
        }