Scene Graph

Scene Graph

The Montagix SDK utilizes a Scene Graph as its backbone for media composition and editing. This provides a clear and organized way to structure media elements, control timings, and apply effects or transitions.

Introduction

A Scene Graph is a structure that encapsulates the entire media scene, representing clips, layers, transitions, and effects. With Montagix SDK, you don't have to create a Scene Graph from scratch; it's already provided. Your primary interaction will be to populate the graph with nodes, such as media clips or effects, and dictate how they connect and behave in relation to each other.

API

Function NameDescription
createLayer()Creates a new layer in the scene graph.
removeLayer(id)Removes a layer from the scene graph by ID.
getLayerByIdOrFirst()Retrieves a layer by ID or the first layer if ID is not provided.
addClip(clip, layerId)Adds a clip to a specified layer.
removeClip(clipId)Removes a clip from the scene graph by ID.
getClipById(clipId)Retrieves a clip by ID from the scene graph.
replaceClip(oldClipId, newClips)Replaces an old clip with new clips in the scene graph.
split(clipId, value)Splits a clip into two at a specified time value.
traverse(callback)Traverses through all clips and layers, executing a callback function.
getAllClipsFromLayers()Retrieves all clips from all layers in the scene graph.
getLayersInOrder()Retrieves all layers in their order in the scene graph.
serialize()Serializes the scene graph into a JSON-friendly format.
SceneGraph.deserialize(data)Deserializes data into a scene graph instance.