Overview
Add-on Packages are the recommended way of distributing add-ons because the package provides a centralized list of all of the Add-on Components necessary to load the Add-on.
Creating an Add-on Package
After an add-on has been developed, an Add-on Package file should be created to specify which add-on components Prepar3D should load when processing the add-on. This file must be called:
The file should be placed at the root level directory of the developed add-on. The root level of the add-on is typically the folder of the add-on's Product Name. The Instructions for Developers article outlines this and where to place the add-on.xml file.
Inside this package file is both information about the Add-on Package as well as a list of Add-on Components. Each Add-on Component specifies the category of the component, the path to where its located, and other information.
The format for the add-on.xml is as follows:
SimBase.Document Schema
The properties at the SimBase.Document level describe the add-on package. The base document can contain multiple AddOn.Component property sets which define each piece of add-on content that describe the add-on.
Property | Description | Default Value | Examples |
---|---|---|---|
Name
|
A name that will be used to show the add-on package in the UI. | Empty String |
<SimBase.Document> ... <AddOn.Name>My Add-on</AddOn.Name> ... </SimBase.Document> |
Description
(Optional, Highly Recommended) |
A description of the add-on package which is shown in the UI. | Empty String |
<SimBase.Document> ... <AddOn.Description>My Add-on</AddOn.Description> ... </SimBase.Document> |
AddOn.Component Schema
The AddOn.Component section specifies an individual add-on component that should be added when processing a package.
Property | Description | Default Value | Examples |
---|---|---|---|
Category
|
The following list of keywords, shown below, are categories that the component belongs to. Note: Use the bolded keyword as the category option.
|
Must Specify |
<AddOn.Component> ... <Category>Scenery</Category> ... </AddOn.Component> > |
Path
|
The folder path of the component to be loaded. By default the path is relative to the directory of the add-on.xml file. However, absolute paths are allowed. | Must Specify |
<AddOn.Component> ... <Path>My Scenery Folder</Path> ... </AddOn.Component> > |
Name
(Optional, required for Scenery Components) |
A name for the individual component. For scenery components this is required, however it is highly recommended to have a component name since it will show in the UI. For scenery components, their name is also shown in the Scenery Library. Note: Since Prepar3D's configuration system does not support components of the same category with the same name, be wary of creating a name that is not unique or it will overwrite the identically named component. However, if the component is not given a name, a name collision cannot occur. |
Empty String |
<AddOn.Component> ... <Name>My Scenery Region</Name> ... </AddOn.Component> |
Type
(Texture Category Only) |
The type identifier string determines what kind of path the entry refers to. At this moment, only texture components support this feature. For textures, the type of entries are:
The default value is GLOBAL and should be sufficient for most add-ons. Most systems will at least search GLOBAL directories, however some systems may search both GLOBAL and WORLD directories in a fallback manner. At this time, the UI texture type is only used internally. |
GLOBAL |
<AddOn.Component> ... <Type>WORLD</Type> ... </AddOn.Component> |
Layer
(Scenery Category Only) |
The layer of the scenery area component starting at one, where higher numbered layers take precendence over lower numbered layers. Add-on sceneries typically do not specify a layer and it is assumed that they should be the topmost layer. | An integer representing a layer one higher than the top layer |
<AddOn.Component> ... <Layer>1</Layer> ... </AddOn.Component> (A scenery component whose layer is the base scenery layer) |
CommandLine
(Optional, EXE and DLL Category Only) |
Specify optional command line arguments to start the add-on application (EXE) or library (DLL) with. | Empty String |
<AddOn.Component> ... <CommandLine>True</CommandLine> ... </AddOn.Component> |
DLLType
(Optional, DLL Category Only) |
The DLLType determines how the add-on library is initially launched. If the DLLType is not set (i.e. Empty String), then the default start, "entry point", and stop, "exit point", functions, described in their respective sections, are used. The list of non-default DLLTypes are:
|
Empty String |
<AddOn.Component> ... <DLLType>SimConnect</DLLType> ... </AddOn.Component> |
DLLStartName
(Optional, DLL Category Only) |
It is not necessary to set this field unless the add-on developer wishes to use an overridden DLL start name, "entry point". The DLLStartName that will be used by Prepar3D, if this field is not set, is determined by the DLLType:
|
(See Description) |
<AddOn.Component> (A hypothetical function called MyEntryFunc that is the entry point of the add-on) |
DLLStopName
(Optional, DLL Category Only) |
It is not necessary to set this field unless the add-on developer wishes to use an overridden DLL stop name, "exit point". The DLLStopName that will be used by Prepar3D, if this field is not set, is determined by the DLLType:
|
(See Description) |
<Addon.Component> (A hypothetical function called MyExitFunc that is the exit point of the add-on) |
NewConsole
(Applications and Library Category Only) |
The add-on library (DLL) or application (EXE) will have a new console in contrary to the default behavior of inheriting the parent application's console. | False |
<Addon.Component> |
Distributing an Add-on Package
Create an Add-on Package that specifies a list of Add-on Components that Prepar3D should load. The recommended and most straightforward way of distribution is to create an add-on whose directory structure aligns with the Add-on Instructions for Developers and whose installation path is Prepar3D's default add-on discovery folder:
Other distribution methods include:
- Add the add-on package directly using Command Line.
- Add an add-on discovery path using Command Line to automatically search for subfolders containing add-on products (i.e. folders with the add-on package file titled add-on.xml)
When Prepar3D loads, there is a discovery phase where new add-on packages inside each of the discoverable add-on folders are found and cached. Add-on packages can be found and loaded upon startup if they are placed one directory level deep inside an add-on discovery folder. Any add-ons that were cached but could no longer be found are subsequently cleaned up.
For each add-on package being processed, its add-on components, found inside the package, are processed in the order they are read. By default, add-on components processed via packages will take precedence over any add-on components not found in a package (i.e. entries in add-on configuration files).
Add-on Package Example
A full example of an add-on package is shown below:add-on.xml
<SimBase.Document Type="AddOnXml" version="4,0" id="add-on"> <AddOn.Name>MyAddOn</AddOn.Name> <AddOn.Description>My Add-on developed by My Company.</AddOn.Description> <AddOn.Component> <Category>SimObjects</Category> <Path>Content\SimObjects\Airplanes</Path> </AddOn.Component> <AddOn.Component> <Category>Scenarios</Category> <Path>Content\Scenarios</Path> </AddOn.Component> <AddOn.Component> <Category>Scenery</Category> <Path>Content\Scenery\Scenery01</Path> <Name>Scenery01</Name> </AddOn.Component> <AddOn.Component> <Category>Scenery</Category> <Path>Content\Scenery\Scenery02</Path> <Name>Scenery02</Name> </AddOn.Component> <AddOn.Component> <Category>DLL</Category> <Path>MyFirstDll.dll</Path> <DLLType>PDK</DLLType> </AddOn.Component> <AddOn.Component> <Category>DLL</Category> <Path>MySecond.dll</Path> <DLLStartName>MyStartFunc</DLLStartName> <DLLStopName>MyStopFunc</DLLStopName> </AddOn.Component> <AddOn.Component> <Category>Texture</Category> <Path>Textures/Global</Path> <Type>GLOBAL</Type> </AddOn.Component> </SimBase.Document> |
Note: This file above is meant to serve as an instructive example and shows the correct file format the developer should use. However, there are DLL and folder paths referenced above that the developer may not have. Make sure your add-on package file contains only add-on components that have valid file and folder paths.