Implement dialog for Export Animated Scene in ParaView

I was tasked to implement an additional dialog when exporting an Animated Scene (with File > Export Animated Scene...) kind of like the one we see when using the Export Scene feature. In the case of exporting a .vtkjs animated scene we want to be able to toggle the option of ignoring the camera of the scene.

For context, see the thread here.

Now the quick-and-dirty fix would probably be something like this:

  • add a boolean ignoreCameraAnimation to vtkSMAnimationSceneWebWriter, which is passed to zipAllTimeSteps here.
  • implement a new Qt dialog, which is opened in the pqAnimatedExportReaction.cxx and sets ignoreCameraAnimation.

To illustrate the problem with this approach let’s have a look at how “Export Scene…” (not “Animated Scene”) is implemented. After the user chooses the extension of the file to export, the next dialog shows some options depending on that extension. This dialog is built with the pqProxyWidget and the fields are defined in Remoting/Export/Resources/exporters.xml.

So the problem with the above approach is that we then have two different dialogs for pretty much the same thing. The vtkSMAnimationSceneWebWriter uses the vtkJSONSceneExporter to save individual frames, so for .vtkjs the options shown in the “Export Animated Scene…” dialog are a super-set of the ones shown in “Export Scene…”.

The reason why we can’t use the pqProxyWidget for the vtkSMAnimationSceneWebWriter is because the latter isn’t a proxy.

  1. Why isn’t vtkSMAnimationSceneWebWriter treated as a vtkExporter?
  2. Why is “Export Animated Scene…” a separate option in the first place? Why not have it all in “Export Scene…” and have an additional option animated for cases like .vtkjs?

Would the following approach make sense?

  • Implement vtkAnimatedExporter, which inherits from vtkExporter in VTK (not ParaView)
  • Implement vtkAnimatedJSONSceneExporter, which inherits from vtkAnimatedExporter
  • Remove vtkSMAnimationSceneWriter
  • Replace vtkSMAnimationSceneWebWriter with vtkAnimatedJSONSceneExporter in ParaView
  • Merge pqExportReaction and pqAnimatedExportReaction (This may be tricky)

I may be missing some key points here, which is why I’d like to ask some ParaView experts for input.

@jourdain, @cory.quammen, @mwestphal, @timothee.chabat

FYI @Julien_Finet

Your plan seems perfectly reasonnable and in line with ParaView philosophy, sound perfect to me. Ill be glad to help in the process.

I think the crux of merging both features is animation handling. AFAIK ParaView animation capabilities are far superior to animation capabilities in pure VTK. The reason a vtkAnimatedJSONSceneExporter doesn’t seem doable for me is because it will not be able to handle what we expect it to handle as a ParaView user. Maybe if it knows the vtkAnimationScene instance used by ParaView it can do some stuff but I’m unsure to which extent it will be complete.

This is why right now it is handled in the SM layer of ParaView. The client play the animation on client side, for each time step save the current scene, and then aggregate all of them at the end.

Your plan may be possible to do at the SM layer but even that would require lots of work.

Someone correct me if I’m wrong

You raise a good point @timothee.chabat , many layer of animation in ParaView are just not exposed to VTK.

That being said, it could still be possible to control all the settings with a single proxy.

Thank you for your inputs. This is exactly the kind of insight I was looking for.

@timothee.chabat Could you specify what ParaView adds on top of the vtkAnimationScene?

And does that mean you two suggest the approach where we implement the SM layer for animated exporters? Would that make it easier in the future to then merge the animation features between ParaView and VTK?

not precisely, maybe @nicolas.vuaille can

This sounds like the right path to take to me yes. And indeed once that is done future development should be way easier and cleaner

1 Like