pixi-particles-editor icon indicating copy to clipboard operation
pixi-particles-editor copied to clipboard

Generated config not compatible with EmitterConfigV3

Open goldenratio opened this issue 3 years ago • 2 comments
trafficstars

Hi, any plans on adding feature to export config as v3 from editor?

goldenratio avatar Feb 15 '22 14:02 goldenratio

In theory, yes, but on top of new features that need to be supported, the editor is very old and needs to be rewritten in order to be properly maintainable. I just have not had the time to do so. That's why I made sure that the runtime can ingest older configs for use in the latest version of the library.

andrewstart avatar Feb 15 '22 21:02 andrewstart

The workaround is to convert your config to v3...

import {
  upgradeConfig,
  Emitter,
  EmitterConfigV1,
  EmitterConfigV3
} from '@pixi/particle-emitter'
......
    const { default: config } = await import(
      `../configs/particle-effect.json`
    )
    const cfgV1: EmitterConfigV1 = config
    const cfgV3: EmitterConfigV3 = upgradeConfig(cfgV1, texture)

    this.emitter = new Emitter(container, cfgV3)

This seems to work perfectly.

schellenbergk avatar Apr 17 '23 16:04 schellenbergk