mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
2 Commits
v5.4.205
...
refactor/p
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ae0f2687a5 | ||
![]() |
56bcb79dcd |
133
Extensions/JsExtensionTypes.d.ts
vendored
133
Extensions/JsExtensionTypes.d.ts
vendored
@@ -4,6 +4,107 @@ type GDNamespace = typeof import('../GDevelop.js/types');
|
|||||||
// in this file and merge it with the other namespace declarations.
|
// in this file and merge it with the other namespace declarations.
|
||||||
declare namespace PIXI {}
|
declare namespace PIXI {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose functions to load PIXI textures or fonts, given the names of
|
||||||
|
* resources and a gd.Project.
|
||||||
|
*/
|
||||||
|
declare class PixiResourcesLoader {
|
||||||
|
burstCache();
|
||||||
|
|
||||||
|
async reloadResource(project: gd.Project, resourceName: string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload the given resources.
|
||||||
|
*/
|
||||||
|
async reloadResources(
|
||||||
|
project: gd.Project,
|
||||||
|
resourceNames: Array<string>
|
||||||
|
): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the PIXI texture represented by the given resource.
|
||||||
|
* If not loaded, it will load it.
|
||||||
|
*/
|
||||||
|
getPIXITexture(project: gd.Project, resourceName: string): PIXI.Texture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the three.js texture associated to the specified resource name.
|
||||||
|
* Returns a placeholder texture if not found.
|
||||||
|
* @param project The project
|
||||||
|
* @param resourceName The name of the resource
|
||||||
|
* @returns The requested texture, or a placeholder if not found.
|
||||||
|
*/
|
||||||
|
getThreeTexture(project: gd.Project, resourceName: string): THREE.Texture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the three.js material associated to the specified resource name.
|
||||||
|
* @param project The project
|
||||||
|
* @param resourceName The name of the resource
|
||||||
|
* @param options Set if the material should be transparent or not.
|
||||||
|
* @returns The requested material.
|
||||||
|
*/
|
||||||
|
getThreeMaterial(
|
||||||
|
project: gd.Project,
|
||||||
|
resourceName: string,
|
||||||
|
{ useTransparentTexture }: { useTransparentTexture: boolean }
|
||||||
|
): THREE.Material;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the three.js material associated to the specified resource name.
|
||||||
|
* @param project The project
|
||||||
|
* @param resourceName The name of the resource
|
||||||
|
* @param options
|
||||||
|
* @returns The requested material.
|
||||||
|
*/
|
||||||
|
get3DModel(
|
||||||
|
project: gd.Project,
|
||||||
|
resourceName: string
|
||||||
|
): Promise<THREE.THREE_ADDONS.GLTF>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the Pixi spine data for the specified resource name.
|
||||||
|
* @param project The project
|
||||||
|
* @param spineName The name of the spine json resource
|
||||||
|
* @returns The requested spine skeleton.
|
||||||
|
*/
|
||||||
|
async getSpineData(
|
||||||
|
project: gd.Project,
|
||||||
|
spineName: string
|
||||||
|
): Promise<SpineDataOrLoadingError>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the PIXI video texture represented by the given resource.
|
||||||
|
* If not loaded, it will load it.
|
||||||
|
* @returns The PIXI.Texture to be used. It can be loading, so you
|
||||||
|
* should listen to PIXI.Texture `update` event, and refresh your object
|
||||||
|
* if this event is triggered.
|
||||||
|
*/
|
||||||
|
getPIXIVideoTexture(project: gd.Project, resourceName: string): PIXI.Texture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the given font from its url/filename.
|
||||||
|
* @returns a Promise that resolves with the font-family to be used
|
||||||
|
* to render a text with the font.
|
||||||
|
*/
|
||||||
|
loadFontFamily(project: gd.Project, resourceName: string): Promise<string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the font family name for the given font resource.
|
||||||
|
* The font won't be loaded.
|
||||||
|
* @returns The font-family to be used to render a text with the font.
|
||||||
|
*/
|
||||||
|
getFontFamily(project: gd.Project, resourceName: string): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data from a bitmap font file (fnt/xml) resource in the IDE.
|
||||||
|
*/
|
||||||
|
getBitmapFontData(project: gd.Project, resourceName: string): Promise<any>;
|
||||||
|
|
||||||
|
getInvalidPIXITexture();
|
||||||
|
|
||||||
|
getResourceJsonData(project: gd.Project, resourceName: string);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RenderedInstance is the base class used for creating 2D renderers of instances,
|
* RenderedInstance is the base class used for creating 2D renderers of instances,
|
||||||
* which display on the scene editor, using Pixi.js, the instance of an object (see InstancesEditor).
|
* which display on the scene editor, using Pixi.js, the instance of an object (see InstancesEditor).
|
||||||
@@ -14,17 +115,17 @@ class RenderedInstance {
|
|||||||
_instance: gd.InitialInstance;
|
_instance: gd.InitialInstance;
|
||||||
_associatedObjectConfiguration: gd.ObjectConfiguration;
|
_associatedObjectConfiguration: gd.ObjectConfiguration;
|
||||||
_pixiContainer: PIXI.Container;
|
_pixiContainer: PIXI.Container;
|
||||||
_pixiResourcesLoader: Class<PixiResourcesLoader>;
|
_pixiResourcesLoader: PixiResourcesLoader;
|
||||||
_pixiObject: PIXI.DisplayObject;
|
_pixiObject: PIXI.DisplayObject;
|
||||||
wasUsed: boolean;
|
wasUsed: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
project: gdProject,
|
project: gd.Project,
|
||||||
layout: gdLayout,
|
layout: gd.Layout,
|
||||||
instance: gdInitialInstance,
|
instance: gd.InitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gd.ObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,25 +186,25 @@ class RenderedInstance {
|
|||||||
* It can also display 2D artifacts on Pixi 2D plane (3D object shadow projected on the plane for instance).
|
* It can also display 2D artifacts on Pixi 2D plane (3D object shadow projected on the plane for instance).
|
||||||
*/
|
*/
|
||||||
class Rendered3DInstance {
|
class Rendered3DInstance {
|
||||||
_project: gdProject;
|
_project: gd.Project;
|
||||||
_layout: gdLayout;
|
_layout: gd.Layout;
|
||||||
_instance: gdInitialInstance;
|
_instance: gd.InitialInstance;
|
||||||
_associatedObjectConfiguration: gdObjectConfiguration;
|
_associatedObjectConfiguration: gd.ObjectConfiguration;
|
||||||
_pixiContainer: PIXI.Container;
|
_pixiContainer: PIXI.Container;
|
||||||
_threeGroup: THREE.Group;
|
_threeGroup: THREE.Group;
|
||||||
_pixiResourcesLoader: Class<PixiResourcesLoader>;
|
_pixiResourcesLoader: PixiResourcesLoader;
|
||||||
_pixiObject: PIXI.DisplayObject;
|
_pixiObject: PIXI.DisplayObject;
|
||||||
_threeObject: THREE.Object3D | null;
|
_threeObject: THREE.Object3D | null;
|
||||||
wasUsed: boolean;
|
wasUsed: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
project: gdProject,
|
project: gd.Project,
|
||||||
layout: gdLayout,
|
layout: gd.Layout,
|
||||||
instance: gdInitialInstance,
|
instance: gd.InitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gd.ObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
threeGroup: THREE.Group,
|
threeGroup: THREE.Group,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1290,6 +1290,7 @@ module.exports = {
|
|||||||
manager.getOrLoadTextureCache(
|
manager.getOrLoadTextureCache(
|
||||||
this._loadTileMapWithCallback.bind(this),
|
this._loadTileMapWithCallback.bind(this),
|
||||||
(textureName) =>
|
(textureName) =>
|
||||||
|
// @ts-ignore
|
||||||
this._pixiResourcesLoader.getPIXITexture(
|
this._pixiResourcesLoader.getPIXITexture(
|
||||||
this._project,
|
this._project,
|
||||||
mapping[textureName] || textureName
|
mapping[textureName] || textureName
|
||||||
|
@@ -88,7 +88,7 @@ namespace gdjs {
|
|||||||
* @param callback A function called when the tiles textures are split.
|
* @param callback A function called when the tiles textures are split.
|
||||||
*/
|
*/
|
||||||
getOrLoadTextureCache(
|
getOrLoadTextureCache(
|
||||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>,
|
getTexture: (textureName: string) => PIXI.Texture,
|
||||||
atlasImageResourceName: string,
|
atlasImageResourceName: string,
|
||||||
tileMapJsonResourceName: string,
|
tileMapJsonResourceName: string,
|
||||||
tileSetJsonResourceName: string,
|
tileSetJsonResourceName: string,
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -58,7 +58,7 @@ export declare class TileMapManager {
|
|||||||
tileSetJsonResourceName: string,
|
tileSetJsonResourceName: string,
|
||||||
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
||||||
) => void,
|
) => void,
|
||||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>,
|
getTexture: (textureName: string) => PIXI.Texture,
|
||||||
atlasImageResourceName: string,
|
atlasImageResourceName: string,
|
||||||
tileMapJsonResourceName: string,
|
tileMapJsonResourceName: string,
|
||||||
tileSetJsonResourceName: string,
|
tileSetJsonResourceName: string,
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"TileMapManager.d.ts","sourceRoot":"","sources":["../../src/render/TileMapManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,mBAAmB,CAAkC;;IAO7D;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;IAWzD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,kBAAkB,GAAG,IAAI;IAwBrD;;;;;;;OAOG;IACH,gBAAgB,CACd,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,GAClD,IAAI;IAiCP;;;;;;;;OAQG;IACH,qBAAqB,CACnB,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpE,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,GACxD,IAAI;IAwCP,WAAW,IAAI,IAAI;CAIpB"}
|
{"version":3,"file":"TileMapManager.d.ts","sourceRoot":"","sources":["../../src/render/TileMapManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,mBAAmB,CAAkC;;IAO7D;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;IAWzD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,kBAAkB,GAAG,IAAI;IAwBrD;;;;;;;OAOG;IACH,gBAAgB,CACd,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,GAClD,IAAI;IAiCP;;;;;;;;OAQG;IACH,qBAAqB,CACnB,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,OAAO,EACjD,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,GACxD,IAAI;IAwCP,WAAW,IAAI,IAAI;CAIpB"}
|
@@ -15,8 +15,8 @@ export declare namespace PixiTileMapHelper {
|
|||||||
function parseAtlas(
|
function parseAtlas(
|
||||||
tileMap: TileMapFileContent,
|
tileMap: TileMapFileContent,
|
||||||
levelIndex: number,
|
levelIndex: number,
|
||||||
atlasTexture: PIXI.BaseTexture<PIXI.Resource> | null,
|
atlasTexture: PIXI.Texture | null,
|
||||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>
|
getTexture: (textureName: string) => PIXI.Texture
|
||||||
): TileTextureCache | null;
|
): TileTextureCache | null;
|
||||||
/**
|
/**
|
||||||
* Re-renders the tile map whenever its rendering settings have been changed
|
* Re-renders the tile map whenever its rendering settings have been changed
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"TileMapPixiHelper.d.ts","sourceRoot":"","sources":["../../src/render/TileMapPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,EACpD,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,iBAAiB,CAC/B,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,EACxC,UAAU,EAAE,MAAM,GACjB,IAAI,CA0GN;IAED;;OAEG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAC3B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,KAAK,EACrB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,KAAK,GACjB,IAAI,CAgEN;CACF"}
|
{"version":3,"file":"TileMapPixiHelper.d.ts","sourceRoot":"","sources":["../../src/render/TileMapPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,EACjC,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,OAAO,GAChD,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,iBAAiB,CAC/B,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,EACxC,UAAU,EAAE,MAAM,GACjB,IAAI,CA0GN;IAED;;OAEG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAC3B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,KAAK,EACrB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,KAAK,GACjB,IAAI,CAgEN;CACF"}
|
@@ -1,7 +1,5 @@
|
|||||||
import { TileTextureCache } from '../TileTextureCache';
|
import { TileTextureCache } from '../TileTextureCache';
|
||||||
import { LDtkTileMap } from '../../load/ldtk/LDtkFormat';
|
import { LDtkTileMap } from '../../load/ldtk/LDtkFormat';
|
||||||
type Texture = PIXI.BaseTexture<PIXI.Resource>;
|
|
||||||
type TextureLoader = (textureName: string) => PIXI.BaseTexture<PIXI.Resource>;
|
|
||||||
export declare namespace LDtkPixiHelper {
|
export declare namespace LDtkPixiHelper {
|
||||||
/**
|
/**
|
||||||
* Split an atlas image into Pixi textures.
|
* Split an atlas image into Pixi textures.
|
||||||
@@ -15,9 +13,8 @@ export declare namespace LDtkPixiHelper {
|
|||||||
function parseAtlas(
|
function parseAtlas(
|
||||||
tileMap: LDtkTileMap,
|
tileMap: LDtkTileMap,
|
||||||
levelIndex: number,
|
levelIndex: number,
|
||||||
atlasTexture: Texture | null,
|
atlasTexture: PIXI.Texture | null,
|
||||||
getTexture: TextureLoader
|
getTexture: (textureName: string) => PIXI.Texture
|
||||||
): TileTextureCache | null;
|
): TileTextureCache | null;
|
||||||
}
|
}
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=LDtkPixiHelper.d.ts.map
|
//# sourceMappingURL=LDtkPixiHelper.d.ts.map
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"LDtkPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/ldtk/LDtkPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAkB,MAAM,4BAA4B,CAAC;AAGzE,KAAK,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,KAAK,aAAa,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAmC9E,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,GAAG,IAAI,EAC5B,UAAU,EAAE,aAAa,GACxB,gBAAgB,GAAG,IAAI,CAoFzB;CACF"}
|
{"version":3,"file":"LDtkPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/ldtk/LDtkPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAkB,MAAM,4BAA4B,CAAC;AAoCzE,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,EACjC,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,OAAO,GAChD,gBAAgB,GAAG,IAAI,CAoFzB;CACF"}
|
@@ -13,8 +13,8 @@ export declare namespace TiledPixiHelper {
|
|||||||
function parseAtlas(
|
function parseAtlas(
|
||||||
tileMap: TiledTileMap,
|
tileMap: TiledTileMap,
|
||||||
levelIndex: number,
|
levelIndex: number,
|
||||||
atlasTexture: PIXI.BaseTexture<PIXI.Resource> | null,
|
atlasTexture: PIXI.Texture | null,
|
||||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>
|
getTexture: (textureName: string) => PIXI.Texture
|
||||||
): TileTextureCache | null;
|
): TileTextureCache | null;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=TiledPixiHelper.d.ts.map
|
//# sourceMappingURL=TiledPixiHelper.d.ts.map
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"TiledPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/tiled/TiledPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,yBAAiB,eAAe,CAAC;IAC/B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,EACpD,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CA8FzB;CACF"}
|
{"version":3,"file":"TiledPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/tiled/TiledPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,yBAAiB,eAAe,CAAC;IAC/B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,EACjC,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,OAAO,GAChD,gBAAgB,GAAG,IAAI,CA8FzB;CACF"}
|
@@ -136,11 +136,7 @@ namespace gdjs {
|
|||||||
this._tilemapJsonFile,
|
this._tilemapJsonFile,
|
||||||
textureName
|
textureName
|
||||||
);
|
);
|
||||||
return (game
|
return game.getImageManager().getPIXITexture(mappedName);
|
||||||
.getImageManager()
|
|
||||||
.getPIXITexture(mappedName) as unknown) as PIXI.BaseTexture<
|
|
||||||
PIXI.Resource
|
|
||||||
>;
|
|
||||||
},
|
},
|
||||||
this._tilemapAtlasImage,
|
this._tilemapAtlasImage,
|
||||||
this._tilemapJsonFile,
|
this._tilemapJsonFile,
|
||||||
|
@@ -132,7 +132,7 @@ export class TileMapManager {
|
|||||||
tileSetJsonResourceName: string,
|
tileSetJsonResourceName: string,
|
||||||
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
||||||
) => void,
|
) => void,
|
||||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>,
|
getTexture: (textureName: string) => PIXI.Texture,
|
||||||
atlasImageResourceName: string,
|
atlasImageResourceName: string,
|
||||||
tileMapJsonResourceName: string,
|
tileMapJsonResourceName: string,
|
||||||
tileSetJsonResourceName: string,
|
tileSetJsonResourceName: string,
|
||||||
|
@@ -23,8 +23,8 @@ export namespace PixiTileMapHelper {
|
|||||||
export function parseAtlas(
|
export function parseAtlas(
|
||||||
tileMap: TileMapFileContent,
|
tileMap: TileMapFileContent,
|
||||||
levelIndex: number,
|
levelIndex: number,
|
||||||
atlasTexture: PIXI.BaseTexture<PIXI.Resource> | null,
|
atlasTexture: PIXI.Texture | null,
|
||||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>
|
getTexture: (textureName: string) => PIXI.Texture
|
||||||
): TileTextureCache | null {
|
): TileTextureCache | null {
|
||||||
if (tileMap.kind === "ldtk") {
|
if (tileMap.kind === "ldtk") {
|
||||||
return LDtkPixiHelper.parseAtlas(
|
return LDtkPixiHelper.parseAtlas(
|
||||||
|
@@ -2,20 +2,17 @@ import { TileTextureCache } from "../TileTextureCache";
|
|||||||
import { LDtkTileMap, LDtkTilesetDef } from "../../load/ldtk/LDtkFormat";
|
import { LDtkTileMap, LDtkTilesetDef } from "../../load/ldtk/LDtkFormat";
|
||||||
import { getLDtkTileId } from "../../load/ldtk/LDtkTileMapLoaderHelper";
|
import { getLDtkTileId } from "../../load/ldtk/LDtkTileMapLoaderHelper";
|
||||||
|
|
||||||
type Texture = PIXI.BaseTexture<PIXI.Resource>;
|
|
||||||
type TextureLoader = (textureName: string) => PIXI.BaseTexture<PIXI.Resource>;
|
|
||||||
|
|
||||||
function getAtlasTexture(
|
function getAtlasTexture(
|
||||||
atlasTextures: Record<number, Texture | null>,
|
atlasTextures: Record<number, PIXI.Texture | null>,
|
||||||
tilesetCache: Record<number, LDtkTilesetDef>,
|
tilesetCache: Record<number, LDtkTilesetDef>,
|
||||||
getTexture: TextureLoader,
|
getTexture: (textureName: string) => PIXI.Texture,
|
||||||
tilesetId: number
|
tilesetId: number
|
||||||
): Texture | null {
|
): PIXI.Texture | null {
|
||||||
if (atlasTextures[tilesetId]) {
|
if (atlasTextures[tilesetId]) {
|
||||||
return atlasTextures[tilesetId];
|
return atlasTextures[tilesetId];
|
||||||
}
|
}
|
||||||
|
|
||||||
let texture: Texture | null = null;
|
let texture: PIXI.Texture | null = null;
|
||||||
|
|
||||||
const tileset = tilesetCache[tilesetId];
|
const tileset = tilesetCache[tilesetId];
|
||||||
if (tileset?.relPath) {
|
if (tileset?.relPath) {
|
||||||
@@ -51,8 +48,8 @@ export namespace LDtkPixiHelper {
|
|||||||
export function parseAtlas(
|
export function parseAtlas(
|
||||||
tileMap: LDtkTileMap,
|
tileMap: LDtkTileMap,
|
||||||
levelIndex: number,
|
levelIndex: number,
|
||||||
atlasTexture: Texture | null,
|
atlasTexture: PIXI.Texture | null,
|
||||||
getTexture: TextureLoader
|
getTexture: (textureName: string) => PIXI.Texture
|
||||||
): TileTextureCache | null {
|
): TileTextureCache | null {
|
||||||
const level = tileMap.levels[levelIndex > -1 ? levelIndex : 0];
|
const level = tileMap.levels[levelIndex > -1 ? levelIndex : 0];
|
||||||
if (!level || !level.layerInstances) {
|
if (!level || !level.layerInstances) {
|
||||||
@@ -68,7 +65,7 @@ export namespace LDtkPixiHelper {
|
|||||||
// List the tiles that have been loaded to Pixi by all the layers of the level.
|
// List the tiles that have been loaded to Pixi by all the layers of the level.
|
||||||
// The keys are a composition (getLDtkTileId) between the tileset's id and the tile's id.
|
// The keys are a composition (getLDtkTileId) between the tileset's id and the tile's id.
|
||||||
const levelTileCache: Record<number, boolean> = {};
|
const levelTileCache: Record<number, boolean> = {};
|
||||||
const atlasTextures: Record<number, Texture | null> = {};
|
const atlasTextures: Record<number, PIXI.Texture | null> = {};
|
||||||
|
|
||||||
for (let iLayer = level.layerInstances.length - 1; iLayer >= 0; --iLayer) {
|
for (let iLayer = level.layerInstances.length - 1; iLayer >= 0; --iLayer) {
|
||||||
const layer = level.layerInstances[iLayer];
|
const layer = level.layerInstances[iLayer];
|
||||||
@@ -113,7 +110,7 @@ export namespace LDtkPixiHelper {
|
|||||||
const [x, y] = tile.src;
|
const [x, y] = tile.src;
|
||||||
const rect = new PIXI.Rectangle(x, y, gridSize, gridSize);
|
const rect = new PIXI.Rectangle(x, y, gridSize, gridSize);
|
||||||
|
|
||||||
const texture = new PIXI.Texture(atlasTexture, rect);
|
const texture = new PIXI.Texture(atlasTexture.baseTexture, rect);
|
||||||
|
|
||||||
textureCache.setTexture(tileId, texture);
|
textureCache.setTexture(tileId, texture);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -131,7 +128,7 @@ export namespace LDtkPixiHelper {
|
|||||||
if (level.bgRelPath) {
|
if (level.bgRelPath) {
|
||||||
const atlasTexture = getTexture(level.bgRelPath);
|
const atlasTexture = getTexture(level.bgRelPath);
|
||||||
const rect = new PIXI.Rectangle(0, 0, level.pxWid, level.pxHei);
|
const rect = new PIXI.Rectangle(0, 0, level.pxWid, level.pxHei);
|
||||||
const texture = new PIXI.Texture(atlasTexture!, rect);
|
const texture = new PIXI.Texture(atlasTexture!.baseTexture, rect);
|
||||||
|
|
||||||
textureCache.setLevelBackgroundTexture(level.bgRelPath, texture);
|
textureCache.setLevelBackgroundTexture(level.bgRelPath, texture);
|
||||||
}
|
}
|
||||||
|
@@ -15,8 +15,8 @@ export namespace TiledPixiHelper {
|
|||||||
export function parseAtlas(
|
export function parseAtlas(
|
||||||
tileMap: TiledTileMap,
|
tileMap: TiledTileMap,
|
||||||
levelIndex: number,
|
levelIndex: number,
|
||||||
atlasTexture: PIXI.BaseTexture<PIXI.Resource> | null,
|
atlasTexture: PIXI.Texture | null,
|
||||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>
|
getTexture: (textureName: string) => PIXI.Texture
|
||||||
): TileTextureCache | null {
|
): TileTextureCache | null {
|
||||||
if (!tileMap.tiledversion) {
|
if (!tileMap.tiledversion) {
|
||||||
console.warn(
|
console.warn(
|
||||||
@@ -99,7 +99,7 @@ export namespace TiledPixiHelper {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const rect = new PIXI.Rectangle(x, y, tilewidth, tileheight);
|
const rect = new PIXI.Rectangle(x, y, tilewidth, tileheight);
|
||||||
const texture = new PIXI.Texture(atlasTexture!, rect);
|
const texture = new PIXI.Texture(atlasTexture!.baseTexture, rect);
|
||||||
|
|
||||||
textureCache.setTexture(tileId, texture);
|
textureCache.setTexture(tileId, texture);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@@ -175,7 +175,7 @@ import useCreateProject from '../Utils/UseCreateProject';
|
|||||||
import newNameGenerator from '../Utils/NewNameGenerator';
|
import newNameGenerator from '../Utils/NewNameGenerator';
|
||||||
import { addDefaultLightToAllLayers } from '../ProjectCreation/CreateProject';
|
import { addDefaultLightToAllLayers } from '../ProjectCreation/CreateProject';
|
||||||
import useEditorTabsStateSaving from './EditorTabs/UseEditorTabsStateSaving';
|
import useEditorTabsStateSaving from './EditorTabs/UseEditorTabsStateSaving';
|
||||||
import PixiResourcesLoader from '../ObjectsRendering/PixiResourcesLoader';
|
import { pixiResourcesLoader } from '../ObjectsRendering/PixiResourcesLoader';
|
||||||
import useResourcesWatcher from './ResourcesWatcher';
|
import useResourcesWatcher from './ResourcesWatcher';
|
||||||
import { extractGDevelopApiErrorStatusAndCode } from '../Utils/GDevelopServices/Errors';
|
import { extractGDevelopApiErrorStatusAndCode } from '../Utils/GDevelopServices/Errors';
|
||||||
import useVersionHistory from '../VersionHistory/UseVersionHistory';
|
import useVersionHistory from '../VersionHistory/UseVersionHistory';
|
||||||
@@ -901,7 +901,7 @@ const MainFrame = (props: Props) => {
|
|||||||
// the URL to a resource with a name in the old project is not re-used
|
// the URL to a resource with a name in the old project is not re-used
|
||||||
// for another resource with the same name in the new project.
|
// for another resource with the same name in the new project.
|
||||||
ResourcesLoader.burstAllUrlsCache();
|
ResourcesLoader.burstAllUrlsCache();
|
||||||
PixiResourcesLoader.burstCache();
|
pixiResourcesLoader.burstCache();
|
||||||
|
|
||||||
const state = await setState(state => ({
|
const state = await setState(state => ({
|
||||||
...state,
|
...state,
|
||||||
|
@@ -25,7 +25,7 @@ import { makeDragSourceAndDropTarget } from '../../UI/DragAndDrop/DragSourceAndD
|
|||||||
import { DragHandleIcon } from '../../UI/DragHandle';
|
import { DragHandleIcon } from '../../UI/DragHandle';
|
||||||
import DropIndicator from '../../UI/SortableVirtualizedItemList/DropIndicator';
|
import DropIndicator from '../../UI/SortableVirtualizedItemList/DropIndicator';
|
||||||
import GDevelopThemeContext from '../../UI/Theme/GDevelopThemeContext';
|
import GDevelopThemeContext from '../../UI/Theme/GDevelopThemeContext';
|
||||||
import PixiResourcesLoader from '../../ObjectsRendering/PixiResourcesLoader';
|
import { pixiResourcesLoader } from '../../ObjectsRendering/PixiResourcesLoader';
|
||||||
import useAlertDialog from '../../UI/Alert/useAlertDialog';
|
import useAlertDialog from '../../UI/Alert/useAlertDialog';
|
||||||
import { type GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
import { type GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
||||||
import * as SkeletonUtils from 'three/examples/jsm/utils/SkeletonUtils';
|
import * as SkeletonUtils from 'three/examples/jsm/utils/SkeletonUtils';
|
||||||
@@ -155,7 +155,7 @@ const Model3DEditor = ({
|
|||||||
const [gltf, setGltf] = React.useState<GLTF | null>(null);
|
const [gltf, setGltf] = React.useState<GLTF | null>(null);
|
||||||
const loadGltf = React.useCallback(
|
const loadGltf = React.useCallback(
|
||||||
async (modelResourceName: string) => {
|
async (modelResourceName: string) => {
|
||||||
const newModel3d = await PixiResourcesLoader.get3DModel(
|
const newModel3d = await pixiResourcesLoader.get3DModel(
|
||||||
project,
|
project,
|
||||||
modelResourceName
|
modelResourceName
|
||||||
);
|
);
|
||||||
|
@@ -24,7 +24,8 @@ import { makeDragSourceAndDropTarget } from '../../UI/DragAndDrop/DragSourceAndD
|
|||||||
import { DragHandleIcon } from '../../UI/DragHandle';
|
import { DragHandleIcon } from '../../UI/DragHandle';
|
||||||
import DropIndicator from '../../UI/SortableVirtualizedItemList/DropIndicator';
|
import DropIndicator from '../../UI/SortableVirtualizedItemList/DropIndicator';
|
||||||
import GDevelopThemeContext from '../../UI/Theme/GDevelopThemeContext';
|
import GDevelopThemeContext from '../../UI/Theme/GDevelopThemeContext';
|
||||||
import PixiResourcesLoader, {
|
import {
|
||||||
|
pixiResourcesLoader,
|
||||||
type SpineDataOrLoadingError,
|
type SpineDataOrLoadingError,
|
||||||
} from '../../ObjectsRendering/PixiResourcesLoader';
|
} from '../../ObjectsRendering/PixiResourcesLoader';
|
||||||
import useAlertDialog from '../../UI/Alert/useAlertDialog';
|
import useAlertDialog from '../../UI/Alert/useAlertDialog';
|
||||||
@@ -109,7 +110,7 @@ const SpineEditor = ({
|
|||||||
React.useEffect(
|
React.useEffect(
|
||||||
() => {
|
() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const spineData = await PixiResourcesLoader.getSpineData(
|
const spineData = await pixiResourcesLoader.getSpineData(
|
||||||
project,
|
project,
|
||||||
spineResourceName
|
spineResourceName
|
||||||
);
|
);
|
||||||
|
@@ -10,7 +10,7 @@ import RenderedTextEntryInstance from './Renderers/RenderedTextEntryInstance';
|
|||||||
import RenderedParticleEmitterInstance from './Renderers/RenderedParticleEmitterInstance';
|
import RenderedParticleEmitterInstance from './Renderers/RenderedParticleEmitterInstance';
|
||||||
import RenderedCustomObjectInstance from './Renderers/RenderedCustomObjectInstance';
|
import RenderedCustomObjectInstance from './Renderers/RenderedCustomObjectInstance';
|
||||||
import RenderedSprite3DInstance from './Renderers/RenderedSprite3DInstance';
|
import RenderedSprite3DInstance from './Renderers/RenderedSprite3DInstance';
|
||||||
import PixiResourcesLoader from './PixiResourcesLoader';
|
import { pixiResourcesLoader } from './PixiResourcesLoader';
|
||||||
import ResourcesLoader from '../ResourcesLoader';
|
import ResourcesLoader from '../ResourcesLoader';
|
||||||
import RenderedInstance from './Renderers/RenderedInstance';
|
import RenderedInstance from './Renderers/RenderedInstance';
|
||||||
import Rendered3DInstance from './Renderers/Rendered3DInstance';
|
import Rendered3DInstance from './Renderers/Rendered3DInstance';
|
||||||
@@ -90,7 +90,7 @@ const ObjectsRenderingService = {
|
|||||||
associatedObjectConfiguration,
|
associatedObjectConfiguration,
|
||||||
pixiContainer,
|
pixiContainer,
|
||||||
threeGroup,
|
threeGroup,
|
||||||
PixiResourcesLoader
|
pixiResourcesLoader
|
||||||
);
|
);
|
||||||
} else if (this.renderers.hasOwnProperty(objectType))
|
} else if (this.renderers.hasOwnProperty(objectType))
|
||||||
return new this.renderers[objectType](
|
return new this.renderers[objectType](
|
||||||
@@ -99,7 +99,7 @@ const ObjectsRenderingService = {
|
|||||||
instance,
|
instance,
|
||||||
associatedObjectConfiguration,
|
associatedObjectConfiguration,
|
||||||
pixiContainer,
|
pixiContainer,
|
||||||
PixiResourcesLoader
|
pixiResourcesLoader
|
||||||
);
|
);
|
||||||
else {
|
else {
|
||||||
if (project.hasEventsBasedObject(objectType)) {
|
if (project.hasEventsBasedObject(objectType)) {
|
||||||
@@ -116,7 +116,7 @@ const ObjectsRenderingService = {
|
|||||||
associatedObjectConfiguration,
|
associatedObjectConfiguration,
|
||||||
pixiContainer,
|
pixiContainer,
|
||||||
threeGroup,
|
threeGroup,
|
||||||
PixiResourcesLoader
|
pixiResourcesLoader
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return new RenderedCustomObjectInstance(
|
return new RenderedCustomObjectInstance(
|
||||||
@@ -126,7 +126,7 @@ const ObjectsRenderingService = {
|
|||||||
associatedObjectConfiguration,
|
associatedObjectConfiguration,
|
||||||
pixiContainer,
|
pixiContainer,
|
||||||
threeGroup,
|
threeGroup,
|
||||||
PixiResourcesLoader
|
pixiResourcesLoader
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ const ObjectsRenderingService = {
|
|||||||
instance,
|
instance,
|
||||||
associatedObjectConfiguration,
|
associatedObjectConfiguration,
|
||||||
pixiContainer,
|
pixiContainer,
|
||||||
PixiResourcesLoader
|
pixiResourcesLoader
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -234,7 +234,7 @@ const getEmbedderResources = (
|
|||||||
* This internally uses ResourcesLoader to get the URL of the resources.
|
* This internally uses ResourcesLoader to get the URL of the resources.
|
||||||
*/
|
*/
|
||||||
export default class PixiResourcesLoader {
|
export default class PixiResourcesLoader {
|
||||||
static burstCache() {
|
burstCache() {
|
||||||
loadedBitmapFonts = {};
|
loadedBitmapFonts = {};
|
||||||
loadedFontFamilies = {};
|
loadedFontFamilies = {};
|
||||||
loadedTextures = {};
|
loadedTextures = {};
|
||||||
@@ -245,7 +245,7 @@ export default class PixiResourcesLoader {
|
|||||||
spineDataPromises = {};
|
spineDataPromises = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static async _reloadEmbedderResources(
|
async _reloadEmbedderResources(
|
||||||
project: gdProject,
|
project: gdProject,
|
||||||
embeddedResourceName: string,
|
embeddedResourceName: string,
|
||||||
embedderResourceKind: ResourceKind
|
embedderResourceKind: ResourceKind
|
||||||
@@ -262,7 +262,7 @@ export default class PixiResourcesLoader {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async reloadResource(project: gdProject, resourceName: string) {
|
async reloadResource(project: gdProject, resourceName: string) {
|
||||||
const loadedTexture = loadedTextures[resourceName];
|
const loadedTexture = loadedTextures[resourceName];
|
||||||
if (loadedTexture && loadedTexture.textureCacheIds) {
|
if (loadedTexture && loadedTexture.textureCacheIds) {
|
||||||
// The property textureCacheIds indicates that the PIXI.Texture object has some
|
// The property textureCacheIds indicates that the PIXI.Texture object has some
|
||||||
@@ -279,7 +279,7 @@ export default class PixiResourcesLoader {
|
|||||||
await this._reloadEmbedderResources(project, resourceName, 'atlas');
|
await this._reloadEmbedderResources(project, resourceName, 'atlas');
|
||||||
}
|
}
|
||||||
|
|
||||||
await PixiResourcesLoader.loadTextures(project, [resourceName]);
|
await this.reloadResources(project, [resourceName]);
|
||||||
|
|
||||||
if (loadedOrLoading3DModelPromises[resourceName]) {
|
if (loadedOrLoading3DModelPromises[resourceName]) {
|
||||||
delete loadedOrLoading3DModelPromises[resourceName];
|
delete loadedOrLoading3DModelPromises[resourceName];
|
||||||
@@ -333,9 +333,9 @@ export default class PixiResourcesLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* (Re)load the PIXI texture represented by the given resources.
|
* Reload the the given resources.
|
||||||
*/
|
*/
|
||||||
static async loadTextures(
|
async reloadResources(
|
||||||
project: gdProject,
|
project: gdProject,
|
||||||
resourceNames: Array<string>
|
resourceNames: Array<string>
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -449,7 +449,7 @@ export default class PixiResourcesLoader {
|
|||||||
* should listen to PIXI.Texture `update` event, and refresh your object
|
* should listen to PIXI.Texture `update` event, and refresh your object
|
||||||
* if this event is triggered.
|
* if this event is triggered.
|
||||||
*/
|
*/
|
||||||
static getPIXITexture(project: gdProject, resourceName: string) {
|
getPIXITexture(project: gdProject, resourceName: string) {
|
||||||
if (loadedTextures[resourceName]) {
|
if (loadedTextures[resourceName]) {
|
||||||
// TODO: we never consider textures as not valid anymore. When we
|
// TODO: we never consider textures as not valid anymore. When we
|
||||||
// update the IDE to unload textures, we should handle loading them again
|
// update the IDE to unload textures, we should handle loading them again
|
||||||
@@ -494,20 +494,14 @@ export default class PixiResourcesLoader {
|
|||||||
* @param resourceName The name of the resource
|
* @param resourceName The name of the resource
|
||||||
* @returns The requested texture, or a placeholder if not found.
|
* @returns The requested texture, or a placeholder if not found.
|
||||||
*/
|
*/
|
||||||
static getThreeTexture(
|
getThreeTexture(project: gdProject, resourceName: string): THREE.Texture {
|
||||||
project: gdProject,
|
|
||||||
resourceName: string
|
|
||||||
): THREE.Texture {
|
|
||||||
const loadedThreeTexture = loadedThreeTextures[resourceName];
|
const loadedThreeTexture = loadedThreeTextures[resourceName];
|
||||||
if (loadedThreeTexture) return loadedThreeTexture;
|
if (loadedThreeTexture) return loadedThreeTexture;
|
||||||
|
|
||||||
// Texture is not loaded, load it now from the PixiJS texture.
|
// Texture is not loaded, load it now from the PixiJS texture.
|
||||||
// TODO (3D) - optimization: don't load the PixiJS Texture if not used by PixiJS.
|
// TODO (3D) - optimization: don't load the PixiJS Texture if not used by PixiJS.
|
||||||
// TODO (3D) - optimization: Ideally we could even share the same WebGL texture.
|
// TODO (3D) - optimization: Ideally we could even share the same WebGL texture.
|
||||||
const pixiTexture = PixiResourcesLoader.getPIXITexture(
|
const pixiTexture = this.getPIXITexture(project, resourceName);
|
||||||
project,
|
|
||||||
resourceName
|
|
||||||
);
|
|
||||||
|
|
||||||
// @ts-ignore - source does exist on resource.
|
// @ts-ignore - source does exist on resource.
|
||||||
const image = pixiTexture.baseTexture.resource.source;
|
const image = pixiTexture.baseTexture.resource.source;
|
||||||
@@ -540,7 +534,7 @@ export default class PixiResourcesLoader {
|
|||||||
* @param options Set if the material should be transparent or not.
|
* @param options Set if the material should be transparent or not.
|
||||||
* @returns The requested material.
|
* @returns The requested material.
|
||||||
*/
|
*/
|
||||||
static getThreeMaterial(
|
getThreeMaterial(
|
||||||
project: gdProject,
|
project: gdProject,
|
||||||
resourceName: string,
|
resourceName: string,
|
||||||
{ useTransparentTexture }: {| useTransparentTexture: boolean |}
|
{ useTransparentTexture }: {| useTransparentTexture: boolean |}
|
||||||
@@ -566,7 +560,7 @@ export default class PixiResourcesLoader {
|
|||||||
* @param options
|
* @param options
|
||||||
* @returns The requested material.
|
* @returns The requested material.
|
||||||
*/
|
*/
|
||||||
static get3DModel(
|
get3DModel(
|
||||||
project: gdProject,
|
project: gdProject,
|
||||||
resourceName: string
|
resourceName: string
|
||||||
): Promise<THREE.THREE_ADDONS.GLTF> {
|
): Promise<THREE.THREE_ADDONS.GLTF> {
|
||||||
@@ -584,7 +578,7 @@ export default class PixiResourcesLoader {
|
|||||||
* @param spineTextureAtlasName The name of the atlas texture resource.
|
* @param spineTextureAtlasName The name of the atlas texture resource.
|
||||||
* @returns The requested texture atlas, or null if it could not be loaded.
|
* @returns The requested texture atlas, or null if it could not be loaded.
|
||||||
*/
|
*/
|
||||||
static async _getSpineTextureAtlas(
|
async _getSpineTextureAtlas(
|
||||||
project: gdProject,
|
project: gdProject,
|
||||||
spineTextureAtlasName: string
|
spineTextureAtlasName: string
|
||||||
): Promise<SpineTextureAtlasOrLoadingError> {
|
): Promise<SpineTextureAtlasOrLoadingError> {
|
||||||
@@ -707,7 +701,7 @@ export default class PixiResourcesLoader {
|
|||||||
* @param spineName The name of the spine json resource
|
* @param spineName The name of the spine json resource
|
||||||
* @returns The requested spine skeleton.
|
* @returns The requested spine skeleton.
|
||||||
*/
|
*/
|
||||||
static async getSpineData(
|
async getSpineData(
|
||||||
project: gdProject,
|
project: gdProject,
|
||||||
spineName: string
|
spineName: string
|
||||||
): Promise<SpineDataOrLoadingError> {
|
): Promise<SpineDataOrLoadingError> {
|
||||||
@@ -811,7 +805,7 @@ export default class PixiResourcesLoader {
|
|||||||
* should listen to PIXI.Texture `update` event, and refresh your object
|
* should listen to PIXI.Texture `update` event, and refresh your object
|
||||||
* if this event is triggered.
|
* if this event is triggered.
|
||||||
*/
|
*/
|
||||||
static getPIXIVideoTexture(project: gdProject, resourceName: string) {
|
getPIXIVideoTexture(project: gdProject, resourceName: string) {
|
||||||
if (loadedTextures[resourceName]) {
|
if (loadedTextures[resourceName]) {
|
||||||
// TODO: we never consider textures as not valid anymore. When we
|
// TODO: we never consider textures as not valid anymore. When we
|
||||||
// update the IDE to unload textures, we should handle loading them again
|
// update the IDE to unload textures, we should handle loading them again
|
||||||
@@ -860,10 +854,7 @@ export default class PixiResourcesLoader {
|
|||||||
* @returns a Promise that resolves with the font-family to be used
|
* @returns a Promise that resolves with the font-family to be used
|
||||||
* to render a text with the font.
|
* to render a text with the font.
|
||||||
*/
|
*/
|
||||||
static loadFontFamily(
|
loadFontFamily(project: gdProject, resourceName: string): Promise<string> {
|
||||||
project: gdProject,
|
|
||||||
resourceName: string
|
|
||||||
): Promise<string> {
|
|
||||||
// Avoid reloading a font if it's already cached
|
// Avoid reloading a font if it's already cached
|
||||||
if (loadedFontFamilies[resourceName]) {
|
if (loadedFontFamilies[resourceName]) {
|
||||||
return Promise.resolve(loadedFontFamilies[resourceName]);
|
return Promise.resolve(loadedFontFamilies[resourceName]);
|
||||||
@@ -909,7 +900,7 @@ export default class PixiResourcesLoader {
|
|||||||
* The font won't be loaded.
|
* The font won't be loaded.
|
||||||
* @returns The font-family to be used to render a text with the font.
|
* @returns The font-family to be used to render a text with the font.
|
||||||
*/
|
*/
|
||||||
static getFontFamily(project: gdProject, resourceName: string) {
|
getFontFamily(project: gdProject, resourceName: string) {
|
||||||
if (loadedFontFamilies[resourceName]) {
|
if (loadedFontFamilies[resourceName]) {
|
||||||
return loadedFontFamilies[resourceName];
|
return loadedFontFamilies[resourceName];
|
||||||
}
|
}
|
||||||
@@ -921,10 +912,7 @@ export default class PixiResourcesLoader {
|
|||||||
/**
|
/**
|
||||||
* Get the data from a bitmap font file (fnt/xml) resource in the IDE.
|
* Get the data from a bitmap font file (fnt/xml) resource in the IDE.
|
||||||
*/
|
*/
|
||||||
static getBitmapFontData(
|
getBitmapFontData(project: gdProject, resourceName: string): Promise<any> {
|
||||||
project: gdProject,
|
|
||||||
resourceName: string
|
|
||||||
): Promise<any> {
|
|
||||||
if (loadedBitmapFonts[resourceName]) {
|
if (loadedBitmapFonts[resourceName]) {
|
||||||
return Promise.resolve(loadedBitmapFonts[resourceName].data);
|
return Promise.resolve(loadedBitmapFonts[resourceName].data);
|
||||||
}
|
}
|
||||||
@@ -963,17 +951,14 @@ export default class PixiResourcesLoader {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInvalidPIXITexture() {
|
getInvalidPIXITexture() {
|
||||||
return invalidTexture;
|
return invalidTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data from a json resource in the IDE.
|
* Get the data from a json resource in the IDE.
|
||||||
*/
|
*/
|
||||||
static getResourceJsonData(
|
getResourceJsonData(project: gdProject, resourceName: string): Promise<any> {
|
||||||
project: gdProject,
|
|
||||||
resourceName: string
|
|
||||||
): Promise<any> {
|
|
||||||
if (!project.getResourcesManager().hasResource(resourceName))
|
if (!project.getResourcesManager().hasResource(resourceName))
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error(`Can't find resource called ${resourceName}.`)
|
new Error(`Can't find resource called ${resourceName}.`)
|
||||||
@@ -999,3 +984,6 @@ export default class PixiResourcesLoader {
|
|||||||
.then(response => response.data);
|
.then(response => response.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The global, unique instance of PixiResourcesLoader. */
|
||||||
|
export const pixiResourcesLoader = new PixiResourcesLoader();
|
||||||
|
@@ -15,7 +15,7 @@ export default class Rendered3DInstance {
|
|||||||
_associatedObjectConfiguration: gdObjectConfiguration;
|
_associatedObjectConfiguration: gdObjectConfiguration;
|
||||||
_pixiContainer: PIXI.Container;
|
_pixiContainer: PIXI.Container;
|
||||||
_threeGroup: THREE.Group;
|
_threeGroup: THREE.Group;
|
||||||
_pixiResourcesLoader: Class<PixiResourcesLoader>;
|
_pixiResourcesLoader: PixiResourcesLoader;
|
||||||
_pixiObject: PIXI.DisplayObject;
|
_pixiObject: PIXI.DisplayObject;
|
||||||
_threeObject: THREE.Object3D | null;
|
_threeObject: THREE.Object3D | null;
|
||||||
wasUsed: boolean;
|
wasUsed: boolean;
|
||||||
@@ -27,7 +27,7 @@ export default class Rendered3DInstance {
|
|||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
threeGroup: THREE.Group,
|
threeGroup: THREE.Group,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
this._pixiObject = null;
|
this._pixiObject = null;
|
||||||
this._threeObject = null;
|
this._threeObject = null;
|
||||||
|
@@ -45,7 +45,7 @@ export default class RenderedCustomObjectInstance extends Rendered3DInstance
|
|||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
threeGroup: THREE.Group,
|
threeGroup: THREE.Group,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
@@ -175,7 +175,7 @@ export default class RenderedCustomObjectInstance extends Rendered3DInstance
|
|||||||
if (this.childrenRenderedInstances.length === 0) {
|
if (this.childrenRenderedInstances.length === 0) {
|
||||||
// Show a placeholder.
|
// Show a placeholder.
|
||||||
this._pixiObject = new PIXI.Sprite(
|
this._pixiObject = new PIXI.Sprite(
|
||||||
PixiResourcesLoader.getInvalidPIXITexture()
|
this._pixiResourcesLoader.getInvalidPIXITexture()
|
||||||
);
|
);
|
||||||
this._pixiContainer.addChild(this._pixiObject);
|
this._pixiContainer.addChild(this._pixiObject);
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ export default function makeRenderer(iconPath: string) {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
|
@@ -12,7 +12,7 @@ export default class RenderedInstance {
|
|||||||
_instance: gdInitialInstance;
|
_instance: gdInitialInstance;
|
||||||
_associatedObjectConfiguration: gdObjectConfiguration;
|
_associatedObjectConfiguration: gdObjectConfiguration;
|
||||||
_pixiContainer: PIXI.Container;
|
_pixiContainer: PIXI.Container;
|
||||||
_pixiResourcesLoader: Class<PixiResourcesLoader>;
|
_pixiResourcesLoader: PixiResourcesLoader;
|
||||||
_pixiObject: PIXI.DisplayObject;
|
_pixiObject: PIXI.DisplayObject;
|
||||||
wasUsed: boolean;
|
wasUsed: boolean;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ export default class RenderedInstance {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
this._pixiObject = null;
|
this._pixiObject = null;
|
||||||
this._instance = instance;
|
this._instance = instance;
|
||||||
|
@@ -28,7 +28,7 @@ export default class RenderedPanelSpriteInstance extends RenderedInstance {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
@@ -86,7 +86,7 @@ export default class RenderedPanelSpriteInstance extends RenderedInstance {
|
|||||||
this._associatedObjectConfiguration
|
this._associatedObjectConfiguration
|
||||||
);
|
);
|
||||||
this._textureName = panelSprite.getTexture();
|
this._textureName = panelSprite.getTexture();
|
||||||
const texture = PixiResourcesLoader.getPIXITexture(
|
const texture = this._pixiResourcesLoader.getPIXITexture(
|
||||||
this._project,
|
this._project,
|
||||||
this._textureName
|
this._textureName
|
||||||
);
|
);
|
||||||
@@ -237,7 +237,7 @@ export default class RenderedPanelSpriteInstance extends RenderedInstance {
|
|||||||
this._associatedObjectConfiguration
|
this._associatedObjectConfiguration
|
||||||
);
|
);
|
||||||
this._textureName = panelSprite.getTexture();
|
this._textureName = panelSprite.getTexture();
|
||||||
const texture = PixiResourcesLoader.getPIXITexture(
|
const texture = this._pixiResourcesLoader.getPIXITexture(
|
||||||
this._project,
|
this._project,
|
||||||
this._textureName
|
this._textureName
|
||||||
);
|
);
|
||||||
|
@@ -16,7 +16,7 @@ export default class RenderedParticleEmitterInstance extends RenderedInstance {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
|
@@ -29,7 +29,7 @@ export default class RenderedSprite3DInstance extends Rendered3DInstance {
|
|||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
threeGroup: THREE.Group,
|
threeGroup: THREE.Group,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
|
@@ -24,7 +24,7 @@ export default class RenderedSpriteInstance extends RenderedInstance {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
|
@@ -38,7 +38,7 @@ export default class RenderedTextInstance extends RenderedInstance {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
@@ -133,10 +133,8 @@ export default class RenderedTextInstance extends RenderedInstance {
|
|||||||
if (this._fontName !== textObjectConfiguration.getFontName()) {
|
if (this._fontName !== textObjectConfiguration.getFontName()) {
|
||||||
//Avoid calling loadFontFamily if the font didn't changed.
|
//Avoid calling loadFontFamily if the font didn't changed.
|
||||||
this._fontName = textObjectConfiguration.getFontName();
|
this._fontName = textObjectConfiguration.getFontName();
|
||||||
PixiResourcesLoader.loadFontFamily(
|
this._pixiResourcesLoader
|
||||||
this._project,
|
.loadFontFamily(this._project, textObjectConfiguration.getFontName())
|
||||||
textObjectConfiguration.getFontName()
|
|
||||||
)
|
|
||||||
.then(fontFamily => {
|
.then(fontFamily => {
|
||||||
// Once the font is loaded, we can use the given fontFamily.
|
// Once the font is loaded, we can use the given fontFamily.
|
||||||
this._fontFamily = fontFamily;
|
this._fontFamily = fontFamily;
|
||||||
|
@@ -17,7 +17,7 @@ export default class RenderedTiledSpriteInstance extends RenderedInstance {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
@@ -34,7 +34,10 @@ export default class RenderedTiledSpriteInstance extends RenderedInstance {
|
|||||||
);
|
);
|
||||||
this._texture = tiledSprite.getTexture();
|
this._texture = tiledSprite.getTexture();
|
||||||
this._pixiObject = new PIXI.TilingSprite(
|
this._pixiObject = new PIXI.TilingSprite(
|
||||||
PixiResourcesLoader.getPIXITexture(project, tiledSprite.getTexture()),
|
this._pixiResourcesLoader.getPIXITexture(
|
||||||
|
project,
|
||||||
|
tiledSprite.getTexture()
|
||||||
|
),
|
||||||
tiledSprite.getWidth(),
|
tiledSprite.getWidth(),
|
||||||
tiledSprite.getHeight()
|
tiledSprite.getHeight()
|
||||||
);
|
);
|
||||||
@@ -80,7 +83,7 @@ export default class RenderedTiledSpriteInstance extends RenderedInstance {
|
|||||||
|
|
||||||
if (this._texture !== tiledSprite.getTexture()) {
|
if (this._texture !== tiledSprite.getTexture()) {
|
||||||
this._texture = tiledSprite.getTexture();
|
this._texture = tiledSprite.getTexture();
|
||||||
this._pixiObject.texture = PixiResourcesLoader.getPIXITexture(
|
this._pixiObject.texture = this._pixiResourcesLoader.getPIXITexture(
|
||||||
this._project,
|
this._project,
|
||||||
tiledSprite.getTexture()
|
tiledSprite.getTexture()
|
||||||
);
|
);
|
||||||
|
@@ -14,7 +14,7 @@ export default class RenderedUnknownInstance extends RenderedInstance {
|
|||||||
instance: gdInitialInstance,
|
instance: gdInitialInstance,
|
||||||
associatedObjectConfiguration: gdObjectConfiguration,
|
associatedObjectConfiguration: gdObjectConfiguration,
|
||||||
pixiContainer: PIXI.Container,
|
pixiContainer: PIXI.Container,
|
||||||
pixiResourcesLoader: Class<PixiResourcesLoader>
|
pixiResourcesLoader: PixiResourcesLoader
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
project,
|
project,
|
||||||
|
@@ -38,7 +38,7 @@ import {
|
|||||||
getHistoryInitialState,
|
getHistoryInitialState,
|
||||||
saveToHistory,
|
saveToHistory,
|
||||||
} from '../Utils/History';
|
} from '../Utils/History';
|
||||||
import PixiResourcesLoader from '../ObjectsRendering/PixiResourcesLoader';
|
import { pixiResourcesLoader } from '../ObjectsRendering/PixiResourcesLoader';
|
||||||
import {
|
import {
|
||||||
type ObjectWithContext,
|
type ObjectWithContext,
|
||||||
type GroupWithContext,
|
type GroupWithContext,
|
||||||
@@ -236,7 +236,7 @@ export default class SceneEditor extends React.Component<Props, State> {
|
|||||||
// through the RenderedInstance's, triggering crashes. So the scene rendering
|
// through the RenderedInstance's, triggering crashes. So the scene rendering
|
||||||
// is paused during this period.
|
// is paused during this period.
|
||||||
editorDisplay.startSceneRendering(false);
|
editorDisplay.startSceneRendering(false);
|
||||||
await PixiResourcesLoader.reloadResource(project, resourceName);
|
await pixiResourcesLoader.reloadResource(project, resourceName);
|
||||||
|
|
||||||
editorDisplay.forceUpdateObjectsList();
|
editorDisplay.forceUpdateObjectsList();
|
||||||
|
|
||||||
@@ -1610,12 +1610,14 @@ export default class SceneEditor extends React.Component<Props, State> {
|
|||||||
.toJSArray();
|
.toJSArray();
|
||||||
resourcesInUse.delete();
|
resourcesInUse.delete();
|
||||||
|
|
||||||
PixiResourcesLoader.loadTextures(project, objectResourceNames).then(() => {
|
pixiResourcesLoader
|
||||||
if (this.editorDisplay)
|
.reloadResources(project, objectResourceNames)
|
||||||
this.editorDisplay.instancesHandlers.resetInstanceRenderersFor(
|
.then(() => {
|
||||||
object.getName()
|
if (this.editorDisplay)
|
||||||
);
|
this.editorDisplay.instancesHandlers.resetInstanceRenderersFor(
|
||||||
});
|
object.getName()
|
||||||
|
);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Reference in New Issue
Block a user