Understanding VStitcher API
API Functions
The API is based on C functions and is ported automatically to Python and C#. The API for all programming languages mentioned above is the same with a slight difference: while the C/C++ API contains a BwApi prefix to the function name, the Python and C# APIs both treat this as a namespace. For example the function for creating a garment looks as follows for each language:
C++:
BwApiGarmentCreate("Garment Name", ...);Python:
BwApi.GarmentCreate('Garment Name', ...)C#:
BwApi.GarmentCreate("Garment Name", ...);For C/C++ only, in order to avoid having different STL versions, there is built-in support for data types like string and vectors that you should use in order to retrieve or push data to the API. For example:
C++ C
C++
// for C++ we provide a wrapper class that can be used BwString garmentId; // allocate on c'tor and deallocate on d'tor BwApiGarmentId(garmentId);
C#
// Allocate string BwApiString* garmentId = BwApiStringCreate(); // Get the garment ID from Browzwear's API BwApiGarmentId(garmentId); // Release the allocated string BwApiStringRelease(garmentId);
Folder structure
sample-plugin
│ plugin.json
└─── src
| __init__.py
| main.pyPlugin.json file
Create a file named plugin.json in the plugin folder with the following schema
Properties
identifier
Unique plugin identifier.
We recommend using a format like: com.companyname.pluginname.
The identifier is always saved in lower case.
name
Your plugin name.
If a menu item is added, the name of the plugin is used as the top level menu.
type
Your programming language - CPP/Python/C#.
version
Your plugin version.
main
source code (Python package folder name/dll name).
dependencies
npm semver compatible string representing range of versions the plugin is compatible with. For more information see https://www.npmjs.com/package/semver.
white_list
Add every remote URL that you are using to the whitelist.
htmlroot
Root for your html resources.
Example
{
"identifier": "com.browzwear.boilerplate.sample-plugin",
"dependencies": {
"bw-api": "3.*"
},
"name": "sample plugin",
"type": "python",
"main": "src",
"version": "1.0.1",
"white_list" : ["browzwear.com"],
"htmlroot" : "HtmlRoot"
}