This page has been translated automatically.
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
High-Level Systems
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
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::NodeReference Class

Header:#include <UnigineNodes.h>
Inherits:Node

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

Members


static NodeReferencePtr create(const char * name)

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

Arguments

  • const char * name - Path to a *.node file.

Ptr<NodeReference> cast(const Ptr<Node> & node)

Casts a NodeReference out of the Node instance.

Arguments

  • const Ptr<Node> & node - Pointer to Node.

Return value

Pointer to NodeReference.

int setNodeName(const char * name)

Sets a reference to a new *.node file

Arguments

  • const char * name - Path to a *.node file.

Return value

Returns 1 if the new reference is set successfully; otherwise, 0.

const char * getNodeName()

Returns the path to the referenced *.node file.

Return value

Path to the referenced *.node file.

Ptr<Node> getReference()

Returns the node stored by the reference.

Return value

Node instance.

Ptr<Node> detachReference()

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.

To remove the node do the following:

Source code (C++)
new_node_reference = NodeReference::create(new_node);
new_node = new_node_reference->detachReference();
new_node = new_node_reference->grab();
new_node_reference.destroy();

Return value

Root node of the internal hierarchy.

int type()

Returns the type of the node.

Return value

NodeReference type identifier.
Last update: 2017-07-03
Build: ()