Code Monkey home page Code Monkey logo

flump's Introduction

Flump

Flump reads specially-constructed .fla and .xfl files saved by Flash and extracts animations and textures to allow them to be recreated in the GPU. Animations created in Flump's style will use far less texture memory per frame of animation than an equivalent flipbook animation, allowing for more expressive animations on mobile platforms. Runtimes have been written for Starling, Sparrow, Flambe, PlayN, and StageXL.

Creating a movie for Flump

  1. Install the latest version of Adobe AIR.
  2. Install the Flump AIR app.
  3. Create a .fla in Flash CS 5, 5.5, or 6.
  4. Create a new item in the library and draw a shape in its canvas.
  5. Right-click on the item, select its properties, tick the Export for ActionScript and Export in frame 1 checkboxes and change its base class to flash.display.Sprite.
  6. Create a second item in the library, and drag the first into it.
  7. Add additional frames in the second item, and create a classic tween moving the first item around in those frames.
  8. Set the Export for ActionScript and Export in frame 1 properties for the second item. Leave its base class as flash.display.MovieClip.
  9. Save the file and publish it as a swf.
  10. Open the Flump app and change its import directory to the directory containing the .fla and .swf files. The .fla file should appear in the list of source files.
  11. Select the .fla file and click 'Preview'. The tween you created in step 6 should start playing back in a preview window.

Details of Flump's conversion

This walks through Flump's process when it exports a single .fla/.swf file combo.

Texture creation

For each item in the document's library that is exported for ActionScript and extends flash.display.Sprite, Flump creates a texture. To do so, it instantiates the library's exported symbol from the .swf file and renders it to a bitmap.

All of the created bitmaps for a Flash document are packed into texture atlases, and xml is generated to map between a texture's symbol and its location in the bitmap.

Animation creation

For each item in the document's library that extends flash.display.MovieClip and isn't a flipbook (explained below), Flump creates an animation. It checks that for all layers and keyframes, each used symbol is either a texture, an animation, or a flipbook. Flump animations can only be constructed from the flump types.

Flipbook creation

For animations that only contain a few frames, a flipbook may be more appropriate. To create one, add a new item to the library and name the first layer in the created item flipbook. When exporting, flump will create a bitmap for each keyframe in the flipbook layer. In playback, flump will display those bitmaps at the same timing.

Compatibility

Flump works with Flash CS 5 and later

Precompiled binaries

Get them here

Building

You will need these dependencies to build Flump:

  1. Build the flump runtime

     flump/runtime$ ant -Dairsdk.dir=/path/to/air maven-deploy
    
  2. Build the flump exporter

     flump/exporter$ ant -Dflexsdk.dir=/path/to/flex swf
    
  3. Build the flump demo

     flump/demo ant -Dairsdk.dir=/path/to/air
    
  4. To get AIR to report errors, run Flump with the AIR debugger (adl):

     flump/exporter$ /path/to/air/bin/adl etc/airdesc.xml dist
    

Runtimes

A list of known Flump runtime implementations for different languages and frameworks:

flump's People

Contributors

aduros avatar deadmoose avatar groves avatar kpatelpro avatar matyasatfp avatar mientjan avatar roguenet avatar tconkling avatar thejustinwalsh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flump's Issues

Configure texture atlas output

It would be nice to have some way of controlling the texture atlas output, for example, setting a maximum for the texture size, or the number of textures it produces.

Additional scale factors are producing blurry images

Perhaps my understanding of the export process is wrong, but when I export my assets for @2x the images are blurry. It looks like the assets are scaled from raster images. I would have assumed that the scaling would have been formed on the assets as vectors and then drawn to the bitmap. Have I gone wrong somewhere in my process?

Optimized png's

Not really a bug, but it would be awesome if png's were automatically optimized after export.

Take a look at: http://tinypng.org/
When I use this tool, i can save 1mb out of 13 spritesheets (1024x1024px), however that requires manual upload/downloading.

[feature request] Add static images

I really like the output for different scales. I'd love to have the option to include non-flash objects too. Like .jpg/.png files, so flump auto resizes them using the scale mode, which would definitively save me lots of time and improves the workflow. I don't need a .json file in that case, just scale the images. It would be great to just have an option to make it jpg or png, to have more control over the filesize. There are cases where I don't need transparency so in that case I could save kb's when output as jpg.

Currently I need to scale my backgrounds and non-animating assets manually. If I put them into a separate flash, flump creates an atlas out, which is way too big (2048x2048 px) and with lots of loss of space. Also, flambe gives a warning when using such big images when I target html.

Feature Request: Label entering

We have made a class to handle animation sequencing with frame labels, and we also use frame labels to make actions of sorts for things like playing sounds.

It would be quite useful for us if there was a signal that fires just before the playhead hits a label. The usefulness in this would be the possibility of calling a goTo just before the upcoming label happens, being able to subvert labelPassed signal.

Only include 'Exported' Symbols (Optional?)

It would be really great if there was an option to avoid creating animations for symbols that aren't 'Exported for Actionscript'.

This would allow files to have other Symbols which are invalid (from flumps point of view) in the library without them preventing flump working on the file.

Reopen the last used project

I'm pretty sure starting Flump used to reopen the most recent project instead of starting empty. Was that removed intentionally or did it get broken?

Skew?

It looks like skew transforms aren't implemented. Is this on the agenda, or would it be difficult to add?

Feature Request: High Quality BitmapData when creating textures BitmapData.drawWithQuality

Since we are using a tool to pre-render the graphics, could we not enable the best rendering algorithm and bitmap smoothing when drawing the textures to bitmap data?

It appears there is a BitmapData.drawWithQuality function that takes the quality argument in and draws ignoring the stage's quality setting. This might be useful if one wanted to configure the quality setting per texture.

Quality modes that are of interest...
StageQuality.HIGH_16X16;
StageQuality.HIGH_16X16_LINEAR;
StageQuality.HIGH_8X8;
StageQuality.HIGH_8X8_LINEAR;

Also turning on smoothing in the draw command (maybe it's optional)

Ideally, these are all options that can be set by the user in the tool in case the want to render with a certain quality level and smoothing off/on for an artistic effect. Thoughts?

movie.play() is not working

I have successfully loaded an asset zip and displayed a movie on stage. However calling movie.play() does not play the movie's animation. I don't get any error messages. I am testing in Flash professional CS6 with Air 3.2 with the latest exporter and runtime. movie.goto appears to work correctly.

Explanation for disposing a library.

I am building an animated book that will load in assets for a page (using LibraryLoader.loadURL) then dispose of them when the page is exited. There doesn't seem to be anything exposed in the API for freeing up the memory once a resource has been loaded. I'm a bit confused, could you please explain how this should be handled?

File stuck on loading in the exporter.

In the following scenario the swf doesn't load properly in the exporter.

If a MovieClip has a child flipbook MovieClip, and the child does not have a linkage id then an error should appear. Presently it just says "..." for in the modified and valid field.

Fix Starling skew support

Starling-1.2 doesn't handle skews in the way the ooo starling branch does; animations with skews are broken in the current build. I haven't looked into this yet, so I'm not sure if it's an issue with Starling or with Flump.

No rotation?

It looks like the new flump version does not have rotation values exported.

Skew in Flash CS5.5

There seems to be a discrepancy between Flash's skew values and actual 2D affine skew transforms. To illustrate this:

  • create square symbol, and add it to the stage
  • set the pivot to the lower right of the symbol.
  • skew it by dragging the y axis 'skew' value in the 'transform' box.

You'll notice that the shape is skewed, but also rotates/scales around the pivot when the degrees > 90. If you take the transform values (via flump) and apply them to shape (we did this in opengl), it will look different, because only skew values are exported, not rotation or scale values. I.e. there is only shear, so e.g. the shape cannot be visually to the right of its pivot point with only y skew.

Somehow, Flash is combining skew and (rotation or scale) visually in Flash, but the exported matrix only has skew values. At least, that's as far as I am with this problem so far.

I believed this worked better in a previous version of Flump where rotation values were exported directly. A similar problem occurred, but I worked around this by taking the scale into account, and adjusting the radians.

Latest air app doesn't export anything with valid XFL

Downloaded the AIR app today. It loaded my fla ok, showed the preview fine, but when I clicked "Export" there was no output. I created an empty folder just to be sure. There is no relevant info in the console.

Versions:
OS: OSX 10.7.3
AIR: 3.2.0.2070

Also tried it with
AIR: 3.3.0.3360

Timeline sounds play/loop in the exporter interface.

Sounds on timelines that are not stopped play/loop in the exporter interface continuously unless timeline code is used to stop the them, which shouldn't really be a requirement. This can interfere with Flash files that are not always HaXe/Flump specific. If I don't want to alter the timelines I have to put up with a potentially obnoxious experience, and have to exit Flump every time I test the site. Please add this to the exporter interface:

SoundMixer.soundTransform = new SoundTransform(0);

Scale grid support

As a scaleRect param that gets conditionally exported for textures. Runtimes will need to be updated to render them properly.

is that only support flash.display.Sprite for create textrue?

is only support flash.display.Sprite for create textrue?
I found you wiki say:
For each item in the document's library that is exported for ActionScript and extends flash.display.Sprite or flash.display.BitmapData,

It seem to not support flash.display.BitmapData,
it's give some error like this
Non-symbols mot not be in movie layers..
but I put bitmap to timeline into mc..

Allow multiple project windows

In Nod, we had different export settings for different asset types (UI, characters, programmer art). These all had to managed as separate projects, and switching between them was a pain. If we allow multiple project windows to be open, it would be less of a pain.

Alternately, it might make sense to allow per-file export settings? Or "export groups" which all have their own settings? I'm not exactly sure what the UI for either of these scenarios would look like.

support for tiled images

Images that will be tiled should duplicate their border pixels. How best to support this? Maybe do it for images that are prefixed with "tile_"?

Controlling timelines of a Movie's child layers?

Is there a way for me to alter the timelines of Movies imbedded in top level movies?
What I would like to accomplish is to tell a Movie's child layer to play/stop independent of it's parent layer.

Are there any examples of doing this, or can someone give me some pointers on how to pull it off?

I had noticed there is a getChildByName function, although that seems to be inherited from starling's Sprite class, will this allow me to get to a child layer then tell it to stop or start playing?

Reload button?

When trying to get a fla in a flump-digestable form, it involves a bit of reloading the fla. Flump doesn't detect when I file has changed, so this process involves closing and restarting Flump, which is a minor annoyance.

Fix "Quit" on Mac

If the preview windows are open, the Quit option doesn't work (because Quit tries to close all the windows, and flump forces the preview windows to stay "open" when they're closed, to work around another bug where closing and reopening the preview window would break)

Layer folders breaks export

Can't export because I have a layer folder, sometimes it's good to use them when you have to organize a lot of layers.
Got the Info severity "No keyframe on layer" but then a critical error "Unable to parse movie in LIBRARY/..."
Would it be easier to just ignore empty layers?

I'm thinking of a way I could put my HUD together in flambe using flump, it coule be nice if the folder information is exported as a meta.

Cheers

  • Jo

App crashes

Mac 10.7.3
Downloaded AIR app.
Created a xfl fla. Exported swf, put it in the same dir as the .xfl file (inside the xfl dir)
App crashed.
App now crashes after starting, no chance to save settings.

Associate .flump files

Making .flump the default file extension for project config files instead of .json can launch Flump when double clicking on them.

Error after selecting an export directory in the exporter.

After selecting an export directory I get the following error:

ArgumentError: Error #1063: Argument count mismatch on flump.export::ProjectController/reloadNow(). Expected 0, got 1.
at org.osflash.signals::Slot/execute()[/export/as3-signals/src/org/osflash/signals/Slot.as:92]
at org.osflash.signals::OnceSignal/dispatch()[/export/as3-signals/src/org/osflash/signals/OnceSignal.as:132]
at Function/()[/Users/jacklee/Downloads/Junk/flump-master-1/exporter/src/main/as/flump/export/DirChooser.as:30]

I'm not sure if this is related but subsequently the exporter breaks with more errors. For instance upon attempting an export:

ArgumentError: Error #1063: Argument count mismatch on flump.export::ProjectController/reloadNow(). Expected 0, got 1.
at org.osflash.signals::Slot/execute()[/export/as3-signals/src/org/osflash/signals/Slot.as:92]
at org.osflash.signals::OnceSignal/dispatch()[/export/as3-signals/src/org/osflash/signals/OnceSignal.as:132]
at Function/()[/Users/jacklee/Downloads/Junk/flump-master-1/exporter/src/main/as/flump/export/DirChooser.as:30]

Optimize for number of atlases

It would be neat if there was an option to tell the packer to minimize the number of atlases at the expense of texture memory. Sometimes you want to minimize state switching (draw calls) rather than memory.

Allow interpolation of animation to be optional.

It would be nice to be able to optionally set the animation interpolation to false for animations where this is not desirable. This would give the animators in my team more flexibility.

Right now in the runtime code in Movie.as I have hacked in a variable and condition in drawFrame() that can control this.

if (movie.interpolate == false || keyframeIdx == keyframes.length - 1 || kf.index == frame) {
// stuff
} else {
// stuff
}

It would be also great if there could something like a tick box in the exporter preview to disable the interpolation so that the animators can see that their animation is reproduced accurately.

Wrong origin in flipbook movies

The origin for flipbook movies is always the top left of the bounding box instead of the authored origin. Check out the guybrush sample.

[feature request] Starling/Sparrow Texture Atlases

Currently, Flump mixes the texture atlas information and the animation/tween information int he same JSON/XML data file. It would have been great if Flump followed Starling's texture atlas format so that they could be loaded by Starling's AssetManager.

Feature Request: Genome2D Runtime

What's the likelihood of getting a Genome2D runtime? I'd like to transition from Starling to G2D but Flump has been working so well for me that I wouldn't like to give up the Flump workflow.

Movie attempting to go to a frame that doesn't exist.

We are sometimes getting runtime errors in the Movie class. Sorry about the ambiguous description. The error is only rare and we are having trouble reproducing the error. I don't have an output to show you but I have a couple of screenshots.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.