sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Film and Stage plugin - need help to fix script

    Scheduled Pinned Locked Moved Developers' Forum
    29 Posts 9 Posters 2.1k Views 9 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.
    • SwissmountainS Offline
      Swissmountain
      last edited by

      Hey Chris,

      You are right, I am a mac user... and I live in Los Angeles.

      I have Parallels but am using such a mish-mosh of apps already I hesitate adding more steps to the process.

      Resizing the window used to work just fine from versions 5 through to early 7.
      Not anymore though, I tried everything, even taking precise snapshots using the ruby console.

      I think I will keep working in 7 until this plugin is revised.

      Thank you for your input!

      Ciao,

      Fredi

      Cogito ergo dum-di-dum

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        @unknownuser said:

        I am trying to find a tool or method which allows me to grab the "skp window" and output it at the precise ratio (1:1.85) so the grey bars disappear.

        Fredi

        hi Fredi,

        I work in film and play around with SU, the original plugin was made by @Last, isn't encoded, is fully modifiable and doesn't have a specific 'camera view' export function.

        Have a look at camera.rb in Smultron Editor or similar, there are a couple of to-do items that someone might complete and possibly add a field of view export (if Google doesn't)

        if you use SnapNDrag's Window selection and then crop down to the FOV in Graphics Convertor you can get very actuate aspect ration jpeg's for free
        with or without camera info

        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • SwissmountainS Offline
          Swissmountain
          last edited by

          Hi John, thanks for all the suggestions!

          I do have the original camera.rb plugin from @last
          but I don't know how to add ruby code which will
          export a jpg of the FOV... rats!

          The screenshot idea is valid, however the resulting
          image is pixelated )jagged edges) due to the lack
          of anti aliasing.

          ...and png exports with transparent background have
          advantages over solid pct and jpg files.

          ...an image capture function of the camera.rb plugin
          would definitely have to be able to output jpg, and png files!

          Anyways... hopefully Google will figure it out... I am keeping
          my fingers crossed. Until then I keep using skp7.

          Cogito ergo dum-di-dum

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            At the last basecamp a couple of months ago, a few of us sat around and discussed this plugin at length. Google is working on it, and I've got a set of improvements I'd like to make to it once we see what they get us. I'm optimistic!

            Also, if you could try this code on the Mac. This will export an image to your plugins folder (or maybe the base SketchUp folder, I'm not exactly sure where). Please do the following:

            • Using the Film and stage plugin, make a camera and set up the aspect ratio to something where you have those grey bars showing on the screen.
            • Copy and paste the following code into the Ruby Console in SketchUp, press enter to execture the code.
            view=Sketchup.active_model.active_view;height=1080;width=(height*view.camera.aspect_ratio).to_i;keys={;filename=>"aspect_exporter.png",;width=>width,;height=>height,;antialias=>false,;compression=>0.9,;transparent=>true};view.write_image keys
            

            That code should all be a single line, no line breaks, pasted into the ruby console as a single line.

            That should export an image to your plugins folder, or maybe base SketchUp installation folder. That image will be 1080pixels tall, and as wide as needed to match the camera aspect that is shown on the screen when the image is exported. BTW, it mgiht not work as expected if there are no gray bars on the screen.

            If you could test the code and let me know if it exports an image to the correct aspect, with no weird grey bars like the Mac is prone to doing, that would be great. If it works, I can write up a more fully functioning image exporter that would help solve your probolems for now.

            Chris

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              hi Chris,

              that doesn't work, unfortunately...

              one idea I've contemplated is using a semi-transparent watermark for the camera FOV, this example is a quick hash-up using knightgame frame with locked aspect ratio...

              you could have one for each camera or a combined set of marker lines

              just an idea

              john
              using standard export 2D

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 Reply Last reply Reply Quote 0
              • mitcorbM Offline
                mitcorb
                last edited by

                @Chris:
                Interesting that you ask about location. "And you're in"LA" is that Los Angeles?, or Louisiana? or somewhere else?"
                Louisiana has a fairly active young film industry.

                I take the slow, deliberate approach in my aimless wandering.

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  @John - That did not work....meaning nothing happened? Or it exported an image of the wrong aspect ratio? Or it still had lame grey bars all over the place? I'd like to tweak it and keep trying a few things on it if you could let me know what about it did not work, I could try something different.

                  There is also an option to crop the image after it has been exported using a ruby. That could also be worth looking into if Google does not fix the problem on their end first.

                  @mitcorb - Cool, I did not know what Louisiana has an up and coming film sector. The way things are now, with film being so accessible by so many people, I think we might start seeing more and more hotspots of film start cropping up - more like music. Maybe you start getting more local film styles, the way music styles are often associated to regions around the country.

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    driven
                    last edited by

                    sorry Chris, I still get this

                    on Mac/10.5.8/SU8 (this is without code)on Mac/10.5.8/SU8 (this is with code)on PC/XP/SU8 (standard export)

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                    1 Reply Last reply Reply Quote 0
                    • Chris FullmerC Offline
                      Chris Fullmer
                      last edited by

                      Thanks for the details!

                      ok, so with the code, it exports the correct aspect, but the lame grey bars are all over inside the image. I'll see if I can come up with a workaround - I have an idea.

                      Chris

                      Lately you've been tan, suspicious for the winter.
                      All my Plugins I've written

                      1 Reply Last reply Reply Quote 0
                      • Chris FullmerC Offline
                        Chris Fullmer
                        last edited by

                        Hmm, I've played around with it, and I have not found a way to get the image to export to the right aspect without those grey bars. I tried getting the aspect ratio of the camera, then turning off the aspect ratio so remove the bars, then export an image with the desired dimensions to match the desired aspect ratio. Then turn the aspect ratio back on - I think that would work, but the zoom is wrong somehow. I guess you could try thise cose and see if it works on the Mac differently than it does on the PC.

                        view=Sketchup.active_model.active_view;ar = view.camera.aspect_ratio.to_f;h=1080;w=(h*ar).to_i;view.camera.aspect_ratio = 0.0;keys={;filename=>"aspect_exporter.png",;width=>w,;height=>h,;antialias=>false,;compression=>0.9,;transparent=>true};view.write_image keys;view.camera.aspect_ratio = ar
                        
                        
                        

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          driven
                          last edited by

                          the script outputs this
                          I think it's because we are input a value (i.e. height), rather then using screen coordinates...
                          but I want an export version of this... with the grey or cropped to them

                          john

                          learn from the mistakes of others, you may not live long enough to make them all yourself...

                          1 Reply Last reply Reply Quote 0
                          • Chris FullmerC Offline
                            Chris Fullmer
                            last edited by

                            The only thing I can try now is to export using the exact same size as the modeling window in one direction, then use the asspect ratio to determine how tall or wide to make the 2nd dimension. So it would be essentially screen size, just cropped.

                            I do not think this will do the trick though. Because changing the sketchup camera from aspect ratio on (showing grey bars) to aspect ratio off, makes the model jump - meaning that the FOV or camera location jump, or more likely that there is something internally to SU that is taking place that I will not be able to adjust for. So I am not convinced that I can get this work around working....But I'll see if I get a few minutes to test using the above method of using only the screen width or height as the image width or height.

                            Chris

                            Lately you've been tan, suspicious for the winter.
                            All my Plugins I've written

                            1 Reply Last reply Reply Quote 0
                            • TIGT Offline
                              TIG Moderator
                              last edited by

                              It's not clear if the screen resolution is the same on the MAC and the PC ?
                              Why not get the screen's view.vpwidth and .vpheight, then work out from the view.camera.aspect_ratio which of them take as its maximum allowable - as either width or height - then apply the aspect_ration to the other one to give the correct adjusted figure for that - that way the 'letterbox' will always maximize to the screen width or if it's a 'portrait' shot to the screen height??

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                driven
                                last edited by

                                @Tig and Chris,

                                I had a play using view.vpwidth and .vpheight but don't understand why it doesn't work, I ran this code on the same drawing with and without a 'Camera' view and thought it might show you if Mac's handle things differently, or not.

                                I thought using the second set of co-ords to output a file would work, but I'm doing something wrong so I'll leave that off this post.

                                [code] > view = Sketchup.active_model.active_view
                                
                                # Determine the size of the design window
                                h = view.vpheight.to_s
                                w = view.vpwidth.to_s
                                puts "Window dimensions; " + w + ", " + h
                                
                                # Display the locations of the four corners
                                puts "Upper left; " + view.corner(0)[0].to_s + ", " + 
                                   view.corner(0)[1].to_s
                                puts "Upper right; " + view.corner(1)[0].to_s + ", " + 
                                   view.corner(1)[1].to_s
                                puts "Bottom left; " + view.corner(2)[0].to_s + ", " + 
                                   view.corner(2)[1].to_s
                                puts "Bottom right; " + view.corner(3)[0].to_s + ", " + 
                                   view.corner(3)[1].to_s
                                   
                                # Show the location of the window's center
                                center = view.center
                                puts "Center; " + center[0].to_s + ", " + center[1].to_s 
                                
                                # Screen coordinates
                                origin = view.screen_coords [0,0,0]
                                puts "Origin; " + origin[0].to_f.to_s + ", " + origin[1].to_f.to_s
                                Window dimensions; 1924, 1089
                                Upper left; 0, 0
                                Upper right; 1924, 0
                                Bottom left; 0, 1089
                                Bottom right; 1924, 1089
                                Center; 962, 544
                                Origin; 579.166591415118, 705.802307848725
                                nil
                                > view = Sketchup.active_model.active_view
                                
                                # Determine the size of the design window
                                h = view.vpheight.to_s
                                w = view.vpwidth.to_s
                                puts "Window dimensions; " + w + ", " + h
                                
                                # Display the locations of the four corners
                                puts "Upper left; " + view.corner(0)[0].to_s + ", " + 
                                   view.corner(0)[1].to_s
                                puts "Upper right; " + view.corner(1)[0].to_s + ", " + 
                                   view.corner(1)[1].to_s
                                puts "Bottom left; " + view.corner(2)[0].to_s + ", " + 
                                   view.corner(2)[1].to_s
                                puts "Bottom right; " + view.corner(3)[0].to_s + ", " + 
                                   view.corner(3)[1].to_s
                                   
                                # Show the location of the window's center
                                center = view.center
                                puts "Center; " + center[0].to_s + ", " + center[1].to_s 
                                
                                # Screen coordinates
                                origin = view.screen_coords [0,0,0]
                                puts "Origin; " + origin[0].to_f.to_s + ", " + origin[1].to_f.to_s
                                Window dimensions; 1924, 1089
                                Upper left; 0, 135
                                Upper right; 1924, 135
                                Bottom left; 0, 954
                                Bottom right; 1924, 954
                                Center; 962, 544
                                Origin; 285.625823583734, 829.482222498574
                                nil
                                [/code]
                                

                                learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                                Advertisement