From bcbb1590df3481f222871e80b73d692bbb4a5747 Mon Sep 17 00:00:00 2001 From: Ailtop <40078161+Ailtop@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:53:50 +0800 Subject: [PATCH 1/4] Fix rendering order error --- Assets/Scripts/Core/NGraphics.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/NGraphics.cs b/Assets/Scripts/Core/NGraphics.cs index 8ab26f82..bd193509 100644 --- a/Assets/Scripts/Core/NGraphics.cs +++ b/Assets/Scripts/Core/NGraphics.cs @@ -383,13 +383,13 @@ public int renderingOrder public void SetRenderingOrder(UpdateContext context, bool inBatch) { - meshRenderer.sortingOrder = context.renderingOrder++; + meshRenderer.sortingOrder = ++context.renderingOrder; if (subInstances != null && !inBatch) { foreach (var sub in subInstances) { - sub.meshRenderer.sortingOrder = context.renderingOrder++; + sub.meshRenderer.sortingOrder = ++context.renderingOrder; } } } From 77ff2efca1da047d2e7e9501b9d6be8d81968ad8 Mon Sep 17 00:00:00 2001 From: Ailtop <40078161+Ailtop@users.noreply.github.com> Date: Fri, 26 Jul 2024 18:10:42 +0800 Subject: [PATCH 2/4] Fix skew not working in TMPRO --- Assets/Scripts/Core/NGraphics.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Core/NGraphics.cs b/Assets/Scripts/Core/NGraphics.cs index bd193509..45b3d37e 100644 --- a/Assets/Scripts/Core/NGraphics.cs +++ b/Assets/Scripts/Core/NGraphics.cs @@ -471,6 +471,12 @@ public VertexMatrix vertexMatrix { _vertexMatrix = value; _meshDirty = true; + + if (subInstances != null) + { + foreach (var sub in subInstances) + sub._vertexMatrix = value; + } } } @@ -835,7 +841,9 @@ public NGraphics CreateSubInstance(string name) newGameObject.transform.SetParent(gameObject.transform, false); newGameObject.layer = gameObject.layer; newGameObject.hideFlags = gameObject.hideFlags; - return new NGraphics(newGameObject); + var newGraphics = new NGraphics(newGameObject); + newGraphics._vertexMatrix = _vertexMatrix; + return newGraphics; } class StencilEraser From 75c72c95618cd8c8a7fea91a16a659566642a05a Mon Sep 17 00:00:00 2001 From: liujunming Date: Wed, 31 Jul 2024 17:50:35 +0800 Subject: [PATCH 3/4] Fix rendering order error --- Assets/Scripts/Core/GoWrapper.cs | 1 + Assets/Scripts/Core/NGraphics.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/GoWrapper.cs b/Assets/Scripts/Core/GoWrapper.cs index 2427c665..c475aaec 100644 --- a/Assets/Scripts/Core/GoWrapper.cs +++ b/Assets/Scripts/Core/GoWrapper.cs @@ -280,6 +280,7 @@ public override void SetRenderingOrder(UpdateContext context, bool inBatch) } } } + context.renderingOrder++; } public override BatchElement AddToBatch(List batchElements, bool force) diff --git a/Assets/Scripts/Core/NGraphics.cs b/Assets/Scripts/Core/NGraphics.cs index 45b3d37e..3ffd8ffd 100644 --- a/Assets/Scripts/Core/NGraphics.cs +++ b/Assets/Scripts/Core/NGraphics.cs @@ -383,13 +383,13 @@ public int renderingOrder public void SetRenderingOrder(UpdateContext context, bool inBatch) { - meshRenderer.sortingOrder = ++context.renderingOrder; + meshRenderer.sortingOrder = context.renderingOrder++; if (subInstances != null && !inBatch) { foreach (var sub in subInstances) { - sub.meshRenderer.sortingOrder = ++context.renderingOrder; + sub.meshRenderer.sortingOrder = context.renderingOrder++; } } } From 7f3c3be6d8f5ce83fad81394f5a2973354fee919 Mon Sep 17 00:00:00 2001 From: liujunming Date: Fri, 2 Aug 2024 10:33:28 +0800 Subject: [PATCH 4/4] Fix the filter not working in TMPRO --- Assets/Scripts/Core/CaptureCamera.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/CaptureCamera.cs b/Assets/Scripts/Core/CaptureCamera.cs index 5dde31d5..6ce717ac 100644 --- a/Assets/Scripts/Core/CaptureCamera.cs +++ b/Assets/Scripts/Core/CaptureCamera.cs @@ -180,7 +180,7 @@ public static void Capture(DisplayObject target, RenderTexture texture, float co if (target.graphics != null) { oldLayer = target.graphics.gameObject.layer; - target.graphics.gameObject.layer = CaptureCamera.layer; + target._SetLayerDirect(CaptureCamera.layer); } if (target is Container) @@ -196,7 +196,7 @@ public static void Capture(DisplayObject target, RenderTexture texture, float co RenderTexture.active = old; if (target.graphics != null) - target.graphics.gameObject.layer = oldLayer; + target._SetLayerDirect(oldLayer); if (target is Container) ((Container)target).SetChildrenLayer(oldLayer);