Search in sources :

Example 1 with Slot

use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.

the class NodeBoard method tryAndConnectLasCC.

public <T extends AbstractModule> void tryAndConnectLasCC(NodeWidget nodeWidget) {
    if (ccFromNode != null) {
        Class fromClass;
        Slot fromSlotObject;
        Array<String> toSlots;
        NodeWidget fromModule;
        NodeWidget toModule;
        String fromSlot = null;
        String toSlot = null;
        if (ccCurrentIsInput) {
            toSlots = nodeWidget.getOutputSlots();
            fromModule = nodeWidget;
            toModule = ccFromNode;
            toSlot = ccFromSlot;
        } else {
            toSlots = nodeWidget.getInputSlots();
            fromModule = ccFromNode;
            toModule = nodeWidget;
            fromSlot = ccFromSlot;
        }
        for (int i = 0; i < toSlots.size; i++) {
            String slot = toSlots.get(i);
            // we can connect
            if (ccCurrentIsInput) {
                fromSlot = slot;
            } else {
                toSlot = slot;
            }
            makeConnection(fromModule, toModule, fromSlot, toSlot);
            break;
        }
        ccFromNode = null;
    }
}
Also used : Slot(com.talosvfx.talos.runtime.Slot)

Example 2 with Slot

use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.

the class RandomInputModule method addInputSlot.

public void addInputSlot(int key) {
    Slot slot = new Slot(this, key, true);
    inputSlots.put(key, slot);
}
Also used : Slot(com.talosvfx.talos.runtime.Slot)

Example 3 with Slot

use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.

the class RandomInputModule method attachModuleToMyInput.

@Override
public void attachModuleToMyInput(AbstractModule module, int mySlot, int targetSlot) {
    addInputSlot(slotCount++);
    super.attachModuleToMyInput(module, mySlot, targetSlot);
    // let's figure out the type
    if (valueType == null) {
        valueType = module.getOutputSlot(targetSlot).getValue().getClass();
    } else {
        Class newValueType = module.getOutputSlot(targetSlot).getValue().getClass();
        if (valueType != newValueType) {
            // changing value detaching all previous values
            // detach code goes here
            valueType = newValueType;
        }
    }
    // re init all previous values
    try {
        for (Slot slot : getInputSlots().values()) {
            slot.setValue((Value) ClassReflection.newInstance(valueType));
        }
        getOutputSlot(0).setValue((Value) ClassReflection.newInstance(valueType));
    } catch (ReflectionException e) {
        e.printStackTrace();
    }
}
Also used : ReflectionException(com.badlogic.gdx.utils.reflect.ReflectionException) Slot(com.talosvfx.talos.runtime.Slot)

Example 4 with Slot

use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.

the class RibbonModule method fetchAllInputSlotValues.

@Override
public void fetchAllInputSlotValues() {
    super.fetchAllInputSlotValues();
    float requester = getScope().get(ScopePayload.REQUESTER_ID).getFloat();
    RibbonRenderer renderer = (RibbonRenderer) outputValue.getDrawable();
    renderer.setCurrentParticle(getScope().currParticle());
    for (int i = 0; i < detail; i++) {
        float pointAlpha = (float) i / (detail - 1);
        if (pointAlpha == 0)
            pointAlpha = 0.001f;
        getScope().set(ScopePayload.SECONDARY_SEED, pointAlpha);
        getScope().set(ScopePayload.REQUESTER_ID, requester + pointAlpha * 0.1f);
        for (Slot inputSlot : inputSlots.values()) {
            fetchInputSlotValue(inputSlot.getIndex());
        }
        float transparencyVal = 1f;
        if (!transparencyValue.isEmpty()) {
            transparencyVal = transparencyValue.getFloat();
        }
        if (colorValue.isEmpty()) {
            tmpColor.set(Color.WHITE);
            tmpColor.a = transparencyVal;
        } else {
            tmpColor.set(colorValue.get(0), colorValue.get(1), colorValue.get(2), transparencyVal);
        }
        float thicknessVal = 0.1f;
        if (!thicknessValue.isEmpty()) {
            thicknessVal = thicknessValue.getFloat();
        }
        renderer.setPointData(i, thicknessVal, tmpColor);
    }
    // renderer.adjustPointData();
    getScope().set(ScopePayload.REQUESTER_ID, requester);
}
Also used : RibbonRenderer(com.talosvfx.talos.runtime.render.drawables.RibbonRenderer) Slot(com.talosvfx.talos.runtime.Slot)

Example 5 with Slot

use of com.talosvfx.talos.runtime.Slot in project talos by rockbite.

the class PolylineModule method fetchAllInputSlotValues.

@Override
public void fetchAllInputSlotValues() {
    float requester = getScope().get(ScopePayload.REQUESTER_ID).getFloat();
    polylineDrawable.setCurrentParticle(getScope().currParticle());
    for (int i = 0; i < pointCount; i++) {
        float pointAlpha = (float) i / (pointCount - 1);
        getScope().set(ScopePayload.SECONDARY_SEED, pointAlpha);
        getScope().set(ScopePayload.REQUESTER_ID, requester + pointAlpha * 0.1f);
        for (Slot inputSlot : inputSlots.values()) {
            fetchInputSlotValue(inputSlot.getIndex());
        }
        float transparencyVal = 1f;
        if (!transparency.isEmpty()) {
            transparencyVal = transparency.getFloat();
        }
        if (color.isEmpty()) {
            tmpColor.set(Color.WHITE);
            tmpColor.a = transparencyVal;
        } else {
            tmpColor.set(color.get(0), color.get(1), color.get(2), transparencyVal);
        }
        float thicknessVal = 0.1f;
        if (!thickness.isEmpty()) {
            thicknessVal = thickness.getFloat();
        }
        if (offset.isEmpty()) {
            offset.set(0);
        }
        polylineDrawable.setPointData(i, offset.get(0), offset.get(1), thicknessVal, tmpColor);
        polylineDrawable.setTangents(leftTangent.get(0), leftTangent.get(1), rightTangent.get(0), rightTangent.get(1));
    }
    getScope().set(ScopePayload.REQUESTER_ID, requester);
}
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