DNAViewer.builder.maya package
Submodules
dna_viewer.builder.maya.mesh module
- class dna_viewer.builder.maya.mesh.MayaMesh(mesh_index: int, dna: dna_viewer.dnalib.dnalib.DNA, blend_shape_group_prefix: str, blend_shape_name_postfix: str, skin_cluster_suffix: str)[source]
Bases:
object
A builder class used for adding joints to the scene
- @type mesh_index
- Type
int
- @param mesh_index
- Type
The index of the mesh
- @type dna
- Type
- @param dna
- Type
Instance of DNA
- @type blend_shape_group_prefix
- Type
str
- @param blend_shape_group_prefix
- Type
prefix string for blend shape group
- @type blend_shape_name_postfix
- Type
str
- @param blend_shape_name_postfix
- Type
postfix string for blend shape name
- @type skin_cluster_suffix
- Type
str
- @param skin_cluster_suffix
- Type
postfix string for skin cluster name
- @type data
- Type
- @param data
- Type
mesh data used in the mesh creation process
- @type fn_mesh
- Type
om.MFnMesh
- @param fn_mesh
- Type
OpenMaya class used for creating the mesh
- @type mesh_object
- Type
om.MObject
- @param mesh_object
- Type
the object representing the mesh
- @type dag_modifier
- Type
om.MDagModifier
- @param dag_modifier
- Type
OpenMaya class used for naming the mesh
- add_blend_shapes(add_mesh_name_to_blend_shape_channel_name: bool) → None[source]
Adds blend shapes to the mesh
- add_skin_cluster(joint_names: List[str], joint_ids: List[int]) → None[source]
Adds skin cluster to the mesh
@type joint_names: List[str] @param joint_names: Joint names needed for adding the skin cluster
@type joint_ids: List[int] @param joint_ids: Joint indices needed for setting skin weights
- create_blend_shape(blend_shape_target_index: int, blend_shape_channel: int, group: str, add_mesh_name_to_blend_shape_channel_name: bool) → None[source]
Builds a single derived mesh using the provided mesh and the blend shape data of the DNA.
@type blend_shape_target_index: int @param blend_shape_target_index: Used for getting a delta value representing the value change concerning the blend shape.
@type blend_shape_channel: int @param blend_shape_channel: Used for getting the blend shape name from the DNA.
@type group: str @param group: The transform the new meshes will be added to.
@type add_mesh_name_to_blend_shape_channel_name: bool @param add_mesh_name_to_blend_shape_channel_name: A flag representing whether mesh name of blend shape channel is added to name when creating it
- create_blend_shapes(add_mesh_name_to_blend_shape_channel_name: bool) → None[source]
Builds all the derived meshes using the provided mesh and the blend shapes data of the DNA.
@type add_mesh_name_to_blend_shape_channel_name: bool @param add_mesh_name_to_blend_shape_channel_name: A flag representing whether mesh name of blend shape channel is added to name when creating it
- create_mesh_object() → OpenMaya.MObject[source]
Gets a list of points that represent the vertex positions.
@rtype: MObject @returns: Maya objects representing maya mesh functions and the created maya mesh object.
- create_neutral_mesh() → OpenMaya.MObject[source]
Creates the neutral mesh using the config provided for this builder class object
@rtype: om.MObject @returns: the instance of the created mesh object
- get_texture_data() → Tuple[List[float], List[float], List[int]][source]
Gets the data needed for the creation of textures.
@rtype: Tuple[List[float], List[float], List[int]] @returns: The tuple containing the list of texture coordinate Us, the list of texture coordinate Vs and the list of texture coordinate indices.
- get_vertex_positions_from_dna_vertex_positions() → List[OpenMaya.MPoint][source]
Gets a list of points that represent the vertex positions.
@rtype: List[MPoint] @returns: List of maya point objects.
- rename_mesh() → OpenMaya.MDagModifier[source]
Renames the initial mesh object that was created to the name from the configuration.
@rtype: Tuple[MDagModifier] @returns: Maya object representing the dag modifier.
- set_skin_weights(mesh_name: str, joint_ids: List[int]) → None[source]
Sets the skin weights attributes.
@type mesh_name: str @param mesh_name: The mesh name that is used for getting the skin cluster name.
@type joint_ids: List[int] @param joint_ids: List of joint indices used for setting the skin weight attribute.
- class dna_viewer.builder.maya.mesh.Mesh(dna_vertex_positions: typing.List[dna_viewer.model.Point3] = <factory>, dna_vertex_layout_positions: typing.List[int] = <factory>, polygon_faces: typing.List[int] = <factory>, polygon_connects: typing.List[int] = <factory>, derived_mesh_names: typing.List[str] = <factory>)[source]
Bases:
object
A model class for holding data needed in the mesh building process
- @type dna_vertex_positions
- Type
List[Point3]
- @param dna_vertex_positions
- Type
Data representing the positions of the vertices
- @type dna_vertex_layout_positions
- Type
List[int]
- @param dna_vertex_layout_positions
- Type
Data representing layout position indices of vertices
- @type polygon_faces
- Type
List[int]
- @param polygon_faces
- Type
List of lengths of vertex layout indices
- @type polygon_connects
- Type
List[int]
- @param polygon_connects
- Type
List of vertex layout position indices
- @type derived_mesh_names
- Type
List[str]
- @param derived_mesh_names
- Type
List of mesh names
- derived_mesh_names: List[str]
- dna_vertex_layout_positions: List[int]
- dna_vertex_positions: List[dna_viewer.model.Point3]
- polygon_connects: List[int]
- polygon_faces: List[int]
dna_viewer.builder.maya.skin_weights module
- class dna_viewer.builder.maya.skin_weights.MayaSkinWeights(skin_cluster: OpenMayaAnim.MFnSkinCluster, mesh_name: str)[source]
Bases:
object
A class used for reading and storing skin weight related data needed for adding skin clusters
- get_skin_cluster_influence(skin_cluster: OpenMayaAnim.MFnSkinCluster) → List[str][source]
Gets a list of joint names that are influences to the skin cluster.
@type skin_cluster: MFnSkinCluster @param skin_cluster: The functionalities of a maya skin cluster object
@rtype: List[str] @returns: The list if names of the joints that influence the skin cluster
- get_skin_weights_for_mesh_name(skin_cluster: OpenMayaAnim.MFnSkinCluster, mesh_name: str) → List[List[Union[int, float]]][source]
Gets the skin weights concerning the given mesh.
@type skin_cluster: MFnSkinCluster @param skin_cluster: The functionalities of a maya skin cluster object
@type mesh_name: str @param mesh_name: The name of the mesh
@rtype: List[List[Union[int, float]]] @returns: A list of list of weight indices and the weight values
- joints: List[str]
- no_of_influences: int
- skinning_method: int
- vertices_info: List[List[Union[int, float]]]
- dna_viewer.builder.maya.skin_weights.get_file_joint_mappings(skin_weights: dna_viewer.builder.maya.skin_weights.MayaSkinWeights, skin_cluster: OpenMayaAnim.MFnSkinCluster) → List[int][source]
Returns a list of object indices representing the influences concerning the joint names specified in the skin weight model.
@type skin_weights: MayaSkinWeights @param skin_weights: The instance of the model storing data about skin weights
@type skin_cluster: MFnSkinCluster @param skin_cluster: An object for working with functions concerning a skin cluster in maya
@rtype: List[int] @returns: a list of indices representing the influences concerning the given joints
- dna_viewer.builder.maya.skin_weights.get_skin_weights_data(mesh_name: str) → Tuple[OpenMaya.MFnMesh, OpenMayaAnim.MFnSkinCluster][source]
Gets the maya objects that manipulate the mesh node and the skin cluster for a given mesh name.
@type mesh_name: str @param mesh_name: The name of the mesh
@rtype: Tuple[MFnMesh, MFnSkinCluster] @returns: The maya object that manipulate the mesh node and the skin cluster for a given mesh name.
- dna_viewer.builder.maya.skin_weights.get_skin_weights_from_scene(mesh_name: str) → dna_viewer.builder.maya.skin_weights.MayaSkinWeights[source]
Gets the instance of this class filled with data from the scene for a given mesh name.
@type mesh_name: str @param mesh_name: The mesh name
@rtype: MayaSkinWeights @returns: An instance of this class with the data from the scene
- dna_viewer.builder.maya.skin_weights.import_skin_weights(skin_cluster: OpenMayaAnim.MFnSkinCluster, mesh_node: OpenMaya.MFnMesh, skin_weights: dna_viewer.builder.maya.skin_weights.MayaSkinWeights, file_joint_mapping: List[int]) → None[source]
Imports the skin weights to the scene using the joint mapping and the data provided in the model containing the weights.
@type skin_cluster: MFnSkinCluster @param skin_cluster: An object for working with functions concerning a skin cluster in maya
@type mesh_node: MFnMesh @param mesh_node: An object for working with functions concerning meshes in maya
@type skin_weights: MayaSkinWeights @param skin_weights: The instance of the model storing data about skin weights
@type file_joint_mapping: List[int] @param file_joint_mapping: a list of indices representing the influences concerning joints
- dna_viewer.builder.maya.skin_weights.set_skin_weights_to_scene(mesh_name: str, skin_weights: dna_viewer.builder.maya.skin_weights.MayaSkinWeights) → None[source]
Sets the skin weights to the scene.
@type mesh_name: str @param mesh_name: The mesh name
@type skin_weights: MayaSkinWeights @param skin_weights: The object containing data that need to be set to the scene.
dna_viewer.builder.maya.util module
- class dna_viewer.builder.maya.util.Maya[source]
Bases:
object
A utility class used for interfacing with maya transforms
- static get_element(name: str) → Union[OpenMaya.MDagPath, OpenMaya.MFnDagNode][source]
gets the Union[MDagPath, MFnDagNode] object of the element with the given name
@type name: str @param name: The name of the element to be retrieved
@rtype: Union[MDagPath, MFnDagNode] @returns: A OpenMaya object representing the given element
- static get_transform(name: str) → OpenMaya.MFnTransform[source]
gets the transform of the element with the given name
@type element: str @param element: The element name that we want the transform of
@rtype: MFnTransform @returns: A MFnTransform object representing the given elements transform
- static get_translation(element: str, space: int = 2) → OpenMaya.MVector[source]
gets the translation of the element with the given name
@type element: str @param element: The element name that we want the translation of
@type space: str @param space: A string value representing the translation space (default is “world”)
@rtype: MVector @returns: A MVector object representing the given elements translation
- static set_translation(element: str, translation: OpenMaya.MVector, space: int = 2) → None[source]
sets the translation of the element with the given name
@type element: str @param element: The element name that we want to set the translation of
@type translation: MVector @param translation: The new translation value
@type space: str @param space: A string value representing the translation space (default is “object”)