Be sure to update the identifiers to describe your own plugin, in both the SDK namespace and the class
name.
Updating in type.js and instance.js
Likewise in both type.js and instance.js, you must update the following:
PLUGIN_CLASS
to refer to your plugin's name
- The
class
name suffixed with Type
or Instance
. (For example the Audio plugin uses AudioPlugin
, AudioType
and AudioInstance
as the three names.)
Optional plugin scripts
Addon SDK v2 only With the addon SDK v2, you may omit the editor script files type.js and instance.js, as well as the runtime script files plugin.js and type.js. If these files are omitted, it uses the default base class with no modifications. To remove these files, be sure to do the following:
- Delete any unused script files
- Remove the files from the
"file-list"
array in addon.json
- Remove any unused editor script files from the
"editor-scripts"
array in addon.json
- In the editor plugin script, call
this._info.SetC3RuntimeScripts()
with an array of the runtime script files in use, as the default list includes c3runtime/plugin.js and c3runtime/type.js.
The plugin constructor
The main function of plugin.js is to define a class representing your plugin. In the class constructor, the configuration for the plugin is set via the this._info
member, which is an IPluginInfo interface. The constructor also reads potentially translated strings from the language subsystem.
For more information about the possible plugin configurations, see the IPluginInfo
reference.
Specifying plugin properties
The plugin properties appear in the Properties Bar when instances of the plugin are selected. To set which properties appear, pass an array of PluginProperty to this._info.SetProperties
. An example is shown below. For more details see the PluginProperty
reference.
this._info.SetProperties([
new SDK.PluginProperty("integer", "test-property", 0)
]);