This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related 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.

Unigine.Editor Class

This class provides functionality for the editor script that loads and manages the hierarchy of nodes displayed in the editor.

Notice
C++ methods running editor script functions are described in the Engine class reference.

Editor Class

Members


int isLoaded()

Returns a value indicating if the editor is already loaded.

Return value

Returns 1 if the editor is loaded; otherwise, 0.

void setEnabled(int enabled)

Enable or disable the editor.

Arguments

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

int isEnabled()

Returns a value of 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.

void setData(string data)

Sets user data associated with the world. In the *.world file, the data is set in the data tag.

Arguments

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

string getData()

Returns user string data associated with the world. This string is written directly into the data tag of the *.world file.

Return value

User string data.

void load(string script = "editor/editor.cpp", int legacy_mode = 1)

Loads the editor from the specified script.

Arguments

  • string script - Path to the script.
  • int legacy_mode - A flag indicating whether the old or the new editor settings will be used.

void quit()

Quit the editor.

void videoRestart()

Restarts the video application to apply changes to video settings, if any.

void reload()

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

int needReload()

Returns a value indicating if Unigine Editor should be reloaded.

Return value

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

void setPlayer(Player player)

Sets the player to be used in the editor. 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.

Arguments

  • Player player - Player to set as current.

Player getPlayer()

Returns the current player used in the editor.

Return value

Current editor player.

void addEditorPlayer(Player player)

Adds another editor player.

Arguments

  • Player player - Player instance.

void removeEditorPlayer(Player player)

Removes a given player from the editor.

Arguments

  • Player player - Player instance.

int isEditorPlayer(Player player)

Returns a value indicating if the given player is an Editor player.

Arguments

  • Player player - Player instance.

Return value

1 if the Player is an Editor player; otherwise, 0.

int getNumNodes()

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

Return value

Number of editor nodes.

int findNode(string name)

Searches an editor node by its name.

Arguments

  • string name - Name of the node.

Return value

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

Node getNode(int num)

Returns the editor node by its index in the list of editor nodes.

Arguments

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

Return value

Editor node.

Node getNodeByName(string name)

Returns the editor node by its name.

Arguments

  • string name - Node name.

Return value

Node, if it is in the list of editor nodes; otherwise, 0.

void getNodesByName(string name, Node[] nodes)

Generates a list of editor nodes with a given name and puts it to nodes.

Arguments

  • string name - Node name.
  • Node[] nodes - List of nodes with the given name.

Node getNodeById(int node_id)

Returns the editor node by its identifier.

Arguments

  • int node_id - Node ID.

Return value

Node, if it is in the list of editor nodes; otherwise, 0.

int findNodeById(int node_id)

Searches for the node by its ID.

Arguments

  • int node_id - Node ID.

Return value

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

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.

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.

int getNodeIndex(Node node)

Returns the index of the given node in the list of editor nodes. This function is useful when you need to change the World Hierarchy in UnigineEditor.

Arguments

  • Node node - Node.

Return value

Node index.

void setNodeIndex(Node node, int index)

Sets a new index for the given node in the list of editor nodes. This function is used to change the World Hierarchy in UnigineEditor.

Arguments

  • Node node - Node.
  • int index - Node index.

int isNode(Node node)

Checks if a given node belongs to the editor.

Arguments

  • Node node - Node to check.

Return value

Returns 1 if the node belongs to the editor; otherwise, 0.

int isRuntimeNode(Node node)

Returns a value indicating if the node has been created at run time. All nodes created at run time in the world script will be deleted on quitting the world. Such nodes will not be saved to a .world file on world_save command.

Arguments

  • Node node - Node to check.

Return value

1 if the node has been created at run time; otherwise, 0.

int addNode(Node node, int is_runtime = 0)

Appends a given node to UnigineEditor.
Notice
The node can have only one owner, so before appending it to the Unigine Editor, its ownership by a script must be removed. Otherwise, it can result in a double deletion at the same address and engine crash.

Arguments

  • Node node - Node instance.
  • int is_runtime - A value indicating if the node should be deleted on quitting the world: 1 to delete the node; 0 to save the node. Runtime nodes will not be saved to a .world file on world_save command.

Return value

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

int removeNode(Node node, int with_children = 0)

Removes a given node from the editor.

Arguments

  • Node node - Node to remove.
  • int with_children - 1 — update the target parent nodes along with all their children nodes; 0 — update the target parent nodes without their children nodes.

Return value

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

int releaseNode(Node node, int with_children = 0)

Releases a given node so it is not owned by the editor (made orphan).

Arguments

  • Node node - Node to be released.
  • int with_children - 1 — update the target parent nodes along with all their children nodes; 0 — update the target parent nodes without their children nodes.

Return value

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

int updateNode(Node node, int with_children = 0)

Updates the target node.

Arguments

  • Node node - Node instance.
  • int with_children - 1 — update the target parent nodes along with all their children nodes; 0 — update the target parent nodes without their children nodes.

Return value

1 if the nodes array was updated successfully; otherwise, 0.

int updateNodes(Node[] nodes, int with_children = 0)

Updates the target array of nodes.

Arguments

  • Node[] nodes - Nodes array.
  • int with_children - 1 — update the target parent nodes along with all their children nodes; 0 — update the target parent nodes without their children nodes.

Return value

1 if the nodes array was updated successfully; otherwise, 0.

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

Searches for all of the nodes intersecting the line. The node closest to the start point is returned.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • Vec3[] ret_point - Intersection point of the line and object.
  • 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.

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

Searches for all of the nodes intersecting the line. The node closest to the start point is returned.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • Node[] exclude - Array of the nodes to exclude; all these nodes will be skipped while checking for intersection.
  • Vec3[] ret_point - Intersection point of the line and object.
  • 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.

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

Searches for all of the nodes intersecting the line. The node closest to the start point is returned. The intersection result will be presented as a WorldIntersection node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • WorldIntersection intersection - WorldIntersection node.

Return value

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

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

Searches for all of the nodes intersecting the line. The node closest to the start point is returned. The intersection result will be presented as a WorldIntersectionNormal node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • WorldIntersectionNormal intersection - WorldIntersectionNormal node.

Return value

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

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

Searches for all of the nodes intersecting the line. The node closest to the start point is returned. The intersection result will be presented as a WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • WorldIntersectionTexCoord intersection - WorldIntersectionTexCoord node.

Return value

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

Node getIntersection(Vec3 p0, Vec3 p1, Node[] exclude, WorldIntersection intersection)

Searches for all of the nodes intersecting the line. The node closest to the start point is returned. The intersection result will be presented as a WorldIntersection node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Node[] exclude - Array of the nodes to exclude; all these nodes will be skipped while checking for intersection.
  • WorldIntersection intersection - WorldIntersection node.

Return value

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

Node getIntersection(Vec3 p0, Vec3 p1, Node[] exclude, WorldIntersectionNormal intersection)

Searches for all of the nodes intersecting the line. The node closest to the start point is returned. The intersection result will be presented as a WorldIntersectionNormal node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Node[] exclude - Array of the nodes to exclude; all these nodes will be skipped while checking for intersection.
  • WorldIntersectionNormal intersection - WorldIntersectionNormal node.

Return value

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

Node getIntersection(Vec3 p0, Vec3 p1, Node[] exclude, WorldIntersectionTexCoord intersection)

Searches for all of the nodes intersecting the line. The node closest to the start point is returned. The intersection result will be presented as a WorldIntersectionTexCoord node.

Arguments

  • Vec3 p0 - Start point of the line.
  • Vec3 p1 - End point of the line.
  • Node[] exclude - Array of the nodes to exclude; all these nodes will be skipped while checking for intersection.
  • WorldIntersectionTexCoord intersection - WorldIntersectionTexCoord node.

Return value

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

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.
Last update: 2018-06-04
Build: ()