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

Menu refactor

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

  • Скачать
  • Почтовые патчи
  • Простое отличие
Слиты nikitronn запросил слияние github/fork/portnov/menu_refactor в master Ноя 26, 2017
  • Обзор 22
  • Коммиты 13
  • Конвейеры 0
  • Изменения 8

Created by: portnov

I'm not sure if this is ready to merge yet, but at least we need to discuss, I think.

What this adds is:

  • Icons to node creation buttons in T panel
  • Proper tooltips (from node docstrings) to buttons in T panel
  • Proper tooltips for items in Shift-A menu.
  • Possibility to create nodes from standard Blender's Space menu (obviously only in node editor context).

screenshot_20171128_201320

More technical description of changes:

  • Special operator class is registered for each node class. This is done in menu.py.

  • Icons for operators are taken from node's bl_icon property. All icon-handling methods are moved from menu.py to sverchok.ui.sv_icons. This is done to use exactly the same code both for menu and for T panel: these functions are called both from sverchok.menu and from sverchok.ui.nodeview_space_menu.

  • A new, more regular syntax is introduced for node class docstrings. RFC-822 is to be used as a standard, at least for new nodes:

    class SvBoxNode(bpy.types.Node, SverchCustomTreeNode):
        """
        Triggers: Box
        Tooltip: Generate a Box primitive
    
        This is the long description in free form, it can include technical
        or historical remarks.
        """
    
        bl_idname = 'SvBoxNode'
        ...
  • For now, only two headers are used: Triggers is a shorthand to be used in Ctrl-Space search menu, and Tooltip is used as a tooltip. Other headers probably will be added in the future. Unknown headers are just ignored. Standard Python's email module is used to parse docstrings, so we can be more or less sure that we correctly understand RFC-822 subtle moments (multiline headers, escaping and so on).

  • Old /// syntax for search shorthands is also supported for compatibility.

  • To incapsulate docstring parsing logic, there is SvDocstring class in node_tree.py introduced.

  • An instance of SvDocstring is associated with each node class and can be obtained with node_class.get_docstring().

  • New classmethods are introduced for SverchCustomTreeNode: get_shorthand() and get_tooltip(). In the default implementation, they parse node class docstring as described above. Author of specific node can override these methods if he needs to. These new methods are used by sv_extra_search.py, menu.py and nodeview_space_menu.py.

  • Box node docstring is updated to be an example of what docstrings should look like.

What I'm not sure about is:

  • Should "enable icons" setting in preferences affect T panel also?
  • Will current code play nicely with reloads?
  • Can we simplify current code, or make it more robust against upcoming blender API changes (if any)?
Ответственный
Назначить
Проверяющие
Запросить ревью
Оценка трудозатрат
Исходная ветка: github/fork/portnov/menu_refactor