Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph Editor: Reduce graph view auto layout spacing #1476

Conversation

marwie
Copy link
Contributor

@marwie marwie commented Aug 21, 2023

Currently spacing between graph nodes is quite large.
This reduces the horizontal space between nodes when using AutoLayout slightly

Current layout
20230821-133506_MaterialX_Graph_Editor-needle

With reduced spacing
20230821-133423_MaterialX_Graph_Editor-needle

Another example with reduced spacing
image

@marwie marwie changed the title Reduce graph view auto layout spacing Graph Editor: Reduce graph view auto layout spacing Aug 21, 2023
@@ -570,7 +570,7 @@ ImVec2 Graph::layoutPosition(UiNodePtr layoutNode, ImVec2 startingPos, bool init
UiNodePtr nextNode = layoutNode->getConnectedNode(pins[i]->_name);
if (nextNode)
{
startingPos.x = (1200.f - ((layoutNode->_level) * 350)) * _fontScale;
startingPos.x = (1200.f - ((layoutNode->_level) * 250)) * _fontScale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has always been too widely spaced. Thanks for the fix.

As this is a hard-coded number still, I'm thinking it would be good to make this as display option data member on the Graph class, or at least a const somewhere. Then if needed the number can be adjusted in one obvious place.

It should handle high-dpi since it uses _fontScale can you do a quick check with different dpi settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a quick test with 175% on windows
image

vs 100%
image

@jstone-lucasfilm
Copy link
Member

This looks like a promising improvement, thanks @marwie, and I'm CC'ing @lfl-eholthouser for her thoughts on this proposal.

@lfl-eholthouser
Copy link
Contributor

That looks great! @marwie Thanks for making that change. I agree with @bernardkwok as well that it would be nice to have this value more accessible as well, maybe as a future improvement.

Copy link
Member

@jstone-lucasfilm jstone-lucasfilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like everyone is in agreement, so let's move forward with the change!

@jstone-lucasfilm jstone-lucasfilm merged commit dd12a10 into AcademySoftwareFoundation:main Aug 22, 2023
13 checks passed
Michaelredaa pushed a commit to Michaelredaa/MaterialX that referenced this pull request Oct 21, 2023
Currently spacing between graph nodes is quite large.
This reduces the horizontal space between nodes when using AutoLayout slightly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants