Seneral / Node_Editor_Framework

A flexible and modular Node Editor Framework for creating node based displays and editors in Unity
https://nodeeditor.seneral.dev
MIT License
2.01k stars 414 forks source link

Idea: Connection colors depending on the value of the node #26

Closed pmhpereira closed 7 years ago

pmhpereira commented 8 years ago

I already implemented this for my custom Boolean nodes, but I figured it would be really easy to extend to any type of nodes.

Example, using the default Float nodes (green for >0, red for <0, black for =0, blue for unconnected)

What do you think, @Seneral ?

Seneral commented 8 years ago

Indeed a good idea, I will add an option to customize the connections of an output. Though I think too much colors for one type are impractical. For boolean his may work, but not for a float;) Rather, I'd think of displaying the value on the connection itslef with a box label... I will try doing this in the best way possible;)

pmhpereira commented 8 years ago

For floats it may not make much sense, but I think it would still be nice if there was an easy way to override the default implementation for the colors (knobs and connections) without creating a new type and/or without tweaking with your code.

WeslomPo commented 8 years ago

I think there need a more complex work than colorize lines. First of all, need to separate node building and rendering. Need to make a node skeleton, where are you can add components and stop thinking about what is in your script file, stop visualize elements hand by hand. Than make some thing like a cascade style sheet, or just skin. Skin is view, components is model. After It we can talk about colorize lines and so on. Now very hard to make any change in code, because elements need to be coded manually, including rendering of nodes. Yes, it will cool on start, when you have only principe of rendering of nodes, now you need to start thinking to what it can be, what it can become.

Seneral commented 8 years ago

You're right, it may seem hard at first to customize that. But, it's essentially just DrawNode, DrawKnobs, DrawConnections, etc. inside Node which you need to modify. I already made DrawNode virtual to make overriding possible, maybe doing that on the other ones, too. I'm not exactly sure if I understood your Skin/Component model of doing things. It may have benefits, but in a final product, the Nodes probably would have a uniform style, either way. You could modify DrawKnobs right now to achive the kind of look as in, fE., NodeCanvas:

You're always free to implement that, so we can get a better idea of what you mean:)

WeslomPo commented 8 years ago

I talk about that need to build a system that no need to write any script, and best solution for that I see trough a component/entity model. Skin - It's like a... skin >__<. Do you ever use a WinAmp?

I need a time to reply to you in details.

p.s. I'm sorry for my english, I'm not native speaker.

Seneral commented 8 years ago

No problem, I'm no native english either;) I understand, but I don't think it's really that useful, tbh. I will work on the system to make it more customizeable per type and make it possible to overwrite per node / connection. That might be the best option here. Because, there's really not much to tweak about Layout and skin of Nodes... Layout includes just the base node (currently header+body, but can be overridden through DrawNode in Node), knob positioning (done with side, position and offset values), etc. Skin is already covered by knob textures and color, and stuff in NodeEditorGUI.cs

What I think will help: Per Connection Type:

Per Node:

But always feel free to comment and improve or implement your idea yourself:)

Seneral commented 8 years ago

This will be adressed more closely soon, after the statemachine and action node is done. Atleast on my part, if anyone wants to do it, no problem:)

Seneral commented 7 years ago

Part of connection refactoring in #74