Blitz3D+ Command Reference

ApplyWorldDocumentEdit ( document,edit )

Parameters

document - world document handle

edit - JSON object using the blitz3d.world-document-edit V1 protocol

Description

Validates and applies a JSON edit transaction to a world document.

All operations are validated and applied atomically at the requested expectedRevision. Supported operations cover identity, settings, assets, entities, reparenting, subtree removal, and metadata.

For the full story, see the Debug World Editor guide.

Requires Extended mode.

See also: WorldDocumentRevision, WorldDocumentJson, WorldDocumentDiagnostics, CreateWorldDocument.

Example

; ApplyWorldDocumentEdit Example - Extended mode
document=CreateWorldDocument("edit-example","Before")
If document=0 Then RuntimeError WorldDocumentError()
q$=Chr(34)
edit=ParseJson("{"+q+"protocol"+q+":"+q+"blitz3d.world-document-edit"+q+","+q+"version"+q+":1,"+q+"expectedRevision"+q+":0,"+q+"operations"+q+":[{"+q+"op"+q+":"+q+"document.identity"+q+","+q+"name"+q+":"+q+"After"+q+"}]}")
If edit=0 Then RuntimeError JsonError()
If Not ApplyWorldDocumentEdit(document,edit) Then RuntimeError WorldDocumentError()
Print "Committed revision "+WorldDocumentRevision(document)
FreeJson edit
FreeWorldDocument document
End

Index