Table of contents |
Derived from: none
Declared in: MTAddOn.h
Library: 3DM.so
To do an add-on you'll need the 3DM.so shared library,
and the following headers:
MTAddOn.h
MTMatrix.h
MTObject.h
MTPoints.h
MTVector.h
All the classes defined in these headers are in the library 3DM.so. In the toolkit, there is a folder Project Template that contains all the necessary files to do a new add-on. You can do a copy and then change it, or install it as a template for BeIDE (read the readme file in the folder for instructions).
If you use the template, the add-on will be in fact compiled as an application. The file main.cpp contains the code to launch the toolkit. That way it is easier to test the add-on (you just have to execute it) and to debug it (just use the "debug" option in BeIDE). If you don't like this, just remove the main.cpp file from the project, and compile the project as a shared library. It can then be loaded by the toolkit as usual.
Your add-on must export two symbols.
extern MTAddOnType addOnType;
This variable indicates what type of add-on it is. Currently
only one value is permitted, MT_TOOLKIT. This variable
MUST be defined. Just add this line in your cpp file:
MTAddOnType addOnType = MT_TOOLKIT;
This line is already in MyAddOn.cpp, if you use the
project template.
|
This function is called when the add-on is loaded by the toolkit. It must return the add-on's MTObject derived object. If you use the project template, this function is already defined, and returns the MyAddOn object. In fact you just have to complete the Update() and CreateView() functions.
Three samples are included with the toolkit:
Simple is the simplest add-on you can do. It just makes a white segment with 100 points. Have a look at the Update() function to see the modifications made to the template.
Pyramid is a demonstration of a more complex object. Everything is done in the Update() function, and I hope the comments are explicit enough. This sample shows how to uses the transformations matrices.
Helix is another add-on that shows how to create a view to control the object generation.