Example #1
0
        public NodeGUIBase( ISynthGraphNode dataNode )
        {
            m_dataNode = dataNode;

            m_isDragged  = false;
            m_dragOffset = Vector2.zero;

            SetRect( GetDefaultRect() );
        }
Example #2
0
        public void SetSourceNode(ISynthGraphNode node, int index)
        {
            if ( index < 0 || index >= m_sourceNodes.Length )
            {
                // Assert
                return;
            }

            m_sourceNodes[ index ] = node;
        }
Example #3
0
 public SynthNodeOutputMono()
 {
     m_sourceNodes = new ISynthGraphNode[1];
 }
Example #4
0
 public NodeGUIConstant( ISynthGraphNode dataNode )
     : base(dataNode)
 {
     m_constantNode = dataNode as SynthNodeConstant;
 }
        private void CacheConnection( ISynthGraphNode node )
        {
            ISynthGraphNode[] inputs = node.GetSourceNodes();

            for( int i = 0; i < inputs.Length; i++ )
            {
                if ( inputs[ i ] != null )
                {
                    SynthGraphEditorGraphConnection connection = new SynthGraphEditorGraphConnection();
                    connection.SetFrom( GetGUIForNode( inputs[ i ] ) );
                    connection.SetTo( GetGUIForNode( node ), i );

                    m_connectionCache.Add( connection );

                    CacheConnection( inputs[ i ] );
                }
            }
        }
 public void AddNode( ISynthGraphNode node )
 {
     m_floatingSelection.Add( node, SynthGraphEditorFactory.GetGUIControl( node ) );
 }
        private NodeGUIBase GetGUIForNode( ISynthGraphNode node )
        {
            if ( m_graphCache.ContainsKey( node ) )
            {
                return m_graphCache[ node ];
            }

            // Should probably assert here, since if a node is connect it should be cached...
            if ( m_floatingSelection.ContainsKey( node ) )
            {
                return m_floatingSelection[ node ];
            }

            return null;
        }
        private void CacheNode( ISynthGraphNode node, Dictionary<ISynthGraphNode, NodeGUIBase> oldCache )
        {
            // If node is part of hierarchy, remove it from floating selection
            if ( m_floatingSelection.ContainsKey( node ) )
            {
                m_graphCache.Add( node, m_floatingSelection[ node ] );
                m_floatingSelection.Remove( node );
            }
            else if ( oldCache.ContainsKey( node ) )
            {
                m_graphCache.Add( node, oldCache[ node ] );
                oldCache.Remove( node );
            }
            else
            {
                if ( !m_graphCache.ContainsKey( node ) )
                {
                    m_graphCache.Add( node, SynthGraphEditorFactory.GetGUIControl( node ) );
                }
            }

            ISynthGraphNode[] inputs = node.GetSourceNodes();

            for( int i = 0; i < inputs.Length; i++ )
            {
                if ( inputs[ i ] != null )
                {
                    CacheNode( inputs[ i ], oldCache );
                }
            }
        }
        private void HandleNodeSelected( NodeGUIBase node )
        {
            m_rootNode = node.DataNode;

            Log ( string.Format("{0} selected", node.ToString()));
        }
Example #10
0
 public NodeGUIOutput( ISynthGraphNode dataNode )
     : base(dataNode)
 {
 }
        // Get GUI control for node
        public static NodeGUIBase GetGUIControl( ISynthGraphNode node )
        {
            System.Type t = node.GetType();

            if ( t == typeof( SynthNodeGeneratorWave ) )
            {
                return new NodeGUIGeneratorWave( node );
            }
            else if ( t == typeof( SynthNodeConstant ) )
            {
                return new NodeGUIConstant( node );
            }
            else if ( t == typeof( SynthNodeOperation ) )
            {
                return new NodeGUIOperation( node );
            }
            else if ( t == typeof( SynthNodeOutputMono ) || t == typeof( SynthNodeOutputStereo ) )
            {
                return new NodeGUIOutput( node );
            }
            else if ( t == typeof( SynthNodeGeneratorNoise ) )
            {
                return new NodeGUINoise( node );
            }
            else if ( t == typeof( SynthNodeTime ) )
            {
                return new NodeGUITime( node );
            }
            else if ( t == typeof( SynthNodeMapper ) )
            {
                return new NodeGUIMapper( node );
            }
            else
            {
                return new NodeGUIBase( node );
            }
        }
 public SynthNodeOutputStereo()
 {
     m_sourceNodes = new ISynthGraphNode[2];
 }
Example #13
0
 public NodeGUIOperation( ISynthGraphNode dataNode )
     : base(dataNode)
 {
     m_operationNode = dataNode as SynthNodeOperation;
 }
Example #14
0
 public NodeGUIGeneratorWave( ISynthGraphNode dataNode )
     : base(dataNode)
 {
     m_generatorNode = dataNode as SynthNodeGeneratorWave;
 }