use of org.jwildfire.script.Parameter in project JWildfire by thargor6.
the class EnvelopeController method setCurrAction.
public void setCurrAction(Action currAction) {
this.currAction = currAction;
setCurrEnvelope(null);
propertyCmb.removeAllItems();
if (currAction != null) {
for (Parameter parameter : currAction.getParameterList()) {
if (isNumber(parameter.getValue()))
propertyCmb.addItem(parameter.getName());
}
}
}
use of org.jwildfire.script.Parameter in project JWildfire by thargor6.
the class EnvelopeController method createEnvelope.
public void createEnvelope() {
String propName = (String) propertyCmb.getSelectedItem();
Parameter parameter = currAction.getParameterByName(propName);
Double val = Double.parseDouble(parameter.getValue());
Envelope env = new Envelope(val);
env.select(0);
parameter.setEnvelope(env);
setCurrEnvelope(env);
enableControls();
refreshEnvelope();
}
use of org.jwildfire.script.Parameter in project JWildfire by thargor6.
the class EnvelopeController method removeEnvelope.
public void removeEnvelope() {
String propName = (String) propertyCmb.getSelectedItem();
Parameter parameter = currAction.getParameterByName(propName);
parameter.setEnvelope(null);
setCurrEnvelope(null);
enableControls();
refreshEnvelope();
}
use of org.jwildfire.script.Parameter in project JWildfire by thargor6.
the class RenderThread method run.
@Override
public void run() {
done = false;
try {
forceAbort = false;
error = null;
try {
for (int frame = frameMin; frame <= frameMax; frame++) {
if (forceAbort)
break;
ActionList actions = actionList.clone();
// generate Filename
String frameStr = String.valueOf(frame);
while (frameStr.length() < 4) frameStr = "0" + frameStr;
String filename = basePath + frameStr + ".jpg";
// calculate parameters
for (Action action : actions) {
if (action.hasEnvelopes()) {
for (Parameter parameter : action.getParameterList()) {
Envelope envelope = parameter.getEnvelope();
if (envelope != null) {
double val = envelope.evaluate(frame);
parameter.setValue(Tools.doubleToString(val));
}
}
}
}
// render the image
ScriptProcessor scriptProcessor = new ScriptProcessor(desktop);
scriptProcessor.setAddBuffersToDesktop(false);
// dummy image just to call the init-method of transformers (which makes sense if script lack some parameters)
SimpleImage paramInitImg = null;
for (Action action : actions) {
switch(action.getActionType()) {
case EXECUTE_CREATOR:
scriptProcessor.selectCreator(action.getParameter());
action.setProperties(scriptProcessor.getCreator(), scriptProcessor.getBufferList());
scriptProcessor.executeCreator(action.getWidth(), action.getHeight(), action.getOutputBuffer(), false);
break;
case EXECUTE_LOADER:
scriptProcessor.selectLoader(action.getParameter());
action.setProperties(scriptProcessor.getLoader(), scriptProcessor.getBufferList());
scriptProcessor.executeLoader(action.getOutputBuffer(), false);
break;
case EXECUTE_TRANSFORMER:
scriptProcessor.selectTransformer(action.getParameter());
if (paramInitImg == null)
paramInitImg = new SimpleImage(320, 256);
scriptProcessor.getTransformer().initDefaultParams(paramInitImg);
action.setProperties(scriptProcessor.getTransformer(), scriptProcessor.getBufferList());
scriptProcessor.executeTransformer(action.getInputBuffer(), action.getOutputBuffer3D() != null, action.getOutputBuffer(), action.getOutputBuffer3D(), false);
break;
case LOAD_IMAGE:
scriptProcessor.loadImage(action.getParameter());
break;
}
}
// Save file
SimpleImage img = scriptProcessor.getLastImage();
switch(mode) {
case BATCH:
scriptProcessor.saveLastImage(filename);
reporter.showProgress(frame, new File(filename).getName(), img);
break;
case SINGLE_FRAME:
lastImage = img;
break;
}
}
} catch (Exception ex) {
error = ex;
}
} finally {
done = true;
reporter.renderingFinished();
}
}
use of org.jwildfire.script.Parameter in project JWildfire by thargor6.
the class EnvelopeController method propertyCmbChanged.
public void propertyCmbChanged() {
String propName = (String) propertyCmb.getSelectedItem();
Parameter parameter = currAction.getParameterByName(propName);
Envelope envelope = (parameter != null) ? parameter.getEnvelope() : null;
setCurrEnvelope(envelope);
enableControls();
refreshEnvelope();
}
Aggregations