Skip to content

Commit

Permalink
Merge pull request #348 from klingbolt/scale_on_map
Browse files Browse the repository at this point in the history
Change Scale On Map with Zoom to Constant Size on Map
  • Loading branch information
AsherGlick authored Sep 9, 2024
2 parents b740a38 + 6cd4cb7 commit 4de28d3
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 30 deletions.
21 changes: 21 additions & 0 deletions xml_converter/doc/rendering/constant_size_on_map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Constant Size On Map
type: Boolean
applies_to: [Icon]
xml_fields: [ScaleOnMapWithZoom]
protobuf_field: constant_size_on_map
custom_functions:
read.xml:
function: inverted_xml_attribute_to_bool
side_effects: []
write.xml:
function: bool_to_inverted_xml_attribute
side_effects: []
---
Scale the size of the object to be the same scale as the map.

Notes
=====

https://blishhud.com/docs/markers/attributes/scaleonmapwithzoom

14 changes: 0 additions & 14 deletions xml_converter/doc/rendering/scale_on_map_with_zoom.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

q
My Category 2B\�)Cf�RC{�WC 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WCB(��“^�
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

q
My Category 2B\�)Cf�RC{�WC 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WCB(��“^�
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" ID="KOjMBsKTXpY=" Name="mycategory">
</MarkerCategory>

<POIs>
<POI Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" ScaleOnMapWithZoom="false" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" ScaleOnMapWithZoom="false" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" 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,10 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" Name="mycategory">
</MarkerCategory>
<POIs>
<POI ScaleOnMapWithZoom="true" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI ScaleOnMapWithZoom="false" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI ScaleOnMapWithZoom="0" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI ScaleOnMapWithZoom="1" Type="mycategory" 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,3 @@

q
My Category 2B\�)Cf�RC{�WC 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WCB(��“^�
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" ID="KOjMBsKTXpY=" Name="mycategory">
</MarkerCategory>

<POIs>
<POI Type="mycategory" ScaleOnMapWithZoom="true" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" ScaleOnMapWithZoom="false" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" ScaleOnMapWithZoom="false" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" ScaleOnMapWithZoom="true" 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 @@ -44,7 +44,7 @@ message Icon {
int32 minimum_size_on_screen = 20;
int32 map_display_size = 21;
int32 maximum_size_on_screen = 22;
bool scale_on_map_with_zoom = 23;
bool constant_size_on_map = 23;
string tip_description = 24;
string tip_name = 25;
fixed32 rgba_color = 26;
Expand Down
26 changes: 13 additions & 13 deletions xml_converter/src/icon_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ bool Icon::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector<XMLEr
else if (attributename == "red") {
xml_attribute_to_float(attribute, errors, state, &(this->color.red), &(this->color_is_set));
}
else if (attributename == "scaleonmapwithzoom") {
inverted_xml_attribute_to_bool(attribute, errors, state, &(this->constant_size_on_map), &(this->constant_size_on_map_is_set));
}
else if (attributename == "copy") {
xml_attribute_to_string(attribute, errors, state, &(this->copy_clipboard), &(this->copy_clipboard_is_set));
}
Expand Down Expand Up @@ -202,9 +205,6 @@ bool Icon::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector<XMLEr
else if (attributename == "resetlength") {
xml_attribute_to_float(attribute, errors, state, &(this->reset_length), &(this->reset_length_is_set));
}
else if (attributename == "scaleonmapwithzoom") {
xml_attribute_to_bool(attribute, errors, state, &(this->scale_on_map_with_zoom), &(this->scale_on_map_with_zoom_is_set));
}
else if (attributename == "schedule") {
xml_attribute_to_string(attribute, errors, state, &(this->schedule), &(this->schedule_is_set));
}
Expand Down Expand Up @@ -285,6 +285,9 @@ vector<string> Icon::as_xml(XMLWriterState* state) const {
if (this->color_is_set) {
xml_node_contents.push_back(float_to_xml_attribute("Alpha", state, &this->color.alpha));
}
if (this->constant_size_on_map_is_set) {
xml_node_contents.push_back(bool_to_inverted_xml_attribute("ScaleOnMapWithZoom", state, &this->constant_size_on_map));
}
if (this->copy_clipboard_is_set) {
xml_node_contents.push_back(string_to_xml_attribute("Copy", state, &this->copy_clipboard));
}
Expand Down Expand Up @@ -375,9 +378,6 @@ vector<string> Icon::as_xml(XMLWriterState* state) const {
if (this->reset_length_is_set) {
xml_node_contents.push_back(float_to_xml_attribute("ResetLength", state, &this->reset_length));
}
if (this->scale_on_map_with_zoom_is_set) {
xml_node_contents.push_back(bool_to_xml_attribute("ScaleOnMapWithZoom", state, &this->scale_on_map_with_zoom));
}
if (this->schedule_is_set) {
xml_node_contents.push_back(string_to_xml_attribute("Schedule", state, &this->schedule));
}
Expand Down Expand Up @@ -439,6 +439,10 @@ waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const {
std::function<void(uint32_t)> setter = [&proto_icon](uint32_t val) { proto_icon.set_rgba_color(val); };
color_to_proto(this->color, state, setter);
}
if (this->constant_size_on_map_is_set) {
std::function<void(bool)> setter = [&proto_icon](bool val) { proto_icon.set_constant_size_on_map(val); };
bool_to_proto(this->constant_size_on_map, state, setter);
}
if (this->copy_clipboard_is_set) {
std::function<void(std::string)> setter = [&proto_icon](std::string val) { proto_icon.mutable_trigger()->set_action_copy_clipboard(val); };
string_to_proto(this->copy_clipboard, state, setter);
Expand Down Expand Up @@ -555,10 +559,6 @@ waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const {
std::function<void(float)> setter = [&proto_icon](float val) { proto_icon.mutable_trigger()->set_reset_length(val); };
float_to_proto(this->reset_length, state, setter);
}
if (this->scale_on_map_with_zoom_is_set) {
std::function<void(bool)> setter = [&proto_icon](bool val) { proto_icon.set_scale_on_map_with_zoom(val); };
bool_to_proto(this->scale_on_map_with_zoom, state, setter);
}
if (this->schedule_is_set) {
std::function<void(std::string)> setter = [&proto_icon](std::string val) { proto_icon.set_bhdraft__schedule(val); };
string_to_proto(this->schedule, state, setter);
Expand Down Expand Up @@ -620,6 +620,9 @@ void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) {
if (proto_icon.rgba_color() != 0) {
proto_to_color(proto_icon.rgba_color(), state, &(this->color), &(this->color_is_set));
}
if (proto_icon.constant_size_on_map() != 0) {
proto_to_bool(proto_icon.constant_size_on_map(), state, &(this->constant_size_on_map), &(this->constant_size_on_map_is_set));
}
if (proto_icon.trigger().action_copy_clipboard() != "") {
proto_to_string(proto_icon.trigger().action_copy_clipboard(), state, &(this->copy_clipboard), &(this->copy_clipboard_is_set));
}
Expand Down Expand Up @@ -707,9 +710,6 @@ void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) {
if (proto_icon.trigger().reset_length() != 0) {
proto_to_float(proto_icon.trigger().reset_length(), state, &(this->reset_length), &(this->reset_length_is_set));
}
if (proto_icon.scale_on_map_with_zoom() != 0) {
proto_to_bool(proto_icon.scale_on_map_with_zoom(), state, &(this->scale_on_map_with_zoom), &(this->scale_on_map_with_zoom_is_set));
}
if (proto_icon.bhdraft__schedule() != "") {
proto_to_string(proto_icon.bhdraft__schedule(), state, &(this->schedule), &(this->schedule_is_set));
}
Expand Down
4 changes: 2 additions & 2 deletions xml_converter/src/icon_gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Icon : public Parseable {
float bounce_height;
MarkerCategory category;
Color color;
bool constant_size_on_map;
std::string copy_clipboard;
std::string copy_message;
CullChirality cull_chirality;
Expand Down Expand Up @@ -64,7 +65,6 @@ class Icon : public Parseable {
bool render_on_minimap;
ResetBehavior reset_behavior;
float reset_length;
bool scale_on_map_with_zoom;
std::string schedule;
float schedule_duration;
MarkerCategory show_category;
Expand All @@ -82,6 +82,7 @@ class Icon : public Parseable {
bool bounce_height_is_set = false;
bool category_is_set = false;
bool color_is_set = false;
bool constant_size_on_map_is_set = false;
bool copy_clipboard_is_set = false;
bool copy_message_is_set = false;
bool cull_chirality_is_set = false;
Expand Down Expand Up @@ -111,7 +112,6 @@ class Icon : public Parseable {
bool render_on_minimap_is_set = false;
bool reset_behavior_is_set = false;
bool reset_length_is_set = false;
bool scale_on_map_with_zoom_is_set = false;
bool schedule_is_set = false;
bool schedule_duration_is_set = false;
bool show_category_is_set = false;
Expand Down

0 comments on commit 4de28d3

Please sign in to comment.