CrackArt uses a dynamic plugins system to expand its library of Blocks and tools using Dynamic Link Libraries.
This system is implemented in CrackArtExe in the files PluginLoader.h and PluginLoader.cpp. CrackArt uses various type of plugins:
Block
SceneEngine is designed to be a library without any user interface code. The main component in SceneEngine is the Block, but this class defines just how the Block works in the scene, but not how it's dialog blocks are, or how it is displayed in the viewports and how the user intercts with it.
BlockGUI
Because of the non-GUI definition of the Block, CrackArt needs an extra component to add the GUI of a block, this component is called a BlockGUI. (Core/sceng_gui.h and Core/sceng_gui.cpp).
Tool
A tool is an element that without being a Block provides commands that affect change the state of the scene.
ToolGUI
The tool doesn't provide a User Interface either, so as with the block, a new class is needed to add the user interface for the tool, this is the ToolGUI.
When the plugin loader is initialized (PluginLoader::Init), it scans the current folder reading all DLL files and searching on their definition for known functions. Depending on the functions it finds, CrackArt decides what kind of plugin this is, a Block, a BlockGUI, a Tool or a ToolGUI. A single DLL can implement just one or all these plugin types.
Note: SceneEngine doesn't implement any user interface to allow the faster and cleaner implementation of Blocks and Tools for batch processing scenes using command line applications and a scripting language.
cada bloque que tiene un cuadro de dialogo debe tener un BlockGUI
ie. class TriMeshObjectGUI : public BlockGUI
ese BlockGUI es casi que totalmente virtual, es un set de funciones y metodos
todos los bloques de la misma clase van a usar ese BlockGUI temporalmente, ya que el BlockGUI es el que sabe como interactuar con el Bloque
el BlockGUI siempre debe existir... osea, la aplicacion se abre, y todos los BlockGUI se crean, pero como solo uno es necesario por bloque, entonces los creamos a la c simplemente:
TriMeshObjectGUI tri_mesh_object_gui;
y lo retornamos en una sola funcion, que devuelve un apuntador a este BlockGUI
BlockGUI * GetTriMeshObjectGUI() { return &tri_mesh_object_gui; }
CrackArt tiene un sistema de plugins, que lo que hace es buscar los archivos DLL y mirar la tabla de definiciones a ver si tiene unas funciones con nombres especificos
Proyecto : CrackArt.exe Metodo : wxPluginLoader::Init
En el caso de plugins con la interface de usuario de un block, el busca 2 funciones: GetNumBlockGUIs GetBlockGUI
Todos los plugins que tengan BlockGUI tienen que implementar estas funciones
Project : ObjectsGUI File : ObjectsGUI.cpp extern "C" WXEXPORT int GetNumBlockGUIs() extern "C" WXEXPORT BlockGUI * GetBlockGUI( int gui_id )
Ahi es donde se unen las 2 cosas... CrackArt y el BlockGUI
entonces tiene que crear ese SplineObjectBlockGUI (o como lo llame) y crear su funcion GetSplineObjectBlockGUI, y retornarla ahi en extern "C" WXEXPORT BlockGUI * GetBlockGUI( int gui_id )
y no se le olvide aumentar el numero de blockGUIs en extern "C" WXEXPORT int GetNumBlockGUIs()