From cdf962a7d2d246e285621480820d8c01de69b03a Mon Sep 17 00:00:00 2001 From: duckietm Date: Fri, 5 Jun 2026 17:21:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Small=20fixing=20alphablend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bootstrap.ts | 2 + src/common/layout/LayoutRoomPreviewerView.tsx | 32 +++-- .../page/layout/pets/CatalogLayoutPetView.tsx | 2 +- src/css/catalog/CatalogClassicView.css | 124 +++++------------- src/pixiPatch.ts | 83 ++++++++++++ 5 files changed, 135 insertions(+), 108 deletions(-) create mode 100644 src/pixiPatch.ts diff --git a/src/bootstrap.ts b/src/bootstrap.ts index 82a8f70..c0e86da 100644 --- a/src/bootstrap.ts +++ b/src/bootstrap.ts @@ -1,3 +1,5 @@ +import './pixiPatch'; + import { GetConfiguration } from '@nitrots/nitro-renderer'; import JSON5 from 'json5'; import { configFileUrl, getClientMode, installSecureFetch } from './secure-assets'; diff --git a/src/common/layout/LayoutRoomPreviewerView.tsx b/src/common/layout/LayoutRoomPreviewerView.tsx index 30deb10..bee10e8 100644 --- a/src/common/layout/LayoutRoomPreviewerView.tsx +++ b/src/common/layout/LayoutRoomPreviewerView.tsx @@ -8,13 +8,8 @@ export const LayoutRoomPreviewerView: FC<{ { const { roomPreviewer = null, height = 0 } = props; const elementRef = useRef(null); - // Latch that disables further renders once Pixi throws inside this - // previewer. The crash (e.g. blackhole furni's filter chain that - // accesses .alphaMode on a null texture) repeats every animation - // frame as long as the ticker keeps firing, flooding the console - // and locking the catalog. One catch and we stop trying for the - // lifetime of this previewer instance. - const renderFailedRef = useRef(false); + const renderFailuresRef = useRef(0); + const MAX_RENDER_FAILURES = 6; const onClick = (event: MouseEvent) => { @@ -28,14 +23,24 @@ export const LayoutRoomPreviewerView: FC<{ { if(!elementRef) return; - renderFailedRef.current = false; + renderFailuresRef.current = 0; const width = elementRef.current.parentElement.clientWidth; const texture = TextureUtils.createRenderTexture(width, height); + const noteFailure = (label: string, error: unknown) => + { + renderFailuresRef.current += 1; + + if(renderFailuresRef.current >= MAX_RENDER_FAILURES) + { + NitroLogger.error(`LayoutRoomPreviewerView ${ label } failed ${ renderFailuresRef.current } times; disabling further renders for this preview`, error); + } + }; + const paintToDOM = () => { - if(renderFailedRef.current) return; + if(renderFailuresRef.current >= MAX_RENDER_FAILURES) return; if(!roomPreviewer || !elementRef.current) return; const renderingCanvas = roomPreviewer.getRenderingCanvas(); @@ -57,17 +62,17 @@ export const LayoutRoomPreviewerView: FC<{ canvas.height = 0; elementRef.current.style.backgroundImage = `url(${ base64 })`; + renderFailuresRef.current = 0; } catch(error) { - renderFailedRef.current = true; - NitroLogger.error('LayoutRoomPreviewerView paint failed; disabling further renders for this preview', error); + noteFailure('paint', error); } }; const update = (ticker: NitroTicker) => { - if(renderFailedRef.current) return; + if(renderFailuresRef.current >= MAX_RENDER_FAILURES) return; if(!roomPreviewer || !elementRef.current) return; try @@ -76,8 +81,7 @@ export const LayoutRoomPreviewerView: FC<{ } catch(error) { - renderFailedRef.current = true; - NitroLogger.error('LayoutRoomPreviewerView update failed; disabling further renders for this preview', error); + noteFailure('update', error); return; } diff --git a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx index 3eba176..2c7d147 100644 --- a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx +++ b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx @@ -291,7 +291,7 @@ export const CatalogLayoutPetView: FC = props => { LocalizeText('catalog.pets.back.breeds') } } -
+
{ !colorsShowing && (sellablePalettes.length > 0) && sellablePalettes.map((palette, index) => (