simvx.core.properties¶
Typed Property subclasses for editor-visible values.
These subclasses extend :class:simvx.core.descriptors.Property with type-specific
metadata so the editor can dispatch the correct widget without relying on name
heuristics or tuple-shape guessing. Stored values remain primitive (str, int,
tuple) so scene serialisation is unaffected.
The five subclasses are:
- class:
Colour– RGB/RGBA tuple with optional alpha channel. Also carries a palette of named colour constants (Colour.REDetc.) and factory helpers (Colour.hex,Colour.rgba,Colour.from_rgb255).
- class:
FilePath– File / resource path with filter and relative base.
- class:
Multiline– Multi-line string with optional syntax hint.
- class:
Bitmask– N-bit integer with optional per-bit names.
- class:
NodePath– Scene-relative node path with optional type filter.
All five accept the existing hint=, group=, on_change=, link=,
propagate= kwargs exactly like :class:Property.
Module Contents¶
Classes¶
Functions¶
Return |
|
Return whether bit |
Data¶
API¶
- simvx.core.properties.set_mask_bit(value: int, index: int, enabled: bool, *, label: str = 'Layer') int[source]¶
Return
valuewith bitindex(0-31) set or cleared perenabled.Shared by the engine’s render-layer / cull-mask toggles.
labelnames the field in the range-check error message.
- simvx.core.properties.get_mask_bit(value: int, index: int, *, label: str = 'Layer') bool[source]¶
Return whether bit
index(0-31) is set invalue.
- class simvx.core.properties.Colour(default: tuple = (1.0, 1.0, 1.0, 1.0), *, has_alpha: bool = True, **kwargs)[source]¶
Bases:
simvx.core.descriptors.PropertyRGB or RGBA colour property (tuple of floats in [0, 1]).
Also exposes a palette of common colour constants and hex/rgba factory helpers for use anywhere an RGBA tuple is expected.
Example as a Property::
class Light(Node3D): tint = Colour((1.0, 0.5, 0.0, 1.0)) ambient = Colour((0.1, 0.1, 0.15), has_alpha=False)Example as a palette::
panel.bg_colour = Colour.RED label.text_colour = Colour.hex("#FF6600") button.bg_colour = Colour.rgba(0.2, 0.4, 0.8)Assigning
Noneto a :class:ColourProperty reverts the value to the descriptor’s declared default (mirroring :class:ThemeColour’s “no override” semantics). Widget setters that acceptColour.coerceoutput (Panel.bg_colouretc.) treatNoneas “use the theme default”.A stored value always has the arity the property declares, so downstream code can unpack it. An RGB value assigned to an RGBA property gains an opaque alpha, and an opaque RGBA value assigned to an RGB property drops it, which is why the palette constants (all RGBA) work on an alpha-less property. A translucent RGBA value assigned to an RGB property raises: that alpha is real data and silently discarding it would render the wrong thing.
Initialization
Create an editor-visible property descriptor.
Args: default: Default value for the property. Mutually exclusive with
default_factory. Mutable containers (list,dict,set,bytearray) are rejected here because a single shared instance would alias across every owning object: passdefault_factoryinstead. default_factory: Zero-arg callable invoked the first time each instance reads the property. The result is cached on the instance, matchingfunctools.cached_propertyanddataclasses.field(default_factory=...)semantics. range: Optional (min, max) tuple for numeric values. By default (clamp=True) assignments are hard-clamped into[min, max], which doubles as input validation (audio safety, save-load sanitisation, [0,1] enforcement rely on this). Withclamp=Falsethe range is a soft hint: it sets the editor inspector field’s default bounds (which stretch to cover a value outside them), and assigned values pass through unclamped. Useclamp=Falsefor physical magnitudes whose range is a suggestion, not a limit (e.g. particlespeedin pixels/sec). enum: Optional list of allowed values. coerce: Optional single-argument callable that converts an incoming value into the form the property stores. It runs FIRST, before every other check: coerce, thenscalarrejection, thenrangeclamping, thenenummembership, then the change-detection andon_changemachinery. Everything downstream therefore sees the converted value. The declareddefaultis converted once at class-definition time so reads of an unwritten property return the canonical form too (default_factoryresults are used verbatim). Passing anEnumtype is the common case:coerce=BodyModelets callers writemode="static"while the node storesBodyMode.STATIC, so identity comparisons downstream hold. A value the callable rejects raisesValueErrornaming the owning class, the property and the accepted values. A property whosedefaultis anEnummember coerces to that member’s type without being asked, so every enum-valued property stores members rather than the bare strings or ints they wrap. Passcoerceexplicitly to override that. hint: Description shown in the editor inspector. link: When True, child values are offset from the parent’s value. propagate: When True, bool/enum Settings inherit disabling values from parents. group: Inspector section name for grouping. Empty string = default “Properties” section. on_change: Name of a bound method to invoke on the owning instance after a successful value change (i.e. when the new value differs from the old). Hooks fired during__init__are deferred until__init__returns, then dispatched once each (deduplicated by(property, hook)pair) so the hook always sees a fully constructed object. After construction, hooks fire synchronously inside__set__(unlesscoalesce=True: see below). coalesce: WhenTrueandon_changeis set, post-init hook calls fire at most once per scene-tree frame. Multiple writes within one tick collapse to a single deferred call drained at the end of :meth:SceneTree.tick: useful for expensive handlers like HUD rasterisation that don’t care about intermediate values (Tower Defence:coins -= 1repeated five times in one frame rasterised the HUD text five times). The owning object must be attached to a SceneTree (obj._treeset); for tree-less owners the flag is ignored and hooks fire synchronously. persist: When True, the value is included inSaveManagersnapshots. save_version: Optional integer schema version recorded alongside the persisted value. clamp: When True (default) a numericrangehard-clamps every assignment into bounds (validation). When False therangeis an editor-field hint only and out-of-range values are accepted verbatim, both on assignment and in the inspector. Has no effect whenrangeis None. It does not relax the type: a ranged property converts its value to a builtin number and refuses NaN under either setting, because NaN is not a magnitude that a looser bound could accommodate. scalar: When True, reject array-like values (numpy ndarray with ndim >= 1, Vec2/Vec3, list, tuple, dict, set) at assignment with a clearTypeError. Plain Python numbers, numpy scalar types (np.float32,np.int64etc.), and 0-d numpy arrays are accepted. Use for properties that semantically represent a single number (e.g.Camera2D.zoom) so a strayVec2doesn’t leak into downstream math and produce visual glitches.- WHITE¶
(1.0, 1.0, 1.0, 1.0)
- BLACK¶
(0.0, 0.0, 0.0, 1.0)
- RED¶
(1.0, 0.0, 0.0, 1.0)
- GREEN¶
(0.0, 1.0, 0.0, 1.0)
- BLUE¶
(0.0, 0.0, 1.0, 1.0)
- YELLOW¶
(1.0, 1.0, 0.0, 1.0)
- CYAN¶
(0.0, 1.0, 1.0, 1.0)
- MAGENTA¶
(1.0, 0.0, 1.0, 1.0)
- TRANSPARENT¶
(0.0, 0.0, 0.0, 0.0)
- GRAY¶
(0.5, 0.5, 0.5, 1.0)
- DARK_GRAY¶
(0.2, 0.2, 0.2, 1.0)
- LIGHT_GRAY¶
(0.75, 0.75, 0.75, 1.0)
- ORANGE¶
(1.0, 0.6, 0.0, 1.0)
- PURPLE¶
(0.6, 0.2, 0.8, 1.0)
- PINK¶
(1.0, 0.4, 0.7, 1.0)
- __slots__¶
(‘has_alpha’,)
- static coerce(value, *, name: str = 'colour', has_alpha: bool = True) tuple[float, ...] | None[source]¶
Coerce a colour-ish value to a float tuple of the requested arity, or
None.Accepts:
None– sentinel meaning “no override, use the theme default”. Returned asNoneso callers can fall back to a theme-resolved colour. Raw draw callsites that cannot tolerateNonemust check the result and either resolve it or raise loudly.tuple/listof 3 or 4 numeric componentsa :class:
ColourProperty instance (uses itsdefaulttuple)
has_alphaselects the arity of the result: RGBA by default, RGB whenFalse. An RGB input is widened with an opaque alpha, and an opaque RGBA input is narrowed by dropping it. A translucent RGBA input cannot be narrowed and raises instead.Raises
TypeError/ValueErrorfor anything else.
- static hex(h: str) tuple[float, float, float, float][source]¶
Parse hex colour string
'#RRGGBB'/'#RRGGBBAA'into RGBA tuple.
- static rgba(r: float, g: float, b: float, a: float = 1.0) tuple[float, float, float, float][source]¶
Create colour from float components (0.0-1.0).
- static from_rgb255(r: int, g: int, b: int, a: int = 255) tuple[float, float, float, float][source]¶
Create colour from 0-255 integer components (alpha defaults to 255 = opaque).
Returns a canonical 0-1 RGBA float tuple. This is the designer-ergonomic entry point for callers who think in 0-255: the rest of the engine speaks float 0-1 (HDR-ready, shader-native).
- storage_backed: bool¶
True
- __new__(*args, coerce: collections.abc.Callable[[Any], Any] | None = None, **kwargs)¶
- __set_name__(owner, name)¶
- __get__(obj, objtype=None)¶
- get_raw(obj)¶
- set_raw(obj, value) None¶
- try_decrement(obj, amount: float | int) bool¶
- __repr__()¶
- class simvx.core.properties.FilePath(default: str = '', *, filter: str = '*.*', relative_to: str | None = None, **kwargs)[source]¶
Bases:
simvx.core.descriptors.PropertyFile / resource path property.
Example::
icon = FilePath("", filter="*.png;*.jpg")Initialization
Create an editor-visible property descriptor.
Args: default: Default value for the property. Mutually exclusive with
default_factory. Mutable containers (list,dict,set,bytearray) are rejected here because a single shared instance would alias across every owning object: passdefault_factoryinstead. default_factory: Zero-arg callable invoked the first time each instance reads the property. The result is cached on the instance, matchingfunctools.cached_propertyanddataclasses.field(default_factory=...)semantics. range: Optional (min, max) tuple for numeric values. By default (clamp=True) assignments are hard-clamped into[min, max], which doubles as input validation (audio safety, save-load sanitisation, [0,1] enforcement rely on this). Withclamp=Falsethe range is a soft hint: it sets the editor inspector field’s default bounds (which stretch to cover a value outside them), and assigned values pass through unclamped. Useclamp=Falsefor physical magnitudes whose range is a suggestion, not a limit (e.g. particlespeedin pixels/sec). enum: Optional list of allowed values. coerce: Optional single-argument callable that converts an incoming value into the form the property stores. It runs FIRST, before every other check: coerce, thenscalarrejection, thenrangeclamping, thenenummembership, then the change-detection andon_changemachinery. Everything downstream therefore sees the converted value. The declareddefaultis converted once at class-definition time so reads of an unwritten property return the canonical form too (default_factoryresults are used verbatim). Passing anEnumtype is the common case:coerce=BodyModelets callers writemode="static"while the node storesBodyMode.STATIC, so identity comparisons downstream hold. A value the callable rejects raisesValueErrornaming the owning class, the property and the accepted values. A property whosedefaultis anEnummember coerces to that member’s type without being asked, so every enum-valued property stores members rather than the bare strings or ints they wrap. Passcoerceexplicitly to override that. hint: Description shown in the editor inspector. link: When True, child values are offset from the parent’s value. propagate: When True, bool/enum Settings inherit disabling values from parents. group: Inspector section name for grouping. Empty string = default “Properties” section. on_change: Name of a bound method to invoke on the owning instance after a successful value change (i.e. when the new value differs from the old). Hooks fired during__init__are deferred until__init__returns, then dispatched once each (deduplicated by(property, hook)pair) so the hook always sees a fully constructed object. After construction, hooks fire synchronously inside__set__(unlesscoalesce=True: see below). coalesce: WhenTrueandon_changeis set, post-init hook calls fire at most once per scene-tree frame. Multiple writes within one tick collapse to a single deferred call drained at the end of :meth:SceneTree.tick: useful for expensive handlers like HUD rasterisation that don’t care about intermediate values (Tower Defence:coins -= 1repeated five times in one frame rasterised the HUD text five times). The owning object must be attached to a SceneTree (obj._treeset); for tree-less owners the flag is ignored and hooks fire synchronously. persist: When True, the value is included inSaveManagersnapshots. save_version: Optional integer schema version recorded alongside the persisted value. clamp: When True (default) a numericrangehard-clamps every assignment into bounds (validation). When False therangeis an editor-field hint only and out-of-range values are accepted verbatim, both on assignment and in the inspector. Has no effect whenrangeis None. It does not relax the type: a ranged property converts its value to a builtin number and refuses NaN under either setting, because NaN is not a magnitude that a looser bound could accommodate. scalar: When True, reject array-like values (numpy ndarray with ndim >= 1, Vec2/Vec3, list, tuple, dict, set) at assignment with a clearTypeError. Plain Python numbers, numpy scalar types (np.float32,np.int64etc.), and 0-d numpy arrays are accepted. Use for properties that semantically represent a single number (e.g.Camera2D.zoom) so a strayVec2doesn’t leak into downstream math and produce visual glitches.- __slots__¶
(‘filter’, ‘relative_to’)
- coerce: collections.abc.Callable[[Any], Any]¶
None
- storage_backed: bool¶
True
- __new__(*args, coerce: collections.abc.Callable[[Any], Any] | None = None, **kwargs)¶
- __set_name__(owner, name)¶
- __get__(obj, objtype=None)¶
- get_raw(obj)¶
- set_raw(obj, value) None¶
- try_decrement(obj, amount: float | int) bool¶
- __repr__()¶
- class simvx.core.properties.Multiline(default: str = '', *, min_lines: int = 3, syntax: str | None = None, **kwargs)[source]¶
Bases:
simvx.core.descriptors.PropertyMulti-line string property with optional syntax hint.
When
syntax='python'the editor uses its code editor widget; otherwise it uses the plain multi-line text editor.Example::
description = Multiline("", min_lines=4) script_body = Multiline("", syntax="python")Initialization
Create an editor-visible property descriptor.
Args: default: Default value for the property. Mutually exclusive with
default_factory. Mutable containers (list,dict,set,bytearray) are rejected here because a single shared instance would alias across every owning object: passdefault_factoryinstead. default_factory: Zero-arg callable invoked the first time each instance reads the property. The result is cached on the instance, matchingfunctools.cached_propertyanddataclasses.field(default_factory=...)semantics. range: Optional (min, max) tuple for numeric values. By default (clamp=True) assignments are hard-clamped into[min, max], which doubles as input validation (audio safety, save-load sanitisation, [0,1] enforcement rely on this). Withclamp=Falsethe range is a soft hint: it sets the editor inspector field’s default bounds (which stretch to cover a value outside them), and assigned values pass through unclamped. Useclamp=Falsefor physical magnitudes whose range is a suggestion, not a limit (e.g. particlespeedin pixels/sec). enum: Optional list of allowed values. coerce: Optional single-argument callable that converts an incoming value into the form the property stores. It runs FIRST, before every other check: coerce, thenscalarrejection, thenrangeclamping, thenenummembership, then the change-detection andon_changemachinery. Everything downstream therefore sees the converted value. The declareddefaultis converted once at class-definition time so reads of an unwritten property return the canonical form too (default_factoryresults are used verbatim). Passing anEnumtype is the common case:coerce=BodyModelets callers writemode="static"while the node storesBodyMode.STATIC, so identity comparisons downstream hold. A value the callable rejects raisesValueErrornaming the owning class, the property and the accepted values. A property whosedefaultis anEnummember coerces to that member’s type without being asked, so every enum-valued property stores members rather than the bare strings or ints they wrap. Passcoerceexplicitly to override that. hint: Description shown in the editor inspector. link: When True, child values are offset from the parent’s value. propagate: When True, bool/enum Settings inherit disabling values from parents. group: Inspector section name for grouping. Empty string = default “Properties” section. on_change: Name of a bound method to invoke on the owning instance after a successful value change (i.e. when the new value differs from the old). Hooks fired during__init__are deferred until__init__returns, then dispatched once each (deduplicated by(property, hook)pair) so the hook always sees a fully constructed object. After construction, hooks fire synchronously inside__set__(unlesscoalesce=True: see below). coalesce: WhenTrueandon_changeis set, post-init hook calls fire at most once per scene-tree frame. Multiple writes within one tick collapse to a single deferred call drained at the end of :meth:SceneTree.tick: useful for expensive handlers like HUD rasterisation that don’t care about intermediate values (Tower Defence:coins -= 1repeated five times in one frame rasterised the HUD text five times). The owning object must be attached to a SceneTree (obj._treeset); for tree-less owners the flag is ignored and hooks fire synchronously. persist: When True, the value is included inSaveManagersnapshots. save_version: Optional integer schema version recorded alongside the persisted value. clamp: When True (default) a numericrangehard-clamps every assignment into bounds (validation). When False therangeis an editor-field hint only and out-of-range values are accepted verbatim, both on assignment and in the inspector. Has no effect whenrangeis None. It does not relax the type: a ranged property converts its value to a builtin number and refuses NaN under either setting, because NaN is not a magnitude that a looser bound could accommodate. scalar: When True, reject array-like values (numpy ndarray with ndim >= 1, Vec2/Vec3, list, tuple, dict, set) at assignment with a clearTypeError. Plain Python numbers, numpy scalar types (np.float32,np.int64etc.), and 0-d numpy arrays are accepted. Use for properties that semantically represent a single number (e.g.Camera2D.zoom) so a strayVec2doesn’t leak into downstream math and produce visual glitches.- __slots__¶
(‘min_lines’, ‘syntax’)
- coerce: collections.abc.Callable[[Any], Any]¶
None
- storage_backed: bool¶
True
- __new__(*args, coerce: collections.abc.Callable[[Any], Any] | None = None, **kwargs)¶
- __set_name__(owner, name)¶
- __get__(obj, objtype=None)¶
- get_raw(obj)¶
- set_raw(obj, value) None¶
- try_decrement(obj, amount: float | int) bool¶
- __repr__()¶
- class simvx.core.properties.Bitmask(default: int = 0, *, bits: int = 32, names: list[str] | None = None, **kwargs)[source]¶
Bases:
simvx.core.descriptors.PropertyBit flag integer property with optional per-bit names.
Stores an ordinary int. The editor renders a grid of
bitstoggles arranged asbits // 8rows of 8.Example::
collision_layer = Bitmask(1, bits=32, group="Collision")
Initialization
Create an editor-visible property descriptor.
Args: default: Default value for the property. Mutually exclusive with
default_factory. Mutable containers (list,dict,set,bytearray) are rejected here because a single shared instance would alias across every owning object: passdefault_factoryinstead. default_factory: Zero-arg callable invoked the first time each instance reads the property. The result is cached on the instance, matchingfunctools.cached_propertyanddataclasses.field(default_factory=...)semantics. range: Optional (min, max) tuple for numeric values. By default (clamp=True) assignments are hard-clamped into[min, max], which doubles as input validation (audio safety, save-load sanitisation, [0,1] enforcement rely on this). Withclamp=Falsethe range is a soft hint: it sets the editor inspector field’s default bounds (which stretch to cover a value outside them), and assigned values pass through unclamped. Useclamp=Falsefor physical magnitudes whose range is a suggestion, not a limit (e.g. particlespeedin pixels/sec). enum: Optional list of allowed values. coerce: Optional single-argument callable that converts an incoming value into the form the property stores. It runs FIRST, before every other check: coerce, thenscalarrejection, thenrangeclamping, thenenummembership, then the change-detection andon_changemachinery. Everything downstream therefore sees the converted value. The declareddefaultis converted once at class-definition time so reads of an unwritten property return the canonical form too (default_factoryresults are used verbatim). Passing anEnumtype is the common case:coerce=BodyModelets callers writemode="static"while the node storesBodyMode.STATIC, so identity comparisons downstream hold. A value the callable rejects raisesValueErrornaming the owning class, the property and the accepted values. A property whosedefaultis anEnummember coerces to that member’s type without being asked, so every enum-valued property stores members rather than the bare strings or ints they wrap. Passcoerceexplicitly to override that. hint: Description shown in the editor inspector. link: When True, child values are offset from the parent’s value. propagate: When True, bool/enum Settings inherit disabling values from parents. group: Inspector section name for grouping. Empty string = default “Properties” section. on_change: Name of a bound method to invoke on the owning instance after a successful value change (i.e. when the new value differs from the old). Hooks fired during__init__are deferred until__init__returns, then dispatched once each (deduplicated by(property, hook)pair) so the hook always sees a fully constructed object. After construction, hooks fire synchronously inside__set__(unlesscoalesce=True: see below). coalesce: WhenTrueandon_changeis set, post-init hook calls fire at most once per scene-tree frame. Multiple writes within one tick collapse to a single deferred call drained at the end of :meth:SceneTree.tick: useful for expensive handlers like HUD rasterisation that don’t care about intermediate values (Tower Defence:coins -= 1repeated five times in one frame rasterised the HUD text five times). The owning object must be attached to a SceneTree (obj._treeset); for tree-less owners the flag is ignored and hooks fire synchronously. persist: When True, the value is included inSaveManagersnapshots. save_version: Optional integer schema version recorded alongside the persisted value. clamp: When True (default) a numericrangehard-clamps every assignment into bounds (validation). When False therangeis an editor-field hint only and out-of-range values are accepted verbatim, both on assignment and in the inspector. Has no effect whenrangeis None. It does not relax the type: a ranged property converts its value to a builtin number and refuses NaN under either setting, because NaN is not a magnitude that a looser bound could accommodate. scalar: When True, reject array-like values (numpy ndarray with ndim >= 1, Vec2/Vec3, list, tuple, dict, set) at assignment with a clearTypeError. Plain Python numbers, numpy scalar types (np.float32,np.int64etc.), and 0-d numpy arrays are accepted. Use for properties that semantically represent a single number (e.g.Camera2D.zoom) so a strayVec2doesn’t leak into downstream math and produce visual glitches.- __slots__¶
(‘bits’, ‘names’)
- coerce: collections.abc.Callable[[Any], Any]¶
None
- storage_backed: bool¶
True
- __new__(*args, coerce: collections.abc.Callable[[Any], Any] | None = None, **kwargs)¶
- __set_name__(owner, name)¶
- __get__(obj, objtype=None)¶
- get_raw(obj)¶
- set_raw(obj, value) None¶
- try_decrement(obj, amount: float | int) bool¶
- __repr__()¶
- class simvx.core.properties.NodePath(default: str = '', *, type_filter: type | None = None, **kwargs)[source]¶
Bases:
simvx.core.descriptors.PropertyScene-relative node path property.
Stores a path string (e.g.
"../Camera2D").type_filteris an optional Node subclass used by the editor picker to grey out nodes that would be invalid targets.Example::
remote_path = NodePath("", type_filter=Node2D)Initialization
Create an editor-visible property descriptor.
Args: default: Default value for the property. Mutually exclusive with
default_factory. Mutable containers (list,dict,set,bytearray) are rejected here because a single shared instance would alias across every owning object: passdefault_factoryinstead. default_factory: Zero-arg callable invoked the first time each instance reads the property. The result is cached on the instance, matchingfunctools.cached_propertyanddataclasses.field(default_factory=...)semantics. range: Optional (min, max) tuple for numeric values. By default (clamp=True) assignments are hard-clamped into[min, max], which doubles as input validation (audio safety, save-load sanitisation, [0,1] enforcement rely on this). Withclamp=Falsethe range is a soft hint: it sets the editor inspector field’s default bounds (which stretch to cover a value outside them), and assigned values pass through unclamped. Useclamp=Falsefor physical magnitudes whose range is a suggestion, not a limit (e.g. particlespeedin pixels/sec). enum: Optional list of allowed values. coerce: Optional single-argument callable that converts an incoming value into the form the property stores. It runs FIRST, before every other check: coerce, thenscalarrejection, thenrangeclamping, thenenummembership, then the change-detection andon_changemachinery. Everything downstream therefore sees the converted value. The declareddefaultis converted once at class-definition time so reads of an unwritten property return the canonical form too (default_factoryresults are used verbatim). Passing anEnumtype is the common case:coerce=BodyModelets callers writemode="static"while the node storesBodyMode.STATIC, so identity comparisons downstream hold. A value the callable rejects raisesValueErrornaming the owning class, the property and the accepted values. A property whosedefaultis anEnummember coerces to that member’s type without being asked, so every enum-valued property stores members rather than the bare strings or ints they wrap. Passcoerceexplicitly to override that. hint: Description shown in the editor inspector. link: When True, child values are offset from the parent’s value. propagate: When True, bool/enum Settings inherit disabling values from parents. group: Inspector section name for grouping. Empty string = default “Properties” section. on_change: Name of a bound method to invoke on the owning instance after a successful value change (i.e. when the new value differs from the old). Hooks fired during__init__are deferred until__init__returns, then dispatched once each (deduplicated by(property, hook)pair) so the hook always sees a fully constructed object. After construction, hooks fire synchronously inside__set__(unlesscoalesce=True: see below). coalesce: WhenTrueandon_changeis set, post-init hook calls fire at most once per scene-tree frame. Multiple writes within one tick collapse to a single deferred call drained at the end of :meth:SceneTree.tick: useful for expensive handlers like HUD rasterisation that don’t care about intermediate values (Tower Defence:coins -= 1repeated five times in one frame rasterised the HUD text five times). The owning object must be attached to a SceneTree (obj._treeset); for tree-less owners the flag is ignored and hooks fire synchronously. persist: When True, the value is included inSaveManagersnapshots. save_version: Optional integer schema version recorded alongside the persisted value. clamp: When True (default) a numericrangehard-clamps every assignment into bounds (validation). When False therangeis an editor-field hint only and out-of-range values are accepted verbatim, both on assignment and in the inspector. Has no effect whenrangeis None. It does not relax the type: a ranged property converts its value to a builtin number and refuses NaN under either setting, because NaN is not a magnitude that a looser bound could accommodate. scalar: When True, reject array-like values (numpy ndarray with ndim >= 1, Vec2/Vec3, list, tuple, dict, set) at assignment with a clearTypeError. Plain Python numbers, numpy scalar types (np.float32,np.int64etc.), and 0-d numpy arrays are accepted. Use for properties that semantically represent a single number (e.g.Camera2D.zoom) so a strayVec2doesn’t leak into downstream math and produce visual glitches.- __slots__¶
(‘type_filter’,)
- coerce: collections.abc.Callable[[Any], Any]¶
None
- storage_backed: bool¶
True
- __new__(*args, coerce: collections.abc.Callable[[Any], Any] | None = None, **kwargs)¶
- __set_name__(owner, name)¶
- __get__(obj, objtype=None)¶
- get_raw(obj)¶
- set_raw(obj, value) None¶
- try_decrement(obj, amount: float | int) bool¶
- __repr__()¶
- simvx.core.properties.__all__¶
[‘Bitmask’, ‘Colour’, ‘FilePath’, ‘Multiline’, ‘NodePath’, ‘get_mask_bit’, ‘set_mask_bit’]