Repository navigation
EN Migration Guide 1.0 to 1.1
SDK 1.1 is not compatible with 1.0: a plugin built against 1.0.91-beta has to be moved to the new indicator and property contract. This page is the step-by-step procedure. The full list of changes is in the changelog of release 1.1.131-beta on the Releases page.
dependencies {
compileOnly 'com.github.velitask:velitask-sdk:1.1.+'
compileOnly 'org.json:json:20250107'
}The 1.0.+ range does not reach version 1.1 — it has to be replaced explicitly. The second line is the third-party org.json library: its JSONObject class appears in the SDK API, but it is not part of the SDK (see Building and connecting the SDK).
Previously an indicator received the player and the canvas separately, and properties read their current value themselves. Now an indicator receives one frame object — FrameContext — and passes it to every property. This way all properties of one frame see consistent values.
// before (1.0)
@Override
public IndicatorContext createContext(IndicatorContext.Player player, IndicatorContext.Canvas canvas) {
return new MyContext(player, canvas);
}
public class MyContext extends IndicatorContext {
public final ColorProperty.ColorContext color;
public MyContext(Player player, Canvas canvas) {
super(player, canvas);
color = mColor.createContext();
}
}// after (1.1)
@Override
public IndicatorContext createContext(FrameContext frame) {
return new MyContext(frame);
}
public class MyContext extends IndicatorContext {
public final ColorProperty.ColorContext color;
public MyContext(FrameContext frame) {
super(frame);
color = mColor.createContext(frame);
}
}What to change:
- the
createContextsignature in every indicator; - the indicator context constructor:
super(frame); - for every property —
createContext(frame)instead ofcreateContext(); a value without a context —mX.get(frame); - the player and the canvas —
frame.playerandframe.canvas.
If you have your own property subclasses or property contexts:
- the
bindFromLive(),bindSnapshot(...),unbindSnapshot()methods are removed — remove the overrides; - a nested context constructor takes the frame:
protected MyContext(IFrameValues frame), withsuper(frame)inside; - your own
IPropertyItemimplementation must implementT get(IFrameValues frame).
Previously an indicator converted the frame time to the sensor time itself and queried values from the property. Now the sensor context does this.
// before (1.0)
long rawTime = mDistanceSensor.convertToRawTime(ctx.player.time);
if (ctx.player.isPreview) {
rawTime = mDistanceSensor.clampToSensorRange(rawTime);
}
DistanceSensorAtom atom = mDistanceSensor.queryAtom(rawTime);
DistanceSensorAtom last = mDistanceSensor.queryLast();// after (1.1): in the indicator context — distance = mDistanceSensor.createContext(frame);
DistanceSensorAtom atom = ctx.distance.queryAtom();
DistanceSensorAtom last = ctx.distance.queryLast();The sensor context (SensorProperty.SensorContext, formerly SensorAtomContext) converts the frame time to the sensor time itself and, when the frame is drawn without waiting for data (frame.player.isPreview: the editor player and source previews), clamps it to the sensor range. For GeoSensorProperty, the approximateZoom(int) and queryLandBounds() methods have also moved to the context — GeoSensorContext.
SvgProperty.createContext() is replaced by createContext(frame):
bgSvg = mBgSvg.createContext(frame);The methods of MapTilesProperty, MapVectorProperty, MapPlacesProperty are unchanged; only the result types changed. It is enough to replace imports and names:
Before (com.velitask.sdk.*) |
After |
|---|---|
osm.OSMTile |
org.abricos.geo.tile.Tile |
vector.OSMVectorTile |
org.abricos.geo.vector.VectorTile |
vector.OSMFeature |
org.abricos.geo.vector.Feature |
vector.OSMGeometryType |
org.abricos.geo.vector.GeometryType |
vector.OSMDataTypes |
org.abricos.geo.vector.VectorDataTypes |
Map loading registries, sources, statuses and settings (OSMTileSourceRegistry, IOSMTileSource, getStatus() and others) are internal application machinery and are not available to plugins.
| Removed | What to use |
|---|---|
meteo, ga, watt sensors (SensorType.METEO/GA/WATT, their atoms, interfaces and properties) |
— |
state.old_Time, state.old_Period
|
the MILLS_PER_* constants — in org.abricos.core.state.Time
|
the state.temp package |
— |
Localization(String, Locale), Localization(LocalizedManager), Localization.setInstance
|
Localization.instance() |
ColorState.getFXColor(), ColorState.set(javafx.scene.paint.Color) — the SDK does not depend on JavaFX |
ColorState.get() / set(java.awt.Color)
|
the IndicatorContext.Player(Period, long, boolean) constructor |
the constructors with speed (and, if needed, outTime, sourceId) |
If you store SourceType by number (ordinal()), switch to the constant name: the order of the constants has changed.
If the plugin keeps its own tables (getDbVersion() > 0):
-
create.sqlis the full schema snapshot of the current version; a new database is created by it alone; - every schema change is made in one commit: update
create.sql, addupgrade-N.sql(migration fromN-1toN) and bumpgetDbVersion(); a releasedupgrade-N.sqlis never edited; - if the plugin database cannot be upgraded, the plugin is detached from the project and an entry is written to the application log;
- if the plugin works with the database through
org.abricos.core.db.DbProvider: inside anexecute/transactioncallback use only theConnectionpassed in, and get the id afterINSERTviagetGeneratedKeys().
Build the plugin (gradle build) — the compiler shows every place still on the 1.0 API. Then install the plugin and check the indicator on the canvas (see Install and run).