Search in sources :

Example 21 with Variation

use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.

the class XForm method createTransformations.

private void createTransformations() {
    t = new ArrayList<TransformationStep>();
    t.add(new TransformationInitStep(this));
    if (!isHasXYCoeffs() && !isHasYZCoeffs() && !isHasZXCoeffs()) {
        t.add(new TransformationAffineNoneStep(this));
    } else if (isHasXYCoeffs() && !isHasYZCoeffs() && !isHasZXCoeffs()) {
        t.add(new TransformationAffineFlatStep(this));
    } else {
        t.add(new TransformationAffineFullStep(this));
    }
    t.add(new TransformationPreparePreVariationsStep(this));
    for (Variation variation : variations) {
        if (variation.getPriority() < 0 || variation.getPriority() == 2) {
            if (variation.getFunc().getPriority() == 2) {
                t.add(new PreInvVariationTransformationStep(this, variation));
            } else if (variation.getFunc().getPriority() < 0) {
                t.add(new PreVariationTransformationStep(this, variation));
            } else {
                t.add(new EnforcedPreVariationTransformationStep(this, variation));
            }
        }
    }
    t.add(new TransformationPrepareVariationsStep(this));
    for (Variation variation : variations) {
        if (variation.getPriority() == 0) {
            if (variation.getFunc().getPriority() == 0) {
                t.add(new VariationTransformationStep(this, variation));
            } else {
                t.add(new EnforcedVariationTransformationStep(this, variation));
            }
        }
    }
    for (Variation variation : variations) {
        if (variation.getPriority() > 0 || variation.getPriority() == -2) {
            if (variation.getFunc().getPriority() == -2) {
                t.add(new PostInvVariationTransformationStep(this, variation));
            } else if (variation.getFunc().getPriority() > 0) {
                t.add(new PostVariationTransformationStep(this, variation));
            } else {
                t.add(new EnforcedPostVariationTransformationStep(this, variation));
            }
        }
    }
    t.add(new TransformationPreparePostAffineStep(this));
    if (!isHasXYPostCoeffs() && !isHasYZPostCoeffs() && !isHasZXPostCoeffs()) {
        t.add(new TransformationPostAffineNoneStep(this));
    } else if (isHasXYPostCoeffs() && !isHasYZPostCoeffs() && !isHasZXPostCoeffs()) {
        t.add(new TransformationPostAffineFlatStep(this));
    } else {
        t.add(new TransformationPostAffineStep(this));
    }
}
Also used : Variation(org.jwildfire.create.tina.variation.Variation)

Example 22 with Variation

use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.

the class XForm method addVariation.

public Variation addVariation(double pAmount, VariationFunc pVariationFunc) {
    Variation variation = new Variation();
    variation.setAmount(pAmount);
    variation.setFunc(pVariationFunc);
    variation.setPriority(pVariationFunc.getPriority());
    variations.add(variation);
    return variation;
}
Also used : Variation(org.jwildfire.create.tina.variation.Variation)

Example 23 with Variation

use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.

the class VariationControlsDelegate method getCurveToEdit.

@Override
public MotionCurve getCurveToEdit(String pPropName) {
    XForm xForm = owner.getCurrXForm();
    Variation var = xForm.getVariation(variationIndex);
    return AnimationService.getPropertyCurve(var, pPropName);
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Variation(org.jwildfire.create.tina.variation.Variation)

Example 24 with Variation

use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.

the class TinaController method nonlinearParamsEditMotionCurve.

public void nonlinearParamsEditMotionCurve(int pIdx) {
    String propertyname = (String) data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsCmb().getSelectedItem();
    XForm xForm = getCurrXForm();
    if (xForm != null && propertyname != null && propertyname.length() > 0) {
        if (pIdx < xForm.getVariationCount()) {
            Variation var = xForm.getVariation(pIdx);
            if (var.getFunc().getParameterIndex(propertyname) >= 0) {
                double initialValue;
                try {
                    String valStr = data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().getText();
                    if (valStr == null || valStr.length() == 0) {
                        valStr = "0";
                    }
                    initialValue = Double.parseDouble(valStr);
                } catch (Exception ex) {
                    initialValue = 0.0;
                }
                MotionCurve curve = var.getMotionCurve(propertyname);
                if (curve == null) {
                    curve = var.createMotionCurve(propertyname);
                }
                variationControlsDelegates[pIdx].editMotionCurve(curve, initialValue, propertyname, "variation property \"" + propertyname + "\"");
                // Doesnt work after changing parameter -> now enable it always
                // variationControlsDelegates[pIdx].enableControl(data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd(), curve, false);
                refreshFlameImage(true, false, 1, true, false);
            }
        }
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve) Variation(org.jwildfire.create.tina.variation.Variation)

Example 25 with Variation

use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.

the class TinaController method propertyPnlValueChanged.

public void propertyPnlValueChanged(int pIdx, String pPropertyName, double pPropertyValue, boolean pIsAdjusting) {
    if (cmbRefreshing) {
        return;
    }
    cmbRefreshing = true;
    try {
        XForm xForm = getCurrXForm();
        if (xForm != null) {
            if (pIdx < xForm.getVariationCount()) {
                Variation var = xForm.getVariation(pIdx);
                var.getFunc().setParameter(pPropertyName, pPropertyValue);
                if (!pIsAdjusting && var.getFunc().dynamicParameterExpansion(pPropertyName)) {
                    // if setting the parameter can change the total number of parameters,
                    // then refresh parameter UI
                    this.refreshParamControls(data.TinaNonlinearControlsRows[pIdx], xForm, var, true);
                }
                refreshFlameImage(true, false, 1, true, false);
            }
        }
    } finally {
        cmbRefreshing = false;
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Variation(org.jwildfire.create.tina.variation.Variation)

Aggregations

Variation (org.jwildfire.create.tina.variation.Variation)26 XForm (org.jwildfire.create.tina.base.XForm)15 VariationFunc (org.jwildfire.create.tina.variation.VariationFunc)9 ArrayList (java.util.ArrayList)5 MotionCurve (org.jwildfire.create.tina.base.motion.MotionCurve)5 List (java.util.List)4 Field (java.lang.reflect.Field)3 Flame (org.jwildfire.create.tina.base.Flame)3 Layer (org.jwildfire.create.tina.base.Layer)3 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)2 Font (java.awt.Font)1 File (java.io.File)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 JFileChooser (javax.swing.JFileChooser)1 XMLAttribute (org.jwildfire.base.Tools.XMLAttribute)1 XMLAttributes (org.jwildfire.base.Tools.XMLAttributes)1 AnimAware (org.jwildfire.create.tina.animate.AnimAware)1 MotionCurveAttribute (org.jwildfire.create.tina.animate.AnimationService.MotionCurveAttribute)1