Class MeshLibrary
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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.
public class MeshLibrary : Resource, IDisposable
- Inheritance
-
MeshLibrary
- Implements
- Inherited Members
Constructors
MeshLibrary()
public MeshLibrary()
Methods
Clear()
Clears the library.
public void Clear()
CreateItem(int)
Creates a new item in the library with the given ID.
You can get an unused ID from GetLastUnusedItemId().
public void CreateItem(int id)
Parameters
id
int
FindItemByName(string)
Returns the first item with the given name.
public int FindItemByName(string name)
Parameters
name
string
Returns
GetItemList()
Returns the list of item IDs in use.
public int[] GetItemList()
Returns
- int[]
GetItemMesh(int)
Returns the item's mesh.
public Mesh GetItemMesh(int id)
Parameters
id
int
Returns
GetItemMeshTransform(int)
Returns the transform applied to the item's mesh.
public Transform3D GetItemMeshTransform(int id)
Parameters
id
int
Returns
GetItemName(int)
Returns the item's name.
public string GetItemName(int id)
Parameters
id
int
Returns
GetItemNavigationLayers(int)
Returns the item's navigation layers bitmask.
public uint GetItemNavigationLayers(int id)
Parameters
id
int
Returns
GetItemNavigationMesh(int)
Returns the item's navigation mesh.
public NavigationMesh GetItemNavigationMesh(int id)
Parameters
id
int
Returns
GetItemNavigationMeshTransform(int)
Returns the transform applied to the item's navigation mesh.
public Transform3D GetItemNavigationMeshTransform(int id)
Parameters
id
int
Returns
GetItemPreview(int)
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 SetItemPreview(int, Texture2D). Returns an empty Texture2D if no preview was manually set in a running project.
public Texture2D GetItemPreview(int id)
Parameters
id
int
Returns
GetItemShapes(int)
Returns an item's collision shapes.
The array consists of each Shape3D followed by its Transform3D.
public Array GetItemShapes(int id)
Parameters
id
int
Returns
GetLastUnusedItemId()
Gets an unused ID for a new item.
public int GetLastUnusedItemId()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
RemoveItem(int)
Removes the item.
public void RemoveItem(int id)
Parameters
id
int
SetItemMesh(int, Mesh)
Sets the item's mesh.
public void SetItemMesh(int id, Mesh mesh)
Parameters
SetItemMeshTransform(int, Transform3D)
Sets the transform to apply to the item's mesh.
public void SetItemMeshTransform(int id, Transform3D meshTransform)
Parameters
id
intmeshTransform
Transform3D
SetItemName(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 FindItemByName(string).
public void SetItemName(int id, string name)
Parameters
SetItemNavigationLayers(int, uint)
Sets the item's navigation layers bitmask.
public void SetItemNavigationLayers(int id, uint navigationLayers)
Parameters
SetItemNavigationMesh(int, NavigationMesh)
Sets the item's navigation mesh.
public void SetItemNavigationMesh(int id, NavigationMesh navigationMesh)
Parameters
id
intnavigationMesh
NavigationMesh
SetItemNavigationMeshTransform(int, Transform3D)
Sets the transform to apply to the item's navigation mesh.
public void SetItemNavigationMeshTransform(int id, Transform3D navigationMesh)
Parameters
id
intnavigationMesh
Transform3D
SetItemPreview(int, Texture2D)
Sets a texture to use as the item's preview icon in the editor.
public void SetItemPreview(int id, Texture2D texture)
Parameters
SetItemShapes(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 Transform3D.IDENTITY
.
public void SetItemShapes(int id, Array shapes)