MOHO Classes

class AnimBool

The AnimBool class represents an animated sequence of on/off values.

Member Functions

void SetValue(when, val)

Set the value at a given frame.

Return value: none
when (int): frame number
val (bool): the value to set

bool GetValue(frame)

Return the value of this channel at a given frame.

Return value (bool): value at the given frame
when (int): frame number

Member Variables

value (bool)

The current value of the channel.

class AnimChannel

The AnimChannel class is the base class for all animation channels in Moho. You never use this class directly, but it provides various functions that are useful for working with any kind of animation channel.

Member Functions

int ChannelType()

Returns the type of animation channel you're working with. See the channel types.

Return value (int): the type of animation channel

int CountKeys()

Returns the number of keyframes in the channel.

Return value (int): the number of keyframes in the channel

int Duration()

Returns the duration of the animation channel (basically, the time of the last keyframe).

Return value (int): the duration of the animation channel

void Clear()

Clears a channel, removing all keyframes.

Return value: none

void StoreValue()

Stores the current value as a keyframe. Each type of channel has a member variable called "value". If you change the value variable then call this function, you will add a new keyframe at the current time.

Return value: none

void AddKey(when)

Adds a new keyframe at the given frame.

Return value: none
when (int): frame number

void Reset(when)

Sets the value at a given frame to be the same as the value at frame 0.

Return value: none
when (int): frame number

bool HasKey(when)

Tests whether the channel has a keyframe at a given frame.

Return value (bool): true if a keyframe exists, otherwise false
when (int): frame number

int GetClosestKeyID(when)

Returns the closest keyframe to the given frame. If the given frame has a key, then that keyframe is returned.

Return value (int): the closest keyframe id
when (int): frame number

void DeleteKey(when)

Deletes a keyframe at the specified frame.

Return value: none
when (int): frame number

void SetKeyInterp(when, interpMode, val1, val2)

Sets the interpolation mode at a specified frame. See the available interpolation mode constants.

Return value: none
when (int): frame number
interpMode (int): interpolation mode
val1 (float): supplemental value 1
val2 (float): supplemental value 2

void SetKeyInterpByID(id, interpMode, val1, val2)

Sets the interpolation mode for a specified keyframe. See the available interpolation mode constants.

Return value: none
id (int): keyframe id
interpMode (int): interpolation mode
val1 (float): supplemental value 1
val2 (float): supplemental value 2

class AnimColor

The AnimColor class represents an animated sequence of color values.

Member Functions

void SetValue()

Set the value at a given frame.

Return value: none
when (int): frame number
val (LM_ColorVector): the value to set

void SetValue()

Set the value at a given frame.

Return value: none
when (int): frame number
val (rgb_color): the value to set

LM_ColorVector GetValue()

Return the value of this channel at a given frame.

Return value (LM_ColorVector): value at the given frame
when (int): frame number

Member Variables

value (rgb_color)

The current value of the channel.

class AnimString

The AnimString class represents an animated sequence of text values.

Member Functions

void SetValue()

Set the value at a given frame.

Return value: none
when (int): frame number
tolua_var_1 (string): the value to set

string GetValue()

Return the value of this channel at a given frame.

Return value (string): value at the given frame
when (int): frame number

Member Variables

value (LM_String)

The current value of the channel.

class AnimVal

The AnimVal class represents an animated sequence of numerical values.

Member Functions

void SetValue()

Set the value at a given frame.

Return value: none
when (int): frame number
val (float): the value to set

float GetValue()

Return the value of this channel at a given frame.

Return value (float): value at the given frame
when (int): frame number

Member Variables

value (float)

The current value of the channel.

class AnimVec2

The AnimVec2 class represents an animated sequence of 2D vector values.

Member Functions

void SetValue()

Set the value at a given frame.

Return value: none
when (int): frame number
val (LM_Vector2): the value to set

LM_Vector2 GetValue()

Return the value of this channel at a given frame.

Return value (LM_Vector2): value at the given frame
when (int): frame number

Member Variables

value (LM_Vector2)

The current value of the channel.

class AnimVec3

The AnimVec3 class represents an animated sequence of 3D vector values.

Member Functions

void SetValue()

Set the value at a given frame.

Return value: none
when (int): frame number
val (LM_Vector3): the value to set

LM_Vector3 GetValue()

Return the value of this channel at a given frame.

Return value (LM_Vector3): value at the given frame
when (int): frame number

Member Variables

value (LM_Vector3)

The current value of the channel.

class AudioLayer

New Feature

class BoneLayer

New Feature

class GroupLayer

Member Functions

int CountLayers()

Returns the number of sub-layers in the group.

Return value (int): the number of sub-layers in the group

MohoLayer Layer(id)

Returns a layer in the group (starting at 0 for the first layer).

Return value (MohoLayer): a layer in the group
id (int): index number of the layer

MohoLayer LayerByDepth(id)

Returns a layer in the group, ir order from furthest to nearest (starting at 0 for the furthest layer).

Return value (MohoLayer): a layer in the group
id (int): depth index number of the layer

bool IsExpanded()

Tests whether the group is expanded in the Moho Layers window.

Return value (bool): true if expanded, otherwise false

void Expand(b)

Expands or contracts the group in the Moho Layers window.

Return value: none
b (bool): true to expand, false to contract

int GetGroupMask()

Returns the group's masking mode. See group masking mode constants.

Return value (int): the group's masking mode

void SetGroupMask(mask)

Sets the group's masking mode. See group masking mode constants.

Return value: none
mask (int): the group's masking mode

void FullDepthSort(doc)

Perform a full depth sort on the group's sub-layers.

Return value: none
doc (MohoDoc): the Moho document

void DepthSort(doc)

Perform an incremental depth sort on the group's sub-layers.

Return value: none
doc (MohoDoc): the Moho document

class ImageLayer

Member Functions

void SetSourceImage(path)

Assign an image file to the image layer.

Return value: none
path (string): file path to the image file

string SourceImage()

Return the source image's file path.

Return value (string): file path to the image file

class InterpSetting

New feature

class KeyEvent

The KeyEvent class is provided to your script when a keyboard event occurs. It contains information about the event.

Member Variables

view (MohoView)

A reference to the Moho editing view.


key (char)

The key character that was pressed.


keyCode (int)

A keycode to indicate which special key was pressed. See keycode constants.


shiftKey (bool)

True if the shift key is down, otherwise false.


ctrlKey (bool)

True if the ctrl key is down, otherwise false.


altKey (bool)

True if the alt key is down, otherwise false.

class LM_FontPreview

The LM_FontPreview class is a user interface class that is used in a dialog to preview what a font will look like. You can create an LM_FontPreview object using the following function:


LM_FontPreview FontPreview(width, height)

Creates a new font preview object that can then be used in a dialog layout.

Return value (LM_FontPreview): the newly-created font preview
width (int): width in pixels
height (int): heigh in pixels

Member Functions

void SetPreviewText(text)

Set the text to be displayed in the preview.

Return value: none
text (string): preview text

void SetFontName(font)

Set the name of the font to be used when displaying the preview.

Return value: none
font (string): font name

void Refresh()

Force the preview to redraw itself.

Return value: none

class LM_MeshPreview

The LM_MeshPreview class is a user interface class that is used in a dialog to preview what a vector mesh will look like. This can be used by a script that generates 2D vector shapes, giving the user a chance to see the result before it is inserted into the Moho document. You can create an LM_MeshPreview object using the following function:


LM_MeshPreview MeshPreview(width, height)

Creates a new mesh preview object that can then be used in a dialog layout.

Return value (LM_MeshPreview): the newly-created mesh preview
width (int): width in pixels
height (int): height in pixels

Member Functions

M_Mesh Mesh()

Returns the M_Mesh object associated with the preview object. You can then modify the mesh to change what is displayed in the preview region.

Return value (M_Mesh): a mesh object

bool CreateShape(filled)

Creates a shape out of the selected points in the mesh.

Return value (bool): true if successful, otherwise false
filled (bool): true for a filled shape, false for just an outline

void AutoZoom()

Automatically zooms in on the mesh so that is fills the preview region.

Return value: none

void Refresh()

Forces the preview region to re-draw itself. Call this function after making changes to the mesh.

Return value: none
[12 3  >>