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
tovtkSMAnimationSceneWebWriter
, which is passed tozipAllTimeSteps
here. - implement a new Qt dialog, which is opened in the
pqAnimatedExportReaction.cxx
and setsignoreCameraAnimation
.
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.
- Why isn’t
vtkSMAnimationSceneWebWriter
treated as avtkExporter
? - 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 fromvtkExporter
in VTK (not ParaView) - Implement
vtkAnimatedJSONSceneExporter
, which inherits fromvtkAnimatedExporter
- Remove
vtkSMAnimationSceneWriter
- Replace
vtkSMAnimationSceneWebWriter
withvtkAnimatedJSONSceneExporter
in ParaView - Merge
pqExportReaction
andpqAnimatedExportReaction
(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.