@cesdk/engine 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -441,13 +441,30 @@ export declare class BlockAPI {
441
441
  * @returns A promise that resolves with a list of handles representing the found blocks or an error.
442
442
  */
443
443
  loadFromString(content: string): Promise<DesignBlockId[]>;
444
+ /**
445
+ * Loads existing blocks from the given URL.
446
+ * The blocks are not attached by default and won't be visible until attached to a page or the scene.
447
+ * The UUID of the loaded blocks is replaced with a new one.
448
+ * @param url - The URL to load the blocks from.
449
+ * @returns A promise that resolves with a list of handles representing the found blocks or an error.
450
+ */
451
+ loadFromArchiveURL(url: string): Promise<DesignBlockId[]>;
444
452
  /**
445
453
  * Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
446
454
  * page with multiple children, the entire hierarchy is saved.
447
455
  * @param blocks - The blocks to save
448
456
  * @returns A promise that resolves to a string representing the blocks or an error.
449
457
  */
450
- saveToString(blocks: DesignBlockId[]): Promise<string>;
458
+ saveToString(blocks: DesignBlockId[], allowedResourceSchemes?: string[]): Promise<string>;
459
+ /**
460
+ * Saves the given blocks and all of their referenced assets into an archive.
461
+ * The archive contains all assets that were accessible when this function was called.
462
+ * Blocks in the archived scene reference assets relative from to the location of the scene
463
+ * file. These references are resolved when loading such a scene via `loadSceneFromURL`.
464
+ * @param blocks - The blocks to save
465
+ * @returns A promise that resolves with a Blob on success or an error on failure.
466
+ */
467
+ saveToArchive(blocks: DesignBlockId[]): Promise<Blob>;
451
468
  /**
452
469
  * Create a new block, fails if type is unknown.
453
470
  * @param type - The type of the block that shall be created.
@@ -2554,6 +2571,12 @@ export declare type BlurTypeShorthand = 'uniform' | 'linear' | 'mirrored' | 'rad
2554
2571
  */
2555
2572
  export declare type BooleanOperation = 'Difference' | 'Intersection' | 'Union' | 'XOR';
2556
2573
 
2574
+ /** @public */
2575
+ export declare interface Buffer {
2576
+ handle: string;
2577
+ buffer: Uint8Array;
2578
+ }
2579
+
2557
2580
  declare type CameraSettings = {
2558
2581
  /** Horizontal resolution in physical pixels */
2559
2582
  width: number;
@@ -3564,6 +3587,8 @@ export declare class EditorAPI {
3564
3587
  * @returns The length of the buffer in bytes.
3565
3588
  */
3566
3589
  getBufferLength(uri: string): number;
3590
+
3591
+
3567
3592
  }
3568
3593
 
3569
3594
  /**
@@ -4053,11 +4078,19 @@ export declare class SceneAPI {
4053
4078
  * @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
4054
4079
  */
4055
4080
  loadFromURL(url: string): Promise<DesignBlockId>;
4081
+ /**
4082
+ * Load a previously archived scene from the URL to the scene file.
4083
+ * The scene file will be fetched asynchronously by the engine. This requires continuous `render`
4084
+ * calls on this engines instance.
4085
+ * @param url - The URL of the scene file.
4086
+ * @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
4087
+ */
4088
+ loadFromArchiveURL(url: string): Promise<DesignBlockId>;
4056
4089
  /**
4057
4090
  * Serializes the current scene into a string. Selection is discarded.
4058
4091
  * @returns A promise that resolves with a string on success or an error on failure.
4059
4092
  */
4060
- saveToString(): Promise<string>;
4093
+ saveToString(allowedResourceSchemes?: string[]): Promise<string>;
4061
4094
  /**
4062
4095
  * Saves the current scene and all of its referenced assets into an archive.
4063
4096
  * The archive contains all assets, that were accessible when this function was called.