Making a simple JRPG (Part 2)
I spent a few hours trying various ways of quickly importing meshes as a MeshLibrary for the GridMap and eventually settled on a simple post import script which helps me iterate quickly while making my assets. #import_mesh_library.gd @tool extends EditorScenePostImport # Generate a MeshLibrary from all the mesh in the imported in the scene const mesh_path: String = "res://Models/Meshes/Tiles" var meshes: Array[Mesh] func _post_import(scene): var dir = Directory.new() if not dir.dir_exists(mesh_path): dir.make_dir_recursive(mesh_path) _iterate(scene) _save_mesh_library() return scene func _iterate(node): if node != null: match node.get_class(): "MeshInstance3D": var resource_path = "%s/%s.mesh" % [mesh_path, node.name] meshes.append((node as MeshInstance3D).mesh) _: pass for child in node.get_children(): _iterate(child) func _save_mesh_library(): var source_file = get_source_file() var file_name = (source_file.get...