bgdev.tools.symmetry_api

Utility methods used to sort nodes and graphs.

created

20/11/2020

author

Benoit GIELLY <benoit.gielly@gmail.com>

class Symmetry[source]

Bases: object

Generates a symmetry table for selected mesh.

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

property center

Get center vertices.

get_side_vertices(side)[source]

Get all components of given side.

Parameters

side (str) – Side of the table to query. Either “left”, “center” or “right”.

Returns

List of side-vertices.

Return type

list

static get_sides_from_rich(vertices)[source]

Get resulting sides of a RichSelection in symmetry.

Parameters

vertices (list) – Vertices to select for symmetry.

Returns

Two OpenMaya.MSelectionList, being the result of the

MRichSelection.getSelection and MRichSelection.getSymmetry methods.

Return type

tuple

static get_vertex_id(vertex)[source]

Get vertex index from name.

Parameters

vertex (str) – Full vertex name (eg. “mesh.vtx[15]”)

Returns

Index of the vertex as integer.

Return type

int

get_vertex_name(index)[source]

Get vertex name from index.

Parameters

index (int) – Index of the vertex.

Returns

Full vertex name (eg. “mesh.vtx[15]”)

Return type

str

property left

Get left side vertices.

mirror(vertices)[source]

Mirror vertices.

Parameters

vertices (list) – List of vertices to mirror.

Yields

str – The next vertex full name in the given list.

mirror_selection(add=False)[source]

Mirror selected vertices.

Parameters

add (bool) – Add to existing selection when True.

populate_table()[source]

Populate the symmetry table with vertices.

Notes

Maya topology symmetry must be activated.

property right

Get right side vertices.

update()[source]

Generate a symmetry table.