Node Reference
A node reference is a node that refers to an external .node file on the disk, which is obtained by exporting a node from the world.
The node references should be used if there are a lot of identical objects that are repeated in the world. Using the node references will enable to avoid manual editing each identical object if you need to make the same changes in all of such objects. You can simply add several node references that point to one .node file and then edit only one node reference in order to update all of them. Such approach enables to hold to integrity of the repeated objects, especially if they are complex and sophisticated.
For example, the node references can be used to add identical cars, boats or buildings that should be updated at once, if necessary.
See Also
- A NodeReference class to edit node references via UnigineScript
- An Unigine::NodeReference class to edit node references via C++ API
- The Randomizer plugin to work with multiple node references
Creating a Node Reference
There are 2 ways to create a node reference via UnigineEditor:
- Add a new node reference that refers to an external .node file. In this case, you will need to export a node into a .node file first.
- Convert a node with all its child nodes presented in the nodes hierarchy list into a node reference. In this case, the source node will change its type to a node reference.
By Adding a New Node Reference
- Export a node from the world.
Before exporting a node into .node file to be used as node reference, you may need to reset the node position to zero, because it is saved relative to the zero of coordinates.
- Click Import -> Node File Reference and choose the exported node in the file dialog window that opens.
- Position the node reference in the world.
You can repeat steps 2 and 3 in order to add the required number of the node references. Or you can simply clone the added one: select the node reference, press Ctrl+D and click Yes in the dialog window that opens.
By Converting an Existing Node
- Select a node in the nodes hierarchy list of the Nodes panel (or directly in the scene).
- On the Menu bar, click Edit -> Convert to NodeReference (or press Ctrl+Shift+G).
- Specify a name for the .node file to which the node reference will refer and click Ok.
As a result, the source node will be converted into the node reference:
Source Node to be Converted |
Converted Node |
You can also clone the converted node in order to get the required number of node references.
Source Nodes to be Converted |
Nodes Grouped Under a Dummy Node to Which Node Reference Refers |
Editing a Node Reference
On the Reference tab of the Nodes panel you can change the path to the source node or open the ReferenceNode Editor used to edit the source node:
Reference Editor
UnigineEditor features a special ReferenceNode Editor, which enables to edit the source node to which the node reference is pointed. To edit the source node:
- Select the node reference in the Nodes panel.
- Open the ReferenceNode Editor by clicking Edit on the Reference tab.
ReferenceNode EditorSource node in the edit mode
- Edit the source node. For example, you can change the material applied to it:
Node references with the yellow material appliedNode references with the changed material
- Click Apply to save changes made to the source node or Cancel changes to cancel them. As a result, the list of the scene nodes will appear again in the Nodes panel.
Deleting a Node Reference
You can delete the node reference the same way as any other node.