Flash -> Ren'Py Exporter [v 1.4, 26/4/2013]

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
Kinsman
Regular
Posts: 130
Joined: Sun Jul 26, 2009 7:07 pm
Location: Fredericton, NB, Canada
Contact:

Flash -> Ren'Py Exporter [v 1.4, 26/4/2013]

#1 Post by Kinsman »

Apr 26 2013: Updated exporter to Version 1.4.
  • Improved the image prediction for complex animations.
  • Simplified the output code in animations.rpy.
[/size][/color]
Feb 14 2013: Updated exporter to Version 1.3.
  • Fixed a bug where if an animation was set to PLAY_ONCE but the last frame had a motion tween attached, the animation would vibrate at the end.
  • You can now tag library items in Flash with instructions on how the default export should be for an animation. For instance, tag an item with '*L' to indicate it should loop by default, or '*R10' to make it a rest-loop animation that goes back to frame 10.
[/size][/color]

I've been working on a Flash to Ren'Py tool for a while now, and I think it's gotten good enough to announce.

With this JSFL script (JSFL being the extension language for Adobe Flash), you can export a library of Graphic symbols and animations, and then use them as images in your Ren'Py project.
demo1.jpg
demo2.gif
demo2.gif (274.81 KiB) Viewed 7713 times
The exporter can handle position, rotation, scaling, and alpha. It will respect animations inside animations, complex motion tweening, and guide layers.

I've also added a few extra features, such as support for "placeholder" animations, and a way to easily set up "rest loop" animations.

You can download the script and a user's guide at the Sourceforge project page,
https://sourceforge.net/projects/flashtorenpyexp/

I've tested this script with my own copy of Flash CS3. Sadly, it won't work on Flash CS2 or earlier (the JSFL support just isn't there.) I'm curious and hopeful to see if it will work for people who are using more recent versions of Flash.
Last edited by Kinsman on Fri Apr 26, 2013 4:23 pm, edited 3 times in total.
Flash To Ren'Py Exporter
See the Cookbook thread

User avatar
dp4
Newbie
Posts: 16
Joined: Fri Feb 08, 2013 2:55 am
Completed: 6
Projects: The Archives of Wynida (PC), Dragon Snack (iOS, Android)
Location: Seattle, WA
Contact:

Re: Flash -> Ren'Py Exporter

#2 Post by dp4 »

Whoa, that is a hardcore impressive tool. I feel guilty for not using it immediately on my existing project, but I'd rather start with characters made specifically to take advantage.

Let us know where you're accepting donations.

Endorphin
Veteran
Posts: 366
Joined: Mon Nov 22, 2010 10:52 am
Location: Germany
Contact:

Re: Flash -> Ren'Py Exporter

#3 Post by Endorphin »

Oh. My. Gosh.
Gotta try this out later, thank you so much for it--it looks extremely promising. =w=

Thank you. <3

- En.

User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: Flash -> Ren'Py Exporter

#4 Post by netravelr »

Looks awesome! If I get an artist that's up for trying this out, I'll definitely use it in something. Sometime. :-P
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

User avatar
Bellalea
Newbie
Posts: 22
Joined: Sun Jun 17, 2012 6:06 pm
Location: Finland
Contact:

Re: Flash -> Ren'Py Exporter

#5 Post by Bellalea »

Thank you so much, this exactly what I needed!

User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: Flash -> Ren'Py Exporter

#6 Post by netravelr »

So I thought I'd play around this just to see what would happen. I created a series of layers, each of which with different keyframes playing an animation that I want to have looping. However, when I export this is the code that I get.

Code: Select all

init:

    image Tween 15:
        LiveComposite ((0,0), (-108,-249),"images/Tween 15.png")
        
    image Tween 14:
        LiveComposite ((0,0), (-108,-249),"images/Tween 14.png")
        
    image Tween 13:
        LiveComposite ((0,0), (-108,-249),"images/Tween 13.png")
        
    image Tween 12:
        LiveComposite ((0,0), (-78,-72),"images/Tween 12.png")
        
    image Tween 11:
        LiveComposite ((0,0), (-78,-72),"images/Tween 11.png")
        
    image Tween 10:
        LiveComposite ((0,0), (-78,-72),"images/Tween 10.png")
        
    image Tween 9:
        LiveComposite ((0,0), (-92,-83),"images/Tween 9.png")
        
    image Tween 8:
        LiveComposite ((0,0), (-92,-83),"images/Tween 8.png")
        
    image Tween 7:
        LiveComposite ((0,0), (-92,-83),"images/Tween 7.png")
        
    image Tween 6:
        LiveComposite ((0,0), (-92,-83),"images/Tween 6.png")
        
    image Tween 5:
        LiveComposite ((0,0), (-92,-83),"images/Tween 5.png")
        
    image Tween 4:
        LiveComposite ((0,0), (-92,-83),"images/Tween 4.png")
        
    image Tween 3:
        LiveComposite ((0,0), (-92,-78),"images/Tween 3.png")
        
    image Tween 2:
        LiveComposite ((0,0), (-92,-78),"images/Tween 2.png")
        
    image Tween 1:
        LiveComposite ((0,0), (-92,-78),"images/Tween 1.png")
        
Am I missing a step here to have it actually create the animation? I'm using Flash CS6.

Thanks in advance, I'm sure this will be so useful in the future!
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

Kinsman
Regular
Posts: 130
Joined: Sun Jul 26, 2009 7:07 pm
Location: Fredericton, NB, Canada
Contact:

Re: Flash -> Ren'Py Exporter

#7 Post by Kinsman »

netravelr wrote:So I thought I'd play around this just to see what would happen. I created a series of layers, each of which with different keyframes playing an animation that I want to have looping. However, when I export this is the code that I get.

Code: Select all

init:

    image Tween 15:
        LiveComposite ((0,0), (-108,-249),"images/Tween 15.png")

    # etc.
        
Am I missing a step here to have it actually create the animation? I'm using Flash CS6.

Thanks in advance, I'm sure this will be so useful in the future!
Hi, netravelr.

In Flash, there's a general rule that when you animate, you should have one object on each of your layers - that way, when you do a motion tween, it's not ambiguous what kind of movement you want to have happen.

If you do have more than one object on a layer, and make a tween of it, Flash has a safety measure where it takes those objects, makes another new object out of it, and calls it "Tween ##". If you check your library in the FLA file, you should see a list of those Tween objects being created.

Now, the Flash exporter should have exported any animation that was inside those Tween objects. The fact that it exported a single image for each of those objects implies that there was just some basic vector-drawing inside each object.

When you tried animating, did you make some drawings, turn them into objects, and then animate the objects? Or did you draw, and then go straight to animating, trusting Flash to turn them into objects on your behalf?

Edit: And one more thing - the Flash exporter searches through your libraries for things to export - not your workspace, so if you had an animation on the general workspace you wanted to export, you should wrap it up in an object and put it in the library first.
Flash To Ren'Py Exporter
See the Cookbook thread

User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: Flash -> Ren'Py Exporter

#8 Post by netravelr »

That's just what I needed to hear. As soon as I moved the layers into a movieclip it was smooth sailing. I would suggest putting that in the tutorial somewhere though, because I was trying to figure it out that way. Really awesome though!
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

User avatar
greyinthedark
Newbie
Posts: 21
Joined: Sat Aug 04, 2012 1:29 pm
Contact:

Re: Flash -> Ren'Py Exporter

#9 Post by greyinthedark »

This is pretty fantastic - thanks so much for making it publically available! Sadly, I only have Flash CS4 on my work computer, but I'll take this in tomorrow and put it to the test. (Frankly, I would probably go back a version to be able to use this. :D )

User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: Flash -> Ren'Py Exporter

#10 Post by netravelr »

Been playing around with it some more. Still exciting, but it seems like my animations are just creating frame by frame animations rather than just animating the pieces. I don't think this was the intended effect, but a 2 second clip is already 11MB this way and I won't be able to replace the sprites down the road. Also the pngs did not capture the whole animation but cut off the left side of the animation, but I set it to be at the beginning of the stage. Do you have any idea why this'd be this way?
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

Kinsman
Regular
Posts: 130
Joined: Sun Jul 26, 2009 7:07 pm
Location: Fredericton, NB, Canada
Contact:

Re: Flash -> Ren'Py Exporter

#11 Post by Kinsman »

netravelr wrote:Been playing around with it some more. Still exciting, but it seems like my animations are just creating frame by frame animations rather than just animating the pieces. I don't think this was the intended effect, but a 2 second clip is already 11MB this way and I won't be able to replace the sprites down the road. Also the pngs did not capture the whole animation but cut off the left side of the animation, but I set it to be at the beginning of the stage. Do you have any idea why this'd be this way?
The general rule for exporting is that if an object has any bitmaps, or any shapes/drawing that are outside of an object, then the exporter will export it as a full image. If the object is made up entirely of sub-objects, then the exporter will export it as pieces.

If you're pretty sure that your animations are all made up of sub-objects, then maybe there's a stray scribble on your timeline that's fooling the exporter.
Flash To Ren'Py Exporter
See the Cookbook thread

Kinsman
Regular
Posts: 130
Joined: Sun Jul 26, 2009 7:07 pm
Location: Fredericton, NB, Canada
Contact:

Re: Flash -> Ren'Py Exporter

#12 Post by Kinsman »

I've updated the exporter to Version 1.4.

The image prediction has been improved for complex animations, so if you've ever noticed a short pause before a complex Flash animation, that pause should either be greatly reduced or gone now.

Also, the output that's in animations.rpy has been simplified.
Flash To Ren'Py Exporter
See the Cookbook thread

jjworks
Newbie
Posts: 19
Joined: Wed May 22, 2013 1:07 pm
Location: USA
Contact:

Re: Flash -> Ren'Py Exporter [v 1.4, 26/4/2013]

#13 Post by jjworks »

This looks great! I've been using flash for years and have just recently looked into ren'py, so this is going to be great for future game animations. I have CS6, so when I have the time I will be sure to let you know how it works, if you are still interested in knowing how recent programs handle this... Thanks again!! :)

User avatar
Rosstin
Veteran
Posts: 368
Joined: Mon Jan 31, 2011 5:43 pm
Completed: Rex Rocket, Kitty Love, King's Ascent
Projects: Road Redemption, Queen At Arms
Organization: Aqualuft Games
Contact:

Re: Flash -> Ren'Py Exporter [v 1.4, 26/4/2013]

#14 Post by Rosstin »

Tagged b/c I'm thinking of using this.
Image

User avatar
computistxyz
Regular
Posts: 58
Joined: Thu Jul 10, 2014 8:35 am
Github: sjgriffiths
Location: Coventry/Norwich, UK
Contact:

Re: Flash -> Ren'Py Exporter [v 1.4, 26/4/2013]

#15 Post by computistxyz »

I don't suppose there's any continue support for this? I can't seem to get the animations to work properly, with renpy throwing up this error:

Code: Select all

NameError: name 'NaN' is not defined
Using Flash CC 2015 may be throwing it all off here. It's a shame because there's no other alternative to this system as far as I'm aware and attempting to manually program all the complex flash animations from my VFX artist in ATL is proving extremely tricky as I'm far from an expert in the Flash environment.

Post Reply

Who is online

Users browsing this forum: No registered users