Example #1
0
        void OnConnectorDoubleClick(object sender, HyperGraph.GraphControl.NodeConnectorEventArgs e)
        {
            var dialog = new HyperGraph.TextEditForm();

            dialog.InputText = "1.0f";

            //  look for an existing simple connection attached to this connector
            foreach (var i in e.Node.Connections)
            {
                if (i.To == e.Connector && i.From == null)
                {
                    dialog.InputText = i.Name;
                }
            }

            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                bool foundExisting = false;
                foreach (var i in e.Node.Connections)
                {
                    if (i.To == e.Connector && i.From == null)
                    {
                        i.Name        = dialog.InputText;
                        foundExisting = true;
                    }
                }

                if (!foundExisting)
                {
                    var connection = new NodeConnection();
                    connection.To   = e.Connector;
                    connection.Name = dialog.InputText;
                    e.Node.AddConnection(connection);
                }

                ShaderFragmentNodeUtil.InvalidateAttachedConstants(graphControl);
            }
        }