MeshAnimation Class
Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
MeshAnimation Class
Members
int getNumBones() const#
Returns the current total number of the mesh bones.
Return value
Current number of the mesh bones.MeshAnimation ( ) #
Constructor. Creates an empty mesh.MeshAnimation ( string path ) #
Constructor. Creates a mesh animation using the specified file.Arguments
- string path - Path to the mesh animation file.
void assignFrom ( MeshAnimation src ) #
Copies the animation data from the source: bones, list of animated bones, and animation frames.Arguments
- MeshAnimation src - Source mesh animation instance.
void clear ( ) #
Clears the mesh animation data: bones, list of animated bones, and animation frames.int flipYZ ( ) #
Flips the Y and Z axes for the animation:- Y axis becomes equal to -Z
- Z axis becomes equal to Y
Return value
1 if the axes are flipped successfully; otherwise, 0.int info ( string path ) #
Returns the information about the specified animation.Arguments
- string path - Path to the file containing animation.
Return value
1 if the information returned successfully; otherwise, 0.int load ( string path ) #
Loads the animation (bone names and bone parent indices) from the specified file.Arguments
- string path - Path to the file containing animation.
Return value
1 if the animation is loaded from the file successfully; otherwise, 0.int save ( string path ) #
Saves the given animation in the ANIM file format. Creates the given file if it doesn’t exist yet (including subdirectories).Arguments
- string path - Path to a file including the file name and extension to which animation is to be saved (*.anim).
Return value
1 if the animation is saved successfully; otherwise, 0.int findBone ( string name ) #
Searches for a bone with a given name and returns its number.Arguments
- string name - Name of the bone.
Return value
Bone number.int addBone ( string name = 0, int parent = -1 ) #
Appends a new mesh bone.Arguments
- string name - Bone name. This argument is empty by default.
- int parent - Parent bone number. The default value is -1 (the new bone has no parent bone).
Return value
Number of mesh bones.void setBoneName ( int bone, string name ) #
Sets the name for the given bone.Arguments
- int bone - Bone number.
- string name - Bone name.
string getBoneName ( int bone ) #
Returns the name of the given bone.Arguments
- int bone - Bone number.
Return value
Bone name.void setBoneParent ( int bone, int parent ) #
Sets the bone specified as the second argument as the parent bone for the bone specified as the first argument.Arguments
- int bone - Number of the bone, for which the parent will be returned.
- int parent - Parent bone number, if the parent exists; otherwise, -1.
int getBoneParent ( int bone ) #
Returns the number of the parent bone for a given one.Arguments
- int bone - Number of the bone, for which the parent will be returned.
Return value
Parent bone number, if the parent exists; otherwise, -1.void setBoneTransform ( int bone, mat4 transform ) #
Sets a transformation matrix for the given bone (without considering node transformations).Notice
Bones can be scaled only uniformly.
Arguments
- int bone - Bone number.
- mat4 transform - Transformation matrix.
mat4 getBoneTransform ( int bone ) #
Returns a transformation matrix of the given bone relatively to the parent object (not considering transformations of the Mesh Skinned node itself).Arguments
- int bone - Bone number.
Return value
Transformation matrix.int getNumAnimationBones ( ) #
Returns the total number of mesh animation bones.Return value
Number of the mesh animation bones.short getAnimationBoneID ( int num ) #
Returns the mesh bone ID for the specified animated bone.Arguments
- int num - Bone index in the list of animated bones.
Return value
Bone ID in the list of mesh bones.void setNumFrames ( int num ) #
Sets the number of frames for the animation.Arguments
- int num - Number of the animation frames.
int getNumFrames ( ) #
Returns the number of frames for the animation.Return value
Number of the animation frames.The information on this page is valid for UNIGINE 2.20 SDK.
Last update:
2024-09-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)