Skip to main content

Editor.Model.SourceRootDirectory

Enum

Enum identifying the root directory context for resolving source paths within a Lens Studio project.

Index

Enumeration Members

Example

// SourceRootDirectory is passed to SourcePath's constructor to anchor a
// relative path either under the project's Assets folder or under the
// Packages folder. AssetManager uses the resulting SourcePath as a
// destination for imports, renames, etc.
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const assetManager = model.project.assetManager;

// "Assets/Materials" — a location inside the project Assets root.
const assetsDest = new Editor.Model.SourcePath(
new Editor.Path('Materials'),
Editor.Model.SourceRootDirectory.Assets
);

// Create a native Material asset under Assets/Materials.
const created = assetManager.createNativeAsset('Material', 'DocsSample', assetsDest);
console.log(`Created ${created.name} under ${assetsDest.toString()}`);

// Packages-rooted paths target the Packages directory instead.
const pkgDest = new Editor.Model.SourcePath(
new Editor.Path('MyPlugin'),
Editor.Model.SourceRootDirectory.Packages
);
console.log(`Packages-rooted path: ${pkgDest.toString()}`);

Enumeration Members

Assets

Assets: number

Represents the Assets root directory, where project asset files are stored.


Packages

Packages: number

Represents the Packages root directory, where package-level assets and dependencies are stored.