Add-on Creation |
NeoAxis Engine has rich features for creating extensions. To create them, you can use built-in GUI system of the engine, WinForms and WPF.
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.
You can create extensions that are made as separate dll builds. This is how example additions are made. Its source codes can be found at Project\Sources\NeoAxis.Addon.ExampleEditorEngineGUI and Project\Sources\NeoAxis.Addon.ExampleEditorWinForms.
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}".
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.
The second example made by using the built-in GUI of the engine.
The third example made by using WinForms.
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.
When creating, specify the base class AssemblyUtility.AssemblyRegistration. This class is needed to perform any actions when initializing the engine.
After creation, the C# code editor will open.
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.
After the restart, a tab in the ribbon and a button in the toolbar will appear.