Movie support #411

Merged
merged 7 commits into from Jul 9, 2016

Conversation

Projects
None yet
3 participants
@prabhuramachandran
Member

prabhuramachandran commented Jul 6, 2016

Adds support for recording movies and animating timesteps. Also added some documentation for this feature. For a timeseries, one can simply select the "play" checkbox and see an animation. For the timestep and mlab.animate one can very easily generate animations also.

prabhuramachandran added some commits Jul 1, 2016

First cut of timestep animation.
This adds a `tvtk.pyface.movie_maker` which facilitates recording a
movie.  Also adds the ability to animate the timesteps for timeseries
data.  The timesteps for similar datasets can be synced.
Support recording movie with animate decorator.
If one has a scene with the movie_maker.record set to True, a movie will
be recorded when the animation is run.
Add bunch of tests for new movie feature.
Also cleanup the movie maker a bit so a user can set the directory and
expect things to work reasonably.  Fixed a few minor bugs in the process.
Add some documentation for the new feature.
Also fix an issue when sync_timestep is chosen and update_files is
fired.
@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Jul 6, 2016

Current coverage is 45.68%

Merging #411 into master will decrease coverage by 0.08%

@@             master       #411   diff @@
==========================================
  Files           254        255     +1   
  Lines         23030      23213   +183   
  Methods           0          0          
  Messages          0          0          
  Branches       3039       3067    +28   
==========================================
+ Hits          10543      10606    +63   
- Misses        11795      11886    +91   
- Partials        692        721    +29   

Powered by Codecov. Last updated by 68787e3...c8158fd

codecov-io commented Jul 6, 2016

Current coverage is 45.68%

Merging #411 into master will decrease coverage by 0.08%

@@             master       #411   diff @@
==========================================
  Files           254        255     +1   
  Lines         23030      23213   +183   
  Methods           0          0          
  Messages          0          0          
  Branches       3039       3067    +28   
==========================================
+ Hits          10543      10606    +63   
- Misses        11795      11886    +91   
- Partials        692        721    +29   

Powered by Codecov. Last updated by 68787e3...c8158fd

mayavi/core/file_data_source.py
+ label='Delay'),
+ Item(name='loop'),
+ ),
+ enabled_when='len(object.file_list) > 1'

This comment has been minimized.

@kitchoi

kitchoi Jul 8, 2016

Member

maybe visible_when is cleaner than enable_when so the UI group just does not show up when there is only one file?

@kitchoi

kitchoi Jul 8, 2016

Member

maybe visible_when is cleaner than enable_when so the UI group just does not show up when there is only one file?

This comment has been minimized.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

Yes, I agree, I will change this.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

Yes, I agree, I will change this.

This comment has been minimized.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

Ahh, I remember why I did this. I thought that if you start with a single file and then add a new one, it will not show the UI elements with visible_when. It appears that I am wrong. I just tested and this does work so I will use visible_when.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

Ahh, I remember why I did this. I thought that if you start with a single file and then add a new one, it will not show the UI elements with visible_when. It appears that I am wrong. I just tested and this does work so I will use visible_when.

+ _count = Int(0)
+
+ def default_traits_view(self):
+ from traitsui.api import Item, View

This comment has been minimized.

@kitchoi

kitchoi Jul 8, 2016

Member

from traitsui.api import Item, View can go to the top?

@kitchoi

kitchoi Jul 8, 2016

Member

from traitsui.api import Item, View can go to the top?

This comment has been minimized.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

The only reason I put it there was to eliminate any UI related imports in the case of offscreen usage or with ETS_TOOLKIT=null.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

The only reason I put it there was to eliminate any UI related imports in the case of offscreen usage or with ETS_TOOLKIT=null.

This comment has been minimized.

@kitchoi

kitchoi Jul 8, 2016

Member

I see. Thanks.

@kitchoi

kitchoi Jul 8, 2016

Member

I see. Thanks.

This comment has been minimized.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

It may not make a difference but I figured it was better to be safe.

@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

It may not make a difference but I figured it was better to be safe.

@@ -917,6 +922,11 @@ def _recorder_changed(self, r):
messenger.disconnect(i_vtk, 'EndInteractionEvent',
self._record_camera_position)
+ def _movie_maker_default(self):
+ from tvtk.pyface.movie_maker import MovieMaker

This comment has been minimized.

@kitchoi

kitchoi Jul 8, 2016

Member

Is this to avoid import cycle?

@kitchoi

kitchoi Jul 8, 2016

Member

Is this to avoid import cycle?

This comment has been minimized.

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 8, 2016

Member

@prabhuramachandran The feature is cool! I have a few minor comments above and one question about the mlab.animate(support_movie=True):

I tested it locally and manually with an animation function that merely modify the camera. It does not seem to make a difference whether support_movie is True or not that both the movie feature and the animation feature can be supported at the same time. Or have I missed something? Can you explain a bit more on this please?

The rest looks good to me.

Member

kitchoi commented Jul 8, 2016

@prabhuramachandran The feature is cool! I have a few minor comments above and one question about the mlab.animate(support_movie=True):

I tested it locally and manually with an animation function that merely modify the camera. It does not seem to make a difference whether support_movie is True or not that both the movie feature and the animation feature can be supported at the same time. Or have I missed something? Can you explain a bit more on this please?

The rest looks good to me.

@prabhuramachandran

This comment has been minimized.

Show comment
Hide comment
@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

@kitchoi -- thanks for the review! The mlab.animate(support_movie=False) case will not invoke the animation start, step and stop methods. I only added this for the rare case when a user explicitly does not want to call those. This can happen if you want to run two animations simultaneously, for example (I have no idea if anyone would do it), let us say you have an animation that keeps rotating the camera about the "z" axis. Now let us say the user also has a timeseries and hits play. If support_movie were True, there would be a problem. In this case the user could use support_movie=False for the animation and the timeseries steps would be recorded as a movie. Is that clear?

Member

prabhuramachandran commented Jul 8, 2016

@kitchoi -- thanks for the review! The mlab.animate(support_movie=False) case will not invoke the animation start, step and stop methods. I only added this for the rare case when a user explicitly does not want to call those. This can happen if you want to run two animations simultaneously, for example (I have no idea if anyone would do it), let us say you have an animation that keeps rotating the camera about the "z" axis. Now let us say the user also has a timeseries and hits play. If support_movie were True, there would be a problem. In this case the user could use support_movie=False for the animation and the timeseries steps would be recorded as a movie. Is that clear?

@prabhuramachandran

This comment has been minimized.

Show comment
Hide comment
@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

@kitchoi -- can this be merged?

Member

prabhuramachandran commented Jul 8, 2016

@kitchoi -- can this be merged?

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 8, 2016

Member

This can happen if you want to run two animations simultaneously, for example (I have no idea if anyone would do it), let us say you have an animation that keeps rotating the camera about the "z" axis. Now let us say the user also has a timeseries and hits play. If support_movie were True, there would be a problem.

I'm sorry I should have explained what I tested more clearly. In fact I tested exactly this scenario and I have not encountered a problem. The experience is the same for both support_movie=True and support_movie=False. I tried starting the animation while the movie-play is on and vice versa.
I tested using traitsui 5.1.0, pyface 5.1.0 + (pyside or wxpython)

Member

kitchoi commented Jul 8, 2016

This can happen if you want to run two animations simultaneously, for example (I have no idea if anyone would do it), let us say you have an animation that keeps rotating the camera about the "z" axis. Now let us say the user also has a timeseries and hits play. If support_movie were True, there would be a problem.

I'm sorry I should have explained what I tested more clearly. In fact I tested exactly this scenario and I have not encountered a problem. The experience is the same for both support_movie=True and support_movie=False. I tried starting the animation while the movie-play is on and vice versa.
I tested using traitsui 5.1.0, pyface 5.1.0 + (pyside or wxpython)

@prabhuramachandran

This comment has been minimized.

Show comment
Hide comment
@prabhuramachandran

prabhuramachandran Jul 8, 2016

Member

Well, if two loops are being called you will end up with two calls to animation_start which will produce two different directories which should not happen when support_movie is False. The animation will still rotate the scene so the view should be the same but the animated function will not call animation_start/stop/step. I don't think the traits or pyface versions will matter. Am I missing something?

Member

prabhuramachandran commented Jul 8, 2016

Well, if two loops are being called you will end up with two calls to animation_start which will produce two different directories which should not happen when support_movie is False. The animation will still rotate the scene so the view should be the same but the animated function will not call animation_start/stop/step. I don't think the traits or pyface versions will matter. Am I missing something?

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 8, 2016

Member

Thanks @prabhuramachandran Now I understood what the 'support_movie' does. I guess it is because of the context of the PR that I was confused. For others using 'animate', it should be clear what 'support_movie' does.

Please feel free to merge. Thanks.

Member

kitchoi commented Jul 8, 2016

Thanks @prabhuramachandran Now I understood what the 'support_movie' does. I guess it is because of the context of the PR that I was confused. For others using 'animate', it should be clear what 'support_movie' does.

Please feel free to merge. Thanks.

@prabhuramachandran

This comment has been minimized.

Show comment
Hide comment
@prabhuramachandran

prabhuramachandran Jul 9, 2016

Member

@kitchoi -- thanks! Will merge this then.

Member

prabhuramachandran commented Jul 9, 2016

@kitchoi -- thanks! Will merge this then.

@prabhuramachandran prabhuramachandran merged commit 6896aeb into enthought:master Jul 9, 2016

3 checks passed

codecov/project Absolute coverage decreased by -0.08% but relative coverage increased by +35.94% compared to 68787e3
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@prabhuramachandran prabhuramachandran deleted the prabhuramachandran:movie_support branch Jul 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment