Search in sources :

Example 26 with GraphBoxImpl

use of com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl in project gdx-graph by MarcinSc.

the class TimeShaderBoxProducer method createPipelineGraphBox.

@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
    GraphBoxImpl result = createGraphBox(id);
    FloatBoxPart multiplierPart = new FloatBoxPart("Multiplier", "multiplier", 1f, null);
    multiplierPart.initialize(data);
    result.addGraphBoxPart(multiplierPart);
    addConfigurationInputsAndOutputs(result);
    return result;
}
Also used : FloatBoxPart(com.gempukku.libgdx.graph.ui.part.FloatBoxPart) GraphBoxImpl(com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl)

Example 27 with GraphBoxImpl

use of com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl in project gdx-graph by MarcinSc.

the class ConditionalShaderBoxProducer method createPipelineGraphBox.

@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
    GraphBoxImpl result = createGraphBox(id);
    addConfigurationInputsAndOutputs(result);
    SelectBoxPart operationType = new SelectBoxPart("Operation", "operation", ">", ">=", "==", "<=", "<", "!=");
    operationType.initialize(data);
    result.addGraphBoxPart(operationType);
    SelectBoxPart aggregationType = new SelectBoxPart("Aggregate", "aggregate", "any", "all");
    aggregationType.initialize(data);
    result.addGraphBoxPart(aggregationType);
    return result;
}
Also used : GraphBoxImpl(com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl) SelectBoxPart(com.gempukku.libgdx.graph.ui.part.SelectBoxPart)

Example 28 with GraphBoxImpl

use of com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl in project gdx-graph by MarcinSc.

the class SceneColorShaderBoxProducer method createPipelineGraphBox.

@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
    GraphBoxImpl result = createGraphBox(id);
    addConfigurationInputsAndOutputs(result);
    TextureSettingsGraphBoxPart textureSettingsPart = new TextureSettingsGraphBoxPart();
    textureSettingsPart.initialize(data);
    result.addGraphBoxPart(textureSettingsPart);
    return result;
}
Also used : GraphBoxImpl(com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl) TextureSettingsGraphBoxPart(com.gempukku.libgdx.graph.ui.graph.property.TextureSettingsGraphBoxPart)

Example 29 with GraphBoxImpl

use of com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl in project gdx-graph by MarcinSc.

the class GradientShaderBoxProducer method createPipelineGraphBox.

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

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            gradientWidget.fire(new GraphChangedEvent(false, true));
        }
    });
    gradientWidget.setListener(new GradientWidget.GradientWidgetListener() {

        @Override
        public void colorPickerShow(final ColorPoint point, final Runnable onSuccess) {
            final ColorPicker picker = new ColorPicker();
            picker.setColor(point.color);
            picker.setListener(new ColorPickerAdapter() {

                @Override
                public void finished(Color newColor) {
                    point.color.set(newColor);
                    picker.dispose();
                    onSuccess.run();
                    result.getActor().fire(new GraphChangedEvent(false, true));
                }

                @Override
                public void canceled(Color oldColor) {
                    picker.dispose();
                }
            });
            gradientWidget.getStage().addActor(picker.fadeIn());
        }
    });
    result.addGraphBoxPart(new GraphBoxPartImpl(gradientWidget, new GraphBoxPartImpl.Callback() {

        @Override
        public void serialize(JsonValue object) {
            Array<ColorPoint> points = gradientWidget.getPoints();
            JsonValue pointsValue = new JsonValue(JsonValue.ValueType.array);
            for (ColorPoint point : points) {
                pointsValue.addChild(new JsonValue(point.color.toString() + "," + SimpleNumberFormatter.format(point.pos)));
            }
            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) {
            result.getActor().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 : GraphBoxImpl(com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl) GraphChangedEvent(com.gempukku.libgdx.graph.ui.graph.GraphChangedEvent) ColorPicker(com.kotcrab.vis.ui.widget.color.ColorPicker) Color(com.badlogic.gdx.graphics.Color) 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) GradientWidget(com.talosvfx.talos.editor.widgets.GradientWidget) ClampMethod(com.gempukku.libgdx.graph.shader.ClampMethod) ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) ColorPickerAdapter(com.kotcrab.vis.ui.widget.color.ColorPickerAdapter)

Example 30 with GraphBoxImpl

use of com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl in project gdx-graph by MarcinSc.

the class PropertyPipelineGraphBoxProducer method createPipelineGraphBox.

@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
    final String name = data.getString("name");
    final String propertyType = data.getString("type");
    GraphBoxImpl result = new GraphBoxImpl(id, new PropertyNodeConfiguration(name, propertyType)) {

        @Override
        public JsonValue getData() {
            JsonValue result = super.getData();
            if (result == null)
                result = new JsonValue(JsonValue.ValueType.object);
            result.addChild("name", new JsonValue(name));
            result.addChild("type", new JsonValue(propertyType));
            return result;
        }
    };
    result.addOutputGraphPart(new ValueGraphNodeOutput(name, propertyType));
    return result;
}
Also used : GraphBoxImpl(com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl) PropertyNodeConfiguration(com.gempukku.libgdx.graph.config.PropertyNodeConfiguration) JsonValue(com.badlogic.gdx.utils.JsonValue) ValueGraphNodeOutput(com.gempukku.libgdx.graph.ui.producer.ValueGraphNodeOutput)

Aggregations

GraphBoxImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl)33 StringBoxPart (com.gempukku.libgdx.graph.ui.part.StringBoxPart)10 JsonValue (com.badlogic.gdx.utils.JsonValue)7 GraphChangedEvent (com.gempukku.libgdx.graph.ui.graph.GraphChangedEvent)6 Graph (com.gempukku.libgdx.graph.data.Graph)4 GraphConnection (com.gempukku.libgdx.graph.data.GraphConnection)4 GraphNode (com.gempukku.libgdx.graph.data.GraphNode)4 GraphProperty (com.gempukku.libgdx.graph.data.GraphProperty)4 IndexBoxPart (com.gempukku.libgdx.graph.ui.part.IndexBoxPart)4 SelectBoxPart (com.gempukku.libgdx.graph.ui.part.SelectBoxPart)4 PropertyNodeConfiguration (com.gempukku.libgdx.graph.config.PropertyNodeConfiguration)3 GraphBoxPartImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxPartImpl)3 CheckboxBoxPart (com.gempukku.libgdx.graph.ui.part.CheckboxBoxPart)3 EnumSelectBoxPart (com.gempukku.libgdx.graph.ui.part.EnumSelectBoxPart)3 ValueGraphNodeOutput (com.gempukku.libgdx.graph.ui.producer.ValueGraphNodeOutput)3 VisTable (com.kotcrab.vis.ui.widget.VisTable)3 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)2 RenderOrder (com.gempukku.libgdx.graph.pipeline.RenderOrder)2 ClampMethod (com.gempukku.libgdx.graph.shader.ClampMethod)2