★ wanayoo — archive 1999 https://github.com/paceholder/nodeeditor/issues/147Nouvelle recherche | Portail wanayoo
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

Allow arbitrary ordering of nodes in the context menu #147

Open
Quincunx271 opened this issue Mar 27, 2018 · 0 comments
Open

Allow arbitrary ordering of nodes in the context menu #147

Quincunx271 opened this issue Mar 27, 2018 · 0 comments

Comments

@Quincunx271
Copy link
Contributor

@Quincunx271 Quincunx271 commented Mar 27, 2018

The ordering of nodes inside the DataModelRegistry is currently pretty arbitrary. When you open the context menu, the nodes are ordered by Category (sorted, as it uses std::set), but within each category, there is no ordering. If I understand the code correctly, this is because RegisteredModelsCategoryMap is a std::unordered_map.

I think it's beneficial to allow this ordering to be fully specified by a user of this library, or at least the order of nodes within any given category.

My proposal is thus the following:

  • Keep the models of a given category in the order that they were registered. This is backwards compatible, assuming the user doesn't rely on the iteration order of unordered_map
  • Keep the categories in the order that they are inserted in via registerModel. Basically, use a std::vector instead of a std::set. It might be a good idea to add a sortCategories() function. This is backwards incompatible, but I think it's valuable. If we want to stay backwards compatible, there should at least be a way to specify the order of the categories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.