Search in sources :

Example 1 with CurveWidget

use of com.talosvfx.talos.editor.widgets.CurveWidget in project talos by rockbite.

the class CurveModuleWrapper method configureSlots.

@Override
protected void configureSlots() {
    addInputSlot("alpha (0 to 1)", InterpolationModule.ALPHA);
    addOutputSlot("output", 0);
    curveWidget = new CurveWidget(getSkin());
    contentWrapper.add(curveWidget).expandX().fillX().growX().height(100).padTop(23).padRight(3).padBottom(3);
    curveWidget.setDataProvider(this);
    leftWrapper.add(new Table()).expandY();
    rightWrapper.add(new Table()).expandY();
}
Also used : CurveWidget(com.talosvfx.talos.editor.widgets.CurveWidget) Table(com.badlogic.gdx.scenes.scene2d.ui.Table)

Example 2 with CurveWidget

use of com.talosvfx.talos.editor.widgets.CurveWidget in project talos by rockbite.

the class OffsetModuleWrapper method configureSlots.

@Override
protected void configureSlots() {
    addInputSlot("alpha (0 to 1)", InterpolationModule.ALPHA);
    lowShape = new ShapeInputWidget(getSkin());
    highShape = new ShapeInputWidget(getSkin());
    curveWidget = new CurveWidget(getSkin());
    curveWidget.setDataProvider(this);
    Table midTable = new Table();
    equalsButton = new ImageButton(getSkin(), "chain");
    equalsButton.setChecked(true);
    midTable.add(equalsButton);
    contentWrapper.add(lowShape).width(100).pad(5);
    contentWrapper.add(midTable).width(30);
    contentWrapper.add(highShape).width(100).pad(5);
    contentWrapper.row();
    contentWrapper.add(curveWidget).width(240).height(100).padTop(0).colspan(3).padBottom(3);
    contentWrapper.padTop(15);
    addOutputSlot("output", OffsetModule.OUTPUT);
    leftWrapper.add(new Table()).expandY();
    rightWrapper.add(new Table()).expandY();
    if (module != null) {
        updateModuleDataFromWidgets();
    }
    equalsButton.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            lowShape.getShapePos(pos);
            lowShape.getShapeSize(size);
            if (equalsButton.isChecked()) {
                highShape.setScaleVal(lowShape.getScale());
                highShape.setPos(pos);
                highShape.setShapeSize(size);
            }
        }
    });
    lowShape.setListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            lowShape.getShapePos(pos);
            lowShape.getShapeSize(size);
            if (equalsButton.isChecked()) {
                highShape.setScaleVal(lowShape.getScale());
                highShape.setPos(pos);
                highShape.setShapeSize(size);
            }
            updateModuleDataFromWidgets();
        }
    });
    highShape.setListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            highShape.getShapePos(pos);
            highShape.getShapeSize(size);
            if (equalsButton.isChecked()) {
                lowShape.setScaleVal(highShape.getScale());
                lowShape.setPos(pos);
                lowShape.setShapeSize(size);
            }
            updateModuleDataFromWidgets();
        }
    });
}
Also used : ShapeInputWidget(com.talosvfx.talos.editor.widgets.ShapeInputWidget) CurveWidget(com.talosvfx.talos.editor.widgets.CurveWidget) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)

Example 3 with CurveWidget

use of com.talosvfx.talos.editor.widgets.CurveWidget in project talos by rockbite.

the class DynamicRangeModuleWrapper method configureSlots.

@Override
protected void configureSlots() {
    addInputSlot("alpha (0 to 1)", InterpolationModule.ALPHA);
    addOutputSlot("output", 0);
    Table container = new Table();
    highInput = new FloatRangeInputWidget("HMin", "HMax", getSkin());
    lowInput = new FloatRangeInputWidget("LMin", "LMax", getSkin());
    lowInput.setValue(0, 0);
    highInput.setValue(1, 1);
    container.add(highInput).row();
    container.add().height(3).row();
    container.add(lowInput);
    contentWrapper.add(container).left().padTop(20).expandX().padLeft(4);
    curveWidget = new CurveWidget(getSkin());
    curveWidget.setDataProvider(this);
    contentWrapper.add(curveWidget).left().growY().width(200).padTop(23).padRight(3).padLeft(4).padBottom(3);
    leftWrapper.add(new Table()).expandY();
    rightWrapper.add(new Table()).expandY();
    highInput.setListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            updateValues();
        }
    });
    lowInput.setListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            updateValues();
        }
    });
}
Also used : CurveWidget(com.talosvfx.talos.editor.widgets.CurveWidget) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) FloatRangeInputWidget(com.talosvfx.talos.editor.widgets.FloatRangeInputWidget) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)

Example 4 with CurveWidget

use of com.talosvfx.talos.editor.widgets.CurveWidget in project gdx-graph by MarcinSc.

the class RemapValueShaderBoxProducer method createPipelineGraphBox.

@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
    GraphBoxImpl result = createGraphBox(id);
    addConfigurationInputsAndOutputs(result);
    final CurveWidget curveWidget = new CurveWidget(skin);
    if (data != null) {
        JsonValue points = data.get("points");
        for (String point : points.asStringArray()) {
            String[] split = point.split(",");
            curveWidget.createPoint(Float.parseFloat(split[0]), Float.parseFloat(split[1]));
        }
    } else {
        curveWidget.createPoint(0, 0);
    }
    curveWidget.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            curveWidget.fire(new GraphChangedEvent(false, true));
        }
    });
    curveWidget.setSize(300, 200);
    result.addGraphBoxPart(new GraphBoxPartImpl(curveWidget, new GraphBoxPartImpl.Callback() {

        @Override
        public void serialize(JsonValue object) {
            Array<Vector2> points = curveWidget.getPoints();
            JsonValue pointsValue = new JsonValue(JsonValue.ValueType.array);
            for (Vector2 point : points) {
                pointsValue.addChild(new JsonValue(SimpleNumberFormatter.format(point.x) + "," + SimpleNumberFormatter.format(point.y)));
            }
            object.addChild("points", pointsValue);
        }
    }));
    final VisSelectBox<ClampMethod> clampMethodSelectBox = new VisSelectBox<ClampMethod>();
    clampMethodSelectBox.setItems(ClampMethod.values());
    if (data != null)
        clampMethodSelectBox.setSelected(ClampMethod.valueOf(data.getString("clamp", "Normal")));
    clampMethodSelectBox.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            clampMethodSelectBox.fire(new GraphChangedEvent(false, true));
        }
    });
    VisTable clampActor = new VisTable();
    clampActor.add("Clamp method:").row();
    clampActor.add(clampMethodSelectBox).growX();
    result.addGraphBoxPart(new GraphBoxPartImpl(clampActor, new GraphBoxPartImpl.Callback() {

        @Override
        public void serialize(JsonValue object) {
            object.addChild("clamp", new JsonValue(clampMethodSelectBox.getSelected().name()));
        }
    }));
    return result;
}
Also used : CurveWidget(com.talosvfx.talos.editor.widgets.CurveWidget) GraphBoxImpl(com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl) GraphChangedEvent(com.gempukku.libgdx.graph.ui.graph.GraphChangedEvent) JsonValue(com.badlogic.gdx.utils.JsonValue) GraphBoxPartImpl(com.gempukku.libgdx.graph.ui.graph.GraphBoxPartImpl) VisSelectBox(com.kotcrab.vis.ui.widget.VisSelectBox) VisTable(com.kotcrab.vis.ui.widget.VisTable) Vector2(com.badlogic.gdx.math.Vector2) ClampMethod(com.gempukku.libgdx.graph.shader.ClampMethod) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)

Aggregations

CurveWidget (com.talosvfx.talos.editor.widgets.CurveWidget)4 Actor (com.badlogic.gdx.scenes.scene2d.Actor)3 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)3 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)3 Vector2 (com.badlogic.gdx.math.Vector2)1 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)1 JsonValue (com.badlogic.gdx.utils.JsonValue)1 ClampMethod (com.gempukku.libgdx.graph.shader.ClampMethod)1 GraphBoxImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl)1 GraphBoxPartImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxPartImpl)1 GraphChangedEvent (com.gempukku.libgdx.graph.ui.graph.GraphChangedEvent)1 VisSelectBox (com.kotcrab.vis.ui.widget.VisSelectBox)1 VisTable (com.kotcrab.vis.ui.widget.VisTable)1 FloatRangeInputWidget (com.talosvfx.talos.editor.widgets.FloatRangeInputWidget)1 ShapeInputWidget (com.talosvfx.talos.editor.widgets.ShapeInputWidget)1