MeshLibrary

继承: Resource < RefCounted < Object

Library of meshes.

描述

A library of meshes. Contains a list of Mesh resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in GridMap.

方法

voidclear ( )
voidcreate_item ( id: int )
intfind_item_by_name ( name: String ) const1
PackedInt32Arrayget_item_list ( ) const1
Meshget_item_mesh ( id: int ) const1
Transform3Dget_item_mesh_transform ( id: int ) const1
Stringget_item_name ( id: int ) const1
intget_item_navigation_layers ( id: int ) const1
NavigationMeshget_item_navigation_mesh ( id: int ) const1
Transform3Dget_item_navigation_mesh_transform ( id: int ) const1
Texture2Dget_item_preview ( id: int ) const1
Arrayget_item_shapes ( id: int ) const1
intget_last_unused_item_id ( ) const1
voidremove_item ( id: int )
voidset_item_mesh ( id: int, mesh: Mesh )
voidset_item_mesh_transform ( id: int, mesh_transform: Transform3D )
voidset_item_name ( id: int, name: String )
voidset_item_navigation_layers ( id: int, navigation_layers: int )
voidset_item_navigation_mesh ( id: int, navigation_mesh: NavigationMesh )
voidset_item_navigation_mesh_transform ( id: int, navigation_mesh: Transform3D )
voidset_item_preview ( id: int, texture: Texture2D )
voidset_item_shapes ( id: int, shapes: Array )

方法说明

void clear ( )

Clears the library.


void create_item ( id: int )

Creates a new item in the library with the given ID.

You can get an unused ID from get_last_unused_item_id.


int find_item_by_name ( name: String ) const1

Returns the first item with the given name, or -1 if no item is found.


PackedInt32Array get_item_list ( ) const1

Returns the list of item IDs in use.


Mesh get_item_mesh ( id: int ) const1

Returns the item's mesh.


Transform3D get_item_mesh_transform ( id: int ) const1

Returns the transform applied to the item's mesh.


String get_item_name ( id: int ) const1

Returns the item's name.


int get_item_navigation_layers ( id: int ) const1

Returns the item's navigation layers bitmask.


NavigationMesh get_item_navigation_mesh ( id: int ) const1

Returns the item's navigation mesh.


Transform3D get_item_navigation_mesh_transform ( id: int ) const1

Returns the transform applied to the item's navigation mesh.


Texture2D get_item_preview ( id: int ) const1

When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using set_item_preview. Returns an empty Texture2D if no preview was manually set in a running project.


Array get_item_shapes ( id: int ) const1

Returns an item's collision shapes.

The array consists of each Shape3D followed by its Transform3D.


int get_last_unused_item_id ( ) const1

Gets an unused ID for a new item.


void remove_item ( id: int )

Removes the item.


void set_item_mesh ( id: int, mesh: Mesh )

Sets the item's mesh.


void set_item_mesh_transform ( id: int, mesh_transform: Transform3D )

Sets the transform to apply to the item's mesh.


void set_item_name ( id: int, name: String )

Sets the item's name.

This name is shown in the editor. It can also be used to look up the item later using find_item_by_name.


void set_item_navigation_layers ( id: int, navigation_layers: int )

Sets the item's navigation layers bitmask.


void set_item_navigation_mesh ( id: int, navigation_mesh: NavigationMesh )

Sets the item's navigation mesh.


void set_item_navigation_mesh_transform ( id: int, navigation_mesh: Transform3D )

Sets the transform to apply to the item's navigation mesh.


void set_item_preview ( id: int, texture: Texture2D )

Sets a texture to use as the item's preview icon in the editor.


void set_item_shapes ( id: int, shapes: Array )

Sets an item's collision shapes.

The array should consist of Shape3D objects, each followed by a Transform3D that will be applied to it. For shapes that should not have a transform, use Transform3D.IDENTITY.

2

本方法通常需要用户覆盖才能生效。

1

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。