Package org.jwildfire.envelope

Examples of org.jwildfire.envelope.Envelope


  }

  protected void editCurve(ActionEvent e) {
    Flame flame = owner.getOwner().getCurrFlame();
    MotionCurve curve = getCurve(flame);
    Envelope envelope = curve.toEnvelope();
    EnvelopeDialog dlg = new EnvelopeDialog(SwingUtilities.getWindowAncestor(rootPanel), owner.getErrorHandler(), envelope, false);
    dlg.setFlameToPreview(EnvelopeDialogFlamePreviewType.COLOR_CURVE, flame, curve);

    dlg.setTitle("Editing motion curve");
    dlg.setModal(true);
View Full Code Here


  }

  public abstract MotionCurve getCurve(Flame pFlame);

  public void refreshCurve(Flame pFlame) {
    Envelope envelope = getCurve(pFlame).toEnvelope();
    ctrl.setEnvelope(envelope);
    envelopePanel.setEnvelope(envelope);
    ctrl.refreshEnvelope();
  }
View Full Code Here

    envelope = (Envelope) value;
    label.setValue(value);
  }

  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);
    }
  }
View Full Code Here

  private 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;
  }
View Full Code Here

      addEnvelope(pFrameCount, curve, points.getEnvX(), points.getEnvY());
    }
  }

  private static void addEnvelope(int pFrameCount, MotionCurve curve, int[] envX, double[] envY) {
    Envelope envelope = new Envelope(envX, envY);
    envelope.setViewXMin(-10);
    envelope.setViewXMax(10 + pFrameCount);
    envelope.setViewYMin(-10000.0);
    envelope.setViewYMax(10000.0);
    envelope.setInterpolation(Interpolation.SPLINE);
    envelope.setSelectedIdx(0);

    if (!curve.isEnabled()) {
      curve.assignFromEnvelope(envelope);
      curve.setEnabled(true);
    }
View Full Code Here

      int row = actionTable.getSelectedRow();
      if ((row >= 0) && (row < actionList.size())) {
        Action action = actionList.get(row);
        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));
            }
          }

          StringBuffer b = new StringBuffer();
View Full Code Here

  }

  public void propertyCmbChanged() {
    String propName = (String) propertyCmb.getSelectedItem();
    Parameter parameter = currAction.getParameterByName(propName);
    Envelope envelope = (parameter != null) ? parameter.getEnvelope() : null;
    setCurrEnvelope(envelope);
    enableControls();
    refreshEnvelope();
  }
View Full Code Here

  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();
  }
View Full Code Here

          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));
                }
              }
            }
          }
View Full Code Here

            String ident = matcher.group(1);
            String paramName = matcher.group(3);
            Parameter param = res.getParameterByName(paramName);
            if (param == null)
              throw new IllegalArgumentException(currLines.get(i));
            Envelope envelope = new Envelope();
            param.setEnvelope(envelope);
            while (i < currLines.size() - 1) {
              i++;
              // view
              {
                Matcher subMatcher = envelopeViewPattern.matcher(currLines.get(i));
                if (subMatcher.find()) {
                  String subIdent = subMatcher.group(1);
                  if (subIdent.length() < ident.length())
                    throw new IllegalArgumentException(currLines.get(i));
                  try {
                    envelope.setViewXMin(Tools.FTOI(Double.parseDouble(subMatcher.group(3))));
                    envelope.setViewXMax(Tools.FTOI(Double.parseDouble(subMatcher.group(5))));
                    envelope.setViewYMin(Double.parseDouble(subMatcher.group(7)));
                    envelope.setViewYMax(Double.parseDouble(subMatcher.group(9)));
                  }
                  catch (Exception ex) {
                    throw new IllegalArgumentException(currLines.get(i));
                  }
                  continue;
                }
              }
              // points
              {
                Matcher subMatcher = envelopePointsPattern.matcher(currLines.get(i));
                if (subMatcher.find()) {
                  String subIdent = subMatcher.group(1);
                  if (subIdent.length() < ident.length())
                    throw new IllegalArgumentException(currLines.get(i));
                  try {
                    String points[] = subMatcher.group(2).trim().split(" ");
                    int x[] = new int[points.length / 2];
                    double y[] = new double[points.length / 2];
                    for (int j = 0; j < points.length; j += 2) {
                      x[j / 2] = Tools.FTOI(Double.parseDouble(points[j]));
                      y[j / 2] = Double.parseDouble(points[j + 1]);
                    }
                    envelope.setValues(x, y);
                  }
                  catch (Exception ex) {
                    throw new IllegalArgumentException(currLines.get(i));
                  }
                  continue;
                }
              }
              // selected
              {
                Matcher subMatcher = envelopeSelectedPattern.matcher(currLines.get(i));
                if (subMatcher.find()) {
                  String subIdent = subMatcher.group(1);
                  if (subIdent.length() < ident.length())
                    throw new IllegalArgumentException(currLines.get(i));
                  try {
                    envelope.setSelectedIdx(Tools.FTOI(Double.parseDouble(subMatcher.group(3))));
                  }
                  catch (Exception ex) {
                    throw new IllegalArgumentException(currLines.get(i));
                  }
                  continue;
                }
              }
              // interpolation
              {
                Matcher subMatcher = envelopeInterpolationPattern.matcher(currLines.get(i));
                if (subMatcher.find()) {
                  String subIdent = subMatcher.group(1);
                  if (subIdent.length() < ident.length())
                    throw new IllegalArgumentException(currLines.get(i));
                  try {
                    String interpolationStr = subMatcher.group(3);
                    envelope.setInterpolation(Envelope.Interpolation.valueOf(interpolationStr));
                  }
                  catch (Exception ex) {
                    throw new IllegalArgumentException(currLines.get(i));
                  }
                  continue;
                }
              }
              // locked
              {
                Matcher subMatcher = envelopeLockedPattern.matcher(currLines.get(i));
                if (subMatcher.find()) {
                  String subIdent = subMatcher.group(1);
                  if (subIdent.length() < ident.length())
                    throw new IllegalArgumentException(currLines.get(i));
                  try {
                    String lockedStr = subMatcher.group(3);
                    envelope.setLocked(lockedStr.equalsIgnoreCase("true"));
                  }
                  catch (Exception ex) {
                    throw new IllegalArgumentException(currLines.get(i));
                  }
                  continue;
View Full Code Here

TOP

Related Classes of org.jwildfire.envelope.Envelope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.