Properties#
The value type of properties and attributes.
Any value that is convertible to a
PropertyField.
This class defines a property (similar to Python built-in properties), i.e., a pair of getter and setter. In addition, it holds (for auto- documentation) a default value, a description, and the name of the involved types. A property has a value of type
PropertyField, which is one ofbool,int,float,string,Vector2or a collection (a vector in C++, a list in Python) thereof. Properties are used to configure sub-classes ofHasPropertieswhen using bindings like YAML or Python. Properties values are accessed using the methods exposed byHasProperties.Constructs a navground property from a Python property.
- Parameters:
property (
property) – The Python propertydefault (
navground.core.PropertyField) – The default value (should be convertible to the property type)type_name (str) – The property type name
description (str) – Optional description
schema (
collections.abc.Callable[[navground.core.schema.Schema], None]) – Optional schema modifierdeprecated_names (list[str]) – A list of deprecated names for this property
Create a value of the desired type.
- Parameters:
type_name – The type name
- Returns:
A value or null is the type name is not valid.
- Type:
The property default value, i.e., the value of the property when the object is initialized.
- Type:
A textual description of the property, used for auto documentation.
- Type:
The name of the property-owner type.
- Type:
Whether the property is readonly
- Type:
The name of the property value type, used for auto documentation.
This class defines set and get methods to access named
Property“properties”.Gets the value of the specified property.
- Parameters:
name – The name of the property
- Raise:
RuntimeError A runtime error if no property is found.
- Returns:
The value of the property
Gets the type of a property.
- Parameters:
name – The name of the property
- Returns:
The property type name or an empty string if the property is not defined.
Checks whether a property exists.
- Parameters:
name – The name of the property
- Returns:
True if the property exists
Set the value of a named property. Fails silently if no property can be found or if the value has a non-compatible type.
- Parameters:
name – The name of the property
value – The desired value for the property