Develop
Develop
Select your platform

Spatial Editor command line interface

Updated: Sep 10, 2024
Spatial Editor includes a Command Line Interface (CLI), simplifying the process of exporting projects and integrating them with the Spatial SDK.

Setup

To use the CLI, install Spatial Editor and open a terminal in the application’s folder. Prefix your commands with the full path to the folder. For example, to export a project on MacOS, you would use:
/Applications/Meta Spatial Editor.app/ export -p /path/to/project.metaspatial -o /path/to/output/directory

Export a project

The export command is exports a project from Spatial Editor. You can specify input and output paths, and the type of export desired, through these options:
  • -h or --help: Displays a help message and exits.
  • -p or --project: Sets the path to the project file you wish to export.
  • -o or --output: Defines the path to the output file or directory for the exported project.
For example, to export an entire project located at /path/to/project.metaspatial to a specified directory, use:
export -p /path/to/project.metaspatial -o /path/to/output/directory
Include the application folder path at the beginning of your command. If integrating with a Spatial SDK app, export to the scenes directory.

Export a composition or object

You can also export specific components of a project, such as a composition or an object, by using the export_options group:
  • -c or --composition: Specifies the path to the .metaspatialcomposition file.
  • -b or --object: Specifies the path to the .metaspatialobject file.
The output format depends on what you are exporting:
  • .metaspatialobject files are exported as .gltf files.
  • .metaspatialcomposition files are exported as .glxf files.
These examples export the specified composition or object to the output file specified by -o. The output file extension is determined by the input file type (.glxf for a composition, .gltf for an object). To export a specific composition:
export -c /path/to/composition.metaspatialcomposition -o /path/to/output/file.glxf
To export a specific object:
export -b /path/to/object.metaspatialobject -o /path/to/output/file.gltf
export --help will display a help message that lists all of the available options for the export command.
Remember to include the path to the Spatial Editor application folder at the start of your command.

Create a new project

The create command creates a new project in the specified directory:
  • -p or --path: Mandatory: Specifies the directory for the new project.
  • -h or --help: Prints a help message listing available options.
For example:
create -p /path/to/project
If you are creating a project inside your Spatial SDK file directory, you should choose the Scenes folder at ./app/src/main/scenes/, which might already contain a default project.
Note: Always start your command with the path to the Spatial Editor application folder for proper execution.
Did you find this page helpful?