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

Header: #include <UnigineEditor.h>

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.

See Also#

  • C++ API sample located in the folder <UnigineSDK>/source/samples/Api/Systems/Editor
  • C# API sample located in the folder <UnigineSDK>/source/csharp/samples/Api/Systems/Editor

Editor Class

Members


Editor * get ( ) #

Returns a pointer to the existing editor instance.

Return value

A pointer to the editor instance.

int isLoaded ( ) #

Returns a value indicating if the editor is already loaded.

Return value

1 if the editor is loaded; otherwise, 0.

void setEnabled ( int enabled ) #

Enable or disable the editor.

Arguments

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

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

void load ( const char * script = "editor/editor.usc" ) #

Loads the editor from the specified script.

Arguments

  • const char * script - Path to the script.

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

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

Ptr<Player> getPlayer ( ) #

Returns the current player used in the editor.

Return value

Current editor player.

void addEditorPlayer ( const Ptr<Player> & player ) #

Adds another editor player.

Arguments

  • const Ptr<Player> & player - Pointer to Player.

void removeEditorPlayer ( const Ptr<Player> & player ) #

Removes a given player from the editor.

Arguments

  • const Ptr<Player> & player - Pointer to Player.

int isEditorPlayer ( const Ptr<Player> & player ) #

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

Arguments

  • const Ptr<Player> & player - A smart pointer to the Player.Player instance.

Return value

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

int getNumNodes ( ) #

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

Return value

Number of editor nodes.

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.

Ptr<Node> getNode ( int num ) #

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 num - Node index.

Return value

Editor node.

Ptr<Node> getNodeByName ( const char * name ) #

Returns the editor node by its name.

Arguments

  • const char * name - Node name.

Return value

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

void getNodesByName ( const char * name, Vector< Ptr<Node> > & nodes ) #

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

Arguments

  • const char * name - Node name.
  • Vector< Ptr<Node> > & nodes - List of nodes with the given name.

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

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 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 getNodeIndex ( const Ptr<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 the editor.

Arguments

  • const Ptr<Node> & node - Node.

Return value

Node index.

void setNodeIndex ( const Ptr<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 the editor.

Arguments

  • const Ptr<Node> & node - Node.
  • int index - Node index.

int isNode ( const Ptr<Node> & node ) #

Checks if a given node belongs to the editor.

Arguments

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

Return value

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

int isNode ( const char * name ) #

Checks if a node with a given name belongs to the editor.

Arguments

  • const char * name - Node name.

Return value

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

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

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

Return value

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

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

Appends a given node to the editor.
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

  • const Ptr<Node> & node - Pointer to Node.
  • 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 ( const Ptr<Node> & node, int with_children = 0 ) #

Deletes a given node completely.

Arguments

  • const Ptr<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 ( const Ptr<Node> & node, int with_children = 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 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 ( const Ptr<Node> & node, int with_children = 0 ) #

Updates the target node.

Arguments

  • const Ptr<Node> & node - Pointer to Node.
  • 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 ( const Vector< Ptr<Node> > & nodes, int with_children = 0 ) #

Updates the target array of nodes.

Arguments

  • const Vector< Ptr<Node> > & nodes - Pointer to 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.

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_instance, int * ret_surface ) #

Searches for all of the nodes intersecting the line. The node closest to the start point 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. Pass NULL if this parameter is not required.
  • 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). Pass NULL if this parameter is not required.
  • int * ret_index - Intersected triangle number. Pass NULL if this parameter is not required.
  • int * ret_instance - Intersected instance number. Pass NULL if this parameter is not required.
    Notice
    Intersected instance number can be obtained for the following classes:
  • int * ret_surface - Intersected surface number. Pass NULL if this parameter is not required.

Return value

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_instance, int * ret_surface ) #

Searches for all of the nodes intersecting the line. The node closest to the start point 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 nodes to exclude; all these nodes 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_instance - Intersected instance number.
    Notice
    Intersected instance number can be obtained for the following classes:
  • int * ret_surface - Intersected surface number.

Return value

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

  • const Math::Vec3 & p0 - Start point of the line.
  • const Math::Vec3 & p1 - End point of the line.
  • const Ptr<WorldIntersection> & intersection - Pointer to WorldIntersection.

Return value

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

  • const Math::Vec3 & p0 - Start point of the line.
  • const Math::Vec3 & p1 - End point of the line.
  • const Ptr<WorldIntersectionNormal> & intersection - Pointer to WorldIntersectionNormal.

Return value

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

  • const Math::Vec3 & p0 - Start point of the line.
  • const Math::Vec3 & p1 - End point of the line.
  • const Ptr<WorldIntersectionTexCoord> & intersection - Pointer to WorldIntersectionTexCoord.

Return value

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

  • 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 nodes to exclude; all these nodes will be skipped while checking for intersection.
  • const Ptr<WorldIntersection> & intersection - Pointer to WorldIntersection.

Return value

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

  • 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 nodes to exclude; all these nodes will be skipped while checking for intersection.
  • const Ptr<WorldIntersectionNormal> & intersection - Pointer to WorldIntersectionNormal.

Return value

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

  • 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 nodes to exclude; all these nodes will be skipped while checking for intersection.
  • const Ptr<WorldIntersectionTexCoord> & intersection - Pointer to WorldIntersectionTexCoord.

Return value

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

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: 2019-08-16
Build: ()