dna_viewer.util package

Submodules

dna_viewer.util.additional_assembly_script module

class dna_viewer.util.additional_assembly_script.AdditionalAssemblyScript[source]

Bases: object

A utility class used for running python scripts

static run_additional_assembly_script(config: dna_viewer.config.character.Character) None[source]

Runs the additional assembly script using the provided character configuration.

@type config: Character @param config: The character configuration object with the needed settings for running the additional assembly script

static run_script(module_name: str, path: str, method: str, parameter: Optional[Any] = None) None[source]

Runs the additional assembly script using the provided parameters.

@type module_name: str @param module_name: The module name that gets loaded

@type path: str @param path: The path where the additional assembly script is located

@type method: str @param method: The name of the method that gets called

@type parameter: Any @param parameter: The parameters that get passed in the method (defaults to None)

dna_viewer.util.assemble module

dna_viewer.util.assemble.assemble_rig(dna: dna_viewer.model.dna.DNA, analog_gui_path: str, gui_path: Optional[str] = None, gui: Optional[dna_viewer.config.gui.Gui] = None, aas_path: Optional[str] = None, aas_fn: str = 'run_after_assemble', aas_params: Optional[Dict[str, Any]] = None, with_attributes_on_root_joint: bool = False, with_key_frames: bool = False, add_mesh_name_to_blend_shape_channel_name: bool = True) dna_viewer.builder.scene.SceneResult[source]

Used for assembling the rig with the following parameters

@type dna: DNA @param dna: Instance of DNA

@type gui_path: str @param gui_path: The file location of the gui

@type gui: Gui @param gui: The gui configuration, this can be used instead of gui_path for finer control

@type analog_gui_path: str @param analog_gui_path: The file location of the analog gui

@type aas_path: str @param aas_path: The file location of the additional assembly script

@type aas_fn: str @param aas_fn: The method name called from the additional assembly script (default is “run_after_assemble”)

@type aas_params: str @param aas_params: The parameters dictionary that will get passed to the provided method name called from the additional assembly script (default is None)

@type with_attributes_on_root_joint: bool @param with_attributes_on_root_joint: A flag used for adding attributes on the root joint (default is False)

@type with_key_frames: bool @param with_key_frames: A flag used for adding key frames (default is False)

@type add_mesh_name_to_blend_shape_channel_name: bool @param add_mesh_name_to_blend_shape_channel_name: A flag representing whether mash name of blend shape channel is added to name when creating it

@rtype: SceneResult @returns: A SceneResult object representing the info about the finished build process

dna_viewer.util.character_creator module

class dna_viewer.util.character_creator.CharacterCreator(config: dna_viewer.config.character.Character, dna: dna_viewer.model.dna.DNA)[source]

Bases: object

A class used for creating the character in the maya scene

@type config
Type

Character

@param config
Type

The character configuration containing build options

@type dna
Type

DNA

@param dna
Type

The DNA object read from the DNA file

@type character_name
Type

str

@param character_name
Type

The name of the character

@type meshes
Type

Dict[int, List[MObject]]

@param meshes
Type

A mapping of lod number to a list of meshes created for that lod

add_analog_gui(add_to_character_node: bool = False) None[source]

Adds an analog gui according to the specified analog gui options. If none is specified no analog gui will be added.

@type add_to_character_node: bool @param add_to_character_node: A flag that specifies if the imported analog gui should be parented to the character node transform (default value is None).

add_gui() None[source]

Adds a gui according to the specified gui options. If none is specified no gui will be added.

add_joints() List[dna_viewer.model.joint.Joint][source]

Reads and adds the joints to the scene, also returns a list model objects of joints that were added.

@rtype: List[JointModel] @returns: The list containing model objects representing the joints that were added to the scene.

add_joints_to_character() None[source]

Starts adding the joints the character, if the character configuration options have add_joints set to False, this step will be skipped.

add_key_frames() None[source]

Adds a starting key frame to the facial root joint if joints are added and the add_key_frames option is set to True.

add_mesh_to_display_layer(mesh_name: str, lod: int) None[source]

Add the mesh with the given name to an already created display layer.

@type mesh_name: str @param mesh_name: The name of the mesh that should be added to a display layer.

@type lod: int @param lod: The lod value, this is needed for determining the name of the display layer that the mesh should be added to.

add_rig_logic_node() None[source]

Creates and adds a rig logic node specified in the character configuration.

attach_mesh_to_lod(mesh_name: str, lod: int) None[source]

Attaches the mesh called mesh_name to a given lod.

@type mesh_name: str @param mesh_name: The mesh that needs to be attached to a lod holder object.

@type lod: str @param lod: The name of the mesh that should be added to a display layer.

create_animated_map_attributes() None[source]

Creates animated map attributes on the root joint from the animated map names.

create_attribute_on_joint(names: List[str]) None[source]

Create attributes from a provided list of names on the facial root joint.

@type names: List[str] @param names: List of names that are added as attributes to the facial root joint.

create_character_meshes() None[source]

Builds the meshes of the character. If specified in the character options they get parented to a created character node transform, otherwise the meshes get put to the root level of the scene.

create_character_node() None[source]

Creates a Maya transform which will hold the character, if the character configuration options have create_character_node set to False, this step will be skipped.

create_ctrl_attributes() None[source]

Creates and sets the raw gui control attributes.

create_ctrl_attributes_on_joint() None[source]

Creates control attributes on the root joint from the raw control names.

create_frm_attributes() None[source]

Creates and sets the animated map attributes.

create_geometry_node() None[source]

Creates a Maya transform which will hold the geometry of the character. If the character configuration options have create_character_node set to False, this step will be skipped.

create_lod_node(lod: int, obj_name: str) None[source]

Creates a Maya transform which will hold the meshes of the character for a given lod.

@type lod: str @param lod: The lod number.

@type obj_name: str @param obj_name: The full path name of the object in the scene, if it is not found a new lod holder will be created.

create_meshes(lod: int, meshes_per_lod: List[int]) List[OpenMaya.MObject][source]

Builds the meshes from the provided mesh ids and then attaches them to a given lod if specified in the character configuration.

@type lod: int @param lod: The lod number representing the display layer the meshes to the display layer.

@type meshes_per_lod: List[int] @param meshes_per_lod: List of mesh indices that are being built.

@rtype: List[MObject] @returns: The list of maya objects that represent the meshes added to the scene.

create_rig_node() None[source]

Creates a Maya transform which will hold the rig of the character. If the character configuration options have create_character_node set to False, this step will be skipped.

get_mesh_node_fullpath_on_root(mesh_name: str) str[source]

Gets the full path in the scene of a mesh.

@type mesh_name: str @param mesh_name: The mesh thats path is needed.

@rtype: str @returns: The full path of the mesh object in the scene

import_gui(gui_path: str, group_name: str, add_to_character_node: bool = False) None[source]

Imports a gui using the provided parameters.

@type gui_path: str @param gui_path: The path of the gui file that needs to be imported.

@type group_name: str @param group_name: The name of the transform that holds the imported asset.

@type add_to_character_node: bool @param add_to_character_node: A flag representing if the gui holder should be attached to the character node or be on the root of the scene (default value is False)

run_additional_assembly_script() None[source]

Runs an additional assembly script if specified in the character configuration.

dna_viewer.util.conversion module

class dna_viewer.util.conversion.Conversion[source]

Bases: object

A utility class containing methods for converting and calculating units

static calculate_angle_modifier(unit: dna_viewer.config.units.AngleUnit, dna_unit: Optional[dna_viewer.config.units.AngleUnit] = None) float[source]

A method used for calculating the value (angle modifier) which the angles will be multiplied with. If the chosen unit is not the same as the one from the DNA file a multiplier will be calculated. Otherwise, it returns 1.

@type unit: AngleUnit @param unit: Can be degree and radian.

@type dna_unit: AngleUnit @param dna_unit: The angle unit specified in the DNA file (default value is None).

@rtype: float @returns: A multiplier needed for conversion between different units.

static calculate_linear_modifier(unit: dna_viewer.config.units.LinearUnit, dna_unit: Optional[dna_viewer.config.units.LinearUnit] = None) float[source]

A method used for calculating the value (linear modifier) which the transforms will be multiplied with. If the chosen unit is not the same as the one from the DNA file a multiplier will be calculated. Otherwise it returns 1.

@type unit: LinearUnit @param unit: Can be m (meter) and cm (centimeter).

@type dna_unit: LinearUnit @param dna_unit: The linear unit specified in the DNA file (default value is None).

@rtype: float @returns: A multiplier needed for conversion between different units.

static get_angle_unit_from_int(value: int) dna_viewer.config.units.AngleUnit[source]

Returns an enum from an int value. 0 -> degree 1 -> radian

@type value: int @param value: The value that the enum is mapped to.

@rtype: AngleUnit @returns: AngleUnit.degree or AngleUnit.radian

static get_linear_unit_from_int(value: int) dna_viewer.config.units.LinearUnit[source]

Returns an enum from an int value. 0 -> cm 1 -> m

@type value: int @param value: The value that the enum is mapped to.

@rtype: LinearUnit @returns: LinearUnit.cm or LinearUnit.m

dna_viewer.util.error module

exception dna_viewer.util.error.DNAViewerError[source]

Bases: Exception

dna_viewer.util.import_util module

class dna_viewer.util.import_util.Import[source]

Bases: object

A utility class containing methods for reading outside python files.

static source_py_file(name: str, path: str) Optional[module][source]

Used for loading a python file, used for additional assembly script.

@type name: str @param name: The name of the module.

@type path: str @param path: The path of the python file.

@rtype: Optional[ModuleType] @returns: The loaded module.

dna_viewer.util.maya_util module

class dna_viewer.util.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”)

dna_viewer.util.mesh module

dna_viewer.util.mesh.build_meshes(dna: dna_viewer.model.dna.DNA, options: Optional[dna_viewer.config.character.BuildOptions] = None, group_by_lod: bool = False, mesh_list: Optional[List[int]] = None, lod_list: Optional[List[int]] = None, create_new_scene: bool = False) List[str][source]

Starts the mesh building process with the provided parameters.

@type dna: DNA @param dna: Instance of DNA

@type options: BuildOptions @param options: The build options used in the build process

@type group_by_lod: bool @param group_by_lod: Represents if the created meshes should be added to a holding transform representing the lod

@type mesh_list: List[int] @param mesh_list: List of mesh indices that should be added.

@type lod_list: List[int] @param lod_list: List of lods from which all containing meshes should be added.

@type create_new_scene: bool @param create_new_scene: Represents if a new scene should be created in the build process.

@rtype: List[str] @returns: The list of full paths of the created meshes in the maya scene

dna_viewer.util.mesh.create_build_options(add_joints: bool = False, add_blend_shapes: bool = False, add_skin: bool = False, add_ctrl_attributes_on_root_joint: bool = False, add_animated_map_attributes_on_root_joint: bool = False, add_mesh_name_to_blend_shape_channel_name: bool = False, add_key_frames: bool = False) dna_viewer.config.character.BuildOptions[source]

Creates the build options object used in the character building process.

@type add_joints: bool @param add_joints: Represents if joints should be added

@type add_blend_shapes: bool @param add_blend_shapes: Represents if blend shapes should be added

@type add_skin: bool @param add_skin: Represents if skin should be added

@type add_ctrl_attributes_on_root_joint: bool @param add_ctrl_attributes_on_root_joint: Represents if gui control attributes should be added on the root joint

@type add_animated_map_attributes_on_root_joint: bool @param add_animated_map_attributes_on_root_joint: Represents if animated map attributes should be added on the root joint

@type add_mesh_name_to_blend_shape_channel_name: bool @param add_mesh_name_to_blend_shape_channel_name: A flag representing whether mash name of blend shape channel is added to name when creating it

@type add_key_frames: bool @param add_key_frames: A flag representing whether key frames should be added

@rtype: BuildOptions @returns: The created build options object

dna_viewer.util.mesh.get_mesh_index(mesh_name: str, lod: int, dna: dna_viewer.model.dna.DNA) Optional[int][source]

Gets a mesh index with the given search string, returns the first one if multiple are found.

@type mesh_name: str @param mesh_name: The string that is searched for in the meshes

@type lod: int @param lod: The lod in which the mesh names will be searched for the result

@type dna: DNA @param dna: Instance of DNA

dna_viewer.util.mesh.get_mesh_indices_containing_string(mesh_name_part: str, lod: int, dna: dna_viewer.model.dna.DNA) List[int][source]

Gets the mesh indices containing a search string.

@type mesh_name_part: str @param mesh_name_part: The string that is searched for in the meshes

@type lod: int @param lod: The lod in which the mesh names will be searched for the result

@type dna: DNA @param dna: Instance of DNA

@rtype: List[int] @returns: The list of mesh indices which contain the mesh_name_part in their name

dna_viewer.util.mesh.get_mesh_lods(dna: dna_viewer.model.dna.DNA) List[List[int]][source]

Gets the list of list of mesh indices grouped by the lod number.

@type dna: DNA @param dna: Instance of DNA.

@rtype: List[List[int]] @returns: The list of list of mesh indices grouped by the lod number

dna_viewer.util.mesh.get_mesh_names(dna: dna_viewer.model.dna.DNA) List[str][source]

Gets the list of mesh names contained in the DNA file.

@type dna: DNA @param dna: Instance of DNA

@rtype: List[str] @returns: The list of mesh names contained in the DNA file

dna_viewer.util.mesh_blend_shape module

class dna_viewer.util.mesh_blend_shape.MeshBlendShape[source]

Bases: object

A utility class used for interacting with blend shapes

static create_all_derived_meshes(config: dna_viewer.config.mesh.Mesh, dna: dna_viewer.model.dna.DNA, data: dna_viewer.model.mesh.Mesh, fn_mesh: OpenMaya.MFnMesh, dag_modifier: OpenMaya.MDagModifier, 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 config: Mesh @param config: Mesh configuration from the DNA.

@type data: MayaMeshModel @param data: An object that stores values that get passed around different methods.

@type fn_mesh: MFnMesh @param fn_mesh: Used for creating and manipulating maya mesh objects.

@type dag_modifier: MDagModifier @param dag_modifier: Used for manipulating maya objects.

@type add_mesh_name_to_blend_shape_channel_name: bool @param add_mesh_name_to_blend_shape_channel_name: A flag representing whether mash name of blend shape channel is added to name when creating it

static create_blend_shape_node(mesh_name: str, derived_mesh_names: List[str], rename: bool = False) None[source]

Creates a blend shape node.

@type mesh_name: str @param mesh_name: The name of the mesh.

@type derived_mesh_names: List[str] @param derived_mesh_names: List of the names that will end up as blend shapes added to the mesh.

@type rename: bool @param rename: A flag representing if the name should be changed to a blend shape naming convention.

dna_viewer.util.mesh_helper module

dna_viewer.util.mesh_helper.print_mesh_indices_containing_string(mesh_name_part: str, lod: int, dna: dna_viewer.model.dna.DNA) None[source]

Prints the mesh indices that contain a search string.

@type mesh_name_part: str @param mesh_name_part: The search string.

@type lod: int @param lod: The lod where the search will be done.

@type dna: DNA @param dna: Instance of DNA.

dna_viewer.util.mesh_helper.print_meshes(dna: dna_viewer.model.dna.DNA) None[source]

Prints the mesh names grouped by lod.

@type dna: DNA @param dna: Instance of DNA.

dna_viewer.util.mesh_neutral module

class dna_viewer.util.mesh_neutral.MeshNeutral[source]

Bases: object

A utility class used for creating and interacting with meshes

static add_texture_coordinates(config: dna_viewer.config.mesh.Mesh, dna: dna_viewer.model.dna.DNA, data: dna_viewer.model.mesh.Mesh, fn_mesh: OpenMaya.MFnMesh) None[source]

Method for adding texture coordinates.

@type config: MeshConfig @param config: Mesh configuration from the DNA.

@type data: MeshModel @param data: An object that stores values that get passed around different methods.

@type fn_mesh: MFnMesh @params fn_mesh: Object used for manipulating maya mesh objects.

static create_mesh_object(config: dna_viewer.config.mesh.Mesh, data: dna_viewer.model.mesh.Mesh) Tuple[OpenMaya.MFnMesh, OpenMaya.MObject][source]

Gets a list of points that represent the vertex positions.

@type config: MeshConfig @param config: Mesh configuration from the DNA.

@type data: MeshModel @param data: An object that stores values that get passed around different methods.

@rtype: Tuple[MFnMesh, MObject] @returns: Maya objects representing maya mesh functions and the created maya mesh object.

static get_texture_data(mesh_index: int, dna: dna_viewer.model.dna.DNA) Tuple[List[float], List[float], List[int]][source]

Gets the data needed for the creation of textures.

@type mesh_index: int @param mesh_index: The mesh index

@type dna: DNA @param dna: Instance of DNA.

@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.

static get_vertex_positions_from_dna_vertex_positions(config: dna_viewer.config.mesh.Mesh, data: dna_viewer.model.mesh.Mesh) List[OpenMaya.MPoint][source]

Gets a list of points that represent the vertex positions.

@type config: MeshConfig @param config: Mesh configuration from the DNA.

@type data: MeshModel @param data: An object that stores values that get passed around different methods.

@rtype: List[MPoint] @returns: List of maya point objects.

static prepare_mesh(config: dna_viewer.config.mesh.Mesh, dna: dna_viewer.model.dna.DNA, data: dna_viewer.model.mesh.Mesh) None[source]

Gets a list of points that represent the vertex positions.

@type config: MeshConfig @param config: Mesh configuration from the DNA.

@type data: MeshModel @param data: An object that stores values that get passed around different methods.

static rename_mesh(config: dna_viewer.config.mesh.Mesh, dna: dna_viewer.model.dna.DNA, mesh_object: OpenMaya.MObject) OpenMaya.MDagModifier[source]

Renames the initial mesh object that was created to the name from the configuration.

@type config: MeshConfig @param config: Mesh configuration from the DNA.

@type mesh_object: MObject @param data: An object that stores values that get passed around different methods.

@rtype: Tuple[MDagModifier] @returns: Maya object representing the dag modifier.

dna_viewer.util.mesh_normals module

class dna_viewer.util.mesh_normals.MeshNormals[source]

Bases: object

A utility class used for adding normals to a mesh

static add_normals(config: dna_viewer.config.mesh.Mesh, dna: dna_viewer.model.dna.DNA, data: dna_viewer.model.mesh.Mesh, fn_mesh: OpenMaya.MFnMesh, space: Optional[OpenMaya.MSpace] = 2) None[source]

Adds normals to the mesh node.

@type config: MeshConfig @param config: Mesh configuration from the DNA.

@type data: MeshModel @param data: An object that stores values that get passed around different methods.

@type fn_mesh: MFnMesh @params fn_mesh: Object used for manipulating maya mesh objects.

@type space: Optional[space] @params space: The maya space used for setting the face vertex normals (defaults to MSpace.kObject)

dna_viewer.util.mesh_skin module

class dna_viewer.util.mesh_skin.MeshSkin[source]

Bases: object

A utility class used for interacting and adding skin clusters to a mesh

static add_skin_cluster(dna: dna_viewer.model.dna.DNA, mesh_index: int, mesh_name: str, joint_names: List[str]) None[source]

Creates a skin cluster object.

@type dna: DNA @param dna: Instance of DNA.

@type mesh_index: int @param mesh_index: The index of the mesh.

@type mesh_name: str @param mesh_name: The mesh name that is used for skin cluster naming.

@type joints: List[Joint] @param joints: List of joints used for adding the skin cluster.

static prepare_joints(dna: dna_viewer.model.dna.DNA, mesh_index: int) Tuple[List[int], List[str]][source]

Gets the joint indices and names needed for the given mesh.

@type dna: DNA @param dna: Instance of DNA.

@type mesh_index: int @param mesh_index: The index of the mesh.

@type joints: List[Joint] @param joints: List of all joints from which some of them are selected as a result.

@rtype: Tuple[List[int], List[str]] @returns: The tuple containing the list of joint indices and the list of joint names.

static set_skin_weights(dna: dna_viewer.model.dna.DNA, mesh_index: int, mesh_name: str, joint_ids: List[int]) None[source]

Sets the skin weights attributes.

@type dna: DNA @param dna: Instance of DNA.

@type mesh_index: int @param mesh_index: The index of the mesh.

@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.

dna_viewer.util.reader module

class dna_viewer.util.reader.Reader[source]

Bases: object

A utility class used for reading DNA files

static create_stream_reader(dna_path: str) dna.BinaryStreamReader[source]

Creates a stream reader needed for reading values from the DNA file.

@type dna_path: str @param dna_path: The path of the DNA file

@rtype: dna.BinaryStreamReader @returns: The stream reader needed for reading values from the DNA file

dna_viewer.util.reference module

class dna_viewer.util.reference.Reference[source]

Bases: object

A class used for storing and retrieving geometry readers.

geometry_readers: Dict[str, List[dna_viewer.reader.geometry.Geometry]] = {}
static get_geometry_reader(mesh_index: int, dna_path: Optional[str] = None) dna_viewer.reader.geometry.Geometry[source]

Gets a Geometry reader for a given mesh index and a dna_file path.

@type mesh_index: int @param mesh_index: The mesh index

@type dna_path: str @param dna_path: The path of the DNA file

@rtype: Geometry @returns: A stored geometry reader for the given mesh index and DNA

static set_geometry_reader(dna_path: str, geometry_reader: dna_viewer.reader.geometry.Geometry) None[source]

Adds a mapping value of a geometry reader to the DNA file path.

@type dna_path: str @param dna_path: The path of the DNA file

@type geometry_reader: Geometry @param geometry_reader: The geometry reader that should be added to the mapping.

dna_viewer.util.reference.get_geometry_reader(mesh_index: int, dna_path: Optional[str] = None) dna_viewer.reader.geometry.Geometry[source]

Gets a Geometry reader for a given mesh index and a dna_file path.

@type mesh_index: int @param mesh_index: The mesh index

@type dna_path: str @param dna_path: The path of the DNA file

@rtype: Geometry @returns: A geometry reader stored in the Reference class object for the given mesh index and DNA

dna_viewer.util.reference.set_geometry_reader(dna_path: str, geometry_reader: dna_viewer.reader.geometry.Geometry) None[source]

Adds a new geometry reader to the the references mapped to the DNA file path.

@type dna_path: str @param dna_path: The path of the DNA file

@type geometry_reader: Geometry @param geometry_reader: The geometry stream reader

dna_viewer.util.rig_logic module

class dna_viewer.util.rig_logic.RigLogic[source]

Bases: object

A utility class for adding rig logic to the character

static add_rig_logic(config: dna_viewer.config.character.Character, character_name: str) None[source]

Adds a rig logic node if the option is specified in the character configuration.

@type config: Character @param config: The character configuration.

@type character_name: str @param character_name: The name of the character.

dna_viewer.util.scene_builder module

class dna_viewer.util.scene_builder.SceneBuilder[source]

Bases: object

A utility class containing methods needed for building the maya scene

LOD_PREFIX = 'LOD_'
static add_display_layers(display_layers_needed: List[int]) None[source]

Creates a display layer for each value of the given list if it does not exist

@type display_layers_needed: List[int] @param display_layers_needed: A list of lod numbers that need a display layer created for them

static new_scene() None[source]

Creates a new maya scene.

static save_scene(save_options: dna_viewer.config.scene.SaveOptions) None[source]

Saves the scene if save options are provided.

@type save_options: SaveOptions @param save_options: The part configuration concerning how the scene should be saved

static set_units(dna: dna_viewer.model.dna.DNA, units: dna_viewer.config.units.Unit) None[source]

Sets the linear and angle units of the scene if provided as a parameter, otherwise defaults the values provided in the DNA file.

@type units: Unit @param units: The configuration that contains the linear and the angle unit.

dna_viewer.util.shader module

class dna_viewer.util.shader.Shader[source]

Bases: object

static default_lambert_shader(mesh_name: str, character_name: Optional[str] = None, create_character_node: bool = False) None[source]

dna_viewer.util.skin_weights_maya module

class dna_viewer.util.skin_weights_maya.MayaSkinWeights[source]

Bases: object

A class used for reading and storing skin weight related data needed for adding skin clusters

static create(skin_cluster: OpenMayaAnim.MFnSkinCluster, mesh_name: str) dna_viewer.util.skin_weights_maya.MayaSkinWeights[source]

Creates a new instance of the class object.

@type skin_cluster: MFnSkinCluster @param skin_cluster: Functionalities of maya skin clusters

@type mesh_name: str @param mesh_name: The name of the mesh

static 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

static 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]]]
class dna_viewer.util.skin_weights_maya.SkinWeightsMaya[source]

Bases: object

A class used for setting and interacting with skin weights in maya.

get_file_joint_mappings(skin_weights: dna_viewer.util.skin_weights_maya.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

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.

get_skin_weights_from_scene(mesh_name: str) dna_viewer.util.skin_weights_maya.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

import_skin_weights(skin_cluster: OpenMayaAnim.MFnSkinCluster, mesh_node: OpenMaya.MFnMesh, skin_weights: dna_viewer.util.skin_weights_maya.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

set_skin_weights_to_scene(mesh_name: str, skin_weights: dna_viewer.util.skin_weights_maya.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.

Module contents