KROYSDOCS
HomeWhat's newv0.1.0
C/C++ SDK / C ABI · Editor / KroysEditorApi

KroysEditorApi

The editor: registrations, commands, notifications, the document scene, selection and undo transactions. Editor target only.

Kindstruct
Headerkroys/kroys_plugin.h
Members27
Functions25
DECLARATION

Declaration

Declared in kroys/kroys_plugin.h.

kroys_plugin.h
typedef struct KroysEditorApi { ... } KroysEditorApi;
REFERENCE

Members

Fields
#uint32_t structSize;

Size of this struct as the writer compiled it (sizeof); the reader uses it to detect members appended by later minor versions.

field
#uint32_t reserved;

Padding reserved for later use; leave it 0.

field
Functions
#KroysResult (KROYS_CALL* RegisterCommand)(KroysContext context, const KroysCommandDesc* desc, const KroysCommandCallbacks* callbacks, KroysHandle* outHandle);

Capability commands: a command in the palette and under Tools > Plugins, optionally on the toolbar and under a shortcut.

function pointer
#KroysResult (KROYS_CALL* RegisterPanel)(KroysContext context, const KroysPanelDesc* desc, const KroysDrawCallbacks* callbacks, KroysHandle* outHandle);

Capability panels: a dockable panel drawn every frame.

function pointer
#KroysResult (KROYS_CALL* RegisterSettingsPage)(KroysContext context, const KroysSettingsPageDesc* desc, const KroysDrawCallbacks* callbacks, KroysHandle* outHandle);

Capability settings: a page in Settings > PLUGINS.

function pointer
#KroysResult (KROYS_CALL* RegisterImporter)(KroysContext context, const KroysImporterDesc* desc, const KroysFileJobCallbacks* callbacks, KroysHandle* outHandle);

Capability importers: Run converts a source file on a worker thread.

function pointer
#KroysResult (KROYS_CALL* RegisterExporter)(KroysContext context, const KroysExporterDesc* desc, const KroysFileJobCallbacks* callbacks, KroysHandle* outHandle);

Capability exporters: Run writes an exported file on a worker thread.

function pointer
#KroysResult (KROYS_CALL* RegisterAssetType)(KroysContext context, const KroysAssetTypeDesc* desc, const KroysAssetTypeCallbacks* callbacks, KroysHandle* outHandle);

Capability asset-types: create, describe, open and save hooks for files with the extension.

function pointer
#KroysResult (KROYS_CALL* RegisterService)(KroysContext context, const char* name, const KroysServiceCallbacks* callbacks, KroysHandle* outHandle);

Capability services: Tick runs every editor frame.

function pointer
#KroysResult (KROYS_CALL* RegisterAutomationStep)(KroysContext context, const char* name, const KroysAutomationCallbacks* callbacks, KroysHandle* outHandle);

Capability automation: a step capture scripts run by name.

function pointer
#KroysResult (KROYS_CALL* ExecuteCommand)(KroysContext context, const char* commandId);

Any editor command ("File.SaveProject", "<plugin id>.<id>").

function pointer
#void (KROYS_CALL* Notify)(KroysContext context, int32_t severity, const char* title, const char* message);

Non-modal toast + console line.

function pointer
#KroysWorld (KROYS_CALL* DocumentWorld)(KroysContext context);

The edited scene; null without a scene or during Play.

function pointer
#int32_t (KROYS_CALL* IsPlaying)(KroysContext context);

Nonzero while Play runs.

function pointer
#uint32_t (KROYS_CALL* SelectionCount)(KroysContext context);

Number of selected entities.

function pointer
#KroysEntity (KROYS_CALL* SelectionAt)(KroysContext context, uint32_t index);

The selected entity at index.

function pointer
#KroysResult (KROYS_CALL* SetSelection)(KroysContext context, const KroysEntity* entities, uint32_t count);

Replaces the selection (count 0: clears it).

function pointer
#KroysResult (KROYS_CALL* BeginTransaction)(KroysContext context, const char* label);

Groups document edits into one undo step. Without one, each edit call is its own step.

function pointer
#KroysResult (KROYS_CALL* EndTransaction)(KroysContext context);

Ends the transaction BeginTransaction opened and records its undo step.

function pointer
#KroysResult (KROYS_CALL* SetPanelOpen)(KroysContext context, const char* panelId, int32_t open);

Opens or closes a panel (local id of this plugin, or a full panel id).

function pointer
#KroysResult (KROYS_CALL* MarkAssetDirty)(KroysContext context, const char* path);

Asks the host to call the asset type's Save hook (on Save All / Plugins.SaveAssets).

function pointer
#KroysResult (KROYS_CALL* ExportFile)(KroysContext context, const char* exporterId, const char* sourcePath, const char* outputPath);

Runs a registered exporter (local id) on a content file; result written to outputPath.

function pointer
#KroysResult (KROYS_CALL* Undo)(KroysContext context);

Permission scene.write: undoes the newest step of the document's undo history (KROYS_E_STATE when there is none or during Play).

function pointersince 2.2
#KroysResult (KROYS_CALL* Redo)(KroysContext context);

Permission scene.write: redoes the step Undo last took back.

function pointersince 2.2
#const char* (KROYS_CALL* HistoryLabel)(KroysContext context, int32_t redo);

The label of the step Undo (redo = 0) or Redo (redo != 0) would apply; "" when none (host string).

function pointersince 2.2
#KroysResult (KROYS_CALL* InstantiatePrefab)(KroysContext context, const char* path, KroysEntity parent, KroysEntity* outEntity);

Permission scene.write: instantiates a prefab (content-relative path, '/' separators) under parent (0: a root entity) as one undo step; the instance root in *outEntity.

function pointersince 2.2
#KroysResult (KROYS_CALL* StartOperation)(KroysContext context, const char* operation, const char* argument, const KroysOperationCallbacks* callbacks, uint64_t* outTaskId);

Capability tasks, permission project.build: starts a long-running operation as an editor task (Tasks panel). Operations: "scripts.build" (builds the project's C# gameplay scripts and reloads them; output: the compiler output), "package" (packages the game with the project's packaging profile; argument: "" or "scripts" to build scripts first). Callbacks report progress and the result; tasks->Cancel(*outTaskId) cancels. KROYS_E_NOT_FOUND for an unknown operation, KROYS_E_STATE when it cannot start now (one already runs, no project, Play).

function pointersince 2.2
Members
uint32_t structSize;
uint32_t reserved;
KroysResult (KROYS_CALL* RegisterCommand)(KroysContext context, const KroysCommandDesc* desc, const KroysCommandCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* RegisterPanel)(KroysContext context, const KroysPanelDesc* desc, const KroysDrawCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* RegisterSettingsPage)(KroysContext context, const KroysSettingsPageDesc* desc, const KroysDrawCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* RegisterImporter)(KroysContext context, const KroysImporterDesc* desc, const KroysFileJobCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* RegisterExporter)(KroysContext context, const KroysExporterDesc* desc, const KroysFileJobCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* RegisterAssetType)(KroysContext context, const KroysAssetTypeDesc* desc, const KroysAssetTypeCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* RegisterService)(KroysContext context, const char* name, const KroysServiceCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* RegisterAutomationStep)(KroysContext context, const char* name, const KroysAutomationCallbacks* callbacks, KroysHandle* outHandle);
KroysResult (KROYS_CALL* ExecuteCommand)(KroysContext context, const char* commandId);
void (KROYS_CALL* Notify)(KroysContext context, int32_t severity, const char* title, const char* message);
KroysWorld (KROYS_CALL* DocumentWorld)(KroysContext context);
int32_t (KROYS_CALL* IsPlaying)(KroysContext context);
uint32_t (KROYS_CALL* SelectionCount)(KroysContext context);
KroysEntity (KROYS_CALL* SelectionAt)(KroysContext context, uint32_t index);
KroysResult (KROYS_CALL* SetSelection)(KroysContext context, const KroysEntity* entities, uint32_t count);
KroysResult (KROYS_CALL* BeginTransaction)(KroysContext context, const char* label);
KroysResult (KROYS_CALL* EndTransaction)(KroysContext context);
KroysResult (KROYS_CALL* SetPanelOpen)(KroysContext context, const char* panelId, int32_t open);
KroysResult (KROYS_CALL* MarkAssetDirty)(KroysContext context, const char* path);
KroysResult (KROYS_CALL* ExportFile)(KroysContext context, const char* exporterId, const char* sourcePath, const char* outputPath);
KroysResult (KROYS_CALL* Undo)(KroysContext context);
KroysResult (KROYS_CALL* Redo)(KroysContext context);
const char* (KROYS_CALL* HistoryLabel)(KroysContext context, int32_t redo);
KroysResult (KROYS_CALL* InstantiatePrefab)(KroysContext context, const char* path, KroysEntity parent, KroysEntity* outEntity);
KroysResult (KROYS_CALL* StartOperation)(KroysContext context, const char* operation, const char* argument, const KroysOperationCallbacks* callbacks, uint64_t* outTaskId);

KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.