Client Controller

class ClientController

[CLIENT]

Sends requests to the server

staticmethod SetFrame(frame: integer)

Set to a frame of the animation

This method also sends the (entity) settings.

staticmethod SelectEntity(entity: Player | SMHEntity, enttable: Set<Entity>)

Select the entity record keyframes.

For multi-selection, this function gets called again, but with an accumulating enttable argument which is usually comes from the SMH.State.Entity field

staticmethod DeleteAudio(id: integer, pointer: SMHAudioClipPointer)

Delete the audio clip from its id and its associated pointer

staticmethod DeleteAllAudio()

Delete all audio clips

staticmethod UpdateServerAudio()

Notify the server of changes to audio updates.

This must be called after any functions that add, delete, or trim audio

staticmethod Record(frame?: integer)

Record a keyframe, either at a specified frame or on the playhead (SMH.State.Frame)

staticmethod Stretch(
    frames: {[1]: SMHFramePointer, [2]: integer}[],
    amount: number
)

Modify the animation length, composed by the selected group of keyframes.

Two types of behavior happen with stretching / compression

  1. If stretching, this will replace keyframes outside of the selected keyframes

  2. If compressing, this will replace keyframes inside the selected keyframes

The stretching / compression pivot is the first frame.

staticmethod Smooth(frames: integer[], maxPasses: integer)

Apply the arc trick (Eltorro64Rus’s smoothing method) to reduce the jerkiness of a motion

Smoothing is applied to the animator’s selected frames. The maxPasses is the smoothing factor: higher results in a smoother result.

staticmethod UpdateKeyframe(
    keyframeId: integer[],
    updateData: any,
    singledata: any
)

If internal updateData`` for a keyframe of a specific keyframeId` has been modified, then update the keyframe data on the server realm

staticmethod CopyKeyframe(keyframeId: integer[], frame: table)

Copies an array of keyframe data and move them to a new place on the timeline

staticmethod DeleteKeyframe(keyframeId: integer[])

Delete the keyframes of the specified keyframeIds

staticmethod StartPlayback(startFrame: integer)

Signal the playback manager to animate all entities owned by the client

staticmethod StopPlayback()

Signal the playback manager to stop for the client

staticmethod GetServerSaves()

Get all animation saves owned by the server

staticmethod GetModelList(path: string, loadFromClient?: boolean)

Get a list of models for an animation save of the specified path

staticmethod GetServerEntities()

Get all animatable entities owned by the client from the server

staticmethod Load(
    path: string,
    modelName: string,
    loadFromClient: boolean
)

Load an animation save from the path for an entity specified by its modelName (usually the model or its name defined by the Properties menu)

staticmethod GetModelInfo(
    path: string,
    modelName: string,
    loadFromClient: boolean
)

For an animation save defined by path, get more information about the entity of modelName

staticmethod Save(path: string, isAutoSave?: boolean)

Request the server to save an animation into the path.

If we are using the autosave feature, isAutoSave is set to true, which lets the server handle the autosaved animation.

staticmethod QuickSave()

Uses the Save function to save an animation to the root

staticmethod RequestUnpack()

Request the server to remove SMHPackage info from every animatable entity

staticmethod RequestPack(path: string)

Request the server to pack animation data into an SMHPackage for every animatable entity

Depending on the value of smh_packentity, path gets stored in the SMHPackage of an entity

staticmethod DeleteSave(
    path: string,
    isFolder: boolean,
    deleteFromClient: boolean
)

Request the server to delete the animation file. If deleteFromClient is true, then delete the animation file directly

staticmethod SaveAudioSeq(path: string)

Save the audio clips on the timeline to an audio sequence file (defined as .txt)

staticmethod DeleteAudioSeq(path: string)

Delete the audio sequence file

staticmethod LoadAudioSeq(path: string, setFrameRate: boolean)

Load the audio sequence file from the path.

If setFrameRate is true, this also sets the frame count and FPS

staticmethod ToggleRendering(renderCmd: string, StartFrame: integer)

Start or stop the rendering process, depending on SMH.Renderer state

The StartFrame can be specified to begin the render at a specific frame

staticmethod OpenMenu()

Open the timeline

staticmethod CloseMenu()

Close the timeline

staticmethod UpdateState(newState: NewState, updatePlaybackControls: any)

Update SMH.State with newState

staticmethod UpdateSettings(newSettings: any)

Update settings for the selected entities

staticmethod UpdateUISetting(setting: any, value: any)

Update the setting on the UI to a value

staticmethod SetRendering(rendering: boolean)

Notify the server about the new rendering state

staticmethod UpdateGhostState()

Update the server ghost data

staticmethod ApplyEntityName(ent: Entity, name: string)

Update the entity’s name from the Properties menu for the server

staticmethod UpdateTimeline()

Update the timeline for selected entities

staticmethod RequestModifiers()

Request new modifier data from the server

staticmethod AddTimeline()

Add a timeline

staticmethod RemoveTimeline()

Remove a timeline

staticmethod UpdateModifier(i: integer, mod: string, check: boolean)

Notify the server of an updated modifier state

staticmethod UpdateKeyframeColor(color: Color, timeline: integer)

Give a new keyframe color to the server, for a specified timeline.

staticmethod SetPreviewEntity(path: string, model: string, loadFromClient: boolean)

Show the preview entity of the first frame of an animation (specified by path), with a given model

staticmethod SpawnEntity(path: string, model: string, loadFromClient: boolean)

Spawn an animated entity for an animation save specified by path and the animation specified by model

staticmethod SetTimeline(settings: Properties, presetname: string)

Change the timeline to modify on the server

staticmethod RequestTimelineInfo(name: string)

Get new timeline information of specified name from the server

staticmethod RequestWorldData(frame: integer)

Get world keyframe data from the server for a specified frame

staticmethod UpdateWorld(str: string, key: string)

Update world keyframe data on the server

staticmethod StartPhysicsRecord(
    framecount: integer,
    interval: integer,
    entities: table<Entity, integer>
)

Tell the server to start its physics recorder

staticmethod StopPhysicsRecord()

Tell the server to stop its physics recorder

staticmethod RequestNewSession()

Begin a new slate. Also tell the server to remove everything