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

Invert default visibility #347

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions xml_converter/doc/menu/default_visibility.md

This file was deleted.

22 changes: 22 additions & 0 deletions xml_converter/doc/menu/is_hidden.md
Original file line number Diff line number Diff line change
@@ -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


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/integration_tests/test_cases/proto_hide_category/input/pack/markers.bin.textproto._old	2024-09-08 00:48:04.767466414 +0000
+++ xml_converter/integration_tests/test_cases/proto_hide_category/input/pack/markers.bin.textproto._new	2024-09-08 00:48:04.775466387 +0000
@@ -0,0 +1,50 @@
+category {
+  name: "My Category"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  default_visibility: true
+  id: "(\350\314\006\302\223^\226"
+}
+category {
+  name: "My Category 2"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  id: "(\355i\3404\0141b"
+}
+category {
+  name: "My Category 3"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  default_visibility: true
+  id: "(\355i\3405\0141b"
+}
+category {
+  name: "My Category 4"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  id: "(\355i\3406\0141b"
+}

Original file line number Diff line number Diff line change
@@ -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
Expand Down
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/integration_tests/test_cases/proto_hide_category/output_proto/markers.bin.textproto._old	2024-09-08 00:48:04.795466321 +0000
+++ xml_converter/integration_tests/test_cases/proto_hide_category/output_proto/markers.bin.textproto._new	2024-09-08 00:48:04.803466295 +0000
@@ -0,0 +1,50 @@
+category {
+  name: "My Category"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  default_visibility: true
+  id: "(\350\314\006\302\223^\226"
+}
+category {
+  name: "My Category 2"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  id: "(\355i\3404\0141b"
+}
+category {
+  name: "My Category 3"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  default_visibility: true
+  id: "(\355i\3405\0141b"
+}
+category {
+  name: "My Category 4"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  id: "(\355i\3406\0141b"
+}

Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" DefaultToggle="false" ID="KOjMBsKTXpY=" Name="mycategory">
</MarkerCategory>

<MarkerCategory DisplayName="My Category 2" ID="KO1p4DQMMWI=" Name="mycategory2">
</MarkerCategory>

<MarkerCategory DisplayName="My Category 3" DefaultToggle="false" ID="KO1p4DUMMWI=" Name="mycategory3">
</MarkerCategory>

<MarkerCategory DisplayName="My Category 4" ID="KO1p4DYMMWI=" Name="mycategory4">
</MarkerCategory>

<POIs>
<POI Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory2" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory3" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory4" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
</POIs>
</OverlayData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input_paths:
"pack": "proto"
expected_stdout: |
expected_stderr: |
expected_returncode: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" DefaultToggle="false" Name="mycategory">
</MarkerCategory>
<MarkerCategory DisplayName="My Category 2" DefaultToggle="true" Name="mycategory2">
</MarkerCategory>
<MarkerCategory DisplayName="My Category 3" DefaultToggle="0" Name="mycategory3">
</MarkerCategory>
<MarkerCategory DisplayName="My Category 4" DefaultToggle="1" Name="mycategory4">
</MarkerCategory>
<POIs>
<POI Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI Type="mycategory2" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI Type="mycategory3" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI Type="mycategory4" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
</POIs>
</OverlayData>
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/integration_tests/test_cases/xml_default_toggle/output_proto/markers.bin.textproto._old	2024-09-08 00:48:04.807466282 +0000
+++ xml_converter/integration_tests/test_cases/xml_default_toggle/output_proto/markers.bin.textproto._new	2024-09-08 00:48:04.815466255 +0000
@@ -0,0 +1,50 @@
+category {
+  name: "My Category"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  default_visibility: true
+  id: "(\350\314\006\302\223^\226"
+}
+category {
+  name: "My Category 2"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  id: "(\355i\3404\0141b"
+}
+category {
+  name: "My Category 3"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  default_visibility: true
+  id: "(\355i\3405\0141b"
+}
+category {
+  name: "My Category 4"
+  icon {
+    map_id: 50
+    position {
+      x: 169.81
+      y: 210.65
+      z: 215.83
+    }
+  }
+  id: "(\355i\3406\0141b"
+}

Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" DefaultToggle="false" ID="KOjMBsKTXpY=" Name="mycategory">
</MarkerCategory>

<MarkerCategory DisplayName="My Category 2" DefaultToggle="true" ID="KO1p4DQMMWI=" Name="mycategory2">
</MarkerCategory>

<MarkerCategory DisplayName="My Category 3" DefaultToggle="false" ID="KO1p4DUMMWI=" Name="mycategory3">
</MarkerCategory>

<MarkerCategory DisplayName="My Category 4" DefaultToggle="true" ID="KO1p4DYMMWI=" Name="mycategory4">
</MarkerCategory>

<POIs>
<POI Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory2" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory3" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory4" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
</POIs>
</OverlayData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input_paths:
"pack": "xml"
expected_stdout: |
expected_stderr: |
expected_returncode: 0
2 changes: 1 addition & 1 deletion xml_converter/proto/waypoint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
28 changes: 14 additions & 14 deletions xml_converter/src/category_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ void Category::init_from_xml(rapidxml::xml_node<>* node, vector<XMLError*>* erro
bool Category::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector<XMLError*>* 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));
}
Expand All @@ -78,12 +78,12 @@ bool Category::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector<X
vector<string> Category::as_xml(XMLWriterState* state) const {
vector<string> xml_node_contents;
xml_node_contents.push_back("<MarkerCategory ");
if (this->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));
}
Expand Down Expand Up @@ -113,14 +113,14 @@ vector<string> 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<void(bool)> 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<void(std::string)> 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<void(bool)> 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<void(bool)> setter = [&proto_category](bool val) { proto_category.set_is_separator(val); };
bool_to_proto(this->is_separator, state, setter);
Expand All @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions xml_converter/src/category_gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading