Skip to content

Commit

Permalink
Merge pull request #347 from klingbolt/invert_default_visibility
Browse files Browse the repository at this point in the history
Invert default visibility
  • Loading branch information
AsherGlick authored Sep 8, 2024
2 parents 8e826f8 + 5322ee7 commit 335463d
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 32 deletions.
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


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,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>
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

0 comments on commit 335463d

Please sign in to comment.