Search in sources :

Example 6 with Slot

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());
}
Also used : NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue) Slot(com.talosvfx.talos.runtime.Slot)

Example 7 with Slot

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;
}
Also used : Slot(com.talosvfx.talos.runtime.Slot)

Example 8 with Slot

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;
}
Also used : Slot(com.talosvfx.talos.runtime.Slot)

Example 9 with Slot

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;
}
Also used : NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue) Slot(com.talosvfx.talos.runtime.Slot)

Example 10 with Slot

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));
        }
    }
}
Also used : Slot(com.talosvfx.talos.runtime.Slot)

Aggregations

Slot (com.talosvfx.talos.runtime.Slot)13 NumericalValue (com.talosvfx.talos.runtime.values.NumericalValue)4 JsonValue (com.badlogic.gdx.utils.JsonValue)1 ReflectionException (com.badlogic.gdx.utils.reflect.ReflectionException)1 RibbonRenderer (com.talosvfx.talos.runtime.render.drawables.RibbonRenderer)1 Value (com.talosvfx.talos.runtime.values.Value)1