Skip to content

Commit

Permalink
pixi checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie committed Feb 13, 2024
1 parent d803307 commit 30656f1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/chrome/src/inject/devtool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function getPixiWrapper(): Pixi {
version: () => pixiWrapper!.pixi().VERSION,
properties: properties(),
detectPixi: () => {
return pixiWrapper!.app() || pixiWrapper!.stage() || pixiWrapper!.renderer()
return pixiWrapper!.pixi() && (pixiWrapper!.app() || pixiWrapper!.stage() || pixiWrapper!.renderer())
? MessageType.Active
: MessageType.Inactive;
},
Expand Down
3 changes: 3 additions & 0 deletions src/chrome/src/inject/properties/AnimatedSpritePropsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export const AnimatedSpritePropsPlugin: PropertyPlugin<AnimatedSprite> = {
props: [
{ section: 'Transform', property: 'roundPixels', propertyProps: { label: 'Round Pixels' }, type: 'boolean' },
// { section: 'Animated Sprite', property: 'textures', propertyProps: { label: 'Textures' }, type: 'text' },
{ section: 'Animated Sprite', property: 'animationSpeed', propertyProps: { label: 'Animation Speed' }, type: 'number' },
{ section: 'Animated Sprite', property: 'loop', propertyProps: { label: 'Loop' }, type: 'boolean' },
{ section: 'Animated Sprite', property: 'updateAnchor', propertyProps: { label: 'Update Anchor' }, type: 'boolean' },
{ section: 'Animated Sprite', property: 'totalFrames', propertyProps: { label: 'Total Frames' }, type: 'number' },
{ section: 'Animated Sprite', property: 'currentFrame', propertyProps: { label: 'Current Frame' }, type: 'number' },
{ section: 'Animated Sprite', property: 'autoUpdate', propertyProps: { label: 'Auto Update' }, type: 'boolean' },
Expand Down
4 changes: 3 additions & 1 deletion src/chrome/src/inject/properties/ContainerPropsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const ContainerPropsPlugin: PropertyPlugin = {
return { value: container.constructor.name, prop };
}

if(!pixi) return { value: null, prop };

if (value instanceof pixi.Matrix) {
return { value: value.toArray(), prop };
} else if (value instanceof pixi.Point) {
Expand All @@ -37,7 +39,7 @@ export const ContainerPropsPlugin: PropertyPlugin = {
}
const pixi = getPixiWrapper().pixi();

console.log('Setting prop', prop, value);
if(!pixi) return;

if (container[prop as keyof Container] instanceof pixi.Matrix) {
(container[prop as keyof Container] as Matrix).fromArray(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ export const TilingSpritePropsPlugin: PropertyPlugin<TilingSprite> = {
type: 'vector2',
},
{ section: 'Tiling Sprite', property: 'tileRotation', propertyProps: { label: 'Tile Rotation' }, type: 'number' },
{ section: 'Tiling Sprite', property: 'clampMargin', propertyProps: { label: 'Clamp Margin' }, type: 'number' },
],
};
2 changes: 2 additions & 0 deletions src/chrome/src/inject/utils/getPixiType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export function getPixiType(container: Container): PixiSceneObjectType {
const pixiWrapper = getPixiWrapper();
const pixi = pixiWrapper.pixi();

if (!pixi) return 'Unknown';

if (container instanceof pixi.BitmapText) {
return 'BitmapText';
} else if (container instanceof pixi.HTMLText) {
Expand Down

0 comments on commit 30656f1

Please sign in to comment.