Search in sources :

Example 1 with PolylineModule

use of com.talosvfx.talos.runtime.modules.PolylineModule in project talos by rockbite.

the class TalosProject method setToExportData.

private void setToExportData(ExportData data, ModuleBoardWidget moduleBoardWidget) {
    final ObjectMap<ParticleEmitterWrapper, Array<ModuleWrapper>> moduleWrappers = moduleBoardWidget.moduleWrappers;
    final ObjectMap<ParticleEmitterWrapper, Array<ModuleBoardWidget.NodeConnection>> nodeConnections = moduleBoardWidget.nodeConnections;
    for (ParticleEmitterWrapper key : moduleWrappers.keys()) {
        final ExportData.EmitterExportData emitterData = new ExportData.EmitterExportData();
        emitterData.name = key.getName();
        for (ModuleWrapper wrapper : moduleWrappers.get(key)) {
            emitterData.modules.add(wrapper.getModule());
            if (wrapper.getModule() instanceof TextureModule) {
                TextureModule textureModule = (TextureModule) wrapper.getModule();
                String name = textureModule.regionName;
                if (name == null)
                    name = "fire";
                if (!data.metadata.resources.contains(name, false)) {
                    data.metadata.resources.add(name);
                }
            }
            if (wrapper.getModule() instanceof PolylineModule) {
                PolylineModule module = (PolylineModule) wrapper.getModule();
                String name = module.regionName;
                if (name == null)
                    name = "fire";
                if (!data.metadata.resources.contains(name, false)) {
                    data.metadata.resources.add(name);
                }
            }
            if (wrapper.getModule() instanceof VectorFieldModule) {
                VectorFieldModule vectorFieldModule = (VectorFieldModule) wrapper.getModule();
                String fgaFileName = vectorFieldModule.fgaFileName;
                if (fgaFileName == null) {
                    return;
                }
                fgaFileName = fgaFileName + ".fga";
                if (!data.metadata.resources.contains(fgaFileName, false)) {
                    data.metadata.resources.add(fgaFileName);
                }
            }
        }
        final Array<ModuleBoardWidget.NodeConnection> nodeConns = nodeConnections.get(key);
        if (nodeConns != null) {
            for (ModuleBoardWidget.NodeConnection nodeConn : nodeConns) {
                emitterData.connections.add(new ConnectionData(nodeConn.fromModule.getModule().getIndex(), nodeConn.toModule.getModule().getIndex(), nodeConn.fromSlot, nodeConn.toSlot));
            }
        }
        data.emitters.add(emitterData);
    }
}
Also used : TextureModule(com.talosvfx.talos.runtime.modules.TextureModule) VectorFieldModule(com.talosvfx.talos.runtime.modules.VectorFieldModule) Array(com.badlogic.gdx.utils.Array) PolylineModule(com.talosvfx.talos.runtime.modules.PolylineModule) ModuleBoardWidget(com.talosvfx.talos.editor.widgets.ui.ModuleBoardWidget) ModuleWrapper(com.talosvfx.talos.editor.wrappers.ModuleWrapper) ExportData(com.talosvfx.talos.runtime.serialization.ExportData) ConnectionData(com.talosvfx.talos.runtime.serialization.ConnectionData) ParticleEmitterWrapper(com.talosvfx.talos.editor.ParticleEmitterWrapper)

Aggregations

Array (com.badlogic.gdx.utils.Array)1 ParticleEmitterWrapper (com.talosvfx.talos.editor.ParticleEmitterWrapper)1 ModuleBoardWidget (com.talosvfx.talos.editor.widgets.ui.ModuleBoardWidget)1 ModuleWrapper (com.talosvfx.talos.editor.wrappers.ModuleWrapper)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 ConnectionData (com.talosvfx.talos.runtime.serialization.ConnectionData)1 ExportData (com.talosvfx.talos.runtime.serialization.ExportData)1