Search in sources :

Example 1 with Envelope

use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.

the class AnimationService method evalCurve.

public static double evalCurve(double pFrame, MotionCurve curve) {
    MotionCurve currCurve = curve;
    double value = 0.0;
    while (currCurve != null) {
        Envelope envelope = currCurve.toEnvelope();
        value += envelope.evaluate(pFrame);
        currCurve = currCurve.getParent();
    }
    return value;
}
Also used : MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve) Envelope(org.jwildfire.envelope.Envelope)

Example 2 with Envelope

use of org.jwildfire.envelope.Envelope 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();
}
Also used : Parameter(org.jwildfire.script.Parameter) Envelope(org.jwildfire.envelope.Envelope)

Example 3 with Envelope

use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.

the class ChannelMixerPanelDelegate method refreshCurve.

public void refreshCurve(Flame pFlame) {
    Envelope envelope = getCurve(pFlame).toEnvelope();
    ctrl.setEnvelope(envelope);
    envelopePanel.setEnvelope(envelope);
    ctrl.refreshEnvelope();
}
Also used : Envelope(org.jwildfire.envelope.Envelope)

Example 4 with Envelope

use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.

the class AbstractControlsDelegate method editMotionCurve.

protected void editMotionCurve(MotionCurve pCurve, double pInitialValue, String pPropName, String pLabel) {
    Envelope envelope = pCurve.toEnvelope();
    if (envelope.getX().length == 0) {
        int[] x = new int[] { 0 };
        if (pInitialValue <= envelope.getViewYMin() + 1) {
            envelope.setViewYMin(pInitialValue - 1.0);
        }
        if (pInitialValue >= envelope.getViewYMax() - 1) {
            envelope.setViewYMax(pInitialValue + 1.0);
        }
        double[] y = new double[] { pInitialValue };
        envelope.setValues(x, y);
    }
    EnvelopeDialog dlg = new EnvelopeDialog(SwingUtilities.getWindowAncestor(rootPanel), owner.getErrorHandler(), envelope, true);
    dlg.setFlameToPreview(EnvelopeDialogFlamePreviewType.MOTION_CURVE, owner.getCurrFlame(), pCurve);
    dlg.setTitle("Editing " + pLabel);
    dlg.setModal(true);
    dlg.setVisible(true);
    if (dlg.isConfirmed()) {
        Flame flame = owner.getCurrFlame();
        if (useUndoManager) {
            owner.undoManager.saveUndoPoint(flame);
        }
        if (dlg.isRemoved()) {
            pCurve.setEnabled(false);
        } else {
            pCurve.assignFromEnvelope(envelope);
            pCurve.setEnabled(true);
        }
        owner.refreshFlameImage(true, false, 1, true, false);
    }
}
Also used : Envelope(org.jwildfire.envelope.Envelope) Flame(org.jwildfire.create.tina.base.Flame)

Example 5 with Envelope

use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.

the class EnvelopePropertyEditor method selectEnvelope.

protected void selectEnvelope() {
    Envelope editEnvelope = envelope.clone();
    EnvelopeDialog dlg = new EnvelopeDialog(SwingUtilities.getWindowAncestor(editor), new ErrorHandler() {

        @Override
        public void handleError(Throwable pThrowable) {
            pThrowable.printStackTrace();
        }
    }, editEnvelope, false);
    dlg.setModal(true);
    dlg.setVisible(true);
    if (dlg.isConfirmed()) {
        Envelope oldEnvelope = envelope;
        label.setValue(editEnvelope);
        envelope = editEnvelope;
        firePropertyChange(oldEnvelope, editEnvelope);
    }
}
Also used : ErrorHandler(org.jwildfire.swing.ErrorHandler) Envelope(org.jwildfire.envelope.Envelope)

Aggregations

Envelope (org.jwildfire.envelope.Envelope)12 MotionCurve (org.jwildfire.create.tina.base.motion.MotionCurve)3 Parameter (org.jwildfire.script.Parameter)3 Flame (org.jwildfire.create.tina.base.Flame)2 File (java.io.File)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 SimpleImage (org.jwildfire.image.SimpleImage)1 Action (org.jwildfire.script.Action)1 ActionList (org.jwildfire.script.ActionList)1 ErrorHandler (org.jwildfire.swing.ErrorHandler)1