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

Editor Class

Unigine editor. This interface provides access to Unigine editor functions.

To use this class, include the UnigineEditor.h file.

Editor Class

Members


Ptr<Player> getPlayer ()

Returns the current player used in the editor.

Return value

Current editor player.

int addNode (const Ptr<Node> & node)

Appends a given node and its children to the editor.

Arguments

  • const Ptr<Node> & node - Node pointer.

Return value

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

Ptr<Node> getIntersection (const Math::Vec3 & p0, const Math::Vec3 & p1, const Vector< Ptr<Node> > & exclude, const Ptr<WorldIntersectionNormal> & v)

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

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

Return value

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

int isNode (const Ptr<Node> & node)

Checks if a given node belongs to the editor.

Arguments

  • const Ptr<Node> & node - Node pointer.

Return value

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

const char * 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 saveMesh (const char * name, const Vector< Ptr<Node> > & nodes)

Arguments

  • const char * name
  • const Vector< Ptr<Node> > & nodes

Return value

void reload ()

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

void setData (const char * data)

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

Arguments

  • const char * data - New user data.

Ptr<Node> getIntersection (const Math::Vec3 & p0, const Math::Vec3 & p1, const Ptr<WorldIntersectionTexCoord> & v)

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

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

Return value

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

int swapNodes (const Ptr<Node> & n0, const Ptr<Node> & n1)

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

Arguments

  • const Ptr<Node> & n0 - First node to swap.
  • const Ptr<Node> & n1 - Second node to swap.

Return value

1 if swapping was done successfully; otherwise, 0.

Ptr<Node> getIntersection (const Math::Vec3 & p0, const Math::Vec3 & p1, const Vector< Ptr<Node> > & exclude, const Ptr<WorldIntersection> & v)

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

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

Return value

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

Ptr<Node> getIntersection (const Math::Vec3 & p0, const Math::Vec3 & p1, const Vector< Ptr<Node> > & exclude, const Ptr<WorldIntersectionTexCoord> & v)

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

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

Return value

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

int releaseNode (const Ptr<Node> & node, int recursion = 0)

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

Arguments

  • const Ptr<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

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

const char * 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.

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 removeNode (const Ptr<Node> & node, int recursion = 0)

Removes a given node from the editor.

Arguments

  • const Ptr<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

Returns 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.

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

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

  • const Math::Vec3 & p0 - Coordinates of the line start point.
  • const Math::Vec3 & p1 - Coordinates of the line end point.
  • const Vector< Ptr<Node> > & exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
  • Math::Vec3 * ret_point - Intersection point of the line and object.
  • Math::vec3 * ret_normal - Normal vector to the intersection point.
  • Math::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

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

void setPlayer (const Ptr<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

  • const Ptr<Player> & player - Editor player to set.

void setEnabled (int enabled)

Enable or disable the editor.

Arguments

  • int enabled - 1 to enable the editor, 0 to disable it.

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.

Ptr<Node> getIntersection (const Math::Vec3 & p0, const Math::Vec3 & p1, Math::Vec3 * ret_point, Math::vec3 * ret_normal, Math::vec4 * ret_texcoord, int * ret_index, int * ret_surface)

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

  • const Math::Vec3 & p0 - Coordinates of the line start point.
  • const Math::Vec3 & p1 - Coordinates of the line end point.
  • Math::Vec3 * ret_point - Intersection point of the line and object.
  • Math::vec3 * ret_normal - Normal vector to the intersection point.
  • Math::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

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

int isRuntimeNode (const Ptr<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

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

Return value

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

int createTerrainIndex (const Ptr<Image> & mask, const Ptr<Image> & index, int block)

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

Arguments

  • const Ptr<Image> & mask - Terrain mask texture. It must be a 2D texture array.
    Notice
    Compressed, combined and unsigned char image formats are not supported.
  • const Ptr<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.

Ptr<Node> getIntersection (const Math::Vec3 & p0, const Math::Vec3 & p1, const Ptr<WorldIntersection> & v)

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

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

Return value

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

Ptr<Node> getNode (int arg1)

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

Arguments

  • int arg1 - Node index.

Return value

Editor node.

int findNode (const char * arg1)

Searches an editor node by its name.

Arguments

  • const char * arg1 - Name of the node.

Return value

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

int isEnabled ()

Return a value indicating if the editor is enabled.

Return value

Return 1 if the editor is enabled; otherwise, 0 is returned.

int isLoaded ()

Returns a value indicating if the editor is already loaded.

Return value

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

int createTerrainMask (const Ptr<Image> & mask, const Ptr<Image> & index, int num_materials)

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

Arguments

  • const Ptr<Image> & mask - Terrain mask texture. It must be a 2D texture.
    Notice
    Compressed, combined and unsigned char image formats are not supported.
  • const Ptr<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.

Ptr<Node> getNodeByName (const char * arg1)

Returns the editor node by its name.

Arguments

  • const char * arg1 - Name of the node.

Return value

Editor node if it is in the list of editor nodes; otherwise, NULL (0).

Ptr<Node> getIntersection (const Math::Vec3 & p0, const Math::Vec3 & p1, const Ptr<WorldIntersectionNormal> & v)

Searches for all of the nodes intersecting the line. A node, which is the most close to the start point of the line, is returned.

Arguments

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

Return value

Returns the first intersected node smart pointer if found; otherwise, NULL pointer.

Ptr<Node> loadMesh (const char * 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

  • const char * name - File with a mesh.

Return value

Node of a type corresponding to the loaded mesh or 0, if the mesh cannot be loaded.
Last update: 2017-07-03