Skip to main content

Editor.Model.ResultType

Enum

How a file should be imported into the project.

Index

Enumeration Members

Example

// ResultType is the third argument to AssetManager.importExternalFile()
// and controls how the imported source file appears in the project.
// Auto — let Lens Studio decide based on file type.
// Use this when you don't have a strong opinion; good default.
// Packed — imported entities are read-only but can be refreshed from
// the source file. Use when you want the authored asset to
// remain the single source of truth (e.g. design handoffs).
// Unpacked — entities are imported individually and are fully editable
// as if they had been authored in-project. Use when you need
// to tweak materials, nodes, or child objects after import.
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const assetManager = model.project.assetManager;

// The destination is relative to the project's Assets root.
const destDir = new Editor.Model.SourcePath(
new Editor.Path(''),
Editor.Model.SourceRootDirectory.Assets
);

// Typical call (commented out so this example doesn't need a real file):
// const sourcePath = new Editor.Path('/path/to/model.fbx');
// const result = assetManager.importExternalFile(
// sourcePath,
// destDir,
// Editor.Model.ResultType.Unpacked, // or Auto / Packed
// );
void assetManager;
void destDir;

console.log('ResultType options: Auto, Packed, Unpacked');
console.log('Auto=' + Editor.Model.ResultType.Auto +
', Packed=' + Editor.Model.ResultType.Packed +
', Unpacked=' + Editor.Model.ResultType.Unpacked);

Enumeration Members

Auto

Auto: number

Lens Studio will decide how the file will be imported.


Packed

Packed: number

The imported entities will be readonly. However, the entity cann also be updated from source file.


Unpacked

Unpacked: number

The entity is unpacked and the entities within exists as if it was imported individually.