This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Instancing Nodes

The virtual world, that you're building, may contain a lot of identical objects, that should always look the same, such as electricity pylons, planes, wheels, boxes, etc.

When you clone these objects and place them in your world, multiple separate copies are created. Thus, if you decide to change something (e.g., the geometry or materials of some parts of the pylons) you'll have do that for each copy individually.

Instead of making copies of an object, it is recommended to make instances of a single one. Such approach ensures integrity when changing the parameters of the repeatedly used objects, especially if they are complex and sophisticated. To do so, You can simply add several node references referring to a single *.node file and then edit only one node reference in order to update all of them.

Below is the typical workflow for node instancing based on node references.

1. Creating a Hierarchy of Nodes

First of all we should prepare the basic hierarchy, that will represent our object. Suppose we have organized the nodes hierarchy for a helicopter, that we are going to reuse several times in our world (see the picture below)

2. Converting the Hierarchy of Nodes

The second step is to convert the hierarchy of nodes to a node reference. You can do that by simply dragging the root node of the hierarchy to the desired folder in the Asset Browser. A corresponding *.node asset (source), containing the hierarchy, will be created in the folder. The node hierarchy will be replaced with a reference to this asset.

You can also convert a single node or a group of selected nodes in the World Hierarchy window via the context menu. To do so, select the desired node(s) in the World Hierarchy window, right-click on the selected node and choose Create a Node Reference. A corresponding *.node asset (source), containing the selected node (or a group of nodes as children with a dummy node as the root), will be created in the current folder opened in the Asset Browser. Selected nodes will be replaced with a reference to this asset.

3. Placing Instances

So, we already have the first instance in the world. It's the one, that replaced the hierarchy, when we dragged it to the Asset Browser. To add other instances to the world, we can simply drag the desired *.node asset from the Asset Browser directly to the Scene Viewport.

Notice
The new instance will be placed at the origin.
Or you can simply clone a node reference, as any other node, via the Scene Viewport by moving it with a manipulator while holding the Shift key. In this case a new instance will be placed exaclty where you point to.

4. Editing the Source Node from its Instances

If you decide to change something in the source node, you can do that by editing any of its instances. To do so, perform the following steps:

  1. Select any instance in the world via the Scene Viewport or the World Hierarchy window. The parameters of the node reference will be displayed in the Parameters window.

  2. Click Edit. The hierarchy of the source node will be displayed in the World Hierarchy window.

  3. Edit the source node. You can make any changes: modify materials, add new nodes, remove existing ones, etc.

  4. Click Apply to save changes made to the source node or Cancel to discard them. The changes will be applied to all instances at once.

Video Tutorial: Instancing Nodes

Last update: 2018-08-10
Build: ()