Excluding scenes from animation
-
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.
-
A page's
page.name
and itspage.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_methodThis 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, is there a way to access the "Include in animation" and "Play" from a script?
-
@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'spage.name
is the same as itspage.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 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.
-
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/11020Thank you for your script and insights Tig. It was helpful to me. I do have a better understanding what is going on now.
-
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.
-
@skastafari said:
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.
-
@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 > AnimationGlobal 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.)
-
@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:-
with a single
Sketchup::Camera
object argument -
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
andFloat
, the API ignores the second (time) argument and you get behavior #1. (Ie, a silent failure from what you'd expect.) -
-
@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.
Advertisement