feat(ShaderBake): 预览图上画分格线与每格 UV 编号

加行/加列之后只看图分不清哪一片对应哪段 UV,只能靠点选一格再看右侧。
现在多格时图上会贴一层白色半透明分格线,每格左上角写 U?/V?,
白字垫在半透明黑底上,浅色结果图上也能读。

线和编号都按百分比定位,缩放与滚动不重算;线只随行列数重建、编号按格数复用,
实时预览每秒重画几十次也不会反复增删节点。只有一格时不画——这时右侧已经写着 UV。
编号所在格在屏幕上不足一个编号宽时自动不显示,避免 16×16 那种网格糊成一片。
This commit is contained in:
2026-11-06 18:39:12 +08:00
parent a0297c2652
commit 92aed8e64b
4 changed files with 213 additions and 7 deletions
+29 -2
View File
@@ -96,12 +96,39 @@
opacity: 0.9;
}
/* 分格线浮在图上:1px 白线 + 每格一个 UV 编号,都用百分比定位,缩放/滚动不用重排 */
.grid-overlay {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: none;
/* 贴边的编号宁可被裁掉,也不该糊到图上之外 */
overflow: hidden;
}
.grid-line {
position: absolute;
background-color: rgba(255, 255, 255, 0.38);
}
.grid-cell-label {
position: absolute;
font-size: 10px;
/* 白字压在半透明黑底上:浅色贴图上白字会糊掉,垫一层才读得出来 */
color: rgba(255, 255, 255, 0.88);
background-color: rgba(0, 0, 0, 0.38);
padding: 0 4px;
border-radius: 2px;
-unity-text-align: middle-left;
}
.preview-readout {
position: absolute;
left: 8px;
bottom: 8px;
font-size: 11px;
color: rgb(220, 220, 220);
font-size: 11px; color: rgb(220, 220, 220);
background-color: rgba(0, 0, 0, 0.45);
padding: 1px 6px;
border-radius: 3px;