diff --git a/xml_converter/doc/menu/default_visibility.md b/xml_converter/doc/menu/default_visibility.md deleted file mode 100644 index b598d83d..00000000 --- a/xml_converter/doc/menu/default_visibility.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Default Visibility -type: Boolean -applies_to: [Category] -xml_fields: [DefaultToggle] -protobuf_field: default_visibility ---- - -Notes -===== -If the category should be shown or hidden on or off by default. - -https://blishhud.com/docs/markers/attributes/defaulttoggle - - diff --git a/xml_converter/doc/menu/is_hidden.md b/xml_converter/doc/menu/is_hidden.md new file mode 100644 index 00000000..a78b08d8 --- /dev/null +++ b/xml_converter/doc/menu/is_hidden.md @@ -0,0 +1,22 @@ +--- +name: Is Hidden +type: Boolean +applies_to: [Category] +xml_fields: [DefaultToggle] +protobuf_field: is_hidden +custom_functions: + read.xml: + function: inverted_xml_attribute_to_bool + side_effects: [] + write.xml: + function: bool_to_inverted_xml_attribute + side_effects: [] +--- + +Notes +===== +If the category should be shown or hidden on or off by default. + +https://blishhud.com/docs/markers/attributes/defaulttoggle + + diff --git a/xml_converter/integration_tests/test_cases/proto_hide_category/input/pack/markers.bin b/xml_converter/integration_tests/test_cases/proto_hide_category/input/pack/markers.bin new file mode 100644 index 00000000..d46368ee --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_hide_category/input/pack/markers.bin @@ -0,0 +1,9 @@ + +. + My Category 2B \Ï)Cf¦RC{ÔWC0B(èÌ“^– +. + My Category 2 2B \Ï)Cf¦RC{ÔWCB(íià4 1b +0 + My Category 3 2B \Ï)Cf¦RC{ÔWC0B(íià5 1b +. + My Category 4 2B \Ï)Cf¦RC{ÔWCB(íià6 1b \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/proto_hide_category/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/proto_hide_category/output_proto/markers.bin new file mode 100644 index 00000000..d46368ee --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_hide_category/output_proto/markers.bin @@ -0,0 +1,9 @@ + +. + My Category 2B \Ï)Cf¦RC{ÔWC0B(èÌ“^– +. + My Category 2 2B \Ï)Cf¦RC{ÔWCB(íià4 1b +0 + My Category 3 2B \Ï)Cf¦RC{ÔWC0B(íià5 1b +. + My Category 4 2B \Ï)Cf¦RC{ÔWCB(íià6 1b \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/proto_hide_category/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/proto_hide_category/output_xml/xml_file.xml new file mode 100644 index 00000000..0bc237c6 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_hide_category/output_xml/xml_file.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/proto_hide_category/testcase.yaml b/xml_converter/integration_tests/test_cases/proto_hide_category/testcase.yaml new file mode 100644 index 00000000..d87f4066 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_hide_category/testcase.yaml @@ -0,0 +1,5 @@ +input_paths: + "pack": "proto" +expected_stdout: | +expected_stderr: | +expected_returncode: 0 diff --git a/xml_converter/integration_tests/test_cases/xml_default_toggle/input/pack/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_default_toggle/input/pack/xml_file.xml new file mode 100644 index 00000000..ebea9d36 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_default_toggle/input/pack/xml_file.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/xml_default_toggle/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/xml_default_toggle/output_proto/markers.bin new file mode 100644 index 00000000..d46368ee --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_default_toggle/output_proto/markers.bin @@ -0,0 +1,9 @@ + +. + My Category 2B \Ï)Cf¦RC{ÔWC0B(èÌ“^– +. + My Category 2 2B \Ï)Cf¦RC{ÔWCB(íià4 1b +0 + My Category 3 2B \Ï)Cf¦RC{ÔWC0B(íià5 1b +. + My Category 4 2B \Ï)Cf¦RC{ÔWCB(íià6 1b \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/xml_default_toggle/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_default_toggle/output_xml/xml_file.xml new file mode 100644 index 00000000..dd9d98b4 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_default_toggle/output_xml/xml_file.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_default_toggle/testcase.yaml b/xml_converter/integration_tests/test_cases/xml_default_toggle/testcase.yaml new file mode 100644 index 00000000..9510c793 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_default_toggle/testcase.yaml @@ -0,0 +1,5 @@ +input_paths: + "pack": "xml" +expected_stdout: | +expected_stderr: | +expected_returncode: 0 diff --git a/xml_converter/proto/waypoint.proto b/xml_converter/proto/waypoint.proto index 74d77133..702e07b1 100644 --- a/xml_converter/proto/waypoint.proto +++ b/xml_converter/proto/waypoint.proto @@ -21,7 +21,7 @@ message Category { repeated Icon icon = 3; repeated Trail trail = 4; bool is_separator = 5; - bool default_visibility = 6; + bool is_hidden = 6; string tip_description = 7; bytes id = 8; } diff --git a/xml_converter/src/category_gen.cpp b/xml_converter/src/category_gen.cpp index 91d69ce7..90be2254 100644 --- a/xml_converter/src/category_gen.cpp +++ b/xml_converter/src/category_gen.cpp @@ -48,12 +48,12 @@ void Category::init_from_xml(rapidxml::xml_node<>* node, vector* erro bool Category::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector* errors, XMLReaderState* state) { string attributename; attributename = normalize(get_attribute_name(attribute)); - if (attributename == "defaulttoggle") { - xml_attribute_to_bool(attribute, errors, state, &(this->default_visibility), &(this->default_visibility_is_set)); - } - else if (attributename == "displayname") { + if (attributename == "displayname") { xml_attribute_to_string(attribute, errors, state, &(this->display_name), &(this->display_name_is_set)); } + else if (attributename == "defaulttoggle") { + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->is_hidden), &(this->is_hidden_is_set)); + } else if (attributename == "isseparator") { xml_attribute_to_bool(attribute, errors, state, &(this->is_separator), &(this->is_separator_is_set)); } @@ -78,12 +78,12 @@ bool Category::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector Category::as_xml(XMLWriterState* state) const { vector xml_node_contents; xml_node_contents.push_back("default_visibility_is_set) { - xml_node_contents.push_back(bool_to_xml_attribute("DefaultToggle", state, &this->default_visibility)); - } if (this->display_name_is_set) { xml_node_contents.push_back(string_to_xml_attribute("DisplayName", state, &this->display_name)); } + if (this->is_hidden_is_set) { + xml_node_contents.push_back(bool_to_inverted_xml_attribute("DefaultToggle", state, &this->is_hidden)); + } if (this->is_separator_is_set) { xml_node_contents.push_back(bool_to_xml_attribute("IsSeparator", state, &this->is_separator)); } @@ -113,14 +113,14 @@ vector Category::as_xml(XMLWriterState* state) const { waypoint::Category Category::as_protobuf(ProtoWriterState* state) const { waypoint::Category proto_category; - if (this->default_visibility_is_set) { - std::function setter = [&proto_category](bool val) { proto_category.set_default_visibility(val); }; - bool_to_proto(this->default_visibility, state, setter); - } if (this->display_name_is_set) { std::function setter = [&proto_category](std::string val) { proto_category.set_name(val); }; display_name_and_name_to_proto_display_name(this->display_name, state, setter, &(this->name), &(this->name_is_set)); } + if (this->is_hidden_is_set) { + std::function setter = [&proto_category](bool val) { proto_category.set_is_hidden(val); }; + bool_to_proto(this->is_hidden, state, setter); + } if (this->is_separator_is_set) { std::function setter = [&proto_category](bool val) { proto_category.set_is_separator(val); }; bool_to_proto(this->is_separator, state, setter); @@ -137,12 +137,12 @@ waypoint::Category Category::as_protobuf(ProtoWriterState* state) const { } void Category::parse_protobuf(waypoint::Category proto_category, ProtoReaderState* state) { - if (proto_category.default_visibility() != 0) { - proto_to_bool(proto_category.default_visibility(), state, &(this->default_visibility), &(this->default_visibility_is_set)); - } if (proto_category.name() != "") { proto_display_name_to_display_name_and_name(proto_category.name(), state, &(this->display_name), &(this->display_name_is_set), &(this->name), &(this->name_is_set)); } + if (proto_category.is_hidden() != 0) { + proto_to_bool(proto_category.is_hidden(), state, &(this->is_hidden), &(this->is_hidden_is_set)); + } if (proto_category.is_separator() != 0) { proto_to_bool(proto_category.is_separator(), state, &(this->is_separator), &(this->is_separator_is_set)); } diff --git a/xml_converter/src/category_gen.hpp b/xml_converter/src/category_gen.hpp index 5a04029b..3bc738cf 100644 --- a/xml_converter/src/category_gen.hpp +++ b/xml_converter/src/category_gen.hpp @@ -17,14 +17,14 @@ class XMLError; class Category : public Parseable { public: - bool default_visibility; std::string display_name; + bool is_hidden; bool is_separator; UniqueId menu_id; std::string name; std::string tooltip_description; - bool default_visibility_is_set = false; bool display_name_is_set = false; + bool is_hidden_is_set = false; bool is_separator_is_set = false; bool menu_id_is_set = false; bool name_is_set = false;