ImporterMesh

Inherits: Resource < RefCounted < Object

A Resource that contains vertex array-based geometry during the import process.

Description

ImporterMesh is a type of Resource analogous to ArrayMesh. It contains vertex array-based geometry, divided in surfaces. 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.

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 clear, followed by add_surface for each surface.

Properties

Dictionary

_data

{"surfaces": []}

Methods

void

add_blend_shape ( String name )

void

add_surface ( PrimitiveType primitive, Array arrays, Array blend_shapes=[], Dictionary lods={ }, Material material=null, String name="", int flags=0 )

void

clear ( )

int

get_blend_shape_count ( ) const

BlendShapeMode

get_blend_shape_mode ( ) const

String

get_blend_shape_name ( int blend_shape_idx ) const

Vector2i

get_lightmap_size_hint ( ) const

ArrayMesh

get_mesh ( ArrayMesh base_mesh=null )

Array

get_surface_arrays ( int surface_idx ) const

Array

get_surface_blend_shape_arrays ( int surface_idx, int blend_shape_idx ) const

int

get_surface_count ( ) const

int

get_surface_format ( int surface_idx ) const

int

get_surface_lod_count ( int surface_idx ) const

PackedInt32Array

get_surface_lod_indices ( int surface_idx, int lod_idx ) const

float

get_surface_lod_size ( int surface_idx, int lod_idx ) const

Material

get_surface_material ( int surface_idx ) const

String

get_surface_name ( int surface_idx ) const

PrimitiveType

get_surface_primitive_type ( int surface_idx )

void

set_blend_shape_mode ( BlendShapeMode mode )

void

set_lightmap_size_hint ( Vector2i size )

void

set_surface_material ( int surface_idx, Material material )

void

set_surface_name ( int surface_idx, String name )

Property Descriptions

Default

{"surfaces": []}

Method Descriptions

  • void add_blend_shape ( String name )

Adds name for a blend shape that will be added with add_surface. Must be called before surface is added.


Creates a new surface, analogous to ArrayMesh.add_surface_from_arrays.

Surfaces are created to be rendered using a primitive, which may be any of the types defined in PrimitiveType. (As a note, when using indices, it is recommended to only use points, lines, or triangles.) Mesh.get_surface_count will become the surf_idx for this new surface.

The arrays argument is an array of arrays. See ArrayType for the values used in this array. For example, arrays[0] 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 empty, except for Mesh.ARRAY_INDEX if it is used.


  • void clear ( )

Removes all surfaces and blend shapes from this ImporterMesh.


  • int get_blend_shape_count ( ) const

Returns the number of blend shapes that the mesh holds.


Returns the blend shape mode for this Mesh.


  • String get_blend_shape_name ( int blend_shape_idx ) const

Returns the name of the blend shape at this index.


  • Vector2i get_lightmap_size_hint ( ) const

Returns the size hint of this mesh for lightmap-unwrapping in UV-space.


Returns the mesh data represented by this ImporterMesh as a usable ArrayMesh.

This method caches the returned mesh, and subsequent calls will return the cached data until clear is called.

If not yet cached and base_mesh is provided, base_mesh will be used and mutated.


  • Array get_surface_arrays ( int surface_idx ) const

Returns the arrays for the vertices, normals, uvs, etc. that make up the requested surface. See add_surface.


  • Array get_surface_blend_shape_arrays ( int surface_idx, int blend_shape_idx ) const

Returns a single set of blend shape arrays for the requested blend shape index for a surface.


  • int get_surface_count ( ) const

Returns the amount of surfaces that the mesh holds.


  • int get_surface_format ( int surface_idx ) const

Returns the format of the surface that the mesh holds.


  • int get_surface_lod_count ( int surface_idx ) const

Returns the amount of lods that the mesh holds on a given surface.


Returns the index buffer of a lod for a surface.


  • float get_surface_lod_size ( int surface_idx, int lod_idx ) const

Returns the screen ratio which activates a lod for a surface.


  • Material get_surface_material ( int surface_idx ) const

Returns a Material in a given surface. Surface is rendered using this material.


  • String get_surface_name ( int surface_idx ) const

Gets the name assigned to this surface.


Returns the primitive type of the requested surface (see add_surface).


Sets the blend shape mode to one of BlendShapeMode.


  • void set_lightmap_size_hint ( Vector2i size )

Sets the size hint of this mesh for lightmap-unwrapping in UV-space.


  • void set_surface_material ( int surface_idx, Material material )

Sets a Material for a given surface. Surface will be rendered using this material.


  • void set_surface_name ( int surface_idx, String name )

Sets a name for a given surface.