Source code for cgl.plugins.substance.custom_menu
import logging
from PySide6 import QtWidgets
from cgl.plugins.CustomMenu import CustomMenu
[docs]
class SubstanceCustomMenu(CustomMenu):
def __init__(self, software="substance", type_="menus"):
CustomMenu.__init__(self, software, type_)
# [Python] COMMAND: import cookbook.substance.menus.Alchemy.Build as Build; Build.run()
[docs]
def add_button(
self,
menu_label,
label="",
annotation="",
command="",
icon="",
image_overlay_label="",
hot_key="",
):
menu_object = self.menu_dict[menu_label]
new_action = menu_object.addAction(label)
new_action.triggered.connect(lambda: exec(command))
# @staticmethod
# def find_menu_by_name(parent, menu_name):
# return menu_name
# sp.ui.delete_ui_element(menu_object)