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

Navigate to content after positioning nodes #318

Open
lucasburkholder opened this issue Jan 8, 2025 · 0 comments
Open

Navigate to content after positioning nodes #318

lucasburkholder opened this issue Jan 8, 2025 · 0 comments

Comments

@lucasburkholder
Copy link

Hello,

Thank you for this library! I'm finding it very helpful. I just am running into one small issue and I'm wondering if you could help point me in the right direction.

The problem

In my application, I serialize the layout of node graphs in a file (similar to NodeEditor.json, but I am creating my own files as I have to manage multiple graphs and allow users to save/open their own layout files). I enable the user to load a node graph stored externally, and when it loads, my application searches for the layout file, loads it, and positions the nodes in the viewport based on the file. It then attempts to center the graph in the window with NavigateToContent() but that is not working.

Why?

When I call SetNodePosition() to position the nodes, it sets node->m_IsLive to false. Then later, when I call NavigateToContent(), it calls GetContentBounds() which calls GetBounds(). In GetBounds(), it ignores all objects that have m_IsLive set to false. This means it is ignoring all of my newly loaded and positioned nodes, causing the editor to try to center around incorrect bounds.

How can I get around this so that my application can load a graph and a layout file, then automatically center it in the window?

Thanks!

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

No branches or pull requests

1 participant