fixes
This commit is contained in:
@@ -48,7 +48,7 @@ namespace Darkmatter.Services.Capture
|
|||||||
|
|
||||||
disabledCanvases = DisableOtherRootCanvases(paperCanvas);
|
disabledCanvases = DisableOtherRootCanvases(paperCanvas);
|
||||||
disabledGraphics = HideNonPaperGraphics(paperRT);
|
disabledGraphics = HideNonPaperGraphics(paperRT);
|
||||||
HidePaperOwnGraphics(paperRT, disabledGraphics);
|
HideBackdropGraphics(paperRT, disabledGraphics);
|
||||||
|
|
||||||
cam.clearFlags = CameraClearFlags.SolidColor;
|
cam.clearFlags = CameraClearFlags.SolidColor;
|
||||||
cam.backgroundColor = new Color(0f, 0f, 0f, 0f);
|
cam.backgroundColor = new Color(0f, 0f, 0f, 0f);
|
||||||
@@ -158,16 +158,27 @@ namespace Darkmatter.Services.Capture
|
|||||||
return disabled;
|
return disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HidePaperOwnGraphics(Transform paper, List<UnityEngine.UI.Graphic> disabled)
|
private static void HideBackdropGraphics(Transform paper, List<UnityEngine.UI.Graphic> disabled)
|
||||||
{
|
{
|
||||||
if (paper == null) return;
|
if (paper == null) return;
|
||||||
var graphics = paper.GetComponents<UnityEngine.UI.Graphic>();
|
|
||||||
foreach (var g in graphics)
|
// Paper root's own graphics (the paper panel itself).
|
||||||
|
foreach (var g in paper.GetComponents<UnityEngine.UI.Graphic>())
|
||||||
{
|
{
|
||||||
if (g == null || !g.enabled) continue;
|
if (g == null || !g.enabled) continue;
|
||||||
g.enabled = false;
|
g.enabled = false;
|
||||||
disabled.Add(g);
|
disabled.Add(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Solid-fill backdrops baked into the drawing: Images with no sprite render as a
|
||||||
|
// plain colored box. Colorable regions always carry a sprite (alpha hit-testing),
|
||||||
|
// so a null sprite means a backdrop, never art.
|
||||||
|
foreach (var img in paper.GetComponentsInChildren<UnityEngine.UI.Image>(includeInactive: false))
|
||||||
|
{
|
||||||
|
if (img == null || !img.enabled || img.sprite != null) continue;
|
||||||
|
img.enabled = false;
|
||||||
|
disabled.Add(img);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Rect ComputeCropRect(GameObject target, int screenW, int screenH)
|
private static Rect ComputeCropRect(GameObject target, int screenW, int screenH)
|
||||||
|
|||||||
Reference in New Issue
Block a user