This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Иерархия и наследование

Properties in UNIGINE can form a hierarchy. However, there are certain rules and constraints described below, that must be taken into account.Свойства (properties) в UNIGINE могут образовывать иерархию. Однако существуют определенные правила и ограничения, описанные ниже, которые необходимо учитывать.

Properties HierarchyИерархия свойств#

Properties hierarchy is formed by inheriting one property from another. A parent property passes all its parameters to its children so that they can be overridden, much like in object-oriented programming.Иерархия свойств формируется путем наследования одного свойства от другого. Родительское свойство передает все свои параметры своим дочерним элементам, чтобы их можно было переопределить, как в объектно-ориентированном программировании.

Примечание
All inherited and non-overridden parameters will be updated automatically, if they are updated in the parent property.Все унаследованные и непереопределенные параметры будут обновлены автоматически, если они обновлены в родительском свойстве.

At the top of the hierarchy there are base properties. Unigine provides 2 built-in read-only base properties: node_base and surface_base. You can also make custom base properties of your own.В верхней части иерархии находятся базовые свойства . Unigine предоставляет встроенные базовые свойства 2, доступные только для чтения: node_base и surface_base. Вы также можете создавать собственные базовые свойства.

Примечание
If you need to assign a property to a single surface, it is recommended to inherit it from the surface_base property.
It is also recommended to inherit properties that will be assigned to nodes from the node_base property. However, you can also assign any custom base property or its children to a node.
Если вам нужно назначить свойство для поверхности , то рекомендуется унаследовать его от surface_base .
Рекомендуется также наследовать свойства, которые будут назначены нодам, от node_base свойство. Однако вы также можете назначить ноде любое настраиваемое базовое свойство или его дочерние элементы.

Base properties cannot have a parent: no base property can be inherited from another base property. The values of parameters of manual properties (including base ones) cannot be changed. So, to modify parameters of a manual property via the UnigineEditor, you should inherit a user property from it. Базовые свойства не могут иметь родителя: никакое базовое свойство не может быть унаследовано от другого базового свойства. Значения параметров manual свойств (включая базовые) не могут быть изменены. Итак, чтобы изменить параметры manual свойства через UnigineEditor, вы должны унаследовать от него пользовательское свойство .

The parent of a user property can be changed by dragging it to a new parent in the Properties Hierarchy window.Родитель пользовательского свойства можно изменить, перетащив его на новый родительский элемент в окне Properties Hierarchy.

Taking all abovementioned into account, there are the following reasons to create properties hierarchy:Принимая во внимание все вышесказанное, есть следующие причины для создания иерархии свойств:

  • Inheriting from a base property allows editing its parameters via the UnigineEditor.Наследование от базового свойства позволяет редактировать его параметры через UnigineEditor.
  • Inheriting from a user property allows for mass controlling values of multiple property parameters.Наследование от пользовательского свойства позволяет массово контролировать значения нескольких параметров свойств.

Hierarchy of propertiesИерархия свойств

Properties Loading OrderПорядок загрузки свойств#

Properties hierarchy doesn't affect the loading order of properties.Иерархия свойств не влияет на порядок загрузки свойств.

Referring to Properties by GUIDsОбращение к свойствам по идентификаторам GUID#

A GUID (Globally Unique Identifier) is an identifier for a property. It represents a 40-character hexadecimal string generated using the SHA-1 hash algorithm. GUID (глобальный уникальный идентификатор) - это идентификатор свойства. Он представляет собой шестнадцатеричную строку из 40 символов, созданную с использованием хеш-алгоритма SHA-1.

Properties hierarchy is based on GUIDs: all properties are referred to using GUIDs, even base and manual ones (the GUIDs for such properties are generated at run time and are uniquely determined by their names). However, only user properties store their GUIDs explicitly: a GUID is generated automatically on user property creation and is written to the corresponding *.prop file.Иерархия свойств основана на идентификаторах GUID: все свойства упоминаются с использованием идентификаторов GUID, даже базовые и manual (идентификаторы GUID для таких свойств генерируются во время выполнения и однозначно определяются их имена). Однако только пользовательские свойства явно хранят свои идентификаторы GUID: идентификатор GUID создается автоматически при создании свойства пользователя и записывается в соответствующий файл *.prop.

Примечание
Each user property created via the UnigineEditor has a GUID.Каждое свойство пользователя , созданное с помощью UnigineEditor , имеет GUID.

For example:Например:

Исходный код (XML)
<property version="2.13.0.1" name="surface_base_0" guid="2750c68c5a8d5e01198c9a32ba6ffaa46ae31b8c" parent="d99ebc8ef5769d70b1e46992309cc3e7d1aa2faa"/>

The GUID of a user property is stored in the guid attribute. If user property is inherited from another user property, it will refer to the parent by its GUID (see the parent attribute in the example above).GUID свойства пользователя хранится в атрибуте guid. Если свойство пользователя унаследовано от другого свойства пользователя, оно будет ссылаться на родительский объект по его GUID (см. атрибут parent в примере выше).

Using GUIDs makes it difficult to edit user properties manually. For example, to rename such property, it is required to generate a GUID for the new name and replace the current GUID.Использование GUID затрудняет редактирование пользовательских свойств вручную. Например, чтобы переименовать такое свойство, необходимо сгенерировать GUID для нового имени и заменить текущий GUID.

As GUIDs for manual properties (including base ones) are uniquely determined by their names, changing the name of such property will also change its GUID. That is why manual properties cannot be renamed at run time. For the same reason, *.prop files of such properties store only their names, not GUIDs. Manual properties usually use name-based references to other manual properties (including base ones).Поскольку идентификаторы GUID для свойств manual (включая базовые) однозначно определяются своими именами, изменение имени такого свойства также изменит его GUID. Вот почему manual свойства нельзя переименовать во время выполнения. По той же причине файлы *.prop с такими свойствами хранят только свои имена, а не GUID. Manual свойства обычно используют именные ссылки на другие manual свойства (включая базовые).

Примечание
If you rename a manual property, that has other manual or user properties inherited from it, the hierarchy will be broken, and you will have to restore it manually for all children (i.e. specify new parent GUID in the parent attribute, or new parent name parent_name attribute for a manual child property).Если переименовать manual свойство, которое имеет другие manual или пользовательские свойства, унаследованные от него, иерархия будет нарушена, и вам придется восстановить его вручную для всех детей (т.е. указать новый родительский GUID в атрибуте parent или новое родительское имя parent_name для manual дочернего свойства).

Types of InheritanceТипы наследования#

As it was mentioned above, base properties, which are all manual, are always at the top of the hierarchy, while other properties are inherited from them. You can inherit:Как было упомянуто выше, базовые свойства, которые задаются вручную, всегда находятся наверху иерархии, в то время как другие свойства наследуются от них. Вы можете унаследовать:

  • a new user property from any other property via the UnigineEditor.новое свойство пользователя из любого другого свойства через UnigineEditor .
  • a new manual property from another manual property (including base one) by creating a new *.prop file with a name-based reference to the parent.новое manual свойство из другого manual свойства (включая базовое) путем создания нового файла *.prop со ссылкой на родителя по имени.

So, basically we can have the following types of inheritance:Итак, в основном у нас могут быть следующие типы наследования:

  • Manual Parent - Manual Child Родительcкий manual - дочерний manual
  • Manual Parent - User Child Родительcкий manual - дочерний пользовательский
  • User Parent - User Child Родительский пользовательский - дочерний пользовательский

Thus, depending on the type of inheritance, the *.prop file of a child property will store a reference to its parent as follows:Таким образом, в зависимости от типа наследования файл *.prop дочернего свойства будет хранить ссылку на его родительский объект следующим образом:

  • Parent: manual property (including base ones).
    • If the inherited property is also manual, the corresponding *.prop file stores the name of the property, and the name of its parent in the parent_name attribute.
      Примечание
      Only manual properties can refer to their parent manual property by name.Only manual properties can refer to their parent manual property by name.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base1" parent_name="node_base" manual="1"/>
      Only manual properties can refer to their parent manual property by name.
      If the inherited property is also manual, the corresponding *.prop file stores the name of the property, and the name of its parent in the parent_name attribute.
      Примечание
      Only manual properties can refer to their parent manual property by name.Only manual properties can refer to their parent manual property by name.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base1" parent_name="node_base" manual="1"/>
    • If the inherited property is not manual (i.e it is a user property), the corresponding *.prop file stores a GUID of the user property, and the GUID of its parent (generated at run time from the parent's name) in the parent attribute.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base2" guid="cccd50e4431ddaeaf01dcb394fc988def578b380" parent="d99ebc8ef5769d70b1e46992309cc3e7d1aa2faa"/>
      If the inherited property is not manual (i.e it is a user property), the corresponding *.prop file stores a GUID of the user property, and the GUID of its parent (generated at run time from the parent's name) in the parent attribute.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base2" guid="cccd50e4431ddaeaf01dcb394fc988def578b380" parent="d99ebc8ef5769d70b1e46992309cc3e7d1aa2faa"/>
    If the inherited property is also manual, the corresponding *.prop file stores the name of the property, and the name of its parent in the parent_name attribute.
    Примечание
    Only manual properties can refer to their parent manual property by name.Only manual properties can refer to their parent manual property by name.
    Исходный код (XML)
    <property version="2.13.0.1" name="my_node_base1" parent_name="node_base" manual="1"/>
    Only manual properties can refer to their parent manual property by name.If the inherited property is not manual (i.e it is a user property), the corresponding *.prop file stores a GUID of the user property, and the GUID of its parent (generated at run time from the parent's name) in the parent attribute.
    Исходный код (XML)
    <property version="2.13.0.1" name="my_node_base2" guid="cccd50e4431ddaeaf01dcb394fc988def578b380" parent="d99ebc8ef5769d70b1e46992309cc3e7d1aa2faa"/>
    Parent: manual свойство (включая базовые).
    • If the inherited property is also manual, the corresponding *.prop file stores the name of the property, and the name of its parent in the parent_name attribute.
      Примечание
      Only manual properties can refer to their parent manual property by name.Only manual properties can refer to their parent manual property by name.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base1" parent_name="node_base" manual="1"/>
      Only manual properties can refer to their parent manual property by name.
      Если унаследованное свойство также является manual, соответствующий файл *.prop сохраняет имя свойства и имя его родительского элемента в атрибуте parent_name.
      Примечание
      Only manual properties can refer to their parent manual property by name.Только manual свойства могут ссылаться на свое родительское manual свойство по имени.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base1" parent_name="node_base" manual="1"/>
    • If the inherited property is not manual (i.e it is a user property), the corresponding *.prop file stores a GUID of the user property, and the GUID of its parent (generated at run time from the parent's name) in the parent attribute.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base2" guid="cccd50e4431ddaeaf01dcb394fc988def578b380" parent="d99ebc8ef5769d70b1e46992309cc3e7d1aa2faa"/>
      Если унаследованное свойство не является manual (то есть это свойство пользователя), соответствующий файл *.prop хранит GUID пользовательского свойства, а GUID его родительского элемента (сгенерированный во время выполнения из имени родителя) в атрибуте parent.
      Исходный код (XML)
      <property version="2.13.0.1" name="my_node_base2" guid="cccd50e4431ddaeaf01dcb394fc988def578b380" parent="d99ebc8ef5769d70b1e46992309cc3e7d1aa2faa"/>
  • Parent: user property. The *.prop file of the inherited user property stores a GUID of the user property, and the GUID of its parent in the parent attribute.
    Исходный код (XML)
    <property version="2.13.0.1" name="my_node_base3" guid="cd3ebc8ef5769d70b1e46452309cc3e7d1aa2ccd" parent="cccd50e4431ddaeaf01dcb394fc988def578b380"/>
    Родитель: пользовательское свойство . В файле *.prop наследуемого свойства пользователя хранится идентификатор GUID свойства пользователя и идентификатор GUID его родительского элемента в атрибуте parent.
    Исходный код (XML)
    <property version="2.13.0.1" name="my_node_base3" guid="cd3ebc8ef5769d70b1e46452309cc3e7d1aa2ccd" parent="cccd50e4431ddaeaf01dcb394fc988def578b380"/>
Последнее обновление: 16.07.2021
Build: ()