Search in sources :

Example 1 with MotionCurve

use of org.jwildfire.create.tina.base.motion.MotionCurve in project JWildfire by thargor6.

the class Variation method createMotionCurve.

public MotionCurve createMotionCurve(String pName) {
    if (getMotionCurve(pName) != null) {
        throw new RuntimeException("Motion curve <" + pName + "> already exists");
    }
    MotionCurve curve = new MotionCurve();
    motionCurves.put(pName, curve);
    return curve;
}
Also used : MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve)

Example 2 with MotionCurve

use of org.jwildfire.create.tina.base.motion.MotionCurve in project JWildfire by thargor6.

the class Variation method assign.

@Override
public void assign(Variation var) {
    amount = var.amount;
    amountCurve.assign(var.amountCurve);
    // motionCurves
    motionCurves.clear();
    for (String name : var.motionCurves.keySet()) {
        MotionCurve copy = new MotionCurve();
        copy.assign(var.motionCurves.get(name));
        motionCurves.put(name, copy);
    }
    // variation function
    func = var.func.makeCopy();
    priority = var.priority;
}
Also used : MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve)

Example 3 with MotionCurve

use of org.jwildfire.create.tina.base.motion.MotionCurve in project JWildfire by thargor6.

the class Variation method getClonedMotionCurves.

public Map<String, MotionCurve> getClonedMotionCurves() {
    Map<String, MotionCurve> res = new HashMap<String, MotionCurve>();
    for (Entry<String, MotionCurve> curveToCopy : motionCurves.entrySet()) {
        MotionCurve copy = new MotionCurve();
        copy.assign(curveToCopy.getValue());
        res.put(curveToCopy.getKey(), copy);
    }
    return res;
}
Also used : HashMap(java.util.HashMap) MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve)

Example 4 with MotionCurve

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

use of org.jwildfire.create.tina.base.motion.MotionCurve in project JWildfire by thargor6.

the class AnimationService method _disableMotionCurves.

private static void _disableMotionCurves(Object pObject) throws IllegalAccessException {
    Class<?> cls = pObject.getClass();
    for (Field field : cls.getDeclaredFields()) {
        field.setAccessible(true);
        if (field.getType() == MotionCurve.class && field.getName().endsWith(Tools.CURVE_POSTFIX)) {
            MotionCurve curve = (MotionCurve) field.get(pObject);
            if (curve.isEnabled()) {
                curve.setEnabled(false);
            }
        } else if (field.getType().isAssignableFrom(ArrayList.class)) {
            List<?> childs = (List<?>) field.get(pObject);
            for (Object child : childs) {
                _disableMotionCurves(child);
            }
        } else if (field.getType().isAssignableFrom(RGBPalette.class)) {
            RGBPalette gradient = (RGBPalette) field.get(pObject);
            _disableMotionCurves(gradient);
        }
    }
    if (pObject instanceof Variation) {
        Variation var = (Variation) pObject;
        VariationFunc func = var.getFunc();
        for (String name : func.getParameterNames()) {
            MotionCurve curve = var.getMotionCurve(name);
            if (curve != null && curve.isEnabled()) {
                curve.setEnabled(false);
            }
        }
    }
}
Also used : Field(java.lang.reflect.Field) MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Variation(org.jwildfire.create.tina.variation.Variation) VariationFunc(org.jwildfire.create.tina.variation.VariationFunc)

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