McManning / BlueGraph

Visual Scripting Framework for Unity
MIT License
237 stars 30 forks source link

Unused node space in nodes with no output fields #54

Open leissler opened 2 years ago

leissler commented 2 years ago

In typical nodes, like the ones in the examples, which have only input fields but no output fields, these input fields occupy less horizontal space than the editable fields below. This leads to a grey unused area on the right side of a node. It is of course debatable if this looks good or ugly, but the fact is that this space could be used to make the input fields in an input-only node larger and make use of this space.

leissler commented 2 years ago

Alright, I fixed this myself for the Executable Graph example. Here's what I did:

In NodeView.cs in the ReloadPorts() method I added at the end:

        EnableInClassList("hasOnlyExecInput", Inputs.Count == 1);
        EnableInClassList("hasOnlyExecOutput", Outputs.Count == 1);

Then in ExecutableNodeView.uss I just added:

.hasOnlyExecInput.hasOnlyExecOutput #top { height:0px; }

I think that was already it (though I'm not 100% sure that I didn't change anything else).

BTW: I fixed another bug, where you couldn't drag nodes that were in the area of the Graph Window with the text label at the lower edge. You need to add the following line in the CanvasView constructor before you add the title label:

        title.pickingMode = PickingMode.Ignore;

Hope you can include it in one of the next releases.

leissler commented 2 years ago

Ok, I solved it a bit cleaner, I guess: I put the lines EnableInClassList("hasOnlyExecInput", Inputs.Count == 1); EnableInClassList("hasOnlyExecOutput", Outputs.Count == 1); into ExecutableNodeView.OnInitialize() method, because it belongs into the that type of graph/nodes. Still had to change CanvasView constructor.

McManning commented 2 years ago

I think this is a good change. Would you like to make a pull request for your suggestions / fixes, or would you prefer I just patch it?

leissler commented 2 years ago

I think these few lines are so small fixes that it's hardly worth a pull request. Maybe you can just add them in some future commit.