Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anim speed #228

Merged
merged 12 commits into from
Dec 5, 2023
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full Diff
--- xml_converter/intigration_tests/expected_outputs/proto_animation_speed/markers.bin.textproto._old	2023-12-05 02:08:49.831166946 +0000
+++ xml_converter/intigration_tests/expected_outputs/proto_animation_speed/markers.bin.textproto._new	2023-12-05 02:08:49.839166935 +0000
@@ -0,0 +1,181 @@
+category {
+  name: "My Category"
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: 1
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: 3.14
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: 123.456
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: 1
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: 3.14
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: 123.456
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: -3.14
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: -123.456
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: -3.14
+  }
+  trail {
+    map_id: 50
+    trail_data {
+      points_x: 1
+      points_x: 2
+      points_x: 3
+      points_y: 4
+      points_y: 5
+      points_y: 6
+      points_z: 7
+      points_z: 8
+      points_z: 9
+    }
+    animation_speed: -123.456
+  }
+}

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" Name="mycategory">
</MarkerCategory>

<POIs>
<Trail AnimSpeed="0.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="1.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="0.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="1.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
</POIs>
</OverlayData>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" Name="mycategory">
</MarkerCategory>

<POIs>
<Trail AnimSpeed="0" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="1.0" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="123.456" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="0" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="1" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="123.456" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="-3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="-123.456" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="-3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="-123.456" TrailData="trail.trl" Type="mycategory" />
</POIs>
</OverlayData>
6 changes: 6 additions & 0 deletions xml_converter/intigration_tests/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ class Testcase:
expected_output_xml_path="./expected_outputs/xml_profession_filter",
expected_output_proto_path="./expected_outputs/proto_profession_filter",
),
Testcase(
name="animation_speed",
xml_input_paths=["./inputs/xml_animation_speed"],
expected_output_xml_path="./expected_outputs/xml_animation_speed",
expected_output_proto_path="./expected_outputs/proto_animation_speed"
),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the proto testcases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the top comment, the proto will be changed by #151. I didn't want to add an incorrect proto

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just change the proto here? Now seems like as good of a time as any to avoid it being forgotten.

Testcase(
name="cull_chirality",
xml_input_paths=["./inputs/xml_cull_chirality"],
Expand Down
20 changes: 8 additions & 12 deletions xml_converter/src/attribute/trail_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void xml_attribute_to_trail_data(
errors->push_back(new XMLAttributeValueError("No trail file found at " + trail_path, input));
return;
}

char version[4];
trail_data_file.read(version, 4);
// Validate the version number. Currently supports versions [0]
Expand All @@ -57,20 +58,15 @@ void xml_attribute_to_trail_data(
*map_id_value = *reinterpret_cast<uint32_t*>(map_id_char);
*is_map_id_set = true;

while (trail_data_file.tellg() > 0) {
char point_x[4];
trail_data_file.read(point_x, 4);
trail_data.points_x.push_back(*reinterpret_cast<float*>(point_x));
char point_y[4];
trail_data_file.read(point_y, 4);
trail_data.points_y.push_back(*reinterpret_cast<float*>(point_y));
char point_z[4];
trail_data_file.read(point_z, 4);
trail_data.points_z.push_back(*reinterpret_cast<float*>(point_z));
char points[12];
while (trail_data_file.read(points, 12)) {
trail_data.points_x.push_back(*reinterpret_cast<float*>(points));
trail_data.points_y.push_back(*reinterpret_cast<float*>(points + 4));
trail_data.points_z.push_back(*reinterpret_cast<float*>(points + 8));
}

if (trail_data.points_x.size() != trail_data.points_y.size() || trail_data.points_x.size() != trail_data.points_z.size()) {
errors->push_back(new XMLAttributeValueError("Unexpected number of bits in trail file. Does not have equal number of X, Y, and Z coordinates." + trail_path, input));
if (trail_data_file.gcount() != 0) {
errors->push_back(new XMLAttributeValueError("Unexpected number of bytes in trail file." + trail_path, input));
}

trail_data_file.close();
Expand Down
Loading