EggTransform¶
from acron.egg import EggTransform
- class EggTransform¶
Bases:
Bases:
MemoryBaseThis represents the <Transform> entry of a group or texture node: a list of component transform operations, applied in order, that describe a net transform matrix.
This may be either a 3-d transform, and therefore described by a 4x4 matrix, or a 2-d transform, described by a 3x3 matrix.
Inheritance diagram
digraph inheritancee443255182 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "EggTransform" [URL="acron.egg.EggTransform.html#acron.egg.EggTransform",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "EggTransform" [arrowsize=0.75,style=""]; }-
enum ComponentType
-
enumerator CT_invalid = 0¶
-
enumerator CT_translate2d = 1¶
-
enumerator CT_translate3d = 2¶
-
enumerator CT_rotate2d = 3¶
-
enumerator CT_rotx = 4¶
-
enumerator CT_roty = 5¶
-
enumerator CT_rotz = 6¶
-
enumerator CT_rotate3d = 7¶
-
enumerator CT_scale2d = 8¶
-
enumerator CT_scale3d = 9¶
-
enumerator CT_uniform_scale = 10¶
-
enumerator CT_matrix3 = 11¶
-
enumerator CT_matrix4 = 12¶
-
enumerator CT_invalid = 0¶
- __init__()¶
- add_matrix3()¶
Appends an arbitrary 3x3 matrix to the current transform.
- add_matrix4()¶
Appends an arbitrary 4x4 matrix to the current transform.
- add_rotate2d()¶
Appends a 2-d rotation to the current transform. The rotation angle is specified in degrees counterclockwise about the origin.
- add_rotate3d()¶
Appends a 3-d rotation about an arbitrary axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.
Appends an arbitrary 3-d rotation to the current transform, expressed as a quaternion. This is converted to axis-angle notation for the egg file.
- add_rotx()¶
Appends a rotation about the X axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.
- add_roty()¶
Appends a rotation about the Y axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.
- add_rotz()¶
Appends a rotation about the Z axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.
- add_scale2d()¶
Appends a possibly non-uniform scale to the current transform.
- add_scale3d()¶
Appends a possibly non-uniform scale to the current transform.
- add_translate2d()¶
Appends a 2-d translation operation to the current transform.
- add_translate3d()¶
Appends a 3-d translation operation to the current transform.
- add_uniform_scale()¶
Appends a uniform scale to the current transform.
- assign()¶
- clear_transform()¶
Resets the transform to empty, identity.
- get_component_mat3()¶
Returns the 3x3 matrix associated with the nth component. It is an error to call this if the component type is not CT_matrix3.
- get_component_mat4()¶
Returns the 4x4 matrix associated with the nth component. It is an error to call this if the component type is not CT_matrix4.
- get_component_number()¶
Returns the solitary number associated with the nth component. In the case of a rotation, this is the angle in degrees to rotate; in the case of uniform scale, this is the amount of the scale. Other types do not use this property.
- get_component_type()¶
Returns the type of the nth component.
- get_component_vec2()¶
Returns the 2-component vector associated with the nth component. This may be the translate vector, rotate axis, or non-uniform scale. It is an error to call this if the component type does not use a 2-d vector property.
- get_component_vec3()¶
Returns the 3-component vector associated with the nth component. This may be the translate vector, rotate axis, or non-uniform scale. It is an error to call this if the component type does not use a 3-d vector property.
- get_num_components()¶
Returns the number of components that make up the transform.
- get_transform2d()¶
Returns the overall transform as a 3x3 matrix. It is an error to call this if
has_transform3d()is true.
- get_transform3d()¶
Returns the overall transform as a 4x4 matrix. It is valid to call this even if
has_transform2d()is true; in this case, the 3x3 transform will be expanded to a 4x4 matrix.
- has_transform()¶
Returns true if the transform is nonempty, false if it is empty (no transform components have been added). This is true for either a 2-d or a 3-d transform.
- has_transform2d()¶
Returns true if the transform is specified as a 2-d transform, e.g. with a 3x3 matrix, or false if it is specified as a 3-d transform (with a 4x4 matrix), or not specified at all.
Normally,
EggTextureshave a 2-d matrix (but occasionally they use a 3-d matrix), andEggGroupsalways have a 3-d matrix.
- has_transform3d()¶
Returns true if the transform is specified as a 3-d transform, e.g. with a 4x4 matrix, or false if it is specified as a 2-d transform (with a 2x2 matrix), or not specified at all.
Normally,
EggTextureshave a 3-d matrix (but occasionally they use a 3-d matrix), andEggGroupsalways have a 3-d matrix.
- set_transform2d()¶
Sets the overall transform as a 3x3 matrix. This completely replaces whatever componentwise transform may have been defined.
- set_transform3d()¶
Sets the overall transform as a 4x4 matrix. This completely replaces whatever componentwise transform may have been defined.
- transform_is_identity()¶
Returns true if the described transform is identity, false otherwise.
- write()¶
Writes the transform to the indicated stream in Egg format.
-
enum ComponentType