MenuItemDescription#
- class omni.kit.menu.utils.extension_window_helper.MenuItemDescription(
- name: str = '',
- glyph: str = '',
- header: str | None = None,
- appear_after: list | str = '',
- enabled: bool = True,
- ticked: bool = False,
- ticked_value: bool | None = None,
- radio_group: str | None = '',
- sub_menu=None,
- hotkey: Tuple[int, int] | None = None,
- name_fn: Callable | None = None,
- show_fn: Callable | None = None,
- enable_fn: Callable | None = None,
- ticked_fn: Callable | None = None,
- onclick_action: Tuple | None = None,
- unclick_action: Tuple | None = None,
- onclick_fn: Callable | None = None,
- unclick_fn: Callable | None = None,
- onclick_right_fn: Callable | None = None,
- original_svg_color: bool = False,
- original_menu_item=None,
- user=None,
- hotkey_window: str | None = 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: str | None = None,
- appear_after: list | str = '',
- enabled: bool = True,
- ticked: bool = False,
- ticked_value: bool | None = None,
- radio_group: str | None = '',
- sub_menu=None,
- hotkey: Tuple[int, int] | None = None,
- name_fn: Callable | None = None,
- show_fn: Callable | None = None,
- enable_fn: Callable | None = None,
- ticked_fn: Callable | None = None,
- onclick_action: Tuple | None = None,
- unclick_action: Tuple | None = None,
- onclick_fn: Callable | None = None,
- unclick_fn: Callable | None = None,
- onclick_right_fn: Callable | None = None,
- original_svg_color: bool = False,
- original_menu_item=None,
- user=None,
- hotkey_window: str | None = None,