Skip to main content

IArrayMesh

Trait IArrayMesh 

Source
pub trait IArrayMesh: GodotClass<Base = ArrayMesh> + You_forgot_the_attribute__godot_api {
Show 24 methods // Required methods fn get_surface_count(&self) -> i32; fn surface_get_array_len(&self, index: i32) -> i32; fn surface_get_array_index_len(&self, index: i32) -> i32; fn surface_get_arrays(&self, index: i32) -> AnyArray; fn surface_get_blend_shape_arrays(&self, index: i32) -> Array<AnyArray>; fn surface_get_lods(&self, index: i32) -> AnyDictionary; fn surface_get_format(&self, index: i32) -> u32; fn surface_get_primitive_type(&self, index: i32) -> u32; fn get_blend_shape_count(&self) -> i32; fn get_blend_shape_name(&self, index: i32) -> StringName; fn set_blend_shape_name(&mut self, index: i32, name: StringName); fn get_aabb(&self) -> Aabb; // Provided methods fn init(base: Base<Self::Base>) -> Self { ... } fn on_notification(&mut self, what: ObjectNotification) { ... } fn on_get(&self, property: StringName) -> Option<Variant> { ... } fn on_set(&mut self, property: StringName, value: Variant) -> bool { ... } fn on_validate_property(&self, property: &mut PropertyInfo) { ... } fn on_get_property_list(&mut self) -> Vec<PropertyInfo> { ... } fn on_property_get_revert(&self, property: StringName) -> Option<Variant> { ... } fn to_string(&self) -> GString { ... } fn setup_local_to_scene(&mut self) { ... } fn get_rid(&self) -> Rid { ... } fn reset_state(&mut self) { ... } fn set_path_cache(&self, path: GString) { ... }
}
Expand description

§Interface trait for class ArrayMesh.

Functions in this trait represent constructors (init) or virtual method callbacks invoked by the engine.

Base interfaces: IMesh > IResource > IRefCounted > IObject.

See also Godot docs for ArrayMesh methods.

Required Methods§

Source

fn get_surface_count(&self) -> i32

Virtual method to override the surface count for a custom class extending Mesh.

Source

fn surface_get_array_len(&self, index: i32) -> i32

Virtual method to override the surface array length for a custom class extending Mesh.

Source

fn surface_get_array_index_len(&self, index: i32) -> i32

Virtual method to override the surface array index length for a custom class extending Mesh.

Source

fn surface_get_arrays(&self, index: i32) -> AnyArray

Virtual method to override the surface arrays for a custom class extending Mesh.

Source

fn surface_get_blend_shape_arrays(&self, index: i32) -> Array<AnyArray>

Virtual method to override the blend shape arrays for a custom class extending Mesh.

Source

fn surface_get_lods(&self, index: i32) -> AnyDictionary

Virtual method to override the surface LODs for a custom class extending Mesh.

Source

fn surface_get_format(&self, index: i32) -> u32

Virtual method to override the surface format for a custom class extending Mesh.

Source

fn surface_get_primitive_type(&self, index: i32) -> u32

Virtual method to override the surface primitive type for a custom class extending Mesh.

Source

fn get_blend_shape_count(&self) -> i32

Virtual method to override the number of blend shapes for a custom class extending Mesh.

Source

fn get_blend_shape_name(&self, index: i32) -> StringName

Virtual method to override the retrieval of blend shape names for a custom class extending Mesh.

Source

fn set_blend_shape_name(&mut self, index: i32, name: StringName)

Virtual method to override the names of blend shapes for a custom class extending Mesh.

Source

fn get_aabb(&self) -> Aabb

Virtual method to override the [AABB][crate::builtin::Aabb] for a custom class extending Mesh.

Provided Methods§

Source

fn init(base: Base<Self::Base>) -> Self

Godot constructor, accepting an injected base object.

base refers to the base instance of the class, which can either be stored in a Base<T> field or discarded. This method returns a fully-constructed instance, which will then be moved into a Gd<T> pointer.

If the class has a #[class(init)] attribute, this method will be auto-generated and must not be overridden.

Source

fn on_notification(&mut self, what: ObjectNotification)

Called when the object receives a Godot notification.

The type of notification can be identified through what. The enum is designed to hold all possible NOTIFICATION_* constants that the current class can handle. However, this is not validated in Godot, so an enum variant Unknown exists to represent integers out of known constants (mistakes or future additions).

This method is named _notification in Godot, but on_notification in Rust. To send notifications, use the Object::notify method.

See also in Godot docs:

Source

fn on_get(&self, property: StringName) -> Option<Variant>

Called whenever get() is called or Godot gets the value of a property.

Should return the given property’s value as Some(value), or None if the property should be handled normally.

See also in Godot docs:

Source

fn on_set(&mut self, property: StringName, value: Variant) -> bool

Called whenever Godot set() is called or Godot sets the value of a property.

Should set property to the given value and return true, or return false to indicate the property should be handled normally.

See also in Godot docs:

Source

fn on_validate_property(&self, property: &mut PropertyInfo)

Called whenever Godot retrieves value of property. Allows to customize existing properties. Every property info goes through this method, except properties added with on_get_property_list().

Exposed property here is a shared mutable reference obtained (and returned to) from Godot.

See also in the Godot docs:

Source

fn on_get_property_list(&mut self) -> Vec<PropertyInfo>

Available on since_api=4.3 only.

Called whenever Godot get_property_list() is called, the returned vector here is appended to the existing list of properties.

This should mainly be used for advanced purposes, such as dynamically updating the property list in the editor.

See also in Godot docs:

Source

fn on_property_get_revert(&self, property: StringName) -> Option<Variant>

Called by Godot to tell if a property has a custom revert or not.

Return None for no custom revert, and return Some(value) to specify the custom revert.

This is a combination of Godot’s Object::_property_get_revert and Object::_property_can_revert. This means that this function will usually be called twice by Godot to find the revert.

Note that this should be a pure function. That is, it should always return the same value for a property as long as self remains unchanged. Otherwise, this may lead to unexpected (safe) behavior.

Source

fn to_string(&self) -> GString

String representation of the Godot instance.

Override this method to define how the instance is represented as a string. Used by impl Display for Gd<T>, as well as str() and print() in GDScript.

Source

fn setup_local_to_scene(&mut self)

Override this method to customize the newly duplicated resource created from instantiate, if the original’s [member resource_local_to_scene] is set to true.

Example: Set a random damage value to every local resource from an instantiated scene:

extends Resource

var damage = 0

func _setup_local_to_scene():
	damage = randi_range(10, 40)
Source

fn get_rid(&self) -> Rid

Override this method to return a custom [RID][crate::builtin::Rid] when get_rid is called.

Source

fn reset_state(&mut self)

For resources that store state in non-exported properties, such as via on_validate_property or on_get_property_list, this method must be implemented to clear them.

Source

fn set_path_cache(&self, path: GString)

Override this method to execute additional logic after set_path_cache is called on this object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§