python.tk_houdini
¶
Subpackages¶
Submodules¶
Package Contents¶
Classes¶
Base class for interface elements that trigger command actions. |
|
Creates panels and installs them into the session. |
|
Base class for interface elements that trigger command actions. |
Functions¶
Ensures a timer is running to periodically check for current file change. |
|
|
Returns a list of AppCommands for the engine’s registered commands. |
|
Returns a list of AppCommands for the engine’s registered panels. |
|
Returns a wrapped widget for use in a houdini python panel. |
-
class
AppCommandsMenu
(engine, commands)[source]¶ Bases:
python.tk_houdini.ui_generation.AppCommandsUI
Base class for interface elements that trigger command actions.
Constructs a top-level “Shotgun” menu.
Same logic for both the static and dynamic menu.
- Returns
tuple containing the root element and the shotgun menu item
Construct the dynamic Shotgun menu for toolkit in Houdini 15+.
- Parameters
xml_path – The path to the xml file to store the menu definitions
Construct the static Shotgun menu for older versions of Houdini.
- Parameters
xml_path – The path to the xml file to store the menu definitions
-
_get_commands_by_app
(self)¶ This method returns a flattened list of registered app commands.
This is called directly as a part of the dynamic menu generation code as houdini builds submenus when the user clicks on the top-level Shotgun menu. This should execute quickly.
-
_get_context_commands
(self)¶ This method returns a modified list of context commands.
This is called directly as a part of the dynamic menu generation code as houdini builds submenus when the user clicks on the top-level Shotgun menu. This should execute quickly.
-
_itemNode
(self, parent, label, id)¶ Constructs a static menu item for the supplied parent.
Adds the script path and args which houdini uses as the callback.
Constructs a submenu for the supplied parent.
Create the Shotgun Menu
-
class
AppCommandsPanelHandler
(engine, commands, panel_commands)[source]¶ Bases:
python.tk_houdini.ui_generation.AppCommandsUI
Creates panels and installs them into the session.
-
create_panels
(self, panels_file)¶ Create the registered panels.
-
-
class
AppCommandsShelf
(engine, commands=None, name='Shotgun', label='Shotgun')[source]¶ Bases:
python.tk_houdini.ui_generation.AppCommandsUI
Base class for interface elements that trigger command actions.
-
create_shelf
(self, shelf_file)¶ Creates a Shotgun shelf with a tool button for each command.
- shelf_file:
The xml file where the shelf definition will be written
-
create_tool
(self, shelf_file, cmd)¶ Create a new shelf tool.
- cmd:
The AppCommand to create a shelf tool for.
- shelf_file:
The shelf file to write the tool definition to.
-
destroy_shelf
(self)¶ Destroy the shelf and all of its tools.
-
destroy_tools
(self)¶ Destroy the tools on the shelf, leaving a blank shelf.
-
-
ensure_file_change_timer_running
()[source]¶ Ensures a timer is running to periodically check for current file change.
-
get_registered_commands
(engine)[source]¶ Returns a list of AppCommands for the engine’s registered commands.
- Parameters
engine – The engine to return registered commands for
NOTE: This method currently returns additional panel commands that are not registered, but always present in the shotgun menu and shelves. Those commands are:
“Jump to Shotgun” “Jump to File System”
-
get_registered_panels
(engine)[source]¶ Returns a list of AppCommands for the engine’s registered panels.
- Parameters
engine – The engine to return registered panel commands for
-
get_wrapped_panel_widget
(engine, widget_class, bundle, title)[source]¶ Returns a wrapped widget for use in a houdini python panel.
- Parameters
engine – The engine instance.
widget_class – The widget class to wrap.
bundle – The bundle associated with the panel being wrapped.
title – The title to display for this panel.
Here we subclass the panel widget in order to hijack the first paint event. There, we force clear the parent’s stylesheet and reset the widget with the bundled stylesheet if there is one. This prevents houdini’s parenting from cramping the panel’s style. We also filter for change events to detect when something else attempts to change the style so we can force it back to the bundled style. The first paint event isn’t sufficient for panels saved in desktops, but detecting style change seems to do the trick.