alelievr / NodeGraphProcessor

Node graph editor framework focused on data processing using Unity UIElements and C# 4.6
https://github.com/alelievr/NodeGraphProcessor/projects/2
MIT License
2.34k stars 387 forks source link

Is it possible to add a description to nodes? #132

Closed emrys90 closed 3 years ago

emrys90 commented 3 years ago

Sorry for all the questions! I tried searching, but didn't see a way to add descriptions to a node on tooltip or something. Would be very useful once you get a lot of custom nodes added in

alelievr commented 3 years ago

All the Unity UIElements have a tooltip field if that's what you're looking for. When you assign the tooltip of a node view it shows up below the node like this: image https://docs.unity3d.com/ScriptReference/UIElements.VisualElement-tooltip.html

emrys90 commented 3 years ago

How do you get it below the node? Do you need a custom node view class for each node to give it a tooltip, or is there some attribute that can be applied to a node?

Basically I'm looking for a way to have an on hover tooltip if possible, but always below works too for now, and ideally a way to see the tooltip in the create node menu too

alelievr commented 3 years ago

Yeah, with a custom view. I recommend you create a base custom view that all your node inherit, this will give you a lot more control over your nodes. Like I did in my Mixture project: https://github.com/alelievr/Mixture/blob/master/Packages/com.alelievr.mixture/Editor/Views/MixtureNodeView.cs

alelievr commented 3 years ago

For the node create menu I don't think it's possible to have a tooltip in it. I'm using the ISearchWindowProvider for it and it doesn't seem to support tooltips

emrys90 commented 3 years ago

Is it not possible to do this in a way that doesn't require a custom node view, ie using a Description attribute that is put on your classes that derive from BaseNode?

For the search window, is it possible to add a second line of text in a smaller font or something? So you could place the description below it

alelievr commented 3 years ago

Is it not possible to do this in a way that doesn't require a custom node view, ie using a Description attribute that is put on your classes that derive from BaseNode?

You can do this, but you'll have to modify NodeGraphProcessor to add it in this case.

For the search window, is it possible to add a second line of text in a smaller font or something? No idea, I never tried. But the API seems very limited (i.e. you can only give a GUIContent for an item and that's it) so it's unlikely that it'll work.

emrys90 commented 3 years ago

Thanks, I just added it in using a custom node view