-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
113 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
packages/devtool-chrome/src/inject/scene/tree/plugins/AnimatedSpriteProperties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
packages/devtool-chrome/src/inject/scene/tree/plugins/SpriteProperties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
packages/devtool-chrome/src/inject/scene/tree/plugins/TextProperties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
packages/devtool-chrome/src/inject/scene/tree/plugins/TilingSpriteProperties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 26 additions & 19 deletions
45
packages/devtool-chrome/src/inject/scene/tree/properties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,60 @@ | ||
import type { PropertyPanelData } from '@devtool/frontend/pages/scene/scene-tree/Properties'; | ||
import type { PropertyPlugin } from '@pixi/devtools'; | ||
import type { PixiDevtools } from '../../pixi'; | ||
import { AnimatedSpritePropertiesPlugin } from './plugins/AnimatedSpriteProperties'; | ||
import { ContainerPropertiesPlugin } from './plugins/ContainerProperties'; | ||
import { PixiDevtools } from '../../pixi'; | ||
import type { PropertyPanelData } from '@devtool/frontend/pages/scene/scene-tree/Properties'; | ||
import { GraphicsPropertiesPlugin } from './plugins/GraphicsProperties'; | ||
import { MeshPropertiesPlugin } from './plugins/MeshProperties'; | ||
import { NineSliceSpritePropertiesPlugin } from './plugins/NineSliceProperties'; | ||
import { SpritePropertiesPlugin } from './plugins/SpriteProperties'; | ||
import { TextPropertiesPlugin } from './plugins/TextProperties'; | ||
import { TilingSpritePropertiesPlugin } from './plugins/TilingSpriteProperties'; | ||
|
||
export class Properties { | ||
public defaultPlugins: PropertyPlugin[] = [ | ||
ContainerPropertiesPlugin, | ||
SpritePropertiesPlugin, | ||
// GraphicsPropertiesPlugin, | ||
// MeshPropertiesPlugin, | ||
// TextPropertiesPlugin, | ||
// NineSliceSpritePropertiesPlugin, | ||
// TilingSpritePropertiesPlugin, | ||
// AnimatedSpritePropertiesPlugin, | ||
GraphicsPropertiesPlugin, | ||
MeshPropertiesPlugin, | ||
TextPropertiesPlugin, | ||
NineSliceSpritePropertiesPlugin, | ||
TilingSpritePropertiesPlugin, | ||
AnimatedSpritePropertiesPlugin, | ||
]; | ||
|
||
private _plugins!: PropertyPlugin[]; | ||
private _devtool: typeof PixiDevtools; | ||
|
||
constructor(devtool: typeof PixiDevtools) { | ||
this._devtool = devtool; | ||
} | ||
|
||
public init() { | ||
this._plugins = [...(PixiDevtools.devtools.plugins?.properties ?? []), ...this.defaultPlugins]; | ||
// this._plugins.forEach((plugin) => { | ||
// plugin.props.forEach((prop) => { | ||
// prop.value = null; | ||
// }); | ||
// }); | ||
this._plugins = [...(this._devtool.devtools.plugins?.properties ?? []), ...this.defaultPlugins]; | ||
} | ||
|
||
public setValue(prop: string, value: any) { | ||
const selectedNode = PixiDevtools.tree.selectedNode; | ||
const selectedNode = this._devtool.tree.selectedNode; | ||
|
||
if (!selectedNode) return; | ||
|
||
this._plugins.forEach((plugin) => { | ||
plugin.setValue(selectedNode, prop, value); | ||
if (plugin.containsProperty(prop)) plugin.setValue(selectedNode, prop, value); | ||
}); | ||
} | ||
|
||
public update() { | ||
const selectedNode = PixiDevtools.tree.selectedNode; | ||
const selectedNode = this._devtool.tree.selectedNode; | ||
if (!selectedNode) return; | ||
|
||
this._plugins.forEach((plugin) => { | ||
plugin.updateProps(PixiDevtools.tree.selectedNode!); | ||
plugin.updateProps(this._devtool.tree.selectedNode!); | ||
}); | ||
} | ||
|
||
public complete() { | ||
const activeProps = this._plugins.map((plugin) => plugin.props).flat(); | ||
PixiDevtools.state.activeProps = activeProps as PropertyPanelData[]; | ||
const uniqueProps = Array.from(new Set(activeProps.map(JSON.stringify as any))).map(JSON.parse as any); | ||
this._devtool.state.activeProps = uniqueProps as PropertyPanelData[]; | ||
} | ||
} |
Oops, something went wrong.