Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
- Animation
- AnimationLibrary
- AnimationNode (6)
- AnimationNodeStateMachinePlayback
- AnimationNodeStateMachineTransition
- AudioBusLayout
- AudioEffect (17)
- AudioStream (10)
- BitMap
- BoneMap
- ButtonGroup
- CameraAttributes (2)
- ColorPalette
- Compositor
- CompositorEffect
- CryptoKey
- Curve
- Curve2D
- Curve3D
- EditorNode3DGizmoPlugin
- EditorSettings
- Environment
- Font (3)
- GDExtension
- GLTFAccessor
- GLTFAnimation
- GLTFBufferView
- GLTFCamera
- GLTFDocument (1)
- GLTFDocumentExtension (1)
- GLTFLight
- GLTFMesh
- GLTFNode
- GLTFPhysicsBody
- GLTFPhysicsShape
- GLTFSkeleton
- GLTFSkin
- GLTFSpecGloss
- GLTFState (1)
- GLTFTexture
- GLTFTextureSampler
- Gradient
- Image
- ImporterMesh
- InputEvent (6)
- JSON
- LabelSettings
- LightmapGIData
- Material (9)
- Mesh (4)
- MeshLibrary
- MissingResource
- MultiMesh
- NavigationMesh
- NavigationMeshSourceGeometryData2D
- NavigationMeshSourceGeometryData3D
- NavigationPolygon
- Noise (1)
- Occluder3D (5)
- OccluderPolygon2D
- OggPacketSequence
- OpenXRAction
- OpenXRActionMap
- OpenXRActionSet
- OpenXRBindingModifier (2)
- OpenXRHapticBase (1)
- OpenXRIPBinding
- OpenXRInteractionProfile
- PackedDataContainer
- PackedScene
- PhysicsMaterial
- PolygonPathFinder
- RDShaderFile
- RDShaderSPIRV
- RichTextEffect
- SceneReplicationConfig
- Script (3)
- Shader (1)
- ShaderInclude
- Shape2D (8)
- Shape3D (9)
- Shortcut
- SkeletonModification2D (7)
- SkeletonModificationStack2D
- SkeletonProfile (1)
- Skin
- Sky
- SpriteFrames
- StyleBox (4)
- SyntaxHighlighter (2)
- Texture (3)
- Theme
- TileMapPattern
- TileSet
- TileSetSource (2)
- Translation (1)
- VideoStream (1)
- VideoStreamPlayback
- VisualShaderNode (62)
- VoxelGIData
- World2D
- World3D
- X509Certificate
Table of contents
-
func add_blend_shape(name: String) -> void -
func add_surface(flags: int = 0) -> void -
func clear() -> void -
func generate_lods(bone_transform_array: Array) -> void -
const func get_blend_shape_count() -> int -
const func get_blend_shape_mode() -> intMesh.BlendShapeMode -
const func get_blend_shape_name(blend_shape_idx: int) -> String -
const func get_lightmap_size_hint() -> Vector2i -
func get_mesh(base_mesh: ArrayMesh = null) -> ArrayMesh -
const func get_surface_arrays(surface_idx: int) -> Array -
const func get_surface_blend_shape_arrays(blend_shape_idx: int) -> Array -
const func get_surface_count() -> int -
const func get_surface_format(surface_idx: int) -> int -
const func get_surface_lod_count(surface_idx: int) -> int -
const func get_surface_lod_indices(lod_idx: int) -> PackedInt32Array -
const func get_surface_lod_size(lod_idx: int) -> float -
const func get_surface_material(surface_idx: int) -> Material -
const func get_surface_name(surface_idx: int) -> String -
func get_surface_primitive_type(surface_idx: int) -> intMesh.PrimitiveType -
func set_blend_shape_mode(mode: int enumMesh.BlendShapeMode) -> void -
func set_lightmap_size_hint(size: Vector2i) -> void -
func set_surface_material(material: Material) -> void -
func set_surface_name(name: String) -> void
ImporterMesh #
is_refcounted, is_instantiable, resource, core, not_builtin_classes
A Resource that contains vertex array-based geometry during the import process.
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.
Members #
Methods #
func add_blend_shape(name: String) -> void#
Adds name for a blend shape that will be added with add_surface. Must be called before surface is added.
func add_surface(flags: int = 0) -> void#
Creates a new surface. Mesh.get_surface_count will become the surf_idx for this new surface.
Surfaces are created to be rendered using a primitive, which may be any of the values defined in Mesh.PrimitiveType.
The arrays argument is an array of arrays. Each of the Mesh.ARRAY_MAX elements contains an array with some of the mesh data for this surface as described by the corresponding member of Mesh.ArrayType or null if it is not used by the surface. For example, arrays0 is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this surface 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 Mesh.ARRAY_INDEX if it is used.
The blend_shapes argument is an array of vertex data for each blend shape. Each element is an array of the same structure as arrays, but Mesh.ARRAY_VERTEX, Mesh.ARRAY_NORMAL, and Mesh.ARRAY_TANGENT are set if and only if they are set in arrays and all other entries are null.
The lods argument is a dictionary with float keys and PackedInt32Array values. Each entry in the dictionary represents an LOD level of the surface, where the value is the Mesh.ARRAY_INDEX array to use for the LOD level and the key is roughly proportional to the distance at which the LOD stats being used. I.e., increasing the key of an LOD also increases the distance that the objects has to be from the camera before the LOD is used.
The flags argument is the bitwise OR of, as required: One value of Mesh.ArrayCustomFormat left shifted by ARRAY_FORMAT_CUSTOMn_SHIFT for each custom channel in use, Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE, Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS, or Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY.
Note: When using indices, it is recommended to only use points, lines, or triangles.
func clear() -> void#
Removes all surfaces and blend shapes from this ImporterMesh.
func generate_lods(bone_transform_array: Array) -> void#
Generates all lods for this ImporterMesh.
normal_merge_angle is in degrees and used in the same way as the importer settings in lods.
normal_split_angle is not used and only remains for compatibility with older versions of the API.
The number of generated lods can be accessed using get_surface_lod_count, and each LOD is available in get_surface_lod_size and get_surface_lod_indices.
bone_transform_array is an Array which can be either empty or contain Transform3Ds 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.
const func get_blend_shape_count() -> int#
Returns the number of blend shapes that the mesh holds.
const func get_blend_shape_mode() -> intMesh.BlendShapeMode#
Returns the blend shape mode for this Mesh.
const func get_blend_shape_name(blend_shape_idx: int) -> String#
Returns the name of the blend shape at this index.
const func get_lightmap_size_hint() -> Vector2i#
Returns the size hint of this mesh for lightmap-unwrapping in UV-space.
func get_mesh(base_mesh: ArrayMesh = null) -> ArrayMesh#
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.
const func get_surface_arrays(surface_idx: int) -> Array#
Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface. See add_surface.
const func get_surface_blend_shape_arrays(blend_shape_idx: int) -> Array#
Returns a single set of blend shape arrays for the requested blend shape index for a surface.
const func get_surface_count() -> int#
Returns the number of surfaces that the mesh holds.
const func get_surface_format(surface_idx: int) -> int#
Returns the format of the surface that the mesh holds.
const func get_surface_lod_count(surface_idx: int) -> int#
Returns the number of lods that the mesh holds on a given surface.
const func get_surface_lod_indices(lod_idx: int) -> PackedInt32Array#
Returns the index buffer of a lod for a surface.
const func get_surface_lod_size(lod_idx: int) -> float#
Returns the screen ratio which activates a lod for a surface.
const func get_surface_material(surface_idx: int) -> Material#
Returns a Material in a given surface. Surface is rendered using this material.
const func get_surface_name(surface_idx: int) -> String#
Gets the name assigned to this surface.
func get_surface_primitive_type(surface_idx: int) -> intMesh.PrimitiveType#
Returns the primitive type of the requested surface (see add_surface).
func set_blend_shape_mode(mode: int enumMesh.BlendShapeMode) -> void#
Sets the blend shape mode to one of Mesh.BlendShapeMode.
func set_lightmap_size_hint(size: Vector2i) -> void#
Sets the size hint of this mesh for lightmap-unwrapping in UV-space.
func set_surface_material(material: Material) -> void#
Sets a Material for a given surface. Surface will be rendered using this material.
func set_surface_name(name: String) -> void#
Sets a name for a given surface.