This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::Editor Class

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

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

Unigine::Editor Class

Members


virtual ~Editor ()

Virtual destructor.

static Editor * get ()

Returns a pointer to the editor.

Return value

Pointer to the editor.

virtual int isLoaded () const =0

Returns a value indicating if the editor is already loaded.

Return value

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

virtual void setEnabled (int enable) const =0

Enable or disable the editor.

Arguments

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

virtual int isEnabled () const =0

Return a value indicating if the editor is enabled.

Return value

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

virtual void setData (const char * data) const =0

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.

virtual const char * getData () const =0

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.

virtual void setPlayer (const PlayerPtr & player) const =0

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 PlayerPtr & player - Editor player to set.

virtual PlayerPtr getPlayer () const =0

Returns the current player used in the editor.

Return value

Current editor player.

virtual NodePtr getIntersection (const UNIGINE_VEC3 & p0, const UNIGINE_VEC3 & p1, UNIGINE_VEC3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface) const =0

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 UNIGINE_VEC3 & p0 - Coordinates of the line start point.
  • const UNIGINE_VEC3 & p1 - Coordinates of the line end point.
  • UNIGINE_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

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

virtual NodePtr getIntersection (const UNIGINE_VEC3 & p0, const UNIGINE_VEC3 & p1, const Vector< NodePtr > & exclude, UNIGINE_VEC3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface) const =0

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 UNIGINE_VEC3 & p0 - Coordinates of the line start point.
  • const UNIGINE_VEC3 & p1 - Coordinates of the line end point.
  • const Vector< NodePtr > & exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
  • UNIGINE_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

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

virtual int getNumNodes () const =0

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.

virtual int findNode (const char * name) const =0

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.

virtual NodePtr getNode (int num) const =0

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

Arguments

  • int num - Node index.

Return value

Editor node.

virtual NodePtr getNodeByName (const char * name) const =0

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

virtual int isNode (const NodePtr & node) const =0

Checks if a given node belongs to the editor.

Arguments

  • const NodePtr & node - Node pointer.

Return value

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

virtual int addNode (const NodePtr & node) const =0

Appends a given node and its children to the editor.

Arguments

  • const NodePtr & node - Node pointer.

Return value

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

virtual int removeNode (const NodePtr & node) const =0

Removes a given node from the editor.

Arguments

  • const NodePtr & node - Node pointer.

Return value

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

virtual int releaseNode (const NodePtr & node) const =0

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

Arguments

  • const NodePtr & node - Node pointer.

Return value

Returns 1 if the node is released successfully; otherwise, 0.
Last update: 2017-07-03
Build: ()