UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

NodeReference Class

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.

Notice
The world can contain several instances of node references referring to the same .node file.
The .node file usually contains a pre-fabricated node (or a hierarchy of nodes) with all the materials and properties libraries that are required for its rendering. All changes that are made for the node reference via UnigineEditor are saved into this file.

The node reference should be used instead of the node if there a lot of identical objects repeated in the world: it will enable to avoid manual editing each object if you need to make the same changes in all of these objects.

Unlike regular nodes, reference nodes are loaded into the world faster because of the internal cache usage.

Notice
A bounding box of the reference node is equal to the bounding box of its root node (child nodes are disregarded).

See Also

  • Article on Nodes that lists the main differences between the regular nodes and reference nodes
  • Article on Node Reference

NodeReference Class

This class inherits from Node

Members


NodeReference (string name)

Constructor. Creates a new object that references a node from a given file.

Arguments

  • string name - Path to a *.node file.

string getNodeName ()

Returns the name of the currently referenced file.

Return value

Path to the referenced *.node file.

Node getNode ()

Returns the node stored by this reference.

Return value

Contained node.

Node releaseNode ()

Releases the internal node of ownership so it is no longer owned by the node reference (made orphan). After being released the node should be appended to one of the scripts not to cause a memory leak.

Return value

Root node of the internal hierarchy.

int setNodeName (string name, int addToWorld = 0)

Sets a reference to a new file.

Arguments

  • string name - Path to a *.node file.
  • int addToWorld - Set 1 to add node to the world library.

Return value

1 if the new reference is set successfully; otherwise, 0.
Last update: 2017-07-03