private void EditSimpleConnection(NodeConnector connector) { using (var dialog = new HyperGraph.TextEditForm()) { var existing = GetSimpleConnection(connector); dialog.InputText = (!string.IsNullOrEmpty(existing)) ? existing : "1.0f"; var result = dialog.ShowDialog(); if (result == DialogResult.OK) { bool foundExisting = false; foreach (var i in connector.Node.Connections) if (i.To == connector && i.From == null) { // empty dialog text means we want to disconnect any existing connections if (dialog.InputText.Length > 0) { i.Name = dialog.InputText; } else { GetGraphModel().Disconnect(i); break; } foundExisting = true; } if (!foundExisting && dialog.InputText.Length > 0) GetGraphModel().Connect(null, connector, dialog.InputText); GetGraphModel().InvokeMiscChange(true); } } }
private void SetArchiveName_Click(object sender, EventArgs e) { var n = GetNode(AttachedId(sender)); if (n == null) { return; } var tag = n.Tag as ShaderFragmentNodeTag; if (tag == null) { return; } using (var dialog = new HyperGraph.TextEditForm { InputText = tag.ArchiveName }) { // careful -- should we validate that the archive name is at least reasonable? if (dialog.ShowDialog() == DialogResult.OK) { tag.ArchiveName = dialog.InputText; } } }
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); } }
private void EditSimpleConnection(NodeConnector connector) { using (var dialog = new HyperGraph.TextEditForm()) { var existing = GetSimpleConnection(connector); dialog.InputText = (!string.IsNullOrEmpty(existing)) ? existing : "1.0f"; var result = dialog.ShowDialog(); if (result == DialogResult.OK) { bool foundExisting = false; foreach (var i in connector.Node.Connections) { if (i.To == connector && i.From == null) { // empty dialog text means we want to disconnect any existing connections if (dialog.InputText.Length > 0) { i.Name = dialog.InputText; } else { GetGraphModel().Disconnect(i); break; } foundExisting = true; } } if (!foundExisting && dialog.InputText.Length > 0) { GetGraphModel().Connect(null, connector, dialog.InputText); } GetGraphModel().InvokeMiscChange(true); } } }
private void SetArchiveName_Click(object sender, EventArgs e) { var n = GetNode(AttachedId(sender)); if (n == null) return; var tag = n.Tag as ShaderFragmentNodeTag; if (tag == null) return; using (var dialog = new HyperGraph.TextEditForm { InputText = tag.ArchiveName }) { // careful -- should we validate that the archive name is at least reasonable? if (dialog.ShowDialog() == DialogResult.OK) tag.ArchiveName = dialog.InputText; } }
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); } }