Search in sources :

Example 26 with Variation

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

the class TinaController method nonlinearParamsCmbChanged.

public void nonlinearParamsCmbChanged(int pIdx) {
    if (cmbRefreshing) {
        return;
    }
    cmbRefreshing = true;
    try {
        String selected = (String) data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsCmb().getSelectedItem();
        XForm xForm = getCurrXForm();
        if (xForm != null && selected != null && selected.length() > 0) {
            if (pIdx < xForm.getVariationCount()) {
                Variation var = xForm.getVariation(pIdx);
                // params
                int idx;
                if ((idx = var.getFunc().getParameterIndex(selected)) >= 0) {
                    enableNonlinearControls(data.TinaNonlinearControlsRows[pIdx], false);
                    data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setOnlyIntegers(false);
                    Object val = var.getFunc().getParameterValues()[idx];
                    if (val instanceof Double) {
                        data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(Tools.doubleToString((Double) val));
                    } else if (val instanceof Integer) {
                        data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(val.toString());
                        data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setOnlyIntegers(true);
                    } else {
                        data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(val.toString());
                    }
                } else // ressources
                if ((idx = var.getFunc().getRessourceIndex(selected)) >= 0) {
                    enableNonlinearControls(data.TinaNonlinearControlsRows[pIdx], true);
                    data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(null);
                } else // empty
                {
                    data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(null);
                }
            }
        }
    } 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