Struct PropertyInfo
pub struct PropertyInfo {
pub variant_type: VariantType,
pub class_id: ClassId,
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: VariantTypeWhich 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_id: ClassIdWhich class this property is.
This should be set to ClassId::none() unless the variant type is Object. You can use
GodotClass::class_id() to get the right name to use here.
property_name: StringNameThe name of this property in Godot.
hint_info: PropertyHintInfoAdditional 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: PropertyUsageFlagsHow 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 PropertyHintInfos 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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PropertyInfo
impl RefUnwindSafe for PropertyInfo
impl Send for PropertyInfo
impl !Sync for PropertyInfo
impl Unpin for PropertyInfo
impl UnwindSafe for PropertyInfo
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)