mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-02 21:48:52 +03:00
434 lines
35 KiB
ReStructuredText
434 lines
35 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_GLTFDocument:
|
||
|
||
GLTFDocument
|
||
============
|
||
|
||
**Наследует:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
**Наследуется от:** :ref:`FBXDocument<class_FBXDocument>`
|
||
|
||
Класс для импорта и экспорта файлов glTF в Godot и из него.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Описание
|
||
----------------
|
||
|
||
GLTFDocument поддерживает чтение данных из файла glTF, буфера или сцены Godot. Затем эти данные можно записать в файловую систему, буфер или использовать для создания сцены Godot.
|
||
|
||
Все данные в сцене glTF хранятся в классе :ref:`GLTFState<class_GLTFState>`. GLTFDocument обрабатывает объекты состояния, но не содержит никаких данных самой сцены. GLTFDocument имеет переменные-члены для хранения параметров конфигурации экспорта, таких как формат изображения, но в остальном не имеет состояния. Несколько сцен можно обрабатывать с теми же настройками, используя тот же объект GLTFDocument и разные объекты :ref:`GLTFState<class_GLTFState>`.
|
||
|
||
GLTFDocument можно расширить с помощью произвольной функциональности, расширив класс :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` и зарегистрировав его в GLTFDocument через :ref:`register_gltf_document_extension()<class_GLTFDocument_method_register_gltf_document_extension>`. Это позволяет импортировать и экспортировать пользовательские данные.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Обучающие материалы
|
||
--------------------------------------
|
||
|
||
- :doc:`Загрузка и сохранение файла времени выполнения <../tutorials/io/runtime_file_loading_and_saving>`
|
||
|
||
- `glTF "Что за утка?" руководство <https://www.khronos.org/files/gltf20-reference-guide.pdf>`__
|
||
|
||
- `Спецификация Khronos glTF <https://registry.khronos.org/glTF/>`__
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Свойства
|
||
----------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------------------------------+-----------------------------------------------------------------------------------+------------+
|
||
| :ref:`String<class_String>` | :ref:`fallback_image_format<class_GLTFDocument_property_fallback_image_format>` | ``"None"`` |
|
||
+---------------------------------------------------------+-----------------------------------------------------------------------------------+------------+
|
||
| :ref:`float<class_float>` | :ref:`fallback_image_quality<class_GLTFDocument_property_fallback_image_quality>` | ``0.25`` |
|
||
+---------------------------------------------------------+-----------------------------------------------------------------------------------+------------+
|
||
| :ref:`String<class_String>` | :ref:`image_format<class_GLTFDocument_property_image_format>` | ``"PNG"`` |
|
||
+---------------------------------------------------------+-----------------------------------------------------------------------------------+------------+
|
||
| :ref:`float<class_float>` | :ref:`lossy_quality<class_GLTFDocument_property_lossy_quality>` | ``0.75`` |
|
||
+---------------------------------------------------------+-----------------------------------------------------------------------------------+------------+
|
||
| :ref:`RootNodeMode<enum_GLTFDocument_RootNodeMode>` | :ref:`root_node_mode<class_GLTFDocument_property_root_node_mode>` | ``0`` |
|
||
+---------------------------------------------------------+-----------------------------------------------------------------------------------+------------+
|
||
| :ref:`VisibilityMode<enum_GLTFDocument_VisibilityMode>` | :ref:`visibility_mode<class_GLTFDocument_property_visibility_mode>` | ``0`` |
|
||
+---------------------------------------------------------+-----------------------------------------------------------------------------------+------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Методы
|
||
------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`append_from_buffer<class_GLTFDocument_method_append_from_buffer>`\ (\ bytes\: :ref:`PackedByteArray<class_PackedByteArray>`, base_path\: :ref:`String<class_String>`, state\: :ref:`GLTFState<class_GLTFState>`, flags\: :ref:`int<class_int>` = 0\ ) |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`append_from_file<class_GLTFDocument_method_append_from_file>`\ (\ path\: :ref:`String<class_String>`, state\: :ref:`GLTFState<class_GLTFState>`, flags\: :ref:`int<class_int>` = 0, base_path\: :ref:`String<class_String>` = ""\ ) |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`append_from_scene<class_GLTFDocument_method_append_from_scene>`\ (\ node\: :ref:`Node<class_Node>`, state\: :ref:`GLTFState<class_GLTFState>`, flags\: :ref:`int<class_int>` = 0\ ) |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>` | :ref:`export_object_model_property<class_GLTFDocument_method_export_object_model_property>`\ (\ state\: :ref:`GLTFState<class_GLTFState>`, node_path\: :ref:`NodePath<class_NodePath>`, godot_node\: :ref:`Node<class_Node>`, gltf_node_index\: :ref:`int<class_int>`\ ) |static| |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`generate_buffer<class_GLTFDocument_method_generate_buffer>`\ (\ state\: :ref:`GLTFState<class_GLTFState>`\ ) |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Node<class_Node>` | :ref:`generate_scene<class_GLTFDocument_method_generate_scene>`\ (\ state\: :ref:`GLTFState<class_GLTFState>`, bake_fps\: :ref:`float<class_float>` = 30, trimming\: :ref:`bool<class_bool>` = false, remove_immutable_tracks\: :ref:`bool<class_bool>` = true\ ) |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_supported_gltf_extensions<class_GLTFDocument_method_get_supported_gltf_extensions>`\ (\ ) |static| |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>` | :ref:`import_object_model_property<class_GLTFDocument_method_import_object_model_property>`\ (\ state\: :ref:`GLTFState<class_GLTFState>`, json_pointer\: :ref:`String<class_String>`\ ) |static| |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`register_gltf_document_extension<class_GLTFDocument_method_register_gltf_document_extension>`\ (\ extension\: :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`, first_priority\: :ref:`bool<class_bool>` = false\ ) |static| |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`unregister_gltf_document_extension<class_GLTFDocument_method_unregister_gltf_document_extension>`\ (\ extension\: :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`\ ) |static| |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`write_to_filesystem<class_GLTFDocument_method_write_to_filesystem>`\ (\ state\: :ref:`GLTFState<class_GLTFState>`, path\: :ref:`String<class_String>`\ ) |
|
||
+---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Перечисления
|
||
------------------------
|
||
|
||
.. _enum_GLTFDocument_RootNodeMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **RootNodeMode**: :ref:`🔗<enum_GLTFDocument_RootNodeMode>`
|
||
|
||
.. _class_GLTFDocument_constant_ROOT_NODE_MODE_SINGLE_ROOT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`RootNodeMode<enum_GLTFDocument_RootNodeMode>` **ROOT_NODE_MODE_SINGLE_ROOT** = ``0``
|
||
|
||
Обрабатывать корневой узел сцены Godot как корневой узел файла glTF и отмечать его как единственный корневой узел с помощью расширения glTF ``GODOT_single_root``. Это будет проанализировано так же, как :ref:`ROOT_NODE_MODE_KEEP_ROOT<class_GLTFDocument_constant_ROOT_NODE_MODE_KEEP_ROOT>`, если реализация не поддерживает ``GODOT_single_root``.
|
||
|
||
.. _class_GLTFDocument_constant_ROOT_NODE_MODE_KEEP_ROOT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`RootNodeMode<enum_GLTFDocument_RootNodeMode>` **ROOT_NODE_MODE_KEEP_ROOT** = ``1``
|
||
|
||
Обрабатывайте корневой узел сцены Godot как корневой узел файла glTF, но не помечайте его как что-то особенное. При импорте в Godot будет сгенерирован дополнительный корневой узел. Это использует только функции vanilla glTF. Это эквивалентно поведению в Godot 4.1 и более ранних версиях.
|
||
|
||
.. _class_GLTFDocument_constant_ROOT_NODE_MODE_MULTI_ROOT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`RootNodeMode<enum_GLTFDocument_RootNodeMode>` **ROOT_NODE_MODE_MULTI_ROOT** = ``2``
|
||
|
||
Обрабатывать корневой узел сцены Godot как имя сцены glTF и добавлять все его дочерние элементы как корневые узлы файла glTF. Это использует только ванильные функции glTF. Это позволяет избежать дополнительного корневого узла, но будет сохранено только имя корневого узла сцены Godot, поскольку оно не будет сохранено как узел.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_GLTFDocument_VisibilityMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **VisibilityMode**: :ref:`🔗<enum_GLTFDocument_VisibilityMode>`
|
||
|
||
.. _class_GLTFDocument_constant_VISIBILITY_MODE_INCLUDE_REQUIRED:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`VisibilityMode<enum_GLTFDocument_VisibilityMode>` **VISIBILITY_MODE_INCLUDE_REQUIRED** = ``0``
|
||
|
||
Если сцена содержит какие-либо невидимые узлы, включите их, отметьте их как невидимые с помощью ``KHR_node_visibility`` и потребуйте, чтобы импортеры учитывали их невидимость. Недостаток: если импортер не поддерживает ``KHR_node_visibility``, файл не может быть импортирован.
|
||
|
||
.. _class_GLTFDocument_constant_VISIBILITY_MODE_INCLUDE_OPTIONAL:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`VisibilityMode<enum_GLTFDocument_VisibilityMode>` **VISIBILITY_MODE_INCLUDE_OPTIONAL** = ``1``
|
||
|
||
Если сцена содержит какие-либо невидимые узлы, включите их, отметьте их как невидимые с помощью ``KHR_node_visibility`` и не предъявляйте никаких требований к импортерам. Недостаток: если импортер не поддерживает ``KHR_node_visibility``, невидимые объекты будут видны.
|
||
|
||
.. _class_GLTFDocument_constant_VISIBILITY_MODE_EXCLUDE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`VisibilityMode<enum_GLTFDocument_VisibilityMode>` **VISIBILITY_MODE_EXCLUDE** = ``2``
|
||
|
||
Если сцена содержит какие-либо невидимые узлы, не включайте их в экспорт. Это то же самое, что и в Godot 4.4 и более ранних версиях. Недостаток: невидимые узлы не будут существовать в экспортированном файле.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Описания свойств
|
||
--------------------------------
|
||
|
||
.. _class_GLTFDocument_property_fallback_image_format:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`String<class_String>` **fallback_image_format** = ``"None"`` :ref:`🔗<class_GLTFDocument_property_fallback_image_format>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_fallback_image_format**\ (\ value\: :ref:`String<class_String>`\ )
|
||
- :ref:`String<class_String>` **get_fallback_image_format**\ (\ )
|
||
|
||
Удобное для пользователя, имя резервного формата изображения. Используется при экспорте файла glTF, включая запись в файл и запись в массив байтов.
|
||
|
||
Это свойство может быть только одним из "None", "PNG" или "JPEG" и используется только тогда, когда :ref:`image_format<class_GLTFDocument_property_image_format>` не является одним из "None", "PNG" или "JPEG". Если требуется иметь несколько форматов изображений с расширением, это можно сделать с помощью класса :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` — это свойство охватывает только вариант использования предоставления базового резервного изображения glTF при использовании пользовательского формата изображения.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_property_fallback_image_quality:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **fallback_image_quality** = ``0.25`` :ref:`🔗<class_GLTFDocument_property_fallback_image_quality>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_fallback_image_quality**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_fallback_image_quality**\ (\ )
|
||
|
||
Качество резервного изображения, если таковое имеется. Для файлов PNG это уменьшает изображение по обоим измерениям на этот коэффициент. Для файлов JPEG это качество изображения с потерями. Рекомендуется низкое значение, поскольку включение нескольких высококачественных изображений в файл glTF сводит на нет выигрыш в размере файла за счет использования более эффективного формата изображения.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_property_image_format:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`String<class_String>` **image_format** = ``"PNG"`` :ref:`🔗<class_GLTFDocument_property_image_format>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_image_format**\ (\ value\: :ref:`String<class_String>`\ )
|
||
- :ref:`String<class_String>` **get_image_format**\ (\ )
|
||
|
||
Удобное для пользователя название формата экспортируемого изображения. Используется при экспорте файла glTF, включая запись в файл и запись в массив байтов.
|
||
|
||
По умолчанию Godot допускает следующие параметры: «None», «PNG», «JPEG», «Lossless WebP» и «Lossy WebP». Поддержка дополнительных форматов изображений может быть добавлена в классы :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`. Один класс расширения может предоставлять несколько параметров для конкретного используемого формата или даже параметр, который использует несколько форматов одновременно.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_property_lossy_quality:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **lossy_quality** = ``0.75`` :ref:`🔗<class_GLTFDocument_property_lossy_quality>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_lossy_quality**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_lossy_quality**\ (\ )
|
||
|
||
Если :ref:`image_format<class_GLTFDocument_property_image_format>` — это формат изображения с потерями (lossy), это определяет качество изображения с потерями. В диапазоне от ``0.0`` до ``1.0``, где ``0.0`` — самое низкое качество, а ``1.0`` — самое высокое качество. Качество с потерями ``1.0`` не то же самое, что и без потерь.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_property_root_node_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`RootNodeMode<enum_GLTFDocument_RootNodeMode>` **root_node_mode** = ``0`` :ref:`🔗<class_GLTFDocument_property_root_node_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_root_node_mode**\ (\ value\: :ref:`RootNodeMode<enum_GLTFDocument_RootNodeMode>`\ )
|
||
- :ref:`RootNodeMode<enum_GLTFDocument_RootNodeMode>` **get_root_node_mode**\ (\ )
|
||
|
||
Как обрабатывать корневой узел во время экспорта. Значение по умолчанию и рекомендуемое значение — :ref:`ROOT_NODE_MODE_SINGLE_ROOT<class_GLTFDocument_constant_ROOT_NODE_MODE_SINGLE_ROOT>`.
|
||
|
||
\ **Примечание:** Независимо от того, как экспортируется файл glTF, при импорте тип и имя корневого узла можно переопределить на вкладке настроек импорта сцены.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_property_visibility_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`VisibilityMode<enum_GLTFDocument_VisibilityMode>` **visibility_mode** = ``0`` :ref:`🔗<class_GLTFDocument_property_visibility_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_visibility_mode**\ (\ value\: :ref:`VisibilityMode<enum_GLTFDocument_VisibilityMode>`\ )
|
||
- :ref:`VisibilityMode<enum_GLTFDocument_VisibilityMode>` **get_visibility_mode**\ (\ )
|
||
|
||
Как работать с видимостью узлов во время экспорта. Эта настройка ничего не делает, если все узлы видны. Значение по умолчанию и рекомендуемое значение — :ref:`VISIBILITY_MODE_INCLUDE_REQUIRED<class_GLTFDocument_constant_VISIBILITY_MODE_INCLUDE_REQUIRED>`, которое использует расширение ``KHR_node_visibility``.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Описания метода
|
||
------------------------------
|
||
|
||
.. _class_GLTFDocument_method_append_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **append_from_buffer**\ (\ bytes\: :ref:`PackedByteArray<class_PackedByteArray>`, base_path\: :ref:`String<class_String>`, state\: :ref:`GLTFState<class_GLTFState>`, flags\: :ref:`int<class_int>` = 0\ ) :ref:`🔗<class_GLTFDocument_method_append_from_buffer>`
|
||
|
||
Принимает :ref:`PackedByteArray<class_PackedByteArray>`, определяющий glTF, и импортирует данные в заданный объект :ref:`GLTFState<class_GLTFState>` через параметр ``state``.
|
||
|
||
\ **Примечание:** ``base_path`` сообщает :ref:`append_from_buffer()<class_GLTFDocument_method_append_from_buffer>`, где найти зависимости, и может быть пустым.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_append_from_file:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **append_from_file**\ (\ path\: :ref:`String<class_String>`, state\: :ref:`GLTFState<class_GLTFState>`, flags\: :ref:`int<class_int>` = 0, base_path\: :ref:`String<class_String>` = ""\ ) :ref:`🔗<class_GLTFDocument_method_append_from_file>`
|
||
|
||
Берет путь к файлу glTF и импортирует данные по этому пути к файлу в указанный объект :ref:`GLTFState<class_GLTFState>` через параметр ``state``.
|
||
|
||
\ **Примечание:** Параметр ``base_path`` сообщает :ref:`append_from_file()<class_GLTFDocument_method_append_from_file>`, где искать зависимости, и может быть пустым.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_append_from_scene:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **append_from_scene**\ (\ node\: :ref:`Node<class_Node>`, state\: :ref:`GLTFState<class_GLTFState>`, flags\: :ref:`int<class_int>` = 0\ ) :ref:`🔗<class_GLTFDocument_method_append_from_scene>`
|
||
|
||
Берет узел сцены Godot Engine и экспортирует его и его потомков в заданный объект :ref:`GLTFState<class_GLTFState>` через параметр ``state``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_export_object_model_property:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>` **export_object_model_property**\ (\ state\: :ref:`GLTFState<class_GLTFState>`, node_path\: :ref:`NodePath<class_NodePath>`, godot_node\: :ref:`Node<class_Node>`, gltf_node_index\: :ref:`int<class_int>`\ ) |static| :ref:`🔗<class_GLTFDocument_method_export_object_model_property>`
|
||
|
||
Определяет сопоставление между заданным Godot ``node_path`` и соответствующим указателем(ями) JSON объектной модели glTF в сгенерированном файле glTF. Подробности этого сопоставления возвращаются в объекте :ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>`. Дополнительные сопоставления могут быть предоставлены с помощью метода обратного вызова :ref:`GLTFDocumentExtension._import_object_model_property()<class_GLTFDocumentExtension_private_method__import_object_model_property>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_generate_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedByteArray<class_PackedByteArray>` **generate_buffer**\ (\ state\: :ref:`GLTFState<class_GLTFState>`\ ) :ref:`🔗<class_GLTFDocument_method_generate_buffer>`
|
||
|
||
Принимает объект :ref:`GLTFState<class_GLTFState>` через параметр ``state`` и возвращает glTF :ref:`PackedByteArray<class_PackedByteArray>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_generate_scene:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Node<class_Node>` **generate_scene**\ (\ state\: :ref:`GLTFState<class_GLTFState>`, bake_fps\: :ref:`float<class_float>` = 30, trimming\: :ref:`bool<class_bool>` = false, remove_immutable_tracks\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_GLTFDocument_method_generate_scene>`
|
||
|
||
Принимает объект :ref:`GLTFState<class_GLTFState>` через параметр ``state`` и возвращает узел сцены Godot Engine.
|
||
|
||
Параметр ``bake_fps`` переопределяет bake_fps в ``state``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_get_supported_gltf_extensions:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedStringArray<class_PackedStringArray>` **get_supported_gltf_extensions**\ (\ ) |static| :ref:`🔗<class_GLTFDocument_method_get_supported_gltf_extensions>`
|
||
|
||
Возвращает список всех поддерживаемых расширений glTF, включая расширения, поддерживаемые непосредственно движком, и расширения, поддерживаемые пользовательскими плагинами, регистрирующими классы :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`.
|
||
|
||
\ **Примечание:** Если этот метод запущен до регистрации GLTFDocumentExtension, его расширения не будут включены в список. Обязательно запускайте этот метод только после регистрации всех расширений. Если вы запускаете его при запуске движка, рассмотрите возможность ожидания кадра перед вызовом этого метода, чтобы убедиться, что все расширения зарегистрированы.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_import_object_model_property:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>` **import_object_model_property**\ (\ state\: :ref:`GLTFState<class_GLTFState>`, json_pointer\: :ref:`String<class_String>`\ ) |static| :ref:`🔗<class_GLTFDocument_method_import_object_model_property>`
|
||
|
||
Определяет сопоставление между заданной моделью объекта glTF ``json_pointer`` и соответствующим путям узла Godot в сгенерированной сцене Godot. Подробности этого сопоставления возвращаются в объекте :ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>`. Дополнительные сопоставления могут быть предоставлены с помощью метода обратного вызова :ref:`GLTFDocumentExtension._export_object_model_property()<class_GLTFDocumentExtension_private_method__export_object_model_property>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_register_gltf_document_extension:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **register_gltf_document_extension**\ (\ extension\: :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`, first_priority\: :ref:`bool<class_bool>` = false\ ) |static| :ref:`🔗<class_GLTFDocument_method_register_gltf_document_extension>`
|
||
|
||
Регистрирует заданный экземпляр :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` с GLTFDocument. Если ``first_priority`` равен ``true``, это расширение будет запущено первым. В противном случае оно будет запущено последним.
|
||
|
||
\ **Примечание:** Как и сам GLTFDocument, все классы GLTFDocumentExtension должны быть без состояния для правильной работы. Если вам нужно сохранить данные, используйте методы ``set_additional_data`` и ``get_additional_data`` в :ref:`GLTFState<class_GLTFState>` или :ref:`GLTFNode<class_GLTFNode>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_unregister_gltf_document_extension:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **unregister_gltf_document_extension**\ (\ extension\: :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`\ ) |static| :ref:`🔗<class_GLTFDocument_method_unregister_gltf_document_extension>`
|
||
|
||
Отменяет регистрацию указанного экземпляра :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_GLTFDocument_method_write_to_filesystem:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **write_to_filesystem**\ (\ state\: :ref:`GLTFState<class_GLTFState>`, path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_GLTFDocument_method_write_to_filesystem>`
|
||
|
||
Принимает объект :ref:`GLTFState<class_GLTFState>` через параметр ``state`` и записывает файл glTF в файловую систему.
|
||
|
||
\ **Примечание:** Расширение файла glTF определяет, является ли он двоичным файлом .glb или текстовым файлом .gltf.
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (Этот метод обычно должен быть переопределен пользователем, чтобы иметь какой-либо эффект.)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (Этот метод не имеет побочных эффектов. Он не изменяет ни одну из переменных-членов экземпляра.)`
|
||
.. |vararg| replace:: :abbr:`vararg (Этот метод принимает любое количество аргументов после описанных здесь.)`
|
||
.. |constructor| replace:: :abbr:`constructor (Этот метод используется для создания типа.)`
|
||
.. |static| replace:: :abbr:`static (Этот метод не нуждается в вызове экземпляра, поэтому его можно вызвать напрямую, используя имя класса.)`
|
||
.. |operator| replace:: :abbr:`operator (Этот метод описывает допустимый оператор для использования с этим типом в качестве левого операнда.)`
|
||
.. |bitfield| replace:: :abbr:`BitField (Это значение является целым числом, составленным как битовая маска следующих флагов.)`
|
||
.. |void| replace:: :abbr:`void (Нет возвращаемого значения.)`
|