Search in sources :

Example 6 with ParticleEffect

use of com.badlogic.gdx.graphics.g3d.particles.ParticleEffect in project libgdx by libgdx.

the class EffectPanel method importEffect.

protected void importEffect() {
    File file = editor.showFileLoadDialog();
    if (file != null) {
        ParticleEffect effect;
        if ((effect = editor.openEffect(file, false)) != null) {
            for (ParticleController controller : effect.getControllers()) addEmitter(controller, false);
            editIndex = 0;
            emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
        }
    }
}
Also used : ParticleEffect(com.badlogic.gdx.graphics.g3d.particles.ParticleEffect) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) File(java.io.File)

Example 7 with ParticleEffect

use of com.badlogic.gdx.graphics.g3d.particles.ParticleEffect in project libgdx by libgdx.

the class ParticleControllerInfluencerPanel method handle.

@Override
public void handle(int aEventType, Object aEventData) {
    if (aEventType == FlameMain.EVT_ASSET_RELOADED) {
        Object[] data = (Object[]) aEventData;
        if (data[0] instanceof ParticleEffect) {
            ParticleEffect oldEffect = (ParticleEffect) data[0];
            int currentCount = value.templates.size;
            value.templates.removeAll(oldEffect.getControllers(), true);
            if (value.templates.size != currentCount) {
                int diff = currentCount - value.templates.size;
                if (diff > 0) {
                    ParticleEffect newEffect = (ParticleEffect) data[1];
                    Array<ParticleController> newControllers = newEffect.getControllers();
                    if (newControllers.size > 0) {
                        for (int i = 0, c = Math.min(diff, newControllers.size); i < c; ++i) value.templates.add(newControllers.get(i));
                    }
                } else {
                    value.templates.addAll(((ParticleEffect) editor.assetManager.get(FlameMain.DEFAULT_BILLBOARD_PARTICLE)).getControllers());
                }
                controllerPicker.reloadTemplates();
                controllerPicker.setValue(value.templates);
                editor.restart();
            }
        }
    }
}
Also used : ParticleEffect(com.badlogic.gdx.graphics.g3d.particles.ParticleEffect) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController)

Aggregations

ParticleController (com.badlogic.gdx.graphics.g3d.particles.ParticleController)7 ParticleEffect (com.badlogic.gdx.graphics.g3d.particles.ParticleEffect)7 SaveData (com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData)2 Array (com.badlogic.gdx.utils.Array)2 IntArray (com.badlogic.gdx.utils.IntArray)2 AssetDescriptor (com.badlogic.gdx.assets.AssetDescriptor)1 ParticleEffectLoader (com.badlogic.gdx.graphics.g3d.particles.ParticleEffectLoader)1 File (java.io.File)1