This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
创建内容
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::NodeReference Class

Header: #include <UnigineNodes.h>
Inherits from: Node
Read More

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.

void setNodePath ( const char * name ) #

Sets a reference to a new *.node file.
Source code (C++)
// create an NodeReference instance
NodeReferencePtr nodeRef = NodeReference::create("unigine_project/nodes/reference_0.node");
// ...
// change a reference node
nodeRef->setNodePath("unigine_project/nodes/reference_1.node");

Arguments

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

const char * getNodePath ( ) #

Returns the path to the referenced *.node file.
Source code (C++)
// create an NodeReference instance
NodeReferencePtr nodeRef = NodeReference::create("unigine_project/nodes/reference_0.node");
// ...
// return the path to the reference node
Log::message("The referenced node is: %s\n",nodeRef->getNodePath());

Return value

Path to the referenced *.node file.

Ptr<Node> getReference ( ) #

Returns the node stored by the reference. The method should be used when you need to change the referenced node. If getReference() has returned a NodeDummy instance, it means that several nodes of the same hierarchy level has been converted into the NodeReference.
Source code (C++)
// create a NodeReference instance
NodeReferencePtr nodeRef = NodeReference::create("unigine_project/nodes/single_nref.node");
// get a node stored by the reference
NodePtr node = nodeRef->getReference();
// if the node is a NodeDummy
if (node->>getType() == Node::NODE_DUMMY){
	// print the type name of each child node of the root node stored by the reference 
	for(int i = 0; i & node->getNumChildren(); i++) {
		Log::message("%d: %s\n",i,node->getChild(i)->getTypeName());
	}
}

Return value

Node instance.

static bool canBeReference ( const char * name, const Ptr<Node> & node ) #

Returns a value indicating if the hierarchy of the given node does not contain a node reference with the given name.

Arguments

  • const char * name - Node reference name.
  • const Ptr<Node> & node - Node to check.

Return value

true if the hierarchy of the given node does not contain a node reference with the given name; otherwise, false.

Ptr<Node> detachReference ( ) #

Returns the node stored by the reference and releases this node of ownership so it is no longer owned and referred to by the NodeReference. The node is managed by the World.

To remove the node do the following:

Source code (C++)
// create a new NodeReference instance
NodeReferencePtr nodeRef = NodeReference::create("unigine_project/nodes/node_reference_0.node");
// perform something
// ...
// get the node stored by the reference and release NodeReference ownership of the node
NodePtr node = nodeRef->detachReference();
// destroy the NodeReference pointer as the NodeReference doesn't refer to a node any more
nodeRef.deleteForce();

Return value

Root node of the internal hierarchy.

static int type ( ) #

Returns the type of the node.

Return value

NodeReference type identifier.
Last update: 2021-12-13
Build: ()