Resource
Cached resource loading. The same path returns the same instance (no duplicate loads). All methods are static.
Resource.loadConfig(path)
Section titled “Resource.loadConfig(path)”Returns: Map (or root type from TOML) — Cached config. Same as Config.load but cached by path; same path returns the same object.
Parameters:
path(String) — Path to the config file (e.g. TOML) relative to the mounted project.
Resource.loadBlend(path)
Section titled “Resource.loadBlend(path)”Returns: BlendResult or null — Loaded blend data (classes, configs, node metadata). Cached per path. null if the file could not be loaded.
Parameters:
path(String) — Path to the.blendfile relative to the mounted project (e.g."Models/Cube.blend").
The result does not include a .nodes map; use instantiate to create scene instances and access nodes.
var blend = Resource.loadBlend("Models/Radio.blend")if (blend != null) { var root = blend.instantiate("Radio", _scene) if (root != null && root.nodes.containsKey("body")) { var bodyNode = root.nodes["body"] }}Resource.loadSound(path)
Section titled “Resource.loadSound(path)”Returns: Source or null — Cached audio source. Same path returns the same Source. null on load failure.
Parameters:
path(String) — Path to the audio file (e.g."sounds/click.wav").
var sound = Resource.loadSound("sounds/click.wav")if (sound != null) Audio.play(sound)BlendResult
Section titled “BlendResult”Result of Resource.loadBlend. Exposes .classes and .configs (no .nodes on the blend resource itself). Use instantiate(...) to create scene instances and register the blend’s actions.
Custom data (nodes)
Section titled “Custom data (nodes)”| Method / property | Returns | Parameters | Description |
|---|---|---|---|
nodeCount | Num | — | Number of nodes in the blend |
nodeName(index) | String | index (Num) | Name of node at index |
nodeId(index) | (node ID) | index (Num) | ID of node at index |
nodeCustomStringKeys(index) | (list-like) | index (Num) | Custom string keys on node |
nodeCustomIntKeys(index) | (list-like) | index (Num) | Custom int keys on node |
nodeCustomPropertyString(index, key) | String | index, key | Custom string property |
nodeCustomPropertyInt(index, key) | Num | index, key | Custom int property |
instantiate(className, scene) / instantiate(className, scene, prefix)
Section titled “instantiate(className, scene) / instantiate(className, scene, prefix)”Returns: Node or null — Root node of the instantiated hierarchy (with .nodes map for children). null if the class was not found or instantiation failed.
Parameters:
className(String) — Class name as set in the Blender addon (e.g."Radio","Cube").scene(Scene) — Scene to add the instance to.prefix(String, optional) — Optional name prefix for instantiated nodes.
Creates an instance of the given class in the scene and registers the blend’s actions. The returned root’s .nodes map (nodeId → Node) lets you look up children.
var cubeRoot = _blend.instantiate("Cube", _scene)if (cubeRoot != null && cubeRoot.nodes.containsKey("model")) { var modelNode = cubeRoot.nodes["model"]}