rfm2  22.0
A python-based rewrite of RenderMan for Maya
rfm2.utils.primvars Namespace Reference

Classes

class  ProgressBar
 

Functions

def freeze_points (pvname='__Pref', worldspace=False, for_alembic=False, cleanup=False)
 
def freeze_normals (pvname='__Nref', worldspace=False, for_alembic=False, cleanup=False)
 
def freeze_world_points (pvname='__WPref', for_alembic=False, cleanup=False)
 
def freeze_world_normals (pvname='__WNref', for_alembic=False, cleanup=False)
 
def get_primvar (pvname, objlist=None)
 
def select_by_primvar (pvname)
 
def add_primvar (attrnm, dag_fn, data, component_count=1, cleanup=False)
 
def delete_primvar (pvname)
 
def list_geo (selection_only=True)
 
def freeze_data (obj_name, vv_name, worldspace=True, data=POINTS, for_alembic=False, cleanup=False)
 
def reference_primvars_setup (for_alembic=False)
 
def reference_primvars_cleanup ()
 

Variables

string POINTS = 'points'
 
string NORMALS = 'normals'
 

Detailed Description

#   A python module to faciliate the manipulation of primvars.
#   These are bound to maya shape nodes and follow a standard naming convention
#   to indicate their data type.

Function Documentation

◆ add_primvar()

def rfm2.utils.primvars.add_primvar (   attrnm,
  dag_fn,
  data,
  component_count = 1,
  cleanup = False 
)
Adds the given data as a dynamic attribute to the maya node

Arguments:
    attrnm {str} -- The name of the attribute that will be added to the maya
                    node, eg. 'rmanP__Pref'.
    dag_fn {MFnMesh, etc} -- The MFn function set for the shape node
    data {MPointArray, etc} -- The data, as a maya array object, eg. MPointArray

Keyword Arguments:
    component_count {int} -- The number of components (1, 3 or 4) (default: {1})
    cleanup {bool} -- if True, add the 'rman_cleanup' category to the attr. (default: {False})
+ Here is the caller graph for this function:

◆ delete_primvar()

def rfm2.utils.primvars.delete_primvar (   pvname)
Delete the named primvar associated with the current selection
    if the pvname is "<any>", we delete all rman primvars associated
    with the selected objects.

Arguments:
    pvname {str} -- A known primvar name.
+ Here is the call graph for this function:

◆ freeze_data()

def rfm2.utils.primvars.freeze_data (   obj_name,
  vv_name,
  worldspace = True,
  data = POINTS,
  for_alembic = False,
  cleanup = False 
)
Create a vv_name reference primvar attribute on node obj_name.

Arguments:
    obj_name {str} -- maya node name
    vv_name {str} -- primvar name

Keyword Arguments:
    worldspace {bool} -- in object-space if False (default: {True})
    data {str} -- 'points' or 'normals' (default: {POINTS})
    for_alembic {bool} -- remove the 'rman?' prefix if True (default: {False})
    cleanup {bool} -- if True, add the 'rman_cleanup' category to the
                      attribute. (default: {False})
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freeze_normals()

def rfm2.utils.primvars.freeze_normals (   pvname = '__Nref',
  worldspace = False,
  for_alembic = False,
  cleanup = False 
)
'freeze' normals by copying their current state into dynamic attributes
with names like rmanN__Nref.

Keyword Arguments:
    pvname {str} -- the base name of the primvar, which will be prepended
                    with a prefix indicating the type to renderman.
                    eg. rmanP_ (default: {'__Nref'})
    worldspace {bool} -- boolean indicating whether to use world or object
                         space (default: {False})
    for_alembic {bool} -- boolean indicating whether this primvar is intended
                          for alembic export, in which case we omit the rman
                          prefix and add an additional attribute indicating
                          detail of the primvar, which is required by
                          alembic (default: {False})
    cleanup {bool} -- tag attribute for deletion with 'rman_cleanup'
                      (default: {False})
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freeze_points()

def rfm2.utils.primvars.freeze_points (   pvname = '__Pref',
  worldspace = False,
  for_alembic = False,
  cleanup = False 
)
    "freeze" controlpoints by copying their current state into
    a dynamic attribute with a name like rmanP__Pref

Args:
 - pvname:      the base name of the primvar, which will be prepended
                with a prefix indicating the type to renderman.  eg. rmanP_
 - worldspace:  boolean indicating whether to use world or object space
 - for_alembic:  boolean indicating whether this primvar is intended for
                alembic export, in which case we omit the rman prefix
                and add an additional attribute indicating detail of
                the primvar, which is required by alembic.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freeze_world_normals()

def rfm2.utils.primvars.freeze_world_normals (   pvname = '__WNref',
  for_alembic = False,
  cleanup = False 
)
Freeze normals in world space
+ Here is the call graph for this function:

◆ freeze_world_points()

def rfm2.utils.primvars.freeze_world_points (   pvname = '__WPref',
  for_alembic = False,
  cleanup = False 
)
Freeze positions in world space
+ Here is the call graph for this function:

◆ get_primvar()

def rfm2.utils.primvars.get_primvar (   pvname,
  objlist = None 
)
Return a list of nodes holding primvar attributes. We rely on the presence
of the 'rman_primvar' category but if it fails, we look for attributes matching
'__*', 'rmanP*', 'rmanN*' or 'rmanH*'.

Arguments:
    pvname {str} -- requested primvar or '<any>'.
    objlist {list of tuples} -- [(objname, objtype), ...]

Returns:
    list of tuples -- [(node_name, [attr0, attr1, ...]), ...]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_geo()

def rfm2.utils.primvars.list_geo (   selection_only = True)
Returns a list of (nodenm, nodetype) for selected geometric/controlPoint
primitives.

Keyword Arguments:
    selection_only {bool} -- Only consider selected objects if True (default: {True})

Returns:
    list of tuples -- [(obj1, nodtype1), ...]
+ Here is the caller graph for this function:

◆ reference_primvars_cleanup()

def rfm2.utils.primvars.reference_primvars_cleanup ( )
Delete temporary reference primvars that have the 'rman_cleanup' category.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reference_primvars_setup()

def rfm2.utils.primvars.reference_primvars_setup (   for_alembic = False)
Create temporary reference primvars to be exported to alembic. The
attributes created have the 'rman_primvar' and 'rman_cleanup' categories
to be easily found later on.

Keyword Arguments:
    for_alembic {bool} -- Creates attributes configured for maya's alembic
                          exporter (default: {False})
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ select_by_primvar()

def rfm2.utils.primvars.select_by_primvar (   pvname)
   Select any shape nodes with associated rman primvars.
   If pvname is "<any>", we look for any primvars otherwise we
   only look for the named primvar.
+ Here is the call graph for this function:

Variable Documentation

◆ NORMALS

string rfm2.utils.primvars.NORMALS = 'normals'

◆ POINTS

string rfm2.utils.primvars.POINTS = 'points'