@wonderlandengine/editor-api
Version:
Wonderland Engine's Editor API for plugins - very experimental.
81 lines (80 loc) • 2.62 kB
TypeScript
import { EditorData } from './data.js';
import { Workspace } from './workspace.js';
interface NativeToolsAPI {
packageProject(destDir?: string): number;
loadFile(filename: string): number;
loadScene(filename: string, parent?: string): number;
awaitJob(jobId: number, cb: (success: boolean) => void): void;
openBrowser(url: string): void;
computeMeshBounds(meshId: string, out: Float32Array): void;
}
interface NativeUiAPI {
freeImage(id: number): void;
loadImage(data: ArrayBuffer): [number, number];
text(text: string): void;
label(text: string): void;
button(label: string): boolean;
image(id: number, width: number, height: number): boolean;
inputText(label: string, value: string): string | null;
inputTextMultiline(widgetId: string, value: string): string | null;
checkbox(label: string, value: boolean): boolean | null;
colorEdit4(label: string, value: Float32Array): boolean;
dummy(width: number, height: number): void;
sameLine(offset?: number): void;
separator(): void;
spinner(): void;
beginGroup(): void;
endGroup(): void;
inputFloat(label: string, value: number): number | null;
inputFloat3(label: string, value: Float32Array): boolean;
inputInt(label: string, value: number): number | null;
inputInt3(label: string, value: Int32Array): boolean;
}
/** Project paths */
export interface Project {
/**
* Root directory of the project
*
* Directory in which the project file resides in.
*/
readonly root: string;
/**
* Project filename
*
* File only without the root directory.
*/
readonly filename: string;
/**
* Project deploy path
* @returns `<root>/deploy`
*/
readonly deployPath: string;
/**
* Project cache path
* @returns `<root>/cache`
*/
readonly cachePath: string;
/**
* Project package.json path
* @returns `<root>/package.json`
*/
readonly packageJsonPath: string;
/**
* Project node_modules path
* @returns `<root>/node_modules`
*/
readonly nodeModulesPath: string;
/**
* Project shaders path
* @returns `<root>/shaders`
*/
readonly shadersPath: string;
}
declare global {
function _wl_internalBinding(moduleName: 'tools'): NativeToolsAPI;
function _wl_internalBinding(moduleName: 'ui'): NativeUiAPI;
function _wl_internalBinding(moduleName: 'data'): EditorData;
function _wl_internalBinding(moduleName: 'project'): Project;
function _wl_internalBinding(moduleName: 'workspace'): Workspace;
}
export {};