Files
godot-docs-l10n/classes/ru/class_gltfobjectmodelproperty.rst

374 lines
28 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_GLTFObjectModelProperty:
GLTFObjectModelProperty
=======================
**Наследует:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Описывает, как получить доступ к свойству, определенному в объектной модели glTF.
.. rst-class:: classref-introduction-group
Описание
----------------
GLTFObjectModelProperty определяет сопоставление между свойством в объектной модели glTF и NodePath в дереве сцены Godot. Это можно использовать для анимации свойств в файле glTF с помощью расширения ``KHR_animation_pointer`` или для доступа к ним через независимый от движка скрипт, такой как граф поведения, определенный расширением ``KHR_interactivity``.
Свойство glTF идентифицируется указателем(ями) JSON, хранящимся в :ref:`json_pointers<class_GLTFObjectModelProperty_property_json_pointers>`, в то время как свойство Godot, с которым оно сопоставляется, определяется :ref:`node_paths<class_GLTFObjectModelProperty_property_node_paths>`. В большинстве случаев :ref:`json_pointers<class_GLTFObjectModelProperty_property_json_pointers>` и :ref:`node_paths<class_GLTFObjectModelProperty_property_node_paths>` будут иметь только один элемент, но в некоторых случаях один указатель glTF JSON будет сопоставляться с несколькими свойствами Godot, или одно свойство Godot будет сопоставляться с несколькими указателями glTF JSON, или это может быть отношение «многие ко многим».
Объекты :ref:`Expression<class_Expression>` могут использоваться для определения преобразований между данными, например, когда glTF определяет угол в радианах, а Godot использует градусы. Свойство :ref:`object_model_type<class_GLTFObjectModelProperty_property_object_model_type>` определяет тип данных, хранящихся в файле glTF, как определено объектной моделью, см. :ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` для возможных значений.
.. rst-class:: classref-introduction-group
Обучающие материалы
--------------------------------------
- `Объектная модель GLTF <https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/ObjectModel.adoc>`__
- `Расширение GLTF KHR_animation_pointer <https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_animation_pointer>`__
.. rst-class:: classref-reftable-group
Свойства
----------------
.. table::
:widths: auto
+--------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+--------+
| :ref:`Expression<class_Expression>` | :ref:`gltf_to_godot_expression<class_GLTFObjectModelProperty_property_gltf_to_godot_expression>` | |
+--------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+--------+
| :ref:`Expression<class_Expression>` | :ref:`godot_to_gltf_expression<class_GLTFObjectModelProperty_property_godot_to_gltf_expression>` | |
+--------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+--------+
| :ref:`Array<class_Array>`\[:ref:`PackedStringArray<class_PackedStringArray>`\] | :ref:`json_pointers<class_GLTFObjectModelProperty_property_json_pointers>` | ``[]`` |
+--------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+--------+
| :ref:`Array<class_Array>`\[:ref:`NodePath<class_NodePath>`\] | :ref:`node_paths<class_GLTFObjectModelProperty_property_node_paths>` | ``[]`` |
+--------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+--------+
| :ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` | :ref:`object_model_type<class_GLTFObjectModelProperty_property_object_model_type>` | ``0`` |
+--------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+--------+
| :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` | :ref:`variant_type<class_GLTFObjectModelProperty_property_variant_type>` | ``0`` |
+--------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+--------+
.. rst-class:: classref-reftable-group
Методы
------------
.. table::
:widths: auto
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`append_node_path<class_GLTFObjectModelProperty_method_append_node_path>`\ (\ node_path\: :ref:`NodePath<class_NodePath>`\ ) |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`append_path_to_property<class_GLTFObjectModelProperty_method_append_path_to_property>`\ (\ node_path\: :ref:`NodePath<class_NodePath>`, prop_name\: :ref:`StringName<class_StringName>`\ ) |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` | :ref:`get_accessor_type<class_GLTFObjectModelProperty_method_get_accessor_type>`\ (\ ) |const| |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_json_pointers<class_GLTFObjectModelProperty_method_has_json_pointers>`\ (\ ) |const| |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_node_paths<class_GLTFObjectModelProperty_method_has_node_paths>`\ (\ ) |const| |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_types<class_GLTFObjectModelProperty_method_set_types>`\ (\ variant_type\: :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`, obj_model_type\: :ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>`\ ) |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Перечисления
------------------------
.. _enum_GLTFObjectModelProperty_GLTFObjectModelType:
.. rst-class:: classref-enumeration
enum **GLTFObjectModelType**: :ref:`🔗<enum_GLTFObjectModelProperty_GLTFObjectModelType>`
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_UNKNOWN:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_UNKNOWN** = ``0``
Неизвестный или не установленный тип модели объекта. Если тип модели объекта установлен на это значение, реальный тип все еще необходимо определить.
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_BOOL:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_BOOL** = ``1``
Тип модели объекта "bool". Представлен в glTF JSON как логическое значение и закодирован в ``GLTFaccessor`` как "SCALAR". При кодировании в accessor значение ``0`` равно ``false``, а любое другое значение равно ``true``.
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT** = ``2``
Тип модели объекта "float". Представлен в glTF JSON как число и закодирован в ``GLTFaccessor`` как "SCALAR".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT_ARRAY:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT_ARRAY** = ``3``
Тип модели объекта "float\[\]". Представлен в glTF JSON как массив чисел и закодирован в ``GLTFaccessor`` как "SCALAR".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT2:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT2** = ``4``
Тип модели объекта "float2". Представлен в glTF JSON как массив из двух чисел и закодирован в ``GLTFaccessor`` как "VEC2".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT3:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT3** = ``5``
Тип модели объекта "float3". Представлен в glTF JSON как массив из трех чисел и закодирован в ``GLTFaccessor`` как "VEC3".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT4:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT4** = ``6``
Тип модели объекта "float4". Представлен в glTF JSON как массив из четырех чисел и закодирован в ``GLTFaccessor`` как "VEC4".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT2X2:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT2X2** = ``7``
Тип модели объекта "float2x2". Представлен в glTF JSON как массив из четырех чисел и закодирован в ``GLTFaccessor`` как "MAT2".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT3X3:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT3X3** = ``8``
Тип модели объекта "float3x3". Представлен в glTF JSON как массив из девяти чисел и закодирован в ``GLTFaccessor`` как "MAT3".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_FLOAT4X4:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_FLOAT4X4** = ``9``
Тип модели объекта "float4x4". Представлен в glTF JSON как массив из шестнадцати чисел и закодирован в ``GLTFaccessor`` как "MAT4".
.. _class_GLTFObjectModelProperty_constant_GLTF_OBJECT_MODEL_TYPE_INT:
.. rst-class:: classref-enumeration-constant
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **GLTF_OBJECT_MODEL_TYPE_INT** = ``10``
Тип модели объекта "int". Представлен в glTF JSON как число и закодирован в ``GLTFaccessor`` как "SCALAR". Диапазон значений ограничен целыми числами со знаком. Для ``KHR_interactivity`` поддерживаются только 32-битные целые числа.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Описания свойств
--------------------------------
.. _class_GLTFObjectModelProperty_property_gltf_to_godot_expression:
.. rst-class:: classref-property
:ref:`Expression<class_Expression>` **gltf_to_godot_expression** :ref:`🔗<class_GLTFObjectModelProperty_property_gltf_to_godot_expression>`
.. rst-class:: classref-property-setget
- |void| **set_gltf_to_godot_expression**\ (\ value\: :ref:`Expression<class_Expression>`\ )
- :ref:`Expression<class_Expression>` **get_gltf_to_godot_expression**\ (\ )
Если установлено, этот :ref:`Expression<class_Expression>` будет использоваться для преобразования значения свойства из объектной модели glTF в значение, ожидаемое свойством Godot. Это полезно, когда объектная модель glTF использует другую систему единиц или когда данные необходимо преобразовать каким-либо образом. Если ``null``, значение будет скопировано как есть.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_property_godot_to_gltf_expression:
.. rst-class:: classref-property
:ref:`Expression<class_Expression>` **godot_to_gltf_expression** :ref:`🔗<class_GLTFObjectModelProperty_property_godot_to_gltf_expression>`
.. rst-class:: classref-property-setget
- |void| **set_godot_to_gltf_expression**\ (\ value\: :ref:`Expression<class_Expression>`\ )
- :ref:`Expression<class_Expression>` **get_godot_to_gltf_expression**\ (\ )
Если установлено, это :ref:`Expression<class_Expression>` будет использоваться для преобразования значения свойства из свойства Godot в значение, ожидаемое объектной моделью glTF. Это полезно, когда объектная модель glTF использует другую систему единиц или когда данные необходимо преобразовать каким-либо образом. Если ``null``, значение будет скопировано как есть.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_property_json_pointers:
.. rst-class:: classref-property
:ref:`Array<class_Array>`\[:ref:`PackedStringArray<class_PackedStringArray>`\] **json_pointers** = ``[]`` :ref:`🔗<class_GLTFObjectModelProperty_property_json_pointers>`
.. rst-class:: classref-property-setget
- |void| **set_json_pointers**\ (\ value\: :ref:`Array<class_Array>`\[:ref:`PackedStringArray<class_PackedStringArray>`\]\ )
- :ref:`Array<class_Array>`\[:ref:`PackedStringArray<class_PackedStringArray>`\] **get_json_pointers**\ (\ )
Указатели JSON объектной модели glTF, используемые для идентификации свойства в объектной модели glTF. В большинстве случаев в этом массиве будет только один элемент, но в некоторых случаях может потребоваться несколько указателей. Элементы сами по себе являются массивами, которые представляют указатель JSON, разделенный на его компоненты.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_property_node_paths:
.. rst-class:: classref-property
:ref:`Array<class_Array>`\[:ref:`NodePath<class_NodePath>`\] **node_paths** = ``[]`` :ref:`🔗<class_GLTFObjectModelProperty_property_node_paths>`
.. rst-class:: classref-property-setget
- |void| **set_node_paths**\ (\ value\: :ref:`Array<class_Array>`\[:ref:`NodePath<class_NodePath>`\]\ )
- :ref:`Array<class_Array>`\[:ref:`NodePath<class_NodePath>`\] **get_node_paths**\ (\ )
Массив :ref:`NodePath<class_NodePath>`, указывающий на свойство или несколько свойств в дереве сцены Godot. При импорте это будет установлено либо :ref:`GLTFDocument<class_GLTFDocument>`, либо классом :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`. В простых случаях используйте :ref:`append_path_to_property()<class_GLTFObjectModelProperty_method_append_path_to_property>`, чтобы добавить свойства в этот массив.
В большинстве случаев :ref:`node_paths<class_GLTFObjectModelProperty_property_node_paths>` будет иметь только один элемент, но в некоторых случаях один указатель glTF JSON будет отображаться на несколько свойств Godot. Например, :ref:`GLTFCamera<class_GLTFCamera>` или :ref:`GLTFLight<class_GLTFLight>`, используемые на нескольких узлах glTF, будут представлены несколькими узлами Godot.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_property_object_model_type:
.. rst-class:: classref-property
:ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **object_model_type** = ``0`` :ref:`🔗<class_GLTFObjectModelProperty_property_object_model_type>`
.. rst-class:: classref-property-setget
- |void| **set_object_model_type**\ (\ value\: :ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>`\ )
- :ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` **get_object_model_type**\ (\ )
Тип данных, хранящихся в файле glTF, как определено объектной моделью. Это надмножество доступных типов аксессоров, и определяет тип аксессора.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_property_variant_type:
.. rst-class:: classref-property
:ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` **variant_type** = ``0`` :ref:`🔗<class_GLTFObjectModelProperty_property_variant_type>`
.. rst-class:: classref-property-setget
- |void| **set_variant_type**\ (\ value\: :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`\ )
- :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` **get_variant_type**\ (\ )
Тип данных, хранящихся в свойстве Godot. Это тип свойства, на которое указывает :ref:`node_paths<class_GLTFObjectModelProperty_property_node_paths>`.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Описания метода
------------------------------
.. _class_GLTFObjectModelProperty_method_append_node_path:
.. rst-class:: classref-method
|void| **append_node_path**\ (\ node_path\: :ref:`NodePath<class_NodePath>`\ ) :ref:`🔗<class_GLTFObjectModelProperty_method_append_node_path>`
Добавляет :ref:`NodePath<class_NodePath>` к :ref:`node_paths<class_GLTFObjectModelProperty_property_node_paths>`. Это может использоваться классами :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` для определения того, как свойство объектной модели glTF сопоставляется со свойством Godot или несколькими свойствами Godot. Предпочитайте использовать :ref:`append_path_to_property()<class_GLTFObjectModelProperty_method_append_path_to_property>` для простых случаев. Обязательно также вызовите :ref:`set_types()<class_GLTFObjectModelProperty_method_set_types>` один раз (порядок не имеет значения).
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_method_append_path_to_property:
.. rst-class:: classref-method
|void| **append_path_to_property**\ (\ node_path\: :ref:`NodePath<class_NodePath>`, prop_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_GLTFObjectModelProperty_method_append_path_to_property>`
Высокоуровневая оболочка над :ref:`append_node_path()<class_GLTFObjectModelProperty_method_append_node_path>`, которая обрабатывает наиболее распространенные случаи. Она создает новый :ref:`NodePath<class_NodePath>`, используя ``node_path`` в качестве базы, и добавляет ``prop_name`` к подпути. Обязательно вызовите :ref:`set_types()<class_GLTFObjectModelProperty_method_set_types>` один раз (порядок не имеет значения).
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_method_get_accessor_type:
.. rst-class:: classref-method
:ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **get_accessor_type**\ (\ ) |const| :ref:`🔗<class_GLTFObjectModelProperty_method_get_accessor_type>`
Тип аксессора GLTF, связанный с :ref:`object_model_type<class_GLTFObjectModelProperty_property_object_model_type>` этого свойства. См. :ref:`GLTFAccessor.accessor_type<class_GLTFAccessor_property_accessor_type>` для возможных значений и см. :ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>` для того, чтобы понять как тип объектной модели сопоставляется с типами аксессора.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_method_has_json_pointers:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **has_json_pointers**\ (\ ) |const| :ref:`🔗<class_GLTFObjectModelProperty_method_has_json_pointers>`
Возвращает ``true``, если :ref:`json_pointers<class_GLTFObjectModelProperty_property_json_pointers>` не пуст. Это используется во время экспорта, чтобы определить, может ли **GLTFObjectModelProperty** обрабатывать преобразование свойства Godot в свойство объектной модели glTF.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_method_has_node_paths:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **has_node_paths**\ (\ ) |const| :ref:`🔗<class_GLTFObjectModelProperty_method_has_node_paths>`
Возвращает ``true``, если :ref:`node_paths<class_GLTFObjectModelProperty_property_node_paths>` не пуст. Это используется во время импорта, чтобы определить, может ли **GLTFObjectModelProperty** обрабатывать преобразование свойства модели объекта glTF в свойство Godot.
.. rst-class:: classref-item-separator
----
.. _class_GLTFObjectModelProperty_method_set_types:
.. rst-class:: classref-method
|void| **set_types**\ (\ variant_type\: :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`, obj_model_type\: :ref:`GLTFObjectModelType<enum_GLTFObjectModelProperty_GLTFObjectModelType>`\ ) :ref:`🔗<class_GLTFObjectModelProperty_method_set_types>`
Устанавливает свойства :ref:`variation_type<class_GLTFObjectModelProperty_property_variation_type>` и :ref:`object_model_type<class_GLTFObjectModelProperty_property_object_model_type>`. Это удобный метод для установки обоих свойств одновременно, поскольку они почти всегда известны в одно и то же время. Этот метод следует вызывать один раз. Повторный вызов с теми же значениями не даст никакого эффекта.
.. |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 (Нет возвращаемого значения.)`