MeshDataTool

Helper tool to access and edit Mesh 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 createFromSurface. When you are finished editing the data commit the data to a mesh with commitToSurface. Below is an example of how the MeshDataTool may be used.

More...
@GodotBaseClass
struct MeshDataTool {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

clear
void clear()

Clears all data currently in MeshDataTool.

commitToSurface
GodotError commitToSurface(ArrayMesh mesh)

Adds a new surface to specified Mesh with edited data.

createFromSurface
GodotError createFromSurface(ArrayMesh mesh, long surface)

Uses specified surface of given Mesh to populate data for MeshDataTool. Requires Mesh with primitive type PRIMITIVE_TRIANGLES.

getEdgeCount
long getEdgeCount()

Returns the number of edges in this Mesh.

getEdgeFaces
PoolIntArray getEdgeFaces(long idx)

Returns array of faces that touch given edge.

getEdgeMeta
Variant getEdgeMeta(long idx)

Returns meta information assigned to given edge.

getEdgeVertex
long getEdgeVertex(long idx, long vertex)

Returns index of specified vertex connected to given edge. Vertex argument can only be 0 or 1 because edges are comprised of two vertices.

getFaceCount
long getFaceCount()

Returns the number of faces in this Mesh.

getFaceEdge
long getFaceEdge(long idx, long edge)

Returns specified edge associated with given face. Edge argument must 2 or less becuase a face only has three edges.

getFaceMeta
Variant getFaceMeta(long idx)

Returns meta data associated with given face.

getFaceNormal
Vector3 getFaceNormal(long idx)

Calculates and returns face normal of given face.

getFaceVertex
long getFaceVertex(long idx, long vertex)

Returns specified vertex of given face. Vertex argument must be 2 or less becuase faces contain three vertices.

getFormat
long getFormat()

Returns format of Mesh. Format is an integer made up of Mesh format flags combined together. For example, a mesh containing both vertices and normals would return a format of 3 becuase ARRAY_FORMAT_VERTEX is 1 and ARRAY_FORMAT_NORMAL is 2. For list of format flags see ArrayMesh.

getMaterial
Ref!Material getMaterial()

Returns material assigned to the Mesh.

getVertex
Vector3 getVertex(long idx)

Returns the vertex at given index.

getVertexBones
PoolIntArray getVertexBones(long idx)

Returns the bones of the given vertex.

getVertexColor
Color getVertexColor(long idx)

Returns the color of the given vertex.

getVertexCount
long getVertexCount()

Returns the total number of vertices in Mesh.

getVertexEdges
PoolIntArray getVertexEdges(long idx)

Returns array of edges that share given vertex.

getVertexFaces
PoolIntArray getVertexFaces(long idx)

Returns array of faces that share given vertex.

getVertexMeta
Variant getVertexMeta(long idx)

Returns meta data associated with given vertex.

getVertexNormal
Vector3 getVertexNormal(long idx)

Returns normal of given vertex.

getVertexTangent
Plane getVertexTangent(long idx)

Returns tangent of given vertex.

getVertexUv
Vector2 getVertexUv(long idx)

Returns UV of given vertex.

getVertexUv2
Vector2 getVertexUv2(long idx)

Returns UV2 of given vertex.

getVertexWeights
PoolRealArray getVertexWeights(long idx)

Returns bone weights of given vertex.

opAssign
MeshDataTool opAssign(T n)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(MeshDataTool other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
setEdgeMeta
void setEdgeMeta(long idx, VariantArg1 meta)

Sets the meta data of given edge.

setFaceMeta
void setFaceMeta(long idx, VariantArg1 meta)

Sets the meta data of given face.

setMaterial
void setMaterial(Material material)

Sets the material to be used by newly constructed Mesh.

setVertex
void setVertex(long idx, Vector3 vertex)

Sets the position of given vertex.

setVertexBones
void setVertexBones(long idx, PoolIntArray bones)

Sets the bones of given vertex.

setVertexColor
void setVertexColor(long idx, Color color)

Sets the color of given vertex.

setVertexMeta
void setVertexMeta(long idx, VariantArg1 meta)

Sets the meta data associated with given vertex.

setVertexNormal
void setVertexNormal(long idx, Vector3 normal)

Sets the normal of given vertex.

setVertexTangent
void setVertexTangent(long idx, Plane tangent)

Sets the tangent of given vertex.

setVertexUv
void setVertexUv(long idx, Vector2 uv)

Sets the UV of given vertex.

setVertexUv2
void setVertexUv2(long idx, Vector2 uv2)

Sets the UV2 of given vertex.

setVertexWeights
void setVertexWeights(long idx, PoolRealArray weights)

Sets the bone weights of given vertex.

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Static functions

_new
MeshDataTool _new()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

_classBinding
struct _classBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
ToRef as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Detailed Description

var mdt = MeshDataTool.new() mdt.create_from_surface(mesh, 0) for i in range(mdt.get_vertex_count()): var vertex = mdt.get_vertex(i) ... mdt.set_vertex(i, vertex) mesh.surface_remove(0) mdt.commit_to_surface(mesh)

Meta