rfm2
22.0
A python-based rewrite of RenderMan for Maya
|
Classes | |
class | NodeClassification |
Functions | |
def | get_node_list_by_type (node_type) |
def | get_node_param_list (node_type) |
def | get_param_dict (node_type, param_name) |
def | rman_default_display (gnode='rmanGlobals') |
def | rman_globals (create=False) |
def | rman_default_baking_display () |
def | rman_baking_globals () |
def | create_node_connected_to (node, attr, unique=False, nodetype=None, force=False) |
def | get_integrator (bake=False) |
def | set_integrator (name, bake=False) |
def | create_default_maya_material (sg) |
def | connect_to_shading_engine (node, plug_type, shadingEngine=None) |
def | create_default_pxr_layer_network (node) |
def | connect_to_msg_array (src, dst) |
def | connect_portal_to_dome_light (node, connect_to=None) |
def | connect_lightfilter_to_light (node, connect_to=None) |
def | create_node (*args, **kwargs) |
def | get_shading_engine (bxdf_node) |
def | create_and_assign_bxdf (node_type) |
def | create_and_connect_light_filter (node_type) |
def | create_and_connect_portal (node_type, connect=True) |
def | create_and_connect_display_filter (node_type) |
def | get_shape_bxdf (shape_node) |
def | next_free_idx (int_list) |
def | create_and_connect_pattern (node_type, src_attr, dst_node, dst_attrs) |
def | add_pattern_to_selected (node_type, src_attr, dst_attrs, only_once=True) |
def | setup_default_stylized_filters () |
def | enable_stylized_looks (state) |
def | stylized_looks_enabled () |
def | create_and_select (node_type) |
def | create_holdout () |
def | remove_holdout () |
def | create_mesh_light (dst_attr=None) |
def | create_fluid_shader () |
def | create_openvdb () |
def | create_volume (geometry) |
def | get_node_param_values (node) |
def | get_search_path_types () |
def | get_search_path (t, expand_env_vars=True) |
def | get_woffs () |
def | get_bbox (selected=True, as_string=False) |
def | get_dir_maps_for_rib () |
def | create_archive_visualizer_filename (ribfile) |
def | create_archive_visualizer (xform, node) |
def | replace_frame_number_with_token (filepath) |
def | get_file_pattern_string (filePath, useFrameExtension, uvTilingMode) |
def | import_archive (file_name=None) |
def | import_procedural (file_name=None) |
def | init_archive_node (node) |
def | archive_filename_changed (node) |
def | get_bxdf (shading_engine) |
def | get_shape_shading_engine (shape) |
def | show_bxdf (node=None) |
def | reset_node (node) |
def | set_param_value (nattr, param, value=None) |
def | set_param_value_ui (*args, **kwargs) |
def | init_user_tokens (node) |
def | register_prefs () |
Variables | |
dictionary | SHADING_ENGINE_PLUG |
tuple | AOV_NODE_TYPES = ('rmanDisplay', 'rmanDisplayChannel') |
Expose a number of useful functions, like string substitution, node creation etc.
def rfm2.api.nodes.add_pattern_to_selected | ( | node_type, | |
src_attr, | |||
dst_attrs, | |||
only_once = True |
|||
) |
Add a pattern of a given node type to selected objects or materials. Args: node_type (str): node type of the new pattern src_attr (str): attribute of the newly created node. dst_attrs (list): a list of potential attributes on the destination bxdf. only_once (bool, optional): add only if it doesn't already exist. Defaults to True.
def rfm2.api.nodes.archive_filename_changed | ( | node | ) |
def rfm2.api.nodes.connect_lightfilter_to_light | ( | node, | |
connect_to = None |
|||
) |
def rfm2.api.nodes.connect_portal_to_dome_light | ( | node, | |
connect_to = None |
|||
) |
Connect an existing portal node to a PxrDomeLight node. * If the current selection contains a PxrDomeLight, connect to this one. * Otherwise, pick the first dome light on the scene. * Warn if there is no dome light in the scene. Args: - node (str): the PxrPortalLight node. Returns: - None
def rfm2.api.nodes.connect_to_msg_array | ( | src, | |
dst | |||
) |
def rfm2.api.nodes.connect_to_shading_engine | ( | node, | |
plug_type, | |||
shadingEngine = None |
|||
) |
Connect a node to a shadingEngine node. This function takes into consideration user preferences (rfmShadingEngineUseRmanPlugs) to connect RenderMan nodes either to Maya's standard plugs (surfaceShader and displacementShader) or to our custom plugs (rman__surface and rman__displacement). Surface mode: When using the shadingEngine's RenderMan plugs, we need to attach a maya surface shader to avoid a getting a green viewport representation. But we leave plenty of choice to the user, via maya preferences: - None: do not connect anything to surfaceShader plug. - Use initialShadingGroup shader: connect the default surface shader. - Use callback: users can register a maya callback that be called by RfM after the connection of the RenderMan node. - owner: 'RenderMan_for_Maya' - hook: 'rmanPostConnectToShadingEngine' - arg 1 (str): name of the shadingEngine node - Choose a maya surface shader node type. We will create a new instance and connect it to the shadingEngine. Displacement mode: if anything is selected when this is called, we examine the selection to find a related shadingEngine (SE) to connect to: - select a shadingEngine: we connect the displacement node to that SE node. - select a bxdf: we connect the displacement node to the SE that bxdf is connected to. - select a shape/transform: we find the SE connected to the shape and connect our displacement to it. Args: - node (str): the node's name - plug_type (str): requested plug type: 'srf' or 'dsp' respectively for surface and displacement.
def rfm2.api.nodes.create_and_assign_bxdf | ( | node_type | ) |
def rfm2.api.nodes.create_and_connect_display_filter | ( | node_type | ) |
Create a display filter of a given node type and connect it to the first available displayFilter plug.
def rfm2.api.nodes.create_and_connect_light_filter | ( | node_type | ) |
def rfm2.api.nodes.create_and_connect_pattern | ( | node_type, | |
src_attr, | |||
dst_node, | |||
dst_attrs | |||
) |
Create a pattern of a given type and connect it to another node. Args: node_type (str): the node type to be created. src_attr (str): attribute of the newly created node. dst_node (str): existing node we chould connect to. dst_attrs (list): a list of potential attributes on the destination bxdf.
def rfm2.api.nodes.create_and_connect_portal | ( | node_type, | |
connect = True |
|||
) |
def rfm2.api.nodes.create_and_select | ( | node_type | ) |
def rfm2.api.nodes.create_archive_visualizer | ( | xform, | |
node | |||
) |
def rfm2.api.nodes.create_archive_visualizer_filename | ( | ribfile | ) |
def rfm2.api.nodes.create_default_maya_material | ( | sg | ) |
Create a default maya surface shader (based on user prefs) and connects it to the shadingEngine node. Arguments: sg {str} -- name of the shadingEngine node. Raises: RuntimeError: If the user callback didn't return the node name. Returns: str -- the name of the maya shader node.
def rfm2.api.nodes.create_default_pxr_layer_network | ( | node | ) |
def rfm2.api.nodes.create_fluid_shader | ( | ) |
Instantiates a PxrVolume network for the selected fluid shape, to match the default fluid shading. This provides added volume controls, like for multiscattering.
def rfm2.api.nodes.create_holdout | ( | ) |
def rfm2.api.nodes.create_mesh_light | ( | dst_attr = None | ) |
Sets up the selected piece of geometry as a mesh light. This involves attaching a PxrBlack bxdf with a PxrMeshLight wired in to it. Or, if the selection already has a PxrVolume attached, the mesh light is wired in to the existing shading group.
def rfm2.api.nodes.create_node | ( | * | args, |
** | kwargs | ||
) |
Node creation callback function. All create actions from the various parts of the UI (create bar, create menu, create render node window) call this function to actually create nodes. Arguments: - postCommand (str): command to be executed after node creation - nodeType (str): the type of node to be created. Keyword Argument: - ignoreClassification (bool): Create the node even if it is not a renderman node. Defaults to False. - as_pattern (bool): If True, the bxdf node shouldn't be connected to a shadingEngine node because it is used like a pattern, i.e. a layered bxdf node. Returns: - The name of the newly created node.
def rfm2.api.nodes.create_node_connected_to | ( | node, | |
attr, | |||
unique = False , |
|||
nodetype = None , |
|||
force = False |
|||
) |
Some nodes expect a connected node on creation: just do that. This function is typically called by the node post-constructor if the node description contained an 'onCreate' property. Args: - node (str): maya node name - attr (str): the attribute the new node should be connected to. Kwargs: - unique: Some nodes can only be instanced once in a scene, like render globals. - nodetype: Provide a specific node type to override the parameter's defaults. Returns: - The created node's name. Raises: - RfmError: if the node creation failed.
def rfm2.api.nodes.create_openvdb | ( | ) |
Creates an OpenVDB visualizer node with a connected PxrVolume.
def rfm2.api.nodes.create_volume | ( | geometry | ) |
Create a volume primitive with a PxrVolume bxdf. Arguments: geometry {str} -- 'box', 'sphere' or 'cone'
def rfm2.api.nodes.enable_stylized_looks | ( | state | ) |
Basic stylized scene setup: - enable rmanGlobals.enableStylizedLooks to make sure NPR display channels are always available. - Enable AOVs in IPR, as the dislay filters need them. - call setup_default_stylized_filters()
def rfm2.api.nodes.get_bbox | ( | selected = True , |
|
as_string = False |
|||
) |
Returns a bbbox for either all items in the scene or selected items
def rfm2.api.nodes.get_bxdf | ( | shading_engine | ) |
Return the bxdf node for a given shadinEngine, taking into account user preferences (use surfaceShader or rman__surface plug). Returns None is nothing is connected.
def rfm2.api.nodes.get_dir_maps_for_rib | ( | ) |
Returns the current dirmaps as one string, formatted for RIB.
def rfm2.api.nodes.get_file_pattern_string | ( | filePath, | |
useFrameExtension, | |||
uvTilingMode | |||
) |
For use with maya file nodes, this returns an appropriate pattern string for use with RfM. It uses maya.app.general.fileTexurePathResolver.getFilePatternString but we handle the frame variable ouselves so that it's appropriately padded for RfM, like <f4>, etc.
def rfm2.api.nodes.get_integrator | ( | bake = False | ) |
Return the name of the current integrator. Returns: - the integrator node name.
def rfm2.api.nodes.get_node_list_by_type | ( | node_type | ) |
Get a list of nodes belonging to a category (bxdf, pattern, etc.) Args: - node_type (str): the node class. Always lower case. Returns: - A list of maya node types.
def rfm2.api.nodes.get_node_param_list | ( | node_type | ) |
Get the parameter list of a node. Args: - node_type (str): the maya node type. Returns: - A list of parameter names. Raises: - RfmError: Id the node type is unknown to RFM.
def rfm2.api.nodes.get_node_param_values | ( | node | ) |
Return a dict containing a RenderMan node's params, type and values, like so: {'channelSource': {'type': 'string', 'value': 'Ci'}, 'channelType': {'type': 'string', 'value': 'color'}, 'enabled': {'type': 'int', 'value': True}, 'lpeLightGroup': {'type': 'string', 'value': None}, 'remapBreakPoint': {'type': 'float', 'value': 0.0}, 'remapMaxValue': {'type': 'float', 'value': 0.0}, 'remapSmoothness': {'type': 'float', 'value': 0.0}} Args: - node: the name of a maya node in the current scene. NOTE: this function returns an empty dict if you ask for a non-RenderMan node. You have been warned.
def rfm2.api.nodes.get_param_dict | ( | node_type, | |
param_name | |||
) |
Return a parameter's properties in a dict. Args: - node_type (str): maya node type. - param_name (str): requested parameter name. Returns: - A python dict Raises: - RfmError: the node type doesn't belong to RFM. - RfmError: unknown parameter name.
def rfm2.api.nodes.get_search_path | ( | t, | |
expand_env_vars = True |
|||
) |
Returns the list of paths for a given renderer searchpath type. eg. shader
def rfm2.api.nodes.get_search_path_types | ( | ) |
Returns a list of the renderer search path types defined in rfm.json
def rfm2.api.nodes.get_shading_engine | ( | bxdf_node | ) |
def rfm2.api.nodes.get_shape_bxdf | ( | shape_node | ) |
Return the bxdf node connected to a shape or None
def rfm2.api.nodes.get_shape_shading_engine | ( | shape | ) |
Returns the shadingEngine node for a given shape. Returns None if nothing is connected.
def rfm2.api.nodes.get_woffs | ( | ) |
def rfm2.api.nodes.import_archive | ( | file_name = None | ) |
Opens a file browser where an archive can be selected (rib, zip, or alembic). A RenderManArchive node is created in the scene referencing the archive.
def rfm2.api.nodes.import_procedural | ( | file_name = None | ) |
Opens a file browser where a RenderMan procedural plug-in can be selected. A RenderManProcedural node is created in the scene referencing the procedural plug-in.
def rfm2.api.nodes.init_archive_node | ( | node | ) |
def rfm2.api.nodes.init_user_tokens | ( | node | ) |
Sets the predefined user tokens on a rmanGlobals node. These tokens have been defined in one or more rfm.json files. Arguments: node {str} -- the node's name
def rfm2.api.nodes.next_free_idx | ( | int_list | ) |
Return the next available plug index based on a list of existing indices. If there is no gap in the list, last index + 1 is returned
def rfm2.api.nodes.register_prefs | ( | ) |
def rfm2.api.nodes.remove_holdout | ( | ) |
def rfm2.api.nodes.replace_frame_number_with_token | ( | filepath | ) |
Find the frame number in a filename and replace it with a <f> or <fn> token. We expect the frame number to be just before the frame number and preceded by a dot or underscore, like so: FILENAME.STUFF.FRAME.EXT or FILENAME.STUFF_FRAME.EXT We look at the number of characters used for the frame number to detect if it is zero-padded. If in doubt, we list the files in the sequence and check the first file. Arguments: filepath {str} -- the file path Returns: (bool, filepath) -- True if the path was modified, then the filepath.
def rfm2.api.nodes.reset_node | ( | node | ) |
Reset a RenderMan node to its default values by looking up defaults in its node description. Arguments: - node {str} -- the node's name
def rfm2.api.nodes.rman_baking_globals | ( | ) |
def rfm2.api.nodes.rman_default_baking_display | ( | ) |
Returns the primary renderMan display node name. Returns: - the rmanDisplay node name as a string.
def rfm2.api.nodes.rman_default_display | ( | gnode = 'rmanGlobals' | ) |
Returns the primary renderMan display node name. Returns: - the rmanDisplay node name as a string.
def rfm2.api.nodes.rman_globals | ( | create = False | ) |
Returns the renderMan Globals node name Keyword Arguments: create {bool} -- Create a new node if True (default: {False}) Returns: str -- The name of the rmanGlobals node
def rfm2.api.nodes.set_integrator | ( | name, | |
bake = False |
|||
) |
Change the integrator used by the rmanGlobals node. Args: - name (str): name of the new integrator. Returns: - None
def rfm2.api.nodes.set_param_value | ( | nattr, | |
param, | |||
value = None |
|||
) |
Sets a maya attribute to a given value (or its default value if None provided) based on its NodesDescParam. Arguments: - nattr {str} -- full plug name (with index if part of a multi/array attribute) - param {NodeDescParam} -- The parameter description object. Keyword Arguments: - value {any} -- a specific value for that plug. The param's default will be used if None (default: {None})
def rfm2.api.nodes.set_param_value_ui | ( | * | args, |
** | kwargs | ||
) |
def rfm2.api.nodes.setup_default_stylized_filters | ( | ) |
Create default stylized display filters and connect them to the rmanGlobals node, if there isn't a single connected stylized filter yet.
def rfm2.api.nodes.show_bxdf | ( | node = None | ) |
Shows the node's bxdf in the attribute editor. If node is None, we use the currently selected node.
def rfm2.api.nodes.stylized_looks_enabled | ( | ) |
tuple rfm2.api.nodes.AOV_NODE_TYPES = ('rmanDisplay', 'rmanDisplayChannel') |