Skip to content

Commit

Permalink
recording enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Nov 9, 2017
1 parent 38c4022 commit 66187c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions Unreal/Plugins/AirSim/Source/Recording/RecordingFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ void RecordingFile::appendRecord(TArray<uint8>& image_data, VehiclePawnWrapper*
std::string filename = std::string("img_").append(std::to_string(images_saved_)).append(".png");

try {
FString image_file_path = FString(common_utils::FileSystem::combine(image_path_, filename).c_str());
imageSavedOk = FFileHelper::SaveArrayToFile(image_data, *image_file_path);
filePath = FString(common_utils::FileSystem::combine(image_path_, filename).c_str());
imageSavedOk = FFileHelper::SaveArrayToFile(image_data, *filePath);
}
catch(std::exception& ex) {
UAirBlueprintLib::LogMessage(TEXT("Image file save failed"), FString(ex.what()), LogDebugLevel::Failure);
Expand All @@ -33,7 +33,7 @@ void RecordingFile::appendRecord(TArray<uint8>& image_data, VehiclePawnWrapper*
if (imageSavedOk) {
writeString(wrapper->getLogLine().append(filename).append("\n"));

UAirBlueprintLib::LogMessage(TEXT("Screenshot saved to:"), filePath, LogDebugLevel::Success);
//UAirBlueprintLib::LogMessage(TEXT("Screenshot saved to:"), filePath, LogDebugLevel::Success);
images_saved_++;
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ void RecordingFile::startRecording()
if (isFileOpen()) {
is_recording_ = true;

UAirBlueprintLib::LogMessage(TEXT("Recording"), TEXT("Started"), LogDebugLevel::Success);
UAirBlueprintLib::LogMessage(TEXT("Recording: "), TEXT("Started"), LogDebugLevel::Success);
}
else
UAirBlueprintLib::LogMessageString("Error creating log file", log_filepath.c_str(), LogDebugLevel::Failure);
Expand All @@ -135,7 +135,8 @@ void RecordingFile::stopRecording(bool ignore_if_stopped)
else
closeFile();

UAirBlueprintLib::LogMessage(TEXT("Recording"), TEXT("Stopped"), LogDebugLevel::Success);
UAirBlueprintLib::LogMessage(TEXT("Recording: "), TEXT("Stopped"), LogDebugLevel::Success);
UAirBlueprintLib::LogMessage(TEXT("Data saved to: "), FString(image_path_.c_str()), LogDebugLevel::Success);
}

bool RecordingFile::isRecording()
Expand Down
2 changes: 1 addition & 1 deletion Unreal/Plugins/AirSim/Source/Recording/RecordingThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ void FRecordingThread::EnsureCompletion()
{
Stop();
thread_->WaitForCompletion();
UAirBlueprintLib::LogMessage(TEXT("Stopped recording thread"), TEXT(""), LogDebugLevel::Success);
//UAirBlueprintLib::LogMessage(TEXT("Stopped recording thread"), TEXT(""), LogDebugLevel::Success);
}

0 comments on commit 66187c5

Please sign in to comment.