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

Possibility to select a menu preset #4841

Merged
merged 11 commits into from
Dec 29, 2022
Merged

Possibility to select a menu preset #4841

merged 11 commits into from
Dec 29, 2022

Conversation

portnov
Copy link
Collaborator

@portnov portnov commented Dec 25, 2022

Addressed problem description

For now, it is not clear (yet), what should be The Right structure of Sverchok's Add Node menu. The ongoing discussion is in #4831.

Solution description

  • index.yaml in the root of sverchok directory stays in place. It is still the default menu, but it is no longer the menu which is actually loaded at sverchok startup!
  • At Sverchok startup we load the index.yaml menu under user's datafiles directory - something like ~/.config/blender/3.4/datafiles/sverchok/index.yaml.
  • If at startup Sverchok does not see that file under datafiles, it will copy the default index.yaml there, before loading it.
  • Non-default menu presets that we provide with Sverchok are under menus/ directory.
  • For standard menu presets, which are named full_*.yaml, there will be a CI test which checks that they have all the same nodes as index.yaml has.
  • There can be menu presets, which contain only some subset of nodes. The convention is to name them partial_*.yaml. At the moment, there are no such presets in Sverchok distribution, but they may appear in future.
  • The user can create his own menu presets, and place them under datafiles directory, menus/ subdirectory - something like ~/.config/blender/3.4/datafiles/sverchok/menus/MY_MENU.yaml.
  • In Sverchok settings, there is now an option, allowing the user to select which preset he wishes to use. When the user clicks "Set", we copy the selected preset file to index.yaml under user's datafiles directory. So at next startup, we will use that preset.
  • If the user wishes, he may directly edit index.yaml under his datafiles directory, without having to touch the one which is in sverchok directory.

Screenshot_20221225_172422

Preflight checklist

Put an x letter in each brackets when you're done this item:

  • Code changes complete.
  • Code documentation complete.
  • Documentation for users complete (or not required, if user never sees these changes).
  • Manual testing done.
  • Unit-tests implemented.
  • Ready for merge.

settings.py Outdated
Comment on lines 12 to 14
from sverchok.ui.presets import get_sverchok_directory

"""Don't import other Sverchok modules here"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are going to initialize half of Sverchok architecture via the settings module again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

okay...
get_sverchok_directory is quite simple function, it should be somewhere in core I think...

@portnov portnov merged commit 4371f91 into master Dec 29, 2022
@portnov portnov deleted the menu_yaml_settings branch December 29, 2022 08:37
@portnov portnov mentioned this pull request Jan 2, 2023
6 tasks
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.

3 participants