diff options
| author | Cosmic Linden <cosmic@lindenlab.com> | 2023-07-31 16:30:50 -0700 | 
|---|---|---|
| committer | Cosmic Linden <cosmic@lindenlab.com> | 2023-08-11 16:31:00 -0700 | 
| commit | 27842d0c5f34b03f6ce16ebbff0e7cb39d3a4fd8 (patch) | |
| tree | 769546b923b853335f951957c2d7c94c2d5cab04 /indra | |
| parent | a5d318567cc5c3e8f2f86fce1132f5883014e14e (diff) | |
SL-20024: Fix material edit/save buttons on build floater sometimes not re-enabling after object inventory load
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llpanelface.cpp | 18 | 
1 files changed, 14 insertions, 4 deletions
| diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 90271b75b2..790c693a3d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1841,6 +1841,7 @@ class PBRPickerItemListener : public LLVOInventoryListener  {  protected:      LLViewerObject* mObjectp; +    bool mChangePending = true;  public:      PBRPickerItemListener(LLViewerObject* object) @@ -1849,7 +1850,10 @@ public:          registerVOInventoryListener(mObjectp, nullptr);      } -    const LLViewerObject* const getObject() { return mObjectp; } +    const bool isListeningFor(const LLViewerObject* objectp) const +    { +        return mChangePending && (objectp == mObjectp); +    }      void inventoryChanged(LLViewerObject* object,          LLInventoryObject::object_list_t* inventory, @@ -1861,11 +1865,13 @@ public:              gFloaterTools->dirty();          }          removeVOInventoryListener(); +        mChangePending = false;      }      ~PBRPickerItemListener()      {          removeVOInventoryListener(); +        mChangePending = false;      }  }; @@ -1893,12 +1899,16 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,      const bool inventory_pending = objectp->isInventoryPending();      getChildView("pbr_from_inventory")->setEnabled(settable); +    // TODO: Put message on these two buttons when material permissions are still loading      getChildView("edit_selected_pbr")->setEnabled(editable && !inventory_pending && !has_faces_without_pbr);      getChildView("save_selected_pbr")->setEnabled(saveable && !inventory_pending && identical_pbr); -    // TODO: Vet inventory updates and memory management -    if (inventory_pending && (!mInventoryListener || mInventoryListener->getObject() != objectp)) +    if (inventory_pending)      { -        mInventoryListener = std::make_unique<PBRPickerItemListener>(objectp); +        // Reuse the same listener when possible +        if (!mInventoryListener || !mInventoryListener->isListeningFor(objectp)) +        { +            mInventoryListener = std::make_unique<PBRPickerItemListener>(objectp); +        }      }      else      { | 
