use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.
the class ModuleWrapper method attachModuleToMyOutput.
public void attachModuleToMyOutput(ModuleWrapper moduleWrapper, int mySlot, int targetSlot) {
// find the flavour
Slot mySlotObject = getModule().getOutputSlot(mySlot);
Slot toSlotObject = moduleWrapper.getModule().getInputSlot(targetSlot);
if (mySlotObject == null || toSlotObject == null)
return;
if (mySlotObject.getValue() instanceof NumericalValue && toSlotObject.getValue() instanceof NumericalValue) {
NumericalValue myValue = (NumericalValue) mySlotObject.getValue();
NumericalValue toValue = (NumericalValue) toSlotObject.getValue();
myValue.setFlavour(toValue.getFlavour());
}
// change the name
lastAttachedTargetSlot = targetSlot;
lastAttachedWrapper = moduleWrapper;
setTitleText(constructTitle());
}
use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.
the class AbstractModule method createInputSlot.
public Value createInputSlot(int slotId, Value value) {
inputSlots.put(slotId, new Slot(this, slotId, true));
inputSlots.get(slotId).setValue(value);
return value;
}
use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.
the class AbstractModule method createOutputSlot.
public Value createOutputSlot(int slotId, Value value) {
outputSlots.put(slotId, new Slot(this, slotId, false));
outputSlots.get(slotId).setValue(value);
return value;
}
use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.
the class AbstractModule method createOutputSlot.
public NumericalValue createOutputSlot(int slotId) {
outputSlots.put(slotId, new Slot(this, slotId, false));
NumericalValue value = new NumericalValue();
outputSlots.get(slotId).setValue(value);
return value;
}
use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.
the class ModuleWrapper method slotClicked.
public void slotClicked(int slotId, boolean isInput) {
Slot slot = module.getInputSlot(slotId);
if (!isInput) {
slot = module.getOutputSlot(slotId);
}
if (slot == null)
return;
if (slot.isInput()) {
Class<? extends AbstractModule> clazz = getSlotsPreferredModule(slot);
if (clazz != null) {
ModuleWrapper newWrapper = moduleBoardWidget.createModule(clazz, getX(), getY());
// connecting
// Slot newOutSlot = newWrapper.getModule().getOutputSlot(0);
moduleBoardWidget.makeConnection(newWrapper, this, 0, slotId);
// now tricky positioning
float offset = MathUtils.random(100, 300);
newWrapper.getOutputSlotPos(0, tmp);
getInputSlotPos(slotId, tmp2);
tmp2.x -= offset;
tmp2.sub(tmp);
// new target
tmp2.add(newWrapper.getX(), newWrapper.getY());
// starting position
tmp.set(tmp2).add(offset, 0);
newWrapper.setPosition(tmp.x, tmp.y);
// now the animation
float duration = 0.2f;
newWrapper.addAction(Actions.fadeIn(duration));
newWrapper.addAction(Actions.moveTo(tmp2.x, tmp2.y, duration, Interpolation.swingOut));
}
}
}
Aggregations