diff options
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r-- | indra/newview/llselectmgr.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 7fabad3c78..796cc8bb5e 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -103,20 +103,12 @@ LLViewerObject* getSelectedParentObject(LLViewerObject *object) ; // Consts // -const F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; -const S32 MAX_SILS_PER_FRAME = 50; -const S32 MAX_OBJECTS_PER_PACKET = 254; +constexpr F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; +constexpr S32 MAX_SILS_PER_FRAME = 50; +constexpr S32 MAX_OBJECTS_PER_PACKET = 254; // For linked sets -const S32 MAX_CHILDREN_PER_TASK = 255; +constexpr S32 MAX_CHILDREN_PER_TASK = 255; -// -// Globals -// - -//bool gDebugSelectMgr = false; - -//bool gHideSelectedObjects = false; -//bool gAllowSelectAvatar = false; bool LLSelectMgr::sRectSelectInclusive = true; bool LLSelectMgr::sRenderHiddenSelections = true; @@ -2259,13 +2251,14 @@ void LLSelectMgr::selectionRevertGLTFMaterials() // Update material locally objectp->setRenderMaterialID(te, asset_id, false /*wait for LLGLTFMaterialList update*/); - objectp->setTEGLTFMaterialOverride(te, nodep->mSavedGLTFOverrideMaterials[te]); + LLGLTFMaterial* material = new LLGLTFMaterial(*nodep->mSavedGLTFOverrideMaterials[te]); + objectp->setTEGLTFMaterialOverride(te, material); // Enqueue update to server if (asset_id.notNull()) { // Restore overrides and base material - LLGLTFMaterialList::queueApply(objectp, te, asset_id, nodep->mSavedGLTFOverrideMaterials[te]); + LLGLTFMaterialList::queueApply(objectp, te, asset_id, material); } else { @@ -3159,15 +3152,20 @@ void LLSelectMgr::adjustTexturesByScale(bool send_to_sim, bool stretch) material->mTextureTransform[i].mScale.set(scale_x, scale_y); } - LLFetchedGLTFMaterial* render_mat = (LLFetchedGLTFMaterial*)tep->getGLTFRenderMaterial(); - if (render_mat) + const LLGLTFMaterial* base_material = tep->getGLTFMaterial(); + if (base_material) { - render_mat->applyOverride(*material); + LLGLTFMaterial* render_material = new LLFetchedGLTFMaterial(); + *render_material = *base_material; + render_material->applyOverride(*material); + tep->setGLTFRenderMaterial(render_material); } if (send_to_sim) { - LLGLTFMaterialList::queueModify(object, te_num, material); + LLGLTFMaterial new_override; + new_override = *material; + LLGLTFMaterialList::queueModify(object, te_num, &new_override); } } send = send_to_sim; @@ -5965,12 +5963,12 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data LLGLTFMaterial* old_override = node->getObject()->getTE(i)->getGLTFMaterialOverride(); if (old_override) { - LLPointer<LLGLTFMaterial> mat = new LLGLTFMaterial(*old_override); - override_materials.push_back(mat); + // saveGLTFMaterials will make a copy + override_materials.emplace_back(old_override); } else { - override_materials.push_back(nullptr); + override_materials.emplace_back(nullptr); } } // processObjectProperties does not include overrides so this @@ -6882,16 +6880,22 @@ void LLSelectNode::saveGLTFMaterials(const uuid_vec_t& materials, const gltf_mat mSavedGLTFMaterialIds.clear(); mSavedGLTFOverrideMaterials.clear(); - for (uuid_vec_t::const_iterator materials_it = materials.begin(); - materials_it != materials.end(); ++materials_it) + for (const LLUUID& id : materials) { - mSavedGLTFMaterialIds.push_back(*materials_it); + mSavedGLTFMaterialIds.push_back(id); } - for (gltf_materials_vec_t::const_iterator mat_it = override_materials.begin(); - mat_it != override_materials.end(); ++mat_it) + for (const LLPointer<LLGLTFMaterial> &mat : override_materials) { - mSavedGLTFOverrideMaterials.push_back(*mat_it); + if (mat.notNull()) + { + LLGLTFMaterial* copy = new LLGLTFMaterial(*mat); + mSavedGLTFOverrideMaterials.emplace_back(copy); + } + else + { + mSavedGLTFOverrideMaterials.emplace_back(nullptr); + } } } } |