DNAViewer.dnalib package

Submodules

dna_viewer.dnalib.behavior module

class dna_viewer.dnalib.behavior.AnimatedMapsConditionalTable(lods: typing.List[int] = <factory>, conditional_table: dna_viewer.dnalib.behavior.ConditionalTable = <factory>)[source]

Bases: object

A model class for holding data about animated maps

@type lods
Type

List[int]

@param lods
Type

A list of lod indices that the blend shapes are contained within

@type conditional_table
Type

ConditionalTable

@param conditional_table
Type

Data needed for animated maps

conditional_table: dna_viewer.dnalib.behavior.ConditionalTable
lods: List[int]
class dna_viewer.dnalib.behavior.Behavior(reader: dna.BinaryStreamReader, layers: Optional[List[dna_viewer.dnalib.layer.Layer]])[source]

Bases: dna_viewer.dnalib.definition.Definition

@type reader: BinaryStreamReader @param reader: The binary stream reader being used

@type gui_to_raw: ConditionalTable @param gui_to_raw: Mapping data about gui to raw values

@type psd: PSDMatrix @param psd: The data representing Pose Space Deformation

@type blend_shapes: BlendShapesData @param blend_shapes: The data representing blend shapes

@type animated_maps: AnimatedMapsConditionalTable @param animated_maps: The data representing animated maps

@type joints: JointGroups @param joints: The data representing joints

add_animated_maps_conditional_table() None[source]

Reads in the animated maps part of the behavior

add_blend_shapes() None[source]

Reads in the blend shapes part of the behavior

add_gui_to_raw() None[source]

Reads in the gui to raw mapping

add_joint_groups() None[source]

Reads in the joints part of the behavior

add_psd() None[source]

Reads in the PSD part of the behavior

get_animated_map_cut_values() List[float][source]
get_animated_map_from_values() List[float][source]
get_animated_map_input_indices() List[int][source]
get_animated_map_lods() List[int][source]
get_animated_map_output_indices() List[int][source]
get_animated_map_slope_values() List[float][source]
get_animated_map_to_values() List[float][source]
get_blend_shape_channel_input_indices() List[int][source]
get_blend_shape_channel_lods() List[int][source]
get_blend_shape_channel_output_indices() List[int][source]
get_gui_to_raw_cut_values() List[float][source]
get_gui_to_raw_from_values() List[float][source]
get_gui_to_raw_input_indices() List[int][source]
get_gui_to_raw_output_indices() List[int][source]
get_gui_to_raw_to_values() List[float][source]
get_joint_column_count() int[source]
get_joint_group_count() int[source]
get_joint_group_input_indices(joint_group_index: int) List[int][source]
get_joint_group_joint_indices(joint_group_index: int) List[int][source]
get_joint_group_logs(joint_group_index: int) List[int][source]
get_joint_group_output_indices(joint_group_index: int) List[int][source]
get_joint_group_values(joint_group_index: int) List[float][source]
get_joint_row_count() int[source]
get_joint_variable_attribute_indices() int[source]
get_psd_column_indices() List[int][source]
get_psd_count() int[source]
get_psd_row_indices() List[int][source]
get_psd_values() List[float][source]
gget_gui_to_raw_slope_values() List[float][source]
is_read() bool[source]
read() None[source]

Starts reading in the behavior part of the DNA

start_read() None[source]
class dna_viewer.dnalib.behavior.BlendShapesData(lods: typing.List[int] = <factory>, inputs: typing.List[int] = <factory>, outputs: typing.List[int] = <factory>)[source]

Bases: object

A model class for holding data about blend shapes

@type lods
Type

List[int]

@param lods
Type

A list of lod indices that the blend shapes are contained within

@type inputs
Type

List[int]

@param inputs
Type

The indices of inputs

@type outputs
Type

List[int]

@param outputs
Type

The indices of outputs

inputs: List[int]
lods: List[int]
outputs: List[int]
class dna_viewer.dnalib.behavior.ConditionalTable(from_values: typing.List[float] = <factory>, to_values: typing.List[float] = <factory>, slope_values: typing.List[float] = <factory>, cut_values: typing.List[float] = <factory>, inputs: typing.List[int] = <factory>, outputs: typing.List[int] = <factory>)[source]

Bases: object

A model class for holding various values

@type from_values
Type

List[float]

@param from_values
Type

The list of values

@type to_values
Type

List[float]

@param to_values
Type

The list of values

@type slope_values
Type

List[float]

@param slope_values
Type

The list of slope values

@type cut_values
Type

List[float]

@param cut_values
Type

The list of cut values

@type inputs
Type

List[int]

@param inputs
Type

The indices of inputs

@type outputs
Type

List[int]

@param outputs
Type

The indices of outputs

cut_values: List[float]
from_values: List[float]
inputs: List[int]
outputs: List[int]
slope_values: List[float]
to_values: List[float]
class dna_viewer.dnalib.behavior.JointGroup(lods: typing.List[int] = <factory>, values: typing.List[float] = <factory>, joints: typing.List[int] = <factory>, inputs: typing.List[int] = <factory>, outputs: typing.List[int] = <factory>)[source]

Bases: object

A model class for holding data about joint groups

@type lods
Type

List[int]

@param lods
Type

A list of lod indices that the joint group is contained within

@type values
Type

List[float]

@param values
Type

A list of values

@type joints
Type

List[int]

@param joints
Type

A list of joint indices

@type inputs
Type

List[int]

@param inputs
Type

The indices of inputs

@type outputs
Type

List[int]

@param outputs
Type

The indices of outputs

inputs: List[int]
joints: List[int]
lods: List[int]
outputs: List[int]
values: List[float]
class dna_viewer.dnalib.behavior.JointGroups(joint_row_count: typing.Optional[int] = None, joint_column_count: typing.Optional[int] = None, joint_variable_attribute_indices: typing.List[typing.List[int]] = <factory>, joint_groups: typing.List[dna_viewer.dnalib.behavior.JointGroup] = <factory>)[source]

Bases: object

A model class for storing data about joints

@type joint_row_count
Type

int

@param joint_row_count
Type

The row count of the matrix that stores the joints data

@type joint_column_count
Type

int

@param joint_column_count
Type

The column count of the matrix that stores the joints data

@type joint_variable_attribute_indices
Type

List[List[int]]

@param joint_variable_attribute_indices
Type

List of joint variable attribute indices per LOD

@type joint_groups
Type

List[JointGroup]

@param joint_groups
Type

The list of joint groups

joint_column_count: Optional[int] = None
joint_groups: List[dna_viewer.dnalib.behavior.JointGroup]
joint_row_count: Optional[int] = None
joint_variable_attribute_indices: List[List[int]]
class dna_viewer.dnalib.behavior.PSDMatrix(count: typing.Optional[int] = None, rows: typing.List[int] = <factory>, columns: typing.List[int] = <factory>, values: typing.List[float] = <factory>)[source]

Bases: object

A model class for holding data about Pose Space Deformation

@type count
Type

int

@param count
Type

The list of values

@type rows
Type

List[int]

@param rows
Type

List of row indices used for storing values

@type columns
Type

List[int]

@param columns
Type

List of row indices used for storing values

@type values
Type

List[float]

@param values
Type

The list of values, that can be accessed from the row and column index

columns: List[int]
count: Optional[int] = None
rows: List[int]
values: List[float]

dna_viewer.dnalib.definition module

class dna_viewer.dnalib.definition.Definition(reader: dna.BinaryStreamReader, layers: Optional[List[dna_viewer.dnalib.layer.Layer]])[source]

Bases: dna_viewer.dnalib.descriptor.Descriptor

A class used for reading and accessing the definition part of the DNA file

@type reader
Type

BinaryStreamReader

@param reader
Type

The binary stream reader being used

@type definition
Type

DefinitionModel

@param definition
Type

The object that holds the definition data read from the DNA file

@type joints
Type

Joints

@param joints
Type

The data about joints

@type blend_shape_channels
Type

GeometryEntity

@param blend_shape_channels
Type

The names and indices of blend shape channels

@type animated_maps
Type

GeometryEntity

@param animated_maps
Type

The names and indices of animated maps

@type meshes
Type

GeometryEntity

@param meshes
Type

The names and indices of the meshes

@type gui_control_names
Type

List[str]

@param gui_control_names
Type

The list of gui control names

@type raw_control_names
Type

List[str]

@param raw_control_names
Type

The list of raw control names

@type mesh_blend_shape_channel_mapping
Type

List[Tuple[int, int]]

@param mesh_blend_shape_channel_mapping
Type

Mapping of mesh index to the blend shape channel index

@type mesh_blend_shape_channel_mapping_indices_for_lod
Type

List[List[int]]

@param mesh_blend_shape_channel_mapping_indices_for_lod
Type

The list of blend shape channel mapping indices by lod

@type neutral_joint_translations
Type

List[Point3]

@param neutral_joint_translations
Type

The list of neutral joint translations

@type neutral_joint_rotations
Type

List[Point3]

@param neutral_joint_rotations
Type

The list of neutral joint rotations

add_animated_maps() None[source]

Reads in the animated maps of the definition

add_blend_shape_channels() None[source]

Reads in the neutral joints part of the definition

add_controls() None[source]

Reads in the gui and raw controls of the definition

add_joints() None[source]

Reads in the joints of the definition

add_mesh_blend_shape_channel_mapping() None[source]

Reads in the mesh blend shape channel mapping

add_meshes() None[source]

Reads in the meshes of the definition

add_neutral_joints() None[source]

Reads in the neutral joints part of the definition

get_animated_map_count() int[source]
get_animated_map_indices_for_lod(index: int) List[int][source]
get_animated_map_name(index: int) str[source]
get_animated_map_names() List[str][source]
get_blend_shape_channel_count() int[source]
get_blend_shape_channel_indices_for_lod(index: int) List[int][source]
get_blend_shape_channel_name(index: int) str[source]
get_gui_control_count() int[source]
get_gui_control_name(index: int) str[source]
get_joint_count() int[source]
get_joint_indices_for_lod(index: int) List[int][source]
get_joint_name(index: int) str[source]
get_joint_parent_index(index: int) int[source]
get_lod_count() int[source]
get_mesh_blend_shape_channel_mapping(index: int) dna.MeshBlendShapeChannelMapping[source]
get_mesh_blend_shape_channel_mapping_count() int[source]
get_mesh_blend_shape_channel_mapping_for_lod(lod: int) List[int][source]
get_mesh_count() int[source]
get_mesh_indices_for_lod(index: int) List[int][source]
get_mesh_name(index: int) str[source]
get_neutral_joint_rotation(index: int) dna_viewer.model.Point3[source]
get_neutral_joint_rotation_xs() List[float][source]
get_neutral_joint_rotation_ys() List[float][source]
get_neutral_joint_rotation_zs() List[float][source]
get_neutral_joint_translation(index: int) dna_viewer.model.Point3[source]
get_neutral_joint_translation_xs() List[float][source]
get_neutral_joint_translation_ys() List[float][source]
get_neutral_joint_translation_zs() List[float][source]
get_raw_control_count() int[source]
get_raw_control_name(index: int) str[source]
get_raw_control_names() List[str][source]
get_rotation_unit() int[source]
get_translation_unit() int[source]
is_read() bool[source]
read() None[source]

Starts reading in the definition part of the DNA

@rtype: DefinitionModel @returns: the instance of the created definition model

start_read() None[source]
class dna_viewer.dnalib.definition.GeometryEntity(names: typing.List[str] = <factory>, lod_indices: typing.List[typing.List[int]] = <factory>)[source]

Bases: object

A model class for holding names and indices

@type names
Type

List[str]

@param names
Type

List of names

@type lod_indices
Type

List[List[int]]

@param lod_indices
Type

List of indices per lod

lod_indices: List[List[int]]
names: List[str]
class dna_viewer.dnalib.definition.Joints(names: typing.List[str] = <factory>, lod_indices: typing.List[typing.List[int]] = <factory>, parent_index: typing.List[int] = <factory>)[source]

Bases: dna_viewer.dnalib.definition.GeometryEntity

A model class for holding data about the joints

@type parent_index
Type

List[int]

@param parent_index
Type

List of parent indices for each joint index

parent_index: List[int]

dna_viewer.dnalib.descriptor module

class dna_viewer.dnalib.descriptor.Descriptor(reader: dna.BinaryStreamReader, layers: Optional[List[dna_viewer.dnalib.layer.Layer]])[source]

Bases: object

A class used for reading and accessing the descriptor part of the DNA file

@type name
Type

str

@param name
Type

The name of the character

@type archetype
Type

int

@param archetype
Type

A value that represents the archetype of the character

@type gender
Type

int

@param gender
Type

A value that represents the gender of the character

@type age
Type

int

@param age
Type

The age of the character

@type metadata
Type

Dict[str, str]

@param metadata
Type

Metadata stored for the character

@type translation_unit
Type

int

@param translation_unit
Type

The translation unit that was used for creating the character

@type rotation_unit
Type

int

@param rotation_unit
Type

The translation unit that was used for creating the character

@type coordinate_system
Type

Tuple[int, int, int]

@param coordinate_system
Type

A tuple representing the coordinate system

@type lod_count
Type

int

@param lod_count
Type

The number of LODs for the characters

@type db_max_lod
Type

int

@param db_max_lod
Type

A LOD constraint representing the greatest LOD we wish wish to produce (ie. if the value is n, the potential LODs are 0, 1, .. n-1)

@type db_complexity
Type

str

@param db_complexity
Type

Will be used in future

@type db_name
Type

str

@param db_name
Type

DB identifier

add_basic_data() None[source]

Reads in the character name, archetype, gender and age

add_db_data() None[source]

Reads in the db data from the DNA file

add_geometry_data() None[source]

Sets the translation unit, rotation unit, and coordinate system from the DNA file

add_metadata() None[source]

Reads in the metadata provided from the DNA file

is_read() bool[source]
layer_enabled(layer: dna_viewer.dnalib.layer.Layer) bool[source]
read() None[source]

Starts reading in the descriptor part of the DNA

@rtype: DescriptorModel @returns: the instance of the created descriptor model

start_read() None[source]

dna_viewer.dnalib.dnalib module

class dna_viewer.dnalib.dnalib.DNA(dna_path: str, layers: Optional[List[dna_viewer.dnalib.layer.Layer]] = None)[source]

Bases: dna_viewer.dnalib.behavior.Behavior, dna_viewer.dnalib.geometry.Geometry

A class used for accessing data in DNA file.

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

@type layers: Optional[List[Layer]] @param layers: List of parts of DNA to be loaded. If noting is passed, whole DNA is going to be loaded. Same as

passing Layer.all.

create_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 @returns: The reader needed for reading values from the DNA file

get_all_meshes_grouped_by_lod() 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

get_all_skin_weights_joint_indices_for_mesh(mesh_index: int) List[List[int]][source]
get_all_skin_weights_values_for_mesh(mesh_index: int) List[List[float]][source]
get_blend_shape_target_deltas_with_vertex_id(mesh_index: int, blend_shape_target_index: int) List[Tuple[int, dna_viewer.model.Point3]][source]
get_blend_shapes(mesh_index: int) List[dna_viewer.model.BlendShape][source]
get_faces(mesh_index: int) List[List[int]][source]
get_layouts_for_mesh_index(mesh_index: int) List[dna_viewer.model.Layout][source]
get_lowest_lod_containing_meshes(mesh_indices: List[int]) Optional[int][source]
get_mesh_id_from_mesh_name(mesh_name: str) Optional[int][source]
get_meshes_by_lods(mesh_indices: List[int]) List[List[int]][source]
get_polygon_faces_and_connects(mesh_index: Optional[int] = None, dna_faces: Optional[List[List[int]]] = None, dna_vertex_layout_positions: Optional[List[int]] = None) Tuple[List[int], List[int]][source]
get_skin_weight_matrix_for_mesh(mesh_index: int) List[List[Tuple[int, float]]][source]
get_texture_coordinate_index(mesh_index: int, layout_id: int) int[source]
get_vertex_layout_positions_for_mesh_index(mesh_index: int) List[int][source]
get_vertex_positions_for_mesh_index(mesh_index: int) List[dna_viewer.model.Point3][source]
get_vertex_texture_coordinates_for_mesh(mesh_index: int) List[dna_viewer.model.UV][source]
has_blend_shapes(mesh_index: int) bool[source]
is_read() bool[source]
read() None[source]

Starts reading in the behavior part of the DNA

read_all_neutral_joints() List[dna_viewer.model.Joint][source]

dna_viewer.dnalib.geometry module

class dna_viewer.dnalib.geometry.Geometry(reader: dna.BinaryStreamReader, layers: Optional[List[dna_viewer.dnalib.layer.Layer]])[source]

Bases: dna_viewer.dnalib.definition.Definition

add_face_vertex_layouts(mesh_index: int) List[List[int]][source]

Reads in the face vertex layouts

add_layouts(mesh_index: int) List[dna_viewer.model.Layout][source]

Reads in the vertex layouts

add_mesh(mesh_index: int) dna_viewer.model.Mesh[source]
add_mesh_blend_shapes(mesh_index: int) List[dna_viewer.model.BlendShape][source]

Reads in the blend shapes

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

add_mesh_skin_weights(mesh_index: int) dna_viewer.model.SkinWeightsData[source]

Reads in the skin weights

add_mesh_topology(mesh_index: int) dna_viewer.model.Topology[source]

Reads in the positions, texture coordinates, normals, layouts and face vertex layouts

add_positions(mesh_index: int) List[dna_viewer.model.Point3][source]

Reads in the vertex positions

add_texture_coordinates(mesh_index: int) List[dna_viewer.model.UV][source]

Reads in the texture coordinates

get_blend_shape_channel_index(mesh_index: int, blend_shape_target_index: int) int[source]
get_blend_shape_target_count(mesh_index: int) int[source]
get_blend_shape_target_delta(mesh_index: int, blend_shape_target_index: int, delta_index: int) Tuple[int, int, int][source]
get_blend_shape_target_delta_count(mesh_index: int, blend_shape_target_index: int) int[source]
get_blend_shape_target_vertex_indices(mesh_index: int, blend_shape_target_index: int) List[int][source]
get_face_count(mesh_index: int) int[source]
get_face_vertex_layout_indices(mesh_index: int, face_index: int) List[int][source]
get_maximum_influence_per_vertex(mesh_index: int) int[source]
get_skin_weights_joint_indices(mesh_index: int, vertex_index: int) List[int][source]
get_skin_weights_values(mesh_index: int, vertex_index: int) List[float][source]
get_vertex_layout(mesh_index: int, layout_index: int) Tuple[int, int, int][source]
get_vertex_layout_count(mesh_index: int) int[source]
get_vertex_position(mesh_index: int, vertex_index: int) Tuple[float, float, float][source]
get_vertex_position_count(mesh_index: int) int[source]
get_vertex_texture_coordinate(mesh_index: int, texture_coordinate_index: int) Tuple[float, float][source]
get_vertex_texture_coordinate_count(mesh_index: int) int[source]
is_read() bool[source]
read() None[source]

Starts reading in the mesh from the geometry part of the DNA

read_target_deltas(mesh_index: int, blend_shape_target_index: int) Dict[int, dna_viewer.model.Point3][source]

Reads in the target deltas

@rtype: Dict[int, Point3] @returns: Mapping of vertex indices to positions

start_read() None[source]

dna_viewer.dnalib.layer module

class dna_viewer.dnalib.layer.Layer(value)[source]

Bases: enum.Enum

An enumeration.

all = 5
behavior = 3
definition = 2
descriptor = 1
geometry = 4