sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Export animation with Ruby

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 3 Posters 1.0k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      ratnanil
      last edited by

      Hello Folk,

      I'm frantically searching for a solution to my problem, and I'm turning to ruby scripts as a last resource. I hope someone can help!

      My situation: I've got a bunch of scences, and I need to export all the animations from every given scene to every other scene. So 1 --> 2, 2 --> 1, 1 --> 3, 3 --1 leaving me to export n*(n-1) one by one.

      I've looked over the net for a plugin/ruby script that might solve this problem. Havent found one. Now I'm looking for a way to program the script myself, but all I've found is the class "write_image" (https://developers.google.com/sketchup/docs/ourdoc/view?hl=de#write_image) which will not really help me, since stitching all the images together in the end will not save me any time.

      So the question: is there a ruby command for "export animation from scene x to scene y"?

      or

      is there a plugin/script that might solve my problem?

      Thanks for any help in advance.

      Nils

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        What is the problem with the built-in File > Export > Animation?

        Hi

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          He does not want to copy page one, (x number of times,) in between every other page.

          Looks like he wants to animate back to page one after each other page ?

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • R Offline
            ratnanil
            last edited by

            Hey Jim. The problem with File > Export > Animation ist that, with n scnenes, I have to export n(n-1) animations one by one. So with 17 Scenes I have to export 17*16 Animations. Each animation taking about 3 minutes to render I'm sitting 13.6 hours at the PC. If, after a while I decide to make some changes in the model, I can do the whole session again.

            Hey Dan: no I actually did copy one scene (aka page) in between every other page. So I set up the scenes likes this: 1 - 2 - 1 - 3 - 1 - 4 - 1 - 2 - 3 - 2 ect ...

            The problem is, I either have to render everything at once and chop it up or render one animation at a time. Or am I missing something??

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              What is the name for that kind of series ??

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                Speed wise, reduce the things that Sketchup has to update or maintain.
                Definately close the Outliner if it is open. (It's a slow dog!)
                I would also close all of any other Inspector toolwindows (if open,) during export.

                I played with the following, that waits 2.0 seconds, before launching the Export dialog, so you can manually minimize the Sketchup application. Then only the dialog is displayed (because it's modal,) and during export, only the export progress modal dialog is visible.

                UI.start_timer(2.0,false){Sketchup.send_action(21386)}

                You'll have to try each, compare times, and see if export with SU minimized helps.

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • R Offline
                  ratnanil
                  last edited by

                  Hello Dan. Thanks for your tipps! I'll def. try them out. But are you saying there is no way to export movie files out of sketchup via ruby? I find that unbelievable!

                  Regards,

                  Nils

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    This one might be a good start. (I have never tried it myself.)

                    [Plugin] Smoothstep Animation (by Whaat)

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      @ratnanil said:

                      But are you saying there is no way to export movie files out of sketchup via ruby?

                      1) The built-in AVI exporter is basic.

                      It's operation is not exposed to the Ruby API, the View does not change while it runs, and so no API Observers fire during export. So all we can do at most from Ruby, is pick the Export item on the menu for you (.. say create a nifty toolbar button?)

                      2) The API has an Importer class, but not an Exporter class. (Like most software companies, they make it easy to bring things in, not so much to migrate files away to another application.)

                      BUT... if you want:

                      A) more control, output size, better resolution, etc. ...and..

                      B) the ability to start and stop export, ie do half of the export today, some more tomarrow .. etc.

                      Then you have to use the Animation class, move the camera yourself between keyframes (scene pages,) and use view.write_image() to write out frame files to a directory.

                      Afterward, you use a 3rd-party App (MS MovieMaker etc. ... whatever you like,) to stitch them into whatever movie format you prefer. (Not just AVI.)

                      There just have to already be some plugins that do this. I've heard people discussing it. (Check the Plugins Index in the Plugins Forum.)

                      ๐Ÿ’ญ

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        ratnanil
                        last edited by

                        @unknownuser said:

                        .. say create a nifty toolbar button?

                        The timeconsuming aspect is not initialising the export, but the 3 min rendering...

                        @unknownuser said:

                        Then you have to use the Animation class, move the camera yourself between keyframes (scene pages,) and use view.write_image() to write out frame files to a directory.

                        Ok that sounds promising... So I use the Animation class to recreate the filmsequence, and view.wirte_image() to render the "frames" in for the film. Two questions about that, and I will bug you no more!

                        1. will the images be rendered in the current "SU-Style" active, or how does that work?

                        2. in the end would I be left with a huge amount of images in with consecutive numbers, or is there a way to "group" them (eg. A-01, A-02, A-03 and then B-01, B-02 etc for the different transitions).

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by

                          @ratnanil said:

                          1. will the images be rendered in the current "SU-Style" active, or how does that work?

                          Yes because the method writes the active viewport to the filepath specified.
                          You have control of the filetype (png, bmp jpg, etc.)
                          You also have more choice of output size (up to 16000 x 16000 pixels.)

                          @ratnanil said:

                          1. in the end would I be left with a huge amount of images in with consecutive numbers, or is there a way to "group" them (eg. A-01, A-02, A-03 and then B-01, B-02 etc for the different transitions).

                          The method uses whatever filename YOU choose to tell it to use.
                          So you can insert the "from" page name (or a substring of it,) and the "to" page name (or a substring of it,) and insert the loop iterator into it as well.

                          NOW.. keep in mind that because you will use your favorite videomaker application, you do not need to actually write frames twice.
                          After you create the "tweenings" between page A and B, you can use those same files, in reverse order, to create the return to A frames.
                          SO.. I'd imagine you should cut the render time, down to about half.

                          Just be sure to look at someone else's script before trying it yourself.
                          And see my Ruby Newbie's Guide to Getting Started

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • R Offline
                            ratnanil
                            last edited by

                            Amazing!! I will dive right into it! Thank you so much for your patience, Dan. I will update my results here (if I make it that far ๐Ÿ˜„

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            Buy SketchPlus
                            Buy SUbD
                            Buy WrapR
                            Buy eBook
                            Buy Modelur
                            Buy Vertex Tools
                            Buy SketchCuisine
                            Buy FormFonts

                            Advertisement