Skip to content

Commit

Permalink
Fixed missing final image cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gedeschaines committed Dec 27, 2023
1 parent 7a0e6f6 commit 369115d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion draw3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,8 @@ def MainLoop(self):
self.canvas.flush_events()
continue

# Save last missile position.
# Save last "true" missile position (i.e., that
# read from a previous ktot >= 0 record).
if true_tsec > 0.0:
last_XM = XM
last_YM = YM
Expand Down Expand Up @@ -1377,5 +1378,14 @@ def MainLoop(self):
self.canvas.update()
self.canvas.flush_events()

if self.imgSave and ktot < 0:
# Save duplicate of last image to ensure final frame in an
# animated GIF or MP4 video file shows time of intercept.
sbuff = StringIO()
sbuff.write("./Ximg/img_%04hd.png" % (img_count))
img_fname = sbuff.getvalue()
sbuff.close()
self.fig.savefig(img_fname, format='png')

self.lfnt.close()
self.lfnt = None

0 comments on commit 369115d

Please sign in to comment.