[][src]Struct gdnative::api::NavigationPolygon

pub struct NavigationPolygon { /* fields omitted */ }

core class NavigationPolygon inherits Resource (reference counted).

Official documentation

See the documentation of this class in the Godot engine's official documentation.

Memory management

The lifetime of this object is automatically managed through reference counting.

Class hierarchy

NavigationPolygon inherits methods from:

Safety

All types in the Godot API have "interior mutability" in Rust parlance. To enforce that the official thread-safety guidelines are followed, the typestate pattern is used in the Ref and TRef smart pointers, and the Instance API. The typestate Access in these types tracks whether the access is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations

impl NavigationPolygon[src]

pub fn new() -> Ref<NavigationPolygon, Unique>[src]

Creates a new instance of this object.

This is a reference-counted type. The returned object is automatically managed by Ref.

pub fn add_outline(&self, outline: TypedArray<Vector2D<f32, UnknownUnit>>)[src]

Appends a [PoolVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines. You have to call [method make_polygons_from_outlines] in order for this array to be converted to polygons that the engine will use.

pub fn add_outline_at_index(
    &self,
    outline: TypedArray<Vector2D<f32, UnknownUnit>>,
    index: i64
)
[src]

Adds a [PoolVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position. You have to call [method make_polygons_from_outlines] in order for this array to be converted to polygons that the engine will use.

pub fn add_polygon(&self, polygon: TypedArray<i32>)[src]

Adds a polygon using the indices of the vertices you get when calling [method get_vertices].

pub fn clear_outlines(&self)[src]

Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them.

pub fn clear_polygons(&self)[src]

Clears the array of polygons, but it doesn't clear the array of outlines and vertices.

pub fn get_outline(&self, idx: i64) -> TypedArray<Vector2D<f32, UnknownUnit>>[src]

Returns a [PoolVector2Array] containing the vertices of an outline that was created in the editor or by script.

pub fn get_outline_count(&self) -> i64[src]

Returns the number of outlines that were created in the editor or by script.

pub fn get_polygon(&self, idx: i64) -> TypedArray<i32>[src]

Returns a [PoolIntArray] containing the indices of the vertices of a created polygon.

pub fn get_polygon_count(&self) -> i64[src]

Returns the count of all polygons.

pub fn vertices(&self) -> TypedArray<Vector2D<f32, UnknownUnit>>[src]

Returns a [PoolVector2Array] containing all the vertices being used to create the polygons.

pub fn make_polygons_from_outlines(&self)[src]

Creates polygons from the outlines added in the editor or by script.

pub fn remove_outline(&self, idx: i64)[src]

Removes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.

pub fn set_outline(
    &self,
    idx: i64,
    outline: TypedArray<Vector2D<f32, UnknownUnit>>
)
[src]

Changes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.

pub fn set_vertices(&self, vertices: TypedArray<Vector2D<f32, UnknownUnit>>)[src]

Sets the vertices that can be then indexed to create polygons with the [method add_polygon] method.

Methods from Deref<Target = Resource>

pub fn duplicate(&self, subresources: bool) -> Option<Ref<Resource, Shared>>[src]

Duplicates the resource, returning a new resource. By default, sub-resources are shared between resource copies for efficiency. This can be changed by passing [code]true[/code] to the [code]subresources[/code] argument which will copy the subresources.
				[b]Note:[/b] If [code]subresources[/code] is [code]true[/code], this method will only perform a shallow copy. Nested resources within subresources will not be duplicated and will still be shared.

Default Arguments

  • subresources - false

pub fn get_local_scene(&self) -> Option<Ref<Node, Shared>>[src]

If [member resource_local_to_scene] is enabled and the resource was loaded from a [PackedScene] instantiation, returns the local scene where this resource's unique copy is in use. Otherwise, returns [code]null[/code].

pub fn name(&self) -> GodotString[src]

The name of the resource. This is an optional identifier.

pub fn path(&self) -> GodotString[src]

The path to the resource. In case it has its own file, it will return its filepath. If it's tied to the scene, it will return the scene's path, followed by the resource's index.

pub fn get_rid(&self) -> Rid[src]

Returns the RID of the resource (or an empty RID). Many resources (such as [Texture], [Mesh], etc) are high-level abstractions of resources stored in a server, so this function will return the original RID.

pub fn is_local_to_scene(&self) -> bool[src]

If [code]true[/code], the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.

pub fn set_local_to_scene(&self, enable: bool)[src]

If [code]true[/code], the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.

pub fn set_name(&self, name: impl Into<GodotString>)[src]

The name of the resource. This is an optional identifier.

pub fn set_path(&self, path: impl Into<GodotString>)[src]

The path to the resource. In case it has its own file, it will return its filepath. If it's tied to the scene, it will return the scene's path, followed by the resource's index.

pub fn setup_local_to_scene(&self)[src]

This method is called when a resource with [member resource_local_to_scene] enabled is loaded from a [PackedScene] instantiation. Its behavior can be customized by overriding [method _setup_local_to_scene] from script.
				For most resources, this method performs no base logic. [ViewportTexture] performs custom logic to properly set the proxy texture and flags in the local viewport.

pub fn take_over_path(&self, path: impl Into<GodotString>)[src]

Sets the path of the resource, potentially overriding an existing cache entry for this path. This differs from setting [member resource_path], as the latter would error out if another resource was already cached for the given path.

Trait Implementations

impl Debug for NavigationPolygon[src]

impl Deref for NavigationPolygon[src]

type Target = Resource

The resulting type after dereferencing.

impl DerefMut for NavigationPolygon[src]

impl GodotObject for NavigationPolygon[src]

type RefKind = RefCounted

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information. Read more

impl Instanciable for NavigationPolygon[src]

impl SubClass<Object> for NavigationPolygon[src]

impl SubClass<Reference> for NavigationPolygon[src]

impl SubClass<Resource> for NavigationPolygon[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SubClass<T> for T where
    T: GodotObject
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.