Search in sources :

Example 26 with MotionCurve

use of org.jwildfire.create.tina.base.motion.MotionCurve 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)

Aggregations

MotionCurve (org.jwildfire.create.tina.base.motion.MotionCurve)26 Field (java.lang.reflect.Field)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 Variation (org.jwildfire.create.tina.variation.Variation)5 VariationFunc (org.jwildfire.create.tina.variation.VariationFunc)4 MotionCurveAttribute (org.jwildfire.create.tina.animate.AnimationService.MotionCurveAttribute)3 Flame (org.jwildfire.create.tina.base.Flame)3 Envelope (org.jwildfire.envelope.Envelope)3 Map (java.util.Map)2 XMLAttributes (org.jwildfire.base.Tools.XMLAttributes)2 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)2 VariationFuncList (org.jwildfire.create.tina.variation.VariationFuncList)2 HashMap (java.util.HashMap)1 ImageIcon (javax.swing.ImageIcon)1 XMLAttribute (org.jwildfire.base.Tools.XMLAttribute)1 XForm (org.jwildfire.create.tina.base.XForm)1 DistantLight (org.jwildfire.create.tina.base.solidrender.DistantLight)1 MaterialSettings (org.jwildfire.create.tina.base.solidrender.MaterialSettings)1 SolidRenderSettings (org.jwildfire.create.tina.base.solidrender.SolidRenderSettings)1