### Run Development Server with Bun Source: https://github.com/babylonjs/editor/blob/master/website/README.md Use this command to start the development server for the Next.js project. Ensure you have Bun installed. ```bash bun dev ``` -------------------------------- ### Run Development Server with npm Source: https://github.com/babylonjs/editor/blob/master/website/README.md Use this command to start the development server for the Next.js project. Ensure you have npm installed. ```bash npm run dev ``` -------------------------------- ### Run Development Server with pnpm Source: https://github.com/babylonjs/editor/blob/master/website/README.md Use this command to start the development server for the Next.js project. Ensure you have pnpm installed. ```bash pnpm dev ``` -------------------------------- ### Run Development Server with Yarn Source: https://github.com/babylonjs/editor/blob/master/website/README.md Use this command to start the development server for the Next.js project. Ensure you have Yarn installed. ```bash yarn dev ``` -------------------------------- ### Install Dependencies Source: https://github.com/babylonjs/editor/blob/master/templates/nuxtjs/README.md Use these commands to install project dependencies. Choose the package manager that suits your workflow. ```bash npm install ``` ```bash yarn install ``` ```bash pnpm install ``` ```bash bun install ``` -------------------------------- ### Typical Bootstrap for Loading a Scene Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/loading-scenes.md Demonstrates a typical setup for bootstrapping a Babylon.js application, including engine initialization, physics setup, and loading a scene using `loadScene`. ```typescript import { Scene } from "@babylonjs/core/scene"; import { Engine } from "@babylonjs/core/Engines/engine"; import { Vector3 } from "@babylonjs/core/Maths/math.vector"; import { SceneLoaderFlags } from "@babylonjs/core/Loading/sceneLoaderFlags"; import { HavokPlugin } from "@babylonjs/core/Physics/v2/Plugins/havokPlugin"; import HavokPhysics from "@babylonjs/havok"; import "@babylonjs/core/Loading/loadingScreen"; import "@babylonjs/core/Loading/Plugins/babylonFileLoader"; // ... other side-effect imports for cameras, lights, materials, physics, etc. import { loadScene } from "babylonjs-editor-tools"; import { scriptsMap } from "./scripts"; const engine = new Engine(canvas, true, { stencil: true, antialias: true, audioEngine: true }); const scene = new Scene(engine); const havok = await HavokPhysics(); scene.enablePhysics(new Vector3(0, -981, 0), new HavokPlugin(true, havok)); SceneLoaderFlags.ForceFullSceneLoadingForIncremental = true; await loadScene("/scene/", "example.babylon", scene, scriptsMap, { quality: "high" }); scene.activeCamera?.attachControl(); engine.runRenderLoop(() => scene.render()); ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/babylonjs/editor/blob/master/templates/solidjs/README.md Install project dependencies using npm, pnpm, or yarn. This command should be run after cloning the template. ```bash npm install # or pnpm install or yarn install ``` -------------------------------- ### Run Development Server with npm, yarn, pnpm, or bun Source: https://github.com/babylonjs/editor/blob/master/templates/nextjs/README.md Use these commands to start the Next.js development server. Open http://localhost:3000 in your browser to view the application. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Start the Editor Source: https://github.com/babylonjs/editor/blob/master/README.md Starts the Babylon.js Editor. The devtools will open automatically after execution. Run from the repository root. ```bash yarn start ``` -------------------------------- ### Run Development Server Source: https://github.com/babylonjs/editor/blob/master/templates/nuxtjs/README.md Execute these commands to start the Nuxt development server. Access the application at http://localhost:3000. ```bash npm run dev ``` ```bash yarn dev ``` ```bash pnpm dev ``` ```bash bun dev ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/babylonjs/editor/blob/master/README.md Installs project dependencies using yarn classic. This command should be run at the root of the repository. ```bash yarn install ``` -------------------------------- ### Install Linux Build Dependencies Source: https://github.com/babylonjs/editor/blob/master/README.md Installs essential build tools for Linux using apt package manager. ```bash sudo apt install -y make python build-essential ``` -------------------------------- ### Run Development Server Source: https://github.com/babylonjs/editor/blob/master/templates/solidjs/README.md Starts the application in development mode, typically accessible at http://localhost:3000. The browser will auto-reload on code changes. ```bash npm run dev # or npm start ``` -------------------------------- ### Install Windows Build Tools Source: https://github.com/babylonjs/editor/blob/master/README.md Run this command in PowerShell as administrator on Windows to install necessary build tools like Python and C++ compiler. ```bash # For more information see https://github.com/felixrieseberg/windows-build-tools npm install --global --production windows-build-tools ``` -------------------------------- ### Class-Based Script Example Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/writing-scripts.md A recommended class-based script structure for Babylon.js editor, demonstrating `onStart` and `onUpdate` methods. The attached object is passed to the constructor. ```typescript import { Mesh } from "@babylonjs/core/Meshes/mesh"; export default class MyScriptComponent { public constructor(public mesh: Mesh) {} public onStart(): void { // Do something when the script is loaded. } public onUpdate(): void { this.mesh.rotation.y += 0.04 * this.mesh.getScene().getAnimationRatio(); } } ``` -------------------------------- ### Package the Project Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Initiates the full packaging pipeline for the project using electron-builder. This includes cleaning, installing, linting, building all components, and testing before the final build. The `--noSign` flag is used for unsigned builds, and `--x64` or `--arm64` can specify the target architecture. ```bash yarn package --noSign [--x64] [--arm64] ``` -------------------------------- ### Linking GUI Assets Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/asset-decorators.md Example of linking a Babylon.js GUI AdvancedDynamicTexture asset to a script property. The GUI is loaded and ready for use. ```typescript import { AdvancedDynamicTexture } from "@babylonjs/gui/2D/advancedDynamicTexture"; import { visibleAsAsset } from "babylonjs-editor-tools"; export default class MyMeshComponent { public constructor(public mesh: Mesh) {} @visibleAsAsset("gui", "My GUI asset") private _gui!: AdvancedDynamicTexture; public onStart(): void { // this._gui.addControl(...); } } ``` -------------------------------- ### Function-Based Script Example Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/writing-scripts.md An alternative function-based script structure for Babylon.js editor, showing `onStart` and `onUpdate` functions. The attached object is passed as the first argument to each function. ```typescript import { Mesh } from "@babylonjs/core/Meshes/mesh"; export function onStart(mesh: Mesh): void { // Do something when the script is loaded. } export function onUpdate(mesh: Mesh): void { mesh.rotation.y += 0.04 * mesh.getScene().getAnimationRatio(); } ``` -------------------------------- ### Linking Material Assets Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/asset-decorators.md Example of linking a Babylon.js material asset to a script property. The material is loaded and can be assigned to a mesh. ```typescript import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial"; import { visibleAsAsset } from "babylonjs-editor-tools"; export default class MyMeshComponent { public constructor(public mesh: Mesh) {} @visibleAsAsset("material", "My material asset") private _material!: PBRMaterial; public onStart(): void { this.mesh.material = this._material; } } ``` -------------------------------- ### Build All Project Components and Templates Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Builds all project components, including templates and the website. This command is useful for a full project build. ```bash yarn build-all ``` -------------------------------- ### Retrieve AnimationGroup by Name Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/scene-decorators.md Use the `@animationGroupFromScene` decorator to get an AnimationGroup by its name. Assign it to a private property for later use. ```typescript import { Mesh } from "@babylonjs/core/Meshes/mesh"; import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup"; import { animationGroupFromScene } from "babylonjs-editor-tools"; export default class MyMeshComponent { @animationGroupFromScene("Idle") private _idle: AnimationGroup | null = null; public constructor(public mesh: Mesh) {} public onStart(): void { this._idle?.play(); } } ``` -------------------------------- ### Build for Production Source: https://github.com/babylonjs/editor/blob/master/templates/solidjs/README.md Builds an optimized production version of the application in the `dist` folder. This process minifies code and includes content hashes for efficient deployment. ```bash npm run build ``` -------------------------------- ### Linking JSON Assets Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/asset-decorators.md Example of linking a JSON asset to a script property. The JSON content is automatically parsed and accessible directly. ```typescript import { Mesh } from "@babylonjs/core/Meshes/mesh"; import { visibleAsAsset } from "babylonjs-editor-tools"; export default class MyMeshComponent { public constructor(public mesh: Mesh) {} @visibleAsAsset("json", "My JSON asset") private _json!: MyJsonTypeOrAny; public onStart(): void { console.log(this._json.name); } } ``` -------------------------------- ### Build All Project Components Concurrently Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Builds all project components, templates, and the website concurrently. This can significantly speed up the build process. ```bash yarn build-all-concurrently ``` -------------------------------- ### Generated scripts.ts Map Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/writing-scripts.md Example of the auto-generated `scripts.ts` file in the Babylon.js editor, which maps script file paths to their corresponding modules for scene loading. ```typescript // src/scripts.ts (generated — do not edit by hand) import { loadScene } from "babylonjs-editor-tools"; import * as scripts_box from "./scripts/box"; export const scriptsMap = { "scripts/box.ts": scripts_box, }; export { loadScene }; ``` -------------------------------- ### Build the Editor Source: https://github.com/babylonjs/editor/blob/master/README.md Builds the Babylon.js Editor and its associated tools. Run this command from the root of the repository. ```bash yarn build ``` -------------------------------- ### Package the Editor (Both Architectures) Source: https://github.com/babylonjs/editor/blob/master/README.md Packages the Electron application for both arm64 and x64 architectures without signing. This command ensures dependencies are up-to-date and the Editor is built. ```bash yarn package --noSign --arm64 --x64 ``` -------------------------------- ### Watch for Changes in Specific Project Components Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Starts watchers for individual project components like the editor, tools, CLI, MCP server, or plugins. Use these when developing specific parts of the monorepo. ```bash yarn watch-tools / watch-cli / watch-mcp-server / watch-plugins ``` -------------------------------- ### Build Specific Project Components Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Builds individual project components such as the editor, tools, CLI, MCP server, plugins, templates, or website. Use these commands when only a specific part of the project needs to be rebuilt. ```bash yarn build-editor / build-tools / build-cli / build-mcp-server / build-plugins / build-templates / build-website ``` -------------------------------- ### Watch Editor and Dependencies Source: https://github.com/babylonjs/editor/blob/master/README.md Continuously watches the Editor and its dependencies for changes, recompiling as needed. Useful for active development. ```bash yarn watch-editor-all ``` -------------------------------- ### Package the Editor (Current Platform) Source: https://github.com/babylonjs/editor/blob/master/README.md Packages the Electron application for the current platform and architecture without signing. This command ensures dependencies are up-to-date and the Editor is built. ```bash yarn package --noSign ``` -------------------------------- ### Package the Editor (x64 Target) Source: https://github.com/babylonjs/editor/blob/master/README.md Packages the Electron application specifically for the x64 architecture without signing. This command ensures dependencies are up-to-date and the Editor is built. ```bash yarn package --noSign --x64 ``` -------------------------------- ### Sound Management Source: https://github.com/babylonjs/editor/blob/master/mcp/mcp-tools-contract.md APIs for listing, creating, and updating sound assets and nodes. ```APIDOC ## list_sound_assets ### Description List .mp3/.ogg/.wav sound assets in the project. ### Method list_sound_assets ### Input {} ### Output { assets: [{ name, path }]} ``` ```APIDOC ## create_sound ### Description Create a SoundNode in the scene from a sound asset and load it. Set spatial: true (default) + parentId/parentName/position for 3D positional ambience emitted at a place; spatial: false for a global 2D ambience/music bed. Values in editor units (cm). After creation: refresh graph, select node, set edited object. ### Method create_sound ### Input { path, name?, parentId?, parentName?, position?: [x,y,z], volume?: number, spatial?: boolean, maxDistance?: number, distanceModel?: "linear"|"inverse"|"exponential", panningModel?: "HRTF"|"equalpower" } ### Output created node summary ``` ```APIDOC ## set_sound_properties ### Description Update properties of an existing SoundNode. Only provided fields are applied. Resolve node by id/name; throw if it is not a SoundNode. forceUpdate the inspector after. ### Method set_sound_properties ### Input { nodeId?, nodeName?, volume?, spatial?, maxDistance?, distanceModel?, panningModel?, autoUpdateSpatial? } ### Output updated node summary ``` -------------------------------- ### Skeleton Skill Entry Point Source: https://github.com/babylonjs/editor/blob/master/mcp/editor-api-skill.md The main function for a Babylon.js Editor skill. It receives the editor instance and can return a summary string or a Promise for asynchronous operations. ```javascript import { Tools, Vector3 } from "babylonjs"; import { UniqueNumber } from "babylonjs-editor"; export function main(editor) { // build content here; may be async (return a Promise) return "summary of what was done"; } ``` -------------------------------- ### Instantiating Sub-Scenes Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/SKILL.md Methods available on `AdvancedAssetContainer` for managing instantiated scenes. ```APIDOC ## Instantiating Sub-Scenes (`AdvancedAssetContainer`) ### `.removeDefault(): void` Removes default instances from the asset container. ### `.instantiate(options?: any): Node` Instantiates the asset container with optional configuration. ### `.getRootNodeByName(name: string): Node | null` Retrieves the root node of the instantiated scene by its name. ### `.getScriptByClassByObjectName(scriptClass: new() => any, objectName: string): any | null` Retrieves a script instance by its class and the name of the object it's attached to. ``` -------------------------------- ### Run All Tests Sequentially Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Executes all tests for the tools and then the editor sequentially. This provides a comprehensive test run for the project. ```bash yarn test ``` -------------------------------- ### Particle Systems Source: https://github.com/babylonjs/editor/blob/master/mcp/mcp-tools-contract.md Manage particle system assets and instantiate them in the scene. ```APIDOC ## list_particle_assets ### Description Lists available `.npss` node particle system assets. ### Method GET ### Endpoint /list_particle_assets ### Response #### Success Response (200) - **assets** (array) - An array of particle system asset objects. - **name** (string) - The name of the particle system asset. - **path** (string) - The path to the particle system asset. ## instantiate_particle_system ### Description Instantiates a `.npss` particle system asset into the scene, or creates a default one if no path is provided. ### Method POST ### Endpoint /instantiate_particle_system ### Parameters #### Request Body - **path** (string) - Optional - The path to the `.npss` particle system asset to instantiate. - **name** (string) - Optional - The desired name for the particle system in the scene. - **emitterNodeId** (string) - Optional - The ID of the node to use as the emitter. - **position** (object) - Optional - The desired position for the particle system (e.g., `{ x: 0, y: 0, z: 0 }`). ### Response #### Success Response (200) - created summary (object) - A summary of the created particle system. ``` -------------------------------- ### Materials and Textures Source: https://github.com/babylonjs/editor/blob/master/mcp/mcp-tools-contract.md Manage scene materials, their types, properties, and texture assignments, as well as environment textures. ```APIDOC ## list_materials ### Description Retrieves a list of all materials in the scene or project, including `.material` assets. ### Method GET ### Endpoint /list_materials ### Response #### Success Response (200) - **materials** (array) - An array of material objects. - **id** (string) - The unique identifier for the material. - **name** (string) - The name of the material. - **className** (string) - The class name of the material. - **path** (string) - Optional - The file path of the material asset. ## list_material_types ### Description Provides a catalog of creatable material types, including those from the Materials Library. Each type includes information on its usage and key properties that can be set via `set_material_properties`. ### Method GET ### Endpoint /list_material_types ### Response #### Success Response (200) - **types** (array) - An array of material type objects. - **type** (string) - The type identifier for the material (e.g., 'pbr', 'standard', 'sky'). - **className** (string) - The class name of the material. - **library** (boolean) - Indicates if the material is part of the Materials Library. - **use** (string) - Description of how the material is used. - **keyProperties** (array) - An array of key properties that can be set for this material type. ## create_material ### Description Creates a new material, including types from the Materials Library (e.g., SkyMaterial). The created material is persisted as a `.material` asset, making it visible in the assets browser. ### Method POST ### Endpoint /create_material ### Parameters #### Request Body - **type** (string) - Required - The type of material to create (e.g., 'pbr', 'standard', 'sky', 'grid', 'normal', 'water', 'lava', 'triplanar', 'cell', 'fire', 'gradient', 'node'). - **name** (string) - Optional - The desired name for the material. - **folder** (string) - Optional - The folder in which to save the material asset. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created material. - **name** (string) - The name of the created material. - **path** (string) - The file path of the created material asset. ## set_material_properties ### Description Sets deep properties of a material using a dotted path notation (e.g., `albedoColor`, `metallic`, `roughness`). It can also coerce color values from an array `[r,g,b]` to a Color3 object. ### Method POST ### Endpoint /set_material_properties ### Parameters #### Request Body - **materialId** (string) - Required - The ID of the material to modify. - **properties** (object) - Required - An object where keys are dotted paths to material properties and values are their new settings. ### Response #### Success Response (200) - updated material summary (object) - A summary of the updated material. ## assign_texture_to_material ### Description Loads a texture asset and assigns it to a specified channel of a material. ### Method POST ### Endpoint /assign_texture_to_material ### Parameters #### Request Body - **materialId** (string) - Required - The ID of the material to modify. - **channel** (string) - Required - The material channel to assign the texture to (e.g., 'albedoTexture', 'bumpTexture', 'metallicTexture'). - **texturePath** (string) - Required - The path to the texture asset. ### Response #### Success Response (200) - updated material summary (object) - A summary of the updated material. ## set_environment_texture ### Description Sets the scene's environment or skybox using a provided cube texture asset (e.g., `.env`, `.hdr`). Optionally creates a skybox. ### Method POST ### Endpoint /set_environment_texture ### Parameters #### Request Body - **texturePath** (string) - Required - The path to the environment texture asset. - **createSkybox** (boolean) - Optional - Whether to create a skybox from the texture. ### Response #### Success Response (200) - **ok** (boolean) - Indicates if the operation was successful. ``` -------------------------------- ### Run a Single Test File in Tools Workspace Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Runs a specific test file within the 'tools' workspace. This is helpful for debugging or quickly verifying a particular test case. ```bash cd tools && yarn vitest run test/tools/scene.test.ts ``` -------------------------------- ### Camera Post-Processes Source: https://github.com/babylonjs/editor/blob/master/mcp/mcp-tools-contract.md Manage per-camera rendering effects and post-processes. ```APIDOC ## get_camera_post_processes ### Description Read all post-process configs for a camera. This reflects the live active camera's configuration if it's active, otherwise it shows the camera's saved configuration. Returns null when disabled. ### Method GET ### Endpoint /get_camera_post_processes ### Parameters #### Query Parameters - **nodeId** (string) - Optional - The ID of the camera node. - **nodeName** (string) - Optional - The name of the camera node. ### Response #### Success Response (200) - **camera** (object) - The camera object. - **cameraId** (string) - The ID of the camera. - **isActive** (boolean) - Whether the camera is currently active. - **postProcesses** (object) - An object containing post-process configurations. - **default** (object) - Default rendering pipeline configurations (bloom, tone mapping, FXAA, image processing, vignette, DOF, chromatic aberration, grain, sharpen, glow, color grading/curves). - **ssao** (object) - Screen Space Ambient Occlusion configuration. - **ssr** (object) - Screen Space Reflections configuration. - **motionBlur** (object) - Motion Blur configuration. - **vls** (object) - Velocity-based Lighting System configuration. - **taa** (object) - Temporal Anti-Aliasing configuration. ## set_camera_post_process ### Description Enable, disable, and customize a post-process for a specific camera. This operation first switches the active camera to the target camera. Properties are the flat serialized keys of the corresponding pipeline. ### Method POST ### Endpoint /set_camera_post_process ### Parameters #### Request Body - **nodeId** (string) - Optional - The ID of the camera node. - **nodeName** (string) - Optional - The name of the camera node. - **type** (string) - Required - The type of post-process to set (e.g., 'default', 'ssao', 'ssr'). - **enabled** (boolean) - Optional - Whether to enable or disable the post-process. - **properties** (object) - Optional - An object containing the properties to customize for the post-process. ### Response #### Success Response (200) - **camera** (object) - The camera object. - **type** (string) - The type of the post-process. - **enabled** (boolean) - The enabled status of the post-process. - **config** (object) - The configuration of the post-process. ``` -------------------------------- ### Package the Editor (macOS Signing) Source: https://github.com/babylonjs/editor/blob/master/README.md Packages the Electron application for macOS, including signing. Requires a .env file with Apple ID credentials. Omit --noSign to enable signing. ```bash # For the current platform and architecture yarn package # By providing the target architecture yarn package --x64 # For both architectures yarn package --arm64 --x64 ``` -------------------------------- ### Run All Tests with Coverage Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Executes all tests for the tools and the editor, generating a code coverage report. This is useful for assessing test completeness. ```bash yarn coverage ``` -------------------------------- ### Light Operations Source: https://github.com/babylonjs/editor/blob/master/mcp/mcp-tools-contract.md Provides methods for creating lights and configuring their shadow generators. ```APIDOC ## create_light ### Description Create a light source (directional, point, spot, or hemispheric). Reuses logic from `editor/src/project/add/light.ts`. ### Method Not specified (assumed internal function call) ### Parameters #### Input - **type** (string) - Required - Type of light: "directional"|"point"|"spot"|"hemispheric" - **name** (string) - Optional - The name of the light. - **parentId** (string) - Optional - The ID of the parent node. - **position** (object) - Optional - The position of the light. - **direction** (object) - Optional - The direction of the light. - **color** (array) - Optional - The color of the light as an RGB array [r,g,b]. - **intensity** (number) - Optional - The intensity of the light. - **range** (number) - Optional - The range of the light (for point and spot lights). - **angle** (number) - Optional - The angle of the light (for spot lights). ### Output - created node summary ``` ```APIDOC ## set_light_shadows ### Description Enable or disable a shadow generator on a light and configure its properties. Supports "classic" and "cascaded" generator types. Cascaded shadows are best for directional lights in large outdoor scenes. ### Method Not specified (assumed internal function call) ### Parameters #### Input - **nodeId** (string) - Optional - The ID of the light to configure. - **nodeName** (string) - Optional - The name of the light to configure. - **enabled** (boolean) - Required - Whether to enable the shadow generator. - **generatorType** (string) - Optional - The type of shadow generator: "classic" or "cascaded". - **mapSize** (number) - Optional - The size of the shadow map. - **numCascades** (number) - Optional - The number of cascades for a cascaded shadow generator. - **lambda** (number) - Optional - Lambda value for shadow map filtering. - **useBlurExponentialShadowMap** (boolean) - Optional - Whether to use exponential blur for shadow maps. - **darkness** (number) - Optional - The darkness of the shadows. ### Output - updated light summary ``` ```APIDOC ## remove_light_shadows ### Description Remove the shadow generator from a light, stopping it from casting shadows. ### Method Not specified (assumed internal function call) ### Parameters #### Input - **nodeId** (string) - Optional - The ID of the light to modify. - **nodeName** (string) - Optional - The name of the light to modify. ### Output - updated light summary ``` ```APIDOC ## create_clustered_light_container ### Description Create the scene's `ClusteredLightContainer` if it does not already exist. This is part of performance optimization. ### Method Not specified (assumed internal function call) ### Parameters #### Input - `{}` - No parameters required. ### Output - node summary ``` ```APIDOC ## add_light_to_clustered_container ### Description Move a non-shadow-casting light into the scene's `ClusteredLightContainer` for performance benefits. ### Method Not specified (assumed internal function call) ### Parameters #### Input - **nodeId** (string) - Optional - The ID of the light to move. - **nodeName** (string) - Optional - The name of the light to move. ### Output - updated summary ``` ```APIDOC ## remove_light_from_clustered_container ### Description Remove a light from the `ClusteredLightContainer`, returning it to the scene as a regular light. ### Method Not specified (assumed internal function call) ### Parameters #### Input - **nodeId** (string) - Optional - The ID of the light to remove. - **nodeName** (string) - Optional - The name of the light to remove. ### Output - updated summary ``` -------------------------------- ### Camera Operations Source: https://github.com/babylonjs/editor/blob/master/mcp/mcp-tools-contract.md Provides methods for creating cameras and setting the active camera in the scene. ```APIDOC ## create_camera ### Description Create a camera (free, arcrotate, or universal). Reuses logic from `editor/src/project/add/camera.ts`. ### Method Not specified (assumed internal function call) ### Parameters #### Input - **type** (string) - Required - Type of camera: "free"|"arcrotate"|"universal" - **name** (string) - Optional - The name of the camera. - **position** (object) - Optional - The initial position of the camera. - **target** (object) - Optional - The target the camera is looking at. - **options** (object) - Optional - Additional options for camera creation. ### Output - created node summary ``` ```APIDOC ## set_active_camera ### Description Set the active camera for the scene. This operation correctly handles camera switching within the preview, including saving and restoring per-camera post-processes. ### Method Not specified (assumed internal function call) ### Parameters #### Input - **nodeId** (string) - Optional - The ID of the camera to set as active. - **nodeName** (string) - Optional - The name of the camera to set as active. ### Output - `{ activeCamera }` ``` -------------------------------- ### Minimal Class-Based Script in TypeScript Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/SKILL.md Use this as a template for creating custom scripts. Ensure decorated properties are accessed after construction, typically in `onStart` or later methods. ```typescript import { Mesh } from "@babylonjs/core/Meshes/mesh"; import { visibleAsNumber } from "babylonjs-editor-tools"; export default class RotateScript { @visibleAsNumber("Rotation Speed", { min: 0, max: 10, step: 0.1 }) private _speed: number = 1; public constructor(public mesh: Mesh) { // ⚠️ decorated properties are NOT available here yet. } public onStart(): void { // ✅ decorated properties are now resolved. } public onUpdate(): void { this.mesh.rotation.y += this._speed * this.mesh.getScene().getAnimationRatio(); } } ``` -------------------------------- ### Deprecated GUI Asset Loading Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/references/asset-decorators.md Shows the deprecated @guiFromAsset decorator for loading GUI files from a fixed path. Prefer @visibleAsAsset("gui", ...) instead. ```typescript // ⚠️ deprecated @guiFromAsset("ui.gui", (instance, gui) => instance._onGuiLoaded(gui)) private _ui!: AdvancedDynamicTexture; ``` -------------------------------- ### Assets Browser Source: https://github.com/babylonjs/editor/blob/master/mcp/mcp-tools-contract.md Interact with the project's asset browser, listing assets and retrieving previews. ```APIDOC ## list_assets ### Description Lists project assets, with optional filtering by type or folder. It also indicates if an `editor_preview.png` exists for the containing folder. ### Method GET ### Endpoint /list_assets ### Parameters #### Query Parameters - **type** (string) - Optional - Filter assets by type (e.g., 'texture', 'mesh', 'material'). - **folder** (string) - Optional - Filter assets by folder path. ### Response #### Success Response (200) - **assets** (array) - An array of asset objects. - **name** (string) - The name of the asset. - **path** (string) - The path to the asset. - **type** (string) - The type of the asset. - **hasPreview** (boolean) - Indicates if a preview exists for the asset's folder. ## get_asset_preview ### Description Returns the `editor_preview.(png/jpg/bmp)` image for a folder, or a generated thumbnail as a base64 encoded string. ### Method GET ### Endpoint /get_asset_preview ### Parameters #### Query Parameters - **path** (string) - Required - The path to the asset or folder for which to get the preview. ### Response #### Success Response (200) - **imageBase64** (string) - The base64 encoded image data. - **mimeType** (string) - The MIME type of the image. ## instantiate_mesh_asset ### Description Loads a mesh asset (e.g., `.glb`, `.gltf`, `.babylon`, `.fbx`) into the scene, simulating a drag-and-drop operation. By default, glTF assets are auto-scaled by 100 as per the specification. ### Method POST ### Endpoint /instantiate_mesh_asset ### Parameters #### Request Body - **path** (string) - Required - The path to the mesh asset. - **name** (string) - Optional - The desired name for the root node of the instantiated mesh. - **parentId** (string) - Optional - The ID of the parent node to attach the instantiated mesh to. - **position** (object) - Optional - The desired position for the instantiated mesh (e.g., `{ x: 0, y: 0, z: 0 }`). ### Response #### Success Response (200) - **rootNodeId** (string) - The ID of the root node of the instantiated mesh. - **createdNodes** (array) - An array of summary objects for the nodes created. ``` -------------------------------- ### Check Code Formatting Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Checks if the code adheres to the project's Prettier formatting rules without modifying files. ```bash yarn format-check ``` -------------------------------- ### Run Tools Tests Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Executes tests specifically for the 'tools' workspace. This command is useful for focused testing of the tools library. ```bash yarn workspace babylonjs-editor-tools test ``` -------------------------------- ### Format Code with Prettier Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Applies code formatting using Prettier according to the project's configuration (tabs, double quotes, printWidth 180, trailing comma 'es5'). ```bash yarn format ``` -------------------------------- ### Loading Scenes Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/SKILL.md Function to asynchronously load and append a Babylon.js scene. ```APIDOC ## Loading Scenes ### `await loadScene(rootUrl: string, sceneFilename: string, scene: Scene, scriptsMap?: { [key: string]: new() => any }, options?: any): Promise` Appends a saved `.babylon` scene to the current scene. It preloads script assets, configures scene properties (lights, shadows, LODs, physics, post-processing), and attaches all scripts. ``` -------------------------------- ### Import Core Babylon.js Editor Tools Source: https://github.com/babylonjs/editor/blob/master/website/public/skills/babylonjs-editor-tools/SKILL.md Import essential functions and decorators from the babylonjs-editor-tools package root. These are commonly used when developing scripts for the Babylon.js Editor. ```typescript import { loadScene, nodeFromScene, visibleAsNumber, onPointerEvent } from "babylonjs-editor-tools"; ``` -------------------------------- ### Run a Single Test File in Editor Workspace Source: https://github.com/babylonjs/editor/blob/master/CLAUDE.md Runs a specific test file within the 'editor' workspace. This is useful for focused debugging and verification of editor functionality. ```bash cd editor && yarn vitest run test/tools/node/clone.test.mts ```