vtool.maya_lib.core

Class Summary

FindUniqueName(test_string) This class is intended to find a name that doesn’t clash with other names in the Maya scene.
TrackNodes() This helps track new nodes that get added to a scene after a function runs.
ProgressBar(title, count) Manipulate the maya progress bar.
StoreDisplaySettings()

Function Summary

get_current_camera()
set_current_camera(camera_name)
undo_off(function)
undo_chunk(function)
is_batch()
returns:True if Maya is in batch mode.
is_transform(node) Is the node a transform.
is_a_shape(node) Test whether the node is a shape.
is_referenced(node)
param node:Name of a node in maya. Check to see if it is referenced.
is_empty(node)
is_undeletable(node)
is_unique(name)
inc_name(name[, inc_last_number]) Finds a unique name by adding a number to the end.
prefix_name(node, prefix, name[, separator]) Convenience to quickly rename a Maya node.
prefix_hierarchy(top_group, prefix) Prefix all the names in a hierarchy.
pad_number(name) Add a number to a name.
get_outliner_sets() Get the sets found in the outliner.
get_top_dag_nodes([exclude_cameras, namespace]) Get transforms that sit at the very top of the hierarchy.
get_first_shape(transform) returns first active shape
get_shapes(transform[, shape_type, …]) Get all the shapes under a transform.
get_node_types(nodes[, return_shape_type]) Get the maya node types for the nodes supplied.
get_basename(name[, remove_namespace]) Get the basename in a hierarchy name.
get_namespace(name)
get_dg_nodes()
remove_namespace_from_string(name)
get_characters()
delete_unknown_nodes() This will find all unknown nodes.
rename_shapes(transform) Rename all the shapes under a transform.
get_shapes_in_hierarchy(transform[, …]) Get all the shapes in the child hierarchy excluding intermediates.
has_shape_of_type(node, maya_type) Test whether the node has a shape of the supplied type.
get_orig_nodes([parent]) Get all the orig nodes in a scene, or just the ones under the parent.
get_component_count(transform) Get the number of components under a transform.
get_components(transform) Get the name of the components under a transform.
get_components_in_hierarchy(transform) Get the components in the hierarchy.
get_components_from_shapes([shapes]) Get the components from the a list of shapes.
create_group(name[, parent])
create_display_layer(name, nodes[, display_type]) Create a display layer containing the supplied nodes.
delete_display_layers() Deletes all display layers.
print_help(string_value)
get_scene_file([directory])
start_new_scene()
import_file(filepath) Import a maya file in a generic vtool way.
reference_file(filepath[, namespace]) Reference a maya file in a generic vtool way.
replace_reference(reference_node, new_path) Not tested
reload_reference(reference_node)
save(filepath)
get_under_cursor([use_qt]) Get what is currently under the cursor using qt or not.
get_visible_hud_displays() Get viewport hud displays.
set_hud_visibility(bool_value[, displays]) Set the viewport hud display visibility.
set_hud_lines(lines, name) Set the viewport hud text for the named hud.
show_channel_box() Makes the channel box visible.
add_to_isolate_select(nodes) Add the specified nodes into every viewport’s isolate select.
get_model_panels() Good to use when editing viewports.
get_current_audio_node() Get the current audio node.
remove_unused_plugins()
delete_turtle_nodes()
delete_nodes_of_type(node_type) Delete all the nodes of type.
delete_garbage()
delete_empty_orig_nodes()
get_empty_groups()
get_empty_nodes()
get_empty_orig_nodes()

Functions

get_current_camera()
set_current_camera(camera_name)
undo_off(function)
undo_chunk(function)
is_batch()
Returns:True if Maya is in batch mode.
Return type:bool
is_transform(node)

Is the node a transform.

Parameters:node (str) – The name of the node to test.
Returns:bool
is_a_shape(node)

Test whether the node is a shape.

Parameters:node (str) – The name of a node.
Returns:bool
is_referenced(node)
Parameters:node (str) – Name of a node in maya. Check to see if it is referenced.
Returns:bool
is_empty(node)
is_undeletable(node)
is_unique(name)
inc_name(name, inc_last_number=True)

Finds a unique name by adding a number to the end.

Parameters:name (str) – Name to start from.
Returns:Modified name, number added if not unique..
Return type:str
prefix_name(node, prefix, name, separator=’_’)

Convenience to quickly rename a Maya node.

Parameters:
  • node (str) – Name of a node in maya to rename.
  • prefix (str) –
  • name (str) –
  • separator (str) –
Returns:

prefix + separator + name

Return type:

str

prefix_hierarchy(top_group, prefix)

Prefix all the names in a hierarchy.

Parameters:
  • top_group (str) – Name of the top node of a hierarchy.
  • prefix (str) – Prefix to add in front of top_group and all children.
Returns:

The renamed hierarchy including top_group.

Return type:

list

pad_number(name)

Add a number to a name.

get_outliner_sets()

Get the sets found in the outliner.

Returns:List of sets in the outliner.
Return type:list
get_top_dag_nodes(exclude_cameras=True, namespace=None)

Get transforms that sit at the very top of the hierarchy.

Returns:list
get_first_shape(transform)

returns first active shape

get_shapes(transform, shape_type=None, no_intermediate=False)

Get all the shapes under a transform.

Parameters:transform (str) – The name of a transform.
Returns:The names of shapes under the transform
Return type:list
get_node_types(nodes, return_shape_type=True)

Get the maya node types for the nodes supplied.

Returns:dict[node_type_name] node dict of matching nodes
Return type:dict
get_basename(name, remove_namespace=True)

Get the basename in a hierarchy name. If top|model|face is supplied, face will be returned.

get_namespace(name)
get_dg_nodes()
remove_namespace_from_string(name)
get_characters()
delete_unknown_nodes()

This will find all unknown nodes. Unlock and delete them.

rename_shapes(transform)

Rename all the shapes under a transform. Renames them to match the name of the transform.

Parameters:transform (str) – The name of a transform.
get_shapes_in_hierarchy(transform, shape_type=”, return_parent=False, skip_first_relative=False)

Get all the shapes in the child hierarchy excluding intermediates. This is good when calculating bounding box of a group.

Parameters:transform (str) – The name of a transform.
Returns:The list of shape nodes.
Return type:list
has_shape_of_type(node, maya_type)

Test whether the node has a shape of the supplied type.

Parameters:
  • node (str) – The name of a node.
  • maya_type (str) – Can be a mesh, nurbsCurve, or any maya shape type.
Returns:

bool

get_orig_nodes(parent=None)

Get all the orig nodes in a scene, or just the ones under the parent.

get_component_count(transform)

Get the number of components under a transform. This does not include hierarchy.

Parameters:transform (str) – The name of a transform.
Returns:The number of components under transform, eg. verts, cvs, etc.
Return type:int
get_components(transform)

Get the name of the components under a transform. This does not include hierarchy.

Parameters:transform (str) – The name of a transform.
Returns:The name of all components under transform, eg verts, cvs, etc.
Return type:list
get_components_in_hierarchy(transform)

Get the components in the hierarchy. This includes all transforms with shapes parented under the transform.

Parameters:transform (str) – The name of a transform.
Returns:The name of all components under transform, eg verts, cvs, etc.
Return type:list
get_components_from_shapes(shapes=None)

Get the components from the a list of shapes. Curntly supports cv and vtx components

Parameters:shapes (list) – List of shape names.
Returns:The components of the supplied shapes.
Return type:list
create_group(name, parent=None)
create_display_layer(name, nodes, display_type=2)

Create a display layer containing the supplied nodes.

Parameters:
  • name (str) – The name to give the display layer.
  • nodes (str) – The nodes that should be in the display layer.
delete_display_layers()

Deletes all display layers.

print_help(string_value)
get_scene_file(directory=False)
start_new_scene()
import_file(filepath)

Import a maya file in a generic vtool way.

reference_file(filepath, namespace=None)

Reference a maya file in a generic vtool way.

Parameters:
  • filepath (str) – The full path and filename.
  • namespace (str) – The namespace to add to the nodes in maya. Default is the name of the file.
replace_reference(reference_node, new_path)

Not tested

reload_reference(reference_node)
save(filepath)
get_under_cursor(use_qt=True)

Get what is currently under the cursor using qt or not. When not using qt it is more of a hack.

get_visible_hud_displays()

Get viewport hud displays.

Returns:List of names of heads up displays.
Return type:list
set_hud_visibility(bool_value, displays=None)

Set the viewport hud display visibility.

Parameters:
  • bool_value (bool) – True turns visiliblity on, False turns it off.
  • displays (list) – List of heads up displays by name.
set_hud_lines(lines, name)

Set the viewport hud text for the named hud.

Parameters:
  • lines (list) – Each entry in the list is a new text line in the display.
  • name (str) – The name of the heads up display to work on.
show_channel_box()

Makes the channel box visible.

add_to_isolate_select(nodes)

Add the specified nodes into every viewport’s isolate select. This will only work on viewports that have isolate select turned on. Use when nodes are not being evaluated because isolate select causes them to be invisible.

Parameters:nodes (list) – The nodes to add to isolate select.
get_model_panels()

Good to use when editing viewports.

get_current_audio_node()

Get the current audio node. Important when getting sound in a playblast.

Returns:Name of the audio node.
Return type:str
remove_unused_plugins()
delete_turtle_nodes()
delete_nodes_of_type(node_type)

Delete all the nodes of type. Good for cleaning up scenes.

Parameters:node_type (str) – The name of a node type. Eg. hyperView, ilrBakeLayouerManger, etc
delete_garbage()
delete_empty_orig_nodes()
get_empty_groups()
get_empty_nodes()
get_empty_orig_nodes()