From d2b28f60ff861427bb9581ca65df1a0a8ce02997 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 7 Aug 2019 21:27:53 -0500 Subject: [PATCH] Speed up object param lookups. --- indra/newview/awavefront.cpp | 2 +- indra/newview/daeexport.cpp | 2 +- indra/newview/llhudtext.cpp | 1 + indra/newview/llpanelobject.cpp | 24 ++--- indra/newview/llpanelobject.h | 8 +- indra/newview/llpanelvolume.cpp | 6 +- indra/newview/llviewermenu.cpp | 4 +- indra/newview/llviewerobject.cpp | 127 ++++++++++--------------- indra/newview/llviewerobject.h | 61 +++++++++--- indra/newview/llviewerobjectbackup.cpp | 27 +++--- indra/newview/llviewertexturelist.cpp | 1 + indra/newview/llvovolume.cpp | 74 +++++++------- 12 files changed, 171 insertions(+), 166 deletions(-) diff --git a/indra/newview/awavefront.cpp b/indra/newview/awavefront.cpp index 2c6e0127e..11a81d350 100644 --- a/indra/newview/awavefront.cpp +++ b/indra/newview/awavefront.cpp @@ -238,7 +238,7 @@ namespace LLViewerObject* obj = node->getObject(); if (obj->isSculpted() && !obj->isMesh()) { - LLSculptParams *sculpt_params = (LLSculptParams *)obj->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = obj->getSculptParams(); LLUUID sculpt_id = sculpt_params->getSculptTexture(); // Find inventory items with asset id of the sculpt map diff --git a/indra/newview/daeexport.cpp b/indra/newview/daeexport.cpp index 71697251c..9f154e72f 100644 --- a/indra/newview/daeexport.cpp +++ b/indra/newview/daeexport.cpp @@ -139,7 +139,7 @@ namespace DAEExportUtil LLViewerObject* obj = node->getObject(); if (obj->isSculpted() && !obj->isMesh()) { - LLSculptParams *sculpt_params = (LLSculptParams *)obj->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = obj->getSculptParams(); LLUUID sculpt_id = sculpt_params->getSculptTexture(); return canExportTexture(sculpt_id); } diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index f20a4cca3..d456584cf 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -674,6 +674,7 @@ void LLHUDText::reshape() F32 LLHUDText::LLHUDTextSegment::getWidth(const LLFontGL* font) { + // Singu note: Reworked hotspot. Less indirection if (mFontWidthMap[0].first == font) { return mFontWidthMap[0].second; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index f838f7d8f..2eab07463 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -130,10 +130,10 @@ LLVector3 LLPanelObject::mClipboardPos; LLVector3 LLPanelObject::mClipboardSize; LLVector3 LLPanelObject::mClipboardRot; LLVolumeParams LLPanelObject::mClipboardVolumeParams; -LLFlexibleObjectData* LLPanelObject::mClipboardFlexiParams = NULL; -LLLightParams* LLPanelObject::mClipboardLightParams = NULL; -LLSculptParams* LLPanelObject::mClipboardSculptParams = NULL; -LLLightImageParams* LLPanelObject::mClipboardLightImageParams = NULL; +const LLFlexibleObjectData* LLPanelObject::mClipboardFlexiParams = NULL; +const LLLightParams* LLPanelObject::mClipboardLightParams = NULL; +const LLSculptParams* LLPanelObject::mClipboardSculptParams = NULL; +const LLLightImageParams* LLPanelObject::mClipboardLightImageParams = NULL; BOOL LLPanelObject::hasParamClipboard = FALSE; BOOL LLPanelObject::postBuild() @@ -895,7 +895,7 @@ void LLPanelObject::getState( ) } - if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + if (objectp->getSculptParams()) { selected_item = MI_SCULPT; LLFirstUse::useSculptedPrim(); @@ -1398,7 +1398,7 @@ void LLPanelObject::getState( ) LLUUID id; - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = objectp->getSculptParams(); if (sculpt_params) // if we have a legal sculpt param block for this object: @@ -1574,13 +1574,13 @@ void LLPanelObject::onCommitParametric( LLUICtrl* ctrl, void* userdata ) if (selected_type == MI_SCULPT) { self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, TRUE, TRUE); - LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = self->mObject->getSculptParams(); if (sculpt_params) volume_params.setSculptID(sculpt_params->getSculptTexture(), sculpt_params->getSculptType()); } else { - LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = self->mObject->getSculptParams(); if (sculpt_params) self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); } @@ -2463,16 +2463,16 @@ void LLPanelObject::onCopyParams(void* user_data) LLViewerObject* objp = self->mObject; - mClipboardFlexiParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE)) : NULL; - mClipboardLightParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_LIGHT)) : NULL; - mClipboardSculptParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_SCULPT)) : NULL; + mClipboardFlexiParams = objp->getFlexibleObjectData(); + mClipboardLightParams = objp->getLightParams(); + mClipboardSculptParams = objp->getSculptParams(); if (mClipboardSculptParams) { const LLUUID id = mClipboardSculptParams->getSculptTexture(); if (id != LLUUID(SCULPT_DEFAULT_TEXTURE) && !texturePermsCheck(id)) mClipboardSculptParams = NULL; } - mClipboardLightImageParams = objp->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE) ? static_cast(objp->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE)) : NULL; + mClipboardLightImageParams = objp->getLightImageParams(); if (mClipboardLightImageParams && texturePermsCheck(mClipboardLightImageParams->getLightTexture())) { mClipboardLightImageParams = NULL; diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index e98808747..18877663c 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -122,10 +122,10 @@ protected: static LLVector3 mClipboardSize; static LLVector3 mClipboardRot; static LLVolumeParams mClipboardVolumeParams; - static LLFlexibleObjectData* mClipboardFlexiParams; - static LLLightParams* mClipboardLightParams; - static LLSculptParams* mClipboardSculptParams; - static LLLightImageParams* mClipboardLightImageParams; + static const LLFlexibleObjectData* mClipboardFlexiParams; + static const LLLightParams* mClipboardLightParams; + static const LLSculptParams* mClipboardSculptParams; + static const LLLightImageParams* mClipboardLightImageParams; static BOOL hasParamClipboard; S32 mComboMaterialItemCount; diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 4426a2846..f521a6cca 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -410,7 +410,7 @@ void LLPanelVolume::getState( ) getChildView("FlexForceY")->setEnabled(true); getChildView("FlexForceZ")->setEnabled(true); - LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + const LLFlexibleObjectData *attributes = objectp->getFlexibleObjectData(); getChild("FlexNumSections")->setValue((F32)attributes->getSimulateLOD()); getChild("FlexGravity")->setValue(attributes->getGravity()); @@ -462,7 +462,7 @@ void LLPanelVolume::getState( ) mComboPhysicsShapeType->add(getString("None"), LLSD(1)); BOOL isMesh = FALSE; - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = objectp->getSculptParams(); if (sculpt_params) { U8 sculpt_type = sculpt_params->getSculptType(); @@ -777,7 +777,7 @@ void LLPanelVolume::onCommitFlexible( LLUICtrl* ctrl, void* userdata ) return; } - LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + const LLFlexibleObjectData *attributes = objectp->getFlexibleObjectData(); if (attributes) { LLFlexibleObjectData new_attributes; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b492683f1..51216eb26 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2189,7 +2189,7 @@ public: LLVOVolume* volume = (*(img->getVolumeList()))[i]; if (volume && volume->isSculpted()) { - LLSculptParams *sculpt_params = (LLSculptParams *)volume->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = volume->getSculptParams(); if(sculpt_params->getSculptTexture() == id) volume->notifyMeshLoaded(); } @@ -2226,7 +2226,7 @@ void reload_objects(LLTextureReloader& texture_list, LLViewerObject::const_child if(object->isSculpted() && !object->isMesh()) { - LLSculptParams *sculpt_params = (LLSculptParams *)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = object->getSculptParams(); if(sculpt_params) { texture_list.addTexture(LLViewerTextureManager::getFetchedTexture(sculpt_params->getSculptTexture())); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ba36aa529..8b41996c6 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1377,11 +1377,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, unpackParticleSource(block_num, owner_id); // Mark all extra parameters not used - std::vector >::iterator iter; - for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter) + for (auto& entry : mExtraParameterList) { - if(*iter) - (*iter)->in_use = FALSE; + if (entry.in_use) *entry.in_use = false; } // Unpack extra parameters @@ -1410,10 +1408,11 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, for (size_t i = 0; i < mExtraParameterList.size(); ++i) { - if (mExtraParameterList[i] && !mExtraParameterList[i]->in_use) + auto& entry = mExtraParameterList[i]; + if (entry.in_use && !*entry.in_use) { // Send an update message in case it was formerly in use - parameterChanged((i + 1) << 4, mExtraParameterList[i]->data.get(), FALSE, false); + parameterChanged((i + 1) << 4, entry.data, FALSE, false); } } break; @@ -1633,11 +1632,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } // Mark all extra parameters not used - std::vector >::iterator iter; - for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter) + for (auto& entry : mExtraParameterList) { - if(*iter) - (*iter)->in_use = FALSE; + if (entry.in_use) *entry.in_use = false; } // Unpack extra params @@ -1657,10 +1654,11 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, for (size_t i = 0; i < mExtraParameterList.size(); ++i) { - if (mExtraParameterList[i] && !mExtraParameterList[i]->in_use) + auto& entry = mExtraParameterList[i]; + if (entry.in_use && !*entry.in_use) { // Send an update message in case it was formerly in use - parameterChanged((i + 1) << 4, mExtraParameterList[i]->data.get(), FALSE, false); + parameterChanged((i + 1) << 4, entry.data, FALSE, false); } } @@ -3990,7 +3988,7 @@ void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) if (isSculpted() && !isMesh()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = getSculptParams(); LLUUID sculpt_id = sculpt_params->getSculptTexture(); LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); } @@ -5814,8 +5812,8 @@ bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) if (param) { param->data->unpack(*dp); - param->in_use = TRUE; - parameterChanged(param_type, param->data.get(), TRUE, false); + *param->in_use = TRUE; + parameterChanged(param_type, param->data, TRUE, false); return true; } else @@ -5827,31 +5825,37 @@ bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 param_type) { LLNetworkData* new_block = NULL; + bool* in_use = NULL; switch (param_type) { case LLNetworkData::PARAMS_FLEXIBLE: { - new_block = new LLFlexibleObjectData(); + new_block = &mFlexibleObjectData; + in_use = &mFlexibleObjectDataInUse; break; } case LLNetworkData::PARAMS_LIGHT: { - new_block = new LLLightParams(); + new_block = &mLightParams; + in_use = &mLightParamsInUse; break; } case LLNetworkData::PARAMS_SCULPT: { - new_block = new LLSculptParams(); + new_block = &mSculptParams; + in_use = &mSculptParamsInUse; break; } case LLNetworkData::PARAMS_LIGHT_IMAGE: { - new_block = new LLLightImageParams(); + new_block = &mLightImageParams; + in_use = &mLightImageParamsInUse; break; } case LLNetworkData::PARAMS_EXTENDED_MESH: { - new_block = new LLExtendedMeshParams(); + new_block = &mExtendedMeshParams; + in_use = &mExtendedMeshParamsInUse; break; } default: @@ -5861,70 +5865,33 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para } }; + ExtraParameter& entry = mExtraParameterList[U32(param_type >> 4) - 1]; if (new_block) { - ExtraParameter* new_entry = new ExtraParameter; - new_entry->data = decltype(new_entry->data)(new_block); - new_entry->in_use = false; // not in use yet - mExtraParameterList[(param_type >> 4) - 1].reset(new_entry); - return new_entry; + entry.in_use = in_use; + *entry.in_use = false; // not in use yet + entry.data = new_block; + return &entry; + } + else + { + entry.is_invalid = true; } return NULL; } -LLViewerObject::ExtraParameter* LLViewerObject::getExtraParameterEntry(U16 param_type) const -{ - return param_type <= LLNetworkData::PARAMS_MAX ? mExtraParameterList[(param_type >> 4) - 1].get() : nullptr; -} - -LLViewerObject::ExtraParameter* LLViewerObject::getExtraParameterEntryCreate(U16 param_type) -{ - ExtraParameter* param = getExtraParameterEntry(param_type); - if (!param) - { - param = createNewParameterEntry(param_type); - } - return param; -} - -LLNetworkData* LLViewerObject::getParameterEntry(U16 param_type) const -{ - ExtraParameter* param = getExtraParameterEntry(param_type); - if (param) - { - return param->data.get(); - } - else - { - return NULL; - } -} - -BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const -{ - ExtraParameter* param = getExtraParameterEntry(param_type); - if (param) - { - return param->in_use; - } - else - { - return FALSE; - } -} - bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin) { ExtraParameter* param = getExtraParameterEntryCreate(param_type); if (param) { - if (param->in_use && new_value == *(param->data)) + if (*(param->in_use) && new_value == *(param->data)) { return false; } - param->in_use = true; + *param->in_use = true; param->data->copy(new_value); - parameterChanged(param_type, param->data.get(), TRUE, local_origin); + parameterChanged(param_type, param->data, TRUE, local_origin); return true; } else @@ -5938,22 +5905,28 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ // Should always return true. bool LLViewerObject::setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin) { - ExtraParameter* param = getExtraParameterEntryCreate(param_type); - if (param && param->in_use != in_use) + if (param_type <= LLNetworkData::PARAMS_MAX) { - param->in_use = in_use; - parameterChanged(param_type, param->data.get(), in_use, local_origin); - return true; + ExtraParameter* param = (in_use ? getExtraParameterEntryCreate(param_type) : &getExtraParameterEntry(param_type)); + if (param && param->data && *param->in_use != (bool)in_use) + { + *param->in_use = in_use; + parameterChanged(param_type, param->data, in_use, local_origin); + return true; + } } return false; } void LLViewerObject::parameterChanged(U16 param_type, bool local_origin) { - ExtraParameter* param = getExtraParameterEntry(param_type); - if (param) + if (param_type <= LLNetworkData::PARAMS_MAX) { - parameterChanged(param_type, param->data.get(), param->in_use, local_origin); + const ExtraParameter& param = getExtraParameterEntry(param_type); + if (param.data) + { + parameterChanged(param_type, param.data, *param.in_use, local_origin); + } } } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index ef4031e92..a7fc3e140 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -123,13 +123,24 @@ class LLViewerObject protected: ~LLViewerObject(); // use unref() - // TomY: Provide for a list of extra parameter structures, mapped by structure name +private: struct ExtraParameter { - BOOL in_use; - std::unique_ptr data; + bool is_invalid = false; + bool* in_use = nullptr; + LLNetworkData* data = nullptr; }; - std::vector > mExtraParameterList; + std::vector mExtraParameterList; + bool mFlexibleObjectDataInUse = false; + bool mLightParamsInUse = false; + bool mSculptParamsInUse = false; + bool mLightImageParamsInUse = false; + bool mExtendedMeshParamsInUse = false; + LLFlexibleObjectData mFlexibleObjectData; + LLLightParams mLightParams; + LLSculptParams mSculptParams; + LLLightImageParams mLightImageParams; + LLExtendedMeshParams mExtendedMeshParams; public: typedef std::list > child_list_t; @@ -587,10 +598,15 @@ public: virtual void dirtySpatialGroup(BOOL priority = FALSE) const; virtual void dirtyMesh(); - virtual LLNetworkData* getParameterEntry(U16 param_type) const; - virtual bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin); - virtual BOOL getParameterEntryInUse(U16 param_type) const; - virtual bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin); + const LLFlexibleObjectData* getFlexibleObjectData() const { return mFlexibleObjectDataInUse ? &mFlexibleObjectData : nullptr; } + const LLLightParams* getLightParams() const { return mLightParamsInUse ? &mLightParams : nullptr; } + const LLSculptParams* getSculptParams() const { return mSculptParamsInUse ? &mSculptParams : nullptr; } + const LLLightImageParams* getLightImageParams() const { return mLightImageParamsInUse ? &mLightImageParams : nullptr; } + const LLExtendedMeshParams* getExtendedMeshParams() const { return mExtendedMeshParamsInUse ? &mExtendedMeshParams : nullptr; } + + bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin); + bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin); + // Called when a parameter is changed virtual void parameterChanged(U16 param_type, bool local_origin); virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin); @@ -617,9 +633,32 @@ public: private: ExtraParameter* createNewParameterEntry(U16 param_type); - ExtraParameter* getExtraParameterEntry(U16 param_type) const; - ExtraParameter* getExtraParameterEntryCreate(U16 param_type); - bool unpackParameterEntry(U16 param_type, LLDataPacker *dp); + const ExtraParameter& getExtraParameterEntry(U16 param_type) const + { + return mExtraParameterList[U32(param_type >> 4) - 1]; + } + ExtraParameter& getExtraParameterEntry(U16 param_type) + { + return mExtraParameterList[U32(param_type >> 4) - 1]; + } + ExtraParameter* getExtraParameterEntryCreate(U16 param_type) + { + if (param_type <= LLNetworkData::PARAMS_MAX) + { + ExtraParameter& param = getExtraParameterEntry(param_type); + if (!param.is_invalid) + { + if (!param.data) + { + ExtraParameter* new_entry = createNewParameterEntry(param_type); + return new_entry; + } + return ¶m; + } + } + return nullptr; + } + bool unpackParameterEntry(U16 param_type, LLDataPacker* dp); // This function checks to see if the given media URL has changed its version // and the update wasn't due to this agent's last action. diff --git a/indra/newview/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index 292a4cae1..c5b1566fd 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -525,8 +525,7 @@ bool LLObjectBackup::validateNode(LLSelectNode* node) } else { - LLSculptParams* params; - params = (LLSculptParams*)obj->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams* params = obj->getSculptParams(); LLUUID sculpt_id = params->getSculptTexture(); return validateTexturePerms(sculpt_id); } @@ -871,23 +870,24 @@ LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, if (object->isFlexible()) { // Flexible - LLFlexibleObjectData* flex; - flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); - prim_llsd["flexible"] = flex->asLLSD(); + const LLFlexibleObjectData* flex = object->getFlexibleObjectData(); + if (flex) + { + prim_llsd["flexible"] = flex->asLLSD(); + } } - if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) + const LLLightParams* light = object->getLightParams(); + if (light) { // Light - LLLightParams* light; - light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); prim_llsd["light"] = light->asLLSD(); } - if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + + const LLLightImageParams* light_param = object->getLightImageParams(); + if (light_param) { // Light image - LLLightImageParams* light_param; - light_param = (LLLightImageParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); t_id = validateTextureID(light_param->getLightTexture()); if (mTexturesList.count(t_id) == 0) { @@ -898,11 +898,10 @@ LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, prim_llsd["light_texture"] = light_param->asLLSD(); } - if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + const LLSculptParams* sculpt = object->getSculptParams(); + if (sculpt) { // Sculpt - LLSculptParams* sculpt; - sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); if ((sculpt->getSculptType() & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH) { diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 82d4cef61..9d19ca427 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -601,6 +601,7 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id) { + // Singu note: Reworked hotspot auto& iter = mUUIDDict.find(image_id); if(iter == mUUIDDict.end()) return NULL; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 3ad3c2565..c02c090e7 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -333,7 +333,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, U8 sculpt_type = 0; if (isSculpted()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = getSculptParams(); sculpt_id = sculpt_params->getSculptTexture(); sculpt_type = sculpt_params->getSculptType(); } @@ -850,7 +850,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) if (getLightTextureID().notNull()) { - LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); + const LLLightImageParams* params = getLightImageParams(); LLUUID id = params->getLightTexture(); mLightTexture = LLViewerTextureManager::getFetchedTexture(id); if (mLightTexture.notNull()) @@ -996,7 +996,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, false); if (!mVolumeImpl) { - LLFlexibleObjectData* data = (LLFlexibleObjectData*)getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + LLFlexibleObjectData* data = (LLFlexibleObjectData*)getFlexibleObjectData(); mVolumeImpl = new LLVolumeImplFlexible(this, data); } } @@ -1100,7 +1100,7 @@ void LLVOVolume::updateSculptTexture() if (isSculpted() && !isMesh()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = getSculptParams(); LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { @@ -2946,7 +2946,7 @@ void LLVOVolume::setLightTextureID(LLUUID id) { setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, TRUE, true); } - LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); + LLLightImageParams* param_block = (LLLightImageParams*)getLightImageParams(); if (param_block && param_block->getLightTexture() != id) { param_block->setLightTexture(id); @@ -2966,7 +2966,7 @@ void LLVOVolume::setLightTextureID(LLUUID id) void LLVOVolume::setSpotLightParams(LLVector3 params) { - LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); + LLLightImageParams* param_block = (LLLightImageParams*)getLightImageParams(); if (param_block && param_block->getParams() != params) { param_block->setParams(params); @@ -3003,7 +3003,7 @@ void LLVOVolume::setIsLight(BOOL is_light) void LLVOVolume::setLightColor(const LLColor3& color) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getColor() != color) @@ -3018,7 +3018,7 @@ void LLVOVolume::setLightColor(const LLColor3& color) void LLVOVolume::setLightIntensity(F32 intensity) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getColor().mV[3] != intensity) @@ -3031,7 +3031,7 @@ void LLVOVolume::setLightIntensity(F32 intensity) void LLVOVolume::setLightRadius(F32 radius) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getRadius() != radius) @@ -3044,7 +3044,7 @@ void LLVOVolume::setLightRadius(F32 radius) void LLVOVolume::setLightFalloff(F32 falloff) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getFalloff() != falloff) @@ -3057,7 +3057,7 @@ void LLVOVolume::setLightFalloff(F32 falloff) void LLVOVolume::setLightCutoff(F32 cutoff) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getCutoff() != cutoff) @@ -3072,12 +3072,12 @@ void LLVOVolume::setLightCutoff(F32 cutoff) BOOL LLVOVolume::getIsLight() const { - return getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT); + return getLightParams() != nullptr; } LLColor3 LLVOVolume::getLightBaseColor() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return LLColor3(param_block->getColor()); @@ -3090,7 +3090,7 @@ LLColor3 LLVOVolume::getLightBaseColor() const LLColor3 LLVOVolume::getLightColor() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return LLColor3(param_block->getColor()) * param_block->getColor().mV[3]; @@ -3103,13 +3103,10 @@ LLColor3 LLVOVolume::getLightColor() const LLUUID LLVOVolume::getLightTextureID() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + const LLLightImageParams *param_block = getLightImageParams(); + if (param_block) { - const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - if (param_block) - { - return param_block->getLightTexture(); - } + return param_block->getLightTexture(); } return LLUUID::null; @@ -3118,13 +3115,10 @@ LLUUID LLVOVolume::getLightTextureID() const LLVector3 LLVOVolume::getSpotLightParams() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + const LLLightImageParams *param_block = getLightImageParams(); + if (param_block) { - const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - if (param_block) - { - return param_block->getParams(); - } + return param_block->getParams(); } return LLVector3(); @@ -3161,8 +3155,8 @@ void LLVOVolume::updateSpotLightPriority() bool LLVOVolume::isLightSpotlight() const { - LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - if (params && getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + const LLLightImageParams* params = getLightImageParams(); + if (params) { return params->isLightSpotlight(); } @@ -3191,7 +3185,7 @@ LLViewerTexture* LLVOVolume::getLightTexture() F32 LLVOVolume::getLightIntensity() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getColor().mV[3]; @@ -3204,7 +3198,7 @@ F32 LLVOVolume::getLightIntensity() const F32 LLVOVolume::getLightRadius() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getRadius(); @@ -3217,7 +3211,7 @@ F32 LLVOVolume::getLightRadius() const F32 LLVOVolume::getLightFalloff() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getFalloff(); @@ -3230,7 +3224,7 @@ F32 LLVOVolume::getLightFalloff() const F32 LLVOVolume::getLightCutoff() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getCutoff(); @@ -3253,7 +3247,7 @@ U32 LLVOVolume::getVolumeInterfaceID() const BOOL LLVOVolume::isFlexible() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE)) + if (getFlexibleObjectData()) { LLVolume* volume = getVolume(); if (volume && volume->getParams().getPathParams().getCurveType() != LL_PCODE_PATH_FLEXIBLE) @@ -3272,7 +3266,7 @@ BOOL LLVOVolume::isFlexible() const BOOL LLVOVolume::isSculpted() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + if (getSculptParams()) { return TRUE; } @@ -3284,7 +3278,7 @@ BOOL LLVOVolume::isMesh() const { if (isSculpted()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = getSculptParams(); U8 sculpt_type = sculpt_params->getSculptType(); if ((sculpt_type & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH) @@ -3299,7 +3293,7 @@ BOOL LLVOVolume::isMesh() const BOOL LLVOVolume::hasLightTexture() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + if (getLightImageParams()) { return TRUE; } @@ -3393,8 +3387,7 @@ BOOL LLVOVolume::isRiggedMesh() const //---------------------------------------------------------------------------- U32 LLVOVolume::getExtendedMeshFlags() const { - const LLExtendedMeshParams *param_block = - (const LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH); + const LLExtendedMeshParams *param_block = getExtendedMeshParams(); if (param_block) { return param_block->getFlags(); @@ -3439,8 +3432,7 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags) { bool in_use = true; setParameterEntryInUse(LLNetworkData::PARAMS_EXTENDED_MESH, in_use, true); - LLExtendedMeshParams *param_block = - (LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH); + LLExtendedMeshParams *param_block = (LLExtendedMeshParams *)getExtendedMeshParams(); if (param_block) { param_block->setFlags(flags); @@ -3762,7 +3754,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const } else { - const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = getSculptParams(); LLUUID sculpt_id = sculpt_params->getSculptTexture(); if (textures.find(sculpt_id) == textures.end()) {