I think there is a bug in how the Sketchup.active_model.pages.show_frame_at(t) method displays section planes. If the time occurs during a scene transition, then it moves the section plane saved with the scene to the correct location, but it doesn’t activate it. Instead it activates the section plane saved on the preceding scene. So, the frame that is displayed is different than what you would see in the slide show animation at that time.
There are 4 scenes, and 4 section planes, and each scene saves a different section plane as the active one. At time t=0 this is what it looks like.
Now, it you run a command like model.pages.show_frame_at(5) it will show a frame that is halfway through the transition to scene 4. This is what it looks like:
The section plane saved on scene 4 is interpolated to the correct position, but it is not activated. Instead the section plane on scene 3 is activated. That is not how it is in the slide show. During the transition to scene 4, the section plane saved on scene 4 is the active one. So, this seems to be a bug.
It is interesting that no one has taken a position one way or the other. I have found that the Pages#show_frame_at method has a lot of logic built in to deal with all the various cases – scenes can save an active section plane, they can save the property as having NO active section plane, or they can just not save the property period – and the results seem to be consistent.
To recap, if Pages#show_frame_at(t) is called during the delay-time phase, it activates the section plane saved on the current scene, which is what you would expect. However, if it is called during the transition-time phase, then it actives the other section plane that the interpolation is based on, (which is usually the section plane saved on the previous scene, but if there is no ASP saved on the previous scene, things can get more complicated). This rule always seems to be true. So, maybe that is what SketchUp intended, and it is not a bug.
Anyway, I can use some Ruby code to activate the section planes that should be active after calling the show_frame_at method. This allowed me to export frames of the entire section cut animation. As a result, my plugin, Keyframe Animation 2.0, can now export animated section cuts combined with moving objects. Here’s an example.
(1) I thought this was noted previously, and discussed.
I know I’ve run into some weirdness with section planes animating between scenes myself.
EDIT: This is the previous topic:
(2) I was always under the impression that Pages#show_frame_at(t) method was for inspection purposes and not really for heavy custom animation. At least I myself have never and would never use it when writing an animation plugin.
There are too many other strange things that happen (or do not happen) if we try to use the rudimentary built-in scene animation feature, (ie, some properties like hidden and materials not interpolating but just switching 100% on the 1st frame, and the strange interpolations of target to eye paths [ie, the distance is not static as one would expect.])
Myself, I’d always use an abstract Sketchup::Animation class.
Yes, it’s more work, but you have so much more control.
The topic you linked makes no mention of the Pages#show_frame_at(t) method, so I don’t think it’s relevant. I am not saying section planes are buggy. In fact, I haven’t had any problems with them. I am saying the Pages#show_frame_at(t) method may be buggy, because it doesn’t activate the section planes that would be active during the scene animation.
I am not using Pages#show_frame_at(t) to create animations. I have my own code to create custom object animations in SketchUp. (It is based on the Sketchup::FrameChangeObserver class, not the Sketchup::Animation class, but that is beside the point.)
That may be true. But, people are going to keep using SketchUp’s built-in animation, and they often want to combine it with my plugin’s object animation. So, in order to export the SketchUp scene animation (along with my object animation) I need a way to step through it one frame at a time, and that is where the Pages#show_frame_at(t) method comes in – it’s ideal for that. The problem is, in some cases, it doesn’t faithfully reproduce the built-in SketchUp animation.