Skip to content

Commit

Permalink
Added a new field that excludes the attribute from being written into…
Browse files Browse the repository at this point in the history
… the proto if we do not know how it will be implemented in Burrito
  • Loading branch information
klingbolt committed Dec 14, 2024
1 parent 8aebcdb commit 027ce83
Show file tree
Hide file tree
Showing 72 changed files with 323 additions and 472 deletions.
1 change: 1 addition & 0 deletions xml_converter/doc/acheivement/achievement_bit_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Achievement Bit Index
type: Int32
applies_to: [Icon, Trail]
xml_fields: ["AchievementBit", "AchievementBitIndex"]
exclude_from_protobuf: True
protobuf_field: achievement_bit_index
examples: ["0", "1", "2", "14"]
---
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/acheivement/achievement_id.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Achievement ID
type: Int32
applies_to: [Icon, Trail]
xml_fields: ["AchievementId"]
exclude_from_protobuf: True
protobuf_field: achievement_id
examples:
- "2655"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Disable Player Cutout
type: Boolean
applies_to: [Icon, Trail]
xml_fields: [CanFade]
exclude_from_protobuf: True
protobuf_field: disable_player_cutout
custom_functions:
read.xml:
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/fade/distance_fade_end.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Float32
applies_to: [Icon, Trail]
xml_fields: [FadeFar, DistanceFadeEnd]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #distance_fade_end
exclude_from_protobuf: True
protobuf_field: distance_fade_end
examples:
- "850"
- "600"
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/fade/distance_fade_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Float32
applies_to: [Icon, Trail]
xml_fields: [FadeNear, DistanceFadeStart]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #distance_fade_start
exclude_from_protobuf: True
protobuf_field: distance_fade_start
examples:
- "650"
- "400"
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/menu/is_hidden.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Is Hidden
type: Boolean
applies_to: [Category]
xml_fields: [DefaultToggle]
exclude_from_protobuf: True
protobuf_field: is_hidden
custom_functions:
read.xml:
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/position/height_offset.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Float32
applies_to: ["Icon"]
xml_fields: ["HeightOffset", "BHHeightOffset"]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #height_offset
exclude_from_protobuf: True
protobuf_field: height_offset
examples:
- "0"
---
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/rendering/constant_size_on_map.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Constant Size On Map
type: Boolean
applies_to: [Icon]
xml_fields: [ScaleOnMapWithZoom]
exclude_from_protobuf: True
protobuf_field: constant_size_on_map
custom_functions:
read.xml:
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/rendering/map_display_size.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Int32
applies_to: [Icon, Trail]
xml_fields: [MapDisplaySize]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #map_display_size
exclude_from_protobuf: True
protobuf_field: map_display_size
---
The size, in pixels, that the marker should be shown on the minimap or fullscreen map.
When applied to a Trail, affects the width of the trail shown on the minimap or fullscreen map.
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/scale/icon_size.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Float32
applies_to: [Icon]
xml_fields: [IconSize]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #tentative__scale
exclude_from_protobuf: True
protobuf_field: tentative__scale
---
Multiplier on the size of an image (i.e. 1 is 100%, 2 is 200%).

Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/scale/trail_scale.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Float32
applies_to: [Trail]
xml_fields: [TrailScale]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #scale
exclude_from_protobuf: True
protobuf_field: scale
---
Adjusts the width of a trail mesh as a multiplier to the default width.

Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/schedule/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Schedule
type: String
applies_to: [Icon, Trail]
xml_fields: [Schedule]
exclude_from_protobuf: True
protobuf_field: bhdraft__schedule
---
A description of when to hide or show an object based on a realtime schedule.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/schedule/schedule_duration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Schedule Duration
type: Float32
applies_to: [Icon, Trail]
xml_fields: [ScheduleDuration]
exclude_from_protobuf: True
protobuf_field: bhdraft__schedule_duration
---
Combined with Schedule to determine how long after the object is shown before it is hidden again.
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/size_on_screen/maximum_size_on_screen.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Int32
applies_to: [Icon]
xml_fields: [MaxSize]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #maximum_size_on_screen
exclude_from_protobuf: True
protobuf_field: maximum_size_on_screen
---
The largest width/height of this icon on the screen.
Notes
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/size_on_screen/minimum_size_on_screen.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Int32
applies_to: [Icon]
xml_fields: [MinSize]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #minimum_size_on_screen
exclude_from_protobuf: True
protobuf_field: minimum_size_on_screen
---
The smallest width/height of this icon on the screen.

Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/texture/animation_speed.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Float32
applies_to: [Trail]
xml_fields: ["AnimSpeed", "AnimationSpeed"]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #animation_speed
exclude_from_protobuf: True
protobuf_field: animation_speed
---
The speed which the texture should be moving across the object.

Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/tooltip/tooltip_description.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Tooltip Description
type: String
applies_to: [Icon, Category]
xml_fields: [TipDescription]
exclude_from_protobuf: True
protobuf_field: tip_description
---
The full text of the tooltip.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/tooltip/tooltip_name.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Tooltip Name
type: String
applies_to: [Icon]
xml_fields: [TipName]
exclude_from_protobuf: True
protobuf_field: tip_name
---
The name of the tooltip when hovering over the minimap.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/auto_trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Auto Trigger
type: Boolean
applies_to: [Icon]
xml_fields: [AutoTrigger]
exclude_from_protobuf: True
protobuf_field: trigger.auto_trigger
---
Any triggers will be triggered automatially when the player enters within range instead of being triggered.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/bounce_delay.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Bounce Delay
type: Float32
applies_to: [Icon]
xml_fields: [BounceDelay]
exclude_from_protobuf: True
protobuf_field: trigger.bounce_delay
---
How many seconds should pass before the bouncing begins.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/bounce_duration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Bounce Duration
type: Float32
applies_to: [Icon]
xml_fields: [BounceDuration]
exclude_from_protobuf: True
protobuf_field: trigger.bounce_duration
---
How long should the icon bounce for when triggered.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/bounce_height.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Bounce Height
type: Float32
applies_to: [Icon]
xml_fields: [BounceHeight]
exclude_from_protobuf: True
protobuf_field: trigger.bounce_height
---
How high should the icon bounce when triggered.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/copy_clipboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Copy Clipboard
type: String
applies_to: [Icon]
xml_fields: [Copy, CopyClipboard]
exclude_from_protobuf: True
protobuf_field: trigger.action_copy_clipboard
---
A value that is copied to the clipboard when triggered.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/copy_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Copy Message
type: String
applies_to: [Icon]
xml_fields: [CopyMessage]
exclude_from_protobuf: True
protobuf_field: trigger.action_copy_message
---
A message that is displayed to the user when an item is copied to the clipboard.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/has_countdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Has Countdown
type: Boolean
xml_fields: ["HasCountdown"]
applies_to: ["Icon"]
exclude_from_protobuf: True
protobuf_field: trigger.has_countdown
---
?
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/hide_category.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type: Custom
class: MarkerCategory
applies_to: [Icon]
xml_fields: [Hide]
exclude_from_protobuf: True
protobuf_field: trigger.action_hide_category
---
Hide the specified category when triggered.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/info_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Info Message
type: String
applies_to: [Icon]
xml_fields: [Info]
exclude_from_protobuf: True
protobuf_field: trigger.action_info_message
---
Show a message to the user when triggered
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/invert_visibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Invert Visibility
type: Boolean
applies_to: [Icon]
xml_fields: [InvertBehavior]
exclude_from_protobuf: True
protobuf_field: trigger.invert_display
---
Inverts the hide show behavior so that it is shown when it is supposed to be hidden and hidden when it is supposed to be shown.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/reset_behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Reset Behavior
type: Enum
applies_to: [Icon]
xml_fields: [Behavior]
exclude_from_protobuf: True
protobuf_field: trigger.reset_behavior
values:
always_visible: ["0", "always_visible"]
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/reset_length.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Reset Length
type: Float32
applies_to: [Icon]
xml_fields: [ResetLength]
exclude_from_protobuf: True
protobuf_field: trigger.reset_length
---
When using behavior 4 (reappear after timer) this value defines, in seconds, the duration until the marker is reset after being activated.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/show_category.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type: Custom
class: MarkerCategory
applies_to: [Icon]
xml_fields: [Show]
exclude_from_protobuf: True
protobuf_field: trigger.action_show_category
---
Show the specified category when triggered.
Expand Down
1 change: 1 addition & 0 deletions xml_converter/doc/trigger/toggle_category.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type: Custom
class: MarkerCategory
applies_to: [Icon]
xml_fields: [Toggle, ToggleCategory]
exclude_from_protobuf: True
protobuf_field: trigger.action_toggle_category
---
Show if hidden or Hide if shown the specified category when triggered.
Expand Down
3 changes: 2 additions & 1 deletion xml_converter/doc/trigger/trigger_range.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: Float32
applies_to: [Icon]
xml_fields: [TriggerRange, InfoRange]
#151 This field should be set to 0 in the protobuf when equal to the default value
protobuf_field: null #trigger.range
exclude_from_protobuf: True
protobuf_field: trigger.range
---

Used to indicate a trigger range. This attribute is used by multiple other attributes to define a distance from the marker in which those attributes will activate their functionality or behavior.
Expand Down
32 changes: 17 additions & 15 deletions xml_converter/generators/cpp_templates/attribute_template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,23 @@ std::string {{attribute_name}}_to_xml_attribute(
const std::string& attribute_name,
XMLWriterState* state,
const {{class_name}}* value);
{% if exclude_from_protobuf == false %}

void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState* state,
{{class_name}}* value,
bool* is_set);
void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState* state,
{{class_name}}* value,
bool* is_set);

{% if type == "Enum" %}
void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState* state,
std::function<void({{proto_field_cpp_type}})> setter);
{% else %}
void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState* state,
std::function<void({{proto_field_cpp_type}}*)> setter);
{% if type == "Enum" %}
void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState* state,
std::function<void({{proto_field_cpp_type}})> setter);
{% else %}
void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState* state,
std::function<void({{proto_field_cpp_type}}*)> setter);
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void xml_attribute_to_{{attribute_name}}(
return " " + attribute_name + "=\"" + output + "\"";
}
{% endif %}
{% if exclude_from_protobuf == false %}

void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
Expand Down Expand Up @@ -79,3 +80,4 @@ void {{attribute_name}}_to_proto(
{% endfor %}
setter(proto_{{attribute_name}});
}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ string {{attribute_name}}_to_xml_attribute(
return " " + attribute_name + "=\"" + "{{class_name}}::{{attribute_components[0].xml_fields[0]}}" + "\"";
}
}
{% if exclude_from_protobuf == false %}

void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
Expand Down Expand Up @@ -95,3 +96,4 @@ void {{attribute_name}}_to_proto(
break;
}
}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ string {{attribute_name}}_to_xml_attribute(
string output = join(flag_values, ",");
return " " + attribute_name + "=\"" + output + "\"";
}
{% if exclude_from_protobuf == false %}

void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
Expand Down Expand Up @@ -90,3 +91,4 @@ void {{attribute_name}}_to_proto(
setter(proto_{{attribute_name}});
}
}
{% endif %}
12 changes: 10 additions & 2 deletions xml_converter/generators/cpp_templates/class_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,18 @@ vector<string> {{cpp_class}}::as_xml(XMLWriterState* state) const {
return xml_node_contents;
}

// The following attributes are not yet supported in Burrito
// and are not written to or read from the protobuf file:
{% for attribute_variable in attribute_variables %}
{% if attribute_variable.exclude_from_protobuf == true %}
// {{attribute_variable.attribute_name}}
{% endif %}
{% endfor %}

guildpoint::{{cpp_class}} {{cpp_class}}::as_protobuf(ProtoWriterState* state) const {
guildpoint::{{cpp_class}} proto_{{cpp_class_header}};
{% for attribute_variable in attribute_variables %}
{% if attribute_variable.is_component == false and attribute_variable.proto_info != None %}
{% if attribute_variable.is_component == false and attribute_variable.proto_info != None and attribute_variable.exclude_from_protobuf == false %}
if (this->{{attribute_variable.attribute_flag_name}}) {
{% if not attribute_variable.proto_info.is_proto_field_scalar %}
std::function<void({{attribute_variable.proto_info.protobuf_cpp_type}}*)> setter = [&proto_{{cpp_class_header}}]({{attribute_variable.proto_info.protobuf_cpp_type}}* val) { proto_{{cpp_class_header}}.{{attribute_variable.proto_info.mutable_proto_drilldown_calls}}set_allocated_{{attribute_variable.proto_info.protobuf_field}}(val); };
Expand All @@ -119,7 +127,7 @@ guildpoint::{{cpp_class}} {{cpp_class}}::as_protobuf(ProtoWriterState* state) co

void {{cpp_class}}::parse_protobuf(guildpoint::{{cpp_class}} proto_{{cpp_class_header}}, ProtoReaderState* state) {
{% for attribute_variable in attribute_variables %}
{% if attribute_variable.is_component == false and attribute_variable.proto_info != None %}
{% if attribute_variable.is_component == false and attribute_variable.proto_info != None and attribute_variable.exclude_from_protobuf == false %}
{% if not attribute_variable.proto_info.is_proto_field_scalar %}
if (proto_{{cpp_class_header}}{{attribute_variable.proto_info.proto_drilldown_calls}}.has_{{attribute_variable.proto_info.protobuf_field}}()) {
{% elif attribute_variable.proto_info.protobuf_cpp_type == "std::string" %}
Expand Down
Loading

0 comments on commit 027ce83

Please sign in to comment.