133 lines
5.2 KiB
Plaintext
133 lines
5.2 KiB
Plaintext
This directory will contain code used in the refactoring of
|
|
the 3D viewer and 3D model management.
|
|
|
|
Notes on building the test program on Linux:
|
|
1. Configure to build KiCad; ensue you have "-DS3D_TEST=ON" to
|
|
enable the "test3dmm" test program.
|
|
|
|
mkdir build
|
|
cd build
|
|
cmake -DKICAD_SCRIPTING=ON \
|
|
-DKICAD_SCRIPTING_MODULES=ON \
|
|
-DBUILD_GITHUB_PLUGIN=ON \
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
-DKICAD_SKIP_BOOST=ON \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DS3D_TEST=ON \
|
|
-DCMAKE_VERBOSE_MAKEFILE=ON ..
|
|
|
|
2. After configuring to build KiCad, descend into the 3dv build
|
|
directory:
|
|
|
|
cd 3dv
|
|
|
|
3. Build all files in the 3dv directory:
|
|
|
|
make -j8
|
|
|
|
4. Install to a directory within the build directory:
|
|
|
|
mkdir inst
|
|
make install DESTDIR=./inst
|
|
|
|
5. Set LD_LIBRARY_PATH so that the 3d manager code can be found:
|
|
|
|
export LD_LIBRARY_PATH=${PWD}/inst/usr/lib/kicad
|
|
|
|
( note: the previous step may have installed the library in
|
|
${PWD}/inst/usr/local/lib/kicad )
|
|
There is no need to include the plugins directory in
|
|
LD_LIBRARY_PATH since the manager should magically find
|
|
plugins there and load them.
|
|
|
|
6. Run the test program:
|
|
|
|
./inst/usr/bin/test3dmm
|
|
|
|
|
|
===========================
|
|
For OSX and MSWin
|
|
===========================
|
|
The dynamic plugin has only been built and tested on Linux; until
|
|
the dynamic plugin system can be made to work on MSWin and OSX, those
|
|
systems will not be able to use the 3D cache framework for anything
|
|
other than a filename resolver and model file browser. Without the
|
|
plugins the 3D viewer will not be able to use the new framework for
|
|
loading generic 3D model formats.
|
|
|
|
Dynamic plugins are managed in 3dv/3d_plugin_manager.cpp so that is the
|
|
only source file which developers need to modify to support plugins
|
|
on OSX and MSWin
|
|
|
|
1. OSX:
|
|
+ In general some attention is required wherever the __APPLE__
|
|
macro is found
|
|
|
|
+ void S3D_PLUGIN_MANAGER::loadPlugins( void )
|
|
In this function a list of reasonable search paths must be provided;
|
|
these paths will be checked for the existence of a plugin
|
|
|
|
+ void S3D_PLUGIN_MANAGER::listPlugins( ... )
|
|
In this function the list of suffixes to use in the plugin
|
|
discovery should be checked to ensure that they comply with
|
|
the expectations of OSX
|
|
|
|
+ bool S3D_PLUGIN_ITEM::Open( void )
|
|
This function loads the dynamic plugins. If OSX use the gcc dlopen
|
|
set of functions then there may be no further work to be done here.
|
|
|
|
2. MSWin:
|
|
+ In general some attention is required wherever the _WIN32 macro is found
|
|
|
|
+ void S3D_PLUGIN_MANAGER::loadPlugins( void )
|
|
In this function a list of reasonable search paths must be provided;
|
|
these paths will be checked for the existence of a plugin
|
|
|
|
+ bool S3D_PLUGIN_ITEM::Open( void )
|
|
This function loads the dynamic plugins. Since the gcc dlopen family
|
|
of functions do not exist on MSWin, some _WIN32 specific code must
|
|
be added to handle the library loading.
|
|
|
|
===
|
|
|
|
Q. How do you know the plugin system is working?
|
|
A. The plugin system is working if the dummy plugin is located and loaded.
|
|
If the plugin is located and the software was built with the DEBUG flag,
|
|
you will see a group of messages which, among other things, advertises
|
|
the file types supported by the dummy plugin:
|
|
|
|
~/code/kicad/branch_3d/3dv/3d_plugin_manager.cpp:loadPlugins:404:
|
|
* [DEBUG] searching path: '~/usr/lib/kicad/plugins'
|
|
XXX - Initializing S3D_PLUGIN_DUMMY
|
|
~/code/kicad/branch_3d/3dv/3d_plugin_manager.cpp:loadPlugins:426:
|
|
* [DEBUG] adding plugin
|
|
XXX - Destroying S3D_PLUGIN_DUMMY
|
|
~/code/kicad/branch_3d/3dv/3d_plugin_manager.cpp:loadPlugins:461:
|
|
* [DEBUG] plugins loaded
|
|
* Extension [plugin name]:
|
|
+ 'IDF' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'IGES' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'IGS' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'STEP' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'STP' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'WRL' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'X3D' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'idf' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'iges' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'igs' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'step' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'stp' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'wrl' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
+ 'x3d' [~/usr/lib/kicad/plugins/libs3d_plugin_dummy.so]
|
|
* File filters:
|
|
+ 'All Files (*.*)|*.*'
|
|
+ 'VRML 1.0/2.0 (*.wrl;*.WRL)|*.wrl;*.WRL'
|
|
+ 'X3D (*.x3d;*.X3D)|*.x3d;*.X3D'
|
|
+ 'IDF 2.0/3.0 (*.idf;*.IDF)|*.idf;*.IDF'
|
|
+ 'IGESv5.3 (*.igs;*.iges;*.IGS;*.IGES)|*.igs;*.iges;*.IGS;*.IGES'
|
|
+ 'STEP (*.stp;*.step;*.STP;*.STEP)|*.stp;*.step;*.STP;*.STEP'
|
|
|
|
The supported file extensions should appear in the list of file filters within the
|
|
model selection dialog; if no plugins are loaded then the only available file
|
|
filter will be the wildcard filter *.*
|