rfm2
22.0
A python-based rewrite of RenderMan for Maya
|
Functions | |
def | first_free_index |
def | valid_node_name |
def | node_type |
def | selected_displays |
def | selected_custom_channels |
def | display_selected |
def | channel_selected |
def | delete_custom_channel |
def | rename_display_item |
def | do_rename_display_item |
def | double_click_channels |
def | double_click_displays |
def | create_display_channel_node |
def | create_new_display |
def | create_selected_display_channels |
def | create_display_from_channel |
def | remove_from_display_list |
def | connect_channel_to_display |
def | add_channel_to_display |
def | add_tree_view_item |
def | drag_n_drop_display |
def | tree_view_item_label |
def | save_items_state |
def | restore_item_state |
def | update_available_channel_list |
def | update_display_list |
def | available_select_CB |
def | display_select_CB |
def | list_selection_changed_CB |
def | update_inspector |
def | set_preset_display_params |
def | add_preset_display |
def | create_list_widget |
def | create |
def | update |
Variables | |
dictionary | _SELECTEDLIST = {} |
list | _ACTIVE_COLOR = [0.32, 0.52, 0.65] |
list | _INACTIVE_COLOR = [0.32 * 0.67, 0.52 * 0.67, 0.65 * 0.67] |
tuple | _VALIDNODENAME = re.compile(r'[_a-zA-Z]\w*\Z') |
list | AOV_NODE_TYPES = ['rmanDisplay', 'rmanDisplayChannel'] |
dictionary | ORNC |
Module implementing the AOV user-interface in the render globals.
def rfm2.ui.aov.add_channel_to_display | ( | uiprefix, | |
args | |||
) |
Create displayChannels (if need be) and connect them to the selected display. Args: - *args (tuple): un-used. Returns: - None
def rfm2.ui.aov.add_preset_display | ( | args | ) |
Create a fully configured display based on aovs.json. If the display already exists (and we are not in batch mode), we ask the user what to do. In batch mode, we just raise an error. Args: - name: the display's name - data: the display's dict - uiprefix: the current UI prefix.
def rfm2.ui.aov.add_tree_view_item | ( | ctl, | |
item, | |||
label, | |||
parent, | |||
description = '' |
|||
) |
Add a treeView item and handle the case where an item with the same name already exists. In that case, modify the item name and set the label to the original item name.
def rfm2.ui.aov.available_select_CB | ( | uiprefix, | |
args | |||
) |
def rfm2.ui.aov.channel_selected | ( | uiprefix | ) |
Return True if a channel is selected. Args: - uiprefix (str): the treeView control prefix Returns: - True if a channel is selected
def rfm2.ui.aov.connect_channel_to_display | ( | uiprefix, | |
channel_list, | |||
display = None |
|||
) |
Connect a rmanDisplayChannel to a rmanDisplay to indicate that it will contribute to this AOV. We trigger an update of the display list at the end. Args: - channel_list (list): list of rmanDisplayChannel nodes to connect. - display (str): the name of the display we should connect the channels to. If provided, we will ignore the UI selection. Returns: - True on success, False if no connection occured because there wasn't any selected display.
def rfm2.ui.aov.create | ( | uiroot, | |
uiprefix | |||
) |
Build the AOV configuration UI. This is the upper part of the UI, without the selection inspector pane. Args: - uiroot (str): ui parent layout in which we will build. The parent will be restored at the end of the function. Returns: - None
def rfm2.ui.aov.create_display_channel_node | ( | channel_name, | |
do_update, | |||
args, | |||
kwargs | |||
) |
Create a new rmanDisplayChannel Node. * if the channel name is 'Custom...', we create a blank (un-configured) node. In interactive mode, we ask the user to name it first. * Otherwise, we use the associated channel definition to configure the newly created node. Args: - channel_name (str): the new node's name. - do_update (str): trigger a channel list update if True. Returns: - str: the node name
def rfm2.ui.aov.create_display_from_channel | ( | uiprefix, | |
channel | |||
) |
Create a new display with a named channel. Args: - uiprefix (str): prefix of the layout hinting at the window kind. - channel (str): name of the channel used by the new display.
def rfm2.ui.aov.create_list_widget | ( | uiprefix, | |
ctlName, | |||
label, | |||
searchFunc, | |||
annotation, | |||
selectFunc, | |||
doubleClickFunc = None , |
|||
editLabelFunc = None , |
|||
itemRenamedFunc = None , |
|||
dragAndDropCmd = None , |
|||
multiSelection = False |
|||
) |
Build a compound widget with a label, a search field and a treeView list. Args: - uiprefix: the current UI prefix. - ctlName (str): The base name of this control. Sub-control names will derive from this. Returns: - return_type: the widget's layout
def rfm2.ui.aov.create_new_display | ( | uiprefix, | |
args | |||
) |
Create a new rmanDisplay node and trigger an update of the display list. Args: - *args (tuple): un-used Returns: - None
def rfm2.ui.aov.create_selected_display_channels | ( | uiprefix, | |
args | |||
) |
Create one or more rmanDisplayChannel nodes based on the current selection in the available channel list and trigger a channel list update. Args: - *args (tuple): un-used. Returns: - List of created channel nodes
def rfm2.ui.aov.delete_custom_channel | ( | uiprefix, | |
args | |||
) |
Delete selected custom displayChannels and refresh the UI. Args: - uiprefix (str): the treeView control prefix - args: passed by Maya but ignored.
def rfm2.ui.aov.display_select_CB | ( | uiprefix, | |
args | |||
) |
def rfm2.ui.aov.display_selected | ( | uiprefix, | |
display_only = False |
|||
) |
True if a display is currently selected. Args: - uiprefix (str): the treeView control prefix Kwargs: - display_only: True if we are only interested in the displa, not the \ displayChannels. Returns: - True if selected.
def rfm2.ui.aov.do_rename_display_item | ( | uiprefix, | |
item, | |||
new_name | |||
) |
def rfm2.ui.aov.double_click_channels | ( | args | ) |
Add a channel to a selected display or create a new channel from the double-clicked channel.
def rfm2.ui.aov.double_click_displays | ( | args | ) |
Return the item to be renamed by the treeView.
def rfm2.ui.aov.drag_n_drop_display | ( | uiprefix, | |
ctlsuffix, | |||
args | |||
) |
Implements drag and drop inside the display list. We support re-ordering and transferring channels to a different display. Args: - uiprefix (str): the current UI prefix. - ctlsuffix (str): a suffix for the control name. - dropped_items (list): items that were dropped. - prev_parents (list): previous parents of the dropped items. - prev_idxs (list): previous indices of dropped items. - new_parent (str): new parent under which items were dropped. - item_above (str): the items above the drop location. - item_below (str): the items below the drop location.
def rfm2.ui.aov.first_free_index | ( | node_array_attr | ) |
def rfm2.ui.aov.list_selection_changed_CB | ( | uiprefix, | |
args | |||
) |
Called by the treeView whenever the user selection changes. We update both list as well as the buttons' states and the inspector layout displaying the selection's parameters. Args: - uiprefix (str): the current UI prefix. - args (str): passed by Maya but ignored.
def rfm2.ui.aov.node_type | ( | node_name, | |
kill = ('unknown', |
|||
) |
Return the node type of a Maya node. If the node is of type 'unknown', we delete the node and return None. Args: - node_name (str): The name of a node that may exist or not. Returns: - The maya nodeType if the node exists and is not 'unknown', otherwise None.
def rfm2.ui.aov.remove_from_display_list | ( | uiprefix | ) |
Remove an entry from the display list. The entry could either be a display or a displaychannel. - display: we simply delete the display node. - displayChannel: we list connected nodes are re-connect them to the array plugs to maintain their order. The array is sparse as usual and if we don't do this the next insertion will happen at the first available position. Args: - uiprefix (str): prefix of the layout hinting at the window kind.
def rfm2.ui.aov.rename_display_item | ( | current_name, | |
proposed_name | |||
) |
Validates an item renaming opration. * This is called by maya.cmds.treeView to validate the new name. * If the proposed name is invalid, we simply warn the user instead of raising an exception. Args: - current_name (str): current node name. - proposed_name (str): potential new node name. Returns: - str: The new name if valid. - None: If the new name isn't a valid maya node name.
def rfm2.ui.aov.restore_item_state | ( | ctl, | |
item, | |||
state_dict | |||
) |
def rfm2.ui.aov.save_items_state | ( | ctl | ) |
def rfm2.ui.aov.selected_custom_channels | ( | uiprefix | ) |
Return a list of selected custom channels. Return [] if none selected.
def rfm2.ui.aov.selected_displays | ( | uiprefix | ) |
Return the names of the selected displays. Args: - uiprefix (str): the treeView control prefix. Returns: - A list of labels of the selected displays (stripping any '%' from the item's name).
def rfm2.ui.aov.set_preset_display_params | ( | uiprefix, | |
dspy, | |||
data | |||
) |
Sets the parameters on the nodes of a newly created display. We run this function using maya.utils.executeDeferred() to allow the node's postContructor() to run and finish the nodes' setup before we start making modifications. Args: - uiprefix (str): the current UI prefix. - dspy (str): name of the display node - data (dict): {param: value} dict to configure the display and the display driver.
def rfm2.ui.aov.tree_view_item_label | ( | name | ) |
Returns an item name without its trailing '%'. The '%' is added at the end of the item name to allow for duplicate nodes with unique names. This is mostly used for displayChannels. Args: -name (str): the treeView item name.
def rfm2.ui.aov.update | ( | uiroot, | |
uiprefix | |||
) |
Refresh the pre-built AOV configuration UI. We assume there is only one instance of this UI. Args: - uiroot (str): ui parent layout in which we will build. The parent will be restored at the end of the function. Returns: - None
def rfm2.ui.aov.update_available_channel_list | ( | uiprefix, | |
glob_filter | |||
) |
Refresh the available channel list based on the AOV definitions in config/aov.json. * Channels are displayed by groups and groups are greyed out. * Channels are also glob-filtered using the glob_filter string. In order to be user-friendly, we add a star at the begining and end of the glob_filter and ignore case. Args: - glob_filter (str): a glob pattern without stars at begining and end. If None, we look up the search field's current value. Returns: - None
def rfm2.ui.aov.update_display_list | ( | uiprefix, | |
glob_filter | |||
) |
Redraw the contents of the display list. The list is filtered based on the glob_filter string. Matching is not case-sensitive. Args: - glob_filter (str): a glob pattern without stars at the begining and end. If None, we look up the search field's current value. Returns: - None
def rfm2.ui.aov.update_inspector | ( | uiprefix, | |
selected_item | |||
) |
Update the layout displaying the selection's parameters. Args: - uiprefix (str): the current UI prefix. - selected_item (str): The item currently selected in the treeView.
def rfm2.ui.aov.valid_node_name | ( | node_name | ) |
Validate a potential node name, based on Maya's conventions: - Name should have at least 1 character. - First character can not be a number. - Valid character set is [a-zA-Z0-9_] Args: - node_name (str): name to be validated. Returns: - bool: True is valid.
list rfm2.ui.aov._ACTIVE_COLOR = [0.32, 0.52, 0.65] |
list rfm2.ui.aov._INACTIVE_COLOR = [0.32 * 0.67, 0.52 * 0.67, 0.65 * 0.67] |
dictionary rfm2.ui.aov._SELECTEDLIST = {} |
tuple rfm2.ui.aov._VALIDNODENAME = re.compile(r'[_a-zA-Z]\w*\Z') |
list rfm2.ui.aov.AOV_NODE_TYPES = ['rmanDisplay', 'rmanDisplayChannel'] |
dictionary rfm2.ui.aov.ORNC |