rfm2
22.0
A python-based rewrite of RenderMan for Maya
|
Functions | |
def | execute_callback (pdesc, name) |
def | qt_ui (param_desc) |
def | widget (param_desc) |
def | get_pref (pdesc, hold=False) |
def | get_pref_by_name (pref_name) |
def | set_pref (pdesc, value, hold=False) |
def | set_pref_by_name (pref_name, val) |
def | remove_pref (pdesc, hold=False) |
def | remove_all_prefs () |
def | register_pref_item (group, param_desc, validator=None) |
def | register_update_callback (func) |
def | get_module_prefs () |
def | clear_module_prefs () |
def | pref_window () |
def | set_defaults () |
def | hold_current_state (mode) |
def | update_ui () |
def | create_frame () |
def | create () |
def | resize_tab_layout_to_fit (tablyt) |
def | register_prefs_ui () |
def | unregister_ui () |
Variables | |
long = int | |
string | kQtUI = 'qt_ui' |
string | PAGE_SEP = '|' |
The preferences module is in charge of: - Registering a preference tab in Maya's preference dialog. - Drawing and managing the preference UI. - Pulling preferences from rfm2 modules. - Provide preference registration and lookup API. * Registering a RenderMan preference Modules (or any other python program) can register preferences to be displayed in the RenderMan section of Maya's preference window. All you need to do is call rfm2.ui.prefs.register_pref_item(). See that function's documentation for details. * Preferences Registration At startup, get_module_prefs() is called by rfm2.renderer.register(). get_module_prefs() walks the rfm2 module and call register_prefs() for each module. If that function doesn't exist for a given module, we simply catch the error and move on. It is also possible for any external script to register their own tab/pref by calling rfm2.ui.prefs.register_pref_item(). RegisterPrefs() is implemented in rfm2.utils.file_dialog and rfm2.render. RegisterPrefs() can register one or more prefs. It can be as simple as : - creating a dictionnary to describe the pref pref = {'name': 'rfmRenderIprDestination', 'type': 'string', 'default': 'Maya Render View', 'label': 'Render to:', 'page': 'Render/IPR', 'widget': 'popup', 'options': 'Maya Render View|Pixar It'} - initialize a rman_utils.node_desc.NodeDescParamJSON object with it. pdesc = rman_utils.node_desc.NodeDescParamJSON(pref) - pass it as the second argument to rfm2.ui.prefs.register_pref_item(). rfm2.ui.prefs.register_pref_item(prefGroup, node_desc.NodeDescParamJSON(pref)) * Supported widgets - int: mapper, checkBox, default - float: default - string: popup, fileInput, default * Useful API calls register_pref_item(): register a single RenderMan pref. get_pref_by_name(): get a pref's value by name. set_pref_by_name(): prefs are usually set in the preference dialog, but it is sometimes useful to store a specific value from another UI.
def rfm2.ui.prefs.clear_module_prefs | ( | ) |
Clears our internal pref storage.
def rfm2.ui.prefs.create | ( | ) |
Called by Maya: The callback function to create the tab.
def rfm2.ui.prefs.create_frame | ( | ) |
Called by Maya: The callback function to create the frame layout of the tab.
def rfm2.ui.prefs.execute_callback | ( | pdesc, | |
name | |||
) |
Safely execute a Qt callback for custom Qt widgets
def rfm2.ui.prefs.get_module_prefs | ( | ) |
Recursively walk through the rfm2 module to harvest preferences. We call register_prefs() on every module to give them an opportunity to contribute preference items. If there is no register_prefs() function, we silently swallow the error and move on to the next module.
def rfm2.ui.prefs.get_pref | ( | pdesc, | |
hold = False |
|||
) |
Return a pref's value, based on the pdesc object. Args: - pdesc (NodeDescParamJSON): full pref description. Kwargs: - hold: get the value of the holding primvar instead. Returns: - any type
def rfm2.ui.prefs.get_pref_by_name | ( | pref_name | ) |
Return a pref's value based on its name. Args: - pref_name (str): the name of the optionVar. Returns: - any type Raises: - ValueError: if this is not a registered pref.
def rfm2.ui.prefs.hold_current_state | ( | mode | ) |
Called by Maya: The callback function to save or restore the preference setting of the tab.
def rfm2.ui.prefs.pref_window | ( | ) |
Return the name of Maya's preferences window.
def rfm2.ui.prefs.qt_ui | ( | param_desc | ) |
Create a Qt UI by calling its 'create' callback.
def rfm2.ui.prefs.register_pref_item | ( | group, | |
param_desc, | |||
validator = None |
|||
) |
Register a preference that will be displayed in Maya's preferences dialog. Args: - group (string): groups are used to identify and order the prefs in the UI. Groups are alphabetically sorted and will be drawn in the same order. The value of the group string should be consistent accross modules but isn't used beyond ordering. - param_desc (NodeDescParamJSON): full pref description object. Raises: - KeyError: if the same pref has been registered in the same group.
def rfm2.ui.prefs.register_prefs_ui | ( | ) |
Register the RenderMan preference tab in Maya. NOTE: addCustomPrefsTab() only takes MEL procs as arguments, so we use the MEL proc declared below to call our python code.
def rfm2.ui.prefs.register_update_callback | ( | func | ) |
def rfm2.ui.prefs.remove_all_prefs | ( | ) |
Delete all registered prefs from Maya, by deleting the optionVars.
def rfm2.ui.prefs.remove_pref | ( | pdesc, | |
hold = False |
|||
) |
Remove a pref from Maya's optionVars. Args: - pdesc (NodeDescParamJSON): a pref description.
def rfm2.ui.prefs.resize_tab_layout_to_fit | ( | tablyt | ) |
Resize our tab layout by recursively computing the size of enclosed controls.
def rfm2.ui.prefs.set_defaults | ( | ) |
Called by Maya: The callback function to set option vars to default values.
def rfm2.ui.prefs.set_pref | ( | pdesc, | |
value, | |||
hold = False |
|||
) |
Sets the value of a pref, based on it's description object. Args: - pdesc (NodeDescParamJSON): full pref description. - value (any type): the new value. Kwargs: - hold: write the new value to the holding optionVar instead. Raises: - TypeError: if we encounter an unknown data type.
def rfm2.ui.prefs.set_pref_by_name | ( | pref_name, | |
val | |||
) |
Set the value of a pref, based on its name. Args: - pref_name (str): the pref's name. - val (any type): the new value. Raises: - KeyError: if this is not a registered pref.
def rfm2.ui.prefs.unregister_ui | ( | ) |
Unregister the RenderMan preference tab in Maya and clear our preference storage.
def rfm2.ui.prefs.update_ui | ( | ) |
Called by Maya: The callback function to update UI elements when option vars changed
def rfm2.ui.prefs.widget | ( | param_desc | ) |
Create/update a preference widget. We support the following widgets (arrays not supported for now): - int: mapper, checkBox, default - float: default - string: popup, fileInput, default Args: - param_desc (NodeDescParamJSON): full pref description. Raises: - TypeError: if we encounter an un-implemented data type.
string rfm2.ui.prefs.kQtUI = 'qt_ui' |
rfm2.ui.prefs.long = int |
string rfm2.ui.prefs.PAGE_SEP = '|' |