import { Observer, ObserverHistory, Events, ObserverList } from '@playcanvas/observer'; import { HistoryAction } from '@playcanvas/observer/types/history'; import * as share from 'sharedb/lib/client/index'; type Metrics = { env: string, send: boolean }; type Plan = { id: number, type: string, }; type Project = { id: number, name: string, permissions: { admin: number[] read: number[], write: number[] }, private: boolean, primaryApp: number, playUrl: string, settings: object }; type Scene = { id: string, uniqueId: string, }; type Sentry = { enabled: true, env: string, version: string send: boolean, service: string, page: string disable_breadcrumbs: boolean } | { enabled: false }; type ModelSchema = { scene: object, settings: object, asset: object, }; type Url = { api: string, launch: string, home: string, realtime: { http: string, }, messenger: { http: string, ws: string, }, relay: { http: string, ws: string, }, frontend: string, engine: string, useCustomEngine: boolean, }; type EngineVersions = { current: { version: string, description: string }, force: { version: string, description: string }, previous?: { version: string, description: string }, releaseCandidate?: { version: string, description: string }, }; type WasmModule = { moduleName: string, glueUrl: string, wasmUrl: string, fallbackUrl: string, preload: boolean }; type EditorBlankConfig = { version: string, self: { id: number, username: string, flags: Record, plan: Plan, branch: { id: null }, diskAllowance: number }, accessToken: string, project: { id: null }, url: Url & { store: string, howdoi: string, static: string, images: string, }, schema: ModelSchema, engineVersions: EngineVersions sentry: Sentry, metrics: Metrics, oneTrustDomainKey: string, wasmModules: WasmModule[] }; type EditorConfig = { version: string, self: { id: number username: string, flags: Record, branch: { id: string, name: string, createdAt: string, latestCheckpointId: string, merge?: object }, plan: Plan, locale: string }, owner: { id: number, username: string, plan: Plan, size: number, diskAllowance: number }, accessToken: string, project: Project & { description: string, privateAssets: boolean, hasPrivateSettings: boolean, thumbnails: { s?: string, m?: string, l?: string, xl?: string } masterBranch: string, }, aws: { s3Prefix: string, }, store: { sketchfab: { clientId: string, cookieName: string, redirectUrl: string, } }, scene: Scene, url: Url & { store: string, howdoi: string, static: string, images: string, }, engineVersions: EngineVersions, sentry: Sentry, metrics: Metrics, oneTrustDomainKey: string, schema: ModelSchema, wasmModules: WasmModule[], }; type CodeEditorConfig = { self: { id: number, username: string, flags: Record, branch: { id: string, name: string, merge?: object, } }, project: Project, tabs: number[], file: { line?: number, col?: number, error?: string, }, title: string, url: Url & { autocomplete: string, }, sentry: Sentry, metrics: Metrics, oneTrustDomainKey: string, schema: ModelSchema }; type LaunchConfig = { self: { id: string; username: string; branch: { id: string, }, locale: string; }, project: Pick & { repositoryUrl: string, scriptPrefix: string, hasReadAccess: boolean } scene: Scene, scenes: { name: string, url: string }[], url: Omit & { engineExtras: string, physics: string, webvr: string, scriptsBeforeEngine: { url: string }[], scriptsAfterEngine: { url: string }[] }, importMap: string, sentry: Sentry, metrics: Metrics, oneTrustDomainKey: string, schema: ModelSchema, engineVersions: EngineVersions, wasmModules?: WasmModule[] }; /** * Represents an Asset. * * What follows is a reference for all possible asset paths that can be passed to functions such as {@link Asset#get} and {@link Asset#set}. */ type AssetProps = { /** * The asset data depend on the type of the asset. Asset data are available at runtime. */ data?: AssetData; /** * Exclude asset from the project. If true, the asset will not be available at runtime and not be included in published builds. */ exclude?: boolean; /** * Properties related to the file of the asset. */ file?: { /** * `[read-only]` Properties for the different variants of the asset file. */ variants?: { /** * `[read-only]` Properties for the BASIS variant of the asset file. */ basis?: object; /** * `[read-only]` Properties for the DXT variant of the asset file. */ dxt?: object; /** * `[read-only]` Properties for the ETC1 variant of the asset file. */ etc1?: object; /** * `[read-only]` Properties for the ETC2 variant of the asset file. */ etc2?: object; /** * `[read-only]` Properties for the PVR variant of the asset file. */ pvr?: object; }; }; /** * A dictionary that holds localized versions of the asset file. Each key in the dictionary is the locale and each value is the asset `id`. */ i18n?: Record; /** * `[read-only]` The asset id. This id is the same across different branches. */ id?: number; /** * `[read-only]` Asset properties that depend on the type of the asset. Meta properties are available in the PlayCanvas Editor but not at runtime. */ meta?: object; /** * `[read-only]` The name of the asset. */ name?: string; /** * `[read-only]` An array of folder asset `id`s that represent the full path of the asset, if the asset is under one or more folders. */ path?: number[]; /** * If true the asset will be loaded during the preload phase of application set up. */ preload?: boolean; /** * `[read-only]` Whether this is a source asset. A source asset is not included at runtime (e.g. FBX) but may have target assets that are generated from it (e.g. model assets). */ source?: boolean; /** * `[read-only]` The `id` of the source asset that generated this asset. */ source_asset_id?: string; /** * An array of asset tags. */ tags?: string[]; /** * `[read-only]` The type of the asset. Can be: various types listed. */ type?: string; /** * `[read-only]` The asset's unique id. This id is different across different branches. */ uniqueId?: number; }; /** * Represents the data for an Asset. */ type AssetData = AnimationAssetData | AnimstategraphAssetData | BundleAssetData | CubemapAssetData | FontAssetData | MaterialAssetData | ModelAssetData | RenderAssetData | ScriptAssetData | SpriteAssetData | TextureAssetData | TextureAtlasAssetData | WasmAssetData; /** * Represents the data for an Animation asset. */ type AnimationAssetData = { /** * A set of events tied to the playback of this animation asset. */ events: { [key: string]: { /** * The name of this event. */ name: string; /** * An optional number value to be passed to the callback of this event's listener. */ number?: number; /** * An optional string value to be passed to the callback of this event's listener. */ string?: string; /** * The time during the playback of this animation that the event should trigger. Given in normalized time. */ time: number; }; }; }; /** * Represents the data for an AnimStateGraph asset. */ type AnimstategraphAssetData = { /** * A set of AnimStateGraph layers. */ layers: { [key: string]: { /** * Defines the way in which this layer should blend with previous layers. * Can be: `pc.ANIM_LAYER_OVERWRITE`, `pc.ANIM_LAYER_ADDITIVE`. */ blendType: string; /** * The name of the AnimStateGraph layer. */ name: string; /** * The ids of the states that this layer contains. */ states: number[]; /** * The ids of the transitions that this layer contains. */ transitions: number[]; /** * The weight that this layer contributes to the final output of the animation. * Given as a normalized value. */ weight: number; }; }; /** * A set of AnimStateGraph parameters. */ parameters: { [key: string]: { /** * The name of the parameter. */ name: string; /** * The type of this parameter's value. * Can be: `pc.ANIM_PARAMETER_INTEGER`, `pc.ANIM_PARAMETER_FLOAT`, `pc.ANIM_PARAMETER_BOOLEAN`, `pc.ANIM_PARAMETER_TRIGGER`. */ type: string; /** * The value of this parameter. */ value: any; }; }; /** * A set of AnimStateGraph states. */ states: { [key: string]: { /** * If true, the START node will transition directly to this node at the start of playback. */ defaultState: boolean; /** * The id of this state. */ id: number; /** * Determines whether playback of this state's animation should continually loop when it reaches the end. */ loop: boolean; /** * The name of this state. */ name: string; /** * The type of node this state should be. Either 0 (START), 1 (ANIMATION), 2 (ANY), or 3 (END). */ nodeType: number; /** * The position of this node in the graph on the x-axis. */ posX: number; /** * The position of this node in the graph on the y-axis. */ posY: number; /** * The playback speed for this state. */ speed: number; }; }; /** * A set of AnimStateGraph transitions. */ transitions: { [key: string]: { conditions: { [key: string]: { /** * The name of the parameter this condition is evaluated on. */ parameterName: string; /** * The comparator used to determine whether the condition passes. * Can be: `pc.ANIM_GREATER_THAN`, `pc.ANIM_LESS_THAN`, `pc.ANIM_GREATER_THAN_EQUAL_TO`, `pc.ANIM_LESS_THAN_EQUAL_TO`, `pc.ANIM_EQUAL_TO`, `pc.ANIM_NOT_EQUAL_TO`. */ predicate: string; /** * The value that the condition should be compared against. */ value: any; }; }; /** * This should be true if this transition moves from the START state. * Only one transition should contain this per layer. */ defaultTransition: boolean; /** * Defines the type of states this transition can connect. * Should be 0 (Animation) nodes. */ edgeType: number; /** * Defines the single frame during the from state's playback that this transition is active for. * Given in normalized time. */ exitTime: number; /** * The id of the state this transition moves from. */ from: number; /** * Determines which states can interrupt this transition with their own transitions. * Can be: `pc.ANIM_INTERRUPTION_NONE`, `pc.ANIM_INTERRUPTION_PREV`, `pc.ANIM_INTERRUPTION_NEXT`, `pc.ANIM_INTERRUPTION_PREV_NEXT`, `pc.ANIM_INTERRUPTION_NEXT_PREV`. */ interruptionSource: string; /** * Used to sort multiple active transitions in priority order. * The transition with the lowest value is selected first. */ priority: number; /** * The duration of the transition's blend between the from and to states. */ time: number; /** * The id of the state this transition moves to. */ to: number; /** * Defines the point during this to state's timeline that this transition should begin playback at. */ transitionOffset: number; }; }; }; /** * Represents the data for a Bundle asset. */ type BundleAssetData = { /** * An array of asset ids contained in the bundle. */ assets: number[]; }; /** * Represents the data for a Cubemap asset. */ type CubemapAssetData = { /** * Integer value specifying the level of anisotropic to apply to the texture ranging from 1 (no anisotropic filtering) to the `pc.GraphicsDevice` property `maxAnisotropy`. */ anisotropy: number; /** * The magnification filter to be applied to the texture. * Can be: `pc.FILTER_NEAREST`, `pc.FILTER_LINEAR`, `pc.FILTER_NEAREST_MIPMAP_NEAREST`, `pc.FILTER_LINEAR_MIPMAP_NEAREST`, `pc.FILTER_NEAREST_MIPMAP_LINEAR`, `pc.FILTER_LINEAR_MIPMAP_LINEAR`. */ magFilter: number; /** * The minification filter to be applied to the texture. * Can be: `pc.FILTER_NEAREST`, `pc.FILTER_LINEAR`, `pc.FILTER_NEAREST_MIPMAP_NEAREST`, `pc.FILTER_LINEAR_MIPMAP_NEAREST`, `pc.FILTER_NEAREST_MIPMAP_LINEAR`, `pc.FILTER_LINEAR_MIPMAP_LINEAR`. */ minFilter: number; /** * Whether the cubemap is RGBM. The RGBM format is a format to store high dynamic range (HDR) textures by using the alpha channel to store a multiplier for the rgb channels. */ rgbm: boolean; /** * An array of 6 texture asset ids that represent the faces of the cubemap. */ textures: number[]; }; /** * Represents the data for a Font asset. */ type FontAssetData = { /** * Information about the characters in the font. */ chars: { [key: string]: { /** * The height of the character. */ height: number; /** * The character id. */ id: number; /** * The actual letter. */ letter: string; /** * The range of the character. */ range: number; /** * The scale of the character. */ scale: number; /** * The width of the character. */ width: number; /** * The x coordinate of the character. */ x: number; /** * How much to advance in the x axis. */ xadvance: number; /** * The offset in the x axis. */ xoffset: number; /** * The y coordinate of the character. */ y: number; /** * The offset in the y axis. */ yoffset: number; }; }; /** * Information about the font. */ info: { /** * The name of the font. */ face: string; /** * The height of the font. */ height: number; /** * The width of the font. */ width: number; }; /** * The intensity of the font. */ intensity: number; /** * Information about the kerning. */ kerning: { [key: string]: any; }; /** * The font version. */ version: number; }; /** * Represents the data for a Material asset. */ type MaterialAssetData = { /** * Used to fade out materials that do not use opacity to fade specular (`opacityFadesSpecular` is false). */ alphaFade: number; /** * The alpha test reference value to control which fragments are written to the currently active render target based on alpha value. * All fragments with an alpha value of less than the `alphaTest` reference value will be discarded. */ alphaTest: number; /** * Enables or disables alpha to coverage. When enabled, and if hardware anti-aliasing is on, limited order-independent transparency can be achieved. * Quality depends on the number of MSAA samples of the current render target. */ alphaToCoverage: boolean; /** * An array of 3 numbers controlling the tint color to multiply the scene's global ambient color. */ ambient: number[]; /** * Enable this to multiply the scene's global ambient color with a material specific color. */ ambientTint: boolean; /** * Defines the amount of specular anisotropy when GGX Specular is enabled. */ anisotropy: number; /** * The id of an ambient occlusion texture asset containing pre-baked ambient occlusion. */ aoMap: number; /** * An ambient occlusion map color channel to extract color value from texture. Can be: r, g, b, a. */ aoMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the AO map. Each component is between 0 and 1. */ aoMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the AO map. */ aoMapTiling: number[]; /** * AO map UV channel. */ aoMapUv: number; /** * Use vertex colors for AO instead of a map. */ aoMapVertexColor: boolean; /** * Controls blending. Can be various types like `pc.BLEND_SUBTRACTIVE`, `pc.BLEND_ADDITIVE`, etc. */ blendType: number; /** * The strength of the applied normal map. This is a value between 0 (the normal map has no effect) and 2 (the effect of the normal map is exaggerated). */ bumpMapFactor: number; /** * Defines the intensity of the clear coat layer from 0 to 1. */ clearCoat: number; /** * The strength of the applied normal map for the clear coat layer, value between 0 and 2. */ clearCoatBumpiness: number; /** * The asset id of the clear coat gloss map that specifies a per-pixel intensity value. The clear coat gloss map is modulated by the clearCoat property. */ clearCoatGlossMap: number; /** * A clear coat gloss map color channel to extract color value from texture. Can be: r, g, b, a. */ clearCoatGlossMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the clear coat gloss map. Each component is between 0 and 1. */ clearCoatGlossMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the clear coat gloss map. */ clearCoatGlossMapTiling: number[]; /** * Clear coat gloss map UV channel. */ clearCoatGlossMapUv: number; /** * Use vertex colors for clear coat glossiness instead of a map. */ clearCoatGlossVertexColor: boolean; /** * A color channel to extract color value from vertex colors for clear coat glossiness. Can be: r, g, b, a. */ clearCoatGlossVertexColorChannel: string; /** * A value determining the smoothness of the clear coat surface. */ clearCoatGlossiness: number; /** * The clear coat map that specifies a per-pixel intensity value. The clear coat map is modulated by the Clear Coat Factor property. */ clearCoatMap: number; /** * A clearCoat map color channel to extract color value from texture. Can be: r, g, b, a. */ clearCoatMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the `clearCoatMap`. Each component is between 0 and 1. */ clearCoatMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `clearCoatMap`. */ clearCoatMapTiling: number[]; /** * ClearCoat map UV channel. */ clearCoatMapUv: number; /** * The asset id of the normal map that specifies the per-pixel surface normals for the clear coat layer. The normal map is modulated by the 'Bumpiness' property. */ clearCoatNormalMap: number; /** * Array of 2 numbers controlling the 2D offset of the clear coat normal map. Each component is between 0 and 1. */ clearCoatNormalMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the clear coat normal map. */ clearCoatNormalMapTiling: number[]; /** * Clear coat normal map UV channel. */ clearCoatNormalMapUv: number; /** * Use vertex colors for clear coat intensity instead of a map. */ clearCoatVertexColor: boolean; /** * A color channel to extract color value from vertex colors for clear coat intensity. Can be: r, g, b, a. */ clearCoatVertexColorChannel: string; /** * Defines how diffuse and specular components are combined when Fresnel is on. It is recommended to leave this option enabled. */ conserveEnergy: boolean; /** * The asset id of a cube map asset that approximates environment reflection. If the scene has a SkyBox set, then it will be used as the default cubeMap. */ cubeMap: number; /** * The type of projection applied to the `cubeMap` property, with options: `pc.CUBEPROJ_NONE` and `pc.CUBEPROJ_BOX`. Set to Box to enable world-space axis-aligned projection of cubemap based on bounding box. */ cubeMapProjection: number; /** * The world space axis-aligned bounding box defining the box-projection used for the cubeMap property. Only used when cubeMapProjection is set to pc.CUBEPROJ_BOX. */ cubeMapProjectionBox: { /** * Array of 3 numbers controlling the center of the box for cubeMap projection. */ center: number[]; /** * Array of 3 numbers controlling the half extents of the box for cubeMap projection. */ halfExtents: number[]; }; /** * Controls culling. Can be: `pc.CULLFACE_NONE`, `pc.CULLFACE_BACK`, `pc.CULLFACE_FRONT`, `pc.CULLFACE_FRONTANDBACK`. */ cull: number; /** * If true, a per-pixel check is performed to determine if the pixel passes the engine's depth test when a mesh with the material is rendered. */ depthTest: boolean; /** * If true, depth information is written to the depth buffer when a mesh with the material is rendered. */ depthWrite: boolean; /** * An array of 3 numbers representing the diffuse color of the material if no diffuse map is set or tint is enabled. */ diffuse: number[]; /** * The asset id of the diffuse map that specifies the per-pixel diffuse material color. If no diffuse map is set, the diffuse color is used instead. */ diffuseMap: number; /** * The diffuse map color channel to extract color value from texture. Can be: r, g, b, a, rgb. */ diffuseMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the `diffuseMap`. Each component is between 0 and 1. */ diffuseMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `diffuseMap`. */ diffuseMapTiling: number[]; /** * Check this to modulate the material's diffuse map with a material specific diffuse color. */ diffuseMapTint: boolean; /** * Diffuse map UV channel. */ diffuseMapUv: number; /** * Use vertex colors for diffuse instead of a map. */ diffuseMapVertexColor: boolean; /** * An array of 3 numbers representing the emissive color of the material if no emissive map is set or tint is enabled. */ emissive: number[]; /** * A multiplier for emissive color that can achieve overbright effects for exceptionally bright emissive materials. */ emissiveIntensity: number; /** * The asset id of the emissive map that specifies the per-pixel emissive color. If no emissive map is set, the emissive color is used instead. */ emissiveMap: number; /** * An emissive map color channel to extract color value from texture. Can be: r, g, b, a, rgb. */ emissiveMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the `emissiveMap`. Each component is between 0 and 1. */ emissiveMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `emissiveMap`. */ emissiveMapTiling: number[]; /** * Check this to modulate the material's emissive map with a material specific emissive color. */ emissiveMapTint: boolean; /** * Emissive map UV channel. */ emissiveMapUv: number; /** * Use vertex colors for emission instead of a map. */ emissiveMapVertexColor: boolean; /** * Enables GGX specular response. Also enables anisotropy parameter to set material anisotropy. */ enableGGXSpecular: boolean; /** * A parameter for Fresnel. Can be: `pc.FRESNEL_NONE`, `pc.FRESNEL_SCHLICK`. */ fresnelModel: number; /** * The asset id of the gloss map that specifies a per-pixel shininess value. The gloss map is modulated by the shininess property. */ glossMap: number; /** * A gloss map color channel to extract color value from texture. Can be: r, g, b, a. */ glossMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the `glossMap`. Each component is between 0 and 1. */ glossMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `glossMap`. */ glossMapTiling: number[]; /** * Gloss map UV channel. */ glossMapUv: number; /** * Use vertex colors for glossiness instead of a map. */ glossMapVertexColor: boolean; /** * The asset id of the height map that specifies the per-pixel strength of the parallax effect. White is full height and black is zero height. */ heightMap: number; /** * A height map color channel to extract color value from texture. Can be: r, g, b, a. */ heightMapChannel: string; /** * The strength of a parallax effect (a value between 0 and 2). */ heightMapFactor: number; /** * Array of 2 numbers controlling the 2D offset of the `heightMap`. Each component is between 0 and 1. */ heightMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `heightMap`. */ heightMapTiling: number[]; /** * Height map UV channel. */ heightMapUv: number; /** * The asset id of the lightmap texture that contains pre-baked diffuse lighting. The lightmap usually is applied to the second UV set. */ lightMap: number; /** * A light map color channel to extract color value from texture. Can be: r, g, b, a, rgb. */ lightMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the lightmap. Each component is between 0 and 1. */ lightMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the lightmap. */ lightMapTiling: number[]; /** * Lightmap UV channel. */ lightMapUv: number; /** * Use vertex lightmap instead of a texture-based one. */ lightMapVertexColor: boolean; /** * Metalness factor multiplier. */ metalness: number; /** * The asset id of the map that specifies per-pixel metalness values. A value of 1 is metal and a value of 0 is non-metal. */ metalnessMap: number; /** * A metalness map color channel to extract color value from texture. Can be: r, g, b, a. */ metalnessMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the metalness map. Each component is between 0 and 1. */ metalnessMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the metalness map. */ metalnessMapTiling: number[]; /** * Metalness map UV channel. */ metalnessMapUv: number; /** * Use vertex colors for metalness instead of a map. */ metalnessMapVertexColor: boolean; /** * The asset id of the normal map that specifies the per-pixel surface normals. The normal map is modulated by the 'Bumpiness' property. */ normalMap: number; /** * Array of 2 numbers controlling the 2D offset of the `normalMap`. Each component is between 0 and 1. */ normalMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `normalMap`. */ normalMapTiling: number[]; /** * Normal map UV channel. */ normalMapUv: number; /** * If true, ambient color will occlude specular factor of a material. */ occludeSpecular: number; /** * The opacity of the material. This is a value between 0 (completely transparent) and 1 (completely opaque). */ opacity: number; /** * Controls whether Specular is faded out by material Opacity which is sometimes not desired for shiny translucent materials such as glass. */ opacityFadesSpecular: boolean; /** * The asset id of the opacity map that specifies the per-pixel opacity. The opacity map is modulated by the `opacity` property. */ opacityMap: number; /** * An opacity map color channel to extract color value from texture. Can be: r, g, b, a. */ opacityMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the `opacityMap`. Each component is between 0 and 1. */ opacityMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `opacityMap`. */ opacityMapTiling: number[]; /** * Opacity map UV channel. */ opacityMapUv: number; /** * Use vertex colors for opacity instead of a map. */ opacityMapVertexColor: boolean; /** * A factor to determine what portion of light is reflected from the material. */ reflectivity: number; /** * A factor to determine what portion of light passes through the material. */ refraction: number; /** * Determines the amount of distortion of light passing through the material. */ refractionIndex: number; /** * A value determining the smoothness of a surface. For smaller shininess values, a surface is rougher and specular highlights will be broader. * For larger shininess values, a surface is smoother and will exhibit more concentrated specular highlights. */ shininess: number; /** * An array of 3 numbers representing the specular color of the material if no specular map is set or tint is checked. */ specular: number[]; /** * Enables Toksvig AA for mipmapped normal maps with specular. */ specularAntialias: boolean; /** * The asset id of the specular map that specifies the per-pixel specular color. If no specular map is set, the specular color is used instead. */ specularMap: number; /** * A specular map color channel to extract color value from texture. Can be: r, g, b, a, rgb. */ specularMapChannel: string; /** * Array of 2 numbers controlling the 2D offset of the `specularMap`. Each component is between 0 and 1. */ specularMapOffset: number[]; /** * Array of 2 numbers controlling the 2D tiling of the `specularMap`. */ specularMapTiling: number[]; /** * Check this to modulate the material's specular map with a material specific specular color. */ specularMapTint: boolean; /** * Specular map UV channel. */ specularMapUv: number; /** * Use vertex colors for specular instead of a map. */ specularMapVertexColor: boolean; /** * The asset id of a sphere map texture asset that approximates environment reflection. */ sphereMap: number; /** * Apply fogging (as configured in scene settings). */ useFog: boolean; /** * Apply gamma correction and tonemapping (as configured in scene settings). */ useGammaTonemap: boolean; /** * Apply lighting. */ useLighting: boolean; /** * Toggle between specular and metalness workflow. */ useMetalness: boolean; /** * Apply scene skybox as prefiltered environment map. */ useSkybox: boolean; } /** * Represents the data for a Model asset. */ type ModelAssetData = { /** * Defines the material mapping for each mesh instance. */ mapping: Array<{ /** * The material mapping object for a mesh instance. */ [key: string]: any; }>; }; /** * Represents the data for a Render asset. */ type RenderAssetData = { /** * The asset `id` of the container asset. */ containerAsset: number; /** * The index of the render asset inside its container asset. */ renderIndex: number; }; /** * Represents the data for a Script asset. */ type ScriptAssetData = { /** * Whether this is a script that defines a custom loading screen. */ loading: boolean; /** * This allows you to control when this script will be loaded. * The possible values are: 0 (load as a regular Asset), 1 (load before the PlayCanvas engine is loaded), 2 (load right after the PlayCanvas engine has loaded). */ loadingType: number; /** * Contains all the script data. */ scripts: { [key: string]: { /** * Contains the script attribute definitions. */ attributes: { [key: string]: { /** * Whether this attribute is an array. */ array: boolean; /** * The asset type. Can be various types like animation, audio, material, etc. */ assetType: string; /** * Defines a color curve. */ color: string; /** * The names of the curves. */ curves: string[]; /** * The default value for the attribute. */ default: any; /** * The description of the attribute. */ description: string; /** * Defines an enumeration of values. */ enum: { /** * Options for the enum. */ options: { [key: string]: any; }; /** * The order of the enumerated values. */ order: string[]; }; /** * The maximum value. */ max: number; /** * The minimum value. */ min: number; /** * The placeholder string for the attribute. */ placeholder: any; /** * The precision of the numeric input. */ precision: number; /** * The schema for the json attribute. */ schema: { [key: string]: any; }[]; /** * The step for the numeric input. */ step: number; /** * The title to display for the attribute in the Editor. */ title: string; /** * The type of the script attribute. Can be: asset, boolean, curve, entity, json, number, rgb, rgba, string, vec2, vec3, vec4. */ type: string; }; }; /** * An array that controls the order of the scripts in the script asset. */ attributesOrder: string[]; }; }; }; /** * Represents the data for a Sprite asset. */ type SpriteAssetData = { /** * The number of pixels that represent one PlayCanvas unit. You can use this value to change the rendered size of your sprites. */ pixelsPerUnit: number; /** * The render mode of the asset. Can be: `pc.SPRITE_RENDERMODE_SIMPLE`, `pc.SPRITE_RENDERMODE_SLICED`, `pc.SPRITE_RENDERMODE_TILED`. */ renderMode: number; /** * The asset `id` of the texture atlas asset that contains all the frames that this asset is referencing. */ textureAtlasAsset: number; }; /** * Represents the data for a Texture asset. */ type TextureAssetData = { /** * The addressing mode to be applied to the texture in the U direction. * Can be: repeat, clamp, mirror. */ addressu: string; /** * The addressing mode to be applied to the texture in the V direction. * Can be: repeat, clamp, mirror. */ addressv: string; /** * Integer value specifying the level of anisotropic to apply to the texture ranging from 1 (no anisotropic filtering) to the `pc.GraphicsDevice` property `maxAnisotropy`. */ anisotropy: number; /** * The magnification filter to be applied to the texture. * Can be: nearest, linear, nearest_mip_nearest, linear_mip_nearest, nearest_mip_linear, linear_mip_linear. */ magfilter: string; /** * The minification filter to be applied to the texture. * Can be: nearest, linear, nearest_mip_nearest, linear_mip_nearest, nearest_mip_linear, linear_mip_linear. */ minfilter: string; /** * Whether the texture has mipmaps. */ mipmaps: boolean; /** * Whether the texture is RGBM. The RGBM format is a format to store high dynamic range (HDR) textures by using the alpha channel to store a multiplier for the rgb channels. */ rgbm: boolean; }; /** * Represents the data for a TextureAtlas asset. */ type TextureAtlasAssetData = { /** * The addressing mode to be applied to the texture in the U direction. * Can be: repeat, clamp, mirror. */ addressu: string; /** * The addressing mode to be applied to the texture in the V direction. * Can be: repeat, clamp, mirror. */ addressv: string; /** * Integer value specifying the level of anisotropic to apply to the texture ranging from 1 (no anisotropic filtering) to the `pc.GraphicsDevice` property `maxAnisotropy`. */ anisotropy: number; /** * The definitions of the frames that can be referenced by sprite assets. */ frames: { [key: string]: { /** * Array of 4 numbers controlling the frame border. */ border: number[]; /** * The frame name. */ name: string; /** * Array of 2 numbers controlling the frame pivot. */ pivot: number[]; /** * Array of 4 numbers controlling the frame dimensions. */ rect: number[]; }; }; /** * The magnification filter to be applied to the texture. * Can be: nearest, linear, nearest_mip_nearest, linear_mip_nearest, nearest_mip_linear, linear_mip_linear. */ magfilter: string; /** * The minification filter to be applied to the texture. * Can be: nearest, linear, nearest_mip_nearest, linear_mip_nearest, nearest_mip_linear, linear_mip_linear. */ minfilter: string; /** * Whether the texture has mipmaps. */ mipmaps: boolean; /** * Whether the texture is RGBM. The RGBM format is a format to store high dynamic range (HDR) textures by using the alpha channel to store a multiplier for the rgb channels. */ rgbm: boolean; }; /** * Represents the data for a Wasm asset. */ type WasmAssetData = { /** * The asset `id` of the fallback script asset to be used if wasm modules are not supported. */ fallbackScriptId?: number; /** * The asset `id` of the script asset with the JavaScript glue code that implements the JavaScript interface to the wasm functions. */ glueScriptId?: number; /** * The name of the module library defined in the wasm module. */ moduleName: string; }; /** * Represents an Entity. * * What follows is a reference for all possible asset paths that can be passed to functions such as {@link Entity#get} and {@link Entity#set}. * * Common Entity Properties: */ type EntityProps = { /** * An array that contains the `resource_id`'s of the entity's children. * @default [] */ children: string[]; /** * Whether the entity is enabled. * @default true */ enabled: boolean; /** * The name of the entity. */ name: string; /** * The `resource_id` of the parent entity. */ parent: string; /** * The position of the entity in local space (x, y, z). * @default [0,0,0] */ position: number[]; /** * The unique GUID of the entity. */ resource_id: string; /** * The rotation of the entity in local space (rx, ry, rz euler angles in degrees). * @default [0,0,0] */ rotation: number[]; /** * The scale of the entity in local space (sx, sy, sz). * @default [1,1,1] */ scale: number[]; /** * The tags of the entity. * @default [] */ tags: string[]; /** * A dictionary of <`resource_id`, `resource_id`> pairs that maps the entity (and its children) to the respective Entities in the template asset. */ template_ent_ids: Record; /** * The `id` of the Template asset that this entity is linked to. */ template_id: number; /** * A dictionary that contains the components of the entity and their data. */ components: Components; }; /** * Components of an Entity. */ type Components = { 'anim'? : AnimComponent; 'animation'? : AnimationComponent; 'audiolistener'? : AudioListenerComponent; 'button'? : ButtonComponent; 'camera'? : CameraComponent; 'collision'? : CollisionComponent; 'element'? : ElementComponent; 'layoutchild'? : LayoutChildComponent; 'layoutgroup'? : LayoutGroupComponent; 'light'? : LightComponent; 'model'? : ModelComponent; 'particlesystem'? : ParticleSystemComponent; 'render'? : RenderComponent; 'rigidbody'? : RigidBodyComponent; 'screen'? : ScreenComponent; 'script'? : ScriptComponent; 'scrollbar'? : ScrollbarComponent; 'scrollview'? : ScrollviewComponent; 'sound'? : SoundComponent; 'sprite'? : SpriteComponent; }; /** * Anim Component Properties. */ type AnimComponent = { /** * If true, the component will start playing the anim state graph on load. * @default true */ activate: boolean; /** * A dictionary that holds the animation assets used by this component. * Each key is a string representing a path to a state. * @default {} */ animationAssets: { [key: string]: { /** * The `id` of the animation asset. * @default null */ asset: number; }; }; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * The layer masks associated with this component. * @default {} */ masks: { [key: string]: { /** * A set of paths to bones in the current model that should be animated by the layer. * @default {} */ mask: { [key: string]: { /** * Whether the children of this bone should also be included in the mask. */ children: boolean; /** * Whether this bone should also be included in the mask. */ value: boolean; }; }; }; }; /** * The `resource_id` of the entity that this anim component should use as the root of the animation hierarchy. * @default null */ rootBone: string; /** * A multiplier for animation playback speed. 0 will freeze animation playback, and 1 represents the normal playback speed. * @default 1 */ speed: number; }; /** * Animation Component Properties. */ type AnimationComponent = { /** * If true, the component will start playing the animation on load. * @default true */ activate: boolean; /** * An array of Animation asset `id`s. * @default [] */ assets: number[]; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * If true, the animation will continue to loop back to the start on completion. Otherwise, it will stop on its final frame. * @default true */ loop: boolean; /** * A multiplier for animation playback speed. 0 will freeze animation playback, and 1 is the normal playback speed. * @default 1 */ speed: number; }; /** * AudioListener Component Properties. */ type AudioListenerComponent = { /** * Whether the component is enabled. * @default true */ enabled: boolean; }; /** * Button Component Properties. */ type ButtonComponent = { /** * If false, the button will be visible but will not respond to hover or touch interactions. * @default true */ active: boolean; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * Duration to be used when fading between tints, in milliseconds. * @default 0 */ fadeDuration: number; /** * An array of 4 numbers controlling the padding to be used in hit-test calculations. * @default [0,0,0,0] */ hitPadding: number[]; /** * The `id` of the sprite asset to be used as the button image when the user hovers over it. * @default null */ hoverSpriteAsset: number; /** * Frame to be used from the hover sprite. * @default 0 */ hoverSpriteFrame: number; /** * Array of 4 numbers controlling the color to be used on the button image when the user hovers over it. * @default [1,1,1,1] */ hoverTint: number[]; /** * The `resource_id` of the entity to be used as the button background. Must have an element component of type `image`. * @default null */ imageEntity: string; /** * The `id` of the sprite asset to be used as the button image when the button is not interactive. * @default null */ inactiveSpriteAsset: number; /** * Frame to be used from the inactive sprite. * @default 0 */ inactiveSpriteFrame: number; /** * Array of 4 numbers controlling the color to be used on the button image when the button is not interactive. * @default [1,1,1,1] */ inactiveTint: number[]; /** * The `id` of the sprite asset to be used as the button image when the user presses it. * @default null */ pressedSpriteAsset: number; /** * Frame to be used from the pressed sprite. * @default 0 */ pressedSpriteFrame: number; /** * Array of 4 numbers controlling the color to be used on the button image when the user presses it. * @default [1,1,1,1] */ pressedTint: number[]; /** * Controls how the button responds when the user hovers over it/presses it. * @default 0 */ transitionMode: number; }; /** * Camera Component Properties. */ type CameraComponent = { /** * The color used to clear the camera's render target. * @default [0.118,0.118,0.118,1] */ clearColor: number[]; /** * If true, the camera will explicitly clear its render target to the chosen clear color before rendering the scene. * @default true */ clearColorBuffer: boolean; /** * If true, the camera will explicitly clear the depth buffer of its render target before rendering the scene. * @default true */ clearDepthBuffer: boolean; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * The distance in camera space from the camera's eye point to the far plane. * @default 1000 */ farClip: number; /** * The angle (in degrees) between top and bottom clip planes of a perspective camera. * @default 45 */ fov: number; /** * Controls the culling of mesh instances against the camera frustum. If true, culling is enabled. If false, all mesh instances are rendered. * @default true */ frustumCulling: boolean; /** * An array of layer id's that this camera will render. * @default [0,1,2,3,4] */ layers: number[]; /** * The distance in camera space from the camera's eye point to the near plane. * @default 0.1 */ nearClip: number; /** * The distance in world units between the top and bottom clip planes of an orthographic camera. * @default 4 */ orthoHeight: number; /** * A number that defines the order in which camera views are rendered by the engine. Smaller numbers are rendered first. * @default 0 */ priority: number; /** * The projection type of the camera. Can be `pc.PROJECTION_PERSPECTIVE` or `pc.PROJECTION_ORTHOGRAPHIC`. * @default 0 */ projection: number; /** * An array that represents the viewport onto the camera's attached render target defined by normalized coordinates. * @default [0,0,1,1] */ rect: number[]; }; /** * Collision Component Properties. */ type CollisionComponent = { /** * The `id` of the model asset that will be used as a source for the triangle-based collision mesh. * @default null */ asset: number; /** * Aligns the capsule/cylinder with the local-space X, Y or Z axis of the entity. * @default 1 */ axis: number; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * The half-extents of the collision box: local space half-width, half-height, and half-depth. * @default [0.5,0.5,0.5] */ halfExtents: number[]; /** * The tip-to-tip height of the capsule/cylinder. * @default 2 */ height: number; /** * The radius of the capsule/cylinder body. * @default 0.5 */ radius: number; /** * The `id` of the render asset that will be used as a source for the triangle-based collision mesh. * @default null */ renderAsset: number; /** * The type of collision primitive. Can be: box, sphere, capsule, cylinder, mesh. * @default "box" */ type: string; }; /** * Element Component Properties. */ type ElementComponent = { /** * An array of 2 numbers controlling the horizontal and vertical alignment of the text relative to its element transform. * @default [0.5,0.5] */ alignment: number[]; /** * An array of 4 numbers controlling the left, bottom, right and top anchors of the element. * @default [0.5,0.5,0.5,0.5] */ anchor: number[]; /** * If true then the font size of the element will scale automatically so that it fits the element's height. * @default false */ autoFitHeight: boolean; /** * If true then the font size and the line height of the element will scale automatically so that it fits the element's width. * @default false */ autoFitWidth: boolean; /** * Make the height of the element match the height of the text content automatically. * @default false */ autoHeight: boolean; /** * Make the width of the element match the width of the text content automatically. * @default false */ autoWidth: boolean; /** * The batch group id that this element belongs to. * @default null */ batchGroupId: number; /** * An array of 3 numbers controlling the color of the element. * @default [1,1,1] */ color: number[]; /** * Flag for enabling markup processing. Only works for text types. * @default false */ enableMarkup: boolean; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * The `id` of the font asset used by the element. * @default null */ fontAsset: number; /** * The size of the font used by the element. * @default 32 */ fontSize: number; /** * The height of the element. * @default 32 */ height: number; /** * The localization key of the element. * @default null */ key: string; /** * An array of layer id's that this element belongs to. * @default [4] */ layers: number[]; /** * The height of each line of text. * @default 32 */ lineHeight: number; /** * An array of 4 numbers controlling the spacing between each edge of the element and the respective anchor. * @default [-16,-16,-16,-16] */ margin: number[]; /** * Switch image element into a mask. * @default false */ mask: boolean; /** * The `id` of the material asset used by this element. * @default null */ materialAsset: number; /** * The maximum size of the font that the element can scale to when using `autoFitWidth` or `autoFitHeight`. * @default 32 */ maxFontSize: number; /** * The maximum number of lines that this element can display. * @default null */ maxLines: number; /** * The minimum size of the font that the element can scale to when using `autoFitWidth` or `autoFitHeight`. * @default 8 */ minFontSize: number; /** * The opacity of the element. * @default 1 */ opacity: number; /** * An array of 4 numbers controlling the text outline effect color and opacity. * @default [0,0,0,1] */ outlineColor: number[]; /** * The text outline effect width. Ranges from 0 to 1. To disable outline effect set to 0. * @default 0 */ outlineThickness: number; /** * An array of 2 numbers controlling the origin of the element. * @default [0.5,0.5] */ pivot: number[]; /** * The number of pixels that correspond to one PlayCanvas unit. * @default null */ pixelsPerUnit: number; /** * An array of 4 numbers controlling the u, v, width and height of the rectangle that represents the portion of the texture that this image maps to. * @default [0,0,1,1] */ rect: number[]; /** * An array of 4 numbers controlling the text shadow cast effect color and opacity. * @default [0,0,0,1] */ shadowColor: number[]; /** * An array of 2 numbers controlling the horizontal and vertical shift of the text shadow cast effect. * @default [0,0] */ shadowOffset: number[]; /** * The spacing between each letter of the text. * @default 1 */ spacing: number; /** * The `id` of the sprite asset to be used by the element. * @default null */ spriteAsset: number; /** * The frame from the sprite asset to render. * @default 0 */ spriteFrame: number; /** * The text content of the element. * @default "" */ text: string; /** * The `id` of the texture asset to be used by the element. * @default null */ textureAsset: number; /** * The type of the element. Can be: `pc.ELEMENTTYPE_GROUP`, `pc.ELEMENTTYPE_IMAGE`, `pc.ELEMENTTYPE_TEXT`. * @default "text" */ type: string; /** * Enable this if you want the element to receive input events. * @default false */ useInput: boolean; /** * The width of the element. * @default 32 */ width: number; /** * Whether to automatically wrap lines based on the element width. * @default true */ wrapLines: boolean; }; /** * LayoutChild Component Properties. */ type LayoutChildComponent = { /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * When enabled, the child will be excluded from all layout calculations. * @default false */ excludeFromLayout: boolean; /** * The amount of additional vertical space that the element should take up, if necessary to satisfy a Stretch/Shrink fitting calculation. * @default 0 */ fitHeightProportion: number; /** * The amount of additional horizontal space that the element should take up, if necessary to satisfy a Stretch/Shrink fitting calculation. * @default 0 */ fitWidthProportion: number; /** * The maximum height the element should be rendered at. * @default null */ maxHeight: number | null; /** * The maximum width the element should be rendered at. * @default null */ maxWidth: number | null; /** * The minimum height the element should be rendered at. * @default 0 */ minHeight: number; /** * The minimum width the element should be rendered at. * @default 0 */ minWidth: number; }; /** * LayoutGroup Component Properties. */ type LayoutGroupComponent = { /** * An array of 2 numbers controlling the horizontal and vertical alignment of child elements. * @default [0,1] */ alignment: number[]; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * Fitting logic to be applied when positioning and scaling child elements. * @default 0 */ heightFitting: number; /** * Whether the layout should run horizontally or vertically. * @default 0 */ orientation: number; /** * An array of 4 numbers controlling the padding to be applied inside the container before positioning any children. * @default [0,0,0,0] */ padding: number[]; /** * Reverses the order of elements on the X axis. * @default false */ reverseX: boolean; /** * Reverses the order of elements on the Y axis. * @default true */ reverseY: boolean; /** * An array of 2 numbers controlling the spacing to be applied between each child element. * @default [0,0] */ spacing: number[]; /** * Fitting logic to be applied when positioning and scaling child elements. * @default 0 */ widthFitting: number; /** * Whether or not to wrap children onto a new row/column when the size of the container is exceeded. * @default false */ wrap: boolean; }; /** * Light Component Properties. */ type LightComponent = { /** * If true the light will affect non-lightmapped objects. * @default true */ affectDynamic: boolean; /** * If true the light will affect lightmapped objects. * @default false */ affectLightmapped: boolean; /** * If true the light will be rendered into lightmaps. * @default false */ bake: boolean; /** * If true and `bake` is true, the light's direction will contribute to directional lightmaps. * @default true */ bakeDir: boolean; /** * The distribution of subdivision of the camera frustum for individual shadow cascades. * @default 0.5 */ cascadeDistribution: number; /** * If true, the light will cause shadow casting models to cast shadows. * @default false */ castShadows: boolean; /** * An array of 3 numbers that represents the color of the emitted light. * @default [1,1,1] */ color: number[]; /** * The id of a projection texture asset. Must be 2D for spot and cubemap for omni (ignored if incorrect type is used). */ cookie: number; /** * Angle for spotlight cookie rotation. * @default 0 */ cookieAngle: number; /** * The id of a texture asset that represents that light cookie. * @default null */ cookieAsset: number; /** * Color channels of the projection texture to use. Can be "r", "g", "b", "a", "rgb" or any swizzled combination. * @default "rgb" */ cookieChannel: string; /** * Toggle normal spotlight falloff when projection texture is used. When set to false, spotlight will work like a pure texture projector (only fading with distance). * @default true */ cookieFalloff: boolean; /** * Projection texture intensity. * @default 1 */ cookieIntensity: number; /** * Spotlight cookie position offset. * @default [0,0] */ cookieOffset: number[]; /** * Spotlight cookie scale. * @default [1,1] */ cookieScale: number[]; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * Controls the rate at which a light attenuates from its position. * @default 0 */ falloffMode: number; /** * The angle at which the spotlight cone starts to fade off. The angle is specified in degrees. Affects spot lights only. * @default 40 */ innerConeAngle: number; /** * The intensity of the light, this acts as a scalar value for the light's color. This value can exceed 1. * @default 1 */ intensity: number; /** * Mark light as non-movable (optimization). * @default false */ isStatic: boolean; /** * An array of layer id's that this light will affect. * @default [0] */ layers: number[]; /** * Normal offset depth bias. * @default 0.05 */ normalOffsetBias: number; /** * Number of shadow cascades. * @default 1 */ numCascades: number; /** * The angle at which the spotlight cone has faded to nothing. The angle is specified in degrees. Affects spot lights only. * @default 45 */ outerConeAngle: number; /** * The distance from the spotlight source at which its contribution falls to zero. * @default 10 */ range: number; }; /** * Model Component Properties. */ type ModelComponent = { /** * An array of 3 numbers that represents the center of the AABB to be used. */ aabbCenter: number[]; /** * An array of 3 numbers that represents the half extents of the AABB to be used. */ aabbHalfExtents: number[]; /** * The `id` of the model asset rendered by this model component. * @default null */ asset: number; /** * The batch group id that this model belongs to. The engine will attempt to batch models in the same batch group. * @default null */ batchGroupId: number; /** * If true, the model rendered by this component will cast shadows onto other models in the scene. * @default true */ castShadows: boolean; /** * If true, this model will cast shadows when rendering lightmaps. * @default true */ castShadowsLightmap: boolean; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * Mark model as non-movable (optimization). * @default false */ isStatic: boolean; /** * An array of layer id's that this model belongs to. When a model belongs to multiple layers it will be rendered multiple times. * @default [0] */ layers: number[]; /** * Changing this value will affect resolution of lightmaps for this model. * @default 1 */ lightmapSizeMultiplier: number; /** * If true, this model will be lightmapped after using lightmapper.bake(). * @default false */ lightmapped: boolean; /** * A dictionary that maps a material asset to each mesh instance. Each key is the mesh instance index and each value is the asset `id`. */ mapping: Record; /** * The `id` of the material asset that will be used to render the model (only applies to primitives). * @default null */ materialAsset: number; /** * If true, the model rendered by this component will receive shadows cast by other models in the scene. * @default true */ receiveShadows: boolean; /** * The type of the model to be rendered. Can be: asset, box, capsule, cone, cylinder, sphere. * @default "asset" */ type: string; }; /** * ParticleSystem Component Properties. */ type ParticleSystemComponent = { /** * If true orient particles in their direction of motion. * @default false */ alignToMotion: boolean; /** * A curve defining how each particle's opacity changes over time. If `alphaGraph2` is specified, the opacity will be a random lerp between both curves. * @default {"type":1,"keys":[0,1],"betweenCurves":false} */ alphaGraph: object; /** * A curve defining how each particle's opacity changes over time. If specified, the opacity will be a random lerp between both curves. * @default {"type":1,"keys":[0,1]} */ alphaGraph2: object; /** * The animation from the sprite sheet to play for each particle in the system. * @default 0 */ animIndex: number; /** * If true then the sprite sheet animation will repeat indefinitely. * @default true */ animLoop: boolean; /** * Number of animations contained in the sprite sheet. * @default 1 */ animNumAnimations: number; /** * Number of sprite sheet frames in each animation. * @default 1 */ animNumFrames: number; /** * Sprite sheet animation speed. 1 = particle lifetime, 2 = twice during lifetime etc... * @default 1 */ animSpeed: number; /** * Sprite sheet frame in animation to begin animating from. * @default 0 */ animStartFrame: number; /** * Number of horizontal tiles in the sprite sheet. * @default 1 */ animTilesX: number; /** * Number of vertical tiles in the sprite sheet. * @default 1 */ animTilesY: number; /** * If true, the particle system will play immediately on creation. If false, you will need to call the particle system component's play function from script. * @default true */ autoPlay: boolean; /** * The blending mode determines how particles are composited when they are written to the frame buffer. * @default 2 */ blendType: number; /** * A curve defining how each particle's color changes over time. * @default {"type":4,"keys":[[0,1],[0,1],[0,1]],"betweenCurves":false} */ colorGraph: object; /** * The `id` of the color map texture asset to apply to all particles in the system. If no texture asset is assigned, a default spot texture is used. * @default null */ colorMapAsset: number; /** * This variable value determines how much particles fade out as they get closer to another surface. * @default 0 */ depthSoftening: number; /** * If true, the particles will write depth information to the depth buffer. * @default false */ depthWrite: boolean; /** * An array of 3 numbers that represents the half extents of a local space bounding box within which particles are spawned at random positions. * @default [0,0,0] */ emitterExtents: number[]; /** * The radius within which particles are spawned at random positions. * @default 0 */ emitterRadius: number; /** * Shape of the emitter. Can be: `pc.EMITTERSHAPE_BOX`, `pc.EMITTERSHAPE_SPHERE`. * @default 0 */ emitterShape: number; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * If true avoid particles looking too flat when lights appear to be shining towards the back sides of the particles. * @default false */ halfLambert: boolean; /** * Scales the color of particles to allow them to have arbitrary brightness. * @default 1 */ intensity: number; /** * An array of layer id's that this particle system belongs to. When a particle system belongs to multiple layers it will be rendered multiple times. * @default [0] */ layers: number[]; /** * If true, the particle will be lit by the directional and ambient light in the scene. * @default false */ lighting: boolean; /** * If true, the particle system will emit indefinitely. Otherwise, it will emit the number of particles specified by the `numParticles` property and then stop. * @default true */ loop: boolean; /** * The `id` of a model asset. The first mesh found in the model is used to represent all particles rather than a flat billboard. * @default null */ mesh: number; /** * The `id` of the normal map texture asset to apply to all particles in the system. * @default null */ normalMapAsset: number; /** * The maximum number of particles managed by this particle system. * @default 30 */ numParticles: number; /** * Orientation mode controls particle planes facing. * @default 0 */ orientation: number; /** * An array of 3 numbers that represents either world or emitter space vector to define particle plane orientation. * @default [0,1,0] */ particleNormal: number[]; /** * If true, the particle system will be initialized as though it had already completed a full cycle. * @default false */ preWarm: boolean; /** * A curve defining how particle's radial speed changes over time. Individual particle radial velocity points from emitter origin to particle current position. * @default {"type":1,"keys":[0,0],"betweenCurves":false} */ radialSpeedGraph: object; /** * A curve defining how each particle's angular velocity changes over time. * @default {"type":1,"keys":[0,0],"betweenCurves":false} */ rotationSpeedGraph: object; /** * A curve defining how each particle's scale changes over time. By default, a particle is 1 unit in width and height. * @default {"type":1,"keys":[0,0.1],"betweenCurves":false} */ scaleGraph: object; /** * Renders particles in 2D screen space. * @default false */ screenSpace: boolean; /** * Sorting mode gives you control over the order in which particles are rendered. * @default 0 */ sort: number; /** * The bounds of the initial particle rotation specified in degrees. * @default 0 */ startAngle: number; /** * A curve defining how each particle's velocity with respect to the world coordinate system changes over time. * @default {"type":1,"keys":[[0,-1],[0,-1],[0,-1]],"betweenCurves":true} */ velocityGraph: object; /** * Enables wrap bounds. * @default false */ wrap: boolean; /** * An array of 3 numbers that represents the world space AABB volume centered on the owner entity's position. * @default [0,0,0] */ wrapBounds: number[]; }; /** * Render Component Properties. */ type RenderComponent = { /** * An array of 3 numbers controlling the center of the AABB to be used. */ aabbCenter: number[]; /** * An array of 3 numbers controlling the half extents of the AABB to be used. */ aabbHalfExtents: number[]; /** * The `id` of the render asset for the render component (only applies to type "asset"). * @default null */ asset: number; /** * The batch group id that the meshes should belong to. * @default null */ batchGroupId: number; /** * If true, attached meshes will cast shadows for lights that have shadow casting enabled. * @default true */ castShadows: boolean; /** * If true, the meshes will cast shadows when rendering lightmaps. * @default true */ castShadowsLightmap: boolean; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * Mark meshes as non-movable (optimization). * @default false */ isStatic: boolean; /** * An array of layer id's to which the meshes should belong. * @default [0] */ layers: number[]; /** * Lightmap resolution multiplier. * @default 1 */ lightmapSizeMultiplier: number; /** * If true, the meshes will be lightmapped after using lightmapper.bake(). * @default false */ lightmapped: boolean; /** * An array of material asset `id`'s that will be used to render the meshes. Each material corresponds to the respective mesh instance. * @default [] */ materialAssets: number[]; /** * If true, shadows will be cast on attached meshes. * @default true */ receiveShadows: boolean; /** * The `resource_id` of the entity to be used as the root bone for any skinned meshes that are rendered by this component. * @default null */ rootBone: string; /** * The type of the render component. Can be: asset, box, capsule, cone, cylinder, plane, sphere. * @default "asset" */ type: string; }; /** * RigidBody Component Properties. */ type RigidBodyComponent = { /** * Controls the rate at which a body loses angular velocity over time. * @default 0 */ angularDamping: number; /** * An array of 3 numbers that represents the scaling factor for angular movement of the body in each axis. * @default [1,1,1] */ angularFactor: number[]; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * The friction value used when contacts occur between two bodies. * @default 0.5 */ friction: number; /** * Controls the rate at which a body loses linear velocity over time. * @default 0 */ linearDamping: number; /** * An array of 3 numbers that represents the scaling factor for linear movement of the body in each axis. * @default [1,1,1] */ linearFactor: number[]; /** * The mass of the body. * @default 1 */ mass: number; /** * The amount of energy lost when two objects collide, this determines the bounciness of the object. * @default 0.5 */ restitution: number; /** * The type of RigidBody determines how it is simulated. Can be one of: static, dynamic, kinematic. * @default "static" */ type: string; }; /** * Screen Component Properties. */ type ScreenComponent = { /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * An array of 2 numbers that represents the reference resolution of the screen. The screen adjusts its size based on `scaleMode`. * @default [1280,720] */ referenceResolution: number[]; /** * An array of 2 numbers that represents the resolution of the screen. * @default [1280,720] */ resolution: number[]; /** * Adjusts screen size changes relative to window size changes. 0 adjusts width only, 1 adjusts height only, values in between adjust both. * @default 0.5 */ scaleBlend: number; /** * Controls screen resizing with window size changes. Can be `pc.SCALEMODE_BLEND` for adjusting to window resolution or `pc.SCALEMODE_NONE`. * @default "blend" */ scaleMode: string; /** * If true, displays child Elements in 2D. Set false for a 3D screen. * @default true */ screenSpace: boolean; }; /** * Script Component Properties. */ type ScriptComponent = { /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * An array of script names in the order they should be executed at runtime. * @default [] */ order: string[]; /** * A dictionary containing all scripts attached to this component, indexed by script name. */ scripts: { [key: string]: { /** * A dictionary holding the values for each attribute, indexed by attribute name. */ attributes: { [key: string]: any; }; /** * Whether the individual script instance is enabled. */ enabled: boolean; }; }; }; /** * Scrollbar Component Properties. */ type ScrollbarComponent = { /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * The `resource_id` of the entity used as the scrollbar handle. Must have a scrollbar component. * @default null */ handleEntity: string; /** * The size of the handle relative to the track size, in the range 0...1. * @default 0.5 */ handleSize: number; /** * The scrollbar orientation: horizontal or vertical. * @default 0 */ orientation: number; /** * The current position value of the scrollbar, in the range 0...1. * @default 0 */ value: number; }; /** * Scrollview Component Properties. */ type ScrollviewComponent = { /** * Controls how far the content should move before bouncing back. * @default 0.1 */ bounceAmount: number; /** * The `resource_id` of the entity containing the scrolling content. Must have an element component. * @default null */ contentEntity: string; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * Controls how freely content moves if thrown, with 1 stopping immediately and 0 allowing perpetual movement. * @default 0.05 */ friction: number; /** * Whether to enable horizontal scrolling. * @default true */ horizontal: boolean; /** * The `resource_id` of the entity used as the horizontal scrollbar. Must have a scrollbar component. * @default null */ horizontalScrollbarEntity: string; /** * Controls visibility of the horizontal scrollbar. * @default 1 */ horizontalScrollbarVisibility: number; /** * Controls mouse wheel sensitivity for scrolling, with 0 disabling it. * @default [1,1] */ mouseWheelSensitivity: number[]; /** * How the scroll view behaves when scrolling past content end. * @default 1 */ scrollMode: number; /** * Whether to use the mouse wheel for scrolling within bounds. * @default true */ useMouseWheel: boolean; /** * Whether to enable vertical scrolling. * @default true */ vertical: boolean; /** * The `resource_id` of the entity used as the vertical scrollbar. Must have a scrollbar component. * @default null */ verticalScrollbarEntity: string; /** * Controls visibility of the vertical scrollbar. * @default 1 */ verticalScrollbarVisibility: number; /** * The `resource_id` of the entity used as the viewport area, within which content scrolls. Must have an element component of type `group`. * @default null */ viewportEntity: string; }; /** * Sound Component Properties. */ type SoundComponent = { /** * Algorithm to use for audio volume falloff. Can be: "inverse", "linear", "exponential". * @default "linear" */ distanceModel: string; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * Maximum distance at which audio falloff stops. * @default 10000 */ maxDistance: number; /** * The pitch for audio playback. Multiplied with slot pitch values. * @default 1 */ pitch: number; /** * If true, audio is played as 3D sound. * @default true */ positional: boolean; /** * Reference distance for reducing audio volume. * @default 1 */ refDistance: number; /** * Rate at which the audio volume falls off. * @default 1 */ rollOffFactor: number; /** * Dictionary of sound slots, each controlling playback of an audio asset. */ slots: { [key: string]: { /** * The `id` of the audio asset in this sound slot. */ asset: number; /** * If true, this sound slot plays on load. */ autoPlay: boolean; /** * Duration of the sound to play from this slot. */ duration: number; /** * If true, sound slot loops playback. */ loop: boolean; /** * Name of the sound slot. */ name: string; /** * If true, sounds from this slot overlap each other. */ overlap: boolean; /** * Pitch for playback of this sound slot. */ pitch: number; /** * Start time for playing the sound. */ startTime: number; /** * Volume modifier for this sound slot. */ volume: number; }; }; /** * Overall volume modifier for the component. * @default 1 */ volume: number; }; /** * Sprite Component Properties. */ type SpriteComponent = { /** * The `name` of the sprite animation clip to play automatically when the component is enabled. * @default null */ autoPlayClip: string; /** * The batch group id that this sprite belongs to. * @default null */ batchGroupId: number; /** * A dictionary containing data for all sprite animation clips. Each key is the index of the clip. */ clips: { [key: string]: { /** * If true, automatically start playing this animation clip when loaded. */ autoPlay: boolean; /** * The frames per second for this animation clip. */ fps: number; /** * If true, the animation clip will loop. */ loop: boolean; /** * The unique name of the animation clip for this sprite component. */ name: string; /** * The `id` of the sprite asset containing all frames for this animation clip. */ spriteAsset: number; }; }; /** * The color tint of the sprite, represented as an array of 3 numbers. * @default [1,1,1] */ color: number[]; /** * The draw order of the sprite; higher values are rendered on top of others. * @default 0 */ drawOrder: number; /** * Whether the component is enabled. * @default true */ enabled: boolean; /** * If true, flips the sprite on the X axis. * @default false */ flipX: boolean; /** * If true, flips the sprite on the Y axis. * @default false */ flipY: boolean; /** * The frame of the sprite asset to render. * @default 0 */ frame: number; /** * The height of the sprite for 9-slicing rendering. * @default 1 */ height: number; /** * The layers this sprite belongs to. * @default [0] */ layers: number[]; /** * The opacity of the sprite. * @default 1 */ opacity: number; /** * Global speed modifier for sprite animation clips. * @default 1 */ speed: number; /** * The `id` of the sprite asset used by the component. * @default null */ spriteAsset: number; /** * The type of sprite component. Can be `pc.SPRITETYPE_SIMPLE` or `pc.SPRITETYPE_ANIMATED`. * @default "simple" */ type: string; /** * The width of the sprite for 9-slicing rendering. * @default 1 */ width: number; }; /** * Represents the settings for the currently loaded scene. */ type SceneSettingsProps = { /** * Physics related settings for the scene. */ physics?: { /** * An array of 3 numbers that represents the gravity force. */ gravity?: [number, number, number]; }; /** * Render settings for the scene. */ render?: { /** * The exposure value tweaks the overall brightness of the scene. */ exposure?: number; /** * The type of fog used in the scene. Can be one of `pc.FOG_NONE`, `pc.FOG_LINEAR`, `pc.FOG_EXP`, `pc.FOG_EXP2`. */ fog?: number; /** * An array of 3 numbers representing the color of the fog. */ fog_color?: [number, number, number]; /** * The density of the fog. This property is only valid if the fog property is set to `pc.FOG_EXP` or `pc.FOG_EXP2`. */ fog_density?: number; /** * The distance from the viewpoint where linear fog reaches its maximum. This property is only valid if the fog property is set to `pc.FOG_LINEAR`. */ fog_end?: number; /** * The distance from the viewpoint where linear fog begins. This property is only valid if the fog property is set to `pc.FOG_LINEAR`. */ fog_start?: number; /** * The gamma correction to apply when rendering the scene. Can be one of `pc.GAMMA_NONE`, `pc.GAMMA_SRGB`. */ gamma_correction?: number; /** * An array of 3 numbers representing the color of the scene's ambient light. */ global_ambient?: [number, number, number]; /** * The maximum lightmap resolution. */ lightmapMaxResolution?: number; /** * The lightmap baking mode. Can be one of `pc.BAKE_COLOR`, `pc.BAKE_COLORDIR`. */ lightmapMode?: number; /** * The lightmap resolution multiplier. */ lightmapSizeMultiplier?: number; /** * The `id` of the cubemap texture to be used as the scene's skybox. */ skybox?: number; /** * Multiplier for skybox intensity. */ skyboxIntensity?: number; /** * The mip level of the skybox to be displayed. Only valid for prefiltered cubemap skyboxes. */ skyboxMip?: number; /** * An array of 3 numbers representing the rotation of the skybox. */ skyboxRotation?: [number, number, number]; /** * The tonemapping transform to apply when writing fragments to the frame buffer. Can be: `pc.TONEMAP_LINEAR`, `pc.TONEMAP_FILMIC`, `pc.TONEMAP_HEJL`, `pc.TONEMAP_ACES`. */ tonemapping?: number; }; }; /** * Represents an observer for an entity, extending the base Observer. */ type EntityObserver = Observer & { /** * The API entity associated with this observer. */ apiEntity: Entity; /** * The history of changes made to the observer. */ history: ObserverHistory; /** * A function that returns the latest observer. */ latestFn: () => Observer; /** * The Engine entity associated with this observer. */ entity: any; }; /** * The Entity class represents an entity in the Editor. */ declare class Entity extends Events { private _observer; private _history; /** * Creates new Entity * * @category Internal * @param data - Optional entity data */ constructor(data?: any); _initializeHistory(): void; /** * Checks if path exists. See {@link Entity} for a list of properties. * * @param path - The path * @returns True if path exists * @example * ```javascript * console.log(entity.has('components.model')); * ``` */ has(path: string): boolean; /** * Gets value at path. See {@link Entity} for a list of properties. * * @param path - The path * @returns The value * @example * ```javascript * console.log(entity.get('position')); * ``` */ get(path: string): any; /** * Sets value at path. See {@link Entity} for a list of properties. * * @param path - The path * @param value - The value * @returns Whether the value was set * @example * ```javascript * entity.set('position', [1, 0, 0]); * ``` */ set(path: string, value: any): boolean; /** * Unsets value at path. See {@link Entity} for a list of properties. * * @param path - The path * @returns Whether the value was unset * @example * ```javascript * entity.unset('components.model'); * ``` */ unset(path: string): boolean; /** * Inserts value in array at path, at specified index. See {@link Entity} for a list of properties. * * @param path - The path * @param value - The value * @param index - The index (if undefined the value will be inserted in the end) * @returns Whether the value was inserted * @example * ```javascript * entity.insert('tags', 'a_tag'); * ``` */ insert(path: string, value: any, index?: number): boolean; /** * Remove value from array at path. See {@link Entity} for a list of properties. * * @param path - The path * @param value - The value * @returns Whether the value was removed * @example * ```javascript * entity.removeValue('tags', 'a_tag'); * ``` */ removeValue(path: string, value: any): boolean; /** * Returns JSON representation of entity data * * @returns - The data * ```javascript * console.log(entity.json()); * ``` */ json(): Record; /** * Returns a JSON representation of entity data. The children array * of the entity gets recursively converted to an array of entity data * instead of containing children resource ids. * * @returns - The data * @example * ```javascript * const data = entity.jsonHierarchy(); * console.log(data.children[0].name); * ``` */ jsonHierarchy(): any; /** * Returns true if this entity is a descendant of the specified parent entity. * * @param parent - The parent * @returns True if it is */ isDescendantOf(parent: Entity): boolean; /** * Finds first entity by name using depth-first search * * @param name - The name * @returns The entity * @example * ```javascript * const door = editor.entities.root.findByName('Door'); * ``` */ findByName(name: string): Entity | null; /** * Finds all entities with specified tags * * @param tags - The tags. If multiple tags are specified then entities that contain ANY of the specified * tags will be included. If an argument is an array of tags then entities that contain ALL of the tags in the array will be included. * @returns The entities * @example * ```javascript * // entities that have the following tag * const entities = editor.entities.root.listByTag('tag'); * // entities that have any of the following tags * const entities = editor.entities.root.listByTag('tag', 'tag2'); * // entities that have all of the following tags * const entities = editor.entities.root.listByTag(['tag', 'tag2']); * ``` */ listByTag(...tags: any[]): Entity[]; /** * Returns the entity and children that satisfy the function * * @param fn - A function that takes an Entity and returns whether it should be included * in the result * @returns The result * @example * ```javascript * const doors = editor.entities.root.filter(entity => entity.get('name').startsWith('door')); * ``` */ filter(fn: (entity: Entity) => boolean): Entity[]; /** * Executes function for this entity and its children in depth first order. * * @param fn - A function that takes an entity as an argument * @example * ```javascript * // get a list of all entities in the graph in depth first order * const entities = []; * editor.entities.root.depthFirst(entity => entities.push(entity)); * ``` */ depthFirst(fn: (entity: Entity) => void): void; /** * Adds a component to this Entity * * @param component - The component name * @param data - Default component data. Defaults values will be used for any missing fields. * For details on component properties see {@link Entity}. * @example * ```javascript * editor.entities.root.addComponent('model', { * type: 'box' * }); * ``` */ addComponent(component: string, data?: {}): void; /** * Removes a component from this Entity * * @param component - The component name * @example * ```javascript * editor.entities.root.removeComponent('model'); * ``` */ removeComponent(component: string): void; /** * Adds entity as a child * * @category Internal * @param entity - The entity * @returns Whether the child was added */ addChild(entity: Entity): boolean; /** * Inserts entity as a child at specified index. * * @category Internal * @param entity - The entity * @param index - The index. If undefined the child will be added in the end. * @returns Whether the child was added */ insertChild(entity: Entity, index?: number | undefined): boolean; /** * Removes entity from children * * @category Internal * @param entity - The entity */ removeChild(entity: Entity): void; /** * Deletes entity (and its children) * * @param options.history - Whether to record a history action. Defaults to true. * @returns A promise * @example * ```javascript * editor.entities.root.findByName('door').delete(); * ``` * */ delete(options?: { history?: boolean; }): Promise; /** * Reparents entity under new parent * * @param parent - The new parent * @param index - The desired index. If undefined the entity will be added at the end of the parent's children. * @param options.history - Whether to record a history action. Defaults to true. * @param options.preserveTransform - Whether to preserve the original transform after reparenting * @example * ```javascript * const redHouse = editor.entities.root.findByName('red house'); * const greenHouse = editor.entities.root.findByName('green house'); * const door = redHouse.findByName('door'); * door.reparent(greenHouse); * ``` */ reparent(parent: Entity, index?: number | null, options?: { history?: boolean; preserveTransform?: boolean; }): void; /** * Duplicates entity under the same parent * * @param options.history - Whether to record a history action. Defaults to true. * @param options.select - Whether to select the new entity. Defaults to false. * @param options.rename - Whether to rename the duplicated entity. Defaults to false. * @returns The new entity */ duplicate(options?: { history?: boolean; select?: boolean; rename?: boolean; }): Promise; /** * Returns the latest version of the Entity from the Entities API. * * @returns The entity */ latest(): Entity; /** * Adds a script to the script component of this entity. * If a script component does not exist, this method will add the script * component as well. * * @param scriptName - The name of the script. * @param options.attributes - The values of attributes. Each key is the name * of the attributes and each value is the value for that attribute. Leave undefined to * let the Editor set default values depending on the attribute types. * @param options.history - Whether to add a history action. Defaults to true. * @param options.index - The desired index in the entity's scripts order to add this script. * @returns A promise */ addScript(scriptName: string, options?: { attributes?: object; history?: boolean; index?: number; }): Promise; /** * Removes a script from the entity's script component. * * @param scriptName - The name of the script. * @param options.history - Whether to record a history action. Defaults to true. */ removeScript(scriptName: string, options?: { history?: boolean; }): void; /** * The observer object for this entity. */ get observer(): EntityObserver; /** * The parent entity. */ get parent(): Entity; /** * The children entities. Warning: this creates a new array every time it's called. */ get children(): Entity[]; /** * The history object for this entity. */ get history(): ObserverHistory; /** * The entity in the 3D viewport of the Editor. */ get viewportEntity(): any; } /** * Represents an observer for an asset, extending the base Observer. */ type AssetObserver = Observer & { /** * The API asset associated with this observer. */ apiAsset: Asset; /** * The history of changes made to the observer. */ history: ObserverHistory; }; /** * The Asset class represents an asset in Editor. */ declare class Asset extends Events { private _observer; private _suspendOnSet; private _history; /** * Constructor * * @param data - The asset data */ constructor(data?: any); initializeHistory(): void; private _resetThumbnailUrls; private _onSet; /** * Checks if path exists. See the {@link Asset} overview for a full list of properties. * * @param path - The path * @returns True if path exists */ has(path: string): boolean; /** * Gets value at path. See the {@link Asset} overview for a full list of properties. * * @param path - The path * @returns The value */ get(path: string): any; /** * Sets value at path. See the {@link Asset} overview for a full list of properties. * * @param path - The path * @param value - The value * @returns Whether the value was set */ set(path: string, value: any): boolean; /** * Unsets value at path. See the {@link Asset} overview for a full list of properties. * * @param path - The path * @returns Whether the value was unset */ unset(path: string): boolean; /** * Inserts value in array at path, at specified index. See the {@link Asset} overview for a * full list of properties. * * @param path - The path * @param value - The value * @param index - The index (if undefined the value will be inserted in the end) * @returns Whether the value was inserted */ insert(path: any, value: any, index: any): boolean; /** * Remove value from array at path. See the {@link Asset} overview for a full list of properties. * * @param path - The path * @param value - The value * @returns Whether the value was removed */ removeValue(path: any, value: any): boolean; /** * Returns JSON representation of entity data * * @returns - The data */ json(): Record; /** * Returns the latest version of the Asset from the Assets API. * * @returns The asset */ latest(): Asset; /** * Loads asset from the server without subscribing to realtime changes. */ load(): Promise; /** * Loads the asset's data from sharedb and subscribes to changes. */ loadAndSubscribe(): Promise; /** * Deletes this asset. */ delete(): Promise; /** * Creates an instance of this template asset. Assumes this asset is a template asset. * * @param parent - The parent entity * @param options.index - The desired index under the parent to instantiate the template. * @param options.history - Whether to record a history action. * @param options.select - Whether to select the new entity. * @param options.extraData - Extra data passed to the backend. Used by the Editor on specific cases. * @returns The new entity. */ instantiateTemplate(parent: Entity, options?: { index?: number; history?: boolean; select?: boolean; extraData?: object; }): Promise; /** * Replaces any references to this asset with references to the new asset specified. * * @param asset - The new asset. * @param options.history - Whether to record a history action. */ replace(asset: Asset, options?: { history?: boolean; }): void; /** * The observer object for this asset. */ get observer(): AssetObserver; /** * Gets observer history for this asset. */ get history(): ObserverHistory; /** * Gets the file URL for an asset file. * * @param id - The asset id * @param filename - The desired filename * @returns The file URL */ static getFileUrl(id: number, filename: string): string; } /** * Arguments passed when uploading an asset file. */ type AssetUploadArguments = { /** * The parent folder asset where the asset should be placed. */ folder?: Asset; /** * The id of the parent folder asset. */ folderId?: number; /** * The filename of the uploaded file. */ filename?: string; /** * The file being uploaded. */ file?: File | Blob; /** * The type of the asset we are uploading. See {@link Asset} for available asset types. */ type?: string; /** * The name of the asset. */ name?: string; /** * The tags of the asset. */ tags?: string[]; /** * The id of the source asset. */ sourceAssetId?: number; /** * The asset data. This depends on the asset type. See {@link Asset} for asset data depending on the type. */ data?: object; /** * Whether to preload the asset. Defaults to true. */ preload?: boolean; /** * If an asset id is specified then this asset will be updated instead of creating a new asset. */ id?: number; }; /** * Import settings used when uploading a texture asset. */ type TextureImportSettings = { /** * Whether to resize the texture to power of 2. */ pow2?: boolean; /** * Whether to search for target assets to update throughout the whole project instead of just the same folder. */ searchRelatedAssets?: boolean; }; /** * Import settings used when uploading a scene (fbx etc.). */ type SceneImportSettings = { /** * Whether to search for target assets to update throughout the whole project instead of just the same folder. Defaults to true. */ searchRelatedAssets?: boolean; /** * Whether to overwrite existing model or create a new one. Defaults to true. */ overwriteModel?: boolean; /** * Whether to overwrite existing animations or create new ones. Defaults to true. */ overwriteAnimation?: boolean; /** * Whether to overwrite existing materials or create new ones. Defaults to true. */ overwriteMaterial?: boolean; /** * Whether to overwrite existing textures or create new ones. Defaults to true. */ overwriteTexture?: boolean; /** * Whether to resize embedded textures to power of 2. Defaults to true. */ pow2?: boolean; /** * Whether to convert models to GLB. Defaults to true. */ useGlb?: boolean; /** * The desired animation sample rate. Defaults to 10. */ animSampleRate?: number; /** * The animation curve tolerance. Defaults to 0. */ animCurveTolerance?: number; /** * Whether to enable cubic curves. Defaults to false. */ animEnableCubic?: boolean; /** * Whether to use the fbx filename for animation names. Defaults to false. */ animUseFbxFilename?: boolean; }; /** * The Assets Editor API */ declare class Assets extends Events { private _uniqueIdToItemId; private _assets; private _parseScriptCallback; private _defaultUploadCompletedCallback; private _defaultUploadProgressCallback; private _defaultUploadErrorCallback; private _uploadId; private _autoSubscribe; /** * Constructor * * @param options.autoSubscribe - Whether to auto subscribe to asset changes when assets are loaded. */ constructor(options?: { autoSubscribe?: boolean; }); private _onMessengerAddAsset; private _onMessengerDeleteAsset; private _onMessengerDeleteAssets; /** * Gets asset by id * * @param id - The asset id * @returns The asset */ get(id: number): Asset | null; /** * Gets asset by its unique id * * @param uniqueId - The unique id * @returns The asset */ getUnique(uniqueId: number): Asset | null; /** * Returns array of all assets * * @returns The assets */ list(): Asset[]; /** * Finds all assets with specified tags * * @param tags - The tags. If multiple tags are specified then assets that contain ANY of the specified * tags will be included. If an argument is an array of tags then assets that contain ALL of the tags in the array will be included. * @returns The assets */ listByTag(...tags: any[]): any[]; /** * Adds asset to the list * * @category Internal * @param asset - The asset */ add(asset: Asset): void; /** * Removes asset from the list * * @category Internal * @param asset - The asset */ remove(asset: Asset): void; /** * Removes all assets from the list * * @category Internal */ clear(): void; /** * Gets assets that satisfy function * * @param fn - The function (takes an asset as an argument and returns boolean). * @returns The assets */ filter(fn: Function): any[]; /** * Finds first asset that satisfies function * * @param fn - A function that takes an asset as an argument and returns boolean. * @returns The asset */ findOne(fn: Function): any; /** * Loads all assets in the current project / branch. Does not * subscribe to realtime changes. * * @category Internal * @param options.view - The desired view for the REST API e.g 'designer', 'shader-editor'. This might limit * the assets returned to a smaller subset depending on the view. */ loadAll(options?: { view?: string; }): Promise; /** * Loads all assets in the current project / branch * and subscribes to changes. * * @param options.view - The desired view for the REST API e.g 'designer', 'shader-editor'. This might limit * the assets returned to a smaller subset depending on the view. * @category Internal */ loadAllAndSubscribe(options?: { view?: string; }): Promise; /** * Gets the first script asset that contains the specified script * * @param script - The script name * @returns The script asset */ getAssetForScript(script: string): any; /** * Creates new asset * * @param data - The asset fields * @param settings - Import settings * @param onProgress - Function to report progress * @returns The new asset */ upload(data: AssetUploadArguments, settings?: TextureImportSettings | SceneImportSettings, onProgress?: Function | null): Promise; /** * Creates new anim state graph asset. * * @param options.name - The asset name * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.data - The asset data. See {@link Asset} for Animstategraph data. * @param options.folder - The parent folder asset * @param options.onProgress - Function to report progress * @returns The new asset */ createAnimStateGraph(options?: { name?: string; preload?: boolean; data?: object; folder?: Asset; onProgress?: Function; }): Promise; /** * Creates new bundle asset * * @param options.name - The asset name * @param options.assets - The assets that the bundle will contain * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createBundle(options?: { name?: string; assets?: any[]; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new CSS asset * * @param options.name - The asset name * @param options.text - The CSS * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createCss(options?: { name?: string; text?: string; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new cubemap asset * * @param options.name - The asset name * @param options.textures - The textures for each cubemap face in this order: * right, left, up, down, front, back * @param options.minFilter - Cubemap minFilter value. Defaults to pc.FILTER_LINEAR_MIPMAP_LINEAR. * @param options.magFilter - Cubemap magFilter value. Defaults to pc.FILTER_LINEAR. * @param options.anisotropy - Cubemap anisotropy value. Defaults to 1. * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createCubemap(options?: { name?: string; textures?: any[]; minFilter?: number; magFilter?: number; anisotropy?: number; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates a new folder asset * * @param options.name - The asset name * @param options.folder - The parent folder asset * @param options.onProgress - Function to report progress * @returns The new asset */ createFolder(options: { name?: string; folder?: Asset; onProgress?: Function; }): Promise; /** * Creates new HTML asset * * @param options.name - The asset name * @param options.text - The HTML * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createHtml(options?: { name?: string; text?: string; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new JSON asset * * @param options.name - The asset name * @param options.json - The JSON * @param options.spaces - The number of spaces used for indentation. Defaults to 0 * (tightly packed output). * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createJson(options?: { name?: string; json?: object; spaces?: number; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new localization JSON asset * * @param options.name - The asset name * @param options.localizationData - The localization data. If null then default data will be used. * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createI18n(options?: { name?: string; localizationData?: object; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new material asset * * @param options.name - The asset name * @param options.data - The material data. Default values will be used for missing fields. See {@link Asset} for material data. * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createMaterial(options?: { name?: string; data?: Record; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new script asset * * @param options.filename - The filename of the script. This will also be the name of the script asset. If not defined it will be generated * from the name of the script. * @param options.text - The contents of the script. If none then boilerplate code will be used. * @param options.data - The script data. See {@link Asset} for Script data. * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createScript(options?: { filename?: string; text?: string; data?: object; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new shader asset * * @param options.name - The asset name * @param options.text - The GLSL * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createShader(options?: { name?: string; text?: string; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new sprite asset * * @param options.name - The asset name * @param options.pixelsPerUnit - The sprite's pixels per unit value. Defaults to 100. * @param options.frameKeys - The sprite's frame keys * @param options.textureAtlas - The sprite's texture atlas asset * @param options.renderMode - The sprite's render mode. Defaults to pc.SPRITE_RENDERMODE_SIMPLE. * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createSprite(options?: { name?: string; pixelsPerUnit?: number; frameKeys?: any[]; textureAtlas?: Asset; renderMode?: number; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new text asset * * @param options.name - The asset name * @param options.text - The text * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createText(options?: { name?: string; text?: string; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Creates new template asset * * @param options.name - The asset name * @param options.entity - The entity to create the template from * @param options.folder - The parent folder asset * @param options.preload - Whether to preload the asset. Defaults to true. * @param options.onProgress - Function to report progress * @returns The new asset */ createTemplate(options: { name?: string; entity: Entity; folder?: Asset; preload?: boolean; onProgress?: Function; }): Promise; /** * Deletes specified assets * * @param assets - The assets */ delete(assets: Asset[]): Promise; /** * Instantiates the specified template assets under the specified * parent entity. * * @param assets - The template assets. * @param parent - The parent entity * @param options.index - The desired index under the parent to instantiate the templates. * @param options.history - Whether to record a history action. * @param options.select - Whether to select the new entities. * @param options.extraData - Extra data passed to the backend. Used by the Editor on specific cases. * @returns The new entities */ instantiateTemplates(assets: Asset[], parent: Entity, options?: { index?: number; history?: boolean; select?: boolean; extraData?: object; }): Promise; get raw(): ObserverList; /** * Sets the default callback called when on asset upload succeeds. * The function takes 2 arguments: the upload id, and the new asset. */ set defaultUploadCompletedCallback(value: (uploadId: number, asset: Asset) => any); /** * Gets the default callback called when on asset upload succeeds. */ get defaultUploadCompletedCallback(): (uploadId: number, asset: Asset) => any; /** * Sets the default callback called when on asset upload progress. * The function takes 2 arguments: the upload id and the progress. */ set defaultUploadProgressCallback(value: (uploadId: number, progress: number) => any); /** * Gets the default callback called when on asset upload progress. */ get defaultUploadProgressCallback(): (uploadId: number, progress: number) => any; /** * Sets the default callback called when on asset upload progress. * The function takes 2 arguments: the upload id, and the error. */ set defaultUploadErrorCallback(value: (uploadId: number, error: Error) => any); /** * Gets the default callback called when on asset upload fails. */ get defaultUploadErrorCallback(): (uploadId: number, error: Error) => any; /** * Sets the callback which parses script assets. When this * callback is set, new script assets will be parsed after they * are created. The function takes the asset as a parameter and returns * a promise with a list of script names when it is done parsing. */ set parseScriptCallback(value: (asset: Asset) => any); /** * Gets the callback which parses script assets. */ get parseScriptCallback(): (asset: Asset) => any; } /** * Represents a custom clipboard with a specific name * which stores a value in localStorage under that name * * @category Internal */ declare class Clipboard { private _name; private _storage; /** * Constructor * * @param name - The name of the clipboard. */ constructor(name: string); /** * Gets whether the clipboard is empty */ get empty(): boolean; /** * Sets the value to be stored in the clipboard. Pass null to clear the value from storage. */ set value(value: object | string); /** * Gets the value stored in the clipboard. */ get value(): object | string; } /** * Data to create a new Entity */ type CreateEntityArguments = { /** * The entity name */ name: string; /** * Component data. See {@link Entity} for details on component data. */ components: object; /** * The parent Entity or its resource_id. If undefined then the root Entity will be used as the parent. */ parent: Entity | string; /** * Data for child entities. */ children: CreateEntityArguments[]; /** * Tags for the Entity. */ tags: string[]; /** * Whether the Entity should be enabled. */ enabled: boolean; /** * The resource_id of the Entity. Leave undefined to generate a new one. */ resource_id?: string; /** * The position of the Entity in local space. */ position: number[]; /** * The rotation of the Entity in local space (euler angles in degrees). */ rotation: number[]; /** * The scale of the Entity in local space. */ scale: number[]; }; /** * Data to reparent an entity under a new parent */ type ReparentArguments = { /** * The entity to reparent */ entity: Entity; /** * The new parent for the entity */ parent: Entity; /** * The child index of the entity under the new parent */ index: number; }; /** * The entities editor API */ declare class Entities extends Events { private _root; private _entities; /** * Creates new API instance * * @category Internal */ constructor(); /** * Gets entity by resource id * * @param id - The entity's resource id * @returns The entity * @example * ```javascript * const entity = editor.entities.get(resourceId); * ``` */ get(id: string): Entity | null; /** * Returns array of all entities * * @returns The entities * @example * ```javascript * const entities = editor.entities.list(); * console.log(entities.length); * ``` */ list(): any[]; /** * Adds entity to list * * @category Internal * @param entity - The entity */ add(entity: Entity): void; /** * Called when an entity is added from the server * * @category Internal * @param entityData - The entity data */ serverAdd(entityData: { parent: Entity; children: Entity[]; }): void; /** * Removes entity from the list * * @category Internal * @param entity - The entity * @param entityReferences - A map of entity references to nullify * when this entity is removed */ remove(entity: Entity, entityReferences?: object): void; /** * Called when an entity is removed from the server * * @category Internal * @param entity - The entity */ serverRemove(entity: Entity): void; /** * Removes all entities from the list * * @category Internal */ clear(): void; /** * Creates new entity and adds it to the hierarchy * * @param data - Initial data for the entity * @param options.index - The child index that this entity will have under its parent. * @param options.history - Whether to record a history action. Defaults to true. * @param options.select - Whether to select new Entity. Defaults to false. * @returns The new entity * * @example * ```javascript * const root = editor.entities.create({ * name: 'parent', * }); * * const child = editor.entities.create({ * name: 'child', * parent: root, * }); *``` */ create(data?: CreateEntityArguments, options?: { index?: number; history?: boolean; select?: boolean; }): Entity; /** * Delete specified entities * * @param entities - The entities * @param options.history - Whether to record a history action. Defaults to true. * * @example * ```javascript * await editor.entities.delete([entity1, entity2]); * ``` */ delete(entities: Entity[] | Entity, options?: { history?: boolean; }): Promise; /** * Reparents entities under new parent. * * @param data - The reparenting data * @param options.preserveTransform - Whether to preserve the transform of the entities. Defaults to false. * @param options.history - Whether to record history. Defaults to true * @example * ```javascript * const child = editor.entities.create(); * const parent = editor.entities.create(); * editor.entities.reparent([{ * entity: child, * parent: parent * }]) * ``` */ reparent(data: ReparentArguments[], options?: { preserveTransform?: boolean; history?: boolean; }): void; /** * Duplicates the specified entities under the same parent * * @param entities - The entities * @param options.history - Whether to record a history action. Defaults to true. * @param options.select - Whether to select the new entities. Defaults to false. * @param options.rename - Whether to rename the duplicated entities. Defaults to false. * @returns The duplicated entities * @example * const duplicated = await editor.entities.duplicate(entities); */ duplicate(entities: Entity[], options?: { history?: boolean; select?: boolean; rename?: boolean; }): Promise; /** * Copy specified entities to localStorage clipboard. Can be used * to paste these entities later on. * * @param entities - The entities */ copyToClipboard(entities: Entity[]): void; /** * Paste entities copied into clipboard * under the specified parent. * * @param parent - The parent * @param options.history - Whether to record a history action. Defaults to true. * @returns The new entities */ pasteFromClipboard(parent: Entity, options?: { history?: boolean; }): Promise; /** * Waits for specified entity ids to be added to the scene. * Once they are the callback is called with the entities as its argument. * * @param entityIds - The ids of the entities to wait for * @param timeoutMs - Number of ms to wait before stopping to wait * @param callback - The callback to call when all entities have been added. * The signature is (Entity[]) => void. * @returns Returns a cancel function which can be called to cancel calling the * callback when the entities are added. */ waitToExist(entityIds: string[], timeoutMs: number, callback: (entities: Entity[]) => void): () => void; /** * Like {@link Entity.addScript} but works on multiple entities using * a single history action. * * @param entities - The entities. * @param scriptName - The name of the script. * @param options.attributes - The values of attributes. Each key is the name * of the attributes and each value is the value for that attribute. Leave undefined to * let the Editor set default values depending on the attribute types. * @param options.history - Whether to add a history action. Defaults to true. * @param options.index - The desired index in the entity's scripts order to add this script. * @returns A promise */ addScript(entities: Entity[], scriptName: string, options?: { attributes?: object; history?: boolean; index?: number; }): Promise; /** * Like {@link Entity.removeScript} but works on multiple entities using * a single history action. * * @param entities - The entities. * @param scriptName - The name of the script. * @param options.history - Whether to record a history action. Defaults to true. */ removeScript(entities: Entity[], scriptName: string, options?: { history?: boolean; }): void; get raw(): ObserverList; /** * Gets the root Entity */ get root(): Entity; } /** * The history API responsible for undo / redo. */ declare class History extends Events { private _history; /** * Creates new instance of the API * * @category Internal */ constructor(); /** * Adds history action * * @param action - The action * @example * ```javascript * const prevSelection = editor.selection.items; * editor.history.add({ * name: 'clear selection', * redo: () => { editor.selection.clear({ history: false }); }, * undo: () => { editor.selection.set(prevSelection, { history: false }); }, * }); * ``` */ add(action: HistoryAction): void; /** * Adds history action and execute redo * * @param action - The action * @example * ```javascript * const prevSelection = editor.selection.items; * editor.history.addAndExecute({ * name: 'clear selection', * redo: () => { editor.selection.clear({ history: false }); }, * undo: () => { editor.selection.set(prevSelection, { history: false }); }, * }); * ``` */ addAndExecute(action: HistoryAction): void; /** * Undo last action * * @example * ```javascript * editor.history.undo(); * ``` */ undo(): void; /** * Redo last action * * @example * ```javascript * editor.history.redo(); * ``` */ redo(): void; /** * Clear history * * @example * ```javascript * editor.history.clear(); * ``` */ clear(): void; /** * Gets the current action */ get currentAction(): HistoryAction; /** * Gets the last action */ get lastAction(): HistoryAction; /** * Sets whether there are actions to undo. */ set canUndo(value: boolean); /** * Gets whether there are actions to undo. */ get canUndo(): boolean; /** * Sets whether there are actions to redo. */ set canRedo(value: boolean); /** * Gets whether there are actions to redo. */ get canRedo(): boolean; } /** * Facilitates tracking of asynchronous jobs. * * @category Internal */ declare class Jobs extends Events { private _jobsInProgress; /** * Adds a new job. The specified function will be returned when the * job is finished. * * @param fn - A function to be stored for this job. * @returns Returns a job id * @example * ```javascript * const jobId = editor.jobs.start(() => console.log('job was finished')); * editor.jobs.finish(jobId)(); // prints 'job was finished' * ``` */ start(fn: Function): string; /** * Notifies that a job has finished. The specified job * id is removed and the callback stored when the job was * started is returned. * * @param jobId - The job id * @returns The function stored when the job was started * @example * ```javascript * const jobId = editor.jobs.start(() => console.log('job was finished')); * editor.jobs.finish(jobId)(); // prints 'job was finished' * ``` */ finish(jobId: string): Function; } /** * The MessagerClient interface extends the Events class and defines the methods and properties * required for the Messenger client. */ type MessagerClient = Events & { /** * Connects to the specified URL. * @param url - The URL to connect to. */ connect(url: string): void; /** * Indicates whether the client is connected. */ isConnected: boolean; /** * Authenticates the client with the specified access token and role. * @param accessToken - The access token for authentication. * @param role - The role for authentication. */ authenticate(accessToken: string, role: string): void; /** * Watches the specified project. * @param projectId - The ID of the project to watch. */ projectWatch(projectId: string): void; }; /** * The Messenger API. The messenger receives messages * when various things happen e.g. an asset is created etc. * * @category Internal */ declare class Messenger extends Events { private _messenger; private _url; /** * Constructor * * @param messenger - The instance of the Messenger client - this is * a different class which requires the Messenger client library to be downloaded. */ constructor(messenger: MessagerClient); private _onConnect; private _onWelcome; private _onMessage; /** * Connects to the messenger server. * * @param url - The server URL */ connect(url: string): void; /** * Returns true if we are connected to the messenger server. */ get isConnected(): boolean; } type ShareDb = share.Connection & { bindToSocket: (socket: WebSocket) => void; startBulk: () => void; endBulk: () => void; }; /** * Handles connecting and communicating with the Realtime server. * * @category Internal */ declare class RealtimeConnection extends Events { private _url; private _realtime; private _socket; private _sharedb; private _reconnectAttempts; private _reconnectInterval; private _state; private _authenticated; private _active; private _domEvtVisibilityChange; private _alive; /** * Constructor * * @param realtime - The realtime API */ constructor(realtime: Realtime); private _onauth; /** * Connect to the realtime server * * @param url - The server URL */ connect(url: string): void; /** * Disconnect from the server */ disconnect(): void; /** * Send message to server * * @param name - The message name * @param data - The message data */ sendMessage(name: string, data: object): void; /** * Sends a string to the server * * @param data - The message data */ send(data: string): Promise; /** * Gets a sharedb document * * @param collection - The collection name * @param id - The document id * @returns The sharedb document */ getDocument(collection: string, id: number): share.Doc; /** * Start bulk subscribing to documents */ startBulkSubscribe(): void; /** * Stop bulk subscribing to documents */ endBulkSubscribe(): void; /** * Whether the user is connected to the server */ get connected(): boolean; /** * Whether the server has authenticated the user */ get authenticated(): boolean; /** * Gets the sharedb instance */ get sharedb(): ShareDb; } /** * Represents an asset in sharedb * * @category Internal */ declare class RealtimeAsset extends Events { private _uniqueId; private _realtime; private _connection; private _document; private _loaded; private _evtConnection; /** * Constructor * * @param uniqueId - The unique asset id * @param realtime - The realtime API * @param connection - The realtime connection * */ constructor(uniqueId: number, realtime: Realtime, connection: RealtimeConnection); /** * Loads asset from sharedb and subscribes to changes. */ load(): void; /** * Unloads asset from sharedb and unsubscribes from changes. */ unload(): void; /** * Submits sharedb operation * * @param op - The operation * @param callback - The callback */ submitOp(op: object, callback?: Function): void; /** * Calls the callback when there are no changes pending to be * sent to the server * * @param callback - The callback */ whenNothingPending(callback: Function): void; _onError(err: string): void; _onLoad(): void; _onOp(ops: any, local: boolean): void; /** * Whether the asset is loaded */ get loaded(): boolean; /** * The asset data */ get data(): any; /** * The asset id - used in combination with branch id */ get id(): number; /** * The asset's unique id */ get uniqueId(): number; } /** * Provides methods to load assets from sharedb * * @category Internal */ declare class RealtimeAssets extends Events { private _realtime; private _connection; private _assets; /** * Constructor * * @param realtime - The realtime API * @param connection - The realtime connection */ constructor(realtime: Realtime, connection: RealtimeConnection); /** * Loads an asset * * @param id - The asset's unique id * @returns The asset */ load(id: number): RealtimeAsset; /** * Gets an already loaded asset * * @param id - The asset's unique id * @returns The asset */ get(id: number): RealtimeAsset; /** * Unloads an asset * * @param id - The asset's unique id */ unload(id: number): void; } /** * Represents a scene in sharedb * * @category Internal */ declare class RealtimeScene extends Events { private _uniqueId; private _realtime; private _connection; private _document; private _loaded; private _evtConnection; /** * Constructor * * @param uniqueId - The unique scene id * @param realtime - The realtime API * @param connection - The realtime connection */ constructor(uniqueId: number, realtime: Realtime, connection: RealtimeConnection); /** * Loads scene from sharedb and subscribes to changes. */ load(): void; /** * Unloads scene from sharedb and unsubscribes from changes. */ unload(): void; /** * Add entity to scene * * @param entity - The entity */ addEntity(entity: Entity): void; /** * Removes entity from scene (not from children of another entity) * * @param entity - The entity */ removeEntity(entity: Entity): void; /** * Submits sharedb operation * * @param op - The operation */ submitOp(op: object): void; /** * Calls the callback when there are no changes pending to be * sent to the server * * @param callback - The callback */ whenNothingPending(callback: Function): void; private _onError; private _onLoad; private _onOp; /** * Whether the scene is loaded */ get loaded(): boolean; /** * The scene data */ get data(): any; /** * The scene id - used in combination with the branch id */ get id(): number; /** * The scene's unique id */ get uniqueId(): number; } /** * Provides methods to load scenes from sharedb * * @category Internal */ declare class RealtimeScenes extends Events { private _realtime; private _connection; private _scenes; private _currentScene; /** * Constructor * * @param realtime - The realtime API * @param connection - The realtime connection */ constructor(realtime: Realtime, connection: RealtimeConnection); /** * Loads a scene * * @param sceneId - The scene id * @returns The scene */ load(sceneId: number): RealtimeScene; /** * Unloads a scene * * @param sceneId - The scene id */ unload(sceneId: number): void; /** * The current scene */ get current(): RealtimeScene; } /** * Provides methods to communicate and load / save data to the realtime server * * @category Internal */ declare class Realtime extends Events { private _connection; private _scenes; private _assets; constructor(); /** * Gets the realtime connection */ get connection(): RealtimeConnection; /** * Gets the realtime scenes API */ get scenes(): RealtimeScenes; /** * Gets the realtime assets API */ get assets(): RealtimeAssets; } type AjaxArgs = { url: string; method?: string; data?: Record | string; headers?: Record; cookies?: boolean; ignoreContentType?: boolean; mimeType?: string; auth?: boolean; notJson?: boolean; }; declare class Ajax extends Events { private _xhr; private _progress; private _notJson; /** * @param args - Arguments for the request. * @returns The Ajax instance. */ static get(args: Omit): Ajax; /** * @param args - Arguments for the request. * @returns The Ajax instance. */ static post(args: Omit): Ajax; /** * @param args - Arguments for the request. * @returns The Ajax instance. */ static put(args: Omit): Ajax; /** * @param args - Arguments for the request. * @returns The Ajax instance. */ static delete(args: Omit): Ajax; /** * @param args - Arguments for the request. */ private constructor(); /** * @param _evt - The load event. */ private _onLoad; /** * @param evt - The error event. */ private _onError; /** * @param evt - The abort event. */ private _onAbort; /** * @param evt - The progress event. */ private _onProgress; /** * @param onprogress - The progress callback. * @returns A promise that resolves with the response. */ promisify(onprogress?: (progress: number) => void): Promise; abort(): void; } /** * Creates a new app * * @param data - The app data to create * @returns A request that responds with the app data */ declare const appCreate: (data: object) => Ajax; /** * Deletes the app with the given ID * * @param appId - The ID of the app to delete * @returns A request that responds when the app is deleted */ declare const appDelete: (appId: number) => Ajax; /** * Get list of apps * * @param tags - The tags to filter the apps by * @returns A request that responds with the list of apps */ declare const appList: (tags: string) => Ajax; /** * Fetches the app with the given ID * * @param appId - The ID of the app to get * @returns A request that responds with the app data */ declare const appGet: (appId: number) => Ajax; /** * Downloads the app with the given ID * * @param data - The app data to download * @returns A request that responds with the app data */ declare const appDownload: (data: object) => Ajax; declare const apps_appCreate: typeof appCreate; declare const apps_appDelete: typeof appDelete; declare const apps_appDownload: typeof appDownload; declare const apps_appGet: typeof appGet; declare const apps_appList: typeof appList; declare namespace apps { export { apps_appCreate as appCreate, apps_appDelete as appDelete, apps_appDownload as appDownload, apps_appGet as appGet, apps_appList as appList }; } type AssetListOptions = { /** * The search string to use */ search?: string; /** * Whether to use regex for the search */ regex?: boolean; /** * The field to sort by */ sort?: string; /** * The order to sort by */ order?: number; /** * The number of assets to skip */ skip?: number; /** * The number of assets to return */ limit?: number; /** * The tags to filter by */ tags?: string; }; type AssetGetFileOptions = { /** * The ID of the branch to get the file from */ branchId?: string; /** * The immutable backup ID to get the file from */ immutableBackup?: string; }; type AssetReimportData = { /** * Whether to use power of two textures */ pow2?: boolean; /** * The animation sample rate */ searchRelatedAssets?: boolean; /** * Whether to search for related assets */ overwriteModel?: boolean; /** * Whether to overwrite the model */ overwriteAnimation?: boolean; /** * Whether to overwrite the animation */ overwriteMaterial?: boolean; /** * Whether to overwrite the material */ overwriteTexture?: boolean; /** * Whether to overwrite the texture */ preserveMapping?: boolean; /** * Whether to preserve the mapping */ useGlb?: boolean; /** * The animation sample rate */ useContainers?: boolean; /** * Whether to use containers */ meshCompression?: boolean; /** * Whether to use mesh compression */ dracoDecodeSpeed?: number; /** * The speed of Draco decoding */ dracoMeshSize?: number; /** * The size of Draco meshes */ animUseFbxFilename?: boolean; }; type AssetDuplicateData = { /** * The type of the asset to duplicate */ type: string; /** * The ID of the branch to duplicate the asset to */ branchId: string; }; type AssetPasteData = { /** * The ID of the project the assets are from */ projectId: number; /** * The ID of the branch the assets are from */ branchId: string; /** * The ID of the project to paste the assets to */ targetProjectId: string; /** * The ID of the branch to paste the assets to */ targetBranchId: string; /** * Whether to keep the folder structure when pasting */ keepFolderStructure: boolean; /** * The assets to paste */ assets: string[]; }; type AssetUpdateData = { /** * The name of the asset */ name?: string; /** * The parent folder of the asset */ parent?: Observer | string; /** * The type of the asset */ type?: string; /** * The filename of the asset */ filename?: string; /** * The file to add to the form */ file?: File; }; type AssetCreateData = AssetUpdateData & { /** * The name of the asset */ type: string; /** * The parent folder of the asset */ asset?: Observer; /** * The type of the asset */ tags?: string[]; /** * The tags of the asset */ source_asset_id?: string; /** * The source asset ID */ data?: object; /** * The data of the asset */ meta?: object; /** * The meta of the asset */ preload?: boolean; /** * Whether to preload the asset */ preloadDefault?: boolean; }; type AssetPipelineOptions = { /** * Whether to use power of two textures */ pow2?: boolean; /** * Whether to search for related assets */ searchRelatedAssets?: boolean; /** * Whether to overwrite the model */ overwriteModel?: boolean; /** * Whether to overwrite the animation */ overwriteAnimation?: boolean; /** * Whether to overwrite the material */ overwriteMaterial?: boolean; /** * Whether to overwrite the texture */ overwriteTexture?: boolean; /** * Whether to preserve the mapping */ preserveMapping?: boolean; /** * Whether to use GLB */ useGlb?: boolean; /** * The animation sample rate */ animSampleRate?: number; /** * The animation curve tolerance */ animCurveTolerance?: number; /** * Whether to enable cubic animations */ animEnableCubic?: boolean; /** * Whether to use the FBX filename for animations */ animUseFbxFilename?: boolean; /** * Whether to use containers */ useContainers?: boolean; /** * Whether to use mesh compression */ meshCompression?: boolean; /** * Whether to unwrap UVs */ unwrapUv?: boolean; /** * The number of texels per meter for UV unwrapping */ unwrapUvTexelsPerMeter?: number; /** * Whether to import morph normals */ importMorphNormals?: boolean; }; /** * Fetches asset data for the given asset * * @param options - The options for the request * @returns A request that responds with the asset data */ declare const assetsList: (options: AssetListOptions) => Ajax; /** * Gets the asset with the given ID * * @param assetId - The ID of the asset to get * @returns A request that responds with the asset */ declare const assetGet: (assetId: string) => Ajax; /** * Fetches file data for the given asset * * @param assetId - The ID of the asset to get * @param fileName - The name of the file to get * @param options - The options for the request * @returns A request that responds with the file data */ declare const assetGetFile: (assetId: string, fileName: string, options: AssetGetFileOptions) => Ajax; /** * Reimport asset * * @param assetId - The ID of the asset to reimport * @param data - The data to reimport * @returns A request that responds with the result of the reimport */ declare const assetReimport: (assetId: string, data: AssetReimportData) => Ajax; /** * Duplicates the asset with the given ID * * @param assetId - The ID of the asset to duplicate * @param data - The data to duplicate * @returns A request that responds with the result of the duplicate */ declare const assetDuplicate: (assetId: string, data: AssetDuplicateData) => Ajax; /** * Pastes the given assets * * @param data - The data to paste * @param data.assets - The assets to paste * @returns A request that responds with the result of the paste */ declare const assetPaste: (data: AssetPasteData) => Ajax; /** * Creates a new asset * * @param data - The data to upload * @param pipeline - The pipeline options to use for the asset * @returns A request that responds with the result of the upload */ declare const assetCreate: (data: AssetCreateData, pipeline?: AssetPipelineOptions) => Ajax; /** * Updates the asset with the given ID * * @param assetId - The ID of the asset to update * @param data - The data to update * @param pipeline - The pipeline options to use for the asset * @returns A request that responds with the result of the update */ declare const assetUpdate: (assetId: string, data: AssetUpdateData, pipeline?: AssetPipelineOptions) => Ajax; type assets_AssetCreateData = AssetCreateData; type assets_AssetDuplicateData = AssetDuplicateData; type assets_AssetGetFileOptions = AssetGetFileOptions; type assets_AssetListOptions = AssetListOptions; type assets_AssetPasteData = AssetPasteData; type assets_AssetPipelineOptions = AssetPipelineOptions; type assets_AssetReimportData = AssetReimportData; type assets_AssetUpdateData = AssetUpdateData; declare const assets_assetCreate: typeof assetCreate; declare const assets_assetDuplicate: typeof assetDuplicate; declare const assets_assetGet: typeof assetGet; declare const assets_assetGetFile: typeof assetGetFile; declare const assets_assetPaste: typeof assetPaste; declare const assets_assetReimport: typeof assetReimport; declare const assets_assetUpdate: typeof assetUpdate; declare const assets_assetsList: typeof assetsList; declare namespace assets { export { type assets_AssetCreateData as AssetCreateData, type assets_AssetDuplicateData as AssetDuplicateData, type assets_AssetGetFileOptions as AssetGetFileOptions, type assets_AssetListOptions as AssetListOptions, type assets_AssetPasteData as AssetPasteData, type assets_AssetPipelineOptions as AssetPipelineOptions, type assets_AssetReimportData as AssetReimportData, type assets_AssetUpdateData as AssetUpdateData, assets_assetCreate as assetCreate, assets_assetDuplicate as assetDuplicate, assets_assetGet as assetGet, assets_assetGetFile as assetGetFile, assets_assetPaste as assetPaste, assets_assetReimport as assetReimport, assets_assetUpdate as assetUpdate, assets_assetsList as assetsList }; } type Branch = { /** * The ID of the branch */ id: string; /** * The ID of the project */ projectId: number; /** * The ID of the user who created the branch */ userId: number; /** * The name of the branch */ name: string; /** * The date the branch was created */ createdAt: string; /** * Whether the branch is closed */ closed: boolean; /** * Whether the branch is permanent */ permanent: boolean; /** * The ID of the latest checkpoint */ latestCheckpointId: string; }; type Checkpoint = { /** * The ID of the checkpoint */ id: string; /** * The ID of the branch */ branchId: string; /** * The ID of the project */ projectId: number; /** * The ID of the user who created the checkpoint */ userId: number; /** * The size of the checkpoint in bytes */ size: number; /** * The version format of the checkpoint */ version: string; /** * The date the checkpoint was created */ createdAt: string; /** * The description of the checkpoint */ description: string; }; type Conflict = { /** * The ID of the conflict */ id: string; /** * The ID of the merge */ mergeId: string; /** * The ID of the item */ itemId: string; /** * The type of the item */ itemType: string; /** * The name of the item */ itemName: string; /** * The type of the asset */ assetType: string; /** * The path of the item */ path: string; /** * The base value of the item */ baseValue: string; /** * The source value of the item */ srcValue: string; /** * The destination value of the item */ dstValue: string; /** * Whether to use the source value */ useSrc: boolean; /** * Whether to use the destination value */ useDst: boolean; /** * Whether to use the merged file */ useMergedFile: boolean; /** * The path of the merged file */ mergedFilePath: string; /** * The type of the base value */ baseType: string; /** * The type of the source value */ srcType: string; /** * The type of the destination value */ dstType: string; /** * The immutable backup of the base value */ baseImmutableBackup: string; /** * The immutable backup of the source value */ srcImmutableBackup: string; /** * The immutable backup of the destination value */ dstImmutableBackup: string; /** * The filename of the base value */ baseFilename: string; /** * The filename of the source value */ srcFilename: string; /** * The filename of the destination value */ dstFilename: string; /** * Whether the base value is missing */ missingInBase?: boolean; /** * Whether the source value is missing */ missingInSrc?: boolean; /** * Whether the destination value is missing */ missingInDst?: boolean; /** * Whether the source value is too big */ srcTooBig?: boolean; /** * Whether the destination value is too big */ dstTooBig?: boolean; /** * Whether the base value is too big */ baseTooBig?: boolean; /** * Whether the merge is textual */ isTextualMerge?: boolean; }; type ConflictGroupedFields = 'itemId' | 'itemType' | 'itemName' | 'assetType' | 'baseImmutableBackup' | 'srcImmutableBackup' | 'dstImmutableBackup' | 'baseFilename' | 'srcFilename' | 'dstFilename'; type Merge = { /** * The ID of the merge */ id: string; /** * The ID of the source branch */ sourceBranchId: string; /** * The ID of the source checkpoint */ sourceCheckpointId: string; /** * The ID of the destination branch */ destinationBranchId: string; /** * The ID of the destination checkpoint */ destinationCheckpointId: string; /** * The ID of the project */ projectId: number; /** * The ID of the user who created the merge */ userId: number; /** * The date the merge was created */ createdAt: string; /** * The number of conflicts in the merge */ numConflicts: number; /** * Whether the merge is a diff */ isDiff: boolean; /** * The expiration time of the merge */ expirationTime?: string; /** * The progress status of the merge */ mergeProgressStatus?: string; /** * Whether to close the source branch after merging */ sourceBranchClose?: boolean; /** * The conflicts of the merge */ conflicts?: (Pick & { /** * The conflict data without the grouped fields */ data: Omit[]; })[]; /** * Source checkpoint */ srcCheckpoint?: { /** * The assets of the source checkpoint */ assets: Record; /** * The scenes of the source checkpoint */ scenes: Record>; /** * The settings of the source checkpoint */ settings: Record; }; /** * Destination checkpoint */ dstCheckpoint?: { /** * The assets of the destination checkpoint */ assets: Record; /** * The scenes of the destination checkpoint */ scenes: Record>; /** * The settings of the destination checkpoint */ settings: Record; }; }; type DiffHiddenFields = 'useSrc' | 'useDst' | 'useMergedFile' | 'baseType' | 'baseImmutableBackup' | 'baseFilename' | 'missingInBase' | 'baseTooBig'; type Diff = Omit & { /** * The grouped conflicts of the diff */ conflicts?: (Pick & { /** * The conflict data without the grouped fields */ data: Omit[]; })[]; }; type User = { /** * The ID of the user */ id: string; /** * The email of the user */ email: string; /** * The full name of the user */ fullName: string; /** * The username of the user */ username: string; }; type Job = { /** * The unique identifier for the job. */ id: number; /** * The scope of the job. */ scope: { /** * The ID of the scope. */ id: number; /** * The type of the scope. */ type: string; }; /** * The time when the job was created. */ created_at: string; /** * The time when the job was last modified. */ modified_at: string; /** * The status of the job. */ status: 'complete' | 'running' | 'error'; /** * The job data. */ data: T; }; type BranchCreateArgs = { /** * The branch name. Cannot be empty or exceed 1000 characters. */ name: string; /** * The project ID */ projectId: number; /** * The ID of the source branch */ sourceBranchId: string; /** * the ID of the source checkpoint */ sourceCheckpointId?: string; }; type BranchCheckoutArgs = { /** * The ID of the branch to checkout */ branchId: string; }; type BranchOpenArgs = { /** * The ID of the branch to open */ branchId: string; }; type BranchCloseArgs = { /** * The ID of the branch to close */ branchId: string; }; type BranchDeleteArgs = { /** * The ID of the branch to delete */ branchId: string; }; type BranchCheckpointArgs = { /** * The ID of the branch to get checkpoints for */ branchId: string; /** * The maximum number of checkpoints to get */ limit?: number; /** * The number of checkpoints to skip */ skip?: number; /** * The type of task to get checkpoints for */ taskType?: string; /** * The ID of the graph to start from */ graphStartId?: string; /** * The ID of the VC history item */ vcHistItem?: string; }; type BranchResponse = Omit & { user: Pick; }; type BranchUserResponse = Omit & { user: Pick; }; /** * Creates a new branch */ declare const branchCreate: (args: BranchCreateArgs) => Ajax; /** * Checks out the master branch */ declare const branchCheckout: (args: BranchCheckoutArgs) => Ajax; /** * Opens a branch */ declare const branchOpen: (args: BranchOpenArgs) => Ajax; /** * Closes a branch */ declare const branchClose: (args: BranchCloseArgs) => Ajax; /** * Deletes a branch */ declare const branchDelete: (args: BranchDeleteArgs) => Ajax; /** * Get branch checkpoints */ declare const branchCheckpoints: (args: BranchCheckpointArgs) => Ajax; type branches_BranchCheckoutArgs = BranchCheckoutArgs; type branches_BranchCheckpointArgs = BranchCheckpointArgs; type branches_BranchCloseArgs = BranchCloseArgs; type branches_BranchCreateArgs = BranchCreateArgs; type branches_BranchDeleteArgs = BranchDeleteArgs; type branches_BranchOpenArgs = BranchOpenArgs; type branches_BranchResponse = BranchResponse; type branches_BranchUserResponse = BranchUserResponse; declare const branches_branchCheckout: typeof branchCheckout; declare const branches_branchCheckpoints: typeof branchCheckpoints; declare const branches_branchClose: typeof branchClose; declare const branches_branchCreate: typeof branchCreate; declare const branches_branchDelete: typeof branchDelete; declare const branches_branchOpen: typeof branchOpen; declare namespace branches { export { type branches_BranchCheckoutArgs as BranchCheckoutArgs, type branches_BranchCheckpointArgs as BranchCheckpointArgs, type branches_BranchCloseArgs as BranchCloseArgs, type branches_BranchCreateArgs as BranchCreateArgs, type branches_BranchDeleteArgs as BranchDeleteArgs, type branches_BranchOpenArgs as BranchOpenArgs, type branches_BranchResponse as BranchResponse, type branches_BranchUserResponse as BranchUserResponse, branches_branchCheckout as branchCheckout, branches_branchCheckpoints as branchCheckpoints, branches_branchClose as branchClose, branches_branchCreate as branchCreate, branches_branchDelete as branchDelete, branches_branchOpen as branchOpen }; } type CheckpointCreateArgs = { /** * The ID of the project to create the checkpoint on */ projectId: number; /** * The ID of the branch to create the checkpoint on */ branchId: string; /** * The description of the checkpoint */ description: string; }; type CheckpointGetArgs = { /** * The ID of the checkpoint to get */ checkpointId: string; }; type CheckpointRestoreArgs = { /** * The ID of the branch to restore the checkpoint to */ branchId: string; /** * The ID of the checkpoint to restore */ checkpointId: string; }; type CheckpointHardResetArgs = { /** * The ID of the branch to hard reset the checkpoint to */ branchId: string; /** * The ID of the checkpoint to hard reset */ checkpointId: string; }; type CheckpointResponse = Pick & { user: Pick; }; type CheckpointUserResponse = Pick & { user: Pick; }; /** * Creates a new checkpoint */ declare const checkpointCreate: (args: CheckpointCreateArgs) => Ajax; /** * Gets a checkpoint * * @param args - The arguments for the request * @returns The Ajax wrapped response */ declare const checkpointGet: (args: CheckpointGetArgs) => Ajax; /** * Restores a checkpoint */ declare const checkpointRestore: (args: CheckpointRestoreArgs) => Ajax; /** * Hard resets a checkpoint */ declare const checkpointHardReset: (args: CheckpointHardResetArgs) => Ajax; type checkpoints_CheckpointCreateArgs = CheckpointCreateArgs; type checkpoints_CheckpointGetArgs = CheckpointGetArgs; type checkpoints_CheckpointHardResetArgs = CheckpointHardResetArgs; type checkpoints_CheckpointResponse = CheckpointResponse; type checkpoints_CheckpointRestoreArgs = CheckpointRestoreArgs; type checkpoints_CheckpointUserResponse = CheckpointUserResponse; declare const checkpoints_checkpointCreate: typeof checkpointCreate; declare const checkpoints_checkpointGet: typeof checkpointGet; declare const checkpoints_checkpointHardReset: typeof checkpointHardReset; declare const checkpoints_checkpointRestore: typeof checkpointRestore; declare namespace checkpoints { export { type checkpoints_CheckpointCreateArgs as CheckpointCreateArgs, type checkpoints_CheckpointGetArgs as CheckpointGetArgs, type checkpoints_CheckpointHardResetArgs as CheckpointHardResetArgs, type checkpoints_CheckpointResponse as CheckpointResponse, type checkpoints_CheckpointRestoreArgs as CheckpointRestoreArgs, type checkpoints_CheckpointUserResponse as CheckpointUserResponse, checkpoints_checkpointCreate as checkpointCreate, checkpoints_checkpointGet as checkpointGet, checkpoints_checkpointHardReset as checkpointHardReset, checkpoints_checkpointRestore as checkpointRestore }; } type ConflictResolveArgs = { /** * The merge id */ mergeId: string; /** * The conflict ids */ conflictIds: string[]; /** * Use source checkpoint */ useSrc?: boolean; /** * Use destination checkpoint */ useDst?: boolean; /** * Un-resolve conflicts */ revert?: boolean; }; type ConflictUploadArgs = { /** * The conflict id */ conflictId: string; /** * The file */ file: File | Blob; }; type ConflictResponse = Omit; /** * Resolve conflicts */ declare const conflictsResolve: (args: ConflictResolveArgs) => Ajax<{ result: ConflictResponse[]; }>; /** * Uploads the specified file to resolve a conflict */ declare const conflictsUpload: (args: ConflictUploadArgs) => Ajax; type conflicts_ConflictResolveArgs = ConflictResolveArgs; type conflicts_ConflictResponse = ConflictResponse; type conflicts_ConflictUploadArgs = ConflictUploadArgs; declare const conflicts_conflictsResolve: typeof conflictsResolve; declare const conflicts_conflictsUpload: typeof conflictsUpload; declare namespace conflicts { export { type conflicts_ConflictResolveArgs as ConflictResolveArgs, type conflicts_ConflictResponse as ConflictResponse, type conflicts_ConflictUploadArgs as ConflictUploadArgs, conflicts_conflictsResolve as conflictsResolve, conflicts_conflictsUpload as conflictsUpload }; } type DiffCreateArgs = { /** * The ID of the source branch */ srcBranchId: string; /** * The ID of the destination branch */ dstBranchId: string; /** * The ID of the source checkpoint */ srcCheckpointId?: string; /** * The ID of the destination checkpoint */ dstCheckpointId?: string; /** * The ID of the merge */ mergeId?: string; /** * The ID of the history item */ histItem?: string; }; type DiffResponse = Diff; /** * Creates a new diff * * @param args - The options for the diff * @returns A request that responds with the new diff */ declare const diffCreate: (args: DiffCreateArgs) => Ajax; type diff_DiffCreateArgs = DiffCreateArgs; type diff_DiffResponse = DiffResponse; declare const diff_diffCreate: typeof diffCreate; declare namespace diff { export { type diff_DiffCreateArgs as DiffCreateArgs, type diff_DiffResponse as DiffResponse, diff_diffCreate as diffCreate }; } type HomeSceneEventData = { /** * The name of the event */ name: string; /** * The title of the event */ title: string; /** * The text of the event */ text: string; }; /** * Gets the current checked out branch from the server * * @returns The request object */ declare const homeBranch: () => Ajax; /** * Gets raw file from the server * * @param url - The URL of the file to get * @param notJson - If the file is not JSON * @returns The request object */ declare const homeFile: (url: string, notJson?: boolean) => Ajax; /** * Set the users editorOpened flag to true * * @param sceneId - The ID of the scene * @returns The request object */ declare const homeSceneOpened: (sceneId: number) => Ajax; /** * Store event on the scene * * @param sceneId - The ID of the scene * @param data - The event data * @returns The request object */ declare const homeSceneEvent: (sceneId: number, data: HomeSceneEventData) => Ajax; /** * Update tip on the scene * * @param sceneId - The ID of the scene * @param tip - The name of the tip * @returns The request object */ declare const homeSceneTip: (sceneId: number, tip: string) => Ajax; type home_HomeSceneEventData = HomeSceneEventData; declare const home_homeBranch: typeof homeBranch; declare const home_homeFile: typeof homeFile; declare const home_homeSceneEvent: typeof homeSceneEvent; declare const home_homeSceneOpened: typeof homeSceneOpened; declare const home_homeSceneTip: typeof homeSceneTip; declare namespace home { export { type home_HomeSceneEventData as HomeSceneEventData, home_homeBranch as homeBranch, home_homeFile as homeFile, home_homeSceneEvent as homeSceneEvent, home_homeSceneOpened as homeSceneOpened, home_homeSceneTip as homeSceneTip }; } type InvitationListOptions = { /** * The project to get the invitations for */ project?: { /** * The name of the project */ name: string; /** * The owner of the project */ owner: string; }; /** * The username to get the invitations for */ username?: string; /** * The ID of the user to get the invitations for */ id?: number; /** * Whether to get accepted invitations */ accepted?: boolean; /** * Whether to get pending invitations */ pending?: boolean; }; type InvitationCreateData = { /** * The owner of the project */ project_owner: string; /** * The name of the project */ project_name: string; /** * The email of the user to invite */ email: string; /** * The permission to give the user */ permission: string; }; /** * Get the project invitations * * @param options - The options to use when fetching the invitations * @returns A request that responds with the list of invitations */ declare const invitationList: (options: InvitationListOptions) => Ajax; /** * Creates a new invitation * * @param data - The invitation data to create * @returns A request that responds with the invitation data */ declare const invitationCreate: (data: InvitationCreateData) => Ajax; /** * Deletes an invitation * * @param invId - The ID of the invitation to delete * @returns A request that responds when the invitation is deleted */ declare const invitationDelete: (invId: number) => Ajax; type invitations_InvitationCreateData = InvitationCreateData; type invitations_InvitationListOptions = InvitationListOptions; declare const invitations_invitationCreate: typeof invitationCreate; declare const invitations_invitationDelete: typeof invitationDelete; declare const invitations_invitationList: typeof invitationList; declare namespace invitations { export { type invitations_InvitationCreateData as InvitationCreateData, type invitations_InvitationListOptions as InvitationListOptions, invitations_invitationCreate as invitationCreate, invitations_invitationDelete as invitationDelete, invitations_invitationList as invitationList }; } type JobGetRequest = { /** * The ID of the job to get */ jobId: number; }; type JobGetResponse = Job; /** * Gets the job with the given ID */ declare const jobGet: (args: JobGetRequest) => Ajax; declare const jobs_jobGet: typeof jobGet; declare namespace jobs { export { jobs_jobGet as jobGet }; } type MergeCreateArgs = { /** * The source branch id */ srcBranchId: string; /** * The destination branch id */ dstBranchId: string; /** * Close the source branch after merging */ srcBranchClose: boolean; }; type MergeApplyArgs = { /** * The ID of the merge */ mergeId: string; /** * Whether to finalize the merge */ finalize: boolean; }; type MergeGetArgs = { /** * The ID of the merge */ mergeId: string; }; type MergeDeleteArgs = { /** * The ID of the merge */ mergeId: string; }; type MergeConflictsArgs = { /** * The ID of the merge */ mergeId: string; /** * The ID of the conflict */ conflictId: string; /** * The name of the file */ fileName: string; /** * Whether the conflict is resolved */ resolved: boolean; }; type MergeResponse = Merge; type MergeFileReponse = string; /** * Create a merge * */ declare const mergeCreate: (args: MergeCreateArgs) => Ajax; /** * Apply a merge */ declare const mergeApply: (args: MergeApplyArgs) => Ajax; /** * Get a merge object by merge id including all of its conflicts */ declare const mergeGet: (args: MergeGetArgs) => Ajax; /** * Force stops a merge which deletes the merge and all of its conflicts */ declare const mergeDelete: (args: MergeDeleteArgs) => Ajax; /** * Get conflicts for a merge */ declare const mergeConflicts: (args: MergeConflictsArgs) => Ajax; type merge_MergeApplyArgs = MergeApplyArgs; type merge_MergeConflictsArgs = MergeConflictsArgs; type merge_MergeCreateArgs = MergeCreateArgs; type merge_MergeDeleteArgs = MergeDeleteArgs; type merge_MergeFileReponse = MergeFileReponse; type merge_MergeGetArgs = MergeGetArgs; type merge_MergeResponse = MergeResponse; declare const merge_mergeApply: typeof mergeApply; declare const merge_mergeConflicts: typeof mergeConflicts; declare const merge_mergeCreate: typeof mergeCreate; declare const merge_mergeDelete: typeof mergeDelete; declare const merge_mergeGet: typeof mergeGet; declare namespace merge { export { type merge_MergeApplyArgs as MergeApplyArgs, type merge_MergeConflictsArgs as MergeConflictsArgs, type merge_MergeCreateArgs as MergeCreateArgs, type merge_MergeDeleteArgs as MergeDeleteArgs, type merge_MergeFileReponse as MergeFileReponse, type merge_MergeGetArgs as MergeGetArgs, type merge_MergeResponse as MergeResponse, merge_mergeApply as mergeApply, merge_mergeConflicts as mergeConflicts, merge_mergeCreate as mergeCreate, merge_mergeDelete as mergeDelete, merge_mergeGet as mergeGet }; } /** * Updates the payment subscription for the given user * * @param userId - The ID of the user to update the subscription for * @param data - The data to update the subscription with * @returns A request that responds with the result of the update */ declare const paymentSubUpdate: (userId: number, data: object) => Ajax; declare const payment_paymentSubUpdate: typeof paymentSubUpdate; declare namespace payment { export { payment_paymentSubUpdate as paymentSubUpdate }; } type ProjectRequestArgs = { /** * The name of the project */ name?: string; /** * The owner of the project */ owner?: string; /** * The description of the project */ description?: string; /** * The URL of the project */ website?: string; /** * Whether the project is private */ private?: boolean; /** * Whether the project's assets are private */ private_source_assets?: boolean; /** * The ID of the project to fork from */ fork_from?: number; /** * The image URL of the project */ image_url?: string; /** * The settings for the project */ settings?: object; /** * The primary app ID of the project */ primary_app?: number; /** * The tags for the project */ tags?: string[]; }; type ProjectCreateArgs = Omit & { /** * The name of the project */ name: string; }; type ProjectUpdateArgs = ProjectRequestArgs & { /** * The ID of the project to update */ projectId: number; }; type ProjectGetArgs = { /** * The ID of the project to get */ projectId: number; }; type ProjectDeleteArgs = { /** * The ID of the project to delete */ projectId: number; }; type ProjectImportArgs = { /** * The URL to export the project from */ export_url: string; /** * The ID of the owner of the project */ owner: number; }; type ProjectExportArgs = { /** * The ID of the project to export */ projectId: number; }; type ProjectTransferData = { /** * The ID of the new owner of the project */ owner_id: number; }; type ProjectCollabCreateData = { /** * The username of the collaborator */ username: string; /** * The invitation of the collaborator */ invitation: string; /** * The access level of the collaborator */ access_level: string; }; type ProjectCollabUpdateData = { /** * The ID of the collaborator */ id: string; /** * The access level of the collaborator */ access_level: string; }; type ProjectBranchesOptions = { /** * The maximum number of branches to return */ limit?: number; /** * The number of branches to skip */ skip?: number; /** * Whether to return closed branches */ closed?: boolean; /** * Whether to return favorite branches */ favorite?: boolean; }; type ProjectCreateResponse = object; type ProjectUpdateResponse = object; type ProjectGetResponse = object; type ProjectDeleteResponse = ''; type ProjectImportResponse = object; type ProjectExportResponse = object; /** * Creates a new project */ declare const projectCreate: (args: ProjectCreateArgs) => Ajax; /** * Updates a project */ declare const projectUpdate: (args: ProjectUpdateArgs) => Ajax; /** * Gets a project by ID */ declare const projectGet: (args: ProjectGetArgs) => Ajax; /** * Deletes a project by ID */ declare const projectDelete: (args: ProjectDeleteArgs) => Ajax<"">; /** * Imports a project */ declare const projectImport: (args: ProjectImportArgs) => Ajax; /** * Exports a project by ID */ declare const projectExport: (args: ProjectExportArgs) => Ajax; /** * Unlocks a project by ID * * @param projectId - The ID of the project to unlock * @returns A request that responds when the project is unlocked */ declare const projectUnlock: (projectId: number) => Ajax; /** * Transfers a project by ID * * @param projectId - The ID of the project to transfer * @param data - The data for the project transfer * @returns A request that responds when the project is transferred */ declare const projectTransfer: (projectId: number, data: ProjectTransferData) => Ajax; /** * Accepts a project transfer by ID * * @param projectId - The ID of the project to accept the transfer for * @returns A request that responds when the project transfer is accepted */ declare const projectAcceptTransfer: (projectId: number) => Ajax; /** * Declines a project transfer by ID * * @param projectId - The ID of the project to decline the transfer for * @returns A request that responds when the project transfer is declined */ declare const projectDeclineTransfer: (projectId: number) => Ajax; /** * Get the project activity * * @param projectId - The ID of the project to get the activity for * @returns A request that responds with the project activity */ declare const projectActivity: (projectId: number) => Ajax; /** * Get the project collaborators * * @param projectId - The ID of the project to get the collaborators for * @returns A request that responds with the project collaborators */ declare const projectCollabList: (projectId: number) => Ajax; /** * Creates a new project collaborator * * @param projectId - The ID of the project to create the collaborator for * @param collab - The data for the new collaborator * @returns A request that responds with the new collaborator */ declare const projectCollabCreate: (projectId: number, collab: ProjectCollabCreateData) => Ajax; /** * Updates a project collaborator * * @param projectId - The ID of the project to update the collaborator for * @param collab - The data for the collaborator * @returns A request that responds with the updated collaborator */ declare const projectCollabUpdate: (projectId: number, collab: ProjectCollabUpdateData) => Ajax; /** * Deletes a project collaborator * * @param projectId - The ID of the project to delete the collaborator for * @param collabId - The ID of the collaborator to delete * @returns A request that responds when the collaborator is deleted */ declare const projectCollabDelete: (projectId: number, collabId: number) => Ajax; /** * Uploads a project image * * @param projectId - The ID of the project to upload the image for * @param file - The image file to upload * @returns A request that responds with the uploaded image */ declare const projectImage: (projectId: number, file: File) => Ajax; /** * Fetches a list of assets for the current project * * @param view - The view to get assets for * @param cookies - Whether to include cookies in the request * @returns A request that responds with the list of assets */ declare const projectAssets: (view: string, cookies?: boolean) => Ajax; /** * Fetches a list of scenes for the current project * * @returns A request that responds with the list of scenes */ declare const projectScenes: () => Ajax; /** * Fetches a list of branches for the current project * * @param options - The options for the request * @returns A request that responds with the list of branches */ declare const projectBranches: (options: ProjectBranchesOptions) => Ajax; /** * Fetches a list of apps for the current project * * @param limit - The maximum number of apps to return * @param skip - The number of apps to skip * @returns A request that responds with the list of apps */ declare const projectApps: (limit?: number, skip?: number) => Ajax; /** * Fetches a list of repositories for the current project * * @returns A request that responds with the list of repositories */ declare const projectRepoList: () => Ajax; /** * Gets list of source files in the repository * * @param repoService - The repository to get the source files for * @returns A request that responds with the list of source files */ declare const projectRepoSourcefilesList: (repoService: string) => Ajax; /** * Gets a source file from the repository * * @param repoService - The repository to get the source file from * @param relativePath - The relative path of the source file * @returns A request that responds with the source file */ declare const projectRepoSourcefile: (repoService: string, relativePath: string) => Ajax; /** * Deletes a source file from the repository * * @param fileName - The name of the source file to remove * @param repoService - The repository to remove the source file from * @returns A request that responds when the source file is removed */ declare const projectRepoSourcefilesDelete: (fileName: string, repoService?: string) => Ajax; type projects_ProjectBranchesOptions = ProjectBranchesOptions; type projects_ProjectCollabCreateData = ProjectCollabCreateData; type projects_ProjectCollabUpdateData = ProjectCollabUpdateData; type projects_ProjectCreateArgs = ProjectCreateArgs; type projects_ProjectCreateResponse = ProjectCreateResponse; type projects_ProjectDeleteArgs = ProjectDeleteArgs; type projects_ProjectDeleteResponse = ProjectDeleteResponse; type projects_ProjectExportArgs = ProjectExportArgs; type projects_ProjectExportResponse = ProjectExportResponse; type projects_ProjectGetArgs = ProjectGetArgs; type projects_ProjectGetResponse = ProjectGetResponse; type projects_ProjectImportArgs = ProjectImportArgs; type projects_ProjectImportResponse = ProjectImportResponse; type projects_ProjectTransferData = ProjectTransferData; type projects_ProjectUpdateArgs = ProjectUpdateArgs; type projects_ProjectUpdateResponse = ProjectUpdateResponse; declare const projects_projectAcceptTransfer: typeof projectAcceptTransfer; declare const projects_projectActivity: typeof projectActivity; declare const projects_projectApps: typeof projectApps; declare const projects_projectAssets: typeof projectAssets; declare const projects_projectBranches: typeof projectBranches; declare const projects_projectCollabCreate: typeof projectCollabCreate; declare const projects_projectCollabDelete: typeof projectCollabDelete; declare const projects_projectCollabList: typeof projectCollabList; declare const projects_projectCollabUpdate: typeof projectCollabUpdate; declare const projects_projectCreate: typeof projectCreate; declare const projects_projectDeclineTransfer: typeof projectDeclineTransfer; declare const projects_projectDelete: typeof projectDelete; declare const projects_projectExport: typeof projectExport; declare const projects_projectGet: typeof projectGet; declare const projects_projectImage: typeof projectImage; declare const projects_projectImport: typeof projectImport; declare const projects_projectRepoList: typeof projectRepoList; declare const projects_projectRepoSourcefile: typeof projectRepoSourcefile; declare const projects_projectRepoSourcefilesDelete: typeof projectRepoSourcefilesDelete; declare const projects_projectRepoSourcefilesList: typeof projectRepoSourcefilesList; declare const projects_projectScenes: typeof projectScenes; declare const projects_projectTransfer: typeof projectTransfer; declare const projects_projectUnlock: typeof projectUnlock; declare const projects_projectUpdate: typeof projectUpdate; declare namespace projects { export { type projects_ProjectBranchesOptions as ProjectBranchesOptions, type projects_ProjectCollabCreateData as ProjectCollabCreateData, type projects_ProjectCollabUpdateData as ProjectCollabUpdateData, type projects_ProjectCreateArgs as ProjectCreateArgs, type projects_ProjectCreateResponse as ProjectCreateResponse, type projects_ProjectDeleteArgs as ProjectDeleteArgs, type projects_ProjectDeleteResponse as ProjectDeleteResponse, type projects_ProjectExportArgs as ProjectExportArgs, type projects_ProjectExportResponse as ProjectExportResponse, type projects_ProjectGetArgs as ProjectGetArgs, type projects_ProjectGetResponse as ProjectGetResponse, type projects_ProjectImportArgs as ProjectImportArgs, type projects_ProjectImportResponse as ProjectImportResponse, type projects_ProjectTransferData as ProjectTransferData, type projects_ProjectUpdateArgs as ProjectUpdateArgs, type projects_ProjectUpdateResponse as ProjectUpdateResponse, projects_projectAcceptTransfer as projectAcceptTransfer, projects_projectActivity as projectActivity, projects_projectApps as projectApps, projects_projectAssets as projectAssets, projects_projectBranches as projectBranches, projects_projectCollabCreate as projectCollabCreate, projects_projectCollabDelete as projectCollabDelete, projects_projectCollabList as projectCollabList, projects_projectCollabUpdate as projectCollabUpdate, projects_projectCreate as projectCreate, projects_projectDeclineTransfer as projectDeclineTransfer, projects_projectDelete as projectDelete, projects_projectExport as projectExport, projects_projectGet as projectGet, projects_projectImage as projectImage, projects_projectImport as projectImport, projects_projectRepoList as projectRepoList, projects_projectRepoSourcefile as projectRepoSourcefile, projects_projectRepoSourcefilesDelete as projectRepoSourcefilesDelete, projects_projectRepoSourcefilesList as projectRepoSourcefilesList, projects_projectScenes as projectScenes, projects_projectTransfer as projectTransfer, projects_projectUnlock as projectUnlock, projects_projectUpdate as projectUpdate }; } type SceneCreateData = { /** * The ID of the project the scene is in */ projectId: number; /** * The ID of the branch the scene is in */ branchId: string; /** * The name of the scene */ name?: string; /** * The ID of the scene to duplicate */ duplicateFrom?: number; }; /** * Creates a new scene * * @param data - The data for the new scene * @returns A request that responds with the new scene */ declare const sceneCreate: (data: SceneCreateData) => Ajax; /** * Deletes the scene with the given ID * * @param sceneId - The ID of the scene to delete * @returns A request that responds when the scene is deleted */ declare const sceneDelete: (sceneId: number) => Ajax; /** * Gets the scene with the given ID * * @param sceneId - The ID of the scene to get * @param cookies - Whether to include cookies in the request * @returns A request that responds with the scene data */ declare const sceneGet: (sceneId: number, cookies?: boolean) => Ajax; type scenes_SceneCreateData = SceneCreateData; declare const scenes_sceneCreate: typeof sceneCreate; declare const scenes_sceneDelete: typeof sceneDelete; declare const scenes_sceneGet: typeof sceneGet; declare namespace scenes { export { type scenes_SceneCreateData as SceneCreateData, scenes_sceneCreate as sceneCreate, scenes_sceneDelete as sceneDelete, scenes_sceneGet as sceneGet }; } type StarCreateData = { scope: { /** * The type of the scope */ type: string; /** * The ID of the scope */ id: number; }; }; /** * Creates a new star * * @param data - The data for the new star * @returns A request that responds with the new star */ declare const starCreate: (data: StarCreateData) => Ajax; /** * Deletes a star by ID * * @param starId - The ID of the star to delete * @returns A request that responds when the star is deleted */ declare const starDelete: (starId: number) => Ajax; type star_StarCreateData = StarCreateData; declare const star_starCreate: typeof starCreate; declare const star_starDelete: typeof starDelete; declare namespace star { export { type star_StarCreateData as StarCreateData, star_starCreate as starCreate, star_starDelete as starDelete }; } type StoreCloneData = { scope: { /** * The type of the scope */ type: string; /** * The ID of the scope */ id: string; }; /** * The name of the store item */ name?: string; /** * The ID of the store to clone the item to */ store?: string; /** * The ID of the folder to clone the item to */ targetFolderId?: string; /** * The license of the store item */ license?: string; }; type StoreListOptions = { /** * The search term to filter store items by */ search?: string; /** * Whether to use regex to filter store items */ regex?: boolean; /** * The field to sort store items by */ sort?: string; /** * The order to sort store items by */ order?: number; /** * The number of store items to skip */ skip?: number; /** * The number of store items to return */ limit?: number; /** * The tags to filter store items by */ tags?: string; /** * The tags to exclude from the store items */ excludeTags?: string; }; type StoreMoveData = { /** * The ID of the branch to move the assets from */ branchId: string; /** * The IDs of the assets to move */ assetIds: string[]; }; /** * Fetches store item * * @param storeId - The ID of the store item to fetch * @returns A request that responds with the store item */ declare const storeGet: (storeId: number) => Ajax; /** * Uploads a store item * * @param data - The data for the new store item * @param mimeType - The MIME type of the store item * @returns A request that responds with the new store item */ declare const storeUpload: (data: object, mimeType: string) => Ajax; /** * Clones store item * * @param storeId - The ID of the store item to clone * @param data - The data for the new store item * @returns A request that responds with the new store item */ declare const storeClone: (storeId: number, data: StoreCloneData) => Ajax; /** * Fetches store assets * * @param storeId - The ID of the store to fetch assets from * @returns A request that responds with the store asset */ declare const storeAssets: (storeId: string) => Ajax; /** * Fetches store asset file * * @param assetId - The ID of the asset to fetch * @param assetName - The name of the asset to fetch * @returns A request that responds with the store asset */ declare const storeAssetFile: (assetId: string, assetName: string) => Ajax; /** * Fetches store licenses * * @returns A request that responds with the store licenses */ declare const storeLicenses: () => Ajax; /** * List store items filtered by search * * @param options - The options to filter store items by * @returns A request that responds with the list of store items */ declare const storeList: (options: StoreListOptions) => Ajax; /** * Move assets to store * * @param storeId - The storeId to move the assets to * @param data - The data for the assets to move * @returns A request that responds when the assets are moved */ declare const storeMove: (storeId: number, data: StoreMoveData) => Ajax; type store_StoreCloneData = StoreCloneData; type store_StoreListOptions = StoreListOptions; type store_StoreMoveData = StoreMoveData; declare const store_storeAssetFile: typeof storeAssetFile; declare const store_storeAssets: typeof storeAssets; declare const store_storeClone: typeof storeClone; declare const store_storeGet: typeof storeGet; declare const store_storeLicenses: typeof storeLicenses; declare const store_storeList: typeof storeList; declare const store_storeMove: typeof storeMove; declare const store_storeUpload: typeof storeUpload; declare namespace store { export { type store_StoreCloneData as StoreCloneData, type store_StoreListOptions as StoreListOptions, type store_StoreMoveData as StoreMoveData, store_storeAssetFile as storeAssetFile, store_storeAssets as storeAssets, store_storeClone as storeClone, store_storeGet as storeGet, store_storeLicenses as storeLicenses, store_storeList as storeList, store_storeMove as storeMove, store_storeUpload as storeUpload }; } type UploadStartData = { /** * The name of the file to upload */ filename: string; /** * The MIME type of the file to upload */ mimeType?: string; }; type UploadUrlsData = { /** * The ID of the upload */ uploadId: string; /** * The number of parts to upload */ parts: number; /** * The s3 key of the file */ key: string; }; type UploadCompleteData = { /** * The ID of the upload */ uploadId: string; /** * The parts of the file to upload */ parts: { PartNumber: number; ETag: string; }[]; /** * The s3 key of the file */ key: string; }; /** * Start upload process * * @param data - The data for the upload * @param data.filename - The name of the file to upload * @returns {Promise<{ uploadId: string, key: string }>} - A promise that resolves with the upload * ID and s3 key */ declare const uploadStart: (data: UploadStartData) => Promise<{ uploadId: string; key: string; }>; /** * Upload a file and get signed URLs * * @param data - The data for the upload * @param data.uploadId - The ID of the upload * @param data.parts - The number of parts to upload * @param data.key - The s3 key of the file * @returns {Promise<{ signedUrls: string[] }>} - A promise that resolves with the signed URLs */ declare const uploadUrls: (data: UploadUrlsData) => Promise<{ signedUrls: string[]; }>; /** * Complete the upload process * * @param data - The data for the upload * @param data.uploadId - The ID of the upload * @param {{ PartNumber: number, ETag: string }[]} data.parts - The parts of the file to upload * @param data.key - The s3 key of the file * @returns {Promise} - A promise that resolves when the upload is complete */ declare const uploadComplete: (data: UploadCompleteData) => Promise; declare const upload_uploadComplete: typeof uploadComplete; declare const upload_uploadStart: typeof uploadStart; declare const upload_uploadUrls: typeof uploadUrls; declare namespace upload { export { upload_uploadComplete as uploadComplete, upload_uploadStart as uploadStart, upload_uploadUrls as uploadUrls }; } /** * Creates a new user * * @param data - The data for the new user * @returns A request that responds with the new user */ declare const userCreate: (data: object) => Ajax; /** * Deletes the user with the given ID * * @param userId - The ID of the user to delete * @returns A request that responds when the user is deleted */ declare const userDelete: (userId: number) => Ajax; /** * Fetches the user with the given ID * * @param userId - The ID of the user to get * @returns A request that responds with the user data */ declare const userGet: (userId: number) => Ajax; /** * Fetches a list of collaborators for the given user * * @param userId - The ID of the user to get collaborators for * @returns A request that responds with the list of collaborators */ declare const userCollabList: (userId: number) => Ajax; /** * Fetches a list of projects for the given user * * @param userId - The ID of the user to get projects for * @param view - The view to get projects for * @returns A request that responds with the list of projects */ declare const userProjects: (userId: number, view: string) => Ajax; /** * Fetches the storage data for the given user * * @param userId - The ID of the user to get storage data for * @returns A request that responds with the storage data */ declare const userUsage: (userId: number) => Ajax; declare const users_userCollabList: typeof userCollabList; declare const users_userCreate: typeof userCreate; declare const users_userDelete: typeof userDelete; declare const users_userGet: typeof userGet; declare const users_userProjects: typeof userProjects; declare const users_userUsage: typeof userUsage; declare namespace users { export { users_userCollabList as userCollabList, users_userCreate as userCreate, users_userDelete as userDelete, users_userGet as userGet, users_userProjects as userProjects, users_userUsage as userUsage }; } type WatchCreateData = { scope: { /** * The type of the scope */ type: string; /** * The ID of the scope */ id: number; }; }; /** * Creates a new watch * * @param data - The data to watch * @returns A request that responds with the watched data */ declare const watchCreate: (data: WatchCreateData) => Ajax; /** * Deletes the watch with the given ID * * @param watchId - The ID of the watch to delete * @returns A request that responds when the watch is deleted */ declare const watchDelete: (watchId: number) => Ajax; type watch_WatchCreateData = WatchCreateData; declare const watch_watchCreate: typeof watchCreate; declare const watch_watchDelete: typeof watchDelete; declare namespace watch { export { type watch_WatchCreateData as WatchCreateData, watch_watchCreate as watchCreate, watch_watchDelete as watchDelete }; } /** * The Rest API provides a set of methods for interacting with the PlayCanvas * Editor's RESTful API. This includes methods for managing assets, branches, * checkpoints, and other resources. The API is designed to be used in conjunction * with the PlayCanvas Editor. * * @category Internal * @ignore */ declare class Rest { /** * The apps API */ apps: typeof apps; /** * The assets API */ assets: typeof assets; /** * The branches API */ branches: typeof branches; /** * The checkpoints API */ checkpoints: typeof checkpoints; /** * The conflicts API */ conflicts: typeof conflicts; /** * The diff API */ diff: typeof diff; /** * The home API */ home: typeof home; /** * The invitations API */ invitations: typeof invitations; /** * The jobs API */ jobs: typeof jobs; /** * The merge API */ merge: typeof merge; /** * The payment API */ payment: typeof payment; /** * The projects API */ projects: typeof projects; /** * The scenes API */ scenes: typeof scenes; /** * The star API */ star: typeof star; /** * The store API */ store: typeof store; /** * The upload API */ upload: typeof upload; /** * The users API */ users: typeof users; /** * The watch API */ watch: typeof watch; } /** * Provides methods to access the Assets schema */ declare class AssetsSchema { private _schemaApi; private _schema; /** * @category Internal * @param schema - The schema API */ constructor(schema: Schema); /** * Gets default data for asset type * * @param type - The asset type * @returns The default data */ getDefaultData(type: string): Record; /** * Gets a list of fields of a particular type for an asset type * * @param assetType - The type of the asset. * @param type - The desired type * @returns A list of fields * @example * ```javascript * const materialAssetPaths = editor.schema.assets.getFieldsOfType('material', 'asset'); * ``` */ getFieldsOfType(assetType: string, type: string): string[]; } /** * Provides methods to access the components schema */ declare class ComponentSchema { private _schemaApi; private _schema; /** * Creates new instance of API * * @category Internal * @param schema - The schema API */ constructor(schema: Schema); _resolveLazyDefaults(defaults: Record): void; /** * Gets default data for a component * * @param component - The component name * @returns The default data * @example * ```javascript * const modelData = editor.schema.components.getDefaultData('model'); * ``` */ getDefaultData(component: string): Record; /** * Gets a list of fields of a particular type for a component * * @param componentName - The component name * @param type - The desired type * @returns A list of fields * @example * ```javascript * const buttonEntityFields = editor.schema.components.getFieldsOfType('button', 'entity'); * ``` */ getFieldsOfType(componentName: string, type: string): string[]; /** * Gets a list of all the available components * * @returns The components */ list(): string[]; } /** * Provides methods to access the render schema */ declare class SceneSchema { private _schemaApi; private _schema; /** * Creates new instance of API * * @category Internal * @param schema - The schema API */ constructor(schema: Schema); _getDefaultData(obj: Record): Record; /** * Get the default physics scene settings for the project * * @returns The default physics scene settings * @example * ```javascript * const scenePhysicsSettings = editor.schema.scene.getDefaultPhysicsSettings(); * ``` */ getDefaultPhysicsSettings(): Record; /** * Get the default render scene settings for the project * * @returns The default physics scene settings * @example * ```javascript * const sceneRenderSettings = editor.schema.scene.getDefaultRenderSettings(); * ``` */ getDefaultRenderSettings(): Record; } /** * Provides methods to access the settings schema */ declare class SettingsSchema { private _schemaApi; private _schema; /** * Creates new instance of API * * @category Internal * @param schema - The schema API */ constructor(schema: Schema); _getDefaultData(obj: Record, scope: string): Record; /** * Get the default settings for the project * * @returns The default settings for the project * @example * ```javascript * const projectSettings = editor.schema.settings.getDefaultProjectSettings(); * ``` */ getDefaultProjectSettings(): Record; /** * Get the default settings for the user * * @returns The default settings for the user * @example * ```javascript * const userSettings = editor.schema.settings.getDefaultUserSettings(); * ``` */ getDefaultUserSettings(): Record; /** * Get the default settings for the user in the project * * @returns The default settings for the user in the project * @example * ```javascript * const projectUserSettings = editor.schema.settings.getDefaultProjectUserSettings(); * ``` */ getDefaultProjectUserSettings(): Record; } /** * Provides methods to access the Editor schema. */ declare class Schema { private _schema; private _assetsSchema; private _componentSchema; private _sceneSchema; private _settingsSchema; /** * Creates new instance of API */ constructor(schema: any); /** * Gets the schema */ get schema(): any; /** * Gets the assets schema */ get assets(): AssetsSchema; /** * Gets the component schema */ get components(): ComponentSchema; /** * Gets the scene schema */ get scene(): SceneSchema; /** * Gets the settings schema */ get settings(): SettingsSchema; /** * Converts the specified schema field to a type recursively. * * @category Internal */ getType(field: any, fixedLength?: number): string; } /** * Enables undo / redo of selection changes */ declare class SelectionHistory { private _selection; private _enabled; private _executingAction; /** * Constructor * * @category Internal */ constructor(selection: Selection); /** * Sets enabled state of selection undo / redo. */ set enabled(value: boolean); /** * Gets enabled state of selection undo / redo. */ get enabled(): boolean; /** * Record history action after executing function. * The history action will restore the previous selection. */ wrapAction(name: any, fn: () => void): void; } /** * Selection API. Allows selecting Entities, Assets etc. */ declare class Selection extends Events { private _history; private _items; private _enabled; private _timeoutChange; /** * Constructor * * @category Internal */ constructor(); /** * Fire 'change' event in timeout */ private _deferChangeEvt; /** * Add item to selection * * @example * ```javascript * // add root entity to selection * editor.selection.add(editor.entities.root); * ``` */ add(item: any, options?: { history?: boolean; }): void; /** * Remove item from selection * * @example * ```javascript * // remove root entity from selection * editor.selection.remove(editor.entities.root); * ``` */ remove(item: any, options?: { history?: boolean; }): void; /** * Toggle item selection * * @example * ```javascript * // toggle root entity selection * editor.selection.toggle(editor.entities.root); * ``` */ toggle(item: any, options?: { history?: boolean; }): void; /** * Checks if item is in selection * * @example * ```javascript * const isRootSelected = editor.selection.has(editor.entities.root); * ``` */ has(item: any): boolean; /** * Clears selection * * @example * ```javascript * editor.selection.clear(); * ``` */ clear(options?: { history?: boolean; }): void; /** * Sets current selection * * @example * ```javascript * // select root entity * editor.selection.set([editor.entities.root]); * ``` */ set(items: any[], options?: { history?: boolean; }): void; /** * Gets the selected items. This creates a new array every time it is called. * * @example * ```javascript * editor.selection.items.add(editor.entities.root); * const selectedEntities = editor.selection.items; * ``` */ get items(): (Entity | Asset)[]; /** * Gets the first selected item. Short for this.items[0]. */ get item(): Entity | Asset; /** * Sets enabled state of the selection methods. */ set enabled(value: boolean); /** * Gets enabled state of the selection methods. */ get enabled(): boolean; /** * Gets the number of selected items */ get count(): number; /** * Gets the selection history */ get history(): SelectionHistory; } /** * Represents an observer for the Scene Settings, extending the base Observer. */ type SceneSettingsObserver = Observer & { history: ObserverHistory; }; /** * The Scene Settings API provides access to the settings of the currently loaded scene. */ declare class SceneSettings extends Events { private _observer; private _history; /** * Creates new instance of the API */ constructor(); /** * Initialize internal observer and history. */ private _initializeObserver; /** * Called when a scene is loaded. * * @param scene - The loaded scene */ private _onLoadScene; /** * Checks if path exists. See the {@link SceneSettings} overview for a full list of properties. * * @param path - The path * @returns True if path exists * @example * ```javascript * console.log(editor.settings.scene.has('render.fog')); * ``` */ has(path: string): boolean; /** * Gets value at path. See the {@link SceneSettings} overview for a full list of properties. * * @param path - The path * @returns The value * @example * ```javascript * console.log(editor.settings.scene.get('render.fog')); * ``` */ get(path: string): any; /** * Sets value at path. See the {@link SceneSettings} overview for a full list of properties. * * @param path - The path * @param value - The value * @returns Whether the value was set * @example * ```javascript * editor.settings.scene.set('render.fog', 'none'); * ``` */ set(path: string, value: any): boolean; /** * Returns JSON representation of scene settings data * * @returns - The data * @example * ```javascript * console.log(editor.settings.scene.json()); * ``` */ json(): Record; get observer(): SceneSettingsObserver; /** * Gets the history object for this entity */ get history(): ObserverHistory; } /** * The settings for the Editor. */ declare class Settings extends Events { private _sceneSettings; /** * Creates new API instance */ constructor(); /** * Gets the settings for the currently loaded scene. */ get scene(): SceneSettings; } /** * Global variables */ declare class globals { /** * The history API */ static history: History; /** * The selection API */ static selection: Selection; /** * The schema API */ static schema: Schema; /** * The realtime API * @category Internal */ static realtime: Realtime; /** * The assets API */ static assets: Assets; /** * The entities API */ static entities: Entities; /** * The settings API */ static settings: Settings; /** * The messenger API * @category Internal */ static messenger: Messenger; /** * The jobs API * @category Internal */ static jobs: Jobs; /** * The main clipboard * @category Internal */ static clipboard: Clipboard; /** * The REST API * @category Internal * @ignore */ static rest: Rest; /** * The user's access token * @category Internal */ static accessToken: string; /** * The current project id */ static projectId: number; /** * The current branch id */ static branchId: string; /** * The home URL */ static homeUrl: string; /** * The REST API URL */ static apiUrl: string; /** * Whether this project is using legacy scripts * @category Internal */ static hasLegacyScripts: boolean; /** * Alert function called when user confirmation is needed * for an action. Defaults to the default browser popup but * can be overridden to show your custom popup instead. * * @param text - The confirm dialog text * @param options - Options for the popup * @param options.yesText - Text for 'yes' option * @param options.noText - Text for 'no' option * @param options.noDismiss - If true then user cannot dismiss the popup and will have to click yes or no * @returns True if the user confirmed, false otherwise */ static confirmFn(text: string, options?: { yesText?: string; noText?: boolean; noDismiss?: boolean; }): Promise; } /** * Contains various utility methods * * @category Internal */ declare class utils { /** * Deep copy an object * * @param data - The data to copy * @returns A copy of the data */ static deepCopy(data: Record): Record; static expandPath(obj: any, path: string, fn: (obj: any, path: string) => void): void; } /** * Basically a very large random number (128-bit) which means the * probability of creating two that clash is vanishingly small. * * @category Internal */ declare class Guid { /** * Create an RFC4122 version 4 compliant GUID. * * @returns A new GUID. */ static create(): string; } /** * Wrapper around native local storage * * @category Internal */ declare class LocalStorage { private _cache; /** * Gets a key from localStorage * * @param key - The key * @returns The value */ get(key: string): string | object; /** * Stores a key-value to localStorage * * @param key - The key * @param value - The value */ set(key: string, value: object | string): void; /** * Removes a key from localStorage * * @param key - The key */ unset(key: string): void; /** * Checks if key exists in local storage * * @param key - The key * @returns True or false */ has(key: string): boolean; } /** * The Editor module provides a comprehensive API for automating and extending * the functionality of the PlayCanvas Editor. It allows developers to programmatically * interact with the Editor, facilitating tasks such as scene manipulation, asset * management, and custom tool integration. This module is essential for developers * looking to streamline their workflow, create custom editing tools, or integrate * external data and systems into the PlayCanvas Editor environment. * * @module Editor */ /** * The version of the Editor API library. This is a string in semantic version format of `major.minor.patch`. */ declare const version = "PACKAGE_VERSION"; /** * The git revision of the Editor API library. This is a string of the git commit hash. */ declare const revision = "PACKAGE_REVISION"; export { Asset, type AssetData, type AssetObserver, type AssetProps, type AssetUploadArguments, Assets, AssetsSchema, Clipboard, type CodeEditorConfig, ComponentSchema, type Components, type CreateEntityArguments, type EditorBlankConfig, type EditorConfig, Entities, Entity, type EntityObserver, type EntityProps, Guid, History, Jobs, type LaunchConfig, LocalStorage, type MessagerClient, Messenger, Realtime, RealtimeAsset, RealtimeAssets, RealtimeConnection, RealtimeScene, RealtimeScenes, type ReparentArguments, Rest, type SceneImportSettings, SceneSchema, SceneSettings, type SceneSettingsObserver, type SceneSettingsProps, Schema, Selection, SelectionHistory, Settings, SettingsSchema, type TextureImportSettings, globals, revision, utils, version }; export as namespace api; declare global { const editor: typeof globals; }