Saturday, July 1, 2017

Abiathar API - Interacting with Abiathar

Almost all interactions an extension has with Abiathar provide an IAbiatharState object. This lets your extension work with Abiathar objects. Here are all the members of that interface:

  • LevelGen provides a level generator, which you can use to create new level objects.
  • Levels provides the level set, which has methods that allow you to inspect, add, and remove level objects.
  • TilePalette produces a tileset object for the given tileset ID.
  • CurTileset returns the currently active tileset object.
  • ViewState returns the view state manager, which you can use to control the UI.
  • TileinfoAccessor provides the tileinfo manager, which you can use to get and set tile's properties.
  • FastMode returns whether Abiathar is in High Speed Mode. In this mode, you should skip fancy graphical effects and not bother with tracking the undo/redo history.
  • CurLevelID returns the current level ID.
  • CurLevel returns the current level object.
  • SelTiles returns the three-long array of selected tile IDs, one for each plane.
  • PlaneStates returns the three-long array of plane states (Active, Locked, Hidden).
  • CurTool returns the current level tool.
  • CurTileTool returns the current tileset tool.
  • FileConfig returns the dictionary of configuration sections.
  • UiProcessingState returns an object that lets you query the current UI settings.
  • SizeRestrictions gets the level format's level size restrictions.
  • ExtraDataFields returns the level format's list of extra data fields. This will only be useful on extended level formats.
  • LevelGenre returns a level-format-defined string.
  • MarkChangesMade sets the levels as modified so Abiathar will warn before exiting.
  • PushUndoStack adds an undo history entry to the timeline. This does nothing if High Speed Mode is on.
  • ClearUndoStack purges the undo timeline.
  • DestroyLevelViewState deletes the cached images of the level with the given ID. Call this when removing a level.
  • InitializeLevelViewState sets up all the planes of the level with the given ID. Call this when adding a new level.
  • ReplaceLevel replaces the level with the given ID with the level object provided.
  • CancelTool cancels either the current level tool or the current tileset tool (depending on whether TileTool is true). The tool may be restarted but left active if HardAbort is false. Call this when a tool has finished an operation.
  • SetTool sets the current tool (level or tileset, as indicated by TileTool) to the given tool object.
  • NotifySelTileChange broadcasts a change in the selected tile for the given plane. Call this after changing the array of selected tiles.
  • NotifyTileinfoChange broadcasts a change in a plane's tileinfo, 0 for background, 1 for foreground.
  • SetDragTranslationMode sets how Abiathar will translate mouse drags for your tool. Supply whether your tool is a tileset tool.
  • DoVisibleLongOperation executes an action on a separate thread and shows a dialog to the user while it runs.
  • IsLevelCurrent returns whether the given level object is the current level.
  • GetExtension returns a loaded extension by name, or null if it cannot be found.
The properties that have to do with the current level or tileset only make sense if a level or tileset is being shown. Therefore, it is only safe to call them from a tool of that type, since a level tool can only run while a level is shown, and likewise for tileset tools and tilesets.

No comments:

Post a Comment