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();
}
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();
}
});
}
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();
}
});
}
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;
}
Aggregations