Search in sources :

Example 56 with Flame

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

the class DanceFlameTransformer method createTransformedFlame.

public Flame createTransformedFlame(DancingFlame pFlame, short[] pFFTData, long pTime, int pFPS) {
    Flame res = pFlame.getFlame().makeCopy();
    List<Motion> motions = project.getMotions(res);
    Flame refFlame = res.makeCopy();
    for (FlamePreprocessor preprocessor : project.getPreprocessors()) {
        if (preprocessor.isActive(pTime, pFPS)) {
            res = preprocessor.preprocessFlame(project, res).makeCopy();
            if (preprocessor instanceof FlameMotionPreprocessor) {
                motions = ((FlameMotionPreprocessor) preprocessor).preprocessMotions(project, motions);
                refFlame = res.makeCopy();
            }
        }
    }
    for (Motion motion : motions) {
        if (motion.getParent() == null && motion.isActive(pTime, pFPS)) {
            double value = 0.0;
            int iter = 0;
            Motion currMotion = motion;
            while (currMotion != null) {
                value += currMotion.computeValue(pFFTData, pTime, pFPS);
                Motion refMotion = currMotion;
                currMotion = null;
                for (Motion nextMotion : motions) {
                    if (nextMotion.isActive(pTime, pFPS) && nextMotion.getParent() == refMotion) {
                        currMotion = nextMotion;
                        break;
                    }
                }
                iter++;
                if (iter > 100) {
                    throw new RuntimeException("Probably endless loop detected");
                }
            }
            for (MotionLink link : motion.getMotionLinks()) {
                if (link.getProperyPath().getFlame().isEqual(refFlame)) {
                    AnimationModelService.setFlameProperty(res, link.getProperyPath(), value);
                }
            }
        }
    }
    return res;
}
Also used : Flame(org.jwildfire.create.tina.base.Flame) DancingFlame(org.jwildfire.create.tina.dance.DancingFlame)

Example 57 with Flame

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

the class EnvelopeDialog method getFlame.

@Override
public Flame getFlame() {
    if (flameToPreview != null) {
        Flame res = flameToPreview.makeCopy();
        res.setFrame(frameToPreview);
        switch(flamePreviewType) {
            case MOTION_CURVE:
                if (curveToPreviewPropertyPath != null) {
                    MotionCurve curve = getMotionCurve(res, curveToPreviewPropertyPath);
                    if (curve != null) {
                        curve.setPoints(new int[] { frameToPreview }, new double[] { curveValueToPreview });
                        curve.setInterpolation(Interpolation.LINEAR);
                        curve.setEnabled(true);
                    }
                }
                break;
            case COLOR_CURVE:
                if (curveToPreviewPropertyPath != null) {
                    MotionCurve curve = getMotionCurve(res, curveToPreviewPropertyPath);
                    if (curve != null) {
                        curve.assignFromEnvelope(ctrl.getCurrEnvelope());
                    }
                }
                break;
            default:
                // nothing to do
                break;
        }
        return res;
    }
    return null;
}
Also used : MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 58 with Flame

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

the class ChannelMixerControlsDelegate method resetBtn_clicked.

public void resetBtn_clicked() {
    Flame flame = owner.getCurrFlame();
    if (useUndoManager) {
        owner.undoManager.saveUndoPoint(flame);
    }
    flame.resetMixerCurves();
    refreshValues(false);
    owner.refreshFlameImage(true, false, 1, true, true);
}
Also used : Flame(org.jwildfire.create.tina.base.Flame)

Example 59 with Flame

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

the class ChannelMixerPanelDelegate method notifyChange.

private void notifyChange(int pSelectedPoint, int pX, double pY) {
    Flame flame = owner.getOwner().getCurrFlame();
    if (owner.isUseUndoManager()) {
        owner.getOwner().undoManager.saveUndoPoint(flame);
    }
    MotionCurve curve = getCurve(flame);
    curve.assignFromEnvelope(ctrl.getCurrEnvelope());
    owner.getOwner().refreshFlameImage(true, false, 1, true, true);
}
Also used : MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve) Flame(org.jwildfire.create.tina.base.Flame)

Example 60 with Flame

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

the class FlameControlsDelegate method postNoiseFilterCheckBox_changed.

public void postNoiseFilterCheckBox_changed() {
    if (!isNoRefresh()) {
        Flame flame = getCurrFlame();
        if (flame != null) {
            owner.saveUndoPoint();
            flame.setPostNoiseFilter(data.tinaPostNoiseFilterCheckBox.isSelected());
            enableControls();
        }
    }
}
Also used : Flame(org.jwildfire.create.tina.base.Flame)

Aggregations

Flame (org.jwildfire.create.tina.base.Flame)232 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)109 Layer (org.jwildfire.create.tina.base.Layer)63 XForm (org.jwildfire.create.tina.base.XForm)55 VariationFunc (org.jwildfire.create.tina.variation.VariationFunc)30 FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)27 FlameReader (org.jwildfire.create.tina.io.FlameReader)24 File (java.io.File)21 RenderInfo (org.jwildfire.create.tina.render.RenderInfo)21 ArrayList (java.util.ArrayList)17 JFileChooser (javax.swing.JFileChooser)17 SimpleImage (org.jwildfire.image.SimpleImage)17 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)15 Rectangle (java.awt.Rectangle)10 Clipboard (java.awt.datatransfer.Clipboard)10 FlamePanel (org.jwildfire.create.tina.swing.flamepanel.FlamePanel)9 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)8 Transferable (java.awt.datatransfer.Transferable)7 ResolutionProfile (org.jwildfire.base.ResolutionProfile)7 Test (org.junit.Test)6