Buildings, characters and objects
A Building, a Character or an Object is a package: a folder with its document (object.json)
and its model (model.glb). The document holds the model's parts, the package's
fields, its components and, for buildings and objects, the objects
it places.
Import Model
Import Model… (on the package's Design tab, and on a right-click in the Project tree) takes a
.glb. The model is copied into the package as model.glb without being converted; the document
gets model {uid, path}, the size measured from the model, and the model's parts.
- The parts are the model's scene tree: only nodes that draw something, and the nodes that hold them (the bones of a skeleton are left out).
- Every part is
{id, name, node, index, children}:
id | the part's own identity, a UUID given on the first import that never changes |
name | the name people see; the node's name at first, then free to change |
node | the node's name in the model (the mesh's when the node has none) |
index | the node's place in the glb, which the view finds it by |
- A model the engine cannot read (a required compression extension, for example) is refused.
Importing again
When a model is imported again, parts are matched by node (the same names in reading order). A
matched part keeps its id, its name and everything the document added to it (its fields, its
components, where it was moved), even if its place in the tree changed; node, index and
children come from the new model. A new part gets a new id. The notification says how many
parts were kept, added and removed, naming them.
Importing is one undoable command; replacing a model asks first.
Parts
A part can be moved, turned, scaled and hidden from the Inspector or the
view's tools, without touching the model: the document keeps the change on
the part, and it survives importing again. A part has fields and components of its own, just as
the package has: a door's door.open, a lamp's script.
Characters
A character is a package like the others; its model has a skeleton, and it links the
animations it plays. Scripts that extend Character go on it
(Host types). Characters and buildings are
placed in scenes; objects are placed in buildings, in other objects and in scenes.