From b33012088dfa309bc2f94cae1d62bceb827232a0 Mon Sep 17 00:00:00 2001 From: Cosmic Linden <cosmic@lindenlab.com> Date: Tue, 20 Feb 2024 16:10:05 -0800 Subject: [PATCH] secondlife/viewer-issues#72: Clean up material preview when hidden or floater closed --- indra/newview/lltexturectrl.cpp | 15 +++++++++++++++ indra/newview/lltexturectrl.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index cbef3537630..233241e3448 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -531,6 +531,8 @@ void LLFloaterTexturePicker::onClose(bool app_quitting) } stopUsingPipette(); sLastPickerMode = mModeSelector->getValue().asInteger(); + // *NOTE: Vertex buffer for sphere preview is still cached + mGLTFPreview = nullptr; } // virtual @@ -1795,6 +1797,19 @@ void LLTextureCtrl::setFilterPermissionMasks(PermissionMask mask) setDnDFilterPermMask(mask); } +void LLTextureCtrl::onVisibilityChange(BOOL new_visibility) +{ + if (!new_visibility) + { + // *NOTE: Vertex buffer for sphere preview is still cached + mGLTFPreview = nullptr; + } + else + { + llassert(!mGLTFPreview); + } +} + void LLTextureCtrl::setVisible( BOOL visible ) { if( !visible ) diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index aba1df8c9bb..59292d5e162 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -147,6 +147,8 @@ class LLTextureCtrl virtual void setVisible( BOOL visible ); virtual void setEnabled( BOOL enabled ); + void onVisibilityChange(BOOL new_visibility) override; + void setValid(BOOL valid); // LLUICtrl interface -- GitLab