engine.editor Functions
An interface for handling the Unigine Engine Editor that loads and manages the hierarchy of nodes displayed in the editor.
Editor Class
Members
void engine.editor.setData(string data)
Updates user data associated with the editor. This string is written directly into a *.world file. Namely, into the data child tag of the editor tag, for example:<world version="1.21">
<editor>
<data>User data</data>
</editor>
</world>
Arguments
- string data - User data to be set. Data can contain an XML formatted string.
string engine.editor.getData()
Returns user data associated with the editor. This string is written directly into a *.world file. Namely, into the data child tag of the editor tag, for example:<world version="1.21">
<edtor>
<data>User data</data>
</editor>
</world>
Return value
User data. Data can contain an XML formatted string.int engine.editor.isEditorPlayer(Player player)
Arguments
- Player player
void engine.editor.setEnabled(int enabled)
Sets a value of the Enabled parameter that controls all internal additional engine processing (for example, reloading of textures when their recording time is changed and so on). For example, you can set the Enabled parameter to 0 when using Syncker in order to increase engine performance (as Syncker operates inside the editor environment and can reduce engine performance).Arguments
- int enabled - 1 to set the Enabled parameter; otherwise, 0.
int engine.editor.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.Node engine.editor.getIntersection(Vec3 p0, Vec3 p1, Vector<Node> exclude, WorldIntersectionNormal v)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
- WorldIntersectionNormal v - Variable.
Return value
The first node found at the line; 0 if there was no intersection.Node engine.editor.getIntersection(Vec3 p0, Vec3 p1, WorldIntersectionTexCoord v)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- WorldIntersectionTexCoord v - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
Return value
The first node found at the line; 0 if there was no intersection.Node engine.editor.getIntersection(Vec3 p0, Vec3 p1, Vector<Node> exclude, WorldIntersection v)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
- WorldIntersection v - Variable.
Return value
The first node found at the line; 0 if there was no intersection.Node engine.editor.getIntersection(Vec3 p0, Vec3 p1, Vector<Node> exclude, WorldIntersectionTexCoord v)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
- WorldIntersectionTexCoord v - Variable.
Return value
The first node found at the line; 0 if there was no intersection.Node engine.editor.getIntersection(Vec3 p0, Vec3 p1, Vector<Node> exclude, Vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- Vector<Node> exclude - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
- Vec3 * ret_point - Variable.
- 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 engine.editor.getIntersection(Vec3 p0, Vec3 p1, Vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- Vec3 * ret_point - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
- vec3 * ret_normal - Variable.
- 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 engine.editor.getIntersection(Vec3 p0, Vec3 p1, WorldIntersection v)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- WorldIntersection v - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
Return value
The first node found at the line; 0 if there was no intersection.Node engine.editor.getIntersection(Vec3 p0, Vec3 p1, WorldIntersectionNormal v)
Traces a line from one point to another to find an object located on that line, skipping objects from a given list. This function takes into account editor-only objects (object handlers). Intersection does not work for disabled objects.
Depending on the variable, passed as an argument, the result will be presented as following:
- WorldIntersection intersection — The WorldIntersection node.
- WorldIntersectionNormal normal — The WorldIntersectionNormal node.
- WorldIntersectionTexCoord texcoord — The WorldIntersectionTexCoord node.
Arguments
- Vec3 p0 - Start point of the line.
- Vec3 p1 - End point of the line.
- WorldIntersectionNormal v - Array of the objects to exclude; all these objects will be skipped while checking for intersection.
Return value
The first node found at the line; 0 if there was no intersection.int engine.editor.isLoaded()
Checks if Unigine Editor is already loaded.Return value
1 if the editor is loaded; otherwise, 0.Node engine.editor.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.Arguments
- int num - Node index in the list of editor nodes.
Return value
Node with the provided index.int engine.editor.isNode(Node node)
Checks if a given node belongs to Unigine Editor.Arguments
- Node node - Node to check.
Return value
1 if the node belongs to Unigine Editor; otherwise, 0.Node engine.editor.getNodeByName(string name)
Returns a node (loaded from the *.world file or belonging to the node list of Unigine Editor) by its name.Arguments
- string name - Name of the node.
Return value
Node, if it exists; otherwise, 0.string engine.editor.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 engine.editor.getNumNodes()
Returns the number of nodes loaded from the *.world file or belonging to the node list of Unigine Editor.Return value
Number of nodes in the list.void engine.editor.setPlayer(Player player)
Sets the current player to be used in the Editor mode.Arguments
- Player player - Player to set as current.
Player engine.editor.getPlayer()
Returns the current player used in the Editor mode.Return value
Current player.int engine.editor.isRuntimeNode(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
- Node node - Node to check.
Return value
1 if the node has been created in runtime; otherwise, 0.void engine.editor.addEditorPlayer(Player player)
Arguments
- Player player
int engine.editor.addNode(Node node, int is_runtime_node = 0)
Arguments
- Node node - Node instance.
- int is_runtime_node
void engine.editor.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 engine.editor.findNode(string name)
Searches for a node by its name.Arguments
- string name - Name of the node.
Return value
Node index if the node is found; otherwise, -1.int engine.editor.findNodeById(int node_id)
Arguments
- int node_id
int engine.editor.needReload()
Returns a value indicating if Unigine Editor should be reloaded.Return value
1 if the editor should be reloaded; otherwise, 0.int engine.editor.releaseNode(Node node, int recursion = 0)
Release the current node so it is not owned by Unigine Editor (made orphan).Arguments
- 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
1 if the node is released successfully; otherwise, 0.void engine.editor.reload()
Reloads the Unigine Editor. This functions updates node hierarchy, updates loaded textures if they were modified, etc.void engine.editor.removeEditorPlayer(Player player)
Arguments
- Player player
int engine.editor.removeNode(Node node, int recursion = 0)
Completely removes a given node.Arguments
- 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
1 if the node is removed successfully; otherwise, 0.int engine.editor.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 engine.editor.updateNode(Node node, int recursion = 0)
Arguments
- Node node - Node instance.
- int recursion