Backdrop pieces are nine Texture regions on the frame, as in 1.12.1 (#905)
A backdrop was data drawn in the frame's own slot, so `GetRegions` and `GetNumRegions` never saw its pieces, and addons that skin by walking a frame's regions missed them. In the reference, installing a backdrop creates nine Texture regions on the frame: the background on BACKGROUND, then eight border pieces on BORDER, linked into its region list in that order. A resize re-runs their texcoords and colours, and the colour setters tint the background or the border alone. The pieces are now real regions, drawn through the region path, so edges draw over another frame's BACKGROUND at the same level. `<Layers>` and `<Backdrop>` load in document order. A region leaving its parent empties any Button, CheckButton, StatusBar, Slider or ColorSelect slot holding it, and a dead layout node now seeds only its dependents. Tests pin the order, colours, resize, teardown and stock quads. Fixes #883 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9be2802f39
commit
4e0011bdd7
@@ -97,7 +97,6 @@ fn content_kind(c: &QuadContent) -> &'static str {
|
||||
QuadContent::Texture { .. } => "texture",
|
||||
QuadContent::ColorWheel => "colorwheel",
|
||||
QuadContent::ColorValue { .. } => "colorvalue",
|
||||
QuadContent::Backdrop { .. } => "backdrop",
|
||||
QuadContent::Text { .. } => "text",
|
||||
}
|
||||
}
|
||||
@@ -280,7 +279,6 @@ fn span_bounds(spans: &[u32], i: usize) -> (usize, usize) {
|
||||
fn splice_simple(eq: &benilla_ui::script::ExtractedQuad) -> bool {
|
||||
match &eq.content {
|
||||
QuadContent::Frame
|
||||
| QuadContent::Backdrop { .. }
|
||||
// At most one quad and one idempotent tile request.
|
||||
| QuadContent::ModelPane { .. }
|
||||
| QuadContent::ColorWheel
|
||||
@@ -1404,44 +1402,6 @@ fn convert_entry(
|
||||
..default()
|
||||
});
|
||||
}
|
||||
QuadContent::Backdrop {
|
||||
path,
|
||||
color,
|
||||
uvs,
|
||||
tile,
|
||||
} => {
|
||||
// A backdrop piece, the bg or one of the 8 border pieces, sampled `Repeat` when `tile`;
|
||||
// its UVs are per-corner, as the TOP and BOTTOM edges are rotated.
|
||||
let handle = assets.as_mut().and_then(|a| {
|
||||
if tile {
|
||||
a.sprite_texture_tiled(&path, images)
|
||||
} else {
|
||||
a.sprite_texture(&path, images)
|
||||
}
|
||||
});
|
||||
// A missing BLP draws nothing.
|
||||
let Some(handle) = handle else { return };
|
||||
// The 8 border pieces share one atlas, so a `tile` piece is pulled half a texel in on
|
||||
// its bounded axes; a stretched bg is a whole texture.
|
||||
let uvs = match images.get(&handle) {
|
||||
Some(img) if tile => {
|
||||
let sz = img.texture_descriptor.size;
|
||||
benilla_ui::script::inset_atlas_bleed(uvs, sz.width as f32, sz.height as f32)
|
||||
}
|
||||
_ => uvs,
|
||||
};
|
||||
let mut color = color;
|
||||
color[3] *= eq.alpha;
|
||||
out.push(UiQuad {
|
||||
rect,
|
||||
z_key: eq.z,
|
||||
texture: Some(handle),
|
||||
uv: UvRect::from_corners(uvs),
|
||||
color,
|
||||
clip,
|
||||
..default()
|
||||
});
|
||||
}
|
||||
QuadContent::Text {
|
||||
text,
|
||||
color,
|
||||
|
||||
@@ -311,7 +311,7 @@ fn the_ground_dim_draws_over_the_tile_and_clear_of_the_rope() {
|
||||
let ground = quads
|
||||
.iter()
|
||||
.position(|q| match &q.content {
|
||||
QuadContent::Backdrop { path, .. } => path.contains("UI-DialogBox-Background"),
|
||||
QuadContent::Texture { path: Some(p), .. } => p.contains("UI-DialogBox-Background"),
|
||||
_ => false,
|
||||
})
|
||||
.expect("the window still wears the 1.14 dialog ground");
|
||||
|
||||
@@ -1262,7 +1262,7 @@ fn popup_children_inherit_the_dialog_stratum() {
|
||||
let backdrop_z = quads
|
||||
.iter()
|
||||
.find_map(|q| match &q.content {
|
||||
QuadContent::Backdrop { path, .. } if path.contains("UI-DialogBox-Background") => {
|
||||
QuadContent::Texture { path: Some(p), .. } if p.contains("UI-DialogBox-Background") => {
|
||||
Some(q.z)
|
||||
}
|
||||
_ => None,
|
||||
|
||||
@@ -41,8 +41,7 @@ fn answer_measures(s: &mut UiScript) {
|
||||
s.set_measured_text_unwrapped(&answers);
|
||||
}
|
||||
|
||||
/// Every texture path drawn: `<Texture>` regions and the `<Backdrop>` plate, which is its own
|
||||
/// quad kind (`QuadContent::Backdrop`).
|
||||
/// Every texture path drawn: `<Texture>` regions, the `<Backdrop>` plate's nine pieces among them.
|
||||
fn drawn_textures(s: &mut UiScript) -> Vec<String> {
|
||||
s.resolve();
|
||||
answer_measures(s);
|
||||
@@ -51,7 +50,6 @@ fn drawn_textures(s: &mut UiScript) -> Vec<String> {
|
||||
.into_iter()
|
||||
.filter_map(|q| match q.content {
|
||||
benilla_ui::script::QuadContent::Texture { path: Some(p), .. } => Some(p),
|
||||
benilla_ui::script::QuadContent::Backdrop { path, .. } => Some(path),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
|
||||
Reference in New Issue
Block a user