Skip to content

The mesh pipeline and the asset editors ​

This page is the technical side of Supported files and best practice and the asset walkthrough: how a mesh file becomes a Mesh on a character, where its settings and its skin live, how the libraries read their folders, and what each asset editor is made of.

From a file to a mesh on a character ​

text
 path in the data ──► MeshSource.load_mesh(path)
                        │  .tres .res .obj      load(path) as Mesh
                        │  .glb .gltf .fbx .blend  load as PackedScene ► the one MeshInstance3D ► its mesh (+ its skin)
                        â–¼
                      MeshSettings.apply_to(mesh, path)   (formats that cannot save: the stored settings become metadata)
                        â–¼
                      the cached Mesh, with metadata  ──►  DatabaseMeshes / EntityRigComponent / the editors
                                                            â–¼
                                                    GeneralSkeleton / ModularSkeleton._apply_mesh_to_*
ClassRole
MeshSource (runtime_classes/utility/mesh_source.gd)The one place that loads a mesh file. EXTENSIONS and SCENE_FORMATS list the file types. load_mesh(path) returns the mesh (or null), load_skin(path) its skin (or null), mesh_node_count(path) how many mesh nodes a model holds, clear_cache() forgets the loaded meshes
MeshSettings (data_classes/meshes/mesh_settings.gd)The settings of the meshes that cannot keep them in their own file. save_mesh(mesh, path) is the one call the editors make after changing a setting
DatabaseMeshesScans the folders (MESH_EXTENSIONS), answers get_body_part_mesh_and_skin, get_attachment_mesh_and_skin, get_weapon_mesh ..., validates the library
ModelSceneDatabaseSkeletons and interactable models (.tscn); keeps the supported skeleton types of a mesh through MeshSettings.save_mesh
ExtendedSkinServiceRemaps a skin onto the bones of a skeleton

Loading a model that is a scene ​

A .glb, .gltf, .fbx or .blend file is imported by Godot as a PackedScene. MeshSource instantiates it, collects the MeshInstance3D nodes (the root included), takes the first one's mesh and skin, and frees the instance. The mesh is cached per path, so the scene is instantiated once. With more than one mesh node it warns and uses the first; DatabaseMeshes.validate_database() returns a MESH_NODE_COUNT warning for every model whose count is not 1. A .blend that Godot could not import (no Blender) does not exist for ResourceLoader and gives no mesh.

Settings are metadata ​

The toolkit reads every mesh setting as metadata of the Mesh: mesh.get_meta("position_offset") and so on. For a resource mesh the metadata is inside the file. For anything else MeshSource.load_mesh calls MeshSettings.apply_to, which sets the stored values as metadata on the loaded mesh (a value the mesh already has is kept). So the skeleton classes, the rig, the item editors and the preview never know which way a setting is kept.

KeyTypeUsed by
position_offsetVector3The weapon's position in the hand (GeneralSkeleton._apply_weapon_transform_offset)
rotation_offsetVector3 (degrees)The weapon's rotation
enchant_vfx_positionVector3Copied to the weapon's MeshInstance3D as metadata for the enchant VFX
projectile_spawn_pointVector3Copied to the weapon's MeshInstance3D; where shots leave
supported_skeleton_typesArray[String]ModelSceneDatabase.does_mesh_support_skeleton_type; all types when absent
skinSkinThe skin of the piece (see below)
allowed_materials_surface_<n>, preferred_material_surface_<n>Array, StringThe material constraints of surface n
allowed_materials, preferred_material, material_categoriesThe older whole-mesh settings (the editor can remove them)

MeshSettings.save_mesh(mesh, path) persists all the metadata the mesh has now (names that start with _ are left out): into the file with ResourceSaver.save for .tres and .res, and into res://src/data/meshes/mesh_settings.tres for every other format. Because it saves the whole set, removing a key from the mesh removes it from the storage too.

Why not convert to .res ​

ResourceSaver.save on a mesh loaded from an .obj (or from any imported file) returns ERR_FILE_UNRECOGNIZED and writes nothing: Godot owns the import. A converted .res copy would be a second file that stops following its source, breaks references when the source is re-exported (Godot reports an invalid UID and falls back to the path), and is tied to the Godot version. So the settings stay beside the source, keyed by its UID:

  • MeshSettings.key_of(path) is ResourceUID.id_to_text(ResourceLoader.get_resource_uid(path)), or "path:" + path for a file with no UID.
  • The UID is written in the .import file and follows the file when it is moved or renamed in the Godot file system dock. Each entry also remembers the last path.
  • MeshSettings.orphans() lists entries whose file is gone (by UID, then by path); validate_database reports them as ORPHAN_MESH_SETTINGS.

Skins ​

A skin is optional. The skeleton classes (GeneralSkeleton._apply_mesh_to_attachment, ModularSkeleton._apply_mesh_to_instance) do this when a mesh is applied:

  1. mesh_instance.mesh = mesh.
  2. The skin is the one passed in, else mesh.get_meta("skin") (duplicated, so instances do not share it).
  3. With a skin: _remap_skin_for_skeleton(skin) and mesh_instance.skin = remapped. Without one: mesh_instance.skin = null and the mesh is drawn as it is. Nothing warns.

MeshSource.load_mesh puts a skin in the metadata of a model when its mesh node has one (and the settings give none). DatabaseMeshes also looks for the companion file (<name>_skin.<extension>, with _mesh replaced by _skin) when it answers get_body_part_mesh_and_skin and its siblings, and the mesh editor's Find & Link All Skins writes the companion skin into the metadata.

Remapping ​

_remap_skin_for_skeleton returns the skin untouched when it already has Godot humanoid bone names (it looks for Hips, Spine, Chest, Head, LeftUpperArm, RightUpperArm). Otherwise ExtendedSkinService.remap_all_bones_in_skin(skin, skeleton) builds a new Skin:

  1. Each bind name goes through get_mapped_bone_name: a table from the bone names of the asset packs the toolkit was made with (pelvis → Hips, spine_01 → Spine, upperarm_l → LeftUpperArm, thigh_r → RightUpperLeg, the fingers, eye_l ...). Names not in the table stay as they are.
  2. If the skeleton has no such bone, get_fallback_bone_name_with_remapping chooses one from the name: hair_dyn* → Head, hips_dyn*, cloth_dyn*, skirt_dyn* → Hips, cape_dyn*, cloak_dyn* → UpperChest, arm_dyn* and leg_dyn* → the matching limb bone, other *_dyn* → UpperChest, weapon and shield bones → the hands, the *Attach* bones → the attachment bones of the skeleton.
  3. The bind pose of each bone is recomputed from the skeleton: skeleton.get_bone_global_rest(bone).inverse(), so the piece fits whatever rest pose the skeleton has.
  4. A bone that cannot be mapped is left out. If the whole remap fails, get_working_skin() returns res://skin_working.tres if the project has it (it logs an error if not) and the skeleton keeps the original skin.

To support the bone names of another pack, add them to get_mapped_bone_name (or give the pieces Godot humanoid names and no remap is needed).

How the libraries read their folders ​

Each library walks its folders with DirAccess and keeps what it finds in static dictionaries, filled once and refreshed by the editor's Refresh (refresh_database()):

LibraryClassFilesLayout
MeshesDatabaseMeshesMESH_EXTENSIONSequipment/weapons/<category>/, equipment/body_parts/<tag>/<part>/, equipment/attachments/<tag>/<slot>/, facial/<tag>/<feature>/, materials/<category>/
Model scenesModelSceneDatabase.tscnskeletons/, interactable_models/
AnimationsDatabaseAnimation.res, .anim<entity type>/<package>/<category>/[<subcategory>/] (four structure patterns), animation_map.tres
VFXDatabaseVFX.tscn (scenes), .tres .res .png .jpg .jpeg .webp (telegraph), .tres .res (material)One folder for each of the seven types
AudioDatabaseAudio.wav .ogg .mp3SFX_CATEGORIES; voicelines/<character>/[<language>/]
IconsDatabaseIcons.png .jpg .jpeg .svg .webpicons/<category>/<id>.<ext>

DatabaseMeshes._get_files_in_folder strips .import and .remap from the names it lists, so a mesh is found in the editor (where Godot keeps foo.glb.import beside foo.glb) and in an exported game (which lists foo.glb.import). The other libraries still compare the plain extension: test an export of a project that scans folders at run time before you ship it. Giving every scan the same cleaning is not done yet.

The editors in detail ​

All seven extend VBoxContainer and live in editor_components/editors/assets/. They share a shape: a search box and a refresh button, a tree or a list built from the library's calls, a settings menu, an import dialog that copies files and asks for a destination, and a validation function whose findings are shown in a dialog. The scenes use unique names (%Name).

EditorWhat it editsCalls and filesValidation
MeshDatabaseEditorMeshes: the tree, the info panel, material constraints by surface, weapon offsets and pointsLoads with MeshSource.load_mesh, saves with MeshSettings.save_mesh; _find_and_link_all_skins; thumbnails by DatabaseMeshesDatabaseMeshes.validate_database: missing files, mesh node counts, orphan settings
SkeletonsEditor, InteractableScenesEditorSkeleton and interactable scenes, their points (ScenePointsTools)SkeletonSceneConverter, InteractableSceneCreator; opens a scene in the 3D editorThe points list says which are missing; Add missing points makes them (SkeletonPoints, InteractablePoints)
AnimationDatabaseEditorEntity types, their parents and the animation mapCorePackageEditor builds the map's drop-downs by reflection of AnimationCoreMap; DatabaseAnimation.build_library_for_entity_validate_entity, _validate_core_animations, _validate_status_effects
VFXDatabaseEditorVFX by type_create_new_vfx_scene makes the root node of a type; _perform_vfx_import_validate_single_vfx, _validate_telegraph_vfx, _validate_material_vfx
AudioDatabaseEditorSounds by category; a voice line panel (languages, warnings, subtitle)DatabaseAudio; VoicelineSubtitles; voice_line_warnings, set_subtitle, import_language_recording are static and testable_validate_database: every file loads
IconDatabaseEditorIcons as a grid by categoryDatabaseIcons.import_icons_to_category numbers the filesMissing ids are shown as "ID n (Not Found)" where used

Adding to the mesh editor ​

You wantDo
A new mesh settingRead it from the metadata where it is used (mesh.get_meta("my_setting")), and in the editor set it with mesh.set_meta then call MeshSettings.save_mesh(mesh, path). It is stored in the file or in the settings file by itself
A new file typeAdd it to MeshSource.EXTENSIONS (and to SCENE_FORMATS if Godot imports it as a scene) and to DatabaseMeshes.MESH_EXTENSIONS, and to the filters of the import dialog
A pack with other bone namesAdd the names to ExtendedSkinService.get_mapped_bone_name

See also ​