Open theshinyknight opened 7 years ago
Hi, take look at main readme file, section "Step 3 - Adding & extending Node Editor context type", especially look on the comments. Everything what is key here is the attributes around methods. I'm considering also to make short tutorial in some spare time. Thanks for the info.
Thanks for your reply; I did check the readme file, but it has bits and pieces about how to use the control.
I was looking for something more simple; like how to create a new node type (not yet on how to instantiate a node via right click menu; that would follow once you have designed and coded your nodes with input and output).
I will go through the example and see where did you declare the operations nodes; and start from there; but if you have time and can write something really simple in steps, about how to get started; I am sure that others will appreciate it too :) Thanks!
Hello, would it be possible to see examples on how to interact with custom editor? How to read and write your node if you have a combobox, checkbox or a trackbar inside it?
[Node("Trackbar", "Input", "Basic", "", false, false, typeof(TrackBar))]
public void ParameterValue(string name, float input, float min, float max, float step, out float outValue)
{
outValue = input;
}
[Node("Combo", "Input", "Basic", "Choose output from combo", false, false, typeof(ComboBox))]
public void InputValueCombo(float inValue, out float outValue)
{
outValue = inValue;
}
Thanks!
@Luonnotar it's simple:
In your custom control you should have something like this:
private void UpdateNodeContext()
{
var node = (Tag as NodeVisual);
if (node != null)
{
dynamic context = node.GetNodeContext();
if (textureBoxRender.RenderTexture != null)
{
context.Texture = new NodeTexture2D(textureBoxRender.RenderTexture);
}
else if (!string.IsNullOrEmpty(context.Texture.GetTexturePath))
{
textureBoxRender.SetTexturePath(context.Texture.GetTexturePath);
}
}
}
Your Node(Visual) is set in the "Tag" property of your custom control. Take a look at how I get the dynamic context to access and use the node properties.
You only need to call "UpdateNodeContext()" from somwhere else. I'm sure you'll figure this out.
Hi, Thanks for making this project public, I did try the example and it is perfect for generic usage.
Although I am having hard time to figure out exactly how do you create new nodes. Ideally I would like to have some guidance example, that show how did you make the nodes for the various operations; and what is the minimum viable code to actually get just the "work area" where to add nodes; and how to make nodes Input and Output.
The example that you made is really helpful but it is taking me some time to get to the basics; I know that you may not have time, but something step by step, that show starting from the inclusion of the control on the form, creation of a couple of different node types and how they interact with each other; would really be the fastest way to dive into your project.
Thanks for your efforts!