HammeritePrefabInstance

Core: the map. Inherits Resource

A prefab instance in the map.

Represents a single instantiation of a prefab with its own transform, tracking all brushes and entities that belong to it.

Properties

TypeNameDefault
intinstance_id0
intprefab_id0
intlayer_id0
Transform3DtransformTransform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
int[]brush_ids[]
int[]entity_ids[]

Methods

ReturnsMethod
int[]get_brush_ids()
int[]get_entity_ids()
int[]get_all_object_ids()
boolcontains_brush(brush_id: int)
boolcontains_entity(entity_id: int)
voidadd_brush(brush_id: int)
voidadd_entity(entity_id: int)
voidremove_brush(brush_id: int)
voidremove_entity(entity_id: int)
boolis_empty()
Vector3get_position()
voidset_position(position: Vector3)
Basisget_basis()
voidset_basis(basis: Basis)
voidmove_to(map: HammeriteMap, to: Transform3D)
voidrequest_delete()

Signals

transform_changed

signal transform_changed(new_transform: Transform3D)

Emitted when transform is assigned, once - by set_position(), set_basis() and move_to() too.

delete_requested

signal delete_requested()

Emitted by request_delete(); the owning HammeriteMap removes the instance record.

Property descriptions

instance_id

var instance_id: int = 0

Unique within its map, from HammeriteMap.gen_instance_id(). Must be nonzero before HammeriteMap.add_prefab_instance().

prefab_id

var prefab_id: int = 0

The HammeritePrefab.prefab_id this was placed from. The prefab itself lives in a HammeritePrefabSet, not in the map.

layer_id

var layer_id: int = 0

The HammeriteLayer the instance was placed on. Its brushes and entities carry their own layer_id, and changing this one does not move them.

transform

var transform: Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

Where the instance stands in map space (position and rotation only, no scale). A record of the placement: assigning it emits transform_changed but does NOT move the instance's brushes or entities, which hold their own map-space geometry - move_to() moves them with it.

brush_ids

var brush_ids: int[] = []

HammeriteBrush.ids of the map brushes that belong to this instance.

entity_ids

var entity_ids: int[] = []

HammeriteEntity.ids of the map entities that belong to this instance.

Method descriptions

get_brush_ids()

func get_brush_ids() -> int[]

brush_ids, as a copy: add and remove through add_brush() and remove_brush().

get_entity_ids()

func get_entity_ids() -> int[]

entity_ids, as a copy; see get_brush_ids().

get_all_object_ids()

func get_all_object_ids() -> int[]

Brush ids followed by entity ids, in a new array. The two id spaces are separate, so a value may appear twice meaning two different things.

contains_brush()

func contains_brush(brush_id: int) -> bool

Check if this instance contains a brush with the given ID.

contains_entity()

func contains_entity(entity_id: int) -> bool

Check if this instance contains an entity with the given ID.

add_brush()

func add_brush(brush_id: int) -> void

Record brush_id as part of this instance, if it is not already. Does not set the brush's own instance_id.

add_entity()

func add_entity(entity_id: int) -> void

Record entity_id as part of this instance, if it is not already. Does not set the entity's own HammeriteEntity.instance_id.

remove_brush()

func remove_brush(brush_id: int) -> void

Forget brush_id. The brush stays in the map.

remove_entity()

func remove_entity(entity_id: int) -> void

Forget entity_id. The entity stays in the map.

is_empty()

func is_empty() -> bool

Check if this instance is empty (no brushes or entities).

get_position()

func get_position() -> Vector3

Get the position component of the transform.

set_position()

func set_position(position: Vector3) -> void

Set transform.origin. Like assigning transform, this moves nothing in the map.

get_basis()

func get_basis() -> Basis

The turn of transform.

set_basis()

func set_basis(basis: Basis) -> void

Set transform.basis. Like assigning transform, this moves nothing in the map.

move_to()

func move_to(map: HammeriteMap, to: Transform3D) -> void

Move the instance to to, taking its brushes and entities in map with it - what assigning transform does not do.

request_delete()

func request_delete() -> void

Ask the owning map to drop this instance by emitting delete_requested. The map removes only the instance record; its brushes and entities stay, still naming it, for the caller to delete or to keep as brushwork of their own.

Hammerite 1.0 · built from a6dd634, 2026-10-10