HammeriteBrushPropertySchema
Core: files, names and extension. Inherits RefCounted
A named group of extendable brush properties contributed by an addon.
Hammerite core knows nothing about acoustics, gameplay volumes or anything else a consuming addon might want to hang off a brush. It knows only that a brush can carry authored values, and that SOMEONE has to say which values exist, what they default to, and which brushes they even make sense for. That declaration is a schema. The tier filter is the point of the whole mechanism: in the subtractive world an air brush IS a room, so "which room am I standing in, and what does it sound like" is answerable per air brush and meaningless on the rock around it. A schema that applies only to air therefore shows up in the inspector exactly when a room is selected, and nowhere else. Register with HammeriteBrushPropertyRegistry.register():
var schema := HammeriteBrushPropertySchema.new(&"audio", "Audio")
schema.tier = HammeriteBrushPropertySchema.Tier.AIR
schema.add(&"weather_exposure", "Weather exposure", 0.0).set_range(0.0, 1.0, 0.05)
HammeriteBrushPropertyRegistry.register(schema)
Properties
| Type | Name | Default |
|---|---|---|
StringName | id | &"" |
String | label | "" |
int | tier | 0 |
bool | structural_only | false |
StringName | fill | &"" |
HammeriteBrushPropertyDef[] | defs | [] |
Methods
| Returns | Method |
|---|---|
HammeriteBrushPropertyDef | add(name: StringName, prop_label: String, default) |
HammeriteBrushPropertyDef | add_enum(name: StringName, prop_label: String, options: PackedStringArray, default: int = 0, option_values: PackedInt32Array = PackedInt32Array()) |
StringName | make_key(schema_id: StringName, name: StringName) static |
bool | applies_to(brush: HammeriteBrush) |
HammeriteBrushPropertyDef | get_def(name: StringName) |
Enumerations
enum Tier
| Value | Name | Description |
|---|---|---|
0 | ANY | Every brush, whatever it carves. |
1 | AIR | Air brushes only - i.e. rooms/cells. |
2 | SOLID | Solid brushes only. |
Property descriptions
id
var id: StringName = &""
Namespace for this schema's keys, and its identity in the registry. Registering a second schema with the same id REPLACES the first, so an addon that re-initializes does not accumulate copies.
label
var label: String = ""
Section header shown in the inspector.
tier
var tier: int = 0
Tier filter - see Tier.
structural_only
var structural_only: bool = false
When true, detail brushwork is excluded. Detail is in-cell dressing rather than world structure, so a schema describing a ROOM wants this on: a cabinet is not a space of its own.
fill
var fill: StringName = &""
Restrict this schema to rooms filled with a particular HammeriteBrushFill - what water looks like is a question about water, and asking it of every room in the map is noise. Empty (the default) means the fill is not part of the filter.
defs
var defs: HammeriteBrushPropertyDef[] = []
The properties this schema declares, in display order. Declare them with add(), which a registered schema's registry hears about; one appended here directly is not.
Method descriptions
add()
func add(name: StringName, prop_label: String, default) -> HammeriteBrushPropertyDef
Declare a property. name is un-namespaced; the stored key becomes <id>/<name>. Returns the new HammeriteBrushPropertyDef so hints can be chained onto it.
add_enum()
func add_enum(name: StringName, prop_label: String, options: PackedStringArray, default: int = 0, option_values: PackedInt32Array = PackedInt32Array()) -> HammeriteBrushPropertyDef
Declare an enum property, drawn as a dropdown over options. option_values gives the options stable ids to store rather than their positions; see HammeriteBrushPropertyDef.option_values. Without it the stored value is the index.
make_key()
static func make_key(schema_id: StringName, name: StringName) -> StringName
The namespaced key for name in schema schema_id.
applies_to()
func applies_to(brush: HammeriteBrush) -> bool
Does this schema's tier filter admit brush?
get_def()
func get_def(name: StringName) -> HammeriteBrushPropertyDef
The def for un-namespaced name, or null.