Skip to content

Commit

Permalink
[#73] Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Orchaldir committed Nov 5, 2023
1 parent eab45ef commit 388ff2b
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 95 deletions.
25 changes: 12 additions & 13 deletions resources/characters/characters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,18 @@
color: Black
outerwear:
type: Coat
style:
sleeve: Long
length: Knee
neckline: DeepV
closing:
type: SingleBreasted
buttons:
button:
size: Medium
color: Silver
count: 5
color: White
belt: null
sleeve: Long
length: Knee
neckline: DeepV
closing:
type: SingleBreasted
buttons:
button:
size: Medium
color: Silver
count: 5
color: White
belt: null
head:
ears:
type: None
Expand Down
127 changes: 61 additions & 66 deletions resources/templates/appearance_edit.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -575,94 +575,89 @@
</li>
{% elif appearance.body.clothing.outerwear.type == "Coat" %}
<li>
<b>Style</b>
<b>Sleeve:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.sleeve", options=[ "Long","None","Short" ], selected=appearance.body.clothing.outerwear.sleeve, update=true) }}
</li>
<li>
<b>Length:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.length", options=[ "Hip","Knee","Ankle" ], selected=appearance.body.clothing.outerwear.length, update=true) }}
</li>
<li>
<b>Neckline:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.neckline", options=[ "Boat","Crew","DeepV","None","Scoop","V","VeryDeepV" ], selected=appearance.body.clothing.outerwear.neckline, update=true) }}
</li>
<li>
<b>Closing:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.closing.type", options=[ "None","SingleBreasted","DoubleBreasted","Zipper" ], selected=appearance.body.clothing.outerwear.closing.type, update=true) }}
<ul>
<li>
<b>Sleeve:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.sleeve", options=[ "Long","None","Short" ], selected=appearance.body.clothing.outerwear.style.sleeve, update=true) }}
</li>
<li>
<b>Length:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.length", options=[ "Hip","Knee","Ankle" ], selected=appearance.body.clothing.outerwear.style.length, update=true) }}
</li>
<li>
<b>Neckline:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.neckline", options=[ "Boat","Crew","DeepV","None","Scoop","V","VeryDeepV" ], selected=appearance.body.clothing.outerwear.style.neckline, update=true) }}
</li>
<li>
<b>Closing:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.closing.type", options=[ "None","SingleBreasted","DoubleBreasted","Zipper" ], selected=appearance.body.clothing.outerwear.style.closing.type, update=true) }}
<ul>
{% if appearance.body.clothing.outerwear.style.closing.type == "None" %}
{% elif appearance.body.clothing.outerwear.style.closing.type == "SingleBreasted" %}
{% if appearance.body.clothing.outerwear.closing.type == "None" %}
{% elif appearance.body.clothing.outerwear.closing.type == "SingleBreasted" %}
<li>
<b>Buttons</b>
<ul>
<li>
<b>Buttons</b>
<b>Button</b>
<ul>
<li>
<b>Button</b>
<ul>
<li>
<b>Size:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.closing.buttons.button.size", options=[ "Small","Medium","Large" ], selected=appearance.body.clothing.outerwear.style.closing.buttons.button.size, update=true) }}
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.closing.buttons.button.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.style.closing.buttons.button.color, update=true) }}
</li>
</ul>
<b>Size:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.closing.buttons.button.size", options=[ "Small","Medium","Large" ], selected=appearance.body.clothing.outerwear.closing.buttons.button.size, update=true) }}
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.closing.buttons.button.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.closing.buttons.button.color, update=true) }}
</li>
<li><b>Count:</b> <input type="number" step="1" id="appearance.body.clothing.outerwear.style.closing.buttons.count" name="appearance.body.clothing.outerwear.style.closing.buttons.count" value="{{ appearance.body.clothing.outerwear.style.closing.buttons.count }}" onchange="updateAppearancePreview();"></li>
</ul>
</li>
{% elif appearance.body.clothing.outerwear.style.closing.type == "DoubleBreasted" %}
<li><b>Count:</b> <input type="number" step="1" id="appearance.body.clothing.outerwear.closing.buttons.count" name="appearance.body.clothing.outerwear.closing.buttons.count" value="{{ appearance.body.clothing.outerwear.closing.buttons.count }}" onchange="updateAppearancePreview();"></li>
</ul>
</li>
{% elif appearance.body.clothing.outerwear.closing.type == "DoubleBreasted" %}
<li>
<b>Buttons</b>
<ul>
<li>
<b>Buttons</b>
<b>Button</b>
<ul>
<li>
<b>Button</b>
<ul>
<li>
<b>Size:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.closing.buttons.button.size", options=[ "Small","Medium","Large" ], selected=appearance.body.clothing.outerwear.style.closing.buttons.button.size, update=true) }}
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.closing.buttons.button.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.style.closing.buttons.button.color, update=true) }}
</li>
</ul>
<b>Size:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.closing.buttons.button.size", options=[ "Small","Medium","Large" ], selected=appearance.body.clothing.outerwear.closing.buttons.button.size, update=true) }}
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.closing.buttons.button.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.closing.buttons.button.color, update=true) }}
</li>
<li><b>Count:</b> <input type="number" step="1" id="appearance.body.clothing.outerwear.style.closing.buttons.count" name="appearance.body.clothing.outerwear.style.closing.buttons.count" value="{{ appearance.body.clothing.outerwear.style.closing.buttons.count }}" onchange="updateAppearancePreview();"></li>
</ul>
</li>
{% elif appearance.body.clothing.outerwear.style.closing.type == "Zipper" %}
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.closing.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.style.closing.color, update=true) }}
</li>
{% endif %}
</ul>
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.style.color, update=true) }}
</li>
<li>
{% if appearance.body.clothing.outerwear.style.belt %}
<b>Belt Availability:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.belt.availability", options=[ "true","false" ], selected="true", update=true) }}
</li>
<li><b>Count:</b> <input type="number" step="1" id="appearance.body.clothing.outerwear.closing.buttons.count" name="appearance.body.clothing.outerwear.closing.buttons.count" value="{{ appearance.body.clothing.outerwear.closing.buttons.count }}" onchange="updateAppearancePreview();"></li>
</ul>
</li>
{% elif appearance.body.clothing.outerwear.closing.type == "Zipper" %}
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.closing.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.closing.color, update=true) }}
</li>
{% endif %}
</ul>
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.color, update=true) }}
</li>
<li>
{% if appearance.body.clothing.outerwear.belt %}
<b>Belt Availability:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.belt.availability", options=[ "true","false" ], selected="true", update=true) }}
</li>
<li>
<b>Belt</b>
<ul>
<li>
<b>Belt</b>
<b>Buckle</b>
<ul>
<li>
<b>Buckle</b>
<ul>
<li>
<b>Style:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.belt.buckle.style", options=[ "Box","Circle","Frame","Plate" ], selected=appearance.body.clothing.outerwear.style.belt.buckle.style, update=true) }}
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.belt.buckle.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.style.belt.buckle.color, update=true) }}
</li>
</ul>
<b>Style:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.belt.buckle.style", options=[ "Box","Circle","Frame","Plate" ], selected=appearance.body.clothing.outerwear.belt.buckle.style, update=true) }}
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.belt.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.style.belt.color, update=true) }}
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.belt.buckle.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.belt.buckle.color, update=true) }}
</li>
</ul>
{% else %}
<b>Belt Availability:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.style.belt.availability", options=[ "true","false" ], selected="false", update=true) }}
{% endif %}
</li>
<li>
<b>Color:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.belt.color", options=[ "Aqua","Black","Blue","Fuchsia","Gray","Green","Lime","Maroon","Navy","Olive","Orange","Purple","Red","SaddleBrown","Silver","Teal","White","Yellow" ], selected=appearance.body.clothing.outerwear.belt.color, update=true) }}
</li>
</ul>
{% else %}
<b>Belt Availability:</b> {{ macros::add_select(name="appearance.body.clothing.outerwear.belt.availability", options=[ "true","false" ], selected="false", update=true) }}
{% endif %}
</li>
{% endif %}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ pub enum Outerwear {
#[default]
None,
Cloak(Cloak),
Coat {
style: Coat,
},
Coat(Coat),
}

/// How long is the [`outerwear`](Outerwear)?
Expand Down
2 changes: 1 addition & 1 deletion rpg_tools_rendering/examples/coats_length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn create_appearance(height: Length, coat: &Coat, shape: &BodyShape) -> Appearan
footwear: Default::default(),
pants: Default::default(),
shirt: Default::default(),
outerwear: Outerwear::Coat { style: *coat },
outerwear: Outerwear::Coat(*coat),
},
},
Default::default(),
Expand Down
19 changes: 9 additions & 10 deletions rpg_tools_rendering/examples/coats_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ fn main() {
}

fn create_appearance(height: Length, neckline: &Neckline, closing: &ClosingOption) -> Appearance {
let coat = Coat {
sleeve: Default::default(),
length: Default::default(),
neckline: *neckline,
closing: *closing,
color: Color::Blue,
belt: None,
};
Appearance::humanoid(
Body {
shape: Default::default(),
Expand All @@ -57,16 +65,7 @@ fn create_appearance(height: Length, neckline: &Neckline, closing: &ClosingOptio
footwear: Default::default(),
pants: Default::default(),
shirt: Default::default(),
outerwear: Outerwear::Coat {
style: Coat {
sleeve: Default::default(),
length: Default::default(),
neckline: *neckline,
closing: *closing,
color: Color::Blue,
belt: None,
},
},
outerwear: Outerwear::Coat(coat),
},
},
Default::default(),
Expand Down
4 changes: 2 additions & 2 deletions rpg_tools_rendering/src/rendering/equipment/outerwear/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pub fn render_outerwear_before_body(
outerwear: &Outerwear,
from_front: bool,
) {
if let Outerwear::Coat { style } = outerwear {
render_coat(renderer, config, aabb, body, style, from_front);
if let Outerwear::Coat(coat) = outerwear {
render_coat(renderer, config, aabb, body, coat, from_front);
}
}

Expand Down

0 comments on commit 388ff2b

Please sign in to comment.