pandemonium_engine_docs/classes/class_meshlibrary.rst

246 lines
15 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/MeshLibrary.xml.
.. _class_MeshLibrary:
MeshLibrary
===========
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
Library of meshes.
Description
-----------
A library of meshes. Contains a list of :ref:`Mesh<class_Mesh>` resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in :ref:`GridMap<class_GridMap>`.
Tutorials
---------
- `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/126>`__
- `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`__
Methods
-------
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear<class_MeshLibrary_method_clear>` **(** **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`create_item<class_MeshLibrary_method_create_item>` **(** :ref:`int<class_int>` id **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>` **(** :ref:`String<class_String>` name **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`get_item_list<class_MeshLibrary_method_get_item_list>` **(** **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Mesh<class_Mesh>` | :ref:`get_item_mesh<class_MeshLibrary_method_get_item_mesh>` **(** :ref:`int<class_int>` id **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Transform<class_Transform>` | :ref:`get_item_mesh_transform<class_MeshLibrary_method_get_item_mesh_transform>` **(** :ref:`int<class_int>` id **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_item_name<class_MeshLibrary_method_get_item_name>` **(** :ref:`int<class_int>` id **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_item_navmesh<class_MeshLibrary_method_get_item_navmesh>` **(** :ref:`int<class_int>` id **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Transform<class_Transform>` | :ref:`get_item_navmesh_transform<class_MeshLibrary_method_get_item_navmesh_transform>` **(** :ref:`int<class_int>` id **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture<class_Texture>` | :ref:`get_item_preview<class_MeshLibrary_method_get_item_preview>` **(** :ref:`int<class_int>` id **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_item_shapes<class_MeshLibrary_method_get_item_shapes>` **(** :ref:`int<class_int>` id **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>` **(** **)** |const| |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`remove_item<class_MeshLibrary_method_remove_item>` **(** :ref:`int<class_int>` id **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_mesh<class_MeshLibrary_method_set_item_mesh>` **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_mesh_transform<class_MeshLibrary_method_set_item_mesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` mesh_transform **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_name<class_MeshLibrary_method_set_item_name>` **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_navmesh<class_MeshLibrary_method_set_item_navmesh>` **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_navmesh_transform<class_MeshLibrary_method_set_item_navmesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>` **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_shapes<class_MeshLibrary_method_set_item_shapes>` **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)** |
+---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Method Descriptions
-------------------
.. _class_MeshLibrary_method_clear:
- void **clear** **(** **)**
Clears the library.
----
.. _class_MeshLibrary_method_create_item:
- void **create_item** **(** :ref:`int<class_int>` id **)**
Creates a new item in the library with the given ID.
You can get an unused ID from :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>`.
----
.. _class_MeshLibrary_method_find_item_by_name:
- :ref:`int<class_int>` **find_item_by_name** **(** :ref:`String<class_String>` name **)** |const|
Returns the first item with the given name.
----
.. _class_MeshLibrary_method_get_item_list:
- :ref:`PoolIntArray<class_PoolIntArray>` **get_item_list** **(** **)** |const|
Returns the list of item IDs in use.
----
.. _class_MeshLibrary_method_get_item_mesh:
- :ref:`Mesh<class_Mesh>` **get_item_mesh** **(** :ref:`int<class_int>` id **)** |const|
Returns the item's mesh.
----
.. _class_MeshLibrary_method_get_item_mesh_transform:
- :ref:`Transform<class_Transform>` **get_item_mesh_transform** **(** :ref:`int<class_int>` id **)** |const|
Returns the transform applied to the item's mesh.
----
.. _class_MeshLibrary_method_get_item_name:
- :ref:`String<class_String>` **get_item_name** **(** :ref:`int<class_int>` id **)** |const|
Returns the item's name.
----
.. _class_MeshLibrary_method_get_item_navmesh:
- :ref:`NavigationMesh<class_NavigationMesh>` **get_item_navmesh** **(** :ref:`int<class_int>` id **)** |const|
Returns the item's navigation mesh.
----
.. _class_MeshLibrary_method_get_item_navmesh_transform:
- :ref:`Transform<class_Transform>` **get_item_navmesh_transform** **(** :ref:`int<class_int>` id **)** |const|
Returns the transform applied to the item's navigation mesh.
----
.. _class_MeshLibrary_method_get_item_preview:
- :ref:`Texture<class_Texture>` **get_item_preview** **(** :ref:`int<class_int>` id **)** |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 :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>`. Returns an empty :ref:`Texture<class_Texture>` if no preview was manually set in a running project.
----
.. _class_MeshLibrary_method_get_item_shapes:
- :ref:`Array<class_Array>` **get_item_shapes** **(** :ref:`int<class_int>` id **)** |const|
Returns an item's collision shapes.
The array consists of each :ref:`Shape<class_Shape>` followed by its :ref:`Transform<class_Transform>`.
----
.. _class_MeshLibrary_method_get_last_unused_item_id:
- :ref:`int<class_int>` **get_last_unused_item_id** **(** **)** |const|
Gets an unused ID for a new item.
----
.. _class_MeshLibrary_method_remove_item:
- void **remove_item** **(** :ref:`int<class_int>` id **)**
Removes the item.
----
.. _class_MeshLibrary_method_set_item_mesh:
- void **set_item_mesh** **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)**
Sets the item's mesh.
----
.. _class_MeshLibrary_method_set_item_mesh_transform:
- void **set_item_mesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` mesh_transform **)**
Sets the transform to apply to the item's mesh.
----
.. _class_MeshLibrary_method_set_item_name:
- void **set_item_name** **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)**
Sets the item's name.
This name is shown in the editor. It can also be used to look up the item later using :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>`.
----
.. _class_MeshLibrary_method_set_item_navmesh:
- void **set_item_navmesh** **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)**
Sets the item's navigation mesh.
----
.. _class_MeshLibrary_method_set_item_navmesh_transform:
- void **set_item_navmesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)**
Sets the transform to apply to the item's navigation mesh.
----
.. _class_MeshLibrary_method_set_item_preview:
- void **set_item_preview** **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)**
Sets a texture to use as the item's preview icon in the editor.
----
.. _class_MeshLibrary_method_set_item_shapes:
- void **set_item_shapes** **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)**
Sets an item's collision shapes.
The array should consist of :ref:`Shape<class_Shape>` objects, each followed by a :ref:`Transform<class_Transform>` that will be applied to it. For shapes that should not have a transform, use :ref:`Transform.IDENTITY<class_Transform_constant_IDENTITY>`.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`