Prefab
Prefabs are pre-designed voxel models that are stored in Prefab Packages. They can be loaded into VoxelLayer nodes using FxVoxelLayer.LoadPrefab.
To change the voxels of a Prefab use FxVoxelLayer.SavePrefab.
Properties
| Name | Type | Default | Access | Description |
|---|---|---|---|---|
category | 1i | 0 | 🟩🟥 | Category |
description | 1s | 🟩🟥 | Metadata, description | |
guid | 1s | 🟩❌ | Globally unique identifier | |
headline | 1s | 🟩🟥 | Metadata, headline | |
keywords | 1s | 🟩🟥 | Metadata, keyword | |
size | 3i | 🟩❌ | Voxel grid size | |
title | 1s | 🟩🟥 | Metadata, title | |
unitScale | 1f | 1.0 | 🟩🟥 | Unit scale |
Details
Type1b: boolean1c: color (integer)1i: integer1f: float1s: string2b: 2-component boolean vector2i: 2-component integer vector2f: 2-component float vector3b: 3-component boolean vector3i: 3-component integer vector3f: 3-component float vector
Access
🟩 : Property value can be read with FxFile.Get
🟥 : Property value can be changed with FxFile.Set
❌ : Property value is read-only and can't be changed
Create
To create a new prefab in the open prefab package use FxFile.Create with FileType 444.
lua
FxFile.Open(445, "MyPackage") -- open target prefab package first
prefabID = FxFile.Create(444); -- create prefab
prefabID = FxFile.Rename(444, prefabID, "MyPrefab"); -- rename new prefab
FxFile.Open(444, prefabID) -- open prefab