Excluding scenes from animation

Excluding scenes from animation

Postby Skastafari » Wed Aug 30, 2017 6:50 pm

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.
0

Skastafari 
 

Re: Excluding scenes from animation

Postby TIG » Thu Aug 31, 2017 12:17 pm

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. ... nce_method
http://ruby.sketchup.com/Sketchup/Page. ... nce_method

This is a simple way of ensuring that only 'included' scene-tabs' pages get processed...
Code: Select all
animated_pages = Sketchup.active_model.pages.find_all{|page| page.name == page.label }
1
TIG
User avatar
TIG 
Global Moderator
 

Re: Excluding scenes from animation

Postby sdmitch » Thu Aug 31, 2017 3:28 pm

Tig, is there a way to access the "Include in animation" and "Play" from a script?
0
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Excluding scenes from animation

Postby TIG » Thu Aug 31, 2017 4:03 pm

sdmitch wrote: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...
1
TIG
User avatar
TIG 
Global Moderator
 

Re: Excluding scenes from animation

Postby sdmitch » Thu Aug 31, 2017 5:28 pm

TIG wrote: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.
0
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Excluding scenes from animation

Postby Skastafari » Thu Aug 31, 2017 8:14 pm

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.
0

Skastafari 
 

Re: Excluding scenes from animation

Postby Skastafari » Thu Aug 31, 2017 9:24 pm

I just found this...

https://forums.sketchup.com/t/handling-include-in-animation-flag-in-scenes/39368

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

Skastafari 
 

Re: Excluding scenes from animation

Postby sdmitch » Fri Sep 01, 2017 12:32 am

Skastafari wrote:I just found this...

https://forums.sketchup.com/t/handling-include-in-animation-flag-in-scenes/39368

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.
0
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Excluding scenes from animation

Postby Dan Rathbun » Wed Sep 06, 2017 1:26 pm

sdmitch wrote: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.
Code: Select all
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.)
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    Re: Excluding scenes from animation

    Postby Dan Rathbun » Wed Sep 06, 2017 2:21 pm

    sdmitch wrote: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 wrote: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.)
    0
      I'm not here much anymore. But a PM will fire email notifications.
      User avatar
      Dan Rathbun 
      PluginStore Author
      PluginStore Author
       

      Re: Excluding scenes from animation

      Postby Dan Rathbun » Fri Dec 08, 2017 4:17 am

      Skastafari wrote: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.

      0
        I'm not here much anymore. But a PM will fire email notifications.
        User avatar
        Dan Rathbun 
        PluginStore Author
        PluginStore Author
         

        SketchUcation One-Liner Adverts

        by Ad Machine » 5 minutes ago



        Ad Machine 
        Robot
         



         

        Return to Developers' Forum

        Who is online

        Users browsing this forum: No registered users and 11 guests

        Visit our sponsors: