Example #1
0
        private void OnEnable()
        {
            window = this;
            var image = EditorGUIUtility.FindTexture(ImageLinks.arrowUp);

            if (image == null)
            {
                Debug.LogWarning("Unable to find image at " + ImageLinks.arrowUp);
                upArrow = new GUIContent("^", "Move this event up");
            }
            else
            {
                upArrow = new GUIContent(image, "Move this event up");
            }
            image = EditorGUIUtility.FindTexture(ImageLinks.arrowDown);
            if (image == null)
            {
                Debug.LogWarning("Unable to find image at " + ImageLinks.arrowDown);
                downArrow = new GUIContent("v", "Move this event down");
            }
            else
            {
                downArrow = new GUIContent(image);
            }
        }
        private void CreateBranchEditorWindow()
        {
            if (!EditorWindow.HasOpenInstances <ScenimaticBranchEditor>())
            {
                if (branchEditor == null)
                {
                    branchEditor = EditorWindow.GetWindow <ScenimaticBranchEditor>();
                    branchEditor.titleContent = new GUIContent("Scenimatic Branch");
                    branchEditor.minSize      = new Vector2(600, 200);
                }
            }
            else
            {
                branchEditor = EditorWindow.GetWindow <ScenimaticBranchEditor>();
                branchEditor.titleContent = new GUIContent("Scenimatic Branch");
                branchEditor.minSize      = new Vector2(600, 200);
            }

            branchEditor.nodeGraph = this;
        }
        private void CreateNewConnectionPointFromConnection(GraphEntityData graphEntity, ConnectionPoint connectedTo, ConnectionPointDirection direction)
        {
            Connection newConn = new Connection()
            {
                type         = connectedTo.connection.type,
                GUID         = System.Guid.NewGuid().ToString(),
                variableName = connectedTo.connection.variableName,
            };

            ScenimaticBranchEditor.CheckForDuplicateNameInConnections(newConn, graphEntity.GetConnections(direction));
            graphEntity.AddNewConnectionPoint(newConn, direction);

            if (!connectedTo.AllowsMultipleConnections())
            {
                connectedTo.RemoveAllConnections();
            }

            newConn.connectedToGUIDs.Add(connectedTo.GUID);
            connectedTo.connection.connectedToGUIDs.Add(newConn.GUID);

            RefreshConnectionPoint(connectedTo);
        }