sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Excluding scenes from animation

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 4 Posters 4.3k Views 4 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.
    • S Offline
      Skastafari
      last edited by

      I am looking for a method to exclude pages from my animation similar to how the "Include in animation" checkbox works from within Sketchup's scene editor. I am generating multiple scenes that cannot be included in my final render, and find the extra step of checking each of those mixed in scenes to exclude them quite tedious. I am having trouble finding an example of how to achieve this in the API documentation. I noticed the parenthesis around scene names in animations and thought perhaps that was the indicator of an excluded scene, and it would be simply...

      model = Sketchup.active_model view = model.active_view pages = model.pages #(define operation here e.g. view.camera.perspective = false etc.) status = pages.add "(excluded scene)"

      However elegant this would seem, unfortunately it does not work. So I am guessing there is some other method to exclude scenes from the animation.

      I had found a thread from Dan Rathbun somewhere dating a couple years back discussing a need for this, but I can't seem to find what the outcome was. If anyone knows, please advise.

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

        A page's page.name and its page.label are NOT the same IF a scene tab is set to be excluded from a scene-animation - because then parentheses are added round the name when forming the label string.

        http://ruby.sketchup.com/Sketchup/Page.html#name-instance_method
        http://ruby.sketchup.com/Sketchup/Page.html#label-instance_method

        This is a simple way of ensuring that only 'included' scene-tabs' pages get processed...

        animated_pages = Sketchup.active_model.pages.find_all{|page| page.name == page.label }
        

        TIG

        1 Reply Last reply Reply Quote 0
        • sdmitchS Offline
          sdmitch
          last edited by

          Tig, is there a way to access the "Include in animation" and "Play" from a script?

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

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

            @sdmitch said:

            Tig, is there a way to access the "Include in animation" and "Play" from a script?
            My snippet does this - making 'animated_pages' subset ??
            Since a page's page.name is the same as its page.label when it is included in an animation....
            I don't think you can actually change the 'label' in the API ?
            As far as I know you can't run the animation tool via the API, but of course your can simply step through the collected pages [scene tabs] in turn - using the 'animated_pages' subset, which I already explained how to assemble.
            The transitions etc between pages is pre/re-set under various option settings ?
            The page.delay time transition_time etc etc...

            TIG

            1 Reply Last reply Reply Quote 0
            • sdmitchS Offline
              sdmitch
              last edited by

              @tig said:

              The transitions etc between pages is pre/re-set under various option settings ?
              The page.delay time transition_time etc etc...

              If i select a scene in a model, the transition time is applied but, if I select that same scene from a script, there is no transition and no delay unless I use sleep(). Entering the same script statement in the Ruby Console works just like selecting the scene in the model. The closest I have come is setting the view camera to the page.camera and refreshing the view but this bypasses the transition.

              Nothing is worthless, it can always be used as a bad example.

              http://sdmitch.blogspot.com/

              1 Reply Last reply Reply Quote 0
              • S Offline
                Skastafari
                last edited by

                Okay, I just learned a lot. So I gather that in order for a page to be excluded from the animation it would need parenthesis to wrap the label string, but when you create a page from the ruby API by default the name IS the label string so that explains why my idea did not work and also why when I uncheck Include in animation the tab name now has 2 sets of parenthesis. If it is true that we can not change the label from the API, then there really is no way I can achieve the function I need as far as I can tell.

                I guess that is why Dan had put in this request back in the day:
                https://forums.sketchup.com/t/ruby-sketchup-page-use-in-animation-use-in-animation/11020

                Thank you for your script and insights Tig. It was helpful to me. I do have a better understanding what is going on now.

                1 Reply Last reply Reply Quote 0
                • S Offline
                  Skastafari
                  last edited by

                  I just found this...

                  Link Preview Image
                  Handling "Include in animation" flag in Scenes

                  I am wondering if there is a way to handle the “Include in animation” flag from the API. I can’t see any related method in Sketchup::Page, so I guess it is not possible at all. Any hint? It would be useful to define whe…

                  favicon

                  SketchUp Community (forums.sketchup.com)

                  I guess this is as close as I am going to get to the status of Dan's request.

                  1 Reply Last reply Reply Quote 0
                  • sdmitchS Offline
                    sdmitch
                    last edited by

                    @skastafari said:

                    I just found this...

                    Link Preview Image
                    Handling "Include in animation" flag in Scenes

                    I am wondering if there is a way to handle the “Include in animation” flag from the API. I can’t see any related method in Sketchup::Page, so I guess it is not possible at all. Any hint? It would be useful to define whe…

                    favicon

                    SketchUp Community (forums.sketchup.com)

                    I guess this is as close as I am going to get to the status of Dan's request.

                    Using the page.name==page.label would certainly work. I'm still trying to solve the transition problem. I found this in the API but I have yet to get it to be recognized. Perhaps it has been removed or never implemented.


                    Capture3.PNG

                    Nothing is worthless, it can always be used as a bad example.

                    http://sdmitch.blogspot.com/

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

                      @sdmitch said:

                      I'm still trying to solve the transition problem.

                      When you manually change scenes (and the model does not have specific transition and/or delay properties assigned to individual page objects,) then the model's global animation transition and delay settings are used.

                      Global settings are via:
                      Window > Model Info > Animation

                      Global transition and delay is accessible via the model's options provider objects.

                      model = Sketchup.active_model
                      manager = model.options
                      popts = Sketchup.active_model.options["PageOptions"]
                      popts.each {|o| puts o }
                      #=> ShowTransition
                      #=> TransitionTime
                      sopts = Sketchup.active_model.options["SlideshowOptions"]
                      sopts.each {|o| puts o }
                      #=> LoopSlideshow
                      #=> SlideTime
                      
                      

                      A per scene page settings interface is not yet implemented, but I think I myself and others have requested it as a PRO feature request. (I believe it should be a Pro only feature myself.)

                      You can easily write a script to set per page transition and delay.

                      I also think some of the better animation extensions have UI interface to set per scene transition and delay. (I think Smustard's does.)

                      I'm not here much anymore.

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

                        @sdmitch said:

                        I found this ( view#camera=) in the API but I have yet to get it to be recognized.

                        See:
                        (SketchUp Developer forum): Setter #view.camera= Testing with Second Transition Time Argument

                        @sdmitch said:

                        Perhaps it has been removed or never implemented.

                        The API docs are a bit confusing.

                        The view#camera= method is an overloaded method, which can be used two ways:

                        1. with a single Sketchup::Camera object argument

                        2. with a single Array argument of: [ Sketchup::Camera, Float ]
                          (The Float being the transition time.)

                        If you attempt to pass two arguments, of Sketchup::Camera and Float, the API ignores the second (time) argument and you get behavior #1. (Ie, a silent failure from what you'd expect.)

                        I'm not here much anymore.

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

                          @skastafari said:

                          I am looking for a method to exclude pages from my animation similar to how the "Include in animation" checkbox works from within Sketchup's scene editor.
                          ...
                          I had found a thread from Dan Rathbun somewhere dating a couple years back discussing a need for this, but I can't seem to find what the outcome was. If anyone knows, please advise.

                          FYI,... Finally, ... the API has been updated for version 2018 and higher ...

                          ... both a query method and a setter method have been added to the Sketchup::Page class.

                          • Sketchup::Page.include_in_animation=

                          • Sketchup::Page.include_in_animation?

                          I'm not here much anymore.

                          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