Simple node editor

pull request submitted

Thanks, merged:)

First of all I want to thank you all for this wonderful node editor!
I’ve been using it for the development of an editor extension to generate trees. I’ve come across a question related to the UI, hope you can help me with this matter.

As I’ve been adding background textures and icons to nodes, these textures are showing at the ā€œselect texture dialogā€ on the editor. Now, I would prefer not to clutter other projects using this extension with unnecessary or unrelated texture on this dialog.

Is there any way to hide textures from the dialog displayed when selecting a texture?

Interesting question, unfortunately I don’t know of a built-in way to do that with the default texture picker right now, would love if you found a solution for that…
If you have a controlled, limited set of textures to choose from (like a specific folder) you might be able to create a custom GUI control in the node property editor to display a dropdown/texture pads to select from after reading those in.
There’s also the in-between way of just using a file open dialogue but it’s also a bit annoying for the user.
So, it depends on exactly which textures you want to show… In case you do need to make a custom control, as I said, you can just use the property editor (overwrite DrawNodePropertyEditor, and use base.DrawNodePropertyEditor) to inject that into the inspector GUI if you don’t want to create a custom editor and mess with the default node custom editor…
Hope that makes sense:)
Seneral

1 Like

Thanks Seneral!
Yes, I’m overriding DrawNodePropertyEditor on some nodes that need to display some extra information. As for the textures, I’ve opted for a single sprite image for the iconography (so the texture dialog would show only this for the extension UI). I’m cropping the required images and saving the Texture2D on memory, just taking care of listening to the editor events to clean or reload things when necessary.

1 Like

Cool, so you did get it to work?

Yes, thanks! Although it was working before, I just wanted to make things more tidy :slight_smile:

Hi there,

Just wanted to show you a first draft of Constellation.

This is a first draft, but I think it’s mature enough to be shown.

repo: GitHub - AntoineCharton/Constellation: Constellation is a visual scripting language for unity that gives you the tools of a programmer without having to write a single line of code. Its goal is to give a user friendly approach to programming. It's currently in alpha, which means it’s going to evolve and improve the next few months.
web site: https://www.constellationeditor.com/
forum: https://www.constellationeditor.com/forum-1

Features:

  • Complete editor.
  • Live debugging.
  • Live editing (Still a bit glitchy sometimes).
  • Unity attributes compatible.

3 Likes

@toinouc Wow looks nice on first glance:) Especially like the concept of warm/cold inputs, although hard to grasp at first…

1 Like

Hi @Seneral_1 ,
Thanks for your feedback :), I will try to improve the doc, it’s not very clear on many aspects. I’m thinking about making a video tutorial to explain the basics of the language. Some abstracts aspects will be easier to understand if they are visualized before they are explained.

Agreed - although I’m (obviously) not one for visual programming languages, it’s a really cool start you got there:)

1 Like

How did you build the WebGL demo: http://www.levingaeher.com/NodeEditor/Examples.html ? I have problems with all the references to UnityEditor to create a player using this in runtime.

Depending on where these UnityEditor references are. In the base framework there should be none, and the default nodes all use RTEditorGUI as replacement controls for the missing editor controls.
If you have custom nodes you either have to use RTEditorGUI aswell or wrap all editor references in #if UNITY_EDITOR / #endif to make it build :slight_smile:
So for me, using the develop branch and the examples, I had to do nothing special to make it build, just switch to WebGL platform, setup a scene with RTNodeEditor and some saved scene canvases to load from, and build it…
Seneral

1 Like

Works perfectly. But now I want buttons and extra text fields in runtime, and the Examples/Dialogue-System looks promising. This is not working in runtime, and I’m not sure how to proceed.

You mean the editor or the runtime with the actual dialogue?
If you want the editor at runtime you need to add support for it yourself, currently not designed for it. I recommend replacing every EditorGUI with RTEditorGUI if existing or work around it somehow, on a case-by-case basis… No better solution there…

What needs to be implemented is a runtime version of EditorGUILayout. Perhaps I just expand the RTEditorGUI with the missing UI components or place it outside the framework.

To support directionless connections, I had to change the code in node.cs: DrawConnections() to iterate all connectionPorts and not just outputPorts, to see the connections drawn. I guess it would be better to create a new class of connections that can be both input and output, and not be called None as it is now.

That draws the connection twice, once from each node it is connected to. Seems though as if I didn’t test it enough, sorry!

But yes, you’re right about RTEditorGUI, would love if you can contribute some more components, it really is a pity that some of the basic controla are only available in the editor…

I would like to save and load from WebGL player. I guess it should be export to XML and then import. But the current export/import code in develop doesn’t really work in WebGL runtime. Still it almost does, so do you have any ideas regarding load and save in WebGL?

I recommend you to read through some guides regarding file I/O on WebGL or web in general. As you probably can assume it’s a difficult topic because of safety concerns, but there are ways to do that as far as I know.
Won’t do that natively in the framework as it’s an absolute edge case, but provided you get file IO in general running, changing the import/export functions should be a breeze:)
Seneral

Hi!
I have a simple requirement from this Node Editor Framework.
Currently, I work on a system that uses tree’s (data structure) as input data,
and I want to use visual node editor to show Tree visually.

I easily managed to create a simple nodes with inputs/outputs, however, I got stuck with the creation of Tree structure. I cannot figure out how to acces children of the node, or which nodes are connected with ConnectionKnob.

I tried using ValueConnectionKnob.

[ValueConnectionKnob(null, Direction.Out, "BoardNode", ConnectionCount.Multi)]
        public ValueConnectionKnob children;
public class BoardNodeConnectionType : ValueConnectionType
    {
        public override string Identifier { get { return "BoardNode"; } }
        public override Color Color { get { return Color.cyan; } }
        public override System.Type Type { get { return typeof(List<BaseNode>); } }
    }
public override void NodeGUI()
        {
            List<BoardNode> childs = GetChildren();
            if (childs != null)
                RTEditorGUI.TextField("Number of children: " + childs.Count);

            if (GUI.changed)
                NodeEditor.curNodeCanvas.OnNodeChange(this);
        }


        public virtual List<BoardNode> GetChildren()
        {
            if (children.connected())
                return children.GetValue<List<BoardNode>>();
            return null;
        }
public override bool Calculate()
        {
            if (parents.connected())
            {
                List<BaseNode> val = parents.GetValue<List<BaseNode>>();
                if (val == null)
                    val = new List<BaseNode>();
                if (!val.Contains(this))
                    val.Add(this);
                parents.SetValue(val);
            }
            return true;
        }

However this result’s with an error

Trying to GetValue<System.Collections.Generic.List`1[[NodeEditorFramework.BoardNodeTree.BoardNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]> for Output Type: System.Collections.Generic.List`1[[NodeEditorFramework.BoardNodeTree.BaseNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]