Class MeshLibrary
Library of meshes.
- Inheritance
-
MeshLibrary
Remarks
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.
See Also
Methods
clear
Clears the library.
void clear
create_item(int)
Creates a new item in the library with the given ID.
You can get an unused ID from get_last_unused_item_id.
void create_item(int id)
Parameters
id
int
find_item_by_name(String)
Qualifiers: const
Returns the first item with the given name, or -1
if no item is found.
int find_item_by_name(String name)
Parameters
name
String
get_item_list
Qualifiers: const
Returns the list of item IDs in use.
PackedInt32Array get_item_list
get_item_mesh(int)
Qualifiers: const
Returns the item's mesh.
Mesh get_item_mesh(int id)
Parameters
id
int
get_item_mesh_cast_shadow(int)
Qualifiers: const
Returns the item's shadow casting mode. See ShadowCastingSetting for possible values.
int get_item_mesh_cast_shadow(int id)
Parameters
id
int
get_item_mesh_transform(int)
Qualifiers: const
Returns the transform applied to the item's mesh.
Transform3D get_item_mesh_transform(int id)
Parameters
id
int
get_item_name(int)
Qualifiers: const
Returns the item's name.
String get_item_name(int id)
Parameters
id
int
get_item_navigation_layers(int)
Qualifiers: const
Returns the item's navigation layers bitmask.
int get_item_navigation_layers(int id)
Parameters
id
int
get_item_navigation_mesh(int)
Qualifiers: const
Returns the item's navigation mesh.
NavigationMesh get_item_navigation_mesh(int id)
Parameters
id
int
get_item_navigation_mesh_transform(int)
Qualifiers: const
Returns the transform applied to the item's navigation mesh.
Transform3D get_item_navigation_mesh_transform(int id)
Parameters
id
int
get_item_preview(int)
Qualifiers: const
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 MeshLibrary.set_item_preview. Returns an empty Texture2D if no preview was manually set in a running project.
Texture2D get_item_preview(int id)
Parameters
id
int
get_item_shapes(int)
Qualifiers: const
Returns an item's collision shapes.
The array consists of each Shape3D followed by its Transform3D.
Array get_item_shapes(int id)
Parameters
id
int
get_last_unused_item_id
Qualifiers: const
Gets an unused ID for a new item.
int get_last_unused_item_id
remove_item(int)
Removes the item.
void remove_item(int id)
Parameters
id
int
set_item_mesh(int, Mesh)
Sets the item's mesh.
void set_item_mesh(int id, Mesh mesh)
Parameters
set_item_mesh_cast_shadow(int, int)
Sets the item's shadow casting mode. See ShadowCastingSetting for possible values.
void set_item_mesh_cast_shadow(int id, int shadow_casting_setting)
Parameters
set_item_mesh_transform(int, Transform3D)
Sets the transform to apply to the item's mesh.
void set_item_mesh_transform(int id, Transform3D mesh_transform)
Parameters
id
intmesh_transform
Transform3D
set_item_name(int, 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 MeshLibrary.find_item_by_name.
void set_item_name(int id, String name)
Parameters
set_item_navigation_layers(int, int)
Sets the item's navigation layers bitmask.
void set_item_navigation_layers(int id, int navigation_layers)
Parameters
set_item_navigation_mesh(int, NavigationMesh)
Sets the item's navigation mesh.
void set_item_navigation_mesh(int id, NavigationMesh navigation_mesh)
Parameters
id
intnavigation_mesh
NavigationMesh
set_item_navigation_mesh_transform(int, Transform3D)
Sets the transform to apply to the item's navigation mesh.
void set_item_navigation_mesh_transform(int id, Transform3D navigation_mesh)
Parameters
id
intnavigation_mesh
Transform3D
set_item_preview(int, Texture2D)
Sets a texture to use as the item's preview icon in the editor.
void set_item_preview(int id, Texture2D texture)
Parameters
set_item_shapes(int, 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 IDENTITY.
void set_item_shapes(int id, Array shapes)