KroysEditorApi
The editor: registrations, commands, notifications, the document scene, selection and undo transactions. Editor target only.
Declaration
Declared in kroys/kroys_plugin.h.
kroys_plugin.h
typedef struct KroysEditorApi { ... } KroysEditorApi;
Members
#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.
#uint32_t reserved;Padding reserved for later use; leave it 0.
#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.
#KroysResult (KROYS_CALL* RegisterPanel)(KroysContext context, const KroysPanelDesc* desc, const KroysDrawCallbacks* callbacks, KroysHandle* outHandle);Capability panels: a dockable panel drawn every frame.
#KroysResult (KROYS_CALL* RegisterSettingsPage)(KroysContext context, const KroysSettingsPageDesc* desc, const KroysDrawCallbacks* callbacks, KroysHandle* outHandle);Capability settings: a page in Settings > PLUGINS.
#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.
#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.
#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.
#KroysResult (KROYS_CALL* RegisterService)(KroysContext context, const char* name, const KroysServiceCallbacks* callbacks, KroysHandle* outHandle);Capability services: Tick runs every editor frame.
#KroysResult (KROYS_CALL* RegisterAutomationStep)(KroysContext context, const char* name, const KroysAutomationCallbacks* callbacks, KroysHandle* outHandle);Capability automation: a step capture scripts run by name.
#KroysResult (KROYS_CALL* ExecuteCommand)(KroysContext context, const char* commandId);Any editor command ("File.SaveProject", "<plugin id>.<id>").
#void (KROYS_CALL* Notify)(KroysContext context, int32_t severity, const char* title, const char* message);Non-modal toast + console line.
#KroysWorld (KROYS_CALL* DocumentWorld)(KroysContext context);The edited scene; null without a scene or during Play.
#int32_t (KROYS_CALL* IsPlaying)(KroysContext context);Nonzero while Play runs.
#uint32_t (KROYS_CALL* SelectionCount)(KroysContext context);Number of selected entities.
#KroysEntity (KROYS_CALL* SelectionAt)(KroysContext context, uint32_t index);The selected entity at index.
#KroysResult (KROYS_CALL* SetSelection)(KroysContext context, const KroysEntity* entities, uint32_t count);Replaces the selection (count 0: clears it).
#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.
#KroysResult (KROYS_CALL* EndTransaction)(KroysContext context);Ends the transaction BeginTransaction opened and records its undo step.
#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).
#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).
#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.
#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).
#KroysResult (KROYS_CALL* Redo)(KroysContext context);Permission scene.write: redoes the step Undo last took back.
#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).
#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.
#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).
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.