Scripting Overview |
The NeoAxis editor includes a rich set of tools for scripting. Following methods for scripting are supported: classic C# programming, C# scripts, visual workflow scripting, advanced object types creation capabilities.
In addition to classic C# programming by using typical IDEs, such as Visual Studio, the engine editor has a built-in C# editor. This gives additional possibilities for object scripting. For example, you can script scenes, GUI files, make event handlers same way as IDEs doing.
There is a lighter way of scripting in the engine, which is called C# scripts. It's significantly different from usual C# programming. Scripts have some advantages over C# programming: those are easier to read, easier to embed, and those require less programming skills.
C# script is a simple C# code, but it lacks a class description, and it does not define used namespaces. Only class components are described (methods, attributes, fields). This is the main difference between C# script and usual C# file. C# script is a kind of abstract file, it does not even have a name.
Following image features simple C# script. The code contains a definition of the method.
The next image shows a somewhat more complex script, which consists of two methods. One of those methods is public.
C# scripts is a part of a basic functional of NeoAxis Engine. In addition to the built-in script editor, there are special components for their integration.
In the image below the example of a simple script. The rotation of the sky is animated depending on the time. Skybox object has nested script component. Skybox's rotation field is bound to 'Method'. So now, every time the Rotation field is requested, it would call a script's 'Method'. This method will be executed during rendering, when skybox's parameters would be requested.
Here's the script's code.
Engine editor supports visual programming of logic via Flow Graph Editor. It is a node editor, that allows to adjust the interactions between objects visually.
Following images display event handler for an object in space. First image demonstrates how to add an event handler for a selected object.
The second image shows the graph editor, which describes event handler.
Graph editor can be used as a base for other specialized editors. For example, in the engine, graph editor used for Material Editor.
It is possible to mix up usual C#, C# scripts, and visual programming. Following image shows an example of using C# script in the graph.
NeoAxis Engine environment provides opportunities for object type modification. By 'object types' the ability of adjusting and reusing objects as a type is implied. From the programming perspective that is the ability to classes creation, inheritance, and other OOP features in a visual manner. NeoAxis Engine editor has fully functional environment for this kind of programming.
Native languages, like C/C++ are also supported. One needs to use PInvoke or C++/CLI.
NeoAxis Engine environment has a rich and complete toolset for scripting. Abilities to mix usual C# code, C# scripts and visual programming provide powerful and comfortable means for developing. Object type creation capabilities extend the editor's concept.