The easiest way to build a plugin is to start with an existing example. There are three places where you can find plugin samples:
samplesfolder in the SDK has a number of plugin samples.
The All Sample Projects package in the Download tab has a
pluginsfolder with some small samples. You can also find their source code here: https://github.com/OurMachinery/sample-projects
You can create a new plugin with the menu command File > New Plugin. This will create a new
.cfile for the plugin together with some helper files for compiling it. (Follow this guide)
The distribution already comes with pre-built .dlls for the sample plugins, such as
bin/plugins/tm_pong_tab.dll. You can see this plugin in action by selecting Tab > Pong in the
editor to open up its tab:
Table of Content
To build plugins you need three things:
- You need to have Visual Studio 2019 installed including the MS C++ Build Tools on your computer. Note that the Community Edition works fine. (Or clang and the build essentials on Linux)
- You need to set the
TM_SDK_DIRenvironment variable to the path of the SDK package that you installed on your computer. When you compile a plugin, it looks for The Machinery headers in the
- You need the
tmbuild.exefrom the SDK package.
tmbuild.exedoes all the steps needed to compile the plugin. Put it in your
PATHor copy it to your plugin folder so that you can run it easily from the command line.
To compile a plugin, simply open a command prompt in the plugin folder and run the
sample-projects/plugins/custom_tab> %TM_SDK_DIR%/bin/tmbuild.exe ~~~ cmd output Installing 7za.exe... Installing premake-5.0.0-alpha14-windows... Building configurations... Running action 'vs2019'... Generated custom_tab.sln... Generated build/custom_tab/custom_tab.vcxproj... Done (133ms). Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved. custom_tab.c custom_tab.vcxproj -> C:\work\themachinery\build\bin\plugins\tm_custom_tab.dll ----------------------------- tmbuild completed in: 23.471 s
tmbuild.exe will perform the following steps to build your executable:
- Create a
libsfolder and download
premake5into it. (You can set the
TM_LIB_DIRenvironment variable to use a shared
libsdirectory for all your projects.)
premake5to create a Visual Studio project from the
- Build the Visual Studio project to build the plugin.
Note: You can learn more about tmbuild in its own section.
|Shows how to write a complex plugin. This is the default assimp importer plugin of the engine.|
|Shows how to interact with the ECS and the renderer.|
|The source code of our default render pipeline. This can help you in case you want to learn more about the render pipeline|
|The source code of our gltf importer|
|Shows how to implement graph nodes.|
|Shows how to implement a more complex tab.|
|Shows how to implement a component and a engine.|
|A great playground for our IMGUI UI System.|