Search in sources :

Example 1 with ShapeInputWidget

use of com.talosvfx.talos.editor.widgets.ShapeInputWidget 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)

Aggregations

Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)1 CurveWidget (com.talosvfx.talos.editor.widgets.CurveWidget)1 ShapeInputWidget (com.talosvfx.talos.editor.widgets.ShapeInputWidget)1