# panda3d.egg.EggXfmSAnim¶

class EggXfmSAnim

Bases: EggGroupNode

This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S\$Anim> entries that specify the nine components of a transformation. It’s implemented as a group that can contain any number of EggSAnimData children.

Inheritance diagram

__init__(convert_from: EggXfmAnimData) → None

Converts the older-style XfmAnim table to the newer-style XfmSAnim table.

__init__(copy: EggXfmSAnim) → None
__init__(name: str, cs: CoordinateSystem) → None
addComponentData(component: int, value: float) → None

Adds a new row to the indicated component (0-12) of the table.

addComponentData(component_name: str, value: float) → None

Adds a new row to the named component (one of matrix_component_letters) of the table.

addData(mat: LMatrix4d) → bool

Adds a new matrix to the table, by adding a new row to each of the subtables.

This is a convenience function that treats the table of tables as if it were a single table of matrices. It is an error to call this if any SAnimData children of this node have an improper name (e.g. not a single letter, or not one of “ijkabchprxyz”).

This function has the further requirement that all nine of the subtables must exist and be of the same length. Furthermore, the order string must be the standard order string, which matches the system compose_matrix() and decompose_matrix() functions.

Thus, you probably cannot take an existing EggXfmSAnim object and start adding matrices to the end; you must clear out the original data first. (As a special exception, if no tables exist, they will be created.) The method normalize() will do this for you on an existing EggXfmSAnim.

This function may fail silently if the matrix cannot be decomposed into scale, shear, rotate, and translate. In this case, the closest approximation is added to the table, and false is returned.

assign(copy: EggXfmSAnim) → EggXfmSAnim
Return type

EggXfmSAnim

clearData() → None

Removes all data from the table. It does this by removing all of its children.

clearFps() → None
clearOrder() → None
static composeWithOrder(mat: LMatrix4d, scale: LVecBase3d, shear: LVecBase3d, hpr: LVecBase3d, trans: LVecBase3d, order: str, cs: CoordinateSystem) → None

Composes a matrix out of the nine individual components, respecting the order string. The components will be applied in the order indicated by the string.

static getClassType() → TypeHandle
Return type

TypeHandle

getCoordinateSystem() → CoordinateSystem

Returns the coordinate system this table believes it is defined within. This should always match the coordinate system of the EggData structure that owns it. It is necessary to store it here because the meaning of the h, p, and r columns depends on the coordinate system.

Return type

CoordinateSystem

getFps() → float

This is only valid if hasFps() returns true.

getNumRows() → int

Returns the effective number of rows in the table. This is actually the number of rows of the smallest subtable larger than one row. This is a convenience function that treats the table of tables as if it were a single table of matrices.

getOrder() → str
static getStandardOrder() → str

Returns the standard order of matrix component composition. This is what the order string must be set to in order to use setValue() or addData() successfully.

getValue(row: int, mat: LMatrix4d) → None

Returns the value of the aggregate row of the table as a matrix. This is a convenience function that treats the table of tables as if it were a single table of matrices. It is an error to call this if any SAnimData children of this node have an improper name (e.g. not a single letter, or not one of “ijkabchprxyz”).

hasFps() → bool
hasOrder() → bool
normalize() → None

The inverse operation of optimize(), this ensures that all the sub-tables have the same length by duplicating rows as necessary. This is needed before doing operations like addData() or setValue() on an existing table.

optimize() → None

Optimizes the table by collapsing redundant sub-tables.

optimizeToStandardOrder() → None

Optimizes the table by collapsing redundant sub-tables, and simultaneously ensures that the order string is the standard order (which is the same as that supported by compose_matrix() and decompose_matrix()).

setFps(fps: float) → None
setOrder(order: str) → None
setValue(row: int, mat: LMatrix4d) → bool

Replaces the indicated row of the table with the given matrix.

This function can only be called if all the constraints of addData(), below, are met. Call normalize() first if you are not sure.

The return value is true if the matrix can be decomposed and stored as scale, shear, rotate, and translate, or false otherwise. The data is set in either case.