Skip to content

Commit f4124c3

Browse files
committed
The object name is now included in the csv when exporting transform data.
1 parent bfc6c2c commit f4124c3

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

Utils/Utils.cpp

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ void Utils::export_transform_data_to_CSV(std::string const& transform_file_path)
4646
record_file.seekg(0, std::ifstream::end);
4747
unsigned long size = record_file.tellg() / sizeof(TransformDTO);
4848

49+
std::string meta_file_path = get_meta_file_path_from_transform(transform_file_path);
50+
MetaInformation meta_information{meta_file_path};
51+
4952
Debug::Log("Recording transform file can be accessed. Number of transform chunks: " + std::to_string(size));
5053
TransformDTO current_data{};
5154
record_file.seekg(0, std::ifstream::beg);
@@ -55,24 +58,25 @@ void Utils::export_transform_data_to_CSV(std::string const& transform_file_path)
5558
"");
5659
std::fstream out(file_name + ".csv", std::fstream::in | std::fstream::out | std::fstream::app);
5760

58-
out << "Time,ID,ParentID,ActiveState,LocPosX,LocPosY,LocPosZ,GloPosX,GloPosY,GloPosZ,LocScaX,LocScaY,LocScaZ,GloScaX,GloScaY,GloScaZ,LocRotX,LocRotY,LocRotZ,LocRotW,GloRotX,GloRotY,GloRotZ,GloRotW\n";
61+
out << "Time;Name;ID;ParentID;ActiveState;LocPosX;LocPosY;LocPosZ;GloPosX;GloPosY;GloPosZ;LocScaX;LocScaY;LocScaZ;GloScaX;GloScaY;GloScaZ;LocRotX;LocRotY;LocRotZ;LocRotW;GloRotX;GloRotY;GloRotZ;GloRotW\n";
5962

6063
for (unsigned long i = 0; i < size; i++) {
6164
record_file.read((char *) &current_data, sizeof(TransformDTO));
62-
out << current_data.t << ",";
63-
out << current_data.id << ",";
64-
out << current_data.p_id << ",";
65-
out << current_data.act << ",";
65+
out << current_data.t << ";";
66+
out << meta_information.get_object_name(current_data.id) << ";";
67+
out << current_data.id << ";";
68+
out << current_data.p_id << ";";
69+
out << current_data.act << ";";
6670

67-
out << current_data.lp[0] << "," << current_data.lp[1] << "," << current_data.lp[2] << ",";
68-
out << current_data.gp[0] << "," << current_data.gp[1] << "," << current_data.gp[2] << ",";
71+
out << current_data.lp[0] << ";" << current_data.lp[1] << ";" << current_data.lp[2] << ";";
72+
out << current_data.gp[0] << ";" << current_data.gp[1] << ";" << current_data.gp[2] << ";";
6973

70-
out << current_data.ls[0] << "," << current_data.ls[1] << "," << current_data.ls[2] << ",";
71-
out << current_data.gs[0] << "," << current_data.gs[1] << "," << current_data.gs[2] << ",";
74+
out << current_data.ls[0] << ";" << current_data.ls[1] << ";" << current_data.ls[2] << ";";
75+
out << current_data.gs[0] << ";" << current_data.gs[1] << ";" << current_data.gs[2] << ";";
7276

73-
out << current_data.lr[0] << "," << current_data.lr[1] << "," << current_data.lr[2] << ","
74-
<< current_data.lr[3] << ",";
75-
out << current_data.gr[0] << "," << current_data.gr[1] << "," << current_data.gr[2] << ","
77+
out << current_data.lr[0] << ";" << current_data.lr[1] << ";" << current_data.lr[2] << ";"
78+
<< current_data.lr[3] << ";";
79+
out << current_data.gr[0] << ";" << current_data.gr[1] << ";" << current_data.gr[2] << ";"
7680
<< current_data.gr[3] << "\n";
7781
}
7882

@@ -104,25 +108,25 @@ void Utils::export_transform_data_to_CSV(std::string const& transform_file_path,
104108
std::string file_name = transform_data_file.replace(transform_data_file.find(file_ending), file_ending.length(),"");
105109
std::fstream out(file_name + "_" + target_object_path + ".csv", std::fstream::in | std::fstream::out | std::fstream::app);
106110

107-
out << "Time,ID,ParentID,ActiveState,LocPosX,LocPosY,LocPosZ,GloPosX,GloPosY,GloPosZ,LocScaX,LocScaY,LocScaZ,GloScaX,GloScaY,GloScaZ,LocRotX,LocRotY,LocRotZ,LocRotW,GloRotX,GloRotY,GloRotZ,GloRotW\n";
111+
out << "Time;ID;ParentID;ActiveState;LocPosX;LocPosY;LocPosZ;GloPosX;GloPosY;GloPosZ;LocScaX;LocScaY;LocScaZ;GloScaX;GloScaY;GloScaZ;LocRotX;LocRotY;LocRotZ;LocRotW;GloRotX;GloRotY;GloRotZ;GloRotW\n";
108112

109113
for (unsigned long i = 0; i < size; i++) {
110114
record_file.read((char *) &current_data, sizeof(TransformDTO));
111115
if(current_data.id == target_object_id) {
112-
out << current_data.t << ",";
113-
out << current_data.id << ",";
114-
out << current_data.p_id << ",";
115-
out << current_data.act << ",";
116+
out << current_data.t << ";";
117+
out << current_data.id << ";";
118+
out << current_data.p_id << ";";
119+
out << current_data.act << ";";
116120

117-
out << current_data.lp[0] << "," << current_data.lp[1] << "," << current_data.lp[2] << ",";
118-
out << current_data.gp[0] << "," << current_data.gp[1] << "," << current_data.gp[2] << ",";
121+
out << current_data.lp[0] << ";" << current_data.lp[1] << ";" << current_data.lp[2] << ";";
122+
out << current_data.gp[0] << ";" << current_data.gp[1] << ";" << current_data.gp[2] << ";";
119123

120-
out << current_data.ls[0] << "," << current_data.ls[1] << "," << current_data.ls[2] << ",";
121-
out << current_data.gs[0] << "," << current_data.gs[1] << "," << current_data.gs[2] << ",";
124+
out << current_data.ls[0] << ";" << current_data.ls[1] << ";" << current_data.ls[2] << ";";
125+
out << current_data.gs[0] << ";" << current_data.gs[1] << ";" << current_data.gs[2] << ";";
122126

123-
out << current_data.lr[0] << "," << current_data.lr[1] << "," << current_data.lr[2] << ","
124-
<< current_data.lr[3] << ",";
125-
out << current_data.gr[0] << "," << current_data.gr[1] << "," << current_data.gr[2] << ","
127+
out << current_data.lr[0] << ";" << current_data.lr[1] << ";" << current_data.lr[2] << ";"
128+
<< current_data.lr[3] << ";";
129+
out << current_data.gr[0] << ";" << current_data.gr[1] << ";" << current_data.gr[2] << ";"
126130
<< current_data.gr[3] << "\n";
127131
}
128132
}

0 commit comments

Comments
 (0)