Operations
Asset Operations
CreatePrimitive
Generate a primitive mesh and optionally create an entity with Transform and MeshComponent.
| Parameter | Type | Required | Description |
|---|---|---|---|
primitive_type | enum | Yes | Cube, Sphere, Plane, or Cylinder |
entity_name | string | No | Name for auto-created entity |
parent_guid | string | No | Parent entity GUID |
position | array | No | Initial position [x, y, z] (default: [0,0,0]) |
segments | integer | No | Segment count for sphere/cylinder (default: 32) |
{
"op": "CreatePrimitive",
"params": {
"primitive_type": "Sphere",
"entity_name": "Ball",
"position": [0, 5, 0],
"segments": 48
}
}
CreatePBRMaterial
Apply a PBR material to an entity. Replaces any existing UnlitMaterial.
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_guid | string | No | Target entity GUID (use this OR entity_name) |
entity_name | string | No | Target entity name |
material_name | string | No | Display name (default: "PBRMaterial") |
base_color | array | No | RGBA color [r, g, b, a] in sRGB, 0-1 range (default: [1,1,1,1]) |
metallic | number | No | Metallic factor 0-1 (default: 0.0) |
roughness | number | No | Roughness factor 0-1 (default: 0.5) |
albedo_texture_guid | string | No | Albedo texture asset GUID |
normal_texture_guid | string | No | Normal map texture GUID |
ao_texture_guid | string | No | Ambient occlusion texture GUID |
{
"op": "CreatePBRMaterial",
"params": {
"entity_name": "Floor",
"material_name": "TileFloor",
"base_color": [0.8, 0.8, 0.75, 1.0],
"metallic": 0.0,
"roughness": 0.3
}
}
ImportMesh
Import a glTF/glb file into the project. Creates mesh metadata and cooked data in the Library.
| Parameter | Type | Required | Description |
|---|---|---|---|
source_path | string | Yes | Path to the .gltf or .glb file |
force | boolean | No | Force re-import even if asset exists |
{
"op": "ImportMesh",
"params": {
"source_path": "/path/to/character.glb",
"force": false
}
}
ImportTexture
Import an image file as a texture asset.
| Parameter | Type | Required | Description |
|---|---|---|---|
source_path | string | Yes | Path to image file (PNG, JPG, BMP, TGA) |
force | boolean | No | Force re-import even if asset exists |
{
"op": "ImportTexture",
"params": {
"source_path": "/path/to/brick_diffuse.png"
}
}
Example: Textured PBR Entity
Import a texture, then apply it as the albedo on a PBR material:
[
{
"op": "ImportTexture",
"params": { "source_path": "/textures/wood.png" }
},
{
"op": "CreatePrimitive",
"params": { "primitive_type": "Cube", "entity_name": "WoodCrate" }
},
{
"op": "CreatePBRMaterial",
"params": {
"entity_name": "WoodCrate",
"albedo_texture_guid": "<texture-guid-from-import>",
"roughness": 0.7,
"metallic": 0.0
}
}
]