Click or drag to resize

Add-on Creation

Type and Metadata ProgrammingManual / Advanced / Add-on CreationSamples and Tutorials

Add-on Creation

NeoAxis Engine has rich features for creating extensions. To create them, you can use WinForms, WPF.

Contents
Component creation

The basic way to create extensions is to create components based on the Component class or based on its heirs.

The easiest way is to add new classes to the NeoAxis.CoreExtension.dll and Project.dll projects.

Connecting additional Dll

You can create extensions that are made as separate dll builds. This is how Pathfinding addition is made. Its source codes can be found at Sources\NeoAxis.Addon.Pathfinding.

In order for the new dll build to be connected to the project, it must be named as "NeoAxis.Addon.*.dll". The second option is to enter its name in the Binaries\NeoAxis.DefaultSettings.config file, adding the line in the form "AutoLoadAssembly {Name = NAME.dll}".

Screenshot999999453.png
Sub-editors creation

You can create full-fledged sub-editors inside the main editor. As examples, there are two sub-editors. The source code is in Sources\NeoAxis.Addon.EditorExample.

The first example of a sub-editor uses a 2D canvas of the engine. Includes a template for the editor.

Screenshot999999555 2.png

The second example is made on WinForms.

Screenshot999999556 2.png
Adding buttons to the Ribbon and Quick Access Toolbar

You can add individual action buttons in Ribbon and Quick Access Toolbar. You can do this directly in the editor.

First you need to create a C# file.

Screenshot999999557.png

When creating, specify the base class AssemblyUtility.AssemblyRegistration. This class is needed to perform any actions when initializing the engine.

Screenshot999999564.png

After creation, the C# code editor will open.

Screenshot999999565.png

OnRegister() method is being created in the class. The code for creating the action and tab of the ribbon is added.

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using NeoAxis;
using NeoAxis.Editor;

namespace Project
{ 
        public class MyRibbonButtons : AssemblyUtility.AssemblyRegistration
        {
                public override void OnRegister()
                {
                        //My Action
                        {
                                var a = new EditorAction();
                                a.Name = "My Action";
                                a.Description = "My action description.";
                                a.ImageSmall = NeoAxis.Properties.Resources.Default_16;
                                a.ImageBig = NeoAxis.Properties.Resources.Default_32;
                                a.QatSupport = true;
                                a.QatAddByDefault = true;
                                a.RibbonText = ("My Action", "");
                                a.GetState += delegate ( EditorAction.GetStateContext context )
                                {
                                        context.Enabled = true;
                                };
                                a.Click += delegate ( EditorAction.ClickContext context )
                                {
                                        EditorMessageBox.ShowInfo("Click.");
                                };
                                EditorActions.Register( a );
                        }

                        //My Tab
                        {
                                var tab = new EditorRibbonDefaultConfiguration.Tab( "My Tab", "Special" );
                                EditorRibbonDefaultConfiguration.Tabs.Add(tab);
                                var group = new EditorRibbonDefaultConfiguration.Group( "My Group" );
                                tab.Groups.Add( group );
                                group.AddAction( "My Action" );
                        }
                }
        }
}

Finally, you need to restart the editor. This can be done using the Restart Application button in the Quick Access Toolbar.

Screenshot999999566 2.png

After the reboot, a tab in the ribbon and a button in the toolbar will appear.

Screenshot999999567 2.png
See also
Type and Metadata ProgrammingSamples and Tutorials