This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Editor Class

This set of functions is related to the Unigine Engine Editor that loads and manages the hierarchy of nodes displayed in the editor.

Editor Class

Members


Player getPlayer ()

Returns the current player used in the Editor mode.

Return value

Current player.

Node getIntersection (Vec3 p0, Vec3 p1, Vector<Node> exclude, WorldIntersectionNormal v)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
  • WorldIntersectionNormal v - Variable.

Return value

The first node found at the line; 0 if there was no intersection.

int isNode (Node node)

Checks if a given node belongs to Unigine Editor.

Arguments

  • Node node - Node to check.

Return value

1 if the node belongs to Unigine Editor; otherwise, 0.

string getNodeName (int num)

Returns a name of a given node (loaded from the *.world file or belonging to the node list of Unigine Editor) by its index in the list of editor nodes.

Arguments

  • int num - Node index in the list of editor nodes.

Return value

Name of the node.

void reload ()

Reloads the Unigine Editor. This functions updates node hierarchy, updates loaded textures if they were modified, etc.

void setData (string data)

Updates user data associated with the editor. This string is written directly into a *.world file. Namely, into the data child tag of the editor tag, for example:
Source code(XML)
<world version="1.21">
	<editor>
		<data>User data</data>
	</editor>
</world>

Arguments

  • string data - User data to be set. Data can contain an XML formatted string.

Node getIntersection (Vec3 p0, Vec3 p1, WorldIntersectionTexCoord v)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • WorldIntersectionTexCoord v - Array of the objects to exclude; all these objects will be skipped while checking for intersection.

Return value

The first node found at the line; 0 if there was no intersection.

int swapNodes (Node n0, Node n1)

Swaps positions of given nodes in the list of editor nodes.

Arguments

  • Node n0 - First node to swap.
  • Node n1 - Second node to swap.

Return value

1 if swapping was done successfully; otherwise, 0.

Node getIntersection (Vec3 p0, Vec3 p1, Vector<Node> exclude, WorldIntersection v)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
  • WorldIntersection v - Variable.

Return value

The first node found at the line; 0 if there was no intersection.

Node getIntersection (Vec3 p0, Vec3 p1, Vector<Node> exclude, WorldIntersectionTexCoord v)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
  • WorldIntersectionTexCoord v - Variable.

Return value

The first node found at the line; 0 if there was no intersection.

int releaseNode (Node node, int recursion = 0)

Release the current node so it is not owned by Unigine Editor (made orphan).
Notice
After the node is released, it must be appended to one of the scripts. Otherwise, it will cause memory leak.

Arguments

  • Node node - Node to be released.
  • int recursion - A value indicating if the node children will also be released. Pass 1 to release child nodes; otherwise, pass 0.

Return value

1 if the node is released successfully; otherwise, 0.

string getData ()

Returns user data associated with the editor. This string is written directly into a *.world file. Namely, into the data child tag of the editor tag, for example:
Source code(XML)
<world version="1.21">
	<edtor>
		<data>User data</data>
	</editor>
</world>

Return value

User data. Data can contain an XML formatted string.

int getNumNodes ()

Returns the number of nodes loaded from the *.world file or belonging to the node list of Unigine Editor.

Return value

Number of nodes in the list.

int removeNode (Node node, int recursion = 0)

Completely removes a given node.

Arguments

  • Node node - Node to remove.
  • int recursion - A value indicating whether the node children will also be removed. Pass 1 to remove the node children; otherwise, pass 0.

Return value

1 if the node is removed successfully; otherwise, 0.

int needReload ()

Returns a value indicating if Unigine Editor should be reloaded.

Return value

1 if the editor should be reloaded; otherwise, 0.

Node getIntersection (Vec3 p0, Vec3 p1, Vector<Node> exclude, Vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
  • Vec3 * ret_point - Variable.
  • vec3 * ret_normal - Normal vector to the intersection point.
  • vec4 * ret_texcoord - Texture coordinates of the intersection point (vec4, where vec4.xy is for the first (0) UV channel, vec4.zw is for the second (1) UV channel).
  • int * ret_index - Intersected triangle number.
  • int * ret_surface - Intersected surface number.

Return value

The first node found at the line; 0 if there was no intersection.

void setPlayer (Player player)

Sets the current player to be used in the Editor mode.
Notice
Editor player is handled differently than in-game players. Parameters set directly for the player are ignored; instead, Editor player uses Camera parameters set via the interface. (See Editor scripts in data/core/editor folder for implementation.)

Arguments

  • Player player - Player to set as current.

void setEnabled (int enabled)

Sets a value of the Enabled parameter that controls all internal additional engine processing (for example, reloading of textures when their recording time is changed and so on). For example, you can set the Enabled parameter to 0 when using Syncker in order to increase engine performance (as Syncker operates inside the editor environment and can reduce engine performance).

Arguments

  • int enabled - 1 to set the Enabled parameter; otherwise, 0.

void clearBindings ()

Clears internal buffers with pointers and instances. This function is used for proper cloning of objects with hierarchies, for example, bodies and joints. Should be called before cloning.

Node getIntersection (Vec3 p0, Vec3 p1, Vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Vec3 * ret_point - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
  • vec3 * ret_normal - Variable.
  • vec4 * ret_texcoord - Texture coordinates of the intersection point (vec4, where vec4.xy is for the first (0) UV channel, vec4.zw is for the second (1) UV channel).
  • int * ret_index - Intersected triangle number.
  • int * ret_surface - Intersected surface number.

Return value

The first node found at the line; 0 if there was no intersection.

int isRuntimeNode (Node node)

Returns a value indicating if the node has been created in runtime. All nodes created in runtime in the world script will be deleted on quitting the world.

Arguments

  • Node node - Node to check.

Return value

1 if the node has been created in runtime; otherwise, 0.

int createTerrainIndex (Image mask, Image index, int block)

Creates a 2D mask texture based on the given index texture and updates this index texture.

Arguments

  • Image mask - Terrain mask texture. It must be a 2D texture array.
    Notice
    Compressed, combined and unsigned char image formats are not supported.
  • Image index - Terrain index texture.
  • int block - The ratio of the widths and heights of the mask and index textures. Namely, the value indicating how many times the width and height of the mask texture more than the width and height of the second texture.

Return value

Number of channels of the created mask texture if it is created successfully; otherwise, 0.

Node getIntersection (Vec3 p0, Vec3 p1, WorldIntersection v)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • WorldIntersection v - Array of the objects to exclude; all these objects will be skipped while checking for intersection.

Return value

The first node found at the line; 0 if there was no intersection.

Node getNode (int arg1)

Returns a node (loaded from the *.world file or belonging to the node list of Unigine Editor) by its index in the list of editor nodes.
Notice
See also engine.world.getNode() function to get nodes from a script or world file by their unique ID.

Arguments

  • int arg1 - Node index in the list of editor nodes.

Return value

Node with the provided index.

int findNode (string arg1)

Searches for a node by its name.

Arguments

  • string arg1 - Name of the node.

Return value

Node index if the node is found; otherwise, -1.

int isEnabled ()

Returns a value of the the Enabled parameter. The Enabled parameter controls all internal additional engine processing (for example, reloading of textures when their recording time is changed and so on). For example, the Enabled parameter can be set to 0 when using Syncker in order to increase engine performance (as Syncker operates inside the editor environment and can reduce engine performance).

Return value

1 if the Enabled parameter is set; otherwise, 0.

int isLoaded ()

Checks if Unigine Editor is already loaded.

Return value

1 if the editor is loaded; otherwise, 0.

int createTerrainMask (Image mask, Image index, int num_materials)

Creates an array of 2D terrain mask textures from the given mask and index textures.

Arguments

  • Image mask - Terrain mask texture. It must be a 2D texture.
    Notice
    Compressed, combined and unsigned char image formats are not supported.
  • Image index - Terrain index texture. It must be a 2D texture.
    Notice
    Compressed, combined and unsigned char image formats are not supported.
  • int num_materials - Number of materials that will be assigned to the created array of 2D terrain mask textures.

Return value

1 if the 2D mask texture array is created successfully; otherwise, 0.

Node getNodeByName (string arg1)

Returns a node (loaded from the *.world file or belonging to the node list of Unigine Editor) by its name.

Arguments

  • string arg1 - Name of the node.

Return value

Node, if it exists; otherwise, 0.

Node getIntersection (Vec3 p0, Vec3 p1, WorldIntersectionNormal v)

Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.

Notice
World space coordinates are used for this function.

Depending on the variable, passed as an argument, the result will be presented as following:

  • WorldIntersectionintersection - The WorldIntersection node.
  • WorldIntersectionNormalnormal - The WorldIntersectionNormal node.
  • WorldIntersectionTexCoordtexcoord - The WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • WorldIntersectionNormal v - Array of the objects to exclude; all these objects will be skipped while checking for intersection.

Return value

The first node found at the line; 0 if there was no intersection.

Node loadMesh (string name)

Loads a mesh from a file. If the mesh is loaded successfully, its node does not belong to any node hierarchy, so be careful and make sure to handle it properly, when it is no longer needed.

Arguments

  • string name - File with a mesh.

Return value

Node of a type corresponding to the loaded mesh or 0, if the mesh cannot be loaded.

get (string function)

Arguments

  • string function

call (Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2
  • Variable arg3

call (Variable function, Variable arg0)

Arguments

  • Variable function
  • Variable arg0

set (string function, Variable value)

Arguments

  • string function
  • Variable value

call (Variable function, Variable arg0, Variable arg1)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1

call (Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3, Variable arg4)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2
  • Variable arg3
  • Variable arg4

call (Variable function, int id = [])

Arguments

  • Variable function
  • int id

call (Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3, Variable arg4, Variable arg5)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2
  • Variable arg3
  • Variable arg4
  • Variable arg5

call (Variable function, Variable arg0, Variable arg1, Variable arg2)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2

call (Variable function)

Arguments

  • Variable function
Last update: 2017-07-03
Build: ()