engine.editor Functions
This class provides functionality for the editor script that loads and manages the hierarchy of nodes displayed in the editor.
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
int engine.editor.isLoaded ( ) #
Returns a value indicating if the editor is already loaded.Return value
1 if the editor is loaded; otherwise, 0.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.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.void engine.editor.reload ( ) #
Reloads the Unigine Editor. This functions updates node hierarchy, updates loaded textures if they were modified, etc.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.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.Return value
Current player.void engine.editor.addEditorPlayer ( Player player ) #
Adds another editor player.Arguments
- Player player - Player instance.
void engine.editor.removeEditorPlayer ( Player player ) #
Removes a given player from the editor.Arguments
- Player player - Player instance.
int engine.editor.isEditorPlayer ( Player player ) #
Returns a value indicating if the given player is an Editor player.Arguments
- Player player - Player instance.
Return value
1 if the Player is an Editor player; otherwise, 0.int engine.editor.isVariable ( string name ) #
Returns a value indicating if the given variable exists in the editor script.Arguments
- string name - Variable name.
Return value
1 if the variable exists; otherwise, 0.int engine.editor.isFunction ( string name, int num_args ) #
Returns a value indicating if the given function with the specified number of arguments exists in the editor script.Arguments
- string name - Function name.
- int num_args - Number of function arguments.
Return value
1 if the function exists; otherwise, 0.void engine.editor.set ( string function, Variable value ) #
Sets a variable in a editor script (this function can be called directly from any other script).Arguments
- string function - Variable name.
- Variable value - Value of the variable.
Variable engine.editor.get ( string function ) #
Returns a variable from the editor script. Instances of user-defined classes cannot be requested in such a manner.Arguments
- string function - Variable name with a namespace, if needed.
Return value
Requested instance.Variable engine.editor.call ( Variable function ) #
Executes a function of the editor script from an external script. The function should not take any arguments.Arguments
- Variable function - Name of the function to execute.
Return value
Value returned by the function.Variable engine.editor.call ( Variable function, Variable arg0 ) #
Executes a function of the editor script from an external script. The function should take one argument.Arguments
Return value
Value returned by the function.Variable engine.editor.call ( Variable function, Variable arg0, Variable arg1 ) #
Executes a function of the editor script from an external script. The function should take two arguments.Arguments
- Variable function - Name of the function to execute.
- Variable arg0 - Argument of the function.
- Variable arg1 - Argument of the function.
Return value
Value returned by the function.Variable engine.editor.call ( Variable function, Variable arg0, Variable arg1, Variable arg2 ) #
Executes a function of the editor script from an external script. The function should take three arguments.Arguments
- Variable function - Name of the function to execute.
- Variable arg0 - Argument of the function.
- Variable arg1 - Argument of the function.
- Variable arg2 - Argument of the function.
Return value
Value returned by the function.Variable engine.editor.call ( Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3 ) #
Executes a function of the editor script from an external script. The function should take four arguments.Arguments
- Variable function - Name of the function to execute.
- Variable arg0 - Argument of the function.
- Variable arg1 - Argument of the function.
- Variable arg2 - Argument of the function.
- Variable arg3 - Argument of the function.
Return value
Value returned by the function.Variable engine.editor.call ( Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3, Variable arg4 ) #
Executes a function of the editor script from an external script. The function should take five arguments.Arguments
- Variable function - Name of the function to execute.
- Variable arg0 - Argument of the function.
- Variable arg1 - Argument of the function.
- Variable arg2 - Argument of the function.
- Variable arg3 - Argument of the function.
- Variable arg4 - Argument of the function.
Return value
Value returned by the function.Variable engine.editor.call ( Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3, Variable arg4, Variable arg5 ) #
Executes a function of the editor script from an external script. The function should take six arguments.Arguments
- Variable function - Name of the function to execute.
- Variable arg0 - Argument of the function.
- Variable arg1 - Argument of the function.
- Variable arg2 - Argument of the function.
- Variable arg3 - Argument of the function.
- Variable arg4 - Argument of the function.
- Variable arg5 - Argument of the function.
Return value
Value returned by the function.Node engine.editor.getIntersection ( Vec3 p0, Vec3 p1, int[] exclude, Variable 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 intersection result will be presented as follows:
- 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.
- int[] exclude - Array of the nodes to exclude; all these nodes will be skipped while checking for intersection.
- Variable v - Variable into which information on the intersection will be saved.
Return value
The first node found at the line; 0 if there was no intersection.Node engine.editor.getIntersection ( Vec3 p0, Vec3 p1, Variable v ) #
Traces a line from one point to another to find an object located on that line. 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 intersection result will be presented as follows:
- 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.
- Variable v - Variable into which information on the intersection will be saved.
Return value
The first node found at the line; 0 if there was no intersection.Variable engine.editor.call ( Variable function, int id = [] ) #
Executes a function of the editor script from an external script. The function takes an array of arguments (up to 8 arguments are supported).Arguments
- Variable function - Name of the function to execute.
- int id - Array of up to 8 arguments.