fix: align SDK7 UiBackground nine-slice with Unity behavior#2006
Draft
kuruk-mm wants to merge 2 commits into
Draft
fix: align SDK7 UiBackground nine-slice with Unity behavior#2006kuruk-mm wants to merge 2 commits into
kuruk-mm wants to merge 2 commits into
Conversation
- NINE_SLICES axis stretch: TILE_FIT -> STRETCH so edges and middle match Unity UI Toolkit instead of tiling the source texture - clamp opposing slices (left+right, top+bottom) to 1.0, mirroring Unity DCLImage.AdjustSlices - reorder protobuf UV indices to BL/TL/TR/BR (Unity ToDCLUVs convention) in has_custom_uvs and the axis-aligned region_rect computation - repack the custom-UV shader parameters so the existing dcl_ui_background_uv.gdshader keeps receiving (TL, BL) / (BR, TR) under the new index order
Contributor
📦 Build Report🤖 Android
Build Status: ✅ Success 🍏 iOS
🔗 Workflow Run: View logs 🔄 Updated: 2026-05-09 16:57:20 UTC |
…e-slice-unity-parity
Contributor
🍏 iOS Build Complete✅ Status: Success 🔗 iOS Workflow: View build 📦 Artifacts: godot-mobile-deploy-pipeline 📍 Branch: 🔄 Completed: 2026-05-11 00:41:30 UTC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2060
Summary
Brings the Godot port of
PBUiBackground(component 1053) closer to the Unity explorer'sDCLImagesemantics.The most user-visible change: nine-slice panels (e.g. HUD
panel_v2.pngwithtextureSlices: 0.18) no longer tile their edge strips and inner area — the wood frame edges and cream interior now stretch smoothly, matching Unity UI Toolkit and ending the long-standingTODO: should be TILE or STRETCH?indcl_ui_background.rs.What changed in
lib/src/godot_classes/dcl_ui_background.rsAxisStretchMode::TILE_FIT→STRETCHon both axes. Matches Unity's default sliced rendering.left+right,top+bottom) are clamped to1.0before being applied as patch margins, mirroring Unity'sDCLImage.AdjustSlices().BL=uvs[0..2],TL=uvs[2..4],TR=uvs[4..6],BR=uvs[6..8](Unity'sExtensions.ToDCLUVs). This affects:has_custom_uvs()axis-alignment checkregion_rectcomputation inSTRETCHmode (also fixes a latent bug where the old1.0 - max/minformula could produce a negativeregion_rectheight for valid inputs)dcl_ui_background_uv.gdshader(the shader itself is unchanged; we just feed it(TL, BL)/(BR, TR)from the new index order)What is not changed
Test plan
Panel(uiBackground.textureMode = 'nine-slices',textureSlices: 0.18per side,panel_v2.png) and verify the wood-frame edges no longer show repeating tilesSTRETCHmode (textureMode: 'stretch') with default UVs still renders the full texture