use of com.gempukku.libgdx.graph.data.GraphConnection in project gdx-graph by MarcinSc.
the class LibgdxGraphScreen method copy.
private void copy() {
GraphDesignTab activeTab = (GraphDesignTab) tabbedPane.getActiveTab();
if (activeTab != null) {
GraphType type = activeTab.getType();
GraphContainer graphContainer = activeTab.getGraphContainer();
ObjectSet<String> selectedNodes = graphContainer.getSelectedNodes();
Array<NodesInClipboard.NodesData> nodesData = new Array<>();
Array<GraphConnection> graphConnections = new Array<>();
ObjectSet<String> copiedNodes = new ObjectSet<>();
for (GraphBox graphBox : graphContainer.getGraphBoxes()) {
if (selectedNodes.contains(graphBox.getId()) && !graphBox.getId().equals("end")) {
VisWindow boxWindow = graphContainer.getBoxWindow(graphBox.getId());
nodesData.add(new NodesInClipboard.NodesData(new GraphNodeImpl(graphBox.getId(), graphBox.getData(), graphBox.getConfiguration()), boxWindow.getX(), boxWindow.getY()));
copiedNodes.add(graphBox.getId());
}
}
for (GraphConnection connection : graphContainer.getConnections()) {
if (copiedNodes.contains(connection.getNodeFrom()) && copiedNodes.contains(connection.getNodeTo()))
graphConnections.add(connection);
}
nodesInClipboard.graphType = type;
nodesInClipboard.nodesData = nodesData;
nodesInClipboard.graphConnections = graphConnections;
}
}
use of com.gempukku.libgdx.graph.data.GraphConnection in project gdx-graph by MarcinSc.
the class EndShadowShaderBoxProducer method createPipelineGraphBox.
@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
final ModelShaderPreviewBoxPart previewBoxPart = new ModelShaderPreviewBoxPart();
previewBoxPart.initialize(data);
GraphBoxImpl result = new GraphBoxImpl(id, getConfiguration()) {
@Override
public void graphChanged(GraphChangedEvent event, boolean hasErrors, Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
if (event.isData() || event.isStructure()) {
previewBoxPart.graphChanged(hasErrors, graph);
}
}
};
SelectBoxPart positionType = new SelectBoxPart("Position", "positionType", "Object space", "World space");
positionType.initialize(data);
result.addGraphBoxPart(positionType);
addConfigurationInputsAndOutputs(result);
EnumSelectBoxPart cullingBox = new EnumSelectBoxPart("Culling", "culling", new StringifyEnum<BasicShader.Culling>(), BasicShader.Culling.values());
cullingBox.initialize(data);
result.addGraphBoxPart(cullingBox);
EnumSelectBoxPart depthTestBox = new EnumSelectBoxPart("DepthTest", "depthTest", new StringifyEnum<BasicShader.DepthTesting>(), BasicShader.DepthTesting.values());
depthTestBox.initialize(data);
result.addGraphBoxPart(depthTestBox);
CheckboxBoxPart writeDepthBox = new CheckboxBoxPart("Write depth", "depthWrite");
writeDepthBox.initialize(data);
result.addGraphBoxPart(writeDepthBox);
result.addGraphBoxPart(previewBoxPart);
return result;
}
use of com.gempukku.libgdx.graph.data.GraphConnection in project gdx-graph by MarcinSc.
the class EndModelShaderBoxProducer method createPipelineGraphBox.
@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
final ModelShaderPreviewBoxPart previewBoxPart = new ModelShaderPreviewBoxPart();
previewBoxPart.initialize(data);
GraphBoxImpl result = new GraphBoxImpl(id, getConfiguration()) {
@Override
public void graphChanged(GraphChangedEvent event, boolean hasErrors, Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
if (event.isData() || event.isStructure()) {
previewBoxPart.graphChanged(hasErrors, graph);
}
}
};
SelectBoxPart positionType = new SelectBoxPart("Position", "positionType", "Object space", "World space");
positionType.initialize(data);
result.addGraphBoxPart(positionType);
addConfigurationInputsAndOutputs(result);
result.addGraphBoxPart(new SectionBoxPart("Rendering config"));
EnumSelectBoxPart cullingBox = new EnumSelectBoxPart("Culling", "culling", new StringifyEnum<BasicShader.Culling>(), BasicShader.Culling.values());
cullingBox.initialize(data);
result.addGraphBoxPart(cullingBox);
BlendingBoxPart blendingBox = new BlendingBoxPart();
blendingBox.initialize(data);
result.addGraphBoxPart(blendingBox);
EnumSelectBoxPart depthTestBox = new EnumSelectBoxPart("DepthTest", "depthTest", new StringifyEnum<BasicShader.DepthTesting>(), BasicShader.DepthTesting.values());
depthTestBox.initialize(data);
result.addGraphBoxPart(depthTestBox);
CheckboxBoxPart writeDepthBox = new CheckboxBoxPart("Write depth", "depthWrite");
writeDepthBox.initialize(data);
result.addGraphBoxPart(writeDepthBox);
result.addGraphBoxPart(new SectionBoxPart("Preview"));
result.addGraphBoxPart(previewBoxPart);
return result;
}
use of com.gempukku.libgdx.graph.data.GraphConnection in project gdx-graph by MarcinSc.
the class EndParticlesShaderBoxProducer method createPipelineGraphBox.
@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
final ParticlesShaderPreviewBoxPart previewBoxPart = new ParticlesShaderPreviewBoxPart();
previewBoxPart.initialize(data);
GraphBoxImpl result = new GraphBoxImpl(id, getConfiguration()) {
@Override
public void graphChanged(GraphChangedEvent event, boolean hasErrors, Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
if (event.isData() || event.isStructure()) {
previewBoxPart.graphChanged(hasErrors, graph);
}
}
};
IntegerBoxPart particleCountBox = new IntegerBoxPart("Max particles ", "maxParticles", 100, new Validators.GreaterThanValidator(0, false));
particleCountBox.initialize(data);
result.addGraphBoxPart(particleCountBox);
addConfigurationInputsAndOutputs(result);
result.addGraphBoxPart(new SectionBoxPart("Rendering config"));
EnumSelectBoxPart cullingBox = new EnumSelectBoxPart("Culling", "culling", new StringifyEnum<BasicShader.Culling>(), BasicShader.Culling.values());
cullingBox.initialize(data);
result.addGraphBoxPart(cullingBox);
BlendingBoxPart blendingBox = new BlendingBoxPart();
blendingBox.initialize(data);
result.addGraphBoxPart(blendingBox);
EnumSelectBoxPart depthTestBox = new EnumSelectBoxPart("DepthTest", "depthTest", new StringifyEnum<BasicShader.DepthTesting>(), BasicShader.DepthTesting.values());
depthTestBox.initialize(data);
result.addGraphBoxPart(depthTestBox);
CheckboxBoxPart writeDepthBox = new CheckboxBoxPart("Write depth", "depthWrite");
writeDepthBox.initialize(data);
result.addGraphBoxPart(writeDepthBox);
result.addGraphBoxPart(new SectionBoxPart("Preview"));
result.addGraphBoxPart(previewBoxPart);
return result;
}
use of com.gempukku.libgdx.graph.data.GraphConnection in project gdx-graph by MarcinSc.
the class LibgdxGraphScreen method paste.
private void paste() {
GraphDesignTab activeTab = (GraphDesignTab) tabbedPane.getActiveTab();
if (activeTab != null) {
GraphType type = activeTab.getType();
if (nodesInClipboard.graphType != null && type.getType().equals(nodesInClipboard.graphType.getType())) {
ObjectMap<String, String> oldToNewIdMapping = new ObjectMap<>();
UIGraphConfiguration[] uiGraphConfigurations = activeTab.getUiGraphConfigurations();
// Do the actual paste
for (NodesInClipboard.NodesData nodesDatum : nodesInClipboard.nodesData) {
String id = UUID.randomUUID().toString().replace("-", "");
GraphBoxProducer graphBoxProducer = findGraphBoxProducer(uiGraphConfigurations, nodesDatum.graphNode.getConfiguration().getType());
GraphBox graphBox = graphBoxProducer.createPipelineGraphBox(skin, id, nodesDatum.graphNode.getData());
activeTab.getGraphContainer().addGraphBox(graphBox, nodesDatum.graphNode.getConfiguration().getName(), true, nodesDatum.x, nodesDatum.y);
oldToNewIdMapping.put(nodesDatum.graphNode.getId(), id);
}
for (GraphConnection graphConnection : nodesInClipboard.graphConnections) {
activeTab.getGraphContainer().addGraphConnection(oldToNewIdMapping.get(graphConnection.getNodeFrom()), graphConnection.getFieldFrom(), oldToNewIdMapping.get(graphConnection.getNodeTo()), graphConnection.getFieldTo());
}
}
}
}
Aggregations