lmblender reference
Every host type, method, command line flag and exit code of lmblender 0.3.6, generated from schema/lmblender.dsl.json, cpp/main.cpp and the vendored cpp/std/lmcode-std.schema.json in the repository. All calls are positional with no optional arguments. Units, bounds and argument meaning for each call are in the repository file docs/LLM_GUIDE.md.
Command line
| Command | Effect |
|---|---|
| lmblender --version | Prints lmblender version with the DSL bytecode version, the Cycles version and the OpenImageDenoise version (or that it is disabled). Exit 0. |
| lmblender --lmcode-schema | Prints a compact summary: context and function signatures, then methods grouped by type. |
| lmblender --lmcode-schema --json | Prints the embedded schema JSON byte for byte (same bytes as schema/lmblender.dsl.json merged with the vendored std). |
| lmblender --schema --json | Older spelling of the same embedded schema output. |
| lmblender --schema | Embedded schema followed by one newline (kept for compatibility). |
| lmblender --lmcode-signatures | Prints every registered signature, one per line. Exit 0. |
| lmblender --lmcode FILE.dslb | Loads compiled bytecode, binds the scene context object, runs the program and prints one JSON result line. |
| lmblender --presets | Lists embedded scene presets as name, tab, description. |
| lmblender --preset-show NAME | Prints one embedded preset as JSON; exit 2 when the name is unknown. |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success. The run prints a JSON line with ok true and a result. |
| 2 | Usage error (wrong arguments) or unknown preset name for --preset-show. Compile failures reported by lmscript also use 2. |
| 3 | Load or run error: JSON line with ok false, phase load or run, code, message and line/column when available. |
| 4 | APP_FAIL (phase app, an unexpected host failure), or a failed write of the schema to stdout. |
Environment variables
| Variable | Effect |
|---|---|
| LMBLENDER_OUTPUT_ROOT | Confines every output path to one directory. |
| LMBLENDER_RUN_TIMEOUT_SECONDS | Whole-program wall-clock limit, default 7200; 0 disables. |
| LMBLENDER_MAX_INSTRUCTIONS | Whole-program VM instruction budget, default 100 million; 0 disables. |
Used from lmscript
An lmscript program declares the host on the block, and run_lmcode compiles the block against the host schema, runs the host and returns a record with ok and result.
mkdir("images");
prog = _lmcode_ cli="lmblender" install="github:lmctl-ai/lmblender@latest";
let ball = scene.uv_sphere(1.0, 48, 32, true);
ball.set_material(scene.material(0.1, 0.3, 0.8, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0));
scene.studio_setup();
scene.render_png("images/hello.png", 32, 640, 480);
end _lmcode_
r = run_lmcode(prog);
if (!r.ok) { println("lmblender failed"); exit(1); }
println("wrote images/hello.png");
The repository examples save the bytecode and call the host with an explicit timeout in milliseconds, which is the form to use for long renders:
savedsl(prog, "build/scene.dslb");
argv = dsl_cli(prog);
push(argv, "--lmcode");
push(argv, "build/scene.dslb");
r = system(argv, 3600000);
println(trim(r.stdout));
if (r.code != 0) { println(trim(f"lmblender exit {r.code}: {r.stderr}")); exit(1); }
Context and host types
| Name | Kind | Methods | Role |
|---|---|---|---|
| scene | context object of type Scene | The one object bound by the host; every program starts from it. | |
| Scene | type | 69 | Scene construction, camera, lights, world, materials, imports, render and presets. |
| Mesh | type | 18 | Handle returned by primitives, imports and instance_mesh. |
| Material | type | 9 | Handle returned by the material constructors. |
The host schema declares no host functions of its own; free functions come from the standard library below.
Scene methods (69)
| Method | Parameters | Returns |
|---|---|---|
| camera_look_at | float, float, float, float, float, float, float | void |
| camera_dof | float, float | void |
| camera_orthographic | float, float, float, float, float, float, float | void |
| fit_camera | float | void |
| studio_setup | none | void |
| area_light | float, float, float, float, float, float, float, float, float, float, float | void |
| sun_light | float, float, float, float, float, float, float, float | void |
| spot_light | float, float, float, float, float, float, float, float, float, float, float, float | void |
| ground_plane | float, float, float, float, float | void |
| wall_plane_y | float, float, float, float, float | void |
| checker_material | float, float, float, float, float, float, float, float | Material |
| noise_material | float, float, float, float, float, float, float, float | Material |
| image_material | string, float | Material |
| point_light | float, float, float, float, float, float, float | void |
| world_color | float, float, float, float | void |
| sky_texture | float, float, float | void |
| environment_texture | string, float, float | void |
| transparent_background | bool | void |
| expect_int | int, int | void |
| import_obj | string | Mesh |
| import_stl | string | Mesh |
| import_ply | string | Mesh |
| import_gltf | string | Mesh |
| instance_mesh | Mesh, float, float, float, float, float, float | Mesh |
| material | float, float, float, float, float, float, float, float, float, float | Material |
| render_png | string, int, int, int | void |
| render_exr | string, int, int, int | void |
| render_passes | string, int, int, int | void |
| depth_range | float, float | void |
| exposure | float | void |
| render_timeout | int | void |
| render_settings | int, int, bool | void |
| denoise_quality | string | void |
| render_preset | string | void |
| set_view_transform | string | void |
| version | none | string |
| plane | float | Mesh |
| cube | float | Mesh |
| uv_sphere | float, int, int, bool | Mesh |
| cylinder | float, float, int, bool | Mesh |
| cone | float, float, int, bool | Mesh |
| torus | float, float, int, int, bool | Mesh |
| capsule | float, float, int, int | Mesh |
| glow_orb | float, float, float, float, float, float, float, float | Mesh |
| tube_between | float, float, float, float, float, float, float | Mesh |
| strand | string, float, float, int | Mesh |
| hair_sphere | float, float, float, float, int, float, float | Mesh |
| hair_patch | float, float, float, float, int, float, float | Mesh |
| loft | string, string, bool | Mesh |
| toon_outline | Mesh, float, float, float, float | Mesh |
| arrow_between | float, float, float, float, float, float, float | Mesh |
| ring_arc | float, float, float, float, float, float, float, int | Mesh |
| checkmark | float, float, float, float, float | Mesh |
| label | string, float, float, float, float | Mesh |
| checker_ground | float, float | void |
| light_clamp | float, float | void |
| render_sequence | string, int, int, int, int, int | void |
| render_apng | string, int, int, int, int, int, int | void |
| camera_keyframe | int, float, float, float, float, float, float, string | void |
| ramp_material | float, float, float, float, float, float, float, float | Material |
| motion_blur | bool, float | void |
| area_light_shape | float, float, float, float, float, float, float, float, float, float, float, float, string | void |
| camera_optics_keyframe | int, float, float, string | void |
| point_light_keyframe | int, int, float, string | void |
| set_threads | int | void |
| use_preset | string | void |
| load_preset | string | void |
| preset_param | string, float | void |
| material_from_palette | string | Material |
Mesh methods (18)
| Method | Parameters | Returns |
|---|---|---|
| set_material | Material | void |
| set_smooth | bool | void |
| translate | float, float, float | void |
| scale | float, float, float | void |
| rotate_x | float | void |
| rotate_y | float | void |
| rotate_z | float | void |
| vertex_count | none | int |
| triangle_count | none | int |
| material_count | none | int |
| min_x | none | float |
| min_y | none | float |
| min_z | none | float |
| max_x | none | float |
| max_y | none | float |
| max_z | none | float |
| keyframe_transform | int, float, float, float, string | void |
| keyframe_visible | int, bool, string | void |
Material methods (9)
| Method | Parameters | Returns |
|---|---|---|
| subsurface | float, float, float, float, float | void |
| volume | string, float, float, float, float | void |
| keyframe_color | int, float, float, float, string | void |
| bump | float, float, float | void |
| texture_maps | string, string, string, string | void |
| mix_with | Material, float | void |
| mix_with_texture | Material, string | void |
| backface_culling | bool | void |
| keyframe_emission_strength | int, float, string | void |
Error codes
| Code | Meaning |
|---|---|
| LOAD_BAD_BYTECODE, LOAD_SCHEMA_MISMATCH, LOAD_UNBOUND | Recompile the .lms against the schema of the installed host (exit 3, phase load). |
| RUN_HOST | Host validation failure: range, non-finite value, missing file, wrong extension, unsupported combination. The message names the method and accepted bounds. |
| RUN_ERROR | VM fault such as division by zero. |
| GEOMETRY_BUDGET, IMAGE_LIMIT, IMAGE_INVALID | Scene geometry or image input outside the documented limits. |
| OBJ_INVALID, OBJ_LIMIT, OBJ_MTL_INVALID, OBJ_MTL_LIMIT, OBJ_MTL_UNSUPPORTED | OBJ/MTL input problems; fix the input rather than retrying. |
| GLTF_INVALID, GLTF_LIMIT, GLTF_UNSUPPORTED | glTF input problems. |
| PRESET_INVALID, PRESET_NOT_FOUND, PRESET_UNSUPPORTED | Preset problems. |
| OUTPUT_PATH | Output directory missing or path outside LMBLENDER_OUTPUT_ROOT. |
| RENDER_TIMEOUT | One render exceeded render_timeout(seconds), 1..3600. Lower samples or resolution, or raise the timeout. |
| RUN_TIMEOUT, RUN_BUDGET | Whole program exceeded its wall-clock or VM-instruction budget (defaults 7200 s and 100 million instructions). |
Limits
| Item | Limit |
|---|---|
| Meshes and materials | 4096 each |
| Scene geometry | 10 million vertices and 20 million triangles in total; instances are free |
| Image inputs | 64 MiB on disk and 64 megapixels decoded |
| Render size | 4096 per dimension and 16 million pixels |
| Samples | 1 to 65536 (render_png also accepts 0 for the preset count) |
| APNG | 240 frames and 64 million total frame-pixels |
| render_timeout | 1 to 3600 seconds per render |
| Device | CPU only |
Standard library in lmblender 0.3.6
lmblender 0.3.6 vendors the lmcode_std_v3 schema pinned in sdk.lock (lmcode-cpp commit 20325f7a) with 206 canonical signatures: 83 functions and 123 methods on 16 container and Json types. The current lmcode_std_v3 catalog has 226 signatures; the 20 additional ones are the REST and CLI module described in the next section, which lmblender picks up when it syncs its vendored std and releases.
File functions (5)
| Function | Parameters | Returns |
|---|---|---|
| file_append | string, string | void |
| file_exists | string | bool |
| file_lines | string | StrList |
| file_read | string | string |
| file_write | string, string | void |
String functions (21)
| Function | Parameters | Returns |
|---|---|---|
| str_base64_decode | string | string |
| str_base64_encode | string | string |
| str_contains | string, string | bool |
| str_ends_with | string, string | bool |
| str_find | string, string | int |
| str_hex_decode | string | string |
| str_hex_encode | string | string |
| str_is_float | string | bool |
| str_is_int | string | bool |
| str_len | string | int |
| str_lower | string | string |
| str_match | string, string | bool |
| str_repeat | string, int | string |
| str_replace | string, string, string | string |
| str_split | string, string | StrList |
| str_starts_with | string, string | bool |
| str_substr | string, int, int | string |
| str_to_float | string | float |
| str_to_int | string | int |
| str_trim | string | string |
| str_upper | string | string |
Math functions (16)
| Function | Parameters | Returns |
|---|---|---|
| math_abs | int | int |
| math_abs | float | float |
| math_ceil | int | int |
| math_ceil | float | float |
| math_floor | int | int |
| math_floor | float | float |
| math_max | int, int | int |
| math_max | float, float | float |
| math_min | int, int | int |
| math_min | float, float | float |
| math_pow | int, int | int |
| math_pow | float, float | float |
| math_round | int | int |
| math_round | float | float |
| math_sqrt | int | int |
| math_sqrt | float | float |
Json and templates (2)
| Function | Parameters | Returns |
|---|---|---|
| json_parse | string | Json |
| template_render | string, Json | string |
Return values (24)
| Function | Parameters | Returns |
|---|---|---|
| lmcode_return_null | none | void |
| lmcode_return_put | string, bool | void |
| lmcode_return_put | string, float | void |
| lmcode_return_put | string, FloatList | void |
| lmcode_return_put | string, FloatMap | void |
| lmcode_return_put | string, int | void |
| lmcode_return_put | string, IntList | void |
| lmcode_return_put | string, IntMap | void |
| lmcode_return_put | string, Json | void |
| lmcode_return_put | string, StrList | void |
| lmcode_return_put | string, StrMap | void |
| lmcode_return_put | string, string | void |
| lmcode_return_put_null | string | void |
| lmcode_return_set | bool | void |
| lmcode_return_set | float | void |
| lmcode_return_set | FloatList | void |
| lmcode_return_set | FloatMap | void |
| lmcode_return_set | int | void |
| lmcode_return_set | IntList | void |
| lmcode_return_set | IntMap | void |
| lmcode_return_set | Json | void |
| lmcode_return_set | StrList | void |
| lmcode_return_set | StrMap | void |
| lmcode_return_set | string | void |
Collection constructors (15)
| Function | Parameters | Returns |
|---|---|---|
| float_list | none | FloatList |
| float_map | none | FloatMap |
| float_pq | none | FloatPQ |
| float_queue | none | FloatQueue |
| float_stack | none | FloatStack |
| int_list | none | IntList |
| int_map | none | IntMap |
| int_pq | none | IntPQ |
| int_queue | none | IntQueue |
| int_stack | none | IntStack |
| str_list | none | StrList |
| str_map | none | StrMap |
| str_pq | none | StrPQ |
| str_queue | none | StrQueue |
| str_stack | none | StrStack |
FloatList methods (7)
| Method | Parameters | Returns |
|---|---|---|
| add | float | FloatList |
| at | int | float |
| clear | none | FloatList |
| contains | float | bool |
| index_of | float | int |
| len | none | int |
| set | int, float | FloatList |
FloatMap methods (10)
| Method | Parameters | Returns |
|---|---|---|
| len | none | int |
| has | string | bool |
| get | string | float |
| get_or | string, float | float |
| set | string, float | FloatMap |
| key_at | int | string |
| remove | string | bool |
| clear | none | FloatMap |
| keys | none | StrList |
| values | none | FloatList |
FloatPQ methods (6)
| Method | Parameters | Returns |
|---|---|---|
| push | float, float | FloatPQ |
| pop | none | float |
| peek | none | float |
| len | none | int |
| empty | none | bool |
| clear | none | FloatPQ |
FloatQueue methods (7)
| Method | Parameters | Returns |
|---|---|---|
| push | float | FloatQueue |
| pop | none | float |
| peek | none | float |
| len | none | int |
| empty | none | bool |
| clear | none | FloatQueue |
| at | int | float |
FloatStack methods (7)
| Method | Parameters | Returns |
|---|---|---|
| push | float | FloatStack |
| pop | none | float |
| peek | none | float |
| len | none | int |
| empty | none | bool |
| clear | none | FloatStack |
| at | int | float |
IntList methods (7)
| Method | Parameters | Returns |
|---|---|---|
| add | int | IntList |
| at | int | int |
| clear | none | IntList |
| contains | int | bool |
| index_of | int | int |
| len | none | int |
| set | int, int | IntList |
IntMap methods (10)
| Method | Parameters | Returns |
|---|---|---|
| len | none | int |
| has | string | bool |
| get | string | int |
| get_or | string, int | int |
| set | string, int | IntMap |
| key_at | int | string |
| remove | string | bool |
| clear | none | IntMap |
| keys | none | StrList |
| values | none | IntList |
IntPQ methods (6)
| Method | Parameters | Returns |
|---|---|---|
| push | int, float | IntPQ |
| pop | none | int |
| peek | none | int |
| len | none | int |
| empty | none | bool |
| clear | none | IntPQ |
IntQueue methods (7)
| Method | Parameters | Returns |
|---|---|---|
| push | int | IntQueue |
| pop | none | int |
| peek | none | int |
| len | none | int |
| empty | none | bool |
| clear | none | IntQueue |
| at | int | int |
IntStack methods (7)
| Method | Parameters | Returns |
|---|---|---|
| push | int | IntStack |
| pop | none | int |
| peek | none | int |
| len | none | int |
| empty | none | bool |
| clear | none | IntStack |
| at | int | int |
Json methods (11)
| Method | Parameters | Returns |
|---|---|---|
| kind | none | string |
| len | none | int |
| at | int | Json |
| get | string | Json |
| has | string | bool |
| keys | none | StrList |
| as_string | none | string |
| as_int | none | int |
| as_float | none | float |
| as_bool | none | bool |
| to_json | none | string |
StrList methods (8)
| Method | Parameters | Returns |
|---|---|---|
| add | string | StrList |
| at | int | string |
| clear | none | StrList |
| contains | string | bool |
| index_of | string | int |
| join | string | string |
| len | none | int |
| set | int, string | StrList |
StrMap methods (10)
| Method | Parameters | Returns |
|---|---|---|
| clear | none | StrMap |
| get | string | string |
| get_or | string, string | string |
| has | string | bool |
| key_at | int | string |
| len | none | int |
| remove | string | bool |
| set | string, string | StrMap |
| keys | none | StrList |
| values | none | StrList |
StrPQ methods (6)
| Method | Parameters | Returns |
|---|---|---|
| push | string, float | StrPQ |
| pop | none | string |
| peek | none | string |
| len | none | int |
| empty | none | bool |
| clear | none | StrPQ |
StrQueue methods (7)
| Method | Parameters | Returns |
|---|---|---|
| push | string | StrQueue |
| pop | none | string |
| peek | none | string |
| len | none | int |
| empty | none | bool |
| clear | none | StrQueue |
| at | int | string |
StrStack methods (7)
| Method | Parameters | Returns |
|---|---|---|
| push | string | StrStack |
| pop | none | string |
| peek | none | string |
| len | none | int |
| empty | none | bool |
| clear | none | StrStack |
| at | int | string |
REST and CLI interfaces
These belong to the current 226-signature lmcode_std_v3 catalog and are not in the std that lmblender 0.3.6 vendors, so a program compiled for lmblender 0.3.6 cannot call them. They are listed so that readers know what arrives with the next std sync. lmblender itself is a batch renderer: it has no server mode and its own command line is the flag table above.
Standard interfaces (not in lmblender 0.3.6)
| Interface | Role |
|---|---|
| RestGet | Handler for HTTP GET routes |
| RestPost | Handler for HTTP POST routes |
| RestPut | Handler for HTTP PUT routes |
| RestDelete | Handler for HTTP DELETE routes |
| RestPatch | Handler for HTTP PATCH routes |
| RestHead | Handler for HTTP HEAD routes |
| RestOptions | Handler for HTTP OPTIONS routes |
| RestHandler | Handler for any method |
| CliCommand | Command dispatched by rest_cli |
| CliOption | Option dispatched by rest_cli |
Functions (not in lmblender 0.3.6)
| Function | Parameters | Returns |
|---|---|---|
| rest_config | string, string | void |
| rest_route | string, string, string | void |
| rest_serve | none | void |
| rest_stop | none | void |
| rest_cli | StrList | string |
Route templates accept {param} and {rest...} as well as :param and :rest... placeholders. rest_cli(argv) is a stateless CLI mode that dispatches options, commands and REST routes. The module also defines 15 RestExchange methods.