Class MohoDoc
Version added: before 9.5
The MohoDoc class represents the current Moho document object.
d = moho.document returns the current document object open in Moho.
d is of type MohoDoc - see the ScriptInterface class.
calls to the methods are made by (e.g.)
or
If a script needs to test whether a method is supported by the version of moho that is running (e.g. if a script wants to use MohoDoc:AddStyle(styleName) but the script is not aware of the version of moho that is running) it can check that the Lua type of the method is a "function" e.g.
Note the "." separators which are necessary as you are not trying to call the method. See the end of the introduction which discusses the difference between t:func() and t.func.
d = moho.document returns the current document object open in Moho.
d is of type MohoDoc - see the ScriptInterface class.
calls to the methods are made by (e.g.)
d = moho.document
local ht = d:Height()or
local ht = moho.document:Height()If a script needs to test whether a method is supported by the version of moho that is running (e.g. if a script wants to use MohoDoc:AddStyle(styleName) but the script is not aware of the version of moho that is running) it can check that the Lua type of the method is a "function" e.g.
if type(moho.document.AddStyle) == "function" then ...Note the "." separators which are necessary as you are not trying to call the method. See the end of the introduction which discusses the difference between t:func() and t.func.
Methods of MohoDoc:
| Name | Returns | Description | Ver |
| AddLayerComp AddLayerComp(comp) | void | Added in version 10 | 10.0 |
| AddLayerCompWithName AddLayerCompWithName(name) | LayerComp | Added in version 12 | 12.0 |
| AddStyle AddStyle(style) | void | < 9.5 | |
| AddStyle AddStyle(styleName) | M_Style | Added in version 14.0 | 14.0 |
| Allow3D Allow3D() | bool | < 9.5 | |
| AnimDuration AnimDuration() | int32 | Returns the duration of the document's animation | < 9.5 |
| ApplyLayerComp ApplyLayerComp(comp, state) | void | Added in version 10 | 10.0 |
| ApplyLayerComp ApplyLayerComp(comp, state, layer) | void | Added in version 10 | 10.0 |
| AspectRatio AspectRatio() | real | Returns the aspect ratio of the final rendered output | < 9.5 |
| BackCol BackCol() | rgb_color | < 9.5 | |
| CleanLayerComps CleanLayerComps() | void | Added in version 10 | 10.0 |
| ClearAnimation ClearAnimation(fromFrame, before) | void | < 9.5 | |
| ClearSecondarySelection ClearSecondarySelection(group) | void | < 9.5 | |
| CountLayerComps CountLayerComps() | int32 | Added in version 10 | 10.0 |
| CountLayers CountLayers() | int32 | Returns the number of top-level layers in the document | < 9.5 |
| CountSelectedLayers CountSelectedLayers(group) | int32 | Returns number of selected layers. | < 9.5 |
| CountStyles CountStyles() | int32 | < 9.5 | |
| CurrentDocAction CurrentDocAction() | char | Returns the name of the current action, or an empty string for the mainline | 10.0 |
| DeleteKeysAtFrame DeleteKeysAtFrame(frame) | void | < 9.5 | |
| DeleteLayerComp DeleteLayerComp(inID) | void | Added in version 10 | 10.0 |
| DepthSort DepthSort() | void | Performs a depth sort on all layers in the document | < 9.5 |
| DuplicateLayer DuplicateLayer(origLayer) | MohoLayer | < 9.5 | |
| EndFrame EndFrame() | int32 | Return's the document's end frame | < 9.5 |
| Fps Fps() | real | Returns the frame rate of the document (frames per second) | < 9.5 |
| GetCameraDirection GetCameraDirection() | Vector3 | < 9.5 | |
| GetCameraMatrix GetCameraMatrix(frame, m) | void | < 9.5 | |
| GetLayerComp GetLayerComp(id) | LayerComp | Added in version 10 | 10.0 |
| GetOutsideViewMatrix GetOutsideViewMatrix(m) | void | Returns the transformation matrix for viewing the scene from the "orbit" view | < 9.5 |
| GetSelectedLayer GetSelectedLayer(id) | MohoLayer | < 9.5 | |
| GlobalRenderStyle GlobalRenderStyle() | MohoRenderStyle | < 9.5 | |
| Height Height() | int32 | Returns the pixel height of the final rendered output | < 9.5 |
| IsLayerValid IsLayerValid(layer) | bool | < 9.5 | |
| IsLayerValid IsLayerValid(uuid) | bool | < 9.5 | |
| IsOutsideViewEnabled IsOutsideViewEnabled() | bool | Returns true if the user is orbiting the workspace, and not viewing the scene through the camera | < 9.5 |
| IsRedoable IsRedoable() | bool | < 9.5 | |
| IsStyleUsed IsStyleUsed(style, layer) | bool | < 9.5 | |
| IsUndoable IsUndoable() | bool | < 9.5 | |
| Layer Layer(id) | MohoLayer | Access an individual layer in the document | < 9.5 |
| LayerAbsoluteID LayerAbsoluteID(layer) | int32 | Returns layer's absolute ID no matter its hierarchy level | < 9.5 |
| LayerByAbsoluteID LayerByAbsoluteID(id) | MohoLayer | Returns a layer by its current absolute ID | < 9.5 |
| LayerByName LayerByName(name) | MohoLayer | < 9.5 | |
| LayerID LayerID(layer) | int32 | Returns document's top level layer's ID | < 9.5 |
| Metadata Metadata() | LM_Message | Added in version 10 | 10.0 |
| Name Name() | char | < 9.5 | |
| NoiseGrain NoiseGrain() | int32 | < 9.5 | |
| Path Path(outAccess) | char | returns the full path for the current document | < 9.5 |
| PrepMultiUndo PrepMultiUndo(shallow) | void | Marks an Undo point for multiple selected layers. | < 9.5 |
| PrepUndo PrepUndo(undoAction, layer, shallow, willOnlyAddPoints) | void | Added in version 12.2 | 12.2 |
| PrepUndo PrepUndo(layer, shallow, willOnlyAddPoints) | void | Mark a point in editing that the user can "undo" to return to | < 9.5 |
| Redo Redo() | void | < 9.5 | |
| Refresh Refresh() | void | Added in version 9.5 | 9.5 |
| RelinkStyles RelinkStyles(layer) | void | < 9.5 | |
| RemoveStyle RemoveStyle(style, layer) | void | < 9.5 | |
| RenameStyle RenameStyle(oldName, newName, layer) | void | < 9.5 | |
| SetAllow3D SetAllow3D(b) | void | < 9.5 | |
| SetBackCol SetBackCol(col) | void | < 9.5 | |
| SetCurrentDocAction SetCurrentDocAction(poseName) | void | Added in version 10 | 10.0 |
| SetDirty SetDirty() | void | Marks the document as "dirty" or modified, prompting the user to save if they try to quit | < 9.5 |
| SetEndFrame SetEndFrame(frame) | void | Sets the document's end frame | < 9.5 |
| SetFps SetFps(fps) | void | < 9.5 | |
| SetNoiseGrain SetNoiseGrain(ng) | void | < 9.5 | |
| SetShape SetShape(w, h) | void | Set's the pixel width and height of the final rendered output | < 9.5 |
| SetStartFrame SetStartFrame(frame) | void | Sets the document's start frame | < 9.5 |
| SetStereoSeparation SetStereoSeparation(ss) | void | < 9.5 | |
| SetUserComments SetUserComments(comments) | void | Added in version 12 | 12.0 |
| SetUserTags SetUserTags(tags) | void | Added in version 12 | 12.0 |
| StartFrame StartFrame() | int32 | Returns the document's start frame (typically 1) | < 9.5 |
| StereoSeparation StereoSeparation() | real | < 9.5 | |
| StripUserComments StripUserComments() | void | Strips comments from document and all layers | 12.0 |
| StripUserTags StripUserTags() | void | Strips tags from document and all layers | 12.0 |
| Style Style(styleName) | M_Style | This method is working as specified when called with a character string | < 9.5 |
| StyleByID StyleByID(id) | M_Style | Added in version 12 | 12.0 |
| Undo Undo() | void | < 9.5 | |
| UserComments UserComments() | char | Added in version 12 | 12.0 |
| UserTags UserTags() | char | Added in version 12 | 12.0 |
| Width Width() | int32 | Returns the pixel width of the final rendered output | < 9.5 |
Properties of MohoDoc:
| Name | Type | Description | Ver |
| fCameraPanTilt | AnimVec2 | the camera pan/tilt animation channel. the x component is tilt (i.e. rotation around the camera's x axis); the y component is pan |
< 9.5 |
| fCameraRoll | AnimVal | the camera roll animation channel (i.e. rotation around the camera's z axis) | < 9.5 |
| fCameraTrack | AnimVec3 | the camera tracking animation channel | < 9.5 |
| fCameraZoom | AnimVal | the camera zoom animation channel. The value in this channel is: Base FoV(v)/FoV(v). [FoV(v) is Field of View (vertical). Base FoV(v) is defined by the global constant LM_ZoomCamera.DEFAULT_FOV = 60 degrees (1.0472 Rad) in AS11 and previous] |
< 9.5 |
| fTimelineMarkers | AnimString | Added in version 10.1 | 10.1 |