Developer

2 min readUpdated 2 weeks ago

Overview

ML MasterVideo gives client exports to read scenes, start playback and reach the editor modules, two server exports, and one editable hook in open/client.lua.

Client Exports

lua
1local sceneManager = exports.ml_mastervideo:GetSceneManager()
2local playback = exports.ml_mastervideo:GetPlaybackModule()
3local scene = exports.ml_mastervideo:GetSceneById(sceneId)
4local current = exports.ml_mastervideo:GetCurrentSceneData()
5local synced = exports.ml_mastervideo:GetSyncedScenesModule()
  • GetSceneManager(): the SceneManager module, for direct control of scene entities
  • GetPlaybackModule(): the Playback module, to start scenes from code
  • GetSceneById(sceneId): scene data by ID
  • GetCurrentSceneData(): the scene loaded in the editor
  • GetSyncedScenesModule(): the SyncedScenes module

Editor Modules

lua
1local freecam = exports.ml_mastervideo:GetFreecamModule()
2exports.ml_mastervideo:StartCameraPlacement(coords, rotation, onSave)
  • StartCameraPlacement(coords?, rotation?, onSave?): opens the free camera to place a shot. onSave runs when the player saves it
  • MLAdminOpen(), MLAdminPanel(): open the editor and give its label and icon, for a staff menu that lists admin tools
  • GetFreecamModule(), GetAppearanceModule(), GetAutoDriveModule(), GetPlacementModule(), GetPossessionModule(), GetPreviewModule(), GetRecordingModule(), GetWorldRecorderModule(): the module tables used by the editor

Server Exports

lua
1local ready = exports.ml_mastervideo:IsInitialized()
2local count = exports.ml_mastervideo:GetSceneCount()
  • IsInitialized(): true when the database is ready
  • GetSceneCount(): number of stored scenes

Client Hook

Located in open/client.lua.

open/client.lua
1function OpenClient.OnSceneAmbiance(active, data)
2end

Fires when a scene takes over or releases the time of day and weather. active is true when the scene sets them and false when it lets go. When active is true, data holds weather, hour and minute, each nil when the scene does not set it. On release data is nil.

A weather or time sync resource keeps writing its own values and fights the scene. Pause it here while a scene is active and resume it when the scene ends. The file has commented examples for common sync resources.

Scene Data Structure

Each scene holds entities, camera tracks and a timeline:

  • Entities: peds, vehicles and props with position, appearance and behavior (idle, animation, scenario, driving, recorded path)
  • Camera tracks: named tracks with keyframes for position, rotation, FOV and interpolation
  • Timeline: clips per entity with start time, duration and the animation, scenario or recording they play

Examples

your_script/client.lua
1local playback = exports.ml_mastervideo:GetPlaybackModule()
2playback.StartScene('my_scene_id', { countdown = 0 })

Options: countdown in seconds before the scene starts (3 by default), loop, startWithCam and startTime in seconds.