zBuilder.nodes package

Submodules

zBuilder.nodes.base module

class zBuilder.nodes.base.Base(*args, **kwargs)[source]

Bases: object

SEARCH_EXCLUDE = ['_class', 'attrs', '_builder_type', 'type']

A list of attribute names in __dict__ to exclude from the string_replace method.

TYPES = None
add_child(child)[source]
child(row)[source]
child_count()[source]
deserialize(dictionary)[source]

Deserializes a node with given dict.

Takes a dictionary and goes through keys and fills up __dict__.

Args (dict): The given dict.

log(tab_level=-1)[source]
long_name

Long name of parameter corresponding to long name of maya node. This property is not settable. To set it use self.name.

name

Name of parameter corresponding to maya node name. Setting this property will check for long name and store that. self.name still returns short name, self.long_name returns the stored long name.

parent()[source]
row()[source]
serialize()[source]

Makes node serializable.

This replaces an mObject with the name of the object in scene to make it serializable for writing out to json. Then it loops through keys in dict and saves out a temp dict of items that can be serializable and returns that temp dict for json writing purposes.

Returns:of serializable items
Return type:dict
string_replace(search, replace)[source]

Search and replaces items in the node. Uses regular expressions. Uses SEARCH_EXCLUDE to define attributes to exclude from this process.

Goes through the __dict__ and search and replace items.

Works with strings, lists of strings and dictionaries where the values are either strings or list of strings. More specific searches should be overridden here.

Parameters:
  • search (str) – string to search for.
  • replace (str) – string to replace it with.
write(file_path)[source]

Writes out individual item to a json file given a file path.

Parameters:file_path (str) – The file path to write to disk.

zBuilder.nodes.deformer module

class zBuilder.nodes.deformer.Deformer(parent=None, maya_node=None, builder=None, deserialize=None)[source]

Bases: zBuilder.nodes.dg_node.DGNode

build(*args, **kwargs)[source]

Builds the node in maya. mean to be overwritten.

check_map_interpolation(interp_maps)[source]

For each map it checks if it is topologically corresponding and if it isn’t it will interpolate the map if the flag is True. Once the map has been interpolated it updates the stored value before it gets applied in Maya.

Parameters:interp_maps (bool) – Do you want to do it?
get_map_meshes()[source]

This is the mesh associated with each map in obj.MAP_LIST. Typically it seems to coincide with mesh store in get_association. Sometimes it deviates, so you can override this method to define your own list of meshes against the map list.

Returns:List of long mesh names.
Return type:list
get_map_names()[source]

This builds the map names. maps from MAP_LIST with the object name in front

For this we want to get the .name and not scene name.

get_map_objects()[source]

Returns:

get_mesh_objects()[source]

Returns:

static get_meshes()[source]

Queries the deformer and returns the meshes associated with it.

Parameters:node – Maya node to query.
Returns:list of strings of mesh names.
Return type:list od strings
populate(maya_node=None)[source]

Populates the node with the info from the passed maya node in args.

This is deals with basic stuff including attributes. For other things it is meant to be overridden in inherited node.

This is inherited from Base and extended to deal with maps and meshes. :param maya_node: The maya node to populate parameter with. :type maya_node: str

set_maya_weights(interp_maps=False)[source]

Given a Builder node this set the map values of the object in the maya scene. It first does a mObject check to see if it has been tracked, if it has it uses that instead of stored scene_name.

Parameters:interp_maps (str) – Do you want maps interpolated? True forces interpolation. False cancels it. auto checks if it needs to. Default = “auto”
Returns:nothing.
spawn_parameters()[source]

Returns:

zBuilder.nodes.dg_node module

class zBuilder.nodes.dg_node.DGNode(parent=None, maya_node=None, builder=None, deserialize=None)[source]

Bases: zBuilder.nodes.base.Base

The base node for the node functionality of all nodes

Parameters:
  • maya_node (str, optional) – maya node to populate parameter with.
  • builder (object, optional) – The builder object for reference.
  • deserialize (dict, optional) – if given a dictionary to deserialize it fills hte parameter with contents of dictionary using the deserialize method.

:ivar : rtype: type() (str): type of parameter. Tied with maya node type. :ivar attrs: A place for the maya attributes dictionary.

EXTEND_ATTR_LIST = []

List of maya node attribute names to add to the auto generated attribute list to include.

MAP_LIST = []

List of maya node attribute names that represent the paintable map.

SEARCH_EXCLUDE = ['_class', 'attrs', '_builder_type', 'type']

A list of attribute names in __dict__ to exclude from the string_replace method.

TYPES = None

Types of maya nodes this parameter is aware of. Only needed if parameter can deal with multiple types. Else leave at None

association

associations of node.

build(*args, **kwargs)[source]

Builds the node in maya. meant to be overwritten.

compare()[source]

Compares populated parameter with that which is in maya scene.

Returns:prints out items that are different.
get_scene_name(long_name=False)[source]

This checks stored mObject and gets name of maya object in scene. If no mObject it returns parameter name.

Parameters:long_name (bool) – Return the fullpath or not. Defaults to False.
Returns:(str) Name of maya object.
is_m_object_valid()[source]

This checks if stored MObject is valid. Querying an invalid one (if node has been deleted from scene for example) will cause maya to crash.

Returns:True if MObject still valid
Return type:[bool]
long_association

Long names of associations.

mobject

Gets mObject stored with parameter. :returns: mObject

mobject_reset()[source]
populate(maya_node=None)[source]

Populates the node with the info from the passed maya node in args.

This is deals with basic stuff including attributes. For other things it is meant to be overridden in inherited node.

Parameters:maya_node (str) – The maya node to populate parameter with.
set_maya_attrs(attr_filter=None)[source]

Given a Builder node this set the attributes of the object in the maya scene. It first does a mObject check to see if it has been tracked, if it has it uses that instead of stored name.

Parameters:attr_filter (dict) –

Attribute filter on what attributes to set. dictionary is key value where key is node type and value is list of attributes to use.

af = {‘zSolver’:[‘substeps’]}

Returns:nothing.
type = None

zBuilder.nodes.transform module

class zBuilder.nodes.transform.TransformNode(*args, **kwargs)[source]

Bases: zBuilder.nodes.dg_node.DGNode

EXTEND_ATTR_LIST = ['rotatePivotX', 'rotatePivotY', 'rotatePivotZ']
build()[source]

Builds the node in maya. meant to be overwritten.

populate(transformName)[source]

Populates the node with the info from the passed maya node in args.

This is deals with basic stuff including attributes. For other things it is meant to be overridden in inherited node.

Parameters:maya_node (str) – The maya node to populate parameter with.
type = 'transform'
zBuilder.nodes.transform.build_transform(transformName, transformType, parentName, jointOrient)[source]
zBuilder.nodes.transform.get_transformData_data(transformName)[source]

Module contents