Click or drag to resize

Scripting Overview

About NeoAxisManual / Scripting OverviewInstallation

Scripting Overview

Engine editor includes 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.

Contents
C# programming

C# is a base language for scripting. Typical IDEs are supported, like Visual Studio. Also, engine has built-in C# editor, so one can use this editor for simpler cases, since it provides basic features.

Screenshot999999505.png
Overview

There is 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.

Script is a simple C# code, but it lacks class description, and it does not define used namespaces. Only class components are described (methods, attributes, fields). This is main difference between C# script and usual C# file. C# script is a kind of an abstract file - it does not even have a name.

Following image features simple C# script. Code contains definition of the method.

Screenshot999999313.png

Next image shows somewhat more complex script, which consists of two methods. One of those methods is public.

Screenshot999999318.png
Integration

C# scripts is a part of basic functional of NeoAxis Engine. Engine editor has built-in script editor. There are special components for scripts integration.

On the image below, simple script is used. Skybox object has nested script component. And Skybox's rotation field is bound to "Method". So now, every time the Rotation field is requested, it would call script's "Method". This method will be executed during rendering, when skybox's parameters would be requested.

Screenshot999999314 2.png

Here's the script's code.

Screenshot999999313.png
Overview

Engine editor supports visual programming of logic via Flow Graph Editor. It is a node editor, that allows to adjust 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.

Screenshot999999323 2.png

Second image shows graph editor, which describes event handler.

Screenshot999999324.png
Specialization

Graph editor can be used as a base for other specialized editors. For example, in the engine, graph editor used for Material Editor.

Screenshot999999194.png
Connect with C#

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.

Screenshot999999315.png
Type programming

NeoAxis Engine environment provides opportunities for object types modification. By "object types", abilities for adjusting and reusing objects as a types is implied. From programming perspective that is similar to classes creation, inheritance, and other OOP features. NeoAxis Engine editor has fully functional environment for this kind of programming, which is mostly can be performed visually.

Let's see an example. We'll create and adjust an object in space. It will be created as a separate resource. Then we will add an object of this type in a separate resource on a new scene.

First image demonstrates scene and a modified object.

Screenshot999999326.png

Second image shows how to to place this kind of object on a new scene. New object has been created, and it's like an instance of previously created type.

Screenshot999999328 2.png

Next image shows three objects, two of which are modified.

Screenshot999999331.png

That was simple example of types usage. Current engine architecture and its tools allow following:

  • Type inheritance.
  • Add nested objects to the type.
  • Add properties, methods, events to the objects in the editor.
  • Hide nested objects of the type, implementing object encapsulation.

All these features can be used for 3D projects development.

C/C++

Native languages, like C/C++ are also supported. One needs to use PInvoke or C++/CLI.

Conclusion

NeoAxis Engine environment has 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 types creation capabilities extend editor's concept.

See also
About NeoAxisInstallation