Struct PropertyInfo
pub struct PropertyInfo {
pub variant_type: VariantType,
pub class_name: ClassName,
pub property_name: StringName,
pub hint_info: PropertyHintInfo,
pub usage: PropertyUsageFlags,
}
Expand description
Describes a property in Godot.
Abstraction of the low-level sys::GDExtensionPropertyInfo
.
Keeps the actual allocated values (the sys
equivalent only keeps pointers, which fall out of scope).
Fields§
§variant_type: VariantType
Which type this property has.
For objects this should be set to VariantType::OBJECT
, and the class_name
field to the actual name of the class.
For Variant
, this should be set to VariantType::NIL
.
class_name: ClassName
Which class this property is.
This should be set to ClassName::none()
unless the variant type is Object
. You can use
GodotClass::class_name()
to get the right name to use here.
property_name: StringName
The name of this property in Godot.
hint_info: PropertyHintInfo
Additional type information for this property, e.g. about array types or enum values. Split into hint
and hint_string
members.
See also PropertyHint
in the Godot docs.
usage: PropertyUsageFlags
How this property should be used. See PropertyUsageFlags
in Godot for the meaning.
Implementations§
§impl PropertyInfo
impl PropertyInfo
pub fn new_var<T>(property_name: &str) -> PropertyInfowhere
T: Var,
pub fn new_var<T>(property_name: &str) -> PropertyInfowhere
T: Var,
Create a new PropertyInfo
representing a property named property_name
with type T
.
This will generate property info equivalent to what a #[var]
attribute would.
pub fn new_export<T>(property_name: &str) -> PropertyInfowhere
T: Export,
pub fn new_export<T>(property_name: &str) -> PropertyInfowhere
T: Export,
Create a new PropertyInfo
representing an exported property named property_name
with type T
.
This will generate property info equivalent to what an #[export]
attribute would.
pub fn with_hint_info(self, hint_info: PropertyHintInfo) -> PropertyInfo
pub fn with_hint_info(self, hint_info: PropertyHintInfo) -> PropertyInfo
Change the hint
and hint_string
to be the given hint_info
.
See export_info_functions
for functions that return appropriate PropertyHintInfo
s for
various Godot annotations.
§Examples
Creating an @export_range
property.
use godot::register::property::export_info_functions;
use godot::meta::PropertyInfo;
let property = PropertyInfo::new_export::<f64>("my_range_property")
.with_hint_info(export_info_functions::export_range(
0.0,
10.0,
Some(0.1),
false,
false,
false,
false,
false,
false,
Some("mm".to_string()),
));
pub fn new_group(group_name: &str, group_prefix: &str) -> PropertyInfo
pub fn new_group(group_name: &str, group_prefix: &str) -> PropertyInfo
Create a new PropertyInfo
representing a group in Godot.
See EditorInspector
in Godot for
more information.
pub fn new_subgroup(subgroup_name: &str, subgroup_prefix: &str) -> PropertyInfo
pub fn new_subgroup(subgroup_name: &str, subgroup_prefix: &str) -> PropertyInfo
Create a new PropertyInfo
representing a subgroup in Godot.
See EditorInspector
in Godot for
more information.
pub fn property_sys(&self) -> GDExtensionPropertyInfo
pub fn property_sys(&self) -> GDExtensionPropertyInfo
Converts to the FFI type. Keep this object allocated while using that!
pub fn empty_sys() -> GDExtensionPropertyInfo
Trait Implementations§
§impl Clone for PropertyInfo
impl Clone for PropertyInfo
§fn clone(&self) -> PropertyInfo
fn clone(&self) -> PropertyInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more