Search in sources :

Example 6 with ParticleEmitterWrapper

use of com.talosvfx.talos.editor.ParticleEmitterWrapper in project talos by rockbite.

the class TalosProject method initEmitter.

private ParticleEmitterWrapper initEmitter(String emitterName) {
    ParticleEmitterWrapper emitterWrapper = new ParticleEmitterWrapper();
    emitterWrapper.setName(emitterName);
    ParticleEmitterDescriptor moduleGraph = TalosMain.Instance().TalosProject().particleEffectDescriptor.createEmitterDescriptor();
    emitterWrapper.setModuleGraph(moduleGraph);
    // particleEffect.addAdvancedEmitter(moduleGraph);
    particleEffect.addEmitter(moduleGraph);
    return emitterWrapper;
}
Also used : ParticleEmitterDescriptor(com.talosvfx.talos.runtime.ParticleEmitterDescriptor) ParticleEmitterWrapper(com.talosvfx.talos.editor.ParticleEmitterWrapper)

Example 7 with ParticleEmitterWrapper

use of com.talosvfx.talos.editor.ParticleEmitterWrapper in project talos by rockbite.

the class TalosProject method sortEmitters.

public void sortEmitters() {
    activeWrappers.sort(emitterComparator);
    // fix for older projects
    if (activeWrappers.size > 1 && activeWrappers.get(0).getEmitter().getSortPosition() == 0 && activeWrappers.get(1).getEmitter().getSortPosition() == 0) {
        activeWrappers.reverse();
    }
    // re-normalize position numbers
    int index = 0;
    for (ParticleEmitterWrapper wrapper : activeWrappers) {
        wrapper.getEmitter().setSortPosition(index++);
        wrapper.setPosition(wrapper.getEmitter().getSortPosition());
    }
    particleEffect.sortEmitters();
}
Also used : ParticleEmitterWrapper(com.talosvfx.talos.editor.ParticleEmitterWrapper)

Example 8 with ParticleEmitterWrapper

use of com.talosvfx.talos.editor.ParticleEmitterWrapper in project talos by rockbite.

the class TalosProject method createNewEmitter.

public ParticleEmitterWrapper createNewEmitter(String emitterName, float sortPosition) {
    ParticleEmitterWrapper emitterWrapper = initEmitter(emitterName);
    activeWrappers.add(emitterWrapper);
    currentEmitterWrapper = emitterWrapper;
    emitterWrapper.setPosition(sortPosition);
    sortEmitters();
    TalosMain.Instance().ProjectController().setDirty();
    TalosMain.Instance().NodeStage().moduleBoardWidget.setCurrentEmitter(currentEmitterWrapper);
    return emitterWrapper;
}
Also used : ParticleEmitterWrapper(com.talosvfx.talos.editor.ParticleEmitterWrapper)

Example 9 with ParticleEmitterWrapper

use of com.talosvfx.talos.editor.ParticleEmitterWrapper in project talos by rockbite.

the class ProjectData method setFrom.

public void setFrom(ModuleBoardWidget moduleBoardWidget) {
    final ObjectMap<ParticleEmitterWrapper, Array<ModuleWrapper>> moduleWrappers = moduleBoardWidget.moduleWrappers;
    final ObjectMap<ParticleEmitterWrapper, Array<ModuleBoardWidget.NodeConnection>> nodeConnections = moduleBoardWidget.nodeConnections;
    emitters.clear();
    for (ParticleEmitterWrapper key : moduleWrappers.keys()) {
        final EmitterData emitterData = new EmitterData();
        emitterData.name = key.getName();
        emitterData.sortPosition = key.getEmitter().getSortPosition();
        emitterData.modules.addAll(moduleWrappers.get(key));
        emitterData.isMuted = key.isMuted;
        final Array<ModuleBoardWidget.NodeConnection> nodeConns = nodeConnections.get(key);
        if (nodeConns != null) {
            for (ModuleBoardWidget.NodeConnection nodeConn : nodeConns) {
                emitterData.connections.add(new ConnectionData(nodeConn.fromModule.getId(), nodeConn.toModule.getId(), nodeConn.fromSlot, nodeConn.toSlot));
            }
        }
        // add groups
        for (ModuleWrapperGroup group : moduleBoardWidget.getGroups(key)) {
            GroupData groupData = new GroupData();
            groupData.text = group.getText();
            groupData.modules = new Array<>();
            groupData.color = group.getFrameColor().toFloatBits();
            for (ModuleWrapper wrapper : group.getModuleWrappers()) {
                groupData.modules.add(wrapper.getId());
            }
            emitterData.groups.add(groupData);
        }
        emitters.add(emitterData);
    }
}
Also used : Array(com.badlogic.gdx.utils.Array) ModuleBoardWidget(com.talosvfx.talos.editor.widgets.ui.ModuleBoardWidget) ModuleWrapper(com.talosvfx.talos.editor.wrappers.ModuleWrapper) ConnectionData(com.talosvfx.talos.runtime.serialization.ConnectionData) ParticleEmitterWrapper(com.talosvfx.talos.editor.ParticleEmitterWrapper) ModuleWrapperGroup(com.talosvfx.talos.editor.data.ModuleWrapperGroup)

Example 10 with ParticleEmitterWrapper

use of com.talosvfx.talos.editor.ParticleEmitterWrapper in project talos by rockbite.

the class TimelineWidgetLegacy method setEmitters.

public void setEmitters(Array<ParticleEmitterWrapper> emitterWrappers) {
    listContent.clearChildren();
    for (ParticleEmitterWrapper emitter : emitterWrappers) {
        EmitterRow row = new EmitterRow(this, getSkin());
        row.set(emitter);
        listContent.add(row).growX();
        rows.add(row);
        listContent.row().padTop(0);
    }
    listContent.row();
    listContent.add().expandY();
    if (emitterWrappers.size > 0) {
        selectRow(TalosMain.Instance().TalosProject().getCurrentEmitterWrapper());
    }
}
Also used : ParticleEmitterWrapper(com.talosvfx.talos.editor.ParticleEmitterWrapper)

Aggregations

ParticleEmitterWrapper (com.talosvfx.talos.editor.ParticleEmitterWrapper)11 ModuleWrapper (com.talosvfx.talos.editor.wrappers.ModuleWrapper)3 Array (com.badlogic.gdx.utils.Array)2 ModuleWrapperGroup (com.talosvfx.talos.editor.data.ModuleWrapperGroup)2 ModuleBoardWidget (com.talosvfx.talos.editor.widgets.ui.ModuleBoardWidget)2 ParticleEmitterDescriptor (com.talosvfx.talos.runtime.ParticleEmitterDescriptor)2 ConnectionData (com.talosvfx.talos.runtime.serialization.ConnectionData)2 Color (com.badlogic.gdx.graphics.Color)1 IntMap (com.badlogic.gdx.utils.IntMap)1 ObjectSet (com.badlogic.gdx.utils.ObjectSet)1 PolylineModule (com.talosvfx.talos.runtime.modules.PolylineModule)1 TextureModule (com.talosvfx.talos.runtime.modules.TextureModule)1 VectorFieldModule (com.talosvfx.talos.runtime.modules.VectorFieldModule)1 ExportData (com.talosvfx.talos.runtime.serialization.ExportData)1