# Implement dialog for Export Animated Scene in ParaView

**URL:** https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227
**Category:** Development
**Tags:** vtk
**Created:** [August 31, 2022, 6:45am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227 "2022-08-31T06:45:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Berger](https://discourse.paraview.org/user_avatar/discourse.paraview.org/david_berger/32/8537_2.png) [@David\_Berger](https://discourse.paraview.org/u/David_Berger)
#### Post date: [August 31, 2022, 6:45am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227/1 "2022-08-31T06:45:06Z")

</div>

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](https://discourse.paraview.org/t/best-way-of-visualizing-exported-animated-scenes/9731/31).

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

- add a boolean `ignoreCameraAnimation` to `vtkSMAnimationSceneWebWriter`, which is passed to `zipAllTimeSteps` [here](https://github.com/Kitware/ParaView/blob/master/Remoting/Animation/vtkSMAnimationSceneWebWriter.cxx#L212).
- 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.

---

<div class="post-metadata">

### Author: ![David\_Berger](https://discourse.paraview.org/user_avatar/discourse.paraview.org/david_berger/32/8537_2.png) [@David\_Berger](https://discourse.paraview.org/u/David_Berger)
#### Post date: [August 31, 2022, 6:46am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227/2 "2022-08-31T06:46:02Z")

</div>

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

FYI @Julien_Finet

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 31, 2022, 6:48am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227/3 "2022-08-31T06:48:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![timothee.chabat](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee.chabat/32/5729_2.png) [@timothee.chabat](https://discourse.paraview.org/u/timothee.chabat)
#### Post date: [August 31, 2022, 7:13am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227/4 "2022-08-31T07:13:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 31, 2022, 7:17am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227/5 "2022-08-31T07:17:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![David\_Berger](https://discourse.paraview.org/user_avatar/discourse.paraview.org/david_berger/32/8537_2.png) [@David\_Berger](https://discourse.paraview.org/u/David_Berger)
#### Post date: [September 5, 2022, 9:29am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227/6 "2022-09-05T09:29:37Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![timothee.chabat](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee.chabat/32/5729_2.png) [@timothee.chabat](https://discourse.paraview.org/u/timothee.chabat)
#### Post date: [September 26, 2022, 8:09am UTC](https://discourse.paraview.org/t/implement-dialog-for-export-animated-scene-in-paraview/10227/7 "2022-09-26T08:09:20Z")

</div>

> [@David\_Berger](#):
>
> Could you specify what ParaView adds on top of the `vtkAnimationScene`?

not precisely, maybe @nicolas.vuaille can

> [@David\_Berger](#):
>
> 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?

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
