MeshDataTool
Category: Core
Helper tool to access and edit data.
The MeshDataTool provides access to individual vertices in a Mesh. It allows users to read and edit vertex data of meshes. It also creates an array of faces and edges.
To use the MeshDataTool, load a mesh with . When you are finished editing the data commit the data to a mesh with commit_to_surface.
Below is an example of how the MeshDataTool may be used.
- void clear ( )
Clears all data currently in MeshDataTool.
- commit_to_surface ( ArrayMesh mesh )
Adds a new surface to specified with edited data.
Uses specified surface of given to populate data for MeshDataTool.
Requires Mesh with primitive type .
- int get_edge_count ( ) const
Returns the number of edges in this .
- PoolIntArray get_edge_faces ( idx ) const
Returns array of faces that touch given edge.
- Variant get_edge_meta ( idx ) const
Returns meta information assigned to given edge.
Returns index of specified vertex connected to given edge.
Vertex argument can only be 0 or 1 because edges are comprised of two vertices.
- get_face_count ( ) const
Returns the number of faces in this Mesh.
- get_face_edge ( int idx, edge ) const
Edge argument must 2 or less because a face only has three edges.
Returns meta data associated with given face.
- Vector3 get_face_normal ( idx ) const
Calculates and returns face normal of given face.
Returns specified vertex of given face.
Vertex argument must be 2 or less because faces contain three vertices.
- get_format ( ) const
Returns format of Mesh. Format is an integer made up of format flags combined together. For example, a mesh containing both vertices and normals would return a format of because ArrayMesh.ARRAY_FORMAT_VERTEX is and is .
For list of format flags see ArrayFormat.
- get_material ( ) const
Returns material assigned to the Mesh.
- get_vertex ( int idx ) const
Returns the vertex at given index.
- get_vertex_bones ( int idx ) const
Returns the bones of the given vertex.
- get_vertex_color ( int idx ) const
Returns the color of the given vertex.
- get_vertex_count ( ) const
Returns the total number of vertices in Mesh.
- get_vertex_edges ( int idx ) const
Returns array of edges that share given vertex.
- get_vertex_faces ( int idx ) const
Returns array of faces that share given vertex.
- get_vertex_meta ( int idx ) const
Returns meta data associated with given vertex.
- get_vertex_normal ( int idx ) const
- get_vertex_tangent ( int idx ) const
Returns tangent of given vertex.
Returns UV of given vertex.
- get_vertex_uv2 ( int idx ) const
Returns UV2 of given vertex.
- get_vertex_weights ( int idx ) const
Returns bone weights of given vertex.
- void set_edge_meta ( idx, Variant meta )
Sets the meta data of given edge.
- void set_face_meta ( idx, Variant meta )
Sets the meta data of given face.
- void set_material ( material )
Sets the material to be used by newly constructed Mesh.
- void set_vertex ( idx, Vector3 vertex )
Sets the position of given vertex.
- void set_vertex_bones ( idx, PoolIntArray bones )
Sets the bones of given vertex.
- void set_vertex_color ( idx, Color color )
Sets the color of given vertex.
- void set_vertex_meta ( idx, Variant meta )
Sets the meta data associated with given vertex.
- void set_vertex_normal ( idx, Vector3 normal )
Sets the normal of given vertex.
- void set_vertex_tangent ( idx, Plane tangent )
Sets the tangent of given vertex.
- void set_vertex_uv ( idx, Vector2 uv )
Sets the UV of given vertex.
- void set_vertex_uv2 ( idx, Vector2 uv2 )
Sets the UV2 of given vertex.