← Back to team overview

kicad-developers team mailing list archive

update on 3D refactor

 

Hi folks,

 I'm progressing with some cleanup of the 3D refactor in preparation
for merging with the main branch (which we can hopefully do early
in 2016). The latest news:

A small refactor was done to make it easier to produce a dynamic
plugin for kicad. The header include/plugins/kicad_plugin.h declares
a basic set of functions which must be implemented by all kicad
plugins. The header include/plugins/3d_plugin.h extends that set
of functions to define a 3D model plugin, which is currently
the only class of dynamic plugin implemented in kicad. There are
currently 3 definitions of the 3D model plugin and they are all found
in subdirectories of plugins/3d. To make the plugins easy to use
on the kicad side I use a plugin loader class; the basic loader
and a derived class for the 3D model plugins can be found in
plugins/ldr{/3d}. Loading a plugin is a simple matter of:

SOME_PLUGIN* myplugin = new SOME_PLUGIN;
myplugin->Open( "my_plugin_name" );

The entire plugin interface is encapsulated by the plugin loader,
so for example in my 3D plugin I can access the function to
load a 3D model via:

myplugin->Load( "some_3D_model" );

To make life even easier for the programmers, a Plugin Manager
can be designed for each specific class of plugin. In the case
of 3D plugins the manager discovers and registers all 3D model
plugins. Developers can build a plugin out-of-tree and simply
drop the plugin into an appropriate directory and it becomes
available to kicad when kicad is restarted.

When the 3D refactor work is done I plan to use the kicad_plugin.h
class to implement an Export Plugin and decouple the VRML and
IDF Export plugins, and eventually also the GeniCAM and Specctra
exporters.  Eventually it will be possible to convert the PCB File I/O
modules into dynamic plugins as well, thus making it possible for
developers to add support for different PCB formats without
recompiling the bulk of pcbnew for every change made.

- Cirilo