diff --git a/xml_converter/intigration_tests/expected_outputs/proto_animation_speed/markers.bin b/xml_converter/intigration_tests/expected_outputs/proto_animation_speed/markers.bin new file mode 100644 index 00000000..269c512c Binary files /dev/null and b/xml_converter/intigration_tests/expected_outputs/proto_animation_speed/markers.bin differ diff --git a/xml_converter/intigration_tests/expected_outputs/xml_animation_speed/xml_file.xml b/xml_converter/intigration_tests/expected_outputs/xml_animation_speed/xml_file.xml new file mode 100644 index 00000000..61c293ba --- /dev/null +++ b/xml_converter/intigration_tests/expected_outputs/xml_animation_speed/xml_file.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/xml_converter/intigration_tests/inputs/xml_animation_speed/trail.trl b/xml_converter/intigration_tests/inputs/xml_animation_speed/trail.trl new file mode 100644 index 00000000..201ab83c Binary files /dev/null and b/xml_converter/intigration_tests/inputs/xml_animation_speed/trail.trl differ diff --git a/xml_converter/intigration_tests/inputs/xml_animation_speed/xml_file.xml b/xml_converter/intigration_tests/inputs/xml_animation_speed/xml_file.xml new file mode 100644 index 00000000..92ebf53c --- /dev/null +++ b/xml_converter/intigration_tests/inputs/xml_animation_speed/xml_file.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/xml_converter/intigration_tests/testcases.py b/xml_converter/intigration_tests/testcases.py index c7476af3..5f8dbe57 100644 --- a/xml_converter/intigration_tests/testcases.py +++ b/xml_converter/intigration_tests/testcases.py @@ -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" + ), Testcase( name="cull_chirality", xml_input_paths=["./inputs/xml_cull_chirality"], diff --git a/xml_converter/src/attribute/trail_data.cpp b/xml_converter/src/attribute/trail_data.cpp index bcd96217..f17463ac 100644 --- a/xml_converter/src/attribute/trail_data.cpp +++ b/xml_converter/src/attribute/trail_data.cpp @@ -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] @@ -57,20 +58,15 @@ void xml_attribute_to_trail_data( *map_id_value = *reinterpret_cast(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(point_x)); - char point_y[4]; - trail_data_file.read(point_y, 4); - trail_data.points_y.push_back(*reinterpret_cast(point_y)); - char point_z[4]; - trail_data_file.read(point_z, 4); - trail_data.points_z.push_back(*reinterpret_cast(point_z)); + char points[12]; + while (trail_data_file.read(points, 12)) { + trail_data.points_x.push_back(*reinterpret_cast(points)); + trail_data.points_y.push_back(*reinterpret_cast(points + 4)); + trail_data.points_z.push_back(*reinterpret_cast(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();