MenuItemDescription
- class omni.kit.menu.utils.scripts.utils.MenuItemDescription(name: str = '', glyph: str = '', header: Optional[str] = None, appear_after: Union[list, str] = '', enabled: bool = True, ticked: bool = False, ticked_value: Optional[bool] = None, radio_group: Optional[str] = '', sub_menu=None, hotkey: Optional[Tuple[int, int]] = None, name_fn: Optional[Callable] = None, show_fn: Optional[Callable] = None, enable_fn: Optional[Callable] = None, ticked_fn: Optional[Callable] = None, onclick_action: Optional[Tuple] = None, unclick_action: Optional[Tuple] = None, onclick_fn: Optional[Callable] = None, unclick_fn: Optional[Callable] = None, onclick_right_fn: Optional[Callable] = None, original_svg_color: bool = False, original_menu_item=None, user=None, hotkey_window: Optional[str] = None)
Bases:
object
Class for creation of menu items
“name” is name shown on menu. (if name is “” then a menu spacer is added. Can be combined with show_fn)
“glyph” is icon shown on menu, full paths are allowed
“header” is None or string value & will add separator above item
“appear_after” is name of menu item to insert after. Used for appending menus, can be a list or string
“enabled” is True/False, True when item enabled
“ticked” menu item is ticked when True
“ticked_fn” function or list of functions used to decide if menu item is ticked
“ticked_value” is value used to decide if menu item is ticked
“radio_group” is name of group of ticked-radio buttons, setting one in group will clear the others
“sub_menu” is sub menu to this menu
“hotkey” is hotkey values for menu item
“name_fn” is function to get menu name
“show_fn” function or list of functions used to decide if menu item is shown. All functions must return True to show
“enable_fn” function or list of functions used to decide if menu item is enabled. All functions must return True to be enabled
“onclick_action” action called when user clicks menu item
“unclick_action” action called when user release’s button on menu item
“onclick_fn” function called when user clicks menu item (deprecated)
“unclick_fn” function called when user releases click on menu item (deprecated)
“onclick_right_fn” function called when user right clicks menu item (deprecated)
“original_svg_color” isn’t used (deprecated)
“user” is user dictionary that is passed to menu. NOTE: values will be added to this dictionary
hotkey_window is title of window where hotkey to be triggered
Methods
__init__
([name, glyph, header, ...])add_on_delete_func
(on_delete_fn)add_on_hotkey_update_func
(hotkey_update_fn)destroy
([recurse])get
(key[, default_value])get_action_mapping_desc
()has_action
()json_enc
()remove_on_delete_func
(on_delete_fn)remove_on_hotkey_update_func
(hotkey_update_fn)set_hotkey
(hotkey)Attributes
MAX_DEPTH
- __init__(name: str = '', glyph: str = '', header: Optional[str] = None, appear_after: Union[list, str] = '', enabled: bool = True, ticked: bool = False, ticked_value: Optional[bool] = None, radio_group: Optional[str] = '', sub_menu=None, hotkey: Optional[Tuple[int, int]] = None, name_fn: Optional[Callable] = None, show_fn: Optional[Callable] = None, enable_fn: Optional[Callable] = None, ticked_fn: Optional[Callable] = None, onclick_action: Optional[Tuple] = None, unclick_action: Optional[Tuple] = None, onclick_fn: Optional[Callable] = None, unclick_fn: Optional[Callable] = None, onclick_right_fn: Optional[Callable] = None, original_svg_color: bool = False, original_menu_item=None, user=None, hotkey_window: Optional[str] = None)