![]() |
SCENE C++ API
2.0.31
|
This article illustrates how you can set up your development environment in order to be able to develop plugin apps for SCENE. Starting with the setup requires the following:
Run the installer of the developer package and follow the on-screen installation instructions. In the installation directory of the developer package you will find additional documentation, samples and resources to get started with the app development. Directory Structure of the Developer Package The installation directory of the developer package contains the following sub-directories:
SCENE plugin apps are written in C++ and built as dynamic-link-libraries. The SCENE API provides a C++ interface which can accessed by plugin apps to make use of the API functionality. You can easily set up a new plugin app project with the following steps:
C:\SCENE API\SCENE API App Developer Package 2.0.0 x64\c++\include
C:\SCENE API\SCENE API App Developer Package 2.0.0 x64\c++\lib\x64
Core_API.lib
, Scanner_API.lib
and Plugin_API.lib
to the Additional Dependencies.Note: In order to be able to use the SCENE API, your project has to be configured to target 64bit platforms. More Information on how to setup your project for 64bit platforms can be found at the following link: How to: Configure Visual C++ Projects to Target 64-Bit Platforms.
Every plugin app must implement at least two fundamental functions, one which is called by SCENE when the app is activated and one which is called when it is deactivated. These functions have to match a defined signature and need to be exported to the dll interface of the app so that they can be correctly called by the hosting SCENE instance. In order to implement and expose the functions in your app project you can just add a new source file to your app project and use the code from the following code snippet:
#include <windows.h> #include <plugin_api/lsscenecontext.h> using namespace SCENE_API; extern "C" __declspec(dllexport) int lsAppStartup( ref_ptr<LSSceneContext> context, HINSTANCE hInstance) { return 0; } extern "C" __declspec(dllexport) void lsAppShutdown() { }
You can find more information on the app lifecycle and on startup and shutdown functions in the plugin app lifecycle documentation article.
Besides the app dll and its dependencies which make up the logical part of an app, each app has to supply additional metadata files. These files are used by SCENE to extract fundamental information such as the app name and version as well as to check whether the app is compatible with the API provided by the hosting SCENE instance. Every app must provide at least one metadata file called the app manifest which contains the essential information required by SCENE to run the app. In order to add an app manifest to your app project you need to create a new file called "AppManifest.xml" and insert the app information using a special xml syntax required by SCENE. As a starting point you can use the following xml code and replace the value properties of the appropriate xml nodes with the values that describe your app.
<?xml version="1.0" encoding="utf-8"?> <!-- XML v. 2 --> <!-- 'SCENE XML' --> <!-- NEXT: XML Root Element --> <FARO> <AttrContainer> <Attr type="String"> <Name value="'Name'" /> <Value value="'App name'" /> </Attr> <Attr type="String"> <Name value="'Version'" /> <Value value="'1.0.0.0'" /> </Attr> <Attr type="String"> <Name value="'Description'" /> <Value value="'App description'" /> </Attr> <Attr type="String"> <Name value="'App_Dll'" /> <Value value="'App dll filename'" /> </Attr> <Attr type="String"> <Name value="'Minimum_Required_API'" /> <Value value="'2.0.0.0'" /> </Attr> </AttrContainer> </FARO>
In order to install and run your app in SCENE you need to create an app package. App packages are special archive files which use an .fpp file ending to be identifiable by SCENE and contain all files related to the app. You can create an app package from within SCENE through the following steps:
After the app package has been created, the app can be installed by double-clicking or dragging it onto a SCENE instance. Upon installation SCENE prompts the user for confirmation of the installation and displays a dialog containing the name and description of the app.
The contents of the prepared app package are installed to a sub-directory of the Apps directory located in the installation directory of SCENE. Once the app has been successfully installed, it will be automatically activated.