Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
EditorSceneFormatImporter
Успадковує: RefCounted < Object
Успадковано від: EditorSceneFormatImporterBlend, EditorSceneFormatImporterFBX2GLTF, EditorSceneFormatImporterGLTF, EditorSceneFormatImporterUFBX
Імпортні сцени з 3D файлів.
Опис
EditorSceneFormatImporter дозволяє визначити скрипт імпортера для третього формату 3D.
Для використання EditorSceneFormatImporter, зареєструйте його за допомогою EditorPlugin.add_scene_format_importer_plugin().
Методи
PackedStringArray |
_get_extensions() virtual required const |
void |
_get_import_options(path: String) virtual |
Variant |
_get_option_visibility(path: String, for_animation: bool, option: String) virtual const |
Object |
_import_scene(path: String, flags: int, options: Dictionary) virtual required |
void |
add_import_option(name: String, value: Variant) |
void |
add_import_option_advanced(type: Variant.Type, name: String, default_value: Variant, hint: PropertyHint = 0, hint_string: String = "", usage_flags: int = 6) |
Переліки
flags ImportFlags: 🔗
ImportFlags IMPORT_SCENE = 1
Unused flag (this has no effect when enabled).
ImportFlags IMPORT_ANIMATION = 2
Import animations from the 3D scene. When importing a scene as an AnimationLibrary, this flag is always enabled.
ImportFlags IMPORT_FAIL_ON_MISSING_DEPENDENCIES = 4
Unused flag (this has no effect when enabled).
ImportFlags IMPORT_GENERATE_TANGENT_ARRAYS = 8
If true, generate vertex tangents using Mikktspace if the input meshes don't have tangent data. When possible, it's recommended to let the 3D modeling software generate tangents on export instead of relying on this option. Tangents are required for correct display of normal and height maps, along with any material/shader features that require tangents.
If you don't need material features that require tangents, disabling this can reduce output file size and speed up importing if the source 3D file doesn't contain tangents.
ImportFlags IMPORT_USE_NAMED_SKIN_BINDS = 16
If checked, use named Skins for animation. The MeshInstance3D node contains 3 properties of relevance here: a skeleton NodePath pointing to the Skeleton3D node (usually ..), a mesh, and a skin:
The Skeleton3D node contains a list of bones with names, their pose and rest, a name, and a parent bone.
The mesh is all of the raw vertex data needed to display a mesh. In terms of the mesh, it knows how vertices are weight-painted and uses some internal numbering often imported from 3D modeling software.
The skin contains the information necessary to bind this mesh onto this Skeleton3D. For each of the internal bone IDs chosen by the 3D modeling software, it contains two things. Firstly, a matrix known as the Bind Pose Matrix, Inverse Bind Matrix, or IBM for short. Secondly, the Skin contains each bone's name (if this flag is enabled), or the bone's index within the Skeleton3D list (if this flag is disabled).
Together, this information is enough to tell Godot how to use the bone poses in the Skeleton3D node to render the mesh from each MeshInstance3D. Note that each MeshInstance3D may share binds, as is common in models exported from Blender, or each MeshInstance3D may use a separate Skin object, as is common in models exported from other tools such as Maya.
ImportFlags IMPORT_DISCARD_MESHES_AND_MATERIALS = 32
Ignore meshes and materials on import. When importing a scene as an AnimationLibrary, this flag is always enabled.
ImportFlags IMPORT_FORCE_DISABLE_MESH_COMPRESSION = 64
Якщо true, стиснення сітки не буде використовуватися. З огляду на те, що ви помітили блоковані артефакти у ваших сітчастих нормах або УФ, або якщо у вас є сітки, які більше, ніж кілька тисяч метрів в кожному напрямку.
Описи методів
PackedStringArray _get_extensions() virtual required const 🔗
Повернути підтримувані розширення файлів для цього імпортера сцен.
void _get_import_options(path: String) virtual 🔗
Перевизначте, щоб додати загальні параметри імпорту. Вони з’являться в головній панелі імпорту в редакторі. Додайте параметри за допомогою add_import_option() і add_import_option_advanced().
Примітка. Усі екземпляри EditorSceneFormatImporter і EditorScenePostImportPlugin додадуть параметри для всіх файлів. Рекомендується перевіряти розширення файлу, якщо path не порожній.
Коли користувач редагує параметри проекту, path буде порожнім. Рекомендується додавати всі параметри, коли path порожній, щоб дозволити користувачеві налаштувати імпорт за замовчуванням.
Variant _get_option_visibility(path: String, for_animation: bool, option: String) virtual const 🔗
Має повернути true, щоб показати заданий параметр, false, щоб приховати вказаний параметр, або null, щоб проігнорувати.
Object _import_scene(path: String, flags: int, options: Dictionary) virtual required 🔗
Виконайте основну частину логіки імпорту сцени тут, наприклад, використовуючи GLTFDocument або FBXDocument.
void add_import_option(name: String, value: Variant) 🔗
Додайте певний параметр імпорту (лише ім’я та значення за замовчуванням). Цю функцію можна викликати лише з _get_import_options().
void add_import_option_advanced(type: Variant.Type, name: String, default_value: Variant, hint: PropertyHint = 0, hint_string: String = "", usage_flags: int = 6) 🔗
Додайте окремий параметр імпорту. Цю функцію можна викликати лише з _get_import_options().