Search in sources :

Example 6 with NumericalValue

use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.

the class MetaData method read.

@Override
public void read(Json json, JsonValue jsonData) {
    JsonValue arr = jsonData.get("scopeDefaults");
    int iter = 0;
    for (JsonValue item : arr) {
        NumericalValue val = new NumericalValue();
        val.set(item.get(0).asFloat(), item.get(1).asFloat(), item.get(2).asFloat(), item.get(3).asFloat());
        TalosMain.Instance().globalScope.setDynamicValue(iter++, val);
    }
    // preview widget stuff
    if (jsonData.has("previewCamPos")) {
        JsonValue camPos = jsonData.get("previewCamPos");
        TalosMain.Instance().UIStage().PreviewWidget().setCameraPos(camPos.getFloat("x", 0), camPos.getFloat("y", 0));
    } else {
        TalosMain.Instance().UIStage().PreviewWidget().setCameraPos(0, 0);
    }
    TalosMain.Instance().UIStage().PreviewWidget().setBackgroundImage(jsonData.getString("bgImagePath", null));
    TalosMain.Instance().UIStage().PreviewWidget().setGridVisible(jsonData.getBoolean("isGridVisible", true));
    TalosMain.Instance().UIStage().PreviewWidget().setImageIsBackground(jsonData.getBoolean("bgImageIsInBack", true));
    TalosMain.Instance().UIStage().PreviewWidget().setBgImageSize(jsonData.getFloat("bgImageSize", 10));
    TalosMain.Instance().UIStage().PreviewWidget().setGridSize(jsonData.getFloat("gridSize", 1));
    TalosMain.Instance().UIStage().PreviewWidget().setCameraZoom(jsonData.getFloat("previewCamZoom", 1.4285715f));
    // particle position
    ParticleEffectInstance particleEffect = TalosMain.Instance().TalosProject().getParticleEffect();
    if (particleEffect != null) {
        float pPosX = jsonData.getFloat("particlePositionX", 0);
        float pPosY = jsonData.getFloat("particlePositionY", 0);
        particleEffect.setPosition(pPosX, pPosY);
    }
    JsonValue resourcePaths = jsonData.get("resourcePaths");
    if (resourcePaths != null) {
        iter = 0;
        for (JsonValue item : resourcePaths) {
            final String filePath = item.asString();
            resourcePathStrings.add(filePath);
        }
    }
}
Also used : ParticleEffectInstance(com.talosvfx.talos.runtime.ParticleEffectInstance) NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue) JsonValue(com.badlogic.gdx.utils.JsonValue)

Example 7 with NumericalValue

use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.

the class GlobalScopeModuleWrapper method setModule.

@Override
public void setModule(GlobalScopeModule module) {
    super.setModule(module);
    NumericalValue value = TalosMain.Instance().globalScope.getDynamicValue(module.getKey());
    dragPoint.set(value.get(0), value.get(1));
}
Also used : NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue)

Example 8 with NumericalValue

use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.

the class GlobalScopeModuleWrapper method updateFromSelectBox.

private void updateFromSelectBox() {
    String selected = selectBox.getSelected();
    int key = Integer.parseInt(selected);
    module.setKey(key);
    NumericalValue value = TalosMain.Instance().globalScope.getDynamicValue(key);
    dragPoint.set(value.get(0), value.get(1));
}
Also used : NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue) DragPoint(com.talosvfx.talos.editor.widgets.ui.DragPoint)

Example 9 with NumericalValue

use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.

the class VectorFieldModule method processValues.

@Override
public void processValues() {
    if (vectorField == null)
        return;
    float scaleVal = 1f;
    if (!scale.isEmpty()) {
        scaleVal = scale.getFloat();
    }
    float forceVal = 1f;
    if (!force.isEmpty()) {
        forceVal = force.getFloat();
    }
    NumericalValue posNumVal = getScope().get(ScopePayload.PARTICLE_POSITION);
    pos.set(posNumVal.get(0), posNumVal.get(1));
    vectorField.setScale(scaleVal);
    vectorField.setPosition(position.get(0), position.get(1));
    tmp = vectorField.getValue(pos, tmp);
    tmp.scl(forceVal);
    angle.set(tmp.angle());
    velocity.set(tmp.len());
}
Also used : NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue)

Example 10 with NumericalValue

use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.

the class OffsetModule method defineSlots.

@Override
protected void defineSlots() {
    alpha = createInputSlot(ALPHA);
    output = createOutputSlot(OUTPUT);
    lowPos = new NumericalValue();
    lowSize = new NumericalValue();
    highPos = new NumericalValue();
    highSize = new NumericalValue();
}
Also used : NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue)

Aggregations

NumericalValue (com.talosvfx.talos.runtime.values.NumericalValue)12 Slot (com.talosvfx.talos.runtime.Slot)3 ParticleEffectInstance (com.talosvfx.talos.runtime.ParticleEffectInstance)2 FileHandle (com.badlogic.gdx.files.FileHandle)1 Interpolation (com.badlogic.gdx.math.Interpolation)1 Vector2 (com.badlogic.gdx.math.Vector2)1 JsonValue (com.badlogic.gdx.utils.JsonValue)1 ObjectMap (com.badlogic.gdx.utils.ObjectMap)1 DragPoint (com.talosvfx.talos.editor.widgets.ui.DragPoint)1