rfm2  22.0
A python-based rewrite of RenderMan for Maya
 All Classes Namespaces Files Functions Variables Pages
rfm2.api.nodes Namespace Reference

Classes

class  NodeClassification
 

Functions

def set_aov_name
 
def get_aov_name
 
def get_aov_node
 
def get_node_list_by_type
 
def get_node_param_list
 
def get_param_dict
 
def rman_default_display
 
def rman_globals
 
def create_node_connected_to
 
def get_integrator
 
def set_integrator
 
def connect_to_shading_engine
 
def create_default_pxr_layer_network
 
def connect_to_msg_array
 
def connect_portal_to_dome_light
 
def connect_lightfilter_to_light
 
def create_node
 
def get_shading_engine
 
def create_and_assign_bxdf
 
def create_and_connect_light_filter
 
def create_and_connect_portal
 
def create_and_select
 
def create_holdout
 
def remove_holdout
 
def create_mesh_light
 
def create_fluid_shader
 
def create_openvdb
 
def get_node_param_values
 
def get_search_path_types
 
def get_search_path
 
def get_bbox
 
def get_dir_maps_for_rib
 
def create_archive_visualizer_filename
 
def create_archive_visualizer
 
def import_archive
 
def import_procedural
 
def init_archive_node
 
def archive_filename_changed
 
def get_bxdf
 
def get_shape_shading_engine
 
def show_bxdf
 
def reset_node
 
def set_param_value
 
def set_param_value_ui
 
def register_prefs
 

Variables

dictionary SHADING_ENGINE_PLUG
 
tuple AOV_NODE_TYPES = ('rmanDisplay', 'rmanDisplayChannel')
 

Detailed Description

Expose a number of useful functions, like string substitution, node creation
etc.

Function Documentation

def rfm2.api.nodes.archive_filename_changed (   node)

+ Here is the call graph for this function:

def rfm2.api.nodes.connect_lightfilter_to_light (   node,
  connect_to = None 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.connect_to_msg_array (   src,
  dst 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.connect_to_shading_engine (   node,
  plug_type 
)
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.

+ Here is the caller graph for this function:

def rfm2.api.nodes.create_and_assign_bxdf (   node_type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.create_and_connect_light_filter (   node_type)

+ Here is the call graph for this function:

def rfm2.api.nodes.create_and_connect_portal (   node_type,
  connect = True 
)

+ Here is the call graph for this function:

def rfm2.api.nodes.create_and_select (   node_type)

+ Here is the call graph for this function:

def rfm2.api.nodes.create_archive_visualizer (   xform,
  node 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.create_archive_visualizer_filename (   ribfile)

+ Here is the caller graph for this function:

def rfm2.api.nodes.create_default_pxr_layer_network (   node)

+ Here is the caller graph for this function:

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.

+ Here is the call graph for this function:

def rfm2.api.nodes.create_holdout ( )

+ Here is the call graph for this function:

def rfm2.api.nodes.create_mesh_light ( )
Sets up the selected piece of geometry as a mesh light.
This involves attaching a PxrBlack bxdf with a PxrMeshLight wired in to it.

+ Here is the call graph for this function:

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.

Returns:
- The name of the newly created node.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.create_openvdb ( )
Creates an OpenVDB visualizer node with a connected PxrVolume.

+ Here is the call graph for this function:

def rfm2.api.nodes.get_aov_name (   node)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.get_aov_node (   name,
  ntype = AOV_NODE_TYPES 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

+ Here is the caller graph for this function:

def rfm2.api.nodes.get_dir_maps_for_rib ( )
Returns the current dirmaps as one string, formatted for RIB.

+ Here is the call graph for this function:

def rfm2.api.nodes.get_integrator ( )
Return the name of the current integrator.

Returns:
- the integrator node name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

+ Here is the call graph for this function:

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.

+ Here is the call graph for this function:

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.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

def rfm2.api.nodes.get_search_path_types ( )
Returns a list of the renderer search path types defined in rfm.json

+ Here is the call graph for this function:

def rfm2.api.nodes.get_shading_engine (   node)

+ Here is the caller graph for this function:

def rfm2.api.nodes.get_shape_shading_engine (   shape)
Returns the shadingEngine node for a given shape.
   Returns None if nothing is connected.

+ Here is the caller graph for this function:

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.

+ Here is the call graph for this function:

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.register_prefs ( )
def rfm2.api.nodes.remove_holdout ( )
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

+ Here is the call graph for this function:

def rfm2.api.nodes.rman_default_display (   gnode = 'rmanGlobals')
Returns the primary renderMan display node name.

Returns:
- the rmanDisplay node name as a string.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.rman_globals ( )
Returns the renderMan Globals node name.

Returns:
- the rmanGlobals node name as a string.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.set_aov_name (   node,
  name 
)
Save a node's display or displayChannel name, so it is decoupled from
the node's name.

Arguments:
    node {[type]} -- [description]
    name {[type]} -- [description]

+ Here is the caller graph for this function:

def rfm2.api.nodes.set_integrator (   name)
Change the integrator used by the rmanGlobals node.

Args:
- name (str): name of the new integrator.

Returns:
- None

+ Here is the call graph for this function:

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})

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.api.nodes.set_param_value_ui (   args,
  kwargs 
)

+ Here is the call graph for this function:

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.

+ Here is the call graph for this function:

Variable Documentation

tuple rfm2.api.nodes.AOV_NODE_TYPES = ('rmanDisplay', 'rmanDisplayChannel')
dictionary rfm2.api.nodes.SHADING_ENGINE_PLUG
Initial value:
1 = {NodeClassification.k_bxdf: ['surfaceShader',
2  'rman__surface'],
3  NodeClassification.k_displace: ['displacementShader',
4  'rman__displacement']}