Search in sources :

Example 1 with GlobalScript

use of org.jwildfire.create.tina.animate.GlobalScript in project JWildfire by thargor6.

the class RotatingMandelbrotRandomMovieGenerator method prepareMovie.

@Override
protected FlameMovie prepareMovie(Prefs pPrefs) {
    FlameMovie movie = new FlameMovie(pPrefs);
    Flame flame = genRandomFlame(new MandelbrotRandomFlameGenerator(), pPrefs);
    flame.setCamPerspective(0.1 + 0.2 * Math.random());
    if (Math.random() < 0.5) {
        flame.setCamDOF(0.05 + 0.1 * Math.random());
    }
    FlameMoviePart part = new FlameMoviePart();
    part.setFlame(flame);
    part.setFrameCount(320);
    part.setFrameMorphCount(0);
    movie.addPart(part);
    {
        double amplitude = -0.75 * Math.random() * 1.5;
        movie.getGlobalScripts()[0] = (new GlobalScript(GlobalScriptType.ROTATE_YAW, amplitude));
    }
    {
        double amplitude = -0.25 * Math.random() * 0.5;
        movie.getGlobalScripts()[1] = new GlobalScript(GlobalScriptType.ROTATE_ROLL, amplitude);
    }
    {
        double amplitude = -0.125 * Math.random() * 0.25;
        movie.getGlobalScripts()[2] = new GlobalScript(GlobalScriptType.ROTATE_PITCH, amplitude);
    }
    {
        double amplitude = 0.2 + Math.random() * 0.6;
        movie.getGlobalScripts()[2] = new GlobalScript(GlobalScriptType.MOVE_CAM_Z, amplitude);
    }
    {
        double amplitude = 0.2 + Math.random() * 1.4;
        movie.getGlobalScripts()[2] = new GlobalScript(GlobalScriptType.MOVE_CAM_Y, amplitude);
    }
    return movie;
}
Also used : GlobalScript(org.jwildfire.create.tina.animate.GlobalScript) FlameMovie(org.jwildfire.create.tina.animate.FlameMovie) FlameMoviePart(org.jwildfire.create.tina.animate.FlameMoviePart) Flame(org.jwildfire.create.tina.base.Flame) MandelbrotRandomFlameGenerator(org.jwildfire.create.tina.randomflame.MandelbrotRandomFlameGenerator)

Example 2 with GlobalScript

use of org.jwildfire.create.tina.animate.GlobalScript in project JWildfire by thargor6.

the class TransformingDuckiesRandomMovieGenerator method prepareMovie.

@Override
protected FlameMovie prepareMovie(Prefs pPrefs) {
    FlameMovie movie = new FlameMovie(pPrefs);
    Flame flame = genRandomFlame(new DuckiesRandomFlameGenerator(), pPrefs);
    FlameMoviePart part = new FlameMoviePart();
    part.setFlame(flame);
    part.setFrameCount(320);
    part.setFrameMorphCount(0);
    movie.addPart(part);
    {
        double amplitude = -1.25 * Math.random() * 2.5;
        movie.getGlobalScripts()[0] = new GlobalScript(GlobalScriptType.ROTATE_ROLL, amplitude);
    }
    {
        double amplitude = Math.random() * 2.0 + 0.2;
        movie.getGlobalScripts()[1] = new GlobalScript(GlobalScriptType.MOVE_CAM_X, amplitude);
    }
    if (Math.random() < 0.5) {
        double amplitude = Math.random() * 0.25;
        movie.getGlobalScripts()[2] = new GlobalScript(GlobalScriptType.MOVE_CAM_Z, amplitude);
    }
    {
        double amplitude = -0.5 * Math.random() * 1.0;
        movie.getxFormScripts()[0] = new XFormScript(XFormScriptType.ROTATE_2ND_XFORM, amplitude);
    }
    return movie;
}
Also used : XFormScript(org.jwildfire.create.tina.animate.XFormScript) GlobalScript(org.jwildfire.create.tina.animate.GlobalScript) FlameMovie(org.jwildfire.create.tina.animate.FlameMovie) DuckiesRandomFlameGenerator(org.jwildfire.create.tina.randomflame.DuckiesRandomFlameGenerator) FlameMoviePart(org.jwildfire.create.tina.animate.FlameMoviePart) Flame(org.jwildfire.create.tina.base.Flame)

Example 3 with GlobalScript

use of org.jwildfire.create.tina.animate.GlobalScript in project JWildfire by thargor6.

the class TinaSWFAnimatorController method getCurrFlame.

private Flame getCurrFlame() {
    int frame = swfAnimatorFrameSlider.getValue();
    Flame flame = currMovie.getFlame(frame);
    if (flame != null) {
        prepareFlame(flame);
        boolean oldNoRefresh = noRefresh;
        noRefresh = true;
        try {
            swfAnimatorFrameREd.setValue(frame);
        } finally {
            noRefresh = oldNoRefresh;
        }
        int frameCount = swfAnimatorFramesREd.getIntValue();
        double fps = swfAnimatorFramesPerSecondREd.getDoubleValue();
        int motionBlurLength = swfAnimatorMotionBlurLengthREd.getIntValue();
        double motionBlurTimeStep = swfAnimatorMotionBlurTimeStepREd.getDoubleValue();
        List<GlobalScript> editedGlobalScripts = new ArrayList<GlobalScript>();
        for (ScriptContainer container : globalScripts) {
            editedGlobalScripts.add(getGlobalScriptFromUI(container.getScriptCmb(), container.getScriptREd()));
        }
        List<XFormScript> editedXFormScripts = new ArrayList<XFormScript>();
        for (ScriptContainer container : xFormScripts) {
            editedXFormScripts.add(getXFormScriptFromUI(container.getScriptCmb(), container.getScriptREd()));
        }
        try {
            Flame res = flame.makeCopy();
            for (GlobalScript script : editedGlobalScripts) {
                AnimationService.addMotionCurve(res, script, frame, frameCount, fps);
            }
            for (XFormScript script : editedXFormScripts) {
                AnimationService.addMotionCurve(res, script, frame, frameCount, fps);
            }
            res.setFrame(frame);
            res.setMotionBlurLength(motionBlurLength);
            res.setMotionBlurTimeStep(motionBlurTimeStep);
            return res;
        } catch (Throwable ex) {
            ex.printStackTrace();
            return null;
        }
    } else {
        return null;
    }
}
Also used : XFormScript(org.jwildfire.create.tina.animate.XFormScript) GlobalScript(org.jwildfire.create.tina.animate.GlobalScript) ArrayList(java.util.ArrayList) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 4 with GlobalScript

use of org.jwildfire.create.tina.animate.GlobalScript in project JWildfire by thargor6.

the class FlameMovieReader method readGlobalScript.

private GlobalScript readGlobalScript(String pAttrScript, String pAttrScriptAmplitude, String pAttrScriptAmplitudeCurve, XMLAttributes pAtts) {
    GlobalScript script = new GlobalScript();
    String hs;
    if ((hs = pAtts.get(pAttrScript)) != null) {
        try {
            script.setScriptType(GlobalScriptType.valueOf(hs));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    if ((hs = pAtts.get(pAttrScriptAmplitude)) != null) {
        script.setAmplitude(Double.parseDouble(hs));
    }
    AbstractFlameReader.readMotionCurveAttributes(pAtts, script.getAmplitudeCurve(), pAttrScript + Tools.CURVE_POSTFIX + "_");
    return script;
}
Also used : GlobalScript(org.jwildfire.create.tina.animate.GlobalScript)

Example 5 with GlobalScript

use of org.jwildfire.create.tina.animate.GlobalScript in project JWildfire by thargor6.

the class FlameMovieReader method parseMovieAttributes.

private void parseMovieAttributes(FlameMovie pMovie, String pXML) {
    XMLAttributes atts = Tools.parseAttributes(pXML);
    String hs;
    if ((hs = atts.get(ATTR_NAME)) != null) {
        pMovie.setName(hs);
    }
    if ((hs = atts.get(ATTR_SCRIPT_GLOBAL)) != null) {
        // legacy
        pMovie.getGlobalScripts()[0] = new GlobalScript(GlobalScriptType.valueOf(hs), 1.0);
    }
    for (int i = 0; i < FlameMovie.SCRIPT_COUNT; i++) {
        String idxStr = String.valueOf(i + 1);
        if ((hs = atts.get(ATTR_SCRIPT_GLOBAL + idxStr)) != null) {
            pMovie.getGlobalScripts()[i] = readGlobalScript(ATTR_SCRIPT_GLOBAL + idxStr, ATTR_SCRIPT_GLOBAL + idxStr + AMPLITUDE_POSTFIX, ATTR_SCRIPT_GLOBAL + idxStr + AMPLITUDE_CURVE_POSTFIX, atts);
        }
    }
    if ((hs = atts.get(ATTR_SCRIPT_XFORM)) != null) {
        // legacy
        pMovie.getxFormScripts()[0] = new XFormScript(XFormScriptType.valueOf(hs), 1.0);
    }
    for (int i = 0; i < FlameMovie.SCRIPT_COUNT; i++) {
        String idxStr = String.valueOf(i + 1);
        if ((hs = atts.get(ATTR_SCRIPT_XFORM + idxStr)) != null) {
            pMovie.getxFormScripts()[i] = readXFormScript(ATTR_SCRIPT_XFORM + idxStr, ATTR_SCRIPT_XFORM + idxStr + AMPLITUDE_POSTFIX, ATTR_SCRIPT_XFORM + idxStr + AMPLITUDE_CURVE_POSTFIX, atts);
        }
    }
    if ((hs = atts.get(ATTR_FRAME_WIDTH)) != null) {
        pMovie.setFrameWidth(Integer.parseInt(hs));
    }
    if ((hs = atts.get(ATTR_FRAME_HEIGHT)) != null) {
        pMovie.setFrameHeight(Integer.parseInt(hs));
    }
    if ((hs = atts.get(ATTR_FPS)) != null) {
        pMovie.setFramesPerSecond(Double.parseDouble(hs));
    }
    if ((hs = atts.get(ATTR_QUALITY)) != null) {
        pMovie.setQuality(Integer.parseInt(hs));
    }
    if ((hs = atts.get(ATTR_SEQUENCE_OUTPUT_TYPE)) != null) {
        try {
            pMovie.setSequenceOutputType(SequenceOutputType.valueOf(hs));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    if ((hs = atts.get(ATTR_MOTIONBLUR_LENGTH)) != null) {
        pMovie.setMotionBlurLength(Integer.parseInt(hs));
    }
    if ((hs = atts.get(ATTR_MOTIONBLUR_TIMESTEP)) != null) {
        pMovie.setMotionBlurTimeStep(Double.parseDouble(hs));
    }
}
Also used : XFormScript(org.jwildfire.create.tina.animate.XFormScript) XMLAttributes(org.jwildfire.base.Tools.XMLAttributes) GlobalScript(org.jwildfire.create.tina.animate.GlobalScript)

Aggregations

GlobalScript (org.jwildfire.create.tina.animate.GlobalScript)7 XFormScript (org.jwildfire.create.tina.animate.XFormScript)4 Flame (org.jwildfire.create.tina.base.Flame)4 FlameMovie (org.jwildfire.create.tina.animate.FlameMovie)3 FlameMoviePart (org.jwildfire.create.tina.animate.FlameMoviePart)3 ArrayList (java.util.ArrayList)1 XMLAttributes (org.jwildfire.base.Tools.XMLAttributes)1 GlobalScriptType (org.jwildfire.create.tina.animate.GlobalScriptType)1 BubblesRandomFlameGenerator (org.jwildfire.create.tina.randomflame.BubblesRandomFlameGenerator)1 DuckiesRandomFlameGenerator (org.jwildfire.create.tina.randomflame.DuckiesRandomFlameGenerator)1 MandelbrotRandomFlameGenerator (org.jwildfire.create.tina.randomflame.MandelbrotRandomFlameGenerator)1 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)1