raspberrypi / scratch

Scratch releases
79 stars 21 forks source link

Camera fails to work in presentation mode #206

Closed timrowledge closed 8 years ago

timrowledge commented 8 years ago

See https://www.raspberrypi.org/forums/viewtopic.php?p=1022466#p1022466 user BTang reports that trying to take a photo when in presentation mode does not work.

It works perfectly well in normal mode.

timrowledge commented 8 years ago

Unfortunately this is not a simple mistake by the user; there is an actual problem because the code in #processPhoto searches for a ScratchFrameMorph but when in presentation mode there is no suitable owner and so there is no target sprite to give the image to.

In principle this is simple to fix but doing so neatly took some time to find. The original code used the always-unpleasant ownerThatIs: ScratchFrameMorph, which is going to fail when presentation mode is active because the top owner is an OffScreenWorldMorph that keeps hold of the frame morph indirectly. We could 'solve' this by using firstOwnerSuchThat: as a nut-cracker but I really hate that approach. So instead we'll pass the buck and do what ought to be done by any decent designer - delegate by sending messages and letting each layer in the owner tree do the right thing. Plain old Morph will pass up to it's owner if not nil, but ScratchFrameMorph and OffscreenWorldMorph can answer themselves or the stored frame.

Testing shows that this now allows the camera to work in presentation mode.

timrowledge commented 8 years ago

Next step is to find a way to get the fix to BTang in time for the youngsters' science fair.

We can't simply send a whole new release to install because we can't know exactly what the local setup is. So, a new image is required, based on the last release. This has an slight extra complication in that the command parsing has been changed a bit, so remember to fudge that too.

New test image uploaded to github for BTang @ https://github.com/raspberrypi/scratch/commit/3fd7495093578d424bd6b82cbab1f590bc63f05d

The fix needs applying to the man stream image and inserting in the beta-test for the next release.