• S sverchok
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • Задачи 148
    • Задачи 148
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 21
    • Запросы на слияние 21
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • Wiki
    • Wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • nikitronn
  • sverchok
  • Запросы на слияние
  • !4856

Menu presets: automatic application.

  • Ревью изменений

  • Скачать
  • Почтовые патчи
  • Простое отличие
Слиты nikitronn запросил слияние menu_presets_v2 в master Янв 02, 2023
  • Обзор 4
  • Коммиты 2
  • Конвейеры 0
  • Изменения 7

Created by: portnov

Addressed problem description

This is a continuation of #4841.

When we add a node, or just rearrange menu presets for some reason, user's index.yaml in datafiles directory still has to be updated. Before current PR, user had to press "Set" in preferences manually after each sverchok update. This is not obvious at all.

Options which were considered

  1. Original solution: copy the preset from sverchok directory to user's datafiles directory only at first sverchok startup, when there is no file in datafiles. - ❌ Rejected: the file will not be updated when we add a new node in Sverchok, or rearrange the default menu.
  2. Add a possibility to apply the selected menu preset automatically, at each blender startup. If enabled, at startup, copy the selected preset file from sverchok directory to user's datafiles. — ❌ Rejected: there is no sense in having index.yaml in user's datafiles, if that file is never actually used, as it is overwritten at each blender startup.
  3. ...If enabled, overwrite user's index.yaml only when the file in sverchok directory is newer than the one in datafiles. ❌ Rejected: not obvious for user, when his changes are overwritten, and there is no clear enough way to notify the user of such actions (message in the log will be most probably ignored).
  • Sub-option: preserve previous version of user's index.yaml as index.yaml.bak. ❌ Rejected: there is no clear or obvious way for user to merge his version of menu with the one from sverchok preset. And again, no clear way for user to know when his changes were overwritten.
  1. Options 1 - 3 were designed having in mind the problem that we can not refer to preferences at the moment when we are loading the menu. But, if we need an option to enable or disable menu file overwriting, then we will have to solve that problem somehow. But, once it is solved, we can look into preferences and use menu preset file name from there. So: If the option is enabled, then do not copy anything, just use menu preset file from sverchok directory. If it is disabled, then we copy the preset file once at first Sverchok startup, and when the user explicitly presses the button. This means that if the option is disabled, the user takes responsibility of updating his index.yaml. ✔

Solution description

Add a possibility to use the menu preset file from sverchok directory directly, ignoring the file in user's datafiles.

If the feature is not enabled, it means the user takes the responsibility on updating his index.yaml manually.

Screenshot_20230104_115648

Technically, for this to work, I had to implement "lazy" initialization of "add node" menu, because in previous state, when I tried to call to preferences at the place where we located index.yaml, it appeared that preferences were not registered yet.

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.
Ответственный
Назначить
Проверяющие
Запросить ревью
Оценка трудозатрат
Исходная ветка: menu_presets_v2