Models - Voxel Shape Module
anvil.api.models.voxel_shape
Builder for Bedrock voxel shape files (*.shape.json).
Built like a :class:~anvil.api.models.geometry.Geometry: a :class:VoxelShape only
creates root groups, and a :class:_VoxelGroup creates boxes and child groups.
Groups organise the shape and can be found again by name; the file itself is a
flat list of every box, in the order they were added.
Example
VoxelShape
Bases: AddonObject
A voxel shape file (<name>.shape.json) built from a tree of groups.
The file is named after name. The shape identifier is
<namespace>:<identifier_name> and defaults to name.
boxes
property
Every box of the shape, in the order they were added.
groups
property
All groups, parents always before their children.
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
shape_identifier
property
How a block's geometry references this shape: <namespace>:<identifier_name>.
content(content)
Sets the content of the addon object and returns the object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
any
|
The content to be set for the addon object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
self |
'AddonObject'
|
The instance of the current AddonObject. |
group(name)
Creates a root group and returns it.
queue(directory=None)
Queues the addon object for processing and logs the event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
The directory of the addon object. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
self |
'AddonObject'
|
The instance of the current AddonObject. |
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |