Programming
Fundamentals
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
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
Rendering-Related Classes

Unigine::Editor Class

Header:#include <UnigineEditor.h>

An interface for handling the Unigine Engine Editor that loads and manages the hierarchy of nodes displayed in the editor.

Editor Class

Members


Editor * get()

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.

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 isEditorPlayer(const Ptr<Player> & player)

Arguments

  • const Ptr<Player> & player

void setEnabled(int enabled)

Enable or disable the editor.

Arguments

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

int isEnabled()

Return a value indicating if the editor is enabled.

Return value

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

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.

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.

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.

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.

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.

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

int isLoaded()

Returns a value indicating if the editor is already loaded.

Return value

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

Ptr<Node> getNode(int num)

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

Arguments

  • int num - Node index.

Return value

Editor node.

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.

Ptr<Node> getNodeByName(const char * name)

Returns the editor node by its name.

Arguments

  • const char * name - Name of the node.

Return value

Editor node if it is in the list of editor nodes; otherwise, NULL (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 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.

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.

Ptr<Player> getPlayer()

Returns the current player used in the editor.

Return value

Current editor player.

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.

void addEditorPlayer(const Ptr<Player> & player)

Arguments

  • const Ptr<Player> & player

int addNode(const Ptr<Node> & node, int is_runtime_node = 0)

Arguments

  • const Ptr<Node> & node - Pointer to Node.
  • int is_runtime_node

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.

int findNode(const char * name)

Searches an editor node by its name.

Arguments

  • const char * name - Name of the node.

Return value

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

int findNodeById(int node_id)

Arguments

  • int node_id

void load(const char * script = "editor/editor.cpp", int legacy_mode = 1)

Arguments

  • const char * script
  • int legacy_mode

int needReload()

Returns a value indicating if Unigine Editor should be reloaded.

Return value

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

void quit()

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.

void reload()

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

void removeEditorPlayer(const Ptr<Player> & player)

Arguments

  • const Ptr<Player> & player

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

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

Arguments

  • const Ptr<Node> & node - Pointer to Node.
  • int recursion

int updateNodes(const Vector< Ptr<Node> > & nodes, int recursion = 0)

Arguments

  • const Vector< Ptr<Node> > & nodes
  • int recursion
Last update: 2017-07-03