Class MohoLayer
Version added: before 9.5
The MohoLayer class is the base class for all Moho layer types. All actual layers in Moho are sub-classes of MohoLayer (vector layers, image layers, group layers, etc.), but the MohoLayer class provides some basic properties that they all have in common.
The most practical way to create a new layer is using the ScriptInterface:CreateNewLayer method:
However, if necessary, instances of this class can be created by:
- Local variable:
- Global (see Script Structure about conventions for naming globals):
The most practical way to create a new layer is using the ScriptInterface:CreateNewLayer method:
local wrapperGroup = moho:CreateNewLayer(MOHO.LT_GROUP, false)
However, if necessary, instances of this class can be created by:
- Local variable:
local layer = MOHO.MohoLayer:new_local()
- Global (see Script Structure about conventions for naming globals):
XX_layer = MOHO.MohoLayer:new()
Methods of MohoLayer:
Name | Returns | Description | Ver |
ActionDuration ActionDuration(name) | int32 | < 9.5 | |
ActionID ActionID(name) | int32 | < 9.5 | |
ActionName ActionName(id) | char | < 9.5 | |
ActivateAction ActivateAction(name) | void | Activates an action for editing | < 9.5 |
AddKey AddKey(frame, recursive, animatedChannelsOnly) | void | < 9.5 | |
AddToFlexiBoneSubset AddToFlexiBoneSubset(boneID) | void | Added in version 9.5 | 9.5 |
AlignWithCamera AlignWithCamera(frame, doc, useLayerBounds) | void | < 9.5 | |
AncestorSwitchChild AncestorSwitchChild() | MohoLayer | < 9.5 | |
AncestorSwitchLayer AncestorSwitchLayer() | SwitchLayer | < 9.5 | |
AnimDuration AnimDuration() | int32 | < 9.5 | |
AreChannelsConsolidated AreChannelsConsolidated() | bool | Added in version 12 | 12.0 |
BlendActions BlendActions(frame, relativeToDefault, numToBlend, names[numToBlend], percentages[numToBlend]) | void | < 9.5 | |
BlendActions BlendActions(frame, blendMode, numToBlend, names[numToBlend], percentages[numToBlend], frames[numToBlend]) | void | < 9.5 | |
BlendingMode BlendingMode() | int32 | Get the layer's blending mode | < 9.5 |
Bounds Bounds(frame) | BBox | < 9.5 | |
BreakLayerReference BreakLayerReference() | void | Added in version 11 | 11.0 |
Channel Channel(id, subID, doc) | AnimChannel | < 9.5 | |
ClearAnimation ClearAnimation(recursive, fromFrame, before) | void | < 9.5 | |
ClearFlexiBoneSubset ClearFlexiBoneSubset() | void | Added in version 9.5 | 9.5 |
ClearLayerKeyCount ClearLayerKeyCount() | void | < 9.5 | |
ConstructionCurvesOn ConstructionCurvesOn() | bool | Added in version 9.5 | 9.5 |
ControllingBoneLayer ControllingBoneLayer() | BoneLayer | Added in version 9.5 | 9.5 |
ControllingSkeleton ControllingSkeleton() | M_Skeleton | Added in version 9.5 | 9.5 |
CopyFrame CopyFrame(fromFrame, toFrame, recursive) | void | < 9.5 | |
CopyTransform CopyTransform(fromLayer) | void | Added in version 14.0 | 14.0 |
CountActions CountActions() | int32 | < 9.5 | |
CountChannels CountChannels() | int32 | < 9.5 | |
CountLayerKeys CountLayerKeys() | int32 | < 9.5 | |
CurFrame CurFrame() | int32 | < 9.5 | |
CurrentAction CurrentAction() | char | Returns the name of the current action being edited | < 9.5 |
DeleteAction DeleteAction(name) | void | < 9.5 | |
DeleteFrame DeleteFrame(frame, recursive) | void | < 9.5 | |
DeleteKeysAtFrame DeleteKeysAtFrame(recursive, frame) | void | < 9.5 | |
DeleteParentBone DeleteParentBone(boneID) | void | Call this function before deleting a bone in a parent bone layer | < 9.5 |
DocToLayerFrame DocToLayerFrame(docFrame) | int32 | Added in version 10 | 10.0 |
DoesFaceCamera DoesFaceCamera() | bool | < 9.5 | |
DoesRotateToFollow DoesRotateToFollow() | bool | < 9.5 | |
FaceCameraMode FaceCameraMode() | int32 | < 9.5 | |
FreeCachedImage FreeCachedImage() | void | Added in version 12 | 12.0 |
GetChannelInfo GetChannelInfo(id, channelInfo) | void | < 9.5 | |
GetDistortionMeshLayer GetDistortionMeshLayer() | MohoLayer | Gets the layer's smart warp layer. In Moho 14.0, replaced by MohoLayer:GetWarpLayer | 12.0 |
GetFollowingCurve GetFollowingCurve() | M_Curve | < 9.5 | |
GetFollowingLayer GetFollowingLayer() | MohoLayer | < 9.5 | |
GetFullTransform GetFullTransform(frame, matrix, doc) | void | Gets the layer's complete transformation at a given frame, including the effects of its parent layers | < 9.5 |
GetLayerKeyWhen GetLayerKeyWhen(keyID) | int32 | < 9.5 | |
GetLayerRefInfo GetLayerRefInfo(refInfo) | void | Added in version 11 | 11.0 |
GetLayerTransform GetLayerTransform(frame, matrix, doc) | void | Gets the layer's transformation at a given frame | < 9.5 |
GetParentBoneTransform GetParentBoneTransform(frame, matrix, doc) | void | < 9.5 | |
GetParentTransform GetParentTransform(frame, matrix, doc) | void | Gets the parent layer's transformation at a given frame | < 9.5 |
GetWarpLayer GetWarpLayer() | MohoLayer | Added in version 14.0 to replace MohoLayer:GetDistortionMeshLayer | 14.0 |
HasAction HasAction(name) | bool | < 9.5 | |
HasAnimatedLayerEffects HasAnimatedLayerEffects() | bool | < 9.5 | |
HasScaleCompensation HasScaleCompensation() | bool | < 9.5 | |
HsvImage HsvImage(outAccess) | char | Returns a file path to the layer's HSV modifier image | < 9.5 |
InsertAction InsertAction(name, frame, byReference) | void | Inserts an action into the current active timeline | < 9.5 |
IsAncestorSelected IsAncestorSelected() | bool | Added in version 11.1 | 11.1 |
IsAudioType IsAudioType() | bool | < 9.5 | |
IsBoneType IsBoneType() | bool | Test whether a layer is a bone layer, or sub-type of bone layer (switch) | < 9.5 |
IsEditOnly IsEditOnly() | bool | Getter method for the "Don't render this layer" checkbox in the layer settings | < 9.5 |
IsGroupType IsGroupType() | bool | Test whether a layer is a group layer, or sub-type of group layer (bone, particle, or switch) | < 9.5 |
IsIgnoredByLayerPicker IsIgnoredByLayerPicker() | bool | 13.5.2 | |
IsImmuneToCamera IsImmuneToCamera() | bool | < 9.5 | |
IsImmuneToDof IsImmuneToDof() | bool | < 9.5 | |
IsIncludedInFlexiBoneSubset IsIncludedInFlexiBoneSubset(boneID) | bool | Added in version 12.2 | 12.2 |
IsLocked IsLocked() | bool | < 9.5 | |
IsPhysicsInEffect IsPhysicsInEffect(frame) | bool | < 9.5 | |
IsReferencedLayer IsReferencedLayer() | bool | Added in version 11 | 11.0 |
IsReferenceExternal IsReferenceExternal() | bool | Added in version 11 | 11.0 |
IsReferenceOutdated IsReferenceOutdated() | bool | Added in version 11 | 11.0 |
IsRenderOnly IsRenderOnly() | bool | Getter method for the "Hide in editing view" checkbox in the layer settings | < 9.5 |
IsShownOnTimeline IsShownOnTimeline() | bool | Added in version 12 | 12.0 |
IsSmartBoneAction IsSmartBoneAction(name) | bool | < 9.5 | |
IsVisible IsVisible() | bool | visibility (non-animated value) | < 9.5 |
LabelColor LabelColor() | int32 | Added in version 11 | 11.0 |
LayerDuration LayerDuration() | int32 | The duration of the video, audio, or image sequence | < 9.5 |
LayerParentBone LayerParentBone() | int32 | Get the id number of the layer's controlling parent bone | < 9.5 |
LayerScript LayerScript(outAccess) | char | < 9.5 | |
LayerType LayerType() | int32 | Use this function to find out what type of layer you're dealing with | < 9.5 |
MarkFlexiBoneSubsetAsElbow MarkFlexiBoneSubsetAsElbow(b) | void | Added in version 10 | 10.0 |
MarkReferenceOutdated MarkReferenceOutdated() | void | Use this method to refresh the reference | 11.0 |
MaskExpansion MaskExpansion() | bool | < 9.5 | |
MaskingMode MaskingMode() | int32 | Get the layer's masking mode | < 9.5 |
Metadata Metadata() | LM_Message | will be removed from the API in a future release as AS11 now has the ScriptData object | < 9.5 |
Name Name() | char | Returns the name of the layer | < 9.5 |
Origin Origin() | Vector2 | Get the origin point of the layer | < 9.5 |
Parent Parent() | GroupLayer | Get the layer's parent layer (if any) | < 9.5 |
PhysicsOptions PhysicsOptions() | MohoPhysicsOptions | < 9.5 | |
PhysicsParent PhysicsParent(frame) | GroupLayer | < 9.5 | |
QualityFlags QualityFlags() | int32 | Added in version 9.5 | 9.5 |
RemoveFromFlexiBoneSubset RemoveFromFlexiBoneSubset(boneID) | void | Added in version 9.5 | 9.5 |
RenameAction RenameAction(oldName, newName) | void | < 9.5 | |
ReorderAction ReorderAction(moveName, placeAfterName) | void | < 9.5 | |
ResetAnimation ResetAnimation(recursive, animatedChannelsOnly) | void | < 9.5 | |
RunLayerScript RunLayerScript() | void | < 9.5 | |
ScaleNormalization ScaleNormalization() | real | Added in version 11 | 11.0 |
ScriptData ScriptData() | LM_Message | Added in version 11 - use this and not MetaData | 11.0 |
SecondarySelection SecondarySelection() | bool | < 9.5 | |
SetAnimatedLayerEffects SetAnimatedLayerEffects(b) | void | < 9.5 | |
SetBlendingMode SetBlendingMode(mode) | void | Set the layer's blending mode | < 9.5 |
SetConsolidatedChannels SetConsolidatedChannels(b) | void | Added in version 12 | 12.0 |
SetDistortionMeshLayer SetDistortionMeshLayer(layer) | void | Sets the layer's smart warp layer. In Moho 14.0, replaced by MohoLayer:SetWarpLayer | 12.0 |
SetEditOnly SetEditOnly(b) | void | An equivalent of the "Don't render this layer" checkbox in the layer settings | < 9.5 |
SetFaceCamera SetFaceCamera(b, mode) | void | < 9.5 | |
SetFollowingCurve SetFollowingCurve(layer, curve, startingCurvePercentage, bendWithCurve) | void | < 9.5 | |
SetHsvImage SetHsvImage(path) | void | Sets the file path to the layer's HSV modifier image | < 9.5 |
SetIgnoredByLayerPicker SetIgnoredByLayerPicker(b) | void | 13.5.2 | |
SetImmuneToCamera SetImmuneToCamera(b) | void | < 9.5 | |
SetImmuneToDof SetImmuneToDof(b) | void | Sets whether the layer is immune to depth of field effects | < 9.5 |
SetLabelColor SetLabelColor(colID) | void | Added in version 11 | 11.0 |
SetLayerParentBone SetLayerParentBone(id) | void | Set the id number of the layer's controlling parent bone | < 9.5 |
SetLayerScript SetLayerScript(path) | void | < 9.5 | |
SetLocked SetLocked(b) | void | < 9.5 | |
SetMaskExpansion SetMaskExpansion(b) | void | < 9.5 | |
SetMaskingMode SetMaskingMode(mode) | void | Set the layer's masking mode. See the masking mode constants. | < 9.5 |
SetName SetName(name) | void | Sets a layer's name | < 9.5 |
SetOrigin SetOrigin(origin) | void | Set the origin point of the layer | < 9.5 |
SetOriginWithTransformCorrection SetOriginWithTransformCorrection(origin) | void | < 9.5 | |
SetQualityFlags SetQualityFlags(flags, recursive) | void | Added in version 9.5 | 9.5 |
SetRenderOnly SetRenderOnly(b) | void | An equivalent of the "Hide in editing view" checkbox in the layer settings | < 9.5 |
SetRotateToFollow SetRotateToFollow(b) | void | < 9.5 | |
SetScaleCompensation SetScaleCompensation(b) | void | < 9.5 | |
SetScaleNormalization SetScaleNormalization(f) | void | Added in version 11 | 11.0 |
SetSecondarySelection SetSecondarySelection(sel) | void | < 9.5 | |
SetShownOnTimeline SetShownOnTimeline(b) | void | Added in version 12 | 12.0 |
SetTimingOffset SetTimingOffset(timingOffset) | void | Moves the layer start time | < 9.5 |
SetUserComments SetUserComments(comments) | void | Added in version 12 | 12.0 |
SetUserTags SetUserTags(tags) | void | Added in version 12 | 12.0 |
SetVisible SetVisible(vis) | void | Sets the layer's visibility in the workarea | < 9.5 |
SetWarpLayer SetWarpLayer(layer) | void | Added in version 14.0 to replace MohoLayer:SetDistortionMeshLayer | 14.0 |
ShowConstructionCurves ShowConstructionCurves(b) | void | Toggle whether to display construction curves for this layer | < 9.5 |
TimingOffset TimingOffset() | int32 | < 9.5 | |
TotalTimingOffset TotalTimingOffset() | int32 | < 9.5 | |
UpdateCurFrame UpdateCurFrame(extended) | void | Recalculates animated properties for this layer | < 9.5 |
UpdateReferencedLayer UpdateReferencedLayer(syncOptions) | bool | Added in version 11 | 11.0 |
UserComments UserComments() | char | Added in version 12 | 12.0 |
UserTags UserTags() | char | Added in version 12 | 12.0 |
UUID UUID() | char | < 9.5 |
Properties of MohoLayer:
Name | Type | Description | Ver |
CameraBoundsCol | rgb_color | Added in version 9.5 | 9.5 |
CameraShadeCol | rgb_color | Added in version 9.5 | 9.5 |
CameraTargetCol | rgb_color | Added in version 9.5 | 9.5 |
GuideCol | rgb_color | Added in version 9.5 | 9.5 |
fAlpha | AnimVal | the layer's alpha animation channel | < 9.5 |
fAmbientOcclusionRadius | AnimVal | Added in version 12 | 12.0 |
fBlur | AnimVal | the layer's blur animation channel | < 9.5 |
fFlipH | AnimBool | the layer's horizontal flip animation channel | < 9.5 |
fFlipV | AnimBool | the layer's vertical flip animation channel | < 9.5 |
fFollowing | AnimVal | < 9.5 | |
fLayerColor | AnimColor | Added in version 10 | 10.0 |
fLayerColorOn | AnimBool | Added in version 10 | 10.0 |
fLayerOutline | AnimBool | < 9.5 | |
fLayerShading | AnimBool | the layer's shading on/off animation channel | < 9.5 |
fLayerShadow | AnimBool | the layer's shadow on/off animation channel | < 9.5 |
fMotionBlur | AnimBool | the layer's motion blur on/off animation channel | < 9.5 |
fMotionBlurAlphaEnd | AnimVal | < 9.5 | |
fMotionBlurAlphaStart | AnimVal | < 9.5 | |
fMotionBlurExtendedFrames | AnimVal | Added in version 12 | 12.0 |
fMotionBlurFramePercentage | AnimVal | Added in version 12 | 12.0 |
fMotionBlurFrames | AnimVal | < 9.5 | |
fMotionBlurRadius | AnimVal | < 9.5 | |
fMotionBlurSkip | AnimVal | < 9.5 | |
fMotionBlurSubframes | AnimBool | Added in version 12 | 12.0 |
fNoise | AnimVal | Added in version 12 | 12.0 |
fOutlineColor | AnimColor | < 9.5 | |
fOutlineWidth | AnimVal | < 9.5 | |
fPerspectiveBlur | AnimVal | < 9.5 | |
fPerspectiveColor | AnimColor | < 9.5 | |
fPerspectiveScale | AnimVal | < 9.5 | |
fPerspectiveShadow | AnimBool | < 9.5 | |
fPerspectiveShear | AnimVal | < 9.5 | |
fPhysicsNudge | AnimVec2 | < 9.5 | |
fPixelation | AnimVal | Added in version 12 | 12.0 |
fRotationX | AnimVal | the layer's X rotation animation channel | < 9.5 |
fRotationY | AnimVal | the layer's Y rotation animation channel | < 9.5 |
fRotationZ | AnimVal | the layer's Z rotation animation channel | < 9.5 |
fScale | AnimVec3 | the layer's scale animation channel | < 9.5 |
fShadingAngle | AnimVal | < 9.5 | |
fShadingBlur | AnimVal | < 9.5 | |
fShadingColor | AnimColor | < 9.5 | |
fShadingContraction | AnimVal | < 9.5 | |
fShadingNoiseAmp | AnimVal | < 9.5 | |
fShadingNoiseScale | AnimVal | < 9.5 | |
fShadingOffset | AnimVal | < 9.5 | |
fShadowAngle | AnimVal | < 9.5 | |
fShadowBlur | AnimVal | < 9.5 | |
fShadowColor | AnimColor | < 9.5 | |
fShadowExpansion | AnimVal | < 9.5 | |
fShadowNoiseAmp | AnimVal | < 9.5 | |
fShadowNoiseScale | AnimVal | < 9.5 | |
fShadowOffset | AnimVal | < 9.5 | |
fShear | AnimVec3 | the layer's shear animation channel | < 9.5 |
fThreshold | AnimVal | Added in version 12 | 12.0 |
fTimelineMarkers | AnimString | Added in version 10 | 10.0 |
fTranslation | AnimVec3 | the layer's translation animation channel | < 9.5 |
fVisibility | AnimBool | the layer's visibility animation channel | < 9.5 |
GridCol | rgb_color | Added in version 9.5 | 9.5 |