2021-01-04 13:33:44 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 13:18:53 +00:00
<class name= "ImporterMesh" inherits= "Resource" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2021-01-04 13:33:44 +00:00
<brief_description >
2021-08-23 01:11:57 +00:00
A [Resource] that contains vertex array-based geometry during the import process.
2021-01-04 13:33:44 +00:00
</brief_description>
<description >
2021-09-21 01:24:31 +00:00
ImporterMesh is a type of [Resource] analogous to [ArrayMesh]. It contains vertex array-based geometry, divided in [i]surfaces[/i]. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials.
2021-08-23 01:11:57 +00:00
2021-09-21 01:24:31 +00:00
Unlike its runtime counterpart, [ImporterMesh] contains mesh data before various import steps, such as lod and shadow mesh generation, have taken place. Modify surface data by calling [method clear], followed by [method add_surface] for each surface.
2021-01-04 13:33:44 +00:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "add_blend_shape" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "String" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Adds name for a blend shape that will be added with [method add_surface]. Must be called before surface is added.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "add_surface" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "primitive" type= "int" enum= "Mesh.PrimitiveType" />
<param index= "1" name= "arrays" type= "Array" />
2022-08-31 17:24:04 +00:00
<param index= "2" name= "blend_shapes" type= "Array[]" default= "[]" />
2022-08-06 18:11:48 +00:00
<param index= "3" name= "lods" type= "Dictionary" default= "{}" />
<param index= "4" name= "material" type= "Material" default= "null" />
<param index= "5" name= "name" type= "String" default= """" />
<param index= "6" name= "flags" type= "int" default= "0" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Creates a new surface, analogous to [method ArrayMesh.add_surface_from_arrays].
2022-08-12 16:07:53 +00:00
Surfaces are created to be rendered using a [param primitive], which may be any of the types defined in [enum Mesh.PrimitiveType]. (As a note, when using indices, it is recommended to only use points, lines, or triangles.) [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface.
The [param arrays] argument is an array of arrays. See [enum Mesh.ArrayType] for the values used in this array. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for [constant Mesh.ARRAY_INDEX] if it is used.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "clear" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2021-01-04 13:33:44 +00:00
<description >
2021-09-21 01:24:31 +00:00
Removes all surfaces and blend shapes from this [ImporterMesh].
2021-01-04 13:33:44 +00:00
</description>
</method>
2022-06-11 23:15:44 +00:00
<method name= "generate_lods" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "normal_merge_angle" type= "float" />
<param index= "1" name= "normal_split_angle" type= "float" />
2022-09-07 19:13:10 +00:00
<param index= "2" name= "bone_transform_array" type= "Array" />
2022-06-11 23:15:44 +00:00
<description >
Generates all lods for this ImporterMesh.
2022-08-12 16:07:53 +00:00
[param normal_merge_angle] and [param normal_split_angle] are in degrees and used in the same way as the importer settings in [code]lods[/code]. As a good default, use 25 and 60 respectively.
2022-06-11 23:15:44 +00:00
The number of generated lods can be accessed using [method get_surface_lod_count], and each LOD is available in [method get_surface_lod_size] and [method get_surface_lod_indices].
2022-09-07 19:13:10 +00:00
[param bone_transform_array] is an [Array] which can be either empty or contain [Transform3D]s which, for each of the mesh's bone IDs, will apply mesh skinning when generating the LOD mesh variations. This is usually used to account for discrepancies in scale between the mesh itself and its skinning data.
2022-06-11 23:15:44 +00:00
</description>
</method>
2021-01-04 13:33:44 +00:00
<method name= "get_blend_shape_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the number of blend shapes that the mesh holds.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_blend_shape_mode" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "Mesh.BlendShapeMode" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the blend shape mode for this Mesh.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_blend_shape_name" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "blend_shape_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the name of the blend shape at this index.
2021-01-04 13:33:44 +00:00
</description>
</method>
2021-03-25 11:19:51 +00:00
<method name= "get_lightmap_size_hint" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2i" />
2021-03-25 11:19:51 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the size hint of this mesh for lightmap-unwrapping in UV-space.
2021-03-25 11:19:51 +00:00
</description>
</method>
2021-01-04 13:33:44 +00:00
<method name= "get_mesh" >
2021-07-30 13:28:05 +00:00
<return type= "ArrayMesh" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "base_mesh" type= "ArrayMesh" default= "null" />
2021-01-04 13:33:44 +00:00
<description >
2021-09-21 01:24:31 +00:00
Returns the mesh data represented by this [ImporterMesh] as a usable [ArrayMesh].
2021-08-23 01:11:57 +00:00
This method caches the returned mesh, and subsequent calls will return the cached data until [method clear] is called.
2022-08-12 16:07:53 +00:00
If not yet cached and [param base_mesh] is provided, [param base_mesh] will be used and mutated.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_arrays" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Array" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the arrays for the vertices, normals, uvs, etc. that make up the requested surface. See [method add_surface].
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_blend_shape_arrays" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Array" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
<param index= "1" name= "blend_shape_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns a single set of blend shape arrays for the requested blend shape index for a surface.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of surfaces that the mesh holds.
2021-01-04 13:33:44 +00:00
</description>
</method>
2021-09-09 04:29:14 +00:00
<method name= "get_surface_format" qualifiers= "const" >
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
2021-09-09 04:29:14 +00:00
<description >
Returns the format of the surface that the mesh holds.
</description>
</method>
2021-01-04 13:33:44 +00:00
<method name= "get_surface_lod_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of lods that the mesh holds on a given surface.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_lod_indices" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "PackedInt32Array" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
<param index= "1" name= "lod_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the index buffer of a lod for a surface.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_lod_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
<param index= "1" name= "lod_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the screen ratio which activates a lod for a surface.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_material" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Material" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns a [Material] in a given surface. Surface is rendered using this material.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_name" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Gets the name assigned to this surface.
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "get_surface_primitive_type" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "Mesh.PrimitiveType" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Returns the primitive type of the requested surface (see [method add_surface]).
2021-01-04 13:33:44 +00:00
</description>
</method>
<method name= "set_blend_shape_mode" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "mode" type= "int" enum= "Mesh.BlendShapeMode" />
2021-01-04 13:33:44 +00:00
<description >
2021-08-23 01:11:57 +00:00
Sets the blend shape mode to one of [enum Mesh.BlendShapeMode].
2021-01-04 13:33:44 +00:00
</description>
</method>
2021-03-25 11:19:51 +00:00
<method name= "set_lightmap_size_hint" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "size" type= "Vector2i" />
2021-03-25 11:19:51 +00:00
<description >
2021-08-23 01:11:57 +00:00
Sets the size hint of this mesh for lightmap-unwrapping in UV-space.
</description>
</method>
<method name= "set_surface_material" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
<param index= "1" name= "material" type= "Material" />
2021-08-23 01:11:57 +00:00
<description >
Sets a [Material] for a given surface. Surface will be rendered using this material.
</description>
</method>
<method name= "set_surface_name" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "surface_idx" type= "int" />
<param index= "1" name= "name" type= "String" />
2021-08-23 01:11:57 +00:00
<description >
Sets a name for a given surface.
2021-03-25 11:19:51 +00:00
</description>
</method>
2021-01-04 13:33:44 +00:00
</methods>
<members >
2022-01-18 10:31:15 +00:00
<member name= "_data" type= "Dictionary" setter= "_set_data" getter= "_get_data" default= "{ "surfaces": [] }" >
2021-01-04 13:33:44 +00:00
</member>
</members>
</class>