This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
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
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::UlonNode Class

Header: #include <UnigineUlon.h>

This class is used to represent a ULON node.

Each ULON node has a type, a name, and a value. It can also have child ULON nodes and a parent node, thus forming a hierarchy.

A node is declared as follows:

Source code
NodeType node_name = node_value

ULON nodes can be of the following types:

  • Boolean
    Node node = true
  • Integer number
    Node node = 1234
  • Floating-point number
    Node node = 3.1459
  • String
    • Quoted string with standard escape characters:
      Node node = "word word"
    • Bare word, beginning with a lower case letter, containing only letters, digits, and underscores "_":
      Node node = word1_word2
    • Heredoc string enclosed in #{ ... #} (used for code fragments):
      Node node = #{C++ C# USC HLSL GLSL USSL#}
  • Array containing a finite number of integer, float, and string elements
    Node node = [100, 0.2, str str "str str str", #{vec4 asd = vec4_zero;#}] This array has the following 6 elements:
    • 100
    • 0.2
    • str
    • str
    • str str str
    • vec4 asd = vec4_zero;

Conditions#

For each node a condition can be specified, if the condition fails the ULON node with all its children is ignored. Thus you can dynamically build the hierarchy of ULON nodes with a great degree of flexibility.

Notice
Conditions are not parsed and executed automatically, processing of conditions is the responsibility of the user of the ULON format (e.g. in case of materials UnigineScript and UUSL are used).
Conditions are specified after the node's name, starting with the if keyword, the condition itself is enclosed in brackets [ ... ].

Condition of the parent node is added to the condition of the child: (parent_conditon) && (child_conditon)

Example:

Source code
Node parent if[var == 10 || var == 5]
{
    Node child_0  if[var == 3]
    Node child_1  if[var == 4]
    {
        Node child_2 if[var != 11]
        Node child_3 if[var != 25]
	}
}
The resulting conditions for each node are as follows:
  • parent condition: (var1 == 10 || var1 == 5)
  • child_0 condition: (var1 == 10 || var1 == 5) && (var2 == 3)
  • child_1 condition: (var1 == 10 || var1 == 5) && (var2 == 4)
  • child_2 condition: (var1 == 10 || var1 == 5) && (var2 == 4) && (var3 != 11)
  • child_3 condition: (var1 == 10 || var1 == 5) && (var2 == 4) && (var3 != 25)

UlonNode Class

Members


static UlonNodePtr create ( ) #

Constructor. Creates a ULON node.

bool load ( const char * path ) #

Loads ULON-data from the specified file and sets the current ULON node to be the root of the parsed hierarchy.

Arguments

  • const char * path - Path to the file containing ULON description.

Return value

true if ULON-data from the specified file is read successfully; otherwise, false.

bool parse ( const char * str ) #

Parses a given string into the ULON node.

Arguments

  • const char * str - String to parse.

Return value

true if the string was parsed successfully; otherwise, false.

Vector< Ptr<UlonNode> > getChildren ( ) const#

Returns the list of all children of the ULON node.

Return value

List of all ULON node's children.

const char * getType ( ) const#

Returns the type of the ULON node.

Return value

ULON node type.

const char * getName ( ) const#

Returns the name of the ULON node.

Return value

ULON node name.

const char * getCondition ( ) const#

Returns a condition set for the ULON node.
Notice
Conditions are not parsed and executed automatically, processing of conditions is the responsibility of the user of the ULON format (e.g. in case of materials UnigineScript and UUSL are used).

Return value

condition set for the ULON node.

Ptr<UlonValue> getValue ( ) const#

Returns the value of the ULON node.

Return value

ULON node value.

Vector< Ptr<UlonArg> > getArgs ( ) const#

Returns the list of all arguments of the ULON node.

Return value

List of all arguments of the ULON node.

bool isArg ( const char * name ) const#

Checks whether an argument with a given name exists.

Arguments

  • const char * name - Name of the argument to be checked.

Return value

true if an argument with the specified name exists; otherwise, false.

float getArgFloat ( const char * name, float ret = 0 ) const#

Returns the value of the ULON node argument with the specified name as a float.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Argument name.
  • float ret - Default value to be returned if a ULON node argument with the specified name is not found.

Return value

Float value of the ULON node argument, if it exists; otherwise a default value set via the ret parameter.

int getArgInt ( const char * name, int ret = 0 ) const#

Returns the value of the ULON node argument with the specified name as an integer.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Argument name.
  • int ret - Default value to be returned if a ULON node argument with the specified name is not found.

Return value

Integer value of the ULON node argument, if it exists; otherwise a default value set via the ret parameter.

long long getArgLong ( const char * name, long long ret = 0 ) const#

Returns the value of the ULON node argument with the specified name as a 64-bit long long.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Argument name.
  • long long ret - Default value to be returned if a ULON node argument with the specified name is not found.

Return value

64-bit long long value of the ULON node argument, if it exists; otherwise a default value set via the ret parameter.

bool getArgBool ( const char * name, bool ret = false ) const#

Returns the value of the ULON node argument with the specified name as a boolean.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Argument name.
  • bool ret - Default value to be returned if a ULON node argument with the specified name is not found.

Return value

Boolean value of the ULON node argument, if it exists; otherwise a default value set via the ret parameter.

char getArgChar ( const char * name, char ret = 0 ) const#

Returns the value of the ULON node argument with the specified name as a char.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Argument name.
  • char ret - Default value to be returned if a ULON node argument with the specified name is not found.

Return value

Char value of the ULON node argument, if it exists; otherwise a default value set via the ret parameter.

const char * getArgStr ( const char * name, const char * ret = "" ) const#

Returns the value of the ULON node argument with the specified name as a string.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Argument name.
  • const char * ret - Default value to be returned if a ULON node argument with the specified name is not found.

Return value

String value of the ULON node argument, if it exists; otherwise a default value set via the ret parameter.

Vector< String > getArgArray ( const char * name ) const#

Returns the value of the ULON node argument with the specified name as an array of strings.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Argument name.

Return value

Array of strings representing elements of the array value, if it exists; otherwise an empty string array.

void printUnusedData ( const char * name ) const#

Prints warnings of unused data (node values and arguments) for the file with the specified name to the Console for debugging.

Arguments

  • const char * name - File name.

void clearUnusedData ( ) const#

Clears all unused node data (node values and arguments).
Last update: 2023-06-23
Build: ()