Exemple #1
0
        private void OnCreateOutputParameterNode(object sender, EventArgs e)
        {
            using (var fm = new InterfaceParameterForm(false)
            {
                Name = "Color", Type = "auto", Semantic = ""
            })
            {
                var result = fm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    var n   = NodeFactory.CreateInterfaceNode("Outputs", InterfaceDirection.Out);
                    var tag = ((ToolStripMenuItem)sender).GetCurrentParent().Tag;
                    if (tag is System.Drawing.PointF)
                    {
                        n.Location = (System.Drawing.PointF)tag;
                    }
                    n.AddItem(new ShaderFragmentInterfaceParameterItem(fm.Name, fm.Type, InterfaceDirection.Out)
                    {
                        Semantic = fm.Semantic, Default = fm.Default
                    });

                    GetGraphModel().AddNode(n);
                }
            }
        }
Exemple #2
0
 private void EditInterfaceParameter(ShaderFragmentInterfaceParameterItem interfItem)
 {
     using (var fm = new InterfaceParameterForm()
     {
         Name = interfItem.Name, Type = interfItem.Type, Semantic = interfItem.Semantic, Default = interfItem.Default
     })
     {
         var result = fm.ShowDialog();
         if (result == DialogResult.OK)
         {
             interfItem.Name     = fm.Name;
             interfItem.Type     = fm.Type;
             interfItem.Semantic = fm.Semantic;
             interfItem.Default  = fm.Default;
             GetGraphModel().InvokeMiscChange(true);
         }
         else if (result == DialogResult.No)
         {
             // we must disconnect before removing the item...
             if (interfItem.Output != null)
             {
                 for (; ;)
                 {
                     var c = interfItem.Output.Connectors.FirstOrDefault();
                     if (c == null)
                     {
                         break;
                     }
                     GetGraphModel().Disconnect(c);
                 }
             }
             if (interfItem.Input != null)
             {
                 for (; ;)
                 {
                     var c = interfItem.Input.Connectors.FirstOrDefault();
                     if (c == null)
                     {
                         break;
                     }
                     GetGraphModel().Disconnect(c);
                 }
             }
             interfItem.Node.RemoveItem(interfItem);
             GetGraphModel().InvokeMiscChange(true);
         }
     }
 }
Exemple #3
0
 public override bool OnClick(System.Windows.Forms.Control container, System.Windows.Forms.MouseEventArgs evnt, System.Drawing.Drawing2D.Matrix viewTransform)
 {
     using (var fm = new InterfaceParameterForm(false)
     {
         Name = "Color", Type = "auto", Semantic = "", Default = ""
     })
     {
         var result = fm.ShowDialog();
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             Node.AddItem(new ShaderFragmentInterfaceParameterItem(fm.Name, fm.Type, Direction)
             {
                 Semantic = fm.Semantic, Default = fm.Default
             });
         }
     }
     return(true);
 }
Exemple #4
0
        private void OnCreateOutputParameterNode(object sender, EventArgs e)
        {
            using (var fm = new InterfaceParameterForm(false) { Name = "Color", Type = "auto", Semantic = "" })
            {
                var result = fm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    var n = NodeFactory.CreateInterfaceNode("Outputs", InterfaceDirection.Out);
                    var tag = ((ToolStripMenuItem)sender).GetCurrentParent().Tag;
                    if (tag is System.Drawing.PointF)
                        n.Location = (System.Drawing.PointF)tag;
                    n.AddItem(new ShaderFragmentInterfaceParameterItem(fm.Name, fm.Type, InterfaceDirection.Out) { Semantic = fm.Semantic, Default = fm.Default });

                    GetGraphModel().AddNode(n);
                }
            }
        }
Exemple #5
0
 private void EditInterfaceParameter(ShaderFragmentInterfaceParameterItem interfItem)
 {
     using (var fm = new InterfaceParameterForm() { Name = interfItem.Name, Type = interfItem.Type, Semantic = interfItem.Semantic, Default = interfItem.Default })
     {
         var result = fm.ShowDialog();
         if (result == DialogResult.OK)
         {
             interfItem.Name = fm.Name;
             interfItem.Type = fm.Type;
             interfItem.Semantic = fm.Semantic;
             interfItem.Default = fm.Default;
             GetGraphModel().InvokeMiscChange(true);
         }
         else if (result == DialogResult.No)
         {
             // we must disconnect before removing the item...
             if (interfItem.Output != null)
             {
                 for (; ; )
                 {
                     var c = interfItem.Output.Connectors.FirstOrDefault();
                     if (c == null) break;
                     GetGraphModel().Disconnect(c);
                 }
             }
             if (interfItem.Input != null)
             {
                 for (; ; )
                 {
                     var c = interfItem.Input.Connectors.FirstOrDefault();
                     if (c == null) break;
                     GetGraphModel().Disconnect(c);
                 }
             }
             interfItem.Node.RemoveItem(interfItem);
             GetGraphModel().InvokeMiscChange(true);
         }
     }
 }