Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
package com.marginallyclever.makelangelo.donatelloimpl.nodes;
import com.marginallyclever.nodegraphcore.Node;
import com.marginallyclever.nodegraphcore.NodeVariable;
import com.marginallyclever.makelangelo.makeart.io.TurtleFactory;
import com.marginallyclever.makelangelo.turtle.Turtle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SaveTurtle extends Node {
private static final Logger logger = LoggerFactory.getLogger(SaveTurtle.class);
private final NodeVariable<String> filename = NodeVariable.newInstance("filename",String.class,null,true,false);
private final NodeVariable<Turtle> turtle = NodeVariable.newInstance("turtle", Turtle.class,new Turtle(),true,false);
public SaveTurtle() {
super("SaveTurtle");
addVariable(filename);
addVariable(turtle);
}
@Override
public void update() throws Exception {
if(filename.getValue().isEmpty()) return;
try {
TurtleFactory.save(turtle.getValue(),filename.getValue());
cleanAllInputs();
} catch (Exception e) {
logger.warn("Failed to update, ignoring", e);
}
}
}
cfb67a76cThis file is pinned to the selected release. Download the original to open it in your design tool.