use of com.talosvfx.talos.runtime.modules.AbstractModule in project talos by rockbite.
the class TextureModuleWrapper method configureSlots.
@Override
protected void configureSlots() {
defaultRegion = new TextureRegion(new Texture(Gdx.files.internal("fire.png")));
dropWidget = new TextureDropWidget<AbstractModule>(defaultRegion, getSkin());
addOutputSlot("output", TextureModule.OUTPUT);
assetNameLabel = new Label("fire", getSkin());
contentWrapper.add(assetNameLabel).padLeft(10).colspan(2).expand().fill().row();
contentWrapper.add(dropWidget).size(50).left().padLeft(10);
contentWrapper.add().expandX();
}
use of com.talosvfx.talos.runtime.modules.AbstractModule in project talos by rockbite.
the class ModuleBoardWidget method createModule.
public ModuleWrapper createModule(Class<? extends AbstractModule> clazz, float x, float y) {
final AbstractModule module;
try {
module = ClassReflection.newInstance(clazz);
if (TalosMain.Instance().TalosProject().getCurrentModuleGraph().addModule(module)) {
final ModuleWrapper moduleWrapper = createModuleWrapper(module, x, y);
moduleWrapper.setModuleToDefaults();
module.setModuleGraph(TalosMain.Instance().TalosProject().getCurrentModuleGraph());
TalosMain.Instance().ProjectController().setDirty();
return moduleWrapper;
} else {
System.out.println("Did not create module: " + clazz.getSimpleName());
return null;
}
} catch (ReflectionException e) {
throw new GdxRuntimeException(e);
}
}
use of com.talosvfx.talos.runtime.modules.AbstractModule in project talos by rockbite.
the class FlipbookModuleWrapper method configureSlots.
@Override
protected void configureSlots() {
super.configureSlots();
dropWidget = new TextureDropWidget<AbstractModule>(defaultRegion, getSkin(), 100f);
addInputSlot("phase", FlipbookModule.PHASE);
rows = new IntegerInputWidget("Rows", getSkin());
cols = new IntegerInputWidget("Cols", getSkin());
duration = new FloatInputWidget("Duration", getSkin());
rows.setValue(1);
cols.setValue(1);
duration.setValue(1f);
leftWrapper.add(rows).padTop(5f).left().expandX().row();
leftWrapper.add(cols).left().expandX().row();
leftWrapper.add(duration).padLeft(5).left().expandX().row();
rightWrapper.add(dropWidget).size(100).right().row();
rightWrapper.add().growY().row();
addOutputSlot("output", FlipbookModule.OUTPUT);
rows.setListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
module.setRows(rows.getValue());
}
});
duration.setListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
module.duration = duration.getValue();
}
});
cols.setListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
module.setCols(cols.getValue());
}
});
}
use of com.talosvfx.talos.runtime.modules.AbstractModule in project talos by rockbite.
the class ParticleEffectDescriptor method load.
public void load(FileHandle fileHandle) {
Json json = new Json();
ParticleEmitterDescriptor.registerModules();
for (Class clazz : ParticleEmitterDescriptor.registeredModules) {
json.addClassTag(clazz.getSimpleName(), clazz);
}
final ExportData exportData = json.fromJson(ExportData.class, fileHandle.readString());
for (ExportData.EmitterExportData emitter : exportData.emitters) {
ParticleEmitterDescriptor emitterDescriptor = new ParticleEmitterDescriptor(this);
IntMap<AbstractModule> idMap = new IntMap<>();
for (AbstractModule module : emitter.modules) {
module.setModuleGraph(emitterDescriptor);
if (module instanceof ParticleModule) {
emitterDescriptor.particleModule = (ParticleModule) module;
}
if (module instanceof EmitterModule) {
emitterDescriptor.emitterModule = (EmitterModule) module;
}
idMap.put(module.getIndex(), module);
// I cannot understand how this was working before. This is needed so that it can later reset requesters.
emitterDescriptor.modules.add(module);
}
for (ConnectionData connection : emitter.connections) {
final int moduleFromId = connection.moduleFrom;
final int moduleToId = connection.moduleTo;
final int slotFrom = connection.slotFrom;
final int slotTo = connection.slotTo;
AbstractModule moduleFrom = idMap.get(moduleFromId);
AbstractModule moduleTo = idMap.get(moduleToId);
if (moduleFrom == null) {
throw new GdxRuntimeException("No module from found for id: " + moduleFromId);
}
if (moduleTo == null) {
throw new GdxRuntimeException("No module to found for id: " + moduleToId);
}
emitterDescriptor.connectNode(moduleFrom, moduleTo, slotFrom, slotTo);
}
emitterModuleGraphs.add(emitterDescriptor);
}
}
use of com.talosvfx.talos.runtime.modules.AbstractModule in project talos by rockbite.
the class TextureDropModuleWrapper method configureSlots.
@Override
protected void configureSlots() {
final TalosAssetProvider projectAssetProvider = TalosMain.Instance().TalosProject().getProjectAssetProvider();
defaultRegion = projectAssetProvider.findAsset("fire", TextureRegion.class);
dropWidget = new TextureDropWidget<AbstractModule>(defaultRegion, getSkin());
}
Aggregations