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.
Excluding scenes from animation
11 posts
• Page 1 of 1
Re: Excluding scenes from animationA 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...
TIG
Re: Excluding scenes from animationTig, is there a way to access the "Include in animation" and "Play" from a script?
Re: Excluding scenes from animationMy 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
Re: Excluding scenes from animation
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.
Re: Excluding scenes from animationOkay, 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. Re: Excluding scenes from animationI 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. Re: Excluding scenes from animation
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.
Re: Excluding scenes from animation
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.
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.)
Re: Excluding scenes from animation
See: (SketchUp Developer forum): Setter #view.camera= Testing with Second Transition Time Argument
The API docs are a bit confusing. The view#camera= method is an overloaded method, which can be used two ways:
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.)
Re: Excluding scenes from animation
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.
11 posts
• Page 1 of 1
|