Overview

This is a guide to the Misfit Model 3D scripting language. It includes only functions that are specific to Misfit Model 3D. Standard lua control structures and functions are not documented here.

For more information on using the scripting language, you may also want to review the Scripting Guide.

Contents


General


modelGetName

Descritption: Get the filename of the model

Arguments: Returns:

Notes: If the model does not have a filename this function will return an empty string.


modelSaveAs

Descritption: Save the model as a specified format.

Arguments: Returns:

Notes: Existing files will not be over-written. If writing the file in the specified format would cause an over-write, a number is added to the filename and incremented until the filename is unique.


modelGetVertexCount

Descritption: Get the number of vertices in the model.

Arguments: Returns:

Notes: None


modelGetFaceCount

Descritption: Get the number of faces (polygons (triangles)) in the model.

Arguments: Returns:

Notes: None


modelGetGroupCount

Descritption: Get the number of polygon groups in the model.

Arguments: Returns:

Notes: None


modelGetJointCount

Descritption: Get the number of bone joints in the model.

Arguments: Returns:

Notes: None


modelGetTextureCount

Descritption: Get the number of textures in the model.

Arguments: Returns:

Notes: None


modelGetGroupByName

Descritption: Get the ID of a group from its name.

Arguments: Returns:

Notes: None


groupGetName

Descritption: Get the name of the specified group.

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


modelGetTextureByName

Descritption: Get the ID of a texture from its name.

Arguments: Returns:

Notes: In most circumstances the name of the texture is the filename without its full path or extension. The exeption to this is if the model did not have textures explicitly associated with it and the model filter had to guess at texture file names. In this case the texture name will be the texture filename including the extension, but without the full path.


textureGetName

Descritption: Get the name of the specified texture.

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


textureGetFilename

Descritption: Get the filename of the specified texture.

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


Primitive Creation


modelCreateMeshRectangle

Descritption: Create a rectangular mesh.

Arguments: Returns:

Notes: None


modelCreateBoneJoint

Descritption: Get the number of vertices in the model.

Arguments: Returns:

Notes: None


vertexSetCoords

Descritption: Move a vertex to a new position

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


modelAddTexture

Descritption: Add an image file to a model as a texture.

Arguments: Returns:

Notes: None


vertexSetCoords

Descritption: Assign a texture to a group.

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


faceSetTextureCoords

Descritption: Set the UV texture coordinates for a vertex of a polygon

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.

Texture coordinates are from 0.0 to 1.0. The origin (0.0, 0.0) is the lower-left corner of the texture, not the upper-right corner.


Selection manipulation


selectedRotate

Descritption: Rotate the selected vertices and bone joints around the origin.

Arguments: Returns:

Notes: Rotation is around the origin. If you want to rotate around an arbitrary point (x0,y0,z0) you can use the following steps:

  1. selectedTranslate ( -x0, -y0, -z0 )
  2. selectedRotate( x, y, z )
  3. selectedTranslate ( x0, y0, z0 )

selectedTranslate

Descritption: Translate the selected vertices and bone joints.

Arguments: Returns:

Notes: None


selectedScale

Descritption: Scale the distance between selected vertices and bone joints.

Arguments: Returns:

Notes: None


selectedApplyMatrix

Descritption: Apply an arbitrary 4x4 matrix to the selected vertices and joints.

Arguments: Returns:

Notes: The m13, m14, m15 elements are the translation elements.


selectedWeldVertices

Descritption: Any selected vertcies that share coordinates into one vertex.

Arguments: Returns:

Notes: This does not weld all verticies into one. It only welds vertices that are very, very close to each other.


selectedInvertNormals

Descritption: Invertes the normals on any selected faces (polygons (triangles)). Effectively this turns objects inside-out so that light reflects off the opposite sides of the faces.

Arguments: Returns:

Notes: None


selectedGroupFaces

Descritption: Assigns all selected faces to a group specified by name. The group is created if it does not exist.

Arguments: Returns:

Notes: None


selectedAddToGroup

Descritption: Adds selected faces to an existing group.

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


Animation


modelCreateAnimation

Descritption: Creates a new animation

Arguments: Returns:

Notes: Animation IDs are unique to their type, but can be the same for two different types. In other words, the first skeletal animation and the first frame animation are always zero (0). This is why you must use an animation type/mode string when you specify an animation ID.


setAnimByIndex

Descritption: Sets the current animation from a mode string and an ID value.

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.

You can set frame animation vertex positions or skeletal animation keyframes directly using functions below. You only need to use this function if you want to use matrix transformations to manipulate several animated primitives at once; for example, translating or rotating many vertex positions at one time.


setAnimByName

Descritption: Sets the current animation from a mode string and a name string.

Arguments: Returns:

Notes: You can set frame animation vertex positions or skeletal animation keyframes directly using functions below. You only need to use this function if you want to use matrix transformations to manipulate several animated primitives at once; for example, translating or rotating many vertex positions at one time.


animSetFrame

Descritption: Sets the current frame of the current animation.

Arguments: Returns:

Notes: You can set frame animation vertex positions or skeletal animation keyframes directly using functions below. You only need to use this function if you want to use matrix transformations to manipulate several animated primitives at once; for example, translating or rotating many vertex positions at one time.


animGetCount

Descritption: Get the number of animations of a specified type.

Arguments: Returns:

Notes: None


animGetName

Descritption: Get the name of an animation.

Arguments: Returns:

Notes: None


animGetFrameCount

Descritption: Get the frame count of an animation.

Arguments: Returns:

Notes: None


animSetName

Descritption: Change the name of the specified animation.

Arguments: Returns:

Notes: None


animSetFrameCount

Descritption: Change the frame count of the specified animation.

Arguments: Returns:

Notes: None


animSetFPS

Descritption: Change the animation speed.

Arguments: Returns:

Notes: None


animClearFrame

Descritption: Clear an animation frame so that all primitives are in their default position and orientation.

Arguments: Returns:

Notes: None


animCopyFrame

Descritption: Copy an animation frame to another frame so that each frame is identical.

Arguments: Returns:

Notes: None


Animation set manipulation


animMove

Descritption: Move an animation from one index to another. This changes the order in which animations are listed.

Arguments: Returns:

Notes: Animation indices and IDs are the same thing. If you move an animation its ID changes to its new index position. Other animation IDs may be changed as well if they appear after the old or new animation index.


animCopy

Descritption: Create a new animation that is a copy of an existing animation.

Arguments: Returns:

Notes: None


animSplit

Descritption: Split an animation into two separate animations at a specified frame.

Arguments: Returns:

Notes: None


animJoin

Descritption: Join two animations together into one.

Arguments: Returns:

Notes: In case the above argument descriptions are unclear, animation 2 will be appended to animation 1.


animConvertToFrame

Descritption: Convert a skeletal animation to a frame animation.

Arguments: Returns:

Notes: The two animations will complete in the same amount of time. The existing animation may be resampled if the frame count of the new animation is different from the existing animation. The new animation's frames per second will be changed to make the two animations compelte in the same amount of time.

In other words: frame_count1 * fps1 = frame_count2 * fps2


Mode-specific animation manipulations


skelAnimSetKeyframe

Descritption: Set a keyframe for a specified animation, frame, and joint. Keyframe may be rotation or translation.

Arguments: Returns:

Notes: None


skelAnimDeleteKeyframe

Descritption: Deletes a keyframe for a specified animation, frame, and joint. Keyframe may be rotation or translation.

Arguments: Returns:

Notes: The joint will have its default position or orientation after calling this function. If there are rotation and translation keyframes, you must call this function twice to delete both; once with isRotation true, and once with isRotation false.


frameAnimSetVertex

Descritption: Deletes a keyframe for a specified animation, frame, and joint. Keyframe may be rotation or translation.

Arguments: Returns:

Notes: None


Selection


modelSelectAll

Descritption: Selects all primitives (vertices, faces, and bone joints)

Arguments: Returns:

Notes: None


modelSelectAllVertices

Descritption: Selects all vertices

Arguments: Returns:

Notes: None


modelSelectAllFaces

Descritption: Selects all faces

Arguments: Returns:

Notes: None


modelSelectAllGroups

Descritption: Selects all faces of all groups

Arguments: Returns:

Notes: None


modelSelectVertices

Descritption: Selects all vertices

Arguments: Returns:

Notes: None


modelSelectVertex

Descritption: Selects specified vertex

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


modelSelectFace

Descritption: Selects specified face

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


modelSelectGroup

Descritption: Selects faces of specified group

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


modelSelectJoint

Descritption: Selects specified joint

Arguments: Returns:

Notes: IDs of any type are integers from zero to count-1 inclusive. Negative numbers are invalid.


modelUnselectAll

Descritption: Unselects all primitives (vertices, faces, bone joints)

Arguments: Returns:

Notes: None


Logging


logDebug

Descritption: Send a message string to the debug log.

Arguments: Returns:

Notes: None


logWarning

Descritption: Send a message string to the warning log.

Arguments: Returns:

Notes: None


logError

Descritption: Send a message string to the error log.

Arguments: Returns:

Notes: None


[ Contents | Using | Tools | Commands ]
Copyright © 2004-2007, Kevin Worcester