   catch error
     return showMessage(MessageType.Error, "<strong>Model error.</strong> #{error}")
 
+  currentModel.atVersion(currentFrame).data = currentModelData
+
   try
     currentActions = eval(editors.actionsEditor.getValue())
   catch error

globals = @

CODE_CHANGE_TIMEOUT = 1000

MessageType = GE.makeConstantSet("Error", "Info")


handleAnimation = ->
  if not isPlaying then return false

  currentModel = executeCode()
  currentFrame++

  editors.modelEditor.setValue(JSON.stringify(currentModel.data, null, MODEL_FORMATTING_INDENTATION))
  # The new contect will be selected by default
  editors.modelEditor.selection.clearSelection() 

