From cf60f6a1910e8fa82011d6f13aa1bd9c6767fffb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Jun 2012 17:08:49 -0400 Subject: SH-3172 WIP - debug setting for settings.xml --- indra/newview/app_settings/settings.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1911943842..53c7ceaa80 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12302,6 +12302,17 @@ Value 1 + UseServerTextureBaking + + Comment + Update appearance via the ServerTextureBaking cap, if available + Persist + 1 + Type + Boolean + Value + 1 + RenderDelayVBUpdate Comment -- cgit v1.2.3 From c3488d1fc64fb3f2bc5ad3a5a0fd5722eb574a4c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 25 Jun 2012 13:50:39 -0400 Subject: SH-3172 WIP - useServerTextureBaking() func --- indra/newview/llappearancemgr.cpp | 9 +++++++-- indra/newview/llappearancemgr.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 indra/newview/llappearancemgr.h (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index faadfb4b87..5d2ff1b40f 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2581,8 +2581,13 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base if (inventory_changed) gInventory.notifyObservers(); } - - +// Should be true iff both the appropriate debug setting is enabled +// and the corresponding cap has been found. +bool useServerTextureBaking() +{ + // TODO: add cap check. + return gSavedSettings.getBOOL("UseServerTextureBaking"); +} class LLShowCreatedOutfit: public LLInventoryCallback { diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h old mode 100644 new mode 100755 index c1d561781d..4423486b95 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -182,6 +182,8 @@ public: bool isInUpdateAppearanceFromCOF() { return mIsInUpdateAppearanceFromCOF; } + bool useServerTextureBaking(); + protected: LLAppearanceMgr(); ~LLAppearanceMgr(); -- cgit v1.2.3 From 99c1c64aa494c0b9085f0766b951fedfb60ce412 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 26 Jun 2012 16:05:03 -0400 Subject: SH-3172 WIP - fix --- indra/newview/llappearancemgr.cpp | 2 +- indra/newview/lldynamictexture.cpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/lldynamictexture.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 5d2ff1b40f..02a90c60ec 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2583,7 +2583,7 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base // Should be true iff both the appropriate debug setting is enabled // and the corresponding cap has been found. -bool useServerTextureBaking() +bool LLAppearanceMgr::useServerTextureBaking() { // TODO: add cap check. return gSavedSettings.getBOOL("UseServerTextureBaking"); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp old mode 100644 new mode 100755 -- cgit v1.2.3 From fbbde138c42dfced9b8805e4ce774ae8605e9d9b Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 27 Jun 2012 17:40:19 -0400 Subject: SH-3231 FIX Process new texture fetch url from login.cgi - Added a new global setting (non-persist) to store the texture request URL - New setting is 'AgentAppearanceServiceURL' --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llstartup.cpp | 8 ++++++++ 2 files changed, 19 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 53c7ceaa80..6a0b9559d0 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -71,6 +71,17 @@ Value 0 + AgentAppearanceServiceURL + + Comment + Current Session Agent Appearance Service URL + Persist + 0 + Type + String + Value + + AlertedUnsupportedHardware Comment diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ebde7a55fe..e271653b2d 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3442,6 +3442,14 @@ bool process_login_success_response() } + // set the location of the Agent Appearance service, from which we can request + // avatar baked textures if they are supported by the current region + std::string agent_appearance_url = response["agent_appearance_service"]; + if (!agent_appearance_url.empty()) + { + gSavedSettings.setString("AgentAppearanceServiceURL", agent_appearance_url); + } + // Set the location of the snapshot sharing config endpoint std::string snapshot_config_url = response["snapshot_config_url"]; if(!snapshot_config_url.empty()) -- cgit v1.2.3 From 14fef9f08a3bfb44d94771be6478a57ed9a91540 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Thu, 28 Jun 2012 11:05:32 -0400 Subject: SH-3230 Disable texture readback & upload If we're utilizing server-side texture baking, upload requests are discarded. Note: this breaks viewer in that it will *always* use the baked textures sent by the cache request/ initial login. Without a server-generated update, you will see those textures on your avatar for the entire session, even if you switch outfits. --- indra/newview/llvoavatarself.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0bfd0df769..ee3381a5ad 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -887,7 +887,10 @@ void LLVOAvatarSelf::removeMissingBakedTextures() invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE); } updateMeshTextures(); - requestLayerSetUploads(); + if (!LLAppearanceMgr::instance().useServerTextureBaking()) + { + requestLayerSetUploads(); + } } } @@ -1630,7 +1633,7 @@ void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_r layerset->requestUpdate(); layerset->invalidateMorphMasks(); - if( upload_result ) + if( upload_result && !LLAppearanceMgr::instance().useServerTextureBaking()) { llassert(isSelf()); -- cgit v1.2.3 From e4a0dda457039b1a04c74024d9fbcf02e071b13d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 28 Jun 2012 14:24:04 -0400 Subject: SH-3228 WIP - always respond to processAppearance for self, convert baked textures to checkerboards --- indra/newview/llvoavatar.cpp | 4 ++-- indra/newview/llvoavatarself.cpp | 2 +- indra/newview/llvovolume.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d2247ed5cb..531d3b4940 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7283,7 +7283,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if( isSelf() ) { llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived ) + if( mFirstTEMessageReceived && !LLAppearanceMgr::instance().useServerTextureBaking()) { // llinfos << "processAvatarAppearance end " << mID << llendl; return; @@ -7294,7 +7294,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); - unpackTEMessage(mesgsys, _PREHASH_ObjectData); + unpackTEMessage(mesgsys, _PREHASH_ObjectData, LLAppearanceMgr::instance().useServerTextureBaking()); // dumpAvatarTEs( "POST processAvatarAppearance()" ); // prevent the overwriting of valid baked textures with invalid baked textures diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0bfd0df769..585a116acb 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -814,7 +814,7 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, updateMeshTextures(); // unpack the texture UUIDs to the texture slots - retval = unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num); + retval = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num); // need to trigger a few operations to get the avatar to use the new bakes for (U32 i = 0; i < mBakedTextureDatas.size(); i++) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b5d173346e..4999f680df 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -370,7 +370,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, // Unpack texture entry data // - S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num); + S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num); if (result & teDirtyBits) { updateTEData(); -- cgit v1.2.3 From fe01e64f9756641756d18d7aab7079bfee21c089 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 29 Jun 2012 13:08:00 -0400 Subject: SH-3226 WIP - request appearance update request, connects to UpdateAgentAppearance cap, in updateAppearanceFromCOF() --- indra/newview/llappearancemgr.cpp | 30 ++++++++++++++++++++++++++++++ indra/newview/llappearancemgr.h | 2 ++ indra/newview/llviewerregion.cpp | 1 + 3 files changed, 33 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 02a90c60ec..d6cb910b4e 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1730,6 +1730,12 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) // the saved outfit stored as a folder link updateIsDirty(); + // Send server request for appearance update + if (useServerTextureBaking()) + { + requestServerAppearanceUpdate(); + } + //dumpCat(getCOF(),"COF, start"); bool follow_folder_links = true; @@ -2589,6 +2595,30 @@ bool LLAppearanceMgr::useServerTextureBaking() return gSavedSettings.getBOOL("UseServerTextureBaking"); } +class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder +{ +public: + RequestAgentUpdateAppearanceResponder() {} + /*virtual*/ void error(U32 status, const std::string& reason) + { + llwarns << "appearance update request failed, reason: " << reason << llendl; + } +}; + +void LLAppearanceMgr::requestServerAppearanceUpdate() +{ + std::string url = gAgent.getRegion()->getCapability("UpdateAgentAppearance"); + if (!url.empty()) + { + LLSD body; + LLHTTPClient::post(url, body, new RequestAgentUpdateAppearanceResponder); + } + else + { + llwarns << "no cap for UpdateAgentAppearance" << llendl; + } +} + class LLShowCreatedOutfit: public LLInventoryCallback { public: diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 4423486b95..46457f1dce 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -184,6 +184,8 @@ public: bool useServerTextureBaking(); + void requestServerAppearanceUpdate(); + protected: LLAppearanceMgr(); ~LLAppearanceMgr(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e3cb985ddb..912dd7d0c9 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1545,6 +1545,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("UntrustedSimulatorMessage"); capabilityNames.append("UpdateAgentInformation"); capabilityNames.append("UpdateAgentLanguage"); + capabilityNames.append("UpdateAgentAppearance"); capabilityNames.append("UpdateGestureAgentInventory"); capabilityNames.append("UpdateNotecardAgentInventory"); capabilityNames.append("UpdateScriptAgent"); -- cgit v1.2.3 From 3f931ad1e3558a847ba93099a0336782f9f5dbdc Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 29 Jun 2012 19:18:33 -0400 Subject: SH-3229 FIX suppress baked texture cache requests and generated agentAppearance messages If you're using the new pipeline, then we should not be requesting cached baked textures from the simulator. Nor should we be sending agentAppearance messages to the simulator (note: this may change in the future on region arrive) --- indra/newview/llagent.cpp | 3 ++- indra/newview/llagentwearables.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3367604753..f99065aa08 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -35,6 +35,7 @@ #include "llagentlistener.h" #include "llagentwearables.h" #include "llagentui.h" +#include "llappearancemgr.h" #include "llanimationstates.h" #include "llcallingcard.h" #include "llcapabilitylistener.h" @@ -3771,7 +3772,7 @@ void LLAgent::requestLeaveGodMode() //----------------------------------------------------------------------------- void LLAgent::sendAgentSetAppearance() { - if (!isAgentAvatarValid()) return; + if (!isAgentAvatarValid() || LLAppearanceMgr::instance().useServerTextureBaking()) return; if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingBakedTextures())) { diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e441f21f90..0a721312f3 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1597,7 +1597,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n void LLAgentWearables::queryWearableCache() { - if (!areWearablesLoaded()) + if (!areWearablesLoaded() || LLAppearanceMgr::instance().useServerTextureBaking()) { return; } -- cgit v1.2.3 From 4718ffebc1942ea1d94c8e8d2eca071d0d834bc2 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 2 Jul 2012 18:17:56 -0400 Subject: FIX: renamed UpdateAgentAppearance to UpdateAvatarAppearance --- indra/newview/llappearancemgr.cpp | 4 ++-- indra/newview/llviewerregion.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d6cb910b4e..480a8e0d73 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2607,7 +2607,7 @@ public: void LLAppearanceMgr::requestServerAppearanceUpdate() { - std::string url = gAgent.getRegion()->getCapability("UpdateAgentAppearance"); + std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance"); if (!url.empty()) { LLSD body; @@ -2615,7 +2615,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate() } else { - llwarns << "no cap for UpdateAgentAppearance" << llendl; + llwarns << "no cap for UpdateAvatarAppearance" << llendl; } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 912dd7d0c9..777475fe61 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1545,7 +1545,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("UntrustedSimulatorMessage"); capabilityNames.append("UpdateAgentInformation"); capabilityNames.append("UpdateAgentLanguage"); - capabilityNames.append("UpdateAgentAppearance"); + capabilityNames.append("UpdateAvatarAppearance"); capabilityNames.append("UpdateGestureAgentInventory"); capabilityNames.append("UpdateNotecardAgentInventory"); capabilityNames.append("UpdateScriptAgent"); -- cgit v1.2.3 From 5904976435873b0b3c4f39a2514aef38bee22a39 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 3 Jul 2012 01:06:04 +0000 Subject: Added more rendering-code early-exits when in headless mode. --- indra/newview/llviewerwindow.cpp | 1 + indra/newview/pipeline.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7afb135470..ed970b84a7 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1712,6 +1712,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) void LLViewerWindow::initGLDefaults() { + if (gHeadlessClient) return; gGL.setSceneBlendType(LLRender::BT_ALPHA); if (!LLGLSLShader::sNoFixedFunction) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 49c4f37871..de72d79043 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1105,6 +1105,7 @@ void LLPipeline::releaseScreenBuffers() void LLPipeline::createGLBuffers() { + if (gHeadlessClient) return; stop_glerror(); LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS); assertInitialized(); -- cgit v1.2.3 From bc2517215cbf79cdf8a910e93cc5d3f2ac1534c7 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 9 Jul 2012 00:48:02 +0000 Subject: Skipping shiftObject pipeline method in headless mode --- indra/newview/llviewerobjectlist.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index beb68c1cbb..e4ce670a43 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1491,6 +1491,7 @@ void LLViewerObjectList::onPhysicsFlagsFetchFailure(const LLUUID& object_id) void LLViewerObjectList::shiftObjects(const LLVector3 &offset) { + if (gHeadlessClient) return; // This is called when we shift our origin when we cross region boundaries... // We need to update many object caches, I'll document this more as I dig through the code // cleaning things out... -- cgit v1.2.3 From 033c84dc9452f4b38cdf87446203241c4554d126 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 9 Jul 2012 14:03:08 -0400 Subject: SH-3171 FIX switched texture pipeline to use the new cap request URL If we support server side texture baking, requests for baked textures will go through the http url received at login. --- indra/newview/llviewerobject.cpp | 17 +++++++++++++++++ indra/newview/llviewerobject.h | 1 + indra/newview/llvoavatar.cpp | 18 ++++++++++++++++-- indra/newview/llvoavatardefines.cpp | 12 ++++++------ 4 files changed, 40 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index cd300accb7..877e475928 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4141,6 +4141,23 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) } +S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ) +{ + S32 retval = 0; + if (uuid != getTE(te)->getID() || + uuid == LLUUID::null) + { + retval = LLPrimitive::setTETexture(te, uuid); + mTEImages[te] = LLViewerTextureManager::getFetchedTextureFromUrl (url, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } + } + return retval; +} + S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host) { S32 retval = 0; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index c8152e1539..b380e9b8ce 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -314,6 +314,7 @@ public: /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid); S32 setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host); + S32 setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ); /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color); /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color); /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 531d3b4940..d48d79f807 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2370,6 +2370,17 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) // to redirect certain avatar texture requests to different sims. if (isIndexBakedTexture((ETextureIndex)te)) { + std::string url = gSavedSettings.getString("AgentAppearanceServiceURL"); + if (LLAppearanceMgr::instance().useServerTextureBaking() && !url.empty()) + { + const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); + if (texture_entry != NULL) + { + url += "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + return setTETextureCore(te, uuid, url); + } + } + LLHost target_host = getObjectHost(); return setTETextureCore(te, uuid, target_host); } @@ -4669,7 +4680,10 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel //the texture pipeline will stop fetching this texture. imagep->resetTextureStats(); - imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures. + if (!LLAppearanceMgr::instance().useServerTextureBaking()) + { + imagep->setCanUseHTTP(false); //turn off http fetching for baked textures. + } imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->resetMaxVirtualSizeResetCounter() ; @@ -7294,7 +7308,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); - unpackTEMessage(mesgsys, _PREHASH_ObjectData, LLAppearanceMgr::instance().useServerTextureBaking()); + unpackTEMessage(mesgsys, _PREHASH_ObjectData, FALSE); // dumpAvatarTEs( "POST processAvatarAppearance()" ); // prevent the overwriting of valid baked textures with invalid baked textures diff --git a/indra/newview/llvoavatardefines.cpp b/indra/newview/llvoavatardefines.cpp index 1ed4e3b61c..ef96a9e923 100644 --- a/indra/newview/llvoavatardefines.cpp +++ b/indra/newview/llvoavatardefines.cpp @@ -66,12 +66,12 @@ LLVOAvatarDictionary::Textures::Textures() addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); - addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD)); - addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER)); - addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER)); - addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES)); - addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR)); - addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT)); + addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head")); + addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper")); + addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower")); + addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes")); + addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair")); + addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt")); } LLVOAvatarDictionary::BakedTextures::BakedTextures() -- cgit v1.2.3 From cb2b59b48b6cf8aeb17f5b0f9f4063e8340ce144 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 10 Jul 2012 00:42:10 +0000 Subject: Added new settings: DisableAllRenderTypes, DisableAllRenderFeatures, and MaxFPS. --- indra/newview/app_settings/settings.xml | 33 ++++++++++++++++++++++++++ indra/newview/llappviewer.cpp | 20 ++++++++++++++++ indra/newview/llappviewer.h | 1 + indra/newview/llviewerdisplay.cpp | 2 +- indra/newview/pipeline.cpp | 42 ++++++++++++++++++++++++++------- indra/newview/pipeline.h | 5 +++- 6 files changed, 93 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5e50bd6e01..dde423f86c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8705,6 +8705,28 @@ Value 1 + DisableAllRenderTypes + + Comment + Disables all rendering types. + Persist + 0 + Type + Boolean + Value + 0 + + DisableAllRenderFeatures + + Comment + Disables all rendering features. + Persist + 0 + Type + Boolean + Value + 0 + RenderHUDInSnapshot Comment @@ -13010,6 +13032,17 @@ Value -1 + MaxFPS + + Comment + Yield some time to the local host if we reach a threshold framerate. + Persist + 1 + Type + F32 + Value + -1.0 + ZoomDirect Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index efa24796e5..f01f62c798 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -632,6 +632,7 @@ LLAppViewer::LLAppViewer() : mQuitRequested(false), mLogoutRequestSent(false), mYieldTime(-1), + mMinFrameTime(-1.0), mMainloopTimeout(NULL), mAgentRegionLastAlive(false), mRandomizeFramerate(LLCachedControl(gSavedSettings,"Randomize Framerate", FALSE)), @@ -1465,6 +1466,19 @@ bool LLAppViewer::mainLoop() { gFrameStalls++; } + + // Limit FPS + if (mMinFrameTime > F_APPROXIMATELY_ZERO) + { + // Sleep a while to limit frame rate. + S32 milliseconds_to_sleep = llclamp((S32)((mMinFrameTime - frameTimer.getElapsedTimeF64()) * 1000.f), 0, 1000); + if (milliseconds_to_sleep > 0) + { + LLFastTimer t(FTM_YIELD); + ms_sleep(milliseconds_to_sleep); + } + } + frameTimer.reset(); resumeMainloopTimeout(); @@ -2577,6 +2591,12 @@ bool LLAppViewer::initConfiguration() } mYieldTime = gSavedSettings.getS32("YieldTime"); + mMinFrameTime = -1.0f; + F32 max_fps = gSavedSettings.getF32("MaxFPS"); + if (max_fps > F_APPROXIMATELY_ZERO) + { + mMinFrameTime = 1.0f / max_fps; + } // Read skin/branding settings if specified. //if (! gDirUtilp->getSkinDir().empty() ) diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index ae3c795d1e..f55954234f 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -254,6 +254,7 @@ private: bool mQuitRequested; // User wants to quit, may have modified documents open. bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. S32 mYieldTime; + F32 mMinFrameTime; struct SettingsFiles* mSettingsLocationList; LLWatchdogTimeout* mMainloopTimeout; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 4571d08050..e4451c3c93 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1042,7 +1042,7 @@ void render_hud_attachments() gPipeline.pushRenderTypeMask(); // turn off everything - gPipeline.andRenderTypeMask(LLPipeline::END_RENDER_TYPES); + gPipeline.clearAllRenderTypes(); // turn on HUD gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD); // turn on HUD particles diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index de72d79043..cd4c7289a7 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -471,19 +471,29 @@ void LLPipeline::init() LLViewerStats::getInstance()->mTrianglesDrawnStat.reset(); resetFrameStats(); - for (U32 i = 0; i < NUM_RENDER_TYPES; ++i) + if (gSavedSettings.getBOOL("DisableAllRenderFeatures")) { - mRenderTypeEnabled[i] = TRUE; //all rendering types start enabled + mRenderDebugFeatureMask = 0x0; + } + else + { + mRenderDebugFeatureMask = 0xffffffff; // By default, all debugging features on } - - mRenderDebugFeatureMask = 0xffffffff; // All debugging features on mRenderDebugMask = 0; // All debug starts off - // Don't turn on ground when this is set - // Mac Books with intel 950s need this - if(!gSavedSettings.getBOOL("RenderGround")) + if (gSavedSettings.getBOOL("DisableAllRenderTypes")) { - toggleRenderType(RENDER_TYPE_GROUND); + clearAllRenderTypes(); + } + else + { + setAllRenderTypes(); // By default, all rendering types start enabled + // Don't turn on ground when this is set + // Mac Books with intel 950s need this + if(!gSavedSettings.getBOOL("RenderGround")) + { + toggleRenderType(RENDER_TYPE_GROUND); + } } // make sure RenderPerformanceTest persists (hackity hack hack) @@ -9945,6 +9955,22 @@ void LLPipeline::clearRenderTypeMask(U32 type, ...) } } +void LLPipeline::setAllRenderTypes() +{ + for (U32 i = 0; i < NUM_RENDER_TYPES; ++i) + { + mRenderTypeEnabled[i] = TRUE; + } +} + +void LLPipeline::clearAllRenderTypes() +{ + for (U32 i = 0; i < NUM_RENDER_TYPES; ++i) + { + mRenderTypeEnabled[i] = FALSE; + } +} + void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color) { DebugBlip blip(position, color); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 6ae482fa06..3536746eb1 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -311,9 +311,12 @@ public: BOOL hasAnyRenderType(const U32 type, ...) const; void setRenderTypeMask(U32 type, ...); - void orRenderTypeMask(U32 type, ...); + // This is equivalent to 'setRenderTypeMask' + //void orRenderTypeMask(U32 type, ...); void andRenderTypeMask(U32 type, ...); void clearRenderTypeMask(U32 type, ...); + void setAllRenderTypes(); + void clearAllRenderTypes(); void pushRenderTypeMask(); void popRenderTypeMask(); -- cgit v1.2.3 From a589bc99701d6258d3dd467a5d36fb989348a758 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Wed, 11 Jul 2012 00:30:04 +0000 Subject: Added LLPipeline eventhost API. Added ForcePeriodicRenderingTime setting. --- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 11 ++ indra/newview/llappviewer.cpp | 47 ++++--- indra/newview/llappviewer.h | 2 - indra/newview/llpipelinelistener.cpp | 216 ++++++++++++++++++++++++++++++++ indra/newview/llpipelinelistener.h | 41 ++++++ indra/newview/llviewermenu.h | 5 + indra/newview/pipeline.cpp | 25 +++- indra/newview/pipeline.h | 10 +- 9 files changed, 337 insertions(+), 22 deletions(-) create mode 100644 indra/newview/llpipelinelistener.cpp create mode 100644 indra/newview/llpipelinelistener.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 9783601696..5a1055319a 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -418,6 +418,7 @@ set(viewer_SOURCE_FILES llpatchvertexarray.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp + llpipelinelistener.cpp llplacesinventorybridge.cpp llplacesinventorypanel.cpp llpopupview.cpp @@ -967,6 +968,7 @@ set(viewer_HEADER_FILES llpatchvertexarray.h llphysicsmotion.h llphysicsshapebuilderutil.h + llpipelinelistener.h llplacesinventorybridge.h llplacesinventorypanel.h llpolymesh.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index dde423f86c..8c82b761bb 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13043,6 +13043,17 @@ Value -1.0 + ForcePeriodicRenderingTime + + Comment + Periodically enable all rendering masks for a single frame. + Persist + 1 + Type + F32 + Value + -1.0 + ZoomDirect Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f01f62c798..f5dce58758 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -631,8 +631,6 @@ LLAppViewer::LLAppViewer() : mForceGraphicsDetail(false), mQuitRequested(false), mLogoutRequestSent(false), - mYieldTime(-1), - mMinFrameTime(-1.0), mMainloopTimeout(NULL), mAgentRegionLastAlive(false), mRandomizeFramerate(LLCachedControl(gSavedSettings,"Randomize Framerate", FALSE)), @@ -1200,7 +1198,7 @@ bool LLAppViewer::mainLoop() LLVoiceChannel::initClass(); LLVoiceClient::getInstance()->init(gServicePump); LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLCallFloater::sOnCurrentChannelChanged, _1), true); - LLTimer frameTimer,idleTimer; + LLTimer frameTimer,idleTimer,periodicRenderingTimer; LLTimer debugTime; LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); joystick->setNeedsReset(true); @@ -1212,6 +1210,8 @@ bool LLAppViewer::mainLoop() // point of posting. LLSD newFrame; + BOOL restore_rendering_masks = FALSE; + //LLPrivateMemoryPoolTester::getInstance()->run(false) ; //LLPrivateMemoryPoolTester::getInstance()->run(true) ; //LLPrivateMemoryPoolTester::destroy() ; @@ -1229,6 +1229,28 @@ bool LLAppViewer::mainLoop() try { + // Check if we need to restore rendering masks. + if (restore_rendering_masks) + { + gPipeline.popRenderDebugFeatureMask(); + gPipeline.popRenderTypeMask(); + } + // Check if we need to temporarily enable rendering. + F32 periodic_rendering = gSavedSettings.getF32("ForcePeriodicRenderingTime"); + if (periodic_rendering > F_APPROXIMATELY_ZERO && periodicRenderingTimer.getElapsedTimeF64() > periodic_rendering) + { + periodicRenderingTimer.reset(); + restore_rendering_masks = TRUE; + gPipeline.pushRenderTypeMask(); + gPipeline.pushRenderDebugFeatureMask(); + gPipeline.setAllRenderTypes(); + gPipeline.setAllRenderDebugFeatures(); + } + else + { + restore_rendering_masks = FALSE; + } + pingMainloopTimeout("Main:MiscNativeWindowEvents"); if (gViewerWindow) @@ -1351,10 +1373,11 @@ bool LLAppViewer::mainLoop() LLFastTimer t2(FTM_SLEEP); // yield some time to the os based on command line option - if(mYieldTime >= 0) + S32 yield_time = gSavedSettings.getS32("YieldTime"); + if(yield_time >= 0) { LLFastTimer t(FTM_YIELD); - ms_sleep(mYieldTime); + ms_sleep(yield_time); } // yield cooperatively when not running as foreground window @@ -1468,10 +1491,12 @@ bool LLAppViewer::mainLoop() } // Limit FPS - if (mMinFrameTime > F_APPROXIMATELY_ZERO) + F32 max_fps = gSavedSettings.getF32("MaxFPS"); + if (max_fps > F_APPROXIMATELY_ZERO) { // Sleep a while to limit frame rate. - S32 milliseconds_to_sleep = llclamp((S32)((mMinFrameTime - frameTimer.getElapsedTimeF64()) * 1000.f), 0, 1000); + F32 min_frame_time = 1.f / max_fps; + S32 milliseconds_to_sleep = llclamp((S32)((min_frame_time - frameTimer.getElapsedTimeF64()) * 1000.f), 0, 1000); if (milliseconds_to_sleep > 0) { LLFastTimer t(FTM_YIELD); @@ -2590,14 +2615,6 @@ bool LLAppViewer::initConfiguration() } } - mYieldTime = gSavedSettings.getS32("YieldTime"); - mMinFrameTime = -1.0f; - F32 max_fps = gSavedSettings.getF32("MaxFPS"); - if (max_fps > F_APPROXIMATELY_ZERO) - { - mMinFrameTime = 1.0f / max_fps; - } - // Read skin/branding settings if specified. //if (! gDirUtilp->getSkinDir().empty() ) //{ diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index f55954234f..043893020b 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -253,8 +253,6 @@ private: bool mQuitRequested; // User wants to quit, may have modified documents open. bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. - S32 mYieldTime; - F32 mMinFrameTime; struct SettingsFiles* mSettingsLocationList; LLWatchdogTimeout* mMainloopTimeout; diff --git a/indra/newview/llpipelinelistener.cpp b/indra/newview/llpipelinelistener.cpp new file mode 100644 index 0000000000..20759239bf --- /dev/null +++ b/indra/newview/llpipelinelistener.cpp @@ -0,0 +1,216 @@ +/** + * @file llpipelinelistener.h + * @author Don Kjer + * @date 2012-07-09 + * @brief Implementation for LLPipelineListener + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" + +#include "llpipelinelistener.h" + +#include "pipeline.h" +#include "stringize.h" +#include +#include "llviewermenu.h" + + +namespace { + // Render Types + void toggle_render_types_wrapper(LLSD const& request) + { + for (LLSD::array_const_iterator iter = request["types"].beginArray(); + iter != request["types"].endArray(); + ++iter) + { + U32 render_type = render_type_from_string( iter->asString() ); + if ( render_type != 0 ) + { + LLPipeline::toggleRenderTypeControl( (void*) render_type ); + } + } + } + + void has_render_type_wrapper(LLSD const& request) + { + LLEventAPI::Response response(LLSD(), request); + U32 render_type = render_type_from_string( request["type"].asString() ); + if ( render_type != 0 ) + { + response["value"] = LLPipeline::hasRenderTypeControl( (void*) render_type ); + } + else + { + response.error(STRINGIZE("unknown type '" << request["type"].asString() << "'")); + } + } + + void disable_all_render_types_wrapper(LLSD const& request) + { + gPipeline.clearAllRenderTypes(); + } + + void enable_all_render_types_wrapper(LLSD const& request) + { + gPipeline.setAllRenderTypes(); + } + + // Render Features + void toggle_render_features_wrapper(LLSD const& request) + { + for (LLSD::array_const_iterator iter = request["features"].beginArray(); + iter != request["features"].endArray(); + ++iter) + { + U32 render_feature = feature_from_string( iter->asString() ); + if ( render_feature != 0 ) + { + LLPipeline::toggleRenderDebugControl( (void*) render_feature ); + } + } + } + + void has_render_feature_wrapper(LLSD const& request) + { + LLEventAPI::Response response(LLSD(), request); + U32 render_feature = feature_from_string( request["feature"].asString() ); + if ( render_feature != 0 ) + { + response["value"] = gPipeline.hasRenderDebugFeatureMask(render_feature); + } + else + { + response.error(STRINGIZE("unknown feature '" << request["feature"].asString() << "'")); + } + } + + void disable_all_render_features_wrapper(LLSD const& request) + { + gPipeline.clearAllRenderDebugFeatures(); + } + + void enable_all_render_features_wrapper(LLSD const& request) + { + gPipeline.setAllRenderDebugFeatures(); + } + + // Render Info Displays + void toggle_info_displays_wrapper(LLSD const& request) + { + for (LLSD::array_const_iterator iter = request["displays"].beginArray(); + iter != request["displays"].endArray(); + ++iter) + { + U32 info_display = info_display_from_string( iter->asString() ); + if ( info_display != 0 ) + { + LLPipeline::toggleRenderDebug( (void*) info_display ); + } + } + } + + void has_info_display_wrapper(LLSD const& request) + { + LLEventAPI::Response response(LLSD(), request); + U32 info_display = info_display_from_string( request["display"].asString() ); + if ( info_display != 0 ) + { + response["value"] = gPipeline.hasRenderDebugMask(info_display); + } + else + { + response.error(STRINGIZE("unknown display '" << request["display"].asString() << "'")); + } + } + + void disable_all_info_displays_wrapper(LLSD const& request) + { + gPipeline.clearAllRenderDebugDisplays(); + } + + void enable_all_info_displays_wrapper(LLSD const& request) + { + gPipeline.setAllRenderDebugDisplays(); + } + +} + + +LLPipelineListener::LLPipelineListener(): + LLEventAPI("LLPipeline", + "API to te rendering pipeline.") +{ + // Render Types + add("toggleRenderTypes", + "Toggle rendering [\"types\"]:\n" + "See: llviewermenu.cpp:render_type_from_string for list of available types.", + &toggle_render_types_wrapper); + add("hasRenderType", + "Check if rendering [\"type\"] is enabled:\n" + "See: llviewermenu.cpp:render_type_from_string for list of available types.", + &has_render_type_wrapper, + LLSDMap("reply", LLSD())); + add("disableAllRenderTypes", + "Turn off all rendering types.", + &disable_all_render_types_wrapper); + add("enableAllRenderTypes", + "Turn on all rendering types.", + &enable_all_render_types_wrapper); + + // Render Features + add("toggleRenderFeatures", + "Toggle rendering [\"features\"]:\n" + "See: llviewermenu.cpp:feature_from_string for list of available features.", + &toggle_render_features_wrapper); + add("hasRenderFeature", + "Check if rendering [\"feature\"] is enabled:\n" + "See: llviewermenu.cpp:render_feature_from_string for list of available features.", + &has_render_feature_wrapper, + LLSDMap("reply", LLSD())); + add("disableAllRenderFeatures", + "Turn off all rendering features.", + &disable_all_render_features_wrapper); + add("enableAllRenderFeatures", + "Turn on all rendering features.", + &enable_all_render_features_wrapper); + + // Render Info Displays + add("toggleRenderInfoDisplays", + "Toggle info [\"displays\"]:\n" + "See: llviewermenu.cpp:info_display_from_string for list of available displays.", + &toggle_info_displays_wrapper); + add("hasRenderInfoDisplay", + "Check if info [\"display\"] is enabled:\n" + "See: llviewermenu.cpp:info_display_from_string for list of available displays.", + &has_info_display_wrapper, + LLSDMap("reply", LLSD())); + add("disableAllRenderInfoDisplays", + "Turn off all info displays.", + &disable_all_info_displays_wrapper); + add("enableAllRenderInfoDisplays", + "Turn on all info displays.", + &enable_all_info_displays_wrapper); +} + diff --git a/indra/newview/llpipelinelistener.h b/indra/newview/llpipelinelistener.h new file mode 100644 index 0000000000..da1898e57b --- /dev/null +++ b/indra/newview/llpipelinelistener.h @@ -0,0 +1,41 @@ +/** + * @file llpipelinelistener.h + * @author Don Kjer + * @date 2012-07-09 + * @brief Wrap subset of LLPipeline API in event API + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLPIPELINELISTENER_H) +#define LL_LLPIPELINELISTENER_H + +#include "lleventapi.h" + +/// Listen on an LLEventPump with specified name for LLPipeline request events. +class LLPipelineListener: public LLEventAPI +{ +public: + LLPipelineListener(); +}; + +#endif /* ! defined(LL_LLPIPELINELISTENER_H) */ diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 8c40762865..c809ebde43 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -130,6 +130,11 @@ bool handle_go_to(); // Export to XML or Collada void handle_export_selected( void * ); +// Convert strings to internal types +U32 render_type_from_string(std::string render_type); +U32 feature_from_string(std::string feature); +U32 info_display_from_string(std::string info_display); + class LLViewerMenuHolderGL : public LLMenuHolderGL { public: diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index cd4c7289a7..72cc6bfcd4 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -72,6 +72,7 @@ #include "llhudtext.h" #include "lllightconstants.h" #include "llmeshrepository.h" +#include "llpipelinelistener.h" #include "llresmgr.h" #include "llselectmgr.h" #include "llsky.h" @@ -368,6 +369,8 @@ BOOL LLPipeline::sMemAllocationThrottled = FALSE; S32 LLPipeline::sVisibleLightCount = 0; F32 LLPipeline::sMinRenderSize = 0.f; +// EventHost API LLPipeline listener. +static LLPipelineListener sPipelineListener; static LLCullResult* sCull = NULL; @@ -473,13 +476,13 @@ void LLPipeline::init() if (gSavedSettings.getBOOL("DisableAllRenderFeatures")) { - mRenderDebugFeatureMask = 0x0; + clearAllRenderDebugFeatures(); } else { - mRenderDebugFeatureMask = 0xffffffff; // By default, all debugging features on + setAllRenderDebugFeatures(); // By default, all debugging features on } - mRenderDebugMask = 0; // All debug starts off + clearAllRenderDebugDisplays(); // All debug displays off if (gSavedSettings.getBOOL("DisableAllRenderTypes")) { @@ -6008,6 +6011,22 @@ void LLPipeline::setRenderDebugFeatureControl(U32 bit, bool value) } } +void LLPipeline::pushRenderDebugFeatureMask() +{ + mRenderDebugFeatureStack.push(mRenderDebugFeatureMask); +} + +void LLPipeline::popRenderDebugFeatureMask() +{ + if (mRenderDebugFeatureStack.empty()) + { + llerrs << "Depleted render feature stack." << llendl; + } + + mRenderDebugFeatureMask = mRenderDebugFeatureStack.top(); + mRenderDebugFeatureStack.pop(); +} + // static void LLPipeline::setRenderScriptedBeacons(BOOL val) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 3536746eb1..16610b8c68 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -304,8 +304,10 @@ public: BOOL hasRenderDebugFeatureMask(const U32 mask) const { return (mRenderDebugFeatureMask & mask) ? TRUE : FALSE; } BOOL hasRenderDebugMask(const U32 mask) const { return (mRenderDebugMask & mask) ? TRUE : FALSE; } - - + void setAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0xffffffff; } + void clearAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0x0; } + void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffff; } + void clearAllRenderDebugDisplays() { mRenderDebugMask = 0x0; } BOOL hasRenderType(const U32 type) const; BOOL hasAnyRenderType(const U32 type, ...) const; @@ -321,6 +323,9 @@ public: void pushRenderTypeMask(); void popRenderTypeMask(); + void pushRenderDebugFeatureMask(); + void popRenderDebugFeatureMask(); + static void toggleRenderType(U32 type); // For UI control of render features @@ -609,6 +614,7 @@ protected: U32 mRenderDebugFeatureMask; U32 mRenderDebugMask; + std::stack mRenderDebugFeatureStack; U32 mOldRenderDebugMask; -- cgit v1.2.3 From 64ad1aba304c50173195e15477c1882c5b6e7d37 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 11 Jul 2012 18:30:39 -0400 Subject: SH-3258 WIP initial work: refactoring appearance editing mode Added flags for appearance editing status as well as which textures we should be using at a time. Also refactored so we are not using camera state to track appearance editing mode. Need to add more handling for which textures we actually use. --- indra/newview/llagentcamera.cpp | 36 +++++++++++++-------------------- indra/newview/llmorphview.cpp | 2 -- indra/newview/llsidepanelappearance.cpp | 32 +++++++++++------------------ indra/newview/llvoavatar.cpp | 12 +++-------- indra/newview/llvoavatar.h | 2 ++ indra/newview/llvoavatarself.cpp | 29 +++++++++++++++++++++----- indra/newview/llvoavatarself.h | 4 ++-- 7 files changed, 57 insertions(+), 60 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 751b73e1eb..a544909e66 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -2251,7 +2251,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToCustomizeAvatar() { - if (LLViewerJoystick::getInstance()->getOverrideCamera()) + if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid()) { return; } @@ -2275,29 +2275,21 @@ void LLAgentCamera::changeCameraToCustomizeAvatar() gFocusMgr.setKeyboardFocus( NULL ); gFocusMgr.setMouseCapture( NULL ); - LLVOAvatarSelf::onCustomizeStart(); - - if (isAgentAvatarValid()) - { - // Remove any pitch or rotation from the avatar - LLVector3 at = gAgent.getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - - gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); - gAgent.setCustomAnim(TRUE); - gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); - LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); + // Remove any pitch or rotation from the avatar + LLVector3 at = gAgent.getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); - if (turn_motion) - { - // delay camera animation long enough to play through turn animation - setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); - } + gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); + gAgent.setCustomAnim(TRUE); + gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); + LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); - gAgentAvatarp->invalidateAll(); - gAgentAvatarp->updateMeshTextures(); + if (turn_motion) + { + // delay camera animation long enough to play through turn animation + setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); } } diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index eaa044cb59..252d1b78ea 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -99,8 +99,6 @@ void LLMorphView::initialize() //----------------------------------------------------------------------------- void LLMorphView::shutdown() { - LLVOAvatarSelf::onCustomizeEnd(); - if (isAgentAvatarValid()) { gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 853656905c..9267444534 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -206,12 +206,9 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) } // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar // when editing its physics. - const BOOL disable_camera_motion = LLWearableType::getDisableCameraSwitch(wearable_ptr->getType()); - if (!gAgentCamera.cameraCustomizeAvatar() && - !disable_camera_motion && - gSavedSettings.getBOOL("AppearanceCameraMovement")) + if (!gAgentCamera.cameraCustomizeAvatar()) { - gAgentCamera.changeCameraToCustomizeAvatar(); + LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); } if (is_wearable_edit_visible) { @@ -283,7 +280,7 @@ void LLSidepanelAppearance::onEditAppearanceButtonClicked() { if (gAgentWearables.areWearablesLoaded()) { - gAgentCamera.changeCameraToCustomizeAvatar(); + LLVOAvatarSelf::onCustomizeStart(); } } @@ -371,15 +368,14 @@ void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_cam if (visible) { mOutfitEdit->onOpen(LLSD()); - if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") ) - { - gAgentCamera.changeCameraToCustomizeAvatar(); - } + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); } - else if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") ) + else { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + } } } @@ -405,10 +401,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we if (visible) { - if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") ) - { - gAgentCamera.changeCameraToCustomizeAvatar(); - } + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); mEditWearable->setWearable(wearable, disable_camera_switch); mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency } @@ -416,10 +409,9 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we { // Save changes if closing. mEditWearable->saveChanges(); - if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") ) + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); } } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d48d79f807..6bcb0c6882 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -692,8 +692,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLoadedCallbacksPaused(FALSE), mHasPelvisOffset( FALSE ), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar")), - mLastRezzedStatus(-1) - + mLastRezzedStatus(-1), + mIsEditingAppearance(FALSE), + mUseLocalAppearance(FALSE) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune @@ -7336,13 +7337,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mMeshTexturesDirty = TRUE; gPipeline.markGLRebuild(this); - // ! BACKWARDS COMPATIBILITY ! - // Non-self avatars will no longer have component textures - if (!isSelf()) - { - releaseComponentTextures(); - } - // parse visual params S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 6fb56a4c0b..3ad13d2edb 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -702,6 +702,8 @@ private: BOOL mAppearanceAnimating; LLFrameTimer mAppearanceMorphTimer; F32 mLastAppearanceBlendTime; + BOOL mIsEditingAppearance; + BOOL mUseLocalAppearance; //-------------------------------------------------------------------- // Clothing colors (convenience functions to access visual parameters) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index ecc616fa67..5355651692 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2705,19 +2705,38 @@ LLTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const // static -void LLVOAvatarSelf::onCustomizeStart() +void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) { - // We're no longer doing any baking or invalidating on entering - // appearance editing mode. Leaving function in place in case - // further changes require us to do something at this point - Nyx + if (isAgentAvatarValid()) + { + gAgentAvatarp->mIsEditingAppearance = true; + gAgentAvatarp->mUseLocalAppearance = true; + + if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch) + { + gAgentCamera.changeCameraToCustomizeAvatar(); + } + + gAgentAvatarp->invalidateAll(); + gAgentAvatarp->updateMeshTextures(); + } } // static -void LLVOAvatarSelf::onCustomizeEnd() +void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) { + gAgentAvatarp->mIsEditingAppearance = false; if (isAgentAvatarValid()) { gAgentAvatarp->invalidateAll(); + + if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } + + LLAppearanceMgr::instance().updateAppearanceFromCOF(); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 543891ca63..5354f18679 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -330,8 +330,8 @@ private: **/ public: - static void onCustomizeStart(); - static void onCustomizeEnd(); + static void onCustomizeStart(bool disable_camera_switch = false); + static void onCustomizeEnd(bool disable_camera_switch = false); //-------------------------------------------------------------------- // Visibility -- cgit v1.2.3 From f0e34ebcd61ee998efa681a211545a7335d60c97 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Wed, 11 Jul 2012 23:58:11 +0000 Subject: Adding --skip-gridargs argument to secondlife wrapper script on linux. --- indra/newview/linux_tools/wrapper.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 20936c6460..fa9ce703a8 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -117,18 +117,32 @@ export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}" # Simply embedding $( Date: Thu, 12 Jul 2012 11:09:27 -0400 Subject: SH-3267 WIP --- indra/newview/llappearancemgr.cpp | 13 +++++++++++++ indra/newview/llappearancemgr.h | 1 + 2 files changed, 14 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 480a8e0d73..04c4220afd 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -925,6 +925,18 @@ const LLUUID LLAppearanceMgr::getCOF() const return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); } +S32 LLAppearanceMgr::getCOFVersion() const +{ + LLViewerInventoryCategory *cof = gInventory.getCategory(getCOF()); + if (cof) + { + return cof->getVersion(); + } + else + { + return LLViewerInventoryCategory::VERSION_UNKNOWN; + } +} const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink() { @@ -2611,6 +2623,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate() if (!url.empty()) { LLSD body; + body["cof_version"] = getCOFVersion(); LLHTTPClient::post(url, body, new RequestAgentUpdateAppearanceResponder); } else diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 46457f1dce..954820c154 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -93,6 +93,7 @@ public: // Find the Current Outfit folder. const LLUUID getCOF() const; + S32 getCOFVersion() const; // Finds the folder link to the currently worn outfit const LLViewerInventoryItem *getBaseOutfitLink(); -- cgit v1.2.3 From 27c7b259b417d5843422e8bd4e8e480a186e44f4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 12 Jul 2012 18:24:23 -0400 Subject: SH-3267 WIP --- indra/newview/llappearancemgr.cpp | 8 ++++++-- indra/newview/llappearancemgr.h | 2 ++ indra/newview/llvoavatar.cpp | 20 +++++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 04c4220afd..eb31358000 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2623,8 +2623,11 @@ void LLAppearanceMgr::requestServerAppearanceUpdate() if (!url.empty()) { LLSD body; - body["cof_version"] = getCOFVersion(); + S32 cof_version = getCOFVersion(); + body["cof_version"] = cof_version; LLHTTPClient::post(url, body, new RequestAgentUpdateAppearanceResponder); + llassert(cof_version >= mLastUpdateRequestCOFVersion); + mLastUpdateRequestCOFVersion = cof_version; } else { @@ -2842,7 +2845,8 @@ LLAppearanceMgr::LLAppearanceMgr(): mAttachmentInvLinkEnabled(false), mOutfitIsDirty(false), mOutfitLocked(false), - mIsInUpdateAppearanceFromCOF(false) + mIsInUpdateAppearanceFromCOF(false), + mLastUpdateRequestCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 954820c154..45291419c7 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -95,6 +95,8 @@ public: const LLUUID getCOF() const; S32 getCOFVersion() const; + S32 mLastUpdateRequestCOFVersion; + // Finds the folder link to the currently worn outfit const LLViewerInventoryItem *getBaseOutfitLink(); bool getBaseOutfitName(std::string &name); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6bcb0c6882..f85b59b8c6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7309,9 +7309,27 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); - unpackTEMessage(mesgsys, _PREHASH_ObjectData, FALSE); + LLTEContents tec; + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, FALSE, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); + // Check for stale update. + if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + { + // Extract COF Version field hacked into local texture id. + LLUUID texture_id = ((LLUUID*)tec.image_data)[0]; + S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + S32 *s_words = (S32*) texture_id.mData; + S32 this_update_cof_version = s_words[0]; + if (this_update_cof_version < last_update_request_cof_version) + { + llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version + << ", got " << this_update_cof_version << llendl; + return; + } + } + unpackParsedTEMessage(tec); + // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) { -- cgit v1.2.3 From 5a473a42a63d3277c65bb3bc96e49f020508cfe8 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 13 Jul 2012 02:54:48 +0000 Subject: Remove MaxFPS limit during login, teleports, and logout. --- indra/newview/llappviewer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f5dce58758..8210a41a78 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1492,7 +1492,12 @@ bool LLAppViewer::mainLoop() // Limit FPS F32 max_fps = gSavedSettings.getF32("MaxFPS"); - if (max_fps > F_APPROXIMATELY_ZERO) + // Only limit FPS when we are actually rendering something. Otherwise + // logins, logouts and teleports take much longer to complete. + if (max_fps > F_APPROXIMATELY_ZERO && + LLStartUp::getStartupState() == STATE_STARTED && + !gTeleportDisplay && + !logoutRequestSent()) { // Sleep a while to limit frame rate. F32 min_frame_time = 1.f / max_fps; -- cgit v1.2.3 From 409be9dcc4e372385f0fb0de274a4b17913bd124 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 13 Jul 2012 16:59:57 -0400 Subject: SH-3267 WIP - extract cof version from avatar appearance message, use to reject stale updates --- indra/newview/llappearancemgr.cpp | 20 +++++++++++--------- indra/newview/llvoavatar.cpp | 8 +++++--- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index eb31358000..e27a21f7fd 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2619,20 +2619,22 @@ public: void LLAppearanceMgr::requestServerAppearanceUpdate() { - std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance"); - if (!url.empty()) + if (!gAgent.getRegion()) { - LLSD body; - S32 cof_version = getCOFVersion(); - body["cof_version"] = cof_version; - LLHTTPClient::post(url, body, new RequestAgentUpdateAppearanceResponder); - llassert(cof_version >= mLastUpdateRequestCOFVersion); - mLastUpdateRequestCOFVersion = cof_version; + llwarns << "Region not set, cannot request server appearance update" << llendl; } - else + std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance"); + if (url.empty()) { llwarns << "no cap for UpdateAvatarAppearance" << llendl; } + + LLSD body; + S32 cof_version = getCOFVersion(); + body["cof_version"] = cof_version; + LLHTTPClient::post(url, body, new RequestAgentUpdateAppearanceResponder); + llassert(cof_version >= mLastUpdateRequestCOFVersion); + mLastUpdateRequestCOFVersion = cof_version; } class LLShowCreatedOutfit: public LLInventoryCallback diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f85b59b8c6..e686948fa2 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7310,7 +7310,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); LLTEContents tec; - parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, FALSE, tec); + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); // Check for stale update. @@ -7321,14 +7321,16 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; S32 *s_words = (S32*) texture_id.mData; S32 this_update_cof_version = s_words[0]; - if (this_update_cof_version < last_update_request_cof_version) + if ((this_update_cof_version > 0) && + (this_update_cof_version < last_update_request_cof_version)) { llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version << ", got " << this_update_cof_version << llendl; return; } + ((LLUUID*)tec.image_data)[0].setNull(); } - unpackParsedTEMessage(tec); + applyParsedTEMessage(tec); // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) -- cgit v1.2.3 From 3679631887f0acec0b0d180525a56d318692a0e2 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 16 Jul 2012 17:29:01 -0400 Subject: SH-3261 WIP Updated texture switching code Updated texture switching code to use the proper request URL, even if reverting to a "last known good" baked texture UUID. Viewer should now switch to a locally-generated composite on entering appearance mode, and should remain using such until a new appearance message is received. Still to do: handling adjacent regions with varying support for the new system, fixing switch back to server-generated bakes. --- indra/newview/llvoavatar.cpp | 71 ++++++++++++++++++++++------------------ indra/newview/llvoavatar.h | 4 +-- indra/newview/llvoavatarself.cpp | 5 +++ 3 files changed, 46 insertions(+), 34 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6bcb0c6882..9c5998b976 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -688,7 +688,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFullyLoaded(FALSE), mPreviousFullyLoaded(FALSE), mFullyLoadedInitialized(FALSE), - mSupportsAlphaLayers(FALSE), mLoadedCallbacksPaused(FALSE), mHasPelvisOffset( FALSE ), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar")), @@ -2371,15 +2370,10 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) // to redirect certain avatar texture requests to different sims. if (isIndexBakedTexture((ETextureIndex)te)) { - std::string url = gSavedSettings.getString("AgentAppearanceServiceURL"); - if (LLAppearanceMgr::instance().useServerTextureBaking() && !url.empty()) + const std::string url = getImageURL(te,uuid); + if (!url.empty()) { - const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); - if (texture_entry != NULL) - { - url += "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); - return setTETextureCore(te, uuid, url); - } + return setTETextureCore(te, uuid, url); } LLHost target_host = getObjectHost(); @@ -4152,7 +4146,7 @@ void LLVOAvatar::updateVisibility() // private bool LLVOAvatar::shouldAlphaMask() { - const bool should_alpha_mask = mSupportsAlphaLayers && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked + const bool should_alpha_mask = !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked && !LLDrawPoolAvatar::sSkipTransparent; return should_alpha_mask; @@ -4726,6 +4720,20 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) setTE(index, te); } +const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) +{ + std::string url = ""; + if (LLAppearanceMgr::instance().useServerTextureBaking() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + { + const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); + if (texture_entry != NULL) + { + url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + } + } + return url; +} + //----------------------------------------------------------------------------- // resolveHeight() //----------------------------------------------------------------------------- @@ -6658,7 +6666,6 @@ void LLVOAvatar::updateMeshTextures() } } - const BOOL self_customizing = isSelf() && gAgentCamera.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures const BOOL other_culled = !isSelf() && mCulled; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; BOOL paused = FALSE; @@ -6698,36 +6705,39 @@ void LLVOAvatar::updateMeshTextures() { use_lkg_baked_layer[i] = (!is_layer_baked[i] && mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); - if (mBakedTextureDatas[i].mTexLayerSet) - { - mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); - } } } - - // Turn on alpha masking correctly for yourself and other avatars on 1.23+ - mSupportsAlphaLayers = isSelf() || is_layer_baked[BAKED_HAIR]; - - // Baked textures should be requested from the sim this avatar is on. JC - const LLHost target_host = getObjectHost(); - if (!target_host.isOk()) - { - llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; - } for (U32 i=0; i < mBakedTextureDatas.size(); i++) { - if (use_lkg_baked_layer[i] && !self_customizing ) + if (use_lkg_baked_layer[i] && !mUseLocalAppearance ) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + LLViewerFetchedTexture* baked_img; + const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); + if (!url.empty()) + { + baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); + } + else + { + // Baked textures should be requested from the sim this avatar is on. JC + const LLHost target_host = getObjectHost(); + if (!target_host.isOk()) + { + llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; + } + + baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + } + mBakedTextureDatas[i].mIsUsed = TRUE; for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); } } - else if (!self_customizing && is_layer_baked[i]) + else if (!mUseLocalAppearance && is_layer_baked[i]) { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) @@ -6747,8 +6757,7 @@ void LLVOAvatar::updateMeshTextures() src_callback_list, paused ); } } - else if (mBakedTextureDatas[i].mTexLayerSet - && !other_culled) + else if (mBakedTextureDatas[i].mTexLayerSet && mUseLocalAppearance) { mBakedTextureDatas[i].mTexLayerSet->createComposite(); mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE ); @@ -6763,7 +6772,7 @@ void LLVOAvatar::updateMeshTextures() // set texture and color of hair manually if we are not using a baked image. // This can happen while loading hair for yourself, or for clients that did not // bake a hair texture. Still needed for yourself after 1.22 is depricated. - if (!is_layer_baked[BAKED_HAIR] || self_customizing) + if (!is_layer_baked[BAKED_HAIR] || mIsEditingAppearance) { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 3ad13d2edb..2b999891f9 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -217,9 +217,6 @@ public: private: //aligned members LLVector4a mImpostorExtents[2]; -private: - BOOL mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients - //-------------------------------------------------------------------- // Updates //-------------------------------------------------------------------- @@ -603,6 +600,7 @@ protected: private: virtual void setImage(const U8 te, LLViewerTexture *imagep, const U32 index); virtual LLViewerTexture* getImage(const U8 te, const U32 index) const; + const std::string getImageURL(const U8 te, const LLUUID &uuid); virtual const LLTextureEntry* getTexEntry(const U8 te_num) const; virtual void setTexEntry(const U8 index, const LLTextureEntry &te); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 5355651692..e715a0d2f1 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2726,6 +2726,11 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) { gAgentAvatarp->mIsEditingAppearance = false; + if (!LLAppearanceMgr::instance().useServerTextureBaking()) + { + gAgentAvatarp->mUseLocalAppearance = false; + } + if (isAgentAvatarValid()) { gAgentAvatarp->invalidateAll(); -- cgit v1.2.3 From d2801da16f9ce6addf6d34b3532a574e24f5d9be Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 17 Jul 2012 14:34:35 -0400 Subject: SH-3258 WIP revert to server-generated textures After exiting appearance mode, next server-generated appearance message should over-ride the locally-generated textures. --- indra/newview/llvoavatar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 236cc1b089..d953a4b99e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4581,6 +4581,7 @@ void LLVOAvatar::updateTextures() if (isIndexBakedTexture((ETextureIndex)texture_index) && imagep->getID() != IMG_DEFAULT_AVATAR && imagep->getID() != IMG_INVISIBLE + && !LLAppearanceMgr::instance().useServerTextureBaking() && !imagep->getTargetHost().isOk()) { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " @@ -7363,7 +7364,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } setCompositeUpdatesEnabled( FALSE ); - mMeshTexturesDirty = TRUE; gPipeline.markGLRebuild(this); // parse visual params @@ -7475,6 +7475,13 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // If all of the avatars are completely baked, release the global image caches to conserve memory. LLVOAvatar::cullAvatarsByPixelArea(); + if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + { + mUseLocalAppearance = false; + } + + updateMeshTextures(); + // llinfos << "processAvatarAppearance end " << mID << llendl; } -- cgit v1.2.3 From 020980fb4cd5f2cc18b56fa795c08c153a15bd4a Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 25 Jul 2012 15:22:13 -0400 Subject: SH-3258 WIP Adding new switching of new vs old appearance based on appearance message Not all appearance messages on a region will be new or old style at all times. Thus we're using a specific flag to mark the new appearance messages. --- indra/newview/llvoavatar.cpp | 41 ++++++++++++++++++++++++++++------------- indra/newview/llvoavatar.h | 1 + 2 files changed, 29 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d953a4b99e..45c7a59b24 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -192,6 +192,8 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; +const S32 SERVER_GENERATED_APPEARANCE = 359949045; + const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); enum ERenderName @@ -693,7 +695,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar")), mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), - mUseLocalAppearance(FALSE) + mUseLocalAppearance(FALSE), + mUseServerBakes(TRUE) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune @@ -4581,7 +4584,7 @@ void LLVOAvatar::updateTextures() if (isIndexBakedTexture((ETextureIndex)texture_index) && imagep->getID() != IMG_DEFAULT_AVATAR && imagep->getID() != IMG_INVISIBLE - && !LLAppearanceMgr::instance().useServerTextureBaking() + && !mUseServerBakes && !imagep->getTargetHost().isOk()) { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " @@ -4676,10 +4679,10 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel //the texture pipeline will stop fetching this texture. imagep->resetTextureStats(); - if (!LLAppearanceMgr::instance().useServerTextureBaking()) - { - imagep->setCanUseHTTP(false); //turn off http fetching for baked textures. - } + // TODO: currently default to HTTP texture and fall back to UDP if cannot be found there. + // Once server messaging is in place, we should call setCanUseHTTP(false) for old style + // appearance requests + imagep->setCanUseHTTP(true); imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->resetMaxVirtualSizeResetCounter() ; @@ -4730,6 +4733,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) if (texture_entry != NULL) { url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + //llinfos << "baked texture url: " << url << llendl; } } return url; @@ -7323,14 +7327,25 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); + // Extract COF Version field hacked into local texture id. + LLUUID flags_id = ((LLUUID*)tec.image_data)[0]; + S32 this_update_cof_version = (flags_id.mData[0] << 24) + (flags_id.mData[1] << 16) +(flags_id.mData[2] << 8) +flags_id.mData[3]; + S32 message_type = (flags_id.mData[4] << 24) + (flags_id.mData[5] << 16) +(flags_id.mData[6] << 8) +flags_id.mData[7]; + + if (message_type == SERVER_GENERATED_APPEARANCE) + { + mUseServerBakes = true; + } + else + { + mUseServerBakes = false; + } + + S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + // Check for stale update. - if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + if (isSelf() && mUseServerBakes) { - // Extract COF Version field hacked into local texture id. - LLUUID texture_id = ((LLUUID*)tec.image_data)[0]; - S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; - S32 *s_words = (S32*) texture_id.mData; - S32 this_update_cof_version = s_words[0]; if ((this_update_cof_version > 0) && (this_update_cof_version < last_update_request_cof_version)) { @@ -7475,7 +7490,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // If all of the avatars are completely baked, release the global image caches to conserve memory. LLVOAvatar::cullAvatarsByPixelArea(); - if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + if (isSelf()) { mUseLocalAppearance = false; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2b999891f9..4283c0e017 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -702,6 +702,7 @@ private: F32 mLastAppearanceBlendTime; BOOL mIsEditingAppearance; BOOL mUseLocalAppearance; + BOOL mUseServerBakes; //-------------------------------------------------------------------- // Clothing colors (convenience functions to access visual parameters) -- cgit v1.2.3 From dfce4c451c0b12f5836db1af0c26bffc316837fa Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 2 Aug 2012 22:54:01 +0000 Subject: Added AppearanceData block to AvatarAppearance message --- indra/newview/llvoavatar.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b7bb4e6b47..0d85666d88 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -192,8 +192,6 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; -const S32 SERVER_GENERATED_APPEARANCE = 359949045; - const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); enum ERenderName @@ -7355,12 +7353,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); - // Extract COF Version field hacked into local texture id. - LLUUID flags_id = ((LLUUID*)tec.image_data)[0]; - S32 this_update_cof_version = (flags_id.mData[0] << 24) + (flags_id.mData[1] << 16) +(flags_id.mData[2] << 8) +flags_id.mData[3]; - S32 message_type = (flags_id.mData[4] << 24) + (flags_id.mData[5] << 16) +(flags_id.mData[6] << 8) +flags_id.mData[7]; + U8 appearance_version = 0; + S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN; + S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + // For future use: + //U32 appearance_flags = 0; + + if (mesgsys->has(_PREHASH_AppearanceData)) + { + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, appearance_version, 0); + mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, this_update_cof_version, 0); + // For future use: + //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); + } - if (message_type == SERVER_GENERATED_APPEARANCE) + if (appearance_version > 0) { mUseServerBakes = true; } @@ -7369,19 +7376,14 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mUseServerBakes = false; } - S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; - // Check for stale update. - if (isSelf() && mUseServerBakes) + if (mUseServerBakes && isSelf() + && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL + && this_update_cof_version < last_update_request_cof_version) { - if ((this_update_cof_version > 0) && - (this_update_cof_version < last_update_request_cof_version)) - { - llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version - << ", got " << this_update_cof_version << llendl; - return; - } - ((LLUUID*)tec.image_data)[0].setNull(); + llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version + << ", got " << this_update_cof_version << llendl; + return; } applyParsedTEMessage(tec); -- cgit v1.2.3 From 225ac5c487548ba7e62f3e15f1b941baba3a433c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 3 Aug 2012 17:49:03 -0400 Subject: Added viewer param for appearance message version --- indra/newview/character/avatar_lad.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) mode change 100644 => 100755 indra/newview/character/avatar_lad.xml (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml old mode 100644 new mode 100755 index 99dbfcae51..2b090c4fa4 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -12291,6 +12291,17 @@ render_pass="bump"> + + + + -- cgit v1.2.3 From e7a63cb356d49925131edfadb5a0e8d5368a9096 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 14 Aug 2012 17:12:01 -0400 Subject: SH-3310 WIP setting up architecture for switching texture baking on per-region basis Set up an architecture to minimize the use of the baked texture debug setting. Instead concentrating on setting a per-region flag at the region handshake point. This should be processed once the new regions are using the updated handshake. The debug setting is being used in this one location as a placeholder. Builds, but not fully tested/commented yet, passing this work off to Vir. --- indra/newview/llagent.cpp | 2 +- indra/newview/llagentwearables.cpp | 2 +- indra/newview/llappearancemgr.cpp | 10 +--------- indra/newview/llappearancemgr.h | 2 -- indra/newview/llviewerregion.cpp | 12 ++++++++++++ indra/newview/llviewerregion.h | 3 +++ indra/newview/llvoavatar.cpp | 4 ++-- indra/newview/llvoavatar.h | 7 ++++--- indra/newview/llvoavatarself.cpp | 24 ++++++++---------------- indra/newview/llvoavatarself.h | 1 - 10 files changed, 32 insertions(+), 35 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f99065aa08..35280d5b5f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3772,7 +3772,7 @@ void LLAgent::requestLeaveGodMode() //----------------------------------------------------------------------------- void LLAgent::sendAgentSetAppearance() { - if (!isAgentAvatarValid() || LLAppearanceMgr::instance().useServerTextureBaking()) return; + if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingBakedTextures())) { diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 0a721312f3..e44b27c6af 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1597,7 +1597,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n void LLAgentWearables::queryWearableCache() { - if (!areWearablesLoaded() || LLAppearanceMgr::instance().useServerTextureBaking()) + if (!areWearablesLoaded() || (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion())) { return; } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e27a21f7fd..237cc0b9f3 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1743,7 +1743,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) updateIsDirty(); // Send server request for appearance update - if (useServerTextureBaking()) + if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()) { requestServerAppearanceUpdate(); } @@ -2599,14 +2599,6 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base if (inventory_changed) gInventory.notifyObservers(); } -// Should be true iff both the appropriate debug setting is enabled -// and the corresponding cap has been found. -bool LLAppearanceMgr::useServerTextureBaking() -{ - // TODO: add cap check. - return gSavedSettings.getBOOL("UseServerTextureBaking"); -} - class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder { public: diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 45291419c7..742833211a 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -185,8 +185,6 @@ public: bool isInUpdateAppearanceFromCOF() { return mIsInUpdateAppearanceFromCOF; } - bool useServerTextureBaking(); - void requestServerAppearanceUpdate(); protected: diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 777475fe61..18f8e4e101 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1424,6 +1424,18 @@ void LLViewerRegion::unpackRegionHandshake() mProductName = productName; } + + mCentralBakeVersion = (S32)gSavedSettings.getBOOL("UseServerTextureBaking"); + /* + if (msg->getSize("RegionInfo4", "CentralBakesVersion") > 0) + { + msg->getS32("RegionInfo4", "CentralBakesVersion", mCentralBakeVersion); + } + else + { + mCentralBakeVersion = 0; + } + */ LLVLComposition *compp = getComposition(); if (compp) { diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index c483c6ef52..2428f56db4 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -277,6 +277,8 @@ public: F32 getLandHeightRegion(const LLVector3& region_pos); + U8 getCentralBakeVersion() { return mCentralBakeVersion; } + void getInfo(LLSD& info); bool meshRezEnabled() const; @@ -390,6 +392,7 @@ private: F32 mBillableFactor; U32 mMaxTasks; // max prim count F32 mCameraDistanceSquared; // updated once per frame + U8 mCentralBakeVersion; // Information for Homestead / CR-53 S32 mClassID; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 45c7a59b24..66674d8c19 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4727,7 +4727,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { std::string url = ""; - if (LLAppearanceMgr::instance().useServerTextureBaking() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) { const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) @@ -7312,7 +7312,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if( isSelf() ) { llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived && !LLAppearanceMgr::instance().useServerTextureBaking()) + if( mFirstTEMessageReceived && !mUseServerBakes) { // llinfos << "processAvatarAppearance end " << mID << llendl; return; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4283c0e017..15f3721c73 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -696,13 +696,14 @@ public: //-------------------------------------------------------------------- public: BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; } + BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode private: BOOL mAppearanceAnimating; LLFrameTimer mAppearanceMorphTimer; F32 mLastAppearanceBlendTime; - BOOL mIsEditingAppearance; - BOOL mUseLocalAppearance; - BOOL mUseServerBakes; + BOOL mIsEditingAppearance; // flag for if we're actively in appearance editing mode + BOOL mUseLocalAppearance; // flag for if we're using a local composite + BOOL mUseServerBakes; // flag for if baked textures should be fetched from baking service (false if they're temporary uploads) //-------------------------------------------------------------------- // Clothing colors (convenience functions to access visual parameters) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e715a0d2f1..c5eb96e740 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -887,7 +887,7 @@ void LLVOAvatarSelf::removeMissingBakedTextures() invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE); } updateMeshTextures(); - if (!LLAppearanceMgr::instance().useServerTextureBaking()) + if (getRegion() && !getRegion()->getCentralBakeVersion()) { requestLayerSetUploads(); } @@ -1633,7 +1633,7 @@ void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_r layerset->requestUpdate(); layerset->invalidateMorphMasks(); - if( upload_result && !LLAppearanceMgr::instance().useServerTextureBaking()) + if( upload_result && (getRegion() && !getRegion()->getCentralBakeVersion())) { llassert(isSelf()); @@ -2616,15 +2616,6 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) } } -BOOL LLVOAvatarSelf::isUsingBakedTextures() const -{ - // Composite textures are used during appearance mode. - if (gAgentCamera.cameraCustomizeAvatar()) - return FALSE; - - return TRUE; -} - void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug) { @@ -2725,14 +2716,15 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) // static void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) { - gAgentAvatarp->mIsEditingAppearance = false; - if (!LLAppearanceMgr::instance().useServerTextureBaking()) - { - gAgentAvatarp->mUseLocalAppearance = false; - } if (isAgentAvatarValid()) { + gAgentAvatarp->mIsEditingAppearance = false; + if (gAgentAvatarp->getRegion() && !gAgentAvatarp->getRegion()->getCentralBakeVersion()) + { + gAgentAvatarp->mUseLocalAppearance = false; + } + gAgentAvatarp->invalidateAll(); if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 5354f18679..c8f8b3791a 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -229,7 +229,6 @@ public: void setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); void forceBakeAllTextures(bool slam_for_debug = false); static void processRebakeAvatarTextures(LLMessageSystem* msg, void**); - BOOL isUsingBakedTextures() const; // e.g. false if in appearance edit mode protected: /*virtual*/ void removeMissingBakedTextures(); -- cgit v1.2.3 From 73dbcc10c5b35e2b55a454e600e86ddd7d24399d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 15 Aug 2012 14:28:05 -0400 Subject: requestServerAppearanceUpdate bails out if corresponding cap is null --- indra/newview/llappearancemgr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3e02f98933..5f1a880ebd 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2619,7 +2619,8 @@ void LLAppearanceMgr::requestServerAppearanceUpdate() std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance"); if (url.empty()) { - llwarns << "no cap for UpdateAvatarAppearance" << llendl; + llwarns << "NO CAP for UpdateAvatarAppearance. This is a bug." << llendl; + return; } LLSD body; -- cgit v1.2.3 From 64d9705ae21c42f4c7869a414e250c5de251b143 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 17 Aug 2012 03:56:38 +0000 Subject: Expanding region flags to 64 bits. Adding region protocol flags --- indra/newview/llestateinfomodel.cpp | 24 ++++--------- indra/newview/llestateinfomodel.h | 25 ++++++++++++-- indra/newview/llfloaterbuyland.cpp | 4 +-- indra/newview/llfloatergodtools.cpp | 34 +++++++++++------- indra/newview/llfloatergodtools.h | 14 ++++---- indra/newview/llfloaterland.cpp | 8 ++--- indra/newview/llfloaterregioninfo.cpp | 24 +++++++++---- indra/newview/llfloaterreporter.cpp | 3 -- indra/newview/lllocationinputctrl.cpp | 4 +-- indra/newview/llpanelland.cpp | 2 +- indra/newview/llpanelplaceprofile.cpp | 4 +-- indra/newview/llpaneltopinfobar.cpp | 4 +-- indra/newview/llregioninfomodel.cpp | 14 ++++++-- indra/newview/llregioninfomodel.h | 2 +- indra/newview/lltoolbrush.cpp | 2 +- indra/newview/lltooldraganddrop.cpp | 2 +- indra/newview/lltoolplacer.cpp | 4 +-- indra/newview/llviewermessage.cpp | 14 ++++++-- indra/newview/llviewerparcelmgr.cpp | 8 ++--- indra/newview/llviewerregion.cpp | 40 +++++++++++---------- indra/newview/llviewerregion.h | 65 ++++++++++++++++++++++++++++------- indra/newview/llworldmap.cpp | 2 +- indra/newview/llworldmap.h | 6 ++-- 23 files changed, 198 insertions(+), 111 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp index 7ed22d68f6..0faa888398 100644 --- a/indra/newview/llestateinfomodel.cpp +++ b/indra/newview/llestateinfomodel.cpp @@ -65,12 +65,12 @@ void LLEstateInfoModel::sendEstateInfo() } } -bool LLEstateInfoModel::getUseFixedSun() const { return mFlags & REGION_FLAGS_SUN_FIXED; } -bool LLEstateInfoModel::getIsExternallyVisible() const { return mFlags & REGION_FLAGS_EXTERNALLY_VISIBLE; } -bool LLEstateInfoModel::getAllowDirectTeleport() const { return mFlags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT; } -bool LLEstateInfoModel::getDenyAnonymous() const { return mFlags & REGION_FLAGS_DENY_ANONYMOUS; } -bool LLEstateInfoModel::getDenyAgeUnverified() const { return mFlags & REGION_FLAGS_DENY_AGEUNVERIFIED; } -bool LLEstateInfoModel::getAllowVoiceChat() const { return mFlags & REGION_FLAGS_ALLOW_VOICE; } +bool LLEstateInfoModel::getUseFixedSun() const { return getFlag(REGION_FLAGS_SUN_FIXED); } +bool LLEstateInfoModel::getIsExternallyVisible() const { return getFlag(REGION_FLAGS_EXTERNALLY_VISIBLE); } +bool LLEstateInfoModel::getAllowDirectTeleport() const { return getFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT); } +bool LLEstateInfoModel::getDenyAnonymous() const { return getFlag(REGION_FLAGS_DENY_ANONYMOUS); } +bool LLEstateInfoModel::getDenyAgeUnverified() const { return getFlag(REGION_FLAGS_DENY_AGEUNVERIFIED); } +bool LLEstateInfoModel::getAllowVoiceChat() const { return getFlag(REGION_FLAGS_ALLOW_VOICE); } void LLEstateInfoModel::setUseFixedSun(bool val) { setFlag(REGION_FLAGS_SUN_FIXED, val); } void LLEstateInfoModel::setIsExternallyVisible(bool val) { setFlag(REGION_FLAGS_EXTERNALLY_VISIBLE, val); } @@ -199,18 +199,6 @@ void LLEstateInfoModel::commitEstateInfoDataserver() gAgent.sendMessage(); } -void LLEstateInfoModel::setFlag(U32 flag, bool val) -{ - if (val) - { - mFlags |= flag; - } - else - { - mFlags &= ~flag; - } -} - std::string LLEstateInfoModel::getInfoDump() { LLSD dump; diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h index 56391eda91..538f2f7c75 100644 --- a/indra/newview/llestateinfomodel.h +++ b/indra/newview/llestateinfomodel.h @@ -85,19 +85,38 @@ protected: private: bool commitEstateInfoCaps(); void commitEstateInfoDataserver(); - U32 getFlags() const { return mFlags; } - void setFlag(U32 flag, bool val); + inline bool getFlag(U64 flag) const; + inline void setFlag(U64 flag, bool val); + U64 getFlags() const { return mFlags; } std::string getInfoDump(); // estate info std::string mName; /// estate name LLUUID mOwnerID; /// estate owner id U32 mID; /// estate id - U32 mFlags; /// estate flags + U64 mFlags; /// estate flags F32 mSunHour; /// estate sun hour update_signal_t mUpdateSignal; /// emitted when we receive update from sim update_signal_t mCommitSignal; /// emitted when our update gets applied to sim }; +inline bool LLEstateInfoModel::getFlag(U64 flag) const +{ + return ((mFlags & flag) != 0); +} + +inline void LLEstateInfoModel::setFlag(U64 flag, bool val) +{ + if (val) + { + mFlags |= flag; + } + else + { + mFlags &= ~flag; + } +} + + #endif // LL_LLESTATEINFOMODEL_H diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 8223e89b64..42857b2aa2 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -538,7 +538,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo() LLTextBox* resellable_clause = getChild("resellable_clause"); if (resellable_clause) { - if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) + if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)) { resellable_clause->setText(getString("can_not_resell")); } @@ -551,7 +551,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo() LLTextBox* changeable_clause = getChild("changeable_clause"); if (changeable_clause) { - if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) + if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { changeable_clause->setText(getString("can_change")); } diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index fb905eae11..aac8f5bfc1 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -164,9 +164,9 @@ LLFloaterGodTools::~LLFloaterGodTools() } -U32 LLFloaterGodTools::computeRegionFlags() const +U64 LLFloaterGodTools::computeRegionFlags() const { - U32 flags = gAgent.getRegion()->getRegionFlags(); + U64 flags = gAgent.getRegion()->getRegionFlags(); if (mPanelRegionTools) flags = mPanelRegionTools->computeRegionFlags(flags); if (mPanelObjectTools) flags = mPanelObjectTools->computeRegionFlags(flags); return flags; @@ -210,7 +210,7 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) if (!msg) return; //const S32 SIM_NAME_BUF = 256; - U32 region_flags; + U64 region_flags; U8 sim_access; U8 agent_limit; std::string sim_name; @@ -231,13 +231,23 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, sim_name); msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, estate_id); msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, parent_estate_id); - msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, region_flags); msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, sim_access); msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, agent_limit); msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, object_bonus_factor); msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, billable_factor); msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height); + if (msg->has(_PREHASH_RegionInfo3)) + { + msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlags, region_flags); + } + else + { + U32 flags = 0; + msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags); + region_flags = flags; + } + if (host != gAgent.getRegionHost()) { // Update is for a different region than the one we're in. @@ -434,7 +444,7 @@ LLPanelRegionTools::~LLPanelRegionTools() // base class will take care of everything } -U32 LLPanelRegionTools::computeRegionFlags(U32 flags) const +U64 LLPanelRegionTools::computeRegionFlags(U64 flags) const { flags &= getRegionFlagsMask(); flags |= getRegionFlags(); @@ -562,9 +572,9 @@ S32 LLPanelRegionTools::getGridPosY() const return getChild("gridposy")->getValue().asInteger(); } -U32 LLPanelRegionTools::getRegionFlags() const +U64 LLPanelRegionTools::getRegionFlags() const { - U32 flags = 0x0; + U64 flags = 0x0; flags = getChild("check prelude")->getValue().asBoolean() ? set_prelude_flags(flags) : unset_prelude_flags(flags); @@ -601,9 +611,9 @@ U32 LLPanelRegionTools::getRegionFlags() const return flags; } -U32 LLPanelRegionTools::getRegionFlagsMask() const +U64 LLPanelRegionTools::getRegionFlagsMask() const { - U32 flags = 0xffffffff; + U64 flags = 0xFFFFFFFFFFFFFFFFULL; flags = getChild("check prelude")->getValue().asBoolean() ? set_prelude_flags(flags) : unset_prelude_flags(flags); @@ -684,7 +694,7 @@ void LLPanelRegionTools::setParentEstateID(U32 id) getChild("parentestate")->setValue((S32)id); } -void LLPanelRegionTools::setCheckFlags(U32 flags) +void LLPanelRegionTools::setCheckFlags(U64 flags) { getChild("check prelude")->setValue(is_prelude(flags) ? TRUE : FALSE); getChild("check fixed sun")->setValue(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE); @@ -943,7 +953,7 @@ void LLPanelObjectTools::refresh() } -U32 LLPanelObjectTools::computeRegionFlags(U32 flags) const +U64 LLPanelObjectTools::computeRegionFlags(U64 flags) const { if (getChild("disable scripts")->getValue().asBoolean()) { @@ -973,7 +983,7 @@ U32 LLPanelObjectTools::computeRegionFlags(U32 flags) const } -void LLPanelObjectTools::setCheckFlags(U32 flags) +void LLPanelObjectTools::setCheckFlags(U64 flags) { getChild("disable scripts")->setValue(flags & REGION_FLAGS_SKIP_SCRIPTS ? TRUE : FALSE); getChild("disable collisions")->setValue(flags & REGION_FLAGS_SKIP_COLLISIONS ? TRUE : FALSE); diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index 1aa8b838fb..cbaeee7051 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -98,7 +98,7 @@ private: ~LLFloaterGodTools(); protected: - U32 computeRegionFlags() const; + U64 computeRegionFlags() const; protected: @@ -147,8 +147,8 @@ public: const std::string getSimName() const; U32 getEstateID() const; U32 getParentEstateID() const; - U32 getRegionFlags() const; - U32 getRegionFlagsMask() const; + U64 getRegionFlags() const; + U64 getRegionFlagsMask() const; F32 getBillableFactor() const; S32 getPricePerMeter() const; S32 getGridPosX() const; @@ -160,7 +160,7 @@ public: void setSimName(const std::string& name); void setEstateID(U32 id); void setParentEstateID(U32 id); - void setCheckFlags(U32 flags); + void setCheckFlags(U64 flags); void setBillableFactor(F32 billable_factor); void setPricePerMeter(S32 price); void setGridPosX(S32 pos); @@ -168,7 +168,7 @@ public: void setRedirectGridX(S32 pos); void setRedirectGridY(S32 pos); - U32 computeRegionFlags(U32 initial_flags) const; + U64 computeRegionFlags(U64 initial_flags) const; void clearAllWidgets(); void enableAllWidgets(); @@ -218,10 +218,10 @@ public: /*virtual*/ void refresh(); void setTargetAvatar(const LLUUID& target_id); - U32 computeRegionFlags(U32 initial_flags) const; + U64 computeRegionFlags(U64 initial_flags) const; void clearAllWidgets(); void enableAllWidgets(); - void setCheckFlags(U32 flags); + void setCheckFlags(U64 flags); void onChangeAnything(); void onApplyChanges(); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 55f3d548ec..ce95d8bacf 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -557,7 +557,7 @@ void LLPanelLandGeneral::refresh() BOOL is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus()); BOOL region_xfer = FALSE; if(regionp - && !(regionp->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)) + && !(regionp->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))) { region_xfer = TRUE; } @@ -2117,7 +2117,7 @@ void LLPanelLandOptions::refreshSearch() LLViewerParcelMgr::isParcelModifiableByAgent( parcel, GP_LAND_CHANGE_IDENTITY) && region - && !(region->getRegionFlags() & REGION_FLAGS_BLOCK_PARCEL_SEARCH); + && !(region->getRegionFlag(REGION_FLAGS_BLOCK_PARCEL_SEARCH)); // There is a bug with this panel whereby the Show Directory bit can be // slammed off by the Region based on an override. Since this data is cached @@ -2866,7 +2866,7 @@ void LLPanelLandCovenant::refresh() LLTextBox* resellable_clause = getChild("resellable_clause"); if (resellable_clause) { - if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) + if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)) { resellable_clause->setText(getString("can_not_resell")); } @@ -2879,7 +2879,7 @@ void LLPanelLandCovenant::refresh() LLTextBox* changeable_clause = getChild("changeable_clause"); if (changeable_clause) { - if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) + if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { changeable_clause->setText(getString("can_change")); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index fe29bb38c7..1d9f519d70 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -318,7 +318,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) // extract message std::string sim_name; std::string sim_type = LLTrans::getString("land_type_unknown"); - U32 region_flags; + U64 region_flags; U8 agent_limit; F32 object_bonus_factor; U8 sim_access; @@ -328,7 +328,6 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) BOOL use_estate_sun; F32 sun_hour; msg->getString("RegionInfo", "SimName", sim_name); - msg->getU32("RegionInfo", "RegionFlags", region_flags); msg->getU8("RegionInfo", "MaxAgents", agent_limit); msg->getF32("RegionInfo", "ObjectBonusFactor", object_bonus_factor); msg->getU8("RegionInfo", "SimAccess", sim_access); @@ -347,6 +346,17 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) LLTrans::findString(sim_type, sim_type); // try localizing sim product name } + if (msg->has(_PREHASH_RegionInfo3)) + { + msg->getU64("RegionInfo", "RegionFlags", region_flags); + } + else + { + U32 flags = 0; + msg->getU32("RegionInfo", "RegionFlags", flags); + region_flags = flags; + } + // GENERAL PANEL panel = tab->getChild("General"); panel->getChild("region_text")->setValue(LLSD(sim_name)); @@ -378,9 +388,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel = tab->getChild("Debug"); panel->getChild("region_text")->setValue(LLSD(sim_name) ); - panel->getChild("disable_scripts_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); - panel->getChild("disable_collisions_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) ); - panel->getChild("disable_physics_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) ); + panel->getChild("disable_scripts_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_SCRIPTS) ? TRUE : FALSE )) ); + panel->getChild("disable_collisions_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_COLLISIONS) ? TRUE : FALSE )) ); + panel->getChild("disable_physics_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_PHYSICS) ? TRUE : FALSE )) ); panel->setCtrlsEnabled(allow_modify); // TERRAIN PANEL @@ -2276,7 +2286,7 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region) LLTextBox* resellable_clause = getChild("resellable_clause"); if (resellable_clause) { - if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) + if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)) { resellable_clause->setText(getString("can_not_resell")); } @@ -2289,7 +2299,7 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region) LLTextBox* changeable_clause = getChild("changeable_clause"); if (changeable_clause) { - if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) + if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { changeable_clause->setText(getString("can_change")); } diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 3ec1e372eb..479bdd5ff7 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -110,9 +110,6 @@ LLFloaterReporter::LLFloaterReporter(const LLSD& key) // static void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg) { - U32 region_flags; - msg->getU32("RegionInfo", "RegionFlags", region_flags); - if ( LLFloaterReg::instanceVisible("reporter") ) { LLNotificationsUtil::add("HelpReportAbuseEmailLL"); diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 8d9d70b50e..5022dba934 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -1217,11 +1217,11 @@ void LLLocationInputCtrl::onParcelIconClick(EParcelIcon icon) case SCRIPTS_ICON: { LLViewerRegion* region = gAgent.getRegion(); - if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) + if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS)) { LLNotificationsUtil::add("ScriptsStopped"); } - else if(region && region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) + else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS)) { LLNotificationsUtil::add("ScriptsNotRunning"); } diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index 04c1a86f69..5321ebc777 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -166,7 +166,7 @@ void LLPanelLandInfo::refresh() getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); // only mainland sims are subdividable by owner - if (regionp->getRegionFlags() && REGION_FLAGS_ALLOW_PARCEL_CHANGES) + if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); } diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index ce8057eead..884de65dd8 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -572,7 +572,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off); - if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) + if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { mSubdivideText->setText(getString("can_change")); } @@ -580,7 +580,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, { mSubdivideText->setText(getString("can_not_change")); } - if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) + if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)) { mResaleText->setText(getString("can_not_resell")); } diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index 280cc11179..fbd86df1f3 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -415,11 +415,11 @@ void LLPanelTopInfoBar::onParcelIconClick(EParcelIcon icon) case SCRIPTS_ICON: { LLViewerRegion* region = gAgent.getRegion(); - if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) + if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS)) { LLNotificationsUtil::add("ScriptsStopped"); } - else if(region && region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) + else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS)) { LLNotificationsUtil::add("ScriptsNotRunning"); } diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp index 698c4f9bb9..cc777d9297 100644 --- a/indra/newview/llregioninfomodel.cpp +++ b/indra/newview/llregioninfomodel.cpp @@ -119,7 +119,7 @@ void LLRegionInfoModel::sendRegionTerrain(const LLUUID& invoice) const bool LLRegionInfoModel::getUseFixedSun() const { - return mRegionFlags & REGION_FLAGS_SUN_FIXED; + return ((mRegionFlags & REGION_FLAGS_SUN_FIXED) != 0); } void LLRegionInfoModel::setUseFixedSun(bool fixed) @@ -141,7 +141,6 @@ void LLRegionInfoModel::update(LLMessageSystem* msg) msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, mSimName); msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, mEstateID); msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, mParentEstateID); - msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, mRegionFlags); msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, mSimAccess); msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, mAgentLimit); msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, mObjectBonusFactor); @@ -159,6 +158,17 @@ void LLRegionInfoModel::update(LLMessageSystem* msg) msg->getF32(_PREHASH_RegionInfo, _PREHASH_SunHour, mSunHour); LL_DEBUGS("Windlight Sync") << "Got region sun hour: " << mSunHour << LL_ENDL; + if (msg->has(_PREHASH_RegionInfo3)) + { + msg->getU64Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, mRegionFlags); + } + else + { + U32 flags = 0; + msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags); + mRegionFlags = flags; + } + // the only reasonable way to decide if we actually have any data is to // check to see if any of these fields have nonzero sizes if (msg->getSize(_PREHASH_RegionInfo2, _PREHASH_ProductSKU) > 0 || diff --git a/indra/newview/llregioninfomodel.h b/indra/newview/llregioninfomodel.h index 89efd82767..d22a0de463 100644 --- a/indra/newview/llregioninfomodel.h +++ b/indra/newview/llregioninfomodel.h @@ -52,7 +52,7 @@ public: U8 mSimAccess; U8 mAgentLimit; - U32 mRegionFlags; + U64 mRegionFlags; U32 mEstateID; U32 mParentEstateID; diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index aba43a9715..08d82ea9cb 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -657,7 +657,7 @@ bool LLToolBrushLand::canTerraform(LLViewerRegion* regionp) const { if (!regionp) return false; if (regionp->canManageEstate()) return true; - return !(regionp->getRegionFlags() & REGION_FLAGS_BLOCK_TERRAFORM); + return !regionp->getRegionFlag(REGION_FLAGS_BLOCK_TERRAFORM); } // static diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index c69999981c..3181e19cae 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1215,7 +1215,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, if (!item || !item->isFinished()) return; //if (regionp - // && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)) + // && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX))) //{ // LLFirstUse::useSandbox(); //} diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 93ba3b2558..641fbc5042 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -182,7 +182,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) return FALSE; } - if (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX) + if (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)) { //LLFirstUse::useSandbox(); } @@ -485,7 +485,7 @@ BOOL LLToolPlacer::addDuplicate(S32 x, S32 y) FALSE); // select copy if (regionp - && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)) + && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX))) { //LLFirstUse::useSandbox(); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 903f4437a7..f399275c94 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4900,9 +4900,19 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) // Various hacks that aren't statistics, but are being handled here. // U32 max_tasks_per_region; - U32 region_flags; + U64 region_flags; msg->getU32("Region", "ObjectCapacity", max_tasks_per_region); - msg->getU32("Region", "RegionFlags", region_flags); + + if (msg->has(_PREHASH_RegionInfo)) + { + msg->getU64("RegionInfo", "RegionFlagsExtended", region_flags); + } + else + { + U32 flags = 0; + msg->getU32("Region", "RegionFlags", flags); + region_flags = flags; + } LLViewerRegion* regionp = gAgent.getRegion(); if (regionp) diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 2bb2e92279..0077632b4a 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -696,8 +696,8 @@ bool LLViewerParcelMgr::allowAgentScripts(const LLViewerRegion* region, const LL // This mirrors the traditional menu bar parcel icon code, but is not // technically correct. return region - && !(region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) - && !(region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) + && !region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS) + && !region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS) && parcel && parcel->getAllowOtherScripts(); } @@ -2121,7 +2121,7 @@ void LLViewerParcelMgr::startReleaseLand() return; } /* - if ((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) + if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL) && !gAgent.isGodlike()) { LLSD args; @@ -2366,7 +2366,7 @@ void LLViewerParcelMgr::startDeedLandToGroup() /* if(!gAgent.isGodlike()) { - if((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) + if(region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL) && (mCurrentParcel->getOwnerID() != region->getOwner())) { LLSD args; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c6f1be4483..9ff00a1b82 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -279,6 +279,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mZoning(""), mIsEstateManager(FALSE), mRegionFlags( REGION_FLAGS_DEFAULT ), + mRegionProtocols( 0 ), mSimAccess( SIM_ACCESS_MIN ), mBillableFactor(1.0), mMaxTasks(DEFAULT_MAX_REGION_WIDE_PRIM_COUNT), @@ -454,18 +455,6 @@ void LLViewerRegion::sendReliableMessage() gMessageSystem->sendReliable(mImpl->mHost); } -void LLViewerRegion::setFlags(BOOL b, U32 flags) -{ - if (b) - { - mRegionFlags |= flags; - } - else - { - mRegionFlags &= ~flags; - } -} - void LLViewerRegion::setWaterHeight(F32 water_level) { mImpl->mLandp->setWaterHeight(water_level); @@ -478,10 +467,10 @@ F32 LLViewerRegion::getWaterHeight() const BOOL LLViewerRegion::isVoiceEnabled() const { - return (getRegionFlags() & REGION_FLAGS_ALLOW_VOICE); + return getRegionFlag(REGION_FLAGS_ALLOW_VOICE); } -void LLViewerRegion::setRegionFlags(U32 flags) +void LLViewerRegion::setRegionFlags(U64 flags) { mRegionFlags = flags; } @@ -574,7 +563,7 @@ std::string LLViewerRegion::getLocalizedSimProductName() const } // static -std::string LLViewerRegion::regionFlagsToString(U32 flags) +std::string LLViewerRegion::regionFlagsToString(U64 flags) { std::string result; @@ -1393,7 +1382,8 @@ void LLViewerRegion::unpackRegionHandshake() { LLMessageSystem *msg = gMessageSystem; - U32 region_flags; + U64 region_flags = 0; + U64 region_protocols = 0; U8 sim_access; std::string sim_name; LLUUID sim_owner; @@ -1402,7 +1392,6 @@ void LLViewerRegion::unpackRegionHandshake() F32 billable_factor; LLUUID cache_id; - msg->getU32 ("RegionInfo", "RegionFlags", region_flags); msg->getU8 ("RegionInfo", "SimAccess", sim_access); msg->getString ("RegionInfo", "SimName", sim_name); msg->getUUID ("RegionInfo", "SimOwner", sim_owner); @@ -1411,7 +1400,20 @@ void LLViewerRegion::unpackRegionHandshake() msg->getF32 ("RegionInfo", "BillableFactor", billable_factor); msg->getUUID ("RegionInfo", "CacheID", cache_id ); + if (msg->has(_PREHASH_RegionInfo4)) + { + msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionFlagsExtended, region_flags); + msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionProtocols, region_protocols); + } + else + { + U32 flags = 0; + msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags); + region_flags = flags; + } + setRegionFlags(region_flags); + setRegionProtocols(region_protocols); setSimAccess(sim_access); setRegionNameAndZone(sim_name); setOwner(sim_owner); @@ -1812,7 +1814,7 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type) // the viewer can not yet distinquish between normal- and estate-owned objects // so we collapse these two bits and enable the UI if either are set -const U32 ALLOW_RETURN_ENCROACHING_OBJECT = REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT +const U64 ALLOW_RETURN_ENCROACHING_OBJECT = REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT | REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT; bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector& boxes) const @@ -1820,7 +1822,7 @@ bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector< return (mParcelOverlay != NULL) && (mParcelOverlay->isOwnedSelf(pos) || mParcelOverlay->isOwnedGroup(pos) - || ((mRegionFlags & ALLOW_RETURN_ENCROACHING_OBJECT) + || (getRegionFlag(ALLOW_RETURN_ENCROACHING_OBJECT) && mParcelOverlay->encroachesOwned(boxes)) ); } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 2ddb17f171..20d96ad9ac 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -109,13 +109,13 @@ public: //void setAgentOffset(const LLVector3d &offset); void updateRenderMatrix(); - void setAllowDamage(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_DAMAGE); } - void setAllowLandmark(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_LANDMARK); } - void setAllowSetHome(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_SET_HOME); } - void setResetHomeOnTeleport(BOOL b) { setFlags(b, REGION_FLAGS_RESET_HOME_ON_TELEPORT); } - void setSunFixed(BOOL b) { setFlags(b, REGION_FLAGS_SUN_FIXED); } - void setBlockFly(BOOL b) { setFlags(b, REGION_FLAGS_BLOCK_FLY); } - void setAllowDirectTeleport(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_DIRECT_TELEPORT); } + void setAllowDamage(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); } + void setAllowLandmark(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); } + void setAllowSetHome(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); } + void setResetHomeOnTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); } + void setSunFixed(BOOL b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); } + void setBlockFly(BOOL b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); } + void setAllowDirectTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); } inline BOOL getAllowDamage() const; @@ -156,8 +156,15 @@ public: LLViewerParcelOverlay *getParcelOverlay() const { return mParcelOverlay; } - void setRegionFlags(U32 flags); - U32 getRegionFlags() const { return mRegionFlags; } + inline void setRegionFlag(U64 flag, BOOL on); + inline BOOL getRegionFlag(U64 flag) const; + void setRegionFlags(U64 flags); + U64 getRegionFlags() const { return mRegionFlags; } + + inline void setRegionProtocol(U64 protocol, BOOL on); + BOOL getRegionProtocol(U64 protocol) const; + void setRegionProtocols(U64 protocols) { mRegionProtocols = protocols; } + U64 getRegionProtocols() const { return mRegionProtocols; } void setTimeDilation(F32 time_dilation); F32 getTimeDilation() const { return mTimeDilation; } @@ -195,7 +202,7 @@ public: std::string getLocalizedSimProductName() const; // Returns "Sandbox", "Expensive", etc. - static std::string regionFlagsToString(U32 flags); + static std::string regionFlagsToString(U64 flags); // Returns translated version of "Mature", "PG", "Adult", etc. static std::string accessToString(U8 sim_access); @@ -347,7 +354,6 @@ public: protected: void disconnectAllNeighbors(); void initStats(); - void setFlags(BOOL b, U32 flags); public: LLWind mWind; @@ -392,7 +398,8 @@ private: U32 mPingDelay; F32 mDeltaTime; // Time since last measurement of lastPackets, Bits, etc - U32 mRegionFlags; // includes damage flags + U64 mRegionFlags; // includes damage flags + U64 mRegionProtocols; // protocols supported by this region U8 mSimAccess; F32 mBillableFactor; U32 mMaxTasks; // max prim count @@ -426,6 +433,40 @@ private: LLSD mSimulatorFeatures; }; +inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const +{ + return ((mRegionProtocols & protocol) != 0); +} + +inline void LLViewerRegion::setRegionProtocol(U64 protocol, BOOL on) +{ + if (on) + { + mRegionProtocols |= protocol; + } + else + { + mRegionProtocols &= ~protocol; + } +} + +inline BOOL LLViewerRegion::getRegionFlag(U64 flag) const +{ + return ((mRegionFlags & flag) != 0); +} + +inline void LLViewerRegion::setRegionFlag(U64 flag, BOOL on) +{ + if (on) + { + mRegionFlags |= flag; + } + else + { + mRegionFlags &= ~flag; + } +} + inline BOOL LLViewerRegion::getAllowDamage() const { return ((mRegionFlags & REGION_FLAGS_ALLOW_DAMAGE) !=0); diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 350ba39b45..cb24e96d5b 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -389,7 +389,7 @@ void LLWorldMap::reloadItems(bool force) // static public // Insert a region in the region map // returns true if region inserted, false otherwise -bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags) +bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& image_id, U32 accesscode, U64 region_flags) { // This region doesn't exist if (accesscode == 255) diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index 73530b9694..c17feaa04b 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -102,7 +102,7 @@ public: // Setters void setName(std::string& name) { mName = name; } void setAccess (U32 accesscode) { mAccess = accesscode; } - void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; } + void setRegionFlags (U64 region_flags) { mRegionFlags = region_flags; } void setLandForSaleImage (LLUUID image_id); // void setWaterHeight (F32 water_height) { mWaterHeight = water_height; } @@ -152,7 +152,7 @@ private: bool mFirstAgentRequest; // Init agent request flag U32 mAccess; // Down/up and maturity rating of the region - U32 mRegionFlags; // Tell us if the siminfo has been received (if non 0) and what kind of region it is (Sandbox, allow damage) + U64 mRegionFlags; // Tell us if the siminfo has been received (if non 0) and what kind of region it is (Sandbox, allow damage) // Currently not used but might prove useful one day so we comment out // F32 mWaterHeight; // Water height on the region (not actively used) @@ -198,7 +198,7 @@ public: // Insert a region and items in the map global instance // Note: x_world and y_world in world coordinates (meters) - static bool insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 accesscode, U32 region_flags); + static bool insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 accesscode, U64 region_flags); static bool insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2); // Get info on sims (region) : note that those methods only search the range of loaded sims (the one that are being browsed) -- cgit v1.2.3 From c188fa6ab7f008069ac5c8d7ae8abc793e7e96f9 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 17 Aug 2012 06:34:28 +0000 Subject: Fix for incorrectly reading extended region flags --- indra/newview/llfloatergodtools.cpp | 2 +- indra/newview/llfloaterregioninfo.cpp | 2 +- indra/newview/llregioninfomodel.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index aac8f5bfc1..9c95899c77 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -239,7 +239,7 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) if (msg->has(_PREHASH_RegionInfo3)) { - msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlags, region_flags); + msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlagsExtended, region_flags); } else { diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 1d9f519d70..a179e4dff7 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -348,7 +348,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) if (msg->has(_PREHASH_RegionInfo3)) { - msg->getU64("RegionInfo", "RegionFlags", region_flags); + msg->getU64("RegionInfo", "RegionFlagsExtended", region_flags); } else { diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp index cc777d9297..498564ecc9 100644 --- a/indra/newview/llregioninfomodel.cpp +++ b/indra/newview/llregioninfomodel.cpp @@ -160,7 +160,7 @@ void LLRegionInfoModel::update(LLMessageSystem* msg) if (msg->has(_PREHASH_RegionInfo3)) { - msg->getU64Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, mRegionFlags); + msg->getU64Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlagsExtended, mRegionFlags); } else { -- cgit v1.2.3 From ba07e95d682428f20e529fca4cc324817dc781a7 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 17 Aug 2012 08:22:50 +0000 Subject: Added extended flags to god tools region info response --- indra/newview/llfloatergodtools.cpp | 6 +++++- indra/newview/llfloaterregioninfo.cpp | 2 +- indra/newview/llregioninfomodel.cpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 9c95899c77..ab56b8e3d6 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -351,6 +351,7 @@ void LLFloaterGodTools::sendGodUpdateRegionInfo() LLMessageSystem *msg = gMessageSystem; LLPanelRegionTools *rtool = god_tools->mPanelRegionTools; + U64 region_flags = computeRegionFlags(); msg->newMessage("GodUpdateRegionInfo"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -359,11 +360,14 @@ void LLFloaterGodTools::sendGodUpdateRegionInfo() msg->addStringFast(_PREHASH_SimName, rtool->getSimName()); msg->addU32Fast(_PREHASH_EstateID, rtool->getEstateID()); msg->addU32Fast(_PREHASH_ParentEstateID, rtool->getParentEstateID()); - msg->addU32Fast(_PREHASH_RegionFlags, computeRegionFlags()); + // Legacy flags + msg->addU32Fast(_PREHASH_RegionFlags, U32(region_flags)); msg->addF32Fast(_PREHASH_BillableFactor, rtool->getBillableFactor()); msg->addS32Fast(_PREHASH_PricePerMeter, rtool->getPricePerMeter()); msg->addS32Fast(_PREHASH_RedirectGridX, rtool->getRedirectGridX()); msg->addS32Fast(_PREHASH_RedirectGridY, rtool->getRedirectGridY()); + msg->nextBlockFast(_PREHASH_RegionInfo2); + msg->addU64Fast(_PREHASH_RegionFlagsExtended, region_flags); gAgent.sendReliableMessage(); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index a179e4dff7..a36021f971 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -348,7 +348,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) if (msg->has(_PREHASH_RegionInfo3)) { - msg->getU64("RegionInfo", "RegionFlagsExtended", region_flags); + msg->getU64("RegionInfo3", "RegionFlagsExtended", region_flags); } else { diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp index 498564ecc9..590e246482 100644 --- a/indra/newview/llregioninfomodel.cpp +++ b/indra/newview/llregioninfomodel.cpp @@ -160,7 +160,7 @@ void LLRegionInfoModel::update(LLMessageSystem* msg) if (msg->has(_PREHASH_RegionInfo3)) { - msg->getU64Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlagsExtended, mRegionFlags); + msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlagsExtended, mRegionFlags); } else { -- cgit v1.2.3 From 2db20dd01b12be830e8b5ac58172e9963b73eba1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 20 Aug 2012 18:11:07 -0400 Subject: SH-3625 WIP - removeItem(s)FromAvatar use updateAppearanceFromCOF. Some but not all remove code goes through these. --- indra/newview/llappearancemgr.cpp | 21 ++++++++++++++++++++- indra/newview/llappearancemgr.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 5f1a880ebd..0b425b656c 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1160,11 +1160,13 @@ void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id) LLInventoryModel::item_array_t::const_iterator it = items.begin(); const LLInventoryModel::item_array_t::const_iterator it_end = items.end(); + uuid_vec_t uuids_to_remove; for( ; it_end != it; ++it) { LLViewerInventoryItem* item = *it; - removeItemFromAvatar(item->getUUID()); + uuids_to_remove.push_back(item->getUUID()); } + removeItemsFromAvatar(uuids_to_remove); } // Create a copy of src_id + contents as a subfolder of dst_id. @@ -2706,8 +2708,24 @@ void LLAppearanceMgr::wearBaseOutfit() updateCOF(base_outfit_id); } +void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) +{ + for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it) + { + const LLUUID& id_to_remove = *it; + const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove); + removeCOFItemLinks(linked_item_id,false); + } + updateAppearanceFromCOF(); +} + void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) { +#if 1 + LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove); + removeCOFItemLinks(linked_item_id,false); + updateAppearanceFromCOF(); +#else LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove); if (!item_to_remove) return; @@ -2733,6 +2751,7 @@ void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) // Also we can't check is link was successfully removed from COF since in case // deleting attachment link removing performs asynchronously in process_kill_object callback. removeCOFItemLinks(id_to_remove,false); +#endif } bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_body) diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 742833211a..c0f41075aa 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -165,6 +165,7 @@ public: bool updateBaseOutfit(); //Remove clothing or detach an object from the agent (a bodypart cannot be removed) + void removeItemsFromAvatar(const uuid_vec_t& item_ids); void removeItemFromAvatar(const LLUUID& item_id); -- cgit v1.2.3 From b232919c0a6d66582b57c8997fee7a99ab9bbddb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 21 Aug 2012 17:03:42 -0400 Subject: SH-3625 WIP - consolidating code paths for wearable/attachment removal --- indra/newview/llappearancemgr.cpp | 51 ++++++++++++++++------------------- indra/newview/llappearancemgr.h | 1 + indra/newview/llcofwearables.cpp | 6 ++--- indra/newview/llinventorybridge.cpp | 34 ++++------------------- indra/newview/llpanelwearing.cpp | 15 ++++------- indra/newview/llviewermenu.cpp | 6 ++--- indra/newview/llwearableitemslist.cpp | 11 ++++---- 7 files changed, 45 insertions(+), 79 deletions(-) mode change 100644 => 100755 indra/newview/llcofwearables.cpp mode change 100644 => 100755 indra/newview/llinventorybridge.cpp mode change 100644 => 100755 indra/newview/llpanelwearing.cpp mode change 100644 => 100755 indra/newview/llviewermenu.cpp mode change 100644 => 100755 indra/newview/llwearableitemslist.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0b425b656c..933049fa79 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2215,6 +2215,29 @@ void LLAppearanceMgr::addEnsembleLink( LLInventoryCategory* cat, bool do_update #endif } +void LLAppearanceMgr::removeAllClothesFromAvatar() +{ + // Fetch worn clothes (i.e. the ones in COF). + LLInventoryModel::item_array_t clothing_items; + LLInventoryModel::cat_array_t dummy; + LLIsType is_clothing(LLAssetType::AT_CLOTHING); + gInventory.collectDescendentsIf(getCOF(), + dummy, + clothing_items, + LLInventoryModel::EXCLUDE_TRASH, + is_clothing, + false); + uuid_vec_t item_ids; + for (LLInventoryModel::item_array_t::iterator it = clothing_items.begin(); + it != clothing_items.end(); ++it) + { + item_ids.push_back((*it).get()->getLinkedUUID()); + } + + // Take them off by removing from COF. + removeItemsFromAvatar(item_ids); +} + void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update) { gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); @@ -2721,37 +2744,9 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) { -#if 1 LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove); removeCOFItemLinks(linked_item_id,false); updateAppearanceFromCOF(); -#else - LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove); - if (!item_to_remove) return; - - switch (item_to_remove->getType()) - { - case LLAssetType::AT_CLOTHING: - if (get_is_item_worn(id_to_remove)) - { - //*TODO move here the exact removing code from LLWearableBridge::removeItemFromAvatar in the future - LLWearableBridge::removeItemFromAvatar(item_to_remove); - } - break; - case LLAssetType::AT_OBJECT: - LLVOAvatarSelf::detachAttachmentIntoInventory(item_to_remove->getLinkedUUID()); - default: - break; - } - - // *HACK: Force to remove garbage from COF. - // Unworn links or objects can't be processed by existed removing functionality - // since it is not designed for such cases. As example attachment object can't be removed - // since sever don't sends message _PREHASH_KillObject in that case. - // Also we can't check is link was successfully removed from COF since in case - // deleting attachment link removing performs asynchronously in process_kill_object callback. - removeCOFItemLinks(id_to_remove,false); -#endif } bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_body) diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index c0f41075aa..7734eba144 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -135,6 +135,7 @@ public: // Remove COF entries void removeCOFItemLinks(const LLUUID& item_id, bool do_update = true); void removeCOFLinksOfType(LLWearableType::EType type, bool do_update = true); + void removeAllClothesFromAvatar(); // Add COF link to ensemble folder. void addEnsembleLink(LLInventoryCategory* item, bool do_update = true); diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp old mode 100644 new mode 100755 index e9c7a3fa03..e86d6930e8 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -139,8 +139,7 @@ protected: { LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1); - registrar.add("Attachment.Detach", boost::bind(handleMultiple, take_off, mUUIDs)); + registrar.add("Attachment.Detach", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs)); return createFromFile("menu_cof_attachment.xml"); } @@ -173,9 +172,8 @@ protected: LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; LLUUID selected_id = mUUIDs.back(); - functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1); - registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs)); + registrar.add("Clothing.TakeOff", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs)); registrar.add("Clothing.Replace", boost::bind(replaceWearable, selected_id)); registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id)); registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id)); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp old mode 100644 new mode 100755 index b819100b9b..e07365109b --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2764,7 +2764,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; - remove_inventory_category_from_avatar ( cat ); + LLAppearanceMgr::instance().takeOffOutfit( cat->getLinkedUUID() ); return; } else if ("purge" == action) @@ -5073,11 +5073,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) } else if (isRemoveAction(action)) { - LLInventoryItem* item = gInventory.getItem(mUUID); - if(item) - { - LLVOAvatarSelf::detachAttachmentIntoInventory(item->getLinkedUUID()); - } + LLAppearanceMgr::instance().removeItemFromAvatar(mUUID); } else LLItemBridge::performAction(model, action); } @@ -5827,30 +5823,10 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, delete on_remove_struct; } -// static -void LLWearableBridge::removeAllClothesFromAvatar() -{ - // Fetch worn clothes (i.e. the ones in COF). - LLInventoryModel::item_array_t clothing_items; - LLInventoryModel::cat_array_t dummy; - LLIsType is_clothing(LLAssetType::AT_CLOTHING); - gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), - dummy, - clothing_items, - LLInventoryModel::EXCLUDE_TRASH, - is_clothing, - false); - - // Take them off by removing from COF. - for (LLInventoryModel::item_array_t::const_iterator it = clothing_items.begin(); it != clothing_items.end(); ++it) - { - LLAppearanceMgr::instance().removeItemFromAvatar((*it)->getUUID()); - } -} - // static void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item) { + llwarns << "safe to remove?" << llendl; if (item) { LLWearableList::instance().getAsset(item->getAssetUUID(), @@ -5863,10 +5839,10 @@ void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item) void LLWearableBridge::removeFromAvatar() { + llwarns << "safe to remove?" << llendl; if (get_is_item_worn(mUUID)) { - LLViewerInventoryItem* item = getItem(); - removeItemFromAvatar(item); + LLAppearanceMgr::instance().removeItemFromAvatar(mUUID); } } diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp old mode 100644 new mode 100755 index 3b9934d4be..aa3ed22bee --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -77,11 +77,7 @@ private: { uuid_vec_t selected_uuids; mPanelWearing->getSelectedItemsUUIDs(selected_uuids); - - for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it) - { - LLAppearanceMgr::instance().removeItemFromAvatar(*it); - } + LLAppearanceMgr::instance().removeItemsFromAvatar(selected_uuids); } LLToggleableMenu* mMenu; @@ -97,12 +93,11 @@ protected: { LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1); - registrar.add("Wearing.Edit", boost::bind(&edit_outfit)); - registrar.add("Wearing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs)); - registrar.add("Wearing.Detach", boost::bind(handleMultiple, take_off, mUUIDs)); - + registrar.add("Wearing.TakeOff", + boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs)); + registrar.add("Wearing.Detach", + boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs)); LLContextMenu* menu = createFromFile("menu_wearing_tab.xml"); updateMenuItemsVisibility(menu); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp old mode 100644 new mode 100755 index 01a54509ef..5bed2eccb5 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7897,7 +7897,7 @@ class LLEditTakeOff : public view_listener_t { std::string clothing = userdata.asString(); if (clothing == "all") - LLWearableBridge::removeAllClothesFromAvatar(); + LLAppearanceMgr::instance().removeAllClothesFromAvatar(); else { LLWearableType::EType type = LLWearableType::typeNameToType(clothing); @@ -7907,8 +7907,8 @@ class LLEditTakeOff : public view_listener_t { // MULTI-WEARABLES: assuming user wanted to remove top shirt. U32 wearable_index = gAgentWearables.getWearableCount(type) - 1; - LLViewerInventoryItem *item = dynamic_cast(gAgentWearables.getWearableInventoryItem(type,wearable_index)); - LLWearableBridge::removeItemFromAvatar(item); + LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index); + LLAppearanceMgr::instance().removeItemFromAvatar(item_id); } } diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp old mode 100644 new mode 100755 index 92697fb2eb..c7e9215643 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -788,23 +788,24 @@ LLContextMenu* LLWearableItemsList::ContextMenu::createMenu() const uuid_vec_t& ids = mUUIDs; // selected items IDs LLUUID selected_id = ids.front(); // ID of the first selected item - functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1); - // Register handlers common for all wearable types. registrar.add("Wearable.Wear", boost::bind(wear_multiple, ids, true)); registrar.add("Wearable.Add", boost::bind(wear_multiple, ids, false)); registrar.add("Wearable.Edit", boost::bind(handleMultiple, LLAgentWearables::editWearable, ids)); registrar.add("Wearable.CreateNew", boost::bind(createNewWearable, selected_id)); registrar.add("Wearable.ShowOriginal", boost::bind(show_item_original, selected_id)); - registrar.add("Wearable.TakeOffDetach", boost::bind(handleMultiple, take_off, ids)); + registrar.add("Wearable.TakeOffDetach", + boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids)); // Register handlers for clothing. - registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, ids)); + registrar.add("Clothing.TakeOff", + boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids)); // Register handlers for body parts. // Register handlers for attachments. - registrar.add("Attachment.Detach", boost::bind(handleMultiple, take_off, ids)); + registrar.add("Attachment.Detach", + boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids)); registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id)); registrar.add("Object.Attach", boost::bind(LLViewerAttachMenu::attachObjects, ids, _2)); -- cgit v1.2.3 From 40df1bba9707cdf35eb9583c2024b294da671a2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 21 Aug 2012 17:58:26 -0400 Subject: SH-3625 WIP - consolidating code paths for removal, removed dead code --- indra/newview/llagentwearables.cpp | 27 +----- indra/newview/llagentwearables.h | 1 - indra/newview/llappearancemgr.cpp | 32 +++++++ indra/newview/llappearancemgr.h | 1 + indra/newview/llinventorybridge.cpp | 179 ------------------------------------ indra/newview/llinventorybridge.h | 3 - indra/newview/llviewermenu.cpp | 2 +- 7 files changed, 35 insertions(+), 210 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e44b27c6af..53a255fe92 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1715,7 +1715,7 @@ void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &ty } } -// Combines userRemoveAllAttachments() and userAttachMultipleAttachments() logic to +// Combines userRemoveMulipleAttachments() and userAttachMultipleAttachments() logic to // get attachments into desired state with minimal number of adds/removes. void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array) { @@ -1811,31 +1811,6 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo gMessageSystem->sendReliable(gAgent.getRegionHost()); } -void LLAgentWearables::userRemoveAllAttachments() -{ - if (!isAgentAvatarValid()) return; - - llvo_vec_t objects_to_remove; - - for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); - iter != gAgentAvatarp->mAttachmentPoints.end();) - { - LLVOAvatar::attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject *attached_object = (*attachment_iter); - if (attached_object) - { - objects_to_remove.push_back(attached_object); - } - } - } - userRemoveMultipleAttachments(objects_to_remove); -} - void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { // Build a compound message to send all the objects that need to be rezzed. diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 5932be21c6..550560d7bc 100755 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -215,7 +215,6 @@ public: static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array); static void userRemoveMultipleAttachments(llvo_vec_t& llvo_array); - static void userRemoveAllAttachments(); static void userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array); BOOL itemUpdatePending(const LLUUID& item_id) const; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 933049fa79..71b7298f5c 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2238,6 +2238,38 @@ void LLAppearanceMgr::removeAllClothesFromAvatar() removeItemsFromAvatar(item_ids); } +void LLAppearanceMgr::removeAllAttachmentsFromAvatar() +{ + if (!isAgentAvatarValid()) return; + + LLAgentWearables::llvo_vec_t objects_to_remove; + + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end();) + { + LLVOAvatar::attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject *attached_object = (*attachment_iter); + if (attached_object) + { + objects_to_remove.push_back(attached_object); + } + } + } + uuid_vec_t ids_to_remove; + for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_remove.begin(); + it != objects_to_remove.end(); + ++it) + { + ids_to_remove.push_back((*it)->getAttachmentItemID()); + } + removeItemsFromAvatar(ids_to_remove); +} + void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update) { gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 7734eba144..df27d5478a 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -136,6 +136,7 @@ public: void removeCOFItemLinks(const LLUUID& item_id, bool do_update = true); void removeCOFLinksOfType(LLWearableType::EType type, bool do_update = true); void removeAllClothesFromAvatar(); + void removeAllAttachmentsFromAvatar(); // Add COF link to ensemble folder. void addEnsembleLink(LLInventoryCategory* item, bool do_update = true); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index e07365109b..27dfbba561 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -107,8 +107,6 @@ void dec_busy_count() } // Function declarations -void remove_inventory_category_from_avatar(LLInventoryCategory* category); -void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id); bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*); bool confirm_attachment_rez(const LLSD& notification, const LLSD& response); void teleport_via_landmark(const LLUUID& asset_id); @@ -5365,120 +5363,6 @@ LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory, mInvType = inv_type; } -void remove_inventory_category_from_avatar( LLInventoryCategory* category ) -{ - if(!category) return; - lldebugs << "remove_inventory_category_from_avatar( " << category->getName() - << " )" << llendl; - - - if (gAgentCamera.cameraCustomizeAvatar()) - { - // switching to outfit editor should automagically save any currently edited wearable - LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); - } - - remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() ); -} - -struct OnRemoveStruct -{ - LLUUID mUUID; - OnRemoveStruct(const LLUUID& uuid): - mUUID(uuid) - { - } -}; - -void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id) -{ - - // Find all the wearables that are in the category's subtree. - lldebugs << "remove_inventory_category_from_avatar_step2()" << llendl; - if(proceed) - { - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - LLFindWearables is_wearable; - gInventory.collectDescendentsIf(category_id, - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_wearable); - S32 i; - S32 wearable_count = item_array.count(); - - LLInventoryModel::cat_array_t obj_cat_array; - LLInventoryModel::item_array_t obj_item_array; - LLIsType is_object( LLAssetType::AT_OBJECT ); - gInventory.collectDescendentsIf(category_id, - obj_cat_array, - obj_item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_object); - S32 obj_count = obj_item_array.count(); - - // Find all gestures in this folder - LLInventoryModel::cat_array_t gest_cat_array; - LLInventoryModel::item_array_t gest_item_array; - LLIsType is_gesture( LLAssetType::AT_GESTURE ); - gInventory.collectDescendentsIf(category_id, - gest_cat_array, - gest_item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_gesture); - S32 gest_count = gest_item_array.count(); - - if (wearable_count > 0) //Loop through wearables. If worn, remove. - { - for(i = 0; i < wearable_count; ++i) - { - LLViewerInventoryItem *item = item_array.get(i); - if (item->getType() == LLAssetType::AT_BODYPART) - continue; - if (gAgent.isTeen() && item->isWearableType() && - (item->getWearableType() == LLWearableType::WT_UNDERPANTS || item->getWearableType() == LLWearableType::WT_UNDERSHIRT)) - continue; - if (get_is_item_worn(item->getUUID())) - { - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(item->getLinkedUUID())); - } - } - } - - if (obj_count > 0) - { - for(i = 0; i < obj_count; ++i) - { - LLViewerInventoryItem *obj_item = obj_item_array.get(i); - if (get_is_item_worn(obj_item->getUUID())) - { - LLVOAvatarSelf::detachAttachmentIntoInventory(obj_item->getLinkedUUID()); - } - } - } - - if (gest_count > 0) - { - for(i = 0; i < gest_count; ++i) - { - LLViewerInventoryItem *gest_item = gest_item_array.get(i); - if (get_is_item_worn(gest_item->getUUID())) - { - LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() ); - gInventory.updateItem( gest_item ); - gInventory.notifyObservers(); - } - - } - } - } -} - BOOL LLWearableBridge::renameItem(const std::string& new_name) { if (get_is_item_worn(mUUID)) @@ -5774,69 +5658,6 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) return FALSE; } -// static -void LLWearableBridge::onRemoveFromAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return; - if(get_is_item_worn(self->mUUID)) - { - LLViewerInventoryItem* item = self->getItem(); - if (item) - { - LLUUID parent_id = item->getParentUUID(); - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - onRemoveFromAvatarArrived, - new OnRemoveStruct(LLUUID(self->mUUID))); - } - } -} - -// static -void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, - void* userdata) -{ - OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata; - const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID); - if(wearable) - { - if( get_is_item_worn( item_id ) ) - { - LLWearableType::EType type = wearable->getType(); - - if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&& - //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) ) - { - bool do_remove_all = false; - U32 index = gAgentWearables.getWearableIndex(wearable); - gAgentWearables.removeWearable( type, do_remove_all, index ); - } - } - } - - // Find and remove this item from the COF. - LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); - gInventory.notifyObservers(); - - delete on_remove_struct; -} - -// static -void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item) -{ - llwarns << "safe to remove?" << llendl; - if (item) - { - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(item->getUUID())); - } -} - void LLWearableBridge::removeFromAvatar() { llwarns << "safe to remove?" << llendl; diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index dc9e88d54d..c37343e678 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -497,9 +497,6 @@ public: void editOnAvatar(); static BOOL canRemoveFromAvatar( void* userdata ); - static void onRemoveFromAvatar( void* userdata ); - static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata ); - static void removeItemFromAvatar(LLViewerInventoryItem *item); static void removeAllClothesFromAvatar(); void removeFromAvatar(); protected: diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 5bed2eccb5..9001c79a4d 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2798,7 +2798,7 @@ class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLAgentWearables::userRemoveAllAttachments(); + LLAppearanceMgr::instance().removeAllAttachmentsFromAvatar(); return true; } }; -- cgit v1.2.3 From 51fabc385079a0b5fab4611bb5b16fea5dc26372 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 21 Aug 2012 18:21:11 -0400 Subject: SH-3261 SH-3324 WIP Starting extraction of wearable/appearance libraries First pass at cmake configs, and starting to try to move wearable class. Things are broken, checkpointing work to collaborate. --- indra/newview/CMakeLists.txt | 4 +- indra/newview/llwearable.cpp | 1285 ------------------------------------------ indra/newview/llwearable.h | 165 ------ 3 files changed, 2 insertions(+), 1452 deletions(-) delete mode 100644 indra/newview/llwearable.cpp delete mode 100644 indra/newview/llwearable.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2c9952cbc8..ff3fb0038c 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -44,6 +44,7 @@ include(LLLogin) include(VisualLeakDetector) include(GLOD) include(CMakeCopyIfDifferent) +include(LLAppearance) add_subdirectory(${LLPHYSICSEXTENSIONS_SRC_DIR} llphysicsextensions) @@ -77,6 +78,7 @@ include_directories( ${LIBS_PREBUILD_DIR}/include/hunspell ${OPENAL_LIB_INCLUDE_DIRS} ${LIBS_PREBUILT_DIR}/include/collada/1.4 + ${LLAPPEARANCE_INCLUDE_DIRS} ) set(viewer_SOURCE_FILES @@ -625,7 +627,6 @@ set(viewer_SOURCE_FILES llwatchdog.cpp llwaterparammanager.cpp llwaterparamset.cpp - llwearable.cpp llwearableitemslist.cpp llwearablelist.cpp llwearabletype.cpp @@ -1194,7 +1195,6 @@ set(viewer_HEADER_FILES llwatchdog.h llwaterparammanager.h llwaterparamset.h - llwearable.h llwearableitemslist.h llwearablelist.h llwearabletype.h diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp deleted file mode 100644 index 402504933c..0000000000 --- a/indra/newview/llwearable.cpp +++ /dev/null @@ -1,1285 +0,0 @@ -/** - * @file llwearable.cpp - * @brief LLWearable class implementation - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llagent.h" -#include "llagentcamera.h" -#include "llagentwearables.h" -#include "lldictionary.h" -#include "llfloatersidepanelcontainer.h" -#include "lllocaltextureobject.h" -#include "llnotificationsutil.h" -#include "llviewertexturelist.h" -#include "llinventorymodel.h" -#include "llinventoryobserver.h" -#include "llsidepanelappearance.h" -#include "lltexlayer.h" -#include "lltexglobalcolor.h" -#include "lltrans.h" -#include "llviewerregion.h" -#include "llvisualparam.h" -#include "llvoavatar.h" -#include "llvoavatarself.h" -#include "llvoavatardefines.h" -#include "llwearable.h" -#include "llviewercontrol.h" - -using namespace LLVOAvatarDefines; - -// static -S32 LLWearable::sCurrentDefinitionVersion = 1; - -// support class - remove for 2.1 (hackity hack hack) -class LLOverrideBakedTextureUpdate -{ -public: - LLOverrideBakedTextureUpdate(bool temp_state) - { - U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES; - for( U32 index = 0; index < num_bakes; ++index ) - { - composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index); - } - gAgentAvatarp->setCompositeUpdatesEnabled(temp_state); - } - - ~LLOverrideBakedTextureUpdate() - { - U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES; - for( U32 index = 0; index < num_bakes; ++index ) - { - gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]); - } - } -private: - bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES]; -}; - -// Private local functions -static std::string terse_F32_to_string(F32 f); -static std::string asset_id_to_filename(const LLUUID &asset_id); - -LLWearable::LLWearable(const LLTransactionID& transaction_id) : - mDefinitionVersion(LLWearable::sCurrentDefinitionVersion), - mType(LLWearableType::WT_INVALID) -{ - mTransactionID = transaction_id; - mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); -} - -LLWearable::LLWearable(const LLAssetID& asset_id) : - mDefinitionVersion( LLWearable::sCurrentDefinitionVersion ), - mType(LLWearableType::WT_INVALID) -{ - mAssetID = asset_id; - mTransactionID.setNull(); -} - -LLWearable::~LLWearable() -{ -} - -const std::string& LLWearable::getTypeLabel() const -{ - return LLWearableType::getTypeLabel(mType); -} - -const std::string& LLWearable::getTypeName() const -{ - return LLWearableType::getTypeName(mType); -} - -LLAssetType::EType LLWearable::getAssetType() const -{ - return LLWearableType::getAssetType(mType); -} - -BOOL LLWearable::exportFile(LLFILE* file) const -{ - // header and version - if( fprintf( file, "LLWearable version %d\n", mDefinitionVersion ) < 0 ) - { - return FALSE; - } - - // name - if( fprintf( file, "%s\n", mName.c_str() ) < 0 ) - { - return FALSE; - } - - // description - if( fprintf( file, "%s\n", mDescription.c_str() ) < 0 ) - { - return FALSE; - } - - // permissions - if( !mPermissions.exportFile( file ) ) - { - return FALSE; - } - - // sale info - if( !mSaleInfo.exportFile( file ) ) - { - return FALSE; - } - - // wearable type - S32 type = (S32)mType; - if( fprintf( file, "type %d\n", type ) < 0 ) - { - return FALSE; - } - - // parameters - S32 num_parameters = mVisualParamIndexMap.size(); - if( fprintf( file, "parameters %d\n", num_parameters ) < 0 ) - { - return FALSE; - } - - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); - iter != mVisualParamIndexMap.end(); - ++iter) - { - S32 param_id = iter->first; - const LLVisualParam* param = iter->second; - F32 param_weight = param->getWeight(); - if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight ).c_str() ) < 0 ) - { - return FALSE; - } - } - - // texture entries - S32 num_textures = mTEMap.size(); - if( fprintf( file, "textures %d\n", num_textures ) < 0 ) - { - return FALSE; - } - - for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) - { - S32 te = iter->first; - const LLUUID& image_id = iter->second->getID(); - if( fprintf( file, "%d %s\n", te, image_id.asString().c_str()) < 0 ) - { - return FALSE; - } - } - return TRUE; -} - - -void LLWearable::createVisualParams() -{ - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if (param->getWearableType() == mType) - { - addVisualParam(param->cloneParam(this)); - } - } - - // resync driver parameters to point to the newly cloned driven parameters - for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); - param_iter != mVisualParamIndexMap.end(); - ++param_iter) - { - LLVisualParam* param = param_iter->second; - LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; - // need this line to disambiguate between versions of LLCharacter::getVisualParam() - LLVisualParam*(LLVOAvatarSelf::*avatar_function)(S32)const = &LLVOAvatarSelf::getVisualParam; - param->resetDrivenParams(); - if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) - { - if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp.get(),_1 ), true)) - { - llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; - continue; - } - } - } -} - -BOOL LLWearable::importFile( LLFILE* file ) -{ - // *NOTE: changing the type or size of this buffer will require - // changes in the fscanf() code below. You would be better off - // rewriting this to use streams and not require an open FILE. - char text_buffer[2048]; /* Flawfinder: ignore */ - S32 fields_read = 0; - - // suppress texlayerset updates while wearables are being imported. Layersets will be updated - // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed. - LLOverrideBakedTextureUpdate stop_bakes(false); - - // read header and version - fields_read = fscanf( file, "LLWearable version %d\n", &mDefinitionVersion ); - if( fields_read != 1 ) - { - // Shouldn't really log the asset id for security reasons, but - // we need it in this case. - llwarns << "Bad Wearable asset header: " << mAssetID << llendl; - //gVFS->dumpMap(); - return FALSE; - } - - - // Temoprary hack to allow wearables with definition version 24 to still load. - // This should only affect lindens and NDA'd testers who have saved wearables in 2.0 - // the extra check for version == 24 can be removed before release, once internal testers - // have loaded these wearables again. See hack pt 2 at bottom of function to ensure that - // these wearables get re-saved with version definition 22. - if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 ) - { - llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl; - return FALSE; - } - - // name - int next_char = fgetc( file ); /* Flawfinder: ignore */ - if( '\n' == next_char ) - { - // no name - mName = ""; - } - else - { - ungetc( next_char, file ); - fields_read = fscanf( /* Flawfinder: ignore */ - file, - "%2047[^\n]", - text_buffer); - if( (1 != fields_read) || (fgetc( file ) != '\n') ) /* Flawfinder: ignore */ - { - llwarns << "Bad Wearable asset: early end of file" << llendl; - return FALSE; - } - mName = text_buffer; - LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN ); - } - - // description - next_char = fgetc( file ); /* Flawfinder: ignore */ - if( '\n' == next_char ) - { - // no description - mDescription = ""; - } - else - { - ungetc( next_char, file ); - fields_read = fscanf( /* Flawfinder: ignore */ - file, - "%2047[^\n]", - text_buffer ); - if( (1 != fields_read) || (fgetc( file ) != '\n') ) /* Flawfinder: ignore */ - { - llwarns << "Bad Wearable asset: early end of file" << llendl; - return FALSE; - } - mDescription = text_buffer; - LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN ); - } - - // permissions - S32 perm_version; - fields_read = fscanf( file, " permissions %d\n", &perm_version ); - if( (fields_read != 1) || (perm_version != 0) ) - { - llwarns << "Bad Wearable asset: missing permissions" << llendl; - return FALSE; - } - if( !mPermissions.importFile( file ) ) - { - return FALSE; - } - - // sale info - S32 sale_info_version; - fields_read = fscanf( file, " sale_info %d\n", &sale_info_version ); - if( (fields_read != 1) || (sale_info_version != 0) ) - { - llwarns << "Bad Wearable asset: missing sale_info" << llendl; - return FALSE; - } - // Sale info used to contain next owner perm. It is now in the - // permissions. Thus, we read that out, and fix legacy - // objects. It's possible this op would fail, but it should pick - // up the vast majority of the tasks. - BOOL has_perm_mask = FALSE; - U32 perm_mask = 0; - if( !mSaleInfo.importFile(file, has_perm_mask, perm_mask) ) - { - return FALSE; - } - if(has_perm_mask) - { - // fair use fix. - if(!(perm_mask & PERM_COPY)) - { - perm_mask |= PERM_TRANSFER; - } - mPermissions.setMaskNext(perm_mask); - } - - // wearable type - S32 type = -1; - fields_read = fscanf( file, "type %d\n", &type ); - if( fields_read != 1 ) - { - llwarns << "Bad Wearable asset: bad type" << llendl; - return FALSE; - } - if( 0 <= type && type < LLWearableType::WT_COUNT ) - { - setType((LLWearableType::EType)type); - } - else - { - mType = LLWearableType::WT_COUNT; - llwarns << "Bad Wearable asset: bad type #" << type << llendl; - return FALSE; - } - - // parameters header - S32 num_parameters = 0; - fields_read = fscanf( file, "parameters %d\n", &num_parameters ); - if( fields_read != 1 ) - { - llwarns << "Bad Wearable asset: missing parameters block" << llendl; - return FALSE; - } - - if( num_parameters != mVisualParamIndexMap.size() ) - { - llwarns << "Wearable parameter mismatch. Reading in " << num_parameters << " from file, but created " << mVisualParamIndexMap.size() << " from avatar parameters. type: " << mType << llendl; - } - - // parameters - S32 i; - for( i = 0; i < num_parameters; i++ ) - { - S32 param_id = 0; - F32 param_weight = 0.f; - fields_read = fscanf( file, "%d %f\n", ¶m_id, ¶m_weight ); - if( fields_read != 2 ) - { - llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl; - return FALSE; - } - mSavedVisualParamMap[param_id] = param_weight; - } - - // textures header - S32 num_textures = 0; - fields_read = fscanf( file, "textures %d\n", &num_textures); - if( fields_read != 1 ) - { - llwarns << "Bad Wearable asset: missing textures block" << llendl; - return FALSE; - } - - // textures - for( i = 0; i < num_textures; i++ ) - { - S32 te = 0; - fields_read = fscanf( /* Flawfinder: ignore */ - file, - "%d %2047s\n", - &te, text_buffer); - if( fields_read != 2 ) - { - llwarns << "Bad Wearable asset: bad texture, #" << i << llendl; - return FALSE; - } - - if( !LLUUID::validate( text_buffer ) ) - { - llwarns << "Bad Wearable asset: bad texture uuid: " << text_buffer << llendl; - return FALSE; - } - LLUUID id = LLUUID(text_buffer); - LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( id ); - if( mTEMap.find(te) != mTEMap.end() ) - { - delete mTEMap[te]; - } - if( mSavedTEMap.find(te) != mSavedTEMap.end() ) - { - delete mSavedTEMap[te]; - } - - if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime")) - { - image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te), NULL); - } - LLUUID textureid(text_buffer); - mTEMap[te] = new LLLocalTextureObject(image, textureid); - mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); - createLayers(te); - } - - // copy all saved param values to working params - revertValues(); - - return TRUE; -} - - -// Avatar parameter and texture definitions can change over time. -// This function returns true if parameters or textures have been added or removed -// since this wearable was created. -BOOL LLWearable::isOldVersion() const -{ - if (!isAgentAvatarValid()) return FALSE; - - if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) - { - llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl; - llassert(0); - } - - if( LLWearable::sCurrentDefinitionVersion != mDefinitionVersion ) - { - return TRUE; - } - - S32 param_count = 0; - for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) - { - if( (param->getWearableType() == mType) && (param->isTweakable() ) ) - { - param_count++; - if( !is_in_map(mVisualParamIndexMap, param->getID() ) ) - { - return TRUE; - } - } - } - if( param_count != mVisualParamIndexMap.size() ) - { - return TRUE; - } - - - S32 te_count = 0; - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - te_count++; - if( !is_in_map(mTEMap, te ) ) - { - return TRUE; - } - } - } - if( te_count != mTEMap.size() ) - { - return TRUE; - } - - return FALSE; -} - -// Avatar parameter and texture definitions can change over time. -// * If parameters or textures have been REMOVED since the wearable was created, -// they're just ignored, so we consider the wearable clean even though isOldVersion() -// will return true. -// * If parameters or textures have been ADDED since the wearable was created, -// they are taken to have default values, so we consider the wearable clean -// only if those values are the same as the defaults. -BOOL LLWearable::isDirty() const -{ - if (!isAgentAvatarValid()) return FALSE; - - for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) - { - if( (param->getWearableType() == mType) - && (param->isTweakable() ) - && !param->getCrossWearable()) - { - F32 current_weight = getVisualParamWeight(param->getID()); - current_weight = llclamp( current_weight, param->getMinWeight(), param->getMaxWeight() ); - F32 saved_weight = get_if_there(mSavedVisualParamMap, param->getID(), param->getDefaultWeight()); - saved_weight = llclamp( saved_weight, param->getMinWeight(), param->getMaxWeight() ); - - U8 a = F32_to_U8( saved_weight, param->getMinWeight(), param->getMaxWeight() ); - U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() ); - if( a != b ) - { - return TRUE; - } - } - } - - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - te_map_t::const_iterator current_iter = mTEMap.find(te); - if(current_iter != mTEMap.end()) - { - const LLUUID& current_image_id = current_iter->second->getID(); - te_map_t::const_iterator saved_iter = mSavedTEMap.find(te); - if(saved_iter != mSavedTEMap.end()) - { - const LLUUID& saved_image_id = saved_iter->second->getID(); - if (saved_image_id != current_image_id) - { - // saved vs current images are different, wearable is dirty - return TRUE; - } - } - else - { - // image found in current image list but not saved image list - return TRUE; - } - } - } - } - - return FALSE; -} - - -void LLWearable::setParamsToDefaults() -{ - if (!isAgentAvatarValid()) return; - - for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) - { - if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable() ) ) - { - setVisualParamWeight(param->getID(),param->getDefaultWeight(), FALSE); - } - } -} - -void LLWearable::setTexturesToDefaults() -{ - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - LLUUID id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te); - LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id ); - if( mTEMap.find(te) == mTEMap.end() ) - { - mTEMap[te] = new LLLocalTextureObject(image, id); - createLayers(te); - } - else - { - // Local Texture Object already created, just set image and UUID - LLLocalTextureObject *lto = mTEMap[te]; - lto->setID(id); - lto->setImage(image); - } - } - } -} - -// Updates the user's avatar's appearance -void LLWearable::writeToAvatar() -{ - if (!isAgentAvatarValid()) return; - - ESex old_sex = gAgentAvatarp->getSex(); - - // Pull params - for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) - { - // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the - // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way. - if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) ) - { - S32 param_id = param->getID(); - F32 weight = getVisualParamWeight(param_id); - - gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE ); - } - } - - // Pull texture entries - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - te_map_t::const_iterator iter = mTEMap.find(te); - LLUUID image_id; - if(iter != mTEMap.end()) - { - image_id = iter->second->getID(); - } - else - { - image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te); - } - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); - // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. - gAgentAvatarp->setLocalTextureTE(te, image, 0); - } - } - - ESex new_sex = gAgentAvatarp->getSex(); - if( old_sex != new_sex ) - { - gAgentAvatarp->updateSexDependentLayerSets( FALSE ); - } - -// if( upload_bake ) -// { -// gAgent.sendAgentSetAppearance(); -// } -} - - -// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values. -// static -void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ) -{ - if (!isAgentAvatarValid()) return; - - // You can't just remove body parts. - if( (type == LLWearableType::WT_SHAPE) || - (type == LLWearableType::WT_SKIN) || - (type == LLWearableType::WT_HAIR) || - (type == LLWearableType::WT_EYES) ) - { - return; - } - - // Pull params - for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) - { - if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable() ) ) - { - S32 param_id = param->getID(); - gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake ); - } - } - - if(gAgentCamera.cameraCustomizeAvatar()) - { - LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); - } - - gAgentAvatarp->updateVisualParams(); - gAgentAvatarp->wearableUpdated(type, FALSE); - -// if( upload_bake ) -// { -// gAgent.sendAgentSetAppearance(); -// } -} - -// Does not copy mAssetID. -// Definition version is current: removes obsolete enties and creates default values for new ones. -void LLWearable::copyDataFrom(const LLWearable* src) -{ - if (!isAgentAvatarValid()) return; - - mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; - - mName = src->mName; - mDescription = src->mDescription; - mPermissions = src->mPermissions; - mSaleInfo = src->mSaleInfo; - - setType(src->mType); - - mSavedVisualParamMap.clear(); - // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) - { - if( (param->getWearableType() == mType) ) - { - S32 id = param->getID(); - F32 weight = src->getVisualParamWeight(id); - mSavedVisualParamMap[id] = weight; - } - } - - destroyTextures(); - // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) - for (S32 te = 0; te < TEX_NUM_INDICES; te++) - { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - te_map_t::const_iterator iter = src->mTEMap.find(te); - LLUUID image_id; - LLViewerFetchedTexture *image = NULL; - if(iter != src->mTEMap.end()) - { - image = src->getLocalTextureObject(te)->getImage(); - image_id = src->getLocalTextureObject(te)->getID(); - mTEMap[te] = new LLLocalTextureObject(image, image_id); - mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); - mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady()); - mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard()); - } - else - { - image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te); - image = LLViewerTextureManager::getFetchedTexture( image_id ); - mTEMap[te] = new LLLocalTextureObject(image, image_id); - mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); - } - createLayers(te); - } - } - - // Probably reduntant, but ensure that the newly created wearable is not dirty by setting current value of params in new wearable - // to be the same as the saved values (which were loaded from src at param->cloneParam(this)) - revertValues(); -} - -void LLWearable::setItemID(const LLUUID& item_id) -{ - mItemID = item_id; -} - -const LLUUID& LLWearable::getItemID() const -{ - return mItemID; -} - -void LLWearable::setType(LLWearableType::EType type) -{ - mType = type; - createVisualParams(); -} - -LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) -{ - te_map_t::iterator iter = mTEMap.find(index); - if( iter != mTEMap.end() ) - { - LLLocalTextureObject* lto = iter->second; - return lto; - } - return NULL; -} - -const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const -{ - te_map_t::const_iterator iter = mTEMap.find(index); - if( iter != mTEMap.end() ) - { - const LLLocalTextureObject* lto = iter->second; - return lto; - } - return NULL; -} - -std::vector LLWearable::getLocalTextureListSeq() -{ - std::vector result; - - for(te_map_t::const_iterator iter = mTEMap.begin(); - iter != mTEMap.end(); iter++) - { - LLLocalTextureObject* lto = iter->second; - result.push_back(lto); - } - - return result; -} - -void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject <o) -{ - if( mTEMap.find(index) != mTEMap.end() ) - { - mTEMap.erase(index); - } - mTEMap[index] = new LLLocalTextureObject(lto); -} - - -void LLWearable::addVisualParam(LLVisualParam *param) -{ - if( mVisualParamIndexMap[param->getID()] ) - { - delete mVisualParamIndexMap[param->getID()]; - } - param->setIsDummy(FALSE); - mVisualParamIndexMap[param->getID()] = param; - mSavedVisualParamMap[param->getID()] = param->getDefaultWeight(); -} - -void LLWearable::setVisualParams() -{ - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - gAgentAvatarp->setVisualParamWeight(id, value, FALSE); - } -} - - -void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_bake) -{ - if( is_in_map(mVisualParamIndexMap, param_index ) ) - { - LLVisualParam *wearable_param = mVisualParamIndexMap[param_index]; - wearable_param->setWeight(value, upload_bake); - } - else - { - llerrs << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl; - } -} - -F32 LLWearable::getVisualParamWeight(S32 param_index) const -{ - if( is_in_map(mVisualParamIndexMap, param_index ) ) - { - const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second; - return wearable_param->getWeight(); - } - else - { - llwarns << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl; - } - return (F32)-1.0; -} - -LLVisualParam* LLWearable::getVisualParam(S32 index) const -{ - visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index); - return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second; -} - - -void LLWearable::getVisualParams(visual_param_vec_t &list) -{ - visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin(); - visual_param_index_map_t::iterator end = mVisualParamIndexMap.end(); - - // add all visual params to the passed-in vector - for( ; iter != end; ++iter ) - { - list.push_back(iter->second); - } -} - -void LLWearable::animateParams(F32 delta, BOOL upload_bake) -{ - for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin(); - iter != mVisualParamIndexMap.end(); - ++iter) - { - LLVisualParam *param = (LLVisualParam*) iter->second; - param->animate(delta, upload_bake); - } -} - -LLColor4 LLWearable::getClothesColor(S32 te) const -{ - LLColor4 color; - U32 param_name[3]; - if( LLVOAvatar::teToColorParams( (LLVOAvatarDefines::ETextureIndex)te, param_name ) ) - { - for( U8 index = 0; index < 3; index++ ) - { - color.mV[index] = getVisualParamWeight(param_name[index]); - } - } - return color; -} - -void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake ) -{ - U32 param_name[3]; - if( LLVOAvatar::teToColorParams( (LLVOAvatarDefines::ETextureIndex)te, param_name ) ) - { - for( U8 index = 0; index < 3; index++ ) - { - setVisualParamWeight(param_name[index], new_color.mV[index], upload_bake); - } - } -} - -void LLWearable::revertValues() -{ - //update saved settings so wearable is no longer dirty - // non-driver params first - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - F32 value = iter->second; - LLVisualParam *param = getVisualParam(id); - if(param && !dynamic_cast(param) ) - { - setVisualParamWeight(id, value, TRUE); - } - } - - //then driver params - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - F32 value = iter->second; - LLVisualParam *param = getVisualParam(id); - if(param && dynamic_cast(param) ) - { - setVisualParamWeight(id, value, TRUE); - } - } - - // make sure that saved values are sane - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *param = getVisualParam(id); - if( param ) - { - mSavedVisualParamMap[id] = param->getWeight(); - } - } - - syncImages(mSavedTEMap, mTEMap); - - - LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); - if( panel ) - { - panel->updateScrollingPanelList(); - } -} - -BOOL LLWearable::isOnTop() const -{ - return (this == gAgentWearables.getTopWearable(mType)); -} - -void LLWearable::createLayers(S32 te) -{ - LLTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); - if (layer_set) - { - layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); - } - else - { - llerrs << "could not find layerset for LTO in wearable!" << llendl; - } -} - -void LLWearable::saveValues() -{ - //update saved settings so wearable is no longer dirty - mSavedVisualParamMap.clear(); - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - mSavedVisualParamMap[id] = value; - } - - // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) - syncImages(mTEMap, mSavedTEMap); - - - LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); - if( panel ) - { - panel->updateScrollingPanelList(); - } -} - -void LLWearable::syncImages(te_map_t &src, te_map_t &dst) -{ - // Deep copy of src (copies only those tes that are current, filling in defaults where needed) - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - te_map_t::const_iterator iter = src.find(te); - LLUUID image_id; - LLViewerFetchedTexture *image = NULL; - LLLocalTextureObject *lto = NULL; - if(iter != src.end()) - { - // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map. - lto = iter->second; - image = lto->getImage(); - image_id = lto->getID(); - } - else - { - // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map. - image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te); - image = LLViewerTextureManager::getFetchedTexture( image_id ); - } - - if( dst.find(te) != dst.end() ) - { - // there's already an entry in the destination map for the texture. Just update its values. - dst[te]->setImage(image); - dst[te]->setID(image_id); - } - else - { - // no entry found in the destination map, we need to create a new Local Texture Object - dst[te] = new LLLocalTextureObject(image, image_id); - } - - if( lto ) - { - // If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map. - dst[te]->setBakedReady(lto->getBakedReady()); - dst[te]->setDiscard(lto->getDiscard()); - } - } - } -} - -void LLWearable::destroyTextures() -{ - for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter ) - { - LLLocalTextureObject *lto = iter->second; - delete lto; - } - mTEMap.clear(); - for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter ) - { - LLLocalTextureObject *lto = iter->second; - delete lto; - } - mSavedTEMap.clear(); -} - -void LLWearable::pullCrossWearableValues() -{ - // scan through all of the avatar's visual parameters - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if( param ) - { - LLDriverParam *driver_param = dynamic_cast(param); - if(driver_param) - { - // parameter is a driver parameter, have it update its - driver_param->updateCrossDrivenParams(getType()); - } - } - } -} - - -void LLWearable::setLabelUpdated() const -{ - gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID()); -} - -void LLWearable::refreshName() -{ - LLUUID item_id = getItemID(); - LLInventoryItem* item = gInventory.getItem(item_id); - if( item ) - { - mName = item->getName(); - } -} - -struct LLWearableSaveData -{ - LLWearableType::EType mType; -}; - -void LLWearable::saveNewAsset() const -{ -// llinfos << "LLWearable::saveNewAsset() type: " << getTypeName() << llendl; - //llinfos << *this << llendl; - - const std::string filename = asset_id_to_filename(mAssetID); - LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ - BOOL successful_save = FALSE; - if(fp && exportFile(fp)) - { - successful_save = TRUE; - } - if(fp) - { - fclose(fp); - fp = NULL; - } - if(!successful_save) - { - std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); - llwarns << buffer << llendl; - - LLSD args; - args["NAME"] = mName; - LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args); - return; - } - - // save it out to database - if( gAssetStorage ) - { - /* - std::string url = gAgent.getRegion()->getCapability("NewAgentInventory"); - if (!url.empty()) - { - llinfos << "Update Agent Inventory via capability" << llendl; - LLSD body; - body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType())); - body["asset_type"] = LLAssetType::lookup(getAssetType()); - body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE); - body["name"] = getName(); - body["description"] = getDescription(); - LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename)); - } - else - { - } - */ - LLWearableSaveData* data = new LLWearableSaveData; - data->mType = mType; - gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(), - &LLWearable::onSaveNewAssetComplete, - (void*)data); - } -} - -// static -void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LLWearableSaveData* data = (LLWearableSaveData*)userdata; - const std::string& type_name = LLWearableType::getTypeName(data->mType); - if(0 == status) - { - // Success - llinfos << "Saved wearable " << type_name << llendl; - } - else - { - std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str()); - llwarns << buffer << " Status: " << status << llendl; - LLSD args; - args["NAME"] = type_name; - LLNotificationsUtil::add("CannotSaveToAssetStore", args); - } - - // Delete temp file - const std::string src_filename = asset_id_to_filename(new_asset_id); - LLFile::remove(src_filename); - - // delete the context data - delete data; - -} - -std::ostream& operator<<(std::ostream &s, const LLWearable &w) -{ - s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n"; - s << " Name: " << w.mName << "\n"; - s << " Desc: " << w.mDescription << "\n"; - //w.mPermissions - //w.mSaleInfo - - s << " Params:" << "\n"; - for (LLWearable::visual_param_index_map_t::const_iterator iter = w.mVisualParamIndexMap.begin(); - iter != w.mVisualParamIndexMap.end(); ++iter) - { - S32 param_id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 param_weight = wearable_param->getWeight(); - s << " " << param_id << " " << param_weight << "\n"; - } - - s << " Textures:" << "\n"; - for (LLWearable::te_map_t::const_iterator iter = w.mTEMap.begin(); - iter != w.mTEMap.end(); ++iter) - { - S32 te = iter->first; - const LLUUID& image_id = iter->second->getID(); - s << " " << te << " " << image_id << "\n"; - } - return s; -} - - -std::string terse_F32_to_string(F32 f) -{ - std::string r = llformat("%.2f", f); - S32 len = r.length(); - - // "1.20" -> "1.2" - // "24.00" -> "24." - while (len > 0 && ('0' == r[len - 1])) - { - r.erase(len-1, 1); - len--; - } - if ('.' == r[len - 1]) - { - // "24." -> "24" - r.erase(len-1, 1); - } - else if (('-' == r[0]) && ('0' == r[1])) - { - // "-0.59" -> "-.59" - r.erase(1, 1); - } - else if ('0' == r[0]) - { - // "0.59" -> ".59" - r.erase(0, 1); - } - return r; -} - -std::string asset_id_to_filename(const LLUUID &asset_id) -{ - std::string asset_id_string; - asset_id.toString(asset_id_string); - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl"; - return filename; -} diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h deleted file mode 100644 index 3d8c53a755..0000000000 --- a/indra/newview/llwearable.h +++ /dev/null @@ -1,165 +0,0 @@ -/** - * @file llwearable.h - * @brief LLWearable class header file - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLWEARABLE_H -#define LL_LLWEARABLE_H - -#include "lluuid.h" -#include "llstring.h" -#include "llpermissions.h" -#include "llsaleinfo.h" -#include "llassetstorage.h" -#include "llwearabletype.h" -#include "llfile.h" -#include "lllocaltextureobject.h" - -class LLViewerInventoryItem; -class LLVisualParam; -class LLTexGlobalColorInfo; -class LLTexGlobalColor; - -class LLWearable -{ - friend class LLWearableList; - - //-------------------------------------------------------------------- - // Constructors and destructors - //-------------------------------------------------------------------- -private: - // Private constructors used by LLWearableList - LLWearable(const LLTransactionID& transactionID); - LLWearable(const LLAssetID& assetID); -public: - virtual ~LLWearable(); - - //-------------------------------------------------------------------- - // Accessors - //-------------------------------------------------------------------- -public: - const LLUUID& getItemID() const; - const LLAssetID& getAssetID() const { return mAssetID; } - const LLTransactionID& getTransactionID() const { return mTransactionID; } - LLWearableType::EType getType() const { return mType; } - void setType(LLWearableType::EType type); - const std::string& getName() const { return mName; } - void setName(const std::string& name) { mName = name; } - const std::string& getDescription() const { return mDescription; } - void setDescription(const std::string& desc) { mDescription = desc; } - const LLPermissions& getPermissions() const { return mPermissions; } - void setPermissions(const LLPermissions& p) { mPermissions = p; } - const LLSaleInfo& getSaleInfo() const { return mSaleInfo; } - void setSaleInfo(const LLSaleInfo& info) { mSaleInfo = info; } - const std::string& getTypeLabel() const; - const std::string& getTypeName() const; - LLAssetType::EType getAssetType() const; - S32 getDefinitionVersion() const { return mDefinitionVersion; } - void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; } - -public: - typedef std::vector visual_param_vec_t; - - BOOL isDirty() const; - BOOL isOldVersion() const; - - void writeToAvatar(); - void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); } - static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ); - - BOOL exportFile(LLFILE* file) const; - BOOL importFile(LLFILE* file); - - void setParamsToDefaults(); - void setTexturesToDefaults(); - - void saveNewAsset() const; - static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status ); - - void copyDataFrom(const LLWearable* src); - - static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; } - - friend std::ostream& operator<<(std::ostream &s, const LLWearable &w); - void setItemID(const LLUUID& item_id); - - LLLocalTextureObject* getLocalTextureObject(S32 index); - const LLLocalTextureObject* getLocalTextureObject(S32 index) const; - std::vector getLocalTextureListSeq(); - - void setLocalTextureObject(S32 index, LLLocalTextureObject <o); - void addVisualParam(LLVisualParam *param); - void setVisualParams(); - void setVisualParamWeight(S32 index, F32 value, BOOL upload_bake); - F32 getVisualParamWeight(S32 index) const; - LLVisualParam* getVisualParam(S32 index) const; - void getVisualParams(visual_param_vec_t &list); - void animateParams(F32 delta, BOOL upload_bake); - - LLColor4 getClothesColor(S32 te) const; - void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake ); - - void revertValues(); - void saveValues(); - void pullCrossWearableValues(); - - BOOL isOnTop() const; - - // Something happened that requires the wearable's label to be updated (e.g. worn/unworn). - void setLabelUpdated() const; - - // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem, - // not the wearable asset itself. - void refreshName(); - -private: - typedef std::map te_map_t; - typedef std::map visual_param_index_map_t; - - void createLayers(S32 te); - void createVisualParams(); - void syncImages(te_map_t &src, te_map_t &dst); - void destroyTextures(); - - static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. - S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. - std::string mName; - std::string mDescription; - LLPermissions mPermissions; - LLSaleInfo mSaleInfo; - LLAssetID mAssetID; - LLTransactionID mTransactionID; - LLWearableType::EType mType; - - typedef std::map param_map_t; - param_map_t mSavedVisualParamMap; // last saved version of visual params - - visual_param_index_map_t mVisualParamIndexMap; - - te_map_t mTEMap; // maps TE to LocalTextureObject - te_map_t mSavedTEMap; // last saved version of TEMap - LLUUID mItemID; // ID of the inventory item in the agent's inventory -}; - -#endif // LL_LLWEARABLE_H -- cgit v1.2.3 From 01a229ecdf466bc183ad68b130b0bb2befcc1e6a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 22 Aug 2012 15:27:34 -0400 Subject: SH-3625 WIP - consolidated a couple of attachment removal paths --- indra/newview/llappearancemgr.cpp | 4 ++++ indra/newview/llviewermenu.cpp | 27 ++++++++------------------- 2 files changed, 12 insertions(+), 19 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 71b7298f5c..2ad6f50ba9 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2765,6 +2765,10 @@ void LLAppearanceMgr::wearBaseOutfit() void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) { + if (ids_to_remove.empty()) + { + llwarns << "called with empty list, nothing to do" << llendl; + } for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it) { const LLUUID& id_to_remove = *it; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9001c79a4d..24bed93f04 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6389,23 +6389,21 @@ class LLAttachmentDetachFromPoint : public view_listener_t { bool handleEvent(const LLSD& user_data) { + uuid_vec_t ids_to_remove; const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL); if (attachment->getNumObjects() > 0) { - gMessageSystem->newMessage("ObjectDetach"); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator iter = attachment->mAttachedObjects.begin(); iter != attachment->mAttachedObjects.end(); iter++) { LLViewerObject *attached_object = (*iter); - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, attached_object->getLocalID()); + ids_to_remove.push_back(attached_object->getAttachmentItemID()); } - gMessageSystem->sendReliable( gAgent.getRegionHost() ); + } + if (!ids_to_remove.empty()) + { + LLAppearanceMgr::instance().removeItemsFromAvatar(ids_to_remove); } return true; } @@ -6478,17 +6476,8 @@ class LLAttachmentDetach : public view_listener_t return true; } - // The sendDetach() method works on the list of selected - // objects. Thus we need to clear the list, make sure it only - // contains the object the user clicked, send the message, - // then clear the list. - // We use deselectAll to update the simulator's notion of what's - // selected, and removeAll just to change things locally. - //RN: I thought it was more useful to detach everything that was selected - if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) - { - LLSelectMgr::getInstance()->sendDetach(); - } + LLAppearanceMgr::instance().removeItemFromAvatar(object->getAttachmentItemID()); + return true; } }; -- cgit v1.2.3 From 6e2739b76c669275b9ad62aa1b888cfc891012eb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 22 Aug 2012 16:16:54 -0400 Subject: SH-3625 - some associated cleanup, do_update field is useless in various calls because of possible race conditions --- indra/newview/llappearancemgr.cpp | 27 +++++++++------------------ indra/newview/llappearancemgr.h | 4 ++-- indra/newview/llgesturemgr.cpp | 2 +- indra/newview/llpaneleditwearable.cpp | 2 +- indra/newview/llvoavatarself.cpp | 2 +- 5 files changed, 14 insertions(+), 23 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2ad6f50ba9..2864338ef5 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -698,7 +698,7 @@ void LLWearableHoldingPattern::clearCOFLinksForMissingWearables() { // Wearable link that was never resolved; remove links to it from COF LL_INFOS("Avatar") << self_av_string() << "removing link for unresolved item " << data.mItemID.asString() << LL_ENDL; - LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID,false); + LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID); } } } @@ -812,7 +812,7 @@ void LLWearableHoldingPattern::handleLateArrivals() if (data.mWearable && data.mIsReplacement && replaced_types.find(data.mWearableType) != replaced_types.end()) { - LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID,false); + LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID); std::list::iterator clobber_ator = iter; ++iter; getFoundList().erase(clobber_ator); @@ -1052,7 +1052,7 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up if ((replace && wearable_count != 0) || (wearable_count >= LLAgentWearables::MAX_CLOTHING_PER_TYPE) ) { - removeCOFItemLinks(gAgentWearables.getWearableItemID(item_to_wear->getWearableType(), wearable_count-1), false); + removeCOFItemLinks(gAgentWearables.getWearableItemID(item_to_wear->getWearableType(), wearable_count-1)); } addCOFItemLink(item_to_wear, do_update, cb); } @@ -1062,7 +1062,7 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up // Remove the existing wearables of the same type. // Remove existing body parts anyway because we must not be able to wear e.g. two skins. - removeCOFLinksOfType(item_to_wear->getWearableType(), false); + removeCOFLinksOfType(item_to_wear->getWearableType()); addCOFItemLink(item_to_wear, do_update, cb); break; @@ -2270,7 +2270,7 @@ void LLAppearanceMgr::removeAllAttachmentsFromAvatar() removeItemsFromAvatar(ids_to_remove); } -void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update) +void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id) { gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); @@ -2288,13 +2288,9 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update) gInventory.purgeObject(item->getUUID()); } } - if (do_update) - { - LLAppearanceMgr::updateAppearanceFromCOF(); - } } -void LLAppearanceMgr::removeCOFLinksOfType(LLWearableType::EType type, bool do_update) +void LLAppearanceMgr::removeCOFLinksOfType(LLWearableType::EType type) { LLFindWearablesOfType filter_wearables_of_type(type); LLInventoryModel::cat_array_t cats; @@ -2310,11 +2306,6 @@ void LLAppearanceMgr::removeCOFLinksOfType(LLWearableType::EType type, bool do_u gInventory.purgeObject(item->getUUID()); } } - - if (do_update) - { - updateAppearanceFromCOF(); - } } bool sort_by_linked_uuid(const LLViewerInventoryItem* item1, const LLViewerInventoryItem* item2) @@ -2773,7 +2764,7 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) { const LLUUID& id_to_remove = *it; const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove); - removeCOFItemLinks(linked_item_id,false); + removeCOFItemLinks(linked_item_id); } updateAppearanceFromCOF(); } @@ -2781,7 +2772,7 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) { LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove); - removeCOFItemLinks(linked_item_id,false); + removeCOFItemLinks(linked_item_id); updateAppearanceFromCOF(); } @@ -2956,7 +2947,7 @@ void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id) if (mAttachmentInvLinkEnabled) { - LLAppearanceMgr::removeCOFItemLinks(item_id, false); + LLAppearanceMgr::removeCOFItemLinks(item_id); } else { diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index df27d5478a..d6187e1cfb 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -133,8 +133,8 @@ public: void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer cb = NULL); // Remove COF entries - void removeCOFItemLinks(const LLUUID& item_id, bool do_update = true); - void removeCOFLinksOfType(LLWearableType::EType type, bool do_update = true); + void removeCOFItemLinks(const LLUUID& item_id); + void removeCOFLinksOfType(LLWearableType::EType type); void removeAllClothesFromAvatar(); void removeAllAttachmentsFromAvatar(); diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 66ca76bfb0..05fd9640c8 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -337,7 +337,7 @@ void LLGestureMgr::deactivateGesture(const LLUUID& item_id) gAgent.sendReliableMessage(); - LLAppearanceMgr::instance().removeCOFItemLinks(base_item_id, false); + LLAppearanceMgr::instance().removeCOFItemLinks(base_item_id); notifyObservers(); } diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index d58d6d536c..d8ba2aa659 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1044,7 +1044,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) if (force_save_as) { // the name of the wearable has changed, re-save wearable with new name - LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID(),false); + LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID()); gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE); mNameEditor->setText(mWearableItem->getName()); } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 3604a373ad..6c8cbc37f7 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1296,7 +1296,7 @@ BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id) const LLViewerObject *attached_obj = gAgentAvatarp->getWornAttachment(item_id); if (!attached_obj) { - LLAppearanceMgr::instance().removeCOFItemLinks(item_id, false); + LLAppearanceMgr::instance().removeCOFItemLinks(item_id); } } return TRUE; -- cgit v1.2.3 From b59a443254ef11def158ffb46dbbb3d4d3dada4a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 22 Aug 2012 18:51:03 -0400 Subject: Removed UseServerTextureBaking setting, now key off region protocol bits --- indra/newview/app_settings/settings.xml | 11 ----------- indra/newview/llviewerregion.cpp | 12 +----------- 2 files changed, 1 insertion(+), 22 deletions(-) mode change 100644 => 100755 indra/newview/llviewerregion.cpp (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 32213a07a8..69986af83b 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12384,17 +12384,6 @@ Value 1 - UseServerTextureBaking - - Comment - Update appearance via the ServerTextureBaking cap, if available - Persist - 1 - Type - Boolean - Value - 1 - RenderSynchronousOcclusion Comment diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp old mode 100644 new mode 100755 index 58e4b804fd..fb50b8bb77 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1453,17 +1453,7 @@ void LLViewerRegion::unpackRegionHandshake() } - mCentralBakeVersion = (S32)gSavedSettings.getBOOL("UseServerTextureBaking"); - /* - if (msg->getSize("RegionInfo4", "CentralBakesVersion") > 0) - { - msg->getS32("RegionInfo4", "CentralBakesVersion", mCentralBakeVersion); - } - else - { - mCentralBakeVersion = 0; - } - */ + mCentralBakeVersion = region_protocols & 1; // was (S32)gSavedSettings.getBOOL("UseServerTextureBaking"); LLVLComposition *compp = getComposition(); if (compp) { -- cgit v1.2.3 From a6bdef648014ec1c7424b2bd307b3453cc5c786c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 28 Aug 2012 17:59:10 -0400 Subject: Force rebake now calls requestServerAppearanceUpdate() if supported --- indra/newview/llviewermenu.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 24bed93f04..3c0136c258 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7620,6 +7620,10 @@ void handle_rebake_textures(void*) // Slam pending upload count to "unstick" things bool slam_for_debug = true; gAgentAvatarp->forceBakeAllTextures(slam_for_debug); + if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()) + { + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); + } } void toggle_visibility(void* user_data) -- cgit v1.2.3 From 9e1b5bcd2cf40e9efe381f7fea7d855924b0f11c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 29 Aug 2012 18:20:29 -0400 Subject: SH-3312 FIX - closing floater with outfit edit now has same behavior as explicitly leaving outfit edit with backarrow --- indra/newview/llfloatersidepanelcontainer.cpp | 22 ++++++++++++++++++++++ indra/newview/llfloatersidepanelcontainer.h | 2 ++ 2 files changed, 24 insertions(+) mode change 100644 => 100755 indra/newview/llfloatersidepanelcontainer.cpp mode change 100644 => 100755 indra/newview/llfloatersidepanelcontainer.h (limited to 'indra/newview') diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp old mode 100644 new mode 100755 index 5385977d95..3c966a073f --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -32,6 +32,8 @@ // newview includes #include "llsidetraypanelcontainer.h" #include "lltransientfloatermgr.h" +#include "llpaneloutfitedit.h" +#include "llsidepanelappearance.h" //static const std::string LLFloaterSidePanelContainer::sMainPanelName("main_panel"); @@ -54,6 +56,26 @@ void LLFloaterSidePanelContainer::onOpen(const LLSD& key) getChild(sMainPanelName)->onOpen(key); } +void LLFloaterSidePanelContainer::onClickCloseBtn() +{ + llinfos << "close clicked" << llendl; + + LLPanelOutfitEdit* panel_outfit_edit = + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); + if (panel_outfit_edit && panel_outfit_edit->getVisible()) + { + LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); + if (parent == this) + { + LLSidepanelAppearance* panel_appearance = + dynamic_cast(getPanel("appearance")); + panel_appearance->showOutfitsInventoryPanel(); + } + } + + LLFloater::onClickCloseBtn(); +} + LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) { LLView* view = findChildView(panel_name, true); diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h old mode 100644 new mode 100755 index 10d85867ce..491723471f --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -51,6 +51,8 @@ public: /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClickCloseBtn(); + LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); static void showPanel(const std::string& floater_name, const LLSD& key); -- cgit v1.2.3 From 825cc7873251ad90720ab40221d689abed7b2ac8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 30 Aug 2012 17:36:03 -0400 Subject: log appearance update requests and results --- indra/newview/llappearancemgr.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2864338ef5..f71d9c7704 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2651,7 +2651,18 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder { public: - RequestAgentUpdateAppearanceResponder() {} + RequestAgentUpdateAppearanceResponder() + { + llinfos << "request created" << llendl; + } + + // Successful completion. + /* virtual */ void result(const LLSD& content) + { + llinfos << "request OK" << llendl; + } + + // Error /*virtual*/ void error(U32 status, const std::string& reason) { llwarns << "appearance update request failed, reason: " << reason << llendl; -- cgit v1.2.3 From c355fb98d3f4040196b7b8586dc9328fccb906d2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 06:12:50 +0000 Subject: Extracted texture baking system into llappearance library. --- indra/newview/CMakeLists.txt | 21 +- indra/newview/llagentwearables.cpp | 120 +- indra/newview/llagentwearables.h | 49 +- indra/newview/llappearancemgr.cpp | 28 +- indra/newview/llappearancemgr.h | 1 - indra/newview/llassetuploadresponders.cpp | 2 +- indra/newview/llavatariconctrl.cpp | 2 + indra/newview/lldriverparam.cpp | 17 +- indra/newview/llfloaterauction.cpp | 1 + indra/newview/llfloateravatartextures.cpp | 5 +- indra/newview/llgroupiconctrl.cpp | 1 + indra/newview/llinventorybridge.cpp | 6 +- indra/newview/llinventorybridge.h | 8 +- indra/newview/llinventoryicon.cpp | 183 --- indra/newview/llinventoryicon.h | 102 -- indra/newview/lllocalbitmaps.cpp | 4 +- indra/newview/lllocalbitmaps.h | 1 + indra/newview/lllocaltextureobject.cpp | 212 --- indra/newview/lllocaltextureobject.h | 87 - indra/newview/llpanelclassified.cpp | 1 + indra/newview/llpaneleditwearable.cpp | 10 +- indra/newview/llpaneleditwearable.h | 10 +- indra/newview/llpostcard.cpp | 1 + indra/newview/llsidepanelappearance.cpp | 10 +- indra/newview/llsidepanelappearance.h | 8 +- indra/newview/lltexglobalcolor.cpp | 152 -- indra/newview/lltexglobalcolor.h | 83 - indra/newview/lltexlayer.cpp | 2508 ----------------------------- indra/newview/lltexlayer.h | 380 ----- indra/newview/lltexlayerparams.cpp | 568 ------- indra/newview/lltexlayerparams.h | 193 --- indra/newview/lltextureview.cpp | 4 +- indra/newview/llviewerjoint.h | 20 +- indra/newview/llviewerjointmesh.cpp | 4 +- indra/newview/llviewerjointmesh.h | 6 +- indra/newview/llviewershadermgr.h | 1 - indra/newview/llviewerstats.cpp | 2 +- indra/newview/llviewertexlayer.cpp | 791 +++++++++ indra/newview/llviewertexlayer.h | 172 ++ indra/newview/llviewertexture.cpp | 25 + indra/newview/llviewertexture.h | 48 +- indra/newview/llviewervisualparam.cpp | 164 -- indra/newview/llviewervisualparam.h | 109 -- indra/newview/llviewerwearable.cpp | 900 +++++++++++ indra/newview/llviewerwearable.h | 116 ++ indra/newview/llvoavatar.cpp | 171 +- indra/newview/llvoavatar.h | 69 +- indra/newview/llvoavatardefines.cpp | 262 --- indra/newview/llvoavatardefines.h | 228 --- indra/newview/llvoavatarself.cpp | 65 +- indra/newview/llvoavatarself.h | 18 +- indra/newview/llwearablelist.cpp | 24 +- indra/newview/llwearablelist.h | 12 +- indra/newview/llwearabletype.cpp | 159 -- indra/newview/llwearabletype.h | 76 - 55 files changed, 2307 insertions(+), 5913 deletions(-) delete mode 100644 indra/newview/llinventoryicon.cpp delete mode 100644 indra/newview/llinventoryicon.h delete mode 100644 indra/newview/lllocaltextureobject.cpp delete mode 100644 indra/newview/lllocaltextureobject.h delete mode 100644 indra/newview/lltexglobalcolor.cpp delete mode 100644 indra/newview/lltexglobalcolor.h delete mode 100644 indra/newview/lltexlayer.cpp delete mode 100644 indra/newview/lltexlayer.h delete mode 100644 indra/newview/lltexlayerparams.cpp delete mode 100644 indra/newview/lltexlayerparams.h create mode 100644 indra/newview/llviewertexlayer.cpp create mode 100644 indra/newview/llviewertexlayer.h delete mode 100644 indra/newview/llviewervisualparam.cpp delete mode 100644 indra/newview/llviewervisualparam.h create mode 100644 indra/newview/llviewerwearable.cpp create mode 100644 indra/newview/llviewerwearable.h delete mode 100644 indra/newview/llvoavatardefines.cpp delete mode 100644 indra/newview/llvoavatardefines.h delete mode 100644 indra/newview/llwearabletype.cpp delete mode 100644 indra/newview/llwearabletype.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index ff3fb0038c..a40f7cd3d3 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -302,7 +302,6 @@ set(viewer_SOURCE_FILES llinventorybridge.cpp llinventoryfilter.cpp llinventoryfunctions.cpp - llinventoryicon.cpp llinventoryitemslist.cpp llinventorylistitem.cpp llinventorymodel.cpp @@ -316,7 +315,6 @@ set(viewer_SOURCE_FILES lllistcontextmenu.cpp lllistview.cpp lllocalbitmaps.cpp - lllocaltextureobject.cpp lllocationhistory.cpp lllocationinputctrl.cpp lllogchat.cpp @@ -495,9 +493,6 @@ set(viewer_SOURCE_FILES llsyswellwindow.cpp llteleporthistory.cpp llteleporthistorystorage.cpp - lltexglobalcolor.cpp - lltexlayer.cpp - lltexlayerparams.cpp lltextureatlas.cpp lltextureatlasmanager.cpp lltexturecache.cpp @@ -595,18 +590,18 @@ set(viewer_SOURCE_FILES llviewershadermgr.cpp llviewerstats.cpp llviewerstatsrecorder.cpp + llviewertexlayer.cpp llviewertexteditor.cpp llviewertexture.cpp llviewertextureanim.cpp llviewertexturelist.cpp llviewerthrottle.cpp - llviewervisualparam.cpp + llviewerwearable.cpp llviewerwindow.cpp llviewerwindowlistener.cpp llvlcomposition.cpp llvlmanager.cpp llvoavatar.cpp - llvoavatardefines.cpp llvoavatarself.cpp llvocache.cpp llvograss.cpp @@ -629,7 +624,6 @@ set(viewer_SOURCE_FILES llwaterparamset.cpp llwearableitemslist.cpp llwearablelist.cpp - llwearabletype.cpp llweb.cpp llwebprofile.cpp llwebsharing.cpp @@ -877,7 +871,6 @@ set(viewer_HEADER_FILES llinventorybridge.h llinventoryfilter.h llinventoryfunctions.h - llinventoryicon.h llinventoryitemslist.h llinventorylistitem.h llinventorymodel.h @@ -892,7 +885,6 @@ set(viewer_HEADER_FILES lllistcontextmenu.h lllistview.h lllocalbitmaps.h - lllocaltextureobject.h lllocationhistory.h lllocationinputctrl.h lllogchat.h @@ -1062,9 +1054,6 @@ set(viewer_HEADER_FILES lltable.h llteleporthistory.h llteleporthistorystorage.h - lltexglobalcolor.h - lltexlayer.h - lltexlayerparams.h lltextureatlas.h lltextureatlasmanager.h lltexturecache.h @@ -1163,18 +1152,18 @@ set(viewer_HEADER_FILES llviewershadermgr.h llviewerstats.h llviewerstatsrecorder.h + llviewertexlayer.h llviewertexteditor.h llviewertexture.h llviewertextureanim.h llviewertexturelist.h llviewerthrottle.h - llviewervisualparam.h + llviewerwearable.h llviewerwindow.h llviewerwindowlistener.h llvlcomposition.h llvlmanager.h llvoavatar.h - llvoavatardefines.h llvoavatarself.h llvocache.h llvograss.h @@ -1197,7 +1186,6 @@ set(viewer_HEADER_FILES llwaterparamset.h llwearableitemslist.h llwearablelist.h - llwearabletype.h llweb.h llwebprofile.h llwebsharing.h @@ -1834,6 +1822,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLPHYSICS_LIBRARIES} ${LLPHYSICSEXTENSIONS_LIBRARIES} ${TCMALLOC_LIBRARIES} + ${LLAPPEARANCE_LIBRARIES} ) if (USE_KDU) diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e44b27c6af..e4f02b9f0b 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -47,7 +47,7 @@ #include "lltooldraganddrop.h" #include "llviewerregion.h" #include "llvoavatarself.h" -#include "llwearable.h" +#include "llviewerwearable.h" #include "llwearablelist.h" #include @@ -82,7 +82,7 @@ class LLWearAndEditCallback : public LLInventoryCallback // wearable type stored in asset is some other value. // Calling this function whenever a wearable is added to increase visibility if this problem // turns up in other inventories. -void checkWearableAgainstInventory(LLWearable *wearable) +void checkWearableAgainstInventory(LLViewerWearable *wearable) { if (wearable->getItemID().isNull()) return; @@ -119,7 +119,7 @@ void LLAgentWearables::dump() llinfos << "Type: " << i << " count " << count << llendl; for (U32 j=0; j cb, LLWearableType::EType type, U32 index, LLWearable* wearable, U32 todo) : + LLPointer cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo) : mType(type), mIndex(index), mWearable(wearable), @@ -265,7 +265,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type, const U32 index, const LLUUID& item_id, - LLWearable* wearable) + LLViewerWearable* wearable) { llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl; @@ -312,7 +312,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() { for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index) { - LLWearable* wearable = getWearable((LLWearableType::EType)type,index); + LLViewerWearable* wearable = getWearable((LLWearableType::EType)type,index); if (wearable) { if (wearable->getItemID().isNull()) @@ -354,7 +354,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() U8 type_u8 = (U8)type; gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8); - LLWearable* wearable = getWearable((LLWearableType::EType)type, 0); + LLViewerWearable* wearable = getWearable((LLWearableType::EType)type, 0); if (wearable) { //llinfos << "Sending wearable " << wearable->getName() << llendl; @@ -382,14 +382,14 @@ void LLAgentWearables::sendAgentWearablesUpdate() void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update, const std::string new_name) { - LLWearable* old_wearable = getWearable(type, index); + LLViewerWearable* old_wearable = getWearable(type, index); if(!old_wearable) return; bool name_changed = !new_name.empty() && (new_name != old_wearable->getName()); if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion()) { LLUUID old_item_id = old_wearable->getItemID(); - LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable); - new_wearable->setItemID(old_item_id); // should this be in LLWearable::copyDataFrom()? + LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable); + new_wearable->setItemID(old_item_id); // should this be in LLViewerWearable::copyDataFrom()? setWearable(type,index,new_wearable); // old_wearable may still be referred to by other inventory items. Revert @@ -465,7 +465,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, llwarns << "LLAgent::saveWearableAs() not copyable." << llendl; return; } - LLWearable* old_wearable = getWearable(type, index); + LLViewerWearable* old_wearable = getWearable(type, index); if (!old_wearable) { llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl; @@ -480,7 +480,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, } std::string trunc_name(new_name); LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN); - LLWearable* new_wearable = LLWearableList::instance().createCopy( + LLViewerWearable* new_wearable = LLWearableList::instance().createCopy( old_wearable, trunc_name); LLPointer cb = @@ -518,7 +518,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index) { - LLWearable* wearable = getWearable(type, index); + LLViewerWearable* wearable = getWearable(type, index); llassert(wearable); if (wearable) { @@ -553,13 +553,13 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j); if (curr_item_id == item_id) { - LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j); + LLViewerWearable* old_wearable = getWearable((LLWearableType::EType)i,j); llassert(old_wearable); if (!old_wearable) continue; std::string old_name = old_wearable->getName(); old_wearable->setName(new_name); - LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable); + LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable); new_wearable->setItemID(item_id); LLInventoryItem* item = gInventory.getItem(item_id); if (item) @@ -640,14 +640,14 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp return item; } -const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const +const LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const { const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id); for (S32 i=0; i < LLWearableType::WT_COUNT; i++) { for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++) { - const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); + const LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); if (curr_wearable && (curr_wearable->getItemID() == base_item_id)) { return curr_wearable; @@ -657,14 +657,14 @@ const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) return NULL; } -LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) +LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) { const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id); for (S32 i=0; i < LLWearableType::WT_COUNT; i++) { for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++) { - LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); + LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); if (curr_wearable && (curr_wearable->getItemID() == base_item_id)) { return curr_wearable; @@ -674,13 +674,13 @@ LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) return NULL; } -LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id) +LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id) { for (S32 i=0; i < LLWearableType::WT_COUNT; i++) { for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++) { - LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); + LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); if (curr_wearable && (curr_wearable->getAssetID() == asset_id)) { return curr_wearable; @@ -705,7 +705,7 @@ BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type) return (gAgentWearables.getWearableCount(type) > 0); } -LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) +LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) { wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type); if (wearable_iter == mWearableDatas.end()) @@ -723,10 +723,10 @@ LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 } } -void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable) +void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLViewerWearable *wearable) { - LLWearable *old_wearable = getWearable(type,index); + LLViewerWearable *old_wearable = getWearable(type,index); if (!old_wearable) { pushWearable(type,wearable); @@ -753,7 +753,7 @@ void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, } } -U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable *wearable) +U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable) { if (wearable == NULL) { @@ -771,7 +771,7 @@ U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable return MAX_CLOTHING_PER_TYPE; } -void LLAgentWearables::wearableUpdated(LLWearable *wearable) +void LLAgentWearables::wearableUpdated(LLViewerWearable *wearable) { gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE); wearable->refreshName(); @@ -794,7 +794,7 @@ void LLAgentWearables::wearableUpdated(LLWearable *wearable) } -void LLAgentWearables::popWearable(LLWearable *wearable) +void LLAgentWearables::popWearable(LLViewerWearable *wearable) { if (wearable == NULL) { @@ -813,7 +813,7 @@ void LLAgentWearables::popWearable(LLWearable *wearable) void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index) { - LLWearable *wearable = getWearable(type, index); + LLViewerWearable *wearable = getWearable(type, index); if (wearable) { mWearableDatas[type].erase(mWearableDatas[type].begin() + index); @@ -825,7 +825,7 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index) } } -U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const +U32 LLAgentWearables::getWearableIndex(const LLViewerWearable *wearable) const { if (wearable == NULL) { @@ -851,7 +851,7 @@ U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const return MAX_CLOTHING_PER_TYPE; } -const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const +const LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const { wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); if (wearable_iter == mWearableDatas.end()) @@ -869,7 +869,7 @@ const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type } } -LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type) +LLViewerWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type) { U32 count = getWearableCount(type); if ( count == 0) @@ -880,7 +880,7 @@ LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type) return getWearable(type, count-1); } -LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type) +LLViewerWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type) { if (getWearableCount(type) == 0) { @@ -920,7 +920,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const { - const LLWearable *wearable = getWearable(type,index); + const LLViewerWearable *wearable = getWearable(type,index); if (wearable) return wearable->getItemID(); else @@ -929,7 +929,7 @@ const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const { - const LLWearable *wearable = getWearable(type,index); + const LLViewerWearable *wearable = getWearable(type,index); if (wearable) return wearable->getAssetID(); else @@ -1012,7 +1012,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i); if (asset_id.isNull()) { - LLWearable::removeFromAvatar(type, FALSE); + LLViewerWearable::removeFromAvatar(type, FALSE); } else { @@ -1058,7 +1058,7 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, // Try to recover by replacing missing wearable with a new one. LLNotificationsUtil::add("ReplacedMissingWearable"); lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; - LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type); + LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type); setWearable(type,index,new_wearable); //new_wearable->writeToAvatar(TRUE); @@ -1095,7 +1095,7 @@ void LLAgentWearables::recoverMissingWearableDone() void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index) { - LLWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index); + LLViewerWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index); if (!wearable) { llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl; @@ -1128,7 +1128,7 @@ public: mItemsToLink, link_waiter); } - void addPendingWearable(LLWearable *wearable) + void addPendingWearable(LLViewerWearable *wearable) { if (!wearable) { @@ -1163,7 +1163,7 @@ public: LLWearableType::EType type = item->getWearableType(); if (type < LLWearableType::WT_COUNT) { - LLWearable *wearable = mWearablesAwaitingItems[type]; + LLViewerWearable *wearable = mWearablesAwaitingItems[type]; if (wearable) wearable->setItemID(inv_item); } @@ -1176,7 +1176,7 @@ public: private: LLInventoryModel::item_array_t mItemsToLink; - std::vector mWearablesAwaitingItems; + std::vector mWearablesAwaitingItems; }; void LLAgentWearables::createStandardWearables() @@ -1208,7 +1208,7 @@ void LLAgentWearables::createStandardWearables() if (create[i]) { llassert(getWearableCount((LLWearableType::EType)i) == 0); - LLWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i); + LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i); ((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable); // no need to update here... LLUUID category_id = LLUUID::null; @@ -1267,7 +1267,7 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index) void LLAgentWearables::addWearableToAgentInventory(LLPointer cb, - LLWearable* wearable, + LLViewerWearable* wearable, const LLUUID& category_id, BOOL notify) { @@ -1305,7 +1305,7 @@ void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_ } else { - LLWearable* old_wearable = getWearable(type,index); + LLViewerWearable* old_wearable = getWearable(type,index); if (old_wearable) { @@ -1363,7 +1363,7 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo S32 max_entry = mWearableDatas[type].size()-1; for (S32 i=max_entry; i>=0; i--) { - LLWearable* old_wearable = getWearable(type,i); + LLViewerWearable* old_wearable = getWearable(type,i); //queryWearableCache(); // moved below if (old_wearable) { @@ -1375,7 +1375,7 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo } else { - LLWearable* old_wearable = getWearable(type, index); + LLViewerWearable* old_wearable = getWearable(type, index); //queryWearableCache(); // moved below if (old_wearable) @@ -1394,7 +1394,7 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo // Assumes existing wearables are not dirty. void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items, - const LLDynamicArray< LLWearable* >& wearables, + const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove) { llinfos << "setWearableOutfit() start" << llendl; @@ -1419,7 +1419,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it S32 i; for (i = 0; i < count; i++) { - LLWearable* new_wearable = wearables[i]; + LLViewerWearable* new_wearable = wearables[i]; LLPointer new_item = items[i]; llassert(new_wearable); @@ -1476,7 +1476,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it // User has picked "wear on avatar" from a menu. -void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append) +void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append) { //LLAgentDumper dumper("setWearableItem"); if (isWearingItem(new_item->getUUID())) @@ -1491,7 +1491,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne { // Remove old wearable, if any // MULTI_WEARABLE: hardwired to 0 - LLWearable* old_wearable = getWearable(type,0); + LLViewerWearable* old_wearable = getWearable(type,0); if (old_wearable) { const LLUUID& old_item_id = old_wearable->getItemID(); @@ -1517,7 +1517,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne } // static -bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable) +bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); LLInventoryItem* new_item = gInventory.getItem(notification["payload"]["item_id"].asUUID()); @@ -1553,7 +1553,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& // Called from setWearableItem() and onSetWearableDialog() to actually set the wearable. // MULTI_WEARABLE: unify code after null objects are gone. -void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append) +void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append) { const LLWearableType::EType type = new_wearable->getType(); @@ -1570,7 +1570,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n // Replace the old wearable with a new one. llassert(new_item->getAssetUUID() == new_wearable->getAssetID()); - LLWearable *old_wearable = getWearable(type,0); + LLViewerWearable *old_wearable = getWearable(type,0); LLUUID old_item_id; if (old_wearable) { @@ -1666,7 +1666,7 @@ LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextur const U32 num_wearables = getWearableCount(baked_type); for (U32 index = 0; index < num_wearables; ++index) { - const LLWearable* wearable = getWearable(baked_type,index); + const LLViewerWearable* wearable = getWearable(baked_type,index); if (wearable) { LLUUID asset_id = wearable->getAssetID(); @@ -1902,11 +1902,11 @@ void LLAgentWearables::checkWearablesLoaded() const // (depending on closer_to_body parameter). bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) { - const LLWearable* wearable = getWearableFromItemID(item_id); + const LLViewerWearable* wearable = getWearableFromItemID(item_id); if (!wearable) return false; LLWearableType::EType wtype = wearable->getType(); - const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype); + const LLViewerWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype); if (!marginal_wearable) return false; return wearable != marginal_wearable; @@ -1928,7 +1928,7 @@ void LLAgentWearables::updateWearablesLoaded() } } -bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const +bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const { if (!wearable) return false; @@ -1943,7 +1943,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake) { for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count) { - LLWearable *wearable = getWearable((LLWearableType::EType)type,count); + LLViewerWearable *wearable = getWearable((LLWearableType::EType)type,count); llassert(wearable); if (wearable) { @@ -1972,7 +1972,7 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos for (U32 i = 0; i < wearable_vec.size(); ++i) { - LLWearable* wearable = wearable_vec[i]; + LLViewerWearable* wearable = wearable_vec[i]; if (!wearable) continue; if (wearable->getAssetID() != asset_id) continue; @@ -1991,7 +1991,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con { if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return; - LLWearable* wearable = LLWearableList::instance().createNewWearable(type); + LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; LLPointer cb = wear ? new LLWearAndEditCallback : NULL; @@ -2024,7 +2024,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) return; } - LLWearable* wearable = gAgentWearables.getWearableFromItemID(item_id); + LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id); if (!wearable) { llwarns << "Cannot get wearable" << llendl; diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 5932be21c6..3df552544b 100755 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -40,10 +40,9 @@ class LLInventoryItem; class LLVOAvatarSelf; -class LLWearable; +class LLViewerWearable; class LLInitialWearablesFetch; class LLViewerObject; -class LLTexLayerTemplate; class LLAgentWearables : public LLInitClass { @@ -82,7 +81,7 @@ public: bool canMoveWearable(const LLUUID& item_id, bool closer_to_body); // Note: False for shape, skin, eyes, and hair, unless you have MORE than 1. - bool canWearableBeRemoved(const LLWearable* wearable) const; + bool canWearableBeRemoved(const LLViewerWearable* wearable) const; void animateAllWearableParams(F32 delta, BOOL upload_bake); @@ -92,15 +91,15 @@ public: public: const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const; const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const; - const LLWearable* getWearableFromItemID(const LLUUID& item_id) const; - LLWearable* getWearableFromItemID(const LLUUID& item_id); - LLWearable* getWearableFromAssetID(const LLUUID& asset_id); + const LLViewerWearable* getWearableFromItemID(const LLUUID& item_id) const; + LLViewerWearable* getWearableFromItemID(const LLUUID& item_id); + LLViewerWearable* getWearableFromAssetID(const LLUUID& asset_id); LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/); static BOOL selfHasWearable(LLWearableType::EType type); - LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/); - const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; - LLWearable* getTopWearable(const LLWearableType::EType type); - LLWearable* getBottomWearable(const LLWearableType::EType type); + LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/); + const LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; + LLViewerWearable* getTopWearable(const LLWearableType::EType type); + LLViewerWearable* getBottomWearable(const LLWearableType::EType type); U32 getWearableCount(const LLWearableType::EType type) const; U32 getWearableCount(const U32 tex_index) const; @@ -113,31 +112,31 @@ public: private: // Low-level data structure setter - public access is via setWearableItem, etc. - void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable); - U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable); - void wearableUpdated(LLWearable *wearable); - void popWearable(LLWearable *wearable); + void setWearable(const LLWearableType::EType type, U32 index, LLViewerWearable *wearable); + U32 pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable); + void wearableUpdated(LLViewerWearable *wearable); + void popWearable(LLViewerWearable *wearable); void popWearable(const LLWearableType::EType type, U32 index); public: - void setWearableItem(LLInventoryItem* new_item, LLWearable* wearable, bool do_append = false); - void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove); + void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false); + void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove); void setWearableName(const LLUUID& item_id, const std::string& new_name); void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index); - U32 getWearableIndex(const LLWearable *wearable) const; + U32 getWearableIndex(const LLViewerWearable *wearable) const; protected: - void setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append = false); - static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable); + void setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append = false); + static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable); void addWearableToAgentInventory(LLPointer cb, - LLWearable* wearable, + LLViewerWearable* wearable, const LLUUID& category_id = LLUUID::null, BOOL notify = TRUE); void addWearabletoAgentInventoryDone(const LLWearableType::EType type, const U32 index, const LLUUID& item_id, - LLWearable* wearable); + LLViewerWearable* wearable); void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/); void recoverMissingWearableDone(); @@ -180,7 +179,7 @@ protected: void sendAgentWearablesRequest(); void queryWearableCache(); void updateServer(); - static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata); + static void onInitialWearableAssetArrived(LLViewerWearable* wearable, void* userdata); //-------------------------------------------------------------------- // Outfits @@ -245,7 +244,7 @@ private: // Member variables //-------------------------------------------------------------------- private: - typedef std::vector wearableentry_vec_t; // all wearables of a certain type (EG all shirts) + typedef std::vector wearableentry_vec_t; // all wearables of a certain type (EG all shirts) typedef std::map wearableentry_map_t; // wearable "categories" arranged by wearable type wearableentry_map_t mWearableDatas; @@ -289,13 +288,13 @@ private: addWearableToAgentInventoryCallback(LLPointer cb, LLWearableType::EType type, U32 index, - LLWearable* wearable, + LLViewerWearable* wearable, U32 todo = CALL_NONE); virtual void fire(const LLUUID& inv_item); private: LLWearableType::EType mType; U32 mIndex; - LLWearable* mWearable; + LLViewerWearable* mWearable; U32 mTodo; LLPointer mCB; }; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3e02f98933..58a0b0fa5b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -277,7 +277,7 @@ struct LLFoundData std::string mName; LLAssetType::EType mAssetType; LLWearableType::EType mWearableType; - LLWearable* mWearable; + LLViewerWearable* mWearable; bool mIsReplacement; }; @@ -301,7 +301,7 @@ public: void recoverMissingWearable(LLWearableType::EType type); void clearCOFLinksForMissingWearables(); - void onWearableAssetFetch(LLWearable *wearable); + void onWearableAssetFetch(LLViewerWearable *wearable); void onAllComplete(); typedef std::list found_list_t; @@ -327,7 +327,7 @@ private: typedef std::set type_set_hp; static type_set_hp sActiveHoldingPatterns; bool mIsMostRecent; - std::set mLateArrivals; + std::set mLateArrivals; bool mIsAllComplete; }; @@ -561,7 +561,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion() class RecoveredItemLinkCB: public LLInventoryCallback { public: - RecoveredItemLinkCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder): + RecoveredItemLinkCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder): mHolder(holder), mWearable(wearable), mType(type) @@ -609,14 +609,14 @@ public: } private: LLWearableHoldingPattern* mHolder; - LLWearable *mWearable; + LLViewerWearable *mWearable; LLWearableType::EType mType; }; class RecoveredItemCB: public LLInventoryCallback { public: - RecoveredItemCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder): + RecoveredItemCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder): mHolder(holder), mWearable(wearable), mType(type) @@ -649,7 +649,7 @@ public: } private: LLWearableHoldingPattern* mHolder; - LLWearable *mWearable; + LLViewerWearable *mWearable; LLWearableType::EType mType; }; @@ -665,7 +665,7 @@ void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type LLNotificationsUtil::add("ReplacedMissingWearable"); lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; - LLWearable* wearable = LLWearableList::instance().createNewWearable(type); + LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type); // Add a new one in the lost and found folder. const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); @@ -772,11 +772,11 @@ void LLWearableHoldingPattern::handleLateArrivals() iter != getFoundList().end(); ++iter) { LLFoundData& data = *iter; - for (std::set::iterator wear_it = mLateArrivals.begin(); + for (std::set::iterator wear_it = mLateArrivals.begin(); wear_it != mLateArrivals.end(); ++wear_it) { - LLWearable *wearable = *wear_it; + LLViewerWearable *wearable = *wear_it; if(wearable->getAssetID() == data.mAssetID) { @@ -836,7 +836,7 @@ void LLWearableHoldingPattern::resetTime(F32 timeout) mWaitTime.setTimerExpirySec(timeout); } -void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable) +void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable) { if (!isMostRecent()) { @@ -887,7 +887,7 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable) } } -static void onWearableAssetFetch(LLWearable* wearable, void* data) +static void onWearableAssetFetch(LLViewerWearable* wearable, void* data) { LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data; holder->onWearableAssetFetch(wearable); @@ -1588,7 +1588,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo { lldebugs << "updateAgentWearables()" << llendl; LLInventoryItem::item_array_t items; - LLDynamicArray< LLWearable* > wearables; + LLDynamicArray< LLViewerWearable* > wearables; // For each wearable type, find the wearables of that type. for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) @@ -1597,7 +1597,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo iter != holder->getFoundList().end(); ++iter) { LLFoundData& data = *iter; - LLWearable* wearable = data.mWearable; + LLViewerWearable* wearable = data.mWearable; if( wearable && ((S32)wearable->getType() == i) ) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 742833211a..370aec8a8f 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -35,7 +35,6 @@ #include "llinventoryobserver.h" #include "llviewerinventory.h" -class LLWearable; class LLWearableHoldingPattern; class LLInventoryCallback; class LLOutfitUnLockTimer; diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 65bfc990d1..35e44d73d4 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -48,8 +48,8 @@ #include "llviewercontrol.h" #include "llviewerobjectlist.h" #include "llviewermenufile.h" +#include "llviewertexlayer.h" #include "llviewerwindow.h" -#include "lltexlayer.h" #include "lltrans.h" // library includes diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index b539ac38ed..d2acd32713 100755 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -37,6 +37,8 @@ #include "lluictrlfactory.h" #include "llagentdata.h" #include "llimfloater.h" +#include "llviewertexture.h" +#include "llvoavatardefines.h" // library includes #include "llavatarnamecache.h" diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 885cae1737..0ae9acd1af 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -32,7 +32,7 @@ #include "llvoavatar.h" #include "llvoavatarself.h" #include "llagent.h" -#include "llwearable.h" +#include "llviewerwearable.h" #include "llagentwearables.h" //----------------------------------------------------------------------------- @@ -623,10 +623,19 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake) { + bool use_self = false; if(isAgentAvatarValid() && - mWearablep && - driven->mParam->getCrossWearable() && - mWearablep->isOnTop()) + mWearablep && + driven->mParam->getCrossWearable()) + { + LLViewerWearable* wearable = dynamic_cast (mWearablep); + if (!wearable->isOnTop()) + { + use_self = false; + } + } + + if (use_self) { // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake ); diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index 2939d31087..3c40e2d4bc 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -38,6 +38,7 @@ #include "message.h" #include "llagent.h" +#include "llassetstorage.h" #include "llcombobox.h" #include "llestateinfomodel.h" #include "llmimetypes.h" diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 4e10b4fc2c..b26b302ea6 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -32,6 +32,7 @@ #include "llagent.h" #include "llagentwearables.h" +#include "llviewerwearable.h" #include "lltexturectrl.h" #include "lluictrlfactory.h" #include "llviewerobjectlist.h" @@ -81,7 +82,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp, if (avatarp->isSelf()) { const LLWearableType::EType wearable_type = tex_entry->mWearableType; - LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); + LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); if (wearable) { LLLocalTextureObject *lto = wearable->getLocalTextureObject(te); @@ -173,7 +174,7 @@ void LLFloaterAvatarTextures::onClickDump(void* data) LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i); if (avatarp->isSelf()) { - LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); + LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); if (wearable) { LLLocalTextureObject *lto = wearable->getLocalTextureObject(i); diff --git a/indra/newview/llgroupiconctrl.cpp b/indra/newview/llgroupiconctrl.cpp index 2f9810775b..97f72b020c 100644 --- a/indra/newview/llgroupiconctrl.cpp +++ b/indra/newview/llgroupiconctrl.cpp @@ -29,6 +29,7 @@ #include "llgroupiconctrl.h" #include "llagent.h" +#include "llviewertexture.h" /* #include "llavatarconstants.h" #include "llcallingcard.h" // for LLAvatarTracker diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b819100b9b..17e9b8026a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -5692,7 +5692,7 @@ void LLWearableBridge::wearAddOnAvatar() } // static -void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata ) +void LLWearableBridge::onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata ) { LLUUID* item_id = (LLUUID*) userdata; if(wearable) @@ -5718,7 +5718,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userda // static // BAP remove the "add" code path once everything is fully COF-ified. -void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ) +void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata ) { LLUUID* item_id = (LLUUID*) userdata; if(wearable) @@ -5799,7 +5799,7 @@ void LLWearableBridge::onRemoveFromAvatar(void* user_data) } // static -void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, +void LLWearableBridge::onRemoveFromAvatarArrived(LLViewerWearable* wearable, void* userdata) { OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata; diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index dc9e88d54d..067e4bdf3d 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -33,7 +33,7 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llviewercontrol.h" -#include "llwearable.h" +#include "llviewerwearable.h" class LLInventoryFilter; class LLInventoryPanel; @@ -486,10 +486,10 @@ public: static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu static BOOL canWearOnAvatar( void* userdata ); - static void onWearOnAvatarArrived( LLWearable* wearable, void* userdata ); + static void onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata ); void wearOnAvatar(); - static void onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ); + static void onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata ); void wearAddOnAvatar(); static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu @@ -498,7 +498,7 @@ public: static BOOL canRemoveFromAvatar( void* userdata ); static void onRemoveFromAvatar( void* userdata ); - static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata ); + static void onRemoveFromAvatarArrived( LLViewerWearable* wearable, void* userdata ); static void removeItemFromAvatar(LLViewerInventoryItem *item); static void removeAllClothesFromAvatar(); void removeFromAvatar(); diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp deleted file mode 100644 index 34734d57c5..0000000000 --- a/indra/newview/llinventoryicon.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/** - * @file llinventoryicon.cpp - * @brief Implementation of the inventory icon. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llinventoryicon.h" - -#include "lldictionary.h" -#include "llinventorydefines.h" -#include "llui.h" -#include "llwearabletype.h" - -struct IconEntry : public LLDictionaryEntry -{ - IconEntry(const std::string &item_name) - : - LLDictionaryEntry(item_name) - {} -}; - -class LLIconDictionary : public LLSingleton, - public LLDictionary -{ -public: - LLIconDictionary(); -}; - -LLIconDictionary::LLIconDictionary() -{ - addEntry(LLInventoryIcon::ICONNAME_TEXTURE, new IconEntry("Inv_Texture")); - addEntry(LLInventoryIcon::ICONNAME_SOUND, new IconEntry("Inv_Sound")); - addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_ONLINE, new IconEntry("Inv_CallingCard")); - addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_OFFLINE, new IconEntry("Inv_CallingCard")); - addEntry(LLInventoryIcon::ICONNAME_LANDMARK, new IconEntry("Inv_Landmark")); - addEntry(LLInventoryIcon::ICONNAME_LANDMARK_VISITED, new IconEntry("Inv_Landmark")); - addEntry(LLInventoryIcon::ICONNAME_SCRIPT, new IconEntry("Inv_Script")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING, new IconEntry("Inv_Clothing")); - addEntry(LLInventoryIcon::ICONNAME_OBJECT, new IconEntry("Inv_Object")); - addEntry(LLInventoryIcon::ICONNAME_OBJECT_MULTI, new IconEntry("Inv_Object_Multi")); - addEntry(LLInventoryIcon::ICONNAME_NOTECARD, new IconEntry("Inv_Notecard")); - addEntry(LLInventoryIcon::ICONNAME_BODYPART, new IconEntry("Inv_Skin")); - addEntry(LLInventoryIcon::ICONNAME_SNAPSHOT, new IconEntry("Inv_Snapshot")); - - addEntry(LLInventoryIcon::ICONNAME_BODYPART_SHAPE, new IconEntry("Inv_BodyShape")); - addEntry(LLInventoryIcon::ICONNAME_BODYPART_SKIN, new IconEntry("Inv_Skin")); - addEntry(LLInventoryIcon::ICONNAME_BODYPART_HAIR, new IconEntry("Inv_Hair")); - addEntry(LLInventoryIcon::ICONNAME_BODYPART_EYES, new IconEntry("Inv_Eye")); - - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SHIRT, new IconEntry("Inv_Shirt")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_PANTS, new IconEntry("Inv_Pants")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SHOES, new IconEntry("Inv_Shoe")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SOCKS, new IconEntry("Inv_Socks")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_JACKET, new IconEntry("Inv_Jacket")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_GLOVES, new IconEntry("Inv_Gloves")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_UNDERSHIRT, new IconEntry("Inv_Undershirt")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_UNDERPANTS, new IconEntry("Inv_Underpants")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SKIRT, new IconEntry("Inv_Skirt")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_ALPHA, new IconEntry("Inv_Alpha")); - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_TATTOO, new IconEntry("Inv_Tattoo")); - addEntry(LLInventoryIcon::ICONNAME_ANIMATION, new IconEntry("Inv_Animation")); - addEntry(LLInventoryIcon::ICONNAME_GESTURE, new IconEntry("Inv_Gesture")); - - addEntry(LLInventoryIcon::ICONNAME_CLOTHING_PHYSICS, new IconEntry("Inv_Physics")); - - addEntry(LLInventoryIcon::ICONNAME_LINKITEM, new IconEntry("Inv_LinkItem")); - addEntry(LLInventoryIcon::ICONNAME_LINKFOLDER, new IconEntry("Inv_LinkFolder")); - addEntry(LLInventoryIcon::ICONNAME_MESH, new IconEntry("Inv_Mesh")); - - addEntry(LLInventoryIcon::ICONNAME_INVALID, new IconEntry("Inv_Invalid")); - - addEntry(LLInventoryIcon::ICONNAME_NONE, new IconEntry("NONE")); -} - -LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type, - U32 misc_flag, - BOOL item_is_multi) -{ - const std::string& icon_name = getIconName(asset_type, inventory_type, misc_flag, item_is_multi); - return LLUI::getUIImage(icon_name); -} - -LLUIImagePtr LLInventoryIcon::getIcon(EIconName idx) -{ - return LLUI::getUIImage(getIconName(idx)); -} - -const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type, - U32 misc_flag, - BOOL item_is_multi) -{ - EIconName idx = ICONNAME_OBJECT; - if (item_is_multi) - { - idx = ICONNAME_OBJECT_MULTI; - return getIconName(idx); - } - - switch(asset_type) - { - case LLAssetType::AT_TEXTURE: - idx = (inventory_type == LLInventoryType::IT_SNAPSHOT) ? ICONNAME_SNAPSHOT : ICONNAME_TEXTURE; - break; - case LLAssetType::AT_SOUND: - idx = ICONNAME_SOUND; - break; - case LLAssetType::AT_CALLINGCARD: - idx = (misc_flag != 0) ? ICONNAME_CALLINGCARD_ONLINE : ICONNAME_CALLINGCARD_OFFLINE; - break; - case LLAssetType::AT_LANDMARK: - idx = (misc_flag != 0) ? ICONNAME_LANDMARK_VISITED : ICONNAME_LANDMARK; - break; - case LLAssetType::AT_SCRIPT: - case LLAssetType::AT_LSL_TEXT: - case LLAssetType::AT_LSL_BYTECODE: - idx = ICONNAME_SCRIPT; - break; - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - idx = assignWearableIcon(misc_flag); - break; - case LLAssetType::AT_NOTECARD: - idx = ICONNAME_NOTECARD; - break; - case LLAssetType::AT_ANIMATION: - idx = ICONNAME_ANIMATION; - break; - case LLAssetType::AT_GESTURE: - idx = ICONNAME_GESTURE; - break; - case LLAssetType::AT_LINK: - idx = ICONNAME_LINKITEM; - break; - case LLAssetType::AT_LINK_FOLDER: - idx = ICONNAME_LINKFOLDER; - break; - case LLAssetType::AT_OBJECT: - idx = ICONNAME_OBJECT; - break; - case LLAssetType::AT_MESH: - idx = ICONNAME_MESH; - default: - break; - } - - return getIconName(idx); -} - - -const std::string& LLInventoryIcon::getIconName(EIconName idx) -{ - const IconEntry *entry = LLIconDictionary::instance().lookup(idx); - return entry->mName; -} - -LLInventoryIcon::EIconName LLInventoryIcon::assignWearableIcon(U32 misc_flag) -{ - const LLWearableType::EType wearable_type = LLWearableType::EType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & misc_flag); - return LLWearableType::getIconName(wearable_type); -} diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h deleted file mode 100644 index c7e2998a20..0000000000 --- a/indra/newview/llinventoryicon.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @file llinventoryfunctions.h - * @brief Miscellaneous inventory-related functions and classes - * class definition - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLINVENTORYICON_H -#define LL_LLINVENTORYICON_H - -#include "llassettype.h" -#include "llinventorytype.h" -#include "lluiimage.h" - -class LLInventoryIcon -{ -public: - enum EIconName - { - ICONNAME_TEXTURE, - ICONNAME_SOUND, - ICONNAME_CALLINGCARD_ONLINE, - ICONNAME_CALLINGCARD_OFFLINE, - ICONNAME_LANDMARK, - ICONNAME_LANDMARK_VISITED, - ICONNAME_SCRIPT, - ICONNAME_CLOTHING, - ICONNAME_OBJECT, - ICONNAME_OBJECT_MULTI, - ICONNAME_NOTECARD, - ICONNAME_BODYPART, - ICONNAME_SNAPSHOT, - - ICONNAME_BODYPART_SHAPE, - ICONNAME_BODYPART_SKIN, - ICONNAME_BODYPART_HAIR, - ICONNAME_BODYPART_EYES, - ICONNAME_CLOTHING_SHIRT, - ICONNAME_CLOTHING_PANTS, - ICONNAME_CLOTHING_SHOES, - ICONNAME_CLOTHING_SOCKS, - ICONNAME_CLOTHING_JACKET, - ICONNAME_CLOTHING_GLOVES, - ICONNAME_CLOTHING_UNDERSHIRT, - ICONNAME_CLOTHING_UNDERPANTS, - ICONNAME_CLOTHING_SKIRT, - ICONNAME_CLOTHING_ALPHA, - ICONNAME_CLOTHING_TATTOO, - - ICONNAME_ANIMATION, - ICONNAME_GESTURE, - - ICONNAME_CLOTHING_PHYSICS, - - ICONNAME_LINKITEM, - ICONNAME_LINKFOLDER, - ICONNAME_MESH, - - ICONNAME_INVALID, - ICONNAME_COUNT, - ICONNAME_NONE = -1 - }; - - static const std::string& getIconName(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE, - U32 misc_flag = 0, // different meanings depending on item type - BOOL item_is_multi = FALSE); - static const std::string& getIconName(EIconName idx); - - static LLUIImagePtr getIcon(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE, - U32 misc_flag = 0, // different meanings depending on item type - BOOL item_is_multi = FALSE); - static LLUIImagePtr getIcon(EIconName idx); - -protected: - static EIconName assignWearableIcon(U32 misc_flag); -}; -#endif // LL_LLINVENTORYICON_H - - - diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 459e52c4f4..097c751386 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -55,7 +55,7 @@ #include "llviewerobject.h" #include "llface.h" #include "llvoavatarself.h" -#include "llwearable.h" +#include "llviewerwearable.h" #include "llagentwearables.h" #include "lltexlayerparams.h" #include "llvovolume.h" @@ -483,7 +483,7 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp U32 count = gAgentWearables.getWearableCount(type); for(U32 wearable_iter = 0; wearable_iter < count; wearable_iter++) { - LLWearable* wearable = gAgentWearables.getWearable(type, wearable_iter); + LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_iter); if (wearable) { std::vector texture_list = wearable->getLocalTextureListSeq(); diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index 7a23c7ef6e..df031de3cb 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -33,6 +33,7 @@ #include "llvoavatardefines.h" class LLScrollListCtrl; +class LLViewerObject; class LLLocalBitmap { diff --git a/indra/newview/lllocaltextureobject.cpp b/indra/newview/lllocaltextureobject.cpp deleted file mode 100644 index 07ec0fab95..0000000000 --- a/indra/newview/lllocaltextureobject.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/** - * @file lllocaltextureobject.cpp - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "lllocaltextureobject.h" - -#include "lltexlayer.h" -#include "llviewertexture.h" -#include "lltextureentry.h" -#include "lluuid.h" -#include "llwearable.h" - - -LLLocalTextureObject::LLLocalTextureObject() : - mIsBakedReady(FALSE), - mDiscard(MAX_DISCARD_LEVEL+1) -{ - mImage = NULL; -} - -LLLocalTextureObject::LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id) : - mIsBakedReady(FALSE), - mDiscard(MAX_DISCARD_LEVEL+1) -{ - mImage = image; - gGL.getTexUnit(0)->bind(mImage); - mID = id; -} - -LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) : - mImage(lto.mImage), - mID(lto.mID), - mIsBakedReady(lto.mIsBakedReady), - mDiscard(lto.mDiscard) -{ - U32 num_layers = lto.getNumTexLayers(); - mTexLayers.reserve(num_layers); - for (U32 index = 0; index < num_layers; index++) - { - LLTexLayer* original_layer = lto.getTexLayer(index); - if (!original_layer) - { - llerrs << "could not clone Local Texture Object: unable to extract texlayer!" << llendl; - continue; - } - - LLTexLayer* new_layer = new LLTexLayer(*original_layer); - new_layer->setLTO(this); - mTexLayers.push_back(new_layer); - } -} - -LLLocalTextureObject::~LLLocalTextureObject() -{ -} - -LLViewerFetchedTexture* LLLocalTextureObject::getImage() const -{ - return mImage; -} - -LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const -{ - if (index >= getNumTexLayers()) - { - return NULL; - } - - return mTexLayers[index]; -} - -LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) -{ - for( tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter != mTexLayers.end(); iter++) - { - LLTexLayer *layer = *iter; - if (layer->getName().compare(name) == 0) - { - return layer; - } - } - - return NULL; -} - -U32 LLLocalTextureObject::getNumTexLayers() const -{ - return mTexLayers.size(); -} - -LLUUID LLLocalTextureObject::getID() const -{ - return mID; -} - -S32 LLLocalTextureObject::getDiscard() const -{ - return mDiscard; -} - -BOOL LLLocalTextureObject::getBakedReady() const -{ - return mIsBakedReady; -} - -void LLLocalTextureObject::setImage(LLViewerFetchedTexture* new_image) -{ - mImage = new_image; -} - -BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) -{ - if (index >= getNumTexLayers() ) - { - return FALSE; - } - - if (new_tex_layer == NULL) - { - return removeTexLayer(index); - } - - LLTexLayer *layer = new LLTexLayer(*new_tex_layer); - layer->setLTO(this); - - if (mTexLayers[index]) - { - delete mTexLayers[index]; - } - mTexLayers[index] = layer; - - return TRUE; -} - -BOOL LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) -{ - if (new_tex_layer == NULL) - { - return FALSE; - } - - LLTexLayer *layer = new LLTexLayer(*new_tex_layer, wearable); - layer->setLTO(this); - mTexLayers.push_back(layer); - return TRUE; -} - -BOOL LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) -{ - if (new_tex_layer == NULL) - { - return FALSE; - } - - LLTexLayer *layer = new LLTexLayer(*new_tex_layer, this, wearable); - layer->setLTO(this); - mTexLayers.push_back(layer); - return TRUE; -} - -BOOL LLLocalTextureObject::removeTexLayer(U32 index) -{ - if (index >= getNumTexLayers()) - { - return FALSE; - } - tex_layer_vec_t::iterator iter = mTexLayers.begin(); - iter += index; - - delete *iter; - mTexLayers.erase(iter); - return TRUE; -} - -void LLLocalTextureObject::setID(LLUUID new_id) -{ - mID = new_id; -} - -void LLLocalTextureObject::setDiscard(S32 new_discard) -{ - mDiscard = new_discard; -} - -void LLLocalTextureObject::setBakedReady(BOOL ready) -{ - mIsBakedReady = ready; -} - diff --git a/indra/newview/lllocaltextureobject.h b/indra/newview/lllocaltextureobject.h deleted file mode 100644 index b9bfc5472f..0000000000 --- a/indra/newview/lllocaltextureobject.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file lllocaltextureobject.h - * @brief LLLocalTextureObject class header file - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LOCALTEXTUREOBJECT_H -#define LL_LOCALTEXTUREOBJECT_H - -#include - -#include "llviewertexture.h" - -class LLUUID; -class LLTexLayer; -class LLTextureEntry; -class LLTexLayerTemplate; -class LLWearable; - -// Stores all relevant information for a single texture -// assumed to have ownership of all objects referred to - -// will delete objects when being replaced or if object is destroyed. -class LLLocalTextureObject -{ -public: - LLLocalTextureObject(); - LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id); - LLLocalTextureObject(const LLLocalTextureObject& lto); - ~LLLocalTextureObject(); - - LLViewerFetchedTexture* getImage() const; - LLTexLayer* getTexLayer(U32 index) const; - LLTexLayer* getTexLayer(const std::string &name); - U32 getNumTexLayers() const; - LLUUID getID() const; - S32 getDiscard() const; - BOOL getBakedReady() const; - - void setImage(LLViewerFetchedTexture* new_image); - BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index); - BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable); - BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable); - BOOL removeTexLayer(U32 index); - - void setID(LLUUID new_id); - void setDiscard(S32 new_discard); - void setBakedReady(BOOL ready); - -protected: - -private: - - LLPointer mImage; - // NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer - // using shared pointers here only for smart assignment & cleanup - // do NOT create new shared pointers to these objects, or keep pointers to them around - typedef std::vector tex_layer_vec_t; - tex_layer_vec_t mTexLayers; - - LLUUID mID; - - BOOL mIsBakedReady; - S32 mDiscard; -}; - - #endif // LL_LOCALTEXTUREOBJECT_H - diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 6889b98ab1..862e4be203 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -55,6 +55,7 @@ #include "lltrans.h" #include "llscrollcontainer.h" #include "llstatusbar.h" +#include "llviewertexture.h" const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$ diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index d58d6d536c..44b56afb1a 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -28,7 +28,7 @@ #include "llpaneleditwearable.h" #include "llpanel.h" -#include "llwearable.h" +#include "llviewerwearable.h" #include "lluictrl.h" #include "llscrollingpanellist.h" #include "llvisualparam.h" @@ -865,7 +865,7 @@ void LLPanelEditWearable::setVisible(BOOL visible) LLPanel::setVisible(visible); } -void LLPanelEditWearable::setWearable(LLWearable *wearable, BOOL disable_camera_switch) +void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch) { showWearable(mWearablePtr, FALSE, disable_camera_switch); mWearablePtr = wearable; @@ -922,7 +922,7 @@ void LLPanelEditWearable::onCommitSexChange() } bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE; - LLWearable* wearable = gAgentWearables.getWearable(type, index); + LLViewerWearable* wearable = gAgentWearables.getWearable(type, index); if (wearable) { wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE); @@ -1069,7 +1069,7 @@ void LLPanelEditWearable::revertChanges() gAgentAvatarp->wearableUpdated(mWearablePtr->getType(), FALSE); } -void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show, BOOL disable_camera_switch) +void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch) { if (!wearable) { @@ -1445,7 +1445,7 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value { LLPanel::Params p; p.name("LLScrollingPanelParam"); - LLWearable *wearable = this->getWearable(); + LLViewerWearable *wearable = this->getWearable(); LLScrollingPanelParamBase *panel_param = NULL; if (wearable && wearable->getType() == LLWearableType::WT_PHYSICS) // Hack to show a different panel for physics. Should generalize this later. { diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 692a7ce90f..85e43c8ebd 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -35,7 +35,7 @@ class LLAccordionCtrl; class LLCheckBoxCtrl; -class LLWearable; +class LLViewerWearable; class LLTextBox; class LLViewerInventoryItem; class LLViewerVisualParam; @@ -58,8 +58,8 @@ public: // changes camera angle to default for selected subpart void changeCamera(U8 subpart); - LLWearable* getWearable() { return mWearablePtr; } - void setWearable(LLWearable *wearable, BOOL disable_camera_switch = FALSE); + LLViewerWearable* getWearable() { return mWearablePtr; } + void setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch = FALSE); void saveChanges(bool force_save_as = false); void revertChanges(); @@ -80,7 +80,7 @@ public: private: typedef std::map value_map_t; - void showWearable(LLWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE); + void showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE); void updateScrollingPanelUI(); LLPanel* getPanel(LLWearableType::EType type); void getSortedParams(value_map_t &sorted_params, const std::string &edit_group); @@ -115,7 +115,7 @@ private: void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel); // the pointer to the wearable we're editing. NULL means we're not editing a wearable. - LLWearable *mWearablePtr; + LLViewerWearable *mWearablePtr; LLViewerInventoryItem* mWearableItem; // these are constant no matter what wearable we're editing diff --git a/indra/newview/llpostcard.cpp b/indra/newview/llpostcard.cpp index 4f2d6da7e5..aebe636f59 100644 --- a/indra/newview/llpostcard.cpp +++ b/indra/newview/llpostcard.cpp @@ -35,6 +35,7 @@ #include "message.h" #include "llagent.h" +#include "llassetstorage.h" #include "llassetuploadresponders.h" /////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 9267444534..6a692209e9 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -47,7 +47,7 @@ #include "llviewercontrol.h" #include "llviewerregion.h" #include "llvoavatarself.h" -#include "llwearable.h" +#include "llviewerwearable.h" static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); @@ -198,7 +198,7 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) if (is_outfit_edit_visible || is_wearable_edit_visible) { - const LLWearable *wearable_ptr = mEditWearable->getWearable(); + const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); if (!wearable_ptr) { llwarns << "Visibility change to invalid wearable" << llendl; @@ -326,7 +326,7 @@ void LLSidepanelAppearance::showOutfitEditPanel() toggleOutfitEditPanel(TRUE); } -void LLSidepanelAppearance::showWearableEditPanel(LLWearable *wearable /* = NULL*/, BOOL disable_camera_switch) +void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) { toggleMyOutfitsPanel(FALSE); toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode @@ -379,7 +379,7 @@ void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_cam } } -void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable, BOOL disable_camera_switch) +void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) { if (!mEditWearable || mEditWearable->getVisible() == visible) { @@ -445,7 +445,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) } //static -void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch) +void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) { LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 6dd3520266..32bbb8a776 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -36,7 +36,7 @@ class LLFilterEditor; class LLCurrentlyWornFetchObserver; class LLPanelEditWearable; -class LLWearable; +class LLViewerWearable; class LLPanelOutfitsInventory; class LLSidepanelAppearance : public LLPanel @@ -51,7 +51,7 @@ public: void refreshCurrentOutfitName(const std::string& name = ""); - static void editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch = FALSE); + static void editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch = FALSE); void fetchInventory(); void inventoryFetched(); @@ -59,7 +59,7 @@ public: void showOutfitsInventoryPanel(); void showOutfitEditPanel(); - void showWearableEditPanel(LLWearable *wearable = NULL, BOOL disable_camera_switch = FALSE); + void showWearableEditPanel(LLViewerWearable *wearable = NULL, BOOL disable_camera_switch = FALSE); void setWearablesLoading(bool val); void showDefaultSubpart(); void updateScrollingPanelList(); @@ -74,7 +74,7 @@ private: void toggleMyOutfitsPanel(BOOL visible); void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE); - void toggleWearableEditPanel(BOOL visible, LLWearable* wearable = NULL, BOOL disable_camera_switch = FALSE); + void toggleWearableEditPanel(BOOL visible, LLViewerWearable* wearable = NULL, BOOL disable_camera_switch = FALSE); LLFilterEditor* mFilterEditor; LLPanelOutfitsInventory* mPanelOutfitsInventory; diff --git a/indra/newview/lltexglobalcolor.cpp b/indra/newview/lltexglobalcolor.cpp deleted file mode 100644 index ebe5ccd6c0..0000000000 --- a/indra/newview/lltexglobalcolor.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @file lltexlayerglobalcolor.cpp - * @brief Color for texture layers. - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llagent.h" -#include "lltexlayer.h" -#include "llvoavatar.h" -#include "llwearable.h" -#include "lltexglobalcolor.h" - -//----------------------------------------------------------------------------- -// LLTexGlobalColor -//----------------------------------------------------------------------------- - -LLTexGlobalColor::LLTexGlobalColor(LLVOAvatar* avatar) - : - mAvatar(avatar), - mInfo(NULL) -{ -} - -LLTexGlobalColor::~LLTexGlobalColor() -{ - // mParamColorList are LLViewerVisualParam's and get deleted with ~LLCharacter() - //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer()); -} - -BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) -{ - llassert(mInfo == NULL); - mInfo = info; - //mID = info->mID; // No ID - - mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size()); - for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin(); - iter != mInfo->mParamColorInfoList.end(); - iter++) - { - LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this); - if (!param_color->setInfo(*iter, TRUE)) - { - mInfo = NULL; - return FALSE; - } - mParamGlobalColorList.push_back(param_color); - } - - return TRUE; -} - -LLColor4 LLTexGlobalColor::getColor() const -{ - // Sum of color params - if (mParamGlobalColorList.empty()) - return LLColor4(1.f, 1.f, 1.f, 1.f); - - LLColor4 net_color(0.f, 0.f, 0.f, 0.f); - LLTexLayer::calculateTexLayerColor(mParamGlobalColorList, net_color); - return net_color; -} - -const std::string& LLTexGlobalColor::getName() const -{ - return mInfo->mName; -} - -//----------------------------------------------------------------------------- -// LLTexParamGlobalColor -//----------------------------------------------------------------------------- -LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) : - LLTexLayerParamColor(tex_global_color->getAvatar()), - mTexGlobalColor(tex_global_color) -{ -} - -/*virtual*/ LLViewerVisualParam* LLTexParamGlobalColor::cloneParam(LLWearable* wearable) const -{ - LLTexParamGlobalColor *new_param = new LLTexParamGlobalColor(mTexGlobalColor); - *new_param = *this; - return new_param; -} - -void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake) -{ - mAvatar->onGlobalColorChanged(mTexGlobalColor, upload_bake); -} - -//----------------------------------------------------------------------------- -// LLTexGlobalColorInfo -//----------------------------------------------------------------------------- - -LLTexGlobalColorInfo::LLTexGlobalColorInfo() -{ -} - - -LLTexGlobalColorInfo::~LLTexGlobalColorInfo() -{ - for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer()); -} - -BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) -{ - // name attribute - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!node->getFastAttributeString(name_string, mName)) - { - llwarns << " element is missing name attribute." << llendl; - return FALSE; - } - // sub-element - for (LLXmlTreeNode* child = node->getChildByName("param"); - child; - child = node->getNextNamedChild()) - { - if (child->getChildByName("param_color")) - { - // - LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo(); - if (!info->parseXml(child)) - { - delete info; - return FALSE; - } - mParamColorInfoList.push_back(info); - } - } - return TRUE; -} diff --git a/indra/newview/lltexglobalcolor.h b/indra/newview/lltexglobalcolor.h deleted file mode 100644 index ae04798445..0000000000 --- a/indra/newview/lltexglobalcolor.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @file lltexglobalcolor.h - * @brief This is global texture color info used by llvoavatar. - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLTEXGLOBALCOLOR_H -#define LL_LLTEXGLOBALCOLOR_H - -#include "lltexlayer.h" -#include "lltexlayerparams.h" - -class LLVOAvatar; -class LLWearable; -class LLTexGlobalColorInfo; - -class LLTexGlobalColor -{ -public: - LLTexGlobalColor( LLVOAvatar* avatar ); - ~LLTexGlobalColor(); - - LLTexGlobalColorInfo* getInfo() const { return mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLTexGlobalColorInfo *info); - - LLVOAvatar* getAvatar() const { return mAvatar; } - LLColor4 getColor() const; - const std::string& getName() const; - -private: - param_color_list_t mParamGlobalColorList; - LLVOAvatar* mAvatar; // just backlink, don't LLPointer - LLTexGlobalColorInfo *mInfo; -}; - -// Used by llvoavatar to determine skin/eye/hair color. -class LLTexGlobalColorInfo -{ - friend class LLTexGlobalColor; -public: - LLTexGlobalColorInfo(); - ~LLTexGlobalColorInfo(); - - BOOL parseXml(LLXmlTreeNode* node); - -private: - param_color_info_list_t mParamColorInfoList; - std::string mName; -}; - -class LLTexParamGlobalColor : public LLTexLayerParamColor -{ -public: - LLTexParamGlobalColor(LLTexGlobalColor *tex_color); - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const; -protected: - /*virtual*/ void onGlobalColorChanged(bool upload_bake); -private: - LLTexGlobalColor* mTexGlobalColor; -}; - -#endif diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp deleted file mode 100644 index 467115c928..0000000000 --- a/indra/newview/lltexlayer.cpp +++ /dev/null @@ -1,2508 +0,0 @@ -/** - * @file lltexlayer.cpp - * @brief A texture layer. Used for avatars. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "lltexlayer.h" - -#include "llagent.h" -#include "llimagej2c.h" -#include "llimagetga.h" -#include "llnotificationsutil.h" -#include "llvfile.h" -#include "llvfs.h" -#include "llviewerstats.h" -#include "llviewerregion.h" -#include "llvoavatar.h" -#include "llvoavatarself.h" -#include "pipeline.h" -#include "llassetuploadresponders.h" -#include "lltexlayerparams.h" -#include "llui.h" -#include "llagentwearables.h" -#include "llwearable.h" -#include "llviewercontrol.h" -#include "llviewershadermgr.h" -#include "llviewervisualparam.h" - -//#include "../tools/imdebug/imdebug.h" - -using namespace LLVOAvatarDefines; - -static const S32 BAKE_UPLOAD_ATTEMPTS = 7; -static const F32 BAKE_UPLOAD_RETRY_DELAY = 2.f; // actual delay grows by power of 2 each attempt - -// runway consolidate -extern std::string self_av_string(); - -class LLTexLayerInfo -{ - friend class LLTexLayer; - friend class LLTexLayerTemplate; - friend class LLTexLayerInterface; -public: - LLTexLayerInfo(); - ~LLTexLayerInfo(); - - BOOL parseXml(LLXmlTreeNode* node); - BOOL createVisualParams(LLVOAvatar *avatar); - BOOL isUserSettable() { return mLocalTexture != -1; } - S32 getLocalTexture() const { return mLocalTexture; } - BOOL getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; } - std::string getName() const { return mName; } - -private: - std::string mName; - - BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, - LLTexLayerInterface::ERenderPass mRenderPass; - - std::string mGlobalColor; - LLColor4 mFixedColor; - - S32 mLocalTexture; - std::string mStaticImageFileName; - BOOL mStaticImageIsMask; - BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask - BOOL mIsVisibilityMask; - - typedef std::vector< std::pair< std::string,BOOL > > morph_name_list_t; - morph_name_list_t mMorphNameList; - param_color_info_list_t mParamColorInfoList; - param_alpha_info_list_t mParamAlphaInfoList; -}; - -//----------------------------------------------------------------------------- -// LLBakedUploadData() -//----------------------------------------------------------------------------- -LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar, - LLTexLayerSet* layerset, - const LLUUID& id, - bool highest_res) : - mAvatar(avatar), - mTexLayerSet(layerset), - mID(id), - mStartTime(LLFrameTimer::getTotalTime()), // Record starting time - mIsHighestRes(highest_res) -{ -} - -//----------------------------------------------------------------------------- -// LLTexLayerSetBuffer -// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one. -//----------------------------------------------------------------------------- - -// static -S32 LLTexLayerSetBuffer::sGLByteCount = 0; - -LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner, - S32 width, S32 height) : - // ORDER_LAST => must render these after the hints are created. - LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, TRUE ), - mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates - mNeedsUpload(FALSE), - mNumLowresUploads(0), - mUploadFailCount(0), - mNeedsUpdate(TRUE), - mNumLowresUpdates(0), - mTexLayerSet(owner) -{ - LLTexLayerSetBuffer::sGLByteCount += getSize(); - mNeedsUploadTimer.start(); - mNeedsUpdateTimer.start(); -} - -LLTexLayerSetBuffer::~LLTexLayerSetBuffer() -{ - LLTexLayerSetBuffer::sGLByteCount -= getSize(); - destroyGLTexture(); - for( S32 order = 0; order < ORDER_COUNT; order++ ) - { - LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case. - } -} - -//virtual -S8 LLTexLayerSetBuffer::getType() const -{ - return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ; -} - -//virtual -void LLTexLayerSetBuffer::restoreGLTexture() -{ - LLViewerDynamicTexture::restoreGLTexture() ; -} - -//virtual -void LLTexLayerSetBuffer::destroyGLTexture() -{ - LLViewerDynamicTexture::destroyGLTexture() ; -} - -// static -void LLTexLayerSetBuffer::dumpTotalByteCount() -{ - llinfos << "Composite System GL Buffers: " << (LLTexLayerSetBuffer::sGLByteCount/1024) << "KB" << llendl; -} - -void LLTexLayerSetBuffer::requestUpdate() -{ - restartUpdateTimer(); - mNeedsUpdate = TRUE; - mNumLowresUpdates = 0; - // If we're in the middle of uploading a baked texture, we don't care about it any more. - // When it's downloaded, ignore it. - mUploadID.setNull(); -} - -void LLTexLayerSetBuffer::requestUpload() -{ - conditionalRestartUploadTimer(); - mNeedsUpload = TRUE; - mNumLowresUploads = 0; - mUploadPending = TRUE; -} - -void LLTexLayerSetBuffer::conditionalRestartUploadTimer() -{ - // If we requested a new upload but haven't even uploaded - // a low res version of our last upload request, then - // keep the timer ticking instead of resetting it. - if (mNeedsUpload && (mNumLowresUploads == 0)) - { - mNeedsUploadTimer.unpause(); - } - else - { - mNeedsUploadTimer.reset(); - mNeedsUploadTimer.start(); - } -} - -void LLTexLayerSetBuffer::restartUpdateTimer() -{ - mNeedsUpdateTimer.reset(); - mNeedsUpdateTimer.start(); -} - -void LLTexLayerSetBuffer::cancelUpload() -{ - mNeedsUpload = FALSE; - mUploadPending = FALSE; - mNeedsUploadTimer.pause(); - mUploadRetryTimer.reset(); -} - -void LLTexLayerSetBuffer::pushProjection() const -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - gGL.loadIdentity(); -} - -void LLTexLayerSetBuffer::popProjection() const -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.popMatrix(); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); -} - -BOOL LLTexLayerSetBuffer::needsRender() -{ - llassert(mTexLayerSet->getAvatar() == gAgentAvatarp); - if (!isAgentAvatarValid()) return FALSE; - - const BOOL upload_now = mNeedsUpload && isReadyToUpload(); - const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); - - // Don't render if we don't want to (or aren't ready to) upload or update. - if (!(update_now || upload_now)) - { - return FALSE; - } - - // Don't render if we're animating our appearance. - if (gAgentAvatarp->getIsAppearanceAnimating()) - { - return FALSE; - } - - // Don't render if we are trying to create a shirt texture but aren't wearing a skirt. - if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && - !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT)) - { - cancelUpload(); - return FALSE; - } - - // Render if we have at least minimal level of detail for each local texture. - return mTexLayerSet->isLocalTextureDataAvailable(); -} - -void LLTexLayerSetBuffer::preRender(BOOL clear_depth) -{ - // Set up an ortho projection - pushProjection(); - - // keep depth buffer, we don't need to clear it - LLViewerDynamicTexture::preRender(FALSE); -} - -void LLTexLayerSetBuffer::postRender(BOOL success) -{ - popProjection(); - - LLViewerDynamicTexture::postRender(success); -} - -BOOL LLTexLayerSetBuffer::render() -{ - // Default color mask for tex layer render - gGL.setColorMask(true, true); - - // do we need to upload, and do we have sufficient data to create an uploadable composite? - // TODO: When do we upload the texture if gAgent.mNumPendingQueries is non-zero? - const BOOL upload_now = mNeedsUpload && isReadyToUpload(); - const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); - - BOOL success = TRUE; - - bool use_shaders = LLGLSLShader::sNoFixedFunction; - - if (use_shaders) - { - gAlphaMaskProgram.bind(); - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - - LLVertexBuffer::unbind(); - - // Composite the color data - LLGLSUIDefault gls_ui; - success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight ); - gGL.flush(); - - if(upload_now) - { - if (!success) - { - llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << llendl; - mUploadPending = FALSE; - } - else - { - if (mTexLayerSet->isVisible()) - { - mTexLayerSet->getAvatar()->debugBakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish. - doUpload(); - } - else - { - mUploadPending = FALSE; - mNeedsUpload = FALSE; - mNeedsUploadTimer.pause(); - mTexLayerSet->getAvatar()->setNewBakedTexture(mTexLayerSet->getBakedTexIndex(),IMG_INVISIBLE); - } - } - } - - if (update_now) - { - doUpdate(); - } - - if (use_shaders) - { - gAlphaMaskProgram.unbind(); - } - - LLVertexBuffer::unbind(); - - // reset GL state - gGL.setColorMask(true, true); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - - // we have valid texture data now - mGLTexturep->setGLTextureCreated(true); - - return success; -} - -BOOL LLTexLayerSetBuffer::isInitialized(void) const -{ - return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated(); -} - -BOOL LLTexLayerSetBuffer::uploadPending() const -{ - return mUploadPending; -} - -BOOL LLTexLayerSetBuffer::uploadNeeded() const -{ - return mNeedsUpload; -} - -BOOL LLTexLayerSetBuffer::uploadInProgress() const -{ - return !mUploadID.isNull(); -} - -BOOL LLTexLayerSetBuffer::isReadyToUpload() const -{ - if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries. - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites. - - BOOL ready = FALSE; - if (mTexLayerSet->isLocalTextureDataFinal()) - { - // If we requested an upload and have the final LOD ready, upload (or wait a while if this is a retry) - if (mUploadFailCount == 0) - { - ready = TRUE; - } - else - { - ready = mUploadRetryTimer.getElapsedTimeF32() >= BAKE_UPLOAD_RETRY_DELAY * (1 << (mUploadFailCount - 1)); - } - } - else - { - // Upload if we've hit a timeout. Upload is a pretty expensive process so we need to make sure - // we aren't doing uploads too frequently. - const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout"); - if (texture_timeout != 0) - { - // The timeout period increases exponentially between every lowres upload in order to prevent - // spamming the server with frequent uploads. - const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads); - - // If we hit our timeout and have textures available at even lower resolution, then upload. - const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; - const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); - ready = has_lower_lod && is_upload_textures_timeout; - } - } - - return ready; -} - -BOOL LLTexLayerSetBuffer::isReadyToUpdate() const -{ - // If we requested an update and have the final LOD ready, then update. - if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE; - - // If we haven't done an update yet, then just do one now regardless of state of textures. - if (mNumLowresUpdates == 0) return TRUE; - - // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small - // since render unnecessarily doesn't cost much. - const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout"); - if (texture_timeout != 0) - { - // If we hit our timeout and have textures available at even lower resolution, then update. - const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout; - const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); - if (has_lower_lod && is_update_textures_timeout) return TRUE; - } - - return FALSE; -} - -BOOL LLTexLayerSetBuffer::requestUpdateImmediate() -{ - mNeedsUpdate = TRUE; - BOOL result = FALSE; - - if (needsRender()) - { - preRender(FALSE); - result = render(); - postRender(result); - } - - return result; -} - -// Create the baked texture, send it out to the server, then wait for it to come -// back so we can switch to using it. -void LLTexLayerSetBuffer::doUpload() -{ - llinfos << "Uploading baked " << mTexLayerSet->getBodyRegionName() << llendl; - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES); - - // Don't need caches since we're baked now. (note: we won't *really* be baked - // until this image is sent to the server and the Avatar Appearance message is received.) - mTexLayerSet->deleteCaches(); - - // Get the COLOR information from our texture - U8* baked_color_data = new U8[ mFullWidth * mFullHeight * 4 ]; - glReadPixels(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, GL_RGBA, GL_UNSIGNED_BYTE, baked_color_data ); - stop_glerror(); - - // Get the MASK information from our texture - LLGLSUIDefault gls_ui; - LLPointer baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 ); - U8* baked_mask_data = baked_mask_image->getData(); - mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight); - - - // Create the baked image from our color and mask information - const S32 baked_image_components = 5; // red green blue [bump] clothing - LLPointer baked_image = new LLImageRaw( mFullWidth, mFullHeight, baked_image_components ); - U8* baked_image_data = baked_image->getData(); - S32 i = 0; - for (S32 u=0; u < mFullWidth; u++) - { - for (S32 v=0; v < mFullHeight; v++) - { - baked_image_data[5*i + 0] = baked_color_data[4*i + 0]; - baked_image_data[5*i + 1] = baked_color_data[4*i + 1]; - baked_image_data[5*i + 2] = baked_color_data[4*i + 2]; - baked_image_data[5*i + 3] = baked_color_data[4*i + 3]; // alpha should be correct for eyelashes. - baked_image_data[5*i + 4] = baked_mask_data[i]; - i++; - } - } - - LLPointer compressedImage = new LLImageJ2C; - const char* comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // writes into baked_color_data. 5 channels (rgb, heightfield/alpha, mask) - if (compressedImage->encode(baked_image, comment_text)) - { - LLTransactionID tid; - tid.generate(); - const LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - if (LLVFile::writeFile(compressedImage->getData(), compressedImage->getDataSize(), - gVFS, asset_id, LLAssetType::AT_TEXTURE)) - { - // Read back the file and validate. - BOOL valid = FALSE; - LLPointer integrity_test = new LLImageJ2C; - S32 file_size = 0; - U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size); - if (data) - { - valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data' - } - else - { - integrity_test->setLastError("Unable to read entire file"); - } - - if (valid) - { - const bool highest_lod = mTexLayerSet->isLocalTextureDataFinal(); - // Baked_upload_data is owned by the responder and deleted after the request completes. - LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp, - this->mTexLayerSet, - asset_id, - highest_lod); - // upload ID is used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit. - mUploadID = asset_id; - - // Upload the image - const std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture"); - if(!url.empty() - && !LLPipeline::sForceOldBakedUpload // toggle debug setting UploadBakedTexOld to change between the new caps method and old method - && (mUploadFailCount < (BAKE_UPLOAD_ATTEMPTS - 1))) // Try last ditch attempt via asset store if cap upload is failing. - { - LLSD body = LLSD::emptyMap(); - // The responder will call LLTexLayerSetBuffer::onTextureUploadComplete() - LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data)); - llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl; - } - else - { - gAssetStorage->storeAssetData(tid, - LLAssetType::AT_TEXTURE, - LLTexLayerSetBuffer::onTextureUploadComplete, - baked_upload_data, - TRUE, // temp_file - TRUE, // is_priority - TRUE); // store_local - llinfos << "Baked texture upload via Asset Store." << llendl; - } - - if (highest_lod) - { - // Sending the final LOD for the baked texture. All done, pause - // the upload timer so we know how long it took. - mNeedsUpload = FALSE; - mNeedsUploadTimer.pause(); - } - else - { - // Sending a lower level LOD for the baked texture. Restart the upload timer. - mNumLowresUploads++; - mNeedsUploadTimer.unpause(); - mNeedsUploadTimer.reset(); - } - - // Print out notification that we uploaded this texture. - if (gSavedSettings.getBOOL("DebugAvatarRezTime")) - { - const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; - LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32()); - args["TIME"] = llformat("%d",(U32)mNeedsUploadTimer.getElapsedTimeF32()); - args["BODYREGION"] = mTexLayerSet->getBodyRegionName(); - args["RESOLUTION"] = lod_str; - LLNotificationsUtil::add("AvatarRezSelfBakedTextureUploadNotification",args); - LL_DEBUGS("Avatar") << self_av_string() << "Uploading [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << LL_ENDL; - } - } - else - { - // The read back and validate operation failed. Remove the uploaded file. - mUploadPending = FALSE; - LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE, LLVFile::WRITE); - file.remove(); - llinfos << "Unable to create baked upload file (reason: corrupted)." << llendl; - } - } - } - else - { - // The VFS write file operation failed. - mUploadPending = FALSE; - llinfos << "Unable to create baked upload file (reason: failed to write file)" << llendl; - } - - delete [] baked_color_data; -} - -// Mostly bookkeeping; don't need to actually "do" anything since -// render() will actually do the update. -void LLTexLayerSetBuffer::doUpdate() -{ - const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); - if (highest_lod) - { - mNeedsUpdate = FALSE; - } - else - { - mNumLowresUpdates++; - } - - restartUpdateTimer(); - - // need to swtich to using this layerset if this is the first update - // after getting the lowest LOD - mTexLayerSet->getAvatar()->updateMeshTextures(); - - // Print out notification that we uploaded this texture. - if (gSavedSettings.getBOOL("DebugAvatarRezTime")) - { - const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); - const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; - LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32()); - args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32()); - args["BODYREGION"] = mTexLayerSet->getBodyRegionName(); - args["RESOLUTION"] = lod_str; - LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args); - LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL; - } -} - -// static -void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, - void* userdata, - S32 result, - LLExtStat ext_status) // StoreAssetData callback (not fixed) -{ - LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata; - - if (isAgentAvatarValid() && - !gAgentAvatarp->isDead() && - (baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures. - (baked_upload_data->mTexLayerSet->hasComposite())) - { - LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite(); - S32 failures = layerset_buffer->mUploadFailCount; - layerset_buffer->mUploadFailCount = 0; - - if (layerset_buffer->mUploadID.isNull()) - { - // The upload got canceled, we should be in the - // process of baking a new texture so request an - // upload with the new data - - // BAP: does this really belong in this callback, as - // opposed to where the cancellation takes place? - // suspect this does nothing. - layerset_buffer->requestUpload(); - } - else if (baked_upload_data->mID == layerset_buffer->mUploadID) - { - // This is the upload we're currently waiting for. - layerset_buffer->mUploadID.setNull(); - const std::string name(baked_upload_data->mTexLayerSet->getBodyRegionName()); - const std::string resolution = baked_upload_data->mIsHighestRes ? " full res " : " low res "; - if (result >= 0) - { - layerset_buffer->mUploadPending = FALSE; // Allows sending of AgentSetAppearance later - LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet); - // Update baked texture info with the new UUID - U64 now = LLFrameTimer::getTotalTime(); // Record starting time - llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; - gAgentAvatarp->setNewBakedTexture(baked_te, uuid); - } - else - { - ++failures; - S32 max_attempts = baked_upload_data->mIsHighestRes ? BAKE_UPLOAD_ATTEMPTS : 1; // only retry final bakes - llwarns << "Baked" << resolution << "texture upload for " << name << " failed (attempt " << failures << "/" << max_attempts << ")" << llendl; - if (failures < max_attempts) - { - layerset_buffer->mUploadFailCount = failures; - layerset_buffer->mUploadRetryTimer.start(); - layerset_buffer->requestUpload(); - } - } - } - else - { - llinfos << "Received baked texture out of date, ignored." << llendl; - } - - gAgentAvatarp->dirtyMesh(); - } - else - { - // Baked texture failed to upload (in which case since we - // didn't set the new baked texture, it means that they'll try - // and rebake it at some point in the future (after login?)), - // or this response to upload is out of date, in which case a - // current response should be on the way or already processed. - llwarns << "Baked upload failed" << llendl; - } - - delete baked_upload_data; -} - -//----------------------------------------------------------------------------- -// LLTexLayerSet -// An ordered set of texture layers that get composited into a single texture. -//----------------------------------------------------------------------------- - -LLTexLayerSetInfo::LLTexLayerSetInfo() : - mBodyRegion( "" ), - mWidth( 512 ), - mHeight( 512 ), - mClearAlpha( TRUE ) -{ -} - -LLTexLayerSetInfo::~LLTexLayerSetInfo( ) -{ - std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); -} - -BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) -{ - llassert( node->hasName( "layer_set" ) ); - if( !node->hasName( "layer_set" ) ) - { - return FALSE; - } - - // body_region - static LLStdStringHandle body_region_string = LLXmlTree::addAttributeString("body_region"); - if( !node->getFastAttributeString( body_region_string, mBodyRegion ) ) - { - llwarns << " is missing body_region attribute" << llendl; - return FALSE; - } - - // width, height - static LLStdStringHandle width_string = LLXmlTree::addAttributeString("width"); - if( !node->getFastAttributeS32( width_string, mWidth ) ) - { - return FALSE; - } - - static LLStdStringHandle height_string = LLXmlTree::addAttributeString("height"); - if( !node->getFastAttributeS32( height_string, mHeight ) ) - { - return FALSE; - } - - // Optional alpha component to apply after all compositing is complete. - static LLStdStringHandle alpha_tga_file_string = LLXmlTree::addAttributeString("alpha_tga_file"); - node->getFastAttributeString( alpha_tga_file_string, mStaticAlphaFileName ); - - static LLStdStringHandle clear_alpha_string = LLXmlTree::addAttributeString("clear_alpha"); - node->getFastAttributeBOOL( clear_alpha_string, mClearAlpha ); - - // - for (LLXmlTreeNode* child = node->getChildByName( "layer" ); - child; - child = node->getNextNamedChild()) - { - LLTexLayerInfo* info = new LLTexLayerInfo(); - if( !info->parseXml( child )) - { - delete info; - return FALSE; - } - mLayerInfoList.push_back( info ); - } - return TRUE; -} - -// creates visual params without generating layersets or layers -void LLTexLayerSetInfo::createVisualParams(LLVOAvatar *avatar) -{ - //layer_info_list_t mLayerInfoList; - for (layer_info_list_t::iterator layer_iter = mLayerInfoList.begin(); - layer_iter != mLayerInfoList.end(); - layer_iter++) - { - LLTexLayerInfo *layer_info = *layer_iter; - layer_info->createVisualParams(avatar); - } -} - -//----------------------------------------------------------------------------- -// LLTexLayerSet -// An ordered set of texture layers that get composited into a single texture. -//----------------------------------------------------------------------------- - -BOOL LLTexLayerSet::sHasCaches = FALSE; - -LLTexLayerSet::LLTexLayerSet(LLVOAvatarSelf* const avatar) : - mComposite( NULL ), - mAvatar( avatar ), - mUpdatesEnabled( FALSE ), - mIsVisible( TRUE ), - mBakedTexIndex(LLVOAvatarDefines::BAKED_HEAD), - mInfo( NULL ) -{ -} - -LLTexLayerSet::~LLTexLayerSet() -{ - deleteCaches(); - std::for_each(mLayerList.begin(), mLayerList.end(), DeletePointer()); - std::for_each(mMaskLayerList.begin(), mMaskLayerList.end(), DeletePointer()); -} - -//----------------------------------------------------------------------------- -// setInfo -//----------------------------------------------------------------------------- - -BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) -{ - llassert(mInfo == NULL); - mInfo = info; - //mID = info->mID; // No ID - - mLayerList.reserve(info->mLayerInfoList.size()); - for (LLTexLayerSetInfo::layer_info_list_t::const_iterator iter = info->mLayerInfoList.begin(); - iter != info->mLayerInfoList.end(); - iter++) - { - LLTexLayerInterface *layer = NULL; - if ( (*iter)->isUserSettable() ) - { - layer = new LLTexLayerTemplate( this ); - } - else - { - layer = new LLTexLayer(this); - } - // this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar - if (!layer->setInfo(*iter, NULL)) - { - mInfo = NULL; - return FALSE; - } - if (!layer->isVisibilityMask()) - { - mLayerList.push_back( layer ); - } - else - { - mMaskLayerList.push_back(layer); - } - } - - requestUpdate(); - - stop_glerror(); - - return TRUE; -} - -#if 0 // obsolete -//----------------------------------------------------------------------------- -// parseData -//----------------------------------------------------------------------------- - -BOOL LLTexLayerSet::parseData(LLXmlTreeNode* node) -{ - LLTexLayerSetInfo *info = new LLTexLayerSetInfo; - - if (!info->parseXml(node)) - { - delete info; - return FALSE; - } - if (!setInfo(info)) - { - delete info; - return FALSE; - } - return TRUE; -} -#endif - -void LLTexLayerSet::deleteCaches() -{ - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - layer->deleteCaches(); - } - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) - { - LLTexLayerInterface* layer = *iter; - layer->deleteCaches(); - } -} - -// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on. -BOOL LLTexLayerSet::isLocalTextureDataAvailable() const -{ - if (!mAvatar->isSelf()) return FALSE; - return ((LLVOAvatarSelf *)mAvatar)->isLocalTextureDataAvailable(this); -} - - -// Returns TRUE if all of the data for the textures that this layerset depends on have arrived. -BOOL LLTexLayerSet::isLocalTextureDataFinal() const -{ - if (!mAvatar->isSelf()) return FALSE; - return ((LLVOAvatarSelf *)mAvatar)->isLocalTextureDataFinal(this); -} - - -BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) -{ - BOOL success = TRUE; - mIsVisible = TRUE; - - if (mMaskLayerList.size() > 0) - { - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) - { - LLTexLayerInterface* layer = *iter; - if (layer->isInvisibleAlphaMask()) - { - mIsVisible = FALSE; - } - } - } - - bool use_shaders = LLGLSLShader::sNoFixedFunction; - - LLGLSUIDefault gls_ui; - LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE); - gGL.setColorMask(true, true); - - // clear buffer area to ensure we don't pick up UI elements - { - gGL.flush(); - LLGLDisable no_alpha(GL_ALPHA_TEST); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.0f); - } - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.f, 0.f, 0.f, 1.f ); - - gl_rect_2d_simple( width, height ); - - gGL.flush(); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - } - - if (mIsVisible) - { - // composite color layers - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - if (layer->getRenderPass() == LLTexLayer::RP_COLOR) - { - gGL.flush(); - success &= layer->render(x, y, width, height); - gGL.flush(); - } - } - - renderAlphaMaskTextures(x, y, width, height, false); - - stop_glerror(); - } - else - { - gGL.flush(); - - gGL.setSceneBlendType(LLRender::BT_REPLACE); - LLGLDisable no_alpha(GL_ALPHA_TEST); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.f); - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.f, 0.f, 0.f, 0.f ); - - gl_rect_2d_simple( width, height ); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - - gGL.flush(); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - } - - return success; -} - - -BOOL LLTexLayerSet::isBodyRegion(const std::string& region) const -{ - return mInfo->mBodyRegion == region; -} - -const std::string LLTexLayerSet::getBodyRegionName() const -{ - return mInfo->mBodyRegion; -} - -void LLTexLayerSet::requestUpdate() -{ - if( mUpdatesEnabled ) - { - createComposite(); - mComposite->requestUpdate(); - } -} - -void LLTexLayerSet::requestUpload() -{ - createComposite(); - mComposite->requestUpload(); -} - -void LLTexLayerSet::cancelUpload() -{ - if(mComposite) - { - mComposite->cancelUpload(); - } -} - -void LLTexLayerSet::createComposite() -{ - if(!mComposite) - { - S32 width = mInfo->mWidth; - S32 height = mInfo->mHeight; - // Composite other avatars at reduced resolution - if( !mAvatar->isSelf() ) - { - llerrs << "composites should not be created for non-self avatars!" << llendl; - } - mComposite = new LLTexLayerSetBuffer( this, width, height ); - } -} - -void LLTexLayerSet::destroyComposite() -{ - if( mComposite ) - { - mComposite = NULL; - } -} - -void LLTexLayerSet::setUpdatesEnabled( BOOL b ) -{ - mUpdatesEnabled = b; -} - - -void LLTexLayerSet::updateComposite() -{ - createComposite(); - mComposite->requestUpdateImmediate(); -} - -LLTexLayerSetBuffer* LLTexLayerSet::getComposite() -{ - if (!mComposite) - { - createComposite(); - } - return mComposite; -} - -const LLTexLayerSetBuffer* LLTexLayerSet::getComposite() const -{ - return mComposite; -} - -void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) -{ - memset(data, 255, width * height); - - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - layer->gatherAlphaMasks(data, mComposite->getOriginX(),mComposite->getOriginY(), width, height); - } - - // Set alpha back to that of our alpha masks. - renderAlphaMaskTextures(mComposite->getOriginX(), mComposite->getOriginY(), width, height, true); -} - -void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear) -{ - const LLTexLayerSetInfo *info = getInfo(); - - bool use_shaders = LLGLSLShader::sNoFixedFunction; - - gGL.setColorMask(false, true); - gGL.setSceneBlendType(LLRender::BT_REPLACE); - - // (Optionally) replace alpha with a single component image from a tga file. - if (!info->mStaticAlphaFileName.empty()) - { - gGL.flush(); - { - LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, TRUE); - if( tex ) - { - LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->bind(tex); - gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); - gl_rect_2d_simple_tex( width, height ); - } - } - gGL.flush(); - } - else if (forceClear || info->mClearAlpha || (mMaskLayerList.size() > 0)) - { - // Set the alpha channel to one (clean up after previous blending) - gGL.flush(); - LLGLDisable no_alpha(GL_ALPHA_TEST); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.f); - } - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.f, 0.f, 0.f, 1.f ); - - gl_rect_2d_simple( width, height ); - - gGL.flush(); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - } - - // (Optional) Mask out part of the baked texture with alpha masks - // will still have an effect even if mClearAlpha is set or the alpha component was replaced - if (mMaskLayerList.size() > 0) - { - gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA); - gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) - { - LLTexLayerInterface* layer = *iter; - gGL.flush(); - layer->blendAlphaTexture(x,y,width, height); - gGL.flush(); - } - - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - gGL.setColorMask(true, true); - gGL.setSceneBlendType(LLRender::BT_ALPHA); -} - -void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components) -{ - mAvatar->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex); -} - -BOOL LLTexLayerSet::isMorphValid() const -{ - for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - const LLTexLayerInterface* layer = *iter; - if (layer && !layer->isMorphValid()) - { - return FALSE; - } - } - return TRUE; -} - -void LLTexLayerSet::invalidateMorphMasks() -{ - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - if (layer) - { - layer->invalidateMorphMasks(); - } - } -} - - -//----------------------------------------------------------------------------- -// LLTexLayerInfo -//----------------------------------------------------------------------------- -LLTexLayerInfo::LLTexLayerInfo() : - mWriteAllChannels( FALSE ), - mRenderPass(LLTexLayer::RP_COLOR), - mFixedColor( 0.f, 0.f, 0.f, 0.f ), - mLocalTexture( -1 ), - mStaticImageIsMask( FALSE ), - mUseLocalTextureAlphaOnly(FALSE), - mIsVisibilityMask(FALSE) -{ -} - -LLTexLayerInfo::~LLTexLayerInfo( ) -{ - std::for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer()); - std::for_each(mParamAlphaInfoList.begin(), mParamAlphaInfoList.end(), DeletePointer()); -} - -BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) -{ - llassert( node->hasName( "layer" ) ); - - // name attribute - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if( !node->getFastAttributeString( name_string, mName ) ) - { - return FALSE; - } - - static LLStdStringHandle write_all_channels_string = LLXmlTree::addAttributeString("write_all_channels"); - node->getFastAttributeBOOL( write_all_channels_string, mWriteAllChannels ); - - std::string render_pass_name; - static LLStdStringHandle render_pass_string = LLXmlTree::addAttributeString("render_pass"); - if( node->getFastAttributeString( render_pass_string, render_pass_name ) ) - { - if( render_pass_name == "bump" ) - { - mRenderPass = LLTexLayer::RP_BUMP; - } - } - - // Note: layers can have either a "global_color" attrib, a "fixed_color" attrib, or a child. - // global color attribute (optional) - static LLStdStringHandle global_color_string = LLXmlTree::addAttributeString("global_color"); - node->getFastAttributeString( global_color_string, mGlobalColor ); - - // Visibility mask (optional) - BOOL is_visibility; - static LLStdStringHandle visibility_mask_string = LLXmlTree::addAttributeString("visibility_mask"); - if (node->getFastAttributeBOOL(visibility_mask_string, is_visibility)) - { - mIsVisibilityMask = is_visibility; - } - - // color attribute (optional) - LLColor4U color4u; - static LLStdStringHandle fixed_color_string = LLXmlTree::addAttributeString("fixed_color"); - if( node->getFastAttributeColor4U( fixed_color_string, color4u ) ) - { - mFixedColor.setVec( color4u ); - } - - // optional sub-element - for (LLXmlTreeNode* texture_node = node->getChildByName( "texture" ); - texture_node; - texture_node = node->getNextNamedChild()) - { - std::string local_texture_name; - static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file"); - static LLStdStringHandle local_texture_string = LLXmlTree::addAttributeString("local_texture"); - static LLStdStringHandle file_is_mask_string = LLXmlTree::addAttributeString("file_is_mask"); - static LLStdStringHandle local_texture_alpha_only_string = LLXmlTree::addAttributeString("local_texture_alpha_only"); - if( texture_node->getFastAttributeString( tga_file_string, mStaticImageFileName ) ) - { - texture_node->getFastAttributeBOOL( file_is_mask_string, mStaticImageIsMask ); - } - else if (texture_node->getFastAttributeString(local_texture_string, local_texture_name)) - { - texture_node->getFastAttributeBOOL( local_texture_alpha_only_string, mUseLocalTextureAlphaOnly ); - - /* if ("upper_shirt" == local_texture_name) - mLocalTexture = TEX_UPPER_SHIRT; */ - mLocalTexture = TEX_NUM_INDICES; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - iter++) - { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; - if (local_texture_name == texture_dict->mName) - { - mLocalTexture = iter->first; - break; - } - } - if (mLocalTexture == TEX_NUM_INDICES) - { - llwarns << " element has invalid local_texture attribute: " << mName << " " << local_texture_name << llendl; - return FALSE; - } - } - else - { - llwarns << " element is missing a required attribute. " << mName << llendl; - return FALSE; - } - } - - for (LLXmlTreeNode* maskNode = node->getChildByName( "morph_mask" ); - maskNode; - maskNode = node->getNextNamedChild()) - { - std::string morph_name; - static LLStdStringHandle morph_name_string = LLXmlTree::addAttributeString("morph_name"); - if (maskNode->getFastAttributeString(morph_name_string, morph_name)) - { - BOOL invert = FALSE; - static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert"); - maskNode->getFastAttributeBOOL(invert_string, invert); - mMorphNameList.push_back(std::pair(morph_name,invert)); - } - } - - // optional sub-element (color or alpha params) - for (LLXmlTreeNode* child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if( child->getChildByName( "param_color" ) ) - { - // - LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo(); - if (!info->parseXml(child)) - { - delete info; - return FALSE; - } - mParamColorInfoList.push_back(info); - } - else if( child->getChildByName( "param_alpha" ) ) - { - // - LLTexLayerParamAlphaInfo* info = new LLTexLayerParamAlphaInfo( ); - if (!info->parseXml(child)) - { - delete info; - return FALSE; - } - mParamAlphaInfoList.push_back(info); - } - } - - return TRUE; -} - -BOOL LLTexLayerInfo::createVisualParams(LLVOAvatar *avatar) -{ - BOOL success = TRUE; - for (param_color_info_list_t::iterator color_info_iter = mParamColorInfoList.begin(); - color_info_iter != mParamColorInfoList.end(); - color_info_iter++) - { - LLTexLayerParamColorInfo * color_info = *color_info_iter; - LLTexLayerParamColor* param_color = new LLTexLayerParamColor(avatar); - if (!param_color->setInfo(color_info, TRUE)) - { - llwarns << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << llendl; - delete param_color; - success = FALSE; - } - } - - for (param_alpha_info_list_t::iterator alpha_info_iter = mParamAlphaInfoList.begin(); - alpha_info_iter != mParamAlphaInfoList.end(); - alpha_info_iter++) - { - LLTexLayerParamAlphaInfo * alpha_info = *alpha_info_iter; - LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(avatar); - if (!param_alpha->setInfo(alpha_info, TRUE)) - { - llwarns << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << llendl; - delete param_alpha; - success = FALSE; - } - } - - return success; -} - -LLTexLayerInterface::LLTexLayerInterface(LLTexLayerSet* const layer_set): - mTexLayerSet( layer_set ), - mMorphMasksValid( FALSE ), - mInfo(NULL), - mHasMorph(FALSE) -{ -} - -LLTexLayerInterface::LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable): - mTexLayerSet( layer.mTexLayerSet ), - mInfo(NULL) -{ - // don't add visual params for cloned layers - setInfo(layer.getInfo(), wearable); - - mHasMorph = layer.mHasMorph; -} - -BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearable ) // This sets mInfo and calls initialization functions -{ - // setInfo should only be called once. Code is not robust enough to handle redefinition of a texlayer. - // Not a critical warning, but could be useful for debugging later issues. -Nyx - if (mInfo != NULL) - { - llwarns << "mInfo != NULL" << llendl; - } - mInfo = info; - //mID = info->mID; // No ID - - mParamColorList.reserve(mInfo->mParamColorInfoList.size()); - for (param_color_info_list_t::const_iterator iter = mInfo->mParamColorInfoList.begin(); - iter != mInfo->mParamColorInfoList.end(); - iter++) - { - LLTexLayerParamColor* param_color; - if (!wearable) - { - param_color = new LLTexLayerParamColor(this); - if (!param_color->setInfo(*iter, TRUE)) - { - mInfo = NULL; - return FALSE; - } - } - else - { - param_color = (LLTexLayerParamColor*)wearable->getVisualParam((*iter)->getID()); - if (!param_color) - { - mInfo = NULL; - return FALSE; - } - } - mParamColorList.push_back( param_color ); - } - - mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size()); - for (param_alpha_info_list_t::const_iterator iter = mInfo->mParamAlphaInfoList.begin(); - iter != mInfo->mParamAlphaInfoList.end(); - iter++) - { - LLTexLayerParamAlpha* param_alpha; - if (!wearable) - { - param_alpha = new LLTexLayerParamAlpha( this ); - if (!param_alpha->setInfo(*iter, TRUE)) - { - mInfo = NULL; - return FALSE; - } - } - else - { - param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam((*iter)->getID()); - if (!param_alpha) - { - mInfo = NULL; - return FALSE; - } - } - mParamAlphaList.push_back( param_alpha ); - } - - return TRUE; -} - -/*virtual*/ void LLTexLayerInterface::requestUpdate() -{ - mTexLayerSet->requestUpdate(); -} - -const std::string& LLTexLayerInterface::getName() const -{ - return mInfo->mName; -} - -LLTexLayerInterface::ERenderPass LLTexLayerInterface::getRenderPass() const -{ - return mInfo->mRenderPass; -} - -const std::string& LLTexLayerInterface::getGlobalColor() const -{ - return mInfo->mGlobalColor; -} - -BOOL LLTexLayerInterface::isVisibilityMask() const -{ - return mInfo->mIsVisibilityMask; -} - -void LLTexLayerInterface::invalidateMorphMasks() -{ - mMorphMasksValid = FALSE; -} - -LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const -{ - LLViewerVisualParam *result = NULL; - for (param_color_list_t::const_iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter) - { - if ((*color_iter)->getID() == index) - { - result = *color_iter; - } - } - for (param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter) - { - if ((*alpha_iter)->getID() == index) - { - result = *alpha_iter; - } - } - - return result; -} - -//----------------------------------------------------------------------------- -// LLTexLayer -// A single texture layer, consisting of: -// * color, consisting of either -// * one or more color parameters (weighted colors) -// * a reference to a global color -// * a fixed color with non-zero alpha -// * opaque white (the default) -// * (optional) a texture defined by either -// * a GUID -// * a texture entry index (TE) -// * (optional) one or more alpha parameters (weighted alpha textures) -//----------------------------------------------------------------------------- -LLTexLayer::LLTexLayer(LLTexLayerSet* const layer_set) : - LLTexLayerInterface( layer_set ), - mLocalTextureObject(NULL) -{ -} - -LLTexLayer::LLTexLayer(const LLTexLayer &layer, LLWearable *wearable) : - LLTexLayerInterface( layer, wearable ), - mLocalTextureObject(NULL) -{ -} - -LLTexLayer::LLTexLayer(const LLTexLayerTemplate &layer_template, LLLocalTextureObject *lto, LLWearable *wearable) : - LLTexLayerInterface( layer_template, wearable ), - mLocalTextureObject(lto) -{ -} - -LLTexLayer::~LLTexLayer() -{ - // mParamAlphaList and mParamColorList are LLViewerVisualParam's and get - // deleted with ~LLCharacter() - //std::for_each(mParamAlphaList.begin(), mParamAlphaList.end(), DeletePointer()); - //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer()); - - for( alpha_cache_t::iterator iter = mAlphaCache.begin(); - iter != mAlphaCache.end(); iter++ ) - { - U8* alpha_data = iter->second; - delete [] alpha_data; - } - -} - -//----------------------------------------------------------------------------- -// setInfo -//----------------------------------------------------------------------------- - -BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable ) -{ - return LLTexLayerInterface::setInfo(info, wearable); -} - -//static -void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color) -{ - for (param_color_list_t::const_iterator iter = param_list.begin(); - iter != param_list.end(); iter++) - { - const LLTexLayerParamColor* param = *iter; - LLColor4 param_net = param->getNetColor(); - const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)param->getInfo(); - switch(info->getOperation()) - { - case LLTexLayerParamColor::OP_ADD: - net_color += param_net; - break; - case LLTexLayerParamColor::OP_MULTIPLY: - net_color = net_color * param_net; - break; - case LLTexLayerParamColor::OP_BLEND: - net_color = lerp(net_color, param_net, param->getWeight()); - break; - default: - llassert(0); - break; - } - } - net_color.clamp(); -} - -/*virtual*/ void LLTexLayer::deleteCaches() -{ - // Only need to delete caches for alpha params. Color params don't hold extra memory - for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); - iter != mParamAlphaList.end(); iter++ ) - { - LLTexLayerParamAlpha* param = *iter; - param->deleteCaches(); - } -} - -BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) -{ - LLGLEnable color_mat(GL_COLOR_MATERIAL); - gPipeline.disableLights(); - - bool use_shaders = LLGLSLShader::sNoFixedFunction; - - LLColor4 net_color; - BOOL color_specified = findNetColor(&net_color); - - if (mTexLayerSet->getAvatar()->mIsDummy) - { - color_specified = true; - net_color = LLVOAvatar::getDummyColor(); - } - - BOOL success = TRUE; - - // If you can't see the layer, don't render it. - if( is_approx_zero( net_color.mV[VW] ) ) - { - return success; - } - - BOOL alpha_mask_specified = FALSE; - param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); - if( iter != mParamAlphaList.end() ) - { - // If we have alpha masks, but we're skipping all of them, skip the whole layer. - // However, we can't do this optimization if we have morph masks that need updating. -/* if (!mHasMorph) - { - BOOL skip_layer = TRUE; - - while( iter != mParamAlphaList.end() ) - { - const LLTexLayerParamAlpha* param = *iter; - - if( !param->getSkip() ) - { - skip_layer = FALSE; - break; - } - - iter++; - } - - if( skip_layer ) - { - return success; - } - }//*/ - - renderMorphMasks(x, y, width, height, net_color); - alpha_mask_specified = TRUE; - gGL.flush(); - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA); - } - - gGL.color4fv( net_color.mV); - - if( getInfo()->mWriteAllChannels ) - { - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_REPLACE); - } - - if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly ) - { - { - LLViewerTexture* tex = NULL; - if (mLocalTextureObject && mLocalTextureObject->getImage()) - { - tex = mLocalTextureObject->getImage(); - if (mLocalTextureObject->getID() == IMG_DEFAULT_AVATAR) - { - tex = NULL; - } - } - else - { - llinfos << "lto not defined or image not defined: " << getInfo()->getLocalTexture() << " lto: " << mLocalTextureObject << llendl; - } -// if( mTexLayerSet->getAvatar()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl ) ) - { - if( tex ) - { - bool no_alpha_test = getInfo()->mWriteAllChannels; - LLGLDisable alpha_test(no_alpha_test ? GL_ALPHA_TEST : 0); - if (use_shaders && no_alpha_test) - { - gAlphaMaskProgram.setMinimumAlpha(0.f); - } - - LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode(); - - gGL.getTexUnit(0)->bind(tex, TRUE); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - - gl_rect_2d_simple_tex( width, height ); - - gGL.getTexUnit(0)->setTextureAddressMode(old_mode); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if (use_shaders && no_alpha_test) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - - } - } -// else -// { -// success = FALSE; -// } - } - } - - if( !getInfo()->mStaticImageFileName.empty() ) - { - { - LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask); - if( tex ) - { - gGL.getTexUnit(0)->bind(tex, TRUE); - gl_rect_2d_simple_tex( width, height ); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - } - else - { - success = FALSE; - } - } - } - - if(((-1 == getInfo()->mLocalTexture) || - getInfo()->mUseLocalTextureAlphaOnly) && - getInfo()->mStaticImageFileName.empty() && - color_specified ) - { - LLGLDisable no_alpha(GL_ALPHA_TEST); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.f); - } - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4fv( net_color.mV ); - gl_rect_2d_simple( width, height ); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - } - - if( alpha_mask_specified || getInfo()->mWriteAllChannels ) - { - // Restore standard blend func value - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - stop_glerror(); - } - - if( !success ) - { - llinfos << "LLTexLayer::render() partial: " << getInfo()->mName << llendl; - } - return success; -} - -const U8* LLTexLayer::getAlphaData() const -{ - LLCRC alpha_mask_crc; - const LLUUID& uuid = getUUID(); - alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES); - - for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) - { - const LLTexLayerParamAlpha* param = *iter; - // MULTI-WEARABLE: verify visual parameters used here - F32 param_weight = param->getWeight(); - alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32)); - } - - U32 cache_index = alpha_mask_crc.getCRC(); - - alpha_cache_t::const_iterator iter2 = mAlphaCache.find(cache_index); - return (iter2 == mAlphaCache.end()) ? 0 : iter2->second; -} - -BOOL LLTexLayer::findNetColor(LLColor4* net_color) const -{ - // Color is either: - // * one or more color parameters (weighted colors) (which may make use of a global color or fixed color) - // * a reference to a global color - // * a fixed color with non-zero alpha - // * opaque white (the default) - - if( !mParamColorList.empty() ) - { - if( !getGlobalColor().empty() ) - { - net_color->setVec( mTexLayerSet->getAvatar()->getGlobalColor( getInfo()->mGlobalColor ) ); - } - else if (getInfo()->mFixedColor.mV[VW]) - { - net_color->setVec( getInfo()->mFixedColor ); - } - else - { - net_color->setVec( 0.f, 0.f, 0.f, 0.f ); - } - - calculateTexLayerColor(mParamColorList, *net_color); - return TRUE; - } - - if( !getGlobalColor().empty() ) - { - net_color->setVec( mTexLayerSet->getAvatar()->getGlobalColor( getGlobalColor() ) ); - return TRUE; - } - - if( getInfo()->mFixedColor.mV[VW] ) - { - net_color->setVec( getInfo()->mFixedColor ); - return TRUE; - } - - net_color->setToWhite(); - - return FALSE; // No need to draw a separate colored polygon -} - -BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) -{ - BOOL success = TRUE; - - gGL.flush(); - - bool use_shaders = LLGLSLShader::sNoFixedFunction; - - if( !getInfo()->mStaticImageFileName.empty() ) - { - LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); - if( tex ) - { - LLGLSNoAlphaTest gls_no_alpha_test; - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.f); - } - gGL.getTexUnit(0)->bind(tex, TRUE); - gl_rect_2d_simple_tex( width, height ); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - } - else - { - success = FALSE; - } - } - else - { - if (getInfo()->mLocalTexture >=0 && getInfo()->mLocalTexture < TEX_NUM_INDICES) - { - LLViewerTexture* tex = mLocalTextureObject->getImage(); - if (tex) - { - LLGLSNoAlphaTest gls_no_alpha_test; - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.f); - } - gGL.getTexUnit(0)->bind(tex); - gl_rect_2d_simple_tex( width, height ); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - success = TRUE; - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - } - } - } - - return success; -} - -/*virtual*/ void LLTexLayer::gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) -{ - addAlphaMask(data, originX, originY, width, height); -} - -BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color) -{ - BOOL success = TRUE; - - llassert( !mParamAlphaList.empty() ); - - bool use_shaders = LLGLSLShader::sNoFixedFunction; - - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.f); - } - - gGL.setColorMask(false, true); - - LLTexLayerParamAlpha* first_param = *mParamAlphaList.begin(); - // Note: if the first param is a mulitply, multiply against the current buffer's alpha - if( !first_param || !first_param->getMultiplyBlend() ) - { - LLGLDisable no_alpha(GL_ALPHA_TEST); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // Clear the alpha - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_REPLACE); - - gGL.color4f( 0.f, 0.f, 0.f, 0.f ); - gl_rect_2d_simple( width, height ); - } - - // Accumulate alphas - LLGLSNoAlphaTest gls_no_alpha_test; - gGL.color4f( 1.f, 1.f, 1.f, 1.f ); - for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) - { - LLTexLayerParamAlpha* param = *iter; - success &= param->render( x, y, width, height ); - } - - // Approximates a min() function - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA); - - // Accumulate the alpha component of the texture - if( getInfo()->mLocalTexture != -1 ) - { - LLViewerTexture* tex = mLocalTextureObject->getImage(); - if( tex && (tex->getComponents() == 4) ) - { - LLGLSNoAlphaTest gls_no_alpha_test; - LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode(); - - gGL.getTexUnit(0)->bind(tex, TRUE); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - - gl_rect_2d_simple_tex( width, height ); - - gGL.getTexUnit(0)->setTextureAddressMode(old_mode); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - } - } - - if( !getInfo()->mStaticImageFileName.empty() ) - { - LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask); - if( tex ) - { - if( (tex->getComponents() == 4) || - ( (tex->getComponents() == 1) && getInfo()->mStaticImageIsMask ) ) - { - LLGLSNoAlphaTest gls_no_alpha_test; - gGL.getTexUnit(0)->bind(tex, TRUE); - gl_rect_2d_simple_tex( width, height ); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - } - } - } - - // Draw a rectangle with the layer color to multiply the alpha by that color's alpha. - // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); - if (layer_color.mV[VW] != 1.f) - { - LLGLDisable no_alpha(GL_ALPHA_TEST); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4fv(layer_color.mV); - gl_rect_2d_simple( width, height ); - } - - if (use_shaders) - { - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - - LLGLSUIDefault gls_ui; - - gGL.setColorMask(true, true); - - if (hasMorph() && success) - { - LLCRC alpha_mask_crc; - const LLUUID& uuid = getUUID(); - alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES); - - for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) - { - const LLTexLayerParamAlpha* param = *iter; - F32 param_weight = param->getWeight(); - alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32)); - } - - U32 cache_index = alpha_mask_crc.getCRC(); - U8* alpha_data = get_if_there(mAlphaCache,cache_index,(U8*)NULL); - if (!alpha_data) - { - // clear out a slot if we have filled our cache - S32 max_cache_entries = getTexLayerSet()->getAvatar()->isSelf() ? 4 : 1; - while ((S32)mAlphaCache.size() >= max_cache_entries) - { - alpha_cache_t::iterator iter2 = mAlphaCache.begin(); // arbitrarily grab the first entry - alpha_data = iter2->second; - delete [] alpha_data; - mAlphaCache.erase(iter2); - } - alpha_data = new U8[width * height]; - mAlphaCache[cache_index] = alpha_data; - glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data); - } - - getTexLayerSet()->getAvatar()->dirtyMesh(); - - mMorphMasksValid = TRUE; - getTexLayerSet()->applyMorphMask(alpha_data, width, height, 1); - } - - return success; -} - -void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height) -{ - S32 size = width * height; - const U8* alphaData = getAlphaData(); - if (!alphaData && hasAlphaParams()) - { - LLColor4 net_color; - findNetColor( &net_color ); - // TODO: eliminate need for layer morph mask valid flag - invalidateMorphMasks(); - renderMorphMasks(originX, originY, width, height, net_color); - alphaData = getAlphaData(); - } - if (alphaData) - { - for( S32 i = 0; i < size; i++ ) - { - U8 curAlpha = data[i]; - U16 resultAlpha = curAlpha; - resultAlpha *= (alphaData[i] + 1); - resultAlpha = resultAlpha >> 8; - data[i] = (U8)resultAlpha; - } - } -} - -/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask() const -{ - if (mLocalTextureObject) - { - if (mLocalTextureObject->getID() == IMG_INVISIBLE) - { - return TRUE; - } - } - - return FALSE; -} - -LLUUID LLTexLayer::getUUID() const -{ - LLUUID uuid; - if( getInfo()->mLocalTexture != -1 ) - { - LLViewerTexture* tex = mLocalTextureObject->getImage(); - if (tex) - { - uuid = mLocalTextureObject->getID(); - } - } - if( !getInfo()->mStaticImageFileName.empty() ) - { - LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask); - if( tex ) - { - uuid = tex->getID(); - } - } - return uuid; -} - - -//----------------------------------------------------------------------------- -// LLTexLayerTemplate -// A single texture layer, consisting of: -// * color, consisting of either -// * one or more color parameters (weighted colors) -// * a reference to a global color -// * a fixed color with non-zero alpha -// * opaque white (the default) -// * (optional) a texture defined by either -// * a GUID -// * a texture entry index (TE) -// * (optional) one or more alpha parameters (weighted alpha textures) -//----------------------------------------------------------------------------- -LLTexLayerTemplate::LLTexLayerTemplate(LLTexLayerSet* layer_set) : - LLTexLayerInterface(layer_set) -{ -} - -LLTexLayerTemplate::LLTexLayerTemplate(const LLTexLayerTemplate &layer) : - LLTexLayerInterface(layer) -{ -} - -LLTexLayerTemplate::~LLTexLayerTemplate() -{ -} - -//----------------------------------------------------------------------------- -// setInfo -//----------------------------------------------------------------------------- - -/*virtual*/ BOOL LLTexLayerTemplate::setInfo(const LLTexLayerInfo* info, LLWearable* wearable ) -{ - return LLTexLayerInterface::setInfo(info, wearable); -} - -U32 LLTexLayerTemplate::updateWearableCache() const -{ - mWearableCache.clear(); - - S32 te = mInfo->mLocalTexture; - if (te == -1) - { - //this isn't a cloneable layer - return 0; - } - LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te); - U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); - U32 added = 0; - for (U32 i = 0; i < num_wearables; i++) - { - LLWearable* wearable = gAgentWearables.getWearable(wearable_type, i); - if (!wearable) - { - continue; - } - mWearableCache.push_back(wearable); - added++; - } - return added; -} -LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const -{ - if (mWearableCache.size() <= i) - { - return NULL; - } - LLWearable *wearable = mWearableCache[i]; - LLLocalTextureObject *lto = NULL; - LLTexLayer *layer = NULL; - if (wearable) - { - lto = wearable->getLocalTextureObject(mInfo->mLocalTexture); - } - if (lto) - { - layer = lto->getTexLayer(getName()); - } - return layer; -} - -/*virtual*/ BOOL LLTexLayerTemplate::render(S32 x, S32 y, S32 width, S32 height) -{ - if(!mInfo) - { - return FALSE ; - } - - BOOL success = TRUE; - updateWearableCache(); - for (wearable_cache_t::const_iterator iter = mWearableCache.begin(); iter!= mWearableCache.end(); iter++) - { - LLWearable* wearable = NULL; - LLLocalTextureObject *lto = NULL; - LLTexLayer *layer = NULL; - wearable = *iter; - if (wearable) - { - lto = wearable->getLocalTextureObject(mInfo->mLocalTexture); - } - if (lto) - { - layer = lto->getTexLayer(getName()); - } - if (layer) - { - wearable->writeToAvatar(); - layer->setLTO(lto); - success &= layer->render(x,y,width,height); - } - } - - return success; -} - -/*virtual*/ BOOL LLTexLayerTemplate::blendAlphaTexture( S32 x, S32 y, S32 width, S32 height) // Multiplies a single alpha texture against the frame buffer -{ - BOOL success = TRUE; - U32 num_wearables = updateWearableCache(); - for (U32 i = 0; i < num_wearables; i++) - { - LLTexLayer *layer = getLayer(i); - if (layer) - { - success &= layer->blendAlphaTexture(x,y,width,height); - } - } - return success; -} - -/*virtual*/ void LLTexLayerTemplate::gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) -{ - U32 num_wearables = updateWearableCache(); - for (U32 i = 0; i < num_wearables; i++) - { - LLTexLayer *layer = getLayer(i); - if (layer) - { - layer->addAlphaMask(data, originX, originY, width, height); - } - } -} - -/*virtual*/ void LLTexLayerTemplate::setHasMorph(BOOL newval) -{ - mHasMorph = newval; - U32 num_wearables = updateWearableCache(); - for (U32 i = 0; i < num_wearables; i++) - { - LLTexLayer *layer = getLayer(i); - if (layer) - { - layer->setHasMorph(newval); - } - } -} - -/*virtual*/ void LLTexLayerTemplate::deleteCaches() -{ - U32 num_wearables = updateWearableCache(); - for (U32 i = 0; i < num_wearables; i++) - { - LLTexLayer *layer = getLayer(i); - if (layer) - { - layer->deleteCaches(); - } - } -} - -/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask() const -{ - U32 num_wearables = updateWearableCache(); - for (U32 i = 0; i < num_wearables; i++) - { - LLTexLayer *layer = getLayer(i); - if (layer) - { - if (layer->isInvisibleAlphaMask()) - { - return TRUE; - } - } - } - - return FALSE; -} - - -//----------------------------------------------------------------------------- -// finds a specific layer based on a passed in name -//----------------------------------------------------------------------------- -LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name) -{ - for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - if (layer->getName() == name) - { - return layer; - } - } - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - if (layer->getName() == name) - { - return layer; - } - } - return NULL; -} - -void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable *wearable) -{ - // initialize all texlayers with this texture type for this LTO - for( LLTexLayerSet::layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter; - if (layer->getInfo()->getLocalTexture() == (S32) tex_index) - { - lto->addTexLayer(layer, wearable); - } - } - for( LLTexLayerSet::layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ ) - { - LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter; - if (layer->getInfo()->getLocalTexture() == (S32) tex_index) - { - lto->addTexLayer(layer, wearable); - } - } -} -//----------------------------------------------------------------------------- -// LLTexLayerStaticImageList -//----------------------------------------------------------------------------- - -LLTexLayerStaticImageList::LLTexLayerStaticImageList() : - mGLBytes(0), - mTGABytes(0), - mImageNames(16384) -{ -} - -LLTexLayerStaticImageList::~LLTexLayerStaticImageList() -{ - deleteCachedImages(); -} - -void LLTexLayerStaticImageList::dumpByteCount() const -{ - llinfos << "Avatar Static Textures " << - "KB GL:" << (mGLBytes / 1024) << - "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; -} - -void LLTexLayerStaticImageList::deleteCachedImages() -{ - if( mGLBytes || mTGABytes ) - { - llinfos << "Clearing Static Textures " << - "KB GL:" << (mGLBytes / 1024) << - "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; - - //mStaticImageLists uses LLPointers, clear() will cause deletion - - mStaticImageListTGA.clear(); - mStaticImageList.clear(); - - mGLBytes = 0; - mTGABytes = 0; - } -} - -// Note: in general, for a given image image we'll call either getImageTga() or getTexture(). -// We call getImageTga() if the image is used as an alpha gradient. -// Otherwise, we call getTexture() - -// Returns an LLImageTGA that contains the encoded data from a tga file named file_name. -// Caches the result to speed identical subsequent requests. -LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name) -{ - const char *namekey = mImageNames.addString(file_name); - image_tga_map_t::const_iterator iter = mStaticImageListTGA.find(namekey); - if( iter != mStaticImageListTGA.end() ) - { - return iter->second; - } - else - { - std::string path; - path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name); - LLPointer image_tga = new LLImageTGA( path ); - if( image_tga->getDataSize() > 0 ) - { - mStaticImageListTGA[ namekey ] = image_tga; - mTGABytes += image_tga->getDataSize(); - return image_tga; - } - else - { - return NULL; - } - } -} - -// Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name. -// Caches the result to speed identical subsequent requests. -LLViewerTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, BOOL is_mask) -{ - LLPointer tex; - const char *namekey = mImageNames.addString(file_name); - - texture_map_t::const_iterator iter = mStaticImageList.find(namekey); - if( iter != mStaticImageList.end() ) - { - tex = iter->second; - } - else - { - tex = LLViewerTextureManager::getLocalTexture( FALSE ); - LLPointer image_raw = new LLImageRaw; - if( loadImageRaw( file_name, image_raw ) ) - { - if( (image_raw->getComponents() == 1) && is_mask ) - { - // Note: these are static, unchanging images so it's ok to assume - // that once an image is a mask it's always a mask. - tex->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); - } - tex->createGLTexture(0, image_raw, 0, TRUE, LLViewerTexture::LOCAL); - - gGL.getTexUnit(0)->bind(tex); - tex->setAddressMode(LLTexUnit::TAM_CLAMP); - - mStaticImageList [ namekey ] = tex; - mGLBytes += (S32)tex->getWidth() * tex->getHeight() * tex->getComponents(); - } - else - { - tex = NULL; - } - } - - return tex; -} - -// Reads a .tga file, decodes it, and puts the decoded data in image_raw. -// Returns TRUE if successful. -BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLImageRaw* image_raw) -{ - BOOL success = FALSE; - std::string path; - path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name); - LLPointer image_tga = new LLImageTGA( path ); - if( image_tga->getDataSize() > 0 ) - { - // Copy data from tga to raw. - success = image_tga->decode( image_raw ); - } - - return success; -} - -const std::string LLTexLayerSetBuffer::dumpTextureInfo() const -{ - if (!isAgentAvatarValid()) return ""; - - const BOOL is_high_res = !mNeedsUpload; - const U32 num_low_res = mNumLowresUploads; - const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32(); - const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet); - - std::string status = "CREATING "; - if (!uploadNeeded()) status = "DONE "; - if (uploadInProgress()) status = "UPLOADING"; - - std::string text = llformat("[%s] [HiRes:%d LoRes:%d] [Elapsed:%d] %s", - status.c_str(), - is_high_res, num_low_res, - upload_time, - local_texture_info.c_str()); - return text; -} diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h deleted file mode 100644 index 4f43547dae..0000000000 --- a/indra/newview/lltexlayer.h +++ /dev/null @@ -1,380 +0,0 @@ -/** - * @file lltexlayer.h - * @brief Texture layer classes. Used for avatars. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLTEXLAYER_H -#define LL_LLTEXLAYER_H - -#include -#include "lldynamictexture.h" -#include "llvoavatardefines.h" -#include "lltexlayerparams.h" - -class LLVOAvatar; -class LLVOAvatarSelf; -class LLImageTGA; -class LLImageRaw; -class LLXmlTreeNode; -class LLTexLayerSet; -class LLTexLayerSetInfo; -class LLTexLayerInfo; -class LLTexLayerSetBuffer; -class LLWearable; -class LLViewerVisualParam; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerInterface -// -// Interface class to generalize functionality shared by LLTexLayer -// and LLTexLayerTemplate. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerInterface -{ -public: - enum ERenderPass - { - RP_COLOR, - RP_BUMP, - RP_SHINE - }; - - LLTexLayerInterface(LLTexLayerSet* const layer_set); - LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable); - virtual ~LLTexLayerInterface() {} - - virtual BOOL render(S32 x, S32 y, S32 width, S32 height) = 0; - virtual void deleteCaches() = 0; - virtual BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0; - virtual BOOL isInvisibleAlphaMask() const = 0; - - const LLTexLayerInfo* getInfo() const { return mInfo; } - virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions - - const std::string& getName() const; - const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; } - LLTexLayerSet* const getTexLayerSet() { return mTexLayerSet; } - - void invalidateMorphMasks(); - virtual void setHasMorph(BOOL newval) { mHasMorph = newval; } - BOOL hasMorph() const { return mHasMorph; } - BOOL isMorphValid() const { return mMorphMasksValid; } - - void requestUpdate(); - virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) = 0; - BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); } - - ERenderPass getRenderPass() const; - BOOL isVisibilityMask() const; - -protected: - const std::string& getGlobalColor() const; - LLViewerVisualParam* getVisualParamPtr(S32 index) const; - -protected: - LLTexLayerSet* const mTexLayerSet; - const LLTexLayerInfo* mInfo; - BOOL mMorphMasksValid; - BOOL mHasMorph; - - // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order. - param_color_list_t mParamColorList; - param_alpha_list_t mParamAlphaList; - // mGlobalColor name stored in mInfo - // mFixedColor value stored in mInfo -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerTemplate -// -// Only exists for llvoavatarself. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerTemplate : public LLTexLayerInterface -{ -public: - LLTexLayerTemplate(LLTexLayerSet* const layer_set); - LLTexLayerTemplate(const LLTexLayerTemplate &layer); - /*virtual*/ ~LLTexLayerTemplate(); - /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height); - /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions - /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer - /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height); - /*virtual*/ void setHasMorph(BOOL newval); - /*virtual*/ void deleteCaches(); - /*virtual*/ BOOL isInvisibleAlphaMask() const; -protected: - U32 updateWearableCache() const; - LLTexLayer* getLayer(U32 i) const; -private: - typedef std::vector wearable_cache_t; - mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayer -// -// A single texture layer. Only exists for llvoavatarself. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayer : public LLTexLayerInterface -{ -public: - LLTexLayer(LLTexLayerSet* const layer_set); - LLTexLayer(const LLTexLayer &layer, LLWearable *wearable); - LLTexLayer(const LLTexLayerTemplate &layer_template, LLLocalTextureObject *lto, LLWearable *wearable); - /*virtual*/ ~LLTexLayer(); - - /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions - /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height); - - /*virtual*/ void deleteCaches(); - const U8* getAlphaData() const; - - BOOL findNetColor(LLColor4* color) const; - /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer - /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height); - BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color); - void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height); - /*virtual*/ BOOL isInvisibleAlphaMask() const; - - void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; } - LLLocalTextureObject* getLTO() { return mLocalTextureObject; } - - static void calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color); -protected: - LLUUID getUUID() const; -private: - typedef std::map alpha_cache_t; - alpha_cache_t mAlphaCache; - LLLocalTextureObject* mLocalTextureObject; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerSet -// -// An ordered set of texture layers that gets composited into a single texture. -// Only exists for llvoavatarself. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerSet -{ - friend class LLTexLayerSetBuffer; -public: - LLTexLayerSet(LLVOAvatarSelf* const avatar); - ~LLTexLayerSet(); - - const LLTexLayerSetInfo* getInfo() const { return mInfo; } - BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions - - BOOL render(S32 x, S32 y, S32 width, S32 height); - void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false); - - BOOL isBodyRegion(const std::string& region) const; - LLTexLayerSetBuffer* getComposite(); - const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist. - void requestUpdate(); - void requestUpload(); - void cancelUpload(); - void updateComposite(); - BOOL isLocalTextureDataAvailable() const; - BOOL isLocalTextureDataFinal() const; - void createComposite(); - void destroyComposite(); - void setUpdatesEnabled(BOOL b); - BOOL getUpdatesEnabled() const { return mUpdatesEnabled; } - void deleteCaches(); - void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height); - void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components); - BOOL isMorphValid() const; - void invalidateMorphMasks(); - LLTexLayerInterface* findLayerByName(const std::string& name); - void cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable* wearable); - - LLVOAvatarSelf* getAvatar() const { return mAvatar; } - const std::string getBodyRegionName() const; - BOOL hasComposite() const { return (mComposite.notNull()); } - LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; } - void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; } - BOOL isVisible() const { return mIsVisible; } - - static BOOL sHasCaches; - -private: - typedef std::vector layer_list_t; - layer_list_t mLayerList; - layer_list_t mMaskLayerList; - LLPointer mComposite; - LLVOAvatarSelf* const mAvatar; // note: backlink only; don't make this an LLPointer. - BOOL mUpdatesEnabled; - BOOL mIsVisible; - - LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex; - const LLTexLayerSetInfo* mInfo; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerSetInfo -// -// Contains shared layer set data. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerSetInfo -{ - friend class LLTexLayerSet; -public: - LLTexLayerSetInfo(); - ~LLTexLayerSetInfo(); - BOOL parseXml(LLXmlTreeNode* node); - void createVisualParams(LLVOAvatar *avatar); -private: - std::string mBodyRegion; - S32 mWidth; - S32 mHeight; - std::string mStaticAlphaFileName; - BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName) - typedef std::vector layer_info_list_t; - layer_info_list_t mLayerInfoList; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerSetBuffer -// -// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerSetBuffer : public LLViewerDynamicTexture -{ - LOG_CLASS(LLTexLayerSetBuffer); - -public: - LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height); - virtual ~LLTexLayerSetBuffer(); - -public: - /*virtual*/ S8 getType() const; - BOOL isInitialized(void) const; - static void dumpTotalByteCount(); - const std::string dumpTextureInfo() const; - virtual void restoreGLTexture(); - virtual void destroyGLTexture(); -protected: - void pushProjection() const; - void popProjection() const; -private: - LLTexLayerSet* const mTexLayerSet; - static S32 sGLByteCount; - - //-------------------------------------------------------------------- - // Render - //-------------------------------------------------------------------- -public: - /*virtual*/ BOOL needsRender(); -protected: - BOOL render(S32 x, S32 y, S32 width, S32 height); - virtual void preRender(BOOL clear_depth); - virtual void postRender(BOOL success); - virtual BOOL render(); - - //-------------------------------------------------------------------- - // Uploads - //-------------------------------------------------------------------- -public: - void requestUpload(); - void cancelUpload(); - BOOL uploadNeeded() const; // We need to upload a new texture - BOOL uploadInProgress() const; // We have started uploading a new texture and are awaiting the result - BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point - static void onTextureUploadComplete(const LLUUID& uuid, - void* userdata, - S32 result, LLExtStat ext_status); -protected: - BOOL isReadyToUpload() const; - void doUpload(); // Does a read back and upload. - void conditionalRestartUploadTimer(); -private: - BOOL mNeedsUpload; // Whether we need to send our baked textures to the server - U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server - BOOL mUploadPending; // Whether we have received back the new baked textures - LLUUID mUploadID; // The current upload process (null if none). - LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested and performed. - S32 mUploadFailCount; // Number of consecutive upload failures - LLFrameTimer mUploadRetryTimer; // Tracks time since last upload failure. - - //-------------------------------------------------------------------- - // Updates - //-------------------------------------------------------------------- -public: - void requestUpdate(); - BOOL requestUpdateImmediate(); -protected: - BOOL isReadyToUpdate() const; - void doUpdate(); - void restartUpdateTimer(); -private: - BOOL mNeedsUpdate; // Whether we need to locally update our baked textures - U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures - LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed. -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerStaticImageList -// -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerStaticImageList : public LLSingleton -{ -public: - LLTexLayerStaticImageList(); - ~LLTexLayerStaticImageList(); - LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask); - LLImageTGA* getImageTGA(const std::string& file_name); - void deleteCachedImages(); - void dumpByteCount() const; -protected: - BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw); -private: - LLStringTable mImageNames; - typedef std::map > texture_map_t; - texture_map_t mStaticImageList; - typedef std::map > image_tga_map_t; - image_tga_map_t mStaticImageListTGA; - S32 mGLBytes; - S32 mTGABytes; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLBakedUploadData -// -// Used by LLTexLayerSetBuffer for a callback. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -struct LLBakedUploadData -{ - LLBakedUploadData(const LLVOAvatarSelf* avatar, - LLTexLayerSet* layerset, - const LLUUID& id, - bool highest_res); - ~LLBakedUploadData() {} - const LLUUID mID; - const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer - LLTexLayerSet* mTexLayerSet; - const U64 mStartTime; // for measuring baked texture upload time - const bool mIsHighestRes; // whether this is a "final" bake, or intermediate low res -}; - -#endif // LL_LLTEXLAYER_H diff --git a/indra/newview/lltexlayerparams.cpp b/indra/newview/lltexlayerparams.cpp deleted file mode 100644 index 8972827eff..0000000000 --- a/indra/newview/lltexlayerparams.cpp +++ /dev/null @@ -1,568 +0,0 @@ -/** - * @file lltexlayerparams.cpp - * @brief Texture layer parameters - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "lltexlayerparams.h" - -#include "llagentcamera.h" -#include "llimagetga.h" -#include "lltexlayer.h" -#include "llvoavatarself.h" -#include "llwearable.h" -#include "llui.h" - -//----------------------------------------------------------------------------- -// LLTexLayerParam -//----------------------------------------------------------------------------- -LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) : - mTexLayer(layer), - mAvatar(NULL) -{ - if (mTexLayer != NULL) - { - mAvatar = mTexLayer->getTexLayerSet()->getAvatar(); - } - else - { - llerrs << "LLTexLayerParam constructor passed with NULL reference for layer!" << llendl; - } -} - -LLTexLayerParam::LLTexLayerParam(LLVOAvatar *avatar) : - mTexLayer(NULL) -{ - mAvatar = avatar; -} - - -BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar ) -{ - LLViewerVisualParam::setInfo(info); - - if (add_to_avatar) - { - mAvatar->addVisualParam( this); - } - - return TRUE; -} - - -//----------------------------------------------------------------------------- -// LLTexLayerParamAlpha -//----------------------------------------------------------------------------- - -// static -LLTexLayerParamAlpha::param_alpha_ptr_list_t LLTexLayerParamAlpha::sInstances; - -// static -void LLTexLayerParamAlpha::dumpCacheByteCount() -{ - S32 gl_bytes = 0; - getCacheByteCount( &gl_bytes); - llinfos << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << llendl; -} - -// static -void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes) -{ - *gl_bytes = 0; - - for (param_alpha_ptr_list_t::iterator iter = sInstances.begin(); - iter != sInstances.end(); iter++) - { - LLTexLayerParamAlpha* instance = *iter; - LLViewerTexture* tex = instance->mCachedProcessedTexture; - if (tex) - { - S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents(); - - if (tex->hasGLTexture()) - { - *gl_bytes += bytes; - } - } - } -} - -LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) : - LLTexLayerParam(layer), - mCachedProcessedTexture(NULL), - mNeedsCreateTexture(FALSE), - mStaticImageInvalid(FALSE), - mAvgDistortionVec(1.f, 1.f, 1.f), - mCachedEffectiveWeight(0.f) -{ - sInstances.push_front(this); -} - -LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLVOAvatar* avatar) : - LLTexLayerParam(avatar), - mCachedProcessedTexture(NULL), - mNeedsCreateTexture(FALSE), - mStaticImageInvalid(FALSE), - mAvgDistortionVec(1.f, 1.f, 1.f), - mCachedEffectiveWeight(0.f) -{ - sInstances.push_front(this); -} - - -LLTexLayerParamAlpha::~LLTexLayerParamAlpha() -{ - deleteCaches(); - sInstances.remove(this); -} - -/*virtual*/ LLViewerVisualParam* LLTexLayerParamAlpha::cloneParam(LLWearable* wearable) const -{ - LLTexLayerParamAlpha *new_param = new LLTexLayerParamAlpha(mTexLayer); - *new_param = *this; - return new_param; -} - -void LLTexLayerParamAlpha::deleteCaches() -{ - mStaticImageTGA = NULL; // deletes image - mCachedProcessedTexture = NULL; - mStaticImageRaw = NULL; - mNeedsCreateTexture = FALSE; -} - -BOOL LLTexLayerParamAlpha::getMultiplyBlend() const -{ - return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend; -} - -void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake) -{ - if (mIsAnimating || mTexLayer == NULL) - { - return; - } - F32 min_weight = getMinWeight(); - F32 max_weight = getMaxWeight(); - F32 new_weight = llclamp(weight, min_weight, max_weight); - U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight); - U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight); - if (cur_u8 != new_u8) - { - mCurWeight = new_weight; - - if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param. - { - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) - { - upload_bake = FALSE; - } - mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake); - mTexLayer->invalidateMorphMasks(); - } - } -} - -void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL upload_bake) -{ - // do not animate dummy parameters - if (mIsDummy) - { - setWeight(target_value, upload_bake); - return; - } - - mTargetWeight = target_value; - setWeight(target_value, upload_bake); - mIsAnimating = TRUE; - if (mNext) - { - mNext->setAnimationTarget(target_value, upload_bake); - } -} - -void LLTexLayerParamAlpha::animate(F32 delta, BOOL upload_bake) -{ - if (mNext) - { - mNext->animate(delta, upload_bake); - } -} - -BOOL LLTexLayerParamAlpha::getSkip() const -{ - if (!mTexLayer) - { - return TRUE; - } - - const LLVOAvatar *avatar = mTexLayer->getTexLayerSet()->getAvatar(); - - if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight) - { - F32 effective_weight = (avatar->getSex() & getSex()) ? mCurWeight : getDefaultWeight(); - if (is_approx_zero(effective_weight)) - { - return TRUE; - } - } - - LLWearableType::EType type = (LLWearableType::EType)getWearableType(); - if ((type != LLWearableType::WT_INVALID) && !avatar->isWearingWearableType(type)) - { - return TRUE; - } - - return FALSE; -} - - -BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) -{ - BOOL success = TRUE; - - if (!mTexLayer) - { - return success; - } - - F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatar()->getSex() & getSex()) ? mCurWeight : getDefaultWeight(); - BOOL weight_changed = effective_weight != mCachedEffectiveWeight; - if (getSkip()) - { - return success; - } - - LLTexLayerParamAlphaInfo *info = (LLTexLayerParamAlphaInfo *)getInfo(); - gGL.flush(); - if (info->mMultiplyBlend) - { - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function - } - else - { - gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function - } - - if (!info->mStaticImageFileName.empty() && !mStaticImageInvalid) - { - if (mStaticImageTGA.isNull()) - { - // Don't load the image file until we actually need it the first time. Like now. - mStaticImageTGA = LLTexLayerStaticImageList::getInstance()->getImageTGA(info->mStaticImageFileName); - // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? TRUE : FALSE; - - if (mStaticImageTGA.isNull()) - { - llwarns << "Unable to load static file: " << info->mStaticImageFileName << llendl; - mStaticImageInvalid = TRUE; // don't try again. - return FALSE; - } - } - - const S32 image_tga_width = mStaticImageTGA->getWidth(); - const S32 image_tga_height = mStaticImageTGA->getHeight(); - if (!mCachedProcessedTexture || - (mCachedProcessedTexture->getWidth() != image_tga_width) || - (mCachedProcessedTexture->getHeight() != image_tga_height) || - (weight_changed)) - { -// llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl; - mCachedEffectiveWeight = effective_weight; - - if (!mCachedProcessedTexture) - { - mCachedProcessedTexture = LLViewerTextureManager::getLocalTexture(image_tga_width, image_tga_height, 1, FALSE); - - // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE; - - mCachedProcessedTexture->setExplicitFormat(GL_ALPHA8, GL_ALPHA); - } - - // Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed. - mStaticImageRaw = NULL; - mStaticImageRaw = new LLImageRaw; - mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight); - mNeedsCreateTexture = TRUE; - } - - if (mCachedProcessedTexture) - { - { - // Create the GL texture, and then hang onto it for future use. - if (mNeedsCreateTexture) - { - mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw); - mNeedsCreateTexture = FALSE; - gGL.getTexUnit(0)->bind(mCachedProcessedTexture); - mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP); - } - - LLGLSNoAlphaTest gls_no_alpha_test; - gGL.getTexUnit(0)->bind(mCachedProcessedTexture); - gl_rect_2d_simple_tex(width, height); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - stop_glerror(); - } - } - - // Don't keep the cache for other people's avatars - // (It's not really a "cache" in that case, but the logic is the same) - if (!mAvatar->isSelf()) - { - mCachedProcessedTexture = NULL; - } - } - else - { - LLGLDisable no_alpha(GL_ALPHA_TEST); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f(0.f, 0.f, 0.f, effective_weight); - gl_rect_2d_simple(width, height); - } - - return success; -} - -//----------------------------------------------------------------------------- -// LLTexLayerParamAlphaInfo -//----------------------------------------------------------------------------- -LLTexLayerParamAlphaInfo::LLTexLayerParamAlphaInfo() : - mMultiplyBlend(FALSE), - mSkipIfZeroWeight(FALSE), - mDomain(0.f) -{ -} - -BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) -{ - llassert(node->hasName("param") && node->getChildByName("param_alpha")); - - if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; - - LLXmlTreeNode* param_alpha_node = node->getChildByName("param_alpha"); - if (!param_alpha_node) - { - return FALSE; - } - - static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file"); - if (param_alpha_node->getFastAttributeString(tga_file_string, mStaticImageFileName)) - { - // Don't load the image file until it's actually needed. - } -// else -// { -// llwarns << " element is missing tga_file attribute." << llendl; -// } - - static LLStdStringHandle multiply_blend_string = LLXmlTree::addAttributeString("multiply_blend"); - param_alpha_node->getFastAttributeBOOL(multiply_blend_string, mMultiplyBlend); - - static LLStdStringHandle skip_if_zero_string = LLXmlTree::addAttributeString("skip_if_zero"); - param_alpha_node->getFastAttributeBOOL(skip_if_zero_string, mSkipIfZeroWeight); - - static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain"); - param_alpha_node->getFastAttributeF32(domain_string, mDomain); - - return TRUE; -} - - - - -LLTexLayerParamColor::LLTexLayerParamColor(LLTexLayerInterface* layer) : - LLTexLayerParam(layer), - mAvgDistortionVec(1.f, 1.f, 1.f) -{ -} - -LLTexLayerParamColor::LLTexLayerParamColor(LLVOAvatar *avatar) : - LLTexLayerParam(avatar), - mAvgDistortionVec(1.f, 1.f, 1.f) -{ -} - -LLTexLayerParamColor::~LLTexLayerParamColor() -{ -} - -/*virtual*/ LLViewerVisualParam* LLTexLayerParamColor::cloneParam(LLWearable* wearable) const -{ - LLTexLayerParamColor *new_param = new LLTexLayerParamColor(mTexLayer); - *new_param = *this; - return new_param; -} - -LLColor4 LLTexLayerParamColor::getNetColor() const -{ - const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo(); - - llassert(info->mNumColors >= 1); - - F32 effective_weight = (mAvatar && (mAvatar->getSex() & getSex())) ? mCurWeight : getDefaultWeight(); - - S32 index_last = info->mNumColors - 1; - F32 scaled_weight = effective_weight * index_last; - S32 index_start = (S32) scaled_weight; - S32 index_end = index_start + 1; - if (index_start == index_last) - { - return info->mColors[index_last]; - } - else - { - F32 weight = scaled_weight - index_start; - const LLColor4 *start = &info->mColors[ index_start ]; - const LLColor4 *end = &info->mColors[ index_end ]; - return LLColor4((1.f - weight) * start->mV[VX] + weight * end->mV[VX], - (1.f - weight) * start->mV[VY] + weight * end->mV[VY], - (1.f - weight) * start->mV[VZ] + weight * end->mV[VZ], - (1.f - weight) * start->mV[VW] + weight * end->mV[VW]); - } -} - -void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake) -{ - if (mIsAnimating) - { - return; - } - - const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo(); - F32 min_weight = getMinWeight(); - F32 max_weight = getMaxWeight(); - F32 new_weight = llclamp(weight, min_weight, max_weight); - U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight); - U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight); - if (cur_u8 != new_u8) - { - mCurWeight = new_weight; - - if (info->mNumColors <= 0) - { - // This will happen when we set the default weight the first time. - return; - } - - if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param. - { - onGlobalColorChanged(upload_bake); - if (mTexLayer) - { - mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake); - } - } - -// llinfos << "param " << mName << " = " << new_weight << llendl; - } -} - -void LLTexLayerParamColor::setAnimationTarget(F32 target_value, BOOL upload_bake) -{ - // set value first then set interpolating flag to ignore further updates - mTargetWeight = target_value; - setWeight(target_value, upload_bake); - mIsAnimating = TRUE; - if (mNext) - { - mNext->setAnimationTarget(target_value, upload_bake); - } -} - -void LLTexLayerParamColor::animate(F32 delta, BOOL upload_bake) -{ - if (mNext) - { - mNext->animate(delta, upload_bake); - } -} - -//----------------------------------------------------------------------------- -// LLTexLayerParamColorInfo -//----------------------------------------------------------------------------- -LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() : - mOperation(LLTexLayerParamColor::OP_ADD), - mNumColors(0) -{ -} - -BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) -{ - llassert(node->hasName("param") && node->getChildByName("param_color")); - - if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; - - LLXmlTreeNode* param_color_node = node->getChildByName("param_color"); - if (!param_color_node) - { - return FALSE; - } - - std::string op_string; - static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation"); - if (param_color_node->getFastAttributeString(operation_string, op_string)) - { - LLStringUtil::toLower(op_string); - if (op_string == "add") mOperation = LLTexLayerParamColor::OP_ADD; - else if (op_string == "multiply") mOperation = LLTexLayerParamColor::OP_MULTIPLY; - else if (op_string == "blend") mOperation = LLTexLayerParamColor::OP_BLEND; - } - - mNumColors = 0; - - LLColor4U color4u; - for (LLXmlTreeNode* child = param_color_node->getChildByName("value"); - child; - child = param_color_node->getNextNamedChild()) - { - if ((mNumColors < MAX_COLOR_VALUES)) - { - static LLStdStringHandle color_string = LLXmlTree::addAttributeString("color"); - if (child->getFastAttributeColor4U(color_string, color4u)) - { - mColors[ mNumColors ].setVec(color4u); - mNumColors++; - } - } - } - if (!mNumColors) - { - llwarns << " is missing sub-elements" << llendl; - return FALSE; - } - - if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1)) - { - llwarns << " with operation\"blend\" must have exactly one " << llendl; - return FALSE; - } - - return TRUE; -} diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h deleted file mode 100644 index 2c0da60b48..0000000000 --- a/indra/newview/lltexlayerparams.h +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @file lltexlayerparams.h - * @brief Texture layer parameters, used by lltexlayer. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLTEXLAYERPARAMS_H -#define LL_LLTEXLAYERPARAMS_H - -#include "llviewervisualparam.h" - -class LLImageRaw; -class LLImageTGA; -class LLTexLayer; -class LLTexLayerInterface; -class LLViewerTexture; -class LLVOAvatar; -class LLWearable; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerParam -// -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerParam : public LLViewerVisualParam -{ -public: - LLTexLayerParam(LLTexLayerInterface *layer); - LLTexLayerParam(LLVOAvatar *avatar); - /*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar ); - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0; - -protected: - LLTexLayerInterface* mTexLayer; - LLVOAvatar* mAvatar; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerParamAlpha -// -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerParamAlpha : public LLTexLayerParam -{ -public: - LLTexLayerParamAlpha( LLTexLayerInterface* layer ); - LLTexLayerParamAlpha( LLVOAvatar* avatar ); - /*virtual*/ ~LLTexLayerParamAlpha(); - - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const; - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - /*virtual*/ void apply( ESex avatar_sex ) {} - /*virtual*/ void setWeight(F32 weight, BOOL upload_bake); - /*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake); - /*virtual*/ void animate(F32 delta, BOOL upload_bake); - - // LLViewerVisualParam Virtual functions - /*virtual*/ F32 getTotalDistortion() { return 1.f; } - /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; } - /*virtual*/ F32 getMaxDistortion() { return 3.f; } - /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f);} - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; - - // New functions - BOOL render( S32 x, S32 y, S32 width, S32 height ); - BOOL getSkip() const; - void deleteCaches(); - BOOL getMultiplyBlend() const; - -private: - LLPointer mCachedProcessedTexture; - LLPointer mStaticImageTGA; - LLPointer mStaticImageRaw; - BOOL mNeedsCreateTexture; - BOOL mStaticImageInvalid; - LLVector4a mAvgDistortionVec; - F32 mCachedEffectiveWeight; - -public: - // Global list of instances for gathering statistics - static void dumpCacheByteCount(); - static void getCacheByteCount( S32* gl_bytes ); - - typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t; - static param_alpha_ptr_list_t sInstances; -}; -class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo -{ - friend class LLTexLayerParamAlpha; -public: - LLTexLayerParamAlphaInfo(); - /*virtual*/ ~LLTexLayerParamAlphaInfo() {}; - - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); - -private: - std::string mStaticImageFileName; - BOOL mMultiplyBlend; - BOOL mSkipIfZeroWeight; - F32 mDomain; -}; -// -// LLTexLayerParamAlpha -//----------------------------------------------------------------------------- - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerParamColor -// -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerParamColor : public LLTexLayerParam -{ -public: - enum EColorOperation - { - OP_ADD = 0, - OP_MULTIPLY = 1, - OP_BLEND = 2, - OP_COUNT = 3 // Number of operations - }; - - LLTexLayerParamColor( LLTexLayerInterface* layer ); - LLTexLayerParamColor( LLVOAvatar* avatar ); - /* virtual */ ~LLTexLayerParamColor(); - - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const; - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - /*virtual*/ void apply( ESex avatar_sex ) {} - /*virtual*/ void setWeight(F32 weight, BOOL upload_bake); - /*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake); - /*virtual*/ void animate(F32 delta, BOOL upload_bake); - - - // LLViewerVisualParam Virtual functions - /*virtual*/ F32 getTotalDistortion() { return 1.f; } - /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; } - /*virtual*/ F32 getMaxDistortion() { return 3.f; } - /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f); } - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; - - // New functions - LLColor4 getNetColor() const; -protected: - virtual void onGlobalColorChanged(bool upload_bake) {} -private: - LLVector4a mAvgDistortionVec; -}; - -class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo -{ - friend class LLTexLayerParamColor; - -public: - LLTexLayerParamColorInfo(); - virtual ~LLTexLayerParamColorInfo() {}; - BOOL parseXml( LLXmlTreeNode* node ); - LLTexLayerParamColor::EColorOperation getOperation() const { return mOperation; } -private: - enum { MAX_COLOR_VALUES = 20 }; - LLTexLayerParamColor::EColorOperation mOperation; - LLColor4 mColors[MAX_COLOR_VALUES]; - S32 mNumColors; -}; - -typedef std::vector param_color_list_t; -typedef std::vector param_alpha_list_t; -typedef std::vector param_color_info_list_t; -typedef std::vector param_alpha_info_list_t; - -#endif diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index c60b4155a0..4611107bc2 100755 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -40,7 +40,7 @@ #include "lltooltip.h" #include "llappviewer.h" #include "llselectmgr.h" -#include "lltexlayer.h" +#include "llviewertexlayer.h" #include "lltexturecache.h" #include "lltexturefetch.h" #include "llviewercontrol.h" @@ -423,7 +423,7 @@ void LLAvatarTexBar::draw() ++baked_iter) { const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first; - const LLTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index); + const LLViewerTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index); if (!layerset) continue; const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); if (!layerset_buffer) continue; diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h index 76e3833acb..531c0f765c 100644 --- a/indra/newview/llviewerjoint.h +++ b/indra/newview/llviewerjoint.h @@ -31,6 +31,7 @@ // Header Files //----------------------------------------------------------------------------- #include "lljoint.h" +#include "lljointpickname.h" class LLFace; class LLViewerJointMesh; @@ -103,21 +104,8 @@ public: F32 getLOD() { return mMinPixelArea; } void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; } - // Sets the OpenGL selection stack name that is pushed and popped - // with this joint state. The default value indicates that no name - // should be pushed/popped. - enum PickName - { - PN_DEFAULT = -1, - PN_0 = 0, - PN_1 = 1, - PN_2 = 2, - PN_3 = 3, - PN_4 = 4, - PN_5 = 5 - }; - void setPickName(PickName name) { mPickName = name; } - PickName getPickName() { return mPickName; } + void setPickName(LLJointPickName name) { mPickName = name; } + LLJointPickName getPickName() { return mPickName; } virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false); @@ -141,7 +129,7 @@ protected: BOOL mValid; U32 mComponents; F32 mMinPixelArea; - PickName mPickName; + LLJointPickName mPickName; BOOL mVisible; S32 mMeshID; }; diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 5d1aa870a3..79800c1df3 100755 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -42,7 +42,7 @@ #include "llface.h" #include "llgldbg.h" #include "llglheaders.h" -#include "lltexlayer.h" +#include "llviewertexlayer.h" #include "llviewercamera.h" #include "llviewercontrol.h" #include "llviewertexturelist.h" @@ -248,7 +248,7 @@ void LLViewerJointMesh::setTexture( LLViewerTexture *texture ) // LLViewerJointMesh::setLayerSet() // Sets the shape texture (takes precedence over normal texture) //-------------------------------------------------------------------- -void LLViewerJointMesh::setLayerSet( LLTexLayerSet* layer_set ) +void LLViewerJointMesh::setLayerSet( LLViewerTexLayerSet* layer_set ) { mLayerSet = layer_set; diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index dd5dae1dc1..ff6bed4f0f 100755 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -35,7 +35,7 @@ class LLDrawable; class LLFace; class LLCharacter; -class LLTexLayerSet; +class LLViewerTexLayerSet; typedef enum e_avatar_render_pass { @@ -67,7 +67,7 @@ protected: // LLColor4 mSpecular; // specular color (always white for now) F32 mShiny; // shiny value LLPointer mTexture; // ptr to a global texture - LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar + LLViewerTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar U32 mTestImageName; // handle to a temporary texture for previewing uploads LLPolyMesh* mMesh; // ptr to a global polymesh BOOL mCullBackFaces; // true by default @@ -109,7 +109,7 @@ public: void setTestTexture( U32 name ) { mTestImageName = name; } // Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture) - void setLayerSet( LLTexLayerSet* layer_set ); + void setLayerSet( LLViewerTexLayerSet* layer_set ); // Gets the poly mesh LLPolyMesh *getMesh(); diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index d6dd645e8c..e3d28f2f5c 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -229,7 +229,6 @@ extern LLGLSLShader gSplatTextureRectProgram; extern LLGLSLShader gGlowCombineFXAAProgram; extern LLGLSLShader gDebugProgram; extern LLGLSLShader gClipProgram; -extern LLGLSLShader gAlphaMaskProgram; //output tex0[tc0] + tex1[tc1] extern LLGLSLShader gTwoTextureAddProgram; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index d1c6b7ea79..f049130f3a 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -41,7 +41,6 @@ #include "lltexturefetch.h" #include "llviewerobjectlist.h" #include "llviewertexturelist.h" -#include "lltexlayer.h" #include "lltexlayerparams.h" #include "llsurface.h" #include "llvlmanager.h" @@ -55,6 +54,7 @@ #include "llviewerregion.h" #include "llvoavatar.h" #include "llvoavatarself.h" +#include "llviewertexlayer.h" #include "llviewerwindow.h" // *TODO: remove, only used for width/height #include "llworld.h" #include "llfeaturemanager.h" diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp new file mode 100644 index 0000000000..f805083aaa --- /dev/null +++ b/indra/newview/llviewertexlayer.cpp @@ -0,0 +1,791 @@ +/** + * @file llviewertexlayer.cpp + * @brief Viewer texture layer. Used for avatars. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llagent.h" +#include "llassetuploadresponders.h" +#include "llavatarappearance.h" +#include "llglslshader.h" +#include "llimagej2c.h" +#include "llnotificationsutil.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" +#include "llviewertexlayer.h" +#include "llvfile.h" +#include "llvfs.h" +#include "llvoavatarself.h" +#include "pipeline.h" + +static const S32 BAKE_UPLOAD_ATTEMPTS = 7; +static const F32 BAKE_UPLOAD_RETRY_DELAY = 2.f; // actual delay grows by power of 2 each attempt + +// runway consolidate +extern std::string self_av_string(); + +LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) : + LLTexLayerSet(appearance), + mComposite( NULL ), + mUpdatesEnabled( FALSE ) +{ +} + +// virtual +LLViewerTexLayerSet::~LLViewerTexLayerSet() +{ +} + +void LLViewerTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) +{ + memset(data, 255, width * height); + + for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + { + LLTexLayerInterface* layer = *iter; + layer->gatherAlphaMasks(data, mComposite->getOriginX(),mComposite->getOriginY(), width, height); + } + + // Set alpha back to that of our alpha masks. + renderAlphaMaskTextures(mComposite->getOriginX(), mComposite->getOriginY(), width, height, true); +} + +LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() +{ + if (!mComposite) + { + createComposite(); + } + return mComposite; +} + +const LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() const +{ + return mComposite; +} + +// virtual +void LLViewerTexLayerSet::requestUpdate() +{ + if( mUpdatesEnabled ) + { + createComposite(); + mComposite->requestUpdate(); + } +} + +void LLViewerTexLayerSet::requestUpload() +{ + createComposite(); + mComposite->requestUpload(); +} + +void LLViewerTexLayerSet::cancelUpload() +{ + if(mComposite) + { + mComposite->cancelUpload(); + } +} + + +void LLViewerTexLayerSet::createComposite() +{ + if(!mComposite) + { + S32 width = mInfo->getWidth(); + S32 height = mInfo->getHeight(); + // Composite other avatars at reduced resolution + if( !mAvatarAppearance->isSelf() ) + { + llerrs << "composites should not be created for non-self avatars!" << llendl; + } + mComposite = new LLTexLayerSetBuffer( this, width, height ); + } +} + +void LLViewerTexLayerSet::updateComposite() +{ + createComposite(); + mComposite->requestUpdateImmediate(); +} + +// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on. +BOOL LLViewerTexLayerSet::isLocalTextureDataAvailable() const +{ + if (!mAvatarAppearance->isSelf()) return FALSE; + LLVOAvatarSelf* self = dynamic_cast(mAvatarAppearance); + return self->isLocalTextureDataAvailable(this); +} + + +// Returns TRUE if all of the data for the textures that this layerset depends on have arrived. +BOOL LLViewerTexLayerSet::isLocalTextureDataFinal() const +{ + if (!mAvatarAppearance->isSelf()) return FALSE; + LLVOAvatarSelf* self = dynamic_cast(mAvatarAppearance); + return self->isLocalTextureDataFinal(this); +} + +void LLViewerTexLayerSet::destroyComposite() +{ + if( mComposite ) + { + mComposite = NULL; + } +} + +void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b ) +{ + mUpdatesEnabled = b; +} + +LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const +{ + return dynamic_cast (mAvatarAppearance); +} + +//----------------------------------------------------------------------------- +// LLBakedUploadData() +//----------------------------------------------------------------------------- +LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar, + LLViewerTexLayerSet* layerset, + const LLUUID& id, + bool highest_res) : + mAvatar(avatar), + mTexLayerSet(layerset), + mID(id), + mStartTime(LLFrameTimer::getTotalTime()), // Record starting time + mIsHighestRes(highest_res) +{ +} + +//----------------------------------------------------------------------------- +// LLTexLayerSetBuffer +// The composite image that a LLViewerTexLayerSet writes to. Each LLViewerTexLayerSet has one. +//----------------------------------------------------------------------------- + +// static +S32 LLTexLayerSetBuffer::sGLByteCount = 0; + +LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLViewerTexLayerSet* const owner, + S32 width, S32 height) : + // ORDER_LAST => must render these after the hints are created. + LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, TRUE ), + mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates + mNeedsUpload(FALSE), + mNumLowresUploads(0), + mUploadFailCount(0), + mNeedsUpdate(TRUE), + mNumLowresUpdates(0), + mTexLayerSet(owner) +{ + LLTexLayerSetBuffer::sGLByteCount += getSize(); + mNeedsUploadTimer.start(); + mNeedsUpdateTimer.start(); +} + +LLTexLayerSetBuffer::~LLTexLayerSetBuffer() +{ + LLTexLayerSetBuffer::sGLByteCount -= getSize(); + destroyGLTexture(); + for( S32 order = 0; order < ORDER_COUNT; order++ ) + { + LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case. + } +} + +//virtual +S8 LLTexLayerSetBuffer::getType() const +{ + return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ; +} + +//virtual +void LLTexLayerSetBuffer::restoreGLTexture() +{ + LLViewerDynamicTexture::restoreGLTexture() ; +} + +//virtual +void LLTexLayerSetBuffer::destroyGLTexture() +{ + LLViewerDynamicTexture::destroyGLTexture() ; +} + +// static +void LLTexLayerSetBuffer::dumpTotalByteCount() +{ + llinfos << "Composite System GL Buffers: " << (LLTexLayerSetBuffer::sGLByteCount/1024) << "KB" << llendl; +} + +void LLTexLayerSetBuffer::requestUpdate() +{ + restartUpdateTimer(); + mNeedsUpdate = TRUE; + mNumLowresUpdates = 0; + // If we're in the middle of uploading a baked texture, we don't care about it any more. + // When it's downloaded, ignore it. + mUploadID.setNull(); +} + +void LLTexLayerSetBuffer::requestUpload() +{ + conditionalRestartUploadTimer(); + mNeedsUpload = TRUE; + mNumLowresUploads = 0; + mUploadPending = TRUE; +} + +void LLTexLayerSetBuffer::conditionalRestartUploadTimer() +{ + // If we requested a new upload but haven't even uploaded + // a low res version of our last upload request, then + // keep the timer ticking instead of resetting it. + if (mNeedsUpload && (mNumLowresUploads == 0)) + { + mNeedsUploadTimer.unpause(); + } + else + { + mNeedsUploadTimer.reset(); + mNeedsUploadTimer.start(); + } +} + +void LLTexLayerSetBuffer::restartUpdateTimer() +{ + mNeedsUpdateTimer.reset(); + mNeedsUpdateTimer.start(); +} + +void LLTexLayerSetBuffer::cancelUpload() +{ + mNeedsUpload = FALSE; + mUploadPending = FALSE; + mNeedsUploadTimer.pause(); + mUploadRetryTimer.reset(); +} + +void LLTexLayerSetBuffer::pushProjection() const +{ + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.loadIdentity(); +} + +void LLTexLayerSetBuffer::popProjection() const +{ + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); +} + +// virtual +BOOL LLTexLayerSetBuffer::needsRender() +{ + llassert(mTexLayerSet->getAvatarAppearance() == gAgentAvatarp); + if (!isAgentAvatarValid()) return FALSE; + + const BOOL upload_now = mNeedsUpload && isReadyToUpload(); + const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); + + // Don't render if we don't want to (or aren't ready to) upload or update. + if (!(update_now || upload_now)) + { + return FALSE; + } + + // Don't render if we're animating our appearance. + if (gAgentAvatarp->getIsAppearanceAnimating()) + { + return FALSE; + } + + // Don't render if we are trying to create a shirt texture but aren't wearing a skirt. + if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && + !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT)) + { + cancelUpload(); + return FALSE; + } + + // Render if we have at least minimal level of detail for each local texture. + return mTexLayerSet->isLocalTextureDataAvailable(); +} + +void LLTexLayerSetBuffer::preRender(BOOL clear_depth) +{ + // Set up an ortho projection + pushProjection(); + + // keep depth buffer, we don't need to clear it + LLViewerDynamicTexture::preRender(FALSE); +} + +void LLTexLayerSetBuffer::postRender(BOOL success) +{ + popProjection(); + + LLViewerDynamicTexture::postRender(success); +} + +BOOL LLTexLayerSetBuffer::render() +{ + // Default color mask for tex layer render + gGL.setColorMask(true, true); + + // do we need to upload, and do we have sufficient data to create an uploadable composite? + // TODO: When do we upload the texture if gAgent.mNumPendingQueries is non-zero? + const BOOL upload_now = mNeedsUpload && isReadyToUpload(); + const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); + + BOOL success = TRUE; + + bool use_shaders = LLGLSLShader::sNoFixedFunction; + + if (use_shaders) + { + gAlphaMaskProgram.bind(); + gAlphaMaskProgram.setMinimumAlpha(0.004f); + } + + LLVertexBuffer::unbind(); + + // Composite the color data + LLGLSUIDefault gls_ui; + success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight ); + gGL.flush(); + + if(upload_now) + { + if (!success) + { + llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << llendl; + mUploadPending = FALSE; + } + else + { + if (mTexLayerSet->isVisible()) + { + mTexLayerSet->getAvatar()->debugBakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish. + doUpload(); + } + else + { + mUploadPending = FALSE; + mNeedsUpload = FALSE; + mNeedsUploadTimer.pause(); + mTexLayerSet->getAvatar()->setNewBakedTexture(mTexLayerSet->getBakedTexIndex(),IMG_INVISIBLE); + } + } + } + + if (update_now) + { + doUpdate(); + } + + if (use_shaders) + { + gAlphaMaskProgram.unbind(); + } + + LLVertexBuffer::unbind(); + + // reset GL state + gGL.setColorMask(true, true); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + + // we have valid texture data now + mGLTexturep->setGLTextureCreated(true); + + return success; +} + +BOOL LLTexLayerSetBuffer::isInitialized(void) const +{ + return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated(); +} + +BOOL LLTexLayerSetBuffer::uploadPending() const +{ + return mUploadPending; +} + +BOOL LLTexLayerSetBuffer::uploadNeeded() const +{ + return mNeedsUpload; +} + +BOOL LLTexLayerSetBuffer::uploadInProgress() const +{ + return !mUploadID.isNull(); +} + +BOOL LLTexLayerSetBuffer::isReadyToUpload() const +{ + if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries. + if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites. + + BOOL ready = FALSE; + if (mTexLayerSet->isLocalTextureDataFinal()) + { + // If we requested an upload and have the final LOD ready, upload (or wait a while if this is a retry) + if (mUploadFailCount == 0) + { + ready = TRUE; + } + else + { + ready = mUploadRetryTimer.getElapsedTimeF32() >= BAKE_UPLOAD_RETRY_DELAY * (1 << (mUploadFailCount - 1)); + } + } + else + { + // Upload if we've hit a timeout. Upload is a pretty expensive process so we need to make sure + // we aren't doing uploads too frequently. + const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout"); + if (texture_timeout != 0) + { + // The timeout period increases exponentially between every lowres upload in order to prevent + // spamming the server with frequent uploads. + const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads); + + // If we hit our timeout and have textures available at even lower resolution, then upload. + const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; + const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); + ready = has_lower_lod && is_upload_textures_timeout; + } + } + + return ready; +} + +BOOL LLTexLayerSetBuffer::isReadyToUpdate() const +{ + // If we requested an update and have the final LOD ready, then update. + if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE; + + // If we haven't done an update yet, then just do one now regardless of state of textures. + if (mNumLowresUpdates == 0) return TRUE; + + // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small + // since render unnecessarily doesn't cost much. + const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout"); + if (texture_timeout != 0) + { + // If we hit our timeout and have textures available at even lower resolution, then update. + const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout; + const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); + if (has_lower_lod && is_update_textures_timeout) return TRUE; + } + + return FALSE; +} + +BOOL LLTexLayerSetBuffer::requestUpdateImmediate() +{ + mNeedsUpdate = TRUE; + BOOL result = FALSE; + + if (needsRender()) + { + preRender(FALSE); + result = render(); + postRender(result); + } + + return result; +} + +// Create the baked texture, send it out to the server, then wait for it to come +// back so we can switch to using it. +void LLTexLayerSetBuffer::doUpload() +{ + llinfos << "Uploading baked " << mTexLayerSet->getBodyRegionName() << llendl; + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES); + + // Don't need caches since we're baked now. (note: we won't *really* be baked + // until this image is sent to the server and the Avatar Appearance message is received.) + mTexLayerSet->deleteCaches(); + + // Get the COLOR information from our texture + U8* baked_color_data = new U8[ mFullWidth * mFullHeight * 4 ]; + glReadPixels(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, GL_RGBA, GL_UNSIGNED_BYTE, baked_color_data ); + stop_glerror(); + + // Get the MASK information from our texture + LLGLSUIDefault gls_ui; + LLPointer baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 ); + U8* baked_mask_data = baked_mask_image->getData(); + mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight); + + + // Create the baked image from our color and mask information + const S32 baked_image_components = 5; // red green blue [bump] clothing + LLPointer baked_image = new LLImageRaw( mFullWidth, mFullHeight, baked_image_components ); + U8* baked_image_data = baked_image->getData(); + S32 i = 0; + for (S32 u=0; u < mFullWidth; u++) + { + for (S32 v=0; v < mFullHeight; v++) + { + baked_image_data[5*i + 0] = baked_color_data[4*i + 0]; + baked_image_data[5*i + 1] = baked_color_data[4*i + 1]; + baked_image_data[5*i + 2] = baked_color_data[4*i + 2]; + baked_image_data[5*i + 3] = baked_color_data[4*i + 3]; // alpha should be correct for eyelashes. + baked_image_data[5*i + 4] = baked_mask_data[i]; + i++; + } + } + + LLPointer compressedImage = new LLImageJ2C; + const char* comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // writes into baked_color_data. 5 channels (rgb, heightfield/alpha, mask) + if (compressedImage->encode(baked_image, comment_text)) + { + LLTransactionID tid; + tid.generate(); + const LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + if (LLVFile::writeFile(compressedImage->getData(), compressedImage->getDataSize(), + gVFS, asset_id, LLAssetType::AT_TEXTURE)) + { + // Read back the file and validate. + BOOL valid = FALSE; + LLPointer integrity_test = new LLImageJ2C; + S32 file_size = 0; + U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size); + if (data) + { + valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data' + } + else + { + integrity_test->setLastError("Unable to read entire file"); + } + + if (valid) + { + const bool highest_lod = mTexLayerSet->isLocalTextureDataFinal(); + // Baked_upload_data is owned by the responder and deleted after the request completes. + LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp, + this->mTexLayerSet, + asset_id, + highest_lod); + // upload ID is used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit. + mUploadID = asset_id; + + // Upload the image + const std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture"); + if(!url.empty() + && !LLPipeline::sForceOldBakedUpload // toggle debug setting UploadBakedTexOld to change between the new caps method and old method + && (mUploadFailCount < (BAKE_UPLOAD_ATTEMPTS - 1))) // Try last ditch attempt via asset store if cap upload is failing. + { + LLSD body = LLSD::emptyMap(); + // The responder will call LLTexLayerSetBuffer::onTextureUploadComplete() + LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data)); + llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl; + } + else + { + gAssetStorage->storeAssetData(tid, + LLAssetType::AT_TEXTURE, + LLTexLayerSetBuffer::onTextureUploadComplete, + baked_upload_data, + TRUE, // temp_file + TRUE, // is_priority + TRUE); // store_local + llinfos << "Baked texture upload via Asset Store." << llendl; + } + + if (highest_lod) + { + // Sending the final LOD for the baked texture. All done, pause + // the upload timer so we know how long it took. + mNeedsUpload = FALSE; + mNeedsUploadTimer.pause(); + } + else + { + // Sending a lower level LOD for the baked texture. Restart the upload timer. + mNumLowresUploads++; + mNeedsUploadTimer.unpause(); + mNeedsUploadTimer.reset(); + } + + // Print out notification that we uploaded this texture. + if (gSavedSettings.getBOOL("DebugAvatarRezTime")) + { + const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; + LLSD args; + args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32()); + args["TIME"] = llformat("%d",(U32)mNeedsUploadTimer.getElapsedTimeF32()); + args["BODYREGION"] = mTexLayerSet->getBodyRegionName(); + args["RESOLUTION"] = lod_str; + LLNotificationsUtil::add("AvatarRezSelfBakedTextureUploadNotification",args); + LL_DEBUGS("Avatar") << self_av_string() << "Uploading [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << LL_ENDL; + } + } + else + { + // The read back and validate operation failed. Remove the uploaded file. + mUploadPending = FALSE; + LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE, LLVFile::WRITE); + file.remove(); + llinfos << "Unable to create baked upload file (reason: corrupted)." << llendl; + } + } + } + else + { + // The VFS write file operation failed. + mUploadPending = FALSE; + llinfos << "Unable to create baked upload file (reason: failed to write file)" << llendl; + } + + delete [] baked_color_data; +} + +// Mostly bookkeeping; don't need to actually "do" anything since +// render() will actually do the update. +void LLTexLayerSetBuffer::doUpdate() +{ + const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); + if (highest_lod) + { + mNeedsUpdate = FALSE; + } + else + { + mNumLowresUpdates++; + } + + restartUpdateTimer(); + + // need to switch to using this layerset if this is the first update + // after getting the lowest LOD + mTexLayerSet->getAvatarAppearance()->updateMeshTextures(); + + // Print out notification that we updated this texture. + if (gSavedSettings.getBOOL("DebugAvatarRezTime")) + { + const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); + const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; + LLSD args; + args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatarAppearance()->debugGetExistenceTimeElapsedF32()); + args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32()); + args["BODYREGION"] = mTexLayerSet->getBodyRegionName(); + args["RESOLUTION"] = lod_str; + LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args); + LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL; + } +} + +// static +void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, + void* userdata, + S32 result, + LLExtStat ext_status) // StoreAssetData callback (not fixed) +{ + LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata; + + if (isAgentAvatarValid() && + !gAgentAvatarp->isDead() && + (baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures. + (baked_upload_data->mTexLayerSet->hasComposite())) + { + LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite(); + S32 failures = layerset_buffer->mUploadFailCount; + layerset_buffer->mUploadFailCount = 0; + + if (layerset_buffer->mUploadID.isNull()) + { + // The upload got canceled, we should be in the + // process of baking a new texture so request an + // upload with the new data + + // BAP: does this really belong in this callback, as + // opposed to where the cancellation takes place? + // suspect this does nothing. + layerset_buffer->requestUpload(); + } + else if (baked_upload_data->mID == layerset_buffer->mUploadID) + { + // This is the upload we're currently waiting for. + layerset_buffer->mUploadID.setNull(); + const std::string name(baked_upload_data->mTexLayerSet->getBodyRegionName()); + const std::string resolution = baked_upload_data->mIsHighestRes ? " full res " : " low res "; + if (result >= 0) + { + layerset_buffer->mUploadPending = FALSE; // Allows sending of AgentSetAppearance later + LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet); + // Update baked texture info with the new UUID + U64 now = LLFrameTimer::getTotalTime(); // Record starting time + llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; + gAgentAvatarp->setNewBakedTexture(baked_te, uuid); + } + else + { + ++failures; + S32 max_attempts = baked_upload_data->mIsHighestRes ? BAKE_UPLOAD_ATTEMPTS : 1; // only retry final bakes + llwarns << "Baked" << resolution << "texture upload for " << name << " failed (attempt " << failures << "/" << max_attempts << ")" << llendl; + if (failures < max_attempts) + { + layerset_buffer->mUploadFailCount = failures; + layerset_buffer->mUploadRetryTimer.start(); + layerset_buffer->requestUpload(); + } + } + } + else + { + llinfos << "Received baked texture out of date, ignored." << llendl; + } + + gAgentAvatarp->dirtyMesh(); + } + else + { + // Baked texture failed to upload (in which case since we + // didn't set the new baked texture, it means that they'll try + // and rebake it at some point in the future (after login?)), + // or this response to upload is out of date, in which case a + // current response should be on the way or already processed. + llwarns << "Baked upload failed" << llendl; + } + + delete baked_upload_data; +} + + + + diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h new file mode 100644 index 0000000000..ff3def5a82 --- /dev/null +++ b/indra/newview/llviewertexlayer.h @@ -0,0 +1,172 @@ +/** + * @file llviewertexlayer.h + * @brief Viewer Texture layer classes. Used for avatars. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_VIEWER_TEXLAYER_H +#define LL_VIEWER_TEXLAYER_H + +#include "lldynamictexture.h" +#include "lltexlayer.h" + +class LLTexLayerSetBuffer; +class LLVOAvatarSelf; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// LLViewerTexLayerSet +// +// An ordered set of texture layers that gets composited into a single texture. +// Only exists for llavatarappearanceself. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLViewerTexLayerSet : public LLTexLayerSet +{ + friend class LLTexLayerSetBuffer; +public: + LLViewerTexLayerSet(LLAvatarAppearance* const appearance); + virtual ~LLViewerTexLayerSet(); + + LLTexLayerSetBuffer* getComposite(); + const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist. + virtual void requestUpdate(); + void requestUpload(); + void cancelUpload(); + void updateComposite(); + BOOL isLocalTextureDataAvailable() const; + BOOL isLocalTextureDataFinal() const; + void createComposite(); + void destroyComposite(); + void setUpdatesEnabled(BOOL b); + BOOL getUpdatesEnabled() const { return mUpdatesEnabled; } + void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height); + + LLVOAvatarSelf* getAvatar() const; + BOOL hasComposite() const { return (mComposite.notNull()); } + +private: + LLPointer mComposite; + BOOL mUpdatesEnabled; + +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// LLTexLayerSetBuffer +// +// The composite image that a LLViewerTexLayerSet writes to. Each LLTexLayerSet has one. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLTexLayerSetBuffer : public LLViewerDynamicTexture +{ + LOG_CLASS(LLTexLayerSetBuffer); + +public: + LLTexLayerSetBuffer(LLViewerTexLayerSet* const owner, S32 width, S32 height); + virtual ~LLTexLayerSetBuffer(); + +public: + /*virtual*/ S8 getType() const; + BOOL isInitialized(void) const; + static void dumpTotalByteCount(); + const std::string dumpTextureInfo() const; + virtual void restoreGLTexture(); + virtual void destroyGLTexture(); +protected: + void pushProjection() const; + void popProjection() const; +private: + LLViewerTexLayerSet* const mTexLayerSet; + static S32 sGLByteCount; + + //-------------------------------------------------------------------- + // Render + //-------------------------------------------------------------------- +public: + /*virtual*/ BOOL needsRender(); +protected: + BOOL render(S32 x, S32 y, S32 width, S32 height); + virtual void preRender(BOOL clear_depth); + virtual void postRender(BOOL success); + virtual BOOL render(); + + //-------------------------------------------------------------------- + // Uploads + //-------------------------------------------------------------------- +public: + void requestUpload(); + void cancelUpload(); + BOOL uploadNeeded() const; // We need to upload a new texture + BOOL uploadInProgress() const; // We have started uploading a new texture and are awaiting the result + BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point + static void onTextureUploadComplete(const LLUUID& uuid, + void* userdata, + S32 result, LLExtStat ext_status); +protected: + BOOL isReadyToUpload() const; + void doUpload(); // Does a read back and upload. + void conditionalRestartUploadTimer(); +private: + BOOL mNeedsUpload; // Whether we need to send our baked textures to the server + U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server + BOOL mUploadPending; // Whether we have received back the new baked textures + LLUUID mUploadID; // The current upload process (null if none). + LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested and performed. + S32 mUploadFailCount; // Number of consecutive upload failures + LLFrameTimer mUploadRetryTimer; // Tracks time since last upload failure. + + //-------------------------------------------------------------------- + // Updates + //-------------------------------------------------------------------- +public: + void requestUpdate(); + BOOL requestUpdateImmediate(); +protected: + BOOL isReadyToUpdate() const; + void doUpdate(); + void restartUpdateTimer(); +private: + BOOL mNeedsUpdate; // Whether we need to locally update our baked textures + U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures + LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed. +}; + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// LLBakedUploadData +// +// Used by LLTexLayerSetBuffer for a callback. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +struct LLBakedUploadData +{ + LLBakedUploadData(const LLVOAvatarSelf* avatar, + LLViewerTexLayerSet* layerset, + const LLUUID& id, + bool highest_res); + ~LLBakedUploadData() {} + const LLUUID mID; + const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer + LLViewerTexLayerSet* mTexLayerSet; + const U64 mStartTime; // for measuring baked texture upload time + const bool mIsHighestRes; // whether this is a "final" bake, or intermediate low res +}; + +#endif // LL_VIEWER_TEXLAYER_H + diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 8eb8717de2..c362269b81 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -59,6 +59,7 @@ #include "lltextureatlas.h" #include "lltextureatlasmanager.h" #include "lltextureentry.h" +#include "lltexturemanagerbridge.h" #include "llmediaentry.h" #include "llvovolume.h" #include "llviewermedia.h" @@ -305,6 +306,26 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const return gTextureList.getImageFromHost(image_id, host) ; } +// Create a bridge to the viewer texture manager. +class LLViewerTextureManagerBridge : public LLTextureManagerBridge +{ + /*virtual*/ LLPointer getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) + { + return LLViewerTextureManager::getLocalTexture(usemipmaps, generate_gl_tex); + } + + /*virtual*/ LLPointer getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) + { + return LLViewerTextureManager::getLocalTexture(width, height, components, usemipmaps, generate_gl_tex); + } + + /*virtual*/ LLTexture* getFetchedTexture(const LLUUID &image_id) + { + return LLViewerTextureManager::getFetchedTexture(image_id); + } +}; + + void LLViewerTextureManager::init() { { @@ -374,6 +395,9 @@ void LLViewerTextureManager::init() LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE); LLViewerTexture::initClass() ; + + // Create a texture manager bridge. + gTextureManagerBridgep = new LLViewerTextureManagerBridge(); if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName)) { @@ -390,6 +414,7 @@ void LLViewerTextureManager::cleanup() { stop_glerror(); + delete gTextureManagerBridgep; LLImageGL::sDefaultGLTexture = NULL ; LLViewerTexture::sNullImagep = NULL; LLViewerTexture::sBlackImagep = NULL; diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 2ea9a07e9a..4b92a2bf8a 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -107,39 +107,6 @@ public: INVALID_TEXTURE_TYPE }; - enum EBoostLevel - { - BOOST_NONE = 0, - BOOST_AVATAR_BAKED , - BOOST_AVATAR , - BOOST_CLOUDS , - BOOST_SCULPTED , - - BOOST_HIGH = 10, - BOOST_BUMP , - BOOST_TERRAIN , // has to be high priority for minimap / low detail - BOOST_SELECTED , - BOOST_AVATAR_BAKED_SELF , - BOOST_AVATAR_SELF , // needed for baking avatar - BOOST_SUPER_HIGH , //textures higher than this need to be downloaded at the required resolution without delay. - BOOST_HUD , - BOOST_ICON , - BOOST_UI , - BOOST_PREVIEW , - BOOST_MAP , - BOOST_MAP_VISIBLE , - BOOST_MAX_LEVEL, - - //other texture Categories - LOCAL = BOOST_MAX_LEVEL, - AVATAR_SCRATCH_TEX, - DYNAMIC_TEX, - MEDIA, - ATLAS, - OTHER, - MAX_GL_IMAGE_CATEGORY - }; - static S32 getTotalNumOfCategories() ; static S32 getIndexFromCategory(S32 category) ; static S32 getCategoryFromIndex(S32 index) ; @@ -168,7 +135,7 @@ public: /*virtual*/ bool bindDefaultImage(const S32 stage = 0) ; /*virtual*/ void forceImmediateUpdate() ; - const LLUUID& getID() const { return mID; } + /*virtual*/ const LLUUID& getID() const { return mID; } void setBoostLevel(S32 level); S32 getBoostLevel() { return mBoostLevel; } @@ -205,24 +172,24 @@ public: /*virtual*/S32 getWidth(S32 discard_level = -1) const; /*virtual*/S32 getHeight(S32 discard_level = -1) const; - BOOL hasGLTexture() const ; + /*virtual*/BOOL hasGLTexture() const ; LLGLuint getTexName() const ; BOOL createGLTexture() ; - BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLViewerTexture::OTHER); + /*virtual*/ BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLTexture::OTHER); virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ; void setFilteringOption(LLTexUnit::eTextureFilterOptions option); - void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); - void setAddressMode(LLTexUnit::eTextureAddressMode mode); + /*virtual*/ void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); + /*virtual*/ void setAddressMode(LLTexUnit::eTextureAddressMode mode); BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height); BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height); void setGLTextureCreated (bool initialized); void setCategory(S32 category) ; - LLTexUnit::eTextureAddressMode getAddressMode(void) const ; + /*virtual*/ LLTexUnit::eTextureAddressMode getAddressMode(void) const ; S32 getMaxDiscardLevel() const; S32 getDiscardLevel() const; - S8 getComponents() const ; + /*virtual*/ S8 getComponents() const; BOOL getBoundRecently() const; S32 getTextureMemory() const ; LLGLenum getPrimaryFormat() const; @@ -761,6 +728,7 @@ public: static void init() ; static void cleanup() ; }; + // //this class is used for test/debug only //it tracks the activities of the texture pipeline diff --git a/indra/newview/llviewervisualparam.cpp b/indra/newview/llviewervisualparam.cpp deleted file mode 100644 index f0cf9b7692..0000000000 --- a/indra/newview/llviewervisualparam.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/** - * @file llviewervisualparam.cpp - * @brief Implementation of LLViewerVisualParam class - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" - -#include "llviewervisualparam.h" -#include "llxmltree.h" -#include "llui.h" -#include "llwearable.h" - -//----------------------------------------------------------------------------- -// LLViewerVisualParamInfo() -//----------------------------------------------------------------------------- -LLViewerVisualParamInfo::LLViewerVisualParamInfo() - : - mWearableType( LLWearableType::WT_INVALID ), - mCrossWearable(FALSE), - mCamDist( 0.5f ), - mCamAngle( 0.f ), - mCamElevation( 0.f ), - mEditGroupDisplayOrder( 0 ), - mShowSimple(FALSE), - mSimpleMin(0.f), - mSimpleMax(100.f) -{ -} - -LLViewerVisualParamInfo::~LLViewerVisualParamInfo() -{ -} - -//----------------------------------------------------------------------------- -// parseXml() -//----------------------------------------------------------------------------- -BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) -{ - llassert( node->hasName( "param" ) ); - - if (!LLVisualParamInfo::parseXml(node)) - return FALSE; - - // VIEWER SPECIFIC PARAMS - - std::string wearable; - static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable"); - if( node->getFastAttributeString( wearable_string, wearable) ) - { - mWearableType = LLWearableType::typeNameToType( wearable ); - } - - static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group"); - if (!node->getFastAttributeString( edit_group_string, mEditGroup)) - { - mEditGroup = ""; - } - - static LLStdStringHandle cross_wearable_string = LLXmlTree::addAttributeString("cross_wearable"); - if (!node->getFastAttributeBOOL(cross_wearable_string, mCrossWearable)) - { - mCrossWearable = FALSE; - } - - // Optional camera offsets from the current joint center. Used for generating "hints" (thumbnails). - static LLStdStringHandle camera_distance_string = LLXmlTree::addAttributeString("camera_distance"); - node->getFastAttributeF32( camera_distance_string, mCamDist ); - static LLStdStringHandle camera_angle_string = LLXmlTree::addAttributeString("camera_angle"); - node->getFastAttributeF32( camera_angle_string, mCamAngle ); // in degrees - static LLStdStringHandle camera_elevation_string = LLXmlTree::addAttributeString("camera_elevation"); - node->getFastAttributeF32( camera_elevation_string, mCamElevation ); - - mCamAngle += 180; - - static S32 params_loaded = 0; - - // By default, parameters are displayed in the order in which they appear in the xml file. - // "edit_group_order" overriddes. - static LLStdStringHandle edit_group_order_string = LLXmlTree::addAttributeString("edit_group_order"); - if( !node->getFastAttributeF32( edit_group_order_string, mEditGroupDisplayOrder ) ) - { - mEditGroupDisplayOrder = (F32)params_loaded; - } - - params_loaded++; - - return TRUE; -} - -/*virtual*/ void LLViewerVisualParamInfo::toStream(std::ostream &out) -{ - LLVisualParamInfo::toStream(out); - - out << mWearableType << "\t"; - out << mEditGroup << "\t"; - out << mEditGroupDisplayOrder << "\t"; -} - -//----------------------------------------------------------------------------- -// LLViewerVisualParam() -//----------------------------------------------------------------------------- -LLViewerVisualParam::LLViewerVisualParam() -{ -} - -//----------------------------------------------------------------------------- -// setInfo() -//----------------------------------------------------------------------------- - -BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info) -{ - llassert(mInfo == NULL); - if (info->mID < 0) - return FALSE; - mInfo = info; - mID = info->mID; - setWeight(getDefaultWeight(), FALSE ); - return TRUE; -} - -/* -//============================================================================= -// These virtual functions should always be overridden, -// but are included here for use as templates -//============================================================================= - -//----------------------------------------------------------------------------- -// parseData() -//----------------------------------------------------------------------------- -BOOL LLViewerVisualParam::parseData(LLXmlTreeNode *node) -{ - LLViewerVisualParamInfo* info = new LLViewerVisualParamInfo; - - info->parseXml(node); - if (!setInfo(info)) - return FALSE; - - return TRUE; -} -*/ diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h deleted file mode 100644 index 3bc95cbfbf..0000000000 --- a/indra/newview/llviewervisualparam.h +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @file llviewervisualparam.h - * @brief viewer side visual params (with data file parsing) - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLViewerVisualParam_H -#define LL_LLViewerVisualParam_H - -#include "v3math.h" -#include "llstring.h" -#include "llvisualparam.h" - -class LLWearable; - -//----------------------------------------------------------------------------- -// LLViewerVisualParamInfo -//----------------------------------------------------------------------------- -class LLViewerVisualParamInfo : public LLVisualParamInfo -{ - friend class LLViewerVisualParam; -public: - LLViewerVisualParamInfo(); - /*virtual*/ ~LLViewerVisualParamInfo(); - - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); - - /*virtual*/ void toStream(std::ostream &out); - -protected: - S32 mWearableType; - BOOL mCrossWearable; - std::string mEditGroup; - F32 mCamDist; - F32 mCamAngle; // degrees - F32 mCamElevation; - F32 mEditGroupDisplayOrder; - BOOL mShowSimple; // show edit controls when in "simple ui" mode? - F32 mSimpleMin; // when in simple UI, apply this minimum, range 0.f to 100.f - F32 mSimpleMax; // when in simple UI, apply this maximum, range 0.f to 100.f -}; - -//----------------------------------------------------------------------------- -// LLViewerVisualParam -// VIRTUAL CLASS -// a viewer side interface class for a generalized parametric modification of the avatar mesh -//----------------------------------------------------------------------------- -class LLViewerVisualParam : public LLVisualParam -{ -public: - LLViewerVisualParam(); - /*virtual*/ ~LLViewerVisualParam(){}; - - // Special: These functions are overridden by child classes - LLViewerVisualParamInfo *getInfo() const { return (LLViewerVisualParamInfo*)mInfo; }; - // This sets mInfo and calls initialization functions - BOOL setInfo(LLViewerVisualParamInfo *info); - - virtual LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0; - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - - // New Virtual functions - virtual F32 getTotalDistortion() = 0; - virtual const LLVector4a& getAvgDistortion() = 0; - virtual F32 getMaxDistortion() = 0; - virtual LLVector4a getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0; - virtual const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0; - virtual const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0; - - // interface methods - F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; } - S32 getWearableType() const { return getInfo()->mWearableType; } - const std::string& getEditGroup() const { return getInfo()->mEditGroup; } - - F32 getCameraDistance() const { return getInfo()->mCamDist; } - F32 getCameraAngle() const { return getInfo()->mCamAngle; } // degrees - F32 getCameraElevation() const { return getInfo()->mCamElevation; } - - BOOL getShowSimple() const { return getInfo()->mShowSimple; } - F32 getSimpleMin() const { return getInfo()->mSimpleMin; } - F32 getSimpleMax() const { return getInfo()->mSimpleMax; } - - BOOL getCrossWearable() const { return getInfo()->mCrossWearable; } - -}; - -#endif // LL_LLViewerVisualParam_H diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp new file mode 100644 index 0000000000..b63f1f57cb --- /dev/null +++ b/indra/newview/llviewerwearable.cpp @@ -0,0 +1,900 @@ +/** + * @file llviewerwearable.cpp + * @brief LLViewerWearable class implementation + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llagent.h" +#include "llagentcamera.h" +#include "llagentwearables.h" +#include "llfloatersidepanelcontainer.h" +#include "llnotificationsutil.h" +#include "llsidepanelappearance.h" +#include "lltextureentry.h" +#include "llviewercontrol.h" +#include "llviewertexlayer.h" +#include "llviewerwearable.h" +#include "llvoavatarself.h" +#include "llvoavatardefines.h" + +using namespace LLVOAvatarDefines; + +// support class - remove for 2.1 (hackity hack hack) +class LLOverrideBakedTextureUpdate +{ +public: + LLOverrideBakedTextureUpdate(bool temp_state) + { + U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES; + for( U32 index = 0; index < num_bakes; ++index ) + { + composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index); + } + gAgentAvatarp->setCompositeUpdatesEnabled(temp_state); + } + + ~LLOverrideBakedTextureUpdate() + { + U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES; + for( U32 index = 0; index < num_bakes; ++index ) + { + gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]); + } + } +private: + bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES]; +}; + +// Private local functions +static std::string asset_id_to_filename(const LLUUID &asset_id); + +LLViewerWearable::LLViewerWearable(const LLTransactionID& transaction_id) : + LLWearable() +{ + mTransactionID = transaction_id; + mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); +} + +LLViewerWearable::LLViewerWearable(const LLAssetID& asset_id) : + LLWearable() +{ + mAssetID = asset_id; + mTransactionID.setNull(); +} + +// virtual +LLViewerWearable::~LLViewerWearable() +{ +} + +void LLViewerWearable::setItemID(const LLUUID& item_id) +{ + mItemID = item_id; +} + +// virtual +BOOL LLViewerWearable::exportFile(LLFILE* file) const +{ + mTextureIDMap.clear(); + for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) + { + S32 te = iter->first; + const LLUUID& image_id = iter->second->getID(); + mTextureIDMap[te] = image_id; + } + return LLWearable::exportFile(file); +} + +// virtual +LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) +{ + // suppress texlayerset updates while wearables are being imported. Layersets will be updated + // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed. + LLOverrideBakedTextureUpdate stop_bakes(false); + + LLWearable::EImportResult result = LLWearable::importFile(file); + if (LLWearable::FAILURE == result) return result; + if (LLWearable::BAD_HEADER == result) + { + // Shouldn't really log the asset id for security reasons, but + // we need it in this case. + llwarns << "Bad Wearable asset header: " << mAssetID << llendl; + //gVFS->dumpMap(); + return result; + } + + LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN ); + LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN ); + + texture_id_map_t::const_iterator iter = mTextureIDMap.begin(); + texture_id_map_t::const_iterator end = mTextureIDMap.end(); + for (; iter != end; ++iter) + { + S32 te = iter->first; + const LLUUID& textureid = iter->second; + if( mTEMap.find(te) != mTEMap.end() ) + { + delete mTEMap[te]; + } + if( mSavedTEMap.find(te) != mSavedTEMap.end() ) + { + delete mSavedTEMap[te]; + } + + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid ); + if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime")) + { + image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLVOAvatarDefines::ETextureIndex)te), NULL); + } + mTEMap[te] = new LLLocalTextureObject(image, textureid); + mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); + createLayers(te); + } + + // copy all saved param values to working params + revertValues(); + + return result; +} + +// Avatar parameter and texture definitions can change over time. +// This function returns true if parameters or textures have been added or removed +// since this wearable was created. +BOOL LLViewerWearable::isOldVersion() const +{ + if (!isAgentAvatarValid()) return FALSE; + + if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) + { + llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl; + llassert(0); + } + + if( LLWearable::sCurrentDefinitionVersion != mDefinitionVersion ) + { + return TRUE; + } + + S32 param_count = 0; + for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) + { + if( (param->getWearableType() == mType) && (param->isTweakable() ) ) + { + param_count++; + if( !is_in_map(mVisualParamIndexMap, param->getID() ) ) + { + return TRUE; + } + } + } + if( param_count != mVisualParamIndexMap.size() ) + { + return TRUE; + } + + + S32 te_count = 0; + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_count++; + if( !is_in_map(mTEMap, te ) ) + { + return TRUE; + } + } + } + if( te_count != mTEMap.size() ) + { + return TRUE; + } + + return FALSE; +} + +// Avatar parameter and texture definitions can change over time. +// * If parameters or textures have been REMOVED since the wearable was created, +// they're just ignored, so we consider the wearable clean even though isOldVersion() +// will return true. +// * If parameters or textures have been ADDED since the wearable was created, +// they are taken to have default values, so we consider the wearable clean +// only if those values are the same as the defaults. +BOOL LLViewerWearable::isDirty() const +{ + if (!isAgentAvatarValid()) return FALSE; + + for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) + { + if( (param->getWearableType() == mType) + && (param->isTweakable() ) + && !param->getCrossWearable()) + { + F32 current_weight = getVisualParamWeight(param->getID()); + current_weight = llclamp( current_weight, param->getMinWeight(), param->getMaxWeight() ); + F32 saved_weight = get_if_there(mSavedVisualParamMap, param->getID(), param->getDefaultWeight()); + saved_weight = llclamp( saved_weight, param->getMinWeight(), param->getMaxWeight() ); + + U8 a = F32_to_U8( saved_weight, param->getMinWeight(), param->getMaxWeight() ); + U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() ); + if( a != b ) + { + return TRUE; + } + } + } + + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_map_t::const_iterator current_iter = mTEMap.find(te); + if(current_iter != mTEMap.end()) + { + const LLUUID& current_image_id = current_iter->second->getID(); + te_map_t::const_iterator saved_iter = mSavedTEMap.find(te); + if(saved_iter != mSavedTEMap.end()) + { + const LLUUID& saved_image_id = saved_iter->second->getID(); + if (saved_image_id != current_image_id) + { + // saved vs current images are different, wearable is dirty + return TRUE; + } + } + else + { + // image found in current image list but not saved image list + return TRUE; + } + } + } + } + + return FALSE; +} + + +void LLViewerWearable::setParamsToDefaults() +{ + if (!isAgentAvatarValid()) return; + + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) + { + if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable() ) ) + { + setVisualParamWeight(param->getID(),param->getDefaultWeight(), FALSE); + } + } +} + +void LLViewerWearable::setTexturesToDefaults() +{ + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + LLUUID id = getDefaultTextureImageID((ETextureIndex) te); + LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id ); + if( mTEMap.find(te) == mTEMap.end() ) + { + mTEMap[te] = new LLLocalTextureObject(image, id); + createLayers(te); + } + else + { + // Local Texture Object already created, just set image and UUID + LLLocalTextureObject *lto = mTEMap[te]; + lto->setID(id); + lto->setImage(image); + } + } + } +} + + +//static +const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) +{ + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const std::string &default_image_name = texture_dict->mDefaultImageName; + if (default_image_name == "") + { + return IMG_DEFAULT_AVATAR; + } + else + { + return LLUUID(gSavedSettings.getString(default_image_name)); + } +} + + +// Updates the user's avatar's appearance +void LLViewerWearable::writeToAvatar() +{ + if (!isAgentAvatarValid()) return; + + ESex old_sex = gAgentAvatarp->getSex(); + + // Pull params + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) + { + // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the + // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way. + if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) ) + { + S32 param_id = param->getID(); + F32 weight = getVisualParamWeight(param_id); + + gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE ); + } + } + + // Pull texture entries + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_map_t::const_iterator iter = mTEMap.find(te); + LLUUID image_id; + if(iter != mTEMap.end()) + { + image_id = iter->second->getID(); + } + else + { + image_id = getDefaultTextureImageID((ETextureIndex) te); + } + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); + // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. + gAgentAvatarp->setLocalTextureTE(te, image, 0); + } + } + + ESex new_sex = gAgentAvatarp->getSex(); + if( old_sex != new_sex ) + { + gAgentAvatarp->updateSexDependentLayerSets( FALSE ); + } + +// if( upload_bake ) +// { +// gAgent.sendAgentSetAppearance(); +// } +} + + +// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values. +// static +void LLViewerWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ) +{ + if (!isAgentAvatarValid()) return; + + // You can't just remove body parts. + if( (type == LLWearableType::WT_SHAPE) || + (type == LLWearableType::WT_SKIN) || + (type == LLWearableType::WT_HAIR) || + (type == LLWearableType::WT_EYES) ) + { + return; + } + + // Pull params + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) + { + if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable() ) ) + { + S32 param_id = param->getID(); + gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake ); + } + } + + if(gAgentCamera.cameraCustomizeAvatar()) + { + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); + } + + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->wearableUpdated(type, FALSE); + +// if( upload_bake ) +// { +// gAgent.sendAgentSetAppearance(); +// } +} + +// Does not copy mAssetID. +// Definition version is current: removes obsolete enties and creates default values for new ones. +void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) +{ + if (!isAgentAvatarValid()) return; + + mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; + + mName = src->mName; + mDescription = src->mDescription; + mPermissions = src->mPermissions; + mSaleInfo = src->mSaleInfo; + + setType(src->mType); + + mSavedVisualParamMap.clear(); + // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) + { + if( (param->getWearableType() == mType) ) + { + S32 id = param->getID(); + F32 weight = src->getVisualParamWeight(id); + mSavedVisualParamMap[id] = weight; + } + } + + destroyTextures(); + // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) + for (S32 te = 0; te < TEX_NUM_INDICES; te++) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_map_t::const_iterator iter = src->mTEMap.find(te); + LLUUID image_id; + LLViewerFetchedTexture *image = NULL; + if(iter != src->mTEMap.end()) + { + image = dynamic_cast (src->getLocalTextureObject(te)->getImage()); + image_id = src->getLocalTextureObject(te)->getID(); + mTEMap[te] = new LLLocalTextureObject(image, image_id); + mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); + mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady()); + mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard()); + } + else + { + image_id = getDefaultTextureImageID((ETextureIndex) te); + image = LLViewerTextureManager::getFetchedTexture( image_id ); + mTEMap[te] = new LLLocalTextureObject(image, image_id); + mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); + } + createLayers(te); + } + } + + // Probably reduntant, but ensure that the newly created wearable is not dirty by setting current value of params in new wearable + // to be the same as the saved values (which were loaded from src at param->cloneParam(this)) + revertValues(); +} + + +LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) +{ + te_map_t::iterator iter = mTEMap.find(index); + if( iter != mTEMap.end() ) + { + LLLocalTextureObject* lto = iter->second; + return lto; + } + return NULL; +} + +const LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) const +{ + te_map_t::const_iterator iter = mTEMap.find(index); + if( iter != mTEMap.end() ) + { + const LLLocalTextureObject* lto = iter->second; + return lto; + } + return NULL; +} + +std::vector LLViewerWearable::getLocalTextureListSeq() +{ + std::vector result; + + for(te_map_t::const_iterator iter = mTEMap.begin(); + iter != mTEMap.end(); iter++) + { + LLLocalTextureObject* lto = iter->second; + result.push_back(lto); + } + + return result; +} + +void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject <o) +{ + if( mTEMap.find(index) != mTEMap.end() ) + { + mTEMap.erase(index); + } + mTEMap[index] = new LLLocalTextureObject(lto); +} + +void LLViewerWearable::revertValues() +{ + //update saved settings so wearable is no longer dirty + // non-driver params first + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + F32 value = iter->second; + LLVisualParam *param = getVisualParam(id); + if(param && !dynamic_cast(param) ) + { + setVisualParamWeight(id, value, TRUE); + } + } + + //then driver params + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + F32 value = iter->second; + LLVisualParam *param = getVisualParam(id); + if(param && dynamic_cast(param) ) + { + setVisualParamWeight(id, value, TRUE); + } + } + + // make sure that saved values are sane + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + LLVisualParam *param = getVisualParam(id); + if( param ) + { + mSavedVisualParamMap[id] = param->getWeight(); + } + } + + syncImages(mSavedTEMap, mTEMap); + + + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); + if( panel ) + { + panel->updateScrollingPanelList(); + } +} + +BOOL LLViewerWearable::isOnTop() const +{ + return (this == gAgentWearables.getTopWearable(mType)); +} + +void LLViewerWearable::saveValues() +{ + //update saved settings so wearable is no longer dirty + mSavedVisualParamMap.clear(); + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter) + { + S32 id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 value = wearable_param->getWeight(); + mSavedVisualParamMap[id] = value; + } + + // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) + syncImages(mTEMap, mSavedTEMap); + + + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); + if( panel ) + { + panel->updateScrollingPanelList(); + } +} + +void LLViewerWearable::syncImages(te_map_t &src, te_map_t &dst) +{ + // Deep copy of src (copies only those tes that are current, filling in defaults where needed) + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_map_t::const_iterator iter = src.find(te); + LLUUID image_id; + LLViewerFetchedTexture *image = NULL; + LLLocalTextureObject *lto = NULL; + if(iter != src.end()) + { + // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map. + lto = iter->second; + image = dynamic_cast (lto->getImage()); + image_id = lto->getID(); + } + else + { + // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map. + image_id = getDefaultTextureImageID((ETextureIndex) te); + image = LLViewerTextureManager::getFetchedTexture( image_id ); + } + + if( dst.find(te) != dst.end() ) + { + // there's already an entry in the destination map for the texture. Just update its values. + dst[te]->setImage(image); + dst[te]->setID(image_id); + } + else + { + // no entry found in the destination map, we need to create a new Local Texture Object + dst[te] = new LLLocalTextureObject(image, image_id); + } + + if( lto ) + { + // If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map. + dst[te]->setBakedReady(lto->getBakedReady()); + dst[te]->setDiscard(lto->getDiscard()); + } + } + } +} + +void LLViewerWearable::destroyTextures() +{ + for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter ) + { + LLLocalTextureObject *lto = iter->second; + delete lto; + } + mTEMap.clear(); + for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter ) + { + LLLocalTextureObject *lto = iter->second; + delete lto; + } + mSavedTEMap.clear(); +} + +void LLViewerWearable::pullCrossWearableValues() +{ + // scan through all of the avatar's visual parameters + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) + { + if( param ) + { + LLDriverParam *driver_param = dynamic_cast(param); + if(driver_param) + { + // parameter is a driver parameter, have it update its + driver_param->updateCrossDrivenParams(getType()); + } + } + } +} + + +void LLViewerWearable::setLabelUpdated() const +{ + gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID()); +} + + +void LLViewerWearable::refreshName() +{ + LLUUID item_id = getItemID(); + LLInventoryItem* item = gInventory.getItem(item_id); + if( item ) + { + mName = item->getName(); + } +} + +struct LLWearableSaveData +{ + LLWearableType::EType mType; +}; + +void LLViewerWearable::saveNewAsset() const +{ +// llinfos << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << llendl; + //llinfos << *this << llendl; + + const std::string filename = asset_id_to_filename(mAssetID); + LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ + BOOL successful_save = FALSE; + if(fp && exportFile(fp)) + { + successful_save = TRUE; + } + if(fp) + { + fclose(fp); + fp = NULL; + } + if(!successful_save) + { + std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); + llwarns << buffer << llendl; + + LLSD args; + args["NAME"] = mName; + LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args); + return; + } + + // save it out to database + if( gAssetStorage ) + { + /* + std::string url = gAgent.getRegion()->getCapability("NewAgentInventory"); + if (!url.empty()) + { + llinfos << "Update Agent Inventory via capability" << llendl; + LLSD body; + body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType())); + body["asset_type"] = LLAssetType::lookup(getAssetType()); + body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE); + body["name"] = getName(); + body["description"] = getDescription(); + LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename)); + } + else + { + } + */ + LLWearableSaveData* data = new LLWearableSaveData; + data->mType = mType; + gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(), + &LLViewerWearable::onSaveNewAssetComplete, + (void*)data); + } +} + +// static +void LLViewerWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) +{ + LLWearableSaveData* data = (LLWearableSaveData*)userdata; + const std::string& type_name = LLWearableType::getTypeName(data->mType); + if(0 == status) + { + // Success + llinfos << "Saved wearable " << type_name << llendl; + } + else + { + std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str()); + llwarns << buffer << " Status: " << status << llendl; + LLSD args; + args["NAME"] = type_name; + LLNotificationsUtil::add("CannotSaveToAssetStore", args); + } + + // Delete temp file + const std::string src_filename = asset_id_to_filename(new_asset_id); + LLFile::remove(src_filename); + + // delete the context data + delete data; + +} + +void LLViewerWearable::createLayers(S32 te) +{ + LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); + if (layer_set) + { + layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); + } + else + { + llerrs << "could not find layerset for LTO in wearable!" << llendl; + } +} + +void LLViewerWearable::createVisualParams() +{ + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) + { + if (param->getWearableType() == mType) + { + addVisualParam(param->cloneParam(this)); + } + } + + // resync driver parameters to point to the newly cloned driven parameters + for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); + param_iter != mVisualParamIndexMap.end(); + ++param_iter) + { + LLVisualParam* param = param_iter->second; + LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; + // need this line to disambiguate between versions of LLCharacter::getVisualParam() + LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; + param->resetDrivenParams(); + if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) + { + if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) + { + llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; + continue; + } + } + } +} + +void LLViewerWearable::setVisualParams() +{ + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) + { + S32 id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 value = wearable_param->getWeight(); + gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + } +} + + + +std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w) +{ + s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n"; + s << " Name: " << w.mName << "\n"; + s << " Desc: " << w.mDescription << "\n"; + //w.mPermissions + //w.mSaleInfo + + s << " Params:" << "\n"; + for (LLWearable::visual_param_index_map_t::const_iterator iter = w.mVisualParamIndexMap.begin(); + iter != w.mVisualParamIndexMap.end(); ++iter) + { + S32 param_id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 param_weight = wearable_param->getWeight(); + s << " " << param_id << " " << param_weight << "\n"; + } + + s << " Textures:" << "\n"; + for (LLViewerWearable::te_map_t::const_iterator iter = w.mTEMap.begin(); + iter != w.mTEMap.end(); ++iter) + { + S32 te = iter->first; + const LLUUID& image_id = iter->second->getID(); + s << " " << te << " " << image_id << "\n"; + } + return s; +} + +std::string asset_id_to_filename(const LLUUID &asset_id) +{ + std::string asset_id_string; + asset_id.toString(asset_id_string); + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl"; + return filename; +} + diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h new file mode 100644 index 0000000000..857900f583 --- /dev/null +++ b/indra/newview/llviewerwearable.h @@ -0,0 +1,116 @@ +/** + * @file llviewerwearable.h + * @brief LLViewerWearable class header file + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_VIEWER_WEARABLE_H +#define LL_VIEWER_WEARABLE_H + +#include "llwearable.h" +#include "llvoavatardefines.h" + +class LLViewerWearable : public LLWearable +{ + friend class LLWearableList; + + //-------------------------------------------------------------------- + // Constructors and destructors + //-------------------------------------------------------------------- +private: + // Private constructors used by LLViewerWearableList + LLViewerWearable(const LLTransactionID& transactionID); + LLViewerWearable(const LLAssetID& assetID); +public: + virtual ~LLViewerWearable(); + + //-------------------------------------------------------------------- + // Accessors + //-------------------------------------------------------------------- +public: + const LLUUID& getItemID() const { return mItemID; } + const LLAssetID& getAssetID() const { return mAssetID; } + const LLTransactionID& getTransactionID() const { return mTransactionID; } + void setItemID(const LLUUID& item_id); + +public: + /*virtual*/ BOOL exportFile(LLFILE* file) const; + /*virtual*/ EImportResult importFile(LLFILE* file); + + BOOL isDirty() const; + BOOL isOldVersion() const; + + /*virtual*/ void writeToAvatar(); + void removeFromAvatar( BOOL upload_bake ) { LLViewerWearable::removeFromAvatar( mType, upload_bake ); } + static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ); + + void setParamsToDefaults(); + void setTexturesToDefaults(); + + static const LLUUID getDefaultTextureImageID(LLVOAvatarDefines::ETextureIndex index); + + + void saveNewAsset() const; + static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status ); + + void copyDataFrom(const LLViewerWearable* src); + + friend std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w); + + /*virtual*/ LLLocalTextureObject* getLocalTextureObject(S32 index); + const LLLocalTextureObject* getLocalTextureObject(S32 index) const; + std::vector getLocalTextureListSeq(); + void setLocalTextureObject(S32 index, LLLocalTextureObject <o); + + void revertValues(); + void saveValues(); + void pullCrossWearableValues(); + + BOOL isOnTop() const; + + // Something happened that requires the wearable's label to be updated (e.g. worn/unworn). + void setLabelUpdated() const; + + // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem, + // not the wearable asset itself. + void refreshName(); + +protected: + void createLayers(S32 te); + /*virtual*/void createVisualParams(); + void setVisualParams(); + + typedef std::map te_map_t; + void syncImages(te_map_t &src, te_map_t &dst); + void destroyTextures(); + LLTransactionID mTransactionID; + LLAssetID mAssetID; + LLUUID mItemID; // ID of the inventory item in the agent's inventory + + te_map_t mTEMap; // maps TE to LocalTextureObject + te_map_t mSavedTEMap; // last saved version of TEMap +}; + + +#endif // LL_VIEWER_WEARABLE_H + diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4894f21e67..dac479b2e0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -77,15 +77,16 @@ #include "llselectmgr.h" #include "llsprite.h" #include "lltargetingmotion.h" -#include "lltexlayer.h" #include "lltoolmorph.h" #include "llviewercamera.h" +#include "llviewertexlayer.h" #include "llviewertexturelist.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewershadermgr.h" #include "llviewerstats.h" +#include "llviewerwearable.h" #include "llvoavatarself.h" #include "llvovolume.h" #include "llworld.h" @@ -192,8 +193,6 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; -const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); - enum ERenderName { RENDER_NAME_NEVER, @@ -645,8 +644,8 @@ static F32 calc_bouncy_animation(F32 x); LLVOAvatar::LLVOAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : + LLAvatarAppearance(), LLViewerObject(id, pcode, regionp), - mIsDummy(FALSE), mSpecialRenderMode(0), mAttachmentGeometryBytes(0), mAttachmentSurfaceArea(0.f), @@ -678,9 +677,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), mVisibilityRank(0), - mTexSkinColor( NULL ), - mTexHairColor( NULL ), - mTexEyeColor( NULL ), mNeedsSkin(FALSE), mLastSkinTime(0.f), mUpdatePeriod(1), @@ -768,7 +764,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mRuthTimer.reset(); mRuthDebugTimer.reset(); - mDebugExistenceTimer.reset(); mPelvisOffset = LLVector3(0.0f,0.0f,0.0f); mLastPelvisToFoot = 0.0f; mPelvisFixup = 0.0f; @@ -1133,7 +1128,7 @@ void LLVOAvatar::resetImpostors() // static void LLVOAvatar::deleteCachedImages(bool clearAll) { - if (LLTexLayerSet::sHasCaches) + if (LLViewerTexLayerSet::sHasCaches) { lldebugs << "Deleting layer set caches" << llendl; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); @@ -1142,7 +1137,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) LLVOAvatar* inst = (LLVOAvatar*) *iter; inst->deleteLayerSetCaches(clearAll); } - LLTexLayerSet::sHasCaches = FALSE; + LLViewerTexLayerSet::sHasCaches = FALSE; } LLVOAvatarSelf::deleteScratchTextures(); LLTexLayerStaticImageList::getInstance()->deleteCachedImages(); @@ -5864,6 +5859,30 @@ void LLVOAvatar::updateVisualParams() updateHeadOffset(); } +// virtual +U32 LLVOAvatar::getWearableCount(const LLWearableType::EType type) const +{ + return gAgentWearables.getWearableCount(type); +} + +// virtual +U32 LLVOAvatar::getWearableCount(const U32 tex_index) const +{ + return gAgentWearables.getWearableCount(tex_index); +} + +// virtual +LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) +{ + return gAgentWearables.getWearable(type, index); +} + +// virtual +const LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const +{ + return gAgentWearables.getWearable(type, index); +} + //----------------------------------------------------------------------------- // isActive() //----------------------------------------------------------------------------- @@ -6453,26 +6472,6 @@ S32 LLVOAvatar::getAttachmentCount() return count; } -LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const -{ - if (color_name=="skin_color" && mTexSkinColor) - { - return mTexSkinColor->getColor(); - } - else if(color_name=="hair_color" && mTexHairColor) - { - return mTexHairColor->getColor(); - } - if(color_name=="eye_color" && mTexEyeColor) - { - return mTexEyeColor->getColor(); - } - else - { -// return LLColor4( .5f, .5f, .5f, .5f ); - return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color - } -} // virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) @@ -6483,6 +6482,7 @@ void LLVOAvatar::invalidateAll() { } +// virtual void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake ) { if (global_color == mTexSkinColor) @@ -6682,6 +6682,7 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const // updateMeshTextures() // Uses the current TE values to set the meshes' and layersets' textures. //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::updateMeshTextures() { // llinfos << "updateMeshTextures" << llendl; @@ -6903,7 +6904,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde { if (isSelf()) { - LLTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet; + LLViewerTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet; if (layer_set) { return !layer_set->isMorphValid(); @@ -6973,112 +6974,6 @@ void LLVOAvatar::releaseComponentTextures() } } -//static -BOOL LLVOAvatar::teToColorParams( ETextureIndex te, U32 *param_name ) -{ - switch( te ) - { - case TEX_UPPER_SHIRT: - param_name[0] = 803; //"shirt_red"; - param_name[1] = 804; //"shirt_green"; - param_name[2] = 805; //"shirt_blue"; - break; - - case TEX_LOWER_PANTS: - param_name[0] = 806; //"pants_red"; - param_name[1] = 807; //"pants_green"; - param_name[2] = 808; //"pants_blue"; - break; - - case TEX_LOWER_SHOES: - param_name[0] = 812; //"shoes_red"; - param_name[1] = 813; //"shoes_green"; - param_name[2] = 817; //"shoes_blue"; - break; - - case TEX_LOWER_SOCKS: - param_name[0] = 818; //"socks_red"; - param_name[1] = 819; //"socks_green"; - param_name[2] = 820; //"socks_blue"; - break; - - case TEX_UPPER_JACKET: - case TEX_LOWER_JACKET: - param_name[0] = 834; //"jacket_red"; - param_name[1] = 835; //"jacket_green"; - param_name[2] = 836; //"jacket_blue"; - break; - - case TEX_UPPER_GLOVES: - param_name[0] = 827; //"gloves_red"; - param_name[1] = 829; //"gloves_green"; - param_name[2] = 830; //"gloves_blue"; - break; - - case TEX_UPPER_UNDERSHIRT: - param_name[0] = 821; //"undershirt_red"; - param_name[1] = 822; //"undershirt_green"; - param_name[2] = 823; //"undershirt_blue"; - break; - - case TEX_LOWER_UNDERPANTS: - param_name[0] = 824; //"underpants_red"; - param_name[1] = 825; //"underpants_green"; - param_name[2] = 826; //"underpants_blue"; - break; - - case TEX_SKIRT: - param_name[0] = 921; //"skirt_red"; - param_name[1] = 922; //"skirt_green"; - param_name[2] = 923; //"skirt_blue"; - break; - - case TEX_HEAD_TATTOO: - case TEX_LOWER_TATTOO: - case TEX_UPPER_TATTOO: - param_name[0] = 1071; //"tattoo_red"; - param_name[1] = 1072; //"tattoo_green"; - param_name[2] = 1073; //"tattoo_blue"; - break; - - default: - llassert(0); - return FALSE; - } - - return TRUE; -} - -void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake ) -{ - U32 param_name[3]; - if( teToColorParams( te, param_name ) ) - { - setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake ); - setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake ); - setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake ); - } -} - -LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) -{ - LLColor4 color; - U32 param_name[3]; - if( teToColorParams( te, param_name ) ) - { - color.mV[VX] = getVisualParamWeight( param_name[0] ); - color.mV[VY] = getVisualParamWeight( param_name[1] ); - color.mV[VZ] = getVisualParamWeight( param_name[2] ); - } - return color; -} - -// static -LLColor4 LLVOAvatar::getDummyColor() -{ - return DUMMY_COLOR; -} - void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const { LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL; @@ -8787,7 +8682,7 @@ BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 ind } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const +BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const { // non-self avatars don't have wearables return FALSE; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 3f65dec11c..023711d81b 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -25,8 +25,8 @@ * $/LicenseInfo$ */ -#ifndef LL_LLVOAVATAR_H -#define LL_LLVOAVATAR_H +#ifndef LL_VOAVATAR_H +#define LL_VOAVATAR_H #include #include @@ -36,6 +36,7 @@ #include #include "imageids.h" // IMG_INVISIBLE +#include "llavatarappearance.h" #include "llchat.h" #include "lldrawpoolalpha.h" #include "llviewerobject.h" @@ -62,7 +63,8 @@ extern const LLUUID ANIM_AGENT_PELVIS_FIX; extern const LLUUID ANIM_AGENT_TARGET; extern const LLUUID ANIM_AGENT_WALK_ADJUST; -class LLTexLayerSet; +class LLViewerTexLayerSet; +class LLViewerWearable; class LLVoiceVisualizer; class LLHUDNameTag; class LLHUDEffectSpiral; @@ -75,8 +77,8 @@ class LLVOAvatarSkeletonInfo; // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLVOAvatar : + public LLAvatarAppearance, public LLViewerObject, - public LLCharacter, public boost::signals2::trackable { LOG_CLASS(LLVOAvatar); @@ -222,8 +224,20 @@ public: public: virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent + /*virtual*/BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode bool isBuilt() const { return mIsBuilt; } +/******************************************************************************** + ** ** + ** WEARABLES + **/ +public: + /*virtual*/ U32 getWearableCount(const LLWearableType::EType type) const; + /*virtual*/ U32 getWearableCount(const U32 tex_index) const; + + /*virtual*/ LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/); + /*virtual*/ const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; + private: //aligned members LL_ALIGN_16(LLVector4a mImpostorExtents[2]); @@ -440,7 +454,7 @@ public: static void deleteCachedImages(bool clearAll=true); static void destroyGL(); static void restoreGL(); - BOOL mIsDummy; // for special views + BOOL mIsDummy; // for special views S32 mSpecialRenderMode; // special lighting U32 mAttachmentGeometryBytes; //number of bytes in attached geometry F32 mAttachmentSurfaceArea; //estimated surface area of attachments @@ -460,7 +474,14 @@ private: public: BOOL morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); void addMaskedMorph(LLVOAvatarDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer); - void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); + virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); + + + //-------------------------------------------------------------------- + // Global colors + //-------------------------------------------------------------------- +public: + virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake); //-------------------------------------------------------------------- // Visibility @@ -563,7 +584,7 @@ public: public: virtual BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; - virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const; + virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const; BOOL isFullyBaked(); static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); @@ -586,7 +607,7 @@ protected: struct BakedTextureData { LLUUID mLastTextureIndex; - LLTexLayerSet* mTexLayerSet; // Only exists for self + LLViewerTexLayerSet* mTexLayerSet; // Only exists for self bool mIsLoaded; bool mIsUsed; LLVOAvatarDefines::ETextureIndex mTextureIndex; @@ -668,15 +689,15 @@ private: **/ public: - void updateMeshTextures(); + virtual void updateMeshTextures(); void updateSexDependentLayerSets(BOOL upload_bake); - void dirtyMesh(); // Dirty the avatar mesh + virtual void dirtyMesh(); // Dirty the avatar mesh void updateMeshData(); protected: void releaseMeshData(); virtual void restoreMeshData(); private: - void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority + virtual void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD BOOL mMeshTexturesDirty; @@ -710,7 +731,6 @@ public: //-------------------------------------------------------------------- public: BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; } - BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode private: BOOL mAppearanceAnimating; LLFrameTimer mAppearanceMorphTimer; @@ -719,25 +739,6 @@ private: BOOL mUseLocalAppearance; // flag for if we're using a local composite BOOL mUseServerBakes; // flag for if baked textures should be fetched from baking service (false if they're temporary uploads) - //-------------------------------------------------------------------- - // Clothing colors (convenience functions to access visual parameters) - //-------------------------------------------------------------------- -public: - void setClothesColor(LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake); - LLColor4 getClothesColor(LLVOAvatarDefines::ETextureIndex te); - static BOOL teToColorParams(LLVOAvatarDefines::ETextureIndex te, U32 *param_name); - - //-------------------------------------------------------------------- - // Global colors - //-------------------------------------------------------------------- -public: - LLColor4 getGlobalColor(const std::string& color_name ) const; - void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake); -private: - LLTexGlobalColor* mTexSkinColor; - LLTexGlobalColor* mTexHairColor; - LLTexGlobalColor* mTexEyeColor; - //-------------------------------------------------------------------- // Visibility //-------------------------------------------------------------------- @@ -746,7 +747,6 @@ public: void setVisibilityRank(U32 rank); U32 getVisibilityRank() const { return mVisibilityRank; } // unused static S32 sNumVisibleAvatars; // Number of instances of this class - static LLColor4 getDummyColor(); /** Appearance ** ** *******************************************************************************/ @@ -1038,11 +1038,9 @@ private: //-------------------------------------------------------------------- public: void debugAvatarRezTime(std::string notification_name, std::string comment = ""); - F32 debugGetExistenceTimeElapsedF32() const { return mDebugExistenceTimer.getElapsedTimeF32(); } protected: LLFrameTimer mRuthDebugTimer; // For tracking how long it takes for av to rez - LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory. /** Diagnostics ** ** @@ -1163,4 +1161,5 @@ protected: // Shared with LLVOAvatarSelf extern const F32 SELF_ADDITIONAL_PRI; extern const S32 MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL; -#endif // LL_VO_AVATAR_H +#endif // LL_VOAVATAR_H + diff --git a/indra/newview/llvoavatardefines.cpp b/indra/newview/llvoavatardefines.cpp deleted file mode 100644 index ef96a9e923..0000000000 --- a/indra/newview/llvoavatardefines.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/** - * @file llvoavatar.cpp - * @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llvoavatardefines.h" -#include "llviewercontrol.h" // gSavedSettings - -const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512; -const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512; -const S32 LLVOAvatarDefines::IMPOSTOR_PERIOD = 2; - -using namespace LLVOAvatarDefines; - -/********************************************************************************* - * Edit this function to add/remove/change textures and mesh definitions for avatars. - */ - -LLVOAvatarDictionary::Textures::Textures() -{ - addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); - addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT)); - addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS)); - addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES)); - addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR)); - addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); - addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); - addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES)); - addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS)); - addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); - addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); - addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES)); - addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT)); - addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS)); - addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT)); - - addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - - addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); - addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); - addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); - - addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head")); - addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper")); - addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower")); - addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes")); - addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair")); - addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt")); -} - -LLVOAvatarDictionary::BakedTextures::BakedTextures() -{ - // Baked textures - addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED, - "head", "a4b9dc38-e13b-4df9-b284-751efb0566ff", - 3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA, - 5, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA)); - - addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED, - "upper_body", "5943ff64-d26c-4a90-a8c0-d61f56bd98d4", - 7, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET, - TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA, - 8, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA)); - - addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED, - "lower_body", "2944ee70-90a7-425d-a5fb-d749c782ed7d", - 8, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS, - TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA, - 9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA)); - - addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED, - "eyes", "27b1bc0f-979f-4b13-95fe-b981c2ba9788", - 2, TEX_EYES_IRIS, TEX_EYES_ALPHA, - 2, LLWearableType::WT_EYES, LLWearableType::WT_ALPHA)); - - addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED, - "skirt", "03e7e8cb-1368-483b-b6f3-74850838ba63", - 1, TEX_SKIRT, - 1, LLWearableType::WT_SKIRT)); - - addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED, - "hair", "a60e85a9-74e8-48d8-8a2d-8129f28d9b61", - 2, TEX_HAIR, TEX_HAIR_ALPHA, - 2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA)); -} - -LLVOAvatarDictionary::Meshes::Meshes() -{ - // Meshes - addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4)); - addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5)); - addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0)); // no baked mesh associated currently - addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1)); - addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2)); - addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3)); - addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3)); - addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5)); -} - -/* - * - *********************************************************************************/ - -LLVOAvatarDictionary::LLVOAvatarDictionary() -{ - createAssociations(); -} - -//virtual -LLVOAvatarDictionary::~LLVOAvatarDictionary() -{ -} - -// Baked textures are composites of textures; for each such composited texture, -// map it to the baked texture. -void LLVOAvatarDictionary::createAssociations() -{ - for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++) - { - const EBakedTextureIndex baked_index = (iter->first); - const BakedEntry *dict = (iter->second); - - // For each texture that this baked texture index affects, associate those textures - // with this baked texture index. - for (texture_vec_t::const_iterator local_texture_iter = dict->mLocalTextures.begin(); - local_texture_iter != dict->mLocalTextures.end(); - local_texture_iter++) - { - const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter; - mTextures[local_texture_index]->mIsUsedByBakedTexture = true; - mTextures[local_texture_index]->mBakedTextureIndex = baked_index; - } - } - -} - -LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name, - bool is_local_texture, - EBakedTextureIndex baked_texture_index, - const std::string &default_image_name, - LLWearableType::EType wearable_type) : - LLDictionaryEntry(name), - mIsLocalTexture(is_local_texture), - mIsBakedTexture(!is_local_texture), - mIsUsedByBakedTexture(baked_texture_index != BAKED_NUM_INDICES), - mBakedTextureIndex(baked_texture_index), - mDefaultImageName(default_image_name), - mWearableType(wearable_type) -{ -} - -LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index, - const std::string &name, - U8 level, - LLViewerJoint::PickName pick) : - LLDictionaryEntry(name), - mBakedID(baked_index), - mLOD(level), - mPickName(pick) -{ -} -LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index, - const std::string &name, - const std::string &hash_name, - U32 num_local_textures, - ... ) : - LLDictionaryEntry(name), - mWearablesHashID(LLUUID(hash_name)), - mTextureIndex(tex_index) -{ - va_list argp; - - va_start(argp, num_local_textures); - - // Read in local textures - for (U8 i=0; i < num_local_textures; i++) - { - ETextureIndex t = (ETextureIndex)va_arg(argp,int); - mLocalTextures.push_back(t); - } - - // Read in number of wearables - const U32 num_wearables = (U32)va_arg(argp,int); - // Read in wearables - for (U8 i=0; i < num_wearables; i++) - { - LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int); - mWearables.push_back(t); - } -} - -// static -ETextureIndex LLVOAvatarDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index) -{ - return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex; -} - -//static -EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name) -{ - U8 index = 0; - while (index < BAKED_NUM_INDICES) - { - const BakedEntry *be = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index); - if (be && be->mName.compare(name) == 0) - { - // baked texture found - return (EBakedTextureIndex) index; - } - index++; - } - // baked texture could not be found - return BAKED_NUM_INDICES; -} - -//static -const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index) -{ - const TextureEntry *texture_dict = getInstance()->getTexture(index); - const std::string &default_image_name = texture_dict->mDefaultImageName; - if (default_image_name == "") - { - return IMG_DEFAULT_AVATAR; - } - else - { - return LLUUID(gSavedSettings.getString(default_image_name)); - } -} - -// static -LLWearableType::EType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index ) -{ - return getInstance()->getTexture(index)->mWearableType; -} - diff --git a/indra/newview/llvoavatardefines.h b/indra/newview/llvoavatardefines.h deleted file mode 100644 index 35bb37463a..0000000000 --- a/indra/newview/llvoavatardefines.h +++ /dev/null @@ -1,228 +0,0 @@ -/** - * @file llvoavatar.h - * @brief Declaration of LLVOAvatar class which is a derivation fo - * LLViewerObject - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LLVOAVATAR_DEFINES_H -#define LLVOAVATAR_DEFINES_H - -#include -#include "llwearable.h" -#include "llviewerjoint.h" -#include "lldictionary.h" - -namespace LLVOAvatarDefines -{ - -extern const S32 SCRATCH_TEX_WIDTH; -extern const S32 SCRATCH_TEX_HEIGHT; -extern const S32 IMPOSTOR_PERIOD; - -//-------------------------------------------------------------------- -// Enums -//-------------------------------------------------------------------- -enum ETextureIndex -{ - TEX_HEAD_BODYPAINT = 0, - TEX_UPPER_SHIRT, - TEX_LOWER_PANTS, - TEX_EYES_IRIS, - TEX_HAIR, - TEX_UPPER_BODYPAINT, - TEX_LOWER_BODYPAINT, - TEX_LOWER_SHOES, - TEX_HEAD_BAKED, // Pre-composited - TEX_UPPER_BAKED, // Pre-composited - TEX_LOWER_BAKED, // Pre-composited - TEX_EYES_BAKED, // Pre-composited - TEX_LOWER_SOCKS, - TEX_UPPER_JACKET, - TEX_LOWER_JACKET, - TEX_UPPER_GLOVES, - TEX_UPPER_UNDERSHIRT, - TEX_LOWER_UNDERPANTS, - TEX_SKIRT, - TEX_SKIRT_BAKED, // Pre-composited - TEX_HAIR_BAKED, // Pre-composited - TEX_LOWER_ALPHA, - TEX_UPPER_ALPHA, - TEX_HEAD_ALPHA, - TEX_EYES_ALPHA, - TEX_HAIR_ALPHA, - TEX_HEAD_TATTOO, - TEX_UPPER_TATTOO, - TEX_LOWER_TATTOO, - TEX_NUM_INDICES -}; - -enum EBakedTextureIndex -{ - BAKED_HEAD = 0, - BAKED_UPPER, - BAKED_LOWER, - BAKED_EYES, - BAKED_SKIRT, - BAKED_HAIR, - BAKED_NUM_INDICES -}; - -// Reference IDs for each mesh. Used as indices for vector of joints -enum EMeshIndex -{ - MESH_ID_HAIR = 0, - MESH_ID_HEAD, - MESH_ID_EYELASH, - MESH_ID_UPPER_BODY, - MESH_ID_LOWER_BODY, - MESH_ID_EYEBALL_LEFT, - MESH_ID_EYEBALL_RIGHT, - MESH_ID_SKIRT, - MESH_ID_NUM_INDICES -}; - -//-------------------------------------------------------------------- -// Vector Types -//-------------------------------------------------------------------- -typedef std::vector texture_vec_t; -typedef std::vector bakedtexture_vec_t; -typedef std::vector mesh_vec_t; -typedef std::vector wearables_vec_t; - -//------------------------------------------------------------------------ -// LLVOAvatarDictionary -// -// Holds dictionary static entries for textures, baked textures, meshes, etc.; i.e. -// information that is common to all avatars. -// -// This holds const data - it is initialized once and the contents never change after that. -//------------------------------------------------------------------------ -class LLVOAvatarDictionary : public LLSingleton -{ - //-------------------------------------------------------------------- - // Constructors and Destructors - //-------------------------------------------------------------------- -public: - LLVOAvatarDictionary(); - virtual ~LLVOAvatarDictionary(); -private: - void createAssociations(); - - //-------------------------------------------------------------------- - // Local and baked textures - //-------------------------------------------------------------------- -public: - struct TextureEntry : public LLDictionaryEntry - { - TextureEntry(const std::string &name, // this must match the xml name used by LLTexLayerInfo::parseXml - bool is_local_texture, - EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES, - const std::string& default_image_name = "", - LLWearableType::EType wearable_type = LLWearableType::WT_INVALID); - const std::string mDefaultImageName; - const LLWearableType::EType mWearableType; - // It's either a local texture xor baked - BOOL mIsLocalTexture; - BOOL mIsBakedTexture; - // If it's a local texture, it may be used by a baked texture - BOOL mIsUsedByBakedTexture; - EBakedTextureIndex mBakedTextureIndex; - }; - - struct Textures : public LLDictionary - { - Textures(); - } mTextures; - const TextureEntry* getTexture(ETextureIndex index) const { return mTextures.lookup(index); } - const Textures& getTextures() const { return mTextures; } - - //-------------------------------------------------------------------- - // Meshes - //-------------------------------------------------------------------- -public: - struct MeshEntry : public LLDictionaryEntry - { - MeshEntry(EBakedTextureIndex baked_index, - const std::string &name, // names of mesh types as they are used in avatar_lad.xml - U8 level, - LLViewerJoint::PickName pick); - // Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml - // Otherwise meshes will be unable to be found, or levels of detail will be ignored - const U8 mLOD; - const EBakedTextureIndex mBakedID; - const LLViewerJoint::PickName mPickName; - }; - - struct Meshes : public LLDictionary - { - Meshes(); - } mMeshes; - const MeshEntry* getMesh(EMeshIndex index) const { return mMeshes.lookup(index); } - const Meshes& getMeshes() const { return mMeshes; } - - //-------------------------------------------------------------------- - // Baked Textures - //-------------------------------------------------------------------- -public: - struct BakedEntry : public LLDictionaryEntry - { - BakedEntry(ETextureIndex tex_index, - const std::string &name, // unused, but necessary for templating. - const std::string &hash_name, - U32 num_local_textures, ... ); // # local textures, local texture list, # wearables, wearable list - // Local Textures - const ETextureIndex mTextureIndex; - texture_vec_t mLocalTextures; - // Wearables - const LLUUID mWearablesHashID; - wearables_vec_t mWearables; - }; - - struct BakedTextures: public LLDictionary - { - BakedTextures(); - } mBakedTextures; - const BakedEntry* getBakedTexture(EBakedTextureIndex index) const { return mBakedTextures.lookup(index); } - const BakedTextures& getBakedTextures() const { return mBakedTextures; } - - //-------------------------------------------------------------------- - // Convenience Functions - //-------------------------------------------------------------------- -public: - // Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED - static ETextureIndex bakedToLocalTextureIndex(EBakedTextureIndex t); - - // find a baked texture index based on its name - static EBakedTextureIndex findBakedByRegionName(std::string name); - - static const LLUUID getDefaultTextureImageID(ETextureIndex index); - - // Given a texture entry, determine which wearable type owns it. - static LLWearableType::EType getTEWearableType(ETextureIndex index); - -}; // End LLVOAvatarDictionary - -} // End namespace LLVOAvatarDefines - -#endif //LL_VO_AVATARDEFINES_H diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 3604a373ad..0fcf43a501 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -55,6 +55,8 @@ #include "llviewerobjectlist.h" #include "llviewerstats.h" #include "llviewerregion.h" +#include "llviewertexlayer.h" +#include "llviewerwearable.h" #include "llappearancemgr.h" #include "llmeshrepository.h" #include "llvovolume.h" @@ -595,7 +597,7 @@ BOOL LLVOAvatarSelf::loadLayersets() { // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. const LLTexLayerSetInfo *info = *iter; - LLTexLayerSet* layer_set = new LLTexLayerSet( this ); + LLViewerTexLayerSet* layer_set = new LLViewerTexLayerSet( this ); if (!layer_set->setInfo(info)) { @@ -734,7 +736,7 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL U32 size = gAgentWearables.getWearableCount(type); for (U32 count = 0; count < size; ++count) { - LLWearable *wearable = gAgentWearables.getWearable(type,count); + LLViewerWearable *wearable = gAgentWearables.getWearable(type,count); if (wearable) { wearable->setVisualParamWeight(param->getID(), weight, upload_bake); @@ -760,7 +762,7 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation() // apply wearable visual params to avatar for (U32 type = 0; type < LLWearableType::WT_COUNT; type++) { - LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type); + LLViewerWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type); if (wearable) { wearable->writeToAvatar(); @@ -1375,7 +1377,7 @@ BOOL LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLViewerTexture** tex { return FALSE; } - *tex_pp = local_tex_obj->getImage(); + *tex_pp = dynamic_cast (local_tex_obj->getImage()); return TRUE; } @@ -1395,7 +1397,7 @@ LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLVOAvatarDefines::ETe { return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR); } - return local_tex_obj->getImage(); + return dynamic_cast (local_tex_obj->getImage()); } const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) const @@ -1416,7 +1418,7 @@ const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) c // Returns true if at least the lowest quality discard level exists for every texture // in the layerset. //----------------------------------------------------------------------------- -BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const +BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const { /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */ @@ -1454,7 +1456,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset) // Returns true if the highest quality discard level exists for every texture // in the layerset. //----------------------------------------------------------------------------- -BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) const +BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const { const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); // const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels. @@ -1515,7 +1517,7 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const { - const LLTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet; + const LLViewerTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet; if (!layerset) return FALSE; const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); if (!layerset_buffer) return FALSE; @@ -1568,7 +1570,7 @@ BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 } //virtual -BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const +BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const { if (isIndexBakedTexture(type)) { @@ -1611,7 +1613,7 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const { for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - LLTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet; + LLViewerTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet; if (layerset && layerset->getComposite() && layerset->getComposite()->uploadPending()) { return true; @@ -1620,7 +1622,7 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const return false; } -void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) +void LLVOAvatarSelf::invalidateComposite( LLViewerTexLayerSet* layerset, BOOL upload_result ) { if( !layerset || !layerset->getUpdatesEnabled() ) { @@ -1712,11 +1714,12 @@ S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index) const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, wearable_index); if (local_tex_obj) { + const LLViewerFetchedTexture* image = dynamic_cast( local_tex_obj->getImage() ); if (type >= 0 && local_tex_obj->getID() != IMG_DEFAULT_AVATAR - && !local_tex_obj->getImage()->isMissingAsset()) + && !image->isMissingAsset()) { - return local_tex_obj->getImage()->getDiscardLevel(); + return image->getDiscardLevel(); } else { @@ -1741,7 +1744,7 @@ void LLVOAvatarSelf::getLocalTextureByteCount(S32* gl_bytes) const const LLLocalTextureObject *local_tex_obj = getLocalTextureObject((ETextureIndex) type, num); if (local_tex_obj) { - const LLViewerFetchedTexture* image_gl = local_tex_obj->getImage(); + const LLViewerFetchedTexture* image_gl = dynamic_cast( local_tex_obj->getImage() ); if (image_gl) { S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents(); @@ -1790,7 +1793,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te return; } - LLTexLayerSet *layer_set = getLayerSet(type); + LLViewerTexLayerSet *layer_set = getLayerSet(type); if (layer_set) { layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getWearable(wearable_type,index)); @@ -1814,15 +1817,15 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te if (isSelf()) { if (gAgentAvatarp->isUsingBakedTextures()) - { - requestLayerSetUpdate(type); - } + { + requestLayerSetUpdate(type); + } else - { - LLVisualParamHint::requestHintUpdates(); + { + LLVisualParamHint::requestHintUpdates(); + } } } - } else { tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL); @@ -1887,7 +1890,7 @@ void LLVOAvatarSelf::dumpLocalTextures() const } else { - const LLViewerFetchedTexture* image = local_tex_obj->getImage(); + const LLViewerFetchedTexture* image = dynamic_cast( local_tex_obj->getImage() ); llinfos << "LocTex " << name << ": " << "Discard " << image->getDiscardLevel() << ", " @@ -2060,7 +2063,7 @@ void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL fini mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32(); } -const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLTexLayerSet* layerset) const +const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const { std::string text=""; @@ -2283,7 +2286,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const for (U32 wearable_index = 0; wearable_index < count; ++wearable_index) { - LLWearable *wearable = gAgentWearables.getWearable(wearable_type, wearable_index); + LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, wearable_index); if (wearable) { const LLLocalTextureObject *texture = wearable->getLocalTextureObject((S32)t_index); @@ -2358,7 +2361,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 wearable_index) const { LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i); - LLWearable* wearable = gAgentWearables.getWearable(type, wearable_index); + LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_index); if (wearable) { return wearable->getLocalTextureObject(i); @@ -2371,7 +2374,7 @@ LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::E // getBakedTE() // Used by the LayerSet. (Layer sets don't in general know what textures depend on them.) //----------------------------------------------------------------------------- -ETextureIndex LLVOAvatarSelf::getBakedTE( const LLTexLayerSet* layerset ) const +ETextureIndex LLVOAvatarSelf::getBakedTE( const LLViewerTexLayerSet* layerset ) const { for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { @@ -2512,7 +2515,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const ++baked_iter) { const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first; - const LLTexLayerSet *layerset = debugGetLayerSet(baked_index); + const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); if (!layerset) continue; const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); if (!layerset_buffer) continue; @@ -2590,7 +2593,7 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) { if (texture_id == gAgentAvatarp->getTEImage(index)->getID()) { - LLTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index); + LLViewerTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index); if (layer_set) { llinfos << "TAT: rebake - matched entry " << (S32)index << llendl; @@ -2622,7 +2625,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug) for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { ETextureIndex baked_index = mBakedTextureDatas[i].mTextureIndex; - LLTexLayerSet* layer_set = getLayerSet(baked_index); + LLViewerTexLayerSet* layer_set = getLayerSet(baked_index); if (layer_set) { if (slam_for_debug) @@ -2664,7 +2667,7 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index ) } } -LLTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const +LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const { /* switch(index) case TEX_HEAD_BAKED: @@ -2679,7 +2682,7 @@ LLTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const return NULL; } -LLTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const +LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const { /* switch(index) case TEX_HEAD_BAKED: diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 92d59dc9e1..26662e8a25 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -197,13 +197,13 @@ public: /*virtual*/ bool hasPendingBakedUploads() const; S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex type, U32 index) const; bool areTexturesCurrent() const; - BOOL isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const; - BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const; + BOOL isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const; + BOOL isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const; BOOL isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const; // If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index /*virtual*/ BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const; /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; - /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const; + /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const; //-------------------------------------------------------------------- @@ -233,7 +233,7 @@ private: // Baked textures //-------------------------------------------------------------------- public: - LLVOAvatarDefines::ETextureIndex getBakedTE(const LLTexLayerSet* layerset ) const; + LLVOAvatarDefines::ETextureIndex getBakedTE(const LLViewerTexLayerSet* layerset ) const; void setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid); void setNewBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); void setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); @@ -249,14 +249,14 @@ public: void requestLayerSetUploads(); void requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i); void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i); - LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const; - LLTexLayerSet* getLayerSet(LLVOAvatarDefines::EBakedTextureIndex baked_index) const; + LLViewerTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const; + LLViewerTexLayerSet* getLayerSet(LLVOAvatarDefines::EBakedTextureIndex baked_index) const; //-------------------------------------------------------------------- // Composites //-------------------------------------------------------------------- public: - /* virtual */ void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result); + /* virtual */ void invalidateComposite(LLViewerTexLayerSet* layerset, BOOL upload_result); /* virtual */ void invalidateAll(); /* virtual */ void setCompositeUpdatesEnabled(bool b); // only works for self /* virtual */ void setCompositeUpdatesEnabled(U32 index, bool b); @@ -388,8 +388,8 @@ public: BOOL isAllLocalTextureDataFinal() const; - const LLTexLayerSet* debugGetLayerSet(LLVOAvatarDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; } - const std::string debugDumpLocalTextureDataInfo(const LLTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer + const LLViewerTexLayerSet* debugGetLayerSet(LLVOAvatarDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; } + const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD LLSD metricsData(); void sendAppearanceChangeMetrics(); // send data associated with completing a change. diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 6f6411ce3c..9f04fbecf0 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -42,7 +42,7 @@ struct LLWearableArrivedData { LLWearableArrivedData(LLAssetType::EType asset_type, const std::string& wearable_name, - void(*asset_arrived_callback)(LLWearable*, void* userdata), + void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) : mAssetType( asset_type ), mCallback( asset_arrived_callback ), @@ -52,7 +52,7 @@ struct LLWearableArrivedData {} LLAssetType::EType mAssetType; - void (*mCallback)(LLWearable*, void* userdata); + void (*mCallback)(LLViewerWearable*, void* userdata); void* mUserdata; std::string mName; S32 mRetries; @@ -72,10 +72,10 @@ void LLWearableList::cleanup() mList.clear(); } -void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata) +void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) { llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) ); - LLWearable* instance = get_if_there(mList, assetID, (LLWearable*)NULL ); + LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL ); if( instance ) { asset_arrived_callback( instance, userdata ); @@ -95,7 +95,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID { BOOL isNewWearable = FALSE; LLWearableArrivedData* data = (LLWearableArrivedData*) userdata; - LLWearable* wearable = NULL; // NULL indicates failure + LLViewerWearable* wearable = NULL; // NULL indicates failure if( !filename ) { @@ -111,7 +111,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID } else { - wearable = new LLWearable(uuid); + wearable = new LLViewerWearable(uuid); bool res = wearable->importFile( fp ); if (!res) { @@ -203,11 +203,11 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID } -LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std::string& new_name) +LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name) { lldebugs << "LLWearableList::createCopy()" << llendl; - LLWearable *wearable = generateNewWearable(); + LLViewerWearable *wearable = generateNewWearable(); wearable->copyDataFrom(old_wearable); LLPermissions perm(old_wearable->getPermissions()); @@ -222,11 +222,11 @@ LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std return wearable; } -LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) +LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) { lldebugs << "LLWearableList::createNewWearable()" << llendl; - LLWearable *wearable = generateNewWearable(); + LLViewerWearable *wearable = generateNewWearable(); wearable->setType( type ); std::string name = LLTrans::getString( LLWearableType::getTypeDefaultNewName(wearable->getType()) ); @@ -251,13 +251,13 @@ LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) return wearable; } -LLWearable *LLWearableList::generateNewWearable() +LLViewerWearable *LLWearableList::generateNewWearable() { LLTransactionID tid; tid.generate(); LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - LLWearable* wearable = new LLWearable(tid); + LLViewerWearable* wearable = new LLViewerWearable(tid); mList[new_asset_id] = wearable; return wearable; } diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index 12d0037aee..0f3078facf 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -28,7 +28,7 @@ #define LL_LLWEARABLELIST_H #include "llmemory.h" -#include "llwearable.h" +#include "llviewerwearable.h" #include "lluuid.h" #include "llassetstorage.h" @@ -51,19 +51,19 @@ public: void getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, - void(*asset_arrived_callback)(LLWearable*, void* userdata), + void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata); - LLWearable* createCopy(const LLWearable* old_wearable, const std::string& new_name = std::string()); - LLWearable* createNewWearable(LLWearableType::EType type); + LLViewerWearable* createCopy(const LLViewerWearable* old_wearable, const std::string& new_name = std::string()); + LLViewerWearable* createNewWearable(LLWearableType::EType type); // Callback static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status); protected: - LLWearable* generateNewWearable(); // used for the create... functions + LLViewerWearable* generateNewWearable(); // used for the create... functions private: - std::map mList; + std::map mList; }; #endif // LL_LLWEARABLELIST_H diff --git a/indra/newview/llwearabletype.cpp b/indra/newview/llwearabletype.cpp deleted file mode 100644 index c090ab5c3d..0000000000 --- a/indra/newview/llwearabletype.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file llwearabletype.cpp - * @brief LLWearableType class implementation - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llwearabletype.h" -#include "llinventoryfunctions.h" -#include "lltrans.h" - -struct WearableEntry : public LLDictionaryEntry -{ - WearableEntry(const std::string &name, - const std::string& default_new_name, - LLAssetType::EType assetType, - LLInventoryIcon::EIconName iconName, - BOOL disable_camera_switch = FALSE, - BOOL allow_multiwear = TRUE) : - LLDictionaryEntry(name), - mAssetType(assetType), - mDefaultNewName(default_new_name), - mLabel(LLTrans::getString(name)), - mIconName(iconName), - mDisableCameraSwitch(disable_camera_switch), - mAllowMultiwear(allow_multiwear) - { - - } - const LLAssetType::EType mAssetType; - const std::string mLabel; - const std::string mDefaultNewName; //keep mLabel for backward compatibility - LLInventoryIcon::EIconName mIconName; - BOOL mDisableCameraSwitch; - BOOL mAllowMultiwear; -}; - -class LLWearableDictionary : public LLSingleton, - public LLDictionary -{ -public: - LLWearableDictionary(); -}; - -LLWearableDictionary::LLWearableDictionary() -{ - addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SHAPE, FALSE, FALSE)); - addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SKIN, FALSE, FALSE)); - addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_HAIR, FALSE, FALSE)); - addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_EYES, FALSE, FALSE)); - addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE)); - addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_PANTS, FALSE, TRUE)); - addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHOES, FALSE, TRUE)); - addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE)); - addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_JACKET, FALSE, TRUE)); - addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE)); - addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE)); - addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE)); - addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE)); - addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE)); - addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE)); - - addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE)); - - addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE, FALSE, FALSE)); - addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE, FALSE, FALSE)); -} - -// static -LLWearableType::EType LLWearableType::typeNameToType(const std::string& type_name) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const LLWearableType::EType wearable = dict->lookup(type_name); - return wearable; -} - -// static -const std::string& LLWearableType::getTypeName(LLWearableType::EType type) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const WearableEntry *entry = dict->lookup(type); - if (!entry) return getTypeName(WT_INVALID); - return entry->mName; -} - -//static -const std::string& LLWearableType::getTypeDefaultNewName(LLWearableType::EType type) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const WearableEntry *entry = dict->lookup(type); - if (!entry) return getTypeDefaultNewName(WT_INVALID); - return entry->mDefaultNewName; -} - -// static -const std::string& LLWearableType::getTypeLabel(LLWearableType::EType type) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const WearableEntry *entry = dict->lookup(type); - if (!entry) return getTypeLabel(WT_INVALID); - return entry->mLabel; -} - -// static -LLAssetType::EType LLWearableType::getAssetType(LLWearableType::EType type) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const WearableEntry *entry = dict->lookup(type); - if (!entry) return getAssetType(WT_INVALID); - return entry->mAssetType; -} - -// static -LLInventoryIcon::EIconName LLWearableType::getIconName(LLWearableType::EType type) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const WearableEntry *entry = dict->lookup(type); - if (!entry) return getIconName(WT_INVALID); - return entry->mIconName; -} - -// static -BOOL LLWearableType::getDisableCameraSwitch(LLWearableType::EType type) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const WearableEntry *entry = dict->lookup(type); - if (!entry) return FALSE; - return entry->mDisableCameraSwitch; -} - -// static -BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type) -{ - const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); - const WearableEntry *entry = dict->lookup(type); - if (!entry) return FALSE; - return entry->mAllowMultiwear; -} - diff --git a/indra/newview/llwearabletype.h b/indra/newview/llwearabletype.h deleted file mode 100644 index d633b4807e..0000000000 --- a/indra/newview/llwearabletype.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file llwearabletype.h - * @brief LLWearableType class header file - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLWEARABLETYPE_H -#define LL_LLWEARABLETYPE_H - -#include "llassettype.h" -#include "lldictionary.h" -#include "llinventoryicon.h" -#include "llsingleton.h" - -class LLWearableType -{ -public: - enum EType - { - WT_SHAPE = 0, - WT_SKIN = 1, - WT_HAIR = 2, - WT_EYES = 3, - WT_SHIRT = 4, - WT_PANTS = 5, - WT_SHOES = 6, - WT_SOCKS = 7, - WT_JACKET = 8, - WT_GLOVES = 9, - WT_UNDERSHIRT = 10, - WT_UNDERPANTS = 11, - WT_SKIRT = 12, - WT_ALPHA = 13, - WT_TATTOO = 14, - WT_PHYSICS = 15, - WT_COUNT = 16, - - WT_INVALID = 255, - WT_NONE = -1, - }; - - static const std::string& getTypeName(EType type); - static const std::string& getTypeDefaultNewName(EType type); - static const std::string& getTypeLabel(EType type); - static LLAssetType::EType getAssetType(EType type); - static EType typeNameToType(const std::string& type_name); - static LLInventoryIcon::EIconName getIconName(EType type); - static BOOL getDisableCameraSwitch(EType type); - static BOOL getAllowMultiwear(EType type); - -protected: - LLWearableType() {} - ~LLWearableType() {} -}; - -#endif // LL_LLWEARABLETYPE_H -- cgit v1.2.3 From 0c7623f628cbba999860379a2f5c302d94c1d287 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 08:37:58 +0000 Subject: Cleanup of llappearance refactor file definition order for easier diff'ing --- indra/newview/llviewertexlayer.cpp | 280 ++++++++++++++++++++----------------- indra/newview/llviewertexlayer.h | 2 +- indra/newview/llviewerwearable.cpp | 134 +++++++++--------- indra/newview/llviewerwearable.h | 14 +- indra/newview/llvoavatar.cpp | 1 + indra/newview/llvoavatar.h | 3 + 6 files changed, 231 insertions(+), 203 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index f805083aaa..3a3cae4047 100644 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -26,19 +26,19 @@ #include "llviewerprecompiledheaders.h" +#include "llviewertexlayer.h" + #include "llagent.h" -#include "llassetuploadresponders.h" -#include "llavatarappearance.h" -#include "llglslshader.h" #include "llimagej2c.h" #include "llnotificationsutil.h" -#include "llviewercontrol.h" -#include "llviewerregion.h" -#include "llviewertexlayer.h" #include "llvfile.h" #include "llvfs.h" +#include "llviewerregion.h" +#include "llglslshader.h" #include "llvoavatarself.h" #include "pipeline.h" +#include "llassetuploadresponders.h" +#include "llviewercontrol.h" static const S32 BAKE_UPLOAD_ATTEMPTS = 7; static const F32 BAKE_UPLOAD_RETRY_DELAY = 2.f; // actual delay grows by power of 2 each attempt @@ -46,126 +46,6 @@ static const F32 BAKE_UPLOAD_RETRY_DELAY = 2.f; // actual delay grows by power o // runway consolidate extern std::string self_av_string(); -LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) : - LLTexLayerSet(appearance), - mComposite( NULL ), - mUpdatesEnabled( FALSE ) -{ -} - -// virtual -LLViewerTexLayerSet::~LLViewerTexLayerSet() -{ -} - -void LLViewerTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) -{ - memset(data, 255, width * height); - - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - layer->gatherAlphaMasks(data, mComposite->getOriginX(),mComposite->getOriginY(), width, height); - } - - // Set alpha back to that of our alpha masks. - renderAlphaMaskTextures(mComposite->getOriginX(), mComposite->getOriginY(), width, height, true); -} - -LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() -{ - if (!mComposite) - { - createComposite(); - } - return mComposite; -} - -const LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() const -{ - return mComposite; -} - -// virtual -void LLViewerTexLayerSet::requestUpdate() -{ - if( mUpdatesEnabled ) - { - createComposite(); - mComposite->requestUpdate(); - } -} - -void LLViewerTexLayerSet::requestUpload() -{ - createComposite(); - mComposite->requestUpload(); -} - -void LLViewerTexLayerSet::cancelUpload() -{ - if(mComposite) - { - mComposite->cancelUpload(); - } -} - - -void LLViewerTexLayerSet::createComposite() -{ - if(!mComposite) - { - S32 width = mInfo->getWidth(); - S32 height = mInfo->getHeight(); - // Composite other avatars at reduced resolution - if( !mAvatarAppearance->isSelf() ) - { - llerrs << "composites should not be created for non-self avatars!" << llendl; - } - mComposite = new LLTexLayerSetBuffer( this, width, height ); - } -} - -void LLViewerTexLayerSet::updateComposite() -{ - createComposite(); - mComposite->requestUpdateImmediate(); -} - -// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on. -BOOL LLViewerTexLayerSet::isLocalTextureDataAvailable() const -{ - if (!mAvatarAppearance->isSelf()) return FALSE; - LLVOAvatarSelf* self = dynamic_cast(mAvatarAppearance); - return self->isLocalTextureDataAvailable(this); -} - - -// Returns TRUE if all of the data for the textures that this layerset depends on have arrived. -BOOL LLViewerTexLayerSet::isLocalTextureDataFinal() const -{ - if (!mAvatarAppearance->isSelf()) return FALSE; - LLVOAvatarSelf* self = dynamic_cast(mAvatarAppearance); - return self->isLocalTextureDataFinal(this); -} - -void LLViewerTexLayerSet::destroyComposite() -{ - if( mComposite ) - { - mComposite = NULL; - } -} - -void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b ) -{ - mUpdatesEnabled = b; -} - -LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const -{ - return dynamic_cast (mAvatarAppearance); -} //----------------------------------------------------------------------------- // LLBakedUploadData() @@ -693,7 +573,7 @@ void LLTexLayerSetBuffer::doUpdate() // need to switch to using this layerset if this is the first update // after getting the lowest LOD - mTexLayerSet->getAvatarAppearance()->updateMeshTextures(); + mTexLayerSet->getAvatar()->updateMeshTextures(); // Print out notification that we updated this texture. if (gSavedSettings.getBOOL("DebugAvatarRezTime")) @@ -701,7 +581,7 @@ void LLTexLayerSetBuffer::doUpdate() const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatarAppearance()->debugGetExistenceTimeElapsedF32()); + args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32()); args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32()); args["BODYREGION"] = mTexLayerSet->getBodyRegionName(); args["RESOLUTION"] = lod_str; @@ -786,6 +666,150 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, delete baked_upload_data; } +//----------------------------------------------------------------------------- +// LLViewerTexLayerSet +// An ordered set of texture layers that get composited into a single texture. +//----------------------------------------------------------------------------- + +LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) : + LLTexLayerSet(appearance), + mComposite( NULL ), + mUpdatesEnabled( FALSE ) +{ +} + +// virtual +LLViewerTexLayerSet::~LLViewerTexLayerSet() +{ +} + +// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on. +BOOL LLViewerTexLayerSet::isLocalTextureDataAvailable() const +{ + if (!mAvatarAppearance->isSelf()) return FALSE; + return getAvatar()->isLocalTextureDataAvailable(this); +} + + +// Returns TRUE if all of the data for the textures that this layerset depends on have arrived. +BOOL LLViewerTexLayerSet::isLocalTextureDataFinal() const +{ + if (!mAvatarAppearance->isSelf()) return FALSE; + return getAvatar()->isLocalTextureDataFinal(this); +} + +// virtual +void LLViewerTexLayerSet::requestUpdate() +{ + if( mUpdatesEnabled ) + { + createComposite(); + mComposite->requestUpdate(); + } +} + +void LLViewerTexLayerSet::requestUpload() +{ + createComposite(); + mComposite->requestUpload(); +} + +void LLViewerTexLayerSet::cancelUpload() +{ + if(mComposite) + { + mComposite->cancelUpload(); + } +} + +void LLViewerTexLayerSet::createComposite() +{ + if(!mComposite) + { + S32 width = mInfo->getWidth(); + S32 height = mInfo->getHeight(); + // Composite other avatars at reduced resolution + if( !mAvatarAppearance->isSelf() ) + { + llerrs << "composites should not be created for non-self avatars!" << llendl; + } + mComposite = new LLTexLayerSetBuffer( this, width, height ); + } +} + +void LLViewerTexLayerSet::destroyComposite() +{ + if( mComposite ) + { + mComposite = NULL; + } +} + +void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b ) +{ + mUpdatesEnabled = b; +} + +void LLViewerTexLayerSet::updateComposite() +{ + createComposite(); + mComposite->requestUpdateImmediate(); +} +LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() +{ + if (!mComposite) + { + createComposite(); + } + return mComposite; +} +const LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() const +{ + return mComposite; +} + +void LLViewerTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) +{ + memset(data, 255, width * height); + + for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + { + LLTexLayerInterface* layer = *iter; + layer->gatherAlphaMasks(data, mComposite->getOriginX(),mComposite->getOriginY(), width, height); + } + + // Set alpha back to that of our alpha masks. + renderAlphaMaskTextures(mComposite->getOriginX(), mComposite->getOriginY(), width, height, true); +} + + +LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const +{ + return dynamic_cast (mAvatarAppearance); +} + + + +const std::string LLTexLayerSetBuffer::dumpTextureInfo() const +{ + if (!isAgentAvatarValid()) return ""; + + const BOOL is_high_res = !mNeedsUpload; + const U32 num_low_res = mNumLowresUploads; + const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32(); + const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet); + + std::string status = "CREATING "; + if (!uploadNeeded()) status = "DONE "; + if (uploadInProgress()) status = "UPLOADING"; + + std::string text = llformat("[%s] [HiRes:%d LoRes:%d] [Elapsed:%d] %s", + status.c_str(), + is_high_res, num_low_res, + upload_time, + local_texture_info.c_str()); + return text; +} diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index ff3def5a82..125bf82adf 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -30,8 +30,8 @@ #include "lldynamictexture.h" #include "lltexlayer.h" -class LLTexLayerSetBuffer; class LLVOAvatarSelf; +class LLTexLayerSetBuffer; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLViewerTexLayerSet diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index b63f1f57cb..2b6649a7ec 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -33,11 +33,11 @@ #include "llnotificationsutil.h" #include "llsidepanelappearance.h" #include "lltextureentry.h" -#include "llviewercontrol.h" #include "llviewertexlayer.h" -#include "llviewerwearable.h" #include "llvoavatarself.h" #include "llvoavatardefines.h" +#include "llviewerwearable.h" +#include "llviewercontrol.h" using namespace LLVOAvatarDefines; @@ -89,11 +89,6 @@ LLViewerWearable::~LLViewerWearable() { } -void LLViewerWearable::setItemID(const LLUUID& item_id) -{ - mItemID = item_id; -} - // virtual BOOL LLViewerWearable::exportFile(LLFILE* file) const { @@ -107,6 +102,40 @@ BOOL LLViewerWearable::exportFile(LLFILE* file) const return LLWearable::exportFile(file); } + +void LLViewerWearable::createVisualParams() +{ + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) + { + if (param->getWearableType() == mType) + { + addVisualParam(param->cloneParam(this)); + } + } + + // resync driver parameters to point to the newly cloned driven parameters + for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); + param_iter != mVisualParamIndexMap.end(); + ++param_iter) + { + LLVisualParam* param = param_iter->second; + LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; + // need this line to disambiguate between versions of LLCharacter::getVisualParam() + LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; + param->resetDrivenParams(); + if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) + { + if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) + { + llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; + continue; + } + } + } +} + // virtual LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) { @@ -159,6 +188,7 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) return result; } + // Avatar parameter and texture definitions can change over time. // This function returns true if parameters or textures have been added or removed // since this wearable was created. @@ -492,6 +522,11 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) revertValues(); } +void LLViewerWearable::setItemID(const LLUUID& item_id) +{ + mItemID = item_id; +} + LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) { @@ -538,6 +573,17 @@ void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject < mTEMap[index] = new LLLocalTextureObject(lto); } +void LLViewerWearable::setVisualParams() +{ + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) + { + S32 id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 value = wearable_param->getWeight(); + gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + } +} + void LLViewerWearable::revertValues() { //update saved settings so wearable is no longer dirty @@ -591,6 +637,19 @@ BOOL LLViewerWearable::isOnTop() const return (this == gAgentWearables.getTopWearable(mType)); } +void LLViewerWearable::createLayers(S32 te) +{ + LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); + if (layer_set) + { + layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); + } + else + { + llerrs << "could not find layerset for LTO in wearable!" << llendl; + } +} + void LLViewerWearable::saveValues() { //update saved settings so wearable is no longer dirty @@ -702,7 +761,6 @@ void LLViewerWearable::setLabelUpdated() const gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID()); } - void LLViewerWearable::refreshName() { LLUUID item_id = getItemID(); @@ -802,65 +860,6 @@ void LLViewerWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* } -void LLViewerWearable::createLayers(S32 te) -{ - LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); - if (layer_set) - { - layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); - } - else - { - llerrs << "could not find layerset for LTO in wearable!" << llendl; - } -} - -void LLViewerWearable::createVisualParams() -{ - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if (param->getWearableType() == mType) - { - addVisualParam(param->cloneParam(this)); - } - } - - // resync driver parameters to point to the newly cloned driven parameters - for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); - param_iter != mVisualParamIndexMap.end(); - ++param_iter) - { - LLVisualParam* param = param_iter->second; - LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; - // need this line to disambiguate between versions of LLCharacter::getVisualParam() - LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; - param->resetDrivenParams(); - if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) - { - if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) - { - llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; - continue; - } - } - } -} - -void LLViewerWearable::setVisualParams() -{ - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - gAgentAvatarp->setVisualParamWeight(id, value, FALSE); - } -} - - - std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w) { s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n"; @@ -897,4 +896,3 @@ std::string asset_id_to_filename(const LLUUID &asset_id) std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl"; return filename; } - diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index 857900f583..a921f82e7d 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -54,8 +54,6 @@ public: void setItemID(const LLUUID& item_id); public: - /*virtual*/ BOOL exportFile(LLFILE* file) const; - /*virtual*/ EImportResult importFile(LLFILE* file); BOOL isDirty() const; BOOL isOldVersion() const; @@ -64,6 +62,9 @@ public: void removeFromAvatar( BOOL upload_bake ) { LLViewerWearable::removeFromAvatar( mType, upload_bake ); } static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ); + /*virtual*/ BOOL exportFile(LLFILE* file) const; + /*virtual*/ EImportResult importFile(LLFILE* file); + void setParamsToDefaults(); void setTexturesToDefaults(); @@ -81,6 +82,7 @@ public: const LLLocalTextureObject* getLocalTextureObject(S32 index) const; std::vector getLocalTextureListSeq(); void setLocalTextureObject(S32 index, LLLocalTextureObject <o); + void setVisualParams(); void revertValues(); void saveValues(); @@ -96,19 +98,19 @@ public: void refreshName(); protected: + typedef std::map te_map_t; + void createLayers(S32 te); /*virtual*/void createVisualParams(); - void setVisualParams(); - typedef std::map te_map_t; void syncImages(te_map_t &src, te_map_t &dst); void destroyTextures(); - LLTransactionID mTransactionID; LLAssetID mAssetID; - LLUUID mItemID; // ID of the inventory item in the agent's inventory + LLTransactionID mTransactionID; te_map_t mTEMap; // maps TE to LocalTextureObject te_map_t mSavedTEMap; // last saved version of TEMap + LLUUID mItemID; // ID of the inventory item in the agent's inventory }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dac479b2e0..e3d8f9135e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -764,6 +764,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mRuthTimer.reset(); mRuthDebugTimer.reset(); + mDebugExistenceTimer.reset(); mPelvisOffset = LLVector3(0.0f,0.0f,0.0f); mLastPelvisToFoot = 0.0f; mPelvisFixup = 0.0f; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 023711d81b..512522803a 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -1038,9 +1038,12 @@ private: //-------------------------------------------------------------------- public: void debugAvatarRezTime(std::string notification_name, std::string comment = ""); + F32 debugGetExistenceTimeElapsedF32() const { return mDebugExistenceTimer.getElapsedTimeF32(); } + protected: LLFrameTimer mRuthDebugTimer; // For tracking how long it takes for av to rez + LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory. /** Diagnostics ** ** -- cgit v1.2.3 From 21c364c4d455cc05ec176032e8c090be0cc4ed50 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 09:10:24 +0000 Subject: Renamed LLVOAvatarDefines to LLAvatarAppearanceDefines --- indra/newview/llagent.cpp | 10 +-- indra/newview/llagent.h | 4 +- indra/newview/llagentcamera.cpp | 2 +- indra/newview/llagentwearables.cpp | 12 +-- indra/newview/llagentwearables.h | 6 +- indra/newview/llappearance.h | 8 +- indra/newview/llavatariconctrl.cpp | 2 +- indra/newview/llfloateravatartextures.cpp | 10 +-- indra/newview/llfloateravatartextures.h | 4 +- indra/newview/lllocalbitmaps.cpp | 100 +++++++++++----------- indra/newview/lllocalbitmaps.h | 4 +- indra/newview/llpaneleditwearable.cpp | 20 ++--- indra/newview/llpaneleditwearable.h | 12 +-- indra/newview/lltextureview.cpp | 6 +- indra/newview/llviewermenu.cpp | 4 +- indra/newview/llviewertexlayer.cpp | 4 +- indra/newview/llviewerwearable.cpp | 26 +++--- indra/newview/llviewerwearable.h | 4 +- indra/newview/llvoavatar.cpp | 102 +++++++++++------------ indra/newview/llvoavatar.h | 30 +++---- indra/newview/llvoavatarself.cpp | 132 +++++++++++++++--------------- indra/newview/llvoavatarself.h | 58 ++++++------- 22 files changed, 280 insertions(+), 280 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2379c23969..4e05836bca 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -92,7 +92,7 @@ #include "llworldmap.h" #include "stringize.h" -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; extern LLMenuBarGL* gMenuBarView; @@ -3654,7 +3654,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * if ((S32)texture_index < TEX_NUM_INDICES ) { - const LLVOAvatarDictionary::TextureEntry *texture_entry = LLVOAvatarDictionary::instance().getTexture((ETextureIndex)texture_index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_entry = LLAvatarAppearanceDictionary::instance().getTexture((ETextureIndex)texture_index); if (texture_entry) { EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex; @@ -4303,7 +4303,7 @@ void LLAgent::sendAgentSetAppearance() for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ ) { - const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); + const ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); // if we're not wearing a skirt, we don't need the texture to be baked if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT)) @@ -4326,7 +4326,7 @@ void LLAgent::sendAgentSetAppearance() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { BOOL generate_valid_hash = TRUE; - if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLVOAvatarDefines::EBakedTextureIndex)baked_index)) + if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLAvatarAppearanceDefines::EBakedTextureIndex)baked_index)) { generate_valid_hash = FALSE; LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << LL_ENDL; @@ -4335,7 +4335,7 @@ void LLAgent::sendAgentSetAppearance() const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash); if (hash.notNull()) { - ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index); + ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index); msg->nextBlockFast(_PREHASH_WearableData); msg->addUUIDFast(_PREHASH_CacheID, hash); msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 99904e118c..f784262e90 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -33,7 +33,7 @@ #include "llagentdata.h" // gAgentID, gAgentSessionID #include "llcharacter.h" #include "llcoordframe.h" // for mFrameAgent -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" #include #include @@ -901,7 +901,7 @@ private: S32 mNumPendingQueries; S32 mWearablesCacheQueryID; U32 mUpdateSerialNum; - S32 mActiveCacheQueries[LLVOAvatarDefines::BAKED_NUM_INDICES]; + S32 mActiveCacheQueries[LLAvatarAppearanceDefines::BAKED_NUM_INDICES]; }; extern LLAgentQueryManager gAgentQueryManager; diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index a544909e66..e1ef0d5399 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -49,7 +49,7 @@ #include "llwindow.h" #include "llworld.h" -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; extern LLMenuBarGL* gMenuBarView; diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e4f02b9f0b..2202d65380 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -56,7 +56,7 @@ LLAgentWearables gAgentWearables; BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE; -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; /////////////////////////////////////////////////////////////////////////////// @@ -903,7 +903,7 @@ U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const U32 LLAgentWearables::getWearableCount(const U32 tex_index) const { - const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index); + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index); return getWearableCount(wearable_type); } @@ -1093,7 +1093,7 @@ void LLAgentWearables::recoverMissingWearableDone() } } -void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index) +void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index) { LLViewerWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index); if (!wearable) @@ -1626,7 +1626,7 @@ void LLAgentWearables::queryWearableCache() num_queries++; // *NOTE: make sure at least one request gets packed - ETextureIndex te_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); + ETextureIndex te_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); //llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl; gMessageSystem->nextBlockFast(_PREHASH_WearableData); @@ -1652,13 +1652,13 @@ void LLAgentWearables::queryWearableCache() } } -LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index, +LLUUID LLAgentWearables::computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index, BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache { LLUUID hash_id; bool hash_computed = false; LLMD5 hash; - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index); for (U8 i=0; i < baked_dict->mWearables.size(); i++) { diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 3df552544b..423e23018e 100755 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -36,7 +36,7 @@ // newview #include "llinventorymodel.h" #include "llviewerinventory.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" class LLInventoryItem; class LLVOAvatarSelf; @@ -122,7 +122,7 @@ public: void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false); void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove); void setWearableName(const LLUUID& item_id, const std::string& new_name); - void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index); + void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index); U32 getWearableIndex(const LLViewerWearable *wearable) const; protected: @@ -171,7 +171,7 @@ protected: public: // Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant) static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data); - LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index, + LLUUID computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index, BOOL generate_valid_hash = TRUE); protected: diff --git a/indra/newview/llappearance.h b/indra/newview/llappearance.h index a28b77b1fc..05dfac4e42 100644 --- a/indra/newview/llappearance.h +++ b/indra/newview/llappearance.h @@ -38,14 +38,14 @@ public: void addParam( S32 id, F32 value ) { mParamMap[id] = value; } F32 getParam( S32 id, F32 defval ) { return get_if_there(mParamMap, id, defval ); } - void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLVOAvatarDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; } - const LLUUID& getTexture( S32 te ) { return ( te < LLVOAvatarDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; } + void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; } + const LLUUID& getTexture( S32 te ) { return ( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; } - void clear() { mParamMap.clear(); for( S32 i=0; i param_map_t; param_map_t mParamMap; - LLUUID mTextures[LLVOAvatarDefines::TEX_NUM_INDICES]; + LLUUID mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES]; }; #endif // LL_LLAPPEARANCE_H diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index d2acd32713..76f10e2d56 100755 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -38,7 +38,7 @@ #include "llagentdata.h" #include "llimfloater.h" #include "llviewertexture.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" // library includes #include "llavatarnamecache.h" diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index b26b302ea6..68bdf9a8d6 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -38,7 +38,7 @@ #include "llviewerobjectlist.h" #include "llvoavatarself.h" -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLSD& id) : LLFloater(id), @@ -54,7 +54,7 @@ BOOL LLFloaterAvatarTextures::postBuild() { for (U32 i=0; i < TEX_NUM_INDICES; i++) { - const std::string tex_name = LLVOAvatarDictionary::getInstance()->getTexture(ETextureIndex(i))->mName; + const std::string tex_name = LLAvatarAppearanceDictionary::getInstance()->getTexture(ETextureIndex(i))->mName; mTextures[i] = getChild(tex_name); } mTitle = getTitle(); @@ -76,7 +76,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp, ETextureIndex te) { LLUUID id = IMG_DEFAULT_AVATAR; - const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture(te); + const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture(te); if (tex_entry->mIsLocalTexture) { if (avatarp->isSelf()) @@ -164,14 +164,14 @@ void LLFloaterAvatarTextures::onClickDump(void* data) const LLTextureEntry* te = avatarp->getTE(i); if (!te) continue; - const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)(i)); + const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)(i)); if (!tex_entry) continue; if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i)) { LLUUID id = IMG_DEFAULT_AVATAR; - LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i); + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((ETextureIndex)i); if (avatarp->isSelf()) { LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); diff --git a/indra/newview/llfloateravatartextures.h b/indra/newview/llfloateravatartextures.h index 85ff545855..02474a10e1 100644 --- a/indra/newview/llfloateravatartextures.h +++ b/indra/newview/llfloateravatartextures.h @@ -30,7 +30,7 @@ #include "llfloater.h" #include "lluuid.h" #include "llstring.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" class LLTextureCtrl; @@ -51,7 +51,7 @@ private: private: LLUUID mID; std::string mTitle; - LLTextureCtrl* mTextures[LLVOAvatarDefines::TEX_NUM_INDICES]; + LLTextureCtrl* mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES]; }; #endif diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 097c751386..fce4c29870 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -495,11 +495,11 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp if (lto && lto->getID() == old_id) { U32 local_texlayer_index = 0; /* can't keep that as static const, gives errors, so i'm leaving this var here */ - LLVOAvatarDefines::EBakedTextureIndex baked_texind = + LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind = lto->getTexLayer(local_texlayer_index)->getTexLayerSet()->getBakedTexIndex(); - LLVOAvatarDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind); - if (reg_texind != LLVOAvatarDefines::TEX_NUM_INDICES) + LLAvatarAppearanceDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind); + if (reg_texind != LLAvatarAppearanceDefines::TEX_NUM_INDICES) { U32 index = gAgentWearables.getWearableIndex(wearable); gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index); @@ -515,10 +515,10 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp } } -LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( - LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind) +LLAvatarAppearanceDefines::ETextureIndex LLLocalBitmap::getTexIndex( + LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind) { - LLVOAvatarDefines::ETextureIndex result = LLVOAvatarDefines::TEX_NUM_INDICES; // using as a default/fail return. + LLAvatarAppearanceDefines::ETextureIndex result = LLAvatarAppearanceDefines::TEX_NUM_INDICES; // using as a default/fail return. switch(type) { @@ -526,32 +526,32 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( { switch(baked_texind) { - case LLVOAvatarDefines::BAKED_EYES: + case LLAvatarAppearanceDefines::BAKED_EYES: { - result = LLVOAvatarDefines::TEX_EYES_ALPHA; + result = LLAvatarAppearanceDefines::TEX_EYES_ALPHA; break; } - case LLVOAvatarDefines::BAKED_HAIR: + case LLAvatarAppearanceDefines::BAKED_HAIR: { - result = LLVOAvatarDefines::TEX_HAIR_ALPHA; + result = LLAvatarAppearanceDefines::TEX_HAIR_ALPHA; break; } - case LLVOAvatarDefines::BAKED_HEAD: + case LLAvatarAppearanceDefines::BAKED_HEAD: { - result = LLVOAvatarDefines::TEX_HEAD_ALPHA; + result = LLAvatarAppearanceDefines::TEX_HEAD_ALPHA; break; } - case LLVOAvatarDefines::BAKED_LOWER: + case LLAvatarAppearanceDefines::BAKED_LOWER: { - result = LLVOAvatarDefines::TEX_LOWER_ALPHA; + result = LLAvatarAppearanceDefines::TEX_LOWER_ALPHA; break; } - case LLVOAvatarDefines::BAKED_UPPER: + case LLAvatarAppearanceDefines::BAKED_UPPER: { - result = LLVOAvatarDefines::TEX_UPPER_ALPHA; + result = LLAvatarAppearanceDefines::TEX_UPPER_ALPHA; break; } @@ -567,9 +567,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_EYES: { - if (baked_texind == LLVOAvatarDefines::BAKED_EYES) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_EYES) { - result = LLVOAvatarDefines::TEX_EYES_IRIS; + result = LLAvatarAppearanceDefines::TEX_EYES_IRIS; } break; @@ -577,9 +577,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_GLOVES: { - if (baked_texind == LLVOAvatarDefines::BAKED_UPPER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER) { - result = LLVOAvatarDefines::TEX_UPPER_GLOVES; + result = LLAvatarAppearanceDefines::TEX_UPPER_GLOVES; } break; @@ -587,13 +587,13 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_JACKET: { - if (baked_texind == LLVOAvatarDefines::BAKED_LOWER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER) { - result = LLVOAvatarDefines::TEX_LOWER_JACKET; + result = LLAvatarAppearanceDefines::TEX_LOWER_JACKET; } - else if (baked_texind == LLVOAvatarDefines::BAKED_UPPER) + else if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER) { - result = LLVOAvatarDefines::TEX_UPPER_JACKET; + result = LLAvatarAppearanceDefines::TEX_UPPER_JACKET; } break; @@ -601,9 +601,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_PANTS: { - if (baked_texind == LLVOAvatarDefines::BAKED_LOWER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER) { - result = LLVOAvatarDefines::TEX_LOWER_PANTS; + result = LLAvatarAppearanceDefines::TEX_LOWER_PANTS; } break; @@ -611,9 +611,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_SHIRT: { - if (baked_texind == LLVOAvatarDefines::BAKED_UPPER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER) { - result = LLVOAvatarDefines::TEX_UPPER_SHIRT; + result = LLAvatarAppearanceDefines::TEX_UPPER_SHIRT; } break; @@ -621,9 +621,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_SHOES: { - if (baked_texind == LLVOAvatarDefines::BAKED_LOWER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER) { - result = LLVOAvatarDefines::TEX_LOWER_SHOES; + result = LLAvatarAppearanceDefines::TEX_LOWER_SHOES; } break; @@ -633,20 +633,20 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( { switch(baked_texind) { - case LLVOAvatarDefines::BAKED_HEAD: + case LLAvatarAppearanceDefines::BAKED_HEAD: { - result = LLVOAvatarDefines::TEX_HEAD_BODYPAINT; + result = LLAvatarAppearanceDefines::TEX_HEAD_BODYPAINT; break; } - case LLVOAvatarDefines::BAKED_LOWER: + case LLAvatarAppearanceDefines::BAKED_LOWER: { - result = LLVOAvatarDefines::TEX_LOWER_BODYPAINT; + result = LLAvatarAppearanceDefines::TEX_LOWER_BODYPAINT; break; } - case LLVOAvatarDefines::BAKED_UPPER: + case LLAvatarAppearanceDefines::BAKED_UPPER: { - result = LLVOAvatarDefines::TEX_UPPER_BODYPAINT; + result = LLAvatarAppearanceDefines::TEX_UPPER_BODYPAINT; break; } @@ -661,9 +661,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_SKIRT: { - if (baked_texind == LLVOAvatarDefines::BAKED_SKIRT) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_SKIRT) { - result = LLVOAvatarDefines::TEX_SKIRT; + result = LLAvatarAppearanceDefines::TEX_SKIRT; } break; @@ -671,9 +671,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_SOCKS: { - if (baked_texind == LLVOAvatarDefines::BAKED_LOWER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER) { - result = LLVOAvatarDefines::TEX_LOWER_SOCKS; + result = LLAvatarAppearanceDefines::TEX_LOWER_SOCKS; } break; @@ -683,20 +683,20 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( { switch(baked_texind) { - case LLVOAvatarDefines::BAKED_HEAD: + case LLAvatarAppearanceDefines::BAKED_HEAD: { - result = LLVOAvatarDefines::TEX_HEAD_TATTOO; + result = LLAvatarAppearanceDefines::TEX_HEAD_TATTOO; break; } - case LLVOAvatarDefines::BAKED_LOWER: + case LLAvatarAppearanceDefines::BAKED_LOWER: { - result = LLVOAvatarDefines::TEX_LOWER_TATTOO; + result = LLAvatarAppearanceDefines::TEX_LOWER_TATTOO; break; } - case LLVOAvatarDefines::BAKED_UPPER: + case LLAvatarAppearanceDefines::BAKED_UPPER: { - result = LLVOAvatarDefines::TEX_UPPER_TATTOO; + result = LLAvatarAppearanceDefines::TEX_UPPER_TATTOO; break; } @@ -711,9 +711,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_UNDERPANTS: { - if (baked_texind == LLVOAvatarDefines::BAKED_LOWER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER) { - result = LLVOAvatarDefines::TEX_LOWER_UNDERPANTS; + result = LLAvatarAppearanceDefines::TEX_LOWER_UNDERPANTS; } break; @@ -721,9 +721,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex( case LLWearableType::WT_UNDERSHIRT: { - if (baked_texind == LLVOAvatarDefines::BAKED_UPPER) + if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER) { - result = LLVOAvatarDefines::TEX_UPPER_UNDERSHIRT; + result = LLAvatarAppearanceDefines::TEX_UPPER_UNDERSHIRT; } break; diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index df031de3cb..ca12fe2045 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -30,7 +30,7 @@ #include "lleventtimer.h" #include "llwearabletype.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" class LLScrollListCtrl; class LLViewerObject; @@ -64,7 +64,7 @@ class LLLocalBitmap void updateUserPrims(LLUUID old_id, LLUUID new_id); void updateUserSculpts(LLUUID old_id, LLUUID new_id); void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type); - LLVOAvatarDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind); + LLAvatarAppearanceDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind); private: /* private enums */ enum ELinkStatus diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 44b56afb1a..225996b5ce 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -104,7 +104,7 @@ enum ESubpart { SUBPART_PHYSICS_ADVANCED, }; -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; typedef std::vector subpart_vec_t; @@ -762,11 +762,11 @@ BOOL LLPanelEditWearable::postBuild() mWearablePtr = NULL; - configureAlphaCheckbox(LLVOAvatarDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible"); - configureAlphaCheckbox(LLVOAvatarDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible"); - configureAlphaCheckbox(LLVOAvatarDefines::TEX_HEAD_ALPHA, "head alpha texture invisible"); - configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible"); - configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible"); + configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible"); + configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible"); + configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_HEAD_ALPHA, "head alpha texture invisible"); + configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_EYES_ALPHA, "eye alpha texture invisible"); + configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible"); // configure tab expanded callbacks for (U32 type_index = 0; type_index < (U32)LLWearableType::WT_COUNT; ++type_index) @@ -1505,7 +1505,7 @@ void LLPanelEditWearable::updateVerbs() } } -void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name) +void LLPanelEditWearable::configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name) { LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild(name); checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te)); @@ -1513,7 +1513,7 @@ void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureInde mAlphaCheckbox2Index[name] = te; } -void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te) +void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te) { if (!checkbox_ctrl) return; if (!getWearable()) return; @@ -1557,7 +1557,7 @@ void LLPanelEditWearable::updateAlphaCheckboxes() for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin(); iter != mAlphaCheckbox2Index.end(); ++iter ) { - LLVOAvatarDefines::ETextureIndex te = (LLVOAvatarDefines::ETextureIndex)iter->second; + LLAvatarAppearanceDefines::ETextureIndex te = (LLAvatarAppearanceDefines::ETextureIndex)iter->second; LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild(iter->first); if (ctrl) { @@ -1575,7 +1575,7 @@ void LLPanelEditWearable::initPreviousAlphaTextures() initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA); } -void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te) +void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te) { LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te); if (lto) diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 85e43c8ebd..309d512e23 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -30,7 +30,7 @@ #include "llpanel.h" #include "llscrollingpanellist.h" #include "llmodaldialog.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" #include "llwearabletype.h" class LLAccordionCtrl; @@ -95,11 +95,11 @@ private: void updateTypeSpecificControls(LLWearableType::EType type); //alpha mask checkboxes - void configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name); - void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te); + void configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name); + void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te); void updateAlphaCheckboxes(); void initPreviousAlphaTextures(); - void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te); + void initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te); // callback for HeightUnits parameter. bool changeHeightUnits(const LLSD& new_value); @@ -165,10 +165,10 @@ private: LLPanel *mPanelTattoo; LLPanel *mPanelPhysics; - typedef std::map string_texture_index_map_t; + typedef std::map string_texture_index_map_t; string_texture_index_map_t mAlphaCheckbox2Index; - typedef std::map s32_uuid_map_t; + typedef std::map s32_uuid_map_t; s32_uuid_map_t mPreviousAlphaTexture; }; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 4611107bc2..070009fe9c 100755 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -418,11 +418,11 @@ void LLAvatarTexBar::draw() LLColor4 color; U32 line_num = 1; - for (LLVOAvatarDefines::LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { - const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first; + const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; const LLViewerTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index); if (!layerset) continue; const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 01a54509ef..2fc6de9d4d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -122,7 +122,7 @@ #include "llpathfindingmanager.h" #include "boost/unordered_map.hpp" -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; typedef LLPointer LLViewerObjectPtr; @@ -7387,7 +7387,7 @@ void handle_grab_baked_texture(void* data) if(folder_id.notNull()) { std::string name; - name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture"; + name = "Baked " + LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture"; LLUUID item_id; item_id.generate(); diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index 3a3cae4047..051aa41ed1 100644 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -212,7 +212,7 @@ BOOL LLTexLayerSetBuffer::needsRender() } // Don't render if we are trying to create a shirt texture but aren't wearing a skirt. - if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && + if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLAvatarAppearanceDefines::TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT)) { cancelUpload(); @@ -627,7 +627,7 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, if (result >= 0) { layerset_buffer->mUploadPending = FALSE; // Allows sending of AgentSetAppearance later - LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet); + LLAvatarAppearanceDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet); // Update baked texture info with the new UUID U64 now = LLFrameTimer::getTotalTime(); // Record starting time llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 2b6649a7ec..0cd3ded371 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -35,11 +35,11 @@ #include "lltextureentry.h" #include "llviewertexlayer.h" #include "llvoavatarself.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" #include "llviewerwearable.h" #include "llviewercontrol.h" -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; // support class - remove for 2.1 (hackity hack hack) class LLOverrideBakedTextureUpdate @@ -47,7 +47,7 @@ class LLOverrideBakedTextureUpdate public: LLOverrideBakedTextureUpdate(bool temp_state) { - U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES; + U32 num_bakes = (U32) LLAvatarAppearanceDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index); @@ -57,14 +57,14 @@ public: ~LLOverrideBakedTextureUpdate() { - U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES; + U32 num_bakes = (U32)LLAvatarAppearanceDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]); } } private: - bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES]; + bool composite_enabled[LLAvatarAppearanceDefines::BAKED_NUM_INDICES]; }; // Private local functions @@ -175,7 +175,7 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid ); if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime")) { - image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLVOAvatarDefines::ETextureIndex)te), NULL); + image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL); } mTEMap[te] = new LLLocalTextureObject(image, textureid); mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); @@ -230,7 +230,7 @@ BOOL LLViewerWearable::isOldVersion() const S32 te_count = 0; for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_count++; if( !is_in_map(mTEMap, te ) ) @@ -282,7 +282,7 @@ BOOL LLViewerWearable::isDirty() const for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator current_iter = mTEMap.find(te); if(current_iter != mTEMap.end()) @@ -328,7 +328,7 @@ void LLViewerWearable::setTexturesToDefaults() { for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { LLUUID id = getDefaultTextureImageID((ETextureIndex) te); LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id ); @@ -352,7 +352,7 @@ void LLViewerWearable::setTexturesToDefaults() //static const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); const std::string &default_image_name = texture_dict->mDefaultImageName; if (default_image_name == "") { @@ -389,7 +389,7 @@ void LLViewerWearable::writeToAvatar() // Pull texture entries for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator iter = mTEMap.find(te); LLUUID image_id; @@ -492,7 +492,7 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) for (S32 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator iter = src->mTEMap.find(te); LLUUID image_id; @@ -678,7 +678,7 @@ void LLViewerWearable::syncImages(te_map_t &src, te_map_t &dst) // Deep copy of src (copies only those tes that are current, filling in defaults where needed) for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator iter = src.find(te); LLUUID image_id; diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index a921f82e7d..ccc26000f2 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -28,7 +28,7 @@ #define LL_VIEWER_WEARABLE_H #include "llwearable.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" class LLViewerWearable : public LLWearable { @@ -68,7 +68,7 @@ public: void setParamsToDefaults(); void setTexturesToDefaults(); - static const LLUUID getDefaultTextureImageID(LLVOAvatarDefines::ETextureIndex index); + static const LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index); void saveNewAsset() const; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e3d8f9135e..56ded53b5d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -118,7 +118,7 @@ extern F32 ANIM_SPEED_MIN; // #define OUTPUT_BREAST_DATA -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; //----------------------------------------------------------------------------- // Global constants @@ -597,7 +597,7 @@ LLXmlTree LLVOAvatar::sXMLTree; LLXmlTree LLVOAvatar::sSkeletonXMLTree; LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; -LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; +LLAvatarAppearanceDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; U32 LLVOAvatar::sMaxVisible = 12; F32 LLVOAvatar::sRenderDistance = 256.f; @@ -711,7 +711,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mBakedTextureDatas[i].mIsLoaded = false; mBakedTextureDatas[i].mIsUsed = false; mBakedTextureDatas[i].mMaskTexName = 0; - mBakedTextureDatas[i].mTextureIndex = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); + mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); } mDirtyMesh = 2; // Dirty geometry, need to regenerate. @@ -1073,15 +1073,15 @@ void LLVOAvatar::dumpBakedStatus() { llcont << " Unbaked ("; - for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++iter) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = iter->second; const ETextureIndex index = baked_dict->mTextureIndex; if (!inst->isTextureDefined(index)) { - llcont << " " << LLVOAvatarDictionary::getInstance()->getTexture(index)->mName; + llcont << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName; } } llcont << " ) " << inst->getUnbakedPixelAreaRank(); @@ -1282,12 +1282,12 @@ void LLVOAvatar::initInstance(void) //------------------------------------------------------------------------- mRoot.setName( "mRoot" ); - for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); ++iter) { const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; LLViewerJoint* joint = new LLViewerJoint(); joint->setName(mesh_dict->mName); joint->setMeshID(mesh_index); @@ -1328,12 +1328,12 @@ void LLVOAvatar::initInstance(void) //------------------------------------------------------------------------- // associate baked textures with meshes //------------------------------------------------------------------------- - for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); ++iter) { const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; // Skip it if there's no associated baked texture. if (baked_texture_index == BAKED_NUM_INDICES) continue; @@ -4565,7 +4565,7 @@ void LLVOAvatar::updateTextures() mHasGrey = FALSE; // debug for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { - LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index); + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index); U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); const LLTextureEntry *te = getTE(texture_index); const F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); @@ -4575,7 +4575,7 @@ void LLVOAvatar::updateTextures() imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); if (imagep) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)texture_index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; if (texture_dict->mIsLocalTexture) { @@ -4736,7 +4736,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) std::string url = ""; if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) { - const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); + const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) { url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); @@ -5515,7 +5515,7 @@ BOOL LLVOAvatar::loadAvatar() { LLVOAvatarXmlInfo::LLVOAvatarMorphInfo *info = *iter; - EBakedTextureIndex baked = LLVOAvatarDictionary::findBakedByRegionName(info->mRegion); + EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion); if (baked != BAKED_NUM_INDICES) { LLPolyMorphTarget *morph_param; @@ -5723,12 +5723,12 @@ BOOL LLVOAvatar::loadMeshNodes() switch(lod) case 0: mesh = &mHairMesh0; */ - for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + for (LLAvatarAppearanceDictionary::Meshes::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); + mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); ++mesh_iter) { const EMeshIndex mesh_index = mesh_iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second; if (type.compare(mesh_dict->mName) == 0) { mesh_id = mesh_index; @@ -6815,12 +6815,12 @@ void LLVOAvatar::updateMeshTextures() } - for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { const EBakedTextureIndex baked_index = baked_iter->first; - const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); @@ -6848,7 +6848,7 @@ void LLVOAvatar::setLocalTexture( ETextureIndex type, LLViewerTexture* in_tex, B } //virtual -void LLVOAvatar::setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) +void LLVOAvatar::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) { // invalid for anyone but self llassert(0); @@ -6894,7 +6894,7 @@ void LLVOAvatar::addMaskedMorph(EBakedTextureIndex index, LLPolyMorphTarget* mor } // returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise -BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index) +BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) { if (index >= BAKED_NUM_INDICES) { @@ -6920,7 +6920,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde return FALSE; } -void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index) +void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) { if (index >= BAKED_NUM_INDICES) { @@ -6959,7 +6959,7 @@ void LLVOAvatar::releaseComponentTextures() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry * bakedDicEntry = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID if (!isTextureDefined(bakedDicEntry->mTextureIndex) && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) )) @@ -6978,11 +6978,11 @@ void LLVOAvatar::releaseComponentTextures() void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const { LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; // TODO: MULTI-WEARABLE: handle multiple textures for self const LLViewerTexture* te_image = getImage(iter->first,0); if( !te_image ) @@ -7027,11 +7027,11 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const /* switch(type) case LLWearableType::WT_SHIRT: indicator_te = TEX_UPPER_SHIRT; */ - for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++tex_iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = tex_iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; if (texture_dict->mWearableType == type) { // If you're checking another avatar's clothing, you don't have component textures. @@ -7042,7 +7042,7 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const if (texture_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - return isTextureDefined(LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); + return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); } return FALSE; } @@ -7495,12 +7495,12 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ BOOL found_texture_id = false; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsUsedByBakedTexture) { const ETextureIndex texture_index = iter->first; @@ -7622,7 +7622,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { //mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); } - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) @@ -7684,7 +7684,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0); @@ -8491,7 +8491,7 @@ void LLVOAvatar::idleUpdateRenderCost() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); ETextureIndex tex_index = baked_dict->mTextureIndex; if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT))) { @@ -8571,11 +8571,11 @@ void LLVOAvatar::idleUpdateRenderCost() } // print any avatar textures we didn't already know about - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; // TODO: MULTI-WEARABLE: handle multiple textures for self const LLViewerTexture* te_image = getImage(iter->first,0); if (!te_image) @@ -8604,26 +8604,26 @@ void LLVOAvatar::idleUpdateRenderCost() BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index) { if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsLocalTexture; + return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture; } // static BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index) { if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsBakedTexture; + return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture; } const std::string LLVOAvatar::getBakedStatusForPrintout() const { std::string line; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsBakedTexture) { line += texture_dict->mName; @@ -8655,7 +8655,7 @@ F32 calc_bouncy_animation(F32 x) } //virtual -BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index ) const +BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index ) const { if (isIndexLocalTexture(te)) { @@ -8667,7 +8667,7 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const +BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { if (isIndexLocalTexture(type)) { @@ -8683,7 +8683,7 @@ BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 ind } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const +BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const { // non-self avatars don't have wearables return FALSE; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 512522803a..644ea22b53 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -45,7 +45,7 @@ #include "llviewerjointmesh.h" #include "llviewerjointattachment.h" #include "llrendertarget.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" #include "lltexglobalcolor.h" #include "lldriverparam.h" #include "material_codes.h" // LL_MCODE_END @@ -472,9 +472,9 @@ private: // Morph masks //-------------------------------------------------------------------- public: - BOOL morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); - void addMaskedMorph(LLVOAvatarDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer); - virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); + BOOL morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); + void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer); + virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); //-------------------------------------------------------------------- @@ -582,9 +582,9 @@ public: // Loading status //-------------------------------------------------------------------- public: - virtual BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; - virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; - virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const; + virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; + virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; + virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const; BOOL isFullyBaked(); static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); @@ -610,7 +610,7 @@ protected: LLViewerTexLayerSet* mTexLayerSet; // Only exists for self bool mIsLoaded; bool mIsUsed; - LLVOAvatarDefines::ETextureIndex mTextureIndex; + LLAvatarAppearanceDefines::ETextureIndex mTextureIndex; U32 mMaskTexName; // Stores pointers to the joint meshes that this baked texture deals with std::vector< LLViewerJointMesh * > mMeshes; // std::vector mJoints[i]->mMeshParts @@ -624,10 +624,10 @@ protected: // Local Textures //-------------------------------------------------------------------- protected: - virtual void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0); - virtual void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0); + virtual void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0); + virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0); // MULTI-WEARABLE: make self-only? - virtual void setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0); + virtual void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0); //-------------------------------------------------------------------- // Texture accessors @@ -662,11 +662,11 @@ public: // Static texture/mesh/baked dictionary //-------------------------------------------------------------------- public: - static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i); - static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i); + static BOOL isIndexLocalTexture(LLAvatarAppearanceDefines::ETextureIndex i); + static BOOL isIndexBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i); private: - static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; } - static LLVOAvatarDefines::LLVOAvatarDictionary* sAvatarDictionary; + static const LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary *getDictionary() { return sAvatarDictionary; } + static LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* sAvatarDictionary; static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo; static LLVOAvatarXmlInfo* sAvatarXmlInfo; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0fcf43a501..b300cfc71c 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -112,7 +112,7 @@ void selfStopAllPhases() } } -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; /********************************************************************************* ** ** @@ -190,7 +190,7 @@ void LLVOAvatarSelf::initInstance() llinfos << "Self avatar object created. Starting timer." << llendl; mDebugSelfLoadTimer.reset(); // clear all times to -1 for debugging - for (U32 i =0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i) + for (U32 i =0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i) { for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j) { @@ -198,7 +198,7 @@ void LLVOAvatarSelf::initInstance() } } - for (U32 i =0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i) + for (U32 i =0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i) { mDebugBakedTextureTimes[i][0] = -1.0f; mDebugBakedTextureTimes[i][1] = -1.0f; @@ -609,11 +609,11 @@ BOOL LLVOAvatarSelf::loadLayersets() // scan baked textures and associate the layerset with the appropriate one EBakedTextureIndex baked_index = BAKED_NUM_INDICES; - for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; if (layer_set->isBodyRegion(baked_dict->mName)) { baked_index = baked_iter->first; @@ -819,7 +819,7 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, // need to trigger a few operations to get the avatar to use the new bakes for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - const LLVOAvatarDefines::ETextureIndex te = mBakedTextureDatas[i].mTextureIndex; + const LLAvatarAppearanceDefines::ETextureIndex te = mBakedTextureDatas[i].mTextureIndex; LLUUID texture_id = getTEImage(te)->getID(); setNewBakedTexture(te, texture_id); mInitialBakeIDs[i] = texture_id; @@ -1074,16 +1074,16 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) //----------------------------------------------------------------------------- void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_result ) { - for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; - const LLVOAvatarDefines::EBakedTextureIndex index = baked_iter->first; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDefines::EBakedTextureIndex index = baked_iter->first; if (baked_dict) { - for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin(); + for (LLAvatarAppearanceDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin(); type_iter != baked_dict->mWearables.end(); ++type_iter) { @@ -1306,9 +1306,9 @@ BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id) return FALSE; } -U32 LLVOAvatarSelf::getNumWearables(LLVOAvatarDefines::ETextureIndex i) const +U32 LLVOAvatarSelf::getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const { - LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i); + LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i); return gAgentWearables.getWearableCount(type); } @@ -1381,7 +1381,7 @@ BOOL LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLViewerTexture** tex return TRUE; } -LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, U32 index) const +LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { if (!isIndexLocalTexture(type)) { @@ -1422,21 +1422,21 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye { /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */ - for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { const EBakedTextureIndex baked_index = baked_iter->first; if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) { BOOL ret = true; - const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) { const ETextureIndex tex_index = *local_tex_iter; - const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index); + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { @@ -1465,13 +1465,13 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset { if (layerset == mBakedTextureDatas[i].mTexLayerSet) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) { const ETextureIndex tex_index = *local_tex_iter; - const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index); + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { @@ -1495,13 +1495,13 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) { const ETextureIndex tex_index = *local_tex_iter; - const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index); + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { @@ -1515,7 +1515,7 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const return TRUE; } -BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const +BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLAvatarAppearanceDefines::EBakedTextureIndex index) const { const LLViewerTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet; if (!layerset) return FALSE; @@ -1524,13 +1524,13 @@ BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureI return !layerset_buffer->uploadNeeded(); } -BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const +BOOL LLVOAvatarSelf::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { LLUUID id; BOOL isDefined = TRUE; if (isIndexLocalTexture(type)) { - const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(type); + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(type); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); if (index >= wearable_count) { @@ -1557,7 +1557,7 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 } //virtual -BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const +BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { if (isIndexBakedTexture(type)) { @@ -1570,7 +1570,7 @@ BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 } //virtual -BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const +BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const { if (isIndexBakedTexture(type)) { @@ -1593,7 +1593,7 @@ void LLVOAvatarSelf::requestLayerSetUploads() } } -void LLVOAvatarSelf::requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i) +void LLVOAvatarSelf::requestLayerSetUpload(LLAvatarAppearanceDefines::EBakedTextureIndex i) { ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex; const BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index)); @@ -1779,7 +1779,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te llerrs << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << llendl; return; } - LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType(type); + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(type); if (!gAgentWearables.getWearable(wearable_type,index)) { // no wearable is loaded, cannot set the texture. @@ -1839,7 +1839,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te setBakedReady(type,baked_version_ready,index); } //virtual -void LLVOAvatarSelf::setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) +void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) { if (!isIndexLocalTexture(type)) return; LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index); @@ -1858,16 +1858,16 @@ void LLVOAvatarSelf::dumpLocalTextures() const /* ETextureIndex baked_equiv[] = { TEX_UPPER_BAKED, if (isTextureDefined(baked_equiv[i])) */ - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) continue; const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - const ETextureIndex baked_equiv = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex; + const ETextureIndex baked_equiv = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex; const std::string &name = texture_dict->mName; const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(iter->first, 0); @@ -2071,21 +2071,21 @@ const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTe /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */ - for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { const EBakedTextureIndex baked_index = baked_iter->first; if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; text += llformat("%d-%s ( ",baked_index, baked_dict->mName.c_str()); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) { const ETextureIndex tex_index = *local_tex_iter; - const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index); + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); if (wearable_count > 0) { @@ -2112,14 +2112,14 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); BOOL is_texture_final = TRUE; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) { const ETextureIndex tex_index = *local_tex_iter; - const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index); + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { @@ -2243,7 +2243,7 @@ const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) c { if (canGrabBakedTexture(baked_index)) { - ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index); + ETextureIndex tex_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(baked_index); if (tex_index == TEX_NUM_INDICES) { return LLUUID::null; @@ -2255,7 +2255,7 @@ const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) c BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const { - ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index); + ETextureIndex tex_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(baked_index); if (tex_index == TEX_NUM_INDICES) { return FALSE; @@ -2274,13 +2274,13 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const // baked texture. We don't want people copying people's // work via baked textures. - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index); for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin(); iter != baked_dict->mLocalTextures.end(); ++iter) { const ETextureIndex t_index = (*iter); - LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(t_index); + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(t_index); U32 count = gAgentWearables.getWearableCount(wearable_type); lldebugs << "Checking index " << (U32) t_index << " count: " << count << llendl; @@ -2358,9 +2358,9 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe } } -LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 wearable_index) const +LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 wearable_index) const { - LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i); + LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i); LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_index); if (wearable) { @@ -2388,9 +2388,9 @@ ETextureIndex LLVOAvatarSelf::getBakedTE( const LLViewerTexLayerSet* layerset ) } -void LLVOAvatarSelf::setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid) +void LLVOAvatarSelf::setNewBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex i, const LLUUID &uuid) { - ETextureIndex index = LLVOAvatarDictionary::bakedToLocalTextureIndex(i); + ETextureIndex index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(i); setNewBakedTexture(index, uuid); } @@ -2412,7 +2412,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) /* switch(te) case TEX_HEAD_BAKED: llinfos << "New baked texture: HEAD" << llendl; */ - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(te); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(te); if (texture_dict->mIsBakedTexture) { debugBakedTextureUpload(texture_dict->mBakedTextureIndex, TRUE); // FALSE for start of upload, TRUE for finish. @@ -2477,7 +2477,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << llendl; LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << llendl; LL_DEBUGS("Avatar") << "\t Load time for each texture: " << llendl; - for (U32 i = 0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i) + for (U32 i = 0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i) { std::stringstream out; out << "\t\t (" << i << ") "; @@ -2505,16 +2505,16 @@ void LLVOAvatarSelf::outputRezDiagnostics() const } } LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << llendl; - for (U32 i = 0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i) + for (U32 i = 0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i) { LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << llendl; } - for (LLVOAvatarDefines::LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { - const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first; + const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); if (!layerset) continue; const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); @@ -2583,12 +2583,12 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) /* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] = TEX_HEAD_BAKED, TEX_UPPER_BAKED, */ - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsBakedTexture) { if (texture_id == gAgentAvatarp->getTEImage(index)->getID()) @@ -2657,7 +2657,7 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index ) case LOCTEX_UPPER_SHIRT: if( mUpperBodyLayerSet ) mUpperBodyLayerSet->requestUpdate(); */ - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) return; const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; @@ -2673,7 +2673,7 @@ LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const case TEX_HEAD_BAKED: case TEX_HEAD_BODYPAINT: return mHeadLayerSet; */ - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); if (texture_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; @@ -2747,12 +2747,12 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const { LLUUID texture_id[TEX_NUM_INDICES]; // pack away current TEs to make sure we don't send them out - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (!texture_dict->mIsBakedTexture) { LLTextureEntry* entry = getTE((U8) index); @@ -2764,12 +2764,12 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const bool success = packTEMessage(mesgsys); // unpack TEs to make sure we don't re-trigger a bake - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (!texture_dict->mIsBakedTexture) { LLTextureEntry* entry = getTE((U8) index); diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 26662e8a25..d4bde1f61f 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -195,32 +195,32 @@ public: //-------------------------------------------------------------------- public: /*virtual*/ bool hasPendingBakedUploads() const; - S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex type, U32 index) const; + S32 getLocalDiscardLevel(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; bool areTexturesCurrent() const; BOOL isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const; BOOL isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const; - BOOL isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const; + BOOL isBakedTextureFinal(const LLAvatarAppearanceDefines::EBakedTextureIndex index) const; // If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index - /*virtual*/ BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const; - /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; - /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const; + /*virtual*/ BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; + /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; + /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const; //-------------------------------------------------------------------- // Local Textures //-------------------------------------------------------------------- public: - BOOL getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const; - LLViewerFetchedTexture* getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, U32 index) const; - const LLUUID& getLocalTextureID(LLVOAvatarDefines::ETextureIndex type, U32 index) const; + BOOL getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const; + LLViewerFetchedTexture* getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; + const LLUUID& getLocalTextureID(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; void setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index); - /*virtual*/ void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index); + /*virtual*/ void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index); protected: - /*virtual*/ void setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index); + /*virtual*/ void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index); void localTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); void getLocalTextureByteCount(S32* gl_byte_count) const; - /*virtual*/ void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index); - LLLocalTextureObject* getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 index) const; + /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index); + LLLocalTextureObject* getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 index) const; private: static void onLocalTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); @@ -233,10 +233,10 @@ private: // Baked textures //-------------------------------------------------------------------- public: - LLVOAvatarDefines::ETextureIndex getBakedTE(const LLViewerTexLayerSet* layerset ) const; - void setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid); - void setNewBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); - void setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); + LLAvatarAppearanceDefines::ETextureIndex getBakedTE(const LLViewerTexLayerSet* layerset ) const; + void setNewBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex i, const LLUUID &uuid); + void setNewBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i, const LLUUID& uuid); + void setCachedBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i, const LLUUID& uuid); void forceBakeAllTextures(bool slam_for_debug = false); static void processRebakeAvatarTextures(LLMessageSystem* msg, void**); protected: @@ -247,10 +247,10 @@ protected: //-------------------------------------------------------------------- public: void requestLayerSetUploads(); - void requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i); - void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i); - LLViewerTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const; - LLViewerTexLayerSet* getLayerSet(LLVOAvatarDefines::EBakedTextureIndex baked_index) const; + void requestLayerSetUpload(LLAvatarAppearanceDefines::EBakedTextureIndex i); + void requestLayerSetUpdate(LLAvatarAppearanceDefines::ETextureIndex i); + LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::ETextureIndex index) const; + LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; //-------------------------------------------------------------------- // Composites @@ -264,8 +264,8 @@ public: void setupComposites(); void updateComposites(); - const LLUUID& grabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const; - BOOL canGrabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const; + const LLUUID& grabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; + BOOL canGrabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; //-------------------------------------------------------------------- @@ -302,7 +302,7 @@ public: /*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type) const; void wearableUpdated(LLWearableType::EType type, BOOL upload_result); protected: - U32 getNumWearables(LLVOAvatarDefines::ETextureIndex i) const; + U32 getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const; //-------------------------------------------------------------------- // Attachments @@ -371,24 +371,24 @@ public: public: struct LLAvatarTexData { - LLAvatarTexData(const LLUUID& id, LLVOAvatarDefines::ETextureIndex index) : + LLAvatarTexData(const LLUUID& id, LLAvatarAppearanceDefines::ETextureIndex index) : mAvatarID(id), mIndex(index) {} LLUUID mAvatarID; - LLVOAvatarDefines::ETextureIndex mIndex; + LLAvatarAppearanceDefines::ETextureIndex mIndex; }; void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); } void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); } void outputRezDiagnostics() const; void outputRezTiming(const std::string& msg) const; void reportAvatarRezTime() const; - void debugBakedTextureUpload(LLVOAvatarDefines::EBakedTextureIndex index, BOOL finished); + void debugBakedTextureUpload(LLAvatarAppearanceDefines::EBakedTextureIndex index, BOOL finished); static void debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); BOOL isAllLocalTextureDataFinal() const; - const LLViewerTexLayerSet* debugGetLayerSet(LLVOAvatarDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; } + const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; } const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD LLSD metricsData(); @@ -397,8 +397,8 @@ private: LLFrameTimer mDebugSelfLoadTimer; F32 mDebugTimeWearablesLoaded; F32 mDebugTimeAvatarVisible; - F32 mDebugTextureLoadTimes[LLVOAvatarDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level - F32 mDebugBakedTextureTimes[LLVOAvatarDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture + F32 mDebugTextureLoadTimes[LLAvatarAppearanceDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level + F32 mDebugBakedTextureTimes[LLAvatarAppearanceDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture void debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); /** Diagnostics -- cgit v1.2.3 From 7b4385420edf3f431ddc4a7042bbc9623ffedd34 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 04:24:47 +0000 Subject: More clean-up to closer match original file order. For llavatarappearance diffs --- indra/newview/lltexturefetch.cpp | 3 ++- indra/newview/llvoavatar.h | 1 - indra/newview/llwearablelist.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 7adf5212c2..16baefac4f 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -973,7 +973,8 @@ bool LLTextureFetchWorker::doWork(S32 param) } else if(!mUrl.empty() && mCanUseHTTP) { - if (!(mUrl.compare(0, 7, "http://") == 0)) + if (!(mUrl.compare(0, 7, "http://") == 0) && + !(mUrl.compare(0, 8, "https://") == 0)) { // *TODO:?remove this warning llwarns << "Unknown URL Type: " << mUrl << llendl; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 644ea22b53..d54d06a6a7 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -454,7 +454,6 @@ public: static void deleteCachedImages(bool clearAll=true); static void destroyGL(); static void restoreGL(); - BOOL mIsDummy; // for special views S32 mSpecialRenderMode; // special lighting U32 mAttachmentGeometryBytes; //number of bytes in attached geometry F32 mAttachmentSurfaceArea; //estimated surface area of attachments diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 9f04fbecf0..6c4790ad77 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -112,8 +112,8 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else { wearable = new LLViewerWearable(uuid); - bool res = wearable->importFile( fp ); - if (!res) + LLWearable::EImportResult result = wearable->importFile( fp ); + if (LLWearable::SUCCESS != result) { if (wearable->getType() == LLWearableType::WT_COUNT) { -- cgit v1.2.3 From 204be2ba5261d794f8264e004b65725450bf1be9 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 15:18:15 +0000 Subject: Split LLTexLayerSetBuffer into llappearance portion, and viewer-specific LLViewerTexLayerSetBuffer --- indra/newview/llassetuploadresponders.cpp | 8 +- indra/newview/lldynamictexture.h | 4 +- indra/newview/lltextureview.cpp | 2 +- indra/newview/llviewerjointmesh.cpp | 2 +- indra/newview/llviewerstats.cpp | 2 +- indra/newview/llviewertexlayer.cpp | 260 ++++++++++++------------------ indra/newview/llviewertexlayer.h | 58 ++++--- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatarself.cpp | 6 +- 9 files changed, 148 insertions(+), 196 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 35e44d73d4..7c423af3c8 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -456,7 +456,7 @@ LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data, LLSendTexLayerResponder::~LLSendTexLayerResponder() { - // mBakedUploadData is normally deleted by calls to LLTexLayerSetBuffer::onTextureUploadComplete() below + // mBakedUploadData is normally deleted by calls to LLViewerTexLayerSetBuffer::onTextureUploadComplete() below if (mBakedUploadData) { // ...but delete it in the case where uploadComplete() is never called delete mBakedUploadData; @@ -477,12 +477,12 @@ void LLSendTexLayerResponder::uploadComplete(const LLSD& content) if (result == "complete" && mBakedUploadData != NULL) { // Invoke - LLTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, 0, LL_EXSTAT_NONE); + LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, 0, LL_EXSTAT_NONE); mBakedUploadData = NULL; // deleted in onTextureUploadComplete() } else { // Invoke the original callback with an error result - LLTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, -1, LL_EXSTAT_NONE); + LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, -1, LL_EXSTAT_NONE); mBakedUploadData = NULL; // deleted in onTextureUploadComplete() } } @@ -492,7 +492,7 @@ void LLSendTexLayerResponder::error(U32 statusNum, const std::string& reason) llinfos << "status: " << statusNum << " reason: " << reason << llendl; // Invoke the original callback with an error result - LLTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE); + LLViewerTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE); mBakedUploadData = NULL; // deleted in onTextureUploadComplete() } diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index c51e7d1e1a..d287ae6eeb 100644 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h @@ -72,8 +72,8 @@ public: /*virtual*/ S8 getType() const ; - S32 getOriginX() { return mOrigin.mX; } - S32 getOriginY() { return mOrigin.mY; } + S32 getOriginX() const { return mOrigin.mX; } + S32 getOriginY() const { return mOrigin.mY; } S32 getSize() { return mFullWidth * mFullHeight * mComponents; } diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 070009fe9c..03529b9246 100755 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -425,7 +425,7 @@ void LLAvatarTexBar::draw() const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; const LLViewerTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index); if (!layerset) continue; - const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); + const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); if (!layerset_buffer) continue; LLColor4 text_color = LLColor4::white; diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 79800c1df3..3532fac1bc 100755 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -562,7 +562,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) { if( mLayerSet->hasComposite() ) { - gGL.getTexUnit(diffuse_channel)->bind(mLayerSet->getComposite()); + gGL.getTexUnit(diffuse_channel)->bind(mLayerSet->getViewerComposite()); } else { diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index f049130f3a..961c7082cf 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -519,7 +519,7 @@ void output_statistics(void*) llinfos << "Avatar Memory (partly overlaps with above stats):" << llendl; LLTexLayerStaticImageList::getInstance()->dumpByteCount(); LLVOAvatarSelf::dumpScratchTextureByteCount(); - LLTexLayerSetBuffer::dumpTotalByteCount(); + LLViewerTexLayerSetBuffer::dumpTotalByteCount(); LLVOAvatarSelf::dumpTotalLocalTextureByteCount(); LLTexLayerParamAlpha::dumpCacheByteCount(); LLVOAvatar::dumpBakedStatus(); diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index 051aa41ed1..69457ab1db 100644 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -63,33 +63,33 @@ LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar, } //----------------------------------------------------------------------------- -// LLTexLayerSetBuffer +// LLViewerTexLayerSetBuffer // The composite image that a LLViewerTexLayerSet writes to. Each LLViewerTexLayerSet has one. //----------------------------------------------------------------------------- // static -S32 LLTexLayerSetBuffer::sGLByteCount = 0; +S32 LLViewerTexLayerSetBuffer::sGLByteCount = 0; -LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLViewerTexLayerSet* const owner, +LLViewerTexLayerSetBuffer::LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height) : // ORDER_LAST => must render these after the hints are created. + LLTexLayerSetBuffer(owner), LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, TRUE ), mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates mNeedsUpload(FALSE), mNumLowresUploads(0), mUploadFailCount(0), mNeedsUpdate(TRUE), - mNumLowresUpdates(0), - mTexLayerSet(owner) + mNumLowresUpdates(0) { - LLTexLayerSetBuffer::sGLByteCount += getSize(); + LLViewerTexLayerSetBuffer::sGLByteCount += getSize(); mNeedsUploadTimer.start(); mNeedsUpdateTimer.start(); } -LLTexLayerSetBuffer::~LLTexLayerSetBuffer() +LLViewerTexLayerSetBuffer::~LLViewerTexLayerSetBuffer() { - LLTexLayerSetBuffer::sGLByteCount -= getSize(); + LLViewerTexLayerSetBuffer::sGLByteCount -= getSize(); destroyGLTexture(); for( S32 order = 0; order < ORDER_COUNT; order++ ) { @@ -98,30 +98,30 @@ LLTexLayerSetBuffer::~LLTexLayerSetBuffer() } //virtual -S8 LLTexLayerSetBuffer::getType() const +S8 LLViewerTexLayerSetBuffer::getType() const { return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ; } //virtual -void LLTexLayerSetBuffer::restoreGLTexture() +void LLViewerTexLayerSetBuffer::restoreGLTexture() { LLViewerDynamicTexture::restoreGLTexture() ; } //virtual -void LLTexLayerSetBuffer::destroyGLTexture() +void LLViewerTexLayerSetBuffer::destroyGLTexture() { LLViewerDynamicTexture::destroyGLTexture() ; } // static -void LLTexLayerSetBuffer::dumpTotalByteCount() +void LLViewerTexLayerSetBuffer::dumpTotalByteCount() { - llinfos << "Composite System GL Buffers: " << (LLTexLayerSetBuffer::sGLByteCount/1024) << "KB" << llendl; + llinfos << "Composite System GL Buffers: " << (LLViewerTexLayerSetBuffer::sGLByteCount/1024) << "KB" << llendl; } -void LLTexLayerSetBuffer::requestUpdate() +void LLViewerTexLayerSetBuffer::requestUpdate() { restartUpdateTimer(); mNeedsUpdate = TRUE; @@ -131,7 +131,7 @@ void LLTexLayerSetBuffer::requestUpdate() mUploadID.setNull(); } -void LLTexLayerSetBuffer::requestUpload() +void LLViewerTexLayerSetBuffer::requestUpload() { conditionalRestartUploadTimer(); mNeedsUpload = TRUE; @@ -139,7 +139,7 @@ void LLTexLayerSetBuffer::requestUpload() mUploadPending = TRUE; } -void LLTexLayerSetBuffer::conditionalRestartUploadTimer() +void LLViewerTexLayerSetBuffer::conditionalRestartUploadTimer() { // If we requested a new upload but haven't even uploaded // a low res version of our last upload request, then @@ -155,13 +155,13 @@ void LLTexLayerSetBuffer::conditionalRestartUploadTimer() } } -void LLTexLayerSetBuffer::restartUpdateTimer() +void LLViewerTexLayerSetBuffer::restartUpdateTimer() { mNeedsUpdateTimer.reset(); mNeedsUpdateTimer.start(); } -void LLTexLayerSetBuffer::cancelUpload() +void LLViewerTexLayerSetBuffer::cancelUpload() { mNeedsUpload = FALSE; mUploadPending = FALSE; @@ -169,29 +169,8 @@ void LLTexLayerSetBuffer::cancelUpload() mUploadRetryTimer.reset(); } -void LLTexLayerSetBuffer::pushProjection() const -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - gGL.loadIdentity(); -} - -void LLTexLayerSetBuffer::popProjection() const -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.popMatrix(); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); -} - // virtual -BOOL LLTexLayerSetBuffer::needsRender() +BOOL LLViewerTexLayerSetBuffer::needsRender() { llassert(mTexLayerSet->getAvatarAppearance() == gAgentAvatarp); if (!isAgentAvatarValid()) return FALSE; @@ -212,7 +191,7 @@ BOOL LLTexLayerSetBuffer::needsRender() } // Don't render if we are trying to create a shirt texture but aren't wearing a skirt. - if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLAvatarAppearanceDefines::TEX_SKIRT_BAKED && + if (gAgentAvatarp->getBakedTE(getViewerTexLayerSet()) == LLAvatarAppearanceDefines::TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT)) { cancelUpload(); @@ -220,51 +199,36 @@ BOOL LLTexLayerSetBuffer::needsRender() } // Render if we have at least minimal level of detail for each local texture. - return mTexLayerSet->isLocalTextureDataAvailable(); + return getViewerTexLayerSet()->isLocalTextureDataAvailable(); } -void LLTexLayerSetBuffer::preRender(BOOL clear_depth) +// virtual +void LLViewerTexLayerSetBuffer::preRenderTexLayerSet() { - // Set up an ortho projection - pushProjection(); + LLTexLayerSetBuffer::preRenderTexLayerSet(); // keep depth buffer, we don't need to clear it LLViewerDynamicTexture::preRender(FALSE); } -void LLTexLayerSetBuffer::postRender(BOOL success) +// virtual +void LLViewerTexLayerSetBuffer::postRenderTexLayerSet(BOOL success) { - popProjection(); + // *TODO: Old logic does not check success before setGLTextureCreated + // we have valid texture data now + mGLTexturep->setGLTextureCreated(true); + LLTexLayerSetBuffer::postRenderTexLayerSet(success); LLViewerDynamicTexture::postRender(success); } -BOOL LLTexLayerSetBuffer::render() +// virtual +void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success) { - // Default color mask for tex layer render - gGL.setColorMask(true, true); - // do we need to upload, and do we have sufficient data to create an uploadable composite? // TODO: When do we upload the texture if gAgent.mNumPendingQueries is non-zero? const BOOL upload_now = mNeedsUpload && isReadyToUpload(); const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); - - BOOL success = TRUE; - - bool use_shaders = LLGLSLShader::sNoFixedFunction; - - if (use_shaders) - { - gAlphaMaskProgram.bind(); - gAlphaMaskProgram.setMinimumAlpha(0.004f); - } - - LLVertexBuffer::unbind(); - - // Composite the color data - LLGLSUIDefault gls_ui; - success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight ); - gGL.flush(); if(upload_now) { @@ -275,9 +239,10 @@ BOOL LLTexLayerSetBuffer::render() } else { - if (mTexLayerSet->isVisible()) + LLViewerTexLayerSet* layer_set = getViewerTexLayerSet(); + if (layer_set->isVisible()) { - mTexLayerSet->getAvatar()->debugBakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish. + layer_set->getAvatar()->debugBakedTextureUpload(layer_set->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish. doUpload(); } else @@ -285,7 +250,7 @@ BOOL LLTexLayerSetBuffer::render() mUploadPending = FALSE; mNeedsUpload = FALSE; mNeedsUploadTimer.pause(); - mTexLayerSet->getAvatar()->setNewBakedTexture(mTexLayerSet->getBakedTexIndex(),IMG_INVISIBLE); + layer_set->getAvatar()->setNewBakedTexture(layer_set->getBakedTexIndex(),IMG_INVISIBLE); } } } @@ -294,51 +259,35 @@ BOOL LLTexLayerSetBuffer::render() { doUpdate(); } - - if (use_shaders) - { - gAlphaMaskProgram.unbind(); - } - - LLVertexBuffer::unbind(); - - // reset GL state - gGL.setColorMask(true, true); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - - // we have valid texture data now - mGLTexturep->setGLTextureCreated(true); - - return success; } -BOOL LLTexLayerSetBuffer::isInitialized(void) const +BOOL LLViewerTexLayerSetBuffer::isInitialized(void) const { return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated(); } -BOOL LLTexLayerSetBuffer::uploadPending() const +BOOL LLViewerTexLayerSetBuffer::uploadPending() const { return mUploadPending; } -BOOL LLTexLayerSetBuffer::uploadNeeded() const +BOOL LLViewerTexLayerSetBuffer::uploadNeeded() const { return mNeedsUpload; } -BOOL LLTexLayerSetBuffer::uploadInProgress() const +BOOL LLViewerTexLayerSetBuffer::uploadInProgress() const { return !mUploadID.isNull(); } -BOOL LLTexLayerSetBuffer::isReadyToUpload() const +BOOL LLViewerTexLayerSetBuffer::isReadyToUpload() const { if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries. if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites. BOOL ready = FALSE; - if (mTexLayerSet->isLocalTextureDataFinal()) + if (getViewerTexLayerSet()->isLocalTextureDataFinal()) { // If we requested an upload and have the final LOD ready, upload (or wait a while if this is a retry) if (mUploadFailCount == 0) @@ -363,7 +312,7 @@ BOOL LLTexLayerSetBuffer::isReadyToUpload() const // If we hit our timeout and have textures available at even lower resolution, then upload. const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; - const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); + const BOOL has_lower_lod = getViewerTexLayerSet()->isLocalTextureDataAvailable(); ready = has_lower_lod && is_upload_textures_timeout; } } @@ -371,10 +320,10 @@ BOOL LLTexLayerSetBuffer::isReadyToUpload() const return ready; } -BOOL LLTexLayerSetBuffer::isReadyToUpdate() const +BOOL LLViewerTexLayerSetBuffer::isReadyToUpdate() const { // If we requested an update and have the final LOD ready, then update. - if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE; + if (getViewerTexLayerSet()->isLocalTextureDataFinal()) return TRUE; // If we haven't done an update yet, then just do one now regardless of state of textures. if (mNumLowresUpdates == 0) return TRUE; @@ -386,14 +335,14 @@ BOOL LLTexLayerSetBuffer::isReadyToUpdate() const { // If we hit our timeout and have textures available at even lower resolution, then update. const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout; - const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); + const BOOL has_lower_lod = getViewerTexLayerSet()->isLocalTextureDataAvailable(); if (has_lower_lod && is_update_textures_timeout) return TRUE; } return FALSE; } -BOOL LLTexLayerSetBuffer::requestUpdateImmediate() +BOOL LLViewerTexLayerSetBuffer::requestUpdateImmediate() { mNeedsUpdate = TRUE; BOOL result = FALSE; @@ -410,14 +359,15 @@ BOOL LLTexLayerSetBuffer::requestUpdateImmediate() // Create the baked texture, send it out to the server, then wait for it to come // back so we can switch to using it. -void LLTexLayerSetBuffer::doUpload() +void LLViewerTexLayerSetBuffer::doUpload() { - llinfos << "Uploading baked " << mTexLayerSet->getBodyRegionName() << llendl; + LLViewerTexLayerSet* layer_set = getViewerTexLayerSet(); + llinfos << "Uploading baked " << layer_set->getBodyRegionName() << llendl; LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES); // Don't need caches since we're baked now. (note: we won't *really* be baked // until this image is sent to the server and the Avatar Appearance message is received.) - mTexLayerSet->deleteCaches(); + layer_set->deleteCaches(); // Get the COLOR information from our texture U8* baked_color_data = new U8[ mFullWidth * mFullHeight * 4 ]; @@ -428,7 +378,7 @@ void LLTexLayerSetBuffer::doUpload() LLGLSUIDefault gls_ui; LLPointer baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 ); U8* baked_mask_data = baked_mask_image->getData(); - mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight); + layer_set->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight); // Create the baked image from our color and mask information @@ -475,10 +425,10 @@ void LLTexLayerSetBuffer::doUpload() if (valid) { - const bool highest_lod = mTexLayerSet->isLocalTextureDataFinal(); + const bool highest_lod = layer_set->isLocalTextureDataFinal(); // Baked_upload_data is owned by the responder and deleted after the request completes. LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp, - this->mTexLayerSet, + layer_set, asset_id, highest_lod); // upload ID is used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit. @@ -491,7 +441,7 @@ void LLTexLayerSetBuffer::doUpload() && (mUploadFailCount < (BAKE_UPLOAD_ATTEMPTS - 1))) // Try last ditch attempt via asset store if cap upload is failing. { LLSD body = LLSD::emptyMap(); - // The responder will call LLTexLayerSetBuffer::onTextureUploadComplete() + // The responder will call LLViewerTexLayerSetBuffer::onTextureUploadComplete() LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data)); llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl; } @@ -499,7 +449,7 @@ void LLTexLayerSetBuffer::doUpload() { gAssetStorage->storeAssetData(tid, LLAssetType::AT_TEXTURE, - LLTexLayerSetBuffer::onTextureUploadComplete, + LLViewerTexLayerSetBuffer::onTextureUploadComplete, baked_upload_data, TRUE, // temp_file TRUE, // is_priority @@ -527,12 +477,12 @@ void LLTexLayerSetBuffer::doUpload() { const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32()); + args["EXISTENCE"] = llformat("%d",(U32)layer_set->getAvatar()->debugGetExistenceTimeElapsedF32()); args["TIME"] = llformat("%d",(U32)mNeedsUploadTimer.getElapsedTimeF32()); - args["BODYREGION"] = mTexLayerSet->getBodyRegionName(); + args["BODYREGION"] = layer_set->getBodyRegionName(); args["RESOLUTION"] = lod_str; LLNotificationsUtil::add("AvatarRezSelfBakedTextureUploadNotification",args); - LL_DEBUGS("Avatar") << self_av_string() << "Uploading [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << LL_ENDL; + LL_DEBUGS("Avatar") << self_av_string() << "Uploading [ name: " << layer_set->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << LL_ENDL; } } else @@ -557,9 +507,10 @@ void LLTexLayerSetBuffer::doUpload() // Mostly bookkeeping; don't need to actually "do" anything since // render() will actually do the update. -void LLTexLayerSetBuffer::doUpdate() +void LLViewerTexLayerSetBuffer::doUpdate() { - const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); + LLViewerTexLayerSet* layer_set = getViewerTexLayerSet(); + const BOOL highest_lod = layer_set->isLocalTextureDataFinal(); if (highest_lod) { mNeedsUpdate = FALSE; @@ -573,25 +524,25 @@ void LLTexLayerSetBuffer::doUpdate() // need to switch to using this layerset if this is the first update // after getting the lowest LOD - mTexLayerSet->getAvatar()->updateMeshTextures(); + layer_set->getAvatar()->updateMeshTextures(); // Print out notification that we updated this texture. if (gSavedSettings.getBOOL("DebugAvatarRezTime")) { - const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); + const BOOL highest_lod = layer_set->isLocalTextureDataFinal(); const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32()); + args["EXISTENCE"] = llformat("%d",(U32)layer_set->getAvatar()->debugGetExistenceTimeElapsedF32()); args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32()); - args["BODYREGION"] = mTexLayerSet->getBodyRegionName(); + args["BODYREGION"] = layer_set->getBodyRegionName(); args["RESOLUTION"] = lod_str; LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args); - LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL; + LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << layer_set->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL; } } // static -void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, +void LLViewerTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* userdata, S32 result, LLExtStat ext_status) // StoreAssetData callback (not fixed) @@ -603,7 +554,7 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, (baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures. (baked_upload_data->mTexLayerSet->hasComposite())) { - LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite(); + LLViewerTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getViewerComposite(); S32 failures = layerset_buffer->mUploadFailCount; layerset_buffer->mUploadFailCount = 0; @@ -627,7 +578,7 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, if (result >= 0) { layerset_buffer->mUploadPending = FALSE; // Allows sending of AgentSetAppearance later - LLAvatarAppearanceDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet); + LLAvatarAppearanceDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->getViewerTexLayerSet()); // Update baked texture info with the new UUID U64 now = LLFrameTimer::getTotalTime(); // Record starting time llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; @@ -673,7 +624,6 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) : LLTexLayerSet(appearance), - mComposite( NULL ), mUpdatesEnabled( FALSE ) { } @@ -704,24 +654,31 @@ void LLViewerTexLayerSet::requestUpdate() if( mUpdatesEnabled ) { createComposite(); - mComposite->requestUpdate(); + getViewerComposite()->requestUpdate(); } } void LLViewerTexLayerSet::requestUpload() { createComposite(); - mComposite->requestUpload(); + getViewerComposite()->requestUpload(); } void LLViewerTexLayerSet::cancelUpload() { if(mComposite) { - mComposite->cancelUpload(); + getViewerComposite()->cancelUpload(); } } +void LLViewerTexLayerSet::updateComposite() +{ + createComposite(); + getViewerComposite()->requestUpdateImmediate(); +} + +// virtual void LLViewerTexLayerSet::createComposite() { if(!mComposite) @@ -733,15 +690,7 @@ void LLViewerTexLayerSet::createComposite() { llerrs << "composites should not be created for non-self avatars!" << llendl; } - mComposite = new LLTexLayerSetBuffer( this, width, height ); - } -} - -void LLViewerTexLayerSet::destroyComposite() -{ - if( mComposite ) - { - mComposite = NULL; + mComposite = new LLViewerTexLayerSetBuffer( this, width, height ); } } @@ -751,26 +700,6 @@ void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b ) } -void LLViewerTexLayerSet::updateComposite() -{ - createComposite(); - mComposite->requestUpdateImmediate(); -} - -LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() -{ - if (!mComposite) - { - createComposite(); - } - return mComposite; -} - -const LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() const -{ - return mComposite; -} - void LLViewerTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) { memset(data, 255, width * height); @@ -778,29 +707,44 @@ void LLViewerTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) { LLTexLayerInterface* layer = *iter; - layer->gatherAlphaMasks(data, mComposite->getOriginX(),mComposite->getOriginY(), width, height); + layer->gatherAlphaMasks(data, getViewerComposite()->getOriginX(), + getViewerComposite()->getOriginY(), width, height); } // Set alpha back to that of our alpha masks. - renderAlphaMaskTextures(mComposite->getOriginX(), mComposite->getOriginY(), width, height, true); + renderAlphaMaskTextures(getViewerComposite()->getOriginX(), + getViewerComposite()->getOriginY(), width, height, true); } - -LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const +LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() { return dynamic_cast (mAvatarAppearance); } +const LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const +{ + return dynamic_cast (mAvatarAppearance); +} + +LLViewerTexLayerSetBuffer* LLViewerTexLayerSet::getViewerComposite() +{ + return dynamic_cast (getComposite()); +} + +const LLViewerTexLayerSetBuffer* LLViewerTexLayerSet::getViewerComposite() const +{ + return dynamic_cast (getComposite()); +} -const std::string LLTexLayerSetBuffer::dumpTextureInfo() const +const std::string LLViewerTexLayerSetBuffer::dumpTextureInfo() const { if (!isAgentAvatarValid()) return ""; const BOOL is_high_res = !mNeedsUpload; const U32 num_low_res = mNumLowresUploads; const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32(); - const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet); + const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(getViewerTexLayerSet()); std::string status = "CREATING "; if (!uploadNeeded()) status = "DONE "; diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index 125bf82adf..6788214f3a 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -31,7 +31,7 @@ #include "lltexlayer.h" class LLVOAvatarSelf; -class LLTexLayerSetBuffer; +class LLViewerTexLayerSetBuffer; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLViewerTexLayerSet @@ -41,46 +41,43 @@ class LLTexLayerSetBuffer; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLViewerTexLayerSet : public LLTexLayerSet { - friend class LLTexLayerSetBuffer; public: LLViewerTexLayerSet(LLAvatarAppearance* const appearance); virtual ~LLViewerTexLayerSet(); - LLTexLayerSetBuffer* getComposite(); - const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist. virtual void requestUpdate(); void requestUpload(); void cancelUpload(); - void updateComposite(); BOOL isLocalTextureDataAvailable() const; BOOL isLocalTextureDataFinal() const; - void createComposite(); - void destroyComposite(); + void updateComposite(); + /*virtual*/void createComposite(); void setUpdatesEnabled(BOOL b); BOOL getUpdatesEnabled() const { return mUpdatesEnabled; } void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height); - LLVOAvatarSelf* getAvatar() const; - BOOL hasComposite() const { return (mComposite.notNull()); } + LLVOAvatarSelf* getAvatar(); + const LLVOAvatarSelf* getAvatar() const; + LLViewerTexLayerSetBuffer* getViewerComposite(); + const LLViewerTexLayerSetBuffer* getViewerComposite() const; private: - LLPointer mComposite; BOOL mUpdatesEnabled; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// LLTexLayerSetBuffer +// LLViewerTexLayerSetBuffer // -// The composite image that a LLViewerTexLayerSet writes to. Each LLTexLayerSet has one. +// The composite image that a LLViewerTexLayerSet writes to. Each LLViewerTexLayerSet has one. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLTexLayerSetBuffer : public LLViewerDynamicTexture +class LLViewerTexLayerSetBuffer : public LLTexLayerSetBuffer, public LLViewerDynamicTexture { - LOG_CLASS(LLTexLayerSetBuffer); + LOG_CLASS(LLViewerTexLayerSetBuffer); public: - LLTexLayerSetBuffer(LLViewerTexLayerSet* const owner, S32 width, S32 height); - virtual ~LLTexLayerSetBuffer(); + LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height); + virtual ~LLViewerTexLayerSetBuffer(); public: /*virtual*/ S8 getType() const; @@ -89,23 +86,34 @@ public: const std::string dumpTextureInfo() const; virtual void restoreGLTexture(); virtual void destroyGLTexture(); -protected: - void pushProjection() const; - void popProjection() const; private: - LLViewerTexLayerSet* const mTexLayerSet; + LLViewerTexLayerSet* getViewerTexLayerSet() + { return dynamic_cast (mTexLayerSet); } + const LLViewerTexLayerSet* getViewerTexLayerSet() const + { return dynamic_cast (mTexLayerSet); } static S32 sGLByteCount; //-------------------------------------------------------------------- - // Render + // Tex Layer Render + //-------------------------------------------------------------------- + virtual void preRenderTexLayerSet(); + virtual void midRenderTexLayerSet(BOOL success); + virtual void postRenderTexLayerSet(BOOL success); + virtual S32 getCompositeOriginX() const { return getOriginX(); } + virtual S32 getCompositeOriginY() const { return getOriginY(); } + virtual S32 getCompositeWidth() const { return getFullWidth(); } + virtual S32 getCompositeHeight() const { return getFullHeight(); } + + //-------------------------------------------------------------------- + // Dynamic Texture Interface //-------------------------------------------------------------------- public: /*virtual*/ BOOL needsRender(); protected: - BOOL render(S32 x, S32 y, S32 width, S32 height); - virtual void preRender(BOOL clear_depth); - virtual void postRender(BOOL success); - virtual BOOL render(); + // Pass these along for tex layer rendering. + virtual void preRender(BOOL clear_depth) { preRenderTexLayerSet(); } + virtual void postRender(BOOL success) { postRenderTexLayerSet(success); } + virtual BOOL render() { return renderTexLayerSet(); } //-------------------------------------------------------------------- // Uploads diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 56ded53b5d..4e17884e0e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6722,7 +6722,7 @@ void LLVOAvatar::updateMeshTextures() // use the last-known good baked texture until it finish the first // render of the new layerset. const BOOL layerset_invalid = mBakedTextureDatas[i].mTexLayerSet - && ( !mBakedTextureDatas[i].mTexLayerSet->getComposite()->isInitialized() + && ( !mBakedTextureDatas[i].mTexLayerSet->getViewerComposite()->isInitialized() || !mBakedTextureDatas[i].mTexLayerSet->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index ec37e6f301..e836a5e4a8 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1519,7 +1519,7 @@ BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLAvatarAppearanceDefines::EBaked { const LLViewerTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet; if (!layerset) return FALSE; - const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); + const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); if (!layerset_buffer) return FALSE; return !layerset_buffer->uploadNeeded(); } @@ -1614,7 +1614,7 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { LLViewerTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet; - if (layerset && layerset->getComposite() && layerset->getComposite()->uploadPending()) + if (layerset && layerset->getViewerComposite() && layerset->getViewerComposite()->uploadPending()) { return true; } @@ -2517,7 +2517,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); if (!layerset) continue; - const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); + const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); if (!layerset_buffer) continue; LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl; } -- cgit v1.2.3 From 1f6e20c5bbfd4495e6493facd2363fd133fe7fcd Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 17:43:08 +0000 Subject: Split gl-specific LLViewerTexture implementation into llrender/LLGLViewerTexture --- indra/newview/llcolorswatch.cpp | 2 +- indra/newview/lldrawpoolbump.cpp | 4 +- indra/newview/lldrawpoolterrain.cpp | 8 +- indra/newview/lldrawpoolwater.cpp | 4 +- indra/newview/lldynamictexture.cpp | 2 +- indra/newview/llface.cpp | 4 +- indra/newview/llfloatermodelpreview.cpp | 2 +- indra/newview/llfloaterreporter.cpp | 4 +- indra/newview/llfloaterscriptdebug.cpp | 2 +- indra/newview/lllocalbitmaps.cpp | 2 +- indra/newview/llpreviewtexture.cpp | 6 +- indra/newview/llselectmgr.cpp | 6 +- indra/newview/llspatialpartition.cpp | 4 +- indra/newview/lltexturectrl.cpp | 6 +- indra/newview/lltextureview.cpp | 2 +- indra/newview/llviewerobject.cpp | 10 +- indra/newview/llviewerstats.cpp | 2 +- indra/newview/llviewertexture.cpp | 390 +++-------------------------- indra/newview/llviewertexture.h | 103 +------- indra/newview/llviewertexturelist.cpp | 20 +- indra/newview/llviewertexturelist.h | 14 +- indra/newview/llviewerwearable.cpp | 2 +- indra/newview/llviewerwindow.cpp | 4 +- indra/newview/llvlcomposition.cpp | 6 +- indra/newview/llvoavatar.cpp | 6 +- indra/newview/llvoavatar.h | 4 +- indra/newview/llvoavatarself.h | 4 +- indra/newview/llvograss.cpp | 2 +- indra/newview/llvoicevisualizer.cpp | 2 +- indra/newview/llvosky.cpp | 10 +- indra/newview/llvotree.cpp | 2 +- indra/newview/llvovolume.cpp | 10 +- indra/newview/llworldmap.cpp | 6 +- indra/newview/llworldmipmap.cpp | 16 +- indra/newview/tests/llworldmap_test.cpp | 6 +- indra/newview/tests/llworldmipmap_test.cpp | 4 +- 36 files changed, 129 insertions(+), 552 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 5b942f283a..87fd47cb2c 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -242,7 +242,7 @@ void LLColorSwatchCtrl::draw() if (!mFallbackImageName.empty()) { LLPointer fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, TRUE, - LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if( fallback_image->getComponents() == 4 ) { gl_rect_2d_checkerboard( interior ); diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index a264eae302..74633e4e42 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -153,7 +153,7 @@ void LLStandardBumpmap::addstandard() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::BOOST_BUMP) ; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ; LLStandardBumpmap::sStandardBumpmapCount++; @@ -1075,7 +1075,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText src_image->getHeight() != bump->getHeight())// || //(LLPipeline::sRenderDeferred && bump->getComponents() != 4)) { - src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; + src_image->setBoostLevel(LLGLTexture::BOOST_BUMP) ; src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL ); src_image->forceToSaveRawImage(0) ; } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 9bc32fddbd..809f34bdff 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -69,7 +69,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", - TRUE, LLViewerTexture::BOOST_UI, + TRUE, LLGLTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, format, int_format, LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); @@ -78,7 +78,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c", - TRUE, LLViewerTexture::BOOST_UI, + TRUE, LLGLTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, format, int_format, LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); @@ -86,7 +86,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); - mTexturep->setBoostLevel(LLViewerTexture::BOOST_TERRAIN); + mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN); //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } @@ -170,7 +170,7 @@ void LLDrawPoolTerrain::render(S32 pass) LLVLComposition *compp = regionp->getComposition(); for (S32 i = 0; i < 4; i++) { - compp->mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_TERRAIN); + compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area } diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 4f6eaa5a5b..26890bd75f 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -66,11 +66,11 @@ LLVector3 LLDrawPoolWater::sLightDir; LLDrawPoolWater::LLDrawPoolWater() : LLFacePool(POOL_WATER) { - mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLViewerTexture::BOOST_UI); + mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLGLTexture::BOOST_UI); gGL.getTexUnit(0)->bind(mHBTex[0]) ; mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP); - mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLViewerTexture::BOOST_UI); + mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLGLTexture::BOOST_UI); gGL.getTexUnit(0)->bind(mHBTex[1]); mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index fa42b157a7..29ad4f34d2 100755 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -107,7 +107,7 @@ void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum { setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); } - createGLTexture(0, raw_image, 0, TRUE, LLViewerTexture::DYNAMIC_TEX); + createGLTexture(0, raw_image, 0, TRUE, LLGLTexture::DYNAMIC_TEX); setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP); mGLTexturep->setGLTextureCreated(false); } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 4a0c94df33..947ab84eec 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -560,8 +560,8 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) /* removed in lieu of raycast uv detection void LLFace::renderSelectedUV() { - LLViewerTexture* red_blue_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test1.j2c", TRUE, LLViewerTexture::BOOST_UI); - LLViewerTexture* green_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test2.tga", TRUE, LLViewerTexture::BOOST_UI); + LLViewerTexture* red_blue_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test1.j2c", TRUE, LLGLTexture::BOOST_UI); + LLViewerTexture* green_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test2.tga", TRUE, LLGLTexture::BOOST_UI); LLGLSUVSelect object_select; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index a071f338ba..dbab15dc9e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2488,7 +2488,7 @@ void LLModelLoader::loadTextures() if(!material.mDiffuseMapFilename.empty()) { material.mDiffuseMap = - LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, TRUE, LLViewerTexture::BOOST_PREVIEW); + LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, TRUE, LLGLTexture::BOOST_PREVIEW); material.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE); material.mDiffuseMap->forceToSaveRawImage(0, F32_MAX); mNumOfFetchingTextures++ ; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 479bdd5ff7..da773e90ec 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -765,8 +765,8 @@ void LLFloaterReporter::takeScreenshot() // store in the image list so it doesn't try to fetch from the server LLPointer image_in_list = - LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE); - image_in_list->createGLTexture(0, raw, 0, TRUE, LLViewerTexture::OTHER); + LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE); + image_in_list->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER); // the texture picker then uses that texture LLTexturePicker* texture = getChild("screenshot"); diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index b691db1049..c987dbb4fb 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -105,7 +105,7 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std: if (objectp) { - objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", TRUE, LLViewerTexture::BOOST_UI)); + objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", TRUE, LLGLTexture::BOOST_UI)); floater_label = llformat("%s(%.0f, %.0f, %.0f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index fce4c29870..3a199135b6 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -440,7 +440,7 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id) if (face && face->getTexture() && face->getTexture()->getID() == old_id) { object->setTEImage(face_iter, LLViewerTextureManager::getFetchedTexture - (new_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + (new_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); update_obj = true; } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 3ff5a05d81..3784208e37 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -70,7 +70,7 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key) mAspectRatio(0.f), mPreviewToSave(FALSE), mImage(NULL), - mImageOldBoostLevel(LLViewerTexture::BOOST_NONE) + mImageOldBoostLevel(LLGLTexture::BOOST_NONE) { updateImageID(); if (key.has("save_as")) @@ -468,9 +468,9 @@ void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata) void LLPreviewTexture::loadAsset() { - mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); mImageOldBoostLevel = mImage->getBoostLevel(); - mImage->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); + mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW); mImage->forceToSaveRawImage(0) ; mAssetStatus = PREVIEW_ASSET_LOADING; mUpdateDimensions = TRUE; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index c3c37141ed..24e272c740 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1608,7 +1608,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) // Texture picker defaults aren't inventory items // * Don't need to worry about permissions for them // * Can just apply the texture and be done with it. - objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } return true; } @@ -1774,7 +1774,7 @@ BOOL LLSelectMgr::selectionRevertTextures() } else { - object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } } @@ -5198,7 +5198,7 @@ void LLSelectMgr::updateSilhouettes() if (!mSilhouetteImagep) { - mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", TRUE, LLViewerTexture::BOOST_UI); + mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", TRUE, LLGLTexture::BOOST_UI); } mHighlightedObjects->cleanupNodes(); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 06c87e57fc..c804898cc3 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3574,9 +3574,9 @@ void renderTexturePriority(LLDrawable* drawable) drawBox(center, size); /*S32 boost = imagep->getBoostLevel(); - if (boost>LLViewerTexture::BOOST_NONE) + if (boost>LLGLTexture::BOOST_NONE) { - F32 t = (F32) boost / (F32) (LLViewerTexture::BOOST_MAX_LEVEL-1); + F32 t = (F32) boost / (F32) (LLGLTexture::BOOST_MAX_LEVEL-1); LLVector4 col = lerp(boost_cold, boost_hot, t); LLGLEnable blend_on(GL_BLEND); gGL.blendFunc(GL_SRC_ALPHA, GL_ONE); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index ec36cf48c2..3dc506d265 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -571,7 +571,7 @@ void LLFloaterTexturePicker::draw() if(mImageAssetID.notNull()) { mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES); - mTexturep->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); + mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW); } if (mTentativeLabel) @@ -1456,9 +1456,9 @@ void LLTextureCtrl::draw() } else if (!mImageAssetID.isNull()) { - LLPointer texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES,LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLPointer texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES,LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - texture->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); + texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW); texture->forceToSaveRawImage(0) ; mTexturep = texture; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 03529b9246..e9615e2613 100755 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -170,7 +170,7 @@ void LLTextureBar::draw() { color = LLColor4::green4; } - else if (mImagep->getBoostLevel() > LLViewerTexture::BOOST_NONE) + else if (mImagep->getBoostLevel() > LLGLTexture::BOOST_NONE) { color = LLColor4::magenta; } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 0bf039224c..3bb7de74e1 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3290,14 +3290,14 @@ void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) S32 tex_count = getNumTEs(); for (i = 0; i < tex_count; i++) { - getTEImage(i)->setBoostLevel(LLViewerTexture::BOOST_SELECTED); + getTEImage(i)->setBoostLevel(LLGLTexture::BOOST_SELECTED); } if (isSculpted() && !isMesh()) { LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLUUID sculpt_id = sculpt_params->getSculptTexture(); - LLViewerTextureManager::getFetchedTexture(sculpt_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLViewerTexture::BOOST_SELECTED); + LLViewerTextureManager::getFetchedTexture(sculpt_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); } if (boost_children) @@ -4044,7 +4044,7 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) // if (mDrawable.notNull() && mDrawable->isVisible()) // { const LLUUID& image_id = getTE(te)->getID(); - mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); // } } @@ -4070,7 +4070,7 @@ S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, const std: uuid == LLUUID::null) { retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTextureFromUrl (url, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + mTEImages[te] = LLViewerTextureManager::getFetchedTextureFromUrl (url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4087,7 +4087,7 @@ S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, LLHost hos uuid == LLUUID::null) { retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTexture(uuid, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + mTEImages[te] = LLViewerTextureManager::getFetchedTexture(uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); setChanged(TEXTURE); if (mDrawable.notNull()) { diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 961c7082cf..635cda4e27 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -564,7 +564,7 @@ F32 gWorstLandCompression = 0.f, gWorstWaterCompression = 0.f; U32 gTotalWorldBytes = 0, gTotalObjectBytes = 0, gTotalTextureBytes = 0, gSimPingCount = 0; U32 gObjectBits = 0; F32 gAvgSimPing = 0.f; -U32 gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {0}; +U32 gTotalTextureBytesPerBoostLevel[LLGLTexture::MAX_GL_IMAGE_CATEGORY] = {0}; extern U32 gVisCompared; extern U32 gVisTested; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index c362269b81..a73ce1d115 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -233,7 +233,7 @@ LLPointer LLViewerTextureManager::getLocalTexture(BOOL usemipma if(generate_gl_tex) { tex->generateGLTexture() ; - tex->setCategory(LLViewerTexture::LOCAL) ; + tex->setCategory(LLGLTexture::LOCAL) ; } return tex ; } @@ -243,14 +243,14 @@ LLPointer LLViewerTextureManager::getLocalTexture(const LLUUID& if(generate_gl_tex) { tex->generateGLTexture() ; - tex->setCategory(LLViewerTexture::LOCAL) ; + tex->setCategory(LLGLTexture::LOCAL) ; } return tex ; } LLPointer LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps) { LLPointer tex = new LLViewerTexture(raw, usemipmaps) ; - tex->setCategory(LLViewerTexture::LOCAL) ; + tex->setCategory(LLGLTexture::LOCAL) ; return tex ; } LLPointer LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex) @@ -259,7 +259,7 @@ LLPointer LLViewerTextureManager::getLocalTexture(const U32 wid if(generate_gl_tex) { tex->generateGLTexture() ; - tex->setCategory(LLViewerTexture::LOCAL) ; + tex->setCategory(LLGLTexture::LOCAL) ; } return tex ; } @@ -309,17 +309,17 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const // Create a bridge to the viewer texture manager. class LLViewerTextureManagerBridge : public LLTextureManagerBridge { - /*virtual*/ LLPointer getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) + /*virtual*/ LLPointer getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) { return LLViewerTextureManager::getLocalTexture(usemipmaps, generate_gl_tex); } - /*virtual*/ LLPointer getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) + /*virtual*/ LLPointer getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) { return LLViewerTextureManager::getLocalTexture(width, height, components, usemipmaps, generate_gl_tex); } - /*virtual*/ LLTexture* getFetchedTexture(const LLUUID &image_id) + /*virtual*/ LLGLTexture* getFetchedTexture(const LLUUID &image_id) { return LLViewerTextureManager::getFetchedTexture(image_id); } @@ -371,12 +371,12 @@ void LLViewerTextureManager::init() imagep->setCachedRawImage(0, image_raw) ; image_raw = NULL; #else - LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLViewerTexture::BOOST_UI); + LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI); #endif LLViewerFetchedTexture::sDefaultImagep->dontDiscard(); - LLViewerFetchedTexture::sDefaultImagep->setCategory(LLViewerTexture::OTHER) ; + LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ; - LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, TRUE, LLViewerTexture::BOOST_UI); + LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, TRUE, LLGLTexture::BOOST_UI); LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ; image_raw = new LLImageRaw(32,32,3); @@ -442,25 +442,6 @@ void LLViewerTexture::initClass() } } -// static -S32 LLViewerTexture::getTotalNumOfCategories() -{ - return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2 ; -} - -// static -//index starts from zero. -S32 LLViewerTexture::getIndexFromCategory(S32 category) -{ - return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1 ; -} - -//static -S32 LLViewerTexture::getCategoryFromIndex(S32 index) -{ - return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1 ; -} - // tuning params const F32 discard_bias_delta = .25f; const F32 discard_delta_time = 0.5f; @@ -597,45 +578,38 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity //------------------------------------------------------------------------------------------- const U32 LLViewerTexture::sCurrentFileVersion = 1; -LLViewerTexture::LLViewerTexture(BOOL usemipmaps) +LLViewerTexture::LLViewerTexture(BOOL usemipmaps) : + LLGLTexture(usemipmaps) { init(true); - mUseMipMaps = usemipmaps ; mID.generate(); sImageCount++; } -LLViewerTexture::LLViewerTexture(const LLUUID& id, BOOL usemipmaps) - : mID(id) +LLViewerTexture::LLViewerTexture(const LLUUID& id, BOOL usemipmaps) : + LLGLTexture(usemipmaps), + mID(id) { init(true); - mUseMipMaps = usemipmaps ; sImageCount++; } -LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) +LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) : + LLGLTexture(width, height, components, usemipmaps) { init(true); - mFullWidth = width ; - mFullHeight = height ; - mUseMipMaps = usemipmaps ; - mComponents = components ; - setTexelsPerImage(); - mID.generate(); sImageCount++; } -LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) +LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) : + LLGLTexture(raw, usemipmaps) { init(true); - mUseMipMaps = usemipmaps ; - mGLTexturep = new LLImageGL(raw, usemipmaps) ; - // Create an empty image of the specified size and width mID.generate(); sImageCount++; } @@ -646,20 +620,10 @@ LLViewerTexture::~LLViewerTexture() sImageCount--; } +// virtual void LLViewerTexture::init(bool firstinit) { - mBoostLevel = LLViewerTexture::BOOST_NONE; - - mFullWidth = 0; - mFullHeight = 0; - mTexelsPerImage = 0 ; - mUseMipMaps = FALSE ; - mComponents = 0 ; - - mTextureState = NO_DELETE ; - mDontDiscard = FALSE; mMaxVirtualSize = 0.f; - mNeedsGLTexture = FALSE ; mMaxVirtualSizeResetInterval = 1; mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval ; mAdditionalDecodePriority = 0.f ; @@ -680,38 +644,18 @@ void LLViewerTexture::cleanup() { mFaceList.clear() ; mVolumeList.clear(); - if(mGLTexturep) - { - mGLTexturep->cleanup(); - } } // virtual void LLViewerTexture::dump() { - if(mGLTexturep) - { - mGLTexturep->dump(); - } + LLGLTexture::dump(); llinfos << "LLViewerTexture" << " mID " << mID << llendl; } -void LLViewerTexture::setBoostLevel(S32 level) -{ - if(mBoostLevel != level) - { - mBoostLevel = level ; - if(mBoostLevel != LLViewerTexture::BOOST_NONE) - { - setNoDelete() ; - } - } -} - - bool LLViewerTexture::bindDefaultImage(S32 stage) { if (stage < 0) return false; @@ -904,294 +848,18 @@ void LLViewerTexture::reorganizeVolumeList() mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end()); } - - //virtual void LLViewerTexture::switchToCachedImage() { //nothing here. } -void LLViewerTexture::forceActive() -{ - mTextureState = ACTIVE ; -} - -void LLViewerTexture::setActive() -{ - if(mTextureState != NO_DELETE) - { - mTextureState = ACTIVE ; - } -} - -//set the texture to stay in memory -void LLViewerTexture::setNoDelete() -{ - mTextureState = NO_DELETE ; -} - -void LLViewerTexture::generateGLTexture() -{ - if(mGLTexturep.isNull()) - { - mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps) ; - } -} - -LLImageGL* LLViewerTexture::getGLTexture() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep ; -} - -BOOL LLViewerTexture::createGLTexture() -{ - if(mGLTexturep.isNull()) - { - generateGLTexture() ; - } - - return mGLTexturep->createGLTexture() ; -} - -BOOL LLViewerTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category) -{ - llassert(mGLTexturep.notNull()) ; - - BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ; - - if(ret) - { - mFullWidth = mGLTexturep->getCurrentWidth() ; - mFullHeight = mGLTexturep->getCurrentHeight() ; - mComponents = mGLTexturep->getComponents() ; - setTexelsPerImage(); - } - - return ret ; -} - //virtual void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) { //nothing here. } -void LLViewerTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) -{ - llassert(mGLTexturep.notNull()) ; - - mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes) ; -} -void LLViewerTexture::setAddressMode(LLTexUnit::eTextureAddressMode mode) -{ - llassert(mGLTexturep.notNull()) ; - mGLTexturep->setAddressMode(mode) ; -} -void LLViewerTexture::setFilteringOption(LLTexUnit::eTextureFilterOptions option) -{ - llassert(mGLTexturep.notNull()) ; - mGLTexturep->setFilteringOption(option) ; -} - -//virtual -S32 LLViewerTexture::getWidth(S32 discard_level) const -{ - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getWidth(discard_level) ; -} - -//virtual -S32 LLViewerTexture::getHeight(S32 discard_level) const -{ - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getHeight(discard_level) ; -} - -S32 LLViewerTexture::getMaxDiscardLevel() const -{ - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getMaxDiscardLevel() ; -} -S32 LLViewerTexture::getDiscardLevel() const -{ - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getDiscardLevel() ; -} -S8 LLViewerTexture::getComponents() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getComponents() ; -} - -LLGLuint LLViewerTexture::getTexName() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getTexName() ; -} - -BOOL LLViewerTexture::hasGLTexture() const -{ - if(mGLTexturep.notNull()) - { - return mGLTexturep->getHasGLTexture() ; - } - return FALSE ; -} - -BOOL LLViewerTexture::getBoundRecently() const -{ - if(mGLTexturep.notNull()) - { - return mGLTexturep->getBoundRecently() ; - } - return FALSE ; -} - -LLTexUnit::eTextureType LLViewerTexture::getTarget(void) const -{ - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getTarget() ; -} - -BOOL LLViewerTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height) -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height) ; -} - -BOOL LLViewerTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height) -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height) ; -} - -void LLViewerTexture::setGLTextureCreated (bool initialized) -{ - llassert(mGLTexturep.notNull()) ; - - mGLTexturep->setGLTextureCreated (initialized) ; -} - -void LLViewerTexture::setCategory(S32 category) -{ - llassert(mGLTexturep.notNull()) ; - - mGLTexturep->setCategory(category) ; -} - -LLTexUnit::eTextureAddressMode LLViewerTexture::getAddressMode(void) const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getAddressMode() ; -} - -S32 LLViewerTexture::getTextureMemory() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->mTextureMemory ; -} - -LLGLenum LLViewerTexture::getPrimaryFormat() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getPrimaryFormat() ; -} - -BOOL LLViewerTexture::getIsAlphaMask() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getIsAlphaMask() ; -} - -BOOL LLViewerTexture::getMask(const LLVector2 &tc) -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getMask(tc) ; -} - -F32 LLViewerTexture::getTimePassedSinceLastBound() -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getTimePassedSinceLastBound() ; -} -BOOL LLViewerTexture::getMissed() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getMissed() ; -} - -BOOL LLViewerTexture::isJustBound() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->isJustBound() ; -} - -void LLViewerTexture::forceUpdateBindStats(void) const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->forceUpdateBindStats() ; -} - -U32 LLViewerTexture::getTexelsInAtlas() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getTexelsInAtlas() ; -} - -U32 LLViewerTexture::getTexelsInGLTexture() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getTexelsInGLTexture() ; -} - -BOOL LLViewerTexture::isGLTextureCreated() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->isGLTextureCreated() ; -} - -S32 LLViewerTexture::getDiscardLevelInAtlas() const -{ - llassert(mGLTexturep.notNull()) ; - - return mGLTexturep->getDiscardLevelInAtlas() ; -} - -void LLViewerTexture::destroyGLTexture() -{ - if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture()) - { - mGLTexturep->destroyGLTexture() ; - mTextureState = DELETED ; - } -} - -void LLViewerTexture::setTexelsPerImage() -{ - S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT); - S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT); - mTexelsPerImage = (F32)fullwidth * fullheight; -} - BOOL LLViewerTexture::isLargeImage() { return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize ; @@ -1775,7 +1443,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() // Don't decode anything we don't need priority = -4.0f; } - else if ((mBoostLevel == LLViewerTexture::BOOST_UI || mBoostLevel == LLViewerTexture::BOOST_ICON) && !have_all_data) + else if ((mBoostLevel == LLGLTexture::BOOST_UI || mBoostLevel == LLGLTexture::BOOST_ICON) && !have_all_data) { priority = 1.f; } @@ -2161,7 +1829,7 @@ bool LLViewerFetchedTexture::updateFetch() // Load the texture progressively: we try not to rush to the desired discard too fast. // If the camera is not moving, we do not tweak the discard level notch by notch but go to the desired discard with larger boosted steps // This mitigates the "textures stay blurry" problem when loading while not killing the texture memory while moving around - S32 delta_level = (mBoostLevel > LLViewerTexture::BOOST_NONE) ? 2 : 1 ; + S32 delta_level = (mBoostLevel > LLGLTexture::BOOST_NONE) ? 2 : 1 ; if (current_discard < 0) { desired_discard = llmax(desired_discard, getMaxDiscardLevel() - delta_level); @@ -2412,7 +2080,7 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so destroySavedRawImage() ; } } - else if(needsToSaveRawImage() && mBoostLevel != LLViewerTexture::BOOST_PREVIEW) + else if(needsToSaveRawImage() && mBoostLevel != LLGLTexture::BOOST_PREVIEW) { if(desired_raw_discard != INVALID_DISCARD_LEVEL) { @@ -2870,7 +2538,7 @@ void LLViewerFetchedTexture::setCachedRawImage() S32 h = mRawImage->getHeight() ; S32 max_size = MAX_CACHED_RAW_IMAGE_AREA ; - if(LLViewerTexture::BOOST_TERRAIN == mBoostLevel) + if(LLGLTexture::BOOST_TERRAIN == mBoostLevel) { max_size = MAX_CACHED_RAW_TERRAIN_IMAGE_AREA ; } @@ -3243,7 +2911,7 @@ void LLViewerLODTexture::processTextureStats() if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048 } - else if (mBoostLevel < LLViewerTexture::BOOST_HIGH && mMaxVirtualSize <= 10.f) + else if (mBoostLevel < LLGLTexture::BOOST_HIGH && mMaxVirtualSize <= 10.f) { // If the image has not been significantly visible in a while, we don't want it mDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)(MAX_DISCARD_LEVEL + 1)); @@ -3293,7 +2961,7 @@ void LLViewerLODTexture::processTextureStats() mCalculatedDiscardLevel = discard_level; } } - if (mBoostLevel < LLViewerTexture::BOOST_SCULPTED) + if (mBoostLevel < LLGLTexture::BOOST_SCULPTED) { discard_level += sDesiredDiscardBias; discard_level *= sDesiredDiscardScale; // scale @@ -3319,7 +2987,7 @@ void LLViewerLODTexture::processTextureStats() // S32 current_discard = getDiscardLevel(); - if (sDesiredDiscardBias > 0.0f && mBoostLevel < LLViewerTexture::BOOST_SCULPTED && current_discard >= 0) + if (sDesiredDiscardBias > 0.0f && mBoostLevel < LLGLTexture::BOOST_SCULPTED && current_discard >= 0) { if(desired_discard_bias_max <= sDesiredDiscardBias && !mForceToSaveRawImage) { @@ -3462,7 +3130,7 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL setMediaImpl() ; - setCategory(LLViewerTexture::MEDIA) ; + setCategory(LLGLTexture::MEDIA) ; LLViewerTexture* tex = gTextureList.findImage(mID) ; if(tex) //this media is a parcel media for tex. diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 4b92a2bf8a..d180d7fa99 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -27,7 +27,7 @@ #ifndef LL_LLVIEWERTEXTURE_H #define LL_LLVIEWERTEXTURE_H -#include "lltexture.h" +#include "llgltexture.h" #include "lltimer.h" #include "llframetimer.h" #include "llhost.h" @@ -88,14 +88,9 @@ public: class LLTextureBar; -class LLViewerTexture : public LLTexture +class LLViewerTexture : public LLGLTexture { public: - enum - { - MAX_IMAGE_SIZE_DEFAULT = 1024, - INVALID_DISCARD_LEVEL = 0x7fff - }; enum { LOCAL_TEXTURE, @@ -107,10 +102,6 @@ public: INVALID_TEXTURE_TYPE }; - static S32 getTotalNumOfCategories() ; - static S32 getIndexFromCategory(S32 category) ; - static S32 getCategoryFromIndex(S32 index) ; - typedef std::vector ll_face_list_t; typedef std::vector ll_volume_list_t; @@ -137,9 +128,6 @@ public: /*virtual*/ const LLUUID& getID() const { return mID; } - void setBoostLevel(S32 level); - S32 getBoostLevel() { return mBoostLevel; } - void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const; void resetTextureStats(); void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;} @@ -149,8 +137,6 @@ public: LLFrameTimer* getLastReferencedTimer() {return &mLastReferencedTimer ;} - S32 getFullWidth() const { return mFullWidth; } - S32 getFullHeight() const { return mFullHeight; } /*virtual*/ void setKnownDrawSize(S32 width, S32 height); virtual void addFace(LLFace* facep) ; @@ -163,60 +149,8 @@ public: S32 getNumVolumes() const; const ll_volume_list_t* getVolumeList() const { return &mVolumeList; } - void generateGLTexture() ; - void destroyGLTexture() ; - - //--------------------------------------------------------------------------------------------- - //functions to access LLImageGL - //--------------------------------------------------------------------------------------------- - /*virtual*/S32 getWidth(S32 discard_level = -1) const; - /*virtual*/S32 getHeight(S32 discard_level = -1) const; - /*virtual*/BOOL hasGLTexture() const ; - LLGLuint getTexName() const ; - BOOL createGLTexture() ; - /*virtual*/ BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLTexture::OTHER); virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ; - - void setFilteringOption(LLTexUnit::eTextureFilterOptions option); - /*virtual*/ void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); - /*virtual*/ void setAddressMode(LLTexUnit::eTextureAddressMode mode); - BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height); - BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height); - void setGLTextureCreated (bool initialized); - void setCategory(S32 category) ; - - /*virtual*/ LLTexUnit::eTextureAddressMode getAddressMode(void) const ; - S32 getMaxDiscardLevel() const; - S32 getDiscardLevel() const; - /*virtual*/ S8 getComponents() const; - BOOL getBoundRecently() const; - S32 getTextureMemory() const ; - LLGLenum getPrimaryFormat() const; - BOOL getIsAlphaMask() const ; - LLTexUnit::eTextureType getTarget(void) const ; - BOOL getMask(const LLVector2 &tc); - F32 getTimePassedSinceLastBound(); - BOOL getMissed() const ; - BOOL isJustBound()const ; - void forceUpdateBindStats(void) const; - - U32 getTexelsInAtlas() const ; - U32 getTexelsInGLTexture() const ; - BOOL isGLTextureCreated() const ; - S32 getDiscardLevelInAtlas() const ; - //--------------------------------------------------------------------------------------------- - //end of functions to access LLImageGL - //--------------------------------------------------------------------------------------------- - - //----------------- - /*virtual*/ void setActive() ; - void forceActive() ; - void setNoDelete() ; - void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; } - BOOL getDontDiscard() const { return mDontDiscard; } - //----------------- - BOOL isLargeImage() ; void setParcelMedia(LLViewerMediaTexture* media) {mParcelMedia = media;} @@ -229,35 +163,21 @@ protected: void init(bool firstinit) ; void reorganizeFaceList() ; void reorganizeVolumeList() ; - void setTexelsPerImage(); private: friend class LLBumpImageList; friend class LLUIImageList; - //note: do not make this function public. - /*virtual*/ LLImageGL* getGLTexture() const ; virtual void switchToCachedImage(); static bool isMemoryForTextureLow() ; protected: LLUUID mID; - S32 mBoostLevel; // enum describing priority level - S32 mFullWidth; - S32 mFullHeight; - BOOL mUseMipMaps ; - S8 mComponents; - F32 mTexelsPerImage; // Texels per image. - mutable S8 mNeedsGLTexture; mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need? mutable S32 mMaxVirtualSizeResetCounter ; mutable S32 mMaxVirtualSizeResetInterval; mutable F32 mAdditionalDecodePriority; // priority add to mDecodePriority. LLFrameTimer mLastReferencedTimer; - //GL texture - LLPointer mGLTexturep ; - S8 mDontDiscard; // Keep full res version of this image (for UI, etc) - ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture U32 mNumFaces ; LLFrameTimer mLastFaceListUpdateTimer ; @@ -269,17 +189,6 @@ protected: //do not use LLPointer here. LLViewerMediaTexture* mParcelMedia ; -protected: - typedef enum - { - DELETED = 0, //removed from memory - DELETION_CANDIDATE, //ready to be removed from memory - INACTIVE, //not be used for the last certain period (i.e., 30 seconds). - ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds). - NO_DELETE = 99 //stay in memory, can not be removed. - } LLGLTextureState; - LLGLTextureState mTextureState ; - static F32 sTexelPixelRatio; public: static const U32 sCurrentFileVersion; @@ -475,7 +384,7 @@ protected: S32 getCurrentDiscardLevelForFetching() ; private: - void init(bool firstinit) ; + void init(bool firstinit) ; void cleanup() ; void saveRawImage() ; @@ -698,7 +607,7 @@ public: static LLViewerFetchedTexture* getFetchedTexture(const LLUUID &image_id, BOOL usemipmap = TRUE, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, // Get the requested level immediately upon creation. + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, LLGLenum primary_format = 0, @@ -707,7 +616,7 @@ public: static LLViewerFetchedTexture* getFetchedTextureFromFile(const std::string& filename, BOOL usemipmap = TRUE, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, LLGLenum primary_format = 0, @@ -716,7 +625,7 @@ public: static LLViewerFetchedTexture* getFetchedTextureFromUrl(const std::string& url, BOOL usemipmap = TRUE, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, LLGLenum primary_format = 0, diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index e4669cde34..b89247ec6f 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -198,7 +198,7 @@ void LLViewerTextureList::doPrefetchImages() if(LLViewerTexture::FETCHED_TEXTURE == texture_type || LLViewerTexture::LOD_TEXTURE == texture_type) { - LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, texture_type); + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type); if (image) { image->addTextureStats((F32)pixel_area); @@ -339,7 +339,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& if (full_path.empty()) { llwarns << "Failed to find local image file: " << filename << llendl; - return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLViewerTexture::BOOST_UI); + return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI); } std::string url = "file://" + full_path; @@ -430,7 +430,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, if ((&image_id == NULL) || image_id.isNull()) { - return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLViewerTexture::BOOST_UI)); + return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI)); } LLPointer imagep = findImage(image_id); @@ -1361,7 +1361,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d U8 *data = new U8[data_size]; msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size); - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (!image) { delete [] data; @@ -1434,7 +1434,7 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d U8 *data = new U8[data_size]; msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size); - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (!image) { delete [] data; @@ -1534,9 +1534,9 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priori LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority ) { - if (boost_priority == LLViewerTexture::BOOST_NONE) + if (boost_priority == LLGLTexture::BOOST_NONE) { - boost_priority = LLViewerTexture::BOOST_UI; + boost_priority = LLGLTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, boost_priority); return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect); @@ -1545,9 +1545,9 @@ LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority) { - if (boost_priority == LLViewerTexture::BOOST_NONE) + if (boost_priority == LLGLTexture::BOOST_NONE) { - boost_priority = LLViewerTexture::BOOST_UI; + boost_priority = LLGLTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, boost_priority); return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect); @@ -1572,7 +1572,7 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st //Note: //Some other textures such as ICON also through this flow to be fetched. //But only UI textures need to set this callback. - if(imagep->getBoostLevel() == LLViewerTexture::BOOST_UI) + if(imagep->getBoostLevel() == LLGLTexture::BOOST_UI) { LLUIImageLoadData* datap = new LLUIImageLoadData; datap->mImageName = name; diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 3dda973d3f..05c7c35f7c 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -131,7 +131,7 @@ private: LLViewerFetchedTexture * getImage(const LLUUID &image_id, BOOL usemipmap = TRUE, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, // Get the requested level immediately upon creation. + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, LLGLenum primary_format = 0, @@ -140,7 +140,7 @@ private: LLViewerFetchedTexture * getImageFromFile(const std::string& filename, BOOL usemipmap = TRUE, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, // Get the requested level immediately upon creation. + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, LLGLenum primary_format = 0, @@ -149,7 +149,7 @@ private: LLViewerFetchedTexture* getImageFromUrl(const std::string& url, BOOL usemipmap = TRUE, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, // Get the requested level immediately upon creation. + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, LLGLenum primary_format = 0, @@ -158,7 +158,7 @@ private: LLViewerFetchedTexture* createImage(const LLUUID &image_id, BOOL usemipmap = TRUE, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_NONE, // Get the requested level immediately upon creation. + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, LLGLenum primary_format = 0, @@ -168,7 +168,7 @@ private: // Request image from a specific host, used for baked avatar textures. // Implemented in header in case someone changes default params above. JC LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, LLHost host) - { return getImage(image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } + { return getImage(image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } public: typedef std::set > image_list_t; @@ -233,11 +233,11 @@ private: LLPointer loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_UI); + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI); LLPointer loadUIImageByID(const LLUUID& id, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, - LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_UI); + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI); LLPointer loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null); diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 0cd3ded371..34f24ef330 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -401,7 +401,7 @@ void LLViewerWearable::writeToAvatar() { image_id = getDefaultTextureImageID((ETextureIndex) te); } - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. gAgentAvatarp->setLocalTextureTE(te, image, 0); } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 4aabbd6bb6..d5ca01931f 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -729,7 +729,7 @@ public: if(log_texture_traffic) { U32 old_y = ypos ; - for(S32 i = LLViewerTexture::BOOST_NONE; i < LLViewerTexture::MAX_GL_IMAGE_CATEGORY; i++) + for(S32 i = LLGLTexture::BOOST_NONE; i < LLGLTexture::MAX_GL_IMAGE_CATEGORY; i++) { if(gTotalTextureBytesPerBoostLevel[i] > 0) { @@ -1678,7 +1678,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) // Init the image list. Must happen after GL is initialized and before the images that // LLViewerWindow needs are requested. - LLImageGL::initClass(LLViewerTexture::MAX_GL_IMAGE_CATEGORY) ; + LLImageGL::initClass(LLGLTexture::MAX_GL_IMAGE_CATEGORY) ; gTextureList.init(); LLViewerTextureManager::init() ; gBumpImageList.init(); diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index ec932501e5..e90a2470d4 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -223,7 +223,7 @@ BOOL LLVLComposition::generateComposition() { if (mDetailTextures[i]->getDiscardLevel() < 0) { - mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_TERRAIN); // in case we are at low detail + mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); // in case we are at low detail mDetailTextures[i]->addTextureStats(BASE_SIZE*BASE_SIZE); return FALSE; } @@ -240,7 +240,7 @@ BOOL LLVLComposition::generateComposition() ddiscard++; min_dim /= 2; } - mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_TERRAIN); // in case we are at low detail + mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); // in case we are at low detail mDetailTextures[i]->setMinDiscardLevel(ddiscard); return FALSE; } @@ -463,7 +463,7 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, for (S32 i = 0; i < 4; i++) { // Un-boost detatil textures (will get re-boosted if rendering in high detail) - mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_NONE); + mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_NONE); mDetailTextures[i]->setMinDiscardLevel(MAX_DISCARD_LEVEL + 1); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4e17884e0e..b86c5d5e8f 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4698,7 +4698,7 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel imagep->addTextureStats(pixel_area / texel_area_ratio); imagep->setBoostLevel(boost_level); - if(boost_level != LLViewerTexture::BOOST_AVATAR_BAKED_SELF) + if(boost_level != LLGLTexture::BOOST_AVATAR_BAKED_SELF) { imagep->setAdditionalDecodePriority(ADDITIONAL_PRI) ; } @@ -6748,7 +6748,7 @@ void LLVOAvatar::updateMeshTextures() const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); if (!url.empty()) { - baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); + baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); } else { @@ -7289,7 +7289,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index d54d06a6a7..b8999728b3 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -563,8 +563,8 @@ private: // Constants //-------------------------------------------------------------------- public: - virtual LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLViewerTexture::BOOST_AVATAR; } - virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLViewerTexture::BOOST_AVATAR_BAKED; } + virtual LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR; } + virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED; } virtual S32 getTexImageSize() const; virtual S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index d4bde1f61f..12886d2d36 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -177,8 +177,8 @@ private: // LLVOAvatar Constants //-------------------------------------------------------------------- public: - /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLViewerTexture::BOOST_AVATAR_SELF; } - /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLViewerTexture::BOOST_AVATAR_BAKED_SELF; } + /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR_SELF; } + /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED_SELF; } /*virtual*/ S32 getTexImageSize() const { return LLVOAvatar::getTexImageSize()*4; } /** Rendering diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 566c33c0af..479e871e94 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -102,7 +102,7 @@ void LLVOGrass::updateSpecies() SpeciesMap::const_iterator it = sSpeciesTable.begin(); mSpecies = (*it).first; } - setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 47060720e7..315e618132 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -136,7 +136,7 @@ LLVoiceVisualizer::LLVoiceVisualizer( const U8 type ) for (int i=0; icreateGLTexture(0, mImageRaw[which], 0, TRUE, LLViewerTexture::LOCAL); + mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL); mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP); } @@ -384,9 +384,9 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mSun.setIntensity(SUN_INTENSITY); mMoon.setIntensity(0.1f * SUN_INTENSITY); - mSunTexturep = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLViewerTexture::BOOST_UI); + mSunTexturep = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLGLTexture::BOOST_UI); mSunTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); - mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLViewerTexture::BOOST_UI); + mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLGLTexture::BOOST_UI); mMoonTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1); mBloomTexturep->setNoDelete() ; @@ -478,9 +478,9 @@ void LLVOSky::restoreGL() { mSkyTex[i].restoreGL(); } - mSunTexturep = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLViewerTexture::BOOST_UI); + mSunTexturep = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLGLTexture::BOOST_UI); mSunTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); - mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLViewerTexture::BOOST_UI); + mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLGLTexture::BOOST_UI); mMoonTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1); mBloomTexturep->setNoDelete() ; diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 6687ce432f..68bb40d727 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -316,7 +316,7 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, // Load Species-Specific data // static const S32 MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = 32 ; //frames. - mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); mTreeImagep->setMaxVirtualSizeResetInterval(MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); //allow to wait for at most 16 frames to reset virtual size. mBranchLength = sSpeciesTable[mSpecies]->mBranchLength; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b43bdb69f8..7fab1cf9b7 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -747,7 +747,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) { F32 area = (F32) camera->getScreenPixelArea(); vsize = area; - imagep->setBoostLevel(LLViewerTexture::BOOST_HUD); + imagep->setBoostLevel(LLGLTexture::BOOST_HUD); face->setPixelArea(area); // treat as full screen face->setVirtualSize(vsize); } @@ -803,7 +803,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) if (mSculptTexture.notNull()) { mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), - (S32)LLViewerTexture::BOOST_SCULPTED)); + (S32)LLGLTexture::BOOST_SCULPTED)); mSculptTexture->setForSculpt() ; if(!mSculptTexture->isCachedRawImageReady()) @@ -1006,7 +1006,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if (is404) { - setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLViewerTexture::BOOST_UI)); + setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLGLTexture::BOOST_UI)); //render prim proxy when mesh loading attempts give up volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE); @@ -1090,7 +1090,7 @@ void LLVOVolume::updateSculptTexture() LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } else @@ -2698,7 +2698,7 @@ void LLVOVolume::updateSpotLightPriority() if (mLightTexture.notNull()) { mLightTexture->addTextureStats(mSpotLightPriority); - mLightTexture->setBoostLevel(LLViewerTexture::BOOST_CLOUDS); + mLightTexture->setBoostLevel(LLGLTexture::BOOST_CLOUDS); } } diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index cb24e96d5b..4d52f23ddb 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -78,7 +78,7 @@ void LLSimInfo::setLandForSaleImage (LLUUID image_id) // Fetch the image if (mMapImageID.notNull()) { - mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, MIPMAP_TRUE, LLViewerTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); + mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP); } else @@ -92,13 +92,13 @@ LLPointer LLSimInfo::getLandForSaleImage () if (mOverlayImage.isNull() && mMapImageID.notNull()) { // Fetch the image if it hasn't been done yet (unlikely but...) - mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, MIPMAP_TRUE, LLViewerTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); + mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP); } if (!mOverlayImage.isNull()) { // Boost the fetch level when we try to access that image - mOverlayImage->setBoostLevel(LLViewerTexture::BOOST_MAP); + mOverlayImage->setBoostLevel(LLGLTexture::BOOST_MAP); } return mOverlayImage; } diff --git a/indra/newview/llworldmipmap.cpp b/indra/newview/llworldmipmap.cpp index 74ed844376..c9d2a24a4e 100644 --- a/indra/newview/llworldmipmap.cpp +++ b/indra/newview/llworldmipmap.cpp @@ -74,21 +74,21 @@ void LLWorldMipmap::equalizeBoostLevels() { LLPointer img = iter->second; S32 current_boost_level = img->getBoostLevel(); - if (current_boost_level == LLViewerTexture::BOOST_MAP_VISIBLE) + if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE) { // If level was BOOST_MAP_VISIBLE, the tile has been used in the last draw so keep it high - img->setBoostLevel(LLViewerTexture::BOOST_MAP); + img->setBoostLevel(LLGLTexture::BOOST_MAP); } else { // If level was BOOST_MAP only (or anything else...), the tile wasn't used in the last draw // so we drop its boost level to BOOST_NONE. - img->setBoostLevel(LLViewerTexture::BOOST_NONE); + img->setBoostLevel(LLGLTexture::BOOST_NONE); } #if DEBUG_TILES_STAT // Increment some stats if compile option on nb_tiles++; - if (current_boost_level == LLViewerTexture::BOOST_MAP_VISIBLE) + if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE) { nb_visible++; } @@ -115,7 +115,7 @@ void LLWorldMipmap::dropBoostLevels() for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++) { LLPointer img = iter->second; - img->setBoostLevel(LLViewerTexture::BOOST_NONE); + img->setBoostLevel(LLGLTexture::BOOST_NONE); } } } @@ -172,7 +172,7 @@ LLPointer LLWorldMipmap::getObjectsTile(U32 grid_x, U32 // Boost the tile level so to mark it's in use *if* load on if (load) { - img->setBoostLevel(LLViewerTexture::BOOST_MAP_VISIBLE); + img->setBoostLevel(LLGLTexture::BOOST_MAP_VISIBLE); } return img; } @@ -189,8 +189,8 @@ LLPointer LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 // END DEBUG //LL_INFOS("World Map") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL; - LLPointer img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - img->setBoostLevel(LLViewerTexture::BOOST_MAP); + LLPointer img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + img->setBoostLevel(LLGLTexture::BOOST_MAP); // Return the smart pointer return img; diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index acc6e814bc..3c68890c36 100644 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -47,9 +47,9 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. // Stub image calls -void LLViewerTexture::setBoostLevel(S32 ) { } -void LLViewerTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, BOOL, LLViewerTexture::EBoostLevel, S8, +void LLGLTexture::setBoostLevel(S32 ) { } +void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, LLHost ) { return NULL; } // Stub related map calls diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index e7ef017760..22ebf28f55 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -42,8 +42,8 @@ // * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) // * A simulator for a class can be implemented here. Please comment and document thoroughly. -void LLViewerTexture::setBoostLevel(S32 ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, BOOL, LLViewerTexture::EBoostLevel, S8, +void LLGLTexture::setBoostLevel(S32 ) { } +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, const LLUUID& ) { return NULL; } LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name) { } -- cgit v1.2.3 From 41301004e13bec1c74f444f42372a3a6609cb305 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 22:49:26 +0000 Subject: Cleanup actions from code review of llappearance with nyx --- indra/newview/lldriverparam.cpp | 4 ++-- indra/newview/lltexturefetch.cpp | 6 ------ indra/newview/llviewertexlayer.cpp | 7 ++++--- indra/newview/llviewertexlayer.h | 2 +- indra/newview/llviewertexture.h | 1 - indra/newview/llvoavatar.h | 5 ++--- 6 files changed, 9 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 0ae9acd1af..5abf72d51f 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -629,9 +629,9 @@ void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bo driven->mParam->getCrossWearable()) { LLViewerWearable* wearable = dynamic_cast (mWearablep); - if (!wearable->isOnTop()) + if (wearable->isOnTop()) { - use_self = false; + use_self = true; } } diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 16baefac4f..db08c16f15 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -973,12 +973,6 @@ bool LLTextureFetchWorker::doWork(S32 param) } else if(!mUrl.empty() && mCanUseHTTP) { - if (!(mUrl.compare(0, 7, "http://") == 0) && - !(mUrl.compare(0, 8, "https://") == 0)) - { - // *TODO:?remove this warning - llwarns << "Unknown URL Type: " << mUrl << llendl; - } setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); mState = SEND_HTTP_REQ; } diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index 69457ab1db..f516562c2f 100644 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -214,9 +214,6 @@ void LLViewerTexLayerSetBuffer::preRenderTexLayerSet() // virtual void LLViewerTexLayerSetBuffer::postRenderTexLayerSet(BOOL success) { - // *TODO: Old logic does not check success before setGLTextureCreated - // we have valid texture data now - mGLTexturep->setGLTextureCreated(true); LLTexLayerSetBuffer::postRenderTexLayerSet(success); LLViewerDynamicTexture::postRender(success); @@ -259,6 +256,10 @@ void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success) { doUpdate(); } + + // *TODO: Old logic does not check success before setGLTextureCreated + // we have valid texture data now + mGLTexturep->setGLTextureCreated(true); } BOOL LLViewerTexLayerSetBuffer::isInitialized(void) const diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index 6788214f3a..95c339a5b0 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -45,7 +45,7 @@ public: LLViewerTexLayerSet(LLAvatarAppearance* const appearance); virtual ~LLViewerTexLayerSet(); - virtual void requestUpdate(); + /*virtual*/void requestUpdate(); void requestUpload(); void cancelUpload(); BOOL isLocalTextureDataAvailable() const; diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index d180d7fa99..254a0cf92f 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -637,7 +637,6 @@ public: static void init() ; static void cleanup() ; }; - // //this class is used for test/debug only //it tracks the activities of the texture pipeline diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index b8999728b3..5f780da145 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -473,14 +473,14 @@ private: public: BOOL morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer); - virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); + /*virtual*/void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); //-------------------------------------------------------------------- // Global colors //-------------------------------------------------------------------- public: - virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake); + /*virtual*/void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake); //-------------------------------------------------------------------- // Visibility @@ -1039,7 +1039,6 @@ public: void debugAvatarRezTime(std::string notification_name, std::string comment = ""); F32 debugGetExistenceTimeElapsedF32() const { return mDebugExistenceTimer.getElapsedTimeF32(); } - protected: LLFrameTimer mRuthDebugTimer; // For tracking how long it takes for av to rez LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory. -- cgit v1.2.3 From b146490e1b46799ccb35e156b4751eddea3a23ce Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 5 Sep 2012 17:46:11 -0400 Subject: SH-3264 Worked to move over mBakedTextureDatas from LLVOAvatar to LLAvatarAppearance. Appear to have been able to move over the parts that are common to both the backend and the viewer into LLAvatarAppearance. --- indra/newview/llvoavatar.cpp | 139 +++++++++++++++++++++------------------ indra/newview/llvoavatar.h | 38 ++--------- indra/newview/llvoavatarself.cpp | 57 +++++++++------- indra/newview/llvoavatarself.h | 2 +- 4 files changed, 113 insertions(+), 123 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b86c5d5e8f..ce0b65ca89 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -703,17 +703,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mPelvisp = NULL; - mBakedTextureDatas.resize(BAKED_NUM_INDICES); - for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) - { - mBakedTextureDatas[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; - mBakedTextureDatas[i].mTexLayerSet = NULL; - mBakedTextureDatas[i].mIsLoaded = false; - mBakedTextureDatas[i].mIsUsed = false; - mBakedTextureDatas[i].mMaskTexName = 0; - mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); - } - mDirtyMesh = 2; // Dirty geometry, need to regenerate. mMeshTexturesDirty = FALSE; mHeadp = NULL; @@ -821,19 +810,6 @@ LLVOAvatar::~LLVOAvatar() mNumJoints = 0; - for (U32 i = 0; i < mBakedTextureDatas.size(); i++) - { - deleteAndClear(mBakedTextureDatas[i].mTexLayerSet); - mBakedTextureDatas[i].mMeshes.clear(); - - for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin(); - iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++) - { - LLMaskedMorph* masked_morph = (*iter2); - delete masked_morph; - } - } - std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); @@ -1102,7 +1078,7 @@ void LLVOAvatar::restoreGL() gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++) { - gAgentAvatarp->invalidateComposite(gAgentAvatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE); + gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i), FALSE); } gAgentAvatarp->updateMeshTextures(); } @@ -5518,9 +5494,9 @@ BOOL LLVOAvatar::loadAvatar() EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion); if (baked != BAKED_NUM_INDICES) { - LLPolyMorphTarget *morph_param; + LLVisualParam* morph_param; const std::string *name = &info->mName; - morph_param = (LLPolyMorphTarget *)(getVisualParam(name->c_str())); + morph_param = getVisualParam(name->c_str()); if (morph_param) { BOOL invert = info->mInvert; @@ -6504,7 +6480,11 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL LLColor4 color = mTexHairColor->getColor(); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + if (mesh) + { + mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + } } } } @@ -6721,15 +6701,16 @@ void LLVOAvatar::updateMeshTextures() // When an avatar is changing clothes and not in Appearance mode, // use the last-known good baked texture until it finish the first // render of the new layerset. - const BOOL layerset_invalid = mBakedTextureDatas[i].mTexLayerSet - && ( !mBakedTextureDatas[i].mTexLayerSet->getViewerComposite()->isInitialized() - || !mBakedTextureDatas[i].mTexLayerSet->isLocalTextureDataAvailable() ); + LLViewerTexLayerSet* layerset = getTexLayerSet(i); + const BOOL layerset_invalid = layerset + && ( !layerset->getViewerComposite()->isInitialized() + || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) && layerset_invalid); if (use_lkg_baked_layer[i]) { - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(TRUE); + layerset->setUpdatesEnabled(TRUE); } } else @@ -6742,6 +6723,7 @@ void LLVOAvatar::updateMeshTextures() for (U32 i=0; i < mBakedTextureDatas.size(); i++) { + LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (use_lkg_baked_layer[i] && !mUseLocalAppearance ) { LLViewerFetchedTexture* baked_img; @@ -6765,7 +6747,11 @@ void LLVOAvatar::updateMeshTextures() mBakedTextureDatas[i].mIsUsed = TRUE; for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + if (mesh) + { + mesh->setTexture( baked_img ); + } } } else if (!mUseLocalAppearance && is_layer_baked[i]) @@ -6788,14 +6774,18 @@ void LLVOAvatar::updateMeshTextures() src_callback_list, paused ); } } - else if (mBakedTextureDatas[i].mTexLayerSet && mUseLocalAppearance) + else if (layerset && mUseLocalAppearance) { - mBakedTextureDatas[i].mTexLayerSet->createComposite(); - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE ); + layerset->createComposite(); + layerset->setUpdatesEnabled( TRUE ); mBakedTextureDatas[i].mIsUsed = FALSE; for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureDatas[i].mMeshes[k]->setLayerSet( mBakedTextureDatas[i].mTexLayerSet ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + if (mesh) + { + mesh->setLayerSet( layerset ); + } } } } @@ -6809,8 +6799,12 @@ void LLVOAvatar::updateMeshTextures() LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + if (mesh) + { + mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mesh->setTexture( hair_img ); + } } } @@ -6883,16 +6877,28 @@ void LLVOAvatar::clearChat() mChats.clear(); } -// adds a morph mask to the appropriate baked texture structure -void LLVOAvatar::addMaskedMorph(EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer) + +void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) { - if (index < BAKED_NUM_INDICES) + if (index >= BAKED_NUM_INDICES) { - LLMaskedMorph *morph = new LLMaskedMorph(morph_target, invert, layer); - mBakedTextureDatas[index].mMaskedMorphs.push_front(morph); + llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; + return; + } + + for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); + iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter) + { + const LLMaskedMorph* maskedMorph = (*iter); + LLPolyMorphTarget* morph_target = dynamic_cast(maskedMorph->mMorphTarget); + if (morph_target) + { + morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); + } } } + // returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) { @@ -6905,7 +6911,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIn { if (isSelf()) { - LLViewerTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet; + LLViewerTexLayerSet *layer_set = getTexLayerSet(index); if (layer_set) { return !layer_set->isMorphValid(); @@ -6920,23 +6926,6 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIn return FALSE; } -void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) -{ - if (index >= BAKED_NUM_INDICES) - { - llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; - return; - } - - for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); - iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter) - { - const LLMaskedMorph* maskedMorph = (*iter); - maskedMorph->mMorphTarget->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); - } -} - - //----------------------------------------------------------------------------- // releaseComponentTextures() // release any component texture UUIDs for which we have a baked texture @@ -7616,7 +7605,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mIsUsed = true; for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureDatas[i].mMeshes[k]->setTexture( image_baked ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + if (mesh) + { + mesh->setTexture( image_baked ); + } } if (mBakedTextureDatas[i].mTexLayerSet) { @@ -7637,7 +7630,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + if (mesh) + { + mesh->setColor( 1.f, 1.f, 1.f, 1.f ); + } } } } @@ -8689,3 +8686,17 @@ BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, return FALSE; } +//virtual +LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) : + mMorphTarget(morph_target), + mInvert(invert), + mLayer(layer) +{ + LLPolyMorphTarget *target = dynamic_cast(morph_target); + if (target) + { + target->addPendingMorphMask(); + } +} + + diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5f780da145..91ea19fbd3 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -48,6 +48,7 @@ #include "llavatarappearancedefines.h" #include "lltexglobalcolor.h" #include "lldriverparam.h" +#include "llviewertexlayer.h" #include "material_codes.h" // LL_MCODE_END #include "llviewerstats.h" @@ -63,7 +64,6 @@ extern const LLUUID ANIM_AGENT_PELVIS_FIX; extern const LLUUID ANIM_AGENT_TARGET; extern const LLUUID ANIM_AGENT_WALK_ADJUST; -class LLViewerTexLayerSet; class LLViewerWearable; class LLVoiceVisualizer; class LLHUDNameTag; @@ -87,7 +87,6 @@ public: friend class LLVOAvatarSelf; protected: struct LLVOAvatarXmlInfo; - struct LLMaskedMorph; /******************************************************************************** ** ** @@ -471,9 +470,8 @@ private: // Morph masks //-------------------------------------------------------------------- public: + /*virtual*/ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); BOOL morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); - void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer); - /*virtual*/void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); //-------------------------------------------------------------------- @@ -601,22 +599,9 @@ protected: static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); virtual void removeMissingBakedTextures(); void useBakedTexture(const LLUUID& id); + LLViewerTexLayerSet* getTexLayerSet(const U32 index) const { return dynamic_cast(mBakedTextureDatas[index].mTexLayerSet); } + - typedef std::deque morph_list_t; - struct BakedTextureData - { - LLUUID mLastTextureIndex; - LLViewerTexLayerSet* mTexLayerSet; // Only exists for self - bool mIsLoaded; - bool mIsUsed; - LLAvatarAppearanceDefines::ETextureIndex mTextureIndex; - U32 mMaskTexName; - // Stores pointers to the joint meshes that this baked texture deals with - std::vector< LLViewerJointMesh * > mMeshes; // std::vector mJoints[i]->mMeshParts - morph_list_t mMaskedMorphs; - }; - typedef std::vector bakedtexturedata_vec_t; - bakedtexturedata_vec_t mBakedTextureDatas; LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; BOOL mLoadedCallbacksPaused; //-------------------------------------------------------------------- @@ -1139,21 +1124,6 @@ protected: // Shared with LLVOAvatarSelf morph_info_list_t mMorphMaskInfoList; }; - struct LLMaskedMorph - { - LLMaskedMorph(LLPolyMorphTarget *morph_target, BOOL invert, std::string layer) : - mMorphTarget(morph_target), - mInvert(invert), - mLayer(layer) - { - morph_target->addPendingMorphMask(); - } - - LLPolyMorphTarget *mMorphTarget; - BOOL mInvert; - std::string mLayer; - }; - /** Support classes ** ** *******************************************************************************/ diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e836a5e4a8..945e134d21 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -883,8 +883,9 @@ void LLVOAvatarSelf::removeMissingBakedTextures() { for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(TRUE); - invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE); + LLViewerTexLayerSet *layerset = getTexLayerSet(i); + layerset->setUpdatesEnabled(TRUE); + invalidateComposite(layerset, FALSE); } updateMeshTextures(); if (getRegion() && !getRegion()->getCentralBakeVersion()) @@ -1090,10 +1091,11 @@ void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_re const LLWearableType::EType comp_type = *type_iter; if (comp_type == type) { - if (mBakedTextureDatas[index].mTexLayerSet) + LLViewerTexLayerSet *layerset = getLayerSet(index); + if (layerset) { - mBakedTextureDatas[index].mTexLayerSet->setUpdatesEnabled(true); - invalidateComposite(mBakedTextureDatas[index].mTexLayerSet, upload_result); + layerset->setUpdatesEnabled(true); + invalidateComposite(layerset, upload_result); } break; } @@ -1517,7 +1519,7 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLAvatarAppearanceDefines::EBakedTextureIndex index) const { - const LLViewerTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet; + const LLViewerTexLayerSet *layerset = getLayerSet(index); if (!layerset) return FALSE; const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); if (!layerset_buffer) return FALSE; @@ -1597,9 +1599,10 @@ void LLVOAvatarSelf::requestLayerSetUpload(LLAvatarAppearanceDefines::EBakedText { ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex; const BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index)); - if (!layer_baked && mBakedTextureDatas[i].mTexLayerSet) + LLViewerTexLayerSet *layerset = getLayerSet(i); + if (!layer_baked && layerset) { - mBakedTextureDatas[i].mTexLayerSet->requestUpload(); + layerset->requestUpload(); } } @@ -1613,7 +1616,7 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const { for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - LLViewerTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet; + LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (layerset && layerset->getViewerComposite() && layerset->getViewerComposite()->uploadPending()) { return true; @@ -1648,7 +1651,8 @@ void LLVOAvatarSelf::invalidateAll() { for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE); + LLViewerTexLayerSet *layerset = getTexLayerSet(i); + invalidateComposite(layerset, TRUE); } //mDebugSelfLoadTimer.reset(); } @@ -1666,17 +1670,19 @@ void LLVOAvatarSelf::setCompositeUpdatesEnabled( bool b ) void LLVOAvatarSelf::setCompositeUpdatesEnabled(U32 index, bool b) { - if (mBakedTextureDatas[index].mTexLayerSet ) + LLViewerTexLayerSet *layerset = getTexLayerSet(index); + if (layerset ) { - mBakedTextureDatas[index].mTexLayerSet->setUpdatesEnabled( b ); + layerset->setUpdatesEnabled( b ); } } bool LLVOAvatarSelf::isCompositeUpdateEnabled(U32 index) { - if (mBakedTextureDatas[index].mTexLayerSet) + LLViewerTexLayerSet *layerset = getTexLayerSet(index); + if (layerset) { - return mBakedTextureDatas[index].mTexLayerSet->getUpdatesEnabled(); + return layerset->getUpdatesEnabled(); } return false; } @@ -1687,9 +1693,10 @@ void LLVOAvatarSelf::setupComposites() { ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex; BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index)); - if (mBakedTextureDatas[i].mTexLayerSet) + LLViewerTexLayerSet *layerset = getTexLayerSet(i); + if (layerset) { - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(!layer_baked); + layerset->setUpdatesEnabled(!layer_baked); } } } @@ -1698,10 +1705,11 @@ void LLVOAvatarSelf::updateComposites() { for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (mBakedTextureDatas[i].mTexLayerSet + LLViewerTexLayerSet *layerset = getTexLayerSet(i); + if (layerset && ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT))) { - mBakedTextureDatas[i].mTexLayerSet->updateComposite(); + layerset->updateComposite(); } } } @@ -1985,14 +1993,14 @@ BOOL LLVOAvatarSelf::getIsCloud() const if (!mPreviousFullyLoaded) { - if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) && + if (!isLocalTextureDataAvailable(getLayerSet(BAKED_LOWER)) && (!isTextureDefined(TEX_LOWER_BAKED, 0))) { lldebugs << "Lower textures not baked" << llendl; return TRUE; } - if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) && + if (!isLocalTextureDataAvailable(getLayerSet(BAKED_UPPER)) && (!isTextureDefined(TEX_UPPER_BAKED, 0))) { lldebugs << "Upper textures not baked" << llendl; @@ -2550,7 +2558,8 @@ void LLVOAvatarSelf::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid mHeadLayerSet->cancelUpload(); */ for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if ( mBakedTextureDatas[i].mTextureIndex == te && mBakedTextureDatas[i].mTexLayerSet) + LLViewerTexLayerSet *layerset = getTexLayerSet(i); + if ( mBakedTextureDatas[i].mTextureIndex == te && layerset) { if (mInitialBakeIDs[i] != LLUUID::null) { @@ -2564,7 +2573,7 @@ void LLVOAvatarSelf::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid } mInitialBakeIDs[i] = LLUUID::null; } - mBakedTextureDatas[i].mTexLayerSet->cancelUpload(); + layerset->cancelUpload(); } } } @@ -2677,7 +2686,7 @@ LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const if (texture_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - return mBakedTextureDatas[baked_index].mTexLayerSet; + return getLayerSet(baked_index); } return NULL; } @@ -2690,7 +2699,7 @@ LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) return mHeadLayerSet; */ if (baked_index >= 0 && baked_index < BAKED_NUM_INDICES) { - return mBakedTextureDatas[baked_index].mTexLayerSet; + return getTexLayerSet(baked_index); } return NULL; } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 12886d2d36..7fcab020e6 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -388,7 +388,7 @@ public: BOOL isAllLocalTextureDataFinal() const; - const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; } + const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); } const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD LLSD metricsData(); -- cgit v1.2.3 From 201d9853f9d57efab9b819ff07745141a5265e98 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Sep 2012 18:25:51 -0400 Subject: Debug display for baked vs. composite status, via setting DebugAvatarCompositeBaked --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llviewerjointmesh.cpp | 5 +++++ indra/newview/llviewerjointmesh.h | 1 + indra/newview/llvoavatar.cpp | 20 ++++++++++++++++---- 4 files changed, 33 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 69986af83b..674685f3bc 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1948,6 +1948,17 @@ Boolean Value 1 + + DebugAvatarCompositeBaked + + Comment + Colorize avatar meshes based on baked/composite state. + Persist + 1 + Type + Boolean + Value + 0 DebugBeaconLineWidth diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 5d1aa870a3..c3f8f42a2a 100755 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -219,6 +219,11 @@ void LLViewerJointMesh::setColor( F32 red, F32 green, F32 blue, F32 alpha ) mColor[3] = alpha; } +void LLViewerJointMesh::setColor( const LLColor4& color ) +{ + mColor = color; +} + //-------------------------------------------------------------------- // LLViewerJointMesh::getTexture() diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index dd5dae1dc1..630981b4a0 100755 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -99,6 +99,7 @@ public: // Sets the shape color void setColor( F32 red, F32 green, F32 blue, F32 alpha ); + void setColor( const LLColor4& color ); // Sets the shininess void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4894f21e67..d92caf1edb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5763,7 +5763,7 @@ BOOL LLVOAvatar::loadMeshNodes() // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. // Do not touch!!! - mesh->setColor( 1.0f, 1.0f, 1.0f, 1.0f ); + mesh->setColor( LLColor4::white ); LLPolyMesh *poly_mesh = NULL; @@ -6503,7 +6503,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL LLColor4 color = mTexHairColor->getColor(); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color ); } } } @@ -6764,6 +6764,10 @@ void LLVOAvatar::updateMeshTextures() for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor(LLColor4::red); + } } } else if (!mUseLocalAppearance && is_layer_baked[i]) @@ -6794,6 +6798,10 @@ void LLVOAvatar::updateMeshTextures() for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setLayerSet( mBakedTextureDatas[i].mTexLayerSet ); + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor( LLColor4::yellow ); + } } } } @@ -6807,7 +6815,7 @@ void LLVOAvatar::updateMeshTextures() LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color ); mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); } } @@ -7721,6 +7729,10 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setTexture( image_baked ); + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor( LLColor4::green ); + } } if (mBakedTextureDatas[i].mTexLayerSet) { @@ -7741,7 +7753,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( LLColor4::white ); } } } -- cgit v1.2.3 From 85d0bcc0630bfbf8b50be3a47a113c4f8d6ec9df Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 6 Sep 2012 02:53:55 +0000 Subject: Extracted mWearableDatas from LLAgentWearables into llappearance/LLWearableData. Moved LLDriverParam into llappearance --- indra/newview/CMakeLists.txt | 2 - indra/newview/llagentwearables.cpp | 360 +++++------------ indra/newview/llagentwearables.h | 34 +- indra/newview/lldriverparam.cpp | 647 ------------------------------ indra/newview/lldriverparam.h | 128 ------ indra/newview/llfloateravatartextures.cpp | 4 +- indra/newview/lllocalbitmaps.cpp | 2 +- indra/newview/llpaneleditwearable.cpp | 2 +- indra/newview/llphysicsmotion.cpp | 12 +- indra/newview/llsidepanelappearance.cpp | 2 +- indra/newview/llviewerwearable.cpp | 35 +- indra/newview/llviewerwearable.h | 8 +- indra/newview/llvoavatar.cpp | 68 +--- indra/newview/llvoavatar.h | 14 - indra/newview/llvoavatarself.cpp | 30 +- indra/newview/llvoavatarself.h | 5 +- 16 files changed, 142 insertions(+), 1211 deletions(-) delete mode 100644 indra/newview/lldriverparam.cpp delete mode 100644 indra/newview/lldriverparam.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 214071fa67..21b1512e58 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -158,7 +158,6 @@ set(viewer_SOURCE_FILES lldrawpooltree.cpp lldrawpoolwater.cpp lldrawpoolwlsky.cpp - lldriverparam.cpp lldynamictexture.cpp llemote.cpp llenvmanager.cpp @@ -728,7 +727,6 @@ set(viewer_HEADER_FILES lldrawpooltree.h lldrawpoolwater.h lldrawpoolwlsky.h - lldriverparam.h lldynamictexture.h llemote.h llenvmanager.h diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 08238e1aea..40cedc1b35 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -119,7 +119,7 @@ void LLAgentWearables::dump() llinfos << "Type: " << i << " count " << count << llendl; for (U32 j=0; joutputRezTiming("Sending wearables request"); - sendAgentWearablesRequest(); - } +{ + llassert(avatar); + avatar->outputRezTiming("Sending wearables request"); + sendAgentWearablesRequest(); + setAvatarAppearance(avatar); } // wearables @@ -312,7 +312,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() { for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index) { - LLViewerWearable* wearable = getWearable((LLWearableType::EType)type,index); + LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type,index); if (wearable) { if (wearable->getItemID().isNull()) @@ -354,7 +354,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() U8 type_u8 = (U8)type; gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8); - LLViewerWearable* wearable = getWearable((LLWearableType::EType)type, 0); + LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type, 0); if (wearable) { //llinfos << "Sending wearable " << wearable->getName() << llendl; @@ -382,7 +382,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update, const std::string new_name) { - LLViewerWearable* old_wearable = getWearable(type, index); + LLViewerWearable* old_wearable = getViewerWearable(type, index); if(!old_wearable) return; bool name_changed = !new_name.empty() && (new_name != old_wearable->getName()); if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion()) @@ -465,7 +465,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, llwarns << "LLAgent::saveWearableAs() not copyable." << llendl; return; } - LLViewerWearable* old_wearable = getWearable(type, index); + LLViewerWearable* old_wearable = getViewerWearable(type, index); if (!old_wearable) { llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl; @@ -518,7 +518,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index) { - LLViewerWearable* wearable = getWearable(type, index); + LLViewerWearable* wearable = getViewerWearable(type, index); llassert(wearable); if (wearable) { @@ -553,7 +553,7 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j); if (curr_item_id == item_id) { - LLViewerWearable* old_wearable = getWearable((LLWearableType::EType)i,j); + LLViewerWearable* old_wearable = getViewerWearable((LLWearableType::EType)i,j); llassert(old_wearable); if (!old_wearable) continue; @@ -647,7 +647,7 @@ const LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& it { for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++) { - const LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); + const LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j); if (curr_wearable && (curr_wearable->getItemID() == base_item_id)) { return curr_wearable; @@ -664,7 +664,7 @@ LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) { for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++) { - LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); + LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j); if (curr_wearable && (curr_wearable->getItemID() == base_item_id)) { return curr_wearable; @@ -680,7 +680,7 @@ LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_i { for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++) { - LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j); + LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j); if (curr_wearable && (curr_wearable->getAssetID() == asset_id)) { return curr_wearable; @@ -699,215 +699,55 @@ void LLAgentWearables::sendAgentWearablesRequest() gAgent.sendReliableMessage(); } -// static -BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type) +LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) { - return (gAgentWearables.getWearableCount(type) > 0); + return dynamic_cast (getWearable(type, index)); } -LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) +const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const { - wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type); - if (wearable_iter == mWearableDatas.end()) - { - return NULL; - } - wearableentry_vec_t& wearable_vec = wearable_iter->second; - if (index>=wearable_vec.size()) - { - return NULL; - } - else - { - return wearable_vec[index]; - } + return dynamic_cast (getWearable(type, index)); } -void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLViewerWearable *wearable) -{ - - LLViewerWearable *old_wearable = getWearable(type,index); - if (!old_wearable) - { - pushWearable(type,wearable); - return; - } - - wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type); - if (wearable_iter == mWearableDatas.end()) - { - llwarns << "invalid type, type " << type << " index " << index << llendl; - return; - } - wearableentry_vec_t& wearable_vec = wearable_iter->second; - if (index>=wearable_vec.size()) - { - llwarns << "invalid index, type " << type << " index " << index << llendl; - } - else - { - wearable_vec[index] = wearable; - old_wearable->setLabelUpdated(); - wearableUpdated(wearable); - checkWearableAgainstInventory(wearable); - } -} - -U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable) -{ - if (wearable == NULL) - { - // no null wearables please! - llwarns << "Null wearable sent for type " << type << llendl; - return MAX_CLOTHING_PER_TYPE; - } - if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) - { - mWearableDatas[type].push_back(wearable); - wearableUpdated(wearable); - checkWearableAgainstInventory(wearable); - return mWearableDatas[type].size()-1; - } - return MAX_CLOTHING_PER_TYPE; -} - -void LLAgentWearables::wearableUpdated(LLViewerWearable *wearable) +// static +BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type) { - gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE); - wearable->refreshName(); - wearable->setLabelUpdated(); - - wearable->pullCrossWearableValues(); - - // Hack pt 2. If the wearable we just loaded has definition version 24, - // then force a re-save of this wearable after slamming the version number to 22. - // This number was incorrectly incremented for internal builds before release, and - // this fix will ensure that the affected wearables are re-saved with the right version number. - // the versions themselves are compatible. This code can be removed before release. - if( wearable->getDefinitionVersion() == 24 ) - { - wearable->setDefinitionVersion(22); - U32 index = getWearableIndex(wearable); - llinfos << "forcing werable type " << wearable->getType() << " to version 22 from 24" << llendl; - saveWearable(wearable->getType(),index,TRUE); - } - + return (gAgentWearables.getWearableCount(type) > 0); } -void LLAgentWearables::popWearable(LLViewerWearable *wearable) +// virtual +void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed) { - if (wearable == NULL) - { - // nothing to do here. move along. - return; - } - - U32 index = getWearableIndex(wearable); - LLWearableType::EType type = wearable->getType(); - - if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type)) + if (isAgentAvatarValid()) { - popWearable(type, index); + const BOOL upload_result = removed; + gAgentAvatarp->wearableUpdated(wearable->getType(), upload_result); } -} -void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index) -{ - LLViewerWearable *wearable = getWearable(type, index); - if (wearable) - { - mWearableDatas[type].erase(mWearableDatas[type].begin() + index); - if (isAgentAvatarValid()) - { - gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE); - } - wearable->setLabelUpdated(); - } -} + LLWearableData::wearableUpdated(wearable, removed); -U32 LLAgentWearables::getWearableIndex(const LLViewerWearable *wearable) const -{ - if (wearable == NULL) + if (!removed) { - return MAX_CLOTHING_PER_TYPE; - } + LLViewerWearable* viewer_wearable = dynamic_cast(wearable); + viewer_wearable->refreshName(); - const LLWearableType::EType type = wearable->getType(); - wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); - if (wearable_iter == mWearableDatas.end()) - { - llwarns << "tried to get wearable index with an invalid type!" << llendl; - return MAX_CLOTHING_PER_TYPE; - } - const wearableentry_vec_t& wearable_vec = wearable_iter->second; - for(U32 index = 0; index < wearable_vec.size(); index++) - { - if (wearable_vec[index] == wearable) + // Hack pt 2. If the wearable we just loaded has definition version 24, + // then force a re-save of this wearable after slamming the version number to 22. + // This number was incorrectly incremented for internal builds before release, and + // this fix will ensure that the affected wearables are re-saved with the right version number. + // the versions themselves are compatible. This code can be removed before release. + if( wearable->getDefinitionVersion() == 24 ) { - return index; + wearable->setDefinitionVersion(22); + U32 index = getWearableIndex(wearable); + llinfos << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << llendl; + saveWearable(wearable->getType(),index,TRUE); } - } - - return MAX_CLOTHING_PER_TYPE; -} -const LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const -{ - wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); - if (wearable_iter == mWearableDatas.end()) - { - return NULL; - } - const wearableentry_vec_t& wearable_vec = wearable_iter->second; - if (index>=wearable_vec.size()) - { - return NULL; - } - else - { - return wearable_vec[index]; + checkWearableAgainstInventory(viewer_wearable); } } -LLViewerWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type) -{ - U32 count = getWearableCount(type); - if ( count == 0) - { - return NULL; - } - - return getWearable(type, count-1); -} - -LLViewerWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type) -{ - if (getWearableCount(type) == 0) - { - return NULL; - } - - return getWearable(type, 0); -} - -U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const -{ - wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); - if (wearable_iter == mWearableDatas.end()) - { - return 0; - } - const wearableentry_vec_t& wearable_vec = wearable_iter->second; - return wearable_vec.size(); -} - -U32 LLAgentWearables::getWearableCount(const U32 tex_index) const -{ - const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index); - return getWearableCount(wearable_type); -} - - BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const { return mItemsAwaitingWearableUpdate.find(item_id) != mItemsAwaitingWearableUpdate.end(); @@ -920,7 +760,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const { - const LLViewerWearable *wearable = getWearable(type,index); + const LLViewerWearable *wearable = getViewerWearable(type,index); if (wearable) return wearable->getItemID(); else @@ -929,7 +769,7 @@ const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const { - const LLViewerWearable *wearable = getWearable(type,index); + const LLViewerWearable *wearable = getViewerWearable(type,index); if (wearable) return wearable->getAssetID(); else @@ -1095,7 +935,7 @@ void LLAgentWearables::recoverMissingWearableDone() void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index) { - LLViewerWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index); + LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)wearable_type, wearable_index); if (!wearable) { llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl; @@ -1305,7 +1145,7 @@ void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_ } else { - LLViewerWearable* old_wearable = getWearable(type,index); + LLViewerWearable* old_wearable = getViewerWearable(type,index); if (old_wearable) { @@ -1360,10 +1200,10 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo //LLAgentDumper dumper("removeWearable"); if (do_remove_all) { - S32 max_entry = mWearableDatas[type].size()-1; + S32 max_entry = getWearableCount(type)-1; for (S32 i=max_entry; i>=0; i--) { - LLViewerWearable* old_wearable = getWearable(type,i); + LLViewerWearable* old_wearable = getViewerWearable(type,i); //queryWearableCache(); // moved below if (old_wearable) { @@ -1371,11 +1211,11 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo old_wearable->removeFromAvatar(TRUE); } } - mWearableDatas[type].clear(); + clearWearableType(type); } else { - LLViewerWearable* old_wearable = getWearable(type, index); + LLViewerWearable* old_wearable = getViewerWearable(type, index); //queryWearableCache(); // moved below if (old_wearable) @@ -1439,8 +1279,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { pushWearable(type,new_wearable); } - wearableUpdated(new_wearable); - checkWearableAgainstInventory(new_wearable); + const BOOL removed = FALSE; + wearableUpdated(new_wearable, removed); } } @@ -1491,7 +1331,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearab { // Remove old wearable, if any // MULTI_WEARABLE: hardwired to 0 - LLViewerWearable* old_wearable = getWearable(type,0); + LLViewerWearable* old_wearable = getViewerWearable(type,0); if (old_wearable) { const LLUUID& old_item_id = old_wearable->getItemID(); @@ -1560,9 +1400,10 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara if (do_append && getWearableItemID(type,0).notNull()) { new_wearable->setItemID(new_item->getUUID()); - mWearableDatas[type].push_back(new_wearable); + const bool trigger_updated = false; + pushWearable(type, new_wearable, trigger_updated); llinfos << "Added additional wearable for type " << type - << " size is now " << mWearableDatas[type].size() << llendl; + << " size is now " << getWearableCount(type) << llendl; checkWearableAgainstInventory(new_wearable); } else @@ -1570,7 +1411,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara // Replace the old wearable with a new one. llassert(new_item->getAssetUUID() == new_wearable->getAssetID()); - LLViewerWearable *old_wearable = getWearable(type,0); + LLViewerWearable *old_wearable = getViewerWearable(type,0); LLUUID old_item_id; if (old_wearable) { @@ -1585,7 +1426,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara gInventory.notifyObservers(); } llinfos << "Replaced current element 0 for type " << type - << " size is now " << mWearableDatas[type].size() << llendl; + << " size is now " << getWearableCount(type) << llendl; } //llinfos << "LLVOAvatar::setWearableItem()" << llendl; @@ -1652,46 +1493,14 @@ void LLAgentWearables::queryWearableCache() } } -LLUUID LLAgentWearables::computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index, - BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache +// virtual +void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const { - LLUUID hash_id; - bool hash_computed = false; - LLMD5 hash; - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index); - - for (U8 i=0; i < baked_dict->mWearables.size(); i++) - { - const LLWearableType::EType baked_type = baked_dict->mWearables[i]; - const U32 num_wearables = getWearableCount(baked_type); - for (U32 index = 0; index < num_wearables; ++index) - { - const LLViewerWearable* wearable = getWearable(baked_type,index); - if (wearable) - { - LLUUID asset_id = wearable->getAssetID(); - hash.update((const unsigned char*)asset_id.mData, UUID_BYTES); - hash_computed = true; - } - } - } - if (hash_computed) + // Add some garbage into the hash so that it becomes invalid. + if (isAgentAvatarValid()) { - hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES); - - // Add some garbage into the hash so that it becomes invalid. - if (!generate_valid_hash) - { - if (isAgentAvatarValid()) - { - hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES); - } - } - hash.finalize(); - hash.raw_digest(hash_id.mData); + hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES); } - - return hash_id; } // User has picked "remove from avatar" from a menu. @@ -1875,13 +1684,13 @@ void LLAgentWearables::checkWearablesLoaded() const // Returns false if the given wearable is already topmost/bottommost // (depending on closer_to_body parameter). -bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) +bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) const { - const LLViewerWearable* wearable = getWearableFromItemID(item_id); + const LLWearable* wearable = getWearableFromItemID(item_id); if (!wearable) return false; LLWearableType::EType wtype = wearable->getType(); - const LLViewerWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype); + const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype); if (!marginal_wearable) return false; return wearable != marginal_wearable; @@ -1918,7 +1727,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake) { for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count) { - LLViewerWearable *wearable = getWearable((LLWearableType::EType)type,count); + LLViewerWearable *wearable = getViewerWearable((LLWearableType::EType)type,count); llassert(wearable); if (wearable) { @@ -1933,28 +1742,39 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos if (!item) return false; if (!item->isWearableType()) return false; - wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(item->getWearableType()); - if (wearable_iter == mWearableDatas.end()) return false; - - wearableentry_vec_t& wearable_vec = wearable_iter->second; - if (wearable_vec.empty()) return false; + LLWearableType::EType type = item->getWearableType(); + U32 wearable_count = getWearableCount(type); + if (0 == wearable_count) return false; const LLUUID& asset_id = item->getAssetUUID(); //nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body) - if (closer_to_body && asset_id == wearable_vec.front()->getAssetID()) return false; - if (!closer_to_body && asset_id == wearable_vec.back()->getAssetID()) return false; + if (closer_to_body) + { + LLViewerWearable* bottom_wearable = dynamic_cast( getBottomWearable(type) ); + if (bottom_wearable->getAssetID() == asset_id) + { + return false; + } + } + else // !closer_to_body + { + LLViewerWearable* top_wearable = dynamic_cast( getTopWearable(type) ); + if (top_wearable->getAssetID() == asset_id) + { + return false; + } + } - for (U32 i = 0; i < wearable_vec.size(); ++i) + for (U32 i = 0; i < wearable_count; ++i) { - LLViewerWearable* wearable = wearable_vec[i]; + LLViewerWearable* wearable = getViewerWearable(type, i); if (!wearable) continue; if (wearable->getAssetID() != asset_id) continue; //swapping wearables U32 swap_i = closer_to_body ? i-1 : i+1; - wearable_vec[i] = wearable_vec[swap_i]; - wearable_vec[swap_i] = wearable; + swapWearables(type, i, swap_i); return true; } diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 41995dd55b..a60fbc969b 100755 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -37,6 +37,7 @@ #include "llinventorymodel.h" #include "llviewerinventory.h" #include "llavatarappearancedefines.h" +#include "llwearabledata.h" class LLInventoryItem; class LLVOAvatarSelf; @@ -44,7 +45,7 @@ class LLViewerWearable; class LLInitialWearablesFetch; class LLViewerObject; -class LLAgentWearables : public LLInitClass +class LLAgentWearables : public LLInitClass, public LLWearableData { //-------------------------------------------------------------------- // Constructors / destructors / Initializers @@ -78,7 +79,7 @@ public: bool isCOFChangeInProgress() const { return mCOFChangeInProgress; } void updateWearablesLoaded(); void checkWearablesLoaded() const; - bool canMoveWearable(const LLUUID& item_id, bool closer_to_body); + bool canMoveWearable(const LLUUID& item_id, bool closer_to_body) const; // Note: False for shape, skin, eyes, and hair, unless you have MORE than 1. bool canWearableBeRemoved(const LLViewerWearable* wearable) const; @@ -94,36 +95,22 @@ public: const LLViewerWearable* getWearableFromItemID(const LLUUID& item_id) const; LLViewerWearable* getWearableFromItemID(const LLUUID& item_id); LLViewerWearable* getWearableFromAssetID(const LLUUID& asset_id); + LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/); + const LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/); static BOOL selfHasWearable(LLWearableType::EType type); - LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/); - const LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; - LLViewerWearable* getTopWearable(const LLWearableType::EType type); - LLViewerWearable* getBottomWearable(const LLWearableType::EType type); - U32 getWearableCount(const LLWearableType::EType type) const; - U32 getWearableCount(const U32 tex_index) const; - - static const U32 MAX_CLOTHING_PER_TYPE = 5; - //-------------------------------------------------------------------- // Setters //-------------------------------------------------------------------- - private: - // Low-level data structure setter - public access is via setWearableItem, etc. - void setWearable(const LLWearableType::EType type, U32 index, LLViewerWearable *wearable); - U32 pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable); - void wearableUpdated(LLViewerWearable *wearable); - void popWearable(LLViewerWearable *wearable); - void popWearable(const LLWearableType::EType type, U32 index); - + /*virtual*/void wearableUpdated(LLWearable *wearable, BOOL removed); public: void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false); void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove); void setWearableName(const LLUUID& item_id, const std::string& new_name); + // *TODO: Move this into llappearance/LLWearableData ? void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index); - U32 getWearableIndex(const LLViewerWearable *wearable) const; protected: void setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append = false); @@ -171,10 +158,9 @@ protected: public: // Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant) static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data); - LLUUID computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index, - BOOL generate_valid_hash = TRUE); protected: + /*virtual*/ void invalidateBakedTextureHash(LLMD5& hash) const; void sendAgentWearablesUpdate(); void sendAgentWearablesRequest(); void queryWearableCache(); @@ -243,10 +229,6 @@ private: // Member variables //-------------------------------------------------------------------- private: - typedef std::vector wearableentry_vec_t; // all wearables of a certain type (EG all shirts) - typedef std::map wearableentry_map_t; // wearable "categories" arranged by wearable type - wearableentry_map_t mWearableDatas; - static BOOL mInitialWearablesUpdateReceived; BOOL mWearablesLoaded; std::set mItemsAwaitingWearableUpdate; diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp deleted file mode 100644 index 5abf72d51f..0000000000 --- a/indra/newview/lldriverparam.cpp +++ /dev/null @@ -1,647 +0,0 @@ -/** - * @file lldriverparam.cpp - * @brief A visual parameter that drives (controls) other visual parameters. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "lldriverparam.h" - -#include "llfasttimer.h" -#include "llvoavatar.h" -#include "llvoavatarself.h" -#include "llagent.h" -#include "llviewerwearable.h" -#include "llagentwearables.h" - -//----------------------------------------------------------------------------- -// LLDriverParamInfo -//----------------------------------------------------------------------------- - -LLDriverParamInfo::LLDriverParamInfo() -{ -} - -BOOL LLDriverParamInfo::parseXml(LLXmlTreeNode* node) -{ - llassert( node->hasName( "param" ) && node->getChildByName( "param_driver" ) ); - - if( !LLViewerVisualParamInfo::parseXml( node )) - return FALSE; - - LLXmlTreeNode* param_driver_node = node->getChildByName( "param_driver" ); - if( !param_driver_node ) - return FALSE; - - for (LLXmlTreeNode* child = param_driver_node->getChildByName( "driven" ); - child; - child = param_driver_node->getNextNamedChild()) - { - S32 driven_id; - static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); - if( child->getFastAttributeS32( id_string, driven_id ) ) - { - F32 min1 = mMinWeight; - F32 max1 = mMaxWeight; - F32 max2 = max1; - F32 min2 = max1; - - // driven ________ // - // ^ /| |\ // - // | / | | \ // - // | / | | \ // - // | / | | \ // - // | / | | \ // - //-------|----|-------|----|-------> driver // - // | min1 max1 max2 min2 - - static LLStdStringHandle min1_string = LLXmlTree::addAttributeString("min1"); - child->getFastAttributeF32( min1_string, min1 ); // optional - static LLStdStringHandle max1_string = LLXmlTree::addAttributeString("max1"); - child->getFastAttributeF32( max1_string, max1 ); // optional - static LLStdStringHandle max2_string = LLXmlTree::addAttributeString("max2"); - child->getFastAttributeF32( max2_string, max2 ); // optional - static LLStdStringHandle min2_string = LLXmlTree::addAttributeString("min2"); - child->getFastAttributeF32( min2_string, min2 ); // optional - - // Push these on the front of the deque, so that we can construct - // them in order later (faster) - mDrivenInfoList.push_front( LLDrivenEntryInfo( driven_id, min1, max1, max2, min2 ) ); - } - else - { - llerrs << " Unable to resolve driven parameter: " << driven_id << llendl; - return FALSE; - } - } - return TRUE; -} - -//virtual -void LLDriverParamInfo::toStream(std::ostream &out) -{ - LLViewerVisualParamInfo::toStream(out); - out << "driver" << "\t"; - out << mDrivenInfoList.size() << "\t"; - for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++) - { - LLDrivenEntryInfo driven = *iter; - out << driven.mDrivenID << "\t"; - } - - out << std::endl; - - if(isAgentAvatarValid()) - { - for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++) - { - LLDrivenEntryInfo driven = *iter; - LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getVisualParam(driven.mDrivenID); - if (param) - { - param->getInfo()->toStream(out); - if (param->getWearableType() != mWearableType) - { - if(param->getCrossWearable()) - { - out << "cross-wearable" << "\t"; - } - else - { - out << "ERROR!" << "\t"; - } - } - else - { - out << "valid" << "\t"; - } - } - else - { - llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl; - } - out << std::endl; - } - } -} - -//----------------------------------------------------------------------------- -// LLDriverParam -//----------------------------------------------------------------------------- - -LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) : - mCurrentDistortionParam( NULL ), - mAvatarp(avatarp), - mWearablep(NULL) -{ - mDefaultVec.clear(); -} - -LLDriverParam::LLDriverParam(LLWearable *wearablep) : - mCurrentDistortionParam( NULL ), - mAvatarp(NULL), - mWearablep(wearablep) -{ - mDefaultVec.clear(); -} - -LLDriverParam::~LLDriverParam() -{ -} - -BOOL LLDriverParam::setInfo(LLDriverParamInfo *info) -{ - llassert(mInfo == NULL); - if (info->mID < 0) - return FALSE; - mInfo = info; - mID = info->mID; - - setWeight(getDefaultWeight(), FALSE ); - - return TRUE; -} - -void LLDriverParam::setWearable(LLWearable *wearablep) -{ - if (wearablep) - { - mWearablep = wearablep; - mAvatarp = NULL; - } -} - -void LLDriverParam::setAvatar(LLVOAvatar *avatarp) -{ - if (avatarp) - { - mWearablep = NULL; - mAvatarp = avatarp; - } -} - -/*virtual*/ LLViewerVisualParam* LLDriverParam::cloneParam(LLWearable* wearable) const -{ - LLDriverParam *new_param; - if (wearable) - { - new_param = new LLDriverParam(wearable); - } - else - { - if (mWearablep) - { - new_param = new LLDriverParam(mWearablep); - } - else - { - new_param = new LLDriverParam(mAvatarp); - } - } - *new_param = *this; - return new_param; -} - -#if 0 // obsolete -BOOL LLDriverParam::parseData(LLXmlTreeNode* node) -{ - LLDriverParamInfo* info = new LLDriverParamInfo; - - info->parseXml(node); - if (!setInfo(info)) - { - delete info; - return FALSE; - } - return TRUE; -} -#endif - -void LLDriverParam::setWeight(F32 weight, BOOL upload_bake) -{ - F32 min_weight = getMinWeight(); - F32 max_weight = getMaxWeight(); - if (mIsAnimating) - { - // allow overshoot when animating - mCurWeight = weight; - } - else - { - mCurWeight = llclamp(weight, min_weight, max_weight); - } - - // driven ________ - // ^ /| |\ ^ - // | / | | \ | - // | / | | \ | - // | / | | \ | - // | / | | \ | - //-------|----|-------|----|-------> driver - // | min1 max1 max2 min2 - - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - LLDrivenEntryInfo* info = driven->mInfo; - - F32 driven_weight = 0.f; - F32 driven_min = driven->mParam->getMinWeight(); - F32 driven_max = driven->mParam->getMaxWeight(); - - if (mIsAnimating) - { - // driven param doesn't interpolate (textures, for example) - if (!driven->mParam->getAnimating()) - { - continue; - } - if( mCurWeight < info->mMin1 ) - { - if (info->mMin1 == min_weight) - { - if (info->mMin1 == info->mMax1) - { - driven_weight = driven_max; - } - else - { - //up slope extrapolation - F32 t = (mCurWeight - info->mMin1) / (info->mMax1 - info->mMin1 ); - driven_weight = driven_min + t * (driven_max - driven_min); - } - } - else - { - driven_weight = driven_min; - } - - setDrivenWeight(driven,driven_weight,upload_bake); - continue; - } - else - if ( mCurWeight > info->mMin2 ) - { - if (info->mMin2 == max_weight) - { - if (info->mMin2 == info->mMax2) - { - driven_weight = driven_max; - } - else - { - //down slope extrapolation - F32 t = (mCurWeight - info->mMax2) / (info->mMin2 - info->mMax2 ); - driven_weight = driven_max + t * (driven_min - driven_max); - } - } - else - { - driven_weight = driven_min; - } - - setDrivenWeight(driven,driven_weight,upload_bake); - continue; - } - } - - driven_weight = getDrivenWeight(driven, mCurWeight); - setDrivenWeight(driven,driven_weight,upload_bake); - } -} - -F32 LLDriverParam::getTotalDistortion() -{ - F32 sum = 0.f; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - sum += driven->mParam->getTotalDistortion(); - } - - return sum; -} - -const LLVector4a &LLDriverParam::getAvgDistortion() -{ - // It's not actually correct to take the average of averages, but it good enough here. - LLVector4a sum; - sum.clear(); - S32 count = 0; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - sum.add(driven->mParam->getAvgDistortion()); - count++; - } - sum.mul( 1.f/(F32)count); - - mDefaultVec = sum; - return mDefaultVec; -} - -F32 LLDriverParam::getMaxDistortion() -{ - F32 max = 0.f; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - F32 param_max = driven->mParam->getMaxDistortion(); - if( param_max > max ) - { - max = param_max; - } - } - - return max; -} - - -LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) -{ - LLVector4a sum; - sum.clear(); - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - sum.add(driven->mParam->getVertexDistortion( index, poly_mesh )); - } - return sum; -} - -const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) -{ - mCurrentDistortionParam = NULL; - const LLVector4a* v = NULL; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - v = driven->mParam->getFirstDistortion( index, poly_mesh ); - if( v ) - { - mCurrentDistortionParam = driven->mParam; - break; - } - } - - return v; -}; - -const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) -{ - llassert( mCurrentDistortionParam ); - if( !mCurrentDistortionParam ) - { - return NULL; - } - - LLDrivenEntry* driven = NULL; - entry_list_t::iterator iter; - - // Set mDriven iteration to the right point - for( iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - driven = &(*iter); - if( driven->mParam == mCurrentDistortionParam ) - { - break; - } - } - - llassert(driven); - if (!driven) - { - return NULL; // shouldn't happen, but... - } - - // We're already in the middle of a param's distortions, so get the next one. - const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh ); - if( (!v) && (iter != mDriven.end()) ) - { - // This param is finished, so start the next param. It might not have any - // distortions, though, so we have to loop to find the next param that does. - for( iter++; iter != mDriven.end(); iter++ ) - { - driven = &(*iter); - v = driven->mParam->getFirstDistortion( index, poly_mesh ); - if( v ) - { - mCurrentDistortionParam = driven->mParam; - break; - } - } - } - - return v; -}; - -//----------------------------------------------------------------------------- -// setAnimationTarget() -//----------------------------------------------------------------------------- -void LLDriverParam::setAnimationTarget( F32 target_value, BOOL upload_bake ) -{ - LLVisualParam::setAnimationTarget(target_value, upload_bake); - - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - F32 driven_weight = getDrivenWeight(driven, mTargetWeight); - - // this isn't normally necessary, as driver params handle interpolation of their driven params - // but texture params need to know to assume their final value at beginning of interpolation - driven->mParam->setAnimationTarget(driven_weight, upload_bake); - } -} - -//----------------------------------------------------------------------------- -// stopAnimating() -//----------------------------------------------------------------------------- -void LLDriverParam::stopAnimating(BOOL upload_bake) -{ - LLVisualParam::stopAnimating(upload_bake); - - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - driven->mParam->setAnimating(FALSE); - } -} - -/*virtual*/ -BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params) -{ - BOOL success = TRUE; - LLDriverParamInfo::entry_info_list_t::iterator iter; - for (iter = getInfo()->mDrivenInfoList.begin(); iter != getInfo()->mDrivenInfoList.end(); ++iter) - { - LLDrivenEntryInfo *driven_info = &(*iter); - S32 driven_id = driven_info->mDrivenID; - - // check for already existing links. Do not overwrite. - BOOL found = FALSE; - for (entry_list_t::iterator driven_iter = mDriven.begin(); driven_iter != mDriven.end() && !found; ++driven_iter) - { - if (driven_iter->mInfo->mDrivenID == driven_id) - { - found = TRUE; - } - } - - if (!found) - { - LLViewerVisualParam* param = (LLViewerVisualParam*)mapper(driven_id); - bool push = param && (!only_cross_params || param->getCrossWearable()); - if (push) - { - mDriven.push_back(LLDrivenEntry( param, driven_info )); - } - else - { - success = FALSE; - } - } - } - - return success; -} - -void LLDriverParam::resetDrivenParams() -{ - mDriven.clear(); - mDriven.reserve(getInfo()->mDrivenInfoList.size()); -} - -void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type) -{ - bool needs_update = (getWearableType()==driven_type); - - // if the driver has a driven entry for the passed-in wearable type, we need to refresh the value - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) - { - LLDrivenEntry* driven = &(*iter); - if (driven && driven->mParam && driven->mParam->getCrossWearable() && driven->mParam->getWearableType() == driven_type) - { - needs_update = true; - } - } - - - if (needs_update) - { - LLWearableType::EType driver_type = (LLWearableType::EType)getWearableType(); - - // If we've gotten here, we've added a new wearable of type "type" - // Thus this wearable needs to get updates from the driver wearable. - // The call to setVisualParamWeight seems redundant, but is necessary - // as the number of driven wearables has changed since the last update. -Nyx - LLWearable *wearable = gAgentWearables.getTopWearable(driver_type); - if (wearable) - { - wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID), false); - } - } -} - - -//----------------------------------------------------------------------------- -// getDrivenWeight() -//----------------------------------------------------------------------------- -F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight) -{ - F32 min_weight = getMinWeight(); - F32 max_weight = getMaxWeight(); - const LLDrivenEntryInfo* info = driven->mInfo; - - F32 driven_weight = 0.f; - F32 driven_min = driven->mParam->getMinWeight(); - F32 driven_max = driven->mParam->getMaxWeight(); - - if( input_weight <= info->mMin1 ) - { - if( info->mMin1 == info->mMax1 && - info->mMin1 <= min_weight) - { - driven_weight = driven_max; - } - else - { - driven_weight = driven_min; - } - } - else - if( input_weight <= info->mMax1 ) - { - F32 t = (input_weight - info->mMin1) / (info->mMax1 - info->mMin1 ); - driven_weight = driven_min + t * (driven_max - driven_min); - } - else - if( input_weight <= info->mMax2 ) - { - driven_weight = driven_max; - } - else - if( input_weight <= info->mMin2 ) - { - F32 t = (input_weight - info->mMax2) / (info->mMin2 - info->mMax2 ); - driven_weight = driven_max + t * (driven_min - driven_max); - } - else - { - if (info->mMax2 >= max_weight) - { - driven_weight = driven_max; - } - else - { - driven_weight = driven_min; - } - } - - return driven_weight; -} - -void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake) -{ - bool use_self = false; - if(isAgentAvatarValid() && - mWearablep && - driven->mParam->getCrossWearable()) - { - LLViewerWearable* wearable = dynamic_cast (mWearablep); - if (wearable->isOnTop()) - { - use_self = true; - } - } - - if (use_self) - { - // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values - gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake ); - } - else - { - driven->mParam->setWeight( driven_weight, upload_bake ); - } -} diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h deleted file mode 100644 index 7a4d711d4e..0000000000 --- a/indra/newview/lldriverparam.h +++ /dev/null @@ -1,128 +0,0 @@ -/** - * @file lldriverparam.h - * @brief A visual parameter that drives (controls) other visual parameters. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLDRIVERPARAM_H -#define LL_LLDRIVERPARAM_H - -#include "llviewervisualparam.h" -#include "llwearabletype.h" - -class LLPhysicsMotion; -class LLVOAvatar; -class LLWearable; - -//----------------------------------------------------------------------------- - -struct LLDrivenEntryInfo -{ - LLDrivenEntryInfo( S32 id, F32 min1, F32 max1, F32 max2, F32 min2 ) - : mDrivenID( id ), mMin1( min1 ), mMax1( max1 ), mMax2( max2 ), mMin2( min2 ) {} - S32 mDrivenID; - F32 mMin1; - F32 mMax1; - F32 mMax2; - F32 mMin2; -}; - -struct LLDrivenEntry -{ - LLDrivenEntry( LLViewerVisualParam* param, LLDrivenEntryInfo *info ) - : mParam( param ), mInfo( info ) {} - LLViewerVisualParam* mParam; - LLDrivenEntryInfo* mInfo; -}; - -//----------------------------------------------------------------------------- - -class LLDriverParamInfo : public LLViewerVisualParamInfo -{ - friend class LLDriverParam; -public: - LLDriverParamInfo(); - /*virtual*/ ~LLDriverParamInfo() {}; - - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); - - /*virtual*/ void toStream(std::ostream &out); - -protected: - typedef std::deque entry_info_list_t; - entry_info_list_t mDrivenInfoList; -}; - -//----------------------------------------------------------------------------- - -class LLDriverParam : public LLViewerVisualParam -{ - friend class LLPhysicsMotion; // physics motion needs to access driven params directly. -public: - LLDriverParam(LLVOAvatar *avatarp); - LLDriverParam(LLWearable *wearablep); - ~LLDriverParam(); - - // Special: These functions are overridden by child classes - LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLDriverParamInfo *info); - - void setWearable(LLWearable *wearablep); - void setAvatar(LLVOAvatar *avatarp); - void updateCrossDrivenParams(LLWearableType::EType driven_type); - - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const; - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - /*virtual*/ void apply( ESex sex ) {} // apply is called separately for each driven param. - /*virtual*/ void setWeight(F32 weight, BOOL upload_bake); - /*virtual*/ void setAnimationTarget( F32 target_value, BOOL upload_bake ); - /*virtual*/ void stopAnimating(BOOL upload_bake); - /*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params); - /*virtual*/ void resetDrivenParams(); - - // LLViewerVisualParam Virtual functions - /*virtual*/ F32 getTotalDistortion(); - /*virtual*/ const LLVector4a& getAvgDistortion(); - /*virtual*/ F32 getMaxDistortion(); - /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); - -protected: - F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight); - void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake); - - - LLVector4a mDefaultVec; // temp holder - typedef std::vector entry_list_t; - entry_list_t mDriven; - LLViewerVisualParam* mCurrentDistortionParam; - // Backlink only; don't make this an LLPointer. - LLVOAvatar* mAvatarp; - LLWearable* mWearablep; -}; - -#endif // LL_LLDRIVERPARAM_H diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 68bdf9a8d6..048837acfe 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -82,7 +82,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp, if (avatarp->isSelf()) { const LLWearableType::EType wearable_type = tex_entry->mWearableType; - LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); + LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0); if (wearable) { LLLocalTextureObject *lto = wearable->getLocalTextureObject(te); @@ -174,7 +174,7 @@ void LLFloaterAvatarTextures::onClickDump(void* data) LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((ETextureIndex)i); if (avatarp->isSelf()) { - LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); + LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0); if (wearable) { LLLocalTextureObject *lto = wearable->getLocalTextureObject(i); diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 3a199135b6..834172f58f 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -483,7 +483,7 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp U32 count = gAgentWearables.getWearableCount(type); for(U32 wearable_iter = 0; wearable_iter < count; wearable_iter++) { - LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_iter); + LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_iter); if (wearable) { std::vector texture_list = wearable->getLocalTextureListSeq(); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 9aadca1d80..43bb1f57e0 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -922,7 +922,7 @@ void LLPanelEditWearable::onCommitSexChange() } bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE; - LLViewerWearable* wearable = gAgentWearables.getWearable(type, index); + LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, index); if (wearable) { wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE); diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index cb6989c9dd..ded7d66022 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -166,7 +166,7 @@ protected: } - void setParamValue(LLViewerVisualParam *param, + void setParamValue(const LLViewerVisualParam *param, const F32 new_value_local, F32 behavior_maxeffect); @@ -673,12 +673,10 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) 0, FALSE); } - for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin(); - iter != driver_param->mDriven.end(); - ++iter) + S32 num_driven = driver_param->getDrivenParamsCount(); + for (S32 i = 0; i < num_driven; ++i) { - LLDrivenEntry &entry = (*iter); - LLViewerVisualParam *driven_param = entry.mParam; + const LLViewerVisualParam *driven_param = driver_param->getDrivenParam(i); setParamValue(driven_param,position_new_local_clamped, behavior_maxeffect); } } @@ -758,7 +756,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) } // Range of new_value_local is assumed to be [0 , 1] normalized. -void LLPhysicsMotion::setParamValue(LLViewerVisualParam *param, +void LLPhysicsMotion::setParamValue(const LLViewerVisualParam *param, F32 new_value_normalized, F32 behavior_maxeffect) { diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 6a692209e9..8c4a05b116 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -389,7 +389,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearab if (!wearable) { - wearable = gAgentWearables.getWearable(LLWearableType::WT_SHAPE, 0); + wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); } if (!wearable) { diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 34f24ef330..eb3a212eae 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -632,11 +632,6 @@ void LLViewerWearable::revertValues() } } -BOOL LLViewerWearable::isOnTop() const -{ - return (this == gAgentWearables.getTopWearable(mType)); -} - void LLViewerWearable::createLayers(S32 te) { LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); @@ -736,27 +731,8 @@ void LLViewerWearable::destroyTextures() mSavedTEMap.clear(); } -void LLViewerWearable::pullCrossWearableValues() -{ - // scan through all of the avatar's visual parameters - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if( param ) - { - LLDriverParam *driver_param = dynamic_cast(param); - if(driver_param) - { - // parameter is a driver parameter, have it update its - driver_param->updateCrossDrivenParams(getType()); - } - } - } -} - - -void LLViewerWearable::setLabelUpdated() const +// virtual +void LLViewerWearable::setUpdated() const { gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID()); } @@ -771,6 +747,13 @@ void LLViewerWearable::refreshName() } } +// virtual +void LLViewerWearable::addToBakedTextureHash(LLMD5& hash) const +{ + LLUUID asset_id = getAssetID(); + hash.update((const unsigned char*)asset_id.mData, UUID_BYTES); +} + struct LLWearableSaveData { LLWearableType::EType mType; diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index ccc26000f2..b3c1e3c3ba 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -86,17 +86,17 @@ public: void revertValues(); void saveValues(); - void pullCrossWearableValues(); - - BOOL isOnTop() const; // Something happened that requires the wearable's label to be updated (e.g. worn/unworn). - void setLabelUpdated() const; + /*virtual*/void setUpdated() const; // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem, // not the wearable asset itself. void refreshName(); + // Update the baked texture hash. + /*virtual*/void addToBakedTextureHash(LLMD5& hash) const; + protected: typedef std::map te_map_t; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b86c5d5e8f..2309ea3488 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -644,7 +644,7 @@ static F32 calc_bouncy_animation(F32 x); LLVOAvatar::LLVOAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : - LLAvatarAppearance(), + LLAvatarAppearance(&gAgentWearables), LLViewerObject(id, pcode, regionp), mSpecialRenderMode(0), mAttachmentGeometryBytes(0), @@ -5860,30 +5860,6 @@ void LLVOAvatar::updateVisualParams() updateHeadOffset(); } -// virtual -U32 LLVOAvatar::getWearableCount(const LLWearableType::EType type) const -{ - return gAgentWearables.getWearableCount(type); -} - -// virtual -U32 LLVOAvatar::getWearableCount(const U32 tex_index) const -{ - return gAgentWearables.getWearableCount(tex_index); -} - -// virtual -LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) -{ - return gAgentWearables.getWearable(type, index); -} - -// virtual -const LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const -{ - return gAgentWearables.getWearable(type, index); -} - //----------------------------------------------------------------------------- // isActive() //----------------------------------------------------------------------------- @@ -7008,48 +6984,6 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const } } -// Unlike most wearable functions, this works for both self and other. -BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const -{ - if (mIsDummy) return TRUE; - - switch(type) - { - case LLWearableType::WT_SHAPE: - case LLWearableType::WT_SKIN: - case LLWearableType::WT_HAIR: - case LLWearableType::WT_EYES: - return TRUE; // everyone has all bodyparts - default: - break; // Do nothing - } - - /* switch(type) - case LLWearableType::WT_SHIRT: - indicator_te = TEX_UPPER_SHIRT; */ - for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); - tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); - ++tex_iter) - { - const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; - if (texture_dict->mWearableType == type) - { - // If you're checking another avatar's clothing, you don't have component textures. - // Thus, you must check to see if the corresponding baked texture is defined. - // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing - // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that - // gets baked into a texture that always exists (upper or lower). - if (texture_dict->mIsUsedByBakedTexture) - { - const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); - } - return FALSE; - } - } - return FALSE; -} - //----------------------------------------------------------------------------- // clampAttachmentPositions() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5f780da145..54719d2671 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -227,17 +227,6 @@ public: /*virtual*/BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode bool isBuilt() const { return mIsBuilt; } -/******************************************************************************** - ** ** - ** WEARABLES - **/ -public: - /*virtual*/ U32 getWearableCount(const LLWearableType::EType type) const; - /*virtual*/ U32 getWearableCount(const U32 tex_index) const; - - /*virtual*/ LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/); - /*virtual*/ const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; - private: //aligned members LL_ALIGN_16(LLVector4a mImpostorExtents[2]); @@ -755,9 +744,6 @@ public: ** WEARABLES **/ -public: - virtual BOOL isWearingWearableType(LLWearableType::EType type ) const; - //-------------------------------------------------------------------- // Attachments //-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e836a5e4a8..c1984fa738 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -74,9 +74,7 @@ LLPointer gAgentAvatarp = NULL; BOOL isAgentAvatarValid() { - return (gAgentAvatarp.notNull() && - (gAgentAvatarp->getRegion() != NULL) && - (!gAgentAvatarp->isDead())); + return (gAgentAvatarp.notNull() && gAgentAvatarp->isValid()); } void selfStartPhase(const std::string& phase_name) @@ -669,10 +667,16 @@ BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent) return LLVOAvatar::updateCharacter(agent); } +// virtual +BOOL LLVOAvatarSelf::isValid() const +{ + return ((getRegion() != NULL) && !isDead()); +} + // virtual void LLVOAvatarSelf::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { - if (isAgentAvatarValid()) + if (isValid()) { LLVOAvatar::idleUpdate(agent, world, time); idleUpdateTractorBeam(); @@ -695,7 +699,7 @@ void LLVOAvatarSelf::resetJointPositions( void ) return LLVOAvatar::resetJointPositions(); } // virtual -BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake ) +BOOL LLVOAvatarSelf::setVisualParamWeight(const LLVisualParam *which_param, F32 weight, BOOL upload_bake ) { if (!which_param) { @@ -723,7 +727,7 @@ BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bak return setParamWeight(param,weight,upload_bake); } -BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL upload_bake ) +BOOL LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight, BOOL upload_bake ) { if (!param) { @@ -736,7 +740,7 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL U32 size = gAgentWearables.getWearableCount(type); for (U32 count = 0; count < size; ++count) { - LLViewerWearable *wearable = gAgentWearables.getWearable(type,count); + LLViewerWearable *wearable = gAgentWearables.getViewerWearable(type,count); if (wearable) { wearable->setVisualParamWeight(param->getID(), weight, upload_bake); @@ -762,7 +766,7 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation() // apply wearable visual params to avatar for (U32 type = 0; type < LLWearableType::WT_COUNT; type++) { - LLViewerWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type); + LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type); if (wearable) { wearable->writeToAvatar(); @@ -1257,7 +1261,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) // Make sure the inventory is in sync with the avatar. // Update COF contents, don't trigger appearance update. - if (!isAgentAvatarValid()) + if (!isValid()) { llinfos << "removeItemLinks skipped, avatar is under destruction" << llendl; } @@ -1780,7 +1784,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te return; } LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(type); - if (!gAgentWearables.getWearable(wearable_type,index)) + if (!gAgentWearables.getViewerWearable(wearable_type,index)) { // no wearable is loaded, cannot set the texture. return; @@ -1796,7 +1800,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te LLViewerTexLayerSet *layer_set = getLayerSet(type); if (layer_set) { - layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getWearable(wearable_type,index)); + layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getViewerWearable(wearable_type,index)); } } @@ -2286,7 +2290,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const for (U32 wearable_index = 0; wearable_index < count; ++wearable_index) { - LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, wearable_index); + LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, wearable_index); if (wearable) { const LLLocalTextureObject *texture = wearable->getLocalTextureObject((S32)t_index); @@ -2361,7 +2365,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 wearable_index) const { LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i); - LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_index); + LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_index); if (wearable) { return wearable->getLocalTextureObject(i); diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 12886d2d36..2fe960cd1e 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -97,7 +97,7 @@ public: void resetJointPositions( void ); - /*virtual*/ BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE ); + /*virtual*/ BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE ); /*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE ); /*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE ); /*virtual*/ void updateVisualParams(); @@ -111,7 +111,7 @@ public: private: // helper function. Passed in param is assumed to be in avatar's parameter list. - BOOL setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL upload_bake = FALSE ); + BOOL setParamWeight(const LLViewerVisualParam *param, F32 weight, BOOL upload_bake = FALSE ); @@ -131,6 +131,7 @@ private: public: /*virtual*/ bool isSelf() const { return true; } + /*virtual*/ BOOL isValid() const; //-------------------------------------------------------------------- // Updates -- cgit v1.2.3 From 2b2fd9e97526d10b0b4d34154cc0a46f957acba7 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2012 17:48:09 -0400 Subject: enhanced XML archetype dumping, added to per-avatar menus --- indra/newview/llviewermenu.cpp | 9 +++++- indra/newview/llvoavatar.cpp | 37 ++++++++++++++++++---- indra/newview/llvoavatar.h | 6 ++-- .../skins/default/xui/en/menu_attachment_other.xml | 8 +++++ .../skins/default/xui/en/menu_attachment_self.xml | 8 +++++ .../skins/default/xui/en/menu_avatar_other.xml | 8 +++++ .../skins/default/xui/en/menu_avatar_self.xml | 16 ++++++++++ .../default/xui/en/menu_inspect_avatar_gear.xml | 8 +++++ .../default/xui/en/menu_inspect_self_gear.xml | 8 +++++ 9 files changed, 99 insertions(+), 9 deletions(-) mode change 100644 => 100755 indra/newview/skins/default/xui/en/menu_attachment_other.xml mode change 100644 => 100755 indra/newview/skins/default/xui/en/menu_attachment_self.xml mode change 100644 => 100755 indra/newview/skins/default/xui/en/menu_avatar_other.xml mode change 100644 => 100755 indra/newview/skins/default/xui/en/menu_avatar_self.xml mode change 100644 => 100755 indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml mode change 100644 => 100755 indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml (limited to 'indra/newview') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 3c0136c258..9c748c7f86 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1600,7 +1600,14 @@ class LLAdvancedAppearanceToXML : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLVOAvatar::dumpArchetypeXML(NULL); + std::string emptyname; + LLVOAvatar* avatar = + find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); + if (!avatar) + { + avatar = gAgentAvatarp; + } + avatar->dumpArchetypeXML(emptyname); return true; } }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d92caf1edb..39ad8fc8d6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -36,6 +36,7 @@ #include #include +#include #include "llaudioengine.h" #include "noise.h" @@ -7762,11 +7763,35 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) dirtyMesh(); } -// static -void LLVOAvatar::dumpArchetypeXML( void* ) +void LLVOAvatar::dumpArchetypeXML(const std::string& filename ) { + std::string outfilename(filename); + if (outfilename.empty()) + { + std::string fullname = getFullname(); + if (!fullname.empty()) + { + typedef std::map file_num_type; + static file_num_type file_nums; + file_num_type::iterator it = file_nums.find(fullname); + S32 num = 0; + if (it != file_nums.end()) + { + num = it->second; + } + std::ostringstream temp; + temp << std::setw(4) << std::setfill('0') << num; + file_nums[fullname] = num+1; + outfilename = fullname + " " + temp.str() + ".xml"; + } + } + if (outfilename.empty()) + { + outfilename = std::string("new archetype.xml"); + } + LLAPRFile outfile; - outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml"), LL_APR_WB ); + outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,outfilename), LL_APR_WB ); apr_file_t* file = outfile.getFileHandle(); if (!file) { @@ -7782,12 +7807,12 @@ void LLVOAvatar::dumpArchetypeXML( void* ) apr_file_printf( file, "\n\t\n" ); // only body parts, not clothing. - for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_EYES; type++) + for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_COUNT; type++) { const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); - for (LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam()) + for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; if( (viewer_param->getWearableType() == type) && @@ -7803,7 +7828,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? - LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0); + LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); if( te_image ) { std::string uuid_str; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 3f65dec11c..5ec2009971 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -710,7 +710,9 @@ public: //-------------------------------------------------------------------- public: BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; } - BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode + BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode + BOOL isUsingLocalAppearance() const { return mUseLocalAppearance; } + private: BOOL mAppearanceAnimating; LLFrameTimer mAppearanceMorphTimer; @@ -1014,7 +1016,7 @@ private: // General //-------------------------------------------------------------------- public: - static void dumpArchetypeXML(void*); + void dumpArchetypeXML(const std::string& filename); static void dumpBakedStatus(); const std::string getBakedStatusForPrintout() const; void dumpAvatarTEs(const std::string& context) const; diff --git a/indra/newview/skins/default/xui/en/menu_attachment_other.xml b/indra/newview/skins/default/xui/en/menu_attachment_other.xml old mode 100644 new mode 100755 index b46b62ec4d..6f92273097 --- a/indra/newview/skins/default/xui/en/menu_attachment_other.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_other.xml @@ -79,6 +79,14 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml old mode 100644 new mode 100755 index b8128da358..84e26268bd --- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml @@ -123,6 +123,14 @@ name="Edit Outfit"> + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml old mode 100644 new mode 100755 index d9bdfece38..0e79b0fee3 --- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml @@ -261,4 +261,20 @@ + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml old mode 100644 new mode 100755 index 76b188220d..4fdfb2281b --- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml @@ -112,6 +112,14 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml old mode 100644 new mode 100755 index 5e7b16ed4a..f935f0f312 --- a/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml @@ -249,4 +249,12 @@ + + + + -- cgit v1.2.3 From 77b33d9623c08152932282048fe847d79fcf43cd Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 7 Sep 2012 23:17:34 -0400 Subject: SH-3264 Porting over the XML loading of the avatar structure to llappearance Moved over the necessary classes to llappearance to support the loading of the avatar's structure & params from file. --- indra/newview/CMakeLists.txt | 4 - indra/newview/llagentcamera.cpp | 10 +- indra/newview/llfloaterbvhpreview.cpp | 4 +- indra/newview/llfloaterimagepreview.cpp | 8 +- indra/newview/llhudeffectlookat.cpp | 2 +- indra/newview/llpolymesh.cpp | 1297 -------------------------- indra/newview/llpolymesh.h | 438 --------- indra/newview/llpolymorph.h | 6 +- indra/newview/llspatialpartition.cpp | 2 +- indra/newview/llstartup.cpp | 3 + indra/newview/llviewerjoint.cpp | 121 +-- indra/newview/llviewerjoint.h | 20 +- indra/newview/llviewerjointmesh.cpp | 283 +----- indra/newview/llviewerjointmesh.h | 86 +- indra/newview/llviewerwindow.cpp | 2 +- indra/newview/llvoavatar.cpp | 1548 +++---------------------------- indra/newview/llvoavatar.h | 172 +--- indra/newview/llvoavatarself.cpp | 6 +- indra/newview/llvoavatarself.h | 2 +- 19 files changed, 196 insertions(+), 3818 deletions(-) delete mode 100644 indra/newview/llpolymesh.cpp delete mode 100644 indra/newview/llpolymesh.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 21b1512e58..7942e815ae 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -443,8 +443,6 @@ set(viewer_SOURCE_FILES llplacesinventorybridge.cpp llplacesinventorypanel.cpp llpopupview.cpp - llpolymesh.cpp - llpolymorph.cpp llpostcard.cpp llpreview.cpp llpreviewanim.cpp @@ -1000,8 +998,6 @@ set(viewer_HEADER_FILES llpipelinelistener.h llplacesinventorybridge.h llplacesinventorypanel.h - llpolymesh.h - llpolymorph.h llpopupview.h llpostcard.h llpreview.h diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e1ef0d5399..7f4d33753d 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1078,8 +1078,8 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) if (!isAgentAvatarValid()) return; - LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot.getWorldRotation(); - LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot.getWorldRotation(); + LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation(); + LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation(); if ((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) && (root_at * last_at_axis > 0.95f)) @@ -1432,7 +1432,7 @@ void LLAgentCamera::updateCamera() LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() + LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation(); LLVector3 diff = mCameraPositionAgent - head_pos; - diff = diff * ~gAgentAvatarp->mRoot.getWorldRotation(); + diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation(); LLJoint* torso_joint = gAgentAvatarp->mTorsop; LLJoint* chest_joint = gAgentAvatarp->mChestp; @@ -1456,7 +1456,7 @@ void LLAgentCamera::updateCamera() gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); - gAgentAvatarp->mRoot.updateWorldMatrixChildren(); + gAgentAvatarp->mRoot->updateWorldMatrixChildren(); for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end(); ) @@ -1684,7 +1684,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) F32 camera_land_height; LLVector3d frame_center_global = !isAgentAvatarValid() ? gAgent.getPositionGlobal() : - gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition()); + gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition()); BOOL isConstrained = FALSE; LLVector3d head_offset; diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index fa0ad20fdb..ce67c6c65d 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -1097,12 +1097,12 @@ BOOL LLPreviewAnimation::render() gGL.flush(); - LLVector3 target_pos = avatarp->mRoot.getWorldPosition(); + LLVector3 target_pos = avatarp->mRoot->getWorldPosition(); LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) * LLQuaternion(mCameraYaw, LLVector3::z_axis); - LLQuaternion av_rot = avatarp->mRoot.getWorldRotation() * camera_rot; + LLQuaternion av_rot = avatarp->mRoot->getWorldRotation() * camera_rot; LLViewerCamera::getInstance()->setOriginAndLookAt( target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera LLVector3::z_axis, // up diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 6b2492d927..887cd2f4b0 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -593,7 +593,7 @@ S8 LLImagePreviewAvatar::getType() const void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) { - mTargetJoint = mDummyAvatar->mRoot.findJoint(joint_name); + mTargetJoint = mDummyAvatar->mRoot->findJoint(joint_name); // clear out existing test mesh if (mTargetMesh) { @@ -612,9 +612,9 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const mDummyAvatar->updateVisualParams(); mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); } - mDummyAvatar->mRoot.setVisible(FALSE, TRUE); + mDummyAvatar->mRoot->setVisible(FALSE, TRUE); - mTargetMesh = (LLViewerJointMesh*)mDummyAvatar->mRoot.findJoint(mesh_name); + mTargetMesh = (LLViewerJointMesh*)mDummyAvatar->mRoot->findJoint(mesh_name); mTargetMesh->setTestTexture(mTextureName); mTargetMesh->setVisible(TRUE, FALSE); mCameraDistance = distance; @@ -631,7 +631,7 @@ void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name) { if (mDummyAvatar) { - LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot.findJoint(mesh_name); + LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot->findJoint(mesh_name); // clear out existing test mesh if (mesh) { diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index bc3b220dc0..9dde65ceb6 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -636,7 +636,7 @@ bool LLHUDEffectLookAt::calcTargetPosition() } else { - target_rot = target_av->mRoot.getWorldRotation(); + target_rot = target_av->mRoot->getWorldRotation(); } } else // target obj is not an avatar diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp deleted file mode 100644 index 70f3b5335e..0000000000 --- a/indra/newview/llpolymesh.cpp +++ /dev/null @@ -1,1297 +0,0 @@ -/** - * @file llpolymesh.cpp - * @brief Implementation of LLPolyMesh class - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" - -#include "llfasttimer.h" -#include "llmemory.h" - -#include "llviewercontrol.h" -#include "llxmltree.h" -#include "llvoavatar.h" -#include "llwearable.h" -#include "lldir.h" -#include "llvolume.h" -#include "llendianswizzle.h" - -#include "llpolymesh.h" - -#define HEADER_ASCII "Linden Mesh 1.0" -#define HEADER_BINARY "Linden Binary Mesh 1.0" - -extern LLControlGroup gSavedSettings; // read only - -LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data, - const std::string &name); -LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data, - const LLVector3 &direction, - const std::string &name); -LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data, - F32 scale, - const std::string &name); - -//----------------------------------------------------------------------------- -// Global table of loaded LLPolyMeshes -//----------------------------------------------------------------------------- -LLPolyMesh::LLPolyMeshSharedDataTable LLPolyMesh::sGlobalSharedMeshList; - -//----------------------------------------------------------------------------- -// LLPolyMeshSharedData() -//----------------------------------------------------------------------------- -LLPolyMeshSharedData::LLPolyMeshSharedData() -{ - mNumVertices = 0; - mBaseCoords = NULL; - mBaseNormals = NULL; - mBaseBinormals = NULL; - mTexCoords = NULL; - mDetailTexCoords = NULL; - mWeights = NULL; - mHasWeights = FALSE; - mHasDetailTexCoords = FALSE; - - mNumFaces = 0; - mFaces = NULL; - - mNumJointNames = 0; - mJointNames = NULL; - - mTriangleIndices = NULL; - mNumTriangleIndices = 0; - - mReferenceData = NULL; - - mLastIndexOffset = -1; -} - -//----------------------------------------------------------------------------- -// ~LLPolyMeshSharedData() -//----------------------------------------------------------------------------- -LLPolyMeshSharedData::~LLPolyMeshSharedData() -{ - freeMeshData(); - for_each(mMorphData.begin(), mMorphData.end(), DeletePointer()); - mMorphData.clear(); -} - -//----------------------------------------------------------------------------- -// setupLOD() -//----------------------------------------------------------------------------- -void LLPolyMeshSharedData::setupLOD(LLPolyMeshSharedData* reference_data) -{ - mReferenceData = reference_data; - - if (reference_data) - { - mBaseCoords = reference_data->mBaseCoords; - mBaseNormals = reference_data->mBaseNormals; - mBaseBinormals = reference_data->mBaseBinormals; - mTexCoords = reference_data->mTexCoords; - mDetailTexCoords = reference_data->mDetailTexCoords; - mWeights = reference_data->mWeights; - mHasWeights = reference_data->mHasWeights; - mHasDetailTexCoords = reference_data->mHasDetailTexCoords; - } -} - -//----------------------------------------------------------------------------- -// LLPolyMeshSharedData::freeMeshData() -//----------------------------------------------------------------------------- -void LLPolyMeshSharedData::freeMeshData() -{ - if (!mReferenceData) - { - mNumVertices = 0; - - ll_aligned_free_16(mBaseCoords); - mBaseCoords = NULL; - - ll_aligned_free_16(mBaseNormals); - mBaseNormals = NULL; - - ll_aligned_free_16(mBaseBinormals); - mBaseBinormals = NULL; - - ll_aligned_free_16(mTexCoords); - mTexCoords = NULL; - - ll_aligned_free_16(mDetailTexCoords); - mDetailTexCoords = NULL; - - ll_aligned_free_16(mWeights); - mWeights = NULL; - } - - mNumFaces = 0; - delete [] mFaces; - mFaces = NULL; - - mNumJointNames = 0; - delete [] mJointNames; - mJointNames = NULL; - - delete [] mTriangleIndices; - mTriangleIndices = NULL; - -// mVertFaceMap.deleteAllData(); -} - -// compate_int is used by the qsort function to sort the index array -int compare_int(const void *a, const void *b); - -//----------------------------------------------------------------------------- -// genIndices() -//----------------------------------------------------------------------------- -void LLPolyMeshSharedData::genIndices(S32 index_offset) -{ - if (index_offset == mLastIndexOffset) - { - return; - } - - delete []mTriangleIndices; - mTriangleIndices = new U32[mNumTriangleIndices]; - - S32 cur_index = 0; - for (S32 i = 0; i < mNumFaces; i++) - { - mTriangleIndices[cur_index] = mFaces[i][0] + index_offset; - cur_index++; - mTriangleIndices[cur_index] = mFaces[i][1] + index_offset; - cur_index++; - mTriangleIndices[cur_index] = mFaces[i][2] + index_offset; - cur_index++; - } - - mLastIndexOffset = index_offset; -} - -//-------------------------------------------------------------------- -// LLPolyMeshSharedData::getNumKB() -//-------------------------------------------------------------------- -U32 LLPolyMeshSharedData::getNumKB() -{ - U32 num_kb = sizeof(LLPolyMesh); - - if (!isLOD()) - { - num_kb += mNumVertices * - ( sizeof(LLVector3) + // coords - sizeof(LLVector3) + // normals - sizeof(LLVector2) ); // texCoords - } - - if (mHasDetailTexCoords && !isLOD()) - { - num_kb += mNumVertices * sizeof(LLVector2); // detailTexCoords - } - - if (mHasWeights && !isLOD()) - { - num_kb += mNumVertices * sizeof(float); // weights - } - - num_kb += mNumFaces * sizeof(LLPolyFace); // faces - - num_kb /= 1024; - return num_kb; -} - -//----------------------------------------------------------------------------- -// LLPolyMeshSharedData::allocateVertexData() -//----------------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices ) -{ - U32 i; - mBaseCoords = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); - mBaseNormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); - mBaseBinormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); - mTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2)); - mDetailTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2)); - mWeights = (F32*) ll_aligned_malloc_16(numVertices*sizeof(F32)); - for (i = 0; i < numVertices; i++) - { - mBaseCoords[i].clear(); - mBaseNormals[i].clear(); - mBaseBinormals[i].clear(); - mTexCoords[i].clear(); - mWeights[i] = 0.f; - } - mNumVertices = numVertices; - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLPolyMeshSharedData::allocateFaceData() -//----------------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::allocateFaceData( U32 numFaces ) -{ - mFaces = new LLPolyFace[ numFaces ]; - mNumFaces = numFaces; - mNumTriangleIndices = mNumFaces * 3; - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLPolyMeshSharedData::allocateJointNames() -//----------------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::allocateJointNames( U32 numJointNames ) -{ - mJointNames = new std::string[ numJointNames ]; - mNumJointNames = numJointNames; - return TRUE; -} - -//-------------------------------------------------------------------- -// LLPolyMeshSharedData::loadMesh() -//-------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) -{ - //------------------------------------------------------------------------- - // Open the file - //------------------------------------------------------------------------- - if(fileName.empty()) - { - llerrs << "Filename is Empty!" << llendl; - return FALSE; - } - LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/ - if (!fp) - { - llerrs << "can't open: " << fileName << llendl; - return FALSE; - } - - //------------------------------------------------------------------------- - // Read a chunk - //------------------------------------------------------------------------- - char header[128]; /*Flawfinder: ignore*/ - if (fread(header, sizeof(char), 128, fp) != 128) - { - llwarns << "Short read" << llendl; - } - - //------------------------------------------------------------------------- - // Check for proper binary header - //------------------------------------------------------------------------- - BOOL status = FALSE; - if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 ) /*Flawfinder: ignore*/ - { - lldebugs << "Loading " << fileName << llendl; - - //---------------------------------------------------------------- - // File Header (seek past it) - //---------------------------------------------------------------- - fseek(fp, 24, SEEK_SET); - - //---------------------------------------------------------------- - // HasWeights - //---------------------------------------------------------------- - U8 hasWeights; - size_t numRead = fread(&hasWeights, sizeof(U8), 1, fp); - if (numRead != 1) - { - llerrs << "can't read HasWeights flag from " << fileName << llendl; - return FALSE; - } - if (!isLOD()) - { - mHasWeights = (hasWeights==0) ? FALSE : TRUE; - } - - //---------------------------------------------------------------- - // HasDetailTexCoords - //---------------------------------------------------------------- - U8 hasDetailTexCoords; - numRead = fread(&hasDetailTexCoords, sizeof(U8), 1, fp); - if (numRead != 1) - { - llerrs << "can't read HasDetailTexCoords flag from " << fileName << llendl; - return FALSE; - } - - //---------------------------------------------------------------- - // Position - //---------------------------------------------------------------- - LLVector3 position; - numRead = fread(position.mV, sizeof(float), 3, fp); - llendianswizzle(position.mV, sizeof(float), 3); - if (numRead != 3) - { - llerrs << "can't read Position from " << fileName << llendl; - return FALSE; - } - setPosition( position ); - - //---------------------------------------------------------------- - // Rotation - //---------------------------------------------------------------- - LLVector3 rotationAngles; - numRead = fread(rotationAngles.mV, sizeof(float), 3, fp); - llendianswizzle(rotationAngles.mV, sizeof(float), 3); - if (numRead != 3) - { - llerrs << "can't read RotationAngles from " << fileName << llendl; - return FALSE; - } - - U8 rotationOrder; - numRead = fread(&rotationOrder, sizeof(U8), 1, fp); - - if (numRead != 1) - { - llerrs << "can't read RotationOrder from " << fileName << llendl; - return FALSE; - } - - rotationOrder = 0; - - setRotation( mayaQ( rotationAngles.mV[0], - rotationAngles.mV[1], - rotationAngles.mV[2], - (LLQuaternion::Order)rotationOrder ) ); - - //---------------------------------------------------------------- - // Scale - //---------------------------------------------------------------- - LLVector3 scale; - numRead = fread(scale.mV, sizeof(float), 3, fp); - llendianswizzle(scale.mV, sizeof(float), 3); - if (numRead != 3) - { - llerrs << "can't read Scale from " << fileName << llendl; - return FALSE; - } - setScale( scale ); - - //------------------------------------------------------------------------- - // Release any existing mesh geometry - //------------------------------------------------------------------------- - freeMeshData(); - - U16 numVertices = 0; - - //---------------------------------------------------------------- - // NumVertices - //---------------------------------------------------------------- - if (!isLOD()) - { - numRead = fread(&numVertices, sizeof(U16), 1, fp); - llendianswizzle(&numVertices, sizeof(U16), 1); - if (numRead != 1) - { - llerrs << "can't read NumVertices from " << fileName << llendl; - return FALSE; - } - - allocateVertexData( numVertices ); - - for (U16 i = 0; i < numVertices; ++i) - { - //---------------------------------------------------------------- - // Coords - //---------------------------------------------------------------- - numRead = fread(&mBaseCoords[i], sizeof(float), 3, fp); - llendianswizzle(&mBaseCoords[i], sizeof(float), 3); - if (numRead != 3) - { - llerrs << "can't read Coordinates from " << fileName << llendl; - return FALSE; - } - } - - for (U16 i = 0; i < numVertices; ++i) - { - //---------------------------------------------------------------- - // Normals - //---------------------------------------------------------------- - numRead = fread(&mBaseNormals[i], sizeof(float), 3, fp); - llendianswizzle(&mBaseNormals[i], sizeof(float), 3); - if (numRead != 3) - { - llerrs << " can't read Normals from " << fileName << llendl; - return FALSE; - } - } - - for (U16 i = 0; i < numVertices; ++i) - { - //---------------------------------------------------------------- - // Binormals - //---------------------------------------------------------------- - numRead = fread(&mBaseBinormals[i], sizeof(float), 3, fp); - llendianswizzle(&mBaseBinormals[i], sizeof(float), 3); - if (numRead != 3) - { - llerrs << " can't read Binormals from " << fileName << llendl; - return FALSE; - } - } - - //---------------------------------------------------------------- - // TexCoords - //---------------------------------------------------------------- - numRead = fread(mTexCoords, 2*sizeof(float), numVertices, fp); - llendianswizzle(mTexCoords, sizeof(float), 2*numVertices); - if (numRead != numVertices) - { - llerrs << "can't read TexCoords from " << fileName << llendl; - return FALSE; - } - - //---------------------------------------------------------------- - // DetailTexCoords - //---------------------------------------------------------------- - if (mHasDetailTexCoords) - { - numRead = fread(mDetailTexCoords, 2*sizeof(float), numVertices, fp); - llendianswizzle(mDetailTexCoords, sizeof(float), 2*numVertices); - if (numRead != numVertices) - { - llerrs << "can't read DetailTexCoords from " << fileName << llendl; - return FALSE; - } - } - - //---------------------------------------------------------------- - // Weights - //---------------------------------------------------------------- - if (mHasWeights) - { - numRead = fread(mWeights, sizeof(float), numVertices, fp); - llendianswizzle(mWeights, sizeof(float), numVertices); - if (numRead != numVertices) - { - llerrs << "can't read Weights from " << fileName << llendl; - return FALSE; - } - } - } - - //---------------------------------------------------------------- - // NumFaces - //---------------------------------------------------------------- - U16 numFaces; - numRead = fread(&numFaces, sizeof(U16), 1, fp); - llendianswizzle(&numFaces, sizeof(U16), 1); - if (numRead != 1) - { - llerrs << "can't read NumFaces from " << fileName << llendl; - return FALSE; - } - allocateFaceData( numFaces ); - - - //---------------------------------------------------------------- - // Faces - //---------------------------------------------------------------- - U32 i; - U32 numTris = 0; - for (i = 0; i < numFaces; i++) - { - S16 face[3]; - numRead = fread(face, sizeof(U16), 3, fp); - llendianswizzle(face, sizeof(U16), 3); - if (numRead != 3) - { - llerrs << "can't read Face[" << i << "] from " << fileName << llendl; - return FALSE; - } - if (mReferenceData) - { - llassert(face[0] < mReferenceData->mNumVertices); - llassert(face[1] < mReferenceData->mNumVertices); - llassert(face[2] < mReferenceData->mNumVertices); - } - - if (isLOD()) - { - // store largest index in case of LODs - for (S32 j = 0; j < 3; j++) - { - if (face[j] > mNumVertices - 1) - { - mNumVertices = face[j] + 1; - } - } - } - mFaces[i][0] = face[0]; - mFaces[i][1] = face[1]; - mFaces[i][2] = face[2]; - -// S32 j; -// for(j = 0; j < 3; j++) -// { -// LLDynamicArray *face_list = mVertFaceMap.getIfThere(face[j]); -// if (!face_list) -// { -// face_list = new LLDynamicArray; -// mVertFaceMap.addData(face[j], face_list); -// } -// face_list->put(i); -// } - - numTris++; - } - - lldebugs << "verts: " << numVertices - << ", faces: " << numFaces - << ", tris: " << numTris - << llendl; - - //---------------------------------------------------------------- - // NumSkinJoints - //---------------------------------------------------------------- - if (!isLOD()) - { - U16 numSkinJoints = 0; - if ( mHasWeights ) - { - numRead = fread(&numSkinJoints, sizeof(U16), 1, fp); - llendianswizzle(&numSkinJoints, sizeof(U16), 1); - if (numRead != 1) - { - llerrs << "can't read NumSkinJoints from " << fileName << llendl; - return FALSE; - } - allocateJointNames( numSkinJoints ); - } - - //---------------------------------------------------------------- - // SkinJoints - //---------------------------------------------------------------- - for (i=0; i < numSkinJoints; i++) - { - char jointName[64+1]; - numRead = fread(jointName, sizeof(jointName)-1, 1, fp); - jointName[sizeof(jointName)-1] = '\0'; // ensure nul-termination - if (numRead != 1) - { - llerrs << "can't read Skin[" << i << "].Name from " << fileName << llendl; - return FALSE; - } - - std::string *jn = &mJointNames[i]; - *jn = jointName; - } - - //------------------------------------------------------------------------- - // look for morph section - //------------------------------------------------------------------------- - char morphName[64+1]; - morphName[sizeof(morphName)-1] = '\0'; // ensure nul-termination - while(fread(&morphName, sizeof(char), 64, fp) == 64) - { - if (!strcmp(morphName, "End Morphs")) - { - // we reached the end of the morphs - break; - } - LLPolyMorphData* morph_data = new LLPolyMorphData(std::string(morphName)); - - BOOL result = morph_data->loadBinary(fp, this); - - if (!result) - { - delete morph_data; - continue; - } - - mMorphData.insert(morph_data); - - if (!strcmp(morphName, "Breast_Female_Cleavage")) - { - mMorphData.insert(clone_morph_param_cleavage(morph_data, - .75f, - "Breast_Physics_LeftRight_Driven")); - } - - if (!strcmp(morphName, "Breast_Female_Cleavage")) - { - mMorphData.insert(clone_morph_param_duplicate(morph_data, - "Breast_Physics_InOut_Driven")); - } - if (!strcmp(morphName, "Breast_Gravity")) - { - mMorphData.insert(clone_morph_param_duplicate(morph_data, - "Breast_Physics_UpDown_Driven")); - } - - if (!strcmp(morphName, "Big_Belly_Torso")) - { - mMorphData.insert(clone_morph_param_direction(morph_data, - LLVector3(0,0,0.05f), - "Belly_Physics_Torso_UpDown_Driven")); - } - - if (!strcmp(morphName, "Big_Belly_Legs")) - { - mMorphData.insert(clone_morph_param_direction(morph_data, - LLVector3(0,0,0.05f), - "Belly_Physics_Legs_UpDown_Driven")); - } - - if (!strcmp(morphName, "skirt_belly")) - { - mMorphData.insert(clone_morph_param_direction(morph_data, - LLVector3(0,0,0.05f), - "Belly_Physics_Skirt_UpDown_Driven")); - } - - if (!strcmp(morphName, "Small_Butt")) - { - mMorphData.insert(clone_morph_param_direction(morph_data, - LLVector3(0,0,0.05f), - "Butt_Physics_UpDown_Driven")); - } - if (!strcmp(morphName, "Small_Butt")) - { - mMorphData.insert(clone_morph_param_direction(morph_data, - LLVector3(0,0.03f,0), - "Butt_Physics_LeftRight_Driven")); - } - } - - S32 numRemaps; - if (fread(&numRemaps, sizeof(S32), 1, fp) == 1) - { - llendianswizzle(&numRemaps, sizeof(S32), 1); - for (S32 i = 0; i < numRemaps; i++) - { - S32 remapSrc; - S32 remapDst; - if (fread(&remapSrc, sizeof(S32), 1, fp) != 1) - { - llerrs << "can't read source vertex in vertex remap data" << llendl; - break; - } - if (fread(&remapDst, sizeof(S32), 1, fp) != 1) - { - llerrs << "can't read destination vertex in vertex remap data" << llendl; - break; - } - llendianswizzle(&remapSrc, sizeof(S32), 1); - llendianswizzle(&remapDst, sizeof(S32), 1); - - mSharedVerts[remapSrc] = remapDst; - } - } - } - - status = TRUE; - } - else - { - llerrs << "invalid mesh file header: " << fileName << llendl; - status = FALSE; - } - - if (0 == mNumJointNames) - { - allocateJointNames(1); - } - - fclose( fp ); - - return status; -} - -//----------------------------------------------------------------------------- -// getSharedVert() -//----------------------------------------------------------------------------- -const S32 *LLPolyMeshSharedData::getSharedVert(S32 vert) -{ - if (mSharedVerts.count(vert) > 0) - { - return &mSharedVerts[vert]; - } - return NULL; -} - -//----------------------------------------------------------------------------- -// getUV() -//----------------------------------------------------------------------------- -const LLVector2 &LLPolyMeshSharedData::getUVs(U32 index) -{ - // TODO: convert all index variables to S32 - llassert((S32)index < mNumVertices); - - return mTexCoords[index]; -} - -//----------------------------------------------------------------------------- -// LLPolyMesh() -//----------------------------------------------------------------------------- -LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_mesh) -{ - LLMemType mt(LLMemType::MTYPE_AVATAR_MESH); - - llassert(shared_data); - - mSharedData = shared_data; - mReferenceMesh = reference_mesh; - mAvatarp = NULL; - mVertexData = NULL; - - mCurVertexCount = 0; - mFaceIndexCount = 0; - mFaceIndexOffset = 0; - mFaceVertexCount = 0; - mFaceVertexOffset = 0; - - if (shared_data->isLOD() && reference_mesh) - { - mCoords = reference_mesh->mCoords; - mNormals = reference_mesh->mNormals; - mScaledNormals = reference_mesh->mScaledNormals; - mBinormals = reference_mesh->mBinormals; - mScaledBinormals = reference_mesh->mScaledBinormals; - mTexCoords = reference_mesh->mTexCoords; - mClothingWeights = reference_mesh->mClothingWeights; - } - else - { - // Allocate memory without initializing every vector - // NOTE: This makes asusmptions about the size of LLVector[234] - S32 nverts = mSharedData->mNumVertices; - //make sure it's an even number of verts for alignment - nverts += nverts%2; - S32 nfloats = nverts * ( - 4 + //coords - 4 + //normals - 4 + //weights - 2 + //coords - 4 + //scaled normals - 4 + //binormals - 4); //scaled binormals - - //use 16 byte aligned vertex data to make LLPolyMesh SSE friendly - mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4); - S32 offset = 0; - mCoords = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; - mNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; - mClothingWeights = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; - mTexCoords = (LLVector2*)(mVertexData + offset); offset += 2*nverts; - mScaledNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; - mBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; - mScaledBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; - initializeForMorph(); - } -} - - -//----------------------------------------------------------------------------- -// ~LLPolyMesh() -//----------------------------------------------------------------------------- -LLPolyMesh::~LLPolyMesh() -{ - S32 i; - for (i = 0; i < mJointRenderData.count(); i++) - { - delete mJointRenderData[i]; - mJointRenderData[i] = NULL; - } - - ll_aligned_free_16(mVertexData); - -} - - -//----------------------------------------------------------------------------- -// LLPolyMesh::getMesh() -//----------------------------------------------------------------------------- -LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_mesh) -{ - //------------------------------------------------------------------------- - // search for an existing mesh by this name - //------------------------------------------------------------------------- - LLPolyMeshSharedData* meshSharedData = get_if_there(sGlobalSharedMeshList, name, (LLPolyMeshSharedData*)NULL); - if (meshSharedData) - { -// llinfos << "Polymesh " << name << " found in global mesh table." << llendl; - LLPolyMesh *poly_mesh = new LLPolyMesh(meshSharedData, reference_mesh); - return poly_mesh; - } - - //------------------------------------------------------------------------- - // if not found, create a new one, add it to the list - //------------------------------------------------------------------------- - std::string full_path; - full_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name); - - LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData(); - if (reference_mesh) - { - mesh_data->setupLOD(reference_mesh->getSharedData()); - } - if ( ! mesh_data->loadMesh( full_path ) ) - { - delete mesh_data; - return NULL; - } - - LLPolyMesh *poly_mesh = new LLPolyMesh(mesh_data, reference_mesh); - -// llinfos << "Polymesh " << name << " added to global mesh table." << llendl; - sGlobalSharedMeshList[name] = poly_mesh->mSharedData; - - return poly_mesh; -} - -//----------------------------------------------------------------------------- -// LLPolyMesh::freeAllMeshes() -//----------------------------------------------------------------------------- -void LLPolyMesh::freeAllMeshes() -{ - // delete each item in the global lists - for_each(sGlobalSharedMeshList.begin(), sGlobalSharedMeshList.end(), DeletePairedPointer()); - sGlobalSharedMeshList.clear(); -} - -LLPolyMeshSharedData *LLPolyMesh::getSharedData() const -{ - return mSharedData; -} - - -//-------------------------------------------------------------------- -// LLPolyMesh::dumpDiagInfo() -//-------------------------------------------------------------------- -void LLPolyMesh::dumpDiagInfo() -{ - // keep track of totals - U32 total_verts = 0; - U32 total_faces = 0; - U32 total_kb = 0; - - std::string buf; - - llinfos << "-----------------------------------------------------" << llendl; - llinfos << " Global PolyMesh Table (DEBUG only)" << llendl; - llinfos << " Verts Faces Mem(KB) Name" << llendl; - llinfos << "-----------------------------------------------------" << llendl; - - // print each loaded mesh, and it's memory usage - for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin(); - iter != sGlobalSharedMeshList.end(); ++iter) - { - const std::string& mesh_name = iter->first; - LLPolyMeshSharedData* mesh = iter->second; - - S32 num_verts = mesh->mNumVertices; - S32 num_faces = mesh->mNumFaces; - U32 num_kb = mesh->getNumKB(); - - buf = llformat("%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name.c_str()); - llinfos << buf << llendl; - - total_verts += num_verts; - total_faces += num_faces; - total_kb += num_kb; - } - - llinfos << "-----------------------------------------------------" << llendl; - buf = llformat("%8d %8d %8d TOTAL", total_verts, total_faces, total_kb ); - llinfos << buf << llendl; - llinfos << "-----------------------------------------------------" << llendl; -} - -//----------------------------------------------------------------------------- -// getWritableCoords() -//----------------------------------------------------------------------------- -LLVector4a *LLPolyMesh::getWritableCoords() -{ - return mCoords; -} - -//----------------------------------------------------------------------------- -// getWritableNormals() -//----------------------------------------------------------------------------- -LLVector4a *LLPolyMesh::getWritableNormals() -{ - return mNormals; -} - -//----------------------------------------------------------------------------- -// getWritableBinormals() -//----------------------------------------------------------------------------- -LLVector4a *LLPolyMesh::getWritableBinormals() -{ - return mBinormals; -} - - -//----------------------------------------------------------------------------- -// getWritableClothingWeights() -//----------------------------------------------------------------------------- -LLVector4a *LLPolyMesh::getWritableClothingWeights() -{ - return mClothingWeights; -} - -//----------------------------------------------------------------------------- -// getWritableTexCoords() -//----------------------------------------------------------------------------- -LLVector2 *LLPolyMesh::getWritableTexCoords() -{ - return mTexCoords; -} - -//----------------------------------------------------------------------------- -// getScaledNormals() -//----------------------------------------------------------------------------- -LLVector4a *LLPolyMesh::getScaledNormals() -{ - return mScaledNormals; -} - -//----------------------------------------------------------------------------- -// getScaledBinormals() -//----------------------------------------------------------------------------- -LLVector4a *LLPolyMesh::getScaledBinormals() -{ - return mScaledBinormals; -} - - -//----------------------------------------------------------------------------- -// initializeForMorph() -//----------------------------------------------------------------------------- -void LLPolyMesh::initializeForMorph() -{ - LLVector4a::memcpyNonAliased16((F32*) mCoords, (F32*) mSharedData->mBaseCoords, sizeof(LLVector4a) * mSharedData->mNumVertices); - LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); - LLVector4a::memcpyNonAliased16((F32*) mScaledNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); - LLVector4a::memcpyNonAliased16((F32*) mBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); - LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); - LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2)); - - for (U32 i = 0; i < mSharedData->mNumVertices; ++i) - { - mClothingWeights[i].clear(); - } -} - -//----------------------------------------------------------------------------- -// getMorphData() -//----------------------------------------------------------------------------- -LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name) -{ - if (!mSharedData) - return NULL; - for (LLPolyMeshSharedData::morphdata_list_t::iterator iter = mSharedData->mMorphData.begin(); - iter != mSharedData->mMorphData.end(); ++iter) - { - LLPolyMorphData *morph_data = *iter; - if (morph_data->getName() == morph_name) - { - return morph_data; - } - } - return NULL; -} - -//----------------------------------------------------------------------------- -// removeMorphData() -//----------------------------------------------------------------------------- -// // erasing but not deleting seems bad, but fortunately we don't actually use this... -// void LLPolyMesh::removeMorphData(LLPolyMorphData *morph_target) -// { -// if (!mSharedData) -// return; -// mSharedData->mMorphData.erase(morph_target); -// } - -//----------------------------------------------------------------------------- -// deleteAllMorphData() -//----------------------------------------------------------------------------- -// void LLPolyMesh::deleteAllMorphData() -// { -// if (!mSharedData) -// return; - -// for_each(mSharedData->mMorphData.begin(), mSharedData->mMorphData.end(), DeletePointer()); -// mSharedData->mMorphData.clear(); -// } - -//----------------------------------------------------------------------------- -// getWritableWeights() -//----------------------------------------------------------------------------- -F32* LLPolyMesh::getWritableWeights() const -{ - return mSharedData->mWeights; -} - -//----------------------------------------------------------------------------- -// LLPolySkeletalDistortionInfo() -//----------------------------------------------------------------------------- -LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo() -{ -} - -BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) -{ - llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) ); - - if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; - - LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton"); - - if (NULL == skeletalParam) - { - llwarns << "Failed to getChildByName(\"param_skeleton\")" - << llendl; - return FALSE; - } - - for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() ) - { - if (bone->hasName("bone")) - { - std::string name; - LLVector3 scale; - LLVector3 pos; - BOOL haspos = FALSE; - - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!bone->getFastAttributeString(name_string, name)) - { - llwarns << "No bone name specified for skeletal param." << llendl; - continue; - } - - static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); - if (!bone->getFastAttributeVector3(scale_string, scale)) - { - llwarns << "No scale specified for bone " << name << "." << llendl; - continue; - } - - // optional offset deformation (translation) - static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset"); - if (bone->getFastAttributeVector3(offset_string, pos)) - { - haspos = TRUE; - } - mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos)); - } - else - { - llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl; - continue; - } - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLPolySkeletalDistortion() -//----------------------------------------------------------------------------- -LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp) -{ - mAvatar = avatarp; - mDefaultVec.splat(0.001f); -} - -//----------------------------------------------------------------------------- -// ~LLPolySkeletalDistortion() -//----------------------------------------------------------------------------- -LLPolySkeletalDistortion::~LLPolySkeletalDistortion() -{ -} - -BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) -{ - llassert(mInfo == NULL); - if (info->mID < 0) - return FALSE; - mInfo = info; - mID = info->mID; - setWeight(getDefaultWeight(), FALSE ); - - LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter; - for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++) - { - LLPolySkeletalBoneInfo *bone_info = &(*iter); - LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName); - if (!joint) - { - llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl; - continue; - } - - if (mJointScales.find(joint) != mJointScales.end()) - { - llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl; - } - - // store it - mJointScales[joint] = bone_info->mScaleDeformation; - - // apply to children that need to inherit it - for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin(); - iter != joint->mChildren.end(); ++iter) - { - LLViewerJoint* child_joint = (LLViewerJoint*)(*iter); - if (child_joint->inheritScale()) - { - LLVector3 childDeformation = LLVector3(child_joint->getScale()); - childDeformation.scaleVec(bone_info->mScaleDeformation); - mJointScales[child_joint] = childDeformation; - } - } - - if (bone_info->mHasPositionDeformation) - { - if (mJointOffsets.find(joint) != mJointOffsets.end()) - { - llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl; - } - mJointOffsets[joint] = bone_info->mPositionDeformation; - } - } - return TRUE; -} - -/*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const -{ - LLPolySkeletalDistortion *new_param = new LLPolySkeletalDistortion(mAvatar); - *new_param = *this; - return new_param; -} - -//----------------------------------------------------------------------------- -// apply() -//----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion"); - -void LLPolySkeletalDistortion::apply( ESex avatar_sex ) -{ - LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY); - - F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight(); - - LLJoint* joint; - joint_vec_map_t::iterator iter; - - for (iter = mJointScales.begin(); - iter != mJointScales.end(); - iter++) - { - joint = iter->first; - LLVector3 newScale = joint->getScale(); - LLVector3 scaleDelta = iter->second; - newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta); - joint->setScale(newScale); - } - - for (iter = mJointOffsets.begin(); - iter != mJointOffsets.end(); - iter++) - { - joint = iter->first; - LLVector3 newPosition = joint->getPosition(); - LLVector3 positionDelta = iter->second; - newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta); - joint->setPosition(newPosition); - } - - if (mLastWeight != mCurWeight && !mIsAnimating) - { - mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1); - } - mLastWeight = mCurWeight; -} - - -LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data, - const std::string &name) -{ - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); - cloned_morph_data->mName = name; - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v] = src_data->mCoords[v]; - cloned_morph_data->mNormals[v] = src_data->mNormals[v]; - cloned_morph_data->mBinormals[v] = src_data->mBinormals[v]; - } - return cloned_morph_data; -} - -LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data, - const LLVector3 &direction, - const std::string &name) -{ - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); - cloned_morph_data->mName = name; - LLVector4a dir; - dir.load3(direction.mV); - - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v] = dir; - cloned_morph_data->mNormals[v].clear(); - cloned_morph_data->mBinormals[v].clear(); - } - return cloned_morph_data; -} - -LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data, - F32 scale, - const std::string &name) -{ - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); - cloned_morph_data->mName = name; - - LLVector4a sc; - sc.splat(scale); - - LLVector4a nsc; - nsc.set(scale, -scale, scale, scale); - - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - if (cloned_morph_data->mCoords[v][1] < 0) - { - cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc); - cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc); - cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc); - } - else - { - cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc); - cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc); - cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc); - } - } - return cloned_morph_data; -} - -// End diff --git a/indra/newview/llpolymesh.h b/indra/newview/llpolymesh.h deleted file mode 100644 index ffb11a3f7e..0000000000 --- a/indra/newview/llpolymesh.h +++ /dev/null @@ -1,438 +0,0 @@ -/** - * @file llpolymesh.h - * @brief Implementation of LLPolyMesh class - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPOLYMESH_H -#define LL_LLPOLYMESH_H - -#include -#include -#include "llstl.h" - -#include "v3math.h" -#include "v2math.h" -#include "llquaternion.h" -#include "llpolymorph.h" -#include "lljoint.h" -//#include "lldarray.h" - -class LLSkinJoint; -class LLVOAvatar; -class LLWearable; - -//#define USE_STRIPS // Use tri-strips for rendering. - -//----------------------------------------------------------------------------- -// LLPolyFace -// A set of 4 vertex indices. -// An LLPolyFace can represent either a triangle or quad. -// If the last index is -1, it's a triangle. -//----------------------------------------------------------------------------- -typedef S32 LLPolyFace[3]; - -//struct PrimitiveGroup; - -//----------------------------------------------------------------------------- -// LLPolyMesh -// A polyhedra consisting of any number of triangles and quads. -// All instances contain a set of faces, and optionally may include -// faces grouped into named face sets. -//----------------------------------------------------------------------------- -class LLPolyMorphTarget; - -class LLPolyMeshSharedData -{ - friend class LLPolyMesh; -private: - // transform data - LLVector3 mPosition; - LLQuaternion mRotation; - LLVector3 mScale; - - // vertex data - S32 mNumVertices; - LLVector4a *mBaseCoords; - LLVector4a *mBaseNormals; - LLVector4a *mBaseBinormals; - LLVector2 *mTexCoords; - LLVector2 *mDetailTexCoords; - F32 *mWeights; - - BOOL mHasWeights; - BOOL mHasDetailTexCoords; - - // face data - S32 mNumFaces; - LLPolyFace *mFaces; - - // face set data - U32 mNumJointNames; - std::string* mJointNames; - - // morph targets - typedef std::set morphdata_list_t; - morphdata_list_t mMorphData; - - std::map mSharedVerts; - - LLPolyMeshSharedData* mReferenceData; - S32 mLastIndexOffset; - -public: - // Temporarily... - // Triangle indices - U32 mNumTriangleIndices; - U32 *mTriangleIndices; - -public: - LLPolyMeshSharedData(); - ~LLPolyMeshSharedData(); - -private: - void setupLOD(LLPolyMeshSharedData* reference_data); - - // Frees all mesh memory resources - void freeMeshData(); - - void setPosition( const LLVector3 &pos ) { mPosition = pos; } - void setRotation( const LLQuaternion &rot ) { mRotation = rot; } - void setScale( const LLVector3 &scale ) { mScale = scale; } - - BOOL allocateVertexData( U32 numVertices ); - - BOOL allocateFaceData( U32 numFaces ); - - BOOL allocateJointNames( U32 numJointNames ); - - // Retrieve the number of KB of memory used by this instance - U32 getNumKB(); - - // Load mesh data from file - BOOL loadMesh( const std::string& fileName ); - -public: - void genIndices(S32 offset); - - const LLVector2 &getUVs(U32 index); - - const S32 *getSharedVert(S32 vert); - - BOOL isLOD() { return (mReferenceData != NULL); } -}; - - -class LLJointRenderData -{ -public: - LLJointRenderData(const LLMatrix4* world_matrix, LLSkinJoint* skin_joint) : mWorldMatrix(world_matrix), mSkinJoint(skin_joint) {} - ~LLJointRenderData(){} - - const LLMatrix4* mWorldMatrix; - LLSkinJoint* mSkinJoint; -}; - - -class LLPolyMesh -{ -public: - - // Constructor - LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_mesh); - - // Destructor - ~LLPolyMesh(); - - // Requests a mesh by name. - // If the mesh already exists in the global mesh table, it is returned, - // otherwise it is loaded from file, added to the table, and returned. - static LLPolyMesh *getMesh( const std::string &name, LLPolyMesh* reference_mesh = NULL); - - // Frees all loaded meshes. - // This should only be called once you know there are no outstanding - // references to these objects. Generally, upon exit of the application. - static void freeAllMeshes(); - - //-------------------------------------------------------------------- - // Transform Data Access - //-------------------------------------------------------------------- - // Get position - const LLVector3 &getPosition() { - llassert (mSharedData); - return mSharedData->mPosition; - } - - // Get rotation - const LLQuaternion &getRotation() { - llassert (mSharedData); - return mSharedData->mRotation; - } - - // Get scale - const LLVector3 &getScale() { - llassert (mSharedData); - return mSharedData->mScale; - } - - //-------------------------------------------------------------------- - // Vertex Data Access - //-------------------------------------------------------------------- - // Get number of vertices - U32 getNumVertices() { - llassert (mSharedData); - return mSharedData->mNumVertices; - } - - // Returns whether or not the mesh has detail texture coords - BOOL hasDetailTexCoords() { - llassert (mSharedData); - return mSharedData->mHasDetailTexCoords; - } - - // Returns whether or not the mesh has vertex weights - BOOL hasWeights() const{ - llassert (mSharedData); - return mSharedData->mHasWeights; - } - - // Get coords - const LLVector4a *getCoords() const{ - return mCoords; - } - - // non const version - LLVector4a *getWritableCoords(); - - // Get normals - const LLVector4a *getNormals() const{ - return mNormals; - } - - // Get normals - const LLVector4a *getBinormals() const{ - return mBinormals; - } - - // Get base mesh normals - const LLVector4a *getBaseNormals() const{ - llassert(mSharedData); - return mSharedData->mBaseNormals; - } - - // Get base mesh normals - const LLVector4a *getBaseBinormals() const{ - llassert(mSharedData); - return mSharedData->mBaseBinormals; - } - - // intermediate morphed normals and output normals - LLVector4a *getWritableNormals(); - LLVector4a *getScaledNormals(); - - LLVector4a *getWritableBinormals(); - LLVector4a *getScaledBinormals(); - - // Get texCoords - const LLVector2 *getTexCoords() const { - return mTexCoords; - } - - // non const version - LLVector2 *getWritableTexCoords(); - - // Get detailTexCoords - const LLVector2 *getDetailTexCoords() const { - llassert (mSharedData); - return mSharedData->mDetailTexCoords; - } - - // Get weights - const F32 *getWeights() const { - llassert (mSharedData); - return mSharedData->mWeights; - } - - F32 *getWritableWeights() const; - - LLVector4a *getWritableClothingWeights(); - - const LLVector4a *getClothingWeights() - { - return mClothingWeights; - } - - //-------------------------------------------------------------------- - // Face Data Access - //-------------------------------------------------------------------- - // Get number of faces - S32 getNumFaces() { - llassert (mSharedData); - return mSharedData->mNumFaces; - } - - // Get faces - LLPolyFace *getFaces() { - llassert (mSharedData); - return mSharedData->mFaces; - } - - U32 getNumJointNames() { - llassert (mSharedData); - return mSharedData->mNumJointNames; - } - - std::string *getJointNames() { - llassert (mSharedData); - return mSharedData->mJointNames; - } - - LLPolyMorphData* getMorphData(const std::string& morph_name); -// void removeMorphData(LLPolyMorphData *morph_target); -// void deleteAllMorphData(); - - LLPolyMeshSharedData *getSharedData() const; - LLPolyMesh *getReferenceMesh() { return mReferenceMesh ? mReferenceMesh : this; } - - // Get indices - U32* getIndices() { return mSharedData ? mSharedData->mTriangleIndices : NULL; } - - BOOL isLOD() { return mSharedData && mSharedData->isLOD(); } - - void setAvatar(LLVOAvatar* avatarp) { mAvatarp = avatarp; } - LLVOAvatar* getAvatar() { return mAvatarp; } - - LLDynamicArray mJointRenderData; - - U32 mFaceVertexOffset; - U32 mFaceVertexCount; - U32 mFaceIndexOffset; - U32 mFaceIndexCount; - U32 mCurVertexCount; -private: - void initializeForMorph(); - - // Dumps diagnostic information about the global mesh table - static void dumpDiagInfo(); - -protected: - // mesh data shared across all instances of a given mesh - LLPolyMeshSharedData *mSharedData; - // Single array of floats for allocation / deletion - F32 *mVertexData; - // deformed vertices (resulting from application of morph targets) - LLVector4a *mCoords; - // deformed normals (resulting from application of morph targets) - LLVector4a *mScaledNormals; - // output normals (after normalization) - LLVector4a *mNormals; - // deformed binormals (resulting from application of morph targets) - LLVector4a *mScaledBinormals; - // output binormals (after normalization) - LLVector4a *mBinormals; - // weight values that mark verts as clothing/skin - LLVector4a *mClothingWeights; - // output texture coordinates - LLVector2 *mTexCoords; - - LLPolyMesh *mReferenceMesh; - - // global mesh list - typedef std::map LLPolyMeshSharedDataTable; - static LLPolyMeshSharedDataTable sGlobalSharedMeshList; - - // Backlink only; don't make this an LLPointer. - LLVOAvatar* mAvatarp; -}; - -//----------------------------------------------------------------------------- -// LLPolySkeletalDeformationInfo -// Shared information for LLPolySkeletalDeformations -//----------------------------------------------------------------------------- -struct LLPolySkeletalBoneInfo -{ - LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos) - : mBoneName(name), - mScaleDeformation(scale), - mPositionDeformation(pos), - mHasPositionDeformation(haspos) {} - std::string mBoneName; - LLVector3 mScaleDeformation; - LLVector3 mPositionDeformation; - BOOL mHasPositionDeformation; -}; - -class LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo -{ - friend class LLPolySkeletalDistortion; -public: - LLPolySkeletalDistortionInfo(); - /*virtual*/ ~LLPolySkeletalDistortionInfo() {}; - - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); - -protected: - typedef std::vector bone_info_list_t; - bone_info_list_t mBoneInfoList; -}; - -//----------------------------------------------------------------------------- -// LLPolySkeletalDeformation -// A set of joint scale data for deforming the avatar mesh -//----------------------------------------------------------------------------- -class LLPolySkeletalDistortion : public LLViewerVisualParam -{ -public: - LLPolySkeletalDistortion(LLVOAvatar *avatarp); - ~LLPolySkeletalDistortion(); - - // Special: These functions are overridden by child classes - LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLPolySkeletalDistortionInfo *info); - - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const; - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - /*virtual*/ void apply( ESex sex ); - - // LLViewerVisualParam Virtual functions - /*virtual*/ F32 getTotalDistortion() { return 0.1f; } - /*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; } - /*virtual*/ F32 getMaxDistortion() { return 0.1f; } - /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);} - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;}; - -protected: - typedef std::map joint_vec_map_t; - joint_vec_map_t mJointScales; - joint_vec_map_t mJointOffsets; - LLVector4a mDefaultVec; - // Backlink only; don't make this an LLPointer. - LLVOAvatar *mAvatar; -}; - -#endif // LL_LLPOLYMESH_H - diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h index 46e23b7792..28d7755d4d 100644 --- a/indra/newview/llpolymorph.h +++ b/indra/newview/llpolymorph.h @@ -35,7 +35,7 @@ class LLPolyMeshSharedData; class LLVOAvatar; class LLVector2; -class LLViewerJointCollisionVolume; +class LLAvatarJointCollisionVolume; class LLWearable; //----------------------------------------------------------------------------- @@ -104,10 +104,10 @@ struct LLPolyVolumeMorphInfo struct LLPolyVolumeMorph { - LLPolyVolumeMorph(LLViewerJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos) + LLPolyVolumeMorph(LLAvatarJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos) : mVolume(volume), mScale(scale), mPos(pos) {}; - LLViewerJointCollisionVolume* mVolume; + LLAvatarJointCollisionVolume* mVolume; LLVector3 mScale; LLVector3 mPos; }; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index c804898cc3..fadaaf4541 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -4028,7 +4028,7 @@ void renderAgentTarget(LLVOAvatar* avatar) { renderCrossHairs(avatar->getPositionAgent(), 0.2f, LLColor4(1, 0, 0, 0.8f)); renderCrossHairs(avatar->mDrawable->getPositionAgent(), 0.2f, LLColor4(1, 0, 0, 0.8f)); - renderCrossHairs(avatar->mRoot.getWorldPosition(), 0.2f, LLColor4(1, 1, 1, 0.8f)); + renderCrossHairs(avatar->mRoot->getWorldPosition(), 0.2f, LLColor4(1, 1, 1, 0.8f)); renderCrossHairs(avatar->mPelvisp->getWorldPosition(), 0.2f, LLColor4(0, 0, 1, 0.8f)); } } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6782e3ef8a..ab06b1f5aa 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1247,6 +1247,9 @@ bool idle_startup() LLPostProcess::initClass(); display_startup(); + LLAvatarAppearance::initClass(); + display_startup(); + LLViewerObject::initVOClasses(); display_startup(); diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index a907f102f8..bb45cf89fc 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -53,7 +53,7 @@ BOOL LLViewerJoint::sDisableLOD = FALSE; // Class Constructor //----------------------------------------------------------------------------- LLViewerJoint::LLViewerJoint() - : LLJoint() + : LLAvatarJoint() { init(); } @@ -64,7 +64,7 @@ LLViewerJoint::LLViewerJoint() // Class Constructor //----------------------------------------------------------------------------- LLViewerJoint::LLViewerJoint(const std::string &name, LLJoint *parent) - : LLJoint(name, parent) + : LLAvatarJoint(name, parent) { init(); } @@ -90,31 +90,6 @@ LLViewerJoint::~LLViewerJoint() } -//-------------------------------------------------------------------- -// setValid() -//-------------------------------------------------------------------- -void LLViewerJoint::setValid( BOOL valid, BOOL recursive ) -{ - //---------------------------------------------------------------- - // set visibility for this joint - //---------------------------------------------------------------- - mValid = valid; - - //---------------------------------------------------------------- - // set visibility for children - //---------------------------------------------------------------- - if (recursive) - { - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->setValid(valid, TRUE); - } - } - -} - //-------------------------------------------------------------------- // renderSkeleton() // DEBUG (UNUSED) @@ -522,98 +497,6 @@ void LLViewerJoint::setMeshesToChildren() addChild((LLViewerJointMesh *) *iter); } } -//----------------------------------------------------------------------------- -// LLViewerJointCollisionVolume() -//----------------------------------------------------------------------------- - -LLViewerJointCollisionVolume::LLViewerJointCollisionVolume() -{ - mUpdateXform = FALSE; -} -LLViewerJointCollisionVolume::LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent) : LLViewerJoint(name, parent) -{ - -} - -void LLViewerJointCollisionVolume::renderCollision() -{ - updateWorldMatrix(); - - gGL.pushMatrix(); - gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] ); - - gGL.diffuseColor3f( 0.f, 0.f, 1.f ); - - gGL.begin(LLRender::LINES); - - LLVector3 v[] = - { - LLVector3(1,0,0), - LLVector3(-1,0,0), - LLVector3(0,1,0), - LLVector3(0,-1,0), - - LLVector3(0,0,-1), - LLVector3(0,0,1), - }; - - //sides - gGL.vertex3fv(v[0].mV); - gGL.vertex3fv(v[2].mV); - - gGL.vertex3fv(v[0].mV); - gGL.vertex3fv(v[3].mV); - - gGL.vertex3fv(v[1].mV); - gGL.vertex3fv(v[2].mV); - - gGL.vertex3fv(v[1].mV); - gGL.vertex3fv(v[3].mV); - - - //top - gGL.vertex3fv(v[0].mV); - gGL.vertex3fv(v[4].mV); - - gGL.vertex3fv(v[1].mV); - gGL.vertex3fv(v[4].mV); - - gGL.vertex3fv(v[2].mV); - gGL.vertex3fv(v[4].mV); - - gGL.vertex3fv(v[3].mV); - gGL.vertex3fv(v[4].mV); - - - //bottom - gGL.vertex3fv(v[0].mV); - gGL.vertex3fv(v[5].mV); - - gGL.vertex3fv(v[1].mV); - gGL.vertex3fv(v[5].mV); - - gGL.vertex3fv(v[2].mV); - gGL.vertex3fv(v[5].mV); - - gGL.vertex3fv(v[3].mV); - gGL.vertex3fv(v[5].mV); - - gGL.end(); - - gGL.popMatrix(); -} - -LLVector3 LLViewerJointCollisionVolume::getVolumePos(LLVector3 &offset) -{ - mUpdateXform = TRUE; - - LLVector3 result = offset; - result.scaleVec(getScale()); - result.rotVec(getWorldRotation()); - result += getWorldPosition(); - - return result; -} // End diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h index 531c0f765c..37c80dafeb 100644 --- a/indra/newview/llviewerjoint.h +++ b/indra/newview/llviewerjoint.h @@ -30,7 +30,7 @@ //----------------------------------------------------------------------------- // Header Files //----------------------------------------------------------------------------- -#include "lljoint.h" +#include "llavatarjoint.h" #include "lljointpickname.h" class LLFace; @@ -40,7 +40,7 @@ class LLViewerJointMesh; // class LLViewerJoint //----------------------------------------------------------------------------- class LLViewerJoint : - public LLJoint + public LLAvatarJoint { public: LLViewerJoint(); @@ -50,9 +50,6 @@ public: // Gets the validity of this joint BOOL getValid() { return mValid; } - // Sets the validity of this joint - virtual void setValid( BOOL valid, BOOL recursive=FALSE ); - // Primarily for debugging and character setup // Derived classes may add text/graphic output. // Draw skeleton graphic for debugging and character setup @@ -134,19 +131,6 @@ protected: S32 mMeshID; }; -class LLViewerJointCollisionVolume : public LLViewerJoint -{ -public: - LLViewerJointCollisionVolume(); - LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent = NULL); - virtual ~LLViewerJointCollisionVolume() {}; - - virtual BOOL inheritScale() { return TRUE; } - - void renderCollision(); - LLVector3 getVolumePos(LLVector3 &offset); -}; - #endif // LL_LLVIEWERJOINT_H diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 3532fac1bc..8d479ab0bf 100755 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -67,101 +67,20 @@ static const U32 sRenderMask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// LLViewerJointMesh::LLSkinJoint -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// LLSkinJoint -//----------------------------------------------------------------------------- -LLSkinJoint::LLSkinJoint() -{ - mJoint = NULL; -} - -//----------------------------------------------------------------------------- -// ~LLSkinJoint -//----------------------------------------------------------------------------- -LLSkinJoint::~LLSkinJoint() -{ - mJoint = NULL; -} - - -//----------------------------------------------------------------------------- -// LLSkinJoint::setupSkinJoint() -//----------------------------------------------------------------------------- -BOOL LLSkinJoint::setupSkinJoint( LLViewerJoint *joint) -{ - // find the named joint - mJoint = joint; - if ( !mJoint ) - { - llinfos << "Can't find joint" << llendl; - } - - // compute the inverse root skin matrix - mRootToJointSkinOffset.clearVec(); - - LLVector3 rootSkinOffset; - while (joint) - { - rootSkinOffset += joint->getSkinOffset(); - joint = (LLViewerJoint*)joint->getParent(); - } - - mRootToJointSkinOffset = -rootSkinOffset; - mRootToParentJointSkinOffset = mRootToJointSkinOffset; - mRootToParentJointSkinOffset += mJoint->getSkinOffset(); - - return TRUE; -} - - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // LLViewerJointMesh //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BOOL LLViewerJointMesh::sPipelineRender = FALSE; -EAvatarRenderPass LLViewerJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE; -U32 LLViewerJointMesh::sClothingMaskImageName = 0; -LLColor4 LLViewerJointMesh::sClothingInnerColor; //----------------------------------------------------------------------------- // LLViewerJointMesh() //----------------------------------------------------------------------------- LLViewerJointMesh::LLViewerJointMesh() : - mTexture( NULL ), - mLayerSet( NULL ), - mTestImageName( 0 ), - mFaceIndexCount(0), - mIsTransparent(FALSE) + LLAvatarJointMesh() { - - mColor[0] = 1.0f; - mColor[1] = 1.0f; - mColor[2] = 1.0f; - mColor[3] = 1.0f; - mShiny = 0.0f; - mCullBackFaces = TRUE; - - mMesh = NULL; - - mNumSkinJoints = 0; - mSkinJoints = NULL; - - mFace = NULL; - - mMeshID = 0; - mUpdateXform = FALSE; - - mValid = FALSE; } @@ -171,199 +90,6 @@ LLViewerJointMesh::LLViewerJointMesh() //----------------------------------------------------------------------------- LLViewerJointMesh::~LLViewerJointMesh() { - mMesh = NULL; - mTexture = NULL; - freeSkinData(); -} - - -//----------------------------------------------------------------------------- -// LLViewerJointMesh::allocateSkinData() -//----------------------------------------------------------------------------- -BOOL LLViewerJointMesh::allocateSkinData( U32 numSkinJoints ) -{ - mSkinJoints = new LLSkinJoint[ numSkinJoints ]; - mNumSkinJoints = numSkinJoints; - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLViewerJointMesh::freeSkinData() -//----------------------------------------------------------------------------- -void LLViewerJointMesh::freeSkinData() -{ - mNumSkinJoints = 0; - delete [] mSkinJoints; - mSkinJoints = NULL; -} - -//-------------------------------------------------------------------- -// LLViewerJointMesh::getColor() -//-------------------------------------------------------------------- -void LLViewerJointMesh::getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha ) -{ - *red = mColor[0]; - *green = mColor[1]; - *blue = mColor[2]; - *alpha = mColor[3]; -} - -//-------------------------------------------------------------------- -// LLViewerJointMesh::setColor() -//-------------------------------------------------------------------- -void LLViewerJointMesh::setColor( F32 red, F32 green, F32 blue, F32 alpha ) -{ - mColor[0] = red; - mColor[1] = green; - mColor[2] = blue; - mColor[3] = alpha; -} - - -//-------------------------------------------------------------------- -// LLViewerJointMesh::getTexture() -//-------------------------------------------------------------------- -//LLViewerTexture *LLViewerJointMesh::getTexture() -//{ -// return mTexture; -//} - -//-------------------------------------------------------------------- -// LLViewerJointMesh::setTexture() -//-------------------------------------------------------------------- -void LLViewerJointMesh::setTexture( LLViewerTexture *texture ) -{ - mTexture = texture; - - // texture and dynamic_texture are mutually exclusive - if( texture ) - { - mLayerSet = NULL; - //texture->bindTexture(0); - //texture->setClamp(TRUE, TRUE); - } -} - -//-------------------------------------------------------------------- -// LLViewerJointMesh::setLayerSet() -// Sets the shape texture (takes precedence over normal texture) -//-------------------------------------------------------------------- -void LLViewerJointMesh::setLayerSet( LLViewerTexLayerSet* layer_set ) -{ - mLayerSet = layer_set; - - // texture and dynamic_texture are mutually exclusive - if( layer_set ) - { - mTexture = NULL; - } -} - - - -//-------------------------------------------------------------------- -// LLViewerJointMesh::getMesh() -//-------------------------------------------------------------------- -LLPolyMesh *LLViewerJointMesh::getMesh() -{ - return mMesh; -} - -//----------------------------------------------------------------------------- -// LLViewerJointMesh::setMesh() -//----------------------------------------------------------------------------- -void LLViewerJointMesh::setMesh( LLPolyMesh *mesh ) -{ - // set the mesh pointer - mMesh = mesh; - - // release any existing skin joints - freeSkinData(); - - if ( mMesh == NULL ) - { - return; - } - - // acquire the transform from the mesh object - setPosition( mMesh->getPosition() ); - setRotation( mMesh->getRotation() ); - setScale( mMesh->getScale() ); - - // create skin joints if necessary - if ( mMesh->hasWeights() && !mMesh->isLOD()) - { - U32 numJointNames = mMesh->getNumJointNames(); - - allocateSkinData( numJointNames ); - std::string *jointNames = mMesh->getJointNames(); - - U32 jn; - for (jn = 0; jn < numJointNames; jn++) - { - //llinfos << "Setting up joint " << jointNames[jn] << llendl; - LLViewerJoint* joint = (LLViewerJoint*)(getRoot()->findJoint(jointNames[jn]) ); - mSkinJoints[jn].setupSkinJoint( joint ); - } - } - - // setup joint array - if (!mMesh->isLOD()) - { - setupJoint((LLViewerJoint*)getRoot()); - } - -// llinfos << "joint render entries: " << mMesh->mJointRenderData.count() << llendl; -} - -//----------------------------------------------------------------------------- -// setupJoint() -//----------------------------------------------------------------------------- -void LLViewerJointMesh::setupJoint(LLViewerJoint* current_joint) -{ -// llinfos << "Mesh: " << getName() << llendl; - -// S32 joint_count = 0; - U32 sj; - for (sj=0; sjmJointRenderData.count() && mMesh->mJointRenderData[mMesh->mJointRenderData.count() - 1]->mWorldMatrix == ¤t_joint->getParent()->getWorldMatrix()) - { - // ...then just add ourselves - LLViewerJoint* jointp = js.mJoint; - mMesh->mJointRenderData.put(new LLJointRenderData(&jointp->getWorldMatrix(), &js)); -// llinfos << "joint " << joint_count << js.mJoint->getName() << llendl; -// joint_count++; - } - // otherwise add our parent and ourselves - else - { - mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getParent()->getWorldMatrix(), NULL)); -// llinfos << "joint " << joint_count << current_joint->getParent()->getName() << llendl; -// joint_count++; - mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getWorldMatrix(), &js)); -// llinfos << "joint " << joint_count << current_joint->getName() << llendl; -// joint_count++; - } - } - - // depth-first traversal - for (LLJoint::child_list_t::iterator iter = current_joint->mChildren.begin(); - iter != current_joint->mChildren.end(); ++iter) - { - LLViewerJoint* child_joint = (LLViewerJoint*)(*iter); - setupJoint(child_joint); - } } const S32 NUM_AXES = 3; @@ -544,6 +270,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) llassert( !(mTexture.notNull() && mLayerSet) ); // mutually exclusive LLTexUnit::eTextureAddressMode old_mode = LLTexUnit::TAM_WRAP; + LLViewerTexLayerSet *layerset = dynamic_cast(mLayerSet); if (mTestImageName) { gGL.getTexUnit(diffuse_channel)->bindManual(LLTexUnit::TT_TEXTURE, mTestImageName); @@ -558,11 +285,11 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); } } - else if( !is_dummy && mLayerSet ) + else if( !is_dummy && layerset ) { - if( mLayerSet->hasComposite() ) + if( layerset->hasComposite() ) { - gGL.getTexUnit(diffuse_channel)->bind(mLayerSet->getViewerComposite()); + gGL.getTexUnit(diffuse_channel)->bind(layerset->getViewerComposite()); } else { diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index ff6bed4f0f..039175830f 100755 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -29,6 +29,7 @@ #include "llviewerjoint.h" #include "llviewertexture.h" +#include "llavatarjointmesh.h" #include "llpolymesh.h" #include "v4color.h" @@ -37,56 +38,12 @@ class LLFace; class LLCharacter; class LLViewerTexLayerSet; -typedef enum e_avatar_render_pass -{ - AVATAR_RENDER_PASS_SINGLE, - AVATAR_RENDER_PASS_CLOTHING_INNER, - AVATAR_RENDER_PASS_CLOTHING_OUTER -} EAvatarRenderPass; - -class LLSkinJoint -{ -public: - LLSkinJoint(); - ~LLSkinJoint(); - BOOL setupSkinJoint( LLViewerJoint *joint); - - LLViewerJoint *mJoint; - LLVector3 mRootToJointSkinOffset; - LLVector3 mRootToParentJointSkinOffset; -}; - //----------------------------------------------------------------------------- // class LLViewerJointMesh //----------------------------------------------------------------------------- -class LLViewerJointMesh : public LLViewerJoint +class LLViewerJointMesh : public LLAvatarJointMesh { friend class LLVOAvatar; -protected: - LLColor4 mColor; // color value -// LLColor4 mSpecular; // specular color (always white for now) - F32 mShiny; // shiny value - LLPointer mTexture; // ptr to a global texture - LLViewerTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar - U32 mTestImageName; // handle to a temporary texture for previewing uploads - LLPolyMesh* mMesh; // ptr to a global polymesh - BOOL mCullBackFaces; // true by default - LLFace* mFace; // ptr to a face w/ AGP copy of mesh - - U32 mFaceIndexCount; - BOOL mIsTransparent; - - U32 mNumSkinJoints; - LLSkinJoint* mSkinJoints; - S32 mMeshID; - -public: - static BOOL sPipelineRender; - //RN: this is here for testing purposes - static U32 sClothingMaskImageName; - static EAvatarRenderPass sRenderPass; - static LLColor4 sClothingInnerColor; - public: // Constructor LLViewerJointMesh(); @@ -94,41 +51,9 @@ public: // Destructor virtual ~LLViewerJointMesh(); - // Gets the shape color - void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha ); - - // Sets the shape color - void setColor( F32 red, F32 green, F32 blue, F32 alpha ); - - // Sets the shininess - void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; }; - - // Sets the shape texture - void setTexture( LLViewerTexture *texture ); - - void setTestTexture( U32 name ) { mTestImageName = name; } - - // Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture) - void setLayerSet( LLViewerTexLayerSet* layer_set ); - - // Gets the poly mesh - LLPolyMesh *getMesh(); - - // Sets the poly mesh - void setMesh( LLPolyMesh *mesh ); - - // Sets up joint matrix data for rendering - void setupJoint(LLViewerJoint* current_joint); - // Render time method to upload batches of joint matrices void uploadJointMatrices(); - // Sets ID for picking - void setMeshID( S32 id ) {mMeshID = id;} - - // Gets ID for picking - S32 getMeshID() { return mMeshID; } - // overloaded from base class /*virtual*/ void drawBone(); /*virtual*/ BOOL isTransparent(); @@ -148,13 +73,6 @@ private: //copy mesh into given face's vertex buffer, applying current animation pose static void updateGeometry(LLFace* face, LLPolyMesh* mesh); - -private: - // Allocate skin data - BOOL allocateSkinData( U32 numSkinJoints ); - - // Free skin data - void freeSkinData(); }; #endif // LL_LLVIEWERJOINTMESH_H diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d5ca01931f..8fc5a3f277 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -382,7 +382,7 @@ public: if (isAgentAvatarValid()) { - tvector = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition()); + tvector = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition()); agent_root_center_text = llformat("AgentRootCenter %f %f %f", (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f6cac6d2d6..f0f469e959 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -139,7 +139,6 @@ const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df44 //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- -const std::string AVATAR_DEFAULT_CHAR = "avatar"; const S32 MIN_PIXEL_AREA_FOR_COMPOSITE = 1024; const F32 SHADOW_OFFSET_AMT = 0.03f; @@ -220,58 +219,6 @@ struct LLTextureMaskData ** **/ -//------------------------------------------------------------------------ -// LLVOBoneInfo -// Trans/Scale/Rot etc. info about each avatar bone. Used by LLVOAvatarSkeleton. -//------------------------------------------------------------------------ -class LLVOAvatarBoneInfo -{ - friend class LLVOAvatar; - friend class LLVOAvatarSkeletonInfo; -public: - LLVOAvatarBoneInfo() : mIsJoint(FALSE) {} - ~LLVOAvatarBoneInfo() - { - std::for_each(mChildList.begin(), mChildList.end(), DeletePointer()); - } - BOOL parseXml(LLXmlTreeNode* node); - -private: - std::string mName; - BOOL mIsJoint; - LLVector3 mPos; - LLVector3 mRot; - LLVector3 mScale; - LLVector3 mPivot; - typedef std::vector child_list_t; - child_list_t mChildList; -}; - -//------------------------------------------------------------------------ -// LLVOAvatarSkeletonInfo -// Overall avatar skeleton -//------------------------------------------------------------------------ -class LLVOAvatarSkeletonInfo -{ - friend class LLVOAvatar; -public: - LLVOAvatarSkeletonInfo() : - mNumBones(0), mNumCollisionVolumes(0) {} - ~LLVOAvatarSkeletonInfo() - { - std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer()); - } - BOOL parseXml(LLXmlTreeNode* node); - S32 getNumBones() const { return mNumBones; } - S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; } - -private: - S32 mNumBones; - S32 mNumCollisionVolumes; - typedef std::vector bone_info_list_t; - bone_info_list_t mBoneInfoList; -}; - //----------------------------------------------------------------------------- // class LLBodyNoiseMotion //----------------------------------------------------------------------------- @@ -593,10 +540,6 @@ private: //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- -LLXmlTree LLVOAvatar::sXMLTree; -LLXmlTree LLVOAvatar::sSkeletonXMLTree; -LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; -LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; LLAvatarAppearanceDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; U32 LLVOAvatar::sMaxVisible = 12; @@ -650,9 +593,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mAttachmentGeometryBytes(0), mAttachmentSurfaceArea(0.f), mTurning(FALSE), - mPelvisToFoot(0.f), mLastSkeletonSerialNum( 0 ), - mHeadOffset(), mIsSitting(FALSE), mTimeVisible(), mTyping(FALSE), @@ -707,13 +648,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mMeshTexturesDirty = FALSE; mHeadp = NULL; - mIsBuilt = FALSE; - - mNumJoints = 0; - mSkeleton = NULL; - - mNumCollisionVolumes = 0; - mCollisionVolumes = NULL; // set up animation variables mSpeed = 0.f; @@ -802,35 +736,9 @@ LLVOAvatar::~LLVOAvatar() lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; - mRoot.removeAllChildren(); - mJointMap.clear(); - - deleteAndClearArray(mSkeleton); - deleteAndClearArray(mCollisionVolumes); - - mNumJoints = 0; - std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); - deleteAndClear(mTexSkinColor); - deleteAndClear(mTexHairColor); - deleteAndClear(mTexEyeColor); - - std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); - mMeshes.clear(); - - for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); - ++jointIter) - { - LLViewerJoint* joint = (LLViewerJoint *) *jointIter; - std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer()); - joint->mMeshParts.clear(); - } - std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer()); - mMeshLOD.clear(); - mDead = TRUE; mAnimationSources.clear(); @@ -1127,109 +1035,6 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) //------------------------------------------------------------------------ void LLVOAvatar::initClass() { - std::string xmlFile; - - xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml"; - BOOL success = sXMLTree.parseFile( xmlFile, FALSE ); - if (!success) - { - llerrs << "Problem reading avatar configuration file:" << xmlFile << llendl; - } - - // now sanity check xml file - LLXmlTreeNode* root = sXMLTree.getRoot(); - if (!root) - { - llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl; - return; - } - - //------------------------------------------------------------------------- - // (root) - //------------------------------------------------------------------------- - if( !root->hasName( "linden_avatar" ) ) - { - llerrs << "Invalid avatar file header: " << xmlFile << llendl; - } - - std::string version; - static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); - if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) - { - llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << llendl; - } - - S32 wearable_def_version = 1; - static LLStdStringHandle wearable_definition_version_string = LLXmlTree::addAttributeString("wearable_definition_version"); - root->getFastAttributeS32( wearable_definition_version_string, wearable_def_version ); - LLWearable::setCurrentDefinitionVersion( wearable_def_version ); - - std::string mesh_file_name; - - LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" ); - if (!skeleton_node) - { - llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl; - return; - } - - std::string skeleton_file_name; - static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); - if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name)) - { - llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl; - } - - std::string skeleton_path; - skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name); - if (!parseSkeletonFile(skeleton_path)) - { - llerrs << "Error parsing skeleton file: " << skeleton_path << llendl; - } - - // Process XML data - - // avatar_skeleton.xml - if (sAvatarSkeletonInfo) - { //this can happen if a login attempt failed - delete sAvatarSkeletonInfo; - } - sAvatarSkeletonInfo = new LLVOAvatarSkeletonInfo; - if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot())) - { - llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; - } - // parse avatar_lad.xml - if (sAvatarXmlInfo) - { //this can happen if a login attempt failed - deleteAndClear(sAvatarXmlInfo); - } - sAvatarXmlInfo = new LLVOAvatarXmlInfo; - if (!sAvatarXmlInfo->parseXmlSkeletonNode(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlMeshNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlColorNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlLayerNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlDriverNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlMorphNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise"); gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot"); gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION,"physics_motion"); @@ -1256,7 +1061,12 @@ void LLVOAvatar::initInstance(void) //------------------------------------------------------------------------- // initialize joint, mesh and shape members //------------------------------------------------------------------------- - mRoot.setName( "mRoot" ); + if (mRoot) + { + delete mRoot; + } + mRoot = new LLViewerJoint(); + mRoot->setName( "mRoot" ); for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); @@ -1314,7 +1124,7 @@ void LLVOAvatar::initInstance(void) // Skip it if there's no associated baked texture. if (baked_texture_index == BAKED_NUM_INDICES) continue; - for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); + for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); iter != mMeshLOD[mesh_index]->mMeshParts.end(); ++iter) { @@ -1707,160 +1517,6 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector return hit; } -//----------------------------------------------------------------------------- -// parseSkeletonFile() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) -{ - LLMemType mt(LLMemType::MTYPE_AVATAR); - - //------------------------------------------------------------------------- - // parse the file - //------------------------------------------------------------------------- - BOOL parsesuccess = sSkeletonXMLTree.parseFile( filename, FALSE ); - - if (!parsesuccess) - { - llerrs << "Can't parse skeleton file: " << filename << llendl; - return FALSE; - } - - // now sanity check xml file - LLXmlTreeNode* root = sSkeletonXMLTree.getRoot(); - if (!root) - { - llerrs << "No root node found in avatar skeleton file: " << filename << llendl; - return FALSE; - } - - if( !root->hasName( "linden_skeleton" ) ) - { - llerrs << "Invalid avatar skeleton file header: " << filename << llendl; - return FALSE; - } - - std::string version; - static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); - if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) - { - llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << llendl; - return FALSE; - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// setupBone() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num) -{ - LLMemType mt(LLMemType::MTYPE_AVATAR); - - LLViewerJoint* joint = NULL; - - if (info->mIsJoint) - { - joint = (LLViewerJoint*)getCharacterJoint(joint_num); - if (!joint) - { - llwarns << "Too many bones" << llendl; - return FALSE; - } - joint->setName( info->mName ); - } - else // collision volume - { - if (volume_num >= (S32)mNumCollisionVolumes) - { - llwarns << "Too many bones" << llendl; - return FALSE; - } - joint = (LLViewerJoint*)(&mCollisionVolumes[volume_num]); - joint->setName( info->mName ); - } - - // add to parent - if (parent) - { - parent->addChild( joint ); - } - - joint->setPosition(info->mPos); - joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY], - info->mRot.mV[VZ], LLQuaternion::XYZ)); - joint->setScale(info->mScale); - - joint->setDefaultFromCurrentXform(); - - if (info->mIsJoint) - { - joint->setSkinOffset( info->mPivot ); - joint_num++; - } - else // collision volume - { - volume_num++; - } - - // setup children - LLVOAvatarBoneInfo::child_list_t::const_iterator iter; - for (iter = info->mChildList.begin(); iter != info->mChildList.end(); ++iter) - { - LLVOAvatarBoneInfo *child_info = *iter; - if (!setupBone(child_info, joint, volume_num, joint_num)) - { - return FALSE; - } - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// buildSkeleton() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) -{ - LLMemType mt(LLMemType::MTYPE_AVATAR); - - //------------------------------------------------------------------------- - // allocate joints - //------------------------------------------------------------------------- - if (!allocateCharacterJoints(info->mNumBones)) - { - llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl; - return FALSE; - } - - //------------------------------------------------------------------------- - // allocate volumes - //------------------------------------------------------------------------- - if (info->mNumCollisionVolumes) - { - if (!allocateCollisionVolumes(info->mNumCollisionVolumes)) - { - llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << llendl; - return FALSE; - } - } - - S32 current_joint_num = 0; - S32 current_volume_num = 0; - LLVOAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; - for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); ++iter) - { - LLVOAvatarBoneInfo *info = *iter; - if (!setupBone(info, NULL, current_volume_num, current_joint_num)) - { - llerrs << "Error parsing bone in skeleton file" << llendl; - return FALSE; - } - } - - return TRUE; -} - LLVOAvatar* LLVOAvatar::asAvatar() { return this; @@ -1892,27 +1548,13 @@ void LLVOAvatar::startDefaultMotions() // LLVOAvatar::buildCharacter() // Deferred initialization and rebuild of the avatar. //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::buildCharacter() { - LLMemType mt(LLMemType::MTYPE_AVATAR); - - //------------------------------------------------------------------------- - // remove all references to our existing skeleton - // so we can rebuild it - //------------------------------------------------------------------------- - flushAllMotions(); - - //------------------------------------------------------------------------- - // remove all of mRoot's children - //------------------------------------------------------------------------- - mRoot.removeAllChildren(); - mJointMap.clear(); - mIsBuilt = FALSE; - //------------------------------------------------------------------------- // clear mesh data //------------------------------------------------------------------------- - for (std::vector::iterator jointIter = mMeshLOD.begin(); + for (std::vector::iterator jointIter = mMeshLOD.begin(); jointIter != mMeshLOD.end(); ++jointIter) { LLViewerJoint* joint = (LLViewerJoint*) *jointIter; @@ -1924,83 +1566,8 @@ void LLVOAvatar::buildCharacter() } } - //------------------------------------------------------------------------- - // (re)load our skeleton and meshes - //------------------------------------------------------------------------- - LLTimer timer; - - BOOL status = loadAvatar(); - stop_glerror(); - -// gPrintMessagesThisFrame = TRUE; - lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl; - - if (!status) - { - if (isSelf()) - { - llerrs << "Unable to load user's avatar" << llendl; - } - else - { - llwarns << "Unable to load other's avatar" << llendl; - } - return; - } - - //------------------------------------------------------------------------- - // initialize "well known" joint pointers - //------------------------------------------------------------------------- - mPelvisp = (LLViewerJoint*)mRoot.findJoint("mPelvis"); - mTorsop = (LLViewerJoint*)mRoot.findJoint("mTorso"); - mChestp = (LLViewerJoint*)mRoot.findJoint("mChest"); - mNeckp = (LLViewerJoint*)mRoot.findJoint("mNeck"); - mHeadp = (LLViewerJoint*)mRoot.findJoint("mHead"); - mSkullp = (LLViewerJoint*)mRoot.findJoint("mSkull"); - mHipLeftp = (LLViewerJoint*)mRoot.findJoint("mHipLeft"); - mHipRightp = (LLViewerJoint*)mRoot.findJoint("mHipRight"); - mKneeLeftp = (LLViewerJoint*)mRoot.findJoint("mKneeLeft"); - mKneeRightp = (LLViewerJoint*)mRoot.findJoint("mKneeRight"); - mAnkleLeftp = (LLViewerJoint*)mRoot.findJoint("mAnkleLeft"); - mAnkleRightp = (LLViewerJoint*)mRoot.findJoint("mAnkleRight"); - mFootLeftp = (LLViewerJoint*)mRoot.findJoint("mFootLeft"); - mFootRightp = (LLViewerJoint*)mRoot.findJoint("mFootRight"); - mWristLeftp = (LLViewerJoint*)mRoot.findJoint("mWristLeft"); - mWristRightp = (LLViewerJoint*)mRoot.findJoint("mWristRight"); - mEyeLeftp = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); - mEyeRightp = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); - - //------------------------------------------------------------------------- - // Make sure "well known" pointers exist - //------------------------------------------------------------------------- - if (!(mPelvisp && - mTorsop && - mChestp && - mNeckp && - mHeadp && - mSkullp && - mHipLeftp && - mHipRightp && - mKneeLeftp && - mKneeRightp && - mAnkleLeftp && - mAnkleRightp && - mFootLeftp && - mFootRightp && - mWristLeftp && - mWristRightp && - mEyeLeftp && - mEyeRightp)) - { - llerrs << "Failed to create avatar." << llendl; - return; - } + LLAvatarAppearance::buildCharacter(); - //------------------------------------------------------------------------- - // initialize the pelvis - //------------------------------------------------------------------------- - mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) ); - //------------------------------------------------------------------------- // set head offset from pelvis //------------------------------------------------------------------------- @@ -2033,9 +1600,6 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- processAnimationStateChanges(); - mIsBuilt = TRUE; - stop_glerror(); - mMeshValid = TRUE; } @@ -2055,7 +1619,7 @@ void LLVOAvatar::releaseMeshData() //llinfos << "Releasing" << llendl; // cleanup mesh data - for (std::vector::iterator iter = mMeshLOD.begin(); + for (std::vector::iterator iter = mMeshLOD.begin(); iter != mMeshLOD.end(); ++iter) { @@ -2149,7 +1713,11 @@ void LLVOAvatar::updateMeshData() last_v_num = num_vertices ; last_i_num = num_indices ; - mMeshLOD[part_index++]->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); + LLViewerJoint* part_mesh = getViewerJoint(part_index++); + if (part_mesh) + { + part_mesh->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); + } } if(num_vertices < 1)//skip empty meshes { @@ -2223,7 +1791,11 @@ void LLVOAvatar::updateMeshData() rigid = true; } - mMeshLOD[k]->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid); + LLViewerJoint* mesh = getViewerJoint(k); + if (mesh) + { + mesh->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid); + } } stop_glerror(); @@ -2243,72 +1815,6 @@ void LLVOAvatar::updateMeshData() //------------------------------------------------------------------------ -//------------------------------------------------------------------------ -// The viewer can only suggest a good size for the agent, -// the simulator will keep it inside a reasonable range. -void LLVOAvatar::computeBodySize() -{ - LLVector3 pelvis_scale = mPelvisp->getScale(); - - // some of the joints have not been cached - LLVector3 skull = mSkullp->getPosition(); - LLVector3 skull_scale = mSkullp->getScale(); - - LLVector3 neck = mNeckp->getPosition(); - LLVector3 neck_scale = mNeckp->getScale(); - - LLVector3 chest = mChestp->getPosition(); - LLVector3 chest_scale = mChestp->getScale(); - - // the rest of the joints have been cached - LLVector3 head = mHeadp->getPosition(); - LLVector3 head_scale = mHeadp->getScale(); - - LLVector3 torso = mTorsop->getPosition(); - LLVector3 torso_scale = mTorsop->getScale(); - - LLVector3 hip = mHipLeftp->getPosition(); - LLVector3 hip_scale = mHipLeftp->getScale(); - - LLVector3 knee = mKneeLeftp->getPosition(); - LLVector3 knee_scale = mKneeLeftp->getScale(); - - LLVector3 ankle = mAnkleLeftp->getPosition(); - LLVector3 ankle_scale = mAnkleLeftp->getScale(); - - LLVector3 foot = mFootLeftp->getPosition(); - - mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] - - knee.mV[VZ] * hip_scale.mV[VZ] - - ankle.mV[VZ] * knee_scale.mV[VZ] - - foot.mV[VZ] * ankle_scale.mV[VZ]; - - LLVector3 new_body_size; - new_body_size.mV[VZ] = mPelvisToFoot + - // the sqrt(2) correction below is an approximate - // correction to get to the top of the head - F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) + - head.mV[VZ] * neck_scale.mV[VZ] + - neck.mV[VZ] * chest_scale.mV[VZ] + - chest.mV[VZ] * torso_scale.mV[VZ] + - torso.mV[VZ] * pelvis_scale.mV[VZ]; - - // TODO -- measure the real depth and width - new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH; - new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH; - - if (new_body_size != mBodySize) - { - mBodySize = new_body_size; - - if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) - { // notify simulator of change in size - // but not if we are in the middle of updating appearance - gAgent.sendAgentSetAppearance(); - } - } -} - //------------------------------------------------------------------------ // LLVOAvatar::processUpdateMessage() //------------------------------------------------------------------------ @@ -2478,7 +1984,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // animate the character // store off last frame's root position to be consistent with camera position - LLVector3 root_pos_last = mRoot.getWorldPosition(); + LLVector3 root_pos_last = mRoot->getWorldPosition(); BOOL detailed_update = updateCharacter(agent); static LLUICachedControl visualizers_in_calls("ShowVoiceVisualizersInCalls", false); @@ -2597,11 +2103,11 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) if ( mIsSitting ) { LLVector3 headOffset = LLVector3( 0.0f, 0.0f, mHeadOffset.mV[2] ); - mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot.getWorldPosition() + headOffset ); + mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot->getWorldPosition() + headOffset ); } else { - LLVector3 tagPos = mRoot.getWorldPosition(); + LLVector3 tagPos = mRoot->getWorldPosition(); tagPos[VZ] -= mPelvisToFoot; tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos ); @@ -3338,7 +2844,7 @@ void LLVOAvatar::invalidateNameTags() // Compute name tag position during idle update LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) { - LLQuaternion root_rot = mRoot.getWorldRotation(); + LLQuaternion root_rot = mRoot->getWorldRotation(); LLVector3 pixel_right_vec; LLVector3 pixel_up_vec; LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); @@ -3352,7 +2858,7 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) local_camera_up.scaleVec(mBodySize * 0.5f); local_camera_at.scaleVec(mBodySize * 0.5f); - LLVector3 name_position = mRoot.getWorldPosition(); + LLVector3 name_position = mRoot->getWorldPosition(); name_position[VZ] -= mPelvisToFoot; name_position[VZ] += (mBodySize[VZ]* 0.55f); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); @@ -3417,13 +2923,13 @@ void LLVOAvatar::idleUpdateBelowWater() void LLVOAvatar::slamPosition() { gAgent.setPositionAgent(getPositionAgent()); - mRoot.setWorldPosition(getPositionAgent()); // teleport + mRoot->setWorldPosition(getPositionAgent()); // teleport setChanged(TRANSLATED); if (mDrawable.notNull()) { gPipeline.updateMoveNormalAsync(mDrawable); } - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); } bool LLVOAvatar::isVisuallyMuted() const @@ -3600,8 +3106,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) throttle = FALSE; // put the pelvis at slaved position/mRotation - mRoot.setWorldPosition( getPositionAgent() ); // first frame - mRoot.setWorldRotation( getRotation() ); + mRoot->setWorldPosition( getPositionAgent() ); // first frame + mRoot->setWorldRotation( getRotation() ); } //-------------------------------------------------------------------- @@ -3644,10 +3150,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); - if (newPosition != mRoot.getXform()->getWorldPosition()) + if (newPosition != mRoot->getXform()->getWorldPosition()) { - mRoot.touch(); - mRoot.setWorldPosition( newPosition ); // regular update + mRoot->touch(); + mRoot->setWorldPosition( newPosition ); // regular update } @@ -3708,7 +3214,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } - LLQuaternion root_rotation = mRoot.getWorldMatrix().quaternion(); + LLQuaternion root_rotation = mRoot->getWorldMatrix().quaternion(); F32 root_roll, root_pitch, root_yaw; root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw); @@ -3717,7 +3223,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // and head turn. Once in motion, it must conform however. BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook(); - LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); + LLVector3 pelvisDir( mRoot->getWorldMatrix().getFwdRow4().mV ); static LLCachedControl s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow"); static LLCachedControl s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast"); @@ -3803,14 +3309,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) F32 u = llclamp((deltaTime / pelvis_lag_time), 0.0f, 1.0f); - mRoot.setWorldRotation( slerp(u, mRoot.getWorldRotation(), wQv) ); + mRoot->setWorldRotation( slerp(u, mRoot->getWorldRotation(), wQv) ); } } else if (mDrawable.notNull()) { - mRoot.setPosition(mDrawable->getPosition()); - mRoot.setRotation(mDrawable->getRotation()); + mRoot->setPosition(mDrawable->getPosition()); + mRoot->setRotation(mDrawable->getRotation()); } //------------------------------------------------------------------------- @@ -3910,7 +3416,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); if (!mDebugText.size() && mText.notNull()) { @@ -3934,7 +3440,7 @@ void LLVOAvatar::updateHeadOffset() { // since we only care about Z, just grab one of the eyes LLVector3 midEyePt = mEyeLeftp->getWorldPosition(); - midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); + midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot->getWorldPosition(); midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]); if (mDrawable.notNull()) @@ -3972,8 +3478,8 @@ void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount, void LLVOAvatar::postPelvisSetRecalc( void ) { computeBodySize(); - mRoot.touch(); - mRoot.updateWorldMatrixChildren(); + mRoot->touch(); + mRoot->updateWorldMatrixChildren(); dirtyMesh(); updateHeadOffset(); } @@ -4207,19 +3713,44 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) if (mNeedsSkin) { //generate animated mesh - mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry(); - mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry(); + LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); + LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); + LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); + LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH); + LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + + if(upper_mesh) + { + upper_mesh->updateJointGeometry(); + } + if (lower_mesh) + { + lower_mesh->updateJointGeometry(); + } if( isWearingWearableType( LLWearableType::WT_SKIRT ) ) { - mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry(); + if(skirt_mesh) + { + skirt_mesh->updateJointGeometry(); + } } if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { - mMeshLOD[MESH_ID_EYELASH]->updateJointGeometry(); - mMeshLOD[MESH_ID_HEAD]->updateJointGeometry(); - mMeshLOD[MESH_ID_HAIR]->updateJointGeometry(); + if(eyelash_mesh) + { + eyelash_mesh->updateJointGeometry(); + } + if(head_mesh) + { + head_mesh->updateJointGeometry(); + } + if(hair_mesh) + { + hair_mesh->updateJointGeometry(); + } } mNeedsSkin = FALSE; mLastSkinTime = gFrameTimeSeconds; @@ -4336,19 +3867,31 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) { if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_HEAD]->render(mAdjustedPixelArea, TRUE, mIsDummy); + LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); + if (head_mesh) + { + num_indices += head_mesh->render(mAdjustedPixelArea, TRUE, mIsDummy); + } first_pass = FALSE; } } if (isTextureVisible(TEX_UPPER_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_UPPER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); + if (upper_mesh) + { + num_indices += upper_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_LOWER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); + if (lower_mesh) + { + num_indices += lower_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } } @@ -4381,7 +3924,11 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) ) { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); - num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE); + LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); + if (skirt_mesh) + { + num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE); + } first_pass = FALSE; gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } @@ -4395,14 +3942,22 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) if (isTextureVisible(TEX_HEAD_BAKED)) { - num_indices += mMeshLOD[MESH_ID_EYELASH]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH); + if (eyelash_mesh) + { + num_indices += eyelash_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); if (getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha) { - num_indices += mMeshLOD[MESH_ID_HAIR]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + if (hair_mesh) + { + num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } if (LLPipeline::sImpostorRender) @@ -4446,8 +4001,16 @@ U32 LLVOAvatar::renderRigid() if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_EYEBALL_LEFT]->render(mAdjustedPixelArea, TRUE, mIsDummy); - num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy); + LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT); + LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT); + if (eyeball_left) + { + num_indices += eyeball_left->render(mAdjustedPixelArea, TRUE, mIsDummy); + } + if(eyeball_right) + { + num_indices += eyeball_right->render(mAdjustedPixelArea, TRUE, mIsDummy); + } } if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction) @@ -5139,7 +4702,7 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name ) if (iter == mJointMap.end() || iter->second == NULL) { //search for joint and cache found joint in lookup table - jointp = mRoot.findJoint(name); + jointp = mRoot->findJoint(name); mJointMap[name] = jointp; } else @@ -5168,7 +4731,7 @@ void LLVOAvatar::resetJointPositions( void ) //----------------------------------------------------------------------------- void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) { - LLJoint* pJoint = mRoot.findJoint( name ); + LLJoint* pJoint = mRoot->findJoint( name ); if ( pJoint && pJoint->doesJointNeedToBeReset() ) { @@ -5356,23 +4919,6 @@ BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) return TRUE; } -//----------------------------------------------------------------------------- -// allocateCollisionVolumes() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::allocateCollisionVolumes( U32 num ) -{ - deleteAndClearArray(mCollisionVolumes); - mNumCollisionVolumes = 0; - - mCollisionVolumes = new LLViewerJointCollisionVolume[num]; - if (!mCollisionVolumes) - { - return FALSE; - } - - mNumCollisionVolumes = num; - return TRUE; -} //----------------------------------------------------------------------------- @@ -5397,154 +4943,14 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion ) // Only agent avatars should handle the stop motion notifications. } -//----------------------------------------------------------------------------- -// loadAvatar() -//----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_LOAD_AVATAR("Load Avatar"); - -BOOL LLVOAvatar::loadAvatar() -{ -// LLFastTimer t(FTM_LOAD_AVATAR); - - // avatar_skeleton.xml - if( !buildSkeleton(sAvatarSkeletonInfo) ) - { - llwarns << "avatar file: buildSkeleton() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( !loadSkeletonNode() ) - { - llwarns << "avatar file: loadNodeSkeleton() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( !loadMeshNodes() ) - { - llwarns << "avatar file: loadNodeMesh() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( sAvatarXmlInfo->mTexSkinColorInfo ) - { - mTexSkinColor = new LLTexGlobalColor( this ); - if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) ) - { - llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"skin_color\" not found" << llendl; - return FALSE; - } - if( sAvatarXmlInfo->mTexHairColorInfo ) - { - mTexHairColor = new LLTexGlobalColor( this ); - if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) ) - { - llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"hair_color\" not found" << llendl; - return FALSE; - } - if( sAvatarXmlInfo->mTexEyeColorInfo ) - { - mTexEyeColor = new LLTexGlobalColor( this ); - if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) ) - { - llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"eye_color\" not found" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if (sAvatarXmlInfo->mLayerInfoList.empty()) - { - llwarns << "avatar file: missing node" << llendl; - return FALSE; - } - - if (sAvatarXmlInfo->mMorphMaskInfoList.empty()) - { - llwarns << "avatar file: missing node" << llendl; - return FALSE; - } - - // avatar_lad.xml : - for (LLVOAvatarXmlInfo::morph_info_list_t::iterator iter = sAvatarXmlInfo->mMorphMaskInfoList.begin(); - iter != sAvatarXmlInfo->mMorphMaskInfoList.end(); - ++iter) - { - LLVOAvatarXmlInfo::LLVOAvatarMorphInfo *info = *iter; - - EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion); - if (baked != BAKED_NUM_INDICES) - { - LLVisualParam* morph_param; - const std::string *name = &info->mName; - morph_param = getVisualParam(name->c_str()); - if (morph_param) - { - BOOL invert = info->mInvert; - addMaskedMorph(baked, morph_param, invert, info->mLayer); - } - } - - } - - loadLayersets(); - - // avatar_lad.xml : - for (LLVOAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin(); - iter != sAvatarXmlInfo->mDriverInfoList.end(); - ++iter) - { - LLDriverParamInfo *info = *iter; - LLDriverParam* driver_param = new LLDriverParam( this ); - if (driver_param->setInfo(info)) - { - addVisualParam( driver_param ); - LLVisualParam*(LLVOAvatar::*avatar_function)(S32)const = &LLVOAvatar::getVisualParam; - if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatar*)this,_1 ), false)) - { - llwarns << "could not link driven params for avatar " << this->getFullname() << " id: " << driver_param->getID() << llendl; - continue; - } - } - else - { - delete driver_param; - llwarns << "avatar file: driver_param->parseData() failed" << llendl; - return FALSE; - } - } - - - return TRUE; -} - //----------------------------------------------------------------------------- // loadSkeletonNode(): loads node from XML tree //----------------------------------------------------------------------------- +//virtual BOOL LLVOAvatar::loadSkeletonNode () { - mRoot.addChild( &mSkeleton[0] ); - - for (std::vector::iterator iter = mMeshLOD.begin(); + // make meshes children before calling parent version of the function + for (std::vector::iterator iter = mMeshLOD.begin(); iter != mMeshLOD.end(); ++iter) { @@ -5553,60 +4959,19 @@ BOOL LLVOAvatar::loadSkeletonNode () joint->setMeshesToChildren(); } - mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); - mRoot.addChild(mMeshLOD[MESH_ID_EYELASH]); - mRoot.addChild(mMeshLOD[MESH_ID_UPPER_BODY]); - mRoot.addChild(mMeshLOD[MESH_ID_LOWER_BODY]); - mRoot.addChild(mMeshLOD[MESH_ID_SKIRT]); - mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); - - LLViewerJoint *skull = (LLViewerJoint*)mRoot.findJoint("mSkull"); - if (skull) - { - skull->addChild(mMeshLOD[MESH_ID_HAIR] ); - } - - LLViewerJoint *eyeL = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); - if (eyeL) + if (!LLAvatarAppearance::loadSkeletonNode()) { - eyeL->addChild( mMeshLOD[MESH_ID_EYEBALL_LEFT] ); - } - - LLViewerJoint *eyeR = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); - if (eyeR) - { - eyeR->addChild( mMeshLOD[MESH_ID_EYEBALL_RIGHT] ); + return FALSE; } - // SKELETAL DISTORTIONS - { - LLVOAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter; - for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin(); - iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end(); - ++iter) - { - LLPolySkeletalDistortionInfo *info = *iter; - LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this); - if (!param->setInfo(info)) - { - delete param; - return FALSE; - } - else - { - addVisualParam(param); - } - } - } - // ATTACHMENTS { - LLVOAvatarXmlInfo::attachment_info_list_t::iterator iter; + LLAvatarXmlInfo::attachment_info_list_t::iterator iter; for (iter = sAvatarXmlInfo->mAttachmentInfoList.begin(); iter != sAvatarXmlInfo->mAttachmentInfoList.end(); ++iter) { - LLVOAvatarXmlInfo::LLVOAvatarAttachmentInfo *info = *iter; + LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *iter; if (!isSelf() && info->mJointName == "mScreen") { //don't process screen joint for other avatars continue; @@ -5678,144 +5043,6 @@ BOOL LLVOAvatar::loadSkeletonNode () return TRUE; } -//----------------------------------------------------------------------------- -// loadMeshNodes(): loads nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::loadMeshNodes() -{ - for (LLVOAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin(); - meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); - ++meshinfo_iter) - { - const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo *info = *meshinfo_iter; - const std::string &type = info->mType; - S32 lod = info->mLOD; - - LLViewerJointMesh* mesh = NULL; - U8 mesh_id = 0; - BOOL found_mesh_id = FALSE; - - /* if (type == "hairMesh") - switch(lod) - case 0: - mesh = &mHairMesh0; */ - for (LLAvatarAppearanceDictionary::Meshes::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); - mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); - ++mesh_iter) - { - const EMeshIndex mesh_index = mesh_iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second; - if (type.compare(mesh_dict->mName) == 0) - { - mesh_id = mesh_index; - found_mesh_id = TRUE; - break; - } - } - - if (found_mesh_id) - { - if (lod < (S32)mMeshLOD[mesh_id]->mMeshParts.size()) - { - mesh = mMeshLOD[mesh_id]->mMeshParts[lod]; - } - else - { - llwarns << "Avatar file: has invalid lod setting " << lod << llendl; - return FALSE; - } - } - else - { - llwarns << "Ignoring unrecognized mesh type: " << type << llendl; - return FALSE; - } - - // llinfos << "Parsing mesh data for " << type << "..." << llendl; - - // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. - // Do not touch!!! - mesh->setColor( 1.0f, 1.0f, 1.0f, 1.0f ); - - LLPolyMesh *poly_mesh = NULL; - - if (!info->mReferenceMeshName.empty()) - { - polymesh_map_t::const_iterator polymesh_iter = mMeshes.find(info->mReferenceMeshName); - if (polymesh_iter != mMeshes.end()) - { - poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName, polymesh_iter->second); - poly_mesh->setAvatar(this); - } - else - { - // This should never happen - LL_WARNS("Avatar") << "Could not find avatar mesh: " << info->mReferenceMeshName << LL_ENDL; - } - } - else - { - poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName); - poly_mesh->setAvatar(this); - } - - if( !poly_mesh ) - { - llwarns << "Failed to load mesh of type " << type << llendl; - return FALSE; - } - - // Multimap insert - mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh)); - - mesh->setMesh( poly_mesh ); - mesh->setLOD( info->mMinPixelArea ); - - for (LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin(); - xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); - ++xmlinfo_iter) - { - const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter); - LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh()); - if (!param->setInfo(info_pair->first)) - { - delete param; - return FALSE; - } - else - { - if (info_pair->second) - { - addSharedVisualParam(param); - } - else - { - addVisualParam(param); - } - } - } - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// loadLayerSets() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::loadLayersets() -{ - BOOL success = TRUE; - for (LLVOAvatarXmlInfo::layer_info_list_t::const_iterator layerset_iter = sAvatarXmlInfo->mLayerInfoList.begin(); - layerset_iter != sAvatarXmlInfo->mLayerInfoList.end(); - ++layerset_iter) - { - // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. - LLTexLayerSetInfo *layerset_info = *layerset_iter; - layerset_info->createVisualParams(this); - } - return success; -} - //----------------------------------------------------------------------------- // updateVisualParams() //----------------------------------------------------------------------------- @@ -5829,7 +5056,7 @@ void LLVOAvatar::updateVisualParams() { computeBodySize(); mLastSkeletonSerialNum = mSkeletonSerialNum; - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); } dirtyMesh(); @@ -5919,7 +5146,12 @@ BOOL LLVOAvatar::updateJointLODs() } // now select meshes to render based on adjusted pixel area - BOOL res = mRoot.updateLOD(mAdjustedPixelArea, TRUE); + LLViewerJoint* root = dynamic_cast(mRoot); + BOOL res = FALSE; + if (root) + { + res = root->updateLOD(mAdjustedPixelArea, TRUE); + } if (res) { sNumLODChangesThisFrame++; @@ -6009,6 +5241,15 @@ void LLVOAvatar::dirtyMesh(S32 priority) { mDirtyMesh = llmax(mDirtyMesh, priority); } + +//----------------------------------------------------------------------------- +// getViewerJoint() +//----------------------------------------------------------------------------- +LLViewerJoint* LLVOAvatar::getViewerJoint(S32 idx) +{ + return dynamic_cast(mMeshLOD[idx]); +} + //----------------------------------------------------------------------------- // hideSkirt() //----------------------------------------------------------------------------- @@ -6322,9 +5563,9 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) // Notice that removing sitDown() from here causes avatars sitting on // objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655. sitDown(TRUE); - mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject - mRoot.setPosition(getPosition()); - mRoot.updateWorldMatrixChildren(); + mRoot->getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject + mRoot->setPosition(getPosition()); + mRoot->updateWorldMatrixChildren(); stopMotion(ANIM_AGENT_BODY_NOISE); @@ -6370,10 +5611,10 @@ void LLVOAvatar::getOffObject() sitDown(FALSE); - mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject - mRoot.setPosition(cur_position_world); - mRoot.setRotation(cur_rotation_world); - mRoot.getXform()->update(); + mRoot->getXform()->setParent(NULL); // LLVOAvatar::getOffObject + mRoot->setPosition(cur_position_world); + mRoot->setRotation(cur_rotation_world); + mRoot->getXform()->update(); startMotion(ANIM_AGENT_BODY_NOISE); @@ -7752,501 +6993,20 @@ void LLVOAvatar::startAppearanceAnimation() } } -// virtual -void LLVOAvatar::removeMissingBakedTextures() -{ -} - -//----------------------------------------------------------------------------- -// LLVOAvatarXmlInfo -//----------------------------------------------------------------------------- - -LLVOAvatar::LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() - : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0) -{ -} - -LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() -{ - std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); - std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); - std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer()); - deleteAndClear(mTexSkinColorInfo); - deleteAndClear(mTexHairColorInfo); - deleteAndClear(mTexEyeColorInfo); - std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); - std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer()); - std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer()); -} - -//----------------------------------------------------------------------------- -// LLVOAvatarBoneInfo::parseXml() -//----------------------------------------------------------------------------- -BOOL LLVOAvatarBoneInfo::parseXml(LLXmlTreeNode* node) -{ - if (node->hasName("bone")) - { - mIsJoint = TRUE; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!node->getFastAttributeString(name_string, mName)) - { - llwarns << "Bone without name" << llendl; - return FALSE; - } - } - else if (node->hasName("collision_volume")) - { - mIsJoint = FALSE; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!node->getFastAttributeString(name_string, mName)) - { - mName = "Collision Volume"; - } - } - else - { - llwarns << "Invalid node " << node->getName() << llendl; - return FALSE; - } - - static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); - if (!node->getFastAttributeVector3(pos_string, mPos)) - { - llwarns << "Bone without position" << llendl; - return FALSE; - } - - static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot"); - if (!node->getFastAttributeVector3(rot_string, mRot)) - { - llwarns << "Bone without rotation" << llendl; - return FALSE; - } - - static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); - if (!node->getFastAttributeVector3(scale_string, mScale)) - { - llwarns << "Bone without scale" << llendl; - return FALSE; - } - - if (mIsJoint) - { - static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot"); - if (!node->getFastAttributeVector3(pivot_string, mPivot)) - { - llwarns << "Bone without pivot" << llendl; - return FALSE; - } - } - - // parse children - LLXmlTreeNode* child; - for( child = node->getFirstChild(); child; child = node->getNextChild() ) - { - LLVOAvatarBoneInfo *child_info = new LLVOAvatarBoneInfo; - if (!child_info->parseXml(child)) - { - delete child_info; - return FALSE; - } - mChildList.push_back(child_info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLVOAvatarSkeletonInfo::parseXml() -//----------------------------------------------------------------------------- -BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) -{ - static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones"); - if (!node->getFastAttributeS32(num_bones_string, mNumBones)) - { - llwarns << "Couldn't find number of bones." << llendl; - return FALSE; - } - - static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes"); - node->getFastAttributeS32(num_collision_volumes_string, mNumCollisionVolumes); - - LLXmlTreeNode* child; - for( child = node->getFirstChild(); child; child = node->getNextChild() ) - { - LLVOAvatarBoneInfo *info = new LLVOAvatarBoneInfo; - if (!info->parseXml(child)) - { - delete info; - llwarns << "Error parsing bone in skeleton file" << llendl; - return FALSE; - } - mBoneInfoList.push_back(info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlSkeletonNode(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) -{ - LLXmlTreeNode* node = root->getChildByName( "skeleton" ); - if( !node ) - { - llwarns << "avatar file: missing " << llendl; - return FALSE; - } - - LLXmlTreeNode* child; - - // SKELETON DISTORTIONS - for (child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if (!child->getChildByName("param_skeleton")) - { - if (child->getChildByName("param_morph")) - { - llwarns << "Can't specify morph param in skeleton definition." << llendl; - } - else - { - llwarns << "Unknown param type." << llendl; - } - continue; - } - - LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo; - if (!info->parseXml(child)) - { - delete info; - return FALSE; - } - - mSkeletalDistortionInfoList.push_back(info); - } - - // ATTACHMENT POINTS - for (child = node->getChildByName( "attachment_point" ); - child; - child = node->getNextNamedChild()) - { - LLVOAvatarAttachmentInfo* info = new LLVOAvatarAttachmentInfo(); - - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!child->getFastAttributeString(name_string, info->mName)) - { - llwarns << "No name supplied for attachment point." << llendl; - delete info; - continue; - } - - static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint"); - if (!child->getFastAttributeString(joint_string, info->mJointName)) - { - llwarns << "No bone declared in attachment point " << info->mName << llendl; - delete info; - continue; - } - - static LLStdStringHandle position_string = LLXmlTree::addAttributeString("position"); - if (child->getFastAttributeVector3(position_string, info->mPosition)) - { - info->mHasPosition = TRUE; - } - - static LLStdStringHandle rotation_string = LLXmlTree::addAttributeString("rotation"); - if (child->getFastAttributeVector3(rotation_string, info->mRotationEuler)) - { - info->mHasRotation = TRUE; - } - static LLStdStringHandle group_string = LLXmlTree::addAttributeString("group"); - if (child->getFastAttributeS32(group_string, info->mGroup)) - { - if (info->mGroup == -1) - info->mGroup = -1111; // -1 = none parsed, < -1 = bad value - } - - static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); - if (!child->getFastAttributeS32(id_string, info->mAttachmentID)) - { - llwarns << "No id supplied for attachment point " << info->mName << llendl; - delete info; - continue; - } - - static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice"); - child->getFastAttributeS32(slot_string, info->mPieMenuSlice); - - static LLStdStringHandle visible_in_first_person_string = LLXmlTree::addAttributeString("visible_in_first_person"); - child->getFastAttributeBOOL(visible_in_first_person_string, info->mVisibleFirstPerson); - - static LLStdStringHandle hud_attachment_string = LLXmlTree::addAttributeString("hud"); - child->getFastAttributeBOOL(hud_attachment_string, info->mIsHUDAttachment); - - mAttachmentInfoList.push_back(info); - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlMeshNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) -{ - for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); - node; - node = root->getNextNamedChild()) - { - LLVOAvatarMeshInfo *info = new LLVOAvatarMeshInfo; - - // attribute: type - static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type"); - if( !node->getFastAttributeString( type_string, info->mType ) ) - { - llwarns << "Avatar file: is missing type attribute. Ignoring element. " << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod"); - if (!node->getFastAttributeS32( lod_string, info->mLOD )) - { - llwarns << "Avatar file: is missing lod attribute. Ignoring element. " << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); - if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) ) - { - llwarns << "Avatar file: is missing file_name attribute. Ignoring: " << info->mType << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference"); - node->getFastAttributeString( reference_string, info->mReferenceMeshName ); - - // attribute: min_pixel_area - static LLStdStringHandle min_pixel_area_string = LLXmlTree::addAttributeString("min_pixel_area"); - static LLStdStringHandle min_pixel_width_string = LLXmlTree::addAttributeString("min_pixel_width"); - if (!node->getFastAttributeF32( min_pixel_area_string, info->mMinPixelArea )) - { - F32 min_pixel_area = 0.1f; - if (node->getFastAttributeF32( min_pixel_width_string, min_pixel_area )) - { - // this is square root of pixel area (sensible to use linear space in defining lods) - min_pixel_area = min_pixel_area * min_pixel_area; - } - info->mMinPixelArea = min_pixel_area; - } - - // Parse visual params for this node only if we haven't already - for (LLXmlTreeNode* child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if (!child->getChildByName("param_morph")) - { - if (child->getChildByName("param_skeleton")) - { - llwarns << "Can't specify skeleton param in a mesh definition." << llendl; - } - else - { - llwarns << "Unknown param type." << llendl; - } - continue; - } - - LLPolyMorphTargetInfo *morphinfo = new LLPolyMorphTargetInfo(); - if (!morphinfo->parseXml(child)) - { - delete morphinfo; - delete info; - return -1; - } - BOOL shared = FALSE; - static LLStdStringHandle shared_string = LLXmlTree::addAttributeString("shared"); - child->getFastAttributeBOOL(shared_string, shared); - - info->mPolyMorphTargetInfoList.push_back(LLVOAvatarMeshInfo::morph_info_pair_t(morphinfo, shared)); - } - - mMeshInfoList.push_back(info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlColorNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) -{ - for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); - color_node; - color_node = root->getNextNamedChild()) - { - std::string global_color_name; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (color_node->getFastAttributeString( name_string, global_color_name ) ) - { - if( global_color_name == "skin_color" ) - { - if (mTexSkinColorInfo) - { - llwarns << "avatar file: multiple instances of skin_color" << llendl; - return FALSE; - } - mTexSkinColorInfo = new LLTexGlobalColorInfo; - if( !mTexSkinColorInfo->parseXml( color_node ) ) - { - deleteAndClear(mTexSkinColorInfo); - llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl; - return FALSE; - } - } - else if( global_color_name == "hair_color" ) - { - if (mTexHairColorInfo) - { - llwarns << "avatar file: multiple instances of hair_color" << llendl; - return FALSE; - } - mTexHairColorInfo = new LLTexGlobalColorInfo; - if( !mTexHairColorInfo->parseXml( color_node ) ) - { - deleteAndClear(mTexHairColorInfo); - llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl; - return FALSE; - } - } - else if( global_color_name == "eye_color" ) - { - if (mTexEyeColorInfo) - { - llwarns << "avatar file: multiple instances of eye_color" << llendl; - return FALSE; - } - mTexEyeColorInfo = new LLTexGlobalColorInfo; - if( !mTexEyeColorInfo->parseXml( color_node ) ) - { - llwarns << "avatar file: mTexEyeColor->parseXml() failed" << llendl; - return FALSE; - } - } - } - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlLayerNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) +//virtual +void LLVOAvatar::bodySizeChanged() { - for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); - layer_node; - layer_node = root->getNextNamedChild()) - { - LLTexLayerSetInfo* layer_info = new LLTexLayerSetInfo(); - if( layer_info->parseXml( layer_node ) ) - { - mLayerInfoList.push_back(layer_info); - } - else - { - delete layer_info; - llwarns << "avatar file: layer_set->parseXml() failed" << llendl; - return FALSE; - } + if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) + { // notify simulator of change in size + // but not if we are in the middle of updating appearance + gAgent.sendAgentSetAppearance(); } - return TRUE; } -//----------------------------------------------------------------------------- -// parseXmlDriverNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) -{ - LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); - if( driver ) - { - for (LLXmlTreeNode* grand_child = driver->getChildByName( "param" ); - grand_child; - grand_child = driver->getNextNamedChild()) - { - if( grand_child->getChildByName( "param_driver" ) ) - { - LLDriverParamInfo* driver_info = new LLDriverParamInfo(); - if( driver_info->parseXml( grand_child ) ) - { - mDriverInfoList.push_back(driver_info); - } - else - { - delete driver_info; - llwarns << "avatar file: driver_param->parseXml() failed" << llendl; - return FALSE; - } - } - } - } - return TRUE; -} -//----------------------------------------------------------------------------- -// parseXmlDriverNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root) -{ - LLXmlTreeNode* masks = root->getChildByName( "morph_masks" ); - if( !masks ) - { - return FALSE; - } - - for (LLXmlTreeNode* grand_child = masks->getChildByName( "mask" ); - grand_child; - grand_child = masks->getNextNamedChild()) - { - LLVOAvatarMorphInfo* info = new LLVOAvatarMorphInfo(); - - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name"); - if (!grand_child->getFastAttributeString(name_string, info->mName)) - { - llwarns << "No name supplied for morph mask." << llendl; - delete info; - continue; - } - - static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region"); - if (!grand_child->getFastAttributeString(region_string, info->mRegion)) - { - llwarns << "No region supplied for morph mask." << llendl; - delete info; - continue; - } - - static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer"); - if (!grand_child->getFastAttributeString(layer_string, info->mLayer)) - { - llwarns << "No layer supplied for morph mask." << llendl; - delete info; - continue; - } - - // optional parameter. don't throw a warning if not present. - static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert"); - grand_child->getFastAttributeBOOL(invert_string, info->mInvert); - - mMorphMaskInfoList.push_back(info); - } - - return TRUE; +// virtual +void LLVOAvatar::removeMissingBakedTextures() +{ } //virtual diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index dd8663f4dc..bda09b044d 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -69,8 +69,7 @@ class LLVoiceVisualizer; class LLHUDNameTag; class LLHUDEffectSpiral; class LLTexGlobalColor; -class LLVOAvatarBoneInfo; -class LLVOAvatarSkeletonInfo; +class LLViewerJoint; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLVOAvatar @@ -85,8 +84,6 @@ class LLVOAvatar : public: friend class LLVOAvatarSelf; -protected: - struct LLVOAvatarXmlInfo; /******************************************************************************** ** ** @@ -111,9 +108,6 @@ public: virtual void initInstance(); // Called after construction to initialize the class. protected: virtual ~LLVOAvatar(); - BOOL loadSkeletonNode(); - BOOL loadMeshNodes(); - virtual BOOL loadLayersets(); /** Initialization ** ** @@ -190,7 +184,7 @@ public: void dumpAnimationState(); virtual LLJoint* getJoint(const std::string &name); - virtual LLJoint* getRootJoint() { return &mRoot; } + virtual LLJoint* getRootJoint() { return mRoot; } void resetJointPositions( void ); void resetJointPositionsToDefault( void ); @@ -224,7 +218,6 @@ public: public: virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent /*virtual*/BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode - bool isBuilt() const { return mIsBuilt; } private: //aligned members LL_ALIGN_16(LLVector4a mImpostorExtents[2]); @@ -343,7 +336,6 @@ protected: /** State ** ** *******************************************************************************/ - /******************************************************************************** ** ** ** SKELETON @@ -351,74 +343,22 @@ protected: public: void updateHeadOffset(); - F32 getPelvisToFoot() const { return mPelvisToFoot; } void setPelvisOffset( bool hasOffset, const LLVector3& translation, F32 offset ) ; bool hasPelvisOffset( void ) { return mHasPelvisOffset; } void postPelvisSetRecalc( void ); void setPelvisOffset( F32 pelvixFixupAmount ); + /*virtual*/ BOOL loadSkeletonNode(); + /*virtual*/ void buildCharacter(); + bool mHasPelvisOffset; LLVector3 mPelvisOffset; F32 mLastPelvisToFoot; F32 mPelvisFixup; F32 mLastPelvisFixup; - LLVector3 mHeadOffset; // current head position - LLViewerJoint mRoot; - - typedef std::map joint_map_t; - joint_map_t mJointMap; - -protected: - static BOOL parseSkeletonFile(const std::string& filename); - void buildCharacter(); - virtual BOOL loadAvatar(); - - BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); - BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info); -private: - BOOL mIsBuilt; // state of deferred character building - S32 mNumJoints; - LLViewerJoint* mSkeleton; - - //-------------------------------------------------------------------- - // Pelvis height adjustment members. - //-------------------------------------------------------------------- -public: - LLVector3 mBodySize; S32 mLastSkeletonSerialNum; -private: - F32 mPelvisToFoot; - //-------------------------------------------------------------------- - // Cached pointers to well known joints - //-------------------------------------------------------------------- -public: - LLViewerJoint* mPelvisp; - LLViewerJoint* mTorsop; - LLViewerJoint* mChestp; - LLViewerJoint* mNeckp; - LLViewerJoint* mHeadp; - LLViewerJoint* mSkullp; - LLViewerJoint* mEyeLeftp; - LLViewerJoint* mEyeRightp; - LLViewerJoint* mHipLeftp; - LLViewerJoint* mHipRightp; - LLViewerJoint* mKneeLeftp; - LLViewerJoint* mKneeRightp; - LLViewerJoint* mAnkleLeftp; - LLViewerJoint* mAnkleRightp; - LLViewerJoint* mFootLeftp; - LLViewerJoint* mFootRightp; - LLViewerJoint* mWristLeftp; - LLViewerJoint* mWristRightp; - - //-------------------------------------------------------------------- - // XML parse tree - //-------------------------------------------------------------------- -private: - static LLXmlTree sXMLTree; // avatar config file - static LLXmlTree sSkeletonXMLTree; // avatar skeleton file /** Skeleton ** ** @@ -640,8 +580,6 @@ public: private: static const LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary *getDictionary() { return sAvatarDictionary; } static LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* sAvatarDictionary; - static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo; - static LLVOAvatarXmlInfo* sAvatarXmlInfo; //-------------------------------------------------------------------- // Messaging @@ -671,13 +609,10 @@ protected: virtual void restoreMeshData(); private: virtual void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority + LLViewerJoint* getViewerJoint(S32 idx); S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD BOOL mMeshTexturesDirty; - typedef std::multimap polymesh_map_t; - polymesh_map_t mMeshes; - std::vector mMeshLOD; - //-------------------------------------------------------------------- // Destroy invisible mesh //-------------------------------------------------------------------- @@ -698,6 +633,7 @@ public: void processAvatarAppearance(LLMessageSystem* mesgsys); void hideSkirt(); void startAppearanceAnimation(); + /*virtual*/ void bodySizeChanged(); //-------------------------------------------------------------------- // Appearance morphing @@ -839,15 +775,6 @@ private: BOOL mTurning; // controls hysteresis on avatar rotation F32 mSpeed; // misc. animation repeated state - //-------------------------------------------------------------------- - // Collision volumes - //-------------------------------------------------------------------- -public: - S32 mNumCollisionVolumes; - LLViewerJointCollisionVolume* mCollisionVolumes; -protected: - BOOL allocateCollisionVolumes(U32 num); - //-------------------------------------------------------------------- // Dimensions //-------------------------------------------------------------------- @@ -858,7 +785,6 @@ public: void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm); void slamPosition(); // Slam position to transmitted position (for teleport); protected: - void computeBodySize(); //-------------------------------------------------------------------- // Material being stepped on @@ -1025,90 +951,6 @@ protected: protected: // Shared with LLVOAvatarSelf - struct LLVOAvatarXmlInfo - { - LLVOAvatarXmlInfo(); - ~LLVOAvatarXmlInfo(); - - BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); - BOOL parseXmlMeshNodes(LLXmlTreeNode* root); - BOOL parseXmlColorNodes(LLXmlTreeNode* root); - BOOL parseXmlLayerNodes(LLXmlTreeNode* root); - BOOL parseXmlDriverNodes(LLXmlTreeNode* root); - BOOL parseXmlMorphNodes(LLXmlTreeNode* root); - - struct LLVOAvatarMeshInfo - { - typedef std::pair morph_info_pair_t; - typedef std::vector morph_info_list_t; - - LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} - ~LLVOAvatarMeshInfo() - { - morph_info_list_t::iterator iter; - for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++) - { - delete iter->first; - } - mPolyMorphTargetInfoList.clear(); - } - - std::string mType; - S32 mLOD; - std::string mMeshFileName; - std::string mReferenceMeshName; - F32 mMinPixelArea; - morph_info_list_t mPolyMorphTargetInfoList; - }; - typedef std::vector mesh_info_list_t; - mesh_info_list_t mMeshInfoList; - - typedef std::vector skeletal_distortion_info_list_t; - skeletal_distortion_info_list_t mSkeletalDistortionInfoList; - - struct LLVOAvatarAttachmentInfo - { - LLVOAvatarAttachmentInfo() - : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), - mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} - std::string mName; - std::string mJointName; - LLVector3 mPosition; - LLVector3 mRotationEuler; - S32 mGroup; - S32 mAttachmentID; - S32 mPieMenuSlice; - BOOL mVisibleFirstPerson; - BOOL mIsHUDAttachment; - BOOL mHasPosition; - BOOL mHasRotation; - }; - typedef std::vector attachment_info_list_t; - attachment_info_list_t mAttachmentInfoList; - - LLTexGlobalColorInfo *mTexSkinColorInfo; - LLTexGlobalColorInfo *mTexHairColorInfo; - LLTexGlobalColorInfo *mTexEyeColorInfo; - - typedef std::vector layer_info_list_t; - layer_info_list_t mLayerInfoList; - - typedef std::vector driver_info_list_t; - driver_info_list_t mDriverInfoList; - - struct LLVOAvatarMorphInfo - { - LLVOAvatarMorphInfo() - : mInvert(FALSE) {} - std::string mName; - std::string mRegion; - std::string mLayer; - BOOL mInvert; - }; - - typedef std::vector morph_info_list_t; - morph_info_list_t mMorphMaskInfoList; - }; /** Support classes ** ** diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index fc52347041..f832a126bd 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -255,7 +255,7 @@ BOOL LLVOAvatarSelf::loadAvatarSelf() return success; } -BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLVOAvatarSkeletonInfo *info) +BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLAvatarSkeletonInfo *info) { LLMemType mt(LLMemType::MTYPE_AVATAR); @@ -589,7 +589,7 @@ LLVOAvatarSelf::~LLVOAvatarSelf() BOOL LLVOAvatarSelf::loadLayersets() { BOOL success = TRUE; - for (LLVOAvatarXmlInfo::layer_info_list_t::const_iterator iter = sAvatarXmlInfo->mLayerInfoList.begin(); + for (LLAvatarXmlInfo::layer_info_list_t::const_iterator iter = sAvatarXmlInfo->mLayerInfoList.begin(); iter != sAvatarXmlInfo->mLayerInfoList.end(); ++iter) { @@ -952,7 +952,7 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) void LLVOAvatarSelf::idleUpdateTractorBeam() { // This is only done for yourself (maybe it should be in the agent?) - if (!needsRenderBeam() || !mIsBuilt) + if (!needsRenderBeam() || !isBuilt()) { mBeam = NULL; } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 75c2743ab0..bdc1ccf133 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -67,7 +67,7 @@ public: protected: /*virtual*/ BOOL loadAvatar(); BOOL loadAvatarSelf(); - BOOL buildSkeletonSelf(const LLVOAvatarSkeletonInfo *info); + BOOL buildSkeletonSelf(const LLAvatarSkeletonInfo *info); BOOL buildMenus(); /*virtual*/ BOOL loadLayersets(); -- cgit v1.2.3 From cf7eb79fa7eadd6d76890d2a3f9da905de8f4691 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sat, 8 Sep 2012 04:39:11 +0000 Subject: Removed most llappearance -> llui dependencies (LLTrans remains). Moved LLInventoryIcon::EIconName into LLInventoryType. Moved LLInventoryIcon back to newview. Moved LLUI gl_* functions into llrender. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llappviewer.cpp | 2 +- indra/newview/llfloaterbuycontents.cpp | 1 + indra/newview/llglsandbox.cpp | 8 +- indra/newview/llinventorybridge.cpp | 3 +- indra/newview/llinventoryicon.cpp | 183 ++++++++++++++++++++++++++++++ indra/newview/llinventoryicon.h | 56 +++++++++ indra/newview/llinventorylistitem.cpp | 1 + indra/newview/llmediactrl.cpp | 18 +-- indra/newview/llpanelgroupnotices.cpp | 1 + indra/newview/llpanelobjectinventory.cpp | 1 + indra/newview/lltoastgroupnotifypanel.cpp | 1 + indra/newview/llviewerdisplay.cpp | 10 +- indra/newview/llviewerwindow.cpp | 12 +- indra/newview/llwearableitemslist.cpp | 1 + indra/newview/llworldmapview.cpp | 2 +- 16 files changed, 275 insertions(+), 27 deletions(-) create mode 100644 indra/newview/llinventoryicon.cpp create mode 100644 indra/newview/llinventoryicon.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 21b1512e58..a17a3b11ec 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -304,6 +304,7 @@ set(viewer_SOURCE_FILES llinventorybridge.cpp llinventoryfilter.cpp llinventoryfunctions.cpp + llinventoryicon.cpp llinventoryitemslist.cpp llinventorylistitem.cpp llinventorymodel.cpp @@ -872,6 +873,7 @@ set(viewer_HEADER_FILES llinventorybridge.h llinventoryfilter.h llinventoryfunctions.h + llinventoryicon.h llinventoryitemslist.h llinventorylistitem.h llinventorymodel.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6ca77ba4dd..fbf15ff5ce 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -771,7 +771,7 @@ bool LLAppViewer::init() LLUI::initClass(settings_map, LLUIImageList::getInstance(), ui_audio_callback, - &LLUI::sGLScaleFactor); + &LLUI::getScaleFactor()); LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ; // Setup paths and LLTrans after LLUI::initClass has been called. diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index 809d344d01..df802f0a0e 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -40,6 +40,7 @@ #include "llcheckboxctrl.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" +#include "llinventoryicon.h" #include "llinventorymodel.h" // for gInventory #include "llfirstuse.h" #include "llfloaterreg.h" diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 1208c9378e..60fa53f491 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -79,10 +79,10 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) S32 top = llmax(y, mDragStartY); S32 bottom =llmin(y, mDragStartY); - left = llround((F32) left * LLUI::sGLScaleFactor.mV[VX]); - right = llround((F32) right * LLUI::sGLScaleFactor.mV[VX]); - top = llround((F32) top * LLUI::sGLScaleFactor.mV[VY]); - bottom = llround((F32) bottom * LLUI::sGLScaleFactor.mV[VY]); + left = llround((F32) left * LLUI::getScaleFactor().mV[VX]); + right = llround((F32) right * LLUI::getScaleFactor().mV[VX]); + top = llround((F32) top * LLUI::getScaleFactor().mV[VY]); + bottom = llround((F32) bottom * LLUI::getScaleFactor().mV[VY]); F32 old_far_plane = LLViewerCamera::getInstance()->getFar(); F32 old_near_plane = LLViewerCamera::getInstance()->getNear(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index dc6147898a..4834d8dd70 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -50,6 +50,7 @@ #include "llclipboard.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" +#include "llinventoryicon.h" #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" @@ -1510,7 +1511,7 @@ LLUIImagePtr LLItemBridge::getIcon() const mIsLink); } - return LLInventoryIcon::getIcon(LLInventoryIcon::ICONNAME_OBJECT); + return LLInventoryIcon::getIcon(LLInventoryType::ICONNAME_OBJECT); } PermissionMask LLItemBridge::getPermissionMask() const diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp new file mode 100644 index 0000000000..14efc25fb9 --- /dev/null +++ b/indra/newview/llinventoryicon.cpp @@ -0,0 +1,183 @@ +/** + * @file llinventoryicon.cpp + * @brief Implementation of the inventory icon. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llinventoryicon.h" + +#include "lldictionary.h" +#include "llinventorydefines.h" +#include "llui.h" +#include "llwearabletype.h" + +struct IconEntry : public LLDictionaryEntry +{ + IconEntry(const std::string &item_name) + : + LLDictionaryEntry(item_name) + {} +}; + +class LLIconDictionary : public LLSingleton, + public LLDictionary +{ +public: + LLIconDictionary(); +}; + +LLIconDictionary::LLIconDictionary() +{ + addEntry(LLInventoryType::ICONNAME_TEXTURE, new IconEntry("Inv_Texture")); + addEntry(LLInventoryType::ICONNAME_SOUND, new IconEntry("Inv_Sound")); + addEntry(LLInventoryType::ICONNAME_CALLINGCARD_ONLINE, new IconEntry("Inv_CallingCard")); + addEntry(LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE, new IconEntry("Inv_CallingCard")); + addEntry(LLInventoryType::ICONNAME_LANDMARK, new IconEntry("Inv_Landmark")); + addEntry(LLInventoryType::ICONNAME_LANDMARK_VISITED, new IconEntry("Inv_Landmark")); + addEntry(LLInventoryType::ICONNAME_SCRIPT, new IconEntry("Inv_Script")); + addEntry(LLInventoryType::ICONNAME_CLOTHING, new IconEntry("Inv_Clothing")); + addEntry(LLInventoryType::ICONNAME_OBJECT, new IconEntry("Inv_Object")); + addEntry(LLInventoryType::ICONNAME_OBJECT_MULTI, new IconEntry("Inv_Object_Multi")); + addEntry(LLInventoryType::ICONNAME_NOTECARD, new IconEntry("Inv_Notecard")); + addEntry(LLInventoryType::ICONNAME_BODYPART, new IconEntry("Inv_Skin")); + addEntry(LLInventoryType::ICONNAME_SNAPSHOT, new IconEntry("Inv_Snapshot")); + + addEntry(LLInventoryType::ICONNAME_BODYPART_SHAPE, new IconEntry("Inv_BodyShape")); + addEntry(LLInventoryType::ICONNAME_BODYPART_SKIN, new IconEntry("Inv_Skin")); + addEntry(LLInventoryType::ICONNAME_BODYPART_HAIR, new IconEntry("Inv_Hair")); + addEntry(LLInventoryType::ICONNAME_BODYPART_EYES, new IconEntry("Inv_Eye")); + + addEntry(LLInventoryType::ICONNAME_CLOTHING_SHIRT, new IconEntry("Inv_Shirt")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_PANTS, new IconEntry("Inv_Pants")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_SHOES, new IconEntry("Inv_Shoe")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_SOCKS, new IconEntry("Inv_Socks")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_JACKET, new IconEntry("Inv_Jacket")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_GLOVES, new IconEntry("Inv_Gloves")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, new IconEntry("Inv_Undershirt")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, new IconEntry("Inv_Underpants")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_SKIRT, new IconEntry("Inv_Skirt")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_ALPHA, new IconEntry("Inv_Alpha")); + addEntry(LLInventoryType::ICONNAME_CLOTHING_TATTOO, new IconEntry("Inv_Tattoo")); + addEntry(LLInventoryType::ICONNAME_ANIMATION, new IconEntry("Inv_Animation")); + addEntry(LLInventoryType::ICONNAME_GESTURE, new IconEntry("Inv_Gesture")); + + addEntry(LLInventoryType::ICONNAME_CLOTHING_PHYSICS, new IconEntry("Inv_Physics")); + + addEntry(LLInventoryType::ICONNAME_LINKITEM, new IconEntry("Inv_LinkItem")); + addEntry(LLInventoryType::ICONNAME_LINKFOLDER, new IconEntry("Inv_LinkFolder")); + addEntry(LLInventoryType::ICONNAME_MESH, new IconEntry("Inv_Mesh")); + + addEntry(LLInventoryType::ICONNAME_INVALID, new IconEntry("Inv_Invalid")); + + addEntry(LLInventoryType::ICONNAME_NONE, new IconEntry("NONE")); +} + +LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type, + LLInventoryType::EType inventory_type, + U32 misc_flag, + BOOL item_is_multi) +{ + const std::string& icon_name = getIconName(asset_type, inventory_type, misc_flag, item_is_multi); + return LLUI::getUIImage(icon_name); +} + +LLUIImagePtr LLInventoryIcon::getIcon(LLInventoryType::EIconName idx) +{ + return LLUI::getUIImage(getIconName(idx)); +} + +const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type, + LLInventoryType::EType inventory_type, + U32 misc_flag, + BOOL item_is_multi) +{ + LLInventoryType::EIconName idx = LLInventoryType::ICONNAME_OBJECT; + if (item_is_multi) + { + idx = LLInventoryType::ICONNAME_OBJECT_MULTI; + return getIconName(idx); + } + + switch(asset_type) + { + case LLAssetType::AT_TEXTURE: + idx = (inventory_type == LLInventoryType::IT_SNAPSHOT) ? LLInventoryType::ICONNAME_SNAPSHOT : LLInventoryType::ICONNAME_TEXTURE; + break; + case LLAssetType::AT_SOUND: + idx = LLInventoryType::ICONNAME_SOUND; + break; + case LLAssetType::AT_CALLINGCARD: + idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_CALLINGCARD_ONLINE : LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE; + break; + case LLAssetType::AT_LANDMARK: + idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_LANDMARK_VISITED : LLInventoryType::ICONNAME_LANDMARK; + break; + case LLAssetType::AT_SCRIPT: + case LLAssetType::AT_LSL_TEXT: + case LLAssetType::AT_LSL_BYTECODE: + idx = LLInventoryType::ICONNAME_SCRIPT; + break; + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_BODYPART: + idx = assignWearableIcon(misc_flag); + break; + case LLAssetType::AT_NOTECARD: + idx = LLInventoryType::ICONNAME_NOTECARD; + break; + case LLAssetType::AT_ANIMATION: + idx = LLInventoryType::ICONNAME_ANIMATION; + break; + case LLAssetType::AT_GESTURE: + idx = LLInventoryType::ICONNAME_GESTURE; + break; + case LLAssetType::AT_LINK: + idx = LLInventoryType::ICONNAME_LINKITEM; + break; + case LLAssetType::AT_LINK_FOLDER: + idx = LLInventoryType::ICONNAME_LINKFOLDER; + break; + case LLAssetType::AT_OBJECT: + idx = LLInventoryType::ICONNAME_OBJECT; + break; + case LLAssetType::AT_MESH: + idx = LLInventoryType::ICONNAME_MESH; + default: + break; + } + + return getIconName(idx); +} + + +const std::string& LLInventoryIcon::getIconName(LLInventoryType::EIconName idx) +{ + const IconEntry *entry = LLIconDictionary::instance().lookup(idx); + return entry->mName; +} + +LLInventoryType::EIconName LLInventoryIcon::assignWearableIcon(U32 misc_flag) +{ + const LLWearableType::EType wearable_type = LLWearableType::EType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & misc_flag); + return LLWearableType::getIconName(wearable_type); +} diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h new file mode 100644 index 0000000000..659448143d --- /dev/null +++ b/indra/newview/llinventoryicon.h @@ -0,0 +1,56 @@ +/** + * @file llinventoryfunctions.h + * @brief Miscellaneous inventory-related functions and classes + * class definition + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLINVENTORYICON_H +#define LL_LLINVENTORYICON_H + +#include "llassettype.h" +#include "llinventorytype.h" +#include "lluiimage.h" + +class LLInventoryIcon +{ +public: + static const std::string& getIconName(LLAssetType::EType asset_type, + LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE, + U32 misc_flag = 0, // different meanings depending on item type + BOOL item_is_multi = FALSE); + static const std::string& getIconName(LLInventoryType::EIconName idx); + + static LLUIImagePtr getIcon(LLAssetType::EType asset_type, + LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE, + U32 misc_flag = 0, // different meanings depending on item type + BOOL item_is_multi = FALSE); + static LLUIImagePtr getIcon(LLInventoryType::EIconName idx); + +protected: + static LLInventoryType::EIconName assignWearableIcon(U32 misc_flag); +}; +#endif // LL_LLINVENTORYICON_H + + + diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp index 3e0849a795..26041767fd 100644 --- a/indra/newview/llinventorylistitem.cpp +++ b/indra/newview/llinventorylistitem.cpp @@ -37,6 +37,7 @@ #include "lltextutil.h" // newview +#include "llinventoryicon.h" #include "llinventorymodel.h" #include "llviewerinventory.h" diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 7650fe9229..04744ab34c 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -119,8 +119,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : if(!getDecoupleTextureSize()) { - S32 screen_width = llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]); - S32 screen_height = llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]); + S32 screen_width = llround((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]); + S32 screen_height = llround((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]); setTextureSize(screen_width, screen_height); } @@ -469,8 +469,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) { if(!getDecoupleTextureSize()) { - S32 screen_width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]); - S32 screen_height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]); + S32 screen_width = llround((F32)width * LLUI::getScaleFactor().mV[VX]); + S32 screen_height = llround((F32)height * LLUI::getScaleFactor().mV[VY]); // when floater is minimized, these sizes are negative if ( screen_height > 0 && screen_width > 0 ) @@ -687,7 +687,7 @@ bool LLMediaCtrl::ensureMediaSourceExists() mMediaSource->addObserver( this ); mMediaSource->setBackgroundColor( getBackgroundColor() ); mMediaSource->setTrustedBrowser(mTrusted); - mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); + mMediaSource->setPageZoomFactor( LLUI::getScaleFactor().mV[ VX ] ); if(mClearCache) { @@ -770,7 +770,7 @@ void LLMediaCtrl::draw() { gGL.pushUIMatrix(); { - mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); + mMediaSource->setPageZoomFactor( LLUI::getScaleFactor().mV[ VX ] ); // scale texture to fit the space using texture coords gGL.getTexUnit(0)->bind(media_texture); @@ -884,14 +884,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); } - x = llround((F32)x * LLUI::sGLScaleFactor.mV[VX]); + x = llround((F32)x * LLUI::getScaleFactor().mV[VX]); if ( ! coords_opengl ) { - y = llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]); + y = llround((F32)(y) * LLUI::getScaleFactor().mV[VY]); } else { - y = llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]); + y = llround((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]); }; } diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 31c0e3d01a..9a3ea0774b 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -35,6 +35,7 @@ #include "llviewerinventory.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" +#include "llinventoryicon.h" #include "llinventorymodel.h" #include "llfloaterinventory.h" #include "llagent.h" diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 1ca24f3031..7c3425d71b 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -47,6 +47,7 @@ #include "llfolderview.h" #include "llinventorybridge.h" #include "llinventorydefines.h" +#include "llinventoryicon.h" #include "llinventoryfilter.h" #include "llinventoryfunctions.h" #include "llpreviewanim.h" diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index 75178a6ef8..64be5408be 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -33,6 +33,7 @@ #include "llbutton.h" #include "lliconctrl.h" #include "llinventoryfunctions.h" +#include "llinventoryicon.h" #include "llnotifications.h" #include "llviewertexteditor.h" diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 3b486efd7e..cc697f8510 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1440,7 +1440,7 @@ void render_ui_2d() gGL.pushMatrix(); S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); - gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); + gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f); gGL.translatef((F32)half_width, (F32)half_height, 0.f); F32 zoom = gAgentCamera.mHUDCurZoom; gGL.scalef(zoom,zoom,1.f); @@ -1478,10 +1478,10 @@ void render_ui_2d() LLUI::sDirtyRect = last_rect; last_rect = t_rect; - last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::sGLScaleFactor.mV[0]); - last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::sGLScaleFactor.mV[0]); - last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::sGLScaleFactor.mV[1]); - last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::sGLScaleFactor.mV[1]); + last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::getScaleFactor().mV[0]); + last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::getScaleFactor().mV[0]); + last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::getScaleFactor().mV[1]); + last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::getScaleFactor().mV[1]); LLRect clip_rect(last_rect); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d5ca01931f..dd29260f70 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2140,7 +2140,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) calcDisplayScale(); - BOOL display_scale_changed = mDisplayScale != LLUI::sGLScaleFactor; + BOOL display_scale_changed = mDisplayScale != LLUI::getScaleFactor(); LLUI::setScaleFactor(mDisplayScale); // update our window rectangle @@ -2346,7 +2346,7 @@ void LLViewerWindow::draw() // scale view by UI global scale factor and aspect ratio correction factor gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); - LLVector2 old_scale_factor = LLUI::sGLScaleFactor; + LLVector2 old_scale_factor = LLUI::getScaleFactor(); // apply camera zoom transform (for high res screenshots) F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); @@ -2360,7 +2360,7 @@ void LLViewerWindow::draw() (F32)getWindowHeightScaled() * -(F32)pos_y, 0.f); gGL.scalef(zoom_factor, zoom_factor, 1.f); - LLUI::sGLScaleFactor *= zoom_factor; + LLUI::getScaleFactor() *= zoom_factor; } // Draw tool specific overlay on world @@ -2408,7 +2408,7 @@ void LLViewerWindow::draw() LLFontGL::HCENTER, LLFontGL::TOP); } - LLUI::sGLScaleFactor = old_scale_factor; + LLUI::setScaleFactor(old_scale_factor); } LLUI::popMatrix(); gGL.popMatrix(); @@ -3208,8 +3208,8 @@ void LLViewerWindow::updateLayout() void LLViewerWindow::updateMouseDelta() { - S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); - S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); + S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::getScaleFactor().mV[VX]); + S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::getScaleFactor().mV[VY]); //RN: fix for asynchronous notification of mouse leaving window not working LLCoordWindow mouse_pos; diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index c7e9215643..c196d70617 100755 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -34,6 +34,7 @@ #include "llagentwearables.h" #include "llappearancemgr.h" #include "llinventoryfunctions.h" +#include "llinventoryicon.h" #include "lltransutil.h" #include "llviewerattachmenu.h" #include "llvoavatarself.h" diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index a3ccf87cfc..428be8efb9 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -421,7 +421,7 @@ void LLWorldMapView::draw() { // Inform the fetch mechanism of the size we need S32 draw_size = llround(sMapScale); - overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); + overlayimage->setKnownDrawSize(llround(draw_size * LLUI::getScaleFactor().mV[VX]), llround(draw_size * LLUI::getScaleFactor().mV[VY])); // Draw something whenever we have enough info if (overlayimage->hasGLTexture()) { -- cgit v1.2.3 From e1580128ab2a42ecd4019ef35069f9e939dc4ff2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sun, 9 Sep 2012 12:12:19 +0000 Subject: Fixed crashes on login. Moved most of the remaining character/skeleton generation code into llappearance. Moved non-rendering related LLViewerJoint functionality into LLAvatarJoint. --- indra/newview/llfloaterimagepreview.cpp | 4 +- indra/newview/llviewerjoint.cpp | 356 ++------------------------------ indra/newview/llviewerjoint.h | 76 +------ indra/newview/llviewerjointmesh.cpp | 15 -- indra/newview/llviewerjointmesh.h | 7 +- indra/newview/llvoavatar.cpp | 246 +++++++--------------- indra/newview/llvoavatar.h | 7 +- indra/newview/llvoavatarself.cpp | 66 ------ indra/newview/llvoavatarself.h | 1 - 9 files changed, 100 insertions(+), 678 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 887cd2f4b0..3b472a2862 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -614,7 +614,7 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const } mDummyAvatar->mRoot->setVisible(FALSE, TRUE); - mTargetMesh = (LLViewerJointMesh*)mDummyAvatar->mRoot->findJoint(mesh_name); + mTargetMesh = dynamic_cast(mDummyAvatar->mRoot->findJoint(mesh_name)); mTargetMesh->setTestTexture(mTextureName); mTargetMesh->setVisible(TRUE, FALSE); mCameraDistance = distance; @@ -631,7 +631,7 @@ void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name) { if (mDummyAvatar) { - LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot->findJoint(mesh_name); + LLViewerJointMesh *mesh = dynamic_cast(mDummyAvatar->mRoot->findJoint(mesh_name)); // clear out existing test mesh if (mesh) { diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index bb45cf89fc..e46299f9d2 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -35,50 +35,26 @@ #include "llrender.h" #include "llmath.h" #include "llglheaders.h" -#include "llrendersphere.h" #include "llvoavatar.h" #include "pipeline.h" -#define DEFAULT_LOD 0.0f - -const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64; - -//----------------------------------------------------------------------------- -// Static Data -//----------------------------------------------------------------------------- -BOOL LLViewerJoint::sDisableLOD = FALSE; +static const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64; //----------------------------------------------------------------------------- // LLViewerJoint() -// Class Constructor +// Class Constructors //----------------------------------------------------------------------------- -LLViewerJoint::LLViewerJoint() - : LLAvatarJoint() -{ - init(); -} +LLViewerJoint::LLViewerJoint() : + LLAvatarJoint() +{ } +LLViewerJoint::LLViewerJoint(const std::string &name, LLJoint *parent) : + LLAvatarJoint(name, parent) +{ } -//----------------------------------------------------------------------------- -// LLViewerJoint() -// Class Constructor -//----------------------------------------------------------------------------- -LLViewerJoint::LLViewerJoint(const std::string &name, LLJoint *parent) - : LLAvatarJoint(name, parent) -{ - init(); -} - - -void LLViewerJoint::init() -{ - mValid = FALSE; - mComponents = SC_JOINT | SC_BONE | SC_AXES; - mMinPixelArea = DEFAULT_LOD; - mPickName = PN_DEFAULT; - mVisible = TRUE; - mMeshID = 0; -} +LLViewerJoint::LLViewerJoint(S32 joint_num) : + LLAvatarJoint(joint_num) +{ } //----------------------------------------------------------------------------- @@ -89,129 +65,6 @@ LLViewerJoint::~LLViewerJoint() { } - -//-------------------------------------------------------------------- -// renderSkeleton() -// DEBUG (UNUSED) -//-------------------------------------------------------------------- -// void LLViewerJoint::renderSkeleton(BOOL recursive) -// { -// F32 nc = 0.57735f; - -// //---------------------------------------------------------------- -// // push matrix stack -// //---------------------------------------------------------------- -// gGL.pushMatrix(); - -// //---------------------------------------------------------------- -// // render the bone to my parent -// //---------------------------------------------------------------- -// if (mComponents & SC_BONE) -// { -// drawBone(); -// } - -// //---------------------------------------------------------------- -// // offset to joint position and -// // rotate to our orientation -// //---------------------------------------------------------------- -// gGL.loadIdentity(); -// gGL.multMatrix( &getWorldMatrix().mMatrix[0][0] ); - -// //---------------------------------------------------------------- -// // render joint axes -// //---------------------------------------------------------------- -// if (mComponents & SC_AXES) -// { -// gGL.begin(LLRender::LINES); -// gGL.color3f( 1.0f, 0.0f, 0.0f ); -// gGL.vertex3f( 0.0f, 0.0f, 0.0f ); -// gGL.vertex3f( 0.1f, 0.0f, 0.0f ); - -// gGL.color3f( 0.0f, 1.0f, 0.0f ); -// gGL.vertex3f( 0.0f, 0.0f, 0.0f ); -// gGL.vertex3f( 0.0f, 0.1f, 0.0f ); - -// gGL.color3f( 0.0f, 0.0f, 1.0f ); -// gGL.vertex3f( 0.0f, 0.0f, 0.0f ); -// gGL.vertex3f( 0.0f, 0.0f, 0.1f ); -// gGL.end(); -// } - -// //---------------------------------------------------------------- -// // render the joint graphic -// //---------------------------------------------------------------- -// if (mComponents & SC_JOINT) -// { -// gGL.color3f( 1.0f, 1.0f, 0.0f ); - -// gGL.begin(LLRender::TRIANGLES); - -// // joint top half -// glNormal3f(nc, nc, nc); -// gGL.vertex3f(0.0f, 0.0f, 0.05f); -// gGL.vertex3f(0.05f, 0.0f, 0.0f); -// gGL.vertex3f(0.0f, 0.05f, 0.0f); - -// glNormal3f(-nc, nc, nc); -// gGL.vertex3f(0.0f, 0.0f, 0.05f); -// gGL.vertex3f(0.0f, 0.05f, 0.0f); -// gGL.vertex3f(-0.05f, 0.0f, 0.0f); - -// glNormal3f(-nc, -nc, nc); -// gGL.vertex3f(0.0f, 0.0f, 0.05f); -// gGL.vertex3f(-0.05f, 0.0f, 0.0f); -// gGL.vertex3f(0.0f, -0.05f, 0.0f); - -// glNormal3f(nc, -nc, nc); -// gGL.vertex3f(0.0f, 0.0f, 0.05f); -// gGL.vertex3f(0.0f, -0.05f, 0.0f); -// gGL.vertex3f(0.05f, 0.0f, 0.0f); - -// // joint bottom half -// glNormal3f(nc, nc, -nc); -// gGL.vertex3f(0.0f, 0.0f, -0.05f); -// gGL.vertex3f(0.0f, 0.05f, 0.0f); -// gGL.vertex3f(0.05f, 0.0f, 0.0f); - -// glNormal3f(-nc, nc, -nc); -// gGL.vertex3f(0.0f, 0.0f, -0.05f); -// gGL.vertex3f(-0.05f, 0.0f, 0.0f); -// gGL.vertex3f(0.0f, 0.05f, 0.0f); - -// glNormal3f(-nc, -nc, -nc); -// gGL.vertex3f(0.0f, 0.0f, -0.05f); -// gGL.vertex3f(0.0f, -0.05f, 0.0f); -// gGL.vertex3f(-0.05f, 0.0f, 0.0f); - -// glNormal3f(nc, -nc, -nc); -// gGL.vertex3f(0.0f, 0.0f, -0.05f); -// gGL.vertex3f(0.05f, 0.0f, 0.0f); -// gGL.vertex3f(0.0f, -0.05f, 0.0f); - -// gGL.end(); -// } - -// //---------------------------------------------------------------- -// // render children -// //---------------------------------------------------------------- -// if (recursive) -// { -// for (child_list_t::iterator iter = mChildren.begin(); -// iter != mChildren.end(); ++iter) -// { -// LLViewerJoint* joint = (LLViewerJoint*)(*iter); -// joint->renderSkeleton(); -// } -// } - -// //---------------------------------------------------------------- -// // pop matrix stack -// //---------------------------------------------------------------- -// gGL.popMatrix(); -// } - - //-------------------------------------------------------------------- // render() //-------------------------------------------------------------------- @@ -292,13 +145,13 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); + LLAvatarJoint* joint = dynamic_cast(*iter); F32 jointLOD = joint->getLOD(); if (pixelArea >= jointLOD || sDisableLOD) { triangle_count += joint->render( pixelArea, TRUE, is_dummy ); - if (jointLOD != DEFAULT_LOD) + if (jointLOD != DEFAULT_AVATAR_JOINT_LOD) { break; } @@ -308,72 +161,6 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) return triangle_count; } - -//-------------------------------------------------------------------- -// drawBone() -// DEBUG (UNUSED) -//-------------------------------------------------------------------- -// void LLViewerJoint::drawBone() -// { -// if ( mParent == NULL ) -// return; - -// F32 boneSize = 0.02f; - -// // rotate to point to child (bone direction) -// gGL.pushMatrix(); - -// LLVector3 boneX = getPosition(); -// F32 length = boneX.normVec(); - -// LLVector3 boneZ(1.0f, 0.0f, 1.0f); - -// LLVector3 boneY = boneZ % boneX; -// boneY.normVec(); - -// boneZ = boneX % boneY; - -// LLMatrix4 rotateMat; -// rotateMat.setFwdRow( boneX ); -// rotateMat.setLeftRow( boneY ); -// rotateMat.setUpRow( boneZ ); -// gGL.multMatrix( &rotateMat.mMatrix[0][0] ); - -// // render the bone -// gGL.color3f( 0.5f, 0.5f, 0.0f ); - -// gGL.begin(LLRender::TRIANGLES); - -// gGL.vertex3f( length, 0.0f, 0.0f); -// gGL.vertex3f( 0.0f, boneSize, 0.0f); -// gGL.vertex3f( 0.0f, 0.0f, boneSize); - -// gGL.vertex3f( length, 0.0f, 0.0f); -// gGL.vertex3f( 0.0f, 0.0f, -boneSize); -// gGL.vertex3f( 0.0f, boneSize, 0.0f); - -// gGL.vertex3f( length, 0.0f, 0.0f); -// gGL.vertex3f( 0.0f, -boneSize, 0.0f); -// gGL.vertex3f( 0.0f, 0.0f, -boneSize); - -// gGL.vertex3f( length, 0.0f, 0.0f); -// gGL.vertex3f( 0.0f, 0.0f, boneSize); -// gGL.vertex3f( 0.0f, -boneSize, 0.0f); - -// gGL.end(); - -// // restore matrix -// gGL.popMatrix(); -// } - -//-------------------------------------------------------------------- -// isTransparent() -//-------------------------------------------------------------------- -BOOL LLViewerJoint::isTransparent() -{ - return FALSE; -} - //-------------------------------------------------------------------- // drawShape() //-------------------------------------------------------------------- @@ -382,121 +169,4 @@ U32 LLViewerJoint::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) return 0; } -//-------------------------------------------------------------------- -// setSkeletonComponents() -//-------------------------------------------------------------------- -void LLViewerJoint::setSkeletonComponents( U32 comp, BOOL recursive ) -{ - mComponents = comp; - if (recursive) - { - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->setSkeletonComponents(comp, recursive); - } - } -} - -void LLViewerJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area) -{ - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->updateFaceSizes(num_vertices, num_indices, pixel_area); - } -} - -void LLViewerJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) -{ - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->updateFaceData(face, pixel_area, damp_wind, terse_update); - } -} - -void LLViewerJoint::updateJointGeometry() -{ - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->updateJointGeometry(); - } -} - - -BOOL LLViewerJoint::updateLOD(F32 pixel_area, BOOL activate) -{ - BOOL lod_changed = FALSE; - BOOL found_lod = FALSE; - - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - F32 jointLOD = joint->getLOD(); - - if (found_lod || jointLOD == DEFAULT_LOD) - { - // we've already found a joint to enable, so enable the rest as alternatives - lod_changed |= joint->updateLOD(pixel_area, TRUE); - } - else - { - if (pixel_area >= jointLOD || sDisableLOD) - { - lod_changed |= joint->updateLOD(pixel_area, TRUE); - found_lod = TRUE; - } - else - { - lod_changed |= joint->updateLOD(pixel_area, FALSE); - } - } - } - return lod_changed; -} - -void LLViewerJoint::dump() -{ - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->dump(); - } -} - -void LLViewerJoint::setVisible(BOOL visible, BOOL recursive) -{ - mVisible = visible; - - if (recursive) - { - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->setVisible(visible, recursive); - } - } -} - - -void LLViewerJoint::setMeshesToChildren() -{ - removeAllChildren(); - for (std::vector::iterator iter = mMeshParts.begin(); - iter != mMeshParts.end(); iter++) - { - addChild((LLViewerJointMesh *) *iter); - } -} - - // End diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h index 37c80dafeb..fd262b6e80 100644 --- a/indra/newview/llviewerjoint.h +++ b/indra/newview/llviewerjoint.h @@ -40,95 +40,25 @@ class LLViewerJointMesh; // class LLViewerJoint //----------------------------------------------------------------------------- class LLViewerJoint : - public LLAvatarJoint + public virtual LLAvatarJoint { public: LLViewerJoint(); + LLViewerJoint(S32 joint_num); + // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform* LLViewerJoint(const std::string &name, LLJoint *parent = NULL); virtual ~LLViewerJoint(); - // Gets the validity of this joint - BOOL getValid() { return mValid; } - - // Primarily for debugging and character setup - // Derived classes may add text/graphic output. - // Draw skeleton graphic for debugging and character setup - void renderSkeleton(BOOL recursive=TRUE); // debug only (unused) - - // Draws a bone graphic to the parent joint. - // Derived classes may add text/graphic output. - // Called by renderSkeleton(). - void drawBone(); // debug only (unused) - // Render character hierarchy. // Traverses the entire joint hierarchy, setting up // transforms and calling the drawShape(). // Derived classes may add text/graphic output. virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); // Returns triangle count - // Returns true if this object is transparent. - // This is used to determine in which order to draw objects. - virtual BOOL isTransparent(); - - // Returns true if this object should inherit scale modifiers from its immediate parent - virtual BOOL inheritScale() { return FALSE; } - // Draws the shape attached to a joint. // Called by render(). virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); virtual void drawNormals() {} - - enum Components - { - SC_BONE = 1, - SC_JOINT = 2, - SC_AXES = 4 - }; - - // Selects which skeleton components to draw - void setSkeletonComponents( U32 comp, BOOL recursive = TRUE ); - - // Returns which skeleton components are enables for drawing - U32 getSkeletonComponents() { return mComponents; } - - // Sets the level of detail for this node as a minimum - // pixel area threshold. If the current pixel area for this - // object is less than the specified threshold, the node is - // not traversed. In addition, if a value is specified (not - // default of 0.0), and the pixel area is larger than the - // specified minimum, the node is rendered, but no other siblings - // of this node under the same parent will be. - F32 getLOD() { return mMinPixelArea; } - void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; } - - void setPickName(LLJointPickName name) { mPickName = name; } - LLJointPickName getPickName() { return mPickName; } - - virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); - virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false); - virtual BOOL updateLOD(F32 pixel_area, BOOL activate); - virtual void updateJointGeometry(); - virtual void dump(); - - void setVisible( BOOL visible, BOOL recursive ); - - // Takes meshes in mMeshParts and sets each one as a child joint - void setMeshesToChildren(); - -public: - static BOOL sDisableLOD; - std::vector mMeshParts; - void setMeshID( S32 id ) {mMeshID = id;} - -protected: - void init(); - - BOOL mValid; - U32 mComponents; - F32 mMinPixelArea; - LLJointPickName mPickName; - BOOL mVisible; - S32 mMeshID; }; #endif // LL_LLVIEWERJOINT_H diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 8d479ab0bf..64454a03d1 100755 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -200,21 +200,6 @@ void LLViewerJointMesh::uploadJointMatrices() } } -//-------------------------------------------------------------------- -// LLViewerJointMesh::drawBone() -//-------------------------------------------------------------------- -void LLViewerJointMesh::drawBone() -{ -} - -//-------------------------------------------------------------------- -// LLViewerJointMesh::isTransparent() -//-------------------------------------------------------------------- -BOOL LLViewerJointMesh::isTransparent() -{ - return mIsTransparent; -} - //-------------------------------------------------------------------- // DrawElementsBLEND and utility code //-------------------------------------------------------------------- diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index 039175830f..64887152a6 100755 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -41,9 +41,8 @@ class LLViewerTexLayerSet; //----------------------------------------------------------------------------- // class LLViewerJointMesh //----------------------------------------------------------------------------- -class LLViewerJointMesh : public LLAvatarJointMesh +class LLViewerJointMesh : public LLAvatarJointMesh, public LLViewerJoint { - friend class LLVOAvatar; public: // Constructor LLViewerJointMesh(); @@ -55,8 +54,6 @@ public: void uploadJointMatrices(); // overloaded from base class - /*virtual*/ void drawBone(); - /*virtual*/ BOOL isTransparent(); /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ); /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); @@ -65,8 +62,6 @@ public: /*virtual*/ void updateJointGeometry(); /*virtual*/ void dump(); - void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; } - /*virtual*/ BOOL isAnimatable() const { return FALSE; } private: diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f0f469e959..081f1d62ca 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -24,12 +24,6 @@ * $/LicenseInfo$ */ -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#endif - #include "llviewerprecompiledheaders.h" #include "llvoavatar.h" @@ -109,12 +103,6 @@ extern F32 SPEED_ADJUST_MAX_SEC; extern F32 ANIM_SPEED_MAX; extern F32 ANIM_SPEED_MIN; -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - -#include // #define OUTPUT_BREAST_DATA @@ -783,7 +771,7 @@ BOOL LLVOAvatar::isFullyTextured() const { for (S32 i = 0; i < mMeshLOD.size(); i++) { - LLViewerJoint* joint = (LLViewerJoint*) mMeshLOD[i]; + LLAvatarJoint* joint = mMeshLOD[i]; if (i==MESH_ID_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT)) { continue; // don't care about skirt textures if we're not wearing one. @@ -792,19 +780,19 @@ BOOL LLVOAvatar::isFullyTextured() const { continue; // nonexistent LOD OK. } - std::vector::iterator meshIter = joint->mMeshParts.begin(); + avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin(); if (meshIter != joint->mMeshParts.end()) { - LLViewerJointMesh *mesh = (LLViewerJointMesh *) *meshIter; + LLAvatarJointMesh *mesh = (*meshIter); if (!mesh) { continue; // nonexistent mesh OK } - if (mesh->mTexture.notNull() && mesh->mTexture->hasGLTexture()) + if (mesh->hasGLTexture()) { continue; // Mesh exists and has a baked texture. } - if (mesh->mLayerSet && mesh->mLayerSet->hasComposite()) + if (mesh->hasComposite()) { continue; // Mesh exists and has a composite texture. } @@ -1056,84 +1044,9 @@ void LLVOAvatar::cleanupClass() sXMLTree.cleanup(); } +// virtual void LLVOAvatar::initInstance(void) { - //------------------------------------------------------------------------- - // initialize joint, mesh and shape members - //------------------------------------------------------------------------- - if (mRoot) - { - delete mRoot; - } - mRoot = new LLViewerJoint(); - mRoot->setName( "mRoot" ); - - for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); - iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); - ++iter) - { - const EMeshIndex mesh_index = iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; - LLViewerJoint* joint = new LLViewerJoint(); - joint->setName(mesh_dict->mName); - joint->setMeshID(mesh_index); - mMeshLOD.push_back(joint); - - /* mHairLOD.setName("mHairLOD"); - mHairMesh0.setName("mHairMesh0"); - mHairMesh0.setMeshID(MESH_ID_HAIR); - mHairMesh1.setName("mHairMesh1"); */ - for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) - { - LLViewerJointMesh* mesh = new LLViewerJointMesh(); - std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast(lod); - // We pre-pended an m - need to capitalize first character for camelCase - mesh_name[1] = toupper(mesh_name[1]); - mesh->setName(mesh_name); - mesh->setMeshID(mesh_index); - mesh->setPickName(mesh_dict->mPickName); - mesh->setIsTransparent(FALSE); - switch((int)mesh_index) - { - case MESH_ID_HAIR: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_SKIRT: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_EYEBALL_LEFT: - case MESH_ID_EYEBALL_RIGHT: - mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); - break; - } - - joint->mMeshParts.push_back(mesh); - } - } - - //------------------------------------------------------------------------- - // associate baked textures with meshes - //------------------------------------------------------------------------- - for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); - iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); - ++iter) - { - const EMeshIndex mesh_index = iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; - const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; - // Skip it if there's no associated baked texture. - if (baked_texture_index == BAKED_NUM_INDICES) continue; - - for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); - iter != mMeshLOD[mesh_index]->mMeshParts.end(); - ++iter) - { - LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; - mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh); - } - } - - //------------------------------------------------------------------------- // register motions //------------------------------------------------------------------------- @@ -1192,10 +1105,9 @@ void LLVOAvatar::initInstance(void) registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); - } - - buildCharacter(); + + LLAvatarAppearance::initInstance(); // preload specific motions here createMotion( ANIM_AGENT_CUSTOMIZE); @@ -1204,7 +1116,30 @@ void LLVOAvatar::initInstance(void) //VTPause(); // VTune mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) ); +} + +// virtual +LLAvatarJoint* LLVOAvatar::createAvatarJoint() +{ + return new LLViewerJoint(); +} +// virtual +LLAvatarJoint* LLVOAvatar::createAvatarJoint(S32 joint_num) +{ + return new LLViewerJoint(joint_num); +} + +// virtual +LLAvatarJointMesh* LLVOAvatar::createAvatarJointMesh() +{ + return new LLViewerJointMesh(); +} + +// virtual +LLTexLayerSet* LLVOAvatar::createTexLayerSet() +{ + return new LLViewerTexLayerSet(this); } const LLVector3 LLVOAvatar::getRenderPosition() const @@ -1279,7 +1214,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) float max_attachment_span = get_default_max_prim_scale() * 5.0f; //stretch bounding box by joint positions - for (polymesh_map_t::iterator i = mMeshes.begin(); i != mMeshes.end(); ++i) + for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i) { LLPolyMesh* mesh = i->second; for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++) @@ -1551,23 +1486,11 @@ void LLVOAvatar::startDefaultMotions() // virtual void LLVOAvatar::buildCharacter() { - //------------------------------------------------------------------------- - // clear mesh data - //------------------------------------------------------------------------- - for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); ++jointIter) - { - LLViewerJoint* joint = (LLViewerJoint*) *jointIter; - for (std::vector::iterator meshIter = joint->mMeshParts.begin(); - meshIter != joint->mMeshParts.end(); ++meshIter) - { - LLViewerJointMesh * mesh = (LLViewerJointMesh *) *meshIter; - mesh->setMesh(NULL); - } - } - LLAvatarAppearance::buildCharacter(); + // Not done building yet; more to do. + mIsBuilt = FALSE; + //------------------------------------------------------------------------- // set head offset from pelvis //------------------------------------------------------------------------- @@ -1600,6 +1523,9 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- processAnimationStateChanges(); + mIsBuilt = TRUE; + stop_glerror(); + mMeshValid = TRUE; } @@ -1619,11 +1545,11 @@ void LLVOAvatar::releaseMeshData() //llinfos << "Releasing" << llendl; // cleanup mesh data - for (std::vector::iterator iter = mMeshLOD.begin(); + for (avatar_joint_list_t::iterator iter = mMeshLOD.begin(); iter != mMeshLOD.end(); ++iter) { - LLViewerJoint* joint = (LLViewerJoint*) *iter; + LLAvatarJoint* joint = (*iter); joint->setValid(FALSE, TRUE); } @@ -4718,10 +4644,12 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name ) //----------------------------------------------------------------------------- void LLVOAvatar::resetJointPositions( void ) { - for(S32 i = 0; i < (S32)mNumJoints; ++i) + avatar_joint_list_t::iterator iter = mSkeleton.begin(); + avatar_joint_list_t::iterator end = mSkeleton.end(); + for (; iter != end; ++iter) { - mSkeleton[i].restoreOldXform(); - mSkeleton[i].setId( LLUUID::null ); + (*iter)->restoreOldXform(); + (*iter)->setId( LLUUID::null ); } mHasPelvisOffset = false; mPelvisFixup = mLastPelvisFixup; @@ -4753,16 +4681,17 @@ void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) //----------------------------------------------------------------------------- void LLVOAvatar::resetJointPositionsToDefault( void ) { - //Subsequent joints are relative to pelvis - for( S32 i = 0; i < (S32)mNumJoints; ++i ) + avatar_joint_list_t::iterator iter = mSkeleton.begin(); + avatar_joint_list_t::iterator end = mSkeleton.end(); + for (; iter != end; ++iter) { - LLJoint* pJoint = (LLJoint*)&mSkeleton[i]; + LLJoint* pJoint = (*iter); if ( pJoint->doesJointNeedToBeReset() ) { - pJoint->setId( LLUUID::null ); //restore joints to default positions, however skip over the pelvis + // *TODO: How does this pointer check skip over pelvis? if ( pJoint ) { pJoint->restoreOldXform(); @@ -4895,43 +4824,18 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) return gAgent.getPosAgentFromGlobal(position); } -//----------------------------------------------------------------------------- -// allocateCharacterJoints() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) -{ - deleteAndClearArray(mSkeleton); - mNumJoints = 0; - - mSkeleton = new LLViewerJoint[num]; - - for(S32 joint_num = 0; joint_num < (S32)num; joint_num++) - { - mSkeleton[joint_num].setJointNum(joint_num); - } - - if (!mSkeleton) - { - return FALSE; - } - - mNumJoints = num; - return TRUE; -} - - //----------------------------------------------------------------------------- // getCharacterJoint() //----------------------------------------------------------------------------- LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) { - if ((S32)num >= mNumJoints + if ((S32)num >= mSkeleton.size() || (S32)num < 0) { return NULL; } - return (LLJoint*)&mSkeleton[num]; + return mSkeleton[num]; } //----------------------------------------------------------------------------- @@ -4949,16 +4853,6 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion ) //virtual BOOL LLVOAvatar::loadSkeletonNode () { - // make meshes children before calling parent version of the function - for (std::vector::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); - ++iter) - { - LLViewerJoint *joint = (LLViewerJoint *) *iter; - joint->mUpdateXform = FALSE; - joint->setMeshesToChildren(); - } - if (!LLAvatarAppearance::loadSkeletonNode()) { return FALSE; @@ -5695,9 +5589,11 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex)) { LLColor4 color = mTexHairColor->getColor(); - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); @@ -5962,9 +5858,11 @@ void LLVOAvatar::updateMeshTextures() } mBakedTextureDatas[i].mIsUsed = TRUE; - for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setTexture( baked_img ); @@ -5996,9 +5894,11 @@ void LLVOAvatar::updateMeshTextures() layerset->createComposite(); layerset->setUpdatesEnabled( TRUE ); mBakedTextureDatas[i].mIsUsed = FALSE; - for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setLayerSet( layerset ); @@ -6014,9 +5914,11 @@ void LLVOAvatar::updateMeshTextures() { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); @@ -6778,9 +6680,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mIsLoaded = true; mBakedTextureDatas[i].mLastTextureIndex = id; mBakedTextureDatas[i].mIsUsed = true; - for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setTexture( image_baked ); @@ -6803,9 +6707,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // This is paired with similar code in updateMeshTextures that sets hair mesh color. if (i == BAKED_HAIR) { - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setColor( 1.f, 1.f, 1.f, 1.f ); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bda09b044d..cc94c2a3eb 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -172,7 +172,6 @@ public: virtual LLVector3 getCharacterVelocity(); virtual LLVector3 getCharacterAngularVelocity(); virtual LLJoint* getCharacterJoint(U32 num); - virtual BOOL allocateCharacterJoints(U32 num); virtual LLUUID remapMotionID(const LLUUID& id); virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); @@ -184,7 +183,6 @@ public: void dumpAnimationState(); virtual LLJoint* getJoint(const std::string &name); - virtual LLJoint* getRootJoint() { return mRoot; } void resetJointPositions( void ); void resetJointPositionsToDefault( void ); @@ -341,6 +339,10 @@ protected: ** SKELETON **/ +protected: + /*virtual*/ LLAvatarJoint* createAvatarJoint(); // Returns LLViewerJoint + /*virtual*/ LLAvatarJoint* createAvatarJoint(S32 joint_num); // Returns LLViewerJoint + /*virtual*/ LLAvatarJointMesh* createAvatarJointMesh(); // Returns LLViewerJointMesh public: void updateHeadOffset(); void setPelvisOffset( bool hasOffset, const LLVector3& translation, F32 offset ) ; @@ -521,6 +523,7 @@ public: // Baked textures //-------------------------------------------------------------------- public: + /*virtual*/ LLTexLayerSet* createTexLayerSet(); // Return LLViewerTexLayerSet void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY ! protected: static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index f832a126bd..96fd41739f 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -249,8 +249,6 @@ BOOL LLVOAvatarSelf::loadAvatarSelf() llwarns << "avatar file: buildSkeleton() failed" << llendl; return FALSE; } - // TODO: make loadLayersets() called only by self. - //success &= loadLayersets(); return success; } @@ -585,70 +583,6 @@ LLVOAvatarSelf::~LLVOAvatarSelf() ** ** *********************************************************************************/ -//virtual -BOOL LLVOAvatarSelf::loadLayersets() -{ - BOOL success = TRUE; - for (LLAvatarXmlInfo::layer_info_list_t::const_iterator iter = sAvatarXmlInfo->mLayerInfoList.begin(); - iter != sAvatarXmlInfo->mLayerInfoList.end(); - ++iter) - { - // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. - const LLTexLayerSetInfo *info = *iter; - LLViewerTexLayerSet* layer_set = new LLViewerTexLayerSet( this ); - - if (!layer_set->setInfo(info)) - { - stop_glerror(); - delete layer_set; - llwarns << "avatar file: layer_set->parseData() failed" << llendl; - return FALSE; - } - - // scan baked textures and associate the layerset with the appropriate one - EBakedTextureIndex baked_index = BAKED_NUM_INDICES; - for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); - ++baked_iter) - { - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; - if (layer_set->isBodyRegion(baked_dict->mName)) - { - baked_index = baked_iter->first; - // ensure both structures are aware of each other - mBakedTextureDatas[baked_index].mTexLayerSet = layer_set; - layer_set->setBakedTexIndex(baked_index); - break; - } - } - // if no baked texture was found, warn and cleanup - if (baked_index == BAKED_NUM_INDICES) - { - llwarns << " has invalid body_region attribute" << llendl; - delete layer_set; - return FALSE; - } - - // scan morph masks and let any affected layers know they have an associated morph - for (LLVOAvatar::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin(); - morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end(); - ++morph_iter) - { - LLMaskedMorph *morph = *morph_iter; - LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer); - if (layer) - { - layer->setHasMorph(TRUE); - } - else - { - llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl; - success = FALSE; - } - } - } - return success; -} // virtual BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent) { diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index bdc1ccf133..907564f8e1 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -69,7 +69,6 @@ protected: BOOL loadAvatarSelf(); BOOL buildSkeletonSelf(const LLAvatarSkeletonInfo *info); BOOL buildMenus(); - /*virtual*/ BOOL loadLayersets(); /** Initialization ** ** -- cgit v1.2.3 From 6504894be60134a66c938ffba64b57ea198c7264 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2012 11:17:27 -0400 Subject: more baked texture debugging under DebugAvatarCompositeBaked --- indra/newview/llvoavatar.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d92caf1edb..3b98a55360 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6804,6 +6804,16 @@ void LLVOAvatar::updateMeshTextures() } } } + else + { + for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + { + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor( LLColor4::blue ); + } + } + } } // set texture and color of hair manually if we are not using a baked image. -- cgit v1.2.3 From fc84d684500c2216aa270bffef865ee265927535 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2012 18:46:52 -0400 Subject: dumpArchetypeXML tweaks, appearance debugging --- indra/newview/llvoavatar.cpp | 41 ++++++++++++++++++++-------------------- indra/newview/llvoavatar.h | 2 +- indra/newview/llvoavatarself.cpp | 1 + indra/newview/llwearable.cpp | 6 ++++++ 4 files changed, 28 insertions(+), 22 deletions(-) mode change 100644 => 100755 indra/newview/llwearable.cpp (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e03c0c3dad..61816c1771 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7337,6 +7337,7 @@ bool LLVOAvatar::visualParamWeightsAreDefault() //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { + dumpArchetypeXML("process_start"); if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -7773,32 +7774,30 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) dirtyMesh(); } -void LLVOAvatar::dumpArchetypeXML(const std::string& filename ) +void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) { - std::string outfilename(filename); - if (outfilename.empty()) + std::string outprefix(prefix); + if (outprefix.empty()) { - std::string fullname = getFullname(); - if (!fullname.empty()) - { - typedef std::map file_num_type; - static file_num_type file_nums; - file_num_type::iterator it = file_nums.find(fullname); - S32 num = 0; - if (it != file_nums.end()) - { - num = it->second; - } - std::ostringstream temp; - temp << std::setw(4) << std::setfill('0') << num; - file_nums[fullname] = num+1; - outfilename = fullname + " " + temp.str() + ".xml"; - } + outprefix = getFullname(); + } + if (outprefix.empty()) + { + outprefix = std::string("new_archetype"); } - if (outfilename.empty()) + typedef std::map file_num_type; + static file_num_type file_nums; + file_num_type::iterator it = file_nums.find(outprefix); + S32 num = 0; + if (it != file_nums.end()) { - outfilename = std::string("new archetype.xml"); + num = it->second; } + std::ostringstream temp; + temp << std::setw(4) << std::setfill('0') << num; + file_nums[outprefix] = num+1; + std::string outfilename = outprefix + " " + temp.str() + ".xml"; + std::replace(outfilename.begin(),outfilename.end(),' ','_'); LLAPRFile outfile; outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,outfilename), LL_APR_WB ); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5ec2009971..62c8e68069 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -1016,7 +1016,7 @@ private: // General //-------------------------------------------------------------------- public: - void dumpArchetypeXML(const std::string& filename); + void dumpArchetypeXML(const std::string& prefix); static void dumpBakedStatus(); const std::string getBakedStatusForPrintout() const; void dumpAvatarTEs(const std::string& context) const; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 6c8cbc37f7..8791055695 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2706,6 +2706,7 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) gAgentCamera.changeCameraToCustomizeAvatar(); } + gAgentAvatarp->clearVisualParamWeights(); gAgentAvatarp->invalidateAll(); gAgentAvatarp->updateMeshTextures(); } diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp old mode 100644 new mode 100755 index 402504933c..3f07d6877c --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -619,6 +619,12 @@ void LLWearable::setTexturesToDefaults() void LLWearable::writeToAvatar() { if (!isAgentAvatarValid()) return; +#if 0 + if (!gAgentAvatarp->isUsingLocalAppearance()) + { + return; + } +#endif ESex old_sex = gAgentAvatarp->getSex(); -- cgit v1.2.3 From f1d6052e36ed6d817faedf9b32cb9d889395cd88 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 11 Sep 2012 11:59:45 -0400 Subject: SH-3264 Moved over a few more items to llappearance moved over: isWearingWearableType wearable::writeToAvatar wearable::mTEMap (stores LocalTextureObject*) more from wearable::import/export wearable::createVisualParams, etc --- indra/newview/llagentwearables.cpp | 6 +- indra/newview/llappearancemgr.cpp | 3 +- indra/newview/llpolymorph.cpp | 747 ---------------------------- indra/newview/llpolymorph.h | 182 ------- indra/newview/llscrollingpanelparam.cpp | 6 +- indra/newview/llscrollingpanelparambase.cpp | 2 +- indra/newview/llviewerwearable.cpp | 116 +---- indra/newview/llviewerwearable.h | 14 +- indra/newview/llvoavatar.cpp | 47 ++ indra/newview/llvoavatar.h | 1 + indra/newview/llvoavatarself.cpp | 33 +- indra/newview/llvoavatarself.h | 6 +- indra/newview/llwearablelist.cpp | 20 +- indra/newview/llwearablelist.h | 3 +- 14 files changed, 116 insertions(+), 1070 deletions(-) delete mode 100644 indra/newview/llpolymorph.cpp delete mode 100644 indra/newview/llpolymorph.h (limited to 'indra/newview') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 40cedc1b35..e2304e6db9 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -898,7 +898,7 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, // Try to recover by replacing missing wearable with a new one. LLNotificationsUtil::add("ReplacedMissingWearable"); lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; - LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type); + LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); setWearable(type,index,new_wearable); //new_wearable->writeToAvatar(TRUE); @@ -1048,7 +1048,7 @@ void LLAgentWearables::createStandardWearables() if (create[i]) { llassert(getWearableCount((LLWearableType::EType)i) == 0); - LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i); + LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i, gAgentAvatarp); ((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable); // no need to update here... LLUUID category_id = LLUUID::null; @@ -1786,7 +1786,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con { if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return; - LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type); + LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; LLPointer cb = wear ? new LLWearAndEditCallback : NULL; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 5717ebaf02..1e4e00d77d 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -665,7 +665,7 @@ void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type LLNotificationsUtil::add("ReplacedMissingWearable"); lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; - LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type); + LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); // Add a new one in the lost and found folder. const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); @@ -1841,6 +1841,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) // Fetch the wearables about to be worn. LLWearableList::instance().getAsset(found.mAssetID, found.mName, + gAgentAvatarp, found.mAssetType, onWearableAssetFetch, (void*)holder); diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp deleted file mode 100644 index d25d1420ee..0000000000 --- a/indra/newview/llpolymorph.cpp +++ /dev/null @@ -1,747 +0,0 @@ -/** - * @file llpolymorph.cpp - * @brief Implementation of LLPolyMesh class - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" - -#include "llpolymorph.h" -#include "llvoavatar.h" -#include "llwearable.h" -#include "llxmltree.h" -#include "llendianswizzle.h" - -//#include "../tools/imdebug/imdebug.h" - -const F32 NORMAL_SOFTEN_FACTOR = 0.65f; - -//----------------------------------------------------------------------------- -// LLPolyMorphData() -//----------------------------------------------------------------------------- -LLPolyMorphData::LLPolyMorphData(const std::string& morph_name) - : mName(morph_name) -{ - mNumIndices = 0; - mCurrentIndex = 0; - mTotalDistortion = 0.f; - mAvgDistortion.clear(); - mMaxDistortion = 0.f; - mVertexIndices = NULL; - mCoords = NULL; - mNormals = NULL; - mBinormals = NULL; - mTexCoords = NULL; - - mMesh = NULL; -} - -LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) : - mName(rhs.mName), - mNumIndices(rhs.mNumIndices), - mTotalDistortion(rhs.mTotalDistortion), - mAvgDistortion(rhs.mAvgDistortion), - mMaxDistortion(rhs.mMaxDistortion), - mVertexIndices(NULL), - mCoords(NULL), - mNormals(NULL), - mBinormals(NULL), - mTexCoords(NULL) -{ - const S32 numVertices = mNumIndices; - - mCoords = new LLVector4a[numVertices]; - mNormals = new LLVector4a[numVertices]; - mBinormals = new LLVector4a[numVertices]; - mTexCoords = new LLVector2[numVertices]; - mVertexIndices = new U32[numVertices]; - - for (S32 v=0; v < numVertices; v++) - { - mCoords[v] = rhs.mCoords[v]; - mNormals[v] = rhs.mNormals[v]; - mBinormals[v] = rhs.mBinormals[v]; - mTexCoords[v] = rhs.mTexCoords[v]; - mVertexIndices[v] = rhs.mVertexIndices[v]; - } -} - - -//----------------------------------------------------------------------------- -// ~LLPolyMorphData() -//----------------------------------------------------------------------------- -LLPolyMorphData::~LLPolyMorphData() -{ - delete [] mVertexIndices; - delete [] mCoords; - delete [] mNormals; - delete [] mBinormals; - delete [] mTexCoords; -} - -//----------------------------------------------------------------------------- -// loadBinary() -//----------------------------------------------------------------------------- -BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) -{ - S32 numVertices; - S32 numRead; - - numRead = fread(&numVertices, sizeof(S32), 1, fp); - llendianswizzle(&numVertices, sizeof(S32), 1); - if (numRead != 1) - { - llwarns << "Can't read number of morph target vertices" << llendl; - return FALSE; - } - - //------------------------------------------------------------------------- - // allocate vertices - //------------------------------------------------------------------------- - mCoords = new LLVector4a[numVertices]; - mNormals = new LLVector4a[numVertices]; - mBinormals = new LLVector4a[numVertices]; - mTexCoords = new LLVector2[numVertices]; - // Actually, we are allocating more space than we need for the skiplist - mVertexIndices = new U32[numVertices]; - mNumIndices = 0; - mTotalDistortion = 0.f; - mMaxDistortion = 0.f; - mAvgDistortion.clear(); - mMesh = mesh; - - //------------------------------------------------------------------------- - // read vertices - //------------------------------------------------------------------------- - for(S32 v = 0; v < numVertices; v++) - { - numRead = fread(&mVertexIndices[v], sizeof(U32), 1, fp); - llendianswizzle(&mVertexIndices[v], sizeof(U32), 1); - if (numRead != 1) - { - llwarns << "Can't read morph target vertex number" << llendl; - return FALSE; - } - - if (mVertexIndices[v] > 10000) - { - llerrs << "Bad morph index: " << mVertexIndices[v] << llendl; - } - - - numRead = fread(&mCoords[v], sizeof(F32), 3, fp); - llendianswizzle(&mCoords[v], sizeof(F32), 3); - if (numRead != 3) - { - llwarns << "Can't read morph target vertex coordinates" << llendl; - return FALSE; - } - - F32 magnitude = mCoords[v].getLength3().getF32(); - - mTotalDistortion += magnitude; - LLVector4a t; - t.setAbs(mCoords[v]); - mAvgDistortion.add(t); - - if (magnitude > mMaxDistortion) - { - mMaxDistortion = magnitude; - } - - numRead = fread(&mNormals[v], sizeof(F32), 3, fp); - llendianswizzle(&mNormals[v], sizeof(F32), 3); - if (numRead != 3) - { - llwarns << "Can't read morph target normal" << llendl; - return FALSE; - } - - numRead = fread(&mBinormals[v], sizeof(F32), 3, fp); - llendianswizzle(&mBinormals[v], sizeof(F32), 3); - if (numRead != 3) - { - llwarns << "Can't read morph target binormal" << llendl; - return FALSE; - } - - - numRead = fread(&mTexCoords[v].mV, sizeof(F32), 2, fp); - llendianswizzle(&mTexCoords[v].mV, sizeof(F32), 2); - if (numRead != 2) - { - llwarns << "Can't read morph target uv" << llendl; - return FALSE; - } - - mNumIndices++; - } - - mAvgDistortion.mul(1.f/(F32)mNumIndices); - mAvgDistortion.normalize3fast(); - - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLPolyMorphTargetInfo() -//----------------------------------------------------------------------------- -LLPolyMorphTargetInfo::LLPolyMorphTargetInfo() - : mIsClothingMorph(FALSE) -{ -} - -BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) -{ - llassert( node->hasName( "param" ) && node->getChildByName( "param_morph" ) ); - - if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; - - // Get mixed-case name - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if( !node->getFastAttributeString( name_string, mMorphName ) ) - { - llwarns << "Avatar file: is missing name attribute" << llendl; - return FALSE; // Continue, ignoring this tag - } - - static LLStdStringHandle clothing_morph_string = LLXmlTree::addAttributeString("clothing_morph"); - node->getFastAttributeBOOL(clothing_morph_string, mIsClothingMorph); - - LLXmlTreeNode *paramNode = node->getChildByName("param_morph"); - - if (NULL == paramNode) - { - llwarns << "Failed to getChildByName(\"param_morph\")" - << llendl; - return FALSE; - } - - for (LLXmlTreeNode* child_node = paramNode->getFirstChild(); - child_node; - child_node = paramNode->getNextChild()) - { - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (child_node->hasName("volume_morph")) - { - std::string volume_name; - if (child_node->getFastAttributeString(name_string, volume_name)) - { - LLVector3 scale; - static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); - child_node->getFastAttributeVector3(scale_string, scale); - - LLVector3 pos; - static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); - child_node->getFastAttributeVector3(pos_string, pos); - - mVolumeInfoList.push_back(LLPolyVolumeMorphInfo(volume_name,scale,pos)); - } - } - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLPolyMorphTarget() -//----------------------------------------------------------------------------- -LLPolyMorphTarget::LLPolyMorphTarget(LLPolyMesh *poly_mesh) - : mMorphData(NULL), mMesh(poly_mesh), - mVertMask(NULL), - mLastSex(SEX_FEMALE), - mNumMorphMasksPending(0) -{ -} - -//----------------------------------------------------------------------------- -// ~LLPolyMorphTarget() -//----------------------------------------------------------------------------- -LLPolyMorphTarget::~LLPolyMorphTarget() -{ - if (mVertMask) - { - delete mVertMask; - } -} - -//----------------------------------------------------------------------------- -// setInfo() -//----------------------------------------------------------------------------- -BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) -{ - llassert(mInfo == NULL); - if (info->mID < 0) - return FALSE; - mInfo = info; - mID = info->mID; - setWeight(getDefaultWeight(), FALSE ); - - LLVOAvatar* avatarp = mMesh->getAvatar(); - LLPolyMorphTargetInfo::volume_info_list_t::iterator iter; - for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++) - { - LLPolyVolumeMorphInfo *volume_info = &(*iter); - for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++) - { - if (avatarp->mCollisionVolumes[i].getName() == volume_info->mName) - { - mVolumeMorphs.push_back(LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i], - volume_info->mScale, - volume_info->mPos)); - break; - } - } - } - - std::string morph_param_name = getInfo()->mMorphName; - - mMorphData = mMesh->getMorphData(morph_param_name); - if (!mMorphData) - { - const std::string driven_tag = "_Driven"; - U32 pos = morph_param_name.find(driven_tag); - if (pos > 0) - { - morph_param_name = morph_param_name.substr(0,pos); - mMorphData = mMesh->getMorphData(morph_param_name); - } - } - if (!mMorphData) - { - llwarns << "No morph target named " << morph_param_name << " found in mesh." << llendl; - return FALSE; // Continue, ignoring this tag - } - return TRUE; -} - -/*virtual*/ LLViewerVisualParam* LLPolyMorphTarget::cloneParam(LLWearable* wearable) const -{ - LLPolyMorphTarget *new_param = new LLPolyMorphTarget(mMesh); - *new_param = *this; - return new_param; -} - -#if 0 // obsolete -//----------------------------------------------------------------------------- -// parseData() -//----------------------------------------------------------------------------- -BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node) -{ - LLPolyMorphTargetInfo* info = new LLPolyMorphTargetInfo; - - info->parseXml(node); - if (!setInfo(info)) - { - delete info; - return FALSE; - } - return TRUE; -} -#endif - -//----------------------------------------------------------------------------- -// getVertexDistortion() -//----------------------------------------------------------------------------- -LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh) -{ - if (!mMorphData || mMesh != mesh) return LLVector4a::getZero(); - - for(U32 index = 0; index < mMorphData->mNumIndices; index++) - { - if (mMorphData->mVertexIndices[index] == (U32)requested_index) - { - return mMorphData->mCoords[index]; - } - } - - return LLVector4a::getZero(); -} - -//----------------------------------------------------------------------------- -// getFirstDistortion() -//----------------------------------------------------------------------------- -const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) -{ - if (!mMorphData) return &LLVector4a::getZero(); - - LLVector4a* resultVec; - mMorphData->mCurrentIndex = 0; - if (mMorphData->mNumIndices) - { - resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex]; - if (index != NULL) - { - *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex]; - } - if (poly_mesh != NULL) - { - *poly_mesh = mMesh; - } - - return resultVec; - } - return NULL; -} - -//----------------------------------------------------------------------------- -// getNextDistortion() -//----------------------------------------------------------------------------- -const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) -{ - if (!mMorphData) return &LLVector4a::getZero(); - - LLVector4a* resultVec; - mMorphData->mCurrentIndex++; - if (mMorphData->mCurrentIndex < mMorphData->mNumIndices) - { - resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex]; - if (index != NULL) - { - *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex]; - } - if (poly_mesh != NULL) - { - *poly_mesh = mMesh; - } - return resultVec; - } - return NULL; -} - -//----------------------------------------------------------------------------- -// getTotalDistortion() -//----------------------------------------------------------------------------- -F32 LLPolyMorphTarget::getTotalDistortion() -{ - if (mMorphData) - { - return mMorphData->mTotalDistortion; - } - else - { - return 0.f; - } -} - -//----------------------------------------------------------------------------- -// getAvgDistortion() -//----------------------------------------------------------------------------- -const LLVector4a& LLPolyMorphTarget::getAvgDistortion() -{ - if (mMorphData) - { - return mMorphData->mAvgDistortion; - } - else - { - return LLVector4a::getZero(); - } -} - -//----------------------------------------------------------------------------- -// getMaxDistortion() -//----------------------------------------------------------------------------- -F32 LLPolyMorphTarget::getMaxDistortion() -{ - if (mMorphData) - { - return mMorphData->mMaxDistortion; - } - else - { - return 0.f; - } -} - -//----------------------------------------------------------------------------- -// apply() -//----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_APPLY_MORPH_TARGET("Apply Morph"); - -void LLPolyMorphTarget::apply( ESex avatar_sex ) -{ - if (!mMorphData || mNumMorphMasksPending > 0) - { - return; - } - - LLFastTimer t(FTM_APPLY_MORPH_TARGET); - - mLastSex = avatar_sex; - - // Check for NaN condition (NaN is detected if a variable doesn't equal itself. - if (mCurWeight != mCurWeight) - { - mCurWeight = 0.0; - } - if (mLastWeight != mLastWeight) - { - mLastWeight = mCurWeight+.001; - } - - // perform differential update of morph - F32 delta_weight = ( getSex() & avatar_sex ) ? (mCurWeight - mLastWeight) : (getDefaultWeight() - mLastWeight); - // store last weight - mLastWeight += delta_weight; - - if (delta_weight != 0.f) - { - llassert(!mMesh->isLOD()); - LLVector4a *coords = mMesh->getWritableCoords(); - - LLVector4a *scaled_normals = mMesh->getScaledNormals(); - LLVector4a *normals = mMesh->getWritableNormals(); - - LLVector4a *scaled_binormals = mMesh->getScaledBinormals(); - LLVector4a *binormals = mMesh->getWritableBinormals(); - - LLVector4a *clothing_weights = mMesh->getWritableClothingWeights(); - LLVector2 *tex_coords = mMesh->getWritableTexCoords(); - - F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL; - - for(U32 vert_index_morph = 0; vert_index_morph < mMorphData->mNumIndices; vert_index_morph++) - { - S32 vert_index_mesh = mMorphData->mVertexIndices[vert_index_morph]; - - F32 maskWeight = 1.f; - if (maskWeightArray) - { - maskWeight = maskWeightArray[vert_index_morph]; - } - - - LLVector4a pos = mMorphData->mCoords[vert_index_morph]; - pos.mul(delta_weight*maskWeight); - coords[vert_index_mesh].add(pos); - - if (getInfo()->mIsClothingMorph && clothing_weights) - { - LLVector4a clothing_offset = mMorphData->mCoords[vert_index_morph]; - clothing_offset.mul(delta_weight * maskWeight); - LLVector4a* clothing_weight = &clothing_weights[vert_index_mesh]; - clothing_weight->add(clothing_offset); - clothing_weight->getF32ptr()[VW] = maskWeight; - } - - // calculate new normals based on half angles - LLVector4a norm = mMorphData->mNormals[vert_index_morph]; - norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); - scaled_normals[vert_index_mesh].add(norm); - norm = scaled_normals[vert_index_mesh]; - norm.normalize3fast(); - normals[vert_index_mesh] = norm; - - // calculate new binormals - LLVector4a binorm = mMorphData->mBinormals[vert_index_morph]; - binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); - scaled_binormals[vert_index_mesh].add(binorm); - LLVector4a tangent; - tangent.setCross3(scaled_binormals[vert_index_mesh], norm); - LLVector4a& normalized_binormal = binormals[vert_index_mesh]; - normalized_binormal.setCross3(norm, tangent); - normalized_binormal.normalize3fast(); - - tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight; - } - - // now apply volume changes - for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ ) - { - LLPolyVolumeMorph* volume_morph = &(*iter); - LLVector3 scale_delta = volume_morph->mScale * delta_weight; - LLVector3 pos_delta = volume_morph->mPos * delta_weight; - - volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta); - volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta); - } - } - - if (mNext) - { - mNext->apply(avatar_sex); - } -} - -//----------------------------------------------------------------------------- -// applyMask() -//----------------------------------------------------------------------------- -void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert) -{ - LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL; - - if (!mVertMask) - { - mVertMask = new LLPolyVertexMask(mMorphData); - mNumMorphMasksPending--; - } - else - { - // remove effect of previous mask - F32 *maskWeights = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL; - - if (maskWeights) - { - LLVector4a *coords = mMesh->getWritableCoords(); - LLVector4a *scaled_normals = mMesh->getScaledNormals(); - LLVector4a *scaled_binormals = mMesh->getScaledBinormals(); - LLVector2 *tex_coords = mMesh->getWritableTexCoords(); - - LLVector4Logical clothing_mask; - clothing_mask.clear(); - clothing_mask.setElement<0>(); - clothing_mask.setElement<1>(); - clothing_mask.setElement<2>(); - - - for(U32 vert = 0; vert < mMorphData->mNumIndices; vert++) - { - F32 lastMaskWeight = mLastWeight * maskWeights[vert]; - S32 out_vert = mMorphData->mVertexIndices[vert]; - - // remove effect of existing masked morph - LLVector4a t; - t = mMorphData->mCoords[vert]; - t.mul(lastMaskWeight); - coords[out_vert].sub(t); - - t = mMorphData->mNormals[vert]; - t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); - scaled_normals[out_vert].sub(t); - - t = mMorphData->mBinormals[vert]; - t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); - scaled_binormals[out_vert].sub(t); - - tex_coords[out_vert] -= mMorphData->mTexCoords[vert] * lastMaskWeight; - - if (clothing_weights) - { - LLVector4a clothing_offset = mMorphData->mCoords[vert]; - clothing_offset.mul(lastMaskWeight); - LLVector4a* clothing_weight = &clothing_weights[out_vert]; - LLVector4a t; - t.setSub(*clothing_weight, clothing_offset); - clothing_weight->setSelectWithMask(clothing_mask, t, *clothing_weight); - } - } - } - } - - // set last weight to 0, since we've removed the effect of this morph - mLastWeight = 0.f; - - mVertMask->generateMask(maskTextureData, width, height, num_components, invert, clothing_weights); - - apply(mLastSex); -} - - -//----------------------------------------------------------------------------- -// LLPolyVertexMask() -//----------------------------------------------------------------------------- -LLPolyVertexMask::LLPolyVertexMask(LLPolyMorphData* morph_data) -{ - mWeights = new F32[morph_data->mNumIndices]; - mMorphData = morph_data; - mWeightsGenerated = FALSE; -} - -//----------------------------------------------------------------------------- -// ~LLPolyVertexMask() -//----------------------------------------------------------------------------- -LLPolyVertexMask::~LLPolyVertexMask() -{ - delete[] mWeights; -} - -//----------------------------------------------------------------------------- -// generateMask() -//----------------------------------------------------------------------------- -void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights) -{ -// RN debug output that uses Image Debugger (http://www.cs.unc.edu/~baxter/projects/imdebug/) -// BOOL debugImg = FALSE; -// if (debugImg) -// { -// if (invert) -// { -// imdebug("lum rbga=rgba b=8 w=%d h=%d *-1 %p", width, height, maskTextureData); -// } -// else -// { -// imdebug("lum rbga=rgba b=8 w=%d h=%d %p", width, height, maskTextureData); -// } -// } - for (U32 index = 0; index < mMorphData->mNumIndices; index++) - { - S32 vertIndex = mMorphData->mVertexIndices[index]; - const S32 *sharedVertIndex = mMorphData->mMesh->getSharedVert(vertIndex); - LLVector2 uvCoords; - - if (sharedVertIndex) - { - uvCoords = mMorphData->mMesh->getUVs(*sharedVertIndex); - } - else - { - uvCoords = mMorphData->mMesh->getUVs(vertIndex); - } - U32 s = llclamp((U32)(uvCoords.mV[VX] * (F32)(width - 1)), (U32)0, (U32)width - 1); - U32 t = llclamp((U32)(uvCoords.mV[VY] * (F32)(height - 1)), (U32)0, (U32)height - 1); - - mWeights[index] = ((F32) maskTextureData[((t * width + s) * num_components) + (num_components - 1)]) / 255.f; - - if (invert) - { - mWeights[index] = 1.f - mWeights[index]; - } - - // now apply step function - // mWeights[index] = mWeights[index] > 0.95f ? 1.f : 0.f; - - if (clothing_weights) - { - clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index]; - } - } - mWeightsGenerated = TRUE; -} - -//----------------------------------------------------------------------------- -// getMaskForMorphIndex() -//----------------------------------------------------------------------------- -F32* LLPolyVertexMask::getMorphMaskWeights() -{ - if (!mWeightsGenerated) - { - return NULL; - } - - return mWeights; -} diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h deleted file mode 100644 index 28d7755d4d..0000000000 --- a/indra/newview/llpolymorph.h +++ /dev/null @@ -1,182 +0,0 @@ -/** - * @file llpolymorph.h - * @brief Implementation of LLPolyMesh class - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPOLYMORPH_H -#define LL_LLPOLYMORPH_H - -#include -#include - -#include "llviewervisualparam.h" - -class LLPolyMeshSharedData; -class LLVOAvatar; -class LLVector2; -class LLAvatarJointCollisionVolume; -class LLWearable; - -//----------------------------------------------------------------------------- -// LLPolyMorphData() -//----------------------------------------------------------------------------- -class LLPolyMorphData -{ -public: - LLPolyMorphData(const std::string& morph_name); - ~LLPolyMorphData(); - LLPolyMorphData(const LLPolyMorphData &rhs); - - BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh); - const std::string& getName() { return mName; } - -public: - std::string mName; - - // morphology - U32 mNumIndices; - U32* mVertexIndices; - U32 mCurrentIndex; - LLVector4a* mCoords; - LLVector4a* mNormals; - LLVector4a* mBinormals; - LLVector2* mTexCoords; - - F32 mTotalDistortion; // vertex distortion summed over entire morph - F32 mMaxDistortion; // maximum single vertex distortion in a given morph - LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph - LLPolyMeshSharedData* mMesh; -}; - -//----------------------------------------------------------------------------- -// LLPolyVertexMask() -//----------------------------------------------------------------------------- -class LLPolyVertexMask -{ -public: - LLPolyVertexMask(LLPolyMorphData* morph_data); - ~LLPolyVertexMask(); - - void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights); - F32* getMorphMaskWeights(); - - -protected: - F32* mWeights; - LLPolyMorphData *mMorphData; - BOOL mWeightsGenerated; - -}; - -//----------------------------------------------------------------------------- -// LLPolyMorphTarget Data structs -//----------------------------------------------------------------------------- -struct LLPolyVolumeMorphInfo -{ - LLPolyVolumeMorphInfo(std::string &name, LLVector3 &scale, LLVector3 &pos) - : mName(name), mScale(scale), mPos(pos) {}; - - std::string mName; - LLVector3 mScale; - LLVector3 mPos; -}; - -struct LLPolyVolumeMorph -{ - LLPolyVolumeMorph(LLAvatarJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos) - : mVolume(volume), mScale(scale), mPos(pos) {}; - - LLAvatarJointCollisionVolume* mVolume; - LLVector3 mScale; - LLVector3 mPos; -}; - -//----------------------------------------------------------------------------- -// LLPolyMorphTargetInfo -// Shared information for LLPolyMorphTargets -//----------------------------------------------------------------------------- -class LLPolyMorphTargetInfo : public LLViewerVisualParamInfo -{ - friend class LLPolyMorphTarget; -public: - LLPolyMorphTargetInfo(); - /*virtual*/ ~LLPolyMorphTargetInfo() {}; - - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); - -protected: - std::string mMorphName; - BOOL mIsClothingMorph; - typedef std::vector volume_info_list_t; - volume_info_list_t mVolumeInfoList; -}; - -//----------------------------------------------------------------------------- -// LLPolyMorphTarget -// A set of vertex data associated with morph target. -// These morph targets must be topologically consistent with a given Polymesh -// (share face sets) -//----------------------------------------------------------------------------- -class LLPolyMorphTarget : public LLViewerVisualParam -{ -public: - LLPolyMorphTarget(LLPolyMesh *poly_mesh); - ~LLPolyMorphTarget(); - - // Special: These functions are overridden by child classes - LLPolyMorphTargetInfo* getInfo() const { return (LLPolyMorphTargetInfo*)mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLPolyMorphTargetInfo *info); - - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const; - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - /*virtual*/ void apply( ESex sex ); - - // LLViewerVisualParam Virtual functions - /*virtual*/ F32 getTotalDistortion(); - /*virtual*/ const LLVector4a& getAvgDistortion(); - /*virtual*/ F32 getMaxDistortion(); - /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); - - void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert); - void addPendingMorphMask() { mNumMorphMasksPending++; } - -protected: - LLPolyMorphData* mMorphData; - LLPolyMesh* mMesh; - LLPolyVertexMask * mVertMask; - ESex mLastSex; - // number of morph masks that haven't been generated, must be 0 before this morph is applied - BOOL mNumMorphMasksPending; - - typedef std::vector volume_list_t; - volume_list_t mVolumeMorphs; - -}; - -#endif // LL_LLPOLYMORPH_H diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index 05b82ba967..a7e24b86b1 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -267,7 +267,7 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint ) && new_percent < slider->getMaxValue()) { mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight, FALSE); - mWearable->writeToAvatar(); + mWearable->writeToAvatar(gAgentAvatarp); gAgentAvatarp->updateVisualParams(); slider->setValue( weightToPercent( new_weight ) ); @@ -300,7 +300,7 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata ) && new_percent < slider->getMaxValue()) { self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE); - self->mWearable->writeToAvatar(); + self->mWearable->writeToAvatar(gAgentAvatarp); slider->setValue( self->weightToPercent( new_weight ) ); } } @@ -334,7 +334,7 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata ) && new_percent < slider->getMaxValue()) { self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE); - self->mWearable->writeToAvatar(); + self->mWearable->writeToAvatar(gAgentAvatarp); slider->setValue( self->weightToPercent( new_weight ) ); } } diff --git a/indra/newview/llscrollingpanelparambase.cpp b/indra/newview/llscrollingpanelparambase.cpp index 62e3039d2f..8e083ddb6c 100644 --- a/indra/newview/llscrollingpanelparambase.cpp +++ b/indra/newview/llscrollingpanelparambase.cpp @@ -94,7 +94,7 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata) if (current_weight != new_weight ) { self->mWearable->setVisualParamWeight( param->getID(), new_weight, FALSE ); - self->mWearable->writeToAvatar(); + self->mWearable->writeToAvatar(gAgentAvatarp); gAgentAvatarp->updateVisualParams(); } } diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index eb3a212eae..8fe3aff0b0 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -90,60 +90,13 @@ LLViewerWearable::~LLViewerWearable() } // virtual -BOOL LLViewerWearable::exportFile(LLFILE* file) const -{ - mTextureIDMap.clear(); - for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) - { - S32 te = iter->first; - const LLUUID& image_id = iter->second->getID(); - mTextureIDMap[te] = image_id; - } - return LLWearable::exportFile(file); -} - - -void LLViewerWearable::createVisualParams() -{ - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if (param->getWearableType() == mType) - { - addVisualParam(param->cloneParam(this)); - } - } - - // resync driver parameters to point to the newly cloned driven parameters - for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); - param_iter != mVisualParamIndexMap.end(); - ++param_iter) - { - LLVisualParam* param = param_iter->second; - LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; - // need this line to disambiguate between versions of LLCharacter::getVisualParam() - LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; - param->resetDrivenParams(); - if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) - { - if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) - { - llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; - continue; - } - } - } -} - -// virtual -LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) +LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file, LLAvatarAppearance* avatarp ) { // suppress texlayerset updates while wearables are being imported. Layersets will be updated // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed. LLOverrideBakedTextureUpdate stop_bakes(false); - LLWearable::EImportResult result = LLWearable::importFile(file); + LLWearable::EImportResult result = LLWearable::importFile(file, avatarp); if (LLWearable::FAILURE == result) return result; if (LLWearable::BAD_HEADER == result) { @@ -157,19 +110,16 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN ); LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN ); - texture_id_map_t::const_iterator iter = mTextureIDMap.begin(); - texture_id_map_t::const_iterator end = mTextureIDMap.end(); + te_map_t::const_iterator iter = mTEMap.begin(); + te_map_t::const_iterator end = mTEMap.end(); for (; iter != end; ++iter) { S32 te = iter->first; - const LLUUID& textureid = iter->second; - if( mTEMap.find(te) != mTEMap.end() ) - { - delete mTEMap[te]; - } - if( mSavedTEMap.find(te) != mSavedTEMap.end() ) + LLLocalTextureObject* lto = iter->second; + LLUUID textureid = LLUUID::null; + if (lto) { - delete mSavedTEMap[te]; + textureid = lto->getID(); } LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid ); @@ -177,9 +127,6 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) { image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL); } - mTEMap[te] = new LLLocalTextureObject(image, textureid); - mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); - createLayers(te); } // copy all saved param values to working params @@ -335,7 +282,7 @@ void LLViewerWearable::setTexturesToDefaults() if( mTEMap.find(te) == mTEMap.end() ) { mTEMap[te] = new LLLocalTextureObject(image, id); - createLayers(te); + createLayers(te, gAgentAvatarp); } else { @@ -366,25 +313,17 @@ const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) // Updates the user's avatar's appearance -void LLViewerWearable::writeToAvatar() +//virtual +void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) { - if (!isAgentAvatarValid()) return; + LLVOAvatarSelf* viewer_avatar = dynamic_cast(avatarp); - ESex old_sex = gAgentAvatarp->getSex(); + if (!avatarp || !viewer_avatar) return; - // Pull params - for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) - { - // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the - // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way. - if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) ) - { - S32 param_id = param->getID(); - F32 weight = getVisualParamWeight(param_id); + ESex old_sex = avatarp->getSex(); + + LLWearable::writeToAvatar(avatarp); - gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE ); - } - } // Pull texture entries for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) @@ -403,14 +342,14 @@ void LLViewerWearable::writeToAvatar() } LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. - gAgentAvatarp->setLocalTextureTE(te, image, 0); + viewer_avatar->setLocalTextureTE(te, image, 0); } } - ESex new_sex = gAgentAvatarp->getSex(); + ESex new_sex = avatarp->getSex(); if( old_sex != new_sex ) { - gAgentAvatarp->updateSexDependentLayerSets( FALSE ); + viewer_avatar->updateSexDependentLayerSets( FALSE ); } // if( upload_bake ) @@ -472,7 +411,7 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) mPermissions = src->mPermissions; mSaleInfo = src->mSaleInfo; - setType(src->mType); + setType(src->mType, gAgentAvatarp); mSavedVisualParamMap.clear(); // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) @@ -513,7 +452,7 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) mTEMap[te] = new LLLocalTextureObject(image, image_id); mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); } - createLayers(te); + createLayers(te, gAgentAvatarp); } } @@ -632,19 +571,6 @@ void LLViewerWearable::revertValues() } } -void LLViewerWearable::createLayers(S32 te) -{ - LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); - if (layer_set) - { - layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); - } - else - { - llerrs << "could not find layerset for LTO in wearable!" << llendl; - } -} - void LLViewerWearable::saveValues() { //update saved settings so wearable is no longer dirty diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index b3c1e3c3ba..d8412b1c65 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -30,6 +30,8 @@ #include "llwearable.h" #include "llavatarappearancedefines.h" +class LLVOAvatar; + class LLViewerWearable : public LLWearable { friend class LLWearableList; @@ -58,12 +60,11 @@ public: BOOL isDirty() const; BOOL isOldVersion() const; - /*virtual*/ void writeToAvatar(); + /*virtual*/ void writeToAvatar(LLAvatarAppearance *avatarp); void removeFromAvatar( BOOL upload_bake ) { LLViewerWearable::removeFromAvatar( mType, upload_bake ); } static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ); - /*virtual*/ BOOL exportFile(LLFILE* file) const; - /*virtual*/ EImportResult importFile(LLFILE* file); + /*virtual*/ EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp); void setParamsToDefaults(); void setTexturesToDefaults(); @@ -98,18 +99,11 @@ public: /*virtual*/void addToBakedTextureHash(LLMD5& hash) const; protected: - typedef std::map te_map_t; - - void createLayers(S32 te); - /*virtual*/void createVisualParams(); - void syncImages(te_map_t &src, te_map_t &dst); void destroyTextures(); LLAssetID mAssetID; LLTransactionID mTransactionID; - te_map_t mTEMap; // maps TE to LocalTextureObject - te_map_t mSavedTEMap; // last saved version of TEMap LLUUID mItemID; // ID of the inventory item in the agent's inventory }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 081f1d62ca..7772ae25a1 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5560,6 +5560,53 @@ S32 LLVOAvatar::getAttachmentCount() return count; } +BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const +{ + if (mIsDummy) return TRUE; + + if (isSelf()) + { + return LLAvatarAppearance::isWearingWearableType(type); + } + + switch(type) + { + case LLWearableType::WT_SHAPE: + case LLWearableType::WT_SKIN: + case LLWearableType::WT_HAIR: + case LLWearableType::WT_EYES: + return TRUE; // everyone has all bodyparts + default: + break; // Do nothing + } + + /* switch(type) + case LLWearableType::WT_SHIRT: + indicator_te = TEX_UPPER_SHIRT; */ + for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); + ++tex_iter) + { + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; + if (texture_dict->mWearableType == type) + { + // If you're checking another avatar's clothing, you don't have component textures. + // Thus, you must check to see if the corresponding baked texture is defined. + // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing + // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that + // gets baked into a texture that always exists (upper or lower). + if (texture_dict->mIsUsedByBakedTexture) + { + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); + } + return FALSE; + } + } + return FALSE; +} + + // virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index cc94c2a3eb..9b59e5f0eb 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -677,6 +677,7 @@ public: virtual BOOL detachObject(LLViewerObject *viewer_object); void cleanupAttachedMesh( LLViewerObject* pVO ); static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj); + /*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type ) const; protected: LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object); void lazyAttach(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 96fd41739f..d0ccde09e8 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -703,7 +703,7 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation() LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type); if (wearable) { - wearable->writeToAvatar(); + wearable->writeToAvatar(this); } } @@ -1001,11 +1001,6 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) } } -/*virtual*/ BOOL LLVOAvatarSelf::isWearingWearableType(LLWearableType::EType type ) const -{ - return gAgentWearables.getWearableCount(type) > 0; -} - //----------------------------------------------------------------------------- // updatedWearable( LLWearableType::EType type ) // forces an update to any baked textures relevant to type. @@ -2616,17 +2611,17 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index ) LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const { - /* switch(index) - case TEX_HEAD_BAKED: - case TEX_HEAD_BODYPAINT: - return mHeadLayerSet; */ - const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); - if (texture_dict->mIsUsedByBakedTexture) - { - const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - return getLayerSet(baked_index); - } - return NULL; + /* switch(index) + case TEX_HEAD_BAKED: + case TEX_HEAD_BODYPAINT: + return mHeadLayerSet; */ + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); + if (texture_dict->mIsUsedByBakedTexture) + { + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + return getLayerSet(baked_index); + } + return NULL; } LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const @@ -2637,12 +2632,14 @@ LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) return mHeadLayerSet; */ if (baked_index >= 0 && baked_index < BAKED_NUM_INDICES) { - return getTexLayerSet(baked_index); + return getTexLayerSet(baked_index); } return NULL; } + + // static void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) { diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 907564f8e1..395874ee62 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -249,8 +249,9 @@ public: void requestLayerSetUploads(); void requestLayerSetUpload(LLAvatarAppearanceDefines::EBakedTextureIndex i); void requestLayerSetUpdate(LLAvatarAppearanceDefines::ETextureIndex i); - LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::ETextureIndex index) const; - LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; + LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; + LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::ETextureIndex index) const; + //-------------------------------------------------------------------- // Composites @@ -299,7 +300,6 @@ protected: **/ public: - /*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type) const; void wearableUpdated(LLWearableType::EType type, BOOL upload_result); protected: U32 getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const; diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 6c4790ad77..50beaaec3f 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -42,13 +42,15 @@ struct LLWearableArrivedData { LLWearableArrivedData(LLAssetType::EType asset_type, const std::string& wearable_name, + LLAvatarAppearance* avatarp, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) : mAssetType( asset_type ), mCallback( asset_arrived_callback ), mUserdata( userdata ), mName( wearable_name ), - mRetries(0) + mRetries(0), + mAvatarp(avatarp) {} LLAssetType::EType mAssetType; @@ -56,6 +58,7 @@ struct LLWearableArrivedData void* mUserdata; std::string mName; S32 mRetries; + LLAvatarAppearance *mAvatarp; }; //////////////////////////////////////////////////////////////////////////// @@ -72,7 +75,7 @@ void LLWearableList::cleanup() mList.clear(); } -void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) +void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAvatarAppearance* avatarp, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) { llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) ); LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL ); @@ -85,7 +88,7 @@ void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& weara gAssetStorage->getAssetData(assetID, asset_type, LLWearableList::processGetAssetReply, - (void*)new LLWearableArrivedData( asset_type, wearable_name, asset_arrived_callback, userdata ), + (void*)new LLWearableArrivedData( asset_type, wearable_name, avatarp, asset_arrived_callback, userdata ), TRUE); } } @@ -96,11 +99,16 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID BOOL isNewWearable = FALSE; LLWearableArrivedData* data = (LLWearableArrivedData*) userdata; LLViewerWearable* wearable = NULL; // NULL indicates failure + LLAvatarAppearance *avatarp = data->mAvatarp; if( !filename ) { LL_WARNS("Wearable") << "Bad Wearable Asset: missing file." << LL_ENDL; } + else if(!avatarp) + { + LL_WARNS("Wearable") << "Bad asset request: missing avatar pointer." << LL_ENDL; + } else if (status >= 0) { // read the file @@ -112,7 +120,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else { wearable = new LLViewerWearable(uuid); - LLWearable::EImportResult result = wearable->importFile( fp ); + LLWearable::EImportResult result = wearable->importFile( fp, avatarp ); if (LLWearable::SUCCESS != result) { if (wearable->getType() == LLWearableType::WT_COUNT) @@ -222,12 +230,12 @@ LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearabl return wearable; } -LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) +LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type, LLAvatarAppearance *avatarp ) { lldebugs << "LLWearableList::createNewWearable()" << llendl; LLViewerWearable *wearable = generateNewWearable(); - wearable->setType( type ); + wearable->setType( type, avatarp ); std::string name = LLTrans::getString( LLWearableType::getTypeDefaultNewName(wearable->getType()) ); wearable->setName( name ); diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index 0f3078facf..d6f0fd09a6 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -50,12 +50,13 @@ public: void getAsset(const LLAssetID& assetID, const std::string& wearable_name, + LLAvatarAppearance *avatarp, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata); LLViewerWearable* createCopy(const LLViewerWearable* old_wearable, const std::string& new_name = std::string()); - LLViewerWearable* createNewWearable(LLWearableType::EType type); + LLViewerWearable* createNewWearable(LLWearableType::EType type, LLAvatarAppearance *avatarp); // Callback static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status); -- cgit v1.2.3 From b4866775a2acc98ebcb3986d7779eea479028ff9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 11 Sep 2012 20:57:04 -0400 Subject: Dump XML tweaks, suppress wearable updates when bakes should dominate --- indra/newview/llviewermenu.cpp | 9 +++++++++ indra/newview/llvoavatar.cpp | 5 +++++ indra/newview/llwearable.cpp | 2 +- indra/newview/skins/default/xui/en/menu_attachment_other.xml | 2 +- indra/newview/skins/default/xui/en/menu_attachment_self.xml | 2 +- indra/newview/skins/default/xui/en/menu_avatar_other.xml | 2 +- indra/newview/skins/default/xui/en/menu_avatar_self.xml | 10 +--------- .../newview/skins/default/xui/en/menu_inspect_avatar_gear.xml | 2 +- indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml | 2 +- 9 files changed, 21 insertions(+), 15 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9c748c7f86..e3e05ef80d 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1596,6 +1596,14 @@ class LLAdvancedEnableGrabBakedTexture : public view_listener_t /////////////////////// +class LLAdvancedEnableAppearanceToXML : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + return gSavedSettings.getBOOL("DebugAvatarCompositeBaked"); + } +}; + class LLAdvancedAppearanceToXML : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -8459,6 +8467,7 @@ void initialize_menus() // Advanced > Character > Character Tests view_listener_t::addMenu(new LLAdvancedAppearanceToXML(), "Advanced.AppearanceToXML"); + view_listener_t::addMenu(new LLAdvancedEnableAppearanceToXML(), "Advanced.EnableAppearanceToXML"); view_listener_t::addMenu(new LLAdvancedToggleCharacterGeometry(), "Advanced.ToggleCharacterGeometry"); view_listener_t::addMenu(new LLAdvancedTestMale(), "Advanced.TestMale"); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 61816c1771..96e59dd9eb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7361,7 +7361,9 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "processAvatarAppearance end " << mID << llendl; return; } + clearVisualParamWeights(); } + dumpArchetypeXML("process_post_clear"); ESex old_sex = getSex(); @@ -7481,6 +7483,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } + dumpArchetypeXML("process_post_set_weights"); + const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) { @@ -7545,6 +7549,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); + dumpArchetypeXML("process_end"); // llinfos << "processAvatarAppearance end " << mID << llendl; } diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index 3f07d6877c..b924a4471d 100755 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -619,7 +619,7 @@ void LLWearable::setTexturesToDefaults() void LLWearable::writeToAvatar() { if (!isAgentAvatarValid()) return; -#if 0 +#if 1 if (!gAgentAvatarp->isUsingLocalAppearance()) { return; diff --git a/indra/newview/skins/default/xui/en/menu_attachment_other.xml b/indra/newview/skins/default/xui/en/menu_attachment_other.xml index 6f92273097..46ba4bd29d 100755 --- a/indra/newview/skins/default/xui/en/menu_attachment_other.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_other.xml @@ -85,7 +85,7 @@ + function="Advanced.EnableAppearanceToXML"/> + function="Advanced.EnableAppearanceToXML"/> diff --git a/indra/newview/skins/default/xui/en/menu_avatar_other.xml b/indra/newview/skins/default/xui/en/menu_avatar_other.xml index 1c39984625..e7c2b80da2 100755 --- a/indra/newview/skins/default/xui/en/menu_avatar_other.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_other.xml @@ -85,7 +85,7 @@ + function="Advanced.EnableAppearanceToXML"/> - - - - + function="Advanced.EnableAppearanceToXML"/> diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml index 4fdfb2281b..354ddc3109 100755 --- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml @@ -118,7 +118,7 @@ + function="Advanced.EnableAppearanceToXML"/> + function="Advanced.EnableAppearanceToXML"/> -- cgit v1.2.3 From c34329fa4c8cc5adbad15d8e8f00296c71016a02 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 12 Sep 2012 21:35:25 +0000 Subject: SH-3347 create demo of back end texture baking service First link of the back-end service with some LLAppearance code. --- indra/newview/llvoavatar.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7772ae25a1..8ac39fe5ef 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7333,17 +7333,5 @@ BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, return FALSE; } -//virtual -LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) : - mMorphTarget(morph_target), - mInvert(invert), - mLayer(layer) -{ - LLPolyMorphTarget *target = dynamic_cast(morph_target); - if (target) - { - target->addPendingMorphMask(); - } -} -- cgit v1.2.3 From da1a303fc33b098f133cb72a8bac9d8e886d65df Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 13 Sep 2012 02:09:21 +0000 Subject: Moved most of the appearance utility application level logic into LLAppAppearanceUtility. Added LLBakingProcess class for adding new process modes. Create a couple concrete classes for llappearance base classes. --- indra/newview/llviewerjointmesh.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index 64887152a6..ac5aab4ef2 100755 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -1,6 +1,6 @@ /** * @file llviewerjointmesh.h - * @brief Implementation of LLViewerJointMesh class + * @brief Declaration of LLViewerJointMesh class * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code -- cgit v1.2.3 From 929b7e029513ecbb08c415e945c83ea09dc1b3eb Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 13 Sep 2012 03:30:17 +0000 Subject: Instantiated bare-bones LLBakingAvatar concrete class (derived from LLAvatarAppearance). Moved some LLCharacter funcionality from LLVOAvatar to LLAvatarAppearance. --- indra/newview/llvoavatar.cpp | 72 ----------------------------------------- indra/newview/llvoavatar.h | 77 ++++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 114 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8ac39fe5ef..fa1f9c95ab 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4557,48 +4557,6 @@ void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) { } -//----------------------------------------------------------------------------- -// getVolumePos() -//----------------------------------------------------------------------------- -LLVector3 LLVOAvatar::getVolumePos(S32 joint_index, LLVector3& volume_offset) -{ - if (joint_index > mNumCollisionVolumes) - { - return LLVector3::zero; - } - - return mCollisionVolumes[joint_index].getVolumePos(volume_offset); -} - -//----------------------------------------------------------------------------- -// findCollisionVolume() -//----------------------------------------------------------------------------- -LLJoint* LLVOAvatar::findCollisionVolume(U32 volume_id) -{ - if ((S32)volume_id > mNumCollisionVolumes) - { - return NULL; - } - - return &mCollisionVolumes[volume_id]; -} - -//----------------------------------------------------------------------------- -// findCollisionVolume() -//----------------------------------------------------------------------------- -S32 LLVOAvatar::getCollisionVolumeID(std::string &name) -{ - for (S32 i = 0; i < mNumCollisionVolumes; i++) - { - if (mCollisionVolumes[i].getName() == name) - { - return i; - } - } - - return -1; -} - //----------------------------------------------------------------------------- // addDebugText() //----------------------------------------------------------------------------- @@ -4790,23 +4748,6 @@ F32 LLVOAvatar::getPixelArea() const } -//----------------------------------------------------------------------------- -// LLVOAvatar::getHeadMesh() -//----------------------------------------------------------------------------- -LLPolyMesh* LLVOAvatar::getHeadMesh() -{ - return mMeshLOD[MESH_ID_HEAD]->mMeshParts[0]->getMesh(); -} - - -//----------------------------------------------------------------------------- -// LLVOAvatar::getUpperBodyMesh() -//----------------------------------------------------------------------------- -LLPolyMesh* LLVOAvatar::getUpperBodyMesh() -{ - return mMeshLOD[MESH_ID_UPPER_BODY]->mMeshParts[0]->getMesh(); -} - //----------------------------------------------------------------------------- // LLVOAvatar::getPosGlobalFromAgent() @@ -4825,19 +4766,6 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) } -//----------------------------------------------------------------------------- -// getCharacterJoint() -//----------------------------------------------------------------------------- -LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) -{ - if ((S32)num >= mSkeleton.size() - || (S32)num < 0) - { - return NULL; - } - return mSkeleton[num]; -} - //----------------------------------------------------------------------------- // requestStopMotion() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 9b59e5f0eb..5335d6fda1 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -122,31 +122,31 @@ protected: // LLViewerObject interface and related //-------------------------------------------------------------------- public: - virtual void updateGL(); - virtual LLVOAvatar* asAvatar(); + /*virtual*/ void updateGL(); + /*virtual*/ LLVOAvatar* asAvatar(); virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp); virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); - virtual BOOL updateLOD(); + /*virtual*/ BOOL updateLOD(); BOOL updateJointLODs(); void updateLODRiggedAttachments( void ); - virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate. - virtual void updateTextures(); - virtual S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. - virtual void onShift(const LLVector4a& shift_vector); - virtual U32 getPartitionType() const; - virtual const LLVector3 getRenderPosition() const; - virtual void updateDrawable(BOOL force_damped); - virtual LLDrawable* createDrawable(LLPipeline *pipeline); - virtual BOOL updateGeometry(LLDrawable *drawable); - virtual void setPixelAreaAndAngle(LLAgent &agent); - virtual void updateRegion(LLViewerRegion *regionp); - virtual void updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax); - virtual void getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); - virtual BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + /*virtual*/ void updateTextures(); + /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. + /*virtual*/ void onShift(const LLVector4a& shift_vector); + /*virtual*/ U32 getPartitionType() const; + /*virtual*/ const LLVector3 getRenderPosition() const; + /*virtual*/ void updateDrawable(BOOL force_damped); + /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); + /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); + /*virtual*/ void updateRegion(LLViewerRegion *regionp); + /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax); + /*virtual*/ void getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); + /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES BOOL pick_transparent = FALSE, S32* face_hit = NULL, // which face was hit @@ -167,15 +167,14 @@ public: // LLCharacter interface and related //-------------------------------------------------------------------- public: - virtual LLVector3 getCharacterPosition(); - virtual LLQuaternion getCharacterRotation(); - virtual LLVector3 getCharacterVelocity(); - virtual LLVector3 getCharacterAngularVelocity(); - virtual LLJoint* getCharacterJoint(U32 num); + /*virtual*/ LLVector3 getCharacterPosition(); + /*virtual*/ LLQuaternion getCharacterRotation(); + /*virtual*/ LLVector3 getCharacterVelocity(); + /*virtual*/ LLVector3 getCharacterAngularVelocity(); - virtual LLUUID remapMotionID(const LLUUID& id); - virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); - virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); + /*virtual*/ LLUUID remapMotionID(const LLUUID& id); + /*virtual*/ BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); + /*virtual*/ BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); virtual void stopMotionFromSource(const LLUUID& source_id); virtual void requestStopMotion(LLMotion* motion); LLMotion* findMotion(const LLUUID& id) const; @@ -188,19 +187,13 @@ public: void resetJointPositionsToDefault( void ); void resetSpecificJointPosition( const std::string& name ); - virtual const char* getAnimationPrefix() { return "avatar"; } - virtual const LLUUID& getID() const; - virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset); - virtual LLJoint* findCollisionVolume(U32 volume_id); - virtual S32 getCollisionVolumeID(std::string &name); - virtual void addDebugText(const std::string& text); - virtual F32 getTimeDilation(); - virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); - virtual F32 getPixelArea() const; - virtual LLPolyMesh* getHeadMesh(); - virtual LLPolyMesh* getUpperBodyMesh(); - virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position); - virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position); + /*virtual*/ const LLUUID& getID() const; + /*virtual*/ void addDebugText(const std::string& text); + /*virtual*/ F32 getTimeDilation(); + /*virtual*/ void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); + /*virtual*/ F32 getPixelArea() const; + /*virtual*/ LLVector3d getPosGlobalFromAgent(const LLVector3 &position); + /*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position); virtual void updateVisualParams(); @@ -495,7 +488,7 @@ public: virtual LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR; } virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED; } virtual S32 getTexImageSize() const; - virtual S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); } + /*virtual*/ S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); } /** Rendering ** ** @@ -808,9 +801,9 @@ private: **/ public: - virtual BOOL setParent(LLViewerObject* parent); - virtual void addChild(LLViewerObject *childp); - virtual void removeChild(LLViewerObject *childp); + /*virtual*/ BOOL setParent(LLViewerObject* parent); + /*virtual*/ void addChild(LLViewerObject *childp); + /*virtual*/ void removeChild(LLViewerObject *childp); //-------------------------------------------------------------------- // Sitting -- cgit v1.2.3 From 8ba2b388769e245ec1b49b7d6d4b0372d684ff86 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 13 Sep 2012 10:25:48 +0000 Subject: Fleshed out target_link_libraries dependencies between libraries. Appearance utility now reads avatar_lad.xml during stubbed out params processing. --- indra/newview/CMakeLists.txt | 11 ----------- indra/newview/llappviewer.cpp | 17 +++++++++++++++++ indra/newview/llvoavatar.cpp | 3 --- 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 9215b7b670..b12853b014 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1824,17 +1824,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLAPPEARANCE_LIBRARIES} ) -if (USE_KDU) - target_link_libraries(${VIEWER_BINARY_NAME} - ${LLKDU_LIBRARIES} - ${KDU_LIBRARY} - ) -else (USE_KDU) - target_link_libraries(${VIEWER_BINARY_NAME} - ${LLIMAGEJ2COJ_LIBRARIES} - ) -endif (USE_KDU) - build_version(viewer) set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fbf15ff5ce..587435301d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -668,6 +668,15 @@ LLAppViewer::~LLAppViewer() removeMarkerFile(); } +class LLUITranslationBridge : public LLTranslationBridge +{ +public: + virtual std::string getString(const std::string &xml_desc) + { + return LLTrans::getString(xml_desc); + } +}; + bool LLAppViewer::init() { // @@ -679,6 +688,10 @@ bool LLAppViewer::init() // LLFastTimer::reset(); + // initialize LLWearableType translation bridge. + // Memory will be cleaned up in ::cleanupClass() + LLWearableType::initClass(new LLUITranslationBridge()); + // initialize SSE options LLVector4a::initClass(); @@ -1797,6 +1810,8 @@ bool LLAppViewer::cleanup() llinfos << "Cleaning up Objects" << llendflush; LLViewerObject::cleanupVOClasses(); + + LLAvatarAppearance::cleanupClass(); LLPostProcess::cleanupClass(); @@ -2030,6 +2045,8 @@ bool LLAppViewer::cleanup() llinfos << "Cleaning up LLProxy." << llendl; LLProxy::cleanupClass(); + LLWearableType::cleanupClass(); + LLMainLoopRepeater::instance().stop(); //release all private memory pools. diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fa1f9c95ab..0d16d039da 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1039,9 +1039,6 @@ void LLVOAvatar::initClass() void LLVOAvatar::cleanupClass() { - deleteAndClear(sAvatarXmlInfo); - sSkeletonXMLTree.cleanup(); - sXMLTree.cleanup(); } // virtual -- cgit v1.2.3 From 97ee3003ffddb7cd2f8a8a2768101a8065ae1fe3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 13 Sep 2012 17:22:15 -0400 Subject: more dump capabilities for visual params and textures in avatar and appearance messages --- indra/newview/llvoavatar.cpp | 153 +++++++++++++++++++++++++++++++++---------- indra/newview/llvoavatar.h | 5 +- 2 files changed, 124 insertions(+), 34 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 96e59dd9eb..bcaf355dd8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -202,6 +202,12 @@ enum ERenderName RENDER_NAME_FADE }; + +// Utility func - FIXME move out of avatar. +std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix, + const S32 width = 4); + //----------------------------------------------------------------------------- // Callback data //----------------------------------------------------------------------------- @@ -7331,13 +7337,54 @@ bool LLVOAvatar::visualParamWeightsAreDefault() return rtn; } +void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, + const std::vector& params_for_dump, + const LLTEContents& tec) +{ + std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + + LLAPRFile outfile; + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); + apr_file_t* file = outfile.getFileHandle(); + if (!file) + { + return; + } + else + { + llinfos << "xmlfile write handle obtained : " << fullpath << llendl; + } + + + LLVisualParam* param = getFirstVisualParam(); + for (S32 i = 0; i < params_for_dump.size(); i++) + { + while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + { + param = getNextVisualParam(); + } + LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; + F32 value = params_for_dump[i]; + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value); + param = getNextVisualParam(); + } + for (U32 i = 0; i < tec.face_count; i++) + { + std::string uuid_str; + ((LLUUID*)tec.image_data)[i].toString(uuid_str); + apr_file_printf( file, "\t\t\n", i, uuid_str.c_str()); + } +} //----------------------------------------------------------------------------- // processAvatarAppearance() //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - dumpArchetypeXML("process_start"); + //std::string dump_prefix = getFullname() + " "; + //dumpArchetypeXML(dump_prefix + "process_start"); if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -7361,9 +7408,9 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "processAvatarAppearance end " << mID << llendl; return; } - clearVisualParamWeights(); } - dumpArchetypeXML("process_post_clear"); + clearVisualParamWeights(); + //dumpArchetypeXML(dump_prefix + "process_post_clear"); ESex old_sex = getSex(); @@ -7448,6 +7495,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } else { + std::vector params_for_dump; for( S32 i = 0; i < num_blocks; i++ ) { while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT @@ -7464,6 +7512,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) U8 value; mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); + params_for_dump.push_back(newWeight); if (is_first_appearance_message || (param->getWeight() != newWeight)) { @@ -7481,9 +7530,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } param = getNextVisualParam(); } + //dumpAppearanceMsgParams(dump_prefix + "appearance_msg", + // params_for_dump, + // tec); } - dumpArchetypeXML("process_post_set_weights"); + //dumpArchetypeXML(dump_prefix + "process_post_set_weights"); const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) @@ -7549,7 +7601,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); - dumpArchetypeXML("process_end"); + //dumpArchetypeXML(dump_prefix + "process_end"); // llinfos << "processAvatarAppearance end " << mID << llendl; } @@ -7779,33 +7831,42 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) dirtyMesh(); } -void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) +std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix, + const S32 width) { - std::string outprefix(prefix); - if (outprefix.empty()) - { - outprefix = getFullname(); - } - if (outprefix.empty()) - { - outprefix = std::string("new_archetype"); - } typedef std::map file_num_type; static file_num_type file_nums; - file_num_type::iterator it = file_nums.find(outprefix); + file_num_type::iterator it = file_nums.find(prefix); S32 num = 0; if (it != file_nums.end()) { num = it->second; } std::ostringstream temp; - temp << std::setw(4) << std::setfill('0') << num; - file_nums[outprefix] = num+1; - std::string outfilename = outprefix + " " + temp.str() + ".xml"; + temp << std::setw(width) << std::setfill('0') << num; + file_nums[prefix] = num+1; + std::string outfilename = prefix + " " + temp.str() + ".xml"; std::replace(outfilename.begin(),outfilename.end(),' ','_'); + return outfilename; +} + +void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_wearables ) +{ + std::string outprefix(prefix); + if (outprefix.empty()) + { + outprefix = getFullname(); + } + if (outprefix.empty()) + { + outprefix = std::string("new_archetype"); + } + std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); LLAPRFile outfile; - outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,outfilename), LL_APR_WB ); + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); apr_file_t* file = outfile.getFileHandle(); if (!file) { @@ -7813,24 +7874,53 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) } else { - llinfos << "xmlfile write handle obtained : " << gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml") << llendl; + llinfos << "xmlfile write handle obtained : " << fullpath << llendl; } apr_file_printf( file, "\n" ); apr_file_printf( file, "\n" ); apr_file_printf( file, "\n\t\n" ); - // only body parts, not clothing. - for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_COUNT; type++) + if (group_by_wearables) { - const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); - apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); + for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++) + { + const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); + apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); + for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) + { + LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; + if( (viewer_param->getWearableType() == type) && + (viewer_param->isTweakable() ) ) + { + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); + } + } + + for (U8 te = 0; te < TEX_NUM_INDICES; te++) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) + { + // MULTIPLE_WEARABLES: extend to multiple wearables? + LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); + if( te_image ) + { + std::string uuid_str; + te_image->getID().toString( uuid_str ); + apr_file_printf( file, "\t\t\n", te, uuid_str.c_str()); + } + } + } + } + } + else + { + // Just dump all params sequentially. for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; - if( (viewer_param->getWearableType() == type) && - (viewer_param->isTweakable() ) ) { apr_file_printf(file, "\t\t\n", viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); @@ -7839,7 +7929,6 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); @@ -7851,14 +7940,12 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) } } } + } apr_file_printf( file, "\t\n" ); apr_file_printf( file, "\n\n" ); - //explictly close the file if it is still open which it should be - if (file) - { - outfile.close(); - } + + // File will close when handle goes out of scope } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 62c8e68069..170072e5c1 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -1016,7 +1016,10 @@ private: // General //-------------------------------------------------------------------- public: - void dumpArchetypeXML(const std::string& prefix); + void dumpArchetypeXML(const std::string& prefix, bool group_by_wearables = false); + void dumpAppearanceMsgParams( const std::string& dump_prefix, + const std::vector& paramsForDump, + const LLTEContents& tec); static void dumpBakedStatus(); const std::string getBakedStatusForPrintout() const; void dumpAvatarTEs(const std::string& context) const; -- cgit v1.2.3 From 9307810e7e8edcf18f7c27abda5d0b94ed13bcf7 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 13 Sep 2012 22:53:16 +0000 Subject: Fix for merge build error. Attempt to cleanup cmake warnings regarding incorrect target_link_libraries --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index bec67c1695..1b185ed508 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6853,7 +6853,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); -- cgit v1.2.3 From 8808325ced4d380d937c9be1cc81e20a5ebb5f62 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 14 Sep 2012 11:27:04 +0000 Subject: Removed appearance utility from viewer source. Added appearance utility autobuild package. --- indra/newview/English.lproj/InfoPlist.strings | 4 ++-- indra/newview/Info-SecondLife.plist | 2 +- indra/newview/res/viewerRes.rc | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/English.lproj/InfoPlist.strings b/indra/newview/English.lproj/InfoPlist.strings index 5c7cacedec..1802e14703 100644 --- a/indra/newview/English.lproj/InfoPlist.strings +++ b/indra/newview/English.lproj/InfoPlist.strings @@ -2,6 +2,6 @@ CFBundleName = "Second Life"; -CFBundleShortVersionString = "Second Life version 2.1.0.13828"; -CFBundleGetInfoString = "Second Life version 2.1.0.13828, Copyright 2004-2009 Linden Research, Inc."; +CFBundleShortVersionString = "Second Life version 3.4.1.264760"; +CFBundleGetInfoString = "Second Life version 3.4.1.264760, Copyright 2004-2009 Linden Research, Inc."; diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index f7b11b217c..035d6cbe6c 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -60,7 +60,7 @@ CFBundleVersion - 2.1.0.13828 + 3.4.1.264760 CSResourcesFileMapped diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index df75f3f697..471a896019 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -135,8 +135,8 @@ TOOLNO CURSOR "llno.cur" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,1,0 - PRODUCTVERSION 2,1,1,0 + FILEVERSION 3,4,1,264760 + PRODUCTVERSION 3,4,1,264760 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -153,12 +153,12 @@ BEGIN BEGIN VALUE "CompanyName", "Linden Lab" VALUE "FileDescription", "Second Life" - VALUE "FileVersion", "2.1.1.0" + VALUE "FileVersion", "3.4.1.264760" VALUE "InternalName", "Second Life" VALUE "LegalCopyright", "Copyright � 2001-2010, Linden Research, Inc." VALUE "OriginalFilename", "SecondLife.exe" VALUE "ProductName", "Second Life" - VALUE "ProductVersion", "2.1.1.0" + VALUE "ProductVersion", "3.4.1.264760" END END BLOCK "VarFileInfo" -- cgit v1.2.3 From 8b2cb3766e3ed546994f81518983283e68263b09 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 14 Sep 2012 11:29:17 -0400 Subject: BUILDFIX: WIN fixing up windows building issues Cleaned up a couple of things that the windows compiler was warning about, with our inheritance structure --- indra/newview/llviewerjointmesh.h | 4 ++++ indra/newview/llvoavatarself.cpp | 13 +++++++------ indra/newview/llvoavatarself.h | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index ac5aab4ef2..0db2836e15 100755 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -56,6 +56,10 @@ public: // overloaded from base class /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ); + // necessary because MS's compiler warns on function inheritance via dominance in the diamond inheritance here. + // warns even though LLViewerJoint holds the only non virtual implementation. + /*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) { return LLViewerJoint::render(pixelArea,first_pass,is_dummy);} + /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false); /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index a29b3ff92b..c5bb4c3700 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1558,24 +1558,25 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const return false; } -void LLVOAvatarSelf::invalidateComposite( LLViewerTexLayerSet* layerset, BOOL upload_result ) +void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) { - if( !layerset || !layerset->getUpdatesEnabled() ) + LLViewerTexLayerSet *layer_set = dynamic_cast(layerset); + if( !layer_set || !layer_set->getUpdatesEnabled() ) { return; } // llinfos << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << llendl; - layerset->requestUpdate(); - layerset->invalidateMorphMasks(); + layer_set->requestUpdate(); + layer_set->invalidateMorphMasks(); if( upload_result && (getRegion() && !getRegion()->getCentralBakeVersion())) { llassert(isSelf()); - ETextureIndex baked_te = getBakedTE( layerset ); + ETextureIndex baked_te = getBakedTE( layer_set ); setTEImage( baked_te, LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR) ); - layerset->requestUpload(); + layer_set->requestUpload(); updateMeshTextures(); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 395874ee62..89bb8bf5c9 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -257,7 +257,7 @@ public: // Composites //-------------------------------------------------------------------- public: - /* virtual */ void invalidateComposite(LLViewerTexLayerSet* layerset, BOOL upload_result); + /* virtual */ void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result); /* virtual */ void invalidateAll(); /* virtual */ void setCompositeUpdatesEnabled(bool b); // only works for self /* virtual */ void setCompositeUpdatesEnabled(U32 index, bool b); -- cgit v1.2.3 From 7b75bd089834a84ab5062c96870edeee6fa22861 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 14 Sep 2012 12:27:50 -0400 Subject: fix for windows compile error - missing precompiled header --- indra/newview/llinventoryicon.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp index 14efc25fb9..02a2475cfd 100644 --- a/indra/newview/llinventoryicon.cpp +++ b/indra/newview/llinventoryicon.cpp @@ -24,6 +24,8 @@ * $/LicenseInfo$ */ +#include "llviewerprecompiledheaders.h" + #include "linden_common.h" #include "llinventoryicon.h" -- cgit v1.2.3 From 49caededb4bf5beb8b87ebee034c1d969968af4d Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 19 Sep 2012 17:05:56 +0000 Subject: BUILDFIX: enabling the building of the viewer/appearance backend with headless mesa --- indra/newview/lldirpicker.cpp | 4 ++++ indra/newview/llfilepicker.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index 1e03582a29..d7d9f82910 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -327,6 +327,8 @@ BOOL LLDirPicker::getDir(std::string* filename) return FALSE; } +#if !LL_MESA_HEADLESS + if (mFilePicker) { GtkWindow* picker = mFilePicker->buildFilePicker(false, true, @@ -340,6 +342,8 @@ BOOL LLDirPicker::getDir(std::string* filename) return (!mFilePicker->getFirstFile().empty()); } } +#endif // !LL_MESA_HEADLESS + return FALSE; } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 4bf5b26b3b..d13f85baa2 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -1103,6 +1103,7 @@ void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::string context) { +#ifndef LL_MESA_HEADLESS if (LLWindowSDL::ll_try_gtk_init()) { GtkWidget *win = NULL; @@ -1174,6 +1175,9 @@ GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::stri { return NULL; } +#else + return NULL; +#endif //LL_MESA_HEADLESS } static void add_common_filters_to_gtkchooser(GtkFileFilter *gfilter, @@ -1473,7 +1477,7 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename return FALSE; } -BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) +BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) @@ -1494,7 +1498,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) default: break; } mFiles.push_back(filename); - llinfos << "getOpenFile: Will try to open file: " << hackyfilename << llendl; + llinfos << "getOpenFile: Will try to open file: " << filename << llendl; return TRUE; } -- cgit v1.2.3 From 47403abc3e1787c81707df0fe8852e46d156953c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Sep 2012 13:16:59 -0400 Subject: work in progress, more debugging/logging of avatar visual param info --- indra/newview/app_settings/settings.xml | 11 ++++++ indra/newview/llviewerwearable.cpp | 7 ++-- indra/newview/llvoavatar.cpp | 59 ++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 28 deletions(-) mode change 100644 => 100755 indra/newview/llviewerwearable.cpp (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 674685f3bc..13bf6c18f8 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1927,6 +1927,17 @@ Value + DebugAvatarAppearanceMessage + + Comment + Dump a bunch of XML files when handling appearance messages + Persist + 1 + Type + Boolean + Value + 0 + DebugAvatarRezTime Comment diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp old mode 100644 new mode 100755 index e9fa92e8be..5b74f1a976 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -322,7 +322,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; -#if 1 +#if 0 // FIXME restrict to server-bake regions. if (!viewer_avatar->isUsingLocalAppearance()) { return; @@ -528,7 +528,10 @@ void LLViewerWearable::setVisualParams() S32 id = iter->first; LLVisualParam *wearable_param = iter->second; F32 value = wearable_param->getWeight(); - gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + if (gAgentAvatarp->isUsingLocalAppearance()) + { + gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + } } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1b185ed508..5ccd2d206d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -48,6 +48,7 @@ #include "llcallingcard.h" // IDEVO for LLAvatarTracker #include "lldrawpoolavatar.h" #include "lldriverparam.h" +#include "llpolyskeletaldistortion.h" #include "lleditingmotion.h" #include "llemote.h" //#include "llfirstuse.h" @@ -191,8 +192,7 @@ enum ERenderName // Utility func - FIXME move out of avatar. std::string get_sequential_numbered_file_name(const std::string& prefix, - const std::string& suffix, - const S32 width = 4); + const std::string& suffix); //----------------------------------------------------------------------------- // Callback data @@ -6277,6 +6277,24 @@ bool LLVOAvatar::visualParamWeightsAreDefault() return rtn; } +void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) +{ + std::string type_string = "unknown"; + if (dynamic_cast(viewer_param)) + type_string = "param_alpha"; + if (dynamic_cast(viewer_param)) + type_string = "param_color"; + if (dynamic_cast(viewer_param)) + type_string = "param_driver"; + if (dynamic_cast(viewer_param)) + type_string = "param_morph"; + if (dynamic_cast(viewer_param)) + type_string = "param_skeleton"; + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str()); +} + + void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, const std::vector& params_for_dump, const LLTEContents& tec) @@ -6306,8 +6324,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; F32 value = params_for_dump[i]; - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), value); + dump_visual_param(file, viewer_param, value); param = getNextVisualParam(); } for (U32 i = 0; i < tec.face_count; i++) @@ -6323,14 +6340,14 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - //std::string dump_prefix = getFullname() + " "; - //dumpArchetypeXML(dump_prefix + "process_start"); + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; + if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; return; } - LLMemType mt(LLMemType::MTYPE_AVATAR); BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; @@ -6349,8 +6366,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } } - clearVisualParamWeights(); - //dumpArchetypeXML(dump_prefix + "process_post_clear"); ESex old_sex = getSex(); @@ -6470,12 +6485,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } param = getNextVisualParam(); } - //dumpAppearanceMsgParams(dump_prefix + "appearance_msg", - // params_for_dump, - // tec); + if (enable_verbose_dumps) + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", params_for_dump, tec); } - //dumpArchetypeXML(dump_prefix + "process_post_set_weights"); + if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) @@ -6541,7 +6555,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); - //dumpArchetypeXML(dump_prefix + "process_end"); + if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); // llinfos << "processAvatarAppearance end " << mID << llendl; } @@ -6784,8 +6798,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) } std::string get_sequential_numbered_file_name(const std::string& prefix, - const std::string& suffix, - const S32 width) + const std::string& suffix) { typedef std::map file_num_type; static file_num_type file_nums; @@ -6795,10 +6808,8 @@ std::string get_sequential_numbered_file_name(const std::string& prefix, { num = it->second; } - std::ostringstream temp; - temp << std::setw(width) << std::setfill('0') << num; file_nums[prefix] = num+1; - std::string outfilename = prefix + " " + temp.str() + ".xml"; + std::string outfilename = prefix + " " + llformat("%04d",num) + ".xml"; std::replace(outfilename.begin(),outfilename.end(),' ','_'); return outfilename; } @@ -6808,7 +6819,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara std::string outprefix(prefix); if (outprefix.empty()) { - outprefix = getFullname(); + outprefix = getFullname() + (isSelf()?"_s":"_o"); } if (outprefix.empty()) { @@ -6846,8 +6857,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara if( (viewer_param->getWearableType() == type) && (viewer_param->isTweakable() ) ) { - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); + dump_visual_param(file, viewer_param, viewer_param->getWeight()); } } @@ -6873,10 +6883,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; - { - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); - } + dump_visual_param(file, viewer_param, viewer_param->getWeight()); } for (U8 te = 0; te < TEX_NUM_INDICES; te++) -- cgit v1.2.3 From f3d52b8d54c3be67262d4d8ae9a00253e9d55249 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Sep 2012 17:59:27 -0400 Subject: small tweaks to param debugging, restricting LLWearable::writeToAvatar --- indra/newview/llviewermenu.cpp | 2 +- indra/newview/llviewerwearable.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index cbd1ac692f..33add7d56c 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1600,7 +1600,7 @@ class LLAdvancedEnableAppearanceToXML : public view_listener_t { bool handleEvent(const LLSD& userdata) { - return gSavedSettings.getBOOL("DebugAvatarCompositeBaked"); + return gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); } }; diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 5b74f1a976..373cc63b41 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -322,12 +322,11 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; -#if 0 // FIXME restrict to server-bake regions. + // FIXME restrict this check to server bake regions? if (!viewer_avatar->isUsingLocalAppearance()) { return; } -#endif ESex old_sex = avatarp->getSex(); @@ -523,7 +522,8 @@ void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject < void LLViewerWearable::setVisualParams() { - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); + iter != mVisualParamIndexMap.end(); iter++) { S32 id = iter->first; LLVisualParam *wearable_param = iter->second; -- cgit v1.2.3 From 7153d1db11c00245a379fa9601f092020152ea73 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 20 Sep 2012 04:29:17 +0000 Subject: Partial rewrite of llifstream and llofstream (Windows implementation pending). Moved more functionality from llviewerwearable to llwearable --- indra/newview/llagent.h | 1 + indra/newview/lllocalbitmaps.h | 4 +- indra/newview/lltoolmorph.cpp | 1 + indra/newview/llviewertexlayer.h | 1 + indra/newview/llviewerwearable.cpp | 184 ++----------------------------------- indra/newview/llviewerwearable.h | 16 +--- indra/newview/llwearablelist.cpp | 8 +- 7 files changed, 20 insertions(+), 195 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index f784262e90..ae5efb2287 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -34,6 +34,7 @@ #include "llcharacter.h" #include "llcoordframe.h" // for mFrameAgent #include "llavatarappearancedefines.h" +#include "llpermissionsflags.h" #include #include diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index ca12fe2045..580b6dfa7e 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -28,9 +28,11 @@ #ifndef LL_LOCALBITMAPS_H #define LL_LOCALBITMAPS_H +#include "llavatarappearancedefines.h" #include "lleventtimer.h" +#include "llimage.h" +#include "llpointer.h" #include "llwearabletype.h" -#include "llavatarappearancedefines.h" class LLScrollListCtrl; class LLViewerObject; diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 0d5daf129f..148e5a015b 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -34,6 +34,7 @@ #include "llaudioengine.h" #include "llviewercontrol.h" #include "llfontgl.h" +#include "llwearable.h" #include "sound_ids.h" #include "v3math.h" #include "v3color.h" diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index 95c339a5b0..9df9474eff 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -28,6 +28,7 @@ #define LL_VIEWER_TEXLAYER_H #include "lldynamictexture.h" +#include "llextendedstatus.h" #include "lltexlayer.h" class LLVOAvatarSelf; diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index e9fa92e8be..162c20837a 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -90,13 +90,13 @@ LLViewerWearable::~LLViewerWearable() } // virtual -LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file, LLAvatarAppearance* avatarp ) +LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ) { // suppress texlayerset updates while wearables are being imported. Layersets will be updated // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed. LLOverrideBakedTextureUpdate stop_bakes(false); - LLWearable::EImportResult result = LLWearable::importFile(file, avatarp); + LLWearable::EImportResult result = LLWearable::importStream(input_stream, avatarp); if (LLWearable::FAILURE == result) return result; if (LLWearable::BAD_HEADER == result) { @@ -129,9 +129,6 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file, LLAvatarAp } } - // copy all saved param values to working params - revertValues(); - return result; } @@ -296,8 +293,8 @@ void LLViewerWearable::setTexturesToDefaults() } -//static -const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) +// virtual +LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) const { const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); const std::string &default_image_name = texture_dict->mDefaultImageName; @@ -475,103 +472,9 @@ void LLViewerWearable::setItemID(const LLUUID& item_id) mItemID = item_id; } - -LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) -{ - te_map_t::iterator iter = mTEMap.find(index); - if( iter != mTEMap.end() ) - { - LLLocalTextureObject* lto = iter->second; - return lto; - } - return NULL; -} - -const LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) const -{ - te_map_t::const_iterator iter = mTEMap.find(index); - if( iter != mTEMap.end() ) - { - const LLLocalTextureObject* lto = iter->second; - return lto; - } - return NULL; -} - -std::vector LLViewerWearable::getLocalTextureListSeq() -{ - std::vector result; - - for(te_map_t::const_iterator iter = mTEMap.begin(); - iter != mTEMap.end(); iter++) - { - LLLocalTextureObject* lto = iter->second; - result.push_back(lto); - } - - return result; -} - -void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject <o) -{ - if( mTEMap.find(index) != mTEMap.end() ) - { - mTEMap.erase(index); - } - mTEMap[index] = new LLLocalTextureObject(lto); -} - -void LLViewerWearable::setVisualParams() -{ - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - gAgentAvatarp->setVisualParamWeight(id, value, FALSE); - } -} - void LLViewerWearable::revertValues() { - //update saved settings so wearable is no longer dirty - // non-driver params first - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - F32 value = iter->second; - LLVisualParam *param = getVisualParam(id); - if(param && !dynamic_cast(param) ) - { - setVisualParamWeight(id, value, TRUE); - } - } - - //then driver params - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - F32 value = iter->second; - LLVisualParam *param = getVisualParam(id); - if(param && dynamic_cast(param) ) - { - setVisualParamWeight(id, value, TRUE); - } - } - - // make sure that saved values are sane - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *param = getVisualParam(id); - if( param ) - { - mSavedVisualParamMap[id] = param->getWeight(); - } - } - - syncImages(mSavedTEMap, mTEMap); - + LLWearable::revertValues(); LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) @@ -582,19 +485,7 @@ void LLViewerWearable::revertValues() void LLViewerWearable::saveValues() { - //update saved settings so wearable is no longer dirty - mSavedVisualParamMap.clear(); - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - mSavedVisualParamMap[id] = value; - } - - // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) - syncImages(mTEMap, mSavedTEMap); - + LLWearable::saveValues(); LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) @@ -603,69 +494,6 @@ void LLViewerWearable::saveValues() } } -void LLViewerWearable::syncImages(te_map_t &src, te_map_t &dst) -{ - // Deep copy of src (copies only those tes that are current, filling in defaults where needed) - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - te_map_t::const_iterator iter = src.find(te); - LLUUID image_id; - LLViewerFetchedTexture *image = NULL; - LLLocalTextureObject *lto = NULL; - if(iter != src.end()) - { - // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map. - lto = iter->second; - image = dynamic_cast (lto->getImage()); - image_id = lto->getID(); - } - else - { - // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map. - image_id = getDefaultTextureImageID((ETextureIndex) te); - image = LLViewerTextureManager::getFetchedTexture( image_id ); - } - - if( dst.find(te) != dst.end() ) - { - // there's already an entry in the destination map for the texture. Just update its values. - dst[te]->setImage(image); - dst[te]->setID(image_id); - } - else - { - // no entry found in the destination map, we need to create a new Local Texture Object - dst[te] = new LLLocalTextureObject(image, image_id); - } - - if( lto ) - { - // If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map. - dst[te]->setBakedReady(lto->getBakedReady()); - dst[te]->setDiscard(lto->getDiscard()); - } - } - } -} - -void LLViewerWearable::destroyTextures() -{ - for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter ) - { - LLLocalTextureObject *lto = iter->second; - delete lto; - } - mTEMap.clear(); - for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter ) - { - LLLocalTextureObject *lto = iter->second; - delete lto; - } - mSavedTEMap.clear(); -} - // virtual void LLViewerWearable::setUpdated() const { diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index d8412b1c65..65566f23a5 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -64,12 +64,12 @@ public: void removeFromAvatar( BOOL upload_bake ) { LLViewerWearable::removeFromAvatar( mType, upload_bake ); } static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ); - /*virtual*/ EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp); + /*virtual*/ EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ); void setParamsToDefaults(); void setTexturesToDefaults(); - static const LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index); + /*virtual*/ LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const; void saveNewAsset() const; @@ -79,14 +79,8 @@ public: friend std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w); - /*virtual*/ LLLocalTextureObject* getLocalTextureObject(S32 index); - const LLLocalTextureObject* getLocalTextureObject(S32 index) const; - std::vector getLocalTextureListSeq(); - void setLocalTextureObject(S32 index, LLLocalTextureObject <o); - void setVisualParams(); - - void revertValues(); - void saveValues(); + /*virtual*/ void revertValues(); + /*virtual*/ void saveValues(); // Something happened that requires the wearable's label to be updated (e.g. worn/unworn). /*virtual*/void setUpdated() const; @@ -99,8 +93,6 @@ public: /*virtual*/void addToBakedTextureHash(LLMD5& hash) const; protected: - void syncImages(te_map_t &src, te_map_t &dst); - void destroyTextures(); LLAssetID mAssetID; LLTransactionID mTransactionID; diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 50beaaec3f..3dfacd70f3 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -112,15 +112,16 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else if (status >= 0) { // read the file - LLFILE* fp = LLFile::fopen(std::string(filename), "rb"); /*Flawfinder: ignore*/ - if( !fp ) + llifstream ifs(filename, llifstream::binary); + if( !ifs.is_open() ) { LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL; } else { wearable = new LLViewerWearable(uuid); - LLWearable::EImportResult result = wearable->importFile( fp, avatarp ); + LLWearable::EImportResult result = wearable->importStream( + ifs, avatarp ); if (LLWearable::SUCCESS != result) { if (wearable->getType() == LLWearableType::WT_COUNT) @@ -131,7 +132,6 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID wearable = NULL; } - fclose( fp ); if(filename) { LLFile::remove(std::string(filename)); -- cgit v1.2.3 From d3924200b6b8817461c0f10f87a643005466d4af Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sun, 23 Sep 2012 03:06:11 +0000 Subject: Removing unused gHeadlessClient code from viewer --- indra/newview/llappviewer.cpp | 10 +++----- indra/newview/llstartup.cpp | 11 --------- indra/newview/llviewerdisplay.cpp | 18 -------------- indra/newview/llviewerobjectlist.cpp | 1 - indra/newview/llviewerwindow.cpp | 47 ++---------------------------------- indra/newview/pipeline.cpp | 1 - 6 files changed, 5 insertions(+), 83 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 587435301d..ce5180c0d2 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1319,11 +1319,11 @@ bool LLAppViewer::mainLoop() // Scan keyboard for movement keys. Command keys and typing // are handled by windows callbacks. Don't do this until we're // done initializing. JC - if ((gHeadlessClient || gViewerWindow->getWindow()->getVisible()) + if (gViewerWindow->getWindow()->getVisible() && gViewerWindow->getActive() && !gViewerWindow->getWindow()->getMinimized() && LLStartUp::getStartupState() == STATE_STARTED - && (gHeadlessClient || !gViewerWindow->getShowProgress()) + && !gViewerWindow->getShowProgress() && !gFocusMgr.focusLocked()) { LLMemType mjk(LLMemType::MTYPE_JOY_KEY); @@ -1371,8 +1371,7 @@ bool LLAppViewer::mainLoop() } // Render scene. - // *TODO: Should we run display() even during gHeadlessClient? DK 2011-02-18 - if (!LLApp::isExiting() && !gHeadlessClient) + if (!LLApp::isExiting()) { pingMainloopTimeout("Main:Display"); gGLActive = TRUE; @@ -2992,9 +2991,6 @@ bool LLAppViewer::initWindow() { LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL; - // store setting in a global for easy access and modification - gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient"); - // always start windowed BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ab06b1f5aa..561734aaae 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -772,10 +772,6 @@ bool idle_startup() gUserCredential = gLoginHandler.initializeLoginInfo(); display_startup(); } - if (gHeadlessClient) - { - LL_WARNS("AppInit") << "Waiting at connection box in headless client. Did you mean to add autologin params?" << LL_ENDL; - } // Make sure the process dialog doesn't hide things display_startup(); gViewerWindow->setShowProgress(FALSE); @@ -3507,13 +3503,6 @@ bool process_login_success_response() void transition_back_to_login_panel(const std::string& emsg) { - if (gHeadlessClient && gSavedSettings.getBOOL("AutoLogin")) - { - LL_WARNS("AppInit") << "Failed to login!" << LL_ENDL; - LL_WARNS("AppInit") << emsg << LL_ENDL; - exit(0); - } - // Bounce back to the login screen. reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW ); gSavedSettings.setBOOL("AutoLogin", FALSE); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index cc697f8510..fae20b1c13 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -313,24 +313,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // Logic for forcing window updates if we're in drone mode. // - // *TODO: Investigate running display() during gHeadlessClient. See if this early exit is needed DK 2011-02-18 - if (gHeadlessClient) - { -#if LL_WINDOWS - static F32 last_update_time = 0.f; - if ((gFrameTimeSeconds - last_update_time) > 1.f) - { - InvalidateRect((HWND)gViewerWindow->getPlatformWindow(), NULL, FALSE); - last_update_time = gFrameTimeSeconds; - } -#elif LL_DARWIN - // MBW -- Do something clever here. -#endif - // Not actually rendering, don't bother. - return; - } - - // // Bail out if we're in the startup state and don't want to try to // render the world. diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index c036fcc114..e399b45cba 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1524,7 +1524,6 @@ static LLFastTimer::DeclareTimer FTM_REGION_SHIFT("Region Shift"); void LLViewerObjectList::shiftObjects(const LLVector3 &offset) { - if (gHeadlessClient) return; // This is called when we shift our origin when we cross region boundaries... // We need to update many object caches, I'll document this more as I dig through the code // cleaning things out... diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0cad2e3ec6..1780c2715a 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1385,43 +1385,6 @@ void LLViewerWindow::handleMenuSelect(LLWindow *window, S32 menu_item) BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height) { - // *TODO: Enable similar information output for other platforms? DK 2011-02-18 -#if LL_WINDOWS - if (gHeadlessClient) - { - HWND window_handle = (HWND)window->getPlatformWindow(); - PAINTSTRUCT ps; - HDC hdc; - - RECT wnd_rect; - wnd_rect.left = 0; - wnd_rect.top = 0; - wnd_rect.bottom = 200; - wnd_rect.right = 500; - - hdc = BeginPaint(window_handle, &ps); - //SetBKColor(hdc, RGB(255, 255, 255)); - FillRect(hdc, &wnd_rect, CreateSolidBrush(RGB(255, 255, 255))); - - std::string temp_str; - temp_str = llformat( "FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */ - LLViewerStats::getInstance()->mFPSStat.getMeanPerSec(), - LLViewerStats::getInstance()->mSimPhysicsFPS.getPrev(0), - LLViewerStats::getInstance()->mSimTimeDilation.getPrev(0)); - S32 len = temp_str.length(); - TextOutA(hdc, 0, 0, temp_str.c_str(), len); - - - LLVector3d pos_global = gAgent.getPositionGlobal(); - temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); - len = temp_str.length(); - TextOutA(hdc, 0, 25, temp_str.c_str(), len); - - TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61); - EndPaint(window_handle, &ps); - return TRUE; - } -#endif return FALSE; } @@ -1568,12 +1531,12 @@ LLViewerWindow::LLViewerWindow(const Params& p) resetSnapshotLoc(); // create window + const BOOL clear_bg = FALSE; mWindow = LLWindowManager::createWindow(this, p.title, p.name, p.x, p.y, p.width, p.height, 0, p.fullscreen, - gHeadlessClient, + clear_bg, gSavedSettings.getBOOL("DisableVerticalSync"), - !gHeadlessClient, p.ignore_pixel_depth, gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled @@ -1717,7 +1680,6 @@ LLViewerWindow::LLViewerWindow(const Params& p) void LLViewerWindow::initGLDefaults() { - if (gHeadlessClient) return; gGL.setSceneBlendType(LLRender::BT_ALPHA); if (!LLGLSLShader::sNoFixedFunction) @@ -4997,11 +4959,6 @@ bool LLViewerWindow::onAlert(const LLSD& notify) { LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - if (gHeadlessClient) - { - llinfos << "Alert: " << notification->getName() << llendl; - } - // If we're in mouselook, the mouse is hidden and so the user can't click // the dialog buttons. In that case, change to First Person instead. if( gAgentCamera.cameraMouselook() ) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index e874373f9e..61df5bc2eb 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1139,7 +1139,6 @@ void LLPipeline::releaseScreenBuffers() void LLPipeline::createGLBuffers() { - if (gHeadlessClient) return; stop_glerror(); LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS); assertInitialized(); -- cgit v1.2.3 From ae0bb922909af95d96c140c1d74a4f39a264d4ec Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 06:36:24 -0400 Subject: renamed isUsingBakedTextures to more accurate isUsingServerBakes. Commented some areas we are probably using the function incorrectly --- indra/newview/llagent.cpp | 5 +++-- indra/newview/llviewertexlayer.cpp | 3 ++- indra/newview/llviewerwindow.cpp | 3 ++- indra/newview/llvoavatar.h | 17 +++++++++++++++-- indra/newview/llvoavatarself.cpp | 6 ++++-- 5 files changed, 26 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 4e05836bca..fe48abc25a 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3630,7 +3630,8 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * return; } - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) + // FIXME DRANO wrong check + if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) { // ignore baked textures when in customize mode return; @@ -4262,7 +4263,7 @@ void LLAgent::sendAgentSetAppearance() { if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; - if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingBakedTextures())) + if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes())) { return; } diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index f516562c2f..463906d3ef 100644 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -285,7 +285,8 @@ BOOL LLViewerTexLayerSetBuffer::uploadInProgress() const BOOL LLViewerTexLayerSetBuffer::isReadyToUpload() const { if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries. - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites. + // FIXME DRANO + if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) return FALSE; // Don't upload if avatar is using composites. BOOL ready = FALSE; if (getViewerTexLayerSet()->isLocalTextureDataFinal()) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0cad2e3ec6..aa3cf3bb9c 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4731,7 +4731,8 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) gResizeScreenTexture = TRUE; gWindowResized = TRUE; - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) + // FIXME DRANO + if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) { LLVisualParamHint::requestHintUpdates(); } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 96e87279b2..10c081cf68 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -208,7 +208,6 @@ public: public: virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent - /*virtual*/BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode private: //aligned members LL_ALIGN_16(LLVector4a mImpostorExtents[2]); @@ -636,7 +635,21 @@ public: //-------------------------------------------------------------------- public: BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; } - BOOL isUsingLocalAppearance() const { return mUseLocalAppearance; } + + // True if we are computing our appearance via local compositing + // instead of baked textures, as for example during wearable + // editing or when waiting for a subsequent server rebake. + /*virtual*/ BOOL isUsingLocalAppearance() const { return mUseLocalAppearance; } + + // True if this avatar should fetch its baked textures via the new + // appearance mechanism. + /*virtual*/ BOOL isUsingServerBakes() const { return mUseServerBakes; } + + // True if we are currently in appearance editing mode. Often but + // not always the same as isUsingLocalAppearance(). + /*virtual*/ BOOL isEditingAppearance() const { return mIsEditingAppearance; } + + // FIXME review isUsingLocalAppearance uses, some should be isEditing instead. private: BOOL mAppearanceAnimating; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index c5bb4c3700..d6d1853bec 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1274,7 +1274,8 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr discard_level < local_tex_obj->getDiscard()) { local_tex_obj->setDiscard(discard_level); - if (isUsingBakedTextures()) + // FIXME DRANO + if (isUsingServerBakes()) { requestLayerSetUpdate(index); } @@ -1758,7 +1759,8 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te local_tex_obj->setDiscard(tex_discard); if (isSelf()) { - if (gAgentAvatarp->isUsingBakedTextures()) + // FIXME DRANO + if (gAgentAvatarp->isUsingServerBakes()) { requestLayerSetUpdate(type); } -- cgit v1.2.3 From 04b0862b3b53ef57801b779c51e6b8fe1c442008 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 11:27:13 -0400 Subject: use accessors for mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes --- indra/newview/llvoavatar.cpp | 16 ++++++++-------- indra/newview/llvoavatarself.cpp | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5ccd2d206d..1676f656d3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4060,7 +4060,7 @@ void LLVOAvatar::updateTextures() if (isIndexBakedTexture((ETextureIndex)texture_index) && imagep->getID() != IMG_DEFAULT_AVATAR && imagep->getID() != IMG_INVISIBLE - && !mUseServerBakes + && !isUsingServerBakes() && !imagep->getTargetHost().isOk()) { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " @@ -4203,7 +4203,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { std::string url = ""; - if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + if (isUsingServerBakes() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) { const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) @@ -5816,7 +5816,7 @@ void LLVOAvatar::updateMeshTextures() for (U32 i=0; i < mBakedTextureDatas.size(); i++) { LLViewerTexLayerSet* layerset = getTexLayerSet(i); - if (use_lkg_baked_layer[i] && !mUseLocalAppearance ) + if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); @@ -5852,7 +5852,7 @@ void LLVOAvatar::updateMeshTextures() } } } - else if (!mUseLocalAppearance && is_layer_baked[i]) + else if (!isUsingLocalAppearance() && is_layer_baked[i]) { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) @@ -5872,7 +5872,7 @@ void LLVOAvatar::updateMeshTextures() src_callback_list, paused ); } } - else if (layerset && mUseLocalAppearance) + else if (layerset && isUsingLocalAppearance()) { layerset->createComposite(); layerset->setUpdatesEnabled( TRUE ); @@ -5913,7 +5913,7 @@ void LLVOAvatar::updateMeshTextures() // set texture and color of hair manually if we are not using a baked image. // This can happen while loading hair for yourself, or for clients that did not // bake a hair texture. Still needed for yourself after 1.22 is depricated. - if (!is_layer_baked[BAKED_HAIR] || mIsEditingAppearance) + if (!is_layer_baked[BAKED_HAIR] || isEditingAppearance()) { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); @@ -6360,7 +6360,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if( isSelf() ) { llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived && !mUseServerBakes) + if( mFirstTEMessageReceived && !isUsingServerBakes()) { // llinfos << "processAvatarAppearance end " << mID << llendl; return; @@ -6399,7 +6399,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } // Check for stale update. - if (mUseServerBakes && isSelf() + if (isUsingServerBakes() && isSelf() && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL && this_update_cof_version < last_update_request_cof_version) { diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index d6d1853bec..b4f36a6391 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2671,6 +2671,7 @@ void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) gAgentAvatarp->mIsEditingAppearance = false; if (gAgentAvatarp->getRegion() && !gAgentAvatarp->getRegion()->getCentralBakeVersion()) { + // FIXME DRANO - move to sendAgentSetAppearance, make conditional on upload complete. gAgentAvatarp->mUseLocalAppearance = false; } -- cgit v1.2.3 From ab83fab72c66e753917001a9030aa55e69a3c496 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 11:52:19 -0400 Subject: error checking, comments for areas needing fix/check in appearance --- indra/newview/llagent.cpp | 5 +++++ indra/newview/llviewertexlayer.cpp | 2 +- indra/newview/llviewerwindow.cpp | 2 +- indra/newview/llvoavatar.cpp | 9 ++++++++- indra/newview/llvoavatarself.cpp | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) mode change 100644 => 100755 indra/newview/llviewertexlayer.cpp (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index fe48abc25a..ffcd263d06 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4263,6 +4263,8 @@ void LLAgent::sendAgentSetAppearance() { if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; + + // FIXME DRANO - remove server bake check, covered by central bake check above? if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes())) { return; @@ -4321,6 +4323,9 @@ void LLAgent::sendAgentSetAppearance() } // only update cache entries if we have all our baked textures + // FIXME DRANO additional if check for not in appearance editing + // mode, if still using local composites need to set using local + // composites to false, update mesh textures. if (textures_current) { LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL; diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp old mode 100644 new mode 100755 index 463906d3ef..9477e89f1c --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -285,7 +285,7 @@ BOOL LLViewerTexLayerSetBuffer::uploadInProgress() const BOOL LLViewerTexLayerSetBuffer::isReadyToUpload() const { if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries. - // FIXME DRANO + // FIXME DRANO - should be checking local appearance? if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) return FALSE; // Don't upload if avatar is using composites. BOOL ready = FALSE; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index aa3cf3bb9c..d6d127ddfc 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4731,7 +4731,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) gResizeScreenTexture = TRUE; gWindowResized = TRUE; - // FIXME DRANO + // FIXME DRANO - what to check against here? if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) { LLVisualParamHint::requestHintUpdates(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1676f656d3..0f18aa358c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4203,8 +4203,15 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { std::string url = ""; - if (isUsingServerBakes() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + if (isUsingServerBakes()) { + if (gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + { + // Probably a server-side issue if we get here: + llwarns << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << llendl; + return url; + } + const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) { diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b4f36a6391..6f58ffc5c1 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1274,7 +1274,7 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr discard_level < local_tex_obj->getDiscard()) { local_tex_obj->setDiscard(discard_level); - // FIXME DRANO + // FIXME DRANO - should this be a local appearance check? if (isUsingServerBakes()) { requestLayerSetUpdate(index); -- cgit v1.2.3 From 93e210d91f521b01deb10aa6aa25160364e6ae28 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 15:45:58 -0400 Subject: more state management stuff, DRANO flags for problematic areas --- indra/newview/llagent.cpp | 12 ++++++++---- indra/newview/llviewertexlayer.cpp | 3 +-- indra/newview/llviewerwearable.cpp | 2 ++ indra/newview/llviewerwindow.cpp | 3 +-- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatarself.cpp | 16 ++++------------ 6 files changed, 17 insertions(+), 21 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index ffcd263d06..bb9f8eaa26 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3630,8 +3630,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * return; } - // FIXME DRANO wrong check - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) + if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance()) { // ignore baked textures when in customize mode return; @@ -4261,11 +4260,16 @@ void LLAgent::requestLeaveGodMode() //----------------------------------------------------------------------------- void LLAgent::sendAgentSetAppearance() { + // FIXME DRANO - this return short-circuits a bunch of phase stat tracking below. if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; + // FIXME DRANO - problems around new-style appearance in an old-style region. + // - does this get called? + // - need to change mUseServerBakes->FALSE in that case + // - need to call processAvatarAppearance as if server had returned this result? + // gAgentAvatarp->mUseServerBakes = FALSE; - // FIXME DRANO - remove server bake check, covered by central bake check above? - if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes())) + if (gAgentQueryManager.mNumPendingQueries > 0) { return; } diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index 9477e89f1c..b129c28e0d 100755 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -285,8 +285,7 @@ BOOL LLViewerTexLayerSetBuffer::uploadInProgress() const BOOL LLViewerTexLayerSetBuffer::isReadyToUpload() const { if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries. - // FIXME DRANO - should be checking local appearance? - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) return FALSE; // Don't upload if avatar is using composites. + if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance()) return FALSE; // Don't upload if avatar is being edited. BOOL ready = FALSE; if (getViewerTexLayerSet()->isLocalTextureDataFinal()) diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 373cc63b41..bd277349d6 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -537,6 +537,8 @@ void LLViewerWearable::setVisualParams() void LLViewerWearable::revertValues() { + // FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance. + //update saved settings so wearable is no longer dirty // non-driver params first for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d6d127ddfc..209e49940a 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4731,8 +4731,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) gResizeScreenTexture = TRUE; gWindowResized = TRUE; - // FIXME DRANO - what to check against here? - if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) + if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance()) { LLVisualParamHint::requestHintUpdates(); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0f18aa358c..a7a08208d4 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -626,7 +626,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), - mUseServerBakes(TRUE) + mUseServerBakes(FALSE) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 6f58ffc5c1..65cadb66df 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1274,12 +1274,8 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr discard_level < local_tex_obj->getDiscard()) { local_tex_obj->setDiscard(discard_level); - // FIXME DRANO - should this be a local appearance check? - if (isUsingServerBakes()) - { - requestLayerSetUpdate(index); - } - else + requestLayerSetUpdate(index); + if (isEditingAppearance()) { LLVisualParamHint::requestHintUpdates(); } @@ -1759,12 +1755,8 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te local_tex_obj->setDiscard(tex_discard); if (isSelf()) { - // FIXME DRANO - if (gAgentAvatarp->isUsingServerBakes()) - { - requestLayerSetUpdate(type); - } - else + requestLayerSetUpdate(type); + if (isEditingAppearance()) { LLVisualParamHint::requestHintUpdates(); } -- cgit v1.2.3 From 05ee87af14c4d20e754aa525e4a3f78eb736a96b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 17:02:46 -0400 Subject: Fixed problems caused by defaulting mUseServerBakes to false --- indra/newview/llvoavatar.cpp | 25 ++++++++++++------------- indra/newview/llvoavatarself.cpp | 5 ++++- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a7a08208d4..f5299f0fa3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6364,23 +6364,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; - if( isSelf() ) - { - llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived && !isUsingServerBakes()) - { -// llinfos << "processAvatarAppearance end " << mID << llendl; - return; - } - } - ESex old_sex = getSex(); -// llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; -// dumpAvatarTEs( "PRE processAvatarAppearance()" ); LLTEContents tec; parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); -// dumpAvatarTEs( "POST processAvatarAppearance()" ); U8 appearance_version = 0; S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN; @@ -6405,6 +6392,18 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mUseServerBakes = false; } + // Only now that we have result of appearance_version can we decide whether to bail out. + // Don't expect this case to occur. + if( isSelf() ) + { + llwarns << avString() << "Received AvatarAppearance for self" << llendl; + if( mFirstTEMessageReceived && !isUsingServerBakes()) + { + return; + } + } + + // Check for stale update. if (isUsingServerBakes() && isSelf() && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 65cadb66df..7ca40a8752 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -746,7 +746,10 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, { U32 retval = LLVOAvatar::processUpdateMessage(mesgsys,user_data,block_num,update_type,dp); - if (mInitialBakesLoaded == false && retval == 0x0) + // FIXME DRANO - skipping in the case of !mFirstAppearanceMessageReceived prevents us from trying to + // load textures before we know where they come from (ie, from baking service or not); + // unknown impact on performance. + if (mInitialBakesLoaded == false && retval == 0x0 && mFirstAppearanceMessageReceived) { // call update textures to force the images to be created updateMeshTextures(); -- cgit v1.2.3 From 0bb1324a27d4dd94d6f8a9d445ab892127f48c5f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 18:11:57 -0400 Subject: Debug text for avatar appearance state related to server-side baking project --- indra/newview/llvoavatar.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f5299f0fa3..fb06eb24c1 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2882,6 +2882,20 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // clear debug text mDebugText.clear(); + + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + S32 central_bake_version = -1; + if (getRegion()) + { + central_bake_version = getRegion()->getCentralBakeVersion(); + } + addDebugText(llformat("mUseLocalAppearance: %d,\nmIsEditingAppearance: %d\n" + "mUseServerBakes %d,\ncentralBakeVersion %d", + mUseLocalAppearance, mIsEditingAppearance, + mUseServerBakes, central_bake_version)); + } + if (LLVOAvatar::sShowAnimationDebug) { for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin(); -- cgit v1.2.3 From 4f93192e7d00f1f03e0e5241e9f1d2f31623729c Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 27 Sep 2012 00:38:52 +0000 Subject: Fix for mac/linux 'ruth' appearance. Fix for linux build issue --- indra/newview/llviewerwearable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 162c20837a..41cef237ed 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -319,7 +319,8 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; -#if 1 + // *TODO: Check with Vir on this: +#if 0 if (!viewer_avatar->isUsingLocalAppearance()) { return; -- cgit v1.2.3 From 352698140775e62498686f80b5aa21aee85524cf Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Sep 2012 05:47:48 -0400 Subject: Fix for ruthing in non-server-bake regions --- indra/newview/llviewerwearable.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index bd277349d6..440548046f 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -38,6 +38,7 @@ #include "llavatarappearancedefines.h" #include "llviewerwearable.h" #include "llviewercontrol.h" +#include "llviewerregion.h" using namespace LLAvatarAppearanceDefines; @@ -322,8 +323,9 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; - // FIXME restrict this check to server bake regions? - if (!viewer_avatar->isUsingLocalAppearance()) + if (viewer_avatar->getRegion() && + (viewer_avatar->getRegion()->getCentralBakeVersion()>0) && + !viewer_avatar->isUsingLocalAppearance()) { return; } -- cgit v1.2.3 From 878eb2b61a26eef3151319cffd1d8d5196b118c2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Sep 2012 17:46:19 -0400 Subject: audited uses of centralBakeVersion vs. isUsingServerBakes --- indra/newview/llagent.cpp | 11 ++++++----- indra/newview/llappearancemgr.cpp | 1 + indra/newview/llviewerregion.cpp | 1 + indra/newview/llviewerwearable.cpp | 5 +++-- indra/newview/llvoavatar.cpp | 25 ++++++++++++------------- indra/newview/llvoavatar.h | 2 ++ 6 files changed, 25 insertions(+), 20 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index bb9f8eaa26..709d29e884 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4260,9 +4260,6 @@ void LLAgent::requestLeaveGodMode() //----------------------------------------------------------------------------- void LLAgent::sendAgentSetAppearance() { - // FIXME DRANO - this return short-circuits a bunch of phase stat tracking below. - if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; - // FIXME DRANO - problems around new-style appearance in an old-style region. // - does this get called? // - need to change mUseServerBakes->FALSE in that case @@ -4282,6 +4279,9 @@ void LLAgent::sendAgentSetAppearance() } gAgentAvatarp->sendAppearanceChangeMetrics(); + + if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; + LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL; //dumpAvatarTEs( "sendAgentSetAppearance()" ); @@ -4327,9 +4327,10 @@ void LLAgent::sendAgentSetAppearance() } // only update cache entries if we have all our baked textures - // FIXME DRANO additional if check for not in appearance editing + + // FIXME DRANO need additional check for not in appearance editing // mode, if still using local composites need to set using local - // composites to false, update mesh textures. + // composites to false, and update mesh textures. if (textures_current) { LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1e4e00d77d..c57269d0b0 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1750,6 +1750,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) { requestServerAppearanceUpdate(); } + gAgentAvatarp->setIsUsingServerBakes(gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()); //dumpCat(getCOF(),"COF, start"); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index fb50b8bb77..0855bc9243 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -283,6 +283,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mSimAccess( SIM_ACCESS_MIN ), mBillableFactor(1.0), mMaxTasks(DEFAULT_MAX_REGION_WIDE_PRIM_COUNT), + mCentralBakeVersion(0), mClassID(0), mCPURatio(0), mColoName("unknown"), diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 440548046f..9b1d8d7936 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -323,8 +323,9 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; - if (viewer_avatar->getRegion() && - (viewer_avatar->getRegion()->getCentralBakeVersion()>0) && + // FIXME DRANO - kludgy way to avoid overwriting avatar state from wearables. + // Ideally would avoid calling this func in the first place. + if (viewer_avatar->isUsingServerBakes() && !viewer_avatar->isUsingLocalAppearance()) { return; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fb06eb24c1..50c2659563 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -626,7 +626,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), - mUseServerBakes(FALSE) + mUseServerBakes(FALSE) // FIXME DRANO consider using boost::optional, defaulting to unknown. { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune @@ -2890,8 +2890,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { central_bake_version = getRegion()->getCentralBakeVersion(); } - addDebugText(llformat("mUseLocalAppearance: %d,\nmIsEditingAppearance: %d\n" - "mUseServerBakes %d,\ncentralBakeVersion %d", + addDebugText(llformat("mUseLocalAppearance: %d\nmIsEditingAppearance: %d\n" + "mUseServerBakes %d\ncentralBakeVersion %d", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version)); } @@ -6397,20 +6397,15 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } - if (appearance_version > 0) - { - mUseServerBakes = true; - } - else - { - mUseServerBakes = false; - } + mUseServerBakes = (appearance_version > 0); // Only now that we have result of appearance_version can we decide whether to bail out. - // Don't expect this case to occur. if( isSelf() ) { - llwarns << avString() << "Received AvatarAppearance for self" << llendl; + if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) + { + llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; + } if( mFirstTEMessageReceived && !isUsingServerBakes()) { return; @@ -7052,6 +7047,10 @@ void LLVOAvatar::bodySizeChanged() } } +void LLVOAvatar::setIsUsingServerBakes(BOOL newval) +{ + mUseServerBakes = newval; +} // virtual void LLVOAvatar::removeMissingBakedTextures() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 10c081cf68..5f858a2bea 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -644,6 +644,8 @@ public: // True if this avatar should fetch its baked textures via the new // appearance mechanism. /*virtual*/ BOOL isUsingServerBakes() const { return mUseServerBakes; } + void setIsUsingServerBakes(BOOL newval); + // True if we are currently in appearance editing mode. Often but // not always the same as isUsingLocalAppearance(). -- cgit v1.2.3 From 5483bc28ae6b33bf5b2371d46648ad20975daf8c Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 2 Oct 2012 01:02:34 +0000 Subject: Moved gatherMorphMaskAlpha into llappearance. --- indra/newview/llviewertexlayer.cpp | 21 +++------------------ indra/newview/llviewertexlayer.h | 1 - 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index b129c28e0d..cd5e781d71 100755 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -379,7 +379,9 @@ void LLViewerTexLayerSetBuffer::doUpload() LLGLSUIDefault gls_ui; LLPointer baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 ); U8* baked_mask_data = baked_mask_image->getData(); - layer_set->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight); + layer_set->gatherMorphMaskAlpha(baked_mask_data, + mOrigin.mX, mOrigin.mY, + mFullWidth, mFullHeight); // Create the baked image from our color and mask information @@ -700,23 +702,6 @@ void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b ) mUpdatesEnabled = b; } - -void LLViewerTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) -{ - memset(data, 255, width * height); - - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) - { - LLTexLayerInterface* layer = *iter; - layer->gatherAlphaMasks(data, getViewerComposite()->getOriginX(), - getViewerComposite()->getOriginY(), width, height); - } - - // Set alpha back to that of our alpha masks. - renderAlphaMaskTextures(getViewerComposite()->getOriginX(), - getViewerComposite()->getOriginY(), width, height, true); -} - LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() { return dynamic_cast (mAvatarAppearance); diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index 9df9474eff..959c883da8 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -55,7 +55,6 @@ public: /*virtual*/void createComposite(); void setUpdatesEnabled(BOOL b); BOOL getUpdatesEnabled() const { return mUpdatesEnabled; } - void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height); LLVOAvatarSelf* getAvatar(); const LLVOAvatarSelf* getAvatar() const; -- cgit v1.2.3 From e29b66ed6ce29528f7b733c51db22a31a05d3a5f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2012 17:13:18 -0400 Subject: additional fixes for avoiding avatar param manipulation via wearables, setting correct state from avatar appearance --- indra/newview/llviewerwearable.cpp | 4 ++++ indra/newview/llvoavatarself.cpp | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index f3d9b2c678..1200f65b6e 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -476,6 +476,10 @@ void LLViewerWearable::setItemID(const LLUUID& item_id) void LLViewerWearable::revertValues() { + if (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes() && !gAgentAvatarp->isUsingLocalAppearance()) + { + return; + } LLWearable::revertValues(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 7ca40a8752..a29ef2f3ad 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -668,6 +668,13 @@ BOOL LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight return FALSE; } + // FIXME DRANO - kludgy way to avoid overwriting avatar state from wearables. + if (isUsingServerBakes() && !isUsingLocalAppearance()) + { + return FALSE; + } + + if (param->getCrossWearable()) { LLWearableType::EType type = (LLWearableType::EType)param->getWearableType(); -- cgit v1.2.3 From 8c0aa31536c447edb6ef4fbee43f99debf593a20 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 4 Oct 2012 00:42:31 +0000 Subject: Adding optimization to skip alpha image analysis when it isn't needed. --- indra/newview/llviewerwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 63fe9312df..4f66b32c1f 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1641,7 +1641,8 @@ LLViewerWindow::LLViewerWindow(const Params& p) // Init the image list. Must happen after GL is initialized and before the images that // LLViewerWindow needs are requested. - LLImageGL::initClass(LLGLTexture::MAX_GL_IMAGE_CATEGORY) ; + const BOOL SKIP_ANALYZE_ALPHA=FALSE; + LLImageGL::initClass(LLGLTexture::MAX_GL_IMAGE_CATEGORY, SKIP_ANALYZE_ALPHA) ; gTextureList.init(); LLViewerTextureManager::init() ; gBumpImageList.init(); -- cgit v1.2.3 From c9ab9590aa1d44ea139b16e7ffcb1461d928bdd5 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 4 Oct 2012 03:12:48 +0000 Subject: Removing server-related cmake cruft. Fixing libGLU warnings on linux. --- indra/newview/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b12853b014..83b38e89f9 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -12,7 +12,7 @@ include(DragDrop) include(EXPAT) include(FMOD) include(OPENAL) -include(FindOpenGL) +include(OpenGL) include(Hunspell) include(JsonCpp) include(LLAudio) -- cgit v1.2.3 From 21df924a10c1c32f7fc28bb29b20dc2179863b24 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 4 Oct 2012 06:29:07 +0000 Subject: Building headless and non-headless libraries side-by-side, removing the need for the BAKING cmake setting. --- indra/newview/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 83b38e89f9..25feb24788 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1539,6 +1539,12 @@ add_executable(${VIEWER_BINARY_NAME} ${viewer_SOURCE_FILES} ) +if (SDL_FOUND) + set_property(TARGET ${VIEWER_BINARY_NAME} + PROPERTY COMPILE_DEFINITIONS LL_SDL=1 + ) +endif (SDL_FOUND) + # add package files file(GLOB EVENT_HOST_SCRIPT_GLOB_LIST ${CMAKE_CURRENT_SOURCE_DIR}/../viewer_components/*.py) -- cgit v1.2.3 From c06c35609c6683731eaea283468f6b32af18fea2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 11 Oct 2012 00:09:04 +0000 Subject: Updating linux build to gcc4.6 --- indra/newview/CMakeLists.txt | 7 ++++++- indra/newview/llagent.cpp | 4 +--- indra/newview/llagentcamera.cpp | 14 -------------- indra/newview/llbuycurrencyhtml.cpp | 4 ++++ indra/newview/llcompilequeue.cpp | 12 ------------ indra/newview/lldrawable.cpp | 2 -- indra/newview/llfasttimerview.cpp | 5 +---- indra/newview/llflexibleobject.cpp | 3 --- indra/newview/llfloatermodelpreview.cpp | 13 ------------- indra/newview/llfloaterreporter.cpp | 7 +------ indra/newview/llfloateruipreview.cpp | 1 - indra/newview/llfolderview.cpp | 8 -------- indra/newview/llhudtext.cpp | 5 +---- indra/newview/llimview.cpp | 6 +----- indra/newview/llinventorybridge.cpp | 1 - indra/newview/llinventorymodel.cpp | 10 ---------- indra/newview/llinventorypanel.cpp | 6 ------ indra/newview/llmaniprotate.cpp | 1 - indra/newview/llmanipscale.cpp | 5 ----- indra/newview/llmaniptranslate.cpp | 17 ----------------- indra/newview/llmeshrepository.cpp | 4 +--- indra/newview/llnetmap.cpp | 2 +- indra/newview/llpanelcontents.cpp | 2 -- indra/newview/llpaneleditwearable.cpp | 5 +---- indra/newview/llpanelface.cpp | 1 - indra/newview/llpanelgrouplandmoney.cpp | 4 ---- indra/newview/llpanellandmarkinfo.cpp | 18 ------------------ indra/newview/llpanelobject.cpp | 3 +-- indra/newview/llpanelpermissions.cpp | 4 +--- indra/newview/llpanelvolume.cpp | 3 +-- indra/newview/llphysicsmotion.cpp | 13 ++++++------- indra/newview/llscreenchannel.cpp | 3 +-- indra/newview/llsechandler_basic.cpp | 2 -- indra/newview/llselectmgr.cpp | 2 -- indra/newview/llsidepaneltaskinfo.cpp | 4 +--- indra/newview/llspatialpartition.cpp | 6 ------ indra/newview/llspeakers.cpp | 2 +- indra/newview/llstartup.cpp | 7 ------- indra/newview/llsurface.cpp | 2 -- indra/newview/lltoastnotifypanel.cpp | 2 -- indra/newview/lltoolcomp.cpp | 2 +- indra/newview/lltoolfocus.cpp | 10 ---------- indra/newview/lltoolpie.cpp | 7 ------- indra/newview/llurlhistory.cpp | 2 -- indra/newview/llviewercamera.cpp | 6 +----- indra/newview/llviewerdisplay.cpp | 1 - indra/newview/llviewermediafocus.cpp | 2 -- indra/newview/llviewermessage.cpp | 15 ++------------- indra/newview/llviewerobjectlist.cpp | 9 ++++++--- indra/newview/llviewerparcelmedia.cpp | 2 -- indra/newview/llviewertexteditor.cpp | 2 -- indra/newview/llviewerwindow.cpp | 2 -- indra/newview/llvlcomposition.cpp | 8 -------- indra/newview/llvoavatar.cpp | 6 ------ indra/newview/llvoavatarself.cpp | 4 ---- indra/newview/llvoicevivox.cpp | 11 +++++------ indra/newview/llvosurfacepatch.cpp | 10 ++-------- indra/newview/llvowlsky.cpp | 16 ++++++++-------- indra/newview/llwaterparamset.cpp | 2 -- indra/newview/llworldmapview.cpp | 3 --- indra/newview/pipeline.cpp | 6 +----- 61 files changed, 56 insertions(+), 290 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 25feb24788..6835939292 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -65,7 +65,6 @@ include_directories( ${LLINVENTORY_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS} ${LLMESSAGE_INCLUDE_DIRS} - ${LLPHYSICSEXTENSIONS_INCLUDE_DIRS} ${LLPLUGIN_INCLUDE_DIRS} ${LLPRIMITIVE_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS} @@ -84,6 +83,12 @@ include_directories( ${LLAPPEARANCE_INCLUDE_DIRS} ) +include_directories(SYSTEM + ${LLCOMMON_SYSTEM_INCLUDE_DIRS} + ${LLXML_SYSTEM_INCLUDE_DIRS} + ${LLPHYSICSEXTENSIONS_INCLUDE_DIRS} + ) + set(viewer_SOURCE_FILES groupchatlistener.cpp llaccountingcostmanager.cpp diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 709d29e884..3e26eac59a 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1709,13 +1709,11 @@ void LLAgent::autoPilot(F32 *delta_yaw) *delta_yaw = yaw; - // Compute when to start slowing down and when to stop - F32 stop_distance = mAutoPilotStopDistance; + // Compute when to start slowing down F32 slow_distance; if (getFlying()) { slow_distance = llmax(6.f, mAutoPilotStopDistance + 5.f); - stop_distance = llmax(2.f, mAutoPilotStopDistance); } else { diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 7f4d33753d..f7b1ba44f0 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -593,7 +593,6 @@ BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) abs_target_offset.abs(); LLVector3 target_offset_dir = target_offset_origin; - F32 object_radius = mFocusObject->getVObjRadius(); BOOL target_outside_object_extents = FALSE; @@ -688,17 +687,6 @@ BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) LLVector3 camera_offset_object(getCameraPositionAgent() - mFocusObject->getPositionAgent()); - // length projected orthogonal to target offset - F32 camera_offset_dist = (camera_offset_object - target_offset_dir * (camera_offset_object * target_offset_dir)).magVec(); - - // calculate whether the target point would be "visible" if it were outside the bounding box - // on the opposite of the splitting plane defined by object_split_axis; - BOOL exterior_target_visible = FALSE; - if (camera_offset_dist > object_radius) - { - // target is visible from camera, so turn off fov zoom - exterior_target_visible = TRUE; - } F32 camera_offset_clip = camera_offset_object * object_split_axis; F32 target_offset_clip = target_offset_dir * object_split_axis; @@ -1657,7 +1645,6 @@ F32 LLAgentCamera::calcCameraFOVZoomFactor() else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar) { // don't FOV zoom on mostly transparent objects - LLVector3 focus_offset = mFocusObjectOffset; F32 obj_min_dist = 0.f; calcCameraMinDistance(obj_min_dist); F32 current_distance = llmax(0.001f, camera_offset_dir.magVec()); @@ -1819,7 +1806,6 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) // set the global camera position LLVector3d camera_offset; - LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : gAgentAvatarp->getRenderPosition(); camera_offset.setVec( local_camera_offset ); camera_position_global = frame_center_global + head_offset + camera_offset; diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp index e5a9be0203..459123a5d8 100644 --- a/indra/newview/llbuycurrencyhtml.cpp +++ b/indra/newview/llbuycurrencyhtml.cpp @@ -61,6 +61,10 @@ public: if ( params.size() >= 3 ) { result_code = params[ 2 ].asInteger(); + if ( result_code != 0 ) + { + LL_WARNS("LLBuyCurrency") << "Received nonzero result code: " << result_code << LL_ENDL ; + } }; // open the legacy XUI based currency floater diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 4f5f9e22b6..4588424474 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -161,18 +161,6 @@ BOOL LLFloaterScriptQueue::start() { std::string buffer; - LLSelectMgr *mgr = LLSelectMgr::getInstance(); - LLObjectSelectionHandle selectHandle = mgr->getSelection(); - U32 n_objects = 0; - if (gSavedSettings.getBOOL("EditLinkedParts")) - { - n_objects = selectHandle->getObjectCount(); - } - else - { - n_objects = selectHandle->getRootObjectCount(); - } - LLStringUtil::format_map_t args; args["[START]"] = mStartString; args["[COUNT]"] = llformat ("%d", mObjectIDs.count()); diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 4eda2b92b3..ded8b20829 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -503,7 +503,6 @@ F32 LLDrawable::updateXform(BOOL undamped) //scaling LLVector3 target_scale = mVObjp->getScale(); LLVector3 old_scale = mCurrentScale; - LLVector3 dest_scale = target_scale; // Damping F32 dist_squared = 0.f; @@ -1215,7 +1214,6 @@ LLCamera LLSpatialBridge::transformCamera(LLCamera& camera) LLCamera ret = camera; LLXformMatrix* mat = mDrawable->getXform(); LLVector3 center = LLVector3(0,0,0) * mat->getWorldMatrix(); - LLQuaternion rotation = LLQuaternion(mat->getWorldMatrix()); LLVector3 delta = ret.getOrigin() - center; LLQuaternion rot = ~mat->getRotation(); diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 9664aa7dbe..04ed362719 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -369,7 +369,7 @@ void LLFastTimerView::draw() S32 left, top, right, bottom; S32 x, y, barw, barh, dx, dy; - S32 texth, textw; + S32 texth; LLPointer box_imagep = LLUI::getUIImage("Rounded_Square"); // Draw the window background @@ -410,7 +410,6 @@ void LLFastTimerView::draw() tdesc = llformat("Full bar = %s [Click to pause/reset] [SHIFT-Click to toggle]",modedesc[mDisplayMode]); LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); - textw = LLFontGL::getFontMonospace()->getWidth(tdesc); x = xleft, y -= (texth + 2); tdesc = llformat("Justification = %s [CTRL-Click to toggle]",centerdesc[mDisplayCenter]); @@ -537,8 +536,6 @@ void LLFastTimerView::draw() y -= (texth + 2); - textw = dx + LLFontGL::getFontMonospace()->getWidth(idp->getName()) + 40; - if (idp->getCollapsed()) { it.skipDescendants(); diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index ef412a6bbf..a9d7c749ab 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -270,9 +270,6 @@ void LLVolumeImplFlexible::setAttributesOfAllSections(LLVector3* inScale) mSection[0].mVelocity.setVec(0,0,0); mSection[0].mAxisRotation.setQuat(begin_rot,0,0,1); - LLVector3 parentSectionPosition = mSection[0].mPosition; - LLVector3 last_direction = mSection[0].mDirection; - remapSections(mSection, mInitializedRes, mSection, mSimulateRes); mInitializedRes = mSimulateRes; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index dbab15dc9e..35d306c6c0 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -746,7 +746,6 @@ void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit) void LLFloaterModelPreview::draw() { LLFloater::draw(); - LLRect r = getRect(); mModelPreview->update(); @@ -1670,7 +1669,6 @@ bool LLModelLoader::doLoadModel() //If no skeleton, do a breadth-first search to get at specific joints bool rootNode = false; - bool skeletonWithNoRootNode = false; //Need to test for a skeleton that does not have a root node //This occurs when your instance controller does not have an associated scene @@ -1681,10 +1679,6 @@ bool LLModelLoader::doLoadModel() { rootNode = true; } - else - { - skeletonWithNoRootNode = true; - } } if ( !pSkeleton || !rootNode ) @@ -4977,16 +4971,9 @@ BOOL LLModelPreview::render() bool upload_skin = mFMP->childGetValue("upload_skin").asBoolean(); bool upload_joints = mFMP->childGetValue("upload_joints").asBoolean(); - bool resetJoints = false; if ( upload_joints != mLastJointUpdate ) { - if ( mLastJointUpdate ) - { - resetJoints = true; - } - mLastJointUpdate = upload_joints; - } for (LLModelLoader::scene::iterator iter = mScene[mPreviewLOD].begin(); iter != mScene[mPreviewLOD].end(); ++iter) diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index da773e90ec..86bd15b217 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -813,12 +813,7 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, return; } - EReportType report_type = UNKNOWN_REPORT; - if (data->mPreferredLocation == LLResourceData::INVALID_LOCATION) - { - report_type = COMPLAINT_REPORT; - } - else + if (data->mPreferredLocation != LLResourceData::INVALID_LOCATION) { llwarns << "Unknown report type : " << data->mPreferredLocation << llendl; } diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index d741b5b133..5e43e981a4 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -914,7 +914,6 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) else { panel->buildFromFile(path); // build it - LLRect new_size = panel->getRect(); // get its rectangle panel->setOrigin(2,2); // reset its origin point so it's not offset by -left or other XUI attributes (*floaterp)->setTitle(path); // use the file name as its title, since panels have no guaranteed meaningful name attribute panel->setUseBoundingRect(TRUE); // enable the use of its outer bounding rect (normally disabled because it's O(n) on the number of sub-elements) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index d4080ab3f7..93f9c0a3f3 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -888,7 +888,6 @@ void LLFolderView::commitRename( const LLSD& data ) void LLFolderView::draw() { - static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", LLColor4::white); if (mDebugFilters) { std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", @@ -1506,12 +1505,6 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) LLMenuGL::sMenuContainer->hideMenus(); } - LLView *item = NULL; - if (getChildCount() > 0) - { - item = *(getChildList()->begin()); - } - switch( key ) { case KEY_F2: @@ -2034,7 +2027,6 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr { LLRect local_rect = item->getLocalRect(); LLRect item_scrolled_rect; // item position relative to display area of scroller - LLRect visible_doc_rect = mScrollContainer->getVisibleContentRect(); S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight(); S32 label_height = getLabelFontForStyle(mLabelStyle)->getLineHeight(); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 579b6008ae..3c6bcd9829 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -186,11 +186,8 @@ void LLHUDText::renderText() LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); } - LLVector2 border_scale_vec((F32)border_width / (F32)imagep->getTextureWidth(), (F32)border_height / (F32)imagep->getTextureHeight()); LLVector3 width_vec = mWidth * x_pixel_vec; LLVector3 height_vec = mHeight * y_pixel_vec; - LLVector3 scaled_border_width = (F32)llfloor(border_scale * (F32)border_width) * x_pixel_vec; - LLVector3 scaled_border_height = (F32)llfloor(border_scale * (F32)border_height) * y_pixel_vec; mRadius = (width_vec + height_vec).magVec() * 0.5f; @@ -440,7 +437,7 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) LLVector3 x_pixel_vec; LLVector3 y_pixel_vec; LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); - LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec); +// LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec); // if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen) // { // // bubble off-screen, so find a spot for it along screen edge diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 4000570872..57373704ef 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2674,7 +2674,6 @@ void LLIMMgr::inviteToSession( // voice invite question is different from default only for group call (EXT-7118) std::string question_type = "VoiceInviteQuestionDefault"; - BOOL ad_hoc_invite = FALSE; BOOL voice_invite = FALSE; bool is_linden = LLMuteList::getInstance()->isLinden(caller_name); @@ -2697,13 +2696,11 @@ void LLIMMgr::inviteToSession( //else it's an ad-hoc //and a voice ad-hoc notify_box_type = "VoiceInviteAdHoc"; - ad_hoc_invite = TRUE; voice_invite = TRUE; } else if ( inv_type == INVITATION_TYPE_IMMEDIATE ) { notify_box_type = "InviteAdHoc"; - ad_hoc_invite = TRUE; } LLSD payload; @@ -3269,10 +3266,9 @@ public: } std::string buffer = saved + message; - BOOL is_this_agent = FALSE; if(from_id == gAgentID) { - is_this_agent = TRUE; + return; } gIMMgr->addMessage( session_id, diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4834d8dd70..0fd406f470 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2514,7 +2514,6 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, if(drop && accept) { it = inventory_objects.begin(); - LLInventoryObject::object_list_t::iterator first_it = inventory_objects.begin(); LLMoveInv* move_inv = new LLMoveInv; move_inv->mObjectID = object_id; move_inv->mCategoryID = category_id; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 6e23d7c701..ac1f40b486 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1354,7 +1354,6 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) item_array_t items; update_map_t update; S32 count = content["items"].size(); - bool all_one_folder = true; LLUUID folder_id; // Does this loop ever execute more than once? for(S32 i = 0; i < count; ++i) @@ -1387,10 +1386,6 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) { folder_id = titem->getParentUUID(); } - else - { - all_one_folder = false; - } } U32 changes = 0x0; @@ -2478,7 +2473,6 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) item_array_t items; update_map_t update; S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); - bool all_one_folder = true; LLUUID folder_id; // Does this loop ever execute more than once? for(S32 i = 0; i < count; ++i) @@ -2510,10 +2504,6 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) { folder_id = titem->getParentUUID(); } - else - { - all_one_folder = false; - } } if(account) { diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 05c81957c6..dabb9bb69f 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -402,8 +402,6 @@ void LLInventoryPanel::modelChanged(U32 mask) static LLFastTimer::DeclareTimer FTM_REFRESH("Inventory Refresh"); LLFastTimer t2(FTM_REFRESH); - bool handled = false; - if (!mViewsInitialized) return; const LLInventoryModel* model = getModel(); @@ -429,7 +427,6 @@ void LLInventoryPanel::modelChanged(U32 mask) // Empty out the display name for relabel. if (mask & LLInventoryObserver::LABEL) { - handled = true; if (view_item) { // Request refresh on this item (also flags for filtering) @@ -448,7 +445,6 @@ void LLInventoryPanel::modelChanged(U32 mask) // Destroy and regenerate the UI. if (mask & LLInventoryObserver::REBUILD) { - handled = true; if (model_item && view_item) { view_item->destroyView(); @@ -488,8 +484,6 @@ void LLInventoryPanel::modelChanged(U32 mask) LLInventoryObserver::ADD | LLInventoryObserver::REMOVE)) { - handled = true; - ////////////////////////////// // ADD Operation // Item exists in memory but a UI element hasn't been created for it. diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 826e8d560a..d79f1040bb 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -1689,7 +1689,6 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) return; } - LLQuaternion object_rot = first_object->getRenderRotation(); LLVector3 rotation_center = gAgent.getPosAgentFromGlobal(mRotationCenter); LLVector3 mouse_dir_x; LLVector3 mouse_dir_y; diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 00a0bf8894..ae0884ac5d 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -1191,9 +1191,6 @@ void LLManipScale::dragFace( S32 x, S32 y ) mInSnapRegime = FALSE; } - BOOL send_scale_update = FALSE; - BOOL send_position_update = FALSE; - LLVector3 dir_agent; if( part_dir_local.mV[VX] ) { @@ -1210,8 +1207,6 @@ void LLManipScale::dragFace( S32 x, S32 y ) stretchFace( projected_vec(drag_start_dir_f, dir_agent) + drag_start_center_agent, projected_vec(drag_delta, dir_agent)); - send_position_update = TRUE; - send_scale_update = TRUE; mDragPointGlobal = drag_point_global; } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 362308c176..b62db70ec8 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -485,7 +485,6 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } // Throttle updates to 10 per second. - BOOL send_update = FALSE; LLVector3 axis_f; LLVector3d axis_d; @@ -702,11 +701,6 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) LLVector3 old_position_local = object->getPosition(); LLVector3 new_position_local = selectNode->mSavedPositionLocal + (clamped_relative_move_f * objWorldRotation); - // move and clamp root object first, before adjusting children - if (new_position_local != old_position_local) - { - send_update = TRUE; - } //RN: I forget, but we need to do this because of snapping which doesn't often result // in position changes even when the mouse moves object->setPosition(new_position_local); @@ -716,8 +710,6 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (selectNode->mIndividualSelection) { - send_update = FALSE; - // counter-translate child objects if we are moving the root as an individual object->resetChildrenPosition(old_position_local - new_position_local, TRUE) ; } @@ -753,7 +745,6 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } // PR: Only update if changed - LLVector3d old_position_global = object->getPositionGlobal(); LLVector3 old_position_agent = object->getPositionAgent(); LLVector3 new_position_agent = gAgent.getPosAgentFromGlobal(new_position_global); if (object->isRootEdit()) @@ -775,11 +766,6 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { // counter-translate child objects if we are moving the root as an individual object->resetChildrenPosition(old_position_agent - new_position_agent, TRUE) ; - send_update = FALSE; - } - else if (old_position_global != new_position_global) - { - send_update = TRUE; } } selectNode->mLastPositionLocal = object->getPosition(); @@ -1310,7 +1296,6 @@ void LLManipTranslate::renderSnapGuides() // add in off-axis offset tick_start += (mSnapOffsetAxis * mSnapOffsetMeters); - BOOL is_sub_tick = FALSE; F32 tick_scale = 1.f; for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) { @@ -1319,7 +1304,6 @@ void LLManipTranslate::renderSnapGuides() break; } tick_scale *= 0.7f; - is_sub_tick = TRUE; } // S32 num_ticks_to_fade = is_sub_tick ? num_ticks_per_side / 2 : num_ticks_per_side; @@ -1542,7 +1526,6 @@ void LLManipTranslate::renderSnapGuides() float a = line_alpha; - LLColor4 col = LLUIColorTable::instance().getColor("SilhouetteChildColor"); { //draw grid behind objects LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index bc7f522848..d7064f04d7 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3058,6 +3058,7 @@ void LLPhysicsDecomp::doDecomposition() param_map[params[i].mName] = params+i; } + U32 ret = LLCD_OK; //set parameter values for (decomp_params::iterator iter = mCurRequest->mParams.begin(); iter != mCurRequest->mParams.end(); ++iter) { @@ -3071,7 +3072,6 @@ void LLPhysicsDecomp::doDecomposition() continue; } - U32 ret = LLCD_OK; if (param->mType == LLCDParam::LLCD_FLOAT) { @@ -3090,8 +3090,6 @@ void LLPhysicsDecomp::doDecomposition() mCurRequest->setStatusMessage("Executing."); - LLCDResult ret = LLCD_OK; - if (LLConvexDecomposition::getInstance() != NULL) { ret = LLConvexDecomposition::getInstance()->executeStage(stage); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 1bda7640bd..dea90b9042 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -150,7 +150,7 @@ void LLNetMap::draw() static LLUIColor map_avatar_color = LLUIColorTable::instance().getColor("MapAvatarColor", LLColor4::white); static LLUIColor map_avatar_friend_color = LLUIColorTable::instance().getColor("MapAvatarFriendColor", LLColor4::white); static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white); - static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white); + //static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white); static LLUIColor map_frustum_color = LLUIColorTable::instance().getColor("MapFrustumColor", LLColor4::white); static LLUIColor map_frustum_rotating_color = LLUIColorTable::instance().getColor("MapFrustumRotatingColor", LLColor4::white); diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 77e1487f38..1a427338e5 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -78,8 +78,6 @@ const char* LLPanelContents::PERMS_ANYONE_CONTROL_KEY = "perms_anyone_control"; BOOL LLPanelContents::postBuild() { - LLRect rect = this->getRect(); - setMouseOpaque(FALSE); childSetAction("button new script",&LLPanelContents::onClickNewScript, this); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 43bb1f57e0..7832156a0e 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1007,13 +1007,11 @@ void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type) return; bool is_modifiable = false; - bool is_copyable = false; if(mWearableItem) { const LLPermissions& perm = mWearableItem->getPermissions(); is_modifiable = perm.allowModifyBy(gAgent.getID(), gAgent.getGroupID()); - is_copyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()); } if (is_modifiable) @@ -1440,7 +1438,6 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value { panel_list->clearPanels(); value_map_t::iterator end = sorted_params.end(); - S32 height = 0; for(value_map_t::iterator it = sorted_params.begin(); it != end; ++it) { LLPanel::Params p; @@ -1455,7 +1452,7 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value { panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, TRUE, this->getWearable(), jointp); } - height = panel_list->addPanel( panel_param ); + panel_list->addPanel( panel_param ); } } } diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 202be9671b..445c0d811f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -84,7 +84,6 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); - LLRect rect = this->getRect(); LLTextureCtrl* mTextureCtrl; LLColorSwatchCtrl* mColorSwatch; diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 363443646d..9a08782757 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -1383,13 +1383,11 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, S32 cur_land_tax; S32 cur_group_tax; S32 cur_parcel_dir_fee; - S32 cur_total_tax; S32 proj_object_tax; S32 proj_light_tax; S32 proj_land_tax; S32 proj_group_tax; S32 proj_parcel_dir_fee; - S32 proj_total_tax; S32 non_exempt_members; msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days ); @@ -1413,8 +1411,6 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, msg->getStringFast(_PREHASH_MoneyData, _PREHASH_LastTaxDate, last_stipend_date); msg->getStringFast(_PREHASH_MoneyData, _PREHASH_TaxDate, next_stipend_date); - cur_total_tax = cur_object_tax + cur_light_tax + cur_land_tax + cur_group_tax + cur_parcel_dir_fee; - proj_total_tax = proj_object_tax + proj_light_tax + proj_land_tax + proj_group_tax + proj_parcel_dir_fee; if (interval_days != mImplementationp->mIntervalLength || current_interval != mImplementationp->mCurrentInterval) diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index c57746ec00..5c9b968ac9 100644 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -209,24 +209,6 @@ void LLPanelLandmarkInfo::processParcelInfo(const LLParcelData& parcel_data) mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG)); } - S32 region_x; - S32 region_y; - S32 region_z; - - // If the region position is zero, grab position from the global - if(mPosRegion.isExactlyZero()) - { - region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS; - region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS; - region_z = llround(parcel_data.global_z); - } - else - { - region_x = llround(mPosRegion.mV[VX]); - region_y = llround(mPosRegion.mV[VY]); - region_z = llround(mPosRegion.mV[VZ]); - } - LLSD info; info["update_verbs"] = true; info["global_x"] = parcel_data.global_x; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index d87b565b32..25ef9a3d6a 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -439,10 +439,9 @@ void LLPanelObject::getState( ) mCtrlRotY->setEnabled( enable_rotate ); mCtrlRotZ->setEnabled( enable_rotate ); - BOOL owners_identical; LLUUID owner_id; std::string owner_name; - owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); + LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? S32 roots_selected = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 51ab7649a4..bc6ae35fda 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -365,10 +365,8 @@ void LLPanelPermissions::refresh() // Update creator text field getChildView("Creator:")->setEnabled(TRUE); - BOOL creators_identical; std::string creator_name; - creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, - creator_name); + LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); getChild("Creator Name")->setValue(creator_name); getChildView("Creator Name")->setEnabled(TRUE); diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 13b746dbab..02d363d795 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -252,10 +252,9 @@ void LLPanelVolume::getState( ) return; } - BOOL owners_identical; LLUUID owner_id; std::string owner_name; - owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); + LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? BOOL editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index ded7d66022..3ee0746412 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -428,14 +428,13 @@ F32 LLPhysicsMotion::toLocal(const LLVector3 &world) F32 LLPhysicsMotion::calculateVelocity_local() { const F32 world_to_model_scale = 100.0f; - LLJoint *joint = mJointState->getJoint(); - const LLVector3 position_world = joint->getWorldPosition(); - const LLQuaternion rotation_world = joint->getWorldRotation(); - const LLVector3 last_position_world = mPosition_world; + LLJoint *joint = mJointState->getJoint(); + const LLVector3 position_world = joint->getWorldPosition(); + const LLVector3 last_position_world = mPosition_world; const LLVector3 positionchange_world = (position_world-last_position_world) * world_to_model_scale; - const LLVector3 velocity_world = positionchange_world; - const F32 velocity_local = toLocal(velocity_world); - return velocity_local; + const LLVector3 velocity_world = positionchange_world; + const F32 velocity_local = toLocal(velocity_world); + return velocity_local; } F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local) diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index d340b304ca..1f5b1a616f 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -707,7 +707,6 @@ void LLScreenChannel::showToastsTop() LLRect toast_rect; S32 top = channel_rect.mTop; - S32 toast_margin = 0; std::vector::reverse_iterator it; updateRect(); @@ -726,7 +725,7 @@ void LLScreenChannel::showToastsTop() } top = toast->getRect().mBottom - toast->getTopPad(); - toast_margin = gSavedSettings.getS32("ToastGap"); + gSavedSettings.getS32("ToastGap"); } LLToast* toast = it->getToast(); diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index 30400a4c6a..928d26646b 100644 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -1239,7 +1239,6 @@ void LLSecAPIBasicHandler::_readProtectedData() llifstream::binary); if (!protected_data_stream.fail()) { - int offset; U8 salt[STORE_SALT_SIZE]; U8 buffer[BUFFER_READ_SIZE]; U8 decrypted_buffer[BUFFER_READ_SIZE]; @@ -1250,7 +1249,6 @@ void LLSecAPIBasicHandler::_readProtectedData() // read in the salt and key protected_data_stream.read((char *)salt, STORE_SALT_SIZE); - offset = 0; if (protected_data_stream.gcount() < STORE_SALT_SIZE) { throw LLProtectedDataException("Config file too short."); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 24e272c740..047bd2f7f3 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1182,7 +1182,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount()) { //LLViewerObject* root = getSelectedParentObject(mSelectedObjects->getFirstObject()); - LLBBox bbox = mSavedSelectionBBox; mGridOrigin = mSavedSelectionBBox.getCenterAgent(); mGridScale = mSavedSelectionBBox.getExtentLocal() * 0.5f; @@ -1200,7 +1199,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & else if (mGridMode == GRID_MODE_REF_OBJECT && first_grid_object && first_grid_object->mDrawable.notNull()) { mGridRotation = first_grid_object->getRenderRotation(); - LLVector3 first_grid_obj_pos = first_grid_object->getRenderPosition(); LLVector4a min_extents(F32_MAX); LLVector4a max_extents(-F32_MAX); diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index c351b1a128..95e173ef3e 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -368,10 +368,8 @@ void LLSidepanelTaskInfo::refresh() // Update creator text field getChildView("Creator:")->setEnabled(TRUE); - BOOL creators_identical; std::string creator_name; - creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, - creator_name); + LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); getChild("Creator Name")->setValue(creator_name); getChildView("Creator Name")->setEnabled(TRUE); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index fadaaf4541..77809f3706 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -4092,9 +4092,6 @@ public: return; } - LLVector4a nodeCenter = group->mBounds[0]; - LLVector4a octCenter = group->mOctreeNode->getCenter(); - group->rebuildGeom(); group->rebuildMesh(); @@ -4571,9 +4568,6 @@ public: virtual bool check(LLDrawable* drawable) { - LLVector3 local_start = mStart; - LLVector3 local_end = mEnd; - if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible()) { return false; diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 07d2f1ad6f..1c7c6450c7 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -350,7 +350,7 @@ void LLSpeakerMgr::update(BOOL resort_ok) LLUUID speaker_id = speaker_it->first; LLSpeaker* speakerp = speaker_it->second; - speaker_map_t::iterator cur_speaker_it = speaker_it++; + speaker_it++; if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id)) { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 561734aaae..8be8a5a56b 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -316,7 +316,6 @@ bool idle_startup() const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay"); static LLTimer timeout; - static S32 timeout_count = 0; static LLTimer login_time; @@ -332,7 +331,6 @@ bool idle_startup() // last location by default static S32 agent_location_id = START_LOCATION_ID_LAST; - static S32 location_which = START_LOCATION_ID_LAST; static bool show_connect_box = true; @@ -744,8 +742,6 @@ bool idle_startup() gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); - timeout_count = 0; - // Login screen needs menus for preferences, but we can enter // this startup phase more than once. if (gLoginMenuBarView == NULL) @@ -982,15 +978,12 @@ bool idle_startup() { case LLSLURL::LOCATION: agent_location_id = START_LOCATION_ID_URL; - location_which = START_LOCATION_ID_LAST; break; case LLSLURL::LAST_LOCATION: agent_location_id = START_LOCATION_ID_LAST; - location_which = START_LOCATION_ID_LAST; break; default: agent_location_id = START_LOCATION_ID_HOME; - location_which = START_LOCATION_ID_HOME; break; } diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index f64a72a616..dad253ffc3 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -1249,8 +1249,6 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, y_end = tex_width; } - LLVector3d origin_global = from_region_handle(getRegion()->getHandle()); - // OK, for now, just have the composition value equal the height at the point. LLVector3 location; LLColor4U coloru; diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 602b924398..8f5d6404e8 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -369,8 +369,6 @@ void LLToastNotifyPanel::adjustPanelForScriptNotice(S32 button_panel_width, S32 void LLToastNotifyPanel::adjustPanelForTipNotice() { - LLRect info_rect = mInfoPanel->getRect(); - LLRect this_rect = getRect(); //we don't need display ControlPanel for tips because they doesn't contain any buttons. mControlPanel->setVisible(FALSE); reshape(getRect().getWidth(), mInfoPanel->getRect().getHeight()); diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 923fbecb1a..5270c3d33f 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -471,7 +471,7 @@ BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask) mObjectPlacedOnMouseDown = TRUE; - return TRUE; + return handled; } void LLToolCompCreate::pickCallback(const LLPickInfo& pick_info) diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index a754d8ee7e..857b0f0714 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -314,8 +314,6 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) S32 dx = gViewerWindow->getCurrentMouseDX(); S32 dy = gViewerWindow->getCurrentMouseDY(); - BOOL moved_outside_slop = FALSE; - if (hasMouseCapture() && mValidClickPoint) { mAccumX += llabs(dx); @@ -323,19 +321,11 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) if (mAccumX >= SLOP_RANGE) { - if (!mOutsideSlopX) - { - moved_outside_slop = TRUE; - } mOutsideSlopX = TRUE; } if (mAccumY >= SLOP_RANGE) { - if (!mOutsideSlopY) - { - moved_outside_slop = TRUE; - } mOutsideSlopY = TRUE; } } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 3cd761b73b..c26d9dbede 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -790,14 +790,10 @@ BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg) LLParcel* hover_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel(); LLUUID owner; - S32 width = 0; - S32 height = 0; if ( hover_parcel ) { owner = hover_parcel->getOwnerID(); - width = S32(LLViewerParcelMgr::getInstance()->getHoverParcelWidth()); - height = S32(LLViewerParcelMgr::getInstance()->getHoverParcelHeight()); } // Line: "Land" @@ -1609,9 +1605,6 @@ BOOL LLToolPie::handleRightClickPick() // didn't click in any UI object, so must have clicked in the world LLViewerObject *object = mPick.getObject(); - LLViewerObject *parent = NULL; - if(object) - parent = object->getRootEdit(); // Can't ignore children here. LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp index edec30f8c4..dd17068be5 100644 --- a/indra/newview/llurlhistory.cpp +++ b/indra/newview/llurlhistory.cpp @@ -112,8 +112,6 @@ void LLURLHistory::addURL(const std::string& collection, const std::string& url) // static void LLURLHistory::removeURL(const std::string& collection, const std::string& url) { - LLSD::array_iterator iter = sHistorySD[collection].beginArray(); - LLSD::array_iterator end = sHistorySD[collection].endArray(); for(int index = 0; index < sHistorySD[collection].size(); index++) { if(sHistorySD[collection].get(index).asString() == url) diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index a437a8b3b5..b5aa0ac92a 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -136,9 +136,6 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, mLastPointOfInterest = point_of_interest; - // constrain to max distance from avatar - LLVector3 camera_offset = center - gAgent.getPositionAgent(); - LLViewerRegion * regp = gAgent.getRegion(); F32 water_height = (NULL != regp) ? regp->getWaterHeight() : 0.f; @@ -318,7 +315,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection, { F32 fov_y, aspect; fov_y = RAD_TO_DEG * getView(); - BOOL z_default_near, z_default_far = FALSE; + BOOL z_default_far = FALSE; if (z_far <= 0) { z_default_far = TRUE; @@ -326,7 +323,6 @@ void LLViewerCamera::setPerspective(BOOL for_selection, } if (z_near <= 0) { - z_default_near = TRUE; z_near = getNear(); } aspect = getAspect(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index fae20b1c13..bd8377e281 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1034,7 +1034,6 @@ void render_hud_attachments() if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) { LLCamera hud_cam = *LLViewerCamera::getInstance(); - LLVector3 origin = hud_cam.getOrigin(); hud_cam.setOrigin(-1.f,0,0); hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1)); LLViewerCamera::updateFrustumPlanes(hud_cam, TRUE); diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index 4543a1ba9a..297906803b 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -406,11 +406,9 @@ void LLViewerMediaFocus::update() LLViewerObject *viewer_object = getFocusedObject(); S32 face = mFocusedObjectFace; LLVector3 normal = mFocusedObjectNormal; - bool focus = true; if(!media_impl || !viewer_object) { - focus = false; media_impl = getHoverMediaImpl(); viewer_object = getHoverObject(); face = mHoverObjectFace; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f399275c94..2a904d393a 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -626,7 +626,6 @@ void send_sound_trigger(const LLUUID& sound_id, F32 gain) bool join_group_response(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - BOOL delete_context_data = TRUE; bool accept_invite = false; LLUUID group_id = notification["payload"]["group_id"].asUUID(); @@ -655,7 +654,6 @@ bool join_group_response(const LLSD& notification, const LLSD& response) } else { - delete_context_data = FALSE; LLSD args; args["NAME"] = name; LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification["payload"]); @@ -668,7 +666,6 @@ bool join_group_response(const LLSD& notification, const LLSD& response) // sure the user is sure they want to join. if (fee > 0) { - delete_context_data = FALSE; LLSD args; args["COST"] = llformat("%d", fee); // Set the fee for next time to 0, so that we don't keep @@ -2768,11 +2765,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); } buffer = saved + message; - BOOL is_this_agent = FALSE; - if(from_id == gAgentID) - { - is_this_agent = TRUE; - } gIMMgr->addMessage( session_id, from_id, @@ -3386,7 +3378,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLColor4 color(1.0f, 1.0f, 1.0f, 1.0f); LLUUID from_id; LLUUID owner_id; - BOOL is_owned_by_me = FALSE; LLViewerObject* chatter; msg->getString("ChatData", "FromName", from_name); @@ -3471,13 +3462,11 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) gAgent.heardChat(chat.mFromID); } } - - is_owned_by_me = chatter->permYouOwner(); } if (is_audible) { - BOOL visible_in_chat_bubble = FALSE; + //BOOL visible_in_chat_bubble = FALSE; color.setVec(1.f,1.f,1.f,1.f); msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); @@ -3560,7 +3549,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if (!is_muted && !is_busy) { - visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles"); + //visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles"); std::string formated_msg = ""; LLViewerChat::formatChatMsg(chat, formated_msg); LLChat chat_bubble = chat; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index e399b45cba..d74324f830 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -286,7 +286,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, LLMemType mt(LLMemType::MTYPE_OBJECT_PROCESS_UPDATE); LLFastTimer t(FTM_PROCESS_OBJECTS); - LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal(); LLViewerObject *objectp; S32 num_objects; U32 local_id; @@ -305,6 +304,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, { //llinfos << "TEST: !cached && !compressed && update_type != OUT_FULL" << llendl; gTerseObjectUpdates += num_objects; + /* S32 size; if (mesgsys->getReceiveCompressedSize()) { @@ -314,10 +314,12 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, { size = mesgsys->getReceiveSize(); } - //llinfos << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; + llinfos << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; + */ } else { + /* S32 size; if (mesgsys->getReceiveCompressedSize()) { @@ -328,7 +330,8 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, size = mesgsys->getReceiveSize(); } - // llinfos << "Received " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; + llinfos << "Received " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; + */ gFullObjectUpdates += num_objects; } diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 90fbc41daa..386b2fd400 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -85,7 +85,6 @@ void LLViewerParcelMedia::update(LLParcel* parcel) } // we're in a parcel - bool new_parcel = false; S32 parcelid = parcel->getLocalID(); LLUUID regionid = gAgent.getRegion()->getRegionID(); @@ -94,7 +93,6 @@ void LLViewerParcelMedia::update(LLParcel* parcel) LL_DEBUGS("Media") << "New parcel, parcel id = " << parcelid << ", region id = " << regionid << LL_ENDL; sMediaParcelLocalID = parcelid; sMediaRegionID = regionid; - new_parcel = true; } std::string mediaUrl = std::string ( parcel->getMediaURL () ); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 99102309a1..d309faf331 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1052,8 +1052,6 @@ void LLViewerTextEditor::findEmbeddedItemSegments(S32 start, S32 end) { LLWString text = getWText(); - LLColor4 text_color = ( mReadOnly ? mReadOnlyFgColor.get() : mFgColor.get() ); - // Start with i just after the first embedded item for(S32 idx = start; idx < end; idx++ ) { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 4f66b32c1f..394e063c86 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2778,7 +2778,6 @@ void LLViewerWindow::updateUI() BOOL handled = FALSE; - BOOL handled_by_top_ctrl = FALSE; LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); LLView* captor_view = dynamic_cast(mouse_captor); @@ -2963,7 +2962,6 @@ void LLViewerWindow::updateUI() S32 local_x, local_y; top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask); - handled_by_top_ctrl = TRUE; } if ( !handled ) diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index e90a2470d4..49474dcc7a 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -376,9 +376,6 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, LLPointer raw = new LLImageRaw(tex_width, tex_height, tex_comps); U8 *rawp = raw->getData(); - F32 tex_width_inv = 1.f/tex_width; - F32 tex_height_inv = 1.f/tex_height; - F32 st_x_stride, st_y_stride; st_x_stride = ((F32)st_width / (F32)mTexScaleX)*((F32)mWidth / (F32)tex_width); st_y_stride = ((F32)st_height / (F32)mTexScaleY)*((F32)mWidth / (F32)tex_height); @@ -413,11 +410,6 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, tex1 = tex0 + 1; tex1 = llclamp(tex1, 0, 3); - F32 xy_int_i, xy_int_j; - - xy_int_i = i * tex_width_inv; - xy_int_j = j * tex_height_inv; - st_offset = (lltrunc(sti) + lltrunc(stj)*st_width) * st_comps; for (U32 k = 0; k < tex_comps; k++) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 50c2659563..3d4573903f 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1755,7 +1755,6 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, { LLMemType mt(LLMemType::MTYPE_AVATAR); - LLVector3 old_vel = getVelocity(); const BOOL has_name = !getNVPair("FirstName"); // Do base class updates... @@ -2645,8 +2644,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - char line[MAX_STRING]; /* Flawfinder: ignore */ - line[0] = '\0'; std::deque::iterator chat_iter = mChats.begin(); mNameText->clearString(); @@ -3035,8 +3032,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) xyVel.mV[VZ] = 0.0f; speed = xyVel.length(); - BOOL throttle = TRUE; - if (!(mIsSitting && getParent())) { //-------------------------------------------------------------------- @@ -3047,7 +3042,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (mTimeLast == 0.0f) { mTimeLast = animation_time; - throttle = FALSE; // put the pelvis at slaved position/mRotation mRoot->setWorldPosition( getPositionAgent() ); // first frame diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index a29ef2f3ad..e4fb1ebf88 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -341,7 +341,6 @@ BOOL LLVOAvatarSelf::buildMenus() } else { - BOOL attachment_found = FALSE; for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -369,7 +368,6 @@ BOOL LLVOAvatarSelf::buildMenus() gAttachPieMenu->addChild(item); - attachment_found = TRUE; break; } @@ -382,7 +380,6 @@ BOOL LLVOAvatarSelf::buildMenus() } else { - BOOL attachment_found = FALSE; for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -409,7 +406,6 @@ BOOL LLVOAvatarSelf::buildMenus() gDetachPieMenu->addChild(item); - attachment_found = TRUE; break; } } diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 820d1d73e1..db0fc3dca7 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -2236,7 +2236,8 @@ void LLVivoxVoiceClient::giveUp() static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel) { - F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the new position and velocity + F32 nat[3], nup[3], nl[3]; // the new at, up, left vectors and the new position and velocity +// F32 nvel[3]; F64 npos[3]; // The original XML command was sent like this: @@ -2286,9 +2287,9 @@ static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVe npos[1] = pos.mdV[VZ]; npos[2] = pos.mdV[VY]; - nvel[0] = vel.mV[VX]; - nvel[1] = vel.mV[VZ]; - nvel[2] = vel.mV[VY]; +// nvel[0] = vel.mV[VX]; +// nvel[1] = vel.mV[VZ]; +// nvel[2] = vel.mV[VY]; for(int i=0;i<3;++i) { at.mV[i] = nat[i]; @@ -3942,7 +3943,6 @@ void LLVivoxVoiceClient::messageEvent( bool is_busy = gAgent.getBusy(); bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat); bool is_linden = LLMuteList::getInstance()->isLinden(session->mName); - bool quiet_chat = false; LLChat chat; chat.mMuted = is_muted && !is_linden; @@ -3955,7 +3955,6 @@ void LLVivoxVoiceClient::messageEvent( if(is_busy && !is_linden) { - quiet_chat = true; // TODO: Question: Return busy mode response here? Or maybe when session is started instead? } diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index cb905d02da..de15f0ef43 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -467,7 +467,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, S32 vertex_count = 0; S32 i, x, y; - S32 num_vertices, num_indices; + S32 num_vertices; U32 render_stride = mLastStride; S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge(); @@ -485,7 +485,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, if (north_stride == render_stride) { num_vertices = 2 * length + 1; - num_indices = length * 6 - 3; facep->mCenterAgent = (mPatchp->getPointAgent(8, 15) + mPatchp->getPointAgent(8, 16))*0.5f; @@ -536,7 +535,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, { // North stride is longer (has less vertices) num_vertices = length + length/2 + 1; - num_indices = half_length*9 - 3; facep->mCenterAgent = (mPatchp->getPointAgent(7, 15) + mPatchp->getPointAgent(8, 16))*0.5f; @@ -595,7 +593,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, length = patch_size / north_stride; half_length = length / 2; num_vertices = length + half_length + 1; - num_indices = 9*half_length - 3; facep->mCenterAgent = (mPatchp->getPointAgent(15, 7) + mPatchp->getPointAgent(16, 8))*0.5f; @@ -666,7 +663,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, { S32 i, x, y; - S32 num_vertices, num_indices; + S32 num_vertices; U32 render_stride = mLastStride; S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge(); @@ -679,7 +676,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, if (east_stride == render_stride) { num_vertices = 2 * length + 1; - num_indices = length * 6 - 3; facep->mCenterAgent = (mPatchp->getPointAgent(8, 15) + mPatchp->getPointAgent(8, 16))*0.5f; @@ -728,7 +724,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, { // East stride is longer (has less vertices) num_vertices = length + half_length + 1; - num_indices = half_length*9 - 3; facep->mCenterAgent = (mPatchp->getPointAgent(7, 15) + mPatchp->getPointAgent(8, 16))*0.5f; @@ -783,7 +778,6 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, length = patch_size / east_stride; half_length = length / 2; num_vertices = length + length/2 + 1; - num_indices = 9*(length/2) - 3; facep->mCenterAgent = (mPatchp->getPointAgent(15, 7) + mPatchp->getPointAgent(16, 8))*0.5f; diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index a33f42cf84..01024f4a12 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -724,8 +724,8 @@ void LLVOWLSky::updateStarColors() const F32 var = 0.15f; const F32 min = 0.5f; //0.75f; - const F32 sunclose_max = 0.6f; - const F32 sunclose_range = 1 - sunclose_max; + //const F32 sunclose_max = 0.6f; + //const F32 sunclose_range = 1 - sunclose_max; //F32 below_horizon = - llmin(0.0f, gSky.mVOSkyp->getToSunLast().mV[2]); //F32 brightness_factor = llmin(1.0f, below_horizon * 20); @@ -739,14 +739,14 @@ void LLVOWLSky::updateStarColors() U32 x; for (x = 0; x < getStarsNumVerts(); ++x) { - F32 sundir_factor = 1; + //F32 sundir_factor = 1; LLVector3 tostar = *v_p; tostar.normVec(); - const F32 how_close_to_sun = tostar * gSky.mVOSkyp->getToSunLast(); - if (how_close_to_sun > sunclose_max) - { - sundir_factor = (1 - how_close_to_sun) / sunclose_range; - } + //const F32 how_close_to_sun = tostar * gSky.mVOSkyp->getToSunLast(); + //if (how_close_to_sun > sunclose_max) + //{ + // sundir_factor = (1 - how_close_to_sun) / sunclose_range; + //} intensity = *(v_i); F32 alpha = v_c->mV[VALPHA] + (ll_frand() - 0.5f) * var * intensity; if (alpha < min * intensity) diff --git a/indra/newview/llwaterparamset.cpp b/indra/newview/llwaterparamset.cpp index 39d366b023..9cc91d2246 100644 --- a/indra/newview/llwaterparamset.cpp +++ b/indra/newview/llwaterparamset.cpp @@ -185,8 +185,6 @@ LLVector3 LLWaterParamSet::getVector3(const std::string& paramName, bool& error) LLVector2 LLWaterParamSet::getVector2(const std::string& paramName, bool& error) { // test to see if right type - int ttest; - ttest = mParamValues.size(); LLSD cur_val = mParamValues.get(paramName); if (!cur_val.isArray() || cur_val.size() != 2) { diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 428be8efb9..ad4d59d671 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -965,8 +965,6 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& S32 text_x = x; S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight()); - BOOL is_in_window = true; - if( x < 0 || y < 0 || x >= getRect().getWidth() @@ -979,7 +977,6 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& text_x = sTrackingArrowX; text_y = sTrackingArrowY; } - is_in_window = false; } else if (LLTracker::getTrackingStatus() == LLTracker::TRACKING_LOCATION && LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 61df5bc2eb..126e8bc436 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -5909,7 +5909,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) if (light->isLightSpotlight() // directional (spot-)light && (LLPipeline::sRenderDeferred || RenderSpotLightsInNondeferred)) // these are only rendered as GL spotlights if we're in deferred rendering mode *or* the setting forces them on { - LLVector3 spotparams = light->getSpotLightParams(); LLQuaternion quat = light->getRenderRotation(); LLVector3 at_axis(0,0,-1); // this matches deferred rendering's object light direction at_axis *= quat; @@ -9097,9 +9096,6 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector 3,7 }; - LLVector3 center = (max+min)*0.5f; - LLVector3 size = (max-min)*0.5f; - for (U32 i = 0; i < 12; i++) { for (U32 j = 0; j < 6; ++j) @@ -9325,7 +9321,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mSunOrthoClipPlanes = LLVector4(clip, clip.mV[2]*clip.mV[2]/clip.mV[1]); //currently used for amount to extrude frusta corners for constructing shadow frusta - LLVector3 n = RenderShadowNearDist; + //LLVector3 n = RenderShadowNearDist; //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; //put together a universal "near clip" plane for shadow frusta -- cgit v1.2.3 From 22f53c85588912582f33d840d106b10f54f2c62d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 15 Oct 2012 18:41:55 -0400 Subject: additional debugging info, including tracking where visual params live --- indra/newview/llvoavatar.cpp | 1 + indra/newview/llvoavatarself.cpp | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3d4573903f..a2ace15f2d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1792,6 +1792,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) const std::string url = getImageURL(te,uuid); if (!url.empty()) { + llinfos << "texture URL " << url << llendl; return setTETextureCore(te, uuid, url); } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e4fb1ebf88..667eedd0c8 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2654,7 +2654,14 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) gAgentCamera.changeCameraToCustomizeAvatar(); } + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + std::string dump_prefix = gAgentAvatarp->getFullname() + "_" + (gAgentAvatarp->isSelf()?"s":"o") + "_"; + if (enable_verbose_dumps) { gAgentAvatarp->dumpArchetypeXML(dump_prefix + "on_customize_start"); } gAgentAvatarp->clearVisualParamWeights(); + if (enable_verbose_dumps) { gAgentAvatarp->dumpArchetypeXML(dump_prefix + "on_customize_post_clear"); } + gAgentAvatarp->idleUpdateAppearanceAnimation(); + if (enable_verbose_dumps) { gAgentAvatarp->dumpArchetypeXML(dump_prefix + "on_customize_post_update"); } + gAgentAvatarp->invalidateAll(); gAgentAvatarp->updateMeshTextures(); } -- cgit v1.2.3 From 7d6da2ebe8db7aa73113659c709d03e16eca5094 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Oct 2012 13:43:19 -0400 Subject: more param location logging, added wearable type info to dumpArchetypeXML --- indra/newview/llvoavatar.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a2ace15f2d..fa6e572064 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6306,8 +6306,15 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) type_string = "param_morph"; if (dynamic_cast(viewer_param)) type_string = "param_skeleton"; - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str()); + S32 wtype = -1; + LLViewerVisualParam *vparam = dynamic_cast(viewer_param); + if (vparam) + { + wtype = vparam->getWearableType(); + } + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str(), + LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str()); } -- cgit v1.2.3 From 2390e21a9d2fc6f5cabe132a2bbd807aec186cfa Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Oct 2012 18:32:26 -0400 Subject: additional diagnostics, improved shape stability at cost of increasing entanglement between baked and local appearance --- indra/newview/llviewerwearable.cpp | 5 +++++ indra/newview/llvoavatar.cpp | 5 +++-- indra/newview/llvoavatarself.cpp | 10 ++++------ 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 1200f65b6e..4477893063 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -320,6 +320,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; +#if 0 // FIXME DRANO - kludgy way to avoid overwriting avatar state from wearables. // Ideally would avoid calling this func in the first place. if (viewer_avatar->isUsingServerBakes() && @@ -327,6 +328,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) { return; } +#endif ESex old_sex = avatarp->getSex(); @@ -476,10 +478,13 @@ void LLViewerWearable::setItemID(const LLUUID& item_id) void LLViewerWearable::revertValues() { +#if 0 + // DRANO avoid overwrite when not in local appearance if (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes() && !gAgentAvatarp->isUsingLocalAppearance()) { return; } +#endif LLWearable::revertValues(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fa6e572064..a49ecc0127 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6312,8 +6312,9 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) { wtype = vparam->getWearableType(); } - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str(), + S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight()); + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(), LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str()); } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 667eedd0c8..a01188d7dc 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -664,12 +664,13 @@ BOOL LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight return FALSE; } +#if 0 // FIXME DRANO - kludgy way to avoid overwriting avatar state from wearables. if (isUsingServerBakes() && !isUsingLocalAppearance()) { return FALSE; } - +#endif if (param->getCrossWearable()) { @@ -2654,13 +2655,10 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) gAgentCamera.changeCameraToCustomizeAvatar(); } - bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); - std::string dump_prefix = gAgentAvatarp->getFullname() + "_" + (gAgentAvatarp->isSelf()?"s":"o") + "_"; - if (enable_verbose_dumps) { gAgentAvatarp->dumpArchetypeXML(dump_prefix + "on_customize_start"); } +#if 0 gAgentAvatarp->clearVisualParamWeights(); - if (enable_verbose_dumps) { gAgentAvatarp->dumpArchetypeXML(dump_prefix + "on_customize_post_clear"); } gAgentAvatarp->idleUpdateAppearanceAnimation(); - if (enable_verbose_dumps) { gAgentAvatarp->dumpArchetypeXML(dump_prefix + "on_customize_post_update"); } +#endif gAgentAvatarp->invalidateAll(); gAgentAvatarp->updateMeshTextures(); -- cgit v1.2.3 From c961b5f6571cc6147410f9e7620e5aa44c009f3f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 22 Oct 2012 11:09:32 -0400 Subject: handling for crossing from non-server-bake to server-bake regions --- indra/newview/llagent.cpp | 10 ++++++++++ indra/newview/llvoavatar.cpp | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3e26eac59a..9eb2723dcf 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -904,6 +904,16 @@ void LLAgent::setRegion(LLViewerRegion *regionp) { LLEnvManagerNew::instance().onRegionCrossing(); } + + // If the newly entered region is using server bakes, and our + // current appearance is non-baked, request appearance update from + // server. + if (isAgentAvatarValid() && + !gAgentAvatarp->isUsingServerBakes() && + (mRegionp->getCentralBakeVersion()>0)) + { + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); + } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a49ecc0127..b08226fe94 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6400,8 +6400,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } - mUseServerBakes = (appearance_version > 0); - // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) { @@ -6409,7 +6407,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; } - if( mFirstTEMessageReceived && !isUsingServerBakes()) + if( mFirstTEMessageReceived && (appearance_version == 0)) { return; } @@ -6417,7 +6415,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // Check for stale update. - if (isUsingServerBakes() && isSelf() + if (isSelf() + && isUsingServerBakes() && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL && this_update_cof_version < last_update_request_cof_version) { @@ -6425,6 +6424,9 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << ", got " << this_update_cof_version << llendl; return; } + + mUseServerBakes = (appearance_version > 0); + applyParsedTEMessage(tec); // prevent the overwriting of valid baked textures with invalid baked textures -- cgit v1.2.3 From a2a3412d1b3390cd39a07ec4467c27763ad95622 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 24 Oct 2012 13:29:59 -0400 Subject: SH-3430 FIX - don't cache ids of images with specified URLs, such as server bakes --- indra/newview/llviewertexturelist.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/llviewertexturelist.cpp (limited to 'indra/newview') diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp old mode 100644 new mode 100755 index b89247ec6f..eeb962a124 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -228,7 +228,9 @@ void LLViewerTextureList::shutdown() if (!image->hasGLTexture() || !image->getUseDiscard() || image->needsAux() || - image->getTargetHost() != LLHost::invalid) + image->getTargetHost() != LLHost::invalid || + !image->getUrl().empty() + ) { continue; // avoid UI, baked, and other special images } -- cgit v1.2.3 From e5c38b3b61f55674f602bb0e7d43baa3e04d541f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 25 Oct 2012 16:44:01 -0400 Subject: SH-3469 FIX - discard new-style updates for self with cof version = 0. This removes a race condition that was causing us to mis-handle region crossing logic --- indra/newview/llvoavatar.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b08226fe94..168a116b95 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6416,9 +6416,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // Check for stale update. if (isSelf() - && isUsingServerBakes() - && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL - && this_update_cof_version < last_update_request_cof_version) + && (appearance_version>0) + && (this_update_cof_version < last_update_request_cof_version)) { llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version << ", got " << this_update_cof_version << llendl; -- cgit v1.2.3 From 3aeff074cfc2f14b661b96bc0664087a95a99eff Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 26 Oct 2012 18:27:08 -0400 Subject: SH-3469 FIX - use callback mechanism to handle possible race between getting caps and setting agent region --- indra/newview/llagent.cpp | 23 +++++++++++++++++++---- indra/newview/llagent.h | 1 + indra/newview/llappearancemgr.cpp | 4 ++++ 3 files changed, 24 insertions(+), 4 deletions(-) mode change 100644 => 100755 indra/newview/llagent.h (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 9eb2723dcf..c49caf93be 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -809,6 +809,18 @@ void LLAgent::standUp() } +void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) +{ + llinfos << "called" << llendl; + + if (isAgentAvatarValid() && + !gAgentAvatarp->isUsingServerBakes() && + (mRegionp->getCentralBakeVersion()>0)) + { + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); + } +} + //----------------------------------------------------------------------------- // setRegion() //----------------------------------------------------------------------------- @@ -908,11 +920,14 @@ void LLAgent::setRegion(LLViewerRegion *regionp) // If the newly entered region is using server bakes, and our // current appearance is non-baked, request appearance update from // server. - if (isAgentAvatarValid() && - !gAgentAvatarp->isUsingServerBakes() && - (mRegionp->getCentralBakeVersion()>0)) + if (mRegionp->capabilitiesReceived()) { - LLAppearanceMgr::instance().requestServerAppearanceUpdate(); + handleServerBakeRegionTransition(mRegionp->getRegionID()); + } + else + { + // Need to handle via callback after caps arrive. + mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::handleServerBakeRegionTransition,this,_1)); } } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h old mode 100644 new mode 100755 index ae5efb2287..693c123851 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -610,6 +610,7 @@ private: void handleTeleportFinished(); void handleTeleportFailed(); + void handleServerBakeRegionTransition(const LLUUID& region_id); //-------------------------------------------------------------------- // Teleport State diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index c57269d0b0..7a8586ebdc 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2677,6 +2677,10 @@ void LLAppearanceMgr::requestServerAppearanceUpdate() { llwarns << "Region not set, cannot request server appearance update" << llendl; } + if (gAgent.getRegion()->getCentralBakeVersion()==0) + { + llwarns << "Region does not support baking" << llendl; + } std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance"); if (url.empty()) { -- cgit v1.2.3 From d4dc41dbd5b54501fcb3c94e07e4753ed4196eac Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 1 Nov 2012 14:19:00 -0400 Subject: misc error detection, debug coloration for avatar meshes --- indra/newview/llappearancemgr.cpp | 4 +- indra/newview/llinventorymodelbackgroundfetch.cpp | 2 +- indra/newview/lltexturefetch.cpp | 2 +- indra/newview/llviewerregion.cpp | 5 ++ indra/newview/llviewertexture.cpp | 6 ++- indra/newview/llvoavatar.cpp | 56 +++++++++++++---------- indra/newview/llvoavatar.h | 1 + 7 files changed, 46 insertions(+), 30 deletions(-) mode change 100644 => 100755 indra/newview/llviewertexture.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7a8586ebdc..51de2fd17b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1750,6 +1750,8 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) { requestServerAppearanceUpdate(); } + // DRANO really should wait for the appearance message to set this. + // verify that deleting this line doesn't break anything. gAgentAvatarp->setIsUsingServerBakes(gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()); //dumpCat(getCOF(),"COF, start"); @@ -2684,7 +2686,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate() std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance"); if (url.empty()) { - llwarns << "NO CAP for UpdateAvatarAppearance. This is a bug." << llendl; + llwarns << "No cap for UpdateAvatarAppearance." << llendl; return; } diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index f4d0110b0f..eb92902de9 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -183,7 +183,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *) void LLInventoryModelBackgroundFetch::backgroundFetch() { - if (mBackgroundFetchActive && gAgent.getRegion()) + if (mBackgroundFetchActive && gAgent.getRegion() && gAgent.getRegion()->capabilitiesReceived()) { // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. if (gSavedSettings.getBOOL("UseHTTPInventory")) diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index db08c16f15..43bfb4442b 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -351,7 +351,7 @@ public: if (!success) { worker->setGetStatus(status, reason); -// llwarns << "CURL GET FAILED, status:" << status << " reason:" << reason << llendl; + llwarns << "CURL GET FAILED, status:" << status << " reason:" << reason << " id: " << mID <callbackHttpGet(channels, buffer, partial, success); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0855bc9243..c8ab055e3f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1745,6 +1745,11 @@ bool LLViewerRegion::isSpecialCapabilityName(const std::string &name) std::string LLViewerRegion::getCapability(const std::string& name) const { + if (!capabilitiesReceived() && (name!=std::string("Seed"))) + { + llwarns << "getCapability called before caps received" << llendl; + } + CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name); if(iter == mImpl->mCapabilities.end()) { diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp old mode 100644 new mode 100755 index a73ce1d115..37f2fd3520 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1946,8 +1946,10 @@ void LLViewerFetchedTexture::setIsMissingAsset() } else { - //it is normal no map tile on an empty region. - //llwarns << mUrl << ": Marking image as missing" << llendl; + // This may or may not be an error - it is normal to have no + // map tile on an empty region, but bad if we're failing on a + // server bake texture. + llwarns << mUrl << ": Marking image as missing" << llendl; } if (mHasFetcher) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 168a116b95..ed5b332e26 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5767,6 +5767,25 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const return mMotionController.findMotion(id); } +void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) +{ + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + { + mesh->setColor(color); + } + } + } + } +} + //----------------------------------------------------------------------------- // updateMeshTextures() // Uses the current TE values to set the meshes' and layersets' textures. @@ -5831,6 +5850,8 @@ void LLVOAvatar::updateMeshTextures() for (U32 i=0; i < mBakedTextureDatas.size(); i++) { + debugColorizeSubMeshes(i, LLColor4::white); + LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { @@ -5853,6 +5874,9 @@ void LLVOAvatar::updateMeshTextures() } mBakedTextureDatas[i].mIsUsed = TRUE; + + debugColorizeSubMeshes(i,LLColor4::red); + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) @@ -5861,10 +5885,6 @@ void LLVOAvatar::updateMeshTextures() if (mesh) { mesh->setTexture( baked_img ); - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - mesh->setColor(LLColor4::red); - } } } } @@ -5890,9 +5910,12 @@ void LLVOAvatar::updateMeshTextures() } else if (layerset && isUsingLocalAppearance()) { + debugColorizeSubMeshes(i,LLColor4::yellow ); + layerset->createComposite(); layerset->setUpdatesEnabled( TRUE ); mBakedTextureDatas[i].mIsUsed = FALSE; + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) @@ -5901,28 +5924,12 @@ void LLVOAvatar::updateMeshTextures() if (mesh) { mesh->setLayerSet( layerset ); - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - mesh->setColor( LLColor4::yellow ); - } } } } else { - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); - avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); - for (; iter != end; ++iter) - { - LLAvatarJointMesh* mesh = (*iter); - if (mesh) - { - mesh->setColor( LLColor4::blue ); - } - } - } + debugColorizeSubMeshes(i,LLColor4::blue); } } @@ -6768,6 +6775,9 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mIsLoaded = true; mBakedTextureDatas[i].mLastTextureIndex = id; mBakedTextureDatas[i].mIsUsed = true; + + debugColorizeSubMeshes(i,LLColor4::green); + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) @@ -6776,10 +6786,6 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) if (mesh) { mesh->setTexture( image_baked ); - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - mesh->setColor( LLColor4::green ); - } } } if (mBakedTextureDatas[i].mTexLayerSet) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5f858a2bea..8f3811f184 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -595,6 +595,7 @@ private: **/ public: + void debugColorizeSubMeshes(U32 i, const LLColor4& color); virtual void updateMeshTextures(); void updateSexDependentLayerSets(BOOL upload_bake); virtual void dirtyMesh(); // Dirty the avatar mesh -- cgit v1.2.3 From 9dd856e37eb9c80701053f0c1a2c0b268f56f5f2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 2 Nov 2012 18:07:07 -0400 Subject: SH-3429 WIP - Added adaptive retry mechanism for failed appearance update requests --- indra/newview/llappearancemgr.cpp | 85 +++++++++++++++++++++++++++++++++++++-- indra/newview/llappearancemgr.h | 2 +- indra/newview/llcallbacklist.cpp | 49 ++++++++++++++++++++++ indra/newview/llcallbacklist.h | 6 +++ 4 files changed, 137 insertions(+), 5 deletions(-) mode change 100644 => 100755 indra/newview/llcallbacklist.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 51de2fd17b..b2a8a33ecf 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2652,12 +2652,70 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base if (inventory_changed) gInventory.notifyObservers(); } +// This is intended for use with HTTP Clients/Responders, but is not +// specifically coupled with those classes. +class LLHTTPRetryPolicy: public LLThreadSafeRefCount +{ +public: + LLHTTPRetryPolicy() {} + virtual ~LLHTTPRetryPolicy() {} + virtual bool shouldRetry(U32 status, F32& seconds_to_wait) = 0; +}; + +// Example of simplest possible policy, not necessarily recommended. +class LLAlwaysRetryImmediatelyPolicy: public LLHTTPRetryPolicy +{ +public: + LLAlwaysRetryImmediatelyPolicy() {} + bool shouldRetry(U32 status, F32& seconds_to_wait) + { + seconds_to_wait = 0.0; + return true; + } +}; + +// Very general policy with geometric back-off after failures, +// up to a maximum delay, and maximum number of retries. +class LLAdaptiveRetryPolicy: public LLHTTPRetryPolicy +{ +public: + LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries): + mMinDelay(min_delay), + mMaxDelay(max_delay), + mBackoffFactor(backoff_factor), + mMaxRetries(max_retries), + mDelay(min_delay), + mRetryCount(0) + { + } + + bool shouldRetry(U32 status, F32& seconds_to_wait) + { + seconds_to_wait = mDelay; + mDelay = llclamp(mDelay*mBackoffFactor,mMinDelay,mMaxDelay); + mRetryCount++; + return (mRetryCount<=mMaxRetries); + } + +private: + F32 mMinDelay; // delay never less than this value + F32 mMaxDelay; // delay never exceeds this value + F32 mBackoffFactor; // delay increases by this factor after each retry, up to mMaxDelay. + U32 mMaxRetries; // maximum number of times shouldRetry will return true. + F32 mDelay; // current delay. + U32 mRetryCount; // number of times shouldRetry has been called. +}; + class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder { public: RequestAgentUpdateAppearanceResponder() { - llinfos << "request created" << llendl; + mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 16.0, 2.0, 5); + } + + virtual ~RequestAgentUpdateAppearanceResponder() + { } // Successful completion. @@ -2669,11 +2727,25 @@ public: // Error /*virtual*/ void error(U32 status, const std::string& reason) { - llwarns << "appearance update request failed, reason: " << reason << llendl; + llwarns << "appearance update request failed, status: " << status << " reason: " << reason << llendl; + F32 seconds_to_wait; + if (mRetryPolicy->shouldRetry(status,seconds_to_wait)) + { + doAfterInterval(boost::bind(&LLAppearanceMgr::requestServerAppearanceUpdate, + LLAppearanceMgr::getInstance(), + LLCurl::ResponderPtr(this)), + seconds_to_wait); + } + else + { + llwarns << "giving up after too many retries" << llendl; + } } + + LLPointer mRetryPolicy; }; -void LLAppearanceMgr::requestServerAppearanceUpdate() +void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr responder_ptr) { if (!gAgent.getRegion()) { @@ -2693,7 +2765,12 @@ void LLAppearanceMgr::requestServerAppearanceUpdate() LLSD body; S32 cof_version = getCOFVersion(); body["cof_version"] = cof_version; - LLHTTPClient::post(url, body, new RequestAgentUpdateAppearanceResponder); + //LLCurl::ResponderPtr responder_ptr; + if (!responder_ptr.get()) + { + responder_ptr = new RequestAgentUpdateAppearanceResponder; + } + LLHTTPClient::post(url, body, responder_ptr); llassert(cof_version >= mLastUpdateRequestCOFVersion); mLastUpdateRequestCOFVersion = cof_version; } diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 4baee10218..01ed66711c 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -187,7 +187,7 @@ public: bool isInUpdateAppearanceFromCOF() { return mIsInUpdateAppearanceFromCOF; } - void requestServerAppearanceUpdate(); + void requestServerAppearanceUpdate(LLCurl::ResponderPtr responder_ptr = NULL); protected: LLAppearanceMgr(); diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp old mode 100644 new mode 100755 index 357a6582d1..79ec43dfe9 --- a/indra/newview/llcallbacklist.cpp +++ b/indra/newview/llcallbacklist.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llcallbacklist.h" +#include "lleventtimer.h" // Library includes #include "llerror.h" @@ -180,6 +181,54 @@ void doOnIdleRepeating(bool_func_t callable) gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor); } +class NullaryFuncEventTimer: public LLEventTimer +{ +public: + NullaryFuncEventTimer(nullary_func_t callable, F32 seconds): + LLEventTimer(seconds), + mCallable(callable) + { + } + +private: + BOOL tick() + { + mCallable(); + return TRUE; + } + + nullary_func_t mCallable; +}; + +// Call a given callable once after specified interval. +void doAfterInterval(nullary_func_t callable, F32 seconds) +{ + new NullaryFuncEventTimer(callable, seconds); +} + +class BoolFuncEventTimer: public LLEventTimer +{ +public: + BoolFuncEventTimer(bool_func_t callable, F32 seconds): + LLEventTimer(seconds), + mCallable(callable) + { + } +private: + BOOL tick() + { + return mCallable(); + } + + bool_func_t mCallable; +}; + +// Call a given callable every specified number of seconds, until it returns true. +void doPeriodically(bool_func_t callable, F32 seconds) +{ + new BoolFuncEventTimer(callable, seconds); +} + #ifdef _DEBUG void test1(void *data) diff --git a/indra/newview/llcallbacklist.h b/indra/newview/llcallbacklist.h index 97f3bfd9ee..0516c9cdb4 100644 --- a/indra/newview/llcallbacklist.h +++ b/indra/newview/llcallbacklist.h @@ -61,6 +61,12 @@ void doOnIdleOneTime(nullary_func_t callable); // Repeatedly call a callable in idle loop until it returns true. void doOnIdleRepeating(bool_func_t callable); +// Call a given callable once after specified interval. +void doAfterInterval(nullary_func_t callable, F32 seconds); + +// Call a given callable every specified number of seconds, until it returns true. +void doPeriodically(bool_func_t callable, F32 seconds); + extern LLCallbackList gIdleCallbacks; #endif -- cgit v1.2.3 From 6d085486bd972406d153beec79449ec30b5a91ff Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 5 Nov 2012 17:36:56 -0500 Subject: small logging tweak --- indra/newview/llappearancemgr.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index b2a8a33ecf..4e103bb75e 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2731,6 +2731,7 @@ public: F32 seconds_to_wait; if (mRetryPolicy->shouldRetry(status,seconds_to_wait)) { + llinfos << "retrying" << llendl; doAfterInterval(boost::bind(&LLAppearanceMgr::requestServerAppearanceUpdate, LLAppearanceMgr::getInstance(), LLCurl::ResponderPtr(this)), -- cgit v1.2.3 From ee2bc008ea8f04ffd1271787382a2b756e6293aa Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 5 Nov 2012 18:02:03 -0500 Subject: renamed a confusingly-named field --- indra/newview/llvoavatar.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ed5b332e26..75e71a7613 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5833,7 +5833,7 @@ void LLVOAvatar::updateMeshTextures() && ( !layerset->getViewerComposite()->isInitialized() || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] - && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) + && (mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR) && layerset_invalid); if (use_lkg_baked_layer[i]) { @@ -5843,7 +5843,7 @@ void LLVOAvatar::updateMeshTextures() else { use_lkg_baked_layer[i] = (!is_layer_baked[i] - && mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); + && mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR); } } @@ -5856,10 +5856,10 @@ void LLVOAvatar::updateMeshTextures() if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; - const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); + const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { - baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); + baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); } else { @@ -5870,7 +5870,7 @@ void LLVOAvatar::updateMeshTextures() llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; } - baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureID, target_host ); } mBakedTextureDatas[i].mIsUsed = TRUE; @@ -5891,7 +5891,7 @@ void LLVOAvatar::updateMeshTextures() else if (!isUsingLocalAppearance() && is_layer_baked[i]) { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; - if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) + if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID ) { // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). useBakedTexture( baked_img->getID() ); @@ -6248,7 +6248,7 @@ void LLVOAvatar::onFirstTEMessageReceived() if (layer_baked) { LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; - mBakedTextureDatas[i].mLastTextureIndex = image->getID(); + mBakedTextureDatas[i].mLastTextureID = image->getID(); // If we have more than one texture for the other baked layers, we'll want to call this for them too. if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { @@ -6439,11 +6439,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) { if (!isTextureDefined(mBakedTextureDatas[baked_index].mTextureIndex) - && mBakedTextureDatas[baked_index].mLastTextureIndex != IMG_DEFAULT + && mBakedTextureDatas[baked_index].mLastTextureID != IMG_DEFAULT && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } @@ -6773,7 +6773,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { LL_DEBUGS("Avatar") << avString() << " i " << i << " id " << id << LL_ENDL; mBakedTextureDatas[i].mIsLoaded = true; - mBakedTextureDatas[i].mLastTextureIndex = id; + mBakedTextureDatas[i].mLastTextureID = id; mBakedTextureDatas[i].mIsUsed = true; debugColorizeSubMeshes(i,LLColor4::green); -- cgit v1.2.3 From f5a4c277cbf83d6adbb5f2040f3a9e2bfaa02277 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Nov 2012 15:28:38 -0500 Subject: SH-3500 FIX - added additional logging to allow params in various locations to be distinguished --- indra/newview/llvoavatar.cpp | 12 ++++++++++-- indra/newview/llvoavatarself.cpp | 35 +++++++++++++++++++++++++++++++++++ indra/newview/llvoavatarself.h | 1 + 3 files changed, 46 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 75e71a7613..ae6af96d4a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6320,9 +6320,11 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) wtype = vparam->getWearableType(); } S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight()); - apr_file_printf(file, "\t\t\n", + apr_file_printf(file, "\t\t\n", viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(), - LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str()); + LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str(), + param_location_name(vparam->getParamLocation()).c_str() + ); } @@ -6929,6 +6931,12 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara apr_file_printf( file, "\t\n" ); apr_file_printf( file, "\n\n" ); + bool ultra_verbose = false; + if (isSelf() && ultra_verbose) + { + // show the cloned params inside the wearables as well. + gAgentAvatarp->dumpWearableInfo(outfile); + } // File will close when handle goes out of scope } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index a01188d7dc..2b95a38086 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2777,3 +2777,38 @@ void LLVOAvatarSelf::dumpScratchTextureByteCount() { llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl; } + +void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); + +void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile) +{ + apr_file_t* file = outfile.getFileHandle(); + if (!file) + { + return; + } + + + apr_file_printf( file, "\n\n" ); + + LLWearableData *wd = getWearableData(); + for (S32 type = 0; type < LLWearableType::WT_COUNT; type++) + { + const std::string& type_name = LLWearableType::getTypeName((LLWearableType::EType)type); + for (U32 j=0; j< wd->getWearableCount((LLWearableType::EType)type); j++) + { + LLViewerWearable *wearable = gAgentWearables.getViewerWearable((LLWearableType::EType)type,j); + apr_file_printf( file, "\n\t \n", + type_name.c_str(), wearable->getName().c_str() ); + LLWearable::visual_param_vec_t v_params; + wearable->getVisualParams(v_params); + for (LLWearable::visual_param_vec_t::iterator it = v_params.begin(); + it != v_params.end(); ++it) + { + LLVisualParam *param = *it; + dump_visual_param(file, param, param->getWeight()); + } + } + } + apr_file_printf( file, "\n\n" ); +} diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 89bb8bf5c9..eeac5ddaeb 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -364,6 +364,7 @@ public: static void dumpTotalLocalTextureByteCount(); void dumpLocalTextures() const; static void dumpScratchTextureByteCount(); + void dumpWearableInfo(LLAPRFile& outfile); //-------------------------------------------------------------------- // Avatar Rez Metrics -- cgit v1.2.3 From 0c834deb97bfa26714c7e20912d9cac12429d0f2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Nov 2012 17:12:09 -0500 Subject: SH-3493 FIX - removed a large number of completely unnecessary image cache clears, each of which then forced re-reading the same data from disk --- indra/newview/llvoavatar.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ae6af96d4a..fe471d515c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7019,15 +7019,9 @@ void LLVOAvatar::cullAvatarsByPixelArea() } } - // runway - this doesn't detect gray/grey state. - // think we just need to be checking self av since it's the only - // one with lltexlayer stuff. + // runway - this doesn't really detect gray/grey state. S32 grey_avatars = 0; - if (LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars)) - { - LLVOAvatar::deleteCachedImages(false); - } - else + if (!LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars)) { if (gFrameTimeSeconds != sUnbakedUpdateTime) // only update once per frame { -- cgit v1.2.3 From 6a94c257a1c030978f4f7705ade39be4abb50b39 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Nov 2012 18:54:20 -0500 Subject: Fixed a temp file deletion problem found by inspection of SL log file --- indra/newview/llwearablelist.cpp | 4 ++++ 1 file changed, 4 insertions(+) mode change 100644 => 100755 indra/newview/llwearablelist.cpp (limited to 'indra/newview') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp old mode 100644 new mode 100755 index 3dfacd70f3..507ce57e79 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -134,6 +134,10 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID if(filename) { + if (ifs.is_open()) + { + ifs.close(); + } LLFile::remove(std::string(filename)); } } -- cgit v1.2.3 From 46fce35fdcae3dfc72e22c8c4f2637f59487ed62 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 8 Nov 2012 11:25:41 -0500 Subject: removed references to two nonexistent textures in textures.xml --- indra/newview/skins/default/textures/textures.xml | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 06f8f8c670..03aedae0a9 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -712,9 +712,6 @@ with the same filename but different name - - - -- cgit v1.2.3 From 2234ed87e4da21a9da257d99d410355306c99171 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 9 Nov 2012 17:44:50 -0500 Subject: SH-3484 WIP - added additional logging under DebugAvatarCompositeBaked to try to track down baked texture issues --- indra/newview/llvoavatar.cpp | 39 +++++++++++++++++++++++++++++++++------ indra/newview/llvoavatar.h | 1 + 2 files changed, 34 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fe471d515c..47cb31ae18 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2888,11 +2888,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { central_bake_version = getRegion()->getCentralBakeVersion(); } - addDebugText(llformat("mUseLocalAppearance: %d\nmIsEditingAppearance: %d\n" - "mUseServerBakes %d\ncentralBakeVersion %d", + addDebugText(llformat("mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version)); } + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + if (!mBakedTextureDebugText.empty()) + addDebugText(mBakedTextureDebugText); + } if (LLVOAvatar::sShowAnimationDebug) { @@ -5793,7 +5797,8 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) // virtual void LLVOAvatar::updateMeshTextures() { - // llinfos << "updateMeshTextures" << llendl; + mBakedTextureDebugText.clear(); + // if user has never specified a texture, assign the default for (U32 i=0; i < getNumTEs(); i++) { @@ -5819,17 +5824,19 @@ void LLVOAvatar::updateMeshTextures() std::vector use_lkg_baked_layer; // lkg = "last known good" use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); + mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; for (U32 i=0; i < mBakedTextureDatas.size(); i++) { is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); - + LLViewerTexLayerSet* layerset = NULL; + bool layerset_invalid = false; if (!other_culled) { // When an avatar is changing clothes and not in Appearance mode, // use the last-known good baked texture until it finish the first // render of the new layerset. - LLViewerTexLayerSet* layerset = getTexLayerSet(i); - const BOOL layerset_invalid = layerset + layerset = getTexLayerSet(i); + layerset_invalid = layerset && ( !layerset->getViewerComposite()->isInitialized() || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] @@ -5846,6 +5853,24 @@ void LLVOAvatar::updateMeshTextures() && mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR); } + std::string last_id_string; + if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT_AVATAR) + last_id_string = "A"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT) + last_id_string = "D"; + else + last_id_string = "*"; + bool is_ltda = layerset + && layerset->getViewerComposite()->isInitialized() + && layerset->isLocalTextureDataAvailable(); + mBakedTextureDebugText += llformat("%4d %4s %4d %4d %4d %4d %4s\n", + i, + (layerset?"*":"0"), + layerset_invalid, + is_ltda, + is_layer_baked[i], + use_lkg_baked_layer[i], + last_id_string.c_str()); } for (U32 i=0; i < mBakedTextureDatas.size(); i++) @@ -5856,6 +5881,7 @@ void LLVOAvatar::updateMeshTextures() if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; + LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { @@ -5872,6 +5898,7 @@ void LLVOAvatar::updateMeshTextures() baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureID, target_host ); } + llassert(baked_img == existing_baked_img); mBakedTextureDatas[i].mIsUsed = TRUE; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 8f3811f184..4802476e59 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -945,6 +945,7 @@ private: F32 mMaxPixelArea; F32 mAdjustedPixelArea; std::string mDebugText; + std::string mBakedTextureDebugText; //-------------------------------------------------------------------- -- cgit v1.2.3 From 51a1d510a5dc0b4c02cf8e1c592dd017bb0d07f3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 Nov 2012 13:09:54 -0500 Subject: SH-3541 WIP - fixed one cause of local textures failing to load --- indra/newview/llviewerregion.cpp | 2 +- indra/newview/llvoavatarself.cpp | 33 +++++++++++++++------------------ 2 files changed, 16 insertions(+), 19 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c8ab055e3f..f225a7640b 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1745,7 +1745,7 @@ bool LLViewerRegion::isSpecialCapabilityName(const std::string &name) std::string LLViewerRegion::getCapability(const std::string& name) const { - if (!capabilitiesReceived() && (name!=std::string("Seed"))) + if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia"))) { llwarns << "getCapability called before caps received" << llendl; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 2b95a38086..88bf596a35 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2275,30 +2275,27 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe { if (!isIndexLocalTexture(type)) return; - if (!covered_by_baked) + if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR && imagep->getDiscardLevel() != 0) { - if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR && imagep->getDiscardLevel() != 0) - { - F32 desired_pixels; - desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); - imagep->setBoostLevel(getAvatarBoostLevel()); + F32 desired_pixels; + desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); + imagep->setBoostLevel(getAvatarBoostLevel()); - imagep->resetTextureStats(); - imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); - imagep->addTextureStats( desired_pixels / texel_area_ratio ); - imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; - imagep->forceUpdateBindStats() ; - if (imagep->getDiscardLevel() < 0) - { - mHasGrey = TRUE; // for statistics gathering - } - } - else + imagep->resetTextureStats(); + imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); + imagep->addTextureStats( desired_pixels / texel_area_ratio ); + imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; + imagep->forceUpdateBindStats() ; + if (imagep->getDiscardLevel() < 0) { - // texture asset is missing mHasGrey = TRUE; // for statistics gathering } } + else + { + // texture asset is missing + mHasGrey = TRUE; // for statistics gathering + } } LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 wearable_index) const -- cgit v1.2.3 From 284e1b44d7bcc463b0d3ca56eae76b19e8fea03f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 Nov 2012 13:54:48 -0500 Subject: Fix for build failures --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 47cb31ae18..6f4dfdbe2a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5881,7 +5881,9 @@ void LLVOAvatar::updateMeshTextures() if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; +#ifndef LL_RELEASE_FOR_DOWNLOAD LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); +#endif const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { -- cgit v1.2.3 From 2540568a83ca07856ddb760a6983efb3b85430a2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 Nov 2012 14:50:05 -0500 Subject: SH-3541 WIP - prioritize local textures when in local appearance --- indra/newview/llvoavatarself.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 88bf596a35..619058fd25 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2279,12 +2279,15 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe { F32 desired_pixels; desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); - imagep->setBoostLevel(getAvatarBoostLevel()); + if (isUsingLocalAppearance()) + { + imagep->setBoostLevel(getAvatarBoostLevel()); + imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; + } imagep->resetTextureStats(); imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->addTextureStats( desired_pixels / texel_area_ratio ); - imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; imagep->forceUpdateBindStats() ; if (imagep->getDiscardLevel() < 0) { -- cgit v1.2.3 From dccfd66d94ad813b55d6dc1667f94288079893e9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 Nov 2012 18:30:14 -0500 Subject: block appearance messages while editing --- indra/newview/llvoavatar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6f4dfdbe2a..3a5cc9fc14 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6462,6 +6462,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + if (isSelf() && isEditingAppearance()) + { + llinfos << "ignoring appearance message while in appearance edit" << llendl; + return; + } + mUseServerBakes = (appearance_version > 0); applyParsedTEMessage(tec); -- cgit v1.2.3 From ebce476bd6e4b4b8a6404fa83e8fa0d8b1e64dc5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 15 Nov 2012 11:13:45 -0500 Subject: SH-3484 WIP, SH-3546 WIP, SH-3541 WIP - restrict useBakedTexture when in local update, minor readability tweaks --- indra/newview/llvoavatar.cpp | 64 ++++++++++++++++++++++------------------ indra/newview/llvoavatarself.cpp | 4 ++- 2 files changed, 38 insertions(+), 30 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3a5cc9fc14..160f498443 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5805,7 +5805,9 @@ void LLVOAvatar::updateMeshTextures() const LLViewerTexture* te_image = getImage(i, 0); if(!te_image || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT)) { - setImage(i, LLViewerTextureManager::getFetchedTexture(i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR), 0); // IMG_DEFAULT_AVATAR = a special texture that's never rendered. + // IMG_DEFAULT_AVATAR = a special texture that's never rendered. + const LLUUID& image_id = (i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR); + setImage(i, LLViewerTextureManager::getFetchedTexture(image_id), 0); } } @@ -5833,12 +5835,11 @@ void LLVOAvatar::updateMeshTextures() if (!other_culled) { // When an avatar is changing clothes and not in Appearance mode, - // use the last-known good baked texture until it finish the first + // use the last-known good baked texture until it finishes the first // render of the new layerset. layerset = getTexLayerSet(i); - layerset_invalid = layerset - && ( !layerset->getViewerComposite()->isInitialized() - || !layerset->isLocalTextureDataAvailable() ); + layerset_invalid = layerset && ( !layerset->getViewerComposite()->isInitialized() + || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] && (mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR) && layerset_invalid); @@ -5919,16 +5920,21 @@ void LLVOAvatar::updateMeshTextures() } else if (!isUsingLocalAppearance() && is_layer_baked[i]) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; + LLViewerFetchedTexture* baked_img = + LLViewerTextureManager::staticCastToFetchedTexture( + getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID ) { - // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). + // Even though the file may not be finished loading, + // we'll consider it loaded and use it (rather than + // doing compositing). useBakedTexture( baked_img->getID() ); } else { mBakedTextureDatas[i].mIsLoaded = FALSE; - if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) + if ( (baked_img->getID() != IMG_INVISIBLE) && + ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), src_callback_list, paused); @@ -5983,7 +5989,8 @@ void LLVOAvatar::updateMeshTextures() } - for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = + LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { @@ -6766,7 +6773,7 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { - //llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; + // llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; LLUUID id = src_vi->getID(); LLUUID *avatar_idp = (LLUUID *)userdata; @@ -6797,12 +6804,6 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, void LLVOAvatar::useBakedTexture( const LLUUID& id ) { - - /* if(id == head_baked->getID()) - mHeadBakedLoaded = TRUE; - mLastHeadBakedID = id; - mHeadMesh0.setTexture( head_baked ); - mHeadMesh1.setTexture( head_baked ); */ for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { LLViewerTexture* image_baked = getImage( mBakedTextureDatas[i].mTextureIndex, 0 ); @@ -6813,23 +6814,28 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mLastTextureID = id; mBakedTextureDatas[i].mIsUsed = true; - debugColorizeSubMeshes(i,LLColor4::green); - - avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); - avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); - for (; iter != end; ++iter) + if (isUsingLocalAppearance()) { - LLAvatarJointMesh* mesh = (*iter); - if (mesh) - { - mesh->setTexture( image_baked ); - } + llinfos << "not changing to baked texture while isUsingLocalAppearance" << llendl; } - if (mBakedTextureDatas[i].mTexLayerSet) + else { - //mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); + debugColorizeSubMeshes(i,LLColor4::green); + + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + mesh->setTexture( image_baked ); + } + } } - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = + LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 619058fd25..77deb5e3bc 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1379,7 +1379,8 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - ret &= (getLocalDiscardLevel(tex_index, wearable_index) >= 0); + BOOL tex_avail = (getLocalDiscardLevel(tex_index, wearable_index) >= 0); + ret &= tex_avail; } } return ret; @@ -1781,6 +1782,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te local_tex_obj->setID(tex->getID()); setBakedReady(type,baked_version_ready,index); } + //virtual void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) { -- cgit v1.2.3 From a3ad89dd3535e2621b9f100fe45a2a3814b4045a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 15 Nov 2012 13:54:22 -0500 Subject: removed param location from archetype dump - not currently used --- indra/newview/llvoavatar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 160f498443..94a59253c4 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6356,10 +6356,10 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) wtype = vparam->getWearableType(); } S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight()); - apr_file_printf(file, "\t\t\n", + apr_file_printf(file, "\t\t\n", viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(), - LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str(), - param_location_name(vparam->getParamLocation()).c_str() + LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str() +// param_location_name(vparam->getParamLocation()).c_str() ); } -- cgit v1.2.3 From f93604c399c889e06980554e1cb59a833e7f847d Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Thu, 15 Nov 2012 15:20:05 -0500 Subject: WIP Working on adding http request to increment the COF version when a change is made to an item in an agent's current outfit folder. SH-3339 --- indra/newview/llpaneleditwearable.cpp | 42 +++++++++++++++++++++++++++++++++++ indra/newview/llpaneleditwearable.h | 12 ++++++---- indra/newview/llviewerregion.cpp | 1 + 3 files changed, 51 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 7832156a0e..9862c98cc8 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1028,6 +1028,46 @@ void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type) } } +//static +void LLPanelEditWearable::incrementCofVersion() +{ + // Create a response handler + LLHTTPClient::ResponderPtr responderPtr = LLHTTPClient::ResponderPtr(new LLMaturityPreferencesResponder(this)); + + // Look up the capability to POST to. + std::string url = gAgent.getRegion()->getCapability("IncrementCofVersion"); + + // If we don't have a region, report it as an error + if (getRegion() == NULL) + { + responderPtr->error(0U, "region is not defined"); + } + else + { + // Find the capability to send maturity preference + std::string url = getRegion()->getCapability("UpdateAgentInformation"); + + // If the capability is not defined, report it as an error + if (url.empty()) + { + responderPtr->error(0U, "capability 'UpdateAgentInformation' is not defined for region"); + } + else + { + // Set new access preference + LLSD access_prefs = LLSD::emptyMap(); + access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity); + + LLSD body = LLSD::emptyMap(); + body["access_prefs"] = access_prefs; + llinfos << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) + << "' via capability to: " << url << llendl; + LLSD headers; + LLHTTPClient::post(url, body, responderPtr, headers, 30.0f); + } + } +} + void LLPanelEditWearable::saveChanges(bool force_save_as) { if (!mWearablePtr || !isDirty()) @@ -1050,6 +1090,8 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) { gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); } + + LLPanelEditWearable::incrementCofVersion(); } void LLPanelEditWearable::revertChanges() diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 309d512e23..619486bb5b 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -31,6 +31,8 @@ #include "llscrollingpanellist.h" #include "llmodaldialog.h" #include "llavatarappearancedefines.h" +#include "llagent.h" +#include "llviewerregion.h" #include "llwearabletype.h" class LLAccordionCtrl; @@ -94,7 +96,7 @@ private: void toggleTypeSpecificControls(LLWearableType::EType type); void updateTypeSpecificControls(LLWearableType::EType type); - //alpha mask checkboxes + // alpha mask checkboxes void configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name); void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te); void updateAlphaCheckboxes(); @@ -104,7 +106,7 @@ private: // callback for HeightUnits parameter. bool changeHeightUnits(const LLSD& new_value); - // updates current metric and replacemet metric label text + // updates current metric and replacement metric label text void updateMetricLayout(BOOL new_value); // updates avatar height label @@ -114,6 +116,8 @@ private: void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel); + static void incrementCofVersion(); + // the pointer to the wearable we're editing. NULL means we're not editing a wearable. LLViewerWearable *mWearablePtr; LLViewerInventoryItem* mWearableItem; @@ -128,7 +132,7 @@ private: LLTextBox *mTxtAvatarHeight; - // localized and parametrized strings that used to build avatar_height_label + // localized and parameterized strings that used to build avatar_height_label std::string mMeters; std::string mFeet; std::string mHeigth; @@ -151,7 +155,7 @@ private: LLPanel *mPanelEyes; LLPanel *mPanelHair; - //clothes + // clothes LLPanel *mPanelShirt; LLPanel *mPanelPants; LLPanel *mPanelShoes; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0855bc9243..94533d97df 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1541,6 +1541,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("FetchLibDescendents2"); capabilityNames.append("FetchInventory2"); capabilityNames.append("FetchInventoryDescendents2"); + capabilityNames.append("IncrementCOFVersion"); } capabilityNames.append("GetDisplayNames"); -- cgit v1.2.3 From ee810bf2abe230769bd5ee81dc76e54d5fcda34c Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Fri, 16 Nov 2012 17:07:45 -0500 Subject: WIP First buildable code after adding support for SH-3339. --- indra/newview/llpaneleditwearable.cpp | 96 ++++++++++++++++++++++++----------- indra/newview/llpaneleditwearable.h | 3 +- 2 files changed, 66 insertions(+), 33 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 9862c98cc8..997edbab07 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -26,6 +26,8 @@ #include "llviewerprecompiledheaders.h" +#include + #include "llpaneleditwearable.h" #include "llpanel.h" #include "llviewerwearable.h" @@ -47,6 +49,7 @@ #include "llscrollingpanelparam.h" #include "llradiogroup.h" #include "llnotificationsutil.h" +#include "llhttpclient.h" #include "llcolorswatch.h" #include "lltexturectrl.h" @@ -1028,44 +1031,75 @@ void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type) } } +class LLIncrementCofVersionResponder : public LLHTTPClient::Responder +{ +public: + LLIncrementCofVersionResponder(S32 retries); + virtual ~LLIncrementCofVersionResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + LLAgent *mAgent; + S32 mRetries; +}; + +LLIncrementCofVersionResponder::LLIncrementCofVersionResponder(S32 retries) + : LLHTTPClient::Responder(), + mRetries(retries) +{ +} + +LLIncrementCofVersionResponder::~LLIncrementCofVersionResponder() +{ +} + +void LLIncrementCofVersionResponder::result(const LLSD &pContent) +{ + lldebugs << "Successfully incremented agent's COF." << llendl; + +} + +void LLIncrementCofVersionResponder::error(U32 pStatus, const std::string& pReason) +{ + llwarns << "While attempting to increment the agent's cof we got an error because '" + << pReason << "' [status:" << pStatus << "]" << llendl; + LLPanelEditWearable::incrementCofVersion(mRetries++); +} + //static -void LLPanelEditWearable::incrementCofVersion() +void LLPanelEditWearable::incrementCofVersion(S32 retries) { - // Create a response handler - LLHTTPClient::ResponderPtr responderPtr = LLHTTPClient::ResponderPtr(new LLMaturityPreferencesResponder(this)); + // Create a response handler + LLHTTPClient::ResponderPtr responderPtr = LLHTTPClient::ResponderPtr(new LLIncrementCofVersionResponder(retries)); - // Look up the capability to POST to. - std::string url = gAgent.getRegion()->getCapability("IncrementCofVersion"); + // If we don't have a region, report it as an error + if (gAgent.getRegion() == NULL) + { + responderPtr->error(0U, "region is not defined"); + } + else + { + // Find the capability to send maturity preference + std::string url = gAgent.getRegion()->getCapability("IncrementCofVersion"); - // If we don't have a region, report it as an error - if (getRegion() == NULL) + // If the capability is not defined, report it as an error + if (url.empty()) { - responderPtr->error(0U, "region is not defined"); + responderPtr->error(0U, "capability 'UpdateAgentInformation' is not defined for region"); } else { - // Find the capability to send maturity preference - std::string url = getRegion()->getCapability("UpdateAgentInformation"); - - // If the capability is not defined, report it as an error - if (url.empty()) - { - responderPtr->error(0U, "capability 'UpdateAgentInformation' is not defined for region"); - } - else - { - // Set new access preference - LLSD access_prefs = LLSD::emptyMap(); - access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity); - - LLSD body = LLSD::emptyMap(); - body["access_prefs"] = access_prefs; - llinfos << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) - << "' via capability to: " << url << llendl; - LLSD headers; - LLHTTPClient::post(url, body, responderPtr, headers, 30.0f); - } - } + llinfos << "Requesting cof_version be incremented via capability to: " + << url << llendl; + LLSD headers; + LLSD body = LLSD::emptyMap(); + LLHTTPClient::post(url, body, responderPtr, headers, 30.0f); + } + } } void LLPanelEditWearable::saveChanges(bool force_save_as) @@ -1091,7 +1125,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); } - LLPanelEditWearable::incrementCofVersion(); + LLPanelEditWearable::incrementCofVersion(0); } void LLPanelEditWearable::revertChanges() diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 619486bb5b..9c9eac791e 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -78,6 +78,7 @@ public: virtual void setVisible(BOOL visible); + static void incrementCofVersion(S32 retries); private: typedef std::map value_map_t; @@ -116,8 +117,6 @@ private: void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel); - static void incrementCofVersion(); - // the pointer to the wearable we're editing. NULL means we're not editing a wearable. LLViewerWearable *mWearablePtr; LLViewerInventoryItem* mWearableItem; -- cgit v1.2.3 From 7221aaaf390270ae72ffbf6813b359d5d99480e8 Mon Sep 17 00:00:00 2001 From: "prep@lindenlab.com" Date: Mon, 19 Nov 2012 11:27:16 -0600 Subject: Implementation for SH-3530, CR:Nyx --- indra/newview/llsaveoutfitcombobtn.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llsaveoutfitcombobtn.cpp b/indra/newview/llsaveoutfitcombobtn.cpp index cbad85cfd3..59137f4ef7 100644 --- a/indra/newview/llsaveoutfitcombobtn.cpp +++ b/indra/newview/llsaveoutfitcombobtn.cpp @@ -31,6 +31,8 @@ #include "llsidepanelappearance.h" #include "llsaveoutfitcombobtn.h" #include "llviewermenu.h" +#include "llagent.h" +#include "llviewerregion.h" static const std::string SAVE_BTN("save_btn"); static const std::string SAVE_FLYOUT_BTN("save_flyout_btn"); @@ -76,8 +78,12 @@ void LLSaveOutfitComboBtn::saveOutfit(bool as_new) if (panel_outfits_inventory) { panel_outfits_inventory->onSave(); + } + + if ( gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()) + { + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); } - //*TODO how to get to know when base outfit is updated or new outfit is created? } -- cgit v1.2.3 From 2aa56069f458441daa74a86a8805763482f02fd6 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Mon, 19 Nov 2012 14:26:59 -0500 Subject: WIP SH-3339 Only try to increment the cof version if in a server bake region. --- indra/newview/llpaneleditwearable.cpp | 11 ++++++++++- indra/newview/llpaneleditwearable.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 997edbab07..ad55936cab 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1070,6 +1070,12 @@ void LLIncrementCofVersionResponder::error(U32 pStatus, const std::string& pReas LLPanelEditWearable::incrementCofVersion(mRetries++); } +//static +void LLPanelEditWearable::incrementCofVersion() +{ + incrementCofVersion(0); +} + //static void LLPanelEditWearable::incrementCofVersion(S32 retries) { @@ -1125,7 +1131,10 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); } - LLPanelEditWearable::incrementCofVersion(0); + if (gAgentAvatarp->isUsingServerBakes()) + { + LLPanelEditWearable::incrementCofVersion(0); + } } void LLPanelEditWearable::revertChanges() diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 9c9eac791e..67217f8751 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -78,6 +78,7 @@ public: virtual void setVisible(BOOL visible); + static void incrementCofVersion(); static void incrementCofVersion(S32 retries); private: -- cgit v1.2.3 From 81219ad03b59a5fcd80ee450b7606c6bb64f4c7d Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Mon, 19 Nov 2012 16:30:14 -0500 Subject: Moved implementation of incrementCofVersion to llappearancemgr.cpp. Changed retry logic to use the more robust mRetryPolicy instead of my own previous implementation. --- indra/newview/llappearancemgr.cpp | 75 +++++++++++++++++++++++++++++++++ indra/newview/llappearancemgr.h | 2 + indra/newview/llpaneleditwearable.cpp | 79 +---------------------------------- indra/newview/llpaneleditwearable.h | 3 -- 4 files changed, 78 insertions(+), 81 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4e103bb75e..e3ac052961 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2776,6 +2776,81 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond mLastUpdateRequestCOFVersion = cof_version; } +class LLIncrementCofVersionResponder : public LLHTTPClient::Responder +{ +public: + LLIncrementCofVersionResponder() : LLHTTPClient::Responder() + { + mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 16.0, 2.0, 5); + } + + virtual ~LLIncrementCofVersionResponder() + { + } + + virtual void result(const LLSD &pContent) + { + llinfos << "Successfully incremented agent's COF." << llendl; + S32 new_version = pContent["category"]["version"].asInteger(); + + LLAppearanceMgr* app_mgr = LLAppearanceMgr::getInstance(); + + // cof_version should have increased + llassert(new_version > app_mgr->mLastUpdateRequestCOFVersion); + + app_mgr->mLastUpdateRequestCOFVersion = new_version; + } + virtual void error(U32 pStatus, const std::string& pReason) + { + llwarns << "While attempting to increment the agent's cof we got an error because '" + << pReason << "' [status:" << pStatus << "]" << llendl; + F32 seconds_to_wait; + if (mRetryPolicy->shouldRetry(pStatus,seconds_to_wait)) + { + llinfos << "retrying" << llendl; + doAfterInterval(boost::bind(&LLAppearanceMgr::incrementCofVersion, + LLAppearanceMgr::getInstance(), + LLHTTPClient::ResponderPtr(this)), + seconds_to_wait); + } + else + { + llwarns << "giving up after too many retries" << llendl; + } + } + + LLPointer mRetryPolicy; +}; + +void LLAppearanceMgr::incrementCofVersion(LLHTTPClient::ResponderPtr responder_ptr) +{ + // If we don't have a region, report it as an error + if (gAgent.getRegion() == NULL) + { + llwarns << "Region not set, cannot request cof_version increment" << llendl; + return; + } + + std::string url = gAgent.getRegion()->getCapability("IncrementCofVersion"); + if (url.empty()) + { + llwarns << "No cap for IncrementCofVersion." << llendl; + return; + } + + llinfos << "Requesting cof_version be incremented via capability to: " + << url << llendl; + LLSD headers; + LLSD body = LLSD::emptyMap(); + + if (!responder_ptr.get()) + { + responder_ptr = LLHTTPClient::ResponderPtr(new LLIncrementCofVersionResponder()); + } + + LLHTTPClient::get(url, body, responder_ptr, headers, 30.0f); +} + class LLShowCreatedOutfit: public LLInventoryCallback { public: diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 01ed66711c..525402c215 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -189,6 +189,8 @@ public: void requestServerAppearanceUpdate(LLCurl::ResponderPtr responder_ptr = NULL); + void incrementCofVersion(LLHTTPClient::ResponderPtr responder_ptr = NULL); + protected: LLAppearanceMgr(); ~LLAppearanceMgr(); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index ad55936cab..2bc952dcae 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1031,83 +1031,6 @@ void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type) } } -class LLIncrementCofVersionResponder : public LLHTTPClient::Responder -{ -public: - LLIncrementCofVersionResponder(S32 retries); - virtual ~LLIncrementCofVersionResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - -protected: - -private: - LLAgent *mAgent; - S32 mRetries; -}; - -LLIncrementCofVersionResponder::LLIncrementCofVersionResponder(S32 retries) - : LLHTTPClient::Responder(), - mRetries(retries) -{ -} - -LLIncrementCofVersionResponder::~LLIncrementCofVersionResponder() -{ -} - -void LLIncrementCofVersionResponder::result(const LLSD &pContent) -{ - lldebugs << "Successfully incremented agent's COF." << llendl; - -} - -void LLIncrementCofVersionResponder::error(U32 pStatus, const std::string& pReason) -{ - llwarns << "While attempting to increment the agent's cof we got an error because '" - << pReason << "' [status:" << pStatus << "]" << llendl; - LLPanelEditWearable::incrementCofVersion(mRetries++); -} - -//static -void LLPanelEditWearable::incrementCofVersion() -{ - incrementCofVersion(0); -} - -//static -void LLPanelEditWearable::incrementCofVersion(S32 retries) -{ - // Create a response handler - LLHTTPClient::ResponderPtr responderPtr = LLHTTPClient::ResponderPtr(new LLIncrementCofVersionResponder(retries)); - - // If we don't have a region, report it as an error - if (gAgent.getRegion() == NULL) - { - responderPtr->error(0U, "region is not defined"); - } - else - { - // Find the capability to send maturity preference - std::string url = gAgent.getRegion()->getCapability("IncrementCofVersion"); - - // If the capability is not defined, report it as an error - if (url.empty()) - { - responderPtr->error(0U, "capability 'UpdateAgentInformation' is not defined for region"); - } - else - { - llinfos << "Requesting cof_version be incremented via capability to: " - << url << llendl; - LLSD headers; - LLSD body = LLSD::emptyMap(); - LLHTTPClient::post(url, body, responderPtr, headers, 30.0f); - } - } -} - void LLPanelEditWearable::saveChanges(bool force_save_as) { if (!mWearablePtr || !isDirty()) @@ -1133,7 +1056,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) if (gAgentAvatarp->isUsingServerBakes()) { - LLPanelEditWearable::incrementCofVersion(0); + LLAppearanceMgr::getInstance()->incrementCofVersion(); } } diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 67217f8751..cd29a5d764 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -78,9 +78,6 @@ public: virtual void setVisible(BOOL visible); - static void incrementCofVersion(); - static void incrementCofVersion(S32 retries); - private: typedef std::map value_map_t; -- cgit v1.2.3 From 632addf63dd6db5cffc18fd351b1899b30fc9062 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Mon, 19 Nov 2012 16:56:03 -0500 Subject: Removed a few unnecessary include lines. --- indra/newview/llpaneleditwearable.cpp | 3 --- indra/newview/llpaneleditwearable.h | 2 -- 2 files changed, 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 2bc952dcae..3e7db06bdf 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -26,8 +26,6 @@ #include "llviewerprecompiledheaders.h" -#include - #include "llpaneleditwearable.h" #include "llpanel.h" #include "llviewerwearable.h" @@ -49,7 +47,6 @@ #include "llscrollingpanelparam.h" #include "llradiogroup.h" #include "llnotificationsutil.h" -#include "llhttpclient.h" #include "llcolorswatch.h" #include "lltexturectrl.h" diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index cd29a5d764..50d5328a83 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -31,8 +31,6 @@ #include "llscrollingpanellist.h" #include "llmodaldialog.h" #include "llavatarappearancedefines.h" -#include "llagent.h" -#include "llviewerregion.h" #include "llwearabletype.h" class LLAccordionCtrl; -- cgit v1.2.3 From 47a2a2982de98c88fbc6cd17bdb897e5ec408b88 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 29 Nov 2012 11:06:10 -0500 Subject: fix for possible crash on exit in self_av_string() --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4e103bb75e..9f6586a69b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -52,7 +52,7 @@ std::string self_av_string() { - return gAgentAvatarp->avString(); + return gAgentAvatarp ? gAgentAvatarp->avString() : std::string("self_av_string error, gAgentAvatarp null"); } // RAII thingy to guarantee that a variable gets reset when the Setter -- cgit v1.2.3 From 9934cd2e29c8ea11e0859cd881d286fd56fae96e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 30 Nov 2012 17:41:07 -0500 Subject: SH-3562 WIP - detect possible hangs in item copying --- indra/newview/llappearancemgr.cpp | 137 +++++++++++++++++++++++++++++++++----- 1 file changed, 121 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 9f6586a69b..09b0c132d2 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -154,6 +154,123 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string } } +// Shim between inventory callback and boost function +typedef boost::function inventory_func_type; + +class LLBoostFuncInventoryCallback: public LLInventoryCallback +{ +public: + + LLBoostFuncInventoryCallback(const inventory_func_type& func): + mFunc(func) + { + } + + void fire(const LLUUID& item_id) + { + mFunc(item_id); + } + +private: + inventory_func_type mFunc; +}; + +LLPointer make_inventory_func_callback(const inventory_func_type& func) +{ + return new LLBoostFuncInventoryCallback(func); +} + +void report_fire(const LLUUID& item_id) +{ + llinfos << item_id << llendl; +} + +class LLInventoryCopyMgr: public LLEventTimer +{ +public: + LLInventoryCopyMgr(LLInventoryModel::item_array_t& src_items, const LLUUID& dst_cat_id, + bool append, const std::string& phase): + mDstCatID(dst_cat_id), + mAppend(append), + mTrackingPhase(phase), + LLEventTimer(5.0) + { + for (LLInventoryModel::item_array_t::const_iterator it = src_items.begin(); + it != src_items.end(); + ++it) + { + LLViewerInventoryItem* item = *it; + mSrcTimes[item->getUUID()] = LLTimer(); + requestCopy(item->getUUID()); + } + if (!mTrackingPhase.empty()) + { + selfStartPhase(mTrackingPhase); + } + } + + void requestCopy(const LLUUID& item_id) + { + LLViewerInventoryItem *item = gInventory.getItem(item_id); + if (!item) + { + llwarns << "requestCopy item not found " << item_id << llendl; + return; + } + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + mDstCatID, + std::string(), + make_inventory_func_callback(boost::bind(&LLInventoryCopyMgr::onCopy,this,item->getUUID(),_1)) + ); + } + + void onCopy(const LLUUID& src_id, const LLUUID& dst_id) + { + LL_DEBUGS("Avatar") << "copied, src_id " << src_id << " to dst_id " << dst_id << " after " << mSrcTimes[src_id].getElapsedTimeF32() << " seconds" << llendl; + mSrcTimes.erase(src_id); + if (mSrcTimes.empty()) + { + onCompletion(); + } + } + + void onCompletion() + { + if (!mTrackingPhase.empty()) + { + selfStopPhase(mTrackingPhase); + } + if( LLInventoryCallbackManager::is_instantiated() ) + { + LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mDstCatID), mAppend); + } + } + + // virtual + // Will be deleted after returning true - only safe to do this if all callbacks have fired. + BOOL tick() + { + bool all_done = mSrcTimes.empty(); + + if (!all_done) + { + llwarns << "possible hang in copy, waiting on " << mSrcTimes.size() << " items" << llendl; + // TODO possibly add retry logic here. + + } + return all_done; + } + +private: + std::string mTrackingPhase; + std::map mSrcTimes; + LLUUID mDstCatID; + bool mAppend; +}; + class LLWearInventoryCategoryCallback : public LLInventoryCallback { public: @@ -1979,22 +2096,10 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap pid, LLFolderType::FT_NONE, name); - LLPointer cb = new LLWearInventoryCategoryCallback(new_cat_id, append); - it = items->begin(); - for(; it < end; ++it) - { - item = *it; - if(item) - { - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - new_cat_id, - std::string(), - cb); - } - } + + // Create a CopyMgr that will copy items, manage its own destruction + new LLInventoryCopyMgr(*items, new_cat_id, append, std::string("wear_inventory_category_callback")); + // BAP fixes a lag in display of created dir. gInventory.notifyObservers(); } -- cgit v1.2.3 From 5c245e941ace3f52dfa3539c473e2c02f207d8a3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 3 Dec 2012 14:34:00 -0500 Subject: SH-3562 WIP --- indra/newview/llappearancemgr.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 09b0c132d2..321bf7edcb 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -239,14 +239,12 @@ public: void onCompletion() { + llinfos << "done" << llendl; if (!mTrackingPhase.empty()) { selfStopPhase(mTrackingPhase); } - if( LLInventoryCallbackManager::is_instantiated() ) - { - LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mDstCatID), mAppend); - } + LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mDstCatID), mAppend); } // virtual @@ -2116,7 +2114,12 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego // Avoid unintentionally overwriting old wearables. We have to do // this up front to avoid having to deal with the case of multiple // wearables being dirty. - if(!category) return; + if (!category) return; + + if ( !LLInventoryCallbackManager::is_instantiated() ) + { + return; + } LL_INFOS("Avatar") << self_av_string() << "wearInventoryCategoryOnAvatar '" << category->getName() << "'" << LL_ENDL; -- cgit v1.2.3 From 6735d40d9a0e03007f6f7aef954022d770c0165d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 4 Dec 2012 17:45:01 -0500 Subject: SH-3604 WIP --- indra/newview/llappearancemgr.cpp | 108 +++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 30 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 79106318a4..8e5f4b3684 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -186,49 +186,59 @@ void report_fire(const LLUUID& item_id) llinfos << item_id << llendl; } -class LLInventoryCopyMgr: public LLEventTimer +class LLCallAfterInventoryBatchMgr: public LLEventTimer { public: - LLInventoryCopyMgr(LLInventoryModel::item_array_t& src_items, const LLUUID& dst_cat_id, - bool append, const std::string& phase): + LLCallAfterInventoryBatchMgr(const LLUUID& dst_cat_id, + const std::string& phase_name, + nullary_func_t on_completion_func, + F32 check_period = 5.0, + F32 retry_after = 30.0, + S32 max_retries = 2 + ): mDstCatID(dst_cat_id), - mAppend(append), - mTrackingPhase(phase), - LLEventTimer(5.0) + mTrackingPhase(phase_name), + mOnCompletionFunc(on_completion_func), + mRetryAfter(retry_after), + mMaxRetries(max_retries), + LLEventTimer(check_period) + { + if (!mTrackingPhase.empty()) + { + selfStartPhase(mTrackingPhase); + } + } + + void addItems(LLInventoryModel::item_array_t& src_items) { for (LLInventoryModel::item_array_t::const_iterator it = src_items.begin(); it != src_items.end(); ++it) { LLViewerInventoryItem* item = *it; - mSrcTimes[item->getUUID()] = LLTimer(); - requestCopy(item->getUUID()); - } - if (!mTrackingPhase.empty()) - { - selfStartPhase(mTrackingPhase); + llassert(item); + addItem(item); } } - void requestCopy(const LLUUID& item_id) + void addItem(LLViewerInventoryItem *item) { - LLViewerInventoryItem *item = gInventory.getItem(item_id); + const LLUUID& item_id = item->getUUID(); if (!item) { - llwarns << "requestCopy item not found " << item_id << llendl; + llwarns << "item not found for " << item_id << llendl; return; } - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - mDstCatID, - std::string(), - make_inventory_func_callback(boost::bind(&LLInventoryCopyMgr::onCopy,this,item->getUUID(),_1)) - ); + if (mSrcTimes.find(item_id) == mSrcTimes.end()) + { + mSrcTimes[item->getUUID()] = LLTimer(); + } + requestOperation(item); } - - void onCopy(const LLUUID& src_id, const LLUUID& dst_id) + + virtual void requestOperation(LLViewerInventoryItem *item) = 0; + + void onOp(const LLUUID& src_id, const LLUUID& dst_id) { LL_DEBUGS("Avatar") << "copied, src_id " << src_id << " to dst_id " << dst_id << " after " << mSrcTimes[src_id].getElapsedTimeF32() << " seconds" << llendl; mSrcTimes.erase(src_id); @@ -245,7 +255,7 @@ public: { selfStopPhase(mTrackingPhase); } - LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mDstCatID), mAppend); + mOnCompletionFunc(); } // virtual @@ -256,18 +266,51 @@ public: if (!all_done) { - llwarns << "possible hang in copy, waiting on " << mSrcTimes.size() << " items" << llendl; + llwarns << "possible hang in operation, waiting on " << mSrcTimes.size() << " items" << llendl; // TODO possibly add retry logic here. } return all_done; } -private: + virtual ~LLCallAfterInventoryBatchMgr() + { + LL_DEBUGS("Avatar") << "ending" << llendl; + } + +protected: std::string mTrackingPhase; std::map mSrcTimes; LLUUID mDstCatID; - bool mAppend; + nullary_func_t mOnCompletionFunc; + F32 mRetryAfter; + S32 mMaxRetries; +}; + +class LLCallAfterInventoryCopyMgr: public LLCallAfterInventoryBatchMgr +{ +public: + LLCallAfterInventoryCopyMgr(LLInventoryModel::item_array_t& src_items, + const LLUUID& dst_cat_id, + const std::string& phase_name, + nullary_func_t on_completion_func + ): + LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func) + { + addItems(src_items); + } + + virtual void requestOperation(LLViewerInventoryItem *item) + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + mDstCatID, + std::string(), + make_inventory_func_callback(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1)) + ); + } }; class LLWearInventoryCategoryCallback : public LLInventoryCallback @@ -2097,7 +2140,12 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap name); // Create a CopyMgr that will copy items, manage its own destruction - new LLInventoryCopyMgr(*items, new_cat_id, append, std::string("wear_inventory_category_callback")); + new LLCallAfterInventoryCopyMgr( + *items, new_cat_id, std::string("wear_inventory_category_callback"), + boost::bind(&LLAppearanceMgr::wearInventoryCategoryOnAvatar, + LLAppearanceMgr::getInstance(), + gInventory.getCategory(new_cat_id), + append)); // BAP fixes a lag in display of created dir. gInventory.notifyObservers(); -- cgit v1.2.3 From 480569677cb0cd6b03d2a38a613561d6ef6be059 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Dec 2012 16:38:21 -0500 Subject: SH-3604 WIP - retry mechanism for batch inventory ops, handle either completion or failure --- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/app_settings/settings.xml | 11 ++ indra/newview/llappearancemgr.cpp | 196 ++++++++++++++++++++---------- 3 files changed, 147 insertions(+), 62 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index efb1ccc1cc..4a69e5b356 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4315,6 +4315,17 @@ Value 1.0 + InventoryDebugSimulateOpFailureRate + + Comment + Rate at which we simulate failures of copy/link requests in some operations + Persist + 1 + Type + F32 + Value + 0.0 + InventoryDisplayInbox Comment diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8e5f4b3684..c149f38fcd 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -192,15 +192,20 @@ public: LLCallAfterInventoryBatchMgr(const LLUUID& dst_cat_id, const std::string& phase_name, nullary_func_t on_completion_func, + nullary_func_t on_failure_func, F32 check_period = 5.0, - F32 retry_after = 30.0, + F32 retry_after = 10.0, S32 max_retries = 2 ): mDstCatID(dst_cat_id), mTrackingPhase(phase_name), mOnCompletionFunc(on_completion_func), + mOnFailureFunc(on_failure_func), mRetryAfter(retry_after), mMaxRetries(max_retries), + mPendingRequests(0), + mFailCount(0), + mRetryCount(0), LLEventTimer(check_period) { if (!mTrackingPhase.empty()) @@ -221,6 +226,7 @@ public: } } + // Request or re-request operation for specified item. void addItem(LLViewerInventoryItem *item) { const LLUUID& item_id = item->getUUID(); @@ -229,10 +235,24 @@ public: llwarns << "item not found for " << item_id << llendl; return; } - if (mSrcTimes.find(item_id) == mSrcTimes.end()) + mPendingRequests++; + // On a re-request, this will reset the timer. + mWaitTimes[item_id] = LLTimer(); + if (mRetryCounts.find(item_id) == mRetryCounts.end()) { - mSrcTimes[item->getUUID()] = LLTimer(); + mRetryCounts[item_id] = 0; } + else + { + mRetryCounts[item_id]++; + } + + if (ll_frand()::const_iterator it = mWaitTimes.begin(); + it != mWaitTimes.end();) + { + // Use a copy of iterator because it may be erased/invalidated. + std::map::const_iterator curr_it = it; + ++it; + + F32 time_waited = curr_it->second.getElapsedTimeF32(); + S32 retries = mRetryCounts[curr_it->first]; + if (time_waited > mRetryAfter) + { + if (retries < mMaxRetries) + { + LL_DEBUGS("Avatar") << "Waited " << time_waited << + " for " << curr_it->first << ", retrying" << llendl; + mRetryCount++; + addItem(gInventory.getItem(curr_it->first)); + } + else + { + llwarns << "Giving up on " << curr_it->first << " after too many retries" << llendl; + mWaitTimes.erase(curr_it); + mFailCount++; + } + } + if (mWaitTimes.empty()) + { + onCompletionOrFailure(); + } + } } return all_done; } + void reportStats() + { + LL_DEBUGS("Avatar") << "mFailCount: " << mFailCount << llendl; + LL_DEBUGS("Avatar") << "mRetryCount: " << mRetryCount << llendl; + LL_DEBUGS("Avatar") << "Times: n " << mTimeStats.getCount() << " min " << mTimeStats.getMinValue() << " max " << mTimeStats.getMaxValue() << llendl; + LL_DEBUGS("Avatar") << "Mean " << mTimeStats.getMean() << " stddev " << mTimeStats.getStdDev() << llendl; + } + virtual ~LLCallAfterInventoryBatchMgr() { - LL_DEBUGS("Avatar") << "ending" << llendl; + LL_DEBUGS("Avatar") << "deleting" << llendl; } protected: std::string mTrackingPhase; - std::map mSrcTimes; + std::map mWaitTimes; + std::map mRetryCounts; LLUUID mDstCatID; nullary_func_t mOnCompletionFunc; + nullary_func_t mOnFailureFunc; F32 mRetryAfter; S32 mMaxRetries; + S32 mPendingRequests; + S32 mFailCount; + S32 mRetryCount; + LLViewerStats::StatsAccumulator mTimeStats; }; class LLCallAfterInventoryCopyMgr: public LLCallAfterInventoryBatchMgr @@ -293,9 +388,10 @@ public: LLCallAfterInventoryCopyMgr(LLInventoryModel::item_array_t& src_items, const LLUUID& dst_cat_id, const std::string& phase_name, - nullary_func_t on_completion_func + nullary_func_t on_completion_func, + nullary_func_t on_failure_func ): - LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func) + LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func) { addItems(src_items); } @@ -313,56 +409,32 @@ public: } }; -class LLWearInventoryCategoryCallback : public LLInventoryCallback +class LLCallAfterInventoryLinkMgr: public LLCallAfterInventoryBatchMgr { -public: - LLWearInventoryCategoryCallback(const LLUUID& cat_id, bool append) - { - mCatID = cat_id; - mAppend = append; - - LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; - - selfStartPhase("wear_inventory_category_callback"); - } - void fire(const LLUUID& item_id) + LLCallAfterInventoryLinkMgr(LLInventoryModel::item_array_t& src_items, + const LLUUID& dst_cat_id, + const std::string& phase_name, + nullary_func_t on_completion_func, + nullary_func_t on_failure_func + ): + LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func) { - /* - * Do nothing. We only care about the destructor - * - * The reason for this is that this callback is used in a hack where the - * same callback is given to dozens of items, and the destructor is called - * after the last item has fired the event and dereferenced it -- if all - * the events actually fire! - */ - LL_DEBUGS("Avatar") << self_av_string() << " fired on copied item, id " << item_id << LL_ENDL; + addItems(src_items); } - -protected: - ~LLWearInventoryCategoryCallback() + + virtual void requestOperation(LLViewerInventoryItem *item) { - LL_INFOS("Avatar") << self_av_string() << "done all inventory callbacks" << LL_ENDL; - - selfStopPhase("wear_inventory_category_callback"); - - // Is the destructor called by ordinary dereference, or because the app's shutting down? - // If the inventory callback manager goes away, we're shutting down, no longer want the callback. - if( LLInventoryCallbackManager::is_instantiated() ) - { - LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); - } - else - { - llwarns << self_av_string() << "Dropping unhandled LLWearInventoryCategoryCallback" << llendl; - } + link_inventory_item(gAgent.getID(), + item->getLinkedUUID(), + mDstCatID, + item->getName(), + item->LLInventoryItem::getDescription(), + LLAssetType::AT_LINK, + make_inventory_func_callback( + boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1))); } - -private: - LLUUID mCatID; - bool mAppend; }; - //Inventory callback updating "dirty" state when destroyed class LLUpdateDirtyState: public LLInventoryCallback { @@ -2145,7 +2217,8 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap boost::bind(&LLAppearanceMgr::wearInventoryCategoryOnAvatar, LLAppearanceMgr::getInstance(), gInventory.getCategory(new_cat_id), - append)); + append), + boost::function()); // BAP fixes a lag in display of created dir. gInventory.notifyObservers(); @@ -2167,6 +2240,7 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego if ( !LLInventoryCallbackManager::is_instantiated() ) { + // shutting down, ignore. return; } -- cgit v1.2.3 From 7d419d59009d429c8d9480adf3ae163d5c688126 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Dec 2012 16:39:23 -0500 Subject: SH-3604 WIP - backed out logcontrol.xml change --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 1259039010..64122bbb6c 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - Avatar -- cgit v1.2.3 From 1004eff4a29371719f98eae378f6ecd7dc6be225 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Wed, 5 Dec 2012 17:29:52 -0500 Subject: Linux Viewer build fixes. * Removed no longer used unpack_bufsize from bitpack_test.cpp * Added llviewertexture_stub.cpp to the newview tests directory to fix llworldmap_test.cpp and llworldmipmap_test.cpp linker errors. --- indra/newview/CMakeLists.txt | 9 ++++++++ indra/newview/tests/llviewertexture_stub.cpp | 32 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 indra/newview/tests/llviewertexture_stub.cpp (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f85060a140..e64697982f 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2060,6 +2060,15 @@ if (LL_TESTS) llworldmipmap.cpp ) + set_source_files_properties( + llworldmap.cpp + llworldmipmap.cpp + PROPERTIES + LL_TEST_ADDITIONAL_SOURCE_FILES + tests/llviewertexture_stub.cpp + #llviewertexturelist.cpp + ) + set_source_files_properties( lltranslate.cpp PROPERTIES diff --git a/indra/newview/tests/llviewertexture_stub.cpp b/indra/newview/tests/llviewertexture_stub.cpp new file mode 100644 index 0000000000..90e76a8f83 --- /dev/null +++ b/indra/newview/tests/llviewertexture_stub.cpp @@ -0,0 +1,32 @@ +/** + * @file llviewertexture_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "../llviewertexture.h" + +void LLViewerTexture::setBoostLevel(int level) +{ +} -- cgit v1.2.3 From bfa3bc0059eef269ac7a77cd28443898cea1fb19 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Dec 2012 17:58:35 -0500 Subject: Possible fix for TC build failure --- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/llappearancemgr.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index c149f38fcd..656949a9bb 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -319,11 +319,11 @@ public: if (!mWaitTimes.empty()) { llwarns << "still waiting on " << mWaitTimes.size() << " items" << llendl; - for (std::map::const_iterator it = mWaitTimes.begin(); + for (std::map::iterator it = mWaitTimes.begin(); it != mWaitTimes.end();) { // Use a copy of iterator because it may be erased/invalidated. - std::map::const_iterator curr_it = it; + std::map::iterator curr_it = it; ++it; F32 time_waited = curr_it->second.getElapsedTimeF32(); -- cgit v1.2.3 From 2af1f6dbdfdef0a7b7b7c4f40ac33c8d93869b1f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Dec 2012 18:04:33 -0500 Subject: removed yet another unintended commit of logcontrol.xml --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 1259039010..64122bbb6c 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - Avatar -- cgit v1.2.3 From 1d5b98929b176f3eeda7274bf8f21b69d551a2cd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Dec 2012 15:17:00 -0500 Subject: SH-3604 FIX - switched link creation in updateCOF() to use retry path, better stats reporting, fixed failure logic --- indra/newview/llappearancemgr.cpp | 48 ++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 656949a9bb..98a8097a1e 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -186,13 +186,15 @@ void report_fire(const LLUUID& item_id) llinfos << item_id << llendl; } +void no_op() {} + class LLCallAfterInventoryBatchMgr: public LLEventTimer { public: LLCallAfterInventoryBatchMgr(const LLUUID& dst_cat_id, const std::string& phase_name, nullary_func_t on_completion_func, - nullary_func_t on_failure_func, + nullary_func_t on_failure_func = no_op, F32 check_period = 5.0, F32 retry_after = 10.0, S32 max_retries = 2 @@ -205,6 +207,7 @@ public: mMaxRetries(max_retries), mPendingRequests(0), mFailCount(0), + mCompletionOrFailureCalled(false), mRetryCount(0), LLEventTimer(check_period) { @@ -260,12 +263,16 @@ public: void onOp(const LLUUID& src_id, const LLUUID& dst_id) { - LL_DEBUGS("Avatar") << "copied, src_id " << src_id << " to dst_id " << dst_id << " after " << mWaitTimes[src_id].getElapsedTimeF32() << " seconds" << llendl; + LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << mWaitTimes[src_id].getElapsedTimeF32() << " seconds" << llendl; mPendingRequests--; F32 wait_time = mWaitTimes[src_id].getElapsedTimeF32(); mTimeStats.push(wait_time); mWaitTimes.erase(src_id); - if (mWaitTimes.empty()) + if (mCompletionOrFailureCalled) + { + llinfos << "late-completing operation, src_id " << src_id << "dst_id " << dst_id << llendl; + } + if (mWaitTimes.empty() && !mCompletionOrFailureCalled) { onCompletionOrFailure(); } @@ -273,6 +280,9 @@ public: void onCompletionOrFailure() { + assert (!mCompletionOrFailureCalled); + mCompletionOrFailureCalled = true; + // Will never call onCompletion() if any item has been flagged as // a failure - otherwise could wind up with corrupted // outfit, involuntary nudity, etc. @@ -356,6 +366,7 @@ public: void reportStats() { + LL_DEBUGS("Avatar") << "Phase: " << mTrackingPhase << llendl; LL_DEBUGS("Avatar") << "mFailCount: " << mFailCount << llendl; LL_DEBUGS("Avatar") << "mRetryCount: " << mRetryCount << llendl; LL_DEBUGS("Avatar") << "Times: n " << mTimeStats.getCount() << " min " << mTimeStats.getMinValue() << " max " << mTimeStats.getMaxValue() << llendl; @@ -379,6 +390,7 @@ protected: S32 mPendingRequests; S32 mFailCount; S32 mRetryCount; + bool mCompletionOrFailureCalled; LLViewerStats::StatsAccumulator mTimeStats; }; @@ -389,7 +401,7 @@ public: const LLUUID& dst_cat_id, const std::string& phase_name, nullary_func_t on_completion_func, - nullary_func_t on_failure_func + nullary_func_t on_failure_func = no_op ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func) { @@ -411,11 +423,12 @@ public: class LLCallAfterInventoryLinkMgr: public LLCallAfterInventoryBatchMgr { +public: LLCallAfterInventoryLinkMgr(LLInventoryModel::item_array_t& src_items, const LLUUID& dst_cat_id, const std::string& phase_name, nullary_func_t on_completion_func, - nullary_func_t on_failure_func + nullary_func_t on_failure_func = no_op ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func) { @@ -1757,34 +1770,38 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) purgeCategory(cof, keep_outfit_links); gInventory.notifyObservers(); - // Create links to new COF contents. - LL_DEBUGS("Avatar") << self_av_string() << "creating LLUpdateAppearanceOnDestroy" << LL_ENDL; - LLPointer link_waiter = new LLUpdateAppearanceOnDestroy(!append); - #ifndef LL_RELEASE_FOR_DOWNLOAD LL_DEBUGS("Avatar") << self_av_string() << "Linking body items" << LL_ENDL; #endif - linkAll(cof, body_items, link_waiter); + + // Create links to new COF contents. + LL_DEBUGS("Avatar") << self_av_string() << "creating LLCallAfterInventoryLinkMgr" << LL_ENDL; + bool update_base_outfit_ordering = !append; + LLCallAfterInventoryLinkMgr *link_waiter = + new LLCallAfterInventoryLinkMgr(body_items,cof,"update_appearance_on_destroy", + boost::bind(&LLAppearanceMgr::updateAppearanceFromCOF, + LLAppearanceMgr::getInstance(), + update_base_outfit_ordering)); #ifndef LL_RELEASE_FOR_DOWNLOAD LL_DEBUGS("Avatar") << self_av_string() << "Linking wear items" << LL_ENDL; #endif - linkAll(cof, wear_items, link_waiter); + link_waiter->addItems(wear_items); #ifndef LL_RELEASE_FOR_DOWNLOAD LL_DEBUGS("Avatar") << self_av_string() << "Linking obj items" << LL_ENDL; #endif - linkAll(cof, obj_items, link_waiter); + link_waiter->addItems(obj_items); #ifndef LL_RELEASE_FOR_DOWNLOAD LL_DEBUGS("Avatar") << self_av_string() << "Linking gesture items" << LL_ENDL; #endif - linkAll(cof, gest_items, link_waiter); + link_waiter->addItems(gest_items); // Add link to outfit if category is an outfit. if (!append) { - createBaseOutfitLink(category, link_waiter); + createBaseOutfitLink(category, NULL); } LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL; } @@ -2217,8 +2234,7 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap boost::bind(&LLAppearanceMgr::wearInventoryCategoryOnAvatar, LLAppearanceMgr::getInstance(), gInventory.getCategory(new_cat_id), - append), - boost::function()); + append)); // BAP fixes a lag in display of created dir. gInventory.notifyObservers(); -- cgit v1.2.3 From 07d05c2967fb1013a3f21c1c055ad068b2be9995 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 6 Dec 2012 22:54:50 +0000 Subject: Alpha rendering fixes for appearance utility. --- indra/newview/llviewertexlayer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index cd5e781d71..f3c9921819 100755 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -416,7 +416,10 @@ void LLViewerTexLayerSetBuffer::doUpload() BOOL valid = FALSE; LLPointer integrity_test = new LLImageJ2C; S32 file_size = 0; - U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size); + LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE); + file_size = file.getSize(); + U8* data = integrity_test->allocateData(file_size); + file.read(data, file_size); if (data) { valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data' -- cgit v1.2.3 From b75e632613312c7b994355c692d18b95991545b3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Dec 2012 13:57:44 -0500 Subject: SH-3606 WIP - moving classes to more reusable location --- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/llappearancemgr.cpp | 71 ++++++++++--------------------- indra/newview/llviewerinventory.h | 21 +++++++++ 3 files changed, 45 insertions(+), 49 deletions(-) mode change 100644 => 100755 indra/newview/llviewerinventory.h (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 98a8097a1e..af276e55c3 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -155,37 +155,6 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string } } -// Shim between inventory callback and boost function -typedef boost::function inventory_func_type; - -class LLBoostFuncInventoryCallback: public LLInventoryCallback -{ -public: - - LLBoostFuncInventoryCallback(const inventory_func_type& func): - mFunc(func) - { - } - - void fire(const LLUUID& item_id) - { - mFunc(item_id); - } - -private: - inventory_func_type mFunc; -}; - -LLPointer make_inventory_func_callback(const inventory_func_type& func) -{ - return new LLBoostFuncInventoryCallback(func); -} - -void report_fire(const LLUUID& item_id) -{ - llinfos << item_id << llendl; -} - void no_op() {} class LLCallAfterInventoryBatchMgr: public LLEventTimer @@ -195,8 +164,7 @@ public: const std::string& phase_name, nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, - F32 check_period = 5.0, - F32 retry_after = 10.0, + F32 retry_after = 15.0, S32 max_retries = 2 ): mDstCatID(dst_cat_id), @@ -209,7 +177,7 @@ public: mFailCount(0), mCompletionOrFailureCalled(false), mRetryCount(0), - LLEventTimer(check_period) + LLEventTimer(retry_after) { if (!mTrackingPhase.empty()) { @@ -261,17 +229,20 @@ public: virtual void requestOperation(LLViewerInventoryItem *item) = 0; - void onOp(const LLUUID& src_id, const LLUUID& dst_id) + void onOp(const LLUUID& src_id, const LLUUID& dst_id, LLTimer timestamp) { - LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << mWaitTimes[src_id].getElapsedTimeF32() << " seconds" << llendl; mPendingRequests--; - F32 wait_time = mWaitTimes[src_id].getElapsedTimeF32(); - mTimeStats.push(wait_time); - mWaitTimes.erase(src_id); - if (mCompletionOrFailureCalled) + F32 elapsed = timestamp.getElapsedTimeF32(); + LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << elapsed << " seconds" << llendl; + if (mWaitTimes.find(src_id) == mWaitTimes.end()) { - llinfos << "late-completing operation, src_id " << src_id << "dst_id " << dst_id << llendl; + // No longer waiting for this item - either serviced + // already or gave up after too many retries. + llwarns << "duplicate or late operation, src_id " << src_id << "dst_id " << dst_id + << " elapsed " << elapsed << " after end " << (S32) mCompletionOrFailureCalled << llendl; } + mTimeStats.push(elapsed); + mWaitTimes.erase(src_id); if (mWaitTimes.empty() && !mCompletionOrFailureCalled) { onCompletionOrFailure(); @@ -401,9 +372,11 @@ public: const LLUUID& dst_cat_id, const std::string& phase_name, nullary_func_t on_completion_func, - nullary_func_t on_failure_func = no_op + nullary_func_t on_failure_func = no_op, + F32 retry_after = 15.0, + S32 max_retries = 2 ): - LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func) + LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) { addItems(src_items); } @@ -416,7 +389,7 @@ public: item->getUUID(), mDstCatID, std::string(), - make_inventory_func_callback(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1)) + new LLBoostFuncInventoryCallback(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1,LLTimer())) ); } }; @@ -428,9 +401,11 @@ public: const LLUUID& dst_cat_id, const std::string& phase_name, nullary_func_t on_completion_func, - nullary_func_t on_failure_func = no_op + nullary_func_t on_failure_func = no_op, + F32 retry_after = 15.0, + S32 max_retries = 2 ): - LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func) + LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) { addItems(src_items); } @@ -443,8 +418,8 @@ public: item->getName(), item->LLInventoryItem::getDescription(), LLAssetType::AT_LINK, - make_inventory_func_callback( - boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1))); + new LLBoostFuncInventoryCallback( + boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1,LLTimer()))); } }; diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h old mode 100644 new mode 100755 index 7822ef4da6..e2793ba105 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -297,6 +297,27 @@ private: LLUUID mTargetLandmarkId; }; +// Shim between inventory callback and boost function/callable +typedef boost::function inventory_func_type; + +class LLBoostFuncInventoryCallback: public LLInventoryCallback +{ +public: + + LLBoostFuncInventoryCallback(const inventory_func_type& func): + mFunc(func) + { + } + + void fire(const LLUUID& item_id) + { + mFunc(item_id); + } + +private: + inventory_func_type mFunc; +}; + // misc functions //void inventory_reliable_callback(void**, S32 status); -- cgit v1.2.3 From 0777f53e2f2d773fa536b3c62e16455ce7bbbcce Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Dec 2012 14:47:17 -0500 Subject: SH-3606 WIP - replaced several LLInventoryCallback subclasses with boost::func equivalents --- indra/newview/llagentwearables.cpp | 27 ++- indra/newview/llagentwearablesfetch.cpp | 67 ++++---- indra/newview/llappearancemgr.cpp | 280 ++++++++++++++------------------ indra/newview/llappearancemgr.h | 3 - indra/newview/llfavoritesbar.cpp | 41 ++--- indra/newview/llfloatergesture.cpp | 45 ++--- indra/newview/llfriendcard.cpp | 4 +- indra/newview/llinventorybridge.cpp | 2 +- indra/newview/lltooldraganddrop.cpp | 4 +- indra/newview/llviewerattachmenu.cpp | 2 +- indra/newview/llviewerinventory.cpp | 53 +----- indra/newview/llviewerinventory.h | 66 +++----- 12 files changed, 234 insertions(+), 360 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e2304e6db9..e79fda2459 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -61,19 +61,16 @@ using namespace LLAvatarAppearanceDefines; /////////////////////////////////////////////////////////////////////////////// // Callback to wear and start editing an item that has just been created. -class LLWearAndEditCallback : public LLInventoryCallback +void wear_and_edit_cb(const LLUUID& inv_item) { - void fire(const LLUUID& inv_item) - { - if (inv_item.isNull()) return; - - // Request editing the item after it gets worn. - gAgentWearables.requestEditingWearable(inv_item); - - // Wear it. - LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); - } -}; + if (inv_item.isNull()) return; + + // Request editing the item after it gets worn. + gAgentWearables.requestEditingWearable(inv_item); + + // Wear it. + LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); +} /////////////////////////////////////////////////////////////////////////////// @@ -965,8 +962,8 @@ public: llinfos << "All items created" << llendl; LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; LLAppearanceMgr::instance().linkAll(LLAppearanceMgr::instance().getCOF(), - mItemsToLink, - link_waiter); + mItemsToLink, + link_waiter); } void addPendingWearable(LLViewerWearable *wearable) { @@ -1789,7 +1786,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; - LLPointer cb = wear ? new LLWearAndEditCallback : NULL; + LLPointer cb = wear ? new LLBoostFuncInventoryCallback(wear_and_edit_cb) : NULL; LLUUID folder_id; if (parent_id.notNull()) diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index e2417cdddb..2d622b380a 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -35,54 +35,45 @@ #include "llvoavatarself.h" -class LLOrderMyOutfitsOnDestroy: public LLInventoryCallback +void order_my_outfits_cb() { -public: - LLOrderMyOutfitsOnDestroy() {}; - - virtual ~LLOrderMyOutfitsOnDestroy() + if (!LLApp::isRunning()) { - if (!LLApp::isRunning()) - { - llwarns << "called during shutdown, skipping" << llendl; - return; - } + llwarns << "called during shutdown, skipping" << llendl; + return; + } - const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - if (my_outfits_id.isNull()) return; - - LLInventoryModel::cat_array_t* cats; - LLInventoryModel::item_array_t* items; - gInventory.getDirectDescendentsOf(my_outfits_id, cats, items); - if (!cats) return; + const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + if (my_outfits_id.isNull()) return; - //My Outfits should at least contain saved initial outfit and one another outfit - if (cats->size() < 2) - { - llwarning("My Outfits category was not populated properly", 0); - return; - } + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(my_outfits_id, cats, items); + if (!cats) return; - llinfos << "Starting updating My Outfits with wearables ordering information" << llendl; + //My Outfits should at least contain saved initial outfit and one another outfit + if (cats->size() < 2) + { + llwarning("My Outfits category was not populated properly", 0); + return; + } - for (LLInventoryModel::cat_array_t::iterator outfit_iter = cats->begin(); - outfit_iter != cats->end(); ++outfit_iter) - { - const LLUUID& cat_id = (*outfit_iter)->getUUID(); - if (cat_id.isNull()) continue; + llinfos << "Starting updating My Outfits with wearables ordering information" << llendl; - // saved initial outfit already contains wearables ordering information - if (cat_id == LLAppearanceMgr::getInstance()->getBaseOutfitUUID()) continue; + for (LLInventoryModel::cat_array_t::iterator outfit_iter = cats->begin(); + outfit_iter != cats->end(); ++outfit_iter) + { + const LLUUID& cat_id = (*outfit_iter)->getUUID(); + if (cat_id.isNull()) continue; - LLAppearanceMgr::getInstance()->updateClothingOrderingInfo(cat_id); - } + // saved initial outfit already contains wearables ordering information + if (cat_id == LLAppearanceMgr::getInstance()->getBaseOutfitUUID()) continue; - llinfos << "Finished updating My Outfits with wearables ordering information" << llendl; + LLAppearanceMgr::getInstance()->updateClothingOrderingInfo(cat_id); } - /* virtual */ void fire(const LLUUID& inv_item) {}; -}; - + llinfos << "Finished updating My Outfits with wearables ordering information" << llendl; +} LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : LLInventoryFetchDescendentsObserver(cof_id) @@ -563,7 +554,7 @@ void LLLibraryOutfitsFetch::contentsDone() LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; - LLPointer order_myoutfits_on_destroy = new LLOrderMyOutfitsOnDestroy; + LLPointer order_myoutfits_on_destroy = new LLBoostFuncInventoryCallback(no_op_inventory_func, order_my_outfits_cb); for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin(); folder_iter != mImportedClothingFolders.end(); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index af276e55c3..d34d54fb3b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -155,8 +155,6 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string } } -void no_op() {} - class LLCallAfterInventoryBatchMgr: public LLEventTimer { public: @@ -423,22 +421,6 @@ public: } }; -//Inventory callback updating "dirty" state when destroyed -class LLUpdateDirtyState: public LLInventoryCallback -{ -public: - LLUpdateDirtyState() {} - virtual ~LLUpdateDirtyState() - { - if (LLAppearanceMgr::instanceExists()) - { - LLAppearanceMgr::getInstance()->updateIsDirty(); - } - } - virtual void fire(const LLUUID&) {} -}; - - LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering): mFireCount(0), mUpdateBaseOrder(update_base_outfit_ordering) @@ -777,100 +759,72 @@ bool LLWearableHoldingPattern::pollFetchCompletion() return done; } -class RecoveredItemLinkCB: public LLInventoryCallback +void recovered_item_link_cb(const LLUUID& item_id, LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder) { -public: - RecoveredItemLinkCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder): - mHolder(holder), - mWearable(wearable), - mType(type) + if (!holder->isMostRecent()) { + llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + // runway skip here? } - void fire(const LLUUID& item_id) - { - if (!mHolder->isMostRecent()) - { - llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; - // runway skip here? - } - llinfos << "Recovered item link for type " << mType << llendl; - mHolder->eraseTypeToLink(mType); - // Add wearable to FoundData for actual wearing - LLViewerInventoryItem *item = gInventory.getItem(item_id); - LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL; + llinfos << "Recovered item link for type " << type << llendl; + holder->eraseTypeToLink(type); + // Add wearable to FoundData for actual wearing + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL; - if (linked_item) - { - gInventory.addChangedMask(LLInventoryObserver::LABEL, linked_item->getUUID()); + if (linked_item) + { + gInventory.addChangedMask(LLInventoryObserver::LABEL, linked_item->getUUID()); - if (item) - { - LLFoundData found(linked_item->getUUID(), - linked_item->getAssetUUID(), - linked_item->getName(), - linked_item->getType(), - linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID, - true // is replacement - ); - found.mWearable = mWearable; - mHolder->getFoundList().push_front(found); - } - else - { - llwarns << self_av_string() << "inventory item not found for recovered wearable" << llendl; - } + if (item) + { + LLFoundData found(linked_item->getUUID(), + linked_item->getAssetUUID(), + linked_item->getName(), + linked_item->getType(), + linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID, + true // is replacement + ); + found.mWearable = wearable; + holder->getFoundList().push_front(found); } else { - llwarns << self_av_string() << "inventory link not found for recovered wearable" << llendl; + llwarns << self_av_string() << "inventory item not found for recovered wearable" << llendl; } } -private: - LLWearableHoldingPattern* mHolder; - LLViewerWearable *mWearable; - LLWearableType::EType mType; -}; + else + { + llwarns << self_av_string() << "inventory link not found for recovered wearable" << llendl; + } +} -class RecoveredItemCB: public LLInventoryCallback +void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder) { -public: - RecoveredItemCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder): - mHolder(holder), - mWearable(wearable), - mType(type) + if (!holder->isMostRecent()) { + // runway skip here? + llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; } - void fire(const LLUUID& item_id) - { - if (!mHolder->isMostRecent()) - { - // runway skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; - } - LL_DEBUGS("Avatar") << self_av_string() << "Recovered item for type " << mType << LL_ENDL; - LLViewerInventoryItem *itemp = gInventory.getItem(item_id); - mWearable->setItemID(item_id); - LLPointer cb = new RecoveredItemLinkCB(mType,mWearable,mHolder); - mHolder->eraseTypeToRecover(mType); - llassert(itemp); - if (itemp) - { - link_inventory_item( gAgent.getID(), - item_id, - LLAppearanceMgr::instance().getCOF(), - itemp->getName(), - itemp->getDescription(), - LLAssetType::AT_LINK, - cb); - } + LL_DEBUGS("Avatar") << self_av_string() << "Recovered item for type " << type << LL_ENDL; + LLViewerInventoryItem *itemp = gInventory.getItem(item_id); + wearable->setItemID(item_id); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(recovered_item_link_cb,_1,type,wearable,holder)); + holder->eraseTypeToRecover(type); + llassert(itemp); + if (itemp) + { + link_inventory_item( gAgent.getID(), + item_id, + LLAppearanceMgr::instance().getCOF(), + itemp->getName(), + itemp->getDescription(), + LLAssetType::AT_LINK, + cb); } -private: - LLWearableHoldingPattern* mHolder; - LLViewerWearable *mWearable; - LLWearableType::EType mType; -}; +} void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type) { @@ -888,7 +842,7 @@ void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type // Add a new one in the lost and found folder. const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - LLPointer cb = new RecoveredItemCB(type,wearable,this); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(recovered_item_cb,_1,type,wearable,this)); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), @@ -1225,6 +1179,18 @@ const LLUUID LLAppearanceMgr::getBaseOutfitUUID() return outfit_cat->getUUID(); } +void wear_on_avatar_cb(const LLUUID& inv_item, bool do_replace = false) +{ + if (inv_item.isNull()) + return; + + LLViewerInventoryItem *item = gInventory.getItem(inv_item); + if (item) + { + LLAppearanceMgr::instance().wearItemOnAvatar(inv_item, true, do_replace); + } +} + bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update, bool replace, LLPointer cb) { if (item_id_to_wear.isNull()) return false; @@ -1244,8 +1210,8 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getLibraryRootFolderID())) { - LLPointer cb = new WearOnAvatarCallback(replace); - copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(), item_to_wear->getUUID(), LLUUID::null, std::string(),cb); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(wear_on_avatar_cb,_1,replace)); + copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(), item_to_wear->getUUID(), LLUUID::null, std::string(), cb); return false; } else if (!gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getRootFolderID())) @@ -2348,6 +2314,25 @@ void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPo } } +void modified_cof_cb(const LLUUID& inv_item) +{ + LLAppearanceMgr::instance().updateAppearanceFromCOF(); + + // Start editing the item if previously requested. + gAgentWearables.editWearableIfRequested(inv_item); + + // TODO: camera mode may not be changed if a debug setting is tweaked + if( gAgentCamera.cameraCustomizeAvatar() ) + { + // If we're in appearance editing mode, the current tab may need to be refreshed + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); + if (panel) + { + panel->showDefaultSubpart(); + } + } +} + void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer cb) { const LLViewerInventoryItem *vitem = dynamic_cast(item); @@ -2411,7 +2396,7 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update { if(do_update && cb.isNull()) { - cb = new ModifiedCOFCallback; + cb = new LLBoostFuncInventoryCallback(modified_cof_cb); } const std::string description = vitem->getIsLinkType() ? vitem->getDescription() : ""; link_inventory_item( gAgent.getID(), @@ -2425,22 +2410,6 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update return; } -// BAP remove ensemble code for 2.1? -void LLAppearanceMgr::addEnsembleLink( LLInventoryCategory* cat, bool do_update ) -{ -#if SUPPORT_ENSEMBLES - // BAP add check for already in COF. - LLPointer cb = do_update ? new ModifiedCOFCallback : 0; - link_inventory_item( gAgent.getID(), - cat->getLinkedUUID(), - getCOF(), - cat->getName(), - cat->getDescription(), - LLAssetType::AT_LINK_FOLDER, - cb); -#endif -} - void LLAppearanceMgr::removeAllClothesFromAvatar() { // Fetch worn clothes (i.e. the ones in COF). @@ -2668,7 +2637,7 @@ void LLAppearanceMgr::copyLibraryGestures() folder_name == COMMON_GESTURES_FOLDER || folder_name == OTHER_GESTURES_FOLDER) { - cb = new ActivateGestureCallback; + cb = new LLBoostFuncInventoryCallback(activate_gesture_cb); } LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name); @@ -2722,6 +2691,16 @@ void LLAppearanceMgr::onFirstFullyVisible() } } +// update "dirty" state - defined outside class to allow for calling +// after appearance mgr instance has been destroyed. +void appearance_mgr_update_dirty_state() +{ + if (LLAppearanceMgr::instanceExists()) + { + LLAppearanceMgr::getInstance()->updateIsDirty(); + } +} + bool LLAppearanceMgr::updateBaseOutfit() { if (isOutfitLocked()) @@ -2742,8 +2721,8 @@ bool LLAppearanceMgr::updateBaseOutfit() // in a Base Outfit we do not remove items, only links purgeCategory(base_outfit_id, false); - - LLPointer dirty_state_updater = new LLUpdateDirtyState(); + LLPointer dirty_state_updater = + new LLBoostFuncInventoryCallback(no_op_inventory_func, appearance_mgr_update_dirty_state); //COF contains only links so we copy to the Base Outfit only links shallowCopyCategoryContents(getCOF(), base_outfit_id, dirty_state_updater); @@ -2998,48 +2977,34 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond mLastUpdateRequestCOFVersion = cof_version; } -class LLShowCreatedOutfit: public LLInventoryCallback +void show_created_outfit(LLUUID& folder_id, bool show_panel = true) { -public: - LLShowCreatedOutfit(LLUUID& folder_id, bool show_panel = true): mFolderID(folder_id), mShowPanel(show_panel) - {} - - virtual ~LLShowCreatedOutfit() + if (!LLApp::isRunning()) { - if (!LLApp::isRunning()) - { - llwarns << "called during shutdown, skipping" << llendl; - return; - } - - LLSD key; + llwarns << "called during shutdown, skipping" << llendl; + return; + } + + LLSD key; + + //EXT-7727. For new accounts inventory callback is created during login process + // and may be processed after login process is finished + if (show_panel) + { + LLFloaterSidePanelContainer::showPanel("appearance", "panel_outfits_inventory", key); - //EXT-7727. For new accounts LLShowCreatedOutfit is created during login process - // add may be processed after login process is finished - if (mShowPanel) - { - LLFloaterSidePanelContainer::showPanel("appearance", "panel_outfits_inventory", key); - - } - LLOutfitsList *outfits_list = - dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab")); - if (outfits_list) - { - outfits_list->setSelectedOutfitByUUID(mFolderID); - } - - LLAppearanceMgr::getInstance()->updateIsDirty(); - gAgentWearables.notifyLoadingFinished(); // New outfit is saved. - LLAppearanceMgr::getInstance()->updatePanelOutfitName(""); } - - virtual void fire(const LLUUID&) - {} - -private: - LLUUID mFolderID; - bool mShowPanel; -}; + LLOutfitsList *outfits_list = + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab")); + if (outfits_list) + { + outfits_list->setSelectedOutfitByUUID(folder_id); + } + + LLAppearanceMgr::getInstance()->updateIsDirty(); + gAgentWearables.notifyLoadingFinished(); // New outfit is saved. + LLAppearanceMgr::getInstance()->updatePanelOutfitName(""); +} LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel) { @@ -3056,7 +3021,8 @@ LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, b updateClothingOrderingInfo(); - LLPointer cb = new LLShowCreatedOutfit(folder_id,show_panel); + LLPointer cb = new LLBoostFuncInventoryCallback(no_op_inventory_func, + boost::bind(show_created_outfit,folder_id,show_panel)); shallowCopyCategoryContents(getCOF(),folder_id, cb); createBaseOutfitLink(folder_id, cb); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 01ed66711c..ba5406caa1 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -137,9 +137,6 @@ public: void removeAllClothesFromAvatar(); void removeAllAttachmentsFromAvatar(); - // Add COF link to ensemble folder. - void addEnsembleLink(LLInventoryCategory* item, bool do_update = true); - //has the current outfit changed since it was loaded? bool isOutfitDirty() { return mOutfitIsDirty; } diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 4cbc9cab4a..686401c43f 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -302,35 +302,26 @@ protected: }; /** - * This class is needed to update an item being copied to the favorites folder + * This callback is needed to update an item being copied to the favorites folder * with a sort field value (required to save favorites bar's tabs order). * See method handleNewFavoriteDragAndDrop for more details on how this class is used. */ -class LLItemCopiedCallback : public LLInventoryCallback +void item_copied_cb(const LLUUID& inv_item, S32 sort_field) { -public: - LLItemCopiedCallback(S32 sortField): mSortField(sortField) {} - - virtual void fire(const LLUUID& inv_item) + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + + if (item) { - LLViewerInventoryItem* item = gInventory.getItem(inv_item); - - if (item) - { - item->setSortField(mSortField); - item->setComplete(TRUE); - item->updateServer(FALSE); - - gInventory.updateItem(item); - gInventory.notifyObservers(); - } - - LLView::getWindow()->setCursor(UI_CURSOR_ARROW); + item->setSortField(sort_field); + item->setComplete(TRUE); + item->updateServer(FALSE); + + gInventory.updateItem(item); + gInventory.notifyObservers(); } - -private: - S32 mSortField; -}; + + LLView::getWindow()->setCursor(UI_CURSOR_ARROW); +} // updateButtons's helper struct LLFavoritesSort @@ -574,7 +565,7 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con } int sortField = 0; - LLPointer cb; + LLPointer cb; // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field for (LLInventoryModel::item_array_t::iterator i = mItems.begin(); i != mItems.end(); ++i) @@ -583,7 +574,7 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con if (currItem->getUUID() == item->getUUID()) { - cb = new LLItemCopiedCallback(++sortField); + cb = new LLBoostFuncInventoryCallback(boost::bind(item_copied_cb, _1, ++sortField)); } else { diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 56051ff684..4054eba1aa 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -65,40 +65,27 @@ private: LLFloaterGesture* mFloater; }; //----------------------------- -// GestureCallback +// gesture callback funcs //----------------------------- -class GestureShowCallback : public LLInventoryCallback +void gesture_show_cb(const LLUUID &inv_item) { -public: - void fire(const LLUUID &inv_item) - { - LLPreviewGesture::show(inv_item, LLUUID::null); - } -}; + LLPreviewGesture::show(inv_item, LLUUID::null); +} -class GestureCopiedCallback : public LLInventoryCallback +void gesture_copied_cb(const LLUUID &inv_item, LLFloaterGesture* floater) { -private: - LLFloaterGesture* mFloater; - -public: - GestureCopiedCallback(LLFloaterGesture* floater): mFloater(floater) - {} - void fire(const LLUUID &inv_item) + if(floater) { - if(mFloater) - { - mFloater->addGesture(inv_item,NULL,mFloater->getChild("gesture_list")); - - // EXP-1909 (Pasted gesture displayed twice) - // The problem is that addGesture is called here for the second time for the same item (which is copied) - // First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory - // change. So we need to refresh the gesture list to avoid duplicates. - mFloater->refreshAll(); - } + floater->addGesture(inv_item,NULL,floater->getChild("gesture_list")); + + // EXP-1909 (Pasted gesture displayed twice) + // The problem is that addGesture is called here for the second time for the same item (which is copied) + // First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory + // change. So we need to refresh the gesture list to avoid duplicates. + floater->refreshAll(); } -}; +} //--------------------------------------------------------------------------- // LLFloaterGesture @@ -448,7 +435,7 @@ void LLFloaterGesture::onClickPlay() void LLFloaterGesture::onClickNew() { - LLPointer cb = new GestureShowCallback(); + LLPointer cb = new LLBoostFuncInventoryCallback(gesture_show_cb); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), LLUUID::null, LLTransactionID::tnull, "New Gesture", "", LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); @@ -520,7 +507,7 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command) return; LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID); llassert(gesture_dir); - LLPointer cb = new GestureCopiedCallback(this); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(gesture_copied_cb, _1, this)); for(LLDynamicArray::iterator it = ids.begin(); it != ids.end(); it++) { diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 11401d6c68..609a16fde0 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -521,7 +521,7 @@ public: void fire(const LLUUID& inv_item_id) { LLViewerInventoryItem* item = gInventory.getItem(inv_item_id); - + if (item) LLFriendCardsManager::instance().extractAvatarID(item->getCreatorUUID()); } @@ -557,7 +557,7 @@ void LLFriendCardsManager::addFriendCardToInventory(const LLUUID& avatarID) lldebugs << "Sent create_inventory_item for " << avatarID << ", " << name << llendl; // TODO: mantipov: Is CreateFriendCardCallback really needed? Probably not - LLPointer cb = new CreateFriendCardCallback(); + LLPointer cb = new CreateFriendCardCallback; create_inventory_callingcard(avatarID, findFriendAllSubfolderUUIDImpl(), cb); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1e9e370395..c9a86fa084 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -5091,7 +5091,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. - LLPointer cb = new RezAttachmentCallback(0); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0)); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 3181e19cae..3d5ea4c2fe 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1709,7 +1709,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( { if(mSource == SOURCE_LIBRARY) { - LLPointer cb = new RezAttachmentCallback(0); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0)); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), @@ -2062,7 +2062,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( { // create item based on that one, and put it on if that // was a success. - LLPointer cb = new ActivateGestureCallback(); + LLPointer cb = new LLBoostFuncInventoryCallback(activate_gesture_cb); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), diff --git a/indra/newview/llviewerattachmenu.cpp b/indra/newview/llviewerattachmenu.cpp index db7dc3fea6..3975292ed3 100644 --- a/indra/newview/llviewerattachmenu.cpp +++ b/indra/newview/llviewerattachmenu.cpp @@ -121,7 +121,7 @@ void LLViewerAttachMenu::attachObjects(const uuid_vec_t& items, const std::strin else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. - LLPointer cb = new RezAttachmentCallback(attachmentp); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, attachmentp)); copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b47a41c44c..d6f0874a58 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -65,6 +65,10 @@ #include "llavataractions.h" #include "lllogininstance.h" +// Two do-nothing ops for use in callbacks. +void no_op_inventory_func(const LLUUID&) {} +void no_op() {} + ///---------------------------------------------------------------------------- /// Helper class to store special inventory item names and their localized values. ///---------------------------------------------------------------------------- @@ -949,46 +953,7 @@ void LLInventoryCallbackManager::fire(U32 callback_id, const LLUUID& item_id) } } -void WearOnAvatarCallback::fire(const LLUUID& inv_item) -{ - if (inv_item.isNull()) - return; - - LLViewerInventoryItem *item = gInventory.getItem(inv_item); - if (item) - { - LLAppearanceMgr::instance().wearItemOnAvatar(inv_item, true, mReplace); - } -} - -void ModifiedCOFCallback::fire(const LLUUID& inv_item) -{ - LLAppearanceMgr::instance().updateAppearanceFromCOF(); - - // Start editing the item if previously requested. - gAgentWearables.editWearableIfRequested(inv_item); - - // TODO: camera mode may not be changed if a debug setting is tweaked - if( gAgentCamera.cameraCustomizeAvatar() ) - { - // If we're in appearance editing mode, the current tab may need to be refreshed - LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); - if (panel) - { - panel->showDefaultSubpart(); - } - } -} - -RezAttachmentCallback::RezAttachmentCallback(LLViewerJointAttachment *attachmentp) -{ - mAttach = attachmentp; -} -RezAttachmentCallback::~RezAttachmentCallback() -{ -} - -void RezAttachmentCallback::fire(const LLUUID& inv_item) +void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp) { if (inv_item.isNull()) return; @@ -996,11 +961,11 @@ void RezAttachmentCallback::fire(const LLUUID& inv_item) LLViewerInventoryItem *item = gInventory.getItem(inv_item); if (item) { - rez_attachment(item, mAttach); + rez_attachment(item, attachmentp); } } -void ActivateGestureCallback::fire(const LLUUID& inv_item) +void activate_gesture_cb(const LLUUID& inv_item) { if (inv_item.isNull()) return; @@ -1013,7 +978,7 @@ void ActivateGestureCallback::fire(const LLUUID& inv_item) LLGestureMgr::instance().activateGesture(inv_item); } -void CreateGestureCallback::fire(const LLUUID& inv_item) +void create_gesture_cb(const LLUUID& inv_item) { if (inv_item.isNull()) return; @@ -1288,7 +1253,7 @@ void create_new_item(const std::string& name, if (inv_type == LLInventoryType::IT_GESTURE) { - LLPointer cb = new CreateGestureCallback(); + LLPointer cb = new LLBoostFuncInventoryCallback(create_gesture_cb); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, NOT_WEARABLE, next_owner_perm, cb); diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index e2793ba105..1a427605b6 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -242,48 +242,13 @@ public: virtual void fire(const LLUUID& inv_item) = 0; }; -class WearOnAvatarCallback : public LLInventoryCallback -{ -public: - WearOnAvatarCallback(bool do_replace = false) : mReplace(do_replace) {} - - void fire(const LLUUID& inv_item); - -protected: - bool mReplace; -}; - -class ModifiedCOFCallback : public LLInventoryCallback -{ - void fire(const LLUUID& inv_item); -}; - class LLViewerJointAttachment; -class RezAttachmentCallback : public LLInventoryCallback -{ -public: - RezAttachmentCallback(LLViewerJointAttachment *attachmentp); - void fire(const LLUUID& inv_item); +void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp); -protected: - ~RezAttachmentCallback(); +void activate_gesture_cb(const LLUUID& inv_item); -private: - LLViewerJointAttachment* mAttach; -}; - -class ActivateGestureCallback : public LLInventoryCallback -{ -public: - void fire(const LLUUID& inv_item); -}; - -class CreateGestureCallback : public LLInventoryCallback -{ -public: - void fire(const LLUUID& inv_item); -}; +void create_gesture_cb(const LLUUID& inv_item); class AddFavoriteLandmarkCallback : public LLInventoryCallback { @@ -297,25 +262,40 @@ private: LLUUID mTargetLandmarkId; }; -// Shim between inventory callback and boost function/callable typedef boost::function inventory_func_type; +void no_op_inventory_func(const LLUUID&); // A do-nothing inventory_func +typedef boost::function nullary_func_type; +void no_op(); // A do-nothing nullary func. + +// Shim between inventory callback and boost function/callable class LLBoostFuncInventoryCallback: public LLInventoryCallback { public: - LLBoostFuncInventoryCallback(const inventory_func_type& func): - mFunc(func) + LLBoostFuncInventoryCallback(inventory_func_type fire_func, + nullary_func_type destroy_func = no_op): + mFireFunc(fire_func), + mDestroyFunc(destroy_func) { } + // virtual void fire(const LLUUID& item_id) { - mFunc(item_id); + mFireFunc(item_id); } + // virtual + ~LLBoostFuncInventoryCallback() + { + mDestroyFunc; + } + + private: - inventory_func_type mFunc; + inventory_func_type mFireFunc; + nullary_func_type mDestroyFunc; }; // misc functions -- cgit v1.2.3 From 6a5e227dc11f19dd7901226a454cebcd16ca7f2d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Dec 2012 14:55:09 -0500 Subject: removed inadvertent commit of logcontrol.xml --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 1259039010..64122bbb6c 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - Avatar -- cgit v1.2.3 From 798377b076fbce895ba2075417107de0da10b9ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Dec 2012 15:32:42 -0500 Subject: SH-3606 WIP - fixed bug found by persnickety compiler --- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/llviewerinventory.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 1a427605b6..13e95c57cb 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -289,7 +289,7 @@ public: // virtual ~LLBoostFuncInventoryCallback() { - mDestroyFunc; + mDestroyFunc(); } -- cgit v1.2.3 From 8657da24cd206af87cb32d095b347f7aa07596b5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 11 Dec 2012 18:21:09 -0500 Subject: SH-3604 WIP - added base outfit link creation to retryable copy/link operations. Resolves race condition with cof version and server texture bakes --- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/llappearancemgr.cpp | 72 +++++++++++++++++++++---------- indra/newview/llappearancemgr.h | 2 +- indra/newview/llvoavatar.cpp | 4 ++ 4 files changed, 56 insertions(+), 24 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 1259039010..64122bbb6c 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - Avatar diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d34d54fb3b..e326ca5e15 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -191,19 +191,13 @@ public: { LLViewerInventoryItem* item = *it; llassert(item); - addItem(item); + addItem(item->getUUID()); } } // Request or re-request operation for specified item. - void addItem(LLViewerInventoryItem *item) + void addItem(const LLUUID& item_id) { - const LLUUID& item_id = item->getUUID(); - if (!item) - { - llwarns << "item not found for " << item_id << llendl; - return; - } mPendingRequests++; // On a re-request, this will reset the timer. mWaitTimes[item_id] = LLTimer(); @@ -222,10 +216,10 @@ public: return; } - requestOperation(item); + requestOperation(item_id); } - virtual void requestOperation(LLViewerInventoryItem *item) = 0; + virtual void requestOperation(const LLUUID& item_id) = 0; void onOp(const LLUUID& src_id, const LLUUID& dst_id, LLTimer timestamp) { @@ -314,7 +308,7 @@ public: LL_DEBUGS("Avatar") << "Waited " << time_waited << " for " << curr_it->first << ", retrying" << llendl; mRetryCount++; - addItem(gInventory.getItem(curr_it->first)); + addItem(curr_it->first); } else { @@ -379,8 +373,10 @@ public: addItems(src_items); } - virtual void requestOperation(LLViewerInventoryItem *item) + virtual void requestOperation(const LLUUID& item_id) { + LLViewerInventoryItem *item = gInventory.getItem(item_id); + llassert(item); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), @@ -408,16 +404,46 @@ public: addItems(src_items); } - virtual void requestOperation(LLViewerInventoryItem *item) + virtual void requestOperation(const LLUUID& item_id) { - link_inventory_item(gAgent.getID(), - item->getLinkedUUID(), - mDstCatID, - item->getName(), - item->LLInventoryItem::getDescription(), - LLAssetType::AT_LINK, - new LLBoostFuncInventoryCallback( - boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1,LLTimer()))); + LLViewerInventoryItem *item = gInventory.getItem(item_id); + if (item) + { + // create an inventory item link. + link_inventory_item(gAgent.getID(), + item->getLinkedUUID(), + mDstCatID, + item->getName(), + item->LLInventoryItem::getDescription(), + LLAssetType::AT_LINK, + new LLBoostFuncInventoryCallback( + boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1,LLTimer()))); + } + else + { + // create a base outfit link if appropriate. + LLViewerInventoryCategory *catp = gInventory.getCategory(item_id); + if (!catp) + { + llwarns << "id not found as inventory item or category " << item_id << llendl; + return; + } + const LLUUID cof = LLAppearanceMgr::instance().getCOF(); + std::string new_outfit_name = ""; + + LLAppearanceMgr::instance().purgeBaseOutfitLink(cof); + + if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) + { + link_inventory_item(gAgent.getID(), item_id, cof, catp->getName(), "", + LLAssetType::AT_LINK_FOLDER, + new LLBoostFuncInventoryCallback( + boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); + new_outfit_name = catp->getName(); + } + + LLAppearanceMgr::instance().updatePanelOutfitName(new_outfit_name); + } } }; @@ -1742,7 +1768,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) // Add link to outfit if category is an outfit. if (!append) { - createBaseOutfitLink(category, NULL); + link_waiter->addItem(category); } LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL; } @@ -2967,6 +2993,8 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond LLSD body; S32 cof_version = getCOFVersion(); body["cof_version"] = cof_version; + LL_DEBUGS("Avatar") << "my_cof_version " << cof_version << llendl; + //LLCurl::ResponderPtr responder_ptr; if (!responder_ptr.get()) { diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index ba5406caa1..cb271cda4d 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -109,6 +109,7 @@ public: // Update the displayed outfit name in UI. void updatePanelOutfitName(const std::string& name); + void purgeBaseOutfitLink(const LLUUID& category); void createBaseOutfitLink(const LLUUID& category, LLPointer link_waiter); void updateAgentWearables(LLWearableHoldingPattern* holder, bool append); @@ -206,7 +207,6 @@ private: bool follow_folder_links); void purgeCategory(const LLUUID& category, bool keep_outfit_links); - void purgeBaseOutfitLink(const LLUUID& category); static void onOutfitRename(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 18d3ea7a47..117f28cc36 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6462,6 +6462,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) { + LL_DEBUGS("Avatar") << "this_update_cof_version " << this_update_cof_version + << " last_update_request_cof_version " << last_update_request_cof_version + << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; + if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; -- cgit v1.2.3 From 531394df23d774ad91ea5986ede8d44ccf9234a1 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Wed, 12 Dec 2012 00:34:40 +0000 Subject: Updating linux libGLOD to match darwin naming --- indra/newview/viewer_manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index ea75d4f4f6..7a41520429 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1079,7 +1079,7 @@ class Linux_i686Manifest(LinuxManifest): self.path("libcrypto.so.*") self.path("libexpat.so.*") self.path("libssl.so.1.0.0") - self.path("libglod.so") + self.path("libGLOD.so") self.path("libminizip.so") self.path("libuuid.so*") self.path("libSDL-1.2.so.*") -- cgit v1.2.3 From 0b896a4953779c2f27c3418453e1a1a315ec111f Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 12 Dec 2012 10:32:42 -0500 Subject: Fixes for SH-3591 & SH-3620 --- indra/newview/llpaneleditwearable.cpp | 10 ++++++++-- indra/newview/llpaneleditwearable.h | 1 + indra/newview/llsidepanelappearance.cpp | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 43344fd60e..87f9e3da59 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -718,8 +718,8 @@ BOOL LLPanelEditWearable::postBuild() mBtnBack = getChild("back_btn"); mBackBtnLabel = mBtnBack->getLabelUnselected(); mBtnBack->setLabel(LLStringUtil::null); - // handled at appearance panel level? - //mBtnBack->setClickedCallback(boost::bind(&LLPanelEditWearable::onBackButtonClicked, this)); + + mBtnBack->setClickedCallback(boost::bind(&LLPanelEditWearable::onBackButtonClicked, this)); mNameEditor = getChild("description"); @@ -872,6 +872,12 @@ void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_c showWearable(mWearablePtr, TRUE, disable_camera_switch); } +//static +void LLPanelEditWearable::onBackButtonClicked(void* userdata) +{ + LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata; + panel->saveChanges(true); +} //static void LLPanelEditWearable::onRevertButtonClicked(void* userdata) diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 309d512e23..515a9913b9 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -70,6 +70,7 @@ public: void updateScrollingPanelList(); static void onRevertButtonClicked(void* userdata); + static void onBackButtonClicked(void* userdata); void onCommitSexChange(); void onSaveAsButtonClicked(); void saveAsCallback(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 8c4a05b116..1fc10c2326 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -232,6 +232,11 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) gAgentCamera.changeCameraToDefault(); gAgentCamera.resetView(); } + + if ( mEditWearable->getVisible() ) + { + mEditWearable->revertChanges(); + } } } -- cgit v1.2.3 From 46cfca5ed6590435d5f1956376479a8876770376 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 12 Dec 2012 12:06:24 -0500 Subject: Fix for problem found with changing to an outfit with missing shape --- indra/newview/llappearancemgr.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e326ca5e15..b0136a570e 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -191,7 +191,7 @@ public: { LLViewerInventoryItem* item = *it; llassert(item); - addItem(item->getUUID()); + addItem(item->getLinkedUUID()); } } @@ -1732,11 +1732,6 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) getDescendentsOfAssetType(category, gest_items, LLAssetType::AT_GESTURE, false); removeDuplicateItems(gest_items); - // Remove current COF contents. - bool keep_outfit_links = append; - purgeCategory(cof, keep_outfit_links); - gInventory.notifyObservers(); - #ifndef LL_RELEASE_FOR_DOWNLOAD LL_DEBUGS("Avatar") << self_av_string() << "Linking body items" << LL_ENDL; #endif @@ -1770,6 +1765,15 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) { link_waiter->addItem(category); } + + // Remove current COF contents. Have to do this after creating + // the link_waiter so links can be followed for any items that get + // carried over (e.g. keeping old shape if the new outfit does not + // contain one) + bool keep_outfit_links = append; + purgeCategory(cof, keep_outfit_links); + gInventory.notifyObservers(); + LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL; } -- cgit v1.2.3 From 507080795f1ee21e7ffc2bee842edc5236f8e38f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 12 Dec 2012 15:32:31 -0500 Subject: SH-3604 WIP - fixed a failure when base outfit link did not need to be created --- indra/newview/llappearancemgr.cpp | 61 +++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index b0136a570e..f957aadec5 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -191,35 +191,56 @@ public: { LLViewerInventoryItem* item = *it; llassert(item); - addItem(item->getLinkedUUID()); + addItem(item->getUUID()); } } // Request or re-request operation for specified item. void addItem(const LLUUID& item_id) { - mPendingRequests++; - // On a re-request, this will reset the timer. - mWaitTimes[item_id] = LLTimer(); - if (mRetryCounts.find(item_id) == mRetryCounts.end()) + LLUUID linked_id; + if (gInventory.getItem(item_id)) + { + linked_id = gInventory.getItem(item_id)->getLinkedUUID(); + } + else if (gInventory.getCategory(item_id)) { - mRetryCounts[item_id] = 0; + linked_id = item_id; } else { - mRetryCounts[item_id]++; + llwarns << "no referent found for item_id " << item_id << llendl; + return; } - + LL_DEBUGS("Avatar") << "item_id " << item_id << " -> linked_id " << linked_id << llendl; + if (ll_frand()getPermissions().getOwner(), item->getUUID(), mDstCatID, std::string(), - new LLBoostFuncInventoryCallback(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1,LLTimer())) + new LLBoostFuncInventoryCallback(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer())) ); + return true; } }; @@ -404,20 +427,23 @@ public: addItems(src_items); } - virtual void requestOperation(const LLUUID& item_id) + virtual bool requestOperation(const LLUUID& item_id) { + bool request_sent = false; LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item) { + LL_DEBUGS("Avatar") << "linking item " << item_id << " name " << item->getName() << " to " << mDstCatID << llendl; // create an inventory item link. link_inventory_item(gAgent.getID(), - item->getLinkedUUID(), + item_id, mDstCatID, item->getName(), item->LLInventoryItem::getDescription(), LLAssetType::AT_LINK, new LLBoostFuncInventoryCallback( - boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item->getUUID(),_1,LLTimer()))); + boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); + request_sent = true; } else { @@ -426,7 +452,7 @@ public: if (!catp) { llwarns << "id not found as inventory item or category " << item_id << llendl; - return; + return false; } const LLUUID cof = LLAppearanceMgr::instance().getCOF(); std::string new_outfit_name = ""; @@ -435,15 +461,18 @@ public: if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) { + LL_DEBUGS("Avatar") << "linking folder " << item_id << " name " << catp->getName() << " to cof " << cof << llendl; link_inventory_item(gAgent.getID(), item_id, cof, catp->getName(), "", LLAssetType::AT_LINK_FOLDER, new LLBoostFuncInventoryCallback( boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); new_outfit_name = catp->getName(); + request_sent = true; } LLAppearanceMgr::instance().updatePanelOutfitName(new_outfit_name); } + return request_sent; } }; -- cgit v1.2.3 From 18ff702a9965ba8b9a17326b391f8edab01242f6 Mon Sep 17 00:00:00 2001 From: "prep@lindenlab.com" Date: Thu, 13 Dec 2012 16:53:38 -0600 Subject: Fix for SH-3591. --- indra/newview/llfloatersidepanelcontainer.cpp | 12 +- indra/newview/llpaneleditwearable.cpp | 8 + indra/newview/llpaneleditwearable.h | 1 + indra/newview/llsidepanelappearance.cpp | 1093 ++++++++++++------------- indra/newview/llsidepanelappearance.h | 3 +- 5 files changed, 566 insertions(+), 551 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 3c966a073f..02150819a0 100755 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -28,6 +28,7 @@ #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" +#include "llpaneleditwearable.h" // newview includes #include "llsidetraypanelcontainer.h" @@ -72,7 +73,16 @@ void LLFloaterSidePanelContainer::onClickCloseBtn() panel_appearance->showOutfitsInventoryPanel(); } } - + + if ( panel_outfit_edit ) + { + LLSidepanelAppearance* panel_appearance = dynamic_cast(getPanel("appearance")); + if ( panel_appearance ) + { + panel_appearance->getWearable()->onClose(); + panel_appearance->showOutfitsInventoryPanel(); + } + } LLFloater::onClickCloseBtn(); } diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 87f9e3da59..786b215fdf 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -856,6 +856,14 @@ void LLPanelEditWearable::draw() LLPanel::draw(); } +void LLPanelEditWearable::onClose() +{ + if ( isDirty() ) + { + revertChanges(); + } +} + void LLPanelEditWearable::setVisible(BOOL visible) { if (!visible) diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 515a9913b9..ac4344de2e 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -54,6 +54,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ BOOL isDirty() const; // LLUICtrl /*virtual*/ void draw(); + void onClose(); // changes camera angle to default for selected subpart void changeCamera(U8 subpart); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 1fc10c2326..98dc2c0e09 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -1,549 +1,544 @@ -/** - * @file llsidepanelappearance.cpp - * @brief Side Bar "Appearance" panel - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llsidepanelappearance.h" - -#include "llaccordionctrltab.h" -#include "llagent.h" -#include "llagentcamera.h" -#include "llagentwearables.h" -#include "llappearancemgr.h" -#include "llfloatersidepanelcontainer.h" -#include "llfolderview.h" -#include "llinventorypanel.h" -#include "llfiltereditor.h" -#include "llfloaterreg.h" -#include "llfloaterworldmap.h" -#include "llfoldervieweventlistener.h" -#include "lloutfitobserver.h" -#include "llpaneleditwearable.h" -#include "llpaneloutfitsinventory.h" -#include "lltextbox.h" -#include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llviewerregion.h" -#include "llvoavatarself.h" -#include "llviewerwearable.h" - -static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); - -class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver -{ -public: - LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, - LLSidepanelAppearance *panel) : - LLInventoryFetchItemsObserver(ids), - mPanel(panel) - {} - ~LLCurrentlyWornFetchObserver() {} - virtual void done() - { - mPanel->inventoryFetched(); - gInventory.removeObserver(this); - delete this; - } -private: - LLSidepanelAppearance *mPanel; -}; - -LLSidepanelAppearance::LLSidepanelAppearance() : - LLPanel(), - mFilterSubString(LLStringUtil::null), - mFilterEditor(NULL), - mOutfitEdit(NULL), - mCurrOutfitPanel(NULL), - mOpened(false) -{ - LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); - outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - - gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); - gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); -} - -LLSidepanelAppearance::~LLSidepanelAppearance() -{ -} - -// virtual -BOOL LLSidepanelAppearance::postBuild() -{ - mOpenOutfitBtn = getChild("openoutfit_btn"); - mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); - - mEditAppearanceBtn = getChild("editappearance_btn"); - mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); - - childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - - mNewOutfitBtn = getChild("newlook_btn"); - mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); - mNewOutfitBtn->setEnabled(false); - - mFilterEditor = getChild("Filter"); - if (mFilterEditor) - { - mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); - } - - mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); - - mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); - if (mOutfitEdit) - { - LLButton* back_btn = mOutfitEdit->getChild("back_btn"); - if (back_btn) - { - back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); - } - - } - - mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); - if (mEditWearable) - { - LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); - if (edit_wearable_back_btn) - { - edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - } - } - - mCurrentLookName = getChild("currentlook_name"); - - mOutfitStatus = getChild("currentlook_status"); - - mCurrOutfitPanel = getChild("panel_currentlook"); - - - setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); - - return TRUE; -} - -// virtual -void LLSidepanelAppearance::onOpen(const LLSD& key) -{ - if (!key.has("type")) - { - // No specific panel requested. - // If we're opened for the first time then show My Outfits. - // Else do nothing. - if (!mOpened) - { - showOutfitsInventoryPanel(); - } - } - else - { - // Switch to the requested panel. - std::string type = key["type"].asString(); - if (type == "my_outfits") - { - showOutfitsInventoryPanel(); - } - else if (type == "edit_outfit") - { - showOutfitEditPanel(); - } - else if (type == "edit_shape") - { - showWearableEditPanel(); - } - } - - mOpened = true; -} - -void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) -{ - LLSD visibility; - visibility["visible"] = new_visibility.asBoolean(); - visibility["reset_accordion"] = false; - updateToVisibility(visibility); -} - -void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) -{ - if (new_visibility["visible"].asBoolean()) - { - const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); - const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); - - if (is_outfit_edit_visible || is_wearable_edit_visible) - { - const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); - if (!wearable_ptr) - { - llwarns << "Visibility change to invalid wearable" << llendl; - return; - } - // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar - // when editing its physics. - if (!gAgentCamera.cameraCustomizeAvatar()) - { - LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); - } - if (is_wearable_edit_visible) - { - if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) - { - // we're no longer wearing the wearable we were last editing, switch back to outfit editor - showOutfitEditPanel(); - } - } - - if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) - { - mOutfitEdit->resetAccordionState(); - } - } - } - else - { - if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) - { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); - } - - if ( mEditWearable->getVisible() ) - { - mEditWearable->revertChanges(); - } - } -} - -void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) -{ - if (mFilterSubString != search_string) - { - mFilterSubString = search_string; - - // Searches are case-insensitive - // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. - - mPanelOutfitsInventory->onSearchEdit(mFilterSubString); - } -} - -void LLSidepanelAppearance::onOpenOutfitButtonClicked() -{ - const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); - if (!outfit_link) - return; - if (!outfit_link->getIsLinkType()) - return; - - LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); - if (tab_outfits) - { - tab_outfits->changeOpenClose(FALSE); - LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); - if (inventory_panel) - { - LLFolderView* root = inventory_panel->getRootFolder(); - LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); - if (outfit_folder) - { - outfit_folder->setOpen(!outfit_folder->isOpen()); - root->setSelectionFromRoot(outfit_folder,TRUE); - root->scrollToShowSelection(); - } - } - } -} - -// *TODO: obsolete? -void LLSidepanelAppearance::onEditAppearanceButtonClicked() -{ - if (gAgentWearables.areWearablesLoaded()) - { - LLVOAvatarSelf::onCustomizeStart(); - } -} - -void LLSidepanelAppearance::onNewOutfitButtonClicked() -{ - if (!mOutfitEdit->getVisible()) - { - mPanelOutfitsInventory->onSave(); - } -} - -void LLSidepanelAppearance::showOutfitsInventoryPanel() -{ - toggleWearableEditPanel(FALSE); - toggleOutfitEditPanel(FALSE); - toggleMyOutfitsPanel(TRUE); -} - -void LLSidepanelAppearance::showOutfitEditPanel() -{ - if (mOutfitEdit && mOutfitEdit->getVisible()) return; - - // Accordion's state must be reset in all cases except the one when user - // is returning back to the mOutfitEdit panel from the mEditWearable panel. - // The simplest way to control this is to check the visibility state of the mEditWearable - // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). - if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) - { - mOutfitEdit->resetAccordionState(); - } - - // If we're exiting the edit wearable view, and the camera was not focused on the avatar - // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since - // otherwise this would trigger the camera focus mode. - if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) - { - showOutfitsInventoryPanel(); - return; - } - - toggleMyOutfitsPanel(FALSE); - toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode - toggleOutfitEditPanel(TRUE); -} - -void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) -{ - toggleMyOutfitsPanel(FALSE); - toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode - toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); -} - -void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) -{ - if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mPanelOutfitsInventory->setVisible(visible); - - // *TODO: Move these controls to panel_outfits_inventory.xml - // so that we don't need to toggle them explicitly. - mFilterEditor->setVisible(visible); - mNewOutfitBtn->setVisible(visible); - mCurrOutfitPanel->setVisible(visible); - - if (visible) - { - mPanelOutfitsInventory->onOpen(LLSD()); - } -} - -void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) -{ - if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mOutfitEdit->setVisible(visible); - - if (visible) - { - mOutfitEdit->onOpen(LLSD()); - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - } - else - { - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) -{ - if (!mEditWearable || mEditWearable->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - if (!wearable) - { - wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); - } - if (!wearable) - { - return; - } - - // Toggle panel visibility. - mEditWearable->setVisible(visible); - - if (visible) - { - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - mEditWearable->setWearable(wearable, disable_camera_switch); - mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency - } - else - { - // Save changes if closing. - mEditWearable->saveChanges(); - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) -{ - // Set current outfit status (wearing/unsaved). - bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); - std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); - mOutfitStatus->setText(cof_status_str); - - if (name == "") - { - std::string outfit_name; - if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) - { - mCurrentLookName->setText(outfit_name); - return; - } - - std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; - mCurrentLookName->setText(getString(string_name)); - mOpenOutfitBtn->setEnabled(FALSE); - } - else - { - mCurrentLookName->setText(name); - // Can't just call update verbs since the folder link may not have been created yet. - mOpenOutfitBtn->setEnabled(TRUE); - } -} - -//static -void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) -{ - LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); - - LLSidepanelAppearance *panel = dynamic_cast(data); - if (panel) - { - panel->showWearableEditPanel(wearable, disable_camera_switch); - } -} - -// Fetch currently worn items and only enable the New Look button after everything's been -// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. -void LLSidepanelAppearance::fetchInventory() -{ - - mNewOutfitBtn->setEnabled(false); - uuid_vec_t ids; - LLUUID item_id; - for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) - { - for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) - { - item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); - if(item_id.notNull()) - { - ids.push_back(item_id); - } - } - } - - if (isAgentAvatarValid()) - { - for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); - iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) - { - LLViewerJointAttachment* attachment = iter->second; - if (!attachment) continue; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject* attached_object = (*attachment_iter); - if (!attached_object) continue; - const LLUUID& item_id = attached_object->getAttachmentItemID(); - if (item_id.isNull()) continue; - ids.push_back(item_id); - } - } - } - - LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); - fetch_worn->startFetch(); - // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. - if (fetch_worn->isFinished()) - { - fetch_worn->done(); - } - else - { - gInventory.addObserver(fetch_worn); - } -} - -void LLSidepanelAppearance::inventoryFetched() -{ - mNewOutfitBtn->setEnabled(true); -} - -void LLSidepanelAppearance::setWearablesLoading(bool val) -{ - getChildView("wearables_loading_indicator")->setVisible( val); - getChildView("edit_outfit_btn")->setVisible( !val); - - if (!val) - { - // refresh outfit name when COF is already changed. - refreshCurrentOutfitName(); - } -} - -void LLSidepanelAppearance::showDefaultSubpart() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->showDefaultSubpart(); - } -} - -void LLSidepanelAppearance::updateScrollingPanelList() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->updateScrollingPanelList(); - } -} +/** + * @file llsidepanelappearance.cpp + * @brief Side Bar "Appearance" panel + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsidepanelappearance.h" + +#include "llaccordionctrltab.h" +#include "llagent.h" +#include "llagentcamera.h" +#include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" +#include "llfolderview.h" +#include "llinventorypanel.h" +#include "llfiltereditor.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" +#include "llfoldervieweventlistener.h" +#include "lloutfitobserver.h" +#include "llpaneleditwearable.h" +#include "llpaneloutfitsinventory.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" +#include "llviewerwearable.h" + +static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); + +class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver +{ +public: + LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, + LLSidepanelAppearance *panel) : + LLInventoryFetchItemsObserver(ids), + mPanel(panel) + {} + ~LLCurrentlyWornFetchObserver() {} + virtual void done() + { + mPanel->inventoryFetched(); + gInventory.removeObserver(this); + delete this; + } +private: + LLSidepanelAppearance *mPanel; +}; + +LLSidepanelAppearance::LLSidepanelAppearance() : + LLPanel(), + mFilterSubString(LLStringUtil::null), + mFilterEditor(NULL), + mOutfitEdit(NULL), + mCurrOutfitPanel(NULL), + mOpened(false) +{ + LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); + outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + + gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); + gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); +} + +LLSidepanelAppearance::~LLSidepanelAppearance() +{ +} + +// virtual +BOOL LLSidepanelAppearance::postBuild() +{ + mOpenOutfitBtn = getChild("openoutfit_btn"); + mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); + + mEditAppearanceBtn = getChild("editappearance_btn"); + mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); + + childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + + mNewOutfitBtn = getChild("newlook_btn"); + mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); + mNewOutfitBtn->setEnabled(false); + + mFilterEditor = getChild("Filter"); + if (mFilterEditor) + { + mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); + } + + mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); + + mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); + if (mOutfitEdit) + { + LLButton* back_btn = mOutfitEdit->getChild("back_btn"); + if (back_btn) + { + back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); + } + + } + + mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); + if (mEditWearable) + { + LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); + if (edit_wearable_back_btn) + { + edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + } + } + + mCurrentLookName = getChild("currentlook_name"); + + mOutfitStatus = getChild("currentlook_status"); + + mCurrOutfitPanel = getChild("panel_currentlook"); + + + setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); + + return TRUE; +} + +// virtual +void LLSidepanelAppearance::onOpen(const LLSD& key) +{ + if (!key.has("type")) + { + // No specific panel requested. + // If we're opened for the first time then show My Outfits. + // Else do nothing. + if (!mOpened) + { + showOutfitsInventoryPanel(); + } + } + else + { + // Switch to the requested panel. + std::string type = key["type"].asString(); + if (type == "my_outfits") + { + showOutfitsInventoryPanel(); + } + else if (type == "edit_outfit") + { + showOutfitEditPanel(); + } + else if (type == "edit_shape") + { + showWearableEditPanel(); + } + } + + mOpened = true; +} + +void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) +{ + LLSD visibility; + visibility["visible"] = new_visibility.asBoolean(); + visibility["reset_accordion"] = false; + updateToVisibility(visibility); +} + +void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) +{ + if (new_visibility["visible"].asBoolean()) + { + const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); + const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); + + if (is_outfit_edit_visible || is_wearable_edit_visible) + { + const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); + if (!wearable_ptr) + { + llwarns << "Visibility change to invalid wearable" << llendl; + return; + } + // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar + // when editing its physics. + if (!gAgentCamera.cameraCustomizeAvatar()) + { + LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); + } + if (is_wearable_edit_visible) + { + if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) + { + // we're no longer wearing the wearable we were last editing, switch back to outfit editor + showOutfitEditPanel(); + } + } + + if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) + { + mOutfitEdit->resetAccordionState(); + } + } + } + else + { + if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } + } +} + +void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) +{ + if (mFilterSubString != search_string) + { + mFilterSubString = search_string; + + // Searches are case-insensitive + // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. + + mPanelOutfitsInventory->onSearchEdit(mFilterSubString); + } +} + +void LLSidepanelAppearance::onOpenOutfitButtonClicked() +{ + const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); + if (!outfit_link) + return; + if (!outfit_link->getIsLinkType()) + return; + + LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); + if (tab_outfits) + { + tab_outfits->changeOpenClose(FALSE); + LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); + if (inventory_panel) + { + LLFolderView* root = inventory_panel->getRootFolder(); + LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); + if (outfit_folder) + { + outfit_folder->setOpen(!outfit_folder->isOpen()); + root->setSelectionFromRoot(outfit_folder,TRUE); + root->scrollToShowSelection(); + } + } + } +} + +// *TODO: obsolete? +void LLSidepanelAppearance::onEditAppearanceButtonClicked() +{ + if (gAgentWearables.areWearablesLoaded()) + { + LLVOAvatarSelf::onCustomizeStart(); + } +} + +void LLSidepanelAppearance::onNewOutfitButtonClicked() +{ + if (!mOutfitEdit->getVisible()) + { + mPanelOutfitsInventory->onSave(); + } +} + +void LLSidepanelAppearance::showOutfitsInventoryPanel() +{ + toggleWearableEditPanel(FALSE); + toggleOutfitEditPanel(FALSE); + toggleMyOutfitsPanel(TRUE); +} + +void LLSidepanelAppearance::showOutfitEditPanel() +{ + if (mOutfitEdit && mOutfitEdit->getVisible()) return; + + // Accordion's state must be reset in all cases except the one when user + // is returning back to the mOutfitEdit panel from the mEditWearable panel. + // The simplest way to control this is to check the visibility state of the mEditWearable + // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). + if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) + { + mOutfitEdit->resetAccordionState(); + } + + // If we're exiting the edit wearable view, and the camera was not focused on the avatar + // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since + // otherwise this would trigger the camera focus mode. + if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) + { + showOutfitsInventoryPanel(); + return; + } + + toggleMyOutfitsPanel(FALSE); + toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode + toggleOutfitEditPanel(TRUE); +} + +void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) +{ + toggleMyOutfitsPanel(FALSE); + toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode + toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); +} + +void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) +{ + if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mPanelOutfitsInventory->setVisible(visible); + + // *TODO: Move these controls to panel_outfits_inventory.xml + // so that we don't need to toggle them explicitly. + mFilterEditor->setVisible(visible); + mNewOutfitBtn->setVisible(visible); + mCurrOutfitPanel->setVisible(visible); + + if (visible) + { + mPanelOutfitsInventory->onOpen(LLSD()); + } +} + +void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) +{ + if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mOutfitEdit->setVisible(visible); + + if (visible) + { + mOutfitEdit->onOpen(LLSD()); + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + } + else + { + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + } + } +} + +void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) +{ + if (!mEditWearable || mEditWearable->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + if (!wearable) + { + wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); + } + if (!wearable) + { + return; + } + + // Toggle panel visibility. + mEditWearable->setVisible(visible); + + if (visible) + { + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + mEditWearable->setWearable(wearable, disable_camera_switch); + mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency + } + else + { + // Save changes if closing. + mEditWearable->saveChanges(); + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + } + } +} + +void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) +{ + // Set current outfit status (wearing/unsaved). + bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); + std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); + mOutfitStatus->setText(cof_status_str); + + if (name == "") + { + std::string outfit_name; + if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) + { + mCurrentLookName->setText(outfit_name); + return; + } + + std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; + mCurrentLookName->setText(getString(string_name)); + mOpenOutfitBtn->setEnabled(FALSE); + } + else + { + mCurrentLookName->setText(name); + // Can't just call update verbs since the folder link may not have been created yet. + mOpenOutfitBtn->setEnabled(TRUE); + } +} + +//static +void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) +{ + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); + + LLSidepanelAppearance *panel = dynamic_cast(data); + if (panel) + { + panel->showWearableEditPanel(wearable, disable_camera_switch); + } +} + +// Fetch currently worn items and only enable the New Look button after everything's been +// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. +void LLSidepanelAppearance::fetchInventory() +{ + + mNewOutfitBtn->setEnabled(false); + uuid_vec_t ids; + LLUUID item_id; + for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) + { + for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) + { + item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); + if(item_id.notNull()) + { + ids.push_back(item_id); + } + } + } + + if (isAgentAvatarValid()) + { + for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (!attachment) continue; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + if (!attached_object) continue; + const LLUUID& item_id = attached_object->getAttachmentItemID(); + if (item_id.isNull()) continue; + ids.push_back(item_id); + } + } + } + + LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); + fetch_worn->startFetch(); + // If no items to be fetched, done will never be triggered. + // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. + if (fetch_worn->isFinished()) + { + fetch_worn->done(); + } + else + { + gInventory.addObserver(fetch_worn); + } +} + +void LLSidepanelAppearance::inventoryFetched() +{ + mNewOutfitBtn->setEnabled(true); +} + +void LLSidepanelAppearance::setWearablesLoading(bool val) +{ + getChildView("wearables_loading_indicator")->setVisible( val); + getChildView("edit_outfit_btn")->setVisible( !val); + + if (!val) + { + // refresh outfit name when COF is already changed. + refreshCurrentOutfitName(); + } +} + +void LLSidepanelAppearance::showDefaultSubpart() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->showDefaultSubpart(); + } +} + +void LLSidepanelAppearance::updateScrollingPanelList() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->updateScrollingPanelList(); + } +} diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 32bbb8a776..762f557a80 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -47,7 +47,7 @@ public: virtual ~LLSidepanelAppearance(); /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onOpen(const LLSD& key); void refreshCurrentOutfitName(const std::string& name = ""); @@ -64,6 +64,7 @@ public: void showDefaultSubpart(); void updateScrollingPanelList(); void updateToVisibility( const LLSD& new_visibility ); + LLPanelEditWearable* getWearable(){ return mEditWearable; } private: void onFilterEdit(const std::string& search_string); -- cgit v1.2.3 From 3565f6f36db90e1a9a5918d8087f9dc0ab61eb69 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Thu, 13 Dec 2012 18:07:50 -0500 Subject: WIP SH-3339. Commit to merge from trunk to get build fixes, etc. --- indra/newview/llappearancemgr.h | 3 ++ indra/newview/llpaneleditwearable.cpp | 54 +++++++++++++++++++++-------------- indra/newview/llpaneleditwearable.h | 3 ++ 3 files changed, 38 insertions(+), 22 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 525402c215..7c94542e20 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -191,6 +191,9 @@ public: void incrementCofVersion(LLHTTPClient::ResponderPtr responder_ptr = NULL); + // *HACK Remove this after server side texture baking is deployed on all sims. + void incrementCofVersionLegacy(); + protected: LLAppearanceMgr(); ~LLAppearanceMgr(); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 3e7db06bdf..650e1809cf 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1028,33 +1028,43 @@ void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type) } } +void LLPanelEditWearable::incrementCofVersionLegacy() +{ + +} + void LLPanelEditWearable::saveChanges(bool force_save_as) { - if (!mWearablePtr || !isDirty()) - { - // do nothing if no unsaved changes - return; - } + if (!mWearablePtr || !isDirty()) + { + // do nothing if no unsaved changes + return; + } - U32 index = gAgentWearables.getWearableIndex(mWearablePtr); + U32 index = gAgentWearables.getWearableIndex(mWearablePtr); - std::string new_name = mNameEditor->getText(); - if (force_save_as) - { - // the name of the wearable has changed, re-save wearable with new name - LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID()); - gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE); - mNameEditor->setText(mWearableItem->getName()); - } - else - { - gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); - } + std::string new_name = mNameEditor->getText(); + if (force_save_as) + { + // the name of the wearable has changed, re-save wearable with new name + LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID()); + gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE); + mNameEditor->setText(mWearableItem->getName()); + } + else + { + gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); + } - if (gAgentAvatarp->isUsingServerBakes()) - { - LLAppearanceMgr::getInstance()->incrementCofVersion(); - } + if (getRegion() && getRegion()->getCentralBakeVersion() > 0) + { + LLAppearanceMgr::getInstance()->incrementCofVersion(); + } + else + { + // *HACK This should be removed when all regions support the IncrementCOFVersion capability. + incrementCofVersionLegacy(); + } } void LLPanelEditWearable::revertChanges() diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 50d5328a83..c5b44ecc9d 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -113,6 +113,9 @@ private: void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel); + // *HACK Remove this when serverside texture baking is available on all regions. + void incrementCofVersionLegacy(); + // the pointer to the wearable we're editing. NULL means we're not editing a wearable. LLViewerWearable *mWearablePtr; LLViewerInventoryItem* mWearableItem; -- cgit v1.2.3 From f9b235adf87819a727a6d656736111b776021ffb Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 14 Dec 2012 01:24:32 +0000 Subject: Attempt at fixing linux shader support on ubuntu 12.04 --- indra/newview/linux_tools/wrapper.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 20936c6460..0aba4bf0d6 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -45,6 +45,7 @@ if [ "`uname -m`" = "x86_64" ]; then echo '64-bit Linux detected.' fi + ## Everything below this line is just for advanced troubleshooters. ##------------------------------------------------------------------- @@ -60,7 +61,15 @@ fi export SDL_VIDEO_X11_DGAMOUSE=0 ## - Works around a problem with misconfigured 64-bit systems not finding GL -export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}":/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri +I386_MULTIARCH="$(dpkg-architecture -ai386 -qDEB_HOST_MULTIARCH 2>/dev/null)" +MULTIARCH_ERR=$? +if [ $MULTIARCH_ERR -eq 0 ]; then + echo 'Multi-arch support detected.' + MULTIARCH_GL_DRIVERS="/usr/lib/${I386_MULTIARCH}/dri" + export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:${MULTIARCH_GL_DRIVERS}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri" +else + export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri" +fi ## - The 'scim' GTK IM module widely crashes the viewer. Avoid it. if [ "$GTK_IM_MODULE" = "scim" ]; then -- cgit v1.2.3 From ad80ebb869a8d1cdca70a726c2c46d41a6263c4e Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 14 Dec 2012 20:11:45 +0000 Subject: Updating shaders to not crash when compiled in llvm --- .../shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl | 2 +- .../app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl index 99a6fe85fe..9c82056fd7 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl @@ -31,7 +31,7 @@ out vec4 frag_color; uniform float minimum_alpha; -vec4 diffuseLookup(vec2 texcoord); +/* vec4 diffuseLookup(vec2 texcoord); */ vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl index df182168f3..d3dacf9bc4 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl @@ -32,7 +32,7 @@ out vec4 frag_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 diffuseLookup(vec2 texcoord); +/* vec4 diffuseLookup(vec2 texcoord); */ vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); -- cgit v1.2.3 From b86a3e39cf8d0d17d5cd30743a871e3078331077 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 17 Dec 2012 13:24:57 -0500 Subject: SH-3604 FIX - resolved an issue with simulated failures/retry logic --- indra/newview/llappearancemgr.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index f957aadec5..7fd7b33be4 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -217,12 +217,12 @@ public: if (ll_frand() Date: Mon, 17 Dec 2012 16:51:25 -0500 Subject: SH-3629 WIP - fixed out-of-order outfit items --- indra/newview/llappearancemgr.cpp | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7fd7b33be4..7751da7b41 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -198,44 +198,30 @@ public: // Request or re-request operation for specified item. void addItem(const LLUUID& item_id) { - LLUUID linked_id; - if (gInventory.getItem(item_id)) - { - linked_id = gInventory.getItem(item_id)->getLinkedUUID(); - } - else if (gInventory.getCategory(item_id)) - { - linked_id = item_id; - } - else - { - llwarns << "no referent found for item_id " << item_id << llendl; - return; - } - LL_DEBUGS("Avatar") << "item_id " << item_id << " -> linked_id " << linked_id << llendl; + LL_DEBUGS("Avatar") << "item_id " << item_id << llendl; if (ll_frand()getName() << " to " << mDstCatID << llendl; // create an inventory item link. link_inventory_item(gAgent.getID(), - item_id, + item->getLinkedUUID(), mDstCatID, item->getName(), item->LLInventoryItem::getDescription(), -- cgit v1.2.3 From 42496cd672436cc4d32f5546fd04294931b8f0b6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 17 Dec 2012 18:34:13 -0500 Subject: SH-3629 WIP - avoid clobbering links to desired items that are already in the COF, as will be the case when wearing an outfit with required body parts missing --- indra/newview/llappearancemgr.cpp | 49 ++++++++++++++++++++------------------- indra/newview/llappearancemgr.h | 3 +-- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7751da7b41..1044732f4b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -418,6 +418,11 @@ public: LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item) { + if (item->getParentUUID() == mDstCatID) + { + LL_DEBUGS("Avatar") << "item " << item_id << " name " << item->getName() << " is already a child of " << mDstCatID << llendl; + return false; + } LL_DEBUGS("Avatar") << "linking item " << item_id << " name " << item->getName() << " to " << mDstCatID << llendl; // create an inventory item link. link_inventory_item(gAgent.getID(), @@ -436,7 +441,7 @@ public: LLViewerInventoryCategory *catp = gInventory.getCategory(item_id); if (!catp) { - llwarns << "id not found as inventory item or category " << item_id << llendl; + llwarns << "link request failed, id not found as inventory item or category " << item_id << llendl; return false; } const LLUUID cof = LLAppearanceMgr::instance().getCOF(); @@ -1621,7 +1626,7 @@ void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category) } } -void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_links) +void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_links, LLInventoryModel::item_array_t* keep_items) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -1634,7 +1639,14 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin continue; if (item->getIsLinkType()) { - gInventory.purgeObject(item->getUUID()); + if (keep_items && keep_items->find(item) != LLInventoryModel::item_array_t::FAIL) + { + llinfos << "preserved item" << llendl; + } + else + { + gInventory.purgeObject(item->getUUID()); + } } } } @@ -1746,34 +1758,23 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) getDescendentsOfAssetType(category, gest_items, LLAssetType::AT_GESTURE, false); removeDuplicateItems(gest_items); -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking body items" << LL_ENDL; -#endif - // Create links to new COF contents. LL_DEBUGS("Avatar") << self_av_string() << "creating LLCallAfterInventoryLinkMgr" << LL_ENDL; + + LLInventoryModel::item_array_t all_items; + all_items += body_items; + all_items += wear_items; + all_items += obj_items; + all_items += gest_items; + + // Will link all the above items. bool update_base_outfit_ordering = !append; LLCallAfterInventoryLinkMgr *link_waiter = - new LLCallAfterInventoryLinkMgr(body_items,cof,"update_appearance_on_destroy", + new LLCallAfterInventoryLinkMgr(all_items,cof,"update_appearance_on_destroy", boost::bind(&LLAppearanceMgr::updateAppearanceFromCOF, LLAppearanceMgr::getInstance(), update_base_outfit_ordering)); -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking wear items" << LL_ENDL; -#endif - link_waiter->addItems(wear_items); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking obj items" << LL_ENDL; -#endif - link_waiter->addItems(obj_items); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking gesture items" << LL_ENDL; -#endif - link_waiter->addItems(gest_items); - // Add link to outfit if category is an outfit. if (!append) { @@ -1785,7 +1786,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) // carried over (e.g. keeping old shape if the new outfit does not // contain one) bool keep_outfit_links = append; - purgeCategory(cof, keep_outfit_links); + purgeCategory(cof, keep_outfit_links, &all_items); gInventory.notifyObservers(); LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index cb271cda4d..31dbce892a 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -206,8 +206,7 @@ private: LLInventoryModel::item_array_t& gest_items, bool follow_folder_links); - void purgeCategory(const LLUUID& category, bool keep_outfit_links); - + void purgeCategory(const LLUUID& category, bool keep_outfit_links, LLInventoryModel::item_array_t* keep_items = NULL); static void onOutfitRename(const LLSD& notification, const LLSD& response); void setOutfitLocked(bool locked); -- cgit v1.2.3 From 67c66a12ab0e169e9e1e86265ff57aa5aa758b2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 18 Dec 2012 12:45:10 -0500 Subject: SH-3604 WIP - fixed a case with retry logic --- indra/newview/llappearancemgr.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1044732f4b..4a484f3b85 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -199,14 +199,8 @@ public: void addItem(const LLUUID& item_id) { LL_DEBUGS("Avatar") << "item_id " << item_id << llendl; - - if (ll_frand()getPermissions().getOwner(), @@ -425,6 +424,11 @@ public: } LL_DEBUGS("Avatar") << "linking item " << item_id << " name " << item->getName() << " to " << mDstCatID << llendl; // create an inventory item link. + if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate")) + { + LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << llendl; + return true; + } link_inventory_item(gAgent.getID(), item->getLinkedUUID(), mDstCatID, @@ -433,7 +437,7 @@ public: LLAssetType::AT_LINK, new LLBoostFuncInventoryCallback( boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); - request_sent = true; + return true; } else { @@ -451,6 +455,11 @@ public: if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) { + if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate")) + { + LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << llendl; + return true; + } LL_DEBUGS("Avatar") << "linking folder " << item_id << " name " << catp->getName() << " to cof " << cof << llendl; link_inventory_item(gAgent.getID(), item_id, cof, catp->getName(), "", LLAssetType::AT_LINK_FOLDER, -- cgit v1.2.3 From cd710087817909a0a83289cd1ee6a39e5e9a1a5c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 18 Dec 2012 13:07:01 -0500 Subject: SH-3604 WIP - more frequent polling for retries --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4a484f3b85..8b4adc8785 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -175,7 +175,7 @@ public: mFailCount(0), mCompletionOrFailureCalled(false), mRetryCount(0), - LLEventTimer(retry_after) + LLEventTimer(5.0) { if (!mTrackingPhase.empty()) { -- cgit v1.2.3 From cbf24c55d511b2390fdc4c12698682531f26f41b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 20 Dec 2012 10:27:18 -0500 Subject: SH-3344 WIP - additional debugging output for avatar local textures --- indra/newview/llviewertexture.cpp | 1 + indra/newview/llviewertexture.h | 2 + indra/newview/llvoavatar.cpp | 4 +- indra/newview/llvoavatarself.cpp | 85 +++++++++++++++++++++++++++++++++++++++ indra/newview/llvoavatarself.h | 1 + 5 files changed, 92 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 846216211e..a673862882 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -616,6 +616,7 @@ LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) : LLViewerTexture::~LLViewerTexture() { + // LL_DEBUGS("Avatar") << mID << llendl; cleanup(); sImageCount--; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 3df942d922..ba6beec883 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -134,6 +134,7 @@ public: void resetTextureStats(); void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;} void resetMaxVirtualSizeResetCounter()const {mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;} + S32 getMaxVirtualSizeResetCounter() const { return mMaxVirtualSizeResetCounter; } virtual F32 getMaxVirtualSize() ; @@ -306,6 +307,7 @@ public: // the priority list, and cause horrible things to happen. void setDecodePriority(F32 priority = -1.0f); F32 getDecodePriority() const { return mDecodePriority; }; + F32 getAdditionalDecodePriority() const { return mAdditionalDecodePriority; }; void setAdditionalDecodePriority(F32 priority) ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 117f28cc36..086e4306f8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5811,6 +5811,7 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) // virtual void LLVOAvatar::updateMeshTextures() { + static S32 update_counter = 0; mBakedTextureDebugText.clear(); // if user has never specified a texture, assign the default @@ -5840,7 +5841,8 @@ void LLVOAvatar::updateMeshTextures() std::vector use_lkg_baked_layer; // lkg = "last known good" use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); - mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; + mBakedTextureDebugText += llformat("%06d\n",update_counter++); + mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; for (U32 i=0; i < mBakedTextureDatas.size(); i++) { is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 77deb5e3bc..674988d94b 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -176,6 +176,17 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, lldebugs << "Marking avatar as self " << id << llendl; } +// Called periodically for diagnostics, return true when done. +bool output_texture_diagnostics() +{ + if (!isAgentAvatarValid()) + return true; // done checking + + gAgentAvatarp->outputRezDiagnostics(); + + return false; +} + void LLVOAvatarSelf::initInstance() { BOOL status = TRUE; @@ -209,6 +220,8 @@ void LLVOAvatarSelf::initInstance() llerrs << "Unable to load user's avatar" << llendl; return; } + + //doPeriodically(output_texture_diagnostics, 30.0); } // virtual @@ -2008,6 +2021,64 @@ void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL fini mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32(); } +const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const +{ + std::ostringstream outbuf; + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = + LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); + ++baked_iter) + { + const EBakedTextureIndex baked_index = baked_iter->first; + if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) + { + outbuf << "baked_index: " << baked_index << "\n"; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; + for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); + local_tex_iter != baked_dict->mLocalTextures.end(); + ++local_tex_iter) + { + const ETextureIndex tex_index = *local_tex_iter; + outbuf << " tex_index " << (S32) tex_index << "\n"; + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); + const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); + if (wearable_count > 0) + { + for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) + { + outbuf << " " << LLWearableType::getTypeName(wearable_type) << " " << wearable_index << "\n"; + const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(tex_index, wearable_index); + if (local_tex_obj) + { + LLViewerFetchedTexture* image = dynamic_cast( local_tex_obj->getImage() ); + if (tex_index >= 0 + && local_tex_obj->getID() != IMG_DEFAULT_AVATAR + && !image->isMissingAsset()) + { + outbuf << " id: " << image->getID() + << " refs: " << image->getNumRefs() + << " glocdisc: " << getLocalDiscardLevel(tex_index, wearable_index) + << " discard: " << image->getDiscardLevel() + << " desired: " << image->getDesiredDiscardLevel() + << " decode: " << image->getDecodePriority() + << " addl: " << image->getAdditionalDecodePriority() + << " ts: " << image->getTextureState() + << " bl: " << image->getBoostLevel() + << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there. + << " mvs: " << image->getMaxVirtualSize() + << " mvsc: " << image->getMaxVirtualSizeResetCounter() + << "\n"; + } + } + } + } + } + break; + } + } + return outbuf.str(); +} + const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const { std::string text=""; @@ -2282,6 +2353,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe F32 desired_pixels; desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); + // DRANO what priority should wearable-based textures have? if (isUsingLocalAppearance()) { imagep->setBoostLevel(getAvatarBoostLevel()); @@ -2466,6 +2538,19 @@ void LLVOAvatarSelf::outputRezDiagnostics() const if (!layerset_buffer) continue; LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl; } + std::string vd_text = "Local textures per baked index and wearable:\n"; + for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); + ++baked_iter) + { + const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; + const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); + if (!layerset) continue; + const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); + if (!layerset_buffer) continue; + vd_text += verboseDebugDumpLocalTextureDataInfo(layerset); + } + LL_DEBUGS("Avatar") << vd_text << llendl; } void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index eeac5ddaeb..02612b83da 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -390,6 +390,7 @@ public: BOOL isAllLocalTextureDataFinal() const; const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); } + const std::string verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD LLSD metricsData(); -- cgit v1.2.3 From 4e1eda1c3bc898ae8481b8dfcff4b29196ac835e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 7 Jan 2013 18:31:28 -0500 Subject: SH-3344 WIP - keep avatar local textures flagged no-delete while in use --- indra/newview/llviewertexture.cpp | 5 ++- indra/newview/llvoavatar.cpp | 73 ++++++++++++++++++++++++++++++++++ indra/newview/llvoavatar.h | 3 ++ indra/newview/llvoavatarself.cpp | 82 ++++++++++++++++++++++----------------- indra/newview/llvoavatarself.h | 1 + 5 files changed, 127 insertions(+), 37 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a673862882..8eada5c2a1 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -616,7 +616,7 @@ LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) : LLViewerTexture::~LLViewerTexture() { - // LL_DEBUGS("Avatar") << mID << llendl; + LL_DEBUGS("Avatar") << mID << llendl; cleanup(); sImageCount--; } @@ -1160,7 +1160,8 @@ void LLViewerFetchedTexture::destroyTexture() { return ; } - + + LL_DEBUGS("Avatar") << mID << llendl; destroyGLTexture() ; mFullyLoaded = FALSE ; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 086e4306f8..df0b8171a6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4004,8 +4004,81 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) //------------------------------------------------------------------------ // LLVOAvatar::updateTextures() //------------------------------------------------------------------------ +void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem) +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index); + U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); + + LLViewerFetchedTexture *imagep = NULL; + for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); + if (imagep) + { + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); + if (texture_dict->mIsLocalTexture) + { + local_mem += imagep->getTextureMemory(); + ids.insert(imagep->getID()); + } + } + } + if (isIndexBakedTexture((ETextureIndex) texture_index)) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + if (imagep) + { + baked_mem += imagep->getTextureMemory(); + ids.insert(imagep->getID()); + } + } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::releaseOldTextures() +{ + S32 current_texture_mem = 0; + + // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" + std::set new_texture_ids; + S32 local_mem = 0, baked_mem = 0; + collectTextureUUIDs(new_texture_ids, local_mem, baked_mem); + LL_DEBUGS("Avatar") << getFullname() << " local_mem: " << local_mem << " baked_mem: " << baked_mem << llendl; + for (std::set::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) + { + if (new_texture_ids.find(*it) == new_texture_ids.end()) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + current_texture_mem += imagep->getTextureMemory(); + if (imagep->getTextureState() == LLGLTexture::NO_DELETE) + { + // This will allow the texture to be deleted if not in use. + imagep->forceActive(); + + // This resets the clock to being flagged as + // unused, preventing the texture from being + // deleted immediately. If other avatars or + // objects are using it, it can still be flagged + // no-delete by them. + imagep->forceUpdateBindStats(); + } + } + } + } + mTextureIDs = new_texture_ids; +} + void LLVOAvatar::updateTextures() { + releaseOldTextures(); + BOOL render_avatar = TRUE; if (mIsDummy) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4802476e59..5b1395e566 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -134,6 +134,8 @@ public: BOOL updateJointLODs(); void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + void collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem); + void releaseOldTextures(); /*virtual*/ void updateTextures(); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ void onShift(const LLVector4a& shift_vector); @@ -528,6 +530,7 @@ protected: LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; BOOL mLoadedCallbacksPaused; + std::set mTextureIDs; //-------------------------------------------------------------------- // Local Textures //-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 674988d94b..41dfe51116 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -177,7 +177,7 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, } // Called periodically for diagnostics, return true when done. -bool output_texture_diagnostics() +bool output_self_av_texture_diagnostics() { if (!isAgentAvatarValid()) return true; // done checking @@ -221,7 +221,7 @@ void LLVOAvatarSelf::initInstance() return; } - //doPeriodically(output_texture_diagnostics, 30.0); + doPeriodically(output_self_av_texture_diagnostics, 30.0); } // virtual @@ -2039,14 +2039,15 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV ++local_tex_iter) { const ETextureIndex tex_index = *local_tex_iter; - outbuf << " tex_index " << (S32) tex_index << "\n"; + const std::string tex_name = LLAvatarAppearanceDictionary::getInstance()->getTexture(tex_index)->mName; + outbuf << " tex_index " << (S32) tex_index << " name " << tex_name << "\n"; const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); if (wearable_count > 0) { for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - outbuf << " " << LLWearableType::getTypeName(wearable_type) << " " << wearable_index << "\n"; + outbuf << " " << LLWearableType::getTypeName(wearable_type) << " " << wearable_index << ":"; const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(tex_index, wearable_index); if (local_tex_obj) { @@ -2055,7 +2056,7 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV && local_tex_obj->getID() != IMG_DEFAULT_AVATAR && !image->isMissingAsset()) { - outbuf << " id: " << image->getID() + outbuf << " id: " << image->getID() << " refs: " << image->getNumRefs() << " glocdisc: " << getLocalDiscardLevel(tex_index, wearable_index) << " discard: " << image->getDiscardLevel() @@ -2067,9 +2068,10 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there. << " mvs: " << image->getMaxVirtualSize() << " mvsc: " << image->getMaxVirtualSizeResetCounter() - << "\n"; + << " mem: " << image->getTextureMemory(); } } + outbuf << "\n"; } } } @@ -2079,6 +2081,23 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV return outbuf.str(); } +void LLVOAvatarSelf::dumpAllTextures() const +{ + std::string vd_text = "Local textures per baked index and wearable:\n"; + for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); + ++baked_iter) + { + const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; + const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); + if (!layerset) continue; + const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); + if (!layerset_buffer) continue; + vd_text += verboseDebugDumpLocalTextureDataInfo(layerset); + } + LL_DEBUGS("Avatar") << vd_text << llendl; +} + const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const { std::string text=""; @@ -2348,24 +2367,28 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe { if (!isIndexLocalTexture(type)) return; - if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR && imagep->getDiscardLevel() != 0) + if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR) { - F32 desired_pixels; - desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); - - // DRANO what priority should wearable-based textures have? - if (isUsingLocalAppearance()) - { - imagep->setBoostLevel(getAvatarBoostLevel()); - imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; - } - imagep->resetTextureStats(); - imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); - imagep->addTextureStats( desired_pixels / texel_area_ratio ); - imagep->forceUpdateBindStats() ; - if (imagep->getDiscardLevel() < 0) + imagep->setNoDelete(); + if (imagep->getDiscardLevel() != 0) { - mHasGrey = TRUE; // for statistics gathering + F32 desired_pixels; + desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); + + // DRANO what priority should wearable-based textures have? + if (isUsingLocalAppearance()) + { + imagep->setBoostLevel(getAvatarBoostLevel()); + imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; + } + imagep->resetTextureStats(); + imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); + imagep->addTextureStats( desired_pixels / texel_area_ratio ); + imagep->forceUpdateBindStats() ; + if (imagep->getDiscardLevel() < 0) + { + mHasGrey = TRUE; // for statistics gathering + } } } else @@ -2538,19 +2561,8 @@ void LLVOAvatarSelf::outputRezDiagnostics() const if (!layerset_buffer) continue; LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl; } - std::string vd_text = "Local textures per baked index and wearable:\n"; - for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); - ++baked_iter) - { - const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; - const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); - if (!layerset) continue; - const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); - if (!layerset_buffer) continue; - vd_text += verboseDebugDumpLocalTextureDataInfo(layerset); - } - LL_DEBUGS("Avatar") << vd_text << llendl; + + dumpAllTextures(); } void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 02612b83da..74888e470d 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -391,6 +391,7 @@ public: const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); } const std::string verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer + void dumpAllTextures() const; const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD LLSD metricsData(); -- cgit v1.2.3 From 8e8765535f94d3084305ef7b9e4644ec92d10723 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 9 Jan 2013 12:41:51 -0500 Subject: SH-3620: Fix for editing a nocopy wearable being removed from the outfit --- indra/newview/llpaneleditwearable.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 786b215fdf..606e78bd58 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -882,9 +882,12 @@ void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_c //static void LLPanelEditWearable::onBackButtonClicked(void* userdata) -{ - LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata; - panel->saveChanges(true); +{ + LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata; + if ( panel->isDirty() ) + { + LLAppearanceMgr::instance().setOutfitDirty( true ); + } } //static -- cgit v1.2.3 From 547f48eabe6b363de9b8551074b004041814ea12 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 9 Jan 2013 15:43:09 -0500 Subject: SH-3600. Undo change is disabled upon reentry into the appearance panel --- indra/newview/llsidepanelappearance.cpp | 1089 ++++++++++++++++--------------- 1 file changed, 545 insertions(+), 544 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 98dc2c0e09..f0844dd9a4 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -1,544 +1,545 @@ -/** - * @file llsidepanelappearance.cpp - * @brief Side Bar "Appearance" panel - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llsidepanelappearance.h" - -#include "llaccordionctrltab.h" -#include "llagent.h" -#include "llagentcamera.h" -#include "llagentwearables.h" -#include "llappearancemgr.h" -#include "llfloatersidepanelcontainer.h" -#include "llfolderview.h" -#include "llinventorypanel.h" -#include "llfiltereditor.h" -#include "llfloaterreg.h" -#include "llfloaterworldmap.h" -#include "llfoldervieweventlistener.h" -#include "lloutfitobserver.h" -#include "llpaneleditwearable.h" -#include "llpaneloutfitsinventory.h" -#include "lltextbox.h" -#include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llviewerregion.h" -#include "llvoavatarself.h" -#include "llviewerwearable.h" - -static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); - -class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver -{ -public: - LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, - LLSidepanelAppearance *panel) : - LLInventoryFetchItemsObserver(ids), - mPanel(panel) - {} - ~LLCurrentlyWornFetchObserver() {} - virtual void done() - { - mPanel->inventoryFetched(); - gInventory.removeObserver(this); - delete this; - } -private: - LLSidepanelAppearance *mPanel; -}; - -LLSidepanelAppearance::LLSidepanelAppearance() : - LLPanel(), - mFilterSubString(LLStringUtil::null), - mFilterEditor(NULL), - mOutfitEdit(NULL), - mCurrOutfitPanel(NULL), - mOpened(false) -{ - LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); - outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - - gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); - gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); -} - -LLSidepanelAppearance::~LLSidepanelAppearance() -{ -} - -// virtual -BOOL LLSidepanelAppearance::postBuild() -{ - mOpenOutfitBtn = getChild("openoutfit_btn"); - mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); - - mEditAppearanceBtn = getChild("editappearance_btn"); - mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); - - childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - - mNewOutfitBtn = getChild("newlook_btn"); - mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); - mNewOutfitBtn->setEnabled(false); - - mFilterEditor = getChild("Filter"); - if (mFilterEditor) - { - mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); - } - - mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); - - mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); - if (mOutfitEdit) - { - LLButton* back_btn = mOutfitEdit->getChild("back_btn"); - if (back_btn) - { - back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); - } - - } - - mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); - if (mEditWearable) - { - LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); - if (edit_wearable_back_btn) - { - edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - } - } - - mCurrentLookName = getChild("currentlook_name"); - - mOutfitStatus = getChild("currentlook_status"); - - mCurrOutfitPanel = getChild("panel_currentlook"); - - - setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); - - return TRUE; -} - -// virtual -void LLSidepanelAppearance::onOpen(const LLSD& key) -{ - if (!key.has("type")) - { - // No specific panel requested. - // If we're opened for the first time then show My Outfits. - // Else do nothing. - if (!mOpened) - { - showOutfitsInventoryPanel(); - } - } - else - { - // Switch to the requested panel. - std::string type = key["type"].asString(); - if (type == "my_outfits") - { - showOutfitsInventoryPanel(); - } - else if (type == "edit_outfit") - { - showOutfitEditPanel(); - } - else if (type == "edit_shape") - { - showWearableEditPanel(); - } - } - - mOpened = true; -} - -void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) -{ - LLSD visibility; - visibility["visible"] = new_visibility.asBoolean(); - visibility["reset_accordion"] = false; - updateToVisibility(visibility); -} - -void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) -{ - if (new_visibility["visible"].asBoolean()) - { - const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); - const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); - - if (is_outfit_edit_visible || is_wearable_edit_visible) - { - const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); - if (!wearable_ptr) - { - llwarns << "Visibility change to invalid wearable" << llendl; - return; - } - // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar - // when editing its physics. - if (!gAgentCamera.cameraCustomizeAvatar()) - { - LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); - } - if (is_wearable_edit_visible) - { - if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) - { - // we're no longer wearing the wearable we were last editing, switch back to outfit editor - showOutfitEditPanel(); - } - } - - if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) - { - mOutfitEdit->resetAccordionState(); - } - } - } - else - { - if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) - { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); - } - } -} - -void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) -{ - if (mFilterSubString != search_string) - { - mFilterSubString = search_string; - - // Searches are case-insensitive - // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. - - mPanelOutfitsInventory->onSearchEdit(mFilterSubString); - } -} - -void LLSidepanelAppearance::onOpenOutfitButtonClicked() -{ - const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); - if (!outfit_link) - return; - if (!outfit_link->getIsLinkType()) - return; - - LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); - if (tab_outfits) - { - tab_outfits->changeOpenClose(FALSE); - LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); - if (inventory_panel) - { - LLFolderView* root = inventory_panel->getRootFolder(); - LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); - if (outfit_folder) - { - outfit_folder->setOpen(!outfit_folder->isOpen()); - root->setSelectionFromRoot(outfit_folder,TRUE); - root->scrollToShowSelection(); - } - } - } -} - -// *TODO: obsolete? -void LLSidepanelAppearance::onEditAppearanceButtonClicked() -{ - if (gAgentWearables.areWearablesLoaded()) - { - LLVOAvatarSelf::onCustomizeStart(); - } -} - -void LLSidepanelAppearance::onNewOutfitButtonClicked() -{ - if (!mOutfitEdit->getVisible()) - { - mPanelOutfitsInventory->onSave(); - } -} - -void LLSidepanelAppearance::showOutfitsInventoryPanel() -{ - toggleWearableEditPanel(FALSE); - toggleOutfitEditPanel(FALSE); - toggleMyOutfitsPanel(TRUE); -} - -void LLSidepanelAppearance::showOutfitEditPanel() -{ - if (mOutfitEdit && mOutfitEdit->getVisible()) return; - - // Accordion's state must be reset in all cases except the one when user - // is returning back to the mOutfitEdit panel from the mEditWearable panel. - // The simplest way to control this is to check the visibility state of the mEditWearable - // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). - if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) - { - mOutfitEdit->resetAccordionState(); - } - - // If we're exiting the edit wearable view, and the camera was not focused on the avatar - // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since - // otherwise this would trigger the camera focus mode. - if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) - { - showOutfitsInventoryPanel(); - return; - } - - toggleMyOutfitsPanel(FALSE); - toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode - toggleOutfitEditPanel(TRUE); -} - -void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) -{ - toggleMyOutfitsPanel(FALSE); - toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode - toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); -} - -void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) -{ - if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mPanelOutfitsInventory->setVisible(visible); - - // *TODO: Move these controls to panel_outfits_inventory.xml - // so that we don't need to toggle them explicitly. - mFilterEditor->setVisible(visible); - mNewOutfitBtn->setVisible(visible); - mCurrOutfitPanel->setVisible(visible); - - if (visible) - { - mPanelOutfitsInventory->onOpen(LLSD()); - } -} - -void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) -{ - if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mOutfitEdit->setVisible(visible); - - if (visible) - { - mOutfitEdit->onOpen(LLSD()); - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - } - else - { - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) -{ - if (!mEditWearable || mEditWearable->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - if (!wearable) - { - wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); - } - if (!wearable) - { - return; - } - - // Toggle panel visibility. - mEditWearable->setVisible(visible); - - if (visible) - { - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - mEditWearable->setWearable(wearable, disable_camera_switch); - mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency - } - else - { - // Save changes if closing. - mEditWearable->saveChanges(); - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) -{ - // Set current outfit status (wearing/unsaved). - bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); - std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); - mOutfitStatus->setText(cof_status_str); - - if (name == "") - { - std::string outfit_name; - if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) - { - mCurrentLookName->setText(outfit_name); - return; - } - - std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; - mCurrentLookName->setText(getString(string_name)); - mOpenOutfitBtn->setEnabled(FALSE); - } - else - { - mCurrentLookName->setText(name); - // Can't just call update verbs since the folder link may not have been created yet. - mOpenOutfitBtn->setEnabled(TRUE); - } -} - -//static -void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) -{ - LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); - - LLSidepanelAppearance *panel = dynamic_cast(data); - if (panel) - { - panel->showWearableEditPanel(wearable, disable_camera_switch); - } -} - -// Fetch currently worn items and only enable the New Look button after everything's been -// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. -void LLSidepanelAppearance::fetchInventory() -{ - - mNewOutfitBtn->setEnabled(false); - uuid_vec_t ids; - LLUUID item_id; - for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) - { - for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) - { - item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); - if(item_id.notNull()) - { - ids.push_back(item_id); - } - } - } - - if (isAgentAvatarValid()) - { - for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); - iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) - { - LLViewerJointAttachment* attachment = iter->second; - if (!attachment) continue; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject* attached_object = (*attachment_iter); - if (!attached_object) continue; - const LLUUID& item_id = attached_object->getAttachmentItemID(); - if (item_id.isNull()) continue; - ids.push_back(item_id); - } - } - } - - LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); - fetch_worn->startFetch(); - // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. - if (fetch_worn->isFinished()) - { - fetch_worn->done(); - } - else - { - gInventory.addObserver(fetch_worn); - } -} - -void LLSidepanelAppearance::inventoryFetched() -{ - mNewOutfitBtn->setEnabled(true); -} - -void LLSidepanelAppearance::setWearablesLoading(bool val) -{ - getChildView("wearables_loading_indicator")->setVisible( val); - getChildView("edit_outfit_btn")->setVisible( !val); - - if (!val) - { - // refresh outfit name when COF is already changed. - refreshCurrentOutfitName(); - } -} - -void LLSidepanelAppearance::showDefaultSubpart() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->showDefaultSubpart(); - } -} - -void LLSidepanelAppearance::updateScrollingPanelList() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->updateScrollingPanelList(); - } -} +/** + * @file llsidepanelappearance.cpp + * @brief Side Bar "Appearance" panel + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsidepanelappearance.h" + +#include "llaccordionctrltab.h" +#include "llagent.h" +#include "llagentcamera.h" +#include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" +#include "llfolderview.h" +#include "llinventorypanel.h" +#include "llfiltereditor.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" +#include "llfoldervieweventlistener.h" +#include "lloutfitobserver.h" +#include "llpaneleditwearable.h" +#include "llpaneloutfitsinventory.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" +#include "llviewerwearable.h" + +static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); + +class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver +{ +public: + LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, + LLSidepanelAppearance *panel) : + LLInventoryFetchItemsObserver(ids), + mPanel(panel) + {} + ~LLCurrentlyWornFetchObserver() {} + virtual void done() + { + mPanel->inventoryFetched(); + gInventory.removeObserver(this); + delete this; + } +private: + LLSidepanelAppearance *mPanel; +}; + +LLSidepanelAppearance::LLSidepanelAppearance() : + LLPanel(), + mFilterSubString(LLStringUtil::null), + mFilterEditor(NULL), + mOutfitEdit(NULL), + mCurrOutfitPanel(NULL), + mOpened(false) +{ + LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); + outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + + gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); + gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); +} + +LLSidepanelAppearance::~LLSidepanelAppearance() +{ +} + +// virtual +BOOL LLSidepanelAppearance::postBuild() +{ + mOpenOutfitBtn = getChild("openoutfit_btn"); + mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); + + mEditAppearanceBtn = getChild("editappearance_btn"); + mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); + + childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + + mNewOutfitBtn = getChild("newlook_btn"); + mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); + mNewOutfitBtn->setEnabled(false); + + mFilterEditor = getChild("Filter"); + if (mFilterEditor) + { + mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); + } + + mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); + + mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); + if (mOutfitEdit) + { + LLButton* back_btn = mOutfitEdit->getChild("back_btn"); + if (back_btn) + { + back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); + } + + } + + mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); + if (mEditWearable) + { + LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); + if (edit_wearable_back_btn) + { + edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + } + } + + mCurrentLookName = getChild("currentlook_name"); + + mOutfitStatus = getChild("currentlook_status"); + + mCurrOutfitPanel = getChild("panel_currentlook"); + + + setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); + + return TRUE; +} + +// virtual +void LLSidepanelAppearance::onOpen(const LLSD& key) +{ + if (!key.has("type")) + { + // No specific panel requested. + // If we're opened for the first time then show My Outfits. + // Else do nothing. + if (!mOpened) + { + showOutfitsInventoryPanel(); + } + } + else + { + // Switch to the requested panel. + std::string type = key["type"].asString(); + if (type == "my_outfits") + { + showOutfitsInventoryPanel(); + } + else if (type == "edit_outfit") + { + showOutfitEditPanel(); + } + else if (type == "edit_shape") + { + showWearableEditPanel(); + } + } + + mOpened = true; +} + +void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) +{ + LLSD visibility; + visibility["visible"] = new_visibility.asBoolean(); + visibility["reset_accordion"] = false; + updateToVisibility(visibility); +} + +void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) +{ + if (new_visibility["visible"].asBoolean()) + { + const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); + const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); + + if (is_outfit_edit_visible || is_wearable_edit_visible) + { + const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); + if (!wearable_ptr) + { + llwarns << "Visibility change to invalid wearable" << llendl; + return; + } + // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar + // when editing its physics. + if (!gAgentCamera.cameraCustomizeAvatar()) + { + LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); + } + if (is_wearable_edit_visible) + { + if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) + { + // we're no longer wearing the wearable we were last editing, switch back to outfit editor + showOutfitEditPanel(); + } + } + + if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) + { + mOutfitEdit->resetAccordionState(); + } + } + } + else + { + if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } + } +} + +void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) +{ + if (mFilterSubString != search_string) + { + mFilterSubString = search_string; + + // Searches are case-insensitive + // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. + + mPanelOutfitsInventory->onSearchEdit(mFilterSubString); + } +} + +void LLSidepanelAppearance::onOpenOutfitButtonClicked() +{ + const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); + if (!outfit_link) + return; + if (!outfit_link->getIsLinkType()) + return; + + LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); + if (tab_outfits) + { + tab_outfits->changeOpenClose(FALSE); + LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); + if (inventory_panel) + { + LLFolderView* root = inventory_panel->getRootFolder(); + LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); + if (outfit_folder) + { + outfit_folder->setOpen(!outfit_folder->isOpen()); + root->setSelectionFromRoot(outfit_folder,TRUE); + root->scrollToShowSelection(); + } + } + } +} + +// *TODO: obsolete? +void LLSidepanelAppearance::onEditAppearanceButtonClicked() +{ + if (gAgentWearables.areWearablesLoaded()) + { + LLVOAvatarSelf::onCustomizeStart(); + } +} + +void LLSidepanelAppearance::onNewOutfitButtonClicked() +{ + if (!mOutfitEdit->getVisible()) + { + mPanelOutfitsInventory->onSave(); + } +} + +void LLSidepanelAppearance::showOutfitsInventoryPanel() +{ + toggleWearableEditPanel(FALSE); + toggleOutfitEditPanel(FALSE); + toggleMyOutfitsPanel(TRUE); +} + +void LLSidepanelAppearance::showOutfitEditPanel() +{ + if (mOutfitEdit && mOutfitEdit->getVisible()) return; + + // Accordion's state must be reset in all cases except the one when user + // is returning back to the mOutfitEdit panel from the mEditWearable panel. + // The simplest way to control this is to check the visibility state of the mEditWearable + // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). + if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) + { + mOutfitEdit->resetAccordionState(); + } + + // If we're exiting the edit wearable view, and the camera was not focused on the avatar + // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since + // otherwise this would trigger the camera focus mode. + if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) + { + showOutfitsInventoryPanel(); + return; + } + + toggleMyOutfitsPanel(FALSE); + toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode + toggleOutfitEditPanel(TRUE); +} + +void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) +{ + toggleMyOutfitsPanel(FALSE); + toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode + toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); +} + +void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) +{ + if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mPanelOutfitsInventory->setVisible(visible); + + // *TODO: Move these controls to panel_outfits_inventory.xml + // so that we don't need to toggle them explicitly. + mFilterEditor->setVisible(visible); + mNewOutfitBtn->setVisible(visible); + mCurrOutfitPanel->setVisible(visible); + + if (visible) + { + mPanelOutfitsInventory->onOpen(LLSD()); + } +} + +void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) +{ + if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mOutfitEdit->setVisible(visible); + + if (visible) + { + mOutfitEdit->onOpen(LLSD()); + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + } + else + { + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + LLAppearanceMgr::getInstance()->setOutfitDirty( FALSE ); + } + } +} + +void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) +{ + if (!mEditWearable || mEditWearable->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + if (!wearable) + { + wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); + } + if (!wearable) + { + return; + } + + // Toggle panel visibility. + mEditWearable->setVisible(visible); + + if (visible) + { + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + mEditWearable->setWearable(wearable, disable_camera_switch); + mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency + } + else + { + // Save changes if closing. + mEditWearable->saveChanges(); + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + } + } +} + +void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) +{ + // Set current outfit status (wearing/unsaved). + bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); + std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); + mOutfitStatus->setText(cof_status_str); + + if (name == "") + { + std::string outfit_name; + if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) + { + mCurrentLookName->setText(outfit_name); + return; + } + + std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; + mCurrentLookName->setText(getString(string_name)); + mOpenOutfitBtn->setEnabled(FALSE); + } + else + { + mCurrentLookName->setText(name); + // Can't just call update verbs since the folder link may not have been created yet. + mOpenOutfitBtn->setEnabled(TRUE); + } +} + +//static +void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) +{ + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); + + LLSidepanelAppearance *panel = dynamic_cast(data); + if (panel) + { + panel->showWearableEditPanel(wearable, disable_camera_switch); + } +} + +// Fetch currently worn items and only enable the New Look button after everything's been +// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. +void LLSidepanelAppearance::fetchInventory() +{ + + mNewOutfitBtn->setEnabled(false); + uuid_vec_t ids; + LLUUID item_id; + for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) + { + for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) + { + item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); + if(item_id.notNull()) + { + ids.push_back(item_id); + } + } + } + + if (isAgentAvatarValid()) + { + for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (!attachment) continue; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + if (!attached_object) continue; + const LLUUID& item_id = attached_object->getAttachmentItemID(); + if (item_id.isNull()) continue; + ids.push_back(item_id); + } + } + } + + LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); + fetch_worn->startFetch(); + // If no items to be fetched, done will never be triggered. + // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. + if (fetch_worn->isFinished()) + { + fetch_worn->done(); + } + else + { + gInventory.addObserver(fetch_worn); + } +} + +void LLSidepanelAppearance::inventoryFetched() +{ + mNewOutfitBtn->setEnabled(true); +} + +void LLSidepanelAppearance::setWearablesLoading(bool val) +{ + getChildView("wearables_loading_indicator")->setVisible( val); + getChildView("edit_outfit_btn")->setVisible( !val); + + if (!val) + { + // refresh outfit name when COF is already changed. + refreshCurrentOutfitName(); + } +} + +void LLSidepanelAppearance::showDefaultSubpart() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->showDefaultSubpart(); + } +} + +void LLSidepanelAppearance::updateScrollingPanelList() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->updateScrollingPanelList(); + } +} -- cgit v1.2.3 From 008e078bf5c7bd3b72eacecb200733715841afe4 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 10 Jan 2013 11:26:05 -0500 Subject: SH-3142: Added a debug option that circumvents the precache delay when teleporting. --- indra/newview/app_settings/settings.xml | 12 ++++++++++++ indra/newview/llviewerdisplay.cpp | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c817579e9e..4b93cef57f 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14170,5 +14170,17 @@ Value 0 + + DisablePrecacheDelayAfterTeleporting + + Comment + Disables the artificial delay in the viewer that precaches some incoming assets + Persist + 0 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index bd8377e281..25abf768cb 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -417,14 +417,21 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gAgent.setTeleportMessage( LLAgent::sTeleportProgressMessages["arriving"]); gTextureList.mForceResetTextureStats = TRUE; - gAgentCamera.resetView(TRUE, TRUE); - + gAgentCamera.resetView(TRUE, TRUE); + if ( gSavedSettings.getBOOL("DisablePrecacheDelayAfterTeleporting") ) + { + gViewerWindow->setShowProgress(FALSE); + gTeleportDisplay = FALSE; + gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); + } + break; case LLAgent::TELEPORT_ARRIVING: // Make the user wait while content "pre-caches" { F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / TELEPORT_ARRIVAL_DELAY); + if( arrival_fraction > 1.f ) { arrival_fraction = 1.f; -- cgit v1.2.3 From 5e7f36541b503bb2bd03e121c7ef13025f69065a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 10 Jan 2013 13:22:48 -0500 Subject: SH-3639 WIP - increased retry interval to allow for intermittent extremely slow responses --- indra/newview/llappearancemgr.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8b4adc8785..bf35382b7a 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -155,6 +155,11 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string } } +// We want this to be much lower (e.g. 15.0 is usually fine), bumping +// up for now until we can diagnose some cases of very slow response +// to requests. +const F32 DEFAULT_RETRY_AFTER_INTERVAL = 300.0; + class LLCallAfterInventoryBatchMgr: public LLEventTimer { public: @@ -162,7 +167,7 @@ public: const std::string& phase_name, nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, - F32 retry_after = 15.0, + F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, S32 max_retries = 2 ): mDstCatID(dst_cat_id), @@ -365,7 +370,7 @@ public: const std::string& phase_name, nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, - F32 retry_after = 15.0, + F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, S32 max_retries = 2 ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) @@ -403,7 +408,7 @@ public: const std::string& phase_name, nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, - F32 retry_after = 15.0, + F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, S32 max_retries = 2 ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) -- cgit v1.2.3 From 0f753a530b914370c7c89c198ee335833ac3e6a1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 11 Jan 2013 11:36:11 -0500 Subject: SH-3639 WIP - cleaned up some diagnostics and added fault injection ability. Disabled inventory retries for now. --- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/app_settings/settings.xml | 11 ++++++++ indra/newview/llappearancemgr.cpp | 43 ++++++++++++++++++++++++++----- indra/newview/llviewertexture.cpp | 2 +- indra/newview/llvoavatarself.cpp | 2 +- indra/newview/llvovolume.cpp | 3 ++- 6 files changed, 53 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4b93cef57f..32b2920279 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4326,6 +4326,17 @@ Value 0.0 + InventoryDebugSimulateLateOpRate + + Comment + Rate at which we simulate late-completing copy/link requests in some operations + Persist + 1 + Type + F32 + Value + 0.0 + InventoryDisplayInbox Comment diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index bf35382b7a..7edba842b8 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -49,6 +49,7 @@ #include "llvoavatarself.h" #include "llviewerregion.h" #include "llwearablelist.h" +#include "llsdutil.h" std::string self_av_string() { @@ -160,6 +161,11 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string // to requests. const F32 DEFAULT_RETRY_AFTER_INTERVAL = 300.0; +// Given the current back-end problems, retrying is causing too many +// duplicate items. Bump this back to 2 once they are resolved (or can +// leave at 0 if the operations become actually reliable). +const S32 DEFAULT_MAX_RETRIES = 0; + class LLCallAfterInventoryBatchMgr: public LLEventTimer { public: @@ -168,7 +174,7 @@ public: nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, - S32 max_retries = 2 + S32 max_retries = DEFAULT_MAX_RETRIES ): mDstCatID(dst_cat_id), mTrackingPhase(phase_name), @@ -228,6 +234,13 @@ public: void onOp(const LLUUID& src_id, const LLUUID& dst_id, LLTimer timestamp) { + if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateLateOpRate")) + { + llwarns << "Simulating late operation by punting handling to later" << llendl; + doAfterInterval(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,src_id,dst_id,timestamp), + mRetryAfter); + return; + } mPendingRequests--; F32 elapsed = timestamp.getElapsedTimeF32(); LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << elapsed << " seconds" << llendl; @@ -371,7 +384,7 @@ public: nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, - S32 max_retries = 2 + S32 max_retries = DEFAULT_MAX_RETRIES ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) { @@ -409,7 +422,7 @@ public: nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, - S32 max_retries = 2 + S32 max_retries = DEFAULT_MAX_RETRIES ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) { @@ -1653,6 +1666,7 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin continue; if (item->getIsLinkType()) { +#if 0 if (keep_items && keep_items->find(item) != LLInventoryModel::item_array_t::FAIL) { llinfos << "preserved item" << llendl; @@ -1661,7 +1675,10 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin { gInventory.purgeObject(item->getUUID()); } +#else + gInventory.purgeObject(item->getUUID()); } +#endif } } @@ -2981,13 +2998,27 @@ public: // Successful completion. /* virtual */ void result(const LLSD& content) { - llinfos << "request OK" << llendl; + LL_DEBUGS("Avatar") << "content: " << ll_pretty_print_sd(content) << LL_ENDL; + if (content["success"].asBoolean()) + { + LL_DEBUGS("Avatar") << "OK" << LL_ENDL; + } + else + { + onFailure(200); + } } // Error - /*virtual*/ void error(U32 status, const std::string& reason) + /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { llwarns << "appearance update request failed, status: " << status << " reason: " << reason << llendl; + LL_DEBUGS("Avatar") << "content: " << ll_pretty_print_sd(content) << LL_ENDL; + onFailure(status); + } + + void onFailure(U32 status) + { F32 seconds_to_wait; if (mRetryPolicy->shouldRetry(status,seconds_to_wait)) { @@ -3001,7 +3032,7 @@ public: { llwarns << "giving up after too many retries" << llendl; } - } + } LLPointer mRetryPolicy; }; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 5763fe307e..6c773368d3 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1161,7 +1161,7 @@ void LLViewerFetchedTexture::destroyTexture() return ; } - LL_DEBUGS("Avatar") << mID << llendl; + //LL_DEBUGS("Avatar") << mID << llendl; destroyGLTexture() ; mFullyLoaded = FALSE ; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 8f118f5110..9b43db7087 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2256,7 +2256,7 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() if (S32_MAX == ++report_sequence) report_sequence = 0; - LL_DEBUGS("Avatar") << avString() << "message: " << ll_pretty_print_sd(msg) << LL_ENDL; +// LL_DEBUGS("Avatar") << avString() << "message: " << ll_pretty_print_sd(msg) << LL_ENDL; std::string caps_url; if (getRegion()) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9078cce932..3831a13f41 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1146,9 +1146,10 @@ void LLVOVolume::sculpt() } else if (current_discard > MAX_DISCARD_LEVEL) { +#if 0 llwarns << "WARNING!!: Current discard of sculpty at " << current_discard << " is more than than allowed max of " << MAX_DISCARD_LEVEL << llendl; - +#endif // corrupted volume... don't update the sculpty return; } -- cgit v1.2.3 From 6390188ff35c47c93748c6fe3023d0bad219dea6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 14 Jan 2013 16:02:28 -0500 Subject: removed yet another logcontrol.xml commit --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 1259039010..64122bbb6c 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - Avatar -- cgit v1.2.3 From 85e993224cfc67830f9586c1767a860a1d0c0deb Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 14 Jan 2013 17:21:13 -0500 Subject: SH-3632:Undo change is now disabled after you save and return to the edit out fit panel (this behavior is now make sunshine-internal consistent with 3.4.1) --- indra/newview/llsidepanelappearance.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview') diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index f0844dd9a4..60ea675da4 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -410,6 +410,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearab { // Save changes if closing. mEditWearable->saveChanges(); + LLAppearanceMgr::getInstance()->setOutfitDirty( FALSE ); if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. { LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); -- cgit v1.2.3 From f34ef33e5ceb7f94ee8ca8586880d7be0e5ced82 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Tue, 15 Jan 2013 17:43:16 -0500 Subject: Fixed spelling error. --- indra/newview/llviewerinventory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 13e95c57cb..83f0486f01 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -211,7 +211,7 @@ public: // Returns true if a fetch was issued. bool fetch(); - // used to help make cacheing more robust - for example, if + // used to help make caching more robust - for example, if // someone is getting 4 packets but logs out after 3. the viewer // may never know the cache is wrong. enum { DESCENDENT_COUNT_UNKNOWN = -1 }; @@ -219,7 +219,7 @@ public: void setDescendentCount(S32 descendents) { mDescendentCount = descendents; } // file handling on the viewer. These are not meant for anything - // other than cacheing. + // other than caching. bool exportFileLocal(LLFILE* fp) const; bool importFileLocal(LLFILE* fp); void determineFolderType(); -- cgit v1.2.3 From f48011e4d04f744a93a18267bf7b78ec0b717b7c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 15 Jan 2013 20:30:20 -0500 Subject: SH-3339 WIP, SH-3645 WIP - added getActualDescription to obviate an obnoxious and widely-used workaround, re-create COF link after wearable edit to force COF version bump --- indra/newview/llappearancemgr.cpp | 49 +++++++++++++++++++++++++++-------- indra/newview/llappearancemgr.h | 3 +++ indra/newview/llpaneleditwearable.cpp | 22 +++++++++++++++- 3 files changed, 62 insertions(+), 12 deletions(-) mode change 100644 => 100755 indra/newview/llpaneleditwearable.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7edba842b8..d1ed82cc98 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -451,7 +451,7 @@ public: item->getLinkedUUID(), mDstCatID, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, new LLBoostFuncInventoryCallback( boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); @@ -1467,13 +1467,13 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL { case LLAssetType::AT_LINK: { - //LLInventoryItem::getDescription() is used for a new description + //getActualDescription() is used for a new description //to propagate ordering information saved in descriptions of links link_inventory_item(gAgent.getID(), item->getLinkedUUID(), dst_id, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, cb); break; } @@ -1718,7 +1718,7 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid, item->getLinkedUUID(), cat_uuid, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, cb); @@ -1910,7 +1910,7 @@ bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* it return true; } - return item1->LLInventoryItem::getDescription() < item2->LLInventoryItem::getDescription(); + return item1->getActualDescription() < item2->getActualDescription(); } void item_array_diff(LLInventoryModel::item_array_t& full_list, @@ -2486,6 +2486,33 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update return; } +LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& item_id) +{ + + LLInventoryModel::item_array_t result; + const LLViewerInventoryItem *vitem = + dynamic_cast(gInventory.getItem(item_id)); + + if (vitem) + { + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceMgr::getCOF(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH); + for (S32 i=0; igetLinkedUUID() == vitem->getLinkedUUID()) + { + result.put(item_array.get(i)); + } + } + } + return result; +} + void LLAppearanceMgr::removeAllClothesFromAvatar() { // Fetch worn clothes (i.e. the ones in COF). @@ -2644,7 +2671,7 @@ void LLAppearanceMgr::updateIsDirty() if (item1->getLinkedUUID() != item2->getLinkedUUID() || item1->getName() != item2->getName() || - item1->LLInventoryItem::getDescription() != item2->LLInventoryItem::getDescription()) + item1->getActualDescription() != item2->getActualDescription()) { mOutfitIsDirty = true; return; @@ -2855,8 +2882,8 @@ struct WearablesOrderComparator return true; } - const std::string& desc1 = item1->LLInventoryItem::getDescription(); - const std::string& desc2 = item2->LLInventoryItem::getDescription(); + const std::string& desc1 = item1->getActualDescription(); + const std::string& desc2 = item2->getActualDescription(); bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]); bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]); @@ -2914,7 +2941,7 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base if (!item) continue; std::string new_order_str = build_order_string((LLWearableType::EType)type, i); - if (new_order_str == item->LLInventoryItem::getDescription()) continue; + if (new_order_str == item->getActualDescription()) continue; item->setDescription(new_order_str); item->setComplete(TRUE); @@ -3179,8 +3206,8 @@ bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_b closer_to_body ? --it : ++it; LLViewerInventoryItem* swap_item = *it; if (!swap_item) return false; - std::string tmp = swap_item->LLInventoryItem::getDescription(); - swap_item->setDescription(item->LLInventoryItem::getDescription()); + std::string tmp = swap_item->getActualDescription(); + swap_item->setDescription(item->getActualDescription()); item->setDescription(tmp); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 31dbce892a..01a2d41458 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -132,6 +132,9 @@ public: void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer cb = NULL); void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer cb = NULL); + // Find COF entries referencing the given item. + LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id); + // Remove COF entries void removeCOFItemLinks(const LLUUID& item_id); void removeCOFLinksOfType(LLWearableType::EType type); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp old mode 100644 new mode 100755 index 606e78bd58..cca3b90329 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1065,7 +1065,27 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) } else { - gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); + LLInventoryModel::item_array_t links = + LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); + if (links.size()>0) + { + // Make another copy of this link, with the same description. + LLInventoryItem *item = links.get(0).get(); + if (item) + { + const std::string description = item->getIsLinkType() ? item->getActualDescription() : ""; + link_inventory_item( gAgent.getID(), + item->getLinkedUUID(), + LLAppearanceMgr::instance().getCOF(), + item->getName(), + description, + LLAssetType::AT_LINK, + NULL); + gInventory.purgeObject(item->getUUID()); + } + } + gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); + } } -- cgit v1.2.3 From 6a8947679cdb3a3d6ce9d4d175a2bdfed4b7eee3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 16 Jan 2013 11:34:42 -0500 Subject: SH-3645 WIP - preserve item order after wearable save as --- indra/newview/llagentwearables.cpp | 12 +++++--- indra/newview/llagentwearables.h | 6 ++-- indra/newview/llappearancemgr.cpp | 26 ++++++++++------- indra/newview/llappearancemgr.h | 4 +-- indra/newview/llinventorylistitem.cpp | 2 +- indra/newview/llpaneleditwearable.cpp | 55 +++++++++++++++++++++-------------- 6 files changed, 64 insertions(+), 41 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e79fda2459..70f4de8db2 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -210,12 +210,13 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal * @param todo Bitmask of actions to take on completion. */ LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback( - LLPointer cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo) : + LLPointer cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo, const std::string description) : mType(type), mIndex(index), mWearable(wearable), mTodo(todo), - mCB(cb) + mCB(cb), + mDescription(description) { llinfos << "constructor" << llendl; } @@ -255,7 +256,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i } if (mTodo & CALL_WEARITEM) { - LLAppearanceMgr::instance().addCOFItemLink(inv_item, true); + LLAppearanceMgr::instance().addCOFItemLink(inv_item, true, NULL, mDescription); } } @@ -455,6 +456,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, + const std::string& description, BOOL save_in_lost_and_found) { if (!isWearableCopyable(type, index)) @@ -486,7 +488,9 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, type, index, new_wearable, - addWearableToAgentInventoryCallback::CALL_WEARITEM); + addWearableToAgentInventoryCallback::CALL_WEARITEM, + description + ); LLUUID category_id; if (save_in_lost_and_found) { diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index a60fbc969b..5be4648636 100755 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -183,7 +183,7 @@ private: // Save Wearables //-------------------------------------------------------------------- public: - void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found); + void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, BOOL save_in_lost_and_found); void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE, const std::string new_name = ""); void saveAllWearables(); @@ -270,7 +270,8 @@ private: LLWearableType::EType type, U32 index, LLViewerWearable* wearable, - U32 todo = CALL_NONE); + U32 todo = CALL_NONE, + const std::string description = ""); virtual void fire(const LLUUID& inv_item); private: LLWearableType::EType mType; @@ -278,6 +279,7 @@ private: LLViewerWearable* mWearable; U32 mTodo; LLPointer mCB; + std::string mDescription; }; }; // LLAgentWearables diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d1ed82cc98..2b1e78c899 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1902,7 +1902,7 @@ static void remove_non_link_items(LLInventoryModel::item_array_t &items) } //a predicate for sorting inventory items by actual descriptions -bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* item2) +bool sort_by_actual_description(const LLInventoryItem* item1, const LLInventoryItem* item2) { if (!item1 || !item2) { @@ -2345,10 +2345,11 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor class LLDeferredCOFLinkObserver: public LLInventoryObserver { public: - LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer cb = NULL): + LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer cb = NULL, std::string description = ""): mItemID(item_id), mDoUpdate(do_update), - mCallback(cb) + mCallback(cb), + mDescription(description) { } @@ -2370,23 +2371,24 @@ public: private: const LLUUID mItemID; bool mDoUpdate; + std::string mDescription; LLPointer mCallback; }; // BAP - note that this runs asynchronously if the item is not already loaded from inventory. // Dangerous if caller assumes link will exist after calling the function. -void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer cb) +void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer cb, const std::string description) { const LLInventoryItem *item = gInventory.getItem(item_id); if (!item) { - LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb); + LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb, description); gInventory.addObserver(observer); } else { - addCOFItemLink(item, do_update, cb); + addCOFItemLink(item, do_update, cb, description); } } @@ -2409,8 +2411,9 @@ void modified_cof_cb(const LLUUID& inv_item) } } -void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer cb) +void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer cb, const std::string description) { + std::string link_description = description; const LLViewerInventoryItem *vitem = dynamic_cast(item); if (!vitem) { @@ -2474,12 +2477,15 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update { cb = new LLBoostFuncInventoryCallback(modified_cof_cb); } - const std::string description = vitem->getIsLinkType() ? vitem->getDescription() : ""; + if (vitem->getIsLinkType()) + { + link_description = vitem->getActualDescription(); + } link_inventory_item( gAgent.getID(), vitem->getLinkedUUID(), getCOF(), vitem->getName(), - description, + link_description, LLAssetType::AT_LINK, cb); } @@ -3240,7 +3246,7 @@ void LLAppearanceMgr::sortItemsByActualDescription(LLInventoryModel::item_array_ { if (items.size() < 2) return; - std::sort(items.begin(), items.end(), sort_by_description); + std::sort(items.begin(), items.end(), sort_by_actual_description); } //#define DUMP_CAT_VERBOSE diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 01a2d41458..bb4c9ee5a2 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -129,8 +129,8 @@ public: LLPointer cb); // Add COF link to individual item. - void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer cb = NULL); - void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer cb = NULL); + void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer cb = NULL, const std::string description = ""); + void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer cb = NULL, const std::string description = ""); // Find COF entries referencing the given item. LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id); diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp index 26041767fd..0601796436 100644 --- a/indra/newview/llinventorylistitem.cpp +++ b/indra/newview/llinventorylistitem.cpp @@ -231,7 +231,7 @@ const std::string& LLPanelInventoryListItemBase::getDescription() const { return LLStringUtil::null; } - return inv_item->getDescription(); + return inv_item->getActualDescription(); } time_t LLPanelInventoryListItemBase::getCreationDate() const diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index cca3b90329..fe4b55bb5a 100755 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1056,36 +1056,47 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) U32 index = gAgentWearables.getWearableIndex(mWearablePtr); std::string new_name = mNameEditor->getText(); + + // Find an existing link to this wearable's inventory item, if any, and its description field. + LLInventoryItem *link_item = NULL; + std::string description; + LLInventoryModel::item_array_t links = + LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); + if (links.size()>0) + { + link_item = links.get(0).get(); + if (link_item && link_item->getIsLinkType()) + { + description = link_item->getActualDescription(); + } + } + if (force_save_as) { - // the name of the wearable has changed, re-save wearable with new name - LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID()); - gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE); - mNameEditor->setText(mWearableItem->getName()); + // the name of the wearable has changed, re-save wearable with new name + LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID()); + gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, description, FALSE); + mNameEditor->setText(mWearableItem->getName()); } else { - LLInventoryModel::item_array_t links = - LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); - if (links.size()>0) + // Make another copy of this link, with the same + // description. This is needed to bump the COF + // version so texture baking service knows appearance has changed. + if (link_item) { - // Make another copy of this link, with the same description. - LLInventoryItem *item = links.get(0).get(); - if (item) - { - const std::string description = item->getIsLinkType() ? item->getActualDescription() : ""; - link_inventory_item( gAgent.getID(), - item->getLinkedUUID(), - LLAppearanceMgr::instance().getCOF(), - item->getName(), - description, - LLAssetType::AT_LINK, - NULL); - gInventory.purgeObject(item->getUUID()); - } + // Create new link + link_inventory_item( gAgent.getID(), + link_item->getLinkedUUID(), + LLAppearanceMgr::instance().getCOF(), + link_item->getName(), + description, + LLAssetType::AT_LINK, + NULL); + // Remove old link + gInventory.purgeObject(link_item->getUUID()); } gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); - } } -- cgit v1.2.3 From b3cbe35532b365e223df14921532a6e587695dec Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 18 Jan 2013 16:51:03 -0500 Subject: SH-3344 WIP - more texture load monitoring --- indra/newview/llvoavatar.cpp | 96 +++++++++++++++++++++++++++++++++++----- indra/newview/llvoavatar.h | 16 ++++--- indra/newview/llvoavatarself.cpp | 1 + 3 files changed, 96 insertions(+), 17 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index df0b8171a6..54bb755ad5 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2888,7 +2888,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { central_bake_version = getRegion()->getCentralBakeVersion(); } - addDebugText(llformat("mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); + bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); + addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + all_local_downloaded ? "L" : "l", + all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version)); } @@ -4001,10 +4005,48 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) return 6; } -//------------------------------------------------------------------------ -// LLVOAvatar::updateTextures() -//------------------------------------------------------------------------ -void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem) +bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) +{ + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep && imagep->getDiscardLevel()!=0) + { + return false; + } + } + return true; +} + +bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() +{ + std::set local_ids; + collectLocalTextureUUIDs(local_ids); + return allTexturesCompletelyDownloaded(local_ids); +} + +bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() +{ + std::set baked_ids; + collectLocalTextureUUIDs(baked_ids); + return allTexturesCompletelyDownloaded(baked_ids); +} + +S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) +{ + S32 result = 0; + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + result += imagep->getTextureMemory(); + } + } + return result; +} + +void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -4020,17 +4062,26 @@ void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); if (texture_dict->mIsLocalTexture) { - local_mem += imagep->getTextureMemory(); ids.insert(imagep->getID()); } } } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLViewerFetchedTexture *imagep = NULL; if (isIndexBakedTexture((ETextureIndex) texture_index)) { imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); if (imagep) { - baked_mem += imagep->getTextureMemory(); ids.insert(imagep->getID()); } } @@ -4040,15 +4091,36 @@ void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& ids.erase(IMG_INVISIBLE); } +void LLVOAvatar::collectTextureUUIDs(std::set& ids) +{ + collectLocalTextureUUIDs(ids); + collectBakedTextureUUIDs(ids); +} + void LLVOAvatar::releaseOldTextures() { S32 current_texture_mem = 0; // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" + std::set baked_texture_ids; + collectBakedTextureUUIDs(baked_texture_ids); + S32 new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); + + std::set local_texture_ids; + collectLocalTextureUUIDs(local_texture_ids); + S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); + std::set new_texture_ids; - S32 local_mem = 0, baked_mem = 0; - collectTextureUUIDs(new_texture_ids, local_mem, baked_mem); - LL_DEBUGS("Avatar") << getFullname() << " local_mem: " << local_mem << " baked_mem: " << baked_mem << llendl; + new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); + new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); + S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); + + S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); + LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + if (!isSelf() && new_total_mem > new_baked_mem) + { + llwarns << "extra local textures stored for non-self av" << llendl; + } for (std::set::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) { if (new_texture_ids.find(*it) == new_texture_ids.end()) @@ -4062,8 +4134,8 @@ void LLVOAvatar::releaseOldTextures() // This will allow the texture to be deleted if not in use. imagep->forceActive(); - // This resets the clock to being flagged as - // unused, preventing the texture from being + // This resets the clock to texture being flagged + // as unused, preventing the texture from being // deleted immediately. If other avatars or // objects are using it, it can still be flagged // no-delete by them. diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5b1395e566..2c64b9695e 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -124,17 +124,23 @@ protected: public: /*virtual*/ void updateGL(); /*virtual*/ LLVOAvatar* asAvatar(); - virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, + virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp); - virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); /*virtual*/ BOOL updateLOD(); - BOOL updateJointLODs(); - void updateLODRiggedAttachments( void ); + BOOL updateJointLODs(); + void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. - void collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem); + S32 totalTextureMemForUUIDS(std::set& ids); + bool allTexturesCompletelyDownloaded(std::set& ids); + bool allLocalTexturesCompletelyDownloaded(); + bool allBakedTexturesCompletelyDownloaded(); + void collectLocalTextureUUIDs(std::set& ids); + void collectBakedTextureUUIDs(std::set& ids); + void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); /*virtual*/ void updateTextures(); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 9b43db7087..19534bde59 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2066,6 +2066,7 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV << " ts: " << image->getTextureState() << " bl: " << image->getBoostLevel() << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there. + << " cl: " << (image->isFullyLoaded() && image->getDiscardLevel()==0) // "completely loaded" << " mvs: " << image->getMaxVirtualSize() << " mvsc: " << image->getMaxVirtualSizeResetCounter() << " mem: " << image->getTextureMemory(); -- cgit v1.2.3 From b40fad02de170b5da179cacc22f32f5f25ffd7cb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 22 Jan 2013 09:19:23 -0500 Subject: Add debug level logging for Avatar by default. Will need to turn this off before general release, but will give us better debugging info during testing --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - -- cgit v1.2.3 From e378effca36a0a6efd6036586c3259ba5367b012 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 22 Jan 2013 21:47:35 -0500 Subject: Added cof version information to DebugAvatarAppearanceMessage output --- indra/newview/llappearancemgr.cpp | 18 +++++++++++++++++- indra/newview/llappearancemgr.h | 7 +++++++ indra/newview/llvoavatar.cpp | 18 ++++++++++++++++-- 3 files changed, 40 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2b1e78c899..e7fa56466d 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1184,6 +1184,21 @@ S32 LLAppearanceMgr::getCOFVersion() const } } +S32 LLAppearanceMgr::getLastUpdateRequestCOFVersion() const +{ + return mLastUpdateRequestCOFVersion; +} + +S32 LLAppearanceMgr::getLastAppearanceUpdateCOFVersion() const +{ + return mLastAppearanceUpdateCOFVersion; +} + +void LLAppearanceMgr::setLastAppearanceUpdateCOFVersion(S32 new_val) +{ + mLastAppearanceUpdateCOFVersion = new_val; +} + const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink() { const LLUUID& current_outfit_cat = getCOF(); @@ -3293,7 +3308,8 @@ LLAppearanceMgr::LLAppearanceMgr(): mOutfitIsDirty(false), mOutfitLocked(false), mIsInUpdateAppearanceFromCOF(false), - mLastUpdateRequestCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + mLastUpdateRequestCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN), + mLastAppearanceUpdateCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index bb4c9ee5a2..1a1ca1ca7d 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -94,7 +94,14 @@ public: const LLUUID getCOF() const; S32 getCOFVersion() const; + // COF version of last viewer-initiated appearance update request. S32 mLastUpdateRequestCOFVersion; + S32 getLastUpdateRequestCOFVersion() const; + + // COF version of last appearance message received for self av. + S32 mLastAppearanceUpdateCOFVersion; + S32 getLastAppearanceUpdateCOFVersion() const; + void setLastAppearanceUpdateCOFVersion(S32 new_val); // Finds the folder link to the currently worn outfit const LLViewerInventoryItem *getBaseOutfitLink(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 54bb755ad5..83667c8c55 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2890,11 +2890,23 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); - addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + S32 curr_cof_version = -1; + S32 last_request_cof_version = -1; + S32 last_received_cof_version = -1; + if (isSelf()) + { + curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); + last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + } + + addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d - cof: %d req: %d rcv:%d", all_local_downloaded ? "L" : "l", all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, - mUseServerBakes, central_bake_version)); + mUseServerBakes, central_bake_version, + curr_cof_version, last_request_cof_version, last_received_cof_version + )); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) { @@ -6613,6 +6625,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << " last_update_request_cof_version " << last_update_request_cof_version << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; + LLAppearanceMgr::instance().setLastAppearanceUpdateCOFVersion(this_update_cof_version); + if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; -- cgit v1.2.3 From d56009af85cd3807dbaaf23e4f4ce9539a637602 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 11:04:23 -0500 Subject: fixes and updates to DebugAvatarAppearanceMessage status line --- indra/newview/llvoavatar.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 83667c8c55..6aad3c8918 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2890,23 +2890,20 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); - S32 curr_cof_version = -1; - S32 last_request_cof_version = -1; - S32 last_received_cof_version = -1; + std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + all_local_downloaded ? "L" : "l", + all_baked_downloaded ? "B" : "b", + mUseLocalAppearance, mIsEditingAppearance, + mUseServerBakes, central_bake_version); if (isSelf()) { - curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); - last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); - last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + S32 last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); + S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + debug_line += llformat(" - cof: %d req: %d rcv:%d", + curr_cof_version, last_request_cof_version, last_received_cof_version); } - - addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d - cof: %d req: %d rcv:%d", - all_local_downloaded ? "L" : "l", - all_baked_downloaded ? "B" : "b", - mUseLocalAppearance, mIsEditingAppearance, - mUseServerBakes, central_bake_version, - curr_cof_version, last_request_cof_version, last_received_cof_version - )); + addDebugText(debug_line); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) { @@ -4040,7 +4037,7 @@ bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() { std::set baked_ids; - collectLocalTextureUUIDs(baked_ids); + collectBakedTextureUUIDs(baked_ids); return allTexturesCompletelyDownloaded(baked_ids); } -- cgit v1.2.3 From 878e31dce2483cea0a1a38f076d4558c04ec9642 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 16:04:08 -0500 Subject: SH-3534 WIP - better encapsulation of mUseServerBakes --- indra/newview/llagent.cpp | 12 +++++------- indra/newview/llvoavatar.cpp | 7 ++++++- indra/newview/llvoavatar.h | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e15b4d071f..5796c34e25 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4286,12 +4286,6 @@ void LLAgent::requestLeaveGodMode() //----------------------------------------------------------------------------- void LLAgent::sendAgentSetAppearance() { - // FIXME DRANO - problems around new-style appearance in an old-style region. - // - does this get called? - // - need to change mUseServerBakes->FALSE in that case - // - need to call processAvatarAppearance as if server had returned this result? - // gAgentAvatarp->mUseServerBakes = FALSE; - if (gAgentQueryManager.mNumPendingQueries > 0) { return; @@ -4308,6 +4302,10 @@ void LLAgent::sendAgentSetAppearance() if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; + // At this point we have a complete appearance to send and are in a non-baking region. + // DRANO FIXME + //gAgentAvatarp->setIsUsingServerBakes(FALSE); + LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL; //dumpAvatarTEs( "sendAgentSetAppearance()" ); @@ -4408,7 +4406,7 @@ void LLAgent::sendAgentSetAppearance() } } -// llinfos << "Avatar XML num VisualParams transmitted = " << transmitted_params << llendl; + //llinfos << "Avatar XML num VisualParams transmitted = " << transmitted_params << llendl; sendReliableMessage(); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6aad3c8918..3d58c50eba 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6651,7 +6651,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - mUseServerBakes = (appearance_version > 0); + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(tec); @@ -7276,6 +7276,11 @@ void LLVOAvatar::bodySizeChanged() } } +BOOL LLVOAvatar::isUsingServerBakes() const +{ + return mUseServerBakes; +} + void LLVOAvatar::setIsUsingServerBakes(BOOL newval) { mUseServerBakes = newval; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2c64b9695e..c5064e4a52 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -653,7 +653,7 @@ public: // True if this avatar should fetch its baked textures via the new // appearance mechanism. - /*virtual*/ BOOL isUsingServerBakes() const { return mUseServerBakes; } + BOOL isUsingServerBakes() const; void setIsUsingServerBakes(BOOL newval); -- cgit v1.2.3 From 9f5e1d601c86e7036d3ecbae063ea637f0cdc7ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 18:31:21 -0500 Subject: SH-3779 WIP - fully parse appearance message before trying to do anything with it --- indra/newview/llvoavatar.cpp | 130 +++++++++++++++++++++++++++++++------------ indra/newview/llvoavatar.h | 2 + 2 files changed, 96 insertions(+), 36 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3d58c50eba..cb9b1aa5cc 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6574,6 +6574,91 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } } +struct LLAppearanceMessageContents +{ + LLAppearanceMessageContents(): + mAppearanceVersion(0), + mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + { + } + + LLTEContents mTEContents; + U8 mAppearanceVersion; + S32 mCOFVersion; + // For future use: + //U32 appearance_flags = 0; + std::vector mParams; +}; + +void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) +{ + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents); + + // Parse the AppearanceData field, if any. + if (mesgsys->has(_PREHASH_AppearanceData)) + { + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, contents.mAppearanceVersion, 0); + mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); + // For future use: + //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); + } + + // Parse visual params, if any. + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); + bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing + if( num_blocks > 1 && !drop_visual_params_debug) + { + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + + LLVisualParam* param = getFirstVisualParam(); + llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 + if (!param) + { + llwarns << "No visual params!" << llendl; + } + else + { + for( S32 i = 0; i < num_blocks; i++ ) + { + while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + { + param = getNextVisualParam(); + } + + if( !param ) + { + // more visual params supplied than expected - just process what we know about + break; + } + + U8 value; + mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); + F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); + contents.mParams.push_back(newWeight); + + param = getNextVisualParam(); + } + } + + const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + if (num_blocks != expected_tweakable_count) + { + llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + } + } + else + { + if (drop_visual_params_debug) + { + llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; + } + else + { + llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; + } + } +} + //----------------------------------------------------------------------------- // processAvatarAppearance() //----------------------------------------------------------------------------- @@ -6598,22 +6683,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) ESex old_sex = getSex(); - LLTEContents tec; - parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); + LLAppearanceMessageContents contents; + parseAppearanceMessage(mesgsys, contents); - U8 appearance_version = 0; - S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN; + U8 appearance_version = contents.mAppearanceVersion; + S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; - // For future use: - //U32 appearance_flags = 0; - - if (mesgsys->has(_PREHASH_AppearanceData)) - { - mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, appearance_version, 0); - mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, this_update_cof_version, 0); - // For future use: - //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); - } // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) @@ -6634,7 +6709,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } - // Check for stale update. if (isSelf() && (appearance_version>0) @@ -6653,7 +6727,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) setIsUsingServerBakes(appearance_version > 0); - applyParsedTEMessage(tec); + applyParsedTEMessage(contents.mTEContents); // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) @@ -6667,7 +6741,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } - // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. @@ -6680,9 +6753,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) gPipeline.markGLRebuild(this); // parse visual params - S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); - bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing - if( num_blocks > 1 && !drop_visual_params_debug) + S32 num_blocks = contents.mParams.size(); + if( num_blocks > 1) { LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; BOOL params_changed = FALSE; @@ -6696,7 +6768,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } else { - std::vector params_for_dump; for( S32 i = 0; i < num_blocks; i++ ) { while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT @@ -6710,14 +6781,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) break; } - U8 value; - mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); - F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); - params_for_dump.push_back(newWeight); + F32 newWeight = contents.mParams[i]; if (is_first_appearance_message || (param->getWeight() != newWeight)) { - //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl; params_changed = TRUE; if(is_first_appearance_message) { @@ -6732,7 +6799,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) param = getNextVisualParam(); } if (enable_verbose_dumps) - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", params_for_dump, tec); + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParams, contents.mTEContents); } if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } @@ -6764,14 +6831,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { // AvatarAppearance message arrived without visual params LL_DEBUGS("Avatar") << avString() << "no visual params" << LL_ENDL; - if (drop_visual_params_debug) - { - llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; - } - else - { - llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; - } const F32 LOADING_TIMEOUT_SECONDS = 60.f; // this isn't really a problem if we already have a non-default shape @@ -6802,7 +6861,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); -// llinfos << "processAvatarAppearance end " << mID << llendl; } // static diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c5064e4a52..784b08a782 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -70,6 +70,7 @@ class LLHUDNameTag; class LLHUDEffectSpiral; class LLTexGlobalColor; class LLViewerJoint; +struct LLAppearanceMessageContents; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLVOAvatar @@ -635,6 +636,7 @@ protected: **/ public: + void parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& msg); void processAvatarAppearance(LLMessageSystem* mesgsys); void hideSkirt(); void startAppearanceAnimation(); -- cgit v1.2.3 From 67c5d567932fd825dfcf8931af595c5df6dcdeb1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 24 Jan 2013 17:28:15 -0500 Subject: SH-3779 WIP - handling of appearance version param --- indra/newview/llvoavatar.cpp | 107 +++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 44 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cb9b1aa5cc..a76a15671c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1796,11 +1796,13 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) return setTETextureCore(te, uuid, url); } + llinfos << "get texture from host " << uuid << llendl; LLHost target_host = getObjectHost(); return setTETextureCore(te, uuid, target_host); } else { + llinfos << "get texture from other " << uuid << llendl; return setTETextureCore(te, uuid, LLHost::invalid); } } @@ -6577,17 +6579,18 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, struct LLAppearanceMessageContents { LLAppearanceMessageContents(): - mAppearanceVersion(0), + mAppearanceVersion(-1), mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { } LLTEContents mTEContents; - U8 mAppearanceVersion; + S32 mAppearanceVersion; S32 mCOFVersion; // For future use: //U32 appearance_flags = 0; - std::vector mParams; + std::vector mParamWeights; + std::vector mParams; }; void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) @@ -6597,7 +6600,10 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe // Parse the AppearanceData field, if any. if (mesgsys->has(_PREHASH_AppearanceData)) { - mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, contents.mAppearanceVersion, 0); + U8 av_u8; + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0); + contents.mAppearanceVersion = av_u8; + llinfos << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << llendl; mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); // For future use: //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); @@ -6634,7 +6640,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe U8 value; mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); - contents.mParams.push_back(newWeight); + contents.mParamWeights.push_back(newWeight); + contents.mParams.push_back(param); param = getNextVisualParam(); } @@ -6657,6 +6664,28 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; } } + + if (contents.mAppearanceVersion < 0) // not set explicitly, try to get from visual param. + { + LLVisualParam* appearance_version_param = getVisualParam(11000); + if (appearance_version_param) + { + std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) + { + S32 index = it - contents.mParams.begin(); + llinfos << "index: " << index << llendl; + S32 appearance_version = llround(contents.mParamWeights[index]); + contents.mAppearanceVersion = appearance_version; + llinfos << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + } + } + } + if (contents.mAppearanceVersion < 0) // still not set, go with 0. + { + contents.mAppearanceVersion = 0; + llinfos << "appversion set by default: " << contents.mAppearanceVersion << llendl; + } } //----------------------------------------------------------------------------- @@ -6725,6 +6754,17 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + S32 num_params = contents.mParamWeights.size(); + if (num_params <= 1) + { + // In this case, we have no reliable basis for knowing + // appearance version, which may cause us to look for baked + // textures in the wrong place and flag them as missing + // assets. + llinfos << "ignoring appearance message due to lack of params" << llendl; + return; + } + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(contents.mTEContents); @@ -6752,62 +6792,41 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) setCompositeUpdatesEnabled( FALSE ); gPipeline.markGLRebuild(this); - // parse visual params - S32 num_blocks = contents.mParams.size(); - if( num_blocks > 1) + // Apply visual params + if( num_params > 1) { - LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_params " << num_params << LL_ENDL; BOOL params_changed = FALSE; BOOL interp_params = FALSE; - LLVisualParam* param = getFirstVisualParam(); - llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 - if (!param) - { - llwarns << "No visual params!" << llendl; - } - else + for( S32 i = 0; i < num_params; i++ ) { - for( S32 i = 0; i < num_blocks; i++ ) + LLVisualParam* param = contents.mParams[i]; + F32 newWeight = contents.mParamWeights[i]; + + if (is_first_appearance_message || (param->getWeight() != newWeight)) { - while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + params_changed = TRUE; + if(is_first_appearance_message) { - param = getNextVisualParam(); + param->setWeight(newWeight, FALSE); } - - if( !param ) - { - // more visual params supplied than expected - just process what we know about - break; - } - - F32 newWeight = contents.mParams[i]; - - if (is_first_appearance_message || (param->getWeight() != newWeight)) + else { - params_changed = TRUE; - if(is_first_appearance_message) - { - param->setWeight(newWeight, FALSE); - } - else - { - interp_params = TRUE; - param->setAnimationTarget(newWeight, FALSE); - } + interp_params = TRUE; + param->setAnimationTarget(newWeight, FALSE); } - param = getNextVisualParam(); } - if (enable_verbose_dumps) - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParams, contents.mTEContents); } + if (enable_verbose_dumps) + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT - if (num_blocks != expected_tweakable_count) + if (num_params != expected_tweakable_count) { - llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + llinfos << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; } if (params_changed) -- cgit v1.2.3 From d2c3ee9624eed458320600860b9f84cca8b80607 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 25 Jan 2013 09:31:20 -0500 Subject: SH-3779 WIP - less verbose appearance dumps, keep appearance version visual param in sync with mUseServerBakes --- indra/newview/llvoavatar.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a76a15671c..dbc80c0217 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6695,7 +6695,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; - if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } + //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -6819,9 +6819,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } if (enable_verbose_dumps) + { dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + } - if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } + //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) @@ -6879,7 +6881,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); - if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); + //if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); } // static @@ -7355,12 +7357,24 @@ void LLVOAvatar::bodySizeChanged() BOOL LLVOAvatar::isUsingServerBakes() const { +#if 1 + // Sanity check - visual param for appearance version should match mUseServerBakes + LLVisualParam* appearance_version_param = getVisualParam(11000); + llassert(appearance_version_param); + F32 wt = appearance_version_param->getWeight(); + F32 expect_wt = mUseServerBakes ? 1.0 : 0.0; + llassert(is_approx_equal(wt,expect_wt)); +#endif + return mUseServerBakes; } void LLVOAvatar::setIsUsingServerBakes(BOOL newval) { mUseServerBakes = newval; + LLVisualParam* appearance_version_param = getVisualParam(11000); + llassert(appearance_version_param); + appearance_version_param->setWeight(newval ? 1.0 : 0.0, false); } // virtual -- cgit v1.2.3 From 438ceeb008b7c4eec0fc48894935289ca352fc65 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 25 Jan 2013 17:58:11 -0500 Subject: BUILDFIX: merge cleanup A couple of merge issues that caused the resulting code to not build. --- indra/newview/llworldmapview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index e96906b4bb..1940cf541e 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1317,7 +1317,7 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - gGL.translatef((F32)x * LLUI::sGLScaleFactor.mV[VX], (F32)y * LLUI::sGLScaleFactor.mV[VY], 0.f); + gGL.translatef((F32)x * LLUI::getScaleFactor().mV[VX], (F32)y * LLUI::getScaleFactor().mV[VY], 0.f); gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color); gGL.popMatrix(); -- cgit v1.2.3 From cbf7de453869749abd9fead08897d1e154bb0f5e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 28 Jan 2013 13:47:00 -0500 Subject: SH-3779 WIP, SH-3534 WIP - more bake-status tracking --- indra/newview/llagent.cpp | 20 +++++++++++++ indra/newview/llappearancemgr.cpp | 2 +- indra/newview/llvoavatar.cpp | 61 ++++++++++++++++++++++++++++++++++++++- indra/newview/llvoavatar.h | 3 ++ 4 files changed, 84 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5796c34e25..1760d4769a 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4305,6 +4305,26 @@ void LLAgent::sendAgentSetAppearance() // At this point we have a complete appearance to send and are in a non-baking region. // DRANO FIXME //gAgentAvatarp->setIsUsingServerBakes(FALSE); + S32 sb_count, host_count, both_count, neither_count; + gAgentAvatarp->bakedTextureOriginCounts(sb_count, host_count, both_count, neither_count); + if (both_count != 0 || neither_count != 0) + { + llwarns << "bad bake texture state " << sb_count << "," << host_count << "," << both_count << "," << neither_count << llendl; + } + if (sb_count != 0 && host_count == 0) + { + gAgentAvatarp->setIsUsingServerBakes(true); + } + else if (sb_count == 0 && host_count != 0) + { + gAgentAvatarp->setIsUsingServerBakes(false); + } + else if (sb_count + host_count > 0) + { + llwarns << "unclear baked texture state, not sending appearance" << llendl; + return; + } + LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL; //dumpAvatarTEs( "sendAgentSetAppearance()" ); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e7fa56466d..f1ba4ad453 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2032,7 +2032,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) } // DRANO really should wait for the appearance message to set this. // verify that deleting this line doesn't break anything. - gAgentAvatarp->setIsUsingServerBakes(gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()); + //gAgentAvatarp->setIsUsingServerBakes(gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()); //dumpCat(getCOF(),"COF, start"); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dbc80c0217..6efd1a27eb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2897,6 +2897,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version); + std::string origin_string = bakedTextureOriginInfo(); + debug_line += " [" + origin_string + "]"; if (isSelf()) { S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); @@ -4043,6 +4045,60 @@ bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() return allTexturesCompletelyDownloaded(baked_ids); } +void LLVOAvatar::bakedTextureOriginCounts(S32 &sb_count, // server-bake, has origin URL. + S32 &host_count, // host-based bake, has host. + S32 &both_count, // error - both host and URL set. + S32 &neither_count) // error - neither set. +{ + sb_count = host_count = both_count = neither_count = 0; + + std::set baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (std::set::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + bool has_url = false, has_host = false; + if (!imagep->getUrl().empty()) + { + has_url = true; + } + if (imagep->getTargetHost().isOk()) + { + has_host = true; + } + if (has_url && !has_host) sb_count++; + else if (has_host && !has_url) host_count++; + else if (has_host && has_url) both_count++; + else if (!has_host && !has_url) neither_count++; + } +} + +std::string LLVOAvatar::bakedTextureOriginInfo() +{ + std::string result; + + std::set baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (std::set::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + bool has_url = false, has_host = false; + if (!imagep->getUrl().empty()) + { + has_url = true; + } + if (imagep->getTargetHost().isOk()) + { + has_host = true; + } + if (has_url && !has_host) result += "u"; // server-bake texture with url + else if (has_host && !has_url) result += "h"; // old-style texture on sim + else if (has_host && has_url) result += "?"; // both origins? + else if (!has_host && !has_url) result += "n"; // no origin? + } + return result; +} + S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) { S32 result = 0; @@ -7363,7 +7419,10 @@ BOOL LLVOAvatar::isUsingServerBakes() const llassert(appearance_version_param); F32 wt = appearance_version_param->getWeight(); F32 expect_wt = mUseServerBakes ? 1.0 : 0.0; - llassert(is_approx_equal(wt,expect_wt)); + if (!is_approx_equal(wt,expect_wt)) + { + llwarns << "wt " << wt << " differs from expected " << expect_wt << llendl; + } #endif return mUseServerBakes; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 784b08a782..bdb477590f 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -139,6 +139,9 @@ public: bool allTexturesCompletelyDownloaded(std::set& ids); bool allLocalTexturesCompletelyDownloaded(); bool allBakedTexturesCompletelyDownloaded(); + void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, + S32 &both_count, S32 &neither_count); + std::string bakedTextureOriginInfo(); void collectLocalTextureUUIDs(std::set& ids); void collectBakedTextureUUIDs(std::set& ids); void collectTextureUUIDs(std::set& ids); -- cgit v1.2.3 From 97acaac84dd09959642595c1676b2ad72d3e0202 Mon Sep 17 00:00:00 2001 From: "prep@lindenlab.com" Date: Tue, 29 Jan 2013 14:53:00 -0600 Subject: SH3530: Removed extra ServerAppearanceUpdate() --- indra/newview/llsaveoutfitcombobtn.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llsaveoutfitcombobtn.cpp b/indra/newview/llsaveoutfitcombobtn.cpp index 59137f4ef7..32295cd96f 100644 --- a/indra/newview/llsaveoutfitcombobtn.cpp +++ b/indra/newview/llsaveoutfitcombobtn.cpp @@ -31,8 +31,6 @@ #include "llsidepanelappearance.h" #include "llsaveoutfitcombobtn.h" #include "llviewermenu.h" -#include "llagent.h" -#include "llviewerregion.h" static const std::string SAVE_BTN("save_btn"); static const std::string SAVE_FLYOUT_BTN("save_flyout_btn"); @@ -78,12 +76,8 @@ void LLSaveOutfitComboBtn::saveOutfit(bool as_new) if (panel_outfits_inventory) { panel_outfits_inventory->onSave(); - } - - if ( gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()) - { - LLAppearanceMgr::instance().requestServerAppearanceUpdate(); - } + } + //*TODO how to get to know when base outfit is updated or new outfit is created? } -- cgit v1.2.3 From 2f638300cd7e2c3ae675125ade037205403b5c54 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 10:14:16 -0500 Subject: SH-3780 WIP - more checking on appearance param values --- indra/newview/llvoavatar.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 90887b5861..8f5d2a6aad 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6703,26 +6703,36 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } } - if (contents.mAppearanceVersion < 0) // not set explicitly, try to get from visual param. + LLVisualParam* appearance_version_param = getVisualParam(11000); + S32 param_appearance_version = -1; + if (appearance_version_param) { - LLVisualParam* appearance_version_param = getVisualParam(11000); - if (appearance_version_param) + std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) { - std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); - if (it != contents.mParams.end()) - { - S32 index = it - contents.mParams.begin(); - llinfos << "index: " << index << llendl; - S32 appearance_version = llround(contents.mParamWeights[index]); - contents.mAppearanceVersion = appearance_version; - llinfos << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; - } + S32 index = it - contents.mParams.begin(); + llinfos << "index: " << index << llendl; + param_appearance_version = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mAppearanceVersion << llendl; } } + if ((contents.mAppearanceVersion) >= 0 && + (param_appearance_version >= 0) && + (contents.mAppearanceVersion != param_appearance_version)) + { + llwarns << "inconsistent appearance_version settings - field: " << + contents.mAppearanceVersion << ", param: " << param_appearance_version << llendl; + } + if (contents.mAppearanceVersion < 0 && + param_appearance_version >= 0) // not set explicitly, try to get from visual param. + { + contents.mAppearanceVersion = param_appearance_version; + LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { contents.mAppearanceVersion = 0; - llinfos << "appversion set by default: " << contents.mAppearanceVersion << llendl; + LL_DEBUGS("Avatar") << "appversion set by default: " << contents.mAppearanceVersion << llendl; } } -- cgit v1.2.3 From 3a7e3eacb86989c936cd6960cfa7434f3b8232fc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 13:56:05 -0500 Subject: SH-3800 WIP - flag mismatched expectations for baked texture origins --- indra/newview/llviewertexturelist.cpp | 34 ++++++++++++++++++++++++++++++++-- indra/newview/llvoavatar.cpp | 4 ++-- 2 files changed, 34 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index a65a90b9ab..4d79af5acc 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -374,7 +374,21 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } LLPointer imagep = findImage(new_id); - + + if (!imagep.isNull()) + { + LLViewerFetchedTexture *texture = imagep.get(); + if (texture->getUrl().empty()) + { + llwarns << "Requested texture " << new_id << " already exists but does not have a URL" << llendl; + } + else if (texture->getUrl() != url) + { + llwarns << "Requested texture " << new_id << " already exists with a different url, requested: " + << url << " current: " << texture->getUrl() << llendl; + } + + } if (imagep.isNull()) { switch(texture_type) @@ -436,7 +450,23 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, } LLPointer imagep = findImage(image_id); - + if (!imagep.isNull()) + { + LLViewerFetchedTexture *texture = imagep.get(); + if (request_from_host.isOk() && + !texture->getTargetHost().isOk()) + { + llwarns << "Requested texture " << image_id << " already exists but does not have a host" << llendl; + } + else if (request_from_host.isOk() && + texture->getTargetHost().isOk() && + request_from_host != texture->getTargetHost()) + { + llwarns << "Requested texture " << image_id << " already exists with a different target host, requested: " + << request_from_host << " current: " << texture->getTargetHost() << llendl; + } + + } if (imagep.isNull()) { imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8f5d2a6aad..c512837632 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1796,8 +1796,8 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) } else { - llinfos << "get texture from other " << uuid << llendl; - return setTETextureCore(te, uuid, LLHost::invalid); + llinfos << "ignoring texture in non-baked slot " << uuid << " - will use null " << LLUUID::null << llendl; + return setTETextureCore(te, LLUUID::null, LLHost::invalid); } } -- cgit v1.2.3 From c24c974cc6a7df3a1df7f7a24ad52275430b18dd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 18:23:31 -0500 Subject: SH-3800 WIP - logic to detect baked textures being sought in the wrong place, avoid querying textures for which we have no authoritative data where they live --- indra/newview/llviewerobject.cpp | 27 ++++-------------- indra/newview/llviewerobject.h | 3 +- indra/newview/llvoavatar.cpp | 59 +++++++++++++++++++++++++--------------- indra/newview/llvoavatar.h | 1 + indra/newview/llvoavatarself.cpp | 10 +++++++ 5 files changed, 55 insertions(+), 45 deletions(-) mode change 100644 => 100755 indra/newview/llviewerobject.cpp mode change 100644 => 100755 indra/newview/llviewerobject.h mode change 100644 => 100755 indra/newview/llvoavatarself.cpp (limited to 'indra/newview') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp old mode 100644 new mode 100755 index 15560be9ba..c4b370a4b4 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4034,32 +4034,15 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) } } - -S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ) -{ - S32 retval = 0; - if (uuid != getTE(te)->getID() || - uuid == LLUUID::null) - { - retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTextureFromUrl (url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - } - return retval; -} - -S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host) +S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) { + const LLUUID& uuid = image->getID(); S32 retval = 0; if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTexture(uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + mTEImages[te] = image; setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4082,7 +4065,9 @@ void LLViewerObject::changeTEImage(S32 index, LLViewerTexture* new_image) S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim - return setTETextureCore(te, uuid, LLHost::invalid); + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid); + return setTETextureCore(te,image); } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h old mode 100644 new mode 100755 index 889025962c..728d279c39 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -301,8 +301,7 @@ public: /*virtual*/ void setNumTEs(const U8 num_tes); /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid); - S32 setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host); - S32 setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ); + S32 setTETextureCore(const U8 te, LLViewerTexture *image); /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color); /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color); /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c512837632..f0986ac223 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1776,29 +1776,42 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } +LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) +{ + LLViewerFetchedTexture *result; + + const std::string url = getImageURL(te,uuid); + if (!url.empty()) + { + llinfos << "texture URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + } + else + { + llinfos << "get texture from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + } + return result; +} + // virtual S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) { - // The core setTETexture() method requests images, so we need - // to redirect certain avatar texture requests to different sims. - if (isIndexBakedTexture((ETextureIndex)te)) + if (!isIndexBakedTexture((ETextureIndex)te)) { - const std::string url = getImageURL(te,uuid); - if (!url.empty()) + if (!uuid.isNull()) { - llinfos << "texture URL " << url << llendl; - return setTETextureCore(te, uuid, url); + llinfos << "ignoring texture " << uuid << " in non-baked slot " << (S32)te << " - will use null " << llendl; } - - llinfos << "get texture from host " << uuid << llendl; - LLHost target_host = getObjectHost(); - return setTETextureCore(te, uuid, target_host); - } - else - { - llinfos << "ignoring texture in non-baked slot " << uuid << " - will use null " << LLUUID::null << llendl; - return setTETextureCore(te, LLUUID::null, LLHost::invalid); + return LLViewerObject::setTETexture(te, LLUUID::null); } + + LLViewerFetchedTexture *image = getBakedTextureImage(te,uuid); + llassert(image); + return setTETextureCore(te, image); } static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update"); @@ -6070,6 +6083,8 @@ void LLVOAvatar::updateMeshTextures() last_id_string = "A"; else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT) last_id_string = "D"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_INVISIBLE) + last_id_string = "I"; else last_id_string = "*"; bool is_ltda = layerset @@ -6750,12 +6765,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; - mFirstAppearanceMessageReceived = TRUE; - - LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID - << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; - ESex old_sex = getSex(); @@ -6831,6 +6840,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. + BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; + mFirstAppearanceMessageReceived = TRUE; + + LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID + << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; + if (is_first_appearance_message ) { onFirstTEMessageReceived(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bdb477590f..c14f18d00e 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -147,6 +147,7 @@ public: void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); /*virtual*/ void updateTextures(); + LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ void onShift(const LLVector4a& shift_vector); /*virtual*/ U32 getPartitionType() const; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp old mode 100644 new mode 100755 index 757d029513..aeac478d4e --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -759,6 +759,15 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, { U32 retval = LLVOAvatar::processUpdateMessage(mesgsys,user_data,block_num,update_type,dp); +#if 0 + // DRANO - it's not clear this does anything useful. If we wait + // until an appearance message has been received, we already have + // the texture ids. If we don't wait, we don't yet know where to + // look for baked textures, because we haven't received the + // appearance version data from the appearance message. This looks + // like an old optimization that's incompatible with server-side + // texture baking. + // FIXME DRANO - skipping in the case of !mFirstAppearanceMessageReceived prevents us from trying to // load textures before we know where they come from (ie, from baking service or not); // unknown impact on performance. @@ -783,6 +792,7 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, mInitialBakesLoaded = true; } +#endif return retval; } -- cgit v1.2.3 From 1518bc9f9add7812f0fa1f60d58c6b8f0ee462ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 18:43:30 -0500 Subject: SH-3800 WIP - avoid complaints about source of various standard textures - IMG_DEFAULT_AVATAR etc --- indra/newview/llvoavatar.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f0986ac223..5b4f31f91a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1778,21 +1778,32 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) { - LLViewerFetchedTexture *result; - - const std::string url = getImageURL(te,uuid); - if (!url.empty()) + LLViewerFetchedTexture *result = NULL; + + if (uuid == IMG_DEFAULT_AVATAR || + uuid == IMG_DEFAULT || + uuid == IMG_INVISIBLE) { - llinfos << "texture URL " << url << llendl; - result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + // Should already exist, don't need to find it on sim or baked-texture host. + result = gTextureList.findImage(uuid); } - else + + if (!result) { - llinfos << "get texture from host " << uuid << llendl; - LLHost host = getObjectHost(); - result = LLViewerTextureManager::getFetchedTexture( - uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + const std::string url = getImageURL(te,uuid); + if (!url.empty()) + { + llinfos << "texture URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + } + else + { + llinfos << "get texture from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + } } return result; } -- cgit v1.2.3 From 235f77b8c6194d7e6ab55a73dda4a31d19948323 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 09:13:31 -0500 Subject: SH-3800 WIP - reject appearance messages with contradictory appearance version info --- indra/newview/llagent.cpp | 1 + indra/newview/llviewertexturelist.cpp | 7 +++-- indra/newview/llvoavatar.cpp | 54 +++++++++++++++++++++-------------- 3 files changed, 39 insertions(+), 23 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 1760d4769a..06a7a2f5c3 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -816,6 +816,7 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) !gAgentAvatarp->isUsingServerBakes() && (mRegionp->getCentralBakeVersion()>0)) { + llinfos << "update requested due to region transition" << llendl; LLAppearanceMgr::instance().requestServerAppearanceUpdate(); } } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 4d79af5acc..6e7f6c9b32 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -384,8 +384,11 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } else if (texture->getUrl() != url) { - llwarns << "Requested texture " << new_id << " already exists with a different url, requested: " - << url << " current: " << texture->getUrl() << llendl; + // This is not an error as long as the images really match - + // e.g. could be two avatars wearing the same outfit. + LL_DEBUGS("Avatar") << "Requested texture " << new_id + << " already exists with a different url, requested: " << url + << " current: " << texture->getUrl() << llendl; } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5b4f31f91a..537bb70579 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6645,11 +6645,13 @@ struct LLAppearanceMessageContents { LLAppearanceMessageContents(): mAppearanceVersion(-1), + mParamAppearanceVersion(-1), mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { } LLTEContents mTEContents; S32 mAppearanceVersion; + S32 mParamAppearanceVersion; S32 mCOFVersion; // For future use: //U32 appearance_flags = 0; @@ -6730,7 +6732,6 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } LLVisualParam* appearance_version_param = getVisualParam(11000); - S32 param_appearance_version = -1; if (appearance_version_param) { std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); @@ -6738,28 +6739,38 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe { S32 index = it - contents.mParams.begin(); llinfos << "index: " << index << llendl; - param_appearance_version = llround(contents.mParamWeights[index]); - LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mAppearanceVersion << llendl; + contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << llendl; } } +} + +bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) +{ if ((contents.mAppearanceVersion) >= 0 && - (param_appearance_version >= 0) && - (contents.mAppearanceVersion != param_appearance_version)) + (contents.mParamAppearanceVersion >= 0) && + (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) { llwarns << "inconsistent appearance_version settings - field: " << - contents.mAppearanceVersion << ", param: " << param_appearance_version << llendl; + contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << llendl; + return false; + } + if (contents.mParamAppearanceVersion >= 0) // use visual param if available. + { + appearance_version = contents.mParamAppearanceVersion; + LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << appearance_version << llendl; } - if (contents.mAppearanceVersion < 0 && - param_appearance_version >= 0) // not set explicitly, try to get from visual param. + if (contents.mAppearanceVersion >= 0) { - contents.mAppearanceVersion = param_appearance_version; - LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + appearance_version = contents.mAppearanceVersion; + LL_DEBUGS("Avatar") << "appversion set by appearance_version field: " << appearance_version << llendl; } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { - contents.mAppearanceVersion = 0; - LL_DEBUGS("Avatar") << "appversion set by default: " << contents.mAppearanceVersion << llendl; + appearance_version = 0; + LL_DEBUGS("Avatar") << "appversion set by default: " << appearance_version << llendl; } + return true; } //----------------------------------------------------------------------------- @@ -6776,13 +6787,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - ESex old_sex = getSex(); LLAppearanceMessageContents contents; parseAppearanceMessage(mesgsys, contents); + if (enable_verbose_dumps) + { + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + } - U8 appearance_version = contents.mAppearanceVersion; + S32 appearance_version; + if (!resolve_appearance_version(contents, appearance_version)) + { + llwarns << "bad appearance version info, discarding" << llendl; + return; + } S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; @@ -6891,13 +6910,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } } - if (enable_verbose_dumps) - { - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); - } - - //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } - const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) { -- cgit v1.2.3 From 3f45d5472c603e9f034161b382ce42baa3a5b3c0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 10:53:02 -0500 Subject: SH-3800 WIP - log some of sent appearance msg info as well as received --- indra/newview/llagent.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++ indra/newview/llagent.h | 1 + indra/newview/llvoavatar.cpp | 8 ++++---- 3 files changed, 54 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 06a7a2f5c3..60873cf41f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4282,6 +4282,49 @@ void LLAgent::requestLeaveGodMode() sendReliableMessage(); } +extern void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); +extern std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix); + +// For debugging, trace agent state at times appearance message are sent out. +void LLAgent::dumpSentAppearance(const std::string& dump_prefix) +{ + std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + + LLAPRFile outfile; + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); + apr_file_t* file = outfile.getFileHandle(); + if (!file) + { + return; + } + else + { + LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << llendl; + } + + LLVisualParam* appearance_version_param = gAgentAvatarp->getVisualParam(11000); + if (appearance_version_param) + { + F32 value = appearance_version_param->getWeight(); + dump_visual_param(file, appearance_version_param, value); + } + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); + ++iter) + { + const ETextureIndex index = iter->first; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; + if (texture_dict->mIsBakedTexture) + { + LLTextureEntry* entry = gAgentAvatarp->getTE((U8) index); + const LLUUID& uuid = entry->getID(); + apr_file_printf( file, "\t\t\n", index, uuid.asString().c_str()); + } + } +} + //----------------------------------------------------------------------------- // sendAgentSetAppearance() //----------------------------------------------------------------------------- @@ -4378,6 +4421,12 @@ void LLAgent::sendAgentSetAppearance() // composites to false, and update mesh textures. if (textures_current) { + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + std::string dump_prefix = gAgentAvatarp->getFullname() + "_sent_appearance"; + if (enable_verbose_dumps) + { + dumpSentAppearance(dump_prefix); + } LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL; for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 693c123851..306dc2d99c 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -845,6 +845,7 @@ private: public: void sendMessage(); // Send message to this agent's region void sendReliableMessage(); + void dumpSentAppearance(const std::string& dump_prefix); void sendAgentSetAppearance(); void sendAgentDataUpdateRequest(); void sendAgentUserInfoRequest(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 537bb70579..1ea1b027f0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6617,7 +6617,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } else { - llinfos << "xmlfile write handle obtained : " << fullpath << llendl; + LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; } @@ -6758,18 +6758,18 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 if (contents.mParamAppearanceVersion >= 0) // use visual param if available. { appearance_version = contents.mParamAppearanceVersion; - LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << appearance_version << llendl; } if (contents.mAppearanceVersion >= 0) { appearance_version = contents.mAppearanceVersion; - LL_DEBUGS("Avatar") << "appversion set by appearance_version field: " << appearance_version << llendl; } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { appearance_version = 0; - LL_DEBUGS("Avatar") << "appversion set by default: " << appearance_version << llendl; } + LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion + << " param: " << contents.mParamAppearanceVersion + << " final: " << appearance_version << llendl; return true; } -- cgit v1.2.3 From 44308c110f0ed4323767493c409de5d0cf4f4c4f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 16:14:37 -0500 Subject: SH-3800 WIP - fixed bad case in appearance version computation --- indra/newview/llvoavatar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1ea1b027f0..cc1993fe40 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6747,6 +6747,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) { + appearance_version = -1; + if ((contents.mAppearanceVersion) >= 0 && (contents.mParamAppearanceVersion >= 0) && (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) @@ -6763,7 +6765,7 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 { appearance_version = contents.mAppearanceVersion; } - if (contents.mAppearanceVersion < 0) // still not set, go with 0. + if (appearance_version < 0) // still not set, go with 0. { appearance_version = 0; } @@ -6823,6 +6825,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } } + else + { + LL_DEBUGS("Avatar") << "appearance message received" << llendl; + } // Check for stale update. if (isSelf() -- cgit v1.2.3 From 8095292585088d277805e04d24d0d1450c5a3289 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 17:21:59 -0500 Subject: SH-3800 WIP - additional log line --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cc1993fe40..24dd0623ef 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6780,6 +6780,8 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { + LL_DEBUGS("Avatar") << starts << llendl; + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } -- cgit v1.2.3 From 197b12d93b01efaa545d80b6cb36989b825e029c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 17:22:50 -0500 Subject: SH-3800 WIP - additional log line --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 24dd0623ef..483bc25b33 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6780,7 +6780,7 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - LL_DEBUGS("Avatar") << starts << llendl; + LL_DEBUGS("Avatar") << "starts" << llendl; bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; -- cgit v1.2.3 From 0897a291d16dc4002765c5eb4ed9e310ee1ba4a4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 7 Feb 2013 11:14:37 -0500 Subject: SH-3852 WIP - small tweaks --- indra/newview/llagent.cpp | 3 ++- indra/newview/llviewerstats.cpp | 14 +++++++------- indra/newview/llviewerstats.h | 4 ++-- indra/newview/llvoavatarself.cpp | 15 +++++---------- 4 files changed, 16 insertions(+), 20 deletions(-) mode change 100644 => 100755 indra/newview/llviewerstats.cpp (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 60873cf41f..abd83485af 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4341,7 +4341,7 @@ void LLAgent::sendAgentSetAppearance() gAgentAvatarp->getPhases().stopPhase("process_initial_wearables_update"); gAgentAvatarp->getPhases().stopPhase("wear_inventory_category"); } - + gAgentAvatarp->sendAppearanceChangeMetrics(); if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; @@ -4409,6 +4409,7 @@ void LLAgent::sendAgentSetAppearance() // IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures if (!gAgentAvatarp->isTextureDefined(texture_index, 0)) { + LL_DEBUGS("Avatar") << "texture not current for baked " << (S32)baked_index << " local " << (S32)texture_index << llendl; textures_current = FALSE; break; } diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp old mode 100644 new mode 100755 index 1627870262..bccd4c1a60 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -733,23 +733,23 @@ void send_stats() LLHTTPClient::post(url, body, new ViewerStatsResponder()); } -LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) +LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); if (iter == mPhaseMap.end()) { - LLFrameTimer timer; + LLTimer timer; mPhaseMap[phase_name] = timer; } - LLFrameTimer& timer = mPhaseMap[phase_name]; + LLTimer& timer = mPhaseMap[phase_name]; return timer; } void LLViewerStats::PhaseMap::startPhase(const std::string& phase_name) { - LLFrameTimer& timer = getPhaseTimer(phase_name); + LLTimer& timer = getPhaseTimer(phase_name); lldebugs << "startPhase " << phase_name << llendl; - timer.unpause(); + timer.start(); } void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) @@ -763,7 +763,7 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); } lldebugs << "stopPhase " << phase_name << llendl; - iter->second.pause(); + iter->second.stop(); } else { @@ -783,7 +783,7 @@ void LLViewerStats::PhaseMap::stopAllPhases() recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); } lldebugs << "stopPhase (all) " << phase_name << llendl; - iter->second.pause(); + iter->second.stop(); } } diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index e02a4ccdc7..bb11e8c5be 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -279,7 +279,7 @@ public: // Phase tracking (originally put in for avatar rezzing), tracking // progress of active/completed phases for activities like outfit changing. - typedef std::map phase_map_t; + typedef std::map phase_map_t; typedef std::map phase_stats_t; class PhaseMap { @@ -288,7 +288,7 @@ public: static phase_stats_t sStats; public: PhaseMap(); - LLFrameTimer& getPhaseTimer(const std::string& phase_name); + LLTimer& getPhaseTimer(const std::string& phase_name); void startPhase(const std::string& phase_name); void stopPhase(const std::string& phase_name); void stopAllPhases(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index aeac478d4e..a1c7cf97ff 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1462,7 +1462,9 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - if (getLocalDiscardLevel(*local_tex_iter, wearable_index) > (S32)(desired_tex_discard_level)) + S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index); + if ((local_discard_level > (S32)(desired_tex_discard_level)) || + (local_discard_level < 0 )) { return FALSE; } @@ -2177,20 +2179,13 @@ LLSD LLVOAvatarSelf::metricsData() // runway - add region info LLSD result; result["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); - std::vector rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); - result["nearby"] = LLSD::emptyMap(); - for (S32 i=0; i Date: Thu, 7 Feb 2013 19:14:00 -0500 Subject: SH-3852 WIP - track per-timer stats --- indra/newview/llagent.cpp | 6 +- indra/newview/llagentwearables.cpp | 2 +- indra/newview/llagentwearablesfetch.cpp | 4 +- indra/newview/llappearancemgr.cpp | 2 - indra/newview/llappviewer.cpp | 6 ++ indra/newview/llviewerstats.cpp | 38 +++++------- indra/newview/llviewerstats.h | 4 +- indra/newview/llvoavatar.cpp | 101 ++++++++++++++++++++++++++++++-- indra/newview/llvoavatar.h | 12 ++-- indra/newview/llvoavatarself.cpp | 35 +++++++---- indra/newview/llvoavatarself.h | 7 ++- 11 files changed, 164 insertions(+), 53 deletions(-) mode change 100644 => 100755 indra/newview/llappviewer.cpp (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index abd83485af..c86b75791d 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4338,12 +4338,10 @@ void LLAgent::sendAgentSetAppearance() if (!gAgentWearables.changeInProgress()) { // Change is fully resolved, can close some open phases. - gAgentAvatarp->getPhases().stopPhase("process_initial_wearables_update"); - gAgentAvatarp->getPhases().stopPhase("wear_inventory_category"); + gAgentAvatarp->stopPhase("process_initial_wearables_update"); + gAgentAvatarp->stopPhase("wear_inventory_category"); } - gAgentAvatarp->sendAppearanceChangeMetrics(); - if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; // At this point we have a complete appearance to send and are in a non-baking region. diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 70f4de8db2..0c79ac0ba3 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -797,7 +797,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs if (isAgentAvatarValid()) { //gAgentAvatarp->clearPhases(); // reset phase timers for outfit loading. - gAgentAvatarp->getPhases().startPhase("process_initial_wearables_update"); + gAgentAvatarp->startPhase("process_initial_wearables_update"); gAgentAvatarp->outputRezTiming("Received initial wearables update"); } diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 2d622b380a..6f1658d1cc 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -80,7 +80,7 @@ LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().startPhase("initial_wearables_fetch"); + gAgentAvatarp->startPhase("initial_wearables_fetch"); gAgentAvatarp->outputRezTiming("Initial wearables fetch started"); } } @@ -99,7 +99,7 @@ void LLInitialWearablesFetch::done() doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this)); if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().stopPhase("initial_wearables_fetch"); + gAgentAvatarp->stopPhase("initial_wearables_fetch"); gAgentAvatarp->outputRezTiming("Initial wearables fetch done"); } } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index f1ba4ad453..1a6d49c7a2 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2006,8 +2006,6 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) llwarns << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << llendl; return; } - - LLVOAvatar::ScopedPhaseSetter(gAgentAvatarp,"update_appearance_from_cof"); BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp old mode 100644 new mode 100755 index 03b11939a9..2ee325a09e --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3612,6 +3612,12 @@ void LLAppViewer::requestQuit() // Try to send metrics back to the grid metricsSend(!gDisconnected); + + // Try to send last batch of avatar rez metrics. + if (!gDisconnected && isAgentAvatarValid()) + { + gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. + } LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index bccd4c1a60..28c6b59391 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -733,6 +733,10 @@ void send_stats() LLHTTPClient::post(url, body, new ViewerStatsResponder()); } +LLViewerStats::PhaseMap::PhaseMap() +{ +} + LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); @@ -761,32 +765,26 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) { // Going from started to paused state - record stats. recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); + iter->second.stop(); } - lldebugs << "stopPhase " << phase_name << llendl; - iter->second.stop(); - } - else - { - lldebugs << "stopPhase " << phase_name << " is not started, no-op" << llendl; } } -void LLViewerStats::PhaseMap::stopAllPhases() +bool LLViewerStats::PhaseMap::getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed) { - for (phase_map_t::iterator iter = mPhaseMap.begin(); - iter != mPhaseMap.end(); ++iter) + phase_map_t::iterator iter = mPhaseMap.find(phase_name); + if (iter != mPhaseMap.end()) { - const std::string& phase_name = iter->first; - if (iter->second.getStarted()) - { - // Going from started to paused state - record stats. - recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); - } - lldebugs << "stopPhase (all) " << phase_name << llendl; - iter->second.stop(); + elapsed = iter->second.getElapsedTimeF32(); + completed = !iter->second.getStarted(); + return true; + } + else + { + return false; } } - + void LLViewerStats::PhaseMap::clearPhases() { lldebugs << "clearPhases" << llendl; @@ -810,10 +808,6 @@ LLSD LLViewerStats::PhaseMap::dumpPhases() //static LLViewerStats::phase_stats_t LLViewerStats::PhaseMap::sStats; -LLViewerStats::PhaseMap::PhaseMap() -{ -} - // static LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) { diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index bb11e8c5be..084f5ae7d1 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -289,13 +289,15 @@ public: public: PhaseMap(); LLTimer& getPhaseTimer(const std::string& phase_name); + bool getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed); void startPhase(const std::string& phase_name); void stopPhase(const std::string& phase_name); - void stopAllPhases(); void clearPhases(); LLSD dumpPhases(); static StatsAccumulator& getPhaseStats(const std::string& phase_name); static void recordPhaseStat(const std::string& phase_name, F32 value); + phase_map_t::iterator begin() { return mPhaseMap.begin(); } + phase_map_t::iterator end() { return mPhaseMap.end(); } }; private: diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 483bc25b33..f7e1944660 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5887,30 +5887,123 @@ void LLVOAvatar::updateRezzedStatusTimers() if (is_cloud && !was_cloud) { // start cloud timer. - getPhases().startPhase("cloud"); + startPhase("cloud"); } else if (was_cloud && !is_cloud) { // stop cloud timer, which will capture stats. - getPhases().stopPhase("cloud"); + stopPhase("cloud"); } // Non-cloud-or-gray to cloud-or-gray if (is_cloud_or_gray && !was_cloud_or_gray) { // start cloud-or-gray timer. - getPhases().startPhase("cloud-or-gray"); + startPhase("cloud-or-gray"); } else if (was_cloud_or_gray && !is_cloud_or_gray) { // stop cloud-or-gray timer, which will capture stats. - getPhases().stopPhase("cloud-or-gray"); + stopPhase("cloud-or-gray"); } mLastRezzedStatus = rez_status; } } +void LLVOAvatar::clearPhases() +{ + getPhases().clearPhases(); +} + +void LLVOAvatar::startPhase(const std::string& phase_name) +{ + getPhases().startPhase(phase_name); +} + +void LLVOAvatar::logPendingPhases() +{ + for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); + it != getPhases().end(); + ++it) + { + const std::string& phase_name = it->first; + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + llwarns << "ignoring " << phase_name << llendl; + } + } + } +} + +//static +void LLVOAvatar::logPendingPhasesAllAvatars() +{ + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + LLVOAvatar* inst = (LLVOAvatar*) *iter; + if( inst->isDead() ) + { + continue; + } + inst->logPendingPhases(); + } +} + +void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed) +{ + LLSD record; + record["timer_name"] = phase_name; + record["agent_id"] = gAgent.getID(); + record["elapsed"] = elapsed; + record["completed"] = completed; + U32 grid_x(0), grid_y(0); + if (getRegion()) + { + record["cbv"] = getRegion()->getCentralBakeVersion(); + grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); + } + record["grid_x"] = LLSD::Integer(grid_x); + record["grid_y"] = LLSD::Integer(grid_y); + record["is_using_server_bake"] = isUsingServerBakes(); + record["is_self"] = isSelf(); + + LL_DEBUGS("Avatar") << "record\n" << ll_pretty_print_sd(record) << llendl; +} + +void LLVOAvatar::stopPhase(const std::string& phase_name) +{ + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + getPhases().stopPhase(phase_name); + completed = true; + + } + else + { + llwarns << "stop when stopped already for " << phase_name << llendl; + } + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + llwarns << "stop when not started for " << phase_name << llendl; + } +} + // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c14f18d00e..8babcc3ef3 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -292,12 +292,16 @@ public: S32 mLastRezzedStatus; - LLViewerStats::PhaseMap& getPhases() - { - return mPhases; - } + + void startPhase(const std::string& phase_name); + void stopPhase(const std::string& phase_name); + void clearPhases(); + void logPendingPhases(); + static void logPendingPhasesAllAvatars(); + void logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed); protected: + LLViewerStats::PhaseMap& getPhases() { return mPhases; } BOOL updateIsFullyLoaded(); BOOL processFullyLoadedChange(bool loading); void updateRuthTimer(bool loading); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index a1c7cf97ff..3ae4f9bc71 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -81,7 +81,7 @@ void selfStartPhase(const std::string& phase_name) { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().startPhase(phase_name); + gAgentAvatarp->startPhase(phase_name); } } @@ -89,7 +89,7 @@ void selfStopPhase(const std::string& phase_name) { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().stopPhase(phase_name); + gAgentAvatarp->stopPhase(phase_name); } } @@ -97,19 +97,11 @@ void selfClearPhases() { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().clearPhases(); + gAgentAvatarp->clearPhases(); gAgentAvatarp->mLastRezzedStatus = -1; } } -void selfStopAllPhases() -{ - if (isAgentAvatarValid()) - { - gAgentAvatarp->getPhases().stopAllPhases(); - } -} - using namespace LLAvatarAppearanceDefines; /********************************************************************************* @@ -222,6 +214,7 @@ void LLVOAvatarSelf::initInstance() } //doPeriodically(output_self_av_texture_diagnostics, 30.0); + doPeriodically(boost::bind(&LLVOAvatarSelf::updateAvatarRezMetrics, this, false), 5.0); } // virtual @@ -2238,6 +2231,22 @@ private: volatile bool & mReportingStarted; }; +bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) +{ + F32 send_period = 30.0; + + if (force_send || mTimeSinceLastRezMessage.getElapsedTimeF32() > send_period) + { + // Stats for completed phases have been getting logged as they + // complete. This will give us stats for any timers that + // haven't finished as of the metric's being sent. + LLVOAvatar::logPendingPhasesAllAvatars(); + sendAppearanceChangeMetrics(); + } + + return false; +} + void LLVOAvatarSelf::sendAppearanceChangeMetrics() { // gAgentAvatarp->stopAllPhases(); @@ -2251,7 +2260,9 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() msg["sequence"] = report_sequence; msg["initial"] = !reporting_started; msg["break"] = false; - + msg["duration"] = mTimeSinceLastRezMessage.getElapsedTimeF32(); + mTimeSinceLastRezMessage.reset(); + // Update sequence number if (S32_MAX == ++report_sequence) report_sequence = 0; diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 74888e470d..857c482f93 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -379,6 +379,10 @@ public: LLUUID mAvatarID; LLAvatarAppearanceDefines::ETextureIndex mIndex; }; + + LLTimer mTimeSinceLastRezMessage; + bool updateAvatarRezMetrics(bool force_send); + void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); } void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); } void outputRezDiagnostics() const; @@ -416,7 +420,8 @@ BOOL isAgentAvatarValid(); void selfStartPhase(const std::string& phase_name); void selfStopPhase(const std::string& phase_name); -void selfStopAllPhases(); void selfClearPhases(); +void update_avatar_rez_metrics(bool force_send); + #endif // LL_VO_AVATARSELF_H -- cgit v1.2.3 From 3bab0b6153b77c2b428e5f7d2a767b77a55fef68 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 Feb 2013 15:51:01 -0500 Subject: SH-3852 WIP - bucketize stats by agent_id, grid coordinates and various other criteria --- indra/newview/llvoavatar.cpp | 14 ++++++- indra/newview/llvoavatarself.cpp | 89 +++++++++++++++++++++++++++++++++++++--- indra/newview/llvoavatarself.h | 6 ++- 3 files changed, 99 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f7e1944660..e911e01420 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -99,6 +99,7 @@ #include "lldebugmessagebox.h" #include "llsdutil.h" +#include "llsdserialize.h" extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; @@ -5964,12 +5965,13 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse LLSD record; record["timer_name"] = phase_name; record["agent_id"] = gAgent.getID(); + record["avatar_id"] = getID(); record["elapsed"] = elapsed; record["completed"] = completed; U32 grid_x(0), grid_y(0); if (getRegion()) { - record["cbv"] = getRegion()->getCentralBakeVersion(); + record["central_bake_version"] = getRegion()->getCentralBakeVersion(); grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); } record["grid_x"] = LLSD::Integer(grid_x); @@ -5977,7 +5979,15 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["is_using_server_bake"] = isUsingServerBakes(); record["is_self"] = isSelf(); - LL_DEBUGS("Avatar") << "record\n" << ll_pretty_print_sd(record) << llendl; + + std::ostringstream ostr; + ostr << LLSDNotationStreamer(record); + LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; + + if (isAgentAvatarValid()) + { + gAgentAvatarp->addMetricsTimerRecord(record); + } } void LLVOAvatar::stopPhase(const std::string& phase_name) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 3ae4f9bc71..4461ba32c5 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -62,6 +62,7 @@ #include "llvovolume.h" #include "llsdutil.h" #include "llstartup.h" +#include "llsdserialize.h" #if LL_MSVC // disable boost::lexical_cast warning @@ -2166,6 +2167,8 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const return text; } + +#if 0 // Dump avatar metrics data. LLSD LLVOAvatarSelf::metricsData() { @@ -2178,10 +2181,10 @@ LLSD LLVOAvatarSelf::metricsData() result["timers"]["invisible"] = mInvisibleTimer.getElapsedTimeF32(); result["timers"]["fully_loaded"] = mFullyLoadedTimer.getElapsedTimeF32(); result["startup"] = LLStartUp::getPhases().dumpPhases(); - result["phases"] = getPhases().dumpPhases(); return result; } +#endif class ViewerAppearanceChangeMetricsResponder: public LLCurl::Responder { @@ -2241,19 +2244,65 @@ bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) // complete. This will give us stats for any timers that // haven't finished as of the metric's being sent. LLVOAvatar::logPendingPhasesAllAvatars(); - sendAppearanceChangeMetrics(); + sendViewerAppearanceChangeMetrics(); } return false; } -void LLVOAvatarSelf::sendAppearanceChangeMetrics() +void LLVOAvatarSelf::addMetricsTimerRecord(const LLSD& record) +{ + mPendingTimerRecords.push_back(record); +} + +bool operator<(const LLSD& a, const LLSD& b) +{ + std::ostringstream aout, bout; + aout << LLSDNotationStreamer(a); + bout << LLSDNotationStreamer(b); + return aout.str() < bout.str(); + +} + +// Given a vector of LLSD records, return an LLSD array of bucketed stats for val_field. +LLSD summarize_by_buckets(std::vector in_records, + std::vector by_fields, + std::string& val_field) +{ + LLSD result = LLSD::emptyArray(); + std::map accum; + for (std::vector::iterator in_record_iter = in_records.begin(); + in_record_iter != in_records.end(); ++in_record_iter) + { + LLSD& record = *in_record_iter; + LLSD key; + for (std::vector::iterator field_iter = by_fields.begin(); + field_iter != by_fields.end(); ++field_iter) + { + const std::string& field = *field_iter; + key[field] = record[field]; + LLViewerStats::StatsAccumulator& stats = accum[key]; + F32 value = record[val_field].asReal(); + stats.push(value); + } + } + for (std::map::iterator accum_it = accum.begin(); + accum_it != accum.end(); ++accum_it) + { + LLSD out_record = accum_it->first; + out_record["stats"] = accum_it->second.getData(); + result.append(out_record); + } + return result; +} + +void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() { // gAgentAvatarp->stopAllPhases(); static volatile bool reporting_started(false); static volatile S32 report_sequence(0); - LLSD msg = metricsData(); + LLSD msg; // = metricsData(); msg["message"] = "ViewerAppearanceChangeMetrics"; msg["session_id"] = gAgentSessionID; msg["agent_id"] = gAgentID; @@ -2261,8 +2310,35 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() msg["initial"] = !reporting_started; msg["break"] = false; msg["duration"] = mTimeSinceLastRezMessage.getElapsedTimeF32(); - mTimeSinceLastRezMessage.reset(); - + + // Status of our own rezzing. + msg["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); + + // Status of all nearby avs including ourself. + msg["nearby"] = LLSD::emptyArray(); + std::vector rez_counts; + LLVOAvatar::getNearbyRezzedStats(rez_counts); + for (S32 rez_stat=0; rez_stat < rez_counts.size(); ++rez_stat) + { + std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); + msg["nearby"][rez_status_name] = rez_counts[rez_stat]; + } + + // std::vector bucket_fields("timer_name","agent_id","is_self","grid_x","grid_y","is_using_server_bake"); + std::vector by_fields; + by_fields.push_back("timer_name"); + by_fields.push_back("agent_id"); + by_fields.push_back("completed"); + by_fields.push_back("grid_x"); + by_fields.push_back("grid_y"); + by_fields.push_back("is_using_server_bake"); + by_fields.push_back("is_self"); + by_fields.push_back("cbv"); + LLSD summary = summarize_by_buckets(mPendingTimerRecords, by_fields, std::string("elapsed")); + msg["timers"] = summary; + + mPendingTimerRecords.clear(); + // Update sequence number if (S32_MAX == ++report_sequence) report_sequence = 0; @@ -2282,6 +2358,7 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() new ViewerAppearanceChangeMetricsResponder(report_sequence, report_sequence, reporting_started)); + mTimeSinceLastRezMessage.reset(); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 857c482f93..04b0fb760c 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -382,6 +382,9 @@ public: LLTimer mTimeSinceLastRezMessage; bool updateAvatarRezMetrics(bool force_send); + + std::vector mPendingTimerRecords; + void addMetricsTimerRecord(const LLSD& record); void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); } void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); } @@ -398,8 +401,7 @@ public: void dumpAllTextures() const; const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD - LLSD metricsData(); - void sendAppearanceChangeMetrics(); // send data associated with completing a change. + void sendViewerAppearanceChangeMetrics(); // send data associated with completing a change. private: LLFrameTimer mDebugSelfLoadTimer; F32 mDebugTimeWearablesLoaded; -- cgit v1.2.3 From f3e407ae3f05e897de0b0d7daea4d31f09e73048 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 13:50:26 -0500 Subject: SH-3852 WIP - removed avatar metrics from ViewerAssetMetrics --- indra/newview/llappviewer.cpp | 1 - indra/newview/llappviewerwin32.cpp | 2 +- indra/newview/llviewerassetstats.cpp | 42 +--------------------- indra/newview/llviewerassetstats.h | 10 ------ indra/newview/llviewerstats.cpp | 25 ------------- indra/newview/llviewerstats.h | 3 -- indra/newview/llvoavatar.cpp | 4 +-- indra/newview/llvoavatarself.cpp | 22 ++++++++---- indra/newview/tests/llviewerassetstats_test.cpp | 47 ++++++------------------- 9 files changed, 29 insertions(+), 127 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2ee325a09e..9a5010c781 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4410,7 +4410,6 @@ void LLAppViewer::idle() // The 5-second interval is nice for this purpose. If the object debug // bit moves or is disabled, please give this a suitable home. LLViewerAssetStatsFF::record_fps_main(gFPSClamped); - LLViewerAssetStatsFF::record_avatar_stats(); } } diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 8326be433e..82b93b52a2 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -92,7 +92,7 @@ void nvapi_error(NvAPI_Status status) llwarns << szDesc << llendl; //should always trigger when asserts are enabled - llassert(status == NVAPI_OK); + //llassert(status == NVAPI_OK); } // Create app mutex creates a unique global windows object. diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index 4c59fd0371..ed768eb093 100755 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -30,7 +30,6 @@ #include "llregionhandle.h" #include "stdtypes.h" -#include "llvoavatar.h" /* * Classes and utility functions for per-thread and per-region @@ -127,8 +126,6 @@ LLViewerAssetStats::PerRegionStats::merge(const LLViewerAssetStats::PerRegionSta mFPS.merge(src.mFPS); } - // Avatar stats - data all comes from main thread, so leave alone. - // Requests for (int i = 0; i < LL_ARRAY_SIZE(mRequests); ++i) { @@ -160,9 +157,7 @@ LLViewerAssetStats::LLViewerAssetStats() LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src) : mRegionHandle(src.mRegionHandle), - mResetTimestamp(src.mResetTimestamp), - mPhaseStats(src.mPhaseStats), - mAvatarRezStates(src.mAvatarRezStates) + mResetTimestamp(src.mResetTimestamp) { const PerRegionContainer::const_iterator it_end(src.mRegionStats.end()); for (PerRegionContainer::const_iterator it(src.mRegionStats.begin()); it_end != it; ++it) @@ -258,17 +253,6 @@ LLViewerAssetStats::recordFPS(F32 fps) mCurRegionStats->mFPS.record(fps); } -void -LLViewerAssetStats::recordAvatarStats() -{ - std::vector rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); - mAvatarRezStates = rez_counts; - mPhaseStats.clear(); - mPhaseStats["cloud"] = LLViewerStats::PhaseMap::getPhaseStats("cloud"); - mPhaseStats["cloud-or-gray"] = LLViewerStats::PhaseMap::getPhaseStats("cloud-or-gray"); -} - LLSD LLViewerAssetStats::asLLSD(bool compact_output) { @@ -299,11 +283,6 @@ LLViewerAssetStats::asLLSD(bool compact_output) static const LLSD::String max_tag("max"); static const LLSD::String mean_tag("mean"); - // Avatar sub-tags - static const LLSD::String avatar_tag("avatar"); - static const LLSD::String avatar_nearby_tag("nearby"); - static const LLSD::String avatar_phase_stats_tag("phase_stats"); - const duration_t now = LLViewerAssetStatsFF::get_timestamp(); mCurRegionStats->accumulateTime(now); @@ -362,16 +341,6 @@ LLViewerAssetStats::asLLSD(bool compact_output) LLSD ret = LLSD::emptyMap(); ret["regions"] = regions; ret["duration"] = LLSD::Real((now - mResetTimestamp) * 1.0e-6); - LLSD avatar_info; - avatar_info[avatar_nearby_tag] = LLSD::emptyArray(); - for (S32 rez_stat=0; rez_stat < mAvatarRezStates.size(); ++rez_stat) - { - std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); - avatar_info[avatar_nearby_tag][rez_status_name] = mAvatarRezStates[rez_stat]; - } - avatar_info[avatar_phase_stats_tag]["cloud"] = mPhaseStats["cloud"].getData(); - avatar_info[avatar_phase_stats_tag]["cloud-or-gray"] = mPhaseStats["cloud-or-gray"].getData(); - ret[avatar_tag] = avatar_info; return ret; } @@ -470,15 +439,6 @@ record_fps_main(F32 fps) gViewerAssetStatsMain->recordFPS(fps); } -void -record_avatar_stats() -{ - if (! gViewerAssetStatsMain) - return; - - gViewerAssetStatsMain->recordAvatarStats(); -} - // 'thread1' - should be for TextureFetch thread void diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index 8319752230..3381c01ed5 100755 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -36,7 +36,6 @@ #include "llviewerassetstorage.h" #include "llsimplestat.h" #include "llsd.h" -#include "llvoavatar.h" /** * @class LLViewerAssetStats @@ -182,9 +181,6 @@ public: // Frames-Per-Second Samples void recordFPS(F32 fps); - // Avatar-related statistics - void recordAvatarStats(); - // Merge a source instance into a destination instance. This is // conceptually an 'operator+=()' method: // - counts are added @@ -256,10 +252,6 @@ protected: // Time of last reset duration_t mResetTimestamp; - - // Nearby avatar stats - std::vector mAvatarRezStates; - LLViewerStats::phase_stats_t mPhaseStats; }; @@ -318,8 +310,6 @@ void record_response_main(LLViewerAssetType::EType at, bool with_http, bool is_t void record_fps_main(F32 fps); -void record_avatar_stats(); - /** * Region context, event and duration loggers for Thread 1. */ diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 28c6b59391..65cae9b338 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -764,7 +764,6 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) if (iter->second.getStarted()) { // Going from started to paused state - record stats. - recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); iter->second.stop(); } } @@ -803,27 +802,3 @@ LLSD LLViewerStats::PhaseMap::dumpPhases() } return result; } - -// static initializer -//static -LLViewerStats::phase_stats_t LLViewerStats::PhaseMap::sStats; - -// static -LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) -{ - phase_stats_t::iterator it = sStats.find(phase_name); - if (it == sStats.end()) - { - LLViewerStats::StatsAccumulator new_stats; - sStats[phase_name] = new_stats; - } - return sStats[phase_name]; -} - -// static -void LLViewerStats::PhaseMap::recordPhaseStat(const std::string& phase_name, F32 value) -{ - LLViewerStats::StatsAccumulator& stats = getPhaseStats(phase_name); - stats.push(value); -} - diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 084f5ae7d1..e74fb36e97 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -285,7 +285,6 @@ public: { private: phase_map_t mPhaseMap; - static phase_stats_t sStats; public: PhaseMap(); LLTimer& getPhaseTimer(const std::string& phase_name); @@ -294,8 +293,6 @@ public: void stopPhase(const std::string& phase_name); void clearPhases(); LLSD dumpPhases(); - static StatsAccumulator& getPhaseStats(const std::string& phase_name); - static void recordPhaseStat(const std::string& phase_name, F32 value); phase_map_t::iterator begin() { return mPhaseMap.begin(); } phase_map_t::iterator end() { return mPhaseMap.end(); } }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e911e01420..e298ccdb9c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5971,12 +5971,12 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse U32 grid_x(0), grid_y(0); if (getRegion()) { - record["central_bake_version"] = getRegion()->getCentralBakeVersion(); + record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion()); grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); } record["grid_x"] = LLSD::Integer(grid_x); record["grid_y"] = LLSD::Integer(grid_y); - record["is_using_server_bake"] = isUsingServerBakes(); + record["is_using_server_bakes"] = ((bool) isUsingServerBakes()); record["is_self"] = isSelf(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 4461ba32c5..55e927652e 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2236,7 +2236,12 @@ private: bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) { - F32 send_period = 30.0; + const F32 AV_METRICS_INTERVAL_QA = 30.0; + F32 send_period = 300.0; + if (gSavedSettings.getBOOL("QAModeMetrics")) + { + send_period = AV_METRICS_INTERVAL_QA; + } if (force_send || mTimeSinceLastRezMessage.getElapsedTimeF32() > send_period) { @@ -2260,7 +2265,10 @@ bool operator<(const LLSD& a, const LLSD& b) std::ostringstream aout, bout; aout << LLSDNotationStreamer(a); bout << LLSDNotationStreamer(b); - return aout.str() < bout.str(); + std::string astring = aout.str(); + std::string bstring = bout.str(); + + return astring < bstring; } @@ -2281,10 +2289,10 @@ LLSD summarize_by_buckets(std::vector in_records, { const std::string& field = *field_iter; key[field] = record[field]; - LLViewerStats::StatsAccumulator& stats = accum[key]; - F32 value = record[val_field].asReal(); - stats.push(value); } + LLViewerStats::StatsAccumulator& stats = accum[key]; + F32 value = record[val_field].asReal(); + stats.push(value); } for (std::map::iterator accum_it = accum.begin(); accum_it != accum.end(); ++accum_it) @@ -2331,9 +2339,9 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() by_fields.push_back("completed"); by_fields.push_back("grid_x"); by_fields.push_back("grid_y"); - by_fields.push_back("is_using_server_bake"); + by_fields.push_back("is_using_server_bakes"); by_fields.push_back("is_self"); - by_fields.push_back("cbv"); + by_fields.push_back("central_bake_version"); LLSD summary = summarize_by_buckets(mPendingTimerRecords, by_fields, std::string("elapsed")); msg["timers"] = summary; diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index f8923b9868..b55b6c13d4 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -35,31 +35,6 @@ #include "lluuid.h" #include "llsdutil.h" #include "llregionhandle.h" -#include "../llvoavatar.h" - -void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) -{ - counts.resize(3); - counts[0] = 0; - counts[1] = 0; - counts[2] = 1; -} - -// static -std::string LLVOAvatar::rezStatusToString(S32 rez_status) -{ - if (rez_status==0) return "cloud"; - if (rez_status==1) return "gray"; - if (rez_status==2) return "textured"; - return "unknown"; -} - -// static -LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) -{ - static LLViewerStats::StatsAccumulator junk; - return junk; -} static const char * all_keys[] = { @@ -117,7 +92,6 @@ static const U64 region2_handle(0x0000030000004200ULL); static const std::string region1_handle_str("0000040000003f00"); static const std::string region2_handle_str("0000030000004200"); -#if 0 static bool is_empty_map(const LLSD & sd) { @@ -135,7 +109,6 @@ is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & { return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); } -#endif static bool is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) @@ -147,7 +120,7 @@ is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & static bool is_no_stats_map(const LLSD & sd) { - return is_triple_key_map(sd, "duration", "regions", "avatar"); + return is_double_key_map(sd, "duration", "regions"); } static bool @@ -258,7 +231,7 @@ namespace tut // Once the region is set, we will get a response even with no data collection it->setRegion(region1_handle); sd_full = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd_full, "duration", "regions", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd_full["regions"], region1_handle)); LLSD sd = sd_full["regions"][0]; @@ -299,7 +272,7 @@ namespace tut it->setRegion(region1_handle); LLSD sd = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd[0]; @@ -324,7 +297,7 @@ namespace tut LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); LLSD sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -364,7 +337,7 @@ namespace tut LLSD sd = gViewerAssetStatsThread1->asLLSD(false); ensure("Other collector is empty", is_no_stats_map(sd)); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -414,7 +387,7 @@ namespace tut // std::cout << sd << std::endl; - ensure("Correct double-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); LLSD sd1 = get_region(sd, region1_handle); LLSD sd2 = get_region(sd, region2_handle); @@ -437,7 +410,7 @@ namespace tut // Reset leaves current region in place gViewerAssetStatsMain->reset(); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = sd["regions"][0]; @@ -486,7 +459,7 @@ namespace tut LLSD sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct double-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); LLSD sd1 = get_region(sd, region1_handle); LLSD sd2 = get_region(sd, region2_handle); @@ -509,7 +482,7 @@ namespace tut // Reset leaves current region in place gViewerAssetStatsMain->reset(); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = get_region(sd, region2_handle); ensure("Region2 is present in results", sd2.isMap()); @@ -555,7 +528,7 @@ namespace tut LLSD sd = gViewerAssetStatsThread1->asLLSD(false); ensure("Other collector is empty", is_no_stats_map(sd)); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = get_region(sd, region1_handle); ensure("Region1 is present in results", sd.isMap()); -- cgit v1.2.3 From f6698ad956d7c168a997e91fc5bc7e9a9b7aba64 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 15:09:53 -0500 Subject: fix for mac build failure --- indra/newview/llvoavatarself.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 55e927652e..21798d5774 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2275,7 +2275,7 @@ bool operator<(const LLSD& a, const LLSD& b) // Given a vector of LLSD records, return an LLSD array of bucketed stats for val_field. LLSD summarize_by_buckets(std::vector in_records, std::vector by_fields, - std::string& val_field) + std::string val_field) { LLSD result = LLSD::emptyArray(); std::map accum; -- cgit v1.2.3 From 25edeb91385a227290b7892b2290e33431fb8737 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 16:43:23 -0500 Subject: fix for build failure on test w/linux --- indra/newview/tests/llviewerassetstats_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index b55b6c13d4..e72fa0fa70 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -92,17 +92,21 @@ static const U64 region2_handle(0x0000030000004200ULL); static const std::string region1_handle_str("0000040000003f00"); static const std::string region2_handle_str("0000030000004200"); +#if 0 static bool is_empty_map(const LLSD & sd) { return sd.isMap() && 0 == sd.size(); } +#endif +#if 0 static bool is_single_key_map(const LLSD & sd, const std::string & key) { return sd.isMap() && 1 == sd.size() && sd.has(key); } +#endif static bool is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & key2) @@ -110,11 +114,13 @@ is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); } +#if 0 static bool is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) { return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3); } +#endif static bool -- cgit v1.2.3 From e11fd0a7eb9e5aa39aa719f6d349506348a06d18 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 10:58:04 -0500 Subject: SH-3852 WIP - added more specific logging of completenesss of texture loading --- indra/newview/llappearancemgr.cpp | 2 +- indra/newview/llvoavatar.cpp | 112 ++++++++++++++++++++++++-------------- indra/newview/llvoavatar.h | 12 ++-- indra/newview/llvoavatarself.cpp | 7 ++- 4 files changed, 84 insertions(+), 49 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1a6d49c7a2..caeaf0970b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2006,7 +2006,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) llwarns << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << llendl; return; } - + BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF); LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e298ccdb9c..0cd97283e9 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -818,6 +818,7 @@ BOOL LLVOAvatar::hasGray() const S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; + if (isFullyTextured() && allBakedTexturesCompletelyDownloaded()) return 3; if (isFullyTextured()) return 2; llassert(hasGray()); return 1; // gray @@ -873,7 +874,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) { counts.clear(); - counts.resize(3); + counts.resize(4); for (std::vector::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -891,6 +892,7 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) if (rez_status==0) return "cloud"; if (rez_status==1) return "gray"; if (rez_status==2) return "textured"; + if (rez_status==3) return "textured_and_downloaded"; return "unknown"; } @@ -1814,10 +1816,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) { if (!isIndexBakedTexture((ETextureIndex)te)) { - if (!uuid.isNull()) - { - llinfos << "ignoring texture " << uuid << " in non-baked slot " << (S32)te << " - will use null " << llendl; - } + // Sim still sends some uuids for non-baked slots sometimes - ignore. return LLViewerObject::setTETexture(te, LLUUID::null); } @@ -4034,7 +4033,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) return 6; } -bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) +bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) const { for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -4047,14 +4046,14 @@ bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) return true; } -bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() +bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() const { std::set local_ids; collectLocalTextureUUIDs(local_ids); return allTexturesCompletelyDownloaded(local_ids); } -bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() +bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() const { std::set baked_ids; collectBakedTextureUUIDs(baked_ids); @@ -4129,7 +4128,7 @@ S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) return result; } -void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) +void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) const { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -4155,7 +4154,7 @@ void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) ids.erase(IMG_INVISIBLE); } -void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) +void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) const { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -5873,8 +5872,9 @@ BOOL LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers() { - // State machine for rezzed status. Statuses are 0 = cloud, 1 = gray, 2 = textured. + // State machine for rezzed status. Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. // Purpose is to collect time data for each period of cloud or cloud+gray. + S32 rez_status = getRezzedStatus(); if (rez_status != mLastRezzedStatus) { @@ -5907,7 +5907,32 @@ void LLVOAvatar::updateRezzedStatusTimers() // stop cloud-or-gray timer, which will capture stats. stopPhase("cloud-or-gray"); } - + + if (mLastRezzedStatus == -1 && rez_status != -1) + { + // First time initialization, start all timers. + for (S32 i = 1; i < 4; i++) + { + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + if (rez_status < mLastRezzedStatus) + { + // load level has decreased. start phase timers for higher load levels. + for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++) + { + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + else if (rez_status > mLastRezzedStatus) + { + // load level has increased. stop phase timers for lower and equal load levels. + for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++) + { + stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + mLastRezzedStatus = rez_status; } } @@ -5919,9 +5944,44 @@ void LLVOAvatar::clearPhases() void LLVOAvatar::startPhase(const std::string& phase_name) { + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + LL_DEBUGS("Avatar") << "start when started already for " << phase_name << llendl; + return; + } + } + LL_DEBUGS("Avatar") << "started phase " << phase_name << llendl; getPhases().startPhase(phase_name); } +void LLVOAvatar::stopPhase(const std::string& phase_name) +{ + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + LL_DEBUGS("Avatar") << "stopped phase " << phase_name << llendl; + getPhases().stopPhase(phase_name); + completed = true; + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + LL_DEBUGS("Avatar") << "stop when stopped already for " << phase_name << llendl; + } + } + else + { + LL_DEBUGS("Avatar") << "stop when not started for " << phase_name << llendl; + } +} + void LLVOAvatar::logPendingPhases() { for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); @@ -5937,10 +5997,6 @@ void LLVOAvatar::logPendingPhases() { logMetricsTimerRecord(phase_name, elapsed, completed); } - else - { - llwarns << "ignoring " << phase_name << llendl; - } } } } @@ -5990,30 +6046,6 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse } } -void LLVOAvatar::stopPhase(const std::string& phase_name) -{ - F32 elapsed; - bool completed; - if (getPhases().getPhaseValues(phase_name, elapsed, completed)) - { - if (!completed) - { - getPhases().stopPhase(phase_name); - completed = true; - - } - else - { - llwarns << "stop when stopped already for " << phase_name << llendl; - } - logMetricsTimerRecord(phase_name, elapsed, completed); - } - else - { - llwarns << "stop when not started for " << phase_name << llendl; - } -} - // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 8babcc3ef3..c8915383ca 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -136,14 +136,14 @@ public: void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. S32 totalTextureMemForUUIDS(std::set& ids); - bool allTexturesCompletelyDownloaded(std::set& ids); - bool allLocalTexturesCompletelyDownloaded(); - bool allBakedTexturesCompletelyDownloaded(); + bool allTexturesCompletelyDownloaded(std::set& ids) const; + bool allLocalTexturesCompletelyDownloaded() const; + bool allBakedTexturesCompletelyDownloaded() const; void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, S32 &both_count, S32 &neither_count); std::string bakedTextureOriginInfo(); - void collectLocalTextureUUIDs(std::set& ids); - void collectBakedTextureUUIDs(std::set& ids); + void collectLocalTextureUUIDs(std::set& ids) const; + void collectBakedTextureUUIDs(std::set& ids) const; void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); /*virtual*/ void updateTextures(); @@ -287,7 +287,7 @@ public: virtual BOOL getIsCloud() const; BOOL isFullyTextured() const; BOOL hasGray() const; - S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = fully textured. + S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = textured, 3 = textured and fully downloaded. void updateRezzedStatusTimers(); S32 mLastRezzedStatus; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 21798d5774..fedab5cd06 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -99,7 +99,7 @@ void selfClearPhases() if (isAgentAvatarValid()) { gAgentAvatarp->clearPhases(); - gAgentAvatarp->mLastRezzedStatus = -1; + //gAgentAvatarp->mLastRezzedStatus = -1; } } @@ -1426,7 +1426,9 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - if (getLocalDiscardLevel(*local_tex_iter, wearable_index) > (S32)(desired_tex_discard_level)) + S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index); + if ((local_discard_level > (S32)(desired_tex_discard_level)) || + (local_discard_level < 0 )) { return FALSE; } @@ -1439,6 +1441,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset return FALSE; } + BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const { const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); -- cgit v1.2.3 From 02e9afd0e5d727ea0729fb2242b3a89247ae5b1a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 14:26:48 -0500 Subject: SH-2852 WIP - track avatar loading via load_ timers, added distinction between partially and fully loaded textures --- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatarself.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0cd97283e9..e2f455258d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2908,7 +2908,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", - all_local_downloaded ? "L" : "l", + isSelf() ? (all_local_downloaded ? "L" : "l") : "-", all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index fedab5cd06..8b29622fdb 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -99,7 +99,6 @@ void selfClearPhases() if (isAgentAvatarValid()) { gAgentAvatarp->clearPhases(); - //gAgentAvatarp->mLastRezzedStatus = -1; } } -- cgit v1.2.3 From 550ff94d6a30367c3ea3d2c597b9fea2911039c8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 16:49:50 -0500 Subject: removed some redundant or deprecated timers --- indra/newview/llvoavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e2f455258d..346c55e589 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5879,6 +5879,7 @@ void LLVOAvatar::updateRezzedStatusTimers() if (rez_status != mLastRezzedStatus) { LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; +#if 0 bool is_cloud_or_gray = (rez_status==0 || rez_status==1); bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); bool is_cloud = (rez_status==0); @@ -5907,6 +5908,7 @@ void LLVOAvatar::updateRezzedStatusTimers() // stop cloud-or-gray timer, which will capture stats. stopPhase("cloud-or-gray"); } +#endif if (mLastRezzedStatus == -1 && rez_status != -1) { @@ -6020,7 +6022,6 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse { LLSD record; record["timer_name"] = phase_name; - record["agent_id"] = gAgent.getID(); record["avatar_id"] = getID(); record["elapsed"] = elapsed; record["completed"] = completed; -- cgit v1.2.3 From 78016f4a8d9aea748a367da73b3aac0bd1690eec Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 17:59:00 -0500 Subject: SH-3852 WIP - removed agent_id from summary packets --- indra/newview/llvoavatarself.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 8b29622fdb..e30d62869f 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2334,10 +2334,9 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() msg["nearby"][rez_status_name] = rez_counts[rez_stat]; } - // std::vector bucket_fields("timer_name","agent_id","is_self","grid_x","grid_y","is_using_server_bake"); + // std::vector bucket_fields("timer_name","is_self","grid_x","grid_y","is_using_server_bake"); std::vector by_fields; by_fields.push_back("timer_name"); - by_fields.push_back("agent_id"); by_fields.push_back("completed"); by_fields.push_back("grid_x"); by_fields.push_back("grid_y"); -- cgit v1.2.3 From fe9fb67aea52b0c8ef900915ad41bb9728f23010 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Tue, 12 Feb 2013 18:37:01 -0500 Subject: SH-3859 FIX adding or removing clothing in appearance edit mode are visible Added check to cancel any appearance update requests that occur while in appearance edit mode. Closing appearance edit mode does trigger an update, so should be safe to cancel intermediate requests without further changes. --- indra/newview/llappearancemgr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index caeaf0970b..ecbb922adc 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3085,6 +3085,12 @@ public: void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr responder_ptr) { + if (gAgentAvatarp->isEditingAppearance()) + { + // don't send out appearance updates if in appearance editing mode + return; + } + if (!gAgent.getRegion()) { llwarns << "Region not set, cannot request server appearance update" << llendl; -- cgit v1.2.3 From 9ef4c33772b3d358fd90125ea82a05ae70c01643 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 07:47:24 -0500 Subject: SH-3852 WIP - modified metrics for update_appearance_from_cof and wear_inventory_category, end when bakes are fully loaded --- indra/newview/llagent.cpp | 1 - indra/newview/llappearancemgr.cpp | 1 + indra/newview/llviewerstats.cpp | 2 +- indra/newview/llvoavatar.cpp | 6 ++++++ 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c86b75791d..d10f76ea55 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4339,7 +4339,6 @@ void LLAgent::sendAgentSetAppearance() { // Change is fully resolved, can close some open phases. gAgentAvatarp->stopPhase("process_initial_wearables_update"); - gAgentAvatarp->stopPhase("wear_inventory_category"); } if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index caeaf0970b..e4686ffeed 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2008,6 +2008,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) } BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF); + selfStartPhase("update_appearance_from_cof"); LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 65cae9b338..17bb03b889 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -763,7 +763,7 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) { if (iter->second.getStarted()) { - // Going from started to paused state - record stats. + // Going from started to stopped state - record stats. iter->second.stop(); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 346c55e589..20d598d35b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5933,6 +5933,12 @@ void LLVOAvatar::updateRezzedStatusTimers() { stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); } + if (rez_status == 3) + { + // "fully loaded", mark any pending appearance change complete. + selfStopPhase("update_appearance_from_cof"); + selfStopPhase("wear_inventory_category"); + } } mLastRezzedStatus = rez_status; -- cgit v1.2.3 From 72dfb2abce5d5635e7f81436d65c8689d161eb37 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 17:28:05 -0500 Subject: SH-3812 WIP, SH-3852 WIP - some metrics cleanup, added rebake when needed and sb system is unavailable, to avoid stale appearance problems --- indra/newview/llagent.cpp | 16 +++++--- indra/newview/llagentwearables.cpp | 1 - indra/newview/llvoavatar.cpp | 61 +++++++++++----------------- indra/newview/llvoavatar.h | 20 +--------- indra/newview/llvoavatarself.cpp | 81 ++++++++++++++++++++++++++++++++++++-- indra/newview/llvoavatarself.h | 5 +-- 6 files changed, 113 insertions(+), 71 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index d10f76ea55..e15c1a5104 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -812,6 +812,8 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) { llinfos << "called" << llendl; + + // Old-style appearance entering a server-bake region. if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes() && (mRegionp->getCentralBakeVersion()>0)) @@ -819,6 +821,14 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) llinfos << "update requested due to region transition" << llendl; LLAppearanceMgr::instance().requestServerAppearanceUpdate(); } + // new-style appearance entering a non-bake region, + // need to check for existence of the baking service. + else if (isAgentAvatarValid() && + gAgentAvatarp->isUsingServerBakes() && + mRegionp->getCentralBakeVersion()==0) + { + gAgentAvatarp->checkForUnsupportedServerBakeAppearance(); + } } //----------------------------------------------------------------------------- @@ -4335,12 +4345,6 @@ void LLAgent::sendAgentSetAppearance() return; } - if (!gAgentWearables.changeInProgress()) - { - // Change is fully resolved, can close some open phases. - gAgentAvatarp->stopPhase("process_initial_wearables_update"); - } - if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; // At this point we have a complete appearance to send and are in a non-baking region. diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 0c79ac0ba3..ba04991a02 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -796,7 +796,6 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs if (isAgentAvatarValid()) { - //gAgentAvatarp->clearPhases(); // reset phase timers for outfit loading. gAgentAvatarp->startPhase("process_initial_wearables_update"); gAgentAvatarp->outputRezTiming("Received initial wearables update"); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 20d598d35b..5b4d57986b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4456,6 +4456,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { + llassert(isIndexBakedTexture(ETextureIndex(te))); std::string url = ""; if (isUsingServerBakes()) { @@ -5872,43 +5873,15 @@ BOOL LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers() { - // State machine for rezzed status. Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. - // Purpose is to collect time data for each period of cloud or cloud+gray. + // State machine for rezzed status. Statuses are -1 on startup, 0 + // = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. + // Purpose is to collect time data for each it takes avatar to reach + // various loading landmarks: gray, textured (partial), textured fully. S32 rez_status = getRezzedStatus(); if (rez_status != mLastRezzedStatus) { LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; -#if 0 - bool is_cloud_or_gray = (rez_status==0 || rez_status==1); - bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); - bool is_cloud = (rez_status==0); - bool was_cloud = (mLastRezzedStatus==0); - - // Non-cloud to cloud - if (is_cloud && !was_cloud) - { - // start cloud timer. - startPhase("cloud"); - } - else if (was_cloud && !is_cloud) - { - // stop cloud timer, which will capture stats. - stopPhase("cloud"); - } - - // Non-cloud-or-gray to cloud-or-gray - if (is_cloud_or_gray && !was_cloud_or_gray) - { - // start cloud-or-gray timer. - startPhase("cloud-or-gray"); - } - else if (was_cloud_or_gray && !is_cloud_or_gray) - { - // stop cloud-or-gray timer, which will capture stats. - stopPhase("cloud-or-gray"); - } -#endif if (mLastRezzedStatus == -1 && rez_status != -1) { @@ -5937,7 +5910,8 @@ void LLVOAvatar::updateRezzedStatusTimers() { // "fully loaded", mark any pending appearance change complete. selfStopPhase("update_appearance_from_cof"); - selfStopPhase("wear_inventory_category"); + selfStopPhase("wear_inventory_category", false); + selfStopPhase("process_initial_wearables_update", false); } } @@ -5958,7 +5932,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "start when started already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << "no-op, start when started already for " << phase_name << llendl; return; } } @@ -5966,7 +5940,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) getPhases().startPhase(phase_name); } -void LLVOAvatar::stopPhase(const std::string& phase_name) +void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) { F32 elapsed; bool completed; @@ -5974,19 +5948,25 @@ void LLVOAvatar::stopPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "stopped phase " << phase_name << llendl; getPhases().stopPhase(phase_name); completed = true; logMetricsTimerRecord(phase_name, elapsed, completed); + LL_DEBUGS("Avatar") << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; } else { - LL_DEBUGS("Avatar") << "stop when stopped already for " << phase_name << llendl; + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << llendl; + } } } else { - LL_DEBUGS("Avatar") << "stop when not started for " << phase_name << llendl; + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << llendl; + } } } @@ -6043,9 +6023,11 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["is_self"] = isSelf(); +#if 0 // verbose logging std::ostringstream ostr; ostr << LLSDNotationStreamer(record); LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; +#endif if (isAgentAvatarValid()) { @@ -6264,7 +6246,8 @@ void LLVOAvatar::updateMeshTextures() #ifndef LL_RELEASE_FOR_DOWNLOAD LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); #endif - const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); + ETextureIndex te = ETextureIndex(mBakedTextureDatas[i].mTextureIndex); + const std::string url = getImageURL(te, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c8915383ca..c989673cdf 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -294,7 +294,7 @@ public: void startPhase(const std::string& phase_name); - void stopPhase(const std::string& phase_name); + void stopPhase(const std::string& phase_name, bool err_check = true); void clearPhases(); void logPendingPhases(); static void logPendingPhasesAllAvatars(); @@ -316,24 +316,6 @@ private: LLFrameTimer mFullyLoadedTimer; LLFrameTimer mRuthTimer; -public: - class ScopedPhaseSetter - { - public: - ScopedPhaseSetter(LLVOAvatar *avatarp, std::string phase_name): - mAvatar(avatarp), mPhaseName(phase_name) - { - if (mAvatar) { mAvatar->getPhases().startPhase(mPhaseName); } - } - ~ScopedPhaseSetter() - { - if (mAvatar) { mAvatar->getPhases().stopPhase(mPhaseName); } - } - private: - std::string mPhaseName; - LLVOAvatar* mAvatar; - }; - private: LLViewerStats::PhaseMap mPhases; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e30d62869f..2775c9442a 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -86,11 +86,11 @@ void selfStartPhase(const std::string& phase_name) } } -void selfStopPhase(const std::string& phase_name) +void selfStopPhase(const std::string& phase_name, bool err_check) { if (isAgentAvatarValid()) { - gAgentAvatarp->stopPhase(phase_name); + gAgentAvatarp->stopPhase(phase_name, err_check); } } @@ -179,6 +179,24 @@ bool output_self_av_texture_diagnostics() return false; } +bool update_avatar_rez_metrics() +{ + if (!isAgentAvatarValid()) + return true; + + gAgentAvatarp->updateAvatarRezMetrics(false); + return false; +} + +bool check_for_unsupported_baked_appearance() +{ + if (!isAgentAvatarValid()) + return true; + + gAgentAvatarp->checkForUnsupportedServerBakeAppearance(); + return false; +} + void LLVOAvatarSelf::initInstance() { BOOL status = TRUE; @@ -214,7 +232,8 @@ void LLVOAvatarSelf::initInstance() } //doPeriodically(output_self_av_texture_diagnostics, 30.0); - doPeriodically(boost::bind(&LLVOAvatarSelf::updateAvatarRezMetrics, this, false), 5.0); + doPeriodically(update_avatar_rez_metrics, 5.0); + doPeriodically(check_for_unsupported_baked_appearance, 120.0); } // virtual @@ -2371,6 +2390,62 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() } } +class CheckAgentAppearanceServiceResponder: public LLHTTPClient::Responder +{ +public: + CheckAgentAppearanceServiceResponder() + { + } + + virtual ~CheckAgentAppearanceServiceResponder() + { + } + + /* virtual */ void result(const LLSD& content) + { + LL_DEBUGS("Avatar") << "status OK" << llendl; + } + + // Error + /*virtual*/ void error(U32 status, const std::string& reason) + { + if (isAgentAvatarValid()) + { + LL_DEBUGS("Avatar") << "failed, will rebake" << llendl; + forceAppearanceUpdate(); + } + } + + static void forceAppearanceUpdate() + { + // Trying to rebake immediately after crossing region boundary + // seems to be failure prone; adding a delay factor. Yes, this + // fix is ad-hoc and not guaranteed to work in all cases. + doAfterInterval(boost::bind(&LLVOAvatarSelf::forceBakeAllTextures, + gAgentAvatarp.get(), true), 5.0); + } +}; + +void LLVOAvatarSelf::checkForUnsupportedServerBakeAppearance() +{ + // Need to check only if we have a server baked appearance and are + // in a non-baking region. + if (!gAgentAvatarp->isUsingServerBakes()) + return; + if (!gAgent.getRegion() || gAgent.getRegion()->getCentralBakeVersion()!=0) + return; + + // if baked image service is unknown, need to refresh. + if (gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + { + CheckAgentAppearanceServiceResponder::forceAppearanceUpdate(); + } + // query baked image service to check status. + std::string image_url = gAgentAvatarp->getImageURL(TEX_HEAD_BAKED, + getTE(TEX_HEAD_BAKED)->getID()); + LLHTTPClient::head(image_url, new CheckAgentAppearanceServiceResponder); +} + const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) const { if (canGrabBakedTexture(baked_index)) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 04b0fb760c..78728cff20 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -402,6 +402,7 @@ public: const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD void sendViewerAppearanceChangeMetrics(); // send data associated with completing a change. + void checkForUnsupportedServerBakeAppearance(); private: LLFrameTimer mDebugSelfLoadTimer; F32 mDebugTimeWearablesLoaded; @@ -421,9 +422,7 @@ extern LLPointer gAgentAvatarp; BOOL isAgentAvatarValid(); void selfStartPhase(const std::string& phase_name); -void selfStopPhase(const std::string& phase_name); +void selfStopPhase(const std::string& phase_name, bool err_check = true); void selfClearPhases(); -void update_avatar_rez_metrics(bool force_send); - #endif // LL_VO_AVATARSELF_H -- cgit v1.2.3 From c99e206374f6afdcc038a97934314dec1a742b2e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 18:37:15 -0500 Subject: SH-3852 WIP - send non-complete timers only on av destruction or last message, so they don't get multiply counted --- indra/newview/llvoavatar.cpp | 16 +++++++++------- indra/newview/llvoavatarself.cpp | 6 +++++- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5b4d57986b..735589414d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -729,6 +729,8 @@ LLVOAvatar::~LLVOAvatar() debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); } + logPendingPhases(); + lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); @@ -1796,13 +1798,13 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU const std::string url = getImageURL(te,uuid); if (!url.empty()) { - llinfos << "texture URL " << url << llendl; + LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl; result = LLViewerTextureManager::getFetchedTextureFromUrl( url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); } else { - llinfos << "get texture from host " << uuid << llendl; + LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl; LLHost host = getObjectHost(); result = LLViewerTextureManager::getFetchedTexture( uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); @@ -4190,15 +4192,15 @@ void LLVOAvatar::releaseOldTextures() std::set local_texture_ids; collectLocalTextureUUIDs(local_texture_ids); - S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); + //S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); std::set new_texture_ids; new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); - S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); - LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); + //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; if (!isSelf() && new_total_mem > new_baked_mem) { llwarns << "extra local textures stored for non-self av" << llendl; @@ -5932,7 +5934,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "no-op, start when started already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << llendl; return; } } @@ -5951,7 +5953,7 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) getPhases().stopPhase(phase_name); completed = true; logMetricsTimerRecord(phase_name, elapsed, completed); - LL_DEBUGS("Avatar") << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; + LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; } else { diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 2775c9442a..1a1564e1a8 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2269,7 +2269,11 @@ bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) // Stats for completed phases have been getting logged as they // complete. This will give us stats for any timers that // haven't finished as of the metric's being sent. - LLVOAvatar::logPendingPhasesAllAvatars(); + + if (force_send) + { + LLVOAvatar::logPendingPhasesAllAvatars(); + } sendViewerAppearanceChangeMetrics(); } -- cgit v1.2.3 From 97fd1cc7d75a065ea7f852820e32fcad91201281 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Feb 2013 13:46:24 -0500 Subject: removed some no-op code, enhanced display of DebugAvatarAppearanceMessage status line --- indra/newview/llvoavatar.cpp | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 735589414d..ce39bee42f 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4108,10 +4108,16 @@ std::string LLVOAvatar::bakedTextureOriginInfo() { has_host = true; } - if (has_url && !has_host) result += "u"; // server-bake texture with url - else if (has_host && !has_url) result += "h"; // old-style texture on sim - else if (has_host && has_url) result += "?"; // both origins? - else if (!has_host && !has_url) result += "n"; // no origin? + S32 discard = imagep->getDiscardLevel(); + if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url + else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim + else if (has_host && has_url) result += discard ? "ERRx" : "ERRX"; // both origins? + else if (!has_host && !has_url) result += discard ? "ERRn" : "ERRN"; // no origin? + if (discard != 0) + { + result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel()); + } + } return result; } @@ -6130,6 +6136,8 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const return mMotionController.findMotion(id); } +// This is a semi-deprecated debugging tool - meshes will not show as +// colorized if using deferred rendering. void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) { if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) @@ -6244,29 +6252,7 @@ void LLVOAvatar::updateMeshTextures() LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { - LLViewerFetchedTexture* baked_img; -#ifndef LL_RELEASE_FOR_DOWNLOAD - LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); -#endif - ETextureIndex te = ETextureIndex(mBakedTextureDatas[i].mTextureIndex); - const std::string url = getImageURL(te, mBakedTextureDatas[i].mLastTextureID); - if (!url.empty()) - { - baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); - } - else - { - // Baked textures should be requested from the sim this avatar is on. JC - const LLHost target_host = getObjectHost(); - if (!target_host.isOk()) - { - llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; - } - - baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureID, target_host ); - } - llassert(baked_img == existing_baked_img); - + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); mBakedTextureDatas[i].mIsUsed = TRUE; debugColorizeSubMeshes(i,LLColor4::red); @@ -7131,6 +7117,7 @@ void LLVOAvatar::getAnimNames( LLDynamicArray* names ) names->put( "enter_away_from_keyboard_state" ); } +// static void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) { if (!userdata) return; @@ -7149,7 +7136,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { if (!aux_src->getData()) { - llerrs << "No auxiliary source data for onBakedTextureMasksLoaded" << llendl; + llerrs << "No auxiliary source (morph mask) data for image id " << id << llendl; return; } -- cgit v1.2.3 From 852211e2c154763d9d86cc30b07c9f319e25df95 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Feb 2013 17:52:50 -0500 Subject: tweaked and added some log messages, including more detail when an image is flagged as missing --- indra/newview/llviewertexture.cpp | 4 ++++ indra/newview/llviewertexturelist.cpp | 1 + indra/newview/llvoavatar.cpp | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 3304ff7ebe..e9501931eb 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1050,6 +1050,7 @@ void LLViewerFetchedTexture::loadFromFastCache() { //discard all oversized textures. destroyRawImage(); + llwarns << "oversized, setting as missing" << llendl; setIsMissingAsset(); mRawDiscardLevel = INVALID_DISCARD_LEVEL ; } @@ -1316,6 +1317,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) // An inappropriately-sized image was uploaded (through a non standard client) // We treat these images as missing assets which causes them to // be renderd as 'missing image' and to stop requesting data + llwarns << "!size_ok, setting as missing" << llendl; setIsMissingAsset(); destroyRawImage(); return FALSE; @@ -1774,6 +1776,7 @@ bool LLViewerFetchedTexture::updateFetch() { //discard all oversized textures. destroyRawImage(); + llwarns << "oversize, setting as missing" << llendl; setIsMissingAsset(); mRawDiscardLevel = INVALID_DISCARD_LEVEL ; mIsFetching = FALSE ; @@ -1803,6 +1806,7 @@ bool LLViewerFetchedTexture::updateFetch() // We finished but received no data if (current_discard < 0) { + llwarns << "!mIsFetching, setting as missing" << llendl; setIsMissingAsset(); desired_discard = -1; } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 6e7f6c9b32..beadef34ba 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1491,6 +1491,7 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void ** LLViewerFetchedTexture* image = gTextureList.findImage( image_id ); if( image ) { + llwarns << "not in db" << llendl; image->setIsMissingAsset(); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ce39bee42f..c654d9ea64 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7188,7 +7188,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture } if (!found_texture_id) { - llinfos << "onBakedTextureMasksLoaded(): unexpected image id: " << id << llendl; + llinfos << "unexpected image id: " << id << llendl; } self->dirtyMesh(); } @@ -7196,7 +7196,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { // this can happen when someone uses an old baked texture possibly provided by // viewer-side baked texture caching - llwarns << "Masks loaded callback but NO aux source!" << llendl; + llwarns << "Masks loaded callback but NO aux source, id " << id << llendl; } } -- cgit v1.2.3 From 741821eb6a8717896307da44b1b8e7078a865fff Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 15 Feb 2013 09:52:11 -0500 Subject: SH-3867 FIX - on logout, wait for any pending metrics uploads to complete --- indra/newview/llappviewer.cpp | 9 +++++++++ indra/newview/llappviewer.h | 2 ++ indra/newview/llvoavatarself.cpp | 7 ++----- 3 files changed, 13 insertions(+), 5 deletions(-) mode change 100644 => 100755 indra/newview/llappviewer.h (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9a5010c781..70c5527b23 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -291,6 +291,8 @@ LLTimer gLogoutTimer; static const F32 LOGOUT_REQUEST_TIME = 6.f; // this will be cut short by the LogoutReply msg. F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME; +S32 gPendingMetricsUploads = 0; + BOOL gDisconnected = FALSE; // used to restore texture state after a mode switch @@ -4725,6 +4727,13 @@ void LLAppViewer::idleShutdown() return; } + if (gPendingMetricsUploads > 0 + && gLogoutTimer.getElapsedTimeF32() < SHUTDOWN_UPLOAD_SAVE_TIME + && !logoutRequestSent()) + { + return; + } + // All floaters are closed. Tell server we want to quit. if( !logoutRequestSent() ) { diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h old mode 100644 new mode 100755 index be72421c58..b69a1944a6 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -341,6 +341,8 @@ extern LLFrameTimer gLoggedInTime; extern F32 gLogoutMaxTime; extern LLTimer gLogoutTimer; +extern S32 gPendingMetricsUploads; + extern F32 gSimLastTime; extern F32 gSimFrames; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 1a1564e1a8..7e24c43017 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2223,6 +2223,7 @@ public: const std::string& reason, const LLSD& content) { + gPendingMetricsUploads--; // if we add retry, this should be moved to the isGoodStatus case. if (isGoodStatus(status)) { LL_DEBUGS("Avatar") << "OK" << LL_ENDL; @@ -2235,11 +2236,6 @@ public: } } - // virtual - void error(U32 status_num, const std::string & reason) - { - } - // virtual void result(const LLSD & content) { @@ -2384,6 +2380,7 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() } if (!caps_url.empty()) { + gPendingMetricsUploads++; LLCurlRequest::headers_t headers; LLHTTPClient::post(caps_url, msg, -- cgit v1.2.3 From e34d93e29eee07843476aed7db46b178a3462e95 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 15 Feb 2013 21:30:56 +0000 Subject: Fix to allow horde bots to render other avatars in the area --- indra/newview/llvoavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c654d9ea64..3681040acc 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1870,7 +1870,8 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) return; } - if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR))) + if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR)) + && !(gSavedSettings.getBOOL("DisableAllRenderTypes"))) { return; } -- cgit v1.2.3 From ce9a15bf989224ccda03d2d8461a3c619ae4339d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 19 Feb 2013 10:09:38 -0500 Subject: SH-3792 WIP - changed local texture loading to be consistent with viewer_development - this fixes the gray head issue. There is still some remaining issue with bakes not uploading at full resolution, probably due to a bad image asset. --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llvoavatar.cpp | 44 +++++++++++++++++++++------------ indra/newview/llvoavatarself.cpp | 41 +++++++++++++++--------------- 3 files changed, 49 insertions(+), 38 deletions(-) mode change 100644 => 100755 indra/newview/app_settings/settings.xml (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml old mode 100644 new mode 100755 index eaad45ee9e..5db8d4e6a1 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7258,7 +7258,7 @@ Type Boolean Value - 0 + 1 QuietSnapshotsToDisk diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c654d9ea64..58c0a412ed 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4096,26 +4096,38 @@ std::string LLVOAvatar::bakedTextureOriginInfo() std::set baked_ids; collectBakedTextureUUIDs(baked_ids); - for (std::set::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); - bool has_url = false, has_host = false; - if (!imagep->getUrl().empty()) - { - has_url = true; - } - if (imagep->getTargetHost().isOk()) + ETextureIndex texture_index = mBakedTextureDatas[i].mTextureIndex; + LLViewerFetchedTexture *imagep = + LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + if (!imagep || + imagep->getID() == IMG_DEFAULT || + imagep->getID() == IMG_DEFAULT_AVATAR) + { - has_host = true; + result += "-"; } - S32 discard = imagep->getDiscardLevel(); - if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url - else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim - else if (has_host && has_url) result += discard ? "ERRx" : "ERRX"; // both origins? - else if (!has_host && !has_url) result += discard ? "ERRn" : "ERRN"; // no origin? - if (discard != 0) + else { - result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel()); + bool has_url = false, has_host = false; + if (!imagep->getUrl().empty()) + { + has_url = true; + } + if (imagep->getTargetHost().isOk()) + { + has_host = true; + } + S32 discard = imagep->getDiscardLevel(); + if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url + else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim + else if (has_host && has_url) result += discard ? "x" : "X"; // both origins? + else if (!has_host && !has_url) result += discard ? "n" : "N"; // no origin? + if (discard != 0) + { + result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel()); + } } } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 7e24c43017..0e8e48099e 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2540,34 +2540,33 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe { if (!isIndexLocalTexture(type)) return; - if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR) + if (!covered_by_baked) { - imagep->setNoDelete(); - if (imagep->getDiscardLevel() != 0) + if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR) { - F32 desired_pixels; - desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); - - // DRANO what priority should wearable-based textures have? - if (isUsingLocalAppearance()) + imagep->setNoDelete(); + if (imagep->getDiscardLevel() != 0) { + F32 desired_pixels; + desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); + imagep->setBoostLevel(getAvatarBoostLevel()); imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; - } - imagep->resetTextureStats(); - imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); - imagep->addTextureStats( desired_pixels / texel_area_ratio ); - imagep->forceUpdateBindStats() ; - if (imagep->getDiscardLevel() < 0) - { - mHasGrey = TRUE; // for statistics gathering + imagep->resetTextureStats(); + imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); + imagep->addTextureStats( desired_pixels / texel_area_ratio ); + imagep->forceUpdateBindStats() ; + if (imagep->getDiscardLevel() < 0) + { + mHasGrey = TRUE; // for statistics gathering + } } } - } - else - { - // texture asset is missing - mHasGrey = TRUE; // for statistics gathering + else + { + // texture asset is missing + mHasGrey = TRUE; // for statistics gathering + } } } -- cgit v1.2.3 From b6f814af25a957e71dc8d9dd314ac15e3cbe6cd9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Feb 2013 13:24:58 -0500 Subject: SH-3891 WIP - separate first-time rezzing stats from subsequent state changes --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 95d4be17b5..266b9fecd5 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5910,6 +5910,7 @@ void LLVOAvatar::updateRezzedStatusTimers() for (S32 i = 1; i < 4; i++) { startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + startPhase("first_load_" + LLVOAvatar::rezStatusToString(i)); } } if (rez_status < mLastRezzedStatus) @@ -5926,6 +5927,7 @@ void LLVOAvatar::updateRezzedStatusTimers() for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++) { stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); + stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false); } if (rez_status == 3) { -- cgit v1.2.3 From 756ab4cad5908f30c29a9e86f6905745dbec616c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 21 Feb 2013 16:50:11 -0800 Subject: SH-3864 FIX Closing the Inventory window exits outfit editing. cleaned up logic when closing floatersidepanels --- indra/newview/llfloatersidepanelcontainer.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 02150819a0..ce5ea66471 100755 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -59,30 +59,22 @@ void LLFloaterSidePanelContainer::onOpen(const LLSD& key) void LLFloaterSidePanelContainer::onClickCloseBtn() { - llinfos << "close clicked" << llendl; - LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); - if (panel_outfit_edit && panel_outfit_edit->getVisible()) + if (panel_outfit_edit) { LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); - if (parent == this) + if (parent == this ) { - LLSidepanelAppearance* panel_appearance = - dynamic_cast(getPanel("appearance")); - panel_appearance->showOutfitsInventoryPanel(); + LLSidepanelAppearance* panel_appearance = dynamic_cast(getPanel("appearance")); + if ( panel_appearance ) + { + panel_appearance->getWearable()->onClose(); + panel_appearance->showOutfitsInventoryPanel(); + } } } - if ( panel_outfit_edit ) - { - LLSidepanelAppearance* panel_appearance = dynamic_cast(getPanel("appearance")); - if ( panel_appearance ) - { - panel_appearance->getWearable()->onClose(); - panel_appearance->showOutfitsInventoryPanel(); - } - } LLFloater::onClickCloseBtn(); } -- cgit v1.2.3 From 9233f08ddb8ecfffb56638533a4089f13ad7fb12 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Mon, 25 Feb 2013 18:19:08 -0500 Subject: SH-3892 SH-3896 SUN-28 FIX add to outfit behaves like replace outfit Conversion away from retry mechanism missed one case which was not supporting the 'add' operation properly. Changed code to use linkAll instead, as it did previously. --- indra/newview/llappearancemgr.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 10523ca998..23a908c0ff 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1814,17 +1814,13 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) all_items += gest_items; // Will link all the above items. - bool update_base_outfit_ordering = !append; - LLCallAfterInventoryLinkMgr *link_waiter = - new LLCallAfterInventoryLinkMgr(all_items,cof,"update_appearance_on_destroy", - boost::bind(&LLAppearanceMgr::updateAppearanceFromCOF, - LLAppearanceMgr::getInstance(), - update_base_outfit_ordering)); + LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; + linkAll(cof,all_items,link_waiter); // Add link to outfit if category is an outfit. if (!append) { - link_waiter->addItem(category); + createBaseOutfitLink(category, NULL); } // Remove current COF contents. Have to do this after creating -- cgit v1.2.3 From b16dcda6a387774a446c04f63e1a55bd35ec7afe Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 25 Feb 2013 19:12:36 -0500 Subject: SH-3860 WIP, SH-3899 WIP - make folder version management more debuggable, log appearance request results --- indra/newview/llagent.cpp | 4 ---- indra/newview/llappearancemgr.cpp | 24 +++++++++++++++++++++--- indra/newview/llinventorymodel.cpp | 11 +++++++++++ indra/newview/llstartup.cpp | 0 indra/newview/llviewerinventory.cpp | 19 +++++++++++++++++-- indra/newview/llviewerinventory.h | 4 ++-- indra/newview/llvoavatar.cpp | 5 ----- indra/newview/llvoavatar.h | 4 ++++ indra/newview/llvoavatarself.cpp | 2 -- 9 files changed, 55 insertions(+), 18 deletions(-) mode change 100644 => 100755 indra/newview/llstartup.cpp (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e15c1a5104..6c082a7e9c 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4292,10 +4292,6 @@ void LLAgent::requestLeaveGodMode() sendReliableMessage(); } -extern void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); -extern std::string get_sequential_numbered_file_name(const std::string& prefix, - const std::string& suffix); - // For debugging, trace agent state at times appearance message are sent out. void LLAgent::dumpSentAppearance(const std::string& dump_prefix) { diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 10523ca998..d0f28b8c10 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -50,6 +50,7 @@ #include "llviewerregion.h" #include "llwearablelist.h" #include "llsdutil.h" +#include "llsdserialize.h" std::string self_av_string() { @@ -3049,6 +3050,10 @@ public: if (content["success"].asBoolean()) { LL_DEBUGS("Avatar") << "OK" << LL_ENDL; + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + dumpContents("appearance_request_ok", content); + } } else { @@ -3056,11 +3061,23 @@ public: } } + void dumpContents(const std::string outprefix, const LLSD& content) + { + std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + std::ofstream ofs(fullpath); + ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); + LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; + } + // Error /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "appearance update request failed, status: " << status << " reason: " << reason << llendl; - LL_DEBUGS("Avatar") << "content: " << ll_pretty_print_sd(content) << LL_ENDL; + llwarns << "appearance update request failed, status: " << status << " reason: " << reason << " code: " << content["code"].asInteger() << " error: \"" << content["error"].asString() << "\"" << llendl; + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + dumpContents("appearance_request_error", content); + } onFailure(status); } @@ -3095,6 +3112,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond if (!gAgent.getRegion()) { llwarns << "Region not set, cannot request server appearance update" << llendl; + return; } if (gAgent.getRegion()->getCentralBakeVersion()==0) { @@ -3110,7 +3128,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond LLSD body; S32 cof_version = getCOFVersion(); body["cof_version"] = cof_version; - LL_DEBUGS("Avatar") << "my_cof_version " << cof_version << llendl; + LL_DEBUGS("Avatar") << "request url " << url << " my_cof_version " << cof_version << llendl; //LLCurl::ResponderPtr responder_ptr; if (!responder_ptr.get()) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ac1f40b486..171a2cd043 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1922,7 +1922,18 @@ bool LLInventoryModel::loadSkeleton( for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) { LLViewerInventoryCategory *llvic = (*it); +#if 1 llvic->setVersion(NO_VERSION); +#else + if (llvic->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT && llvic->getVersion()==1) + { + llinfos << "preserving empty COF for first-time login" << llendl; + } + else + { + llvic->setVersion(NO_VERSION); + } +#endif addCategory(*it); } } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp old mode 100644 new mode 100755 diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index d6f0874a58..59efcfa7fa 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -592,7 +592,7 @@ void LLViewerInventoryCategory::copyViewerCategory(const LLViewerInventoryCatego { copyCategory(other); mOwnerID = other->mOwnerID; - mVersion = other->mVersion; + setVersion(other->getVersion()); mDescendentCount = other->mDescendentCount; mDescendentsRequested = other->mDescendentsRequested; } @@ -660,9 +660,19 @@ void LLViewerInventoryCategory::removeFromServer( void ) gAgent.sendReliableMessage(); } +S32 LLViewerInventoryCategory::getVersion() const +{ + return mVersion; +} + +void LLViewerInventoryCategory::setVersion(S32 version) +{ + mVersion = version; +} + bool LLViewerInventoryCategory::fetch() { - if((VERSION_UNKNOWN == mVersion) + if((VERSION_UNKNOWN == getVersion()) && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads. { LL_DEBUGS("InventoryFetch") << "Fetching category children: " << mName << ", UUID: " << mUUID << LL_ENDL; @@ -1127,6 +1137,11 @@ void link_inventory_item( } } +#if 1 // debugging stuff + LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); + lldebugs << "cat: " << cat << llendl; + +#endif LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_LinkInventoryItem); msg->nextBlock(_PREHASH_AgentData); diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 13e95c57cb..812b3b2739 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -205,8 +205,8 @@ public: // Version handling enum { VERSION_UNKNOWN = -1, VERSION_INITIAL = 1 }; - S32 getVersion() const { return mVersion; } - void setVersion(S32 version) { mVersion = version; } + S32 getVersion() const; + void setVersion(S32 version); // Returns true if a fetch was issued. bool fetch(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 266b9fecd5..04458da529 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -190,11 +190,6 @@ enum ERenderName RENDER_NAME_FADE }; - -// Utility func - FIXME move out of avatar. -std::string get_sequential_numbered_file_name(const std::string& prefix, - const std::string& suffix); - //----------------------------------------------------------------------------- // Callback data //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c989673cdf..3382a1ef17 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -980,5 +980,9 @@ protected: // Shared with LLVOAvatarSelf extern const F32 SELF_ADDITIONAL_PRI; extern const S32 MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL; +std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix); +void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); + #endif // LL_VOAVATAR_H diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0e8e48099e..c069488a37 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -3049,8 +3049,6 @@ void LLVOAvatarSelf::dumpScratchTextureByteCount() llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl; } -void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); - void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile) { apr_file_t* file = outfile.getFileHandle(); -- cgit v1.2.3 From d679ad47d524f73bdde0204b91607f9221dc41ab Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 26 Feb 2013 07:45:50 -0500 Subject: cleaned up old message --- indra/newview/llappearancemgr.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 131bef6958..bd4e8ddf72 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1806,8 +1806,6 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) removeDuplicateItems(gest_items); // Create links to new COF contents. - LL_DEBUGS("Avatar") << self_av_string() << "creating LLCallAfterInventoryLinkMgr" << LL_ENDL; - LLInventoryModel::item_array_t all_items; all_items += body_items; all_items += wear_items; -- cgit v1.2.3 From 26ac1097729ce801e61523e3e42d7a868ddcde13 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 26 Feb 2013 22:00:50 -0500 Subject: SH-3899 WIP - more logging of appearance message info --- indra/newview/llappearancemgr.cpp | 9 +++++++ indra/newview/llvoavatar.cpp | 52 +++++++++++++++++++++++---------------- indra/newview/llvoavatar.h | 3 +-- 3 files changed, 41 insertions(+), 23 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index bd4e8ddf72..8d41edf6af 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3063,6 +3063,13 @@ public: ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; } + + void debugCOF(const LLSD& content) + { + //S32 cof_version = content["cof_version"]; + //S32 cof_expected = content["expected"]; + //S32 cof_observed = content["observed"]; + } // Error /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) @@ -3071,6 +3078,8 @@ public: if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { dumpContents("appearance_request_error", content); + debugCOF(content); + } onFailure(status); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 04458da529..afe8a037b7 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -210,6 +210,24 @@ struct LLTextureMaskData ** **/ +struct LLAppearanceMessageContents +{ + LLAppearanceMessageContents(): + mAppearanceVersion(-1), + mParamAppearanceVersion(-1), + mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + { + } + LLTEContents mTEContents; + S32 mAppearanceVersion; + S32 mParamAppearanceVersion; + S32 mCOFVersion; + // For future use: + //U32 appearance_flags = 0; + std::vector mParamWeights; + std::vector mParams; +}; + //----------------------------------------------------------------------------- // class LLBodyNoiseMotion //----------------------------------------------------------------------------- @@ -6725,10 +6743,11 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, - const std::vector& params_for_dump, - const LLTEContents& tec) + const LLAppearanceMessageContents& contents) { std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + const std::vector& params_for_dump = contents.mParamWeights; + const LLTEContents& tec = contents.mTEContents; LLAPRFile outfile; std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); @@ -6743,7 +6762,12 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; } + apr_file_printf(file, "
\n"); + apr_file_printf(file, "\t\t\n", contents.mCOFVersion); + apr_file_printf(file, "\t\t\n", contents.mAppearanceVersion); + apr_file_printf(file, "
\n"); + apr_file_printf(file, "\n\n"); LLVisualParam* param = getFirstVisualParam(); for (S32 i = 0; i < params_for_dump.size(); i++) { @@ -6756,32 +6780,18 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, dump_visual_param(file, viewer_param, value); param = getNextVisualParam(); } + apr_file_printf(file, "\n"); + + apr_file_printf(file, "\n\n"); for (U32 i = 0; i < tec.face_count; i++) { std::string uuid_str; ((LLUUID*)tec.image_data)[i].toString(uuid_str); apr_file_printf( file, "\t\t\n", i, uuid_str.c_str()); } + apr_file_printf(file, "\n"); } -struct LLAppearanceMessageContents -{ - LLAppearanceMessageContents(): - mAppearanceVersion(-1), - mParamAppearanceVersion(-1), - mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) - { - } - LLTEContents mTEContents; - S32 mAppearanceVersion; - S32 mParamAppearanceVersion; - S32 mCOFVersion; - // For future use: - //U32 appearance_flags = 0; - std::vector mParamWeights; - std::vector mParams; -}; - void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) { parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents); @@ -6920,7 +6930,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) parseAppearanceMessage(mesgsys, contents); if (enable_verbose_dumps) { - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents); } S32 appearance_version; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 3382a1ef17..5ebd8d0399 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -928,8 +928,7 @@ private: public: void dumpArchetypeXML(const std::string& prefix, bool group_by_wearables = false); void dumpAppearanceMsgParams( const std::string& dump_prefix, - const std::vector& paramsForDump, - const LLTEContents& tec); + const LLAppearanceMessageContents& contents); static void dumpBakedStatus(); const std::string getBakedStatusForPrintout() const; void dumpAvatarTEs(const std::string& context) const; -- cgit v1.2.3 From d9d5c7e0ccec47d57743304c800c5137dd50aa22 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 27 Feb 2013 11:38:12 -0500 Subject: SH-3899 WIP - more verbose logging of appearance request status, debug option to force failures for testing --- indra/newview/app_settings/settings.xml | 11 +++++++++ indra/newview/llappearancemgr.cpp | 41 ++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 18 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5db8d4e6a1..826a79b455 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1982,6 +1982,17 @@ Value 1
+ DebugForceAppearanceRequestFailure + + Comment + Request wrong cof version to test the failure path for server appearance update requests. + Persist + 1 + Type + Boolean + Value + 0 + DebugHideEmptySystemFolders Comment diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8d41edf6af..30e7f32ef7 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3046,7 +3046,7 @@ public: LL_DEBUGS("Avatar") << "OK" << LL_ENDL; if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { - dumpContents("appearance_request_ok", content); + dumpContents(gAgentAvatarp->getFullname() + "_appearance_request_ok", content); } } else @@ -3055,29 +3055,13 @@ public: } } - void dumpContents(const std::string outprefix, const LLSD& content) - { - std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); - std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); - std::ofstream ofs(fullpath); - ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); - LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; - } - - void debugCOF(const LLSD& content) - { - //S32 cof_version = content["cof_version"]; - //S32 cof_expected = content["expected"]; - //S32 cof_observed = content["observed"]; - } - // Error /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { llwarns << "appearance update request failed, status: " << status << " reason: " << reason << " code: " << content["code"].asInteger() << " error: \"" << content["error"].asString() << "\"" << llendl; if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { - dumpContents("appearance_request_error", content); + dumpContents(gAgentAvatarp->getFullname() + "_appearance_request_error", content); debugCOF(content); } @@ -3101,6 +3085,23 @@ public: } } + void dumpContents(const std::string outprefix, const LLSD& content) + { + std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + std::ofstream ofs(fullpath); + ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); + LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; + } + + void debugCOF(const LLSD& content) + { + //S32 cof_version = content["cof_version"]; + //S32 cof_expected = content["expected"]; + //S32 cof_observed = content["observed"]; + } + + LLPointer mRetryPolicy; }; @@ -3131,6 +3132,10 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond LLSD body; S32 cof_version = getCOFVersion(); body["cof_version"] = cof_version; + if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + { + body["cof_version"] = cof_version+1; + } LL_DEBUGS("Avatar") << "request url " << url << " my_cof_version " << cof_version << llendl; //LLCurl::ResponderPtr responder_ptr; -- cgit v1.2.3 From 72412e1b42325c35c02aef43a87b8907ca591d1f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 27 Feb 2013 11:55:08 -0500 Subject: Fix for mac build failure --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 30e7f32ef7..a87be17505 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3089,7 +3089,7 @@ public: { std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); - std::ofstream ofs(fullpath); + std::ofstream ofs(fullpath, std::ios_base::out); ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; } -- cgit v1.2.3 From df3f6f6cacd3803748af569ad76ae1131ad1b1b9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 27 Feb 2013 11:59:44 -0500 Subject: Fix for mac build failure this time for sure --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index a87be17505..2e71f15a78 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3089,7 +3089,7 @@ public: { std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); - std::ofstream ofs(fullpath, std::ios_base::out); + std::ofstream ofs(fullpath.c_str(), std::ios_base::out); ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; } -- cgit v1.2.3 From 41d3b428e1cfbaf8e21a335e1a9ee9a12ad46c33 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 27 Feb 2013 15:17:31 -0500 Subject: Increase number of retries for requestServerAppearanceUpdate() --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index a87be17505..adfdb7d93d 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3030,7 +3030,7 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder public: RequestAgentUpdateAppearanceResponder() { - mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 16.0, 2.0, 5); + mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10); } virtual ~RequestAgentUpdateAppearanceResponder() -- cgit v1.2.3 From 2b6d7e50053a7efd2a20032c801d4b7db3b49dc1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 27 Feb 2013 17:58:43 -0500 Subject: SH-3860 WIP - fixes for initial COF loading and config --- indra/newview/llappearancemgr.cpp | 2 +- indra/newview/llinventorymodel.cpp | 4 ++-- indra/newview/llstartup.cpp | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index adfdb7d93d..0177f6d83c 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1819,7 +1819,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) // Add link to outfit if category is an outfit. if (!append) { - createBaseOutfitLink(category, NULL); + createBaseOutfitLink(category, link_waiter); } // Remove current COF contents. Have to do this after creating diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 171a2cd043..f0bfc68866 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1922,9 +1922,9 @@ bool LLInventoryModel::loadSkeleton( for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) { LLViewerInventoryCategory *llvic = (*it); -#if 1 +#if 0 llvic->setVersion(NO_VERSION); -#else +#else // SH-3860 WIP if (llvic->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT && llvic->getVersion()==1) { llinfos << "preserving empty COF for first-time login" << llendl; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9d0df5e83e..717f578ddb 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2572,12 +2572,21 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, } else { + // FIXME SH-3860 - this creates a race condition, where COF + // changes (base outfit link added) after appearance update + // request has been submitted. sWearablesLoadedCon = gAgentWearables.addLoadedCallback(LLStartUp::saveInitialOutfit); bool do_copy = true; bool do_append = false; LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); +#if 0 // SH-3860 WIP + // Need to fetch cof contents before we can wear. + callAfterCategoryFetch(LLAppearanceMgr::instance().getCOF(), + boost::bind(&LLAppearanceMgr::wearInventoryCategory, LLAppearanceMgr::getInstance(), cat, do_copy, do_append)); +#else LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append); +#endif lldebugs << "initial outfit category id: " << cat_id << llendl; } -- cgit v1.2.3 From 03b51b779fd545e63b6f2fa2ef5ba28f21f1ae62 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 28 Feb 2013 10:56:12 -0500 Subject: SH-3895. Added code to recognize if the second incoming regions seed caps differ in size from the initial region caps. Also avoid starting a inventory fetch responder if the requisite cap is missing" --- indra/newview/llinventorymodelbackgroundfetch.cpp | 28 ++++----- indra/newview/llviewerregion.cpp | 70 +++++++++++++++++++++-- indra/newview/llviewerregion.h | 5 +- 3 files changed, 84 insertions(+), 19 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index eb92902de9..024d34519f 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -564,7 +564,6 @@ BOOL LLInventoryModelFetchDescendentsResponder::getIsRecursive(const LLUUID& cat { return (std::find(mRecursiveCatUUIDs.begin(),mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end()); } - // Bundle up a bunch of requests to send all at once. // static void LLInventoryModelBackgroundFetch::bulkFetch() @@ -687,20 +686,23 @@ void LLInventoryModelBackgroundFetch::bulkFetch() { if (folder_count) { - std::string url = region->getCapability("FetchInventoryDescendents2"); - mFetchCount++; - if (folder_request_body["folders"].size()) - { - LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body, recursive_cats); - LLHTTPClient::post(url, folder_request_body, fetcher, 300.0); - } - if (folder_request_body_lib["folders"].size()) + std::string url = region->getCapability("FetchInventoryDescendents2"); + if ( !url.empty() ) { - std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2"); + mFetchCount++; + if (folder_request_body["folders"].size()) + { + LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body, recursive_cats); + LLHTTPClient::post(url, folder_request_body, fetcher, 300.0); + } + if (folder_request_body_lib["folders"].size()) + { + std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2"); - LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body_lib, recursive_cats); - LLHTTPClient::post(url_lib, folder_request_body_lib, fetcher, 300.0); - } + LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body_lib, recursive_cats); + LLHTTPClient::post(url_lib, folder_request_body_lib, fetcher, 300.0); + } + } } if (item_count) { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d60ec04578..db5bba89e2 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -142,7 +142,8 @@ public: LLUUID mCacheID; CapabilityMap mCapabilities; - + CapabilityMap mSecondCapabilitiesTracker; + LLEventPoll* mEventPoll; S32 mSeedCapMaxAttempts; @@ -219,7 +220,7 @@ public: } } - void result(const LLSD& content) + void result(const LLSD& content) { LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if(!regionp) //region was removed @@ -237,6 +238,7 @@ public: for(iter = content.beginMap(); iter != content.endMap(); ++iter) { regionp->setCapability(iter->first, iter->second); + LL_DEBUGS2("AppInit", "Capabilities") << "got capability for " << iter->first << LL_ENDL; @@ -265,6 +267,53 @@ private: S32 mID; }; +class BaseCapabilitiesCompleteDebug : public LLHTTPClient::Responder +{ + LOG_CLASS(BaseCapabilitiesCompleteDebug); +public: + BaseCapabilitiesCompleteDebug( U64 region_handle, S32 id ) + : mRegionHandle(region_handle), mID(id) + { } + + virtual ~BaseCapabilitiesCompleteDebug() + { } + + void error(U32 statusNum, const std::string& reason) + { } + + void result(const LLSD& content) + { + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); + if(!regionp || mID != regionp->getHttpResponderID()) + { + return ; + } + LLSD::map_const_iterator iter; + for(iter = content.beginMap(); iter != content.endMap(); ++iter) + { + regionp->setCapabilityDebug(iter->first, iter->second); + } + + if ( regionp->getRegionImpl()->mCapabilities.size() != regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() ) + { + llwarns<<"Sim sent duplicate seed caps that differ in size - most likely content."<getRegionImplNC()->mSecondCapabilitiesTracker.clear(); + } + + } + + static BaseCapabilitiesCompleteDebug* build( U64 region_handle, S32 id ) + { + return new BaseCapabilitiesCompleteDebug( region_handle, id ); + } + +private: + U64 mRegionHandle; + S32 mID; + +}; + LLViewerRegion::LLViewerRegion(const U64 &handle, const LLHost &host, @@ -1529,7 +1578,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("EventQueueGet"); if (gSavedSettings.getBOOL("UseHTTPInventory")) - { + { capabilityNames.append("FetchLib2"); capabilityNames.append("FetchLibDescendents2"); capabilityNames.append("FetchInventory2"); @@ -1595,8 +1644,14 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) void LLViewerRegion::setSeedCapability(const std::string& url) { if (getCapability("Seed") == url) - { - // llwarns << "Ignoring duplicate seed capability" << llendl; + { + //llwarns << "Ignoring duplicate seed capability" << llendl; + //Instead of just returning we build up a second set of seed caps and compare them + //to the "original" seed cap received and determine why there is problem! + LLSD capabilityNames = LLSD::emptyArray(); + mImpl->buildCapabilityNames( capabilityNames ); + LLHTTPClient::post( url, capabilityNames, BaseCapabilitiesCompleteDebug::build(getHandle(), ++mImpl->mHttpResponderID ), + LLSD(), CAP_REQUEST_TIMEOUT ); return; } @@ -1732,6 +1787,11 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u } } +void LLViewerRegion::setCapabilityDebug(const std::string& name, const std::string& url) +{ + mImpl->mSecondCapabilitiesTracker[name] = url; +} + bool LLViewerRegion::isSpecialCapabilityName(const std::string &name) { return name == "EventQueueGet" || name == "UntrustedSimulatorMessage"; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 20d96ad9ac..b5fe4677b7 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -241,6 +241,7 @@ public: void failedSeedCapability(); S32 getNumSeedCapRetries(); void setCapability(const std::string& name, const std::string& url); + void setCapabilityDebug(const std::string& name, const std::string& url); // implements LLCapabilityProvider virtual std::string getCapability(const std::string& name) const; @@ -339,7 +340,9 @@ public: void getNeighboringRegions( std::vector& uniqueRegions ); void getNeighboringRegionsStatus( std::vector& regions ); - + const LLViewerRegionImpl * getRegionImpl() const { return mImpl; } + LLViewerRegionImpl * getRegionImplNC() { return mImpl; } + public: struct CompareDistance { -- cgit v1.2.3 From eae5cd57eb76fb65e36a69df90fa0aedeaa26ec1 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 28 Feb 2013 11:19:19 -0500 Subject: Renamed seedcap tracker class --- indra/newview/llviewerregion.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a7595a56d3..0033be2dbf 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -267,15 +267,15 @@ private: S32 mID; }; -class BaseCapabilitiesCompleteDebug : public LLHTTPClient::Responder +class BaseCapabilitiesCompleteTracker : public LLHTTPClient::Responder { - LOG_CLASS(BaseCapabilitiesCompleteDebug); + LOG_CLASS(BaseCapabilitiesCompleteTracker); public: - BaseCapabilitiesCompleteDebug( U64 region_handle, S32 id ) + BaseCapabilitiesCompleteTracker( U64 region_handle, S32 id ) : mRegionHandle(region_handle), mID(id) { } - virtual ~BaseCapabilitiesCompleteDebug() + virtual ~BaseCapabilitiesCompleteTracker() { } void error(U32 statusNum, const std::string& reason) @@ -296,16 +296,16 @@ public: if ( regionp->getRegionImpl()->mCapabilities.size() != regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() ) { - llwarns<<"Sim sent duplicate seed caps that differ in size - most likely content."<getRegionImplNC()->mSecondCapabilitiesTracker.clear(); } } - static BaseCapabilitiesCompleteDebug* build( U64 region_handle, S32 id ) + static BaseCapabilitiesCompleteTracker* build( U64 region_handle, S32 id ) { - return new BaseCapabilitiesCompleteDebug( region_handle, id ); + return new BaseCapabilitiesCompleteTracker( region_handle, id ); } private: @@ -1651,7 +1651,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) //to the "original" seed cap received and determine why there is problem! LLSD capabilityNames = LLSD::emptyArray(); mImpl->buildCapabilityNames( capabilityNames ); - LLHTTPClient::post( url, capabilityNames, BaseCapabilitiesCompleteDebug::build(getHandle(), ++mImpl->mHttpResponderID ), + LLHTTPClient::post( url, capabilityNames, BaseCapabilitiesCompleteTracker::build(getHandle(), ++mImpl->mHttpResponderID ), LLSD(), CAP_REQUEST_TIMEOUT ); return; } -- cgit v1.2.3 From c14b43b5bf21365573608a4bac98b99cddd61d4d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 28 Feb 2013 11:47:14 -0500 Subject: SH-3899 WIP - detailed logging of cof mismatch errors --- indra/newview/llappearancemgr.cpp | 70 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 6df4822135..e12ecea760 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3096,11 +3096,71 @@ public: void debugCOF(const LLSD& content) { - //S32 cof_version = content["cof_version"]; - //S32 cof_expected = content["expected"]; - //S32 cof_observed = content["observed"]; + LL_DEBUGS("Avatar") << "AIS COF, version found: " << content["expected"].asInteger() << llendl; + std::set ais_items, local_items; + const LLSD& cof_raw = content["cof_raw"]; + for (LLSD::array_const_iterator it = cof_raw.beginArray(); + it != cof_raw.endArray(); ++it) + { + const LLSD& item = *it; + if (item["parent_id"].asUUID() == LLAppearanceMgr::instance().getCOF()) + { + ais_items.insert(item["item_id"].asUUID()); + if (item["type"].asInteger() == 24) // link + { + LL_DEBUGS("Avatar") << "Link: item_id: " << item["item_id"].asUUID() + << " linked_item_id: " << item["asset_id"].asUUID() + << " name: " << item["name"].asString() + << llendl; + } + else if (item["type"].asInteger() == 25) // folder link + { + LL_DEBUGS("Avatar") << "Folder link: item_id: " << item["item_id"].asUUID() + << " linked_item_id: " << item["asset_id"].asUUID() + << " name: " << item["name"].asString() + << llendl; + + } + else + { + LL_DEBUGS("Avatar") << "Other: item_id: " << item["item_id"].asUUID() + << " linked_item_id: " << item["asset_id"].asUUID() + << " name: " << item["name"].asString() + << llendl; + } + } + } + LL_DEBUGS("Avatar") << llendl; + LL_DEBUGS("Avatar") << "Local COF, version req: " << content["observed"] << llendl; + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), + cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); + for (S32 i=0; igetUUID()); + LL_DEBUGS("Avatar") << "item_id: " << inv_item->getUUID() + << " linked_item_id: " << inv_item->getLinkedUUID() + << " name: " << inv_item->getName() + << llendl; + } + LL_DEBUGS("Avatar") << llendl; + for (std::set::iterator it = local_items.begin(); it != local_items.end(); ++it) + { + if (ais_items.find(*it) == ais_items.end()) + { + LL_DEBUGS("Avatar") << "LOCAL ONLY: " << *it << llendl; + } + } + for (std::set::iterator it = ais_items.begin(); it != ais_items.end(); ++it) + { + if (local_items.find(*it) == local_items.end()) + { + LL_DEBUGS("Avatar") << "AIS ONLY: " << *it << llendl; + } + } } - LLPointer mRetryPolicy; }; @@ -3134,7 +3194,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond body["cof_version"] = cof_version; if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) { - body["cof_version"] = cof_version+1; + body["cof_version"] = cof_version+999; } LL_DEBUGS("Avatar") << "request url " << url << " my_cof_version " << cof_version << llendl; -- cgit v1.2.3 From f92a830730b8acf8930a439ed874f27f77102260 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 28 Feb 2013 13:40:36 -0500 Subject: Bug fix# we don't want to be incrementing the responderid in the base responder --- indra/newview/llviewerregion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0033be2dbf..9a1c5f89ef 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1651,7 +1651,9 @@ void LLViewerRegion::setSeedCapability(const std::string& url) //to the "original" seed cap received and determine why there is problem! LLSD capabilityNames = LLSD::emptyArray(); mImpl->buildCapabilityNames( capabilityNames ); - LLHTTPClient::post( url, capabilityNames, BaseCapabilitiesCompleteTracker::build(getHandle(), ++mImpl->mHttpResponderID ), + S32 responderID = mImpl->mHttpResponderID+1; + + LLHTTPClient::post( url, capabilityNames, BaseCapabilitiesCompleteTracker::build(getHandle(), responderID ), LLSD(), CAP_REQUEST_TIMEOUT ); return; } -- cgit v1.2.3 From 22f05155990176ece57390e69de71deae9f34ed4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 28 Feb 2013 14:53:53 -0500 Subject: SH-3899 WIP --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e12ecea760..48a2ab0eb2 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3131,7 +3131,7 @@ public: } } LL_DEBUGS("Avatar") << llendl; - LL_DEBUGS("Avatar") << "Local COF, version req: " << content["observed"] << llendl; + LL_DEBUGS("Avatar") << "Local COF, version requested: " << content["observed"].asInteger() << llendl; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), -- cgit v1.2.3 From ecb3d1d64d035f22c6d85864131cae6a1108fc68 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 28 Feb 2013 15:58:56 -0500 Subject: SH-3932 FIX - added LLSD blob for viewer-side cof contents, optionally included with request appearance update --- indra/newview/llappearancemgr.cpp | 25 +++++++++++++++++++++++++ indra/newview/llappearancemgr.h | 3 +++ 2 files changed, 28 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 48a2ab0eb2..6c3858b947 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3165,6 +3165,27 @@ public: LLPointer mRetryPolicy; }; +LLSD LLAppearanceMgr::dumpCOF() const +{ + LLSD result = LLSD::emptyArray(); + + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(getCOF(),cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); + for (S32 i=0; igetUUID(); + item["linked_item_id"] = inv_item->getLinkedUUID(); + item["name"] = inv_item->getName(); + item["description"] = inv_item->getActualDescription(); + item["type"] = inv_item->getActualType(); + result.append(item); + } + return result; +} + void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr responder_ptr) { if (gAgentAvatarp->isEditingAppearance()) @@ -3196,6 +3217,10 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond { body["cof_version"] = cof_version+999; } + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + body["debug_cof"] = dumpCOF(); + } LL_DEBUGS("Avatar") << "request url " << url << " my_cof_version " << cof_version << llendl; //LLCurl::ResponderPtr responder_ptr; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index b35504eb1f..84e08db4c8 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -94,6 +94,9 @@ public: const LLUUID getCOF() const; S32 getCOFVersion() const; + // Debugging - get truncated LLSD summary of COF contents. + LLSD dumpCOF() const; + // COF version of last viewer-initiated appearance update request. S32 mLastUpdateRequestCOFVersion; S32 getLastUpdateRequestCOFVersion() const; -- cgit v1.2.3 From c9feefb714291fc80f9eadfda2e1ec5f68ad0a84 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 28 Feb 2013 16:22:27 -0500 Subject: WIP: Removed caching of responder id. Code to dump the new and old seed caps when we receive multiple seedcaps for a region. --- indra/newview/llviewerregion.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 9a1c5f89ef..e940dda010 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -271,8 +271,8 @@ class BaseCapabilitiesCompleteTracker : public LLHTTPClient::Responder { LOG_CLASS(BaseCapabilitiesCompleteTracker); public: - BaseCapabilitiesCompleteTracker( U64 region_handle, S32 id ) - : mRegionHandle(region_handle), mID(id) + BaseCapabilitiesCompleteTracker( U64 region_handle) + : mRegionHandle(region_handle) { } virtual ~BaseCapabilitiesCompleteTracker() @@ -284,34 +284,40 @@ public: void result(const LLSD& content) { LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if(!regionp || mID != regionp->getHttpResponderID()) - { + if( !regionp ) + { return ; } LLSD::map_const_iterator iter; for(iter = content.beginMap(); iter != content.endMap(); ++iter) { - regionp->setCapabilityDebug(iter->first, iter->second); + regionp->setCapabilityDebug(iter->first, iter->second); + //llinfos<<"BaseCapabilitiesCompleteTracker New Caps "<first<<" "<< iter->second<getRegionImpl()->mCapabilities.size() != regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() ) { - llwarns<<"Sim sent duplicate seed caps that differs in size - most likely content."<getRegionImpl()->mCapabilities.begin(); + while (iter!=regionp->getRegionImpl()->mCapabilities.end() ) + { + llinfos<<"BaseCapabilitiesCompleteTracker Original "<first<<" "<< iter->second<getRegionImplNC()->mSecondCapabilitiesTracker.clear(); } } - static BaseCapabilitiesCompleteTracker* build( U64 region_handle, S32 id ) + static BaseCapabilitiesCompleteTracker* build( U64 region_handle ) { - return new BaseCapabilitiesCompleteTracker( region_handle, id ); + return new BaseCapabilitiesCompleteTracker( region_handle ); } private: - U64 mRegionHandle; - S32 mID; - + U64 mRegionHandle; }; @@ -1651,9 +1657,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) //to the "original" seed cap received and determine why there is problem! LLSD capabilityNames = LLSD::emptyArray(); mImpl->buildCapabilityNames( capabilityNames ); - S32 responderID = mImpl->mHttpResponderID+1; - - LLHTTPClient::post( url, capabilityNames, BaseCapabilitiesCompleteTracker::build(getHandle(), responderID ), + LLHTTPClient::post( url, capabilityNames, BaseCapabilitiesCompleteTracker::build(getHandle() ), LLSD(), CAP_REQUEST_TIMEOUT ); return; } -- cgit v1.2.3 From d1c144519306cae7eff7f781417482c85068988c Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Thu, 28 Feb 2013 17:25:37 -0500 Subject: SH-3909 Support avatar height offset Adding a new visual param that allows users to manually adjust an offset for how far off the ground (+ or -) their avatar's root bone is. Supports the +-2m range people are used to adjusting in their viewers, but new implementation should support server-generated appearances. --- indra/newview/character/avatar_lad.xml | 17 +++++++++++++++++ indra/newview/llagent.cpp | 4 ++-- indra/newview/llcallingcard.cpp | 3 ++- indra/newview/llvoavatar.cpp | 10 ++++++---- indra/newview/skins/default/xui/en/strings.xml | 1 + 5 files changed, 28 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 2b090c4fa4..284e9c44b2 100755 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -1084,6 +1084,23 @@ scale="0 0 .5" /> + + + + + mBodySize.mV[VZ]; + agent_pos.mV[VZ] -= 0.5f * (gAgentAvatarp->mBodySize.mV[VZ] + gAgentAvatarp->mAvatarOffset.mV[VZ]); } agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); @@ -4385,7 +4385,7 @@ void LLAgent::sendAgentSetAppearance() // NOTE -- when we start correcting all of the other Havok geometry // to compensate for the COLLISION_TOLERANCE ugliness we will have // to tweak this number again - const LLVector3 body_size = gAgentAvatarp->mBodySize; + const LLVector3 body_size = gAgentAvatarp->mBodySize + gAgentAvatarp->mAvatarOffset; msg->addVector3Fast(_PREHASH_Size, body_size); // To guard against out of order packets diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 0d55c4429a..0b8f863e75 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -183,7 +183,8 @@ LLVector3d LLAvatarTracker::getGlobalPos() global_pos = object->getPositionGlobal(); // HACK - for making the tracker point above the avatar's head // rather than its groin - global_pos.mdV[VZ] += 0.7f * ((LLVOAvatar *)object)->mBodySize.mV[VZ]; + LLVOAvatar* av = (LLVOAvatar*)object; + global_pos.mdV[VZ] += 0.7f * (av->mBodySize.mV[VZ] + av->mAvatarOffset.mV[VZ]); mTrackingData->mGlobalPositionEstimate = global_pos; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 266b9fecd5..aa90cbc5d2 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2061,7 +2061,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { LLVector3 tagPos = mRoot->getWorldPosition(); tagPos[VZ] -= mPelvisToFoot; - tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); + tagPos[VZ] += ( mBodySize[VZ] + mAvatarOffset[VZ] + 0.125f ); mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos ); } }//if ( voiceEnabled ) @@ -2805,12 +2805,12 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) local_camera_up.normalize(); local_camera_up = local_camera_up * ~root_rot; - local_camera_up.scaleVec(mBodySize * 0.5f); - local_camera_at.scaleVec(mBodySize * 0.5f); + local_camera_up.scaleVec((mBodySize + mAvatarOffset) * 0.5f); + local_camera_at.scaleVec((mBodySize + mAvatarOffset) * 0.5f); LLVector3 name_position = mRoot->getWorldPosition(); name_position[VZ] -= mPelvisToFoot; - name_position[VZ] += (mBodySize[VZ]* 0.55f); + name_position[VZ] += ((mBodySize[VZ] + mAvatarOffset[VZ])* 0.55f); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); name_position += pixel_up_vec * 15.f; @@ -3110,6 +3110,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition()); + root_pos.mdV[VZ] += getVisualParamWeight(11001); + resolveHeightGlobal(root_pos, ground_under_pelvis, normal); F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 4383b98592..883a06d5e1 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2991,6 +2991,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Higher Hip Length Hip Width +Hover In Inner Shadow Color Inner Shadow Opacity -- cgit v1.2.3 From 70e22de2bb9bf8515d7e3cd68c7328beb75409d6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Mar 2013 09:06:40 -0500 Subject: SH-3860 WIP - fixes the cloud on initial login, still have a COF version rae condition due to creation of the base outfit link --- indra/newview/llappearancemgr.cpp | 9 ++++----- indra/newview/llinventorymodel.cpp | 11 ----------- indra/newview/llstartup.cpp | 4 ---- 3 files changed, 4 insertions(+), 20 deletions(-) mode change 100644 => 100755 indra/newview/llstartup.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 6c3858b947..d8ba4239b7 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3658,9 +3658,9 @@ public: } virtual void done() { - // What we do here is get the complete information on the items in - // the library, and set up an observer that will wait for that to - // happen. + // What we do here is get the complete information on the + // items in the requested category, and set up an observer + // that will wait for that to happen. LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(mComplete.front(), @@ -3674,9 +3674,8 @@ public: << llendl; //dec_busy_count(); gInventory.removeObserver(this); + doOnIdleOneTime(mCallable); - // lets notify observers that loading is finished. - gAgentWearables.notifyLoadingFinished(); delete this; return; } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index f0bfc68866..ac1f40b486 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1922,18 +1922,7 @@ bool LLInventoryModel::loadSkeleton( for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) { LLViewerInventoryCategory *llvic = (*it); -#if 0 llvic->setVersion(NO_VERSION); -#else // SH-3860 WIP - if (llvic->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT && llvic->getVersion()==1) - { - llinfos << "preserving empty COF for first-time login" << llendl; - } - else - { - llvic->setVersion(NO_VERSION); - } -#endif addCategory(*it); } } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp old mode 100644 new mode 100755 index 717f578ddb..156aa25274 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2580,13 +2580,9 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, bool do_copy = true; bool do_append = false; LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); -#if 0 // SH-3860 WIP // Need to fetch cof contents before we can wear. callAfterCategoryFetch(LLAppearanceMgr::instance().getCOF(), boost::bind(&LLAppearanceMgr::wearInventoryCategory, LLAppearanceMgr::getInstance(), cat, do_copy, do_append)); -#else - LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append); -#endif lldebugs << "initial outfit category id: " << cat_id << llendl; } -- cgit v1.2.3 From 312b2563548c19837707b6598932d8ef19430f73 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Mar 2013 13:50:21 -0500 Subject: Periodic log messages to explain why user is still clouded, if they are --- indra/newview/llvoavatarself.cpp | 50 ++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index c069488a37..d3c91f3339 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1946,19 +1946,41 @@ void LLVOAvatarSelf::dumpTotalLocalTextureByteCount() BOOL LLVOAvatarSelf::getIsCloud() const { + // Let people know why they're clouded without spamming them into oblivion. + bool do_warn = false; + static LLTimer time_since_notice; + F32 update_freq = 30.0; + if (time_since_notice.getElapsedTimeF32() > update_freq) + { + time_since_notice.reset(); + do_warn = true; + } + // do we have our body parts? - if (gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE) == 0 || - gAgentWearables.getWearableCount(LLWearableType::WT_HAIR) == 0 || - gAgentWearables.getWearableCount(LLWearableType::WT_EYES) == 0 || - gAgentWearables.getWearableCount(LLWearableType::WT_SKIN) == 0) + S32 shape_count = gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE); + S32 hair_count = gAgentWearables.getWearableCount(LLWearableType::WT_HAIR); + S32 eye_count = gAgentWearables.getWearableCount(LLWearableType::WT_EYES); + S32 skin_count = gAgentWearables.getWearableCount(LLWearableType::WT_SKIN); + if (!shape_count || !hair_count || !eye_count || !skin_count) { - lldebugs << "No body parts" << llendl; + if (do_warn) + { + llinfos << "Self is clouded due to missing one or more required body parts: " + << (shape_count ? "" : "SHAPE ") + << (hair_count ? "" : "HAIR ") + << (eye_count ? "" : "EYES ") + << (skin_count ? "" : "SKIN ") + << llendl; + } return TRUE; } if (!isTextureDefined(TEX_HAIR, 0)) { - lldebugs << "No hair texture" << llendl; + if (do_warn) + { + llinfos << "Self is clouded because of no hair texture" << llendl; + } return TRUE; } @@ -1967,14 +1989,20 @@ BOOL LLVOAvatarSelf::getIsCloud() const if (!isLocalTextureDataAvailable(getLayerSet(BAKED_LOWER)) && (!isTextureDefined(TEX_LOWER_BAKED, 0))) { - lldebugs << "Lower textures not baked" << llendl; + if (do_warn) + { + llinfos << "Self is clouded because lower textures not baked" << llendl; + } return TRUE; } if (!isLocalTextureDataAvailable(getLayerSet(BAKED_UPPER)) && (!isTextureDefined(TEX_UPPER_BAKED, 0))) { - lldebugs << "Upper textures not baked" << llendl; + if (do_warn) + { + llinfos << "Self is clouded because upper textures not baked" << llendl; + } return TRUE; } @@ -1991,7 +2019,11 @@ BOOL LLVOAvatarSelf::getIsCloud() const const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 ); if (!baked_img || !baked_img->hasGLTexture()) { - lldebugs << "Texture at index " << i << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << llendl; + if (do_warn) + { + llinfos << "Self is clouded because texture at index " << i + << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << llendl; + } return TRUE; } } -- cgit v1.2.3 From 3e5599a827238faa4fcccfad9702428ce4ea6f46 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 1 Mar 2013 19:39:47 -0500 Subject: SH-3649 WIP newly created pants do not show up on mac/windows. Added an initializer for the wearable definition version when creating a new wearable. Should fix the issue but need to test. --- indra/newview/llwearablelist.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 507ce57e79..ef1a953f59 100755 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -249,6 +249,8 @@ LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type, perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); wearable->setPermissions(perm); + wearable->setDefinitionVersion(LLWearable::getCurrentDefinitionVersion()); + // Description and sale info have default values. wearable->setParamsToDefaults(); wearable->setTexturesToDefaults(); -- cgit v1.2.3 From 8410887e2e8327f3a24e74f6bc89a4feddcbff62 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sun, 3 Mar 2013 23:32:48 -0800 Subject: Adding DebugAvatarExperimentalServerAppearanceUpdate setting to test sending full cof contents --- indra/newview/app_settings/settings.xml | 11 ++++++++ indra/newview/llappearancemgr.cpp | 48 ++++++++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 826a79b455..215fcf4eab 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1937,6 +1937,17 @@ Boolean Value 0 + + DebugAvatarExperimentalServerAppearanceUpdate + + Comment + Experiment with sending full cof_contents instead of cof_version + Persist + 1 + Type + Boolean + Value + 0 DebugAvatarRezTime diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d8ba4239b7..cc78d5a2fc 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3177,10 +3177,41 @@ LLSD LLAppearanceMgr::dumpCOF() const const LLViewerInventoryItem* inv_item = item_array.get(i).get(); LLSD item; item["item_id"] = inv_item->getUUID(); - item["linked_item_id"] = inv_item->getLinkedUUID(); item["name"] = inv_item->getName(); item["description"] = inv_item->getActualDescription(); - item["type"] = inv_item->getActualType(); + item["asset_type"] = inv_item->getActualType(); + item["inv_type"] = inv_item->getInventoryType(); + item["linked_id"] = inv_item->getLinkedUUID(); + + if (LLAssetType::AT_LINK == inv_item->getActualType()) + { + const LLViewerInventoryItem* linked_item = inv_item->getLinkedItem(); + if (NULL == linked_item) + { + llwarns << "Broken link for item '" << inv_item->getName() + << "' (" << inv_item->getUUID() + << ") during requestServerAppearanceUpdate" << llendl; + continue; + } + if (linked_item->getAssetUUID().isNull()) + { + llwarns << "Broken link (null asset) for item '" << inv_item->getName() + << "' (" << inv_item->getUUID() + << ") during requestServerAppearanceUpdate" << llendl; + continue; + } + item["linked_asset_id"] = linked_item->getAssetUUID(); + item["linked_asset_type"] = linked_item->getType(); + item["linked_flags"] = LLSD::Integer(linked_item->getFlags()); + } + else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType()) + { + llwarns << "Non-link item '" << inv_item->getName() + << "' (" << inv_item->getUUID() + << ") type " << (S32) inv_item->getActualType() + << " during requestServerAppearanceUpdate" << llendl; + continue; + } result.append(item); } return result; @@ -3212,14 +3243,17 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond LLSD body; S32 cof_version = getCOFVersion(); - body["cof_version"] = cof_version; - if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + if (gSavedSettings.getBOOL("DebugAvatarExperimentalServerAppearanceUpdate")) { - body["cof_version"] = cof_version+999; + body["cof_contents"] = dumpCOF(); } - if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + else { - body["debug_cof"] = dumpCOF(); + body["cof_version"] = cof_version; + if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + { + body["cof_version"] = cof_version+999; + } } LL_DEBUGS("Avatar") << "request url " << url << " my_cof_version " << cof_version << llendl; -- cgit v1.2.3 From ec1bc19d01715299209d9f00230e4681917bde12 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 4 Mar 2013 01:09:45 -0800 Subject: Adding md5sum calculation to experimental server appearance update message --- indra/newview/llappearancemgr.cpp | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index cc78d5a2fc..2cebf6863e 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -26,6 +26,7 @@ #include "llviewerprecompiledheaders.h" +#include #include "llaccordionctrltab.h" #include "llagent.h" #include "llagentcamera.h" @@ -52,6 +53,11 @@ #include "llsdutil.h" #include "llsdserialize.h" +#if LL_MSVC +// disable boost::lexical_cast warning +#pragma warning (disable:4702) +#endif + std::string self_av_string() { // On logout gAgentAvatarp can already be invalid @@ -3167,7 +3173,8 @@ public: LLSD LLAppearanceMgr::dumpCOF() const { - LLSD result = LLSD::emptyArray(); + LLSD links = LLSD::emptyArray(); + LLMD5 md5; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; @@ -3176,12 +3183,17 @@ LLSD LLAppearanceMgr::dumpCOF() const { const LLViewerInventoryItem* inv_item = item_array.get(i).get(); LLSD item; - item["item_id"] = inv_item->getUUID(); + LLUUID item_id(inv_item->getUUID()); + item["item_id"] = item_id; + md5.update((unsigned char*)item_id.mData, 16); item["name"] = inv_item->getName(); item["description"] = inv_item->getActualDescription(); + md5.update(inv_item->getActualDescription()); item["asset_type"] = inv_item->getActualType(); item["inv_type"] = inv_item->getInventoryType(); - item["linked_id"] = inv_item->getLinkedUUID(); + LLUUID linked_id(inv_item->getLinkedUUID()); + item["linked_id"] = linked_id; + md5.update((unsigned char*)linked_id.mData, 16); if (LLAssetType::AT_LINK == inv_item->getActualType()) { @@ -3200,9 +3212,13 @@ LLSD LLAppearanceMgr::dumpCOF() const << ") during requestServerAppearanceUpdate" << llendl; continue; } - item["linked_asset_id"] = linked_item->getAssetUUID(); + LLUUID linked_asset_id(linked_item->getAssetUUID()); + item["linked_asset_id"] = linked_asset_id; + md5.update((unsigned char*)linked_asset_id.mData, 16); item["linked_asset_type"] = linked_item->getType(); - item["linked_flags"] = LLSD::Integer(linked_item->getFlags()); + U32 flags = linked_item->getFlags(); + item["linked_flags"] = LLSD::Integer(flags); + md5.update(boost::lexical_cast(flags)); } else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType()) { @@ -3212,8 +3228,14 @@ LLSD LLAppearanceMgr::dumpCOF() const << " during requestServerAppearanceUpdate" << llendl; continue; } - result.append(item); + links.append(item); } + LLSD result = LLSD::emptyMap(); + result["cof_contents"] = links; + char cof_md5sum[MD5HEX_STR_SIZE]; + md5.finalize(); + md5.hex_digest(cof_md5sum); + result["cof_md5sum"] = std::string(cof_md5sum); return result; } @@ -3245,7 +3267,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond S32 cof_version = getCOFVersion(); if (gSavedSettings.getBOOL("DebugAvatarExperimentalServerAppearanceUpdate")) { - body["cof_contents"] = dumpCOF(); + body = dumpCOF(); } else { -- cgit v1.2.3 From 2e942026865e921ad5bc89cc5d8311abf0924163 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 4 Mar 2013 13:14:35 -0500 Subject: Removed deprecated calls to incrementCofVersion --- indra/newview/llpaneleditwearable.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index a49bbcd924..e71dba5cae 100755 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1105,15 +1105,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); } - if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion() > 0) - { - LLAppearanceMgr::getInstance()->incrementCofVersion(); - } - else - { - // *HACK This should be removed when all regions support the IncrementCOFVersion capability. - incrementCofVersionLegacy(); - } + } void LLPanelEditWearable::revertChanges() -- cgit v1.2.3 From 2efe411a4fd8d76e9a153ed4aad9235819738328 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 4 Mar 2013 12:02:02 -0800 Subject: Reducing amount of cof link data sent to appearance update service. Allowing links to items with 'null' asset ids to be passed --- indra/newview/llappearancemgr.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2cebf6863e..fa239e2c8a 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3184,13 +3184,10 @@ LLSD LLAppearanceMgr::dumpCOF() const const LLViewerInventoryItem* inv_item = item_array.get(i).get(); LLSD item; LLUUID item_id(inv_item->getUUID()); - item["item_id"] = item_id; md5.update((unsigned char*)item_id.mData, 16); - item["name"] = inv_item->getName(); item["description"] = inv_item->getActualDescription(); md5.update(inv_item->getActualDescription()); item["asset_type"] = inv_item->getActualType(); - item["inv_type"] = inv_item->getInventoryType(); LLUUID linked_id(inv_item->getLinkedUUID()); item["linked_id"] = linked_id; md5.update((unsigned char*)linked_id.mData, 16); @@ -3205,19 +3202,17 @@ LLSD LLAppearanceMgr::dumpCOF() const << ") during requestServerAppearanceUpdate" << llendl; continue; } - if (linked_item->getAssetUUID().isNull()) - { - llwarns << "Broken link (null asset) for item '" << inv_item->getName() - << "' (" << inv_item->getUUID() - << ") during requestServerAppearanceUpdate" << llendl; - continue; - } + // Some assets may be 'hidden' and show up as null in the viewer. + //if (linked_item->getAssetUUID().isNull()) + //{ + // llwarns << "Broken link (null asset) for item '" << inv_item->getName() + // << "' (" << inv_item->getUUID() + // << ") during requestServerAppearanceUpdate" << llendl; + // continue; + //} LLUUID linked_asset_id(linked_item->getAssetUUID()); - item["linked_asset_id"] = linked_asset_id; md5.update((unsigned char*)linked_asset_id.mData, 16); - item["linked_asset_type"] = linked_item->getType(); U32 flags = linked_item->getFlags(); - item["linked_flags"] = LLSD::Integer(flags); md5.update(boost::lexical_cast(flags)); } else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType()) -- cgit v1.2.3 From 9a0c52a247ecbd79f5f872ceb97a6be3e0499bea Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 5 Mar 2013 11:28:06 -0800 Subject: Adding debug setting to allow overriding appearance service url --- indra/newview/app_settings/settings.xml | 22 +++++++++++----------- indra/newview/llappearancemgr.cpp | 9 +++++++++ indra/newview/llappearancemgr.h | 7 +++++++ indra/newview/llstartup.cpp | 2 +- indra/newview/llvoavatar.cpp | 7 ++++--- indra/newview/llvoavatarself.cpp | 2 +- 6 files changed, 33 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 215fcf4eab..089bc7d4cd 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -71,17 +71,6 @@ Value 0 - AgentAppearanceServiceURL - - Comment - Current Session Agent Appearance Service URL - Persist - 0 - Type - String - Value - - AlertedUnsupportedHardware Comment @@ -1949,6 +1938,17 @@ Value 0 + DebugAvatarAppearanceServiceURLOverride + + Comment + URL to use for baked texture requests; overrides value returned by login server. + Persist + 1 + Type + String + Value + + DebugAvatarRezTime Comment diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index fa239e2c8a..1561f8d74c 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3359,6 +3359,15 @@ void LLAppearanceMgr::incrementCofVersion(LLHTTPClient::ResponderPtr responder_p LLHTTPClient::get(url, body, responder_ptr, headers, 30.0f); } +std::string LLAppearanceMgr::getAppearanceServiceURL() const +{ + if (gSavedSettings.getString("DebugAvatarAppearanceServiceURLOverride").empty()) + { + return mAppearanceServiceURL; + } + return gSavedSettings.getString("DebugAvatarAppearanceServiceURLOverride"); +} + void show_created_outfit(LLUUID& folder_id, bool show_panel = true) { if (!LLApp::isRunning()) diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 84e08db4c8..d49f5d6c15 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -205,6 +205,13 @@ public: // *HACK Remove this after server side texture baking is deployed on all sims. void incrementCofVersionLegacy(); + void setAppearanceServiceURL(const std::string& url) { mAppearanceServiceURL = url; } + std::string getAppearanceServiceURL() const; + +private: + std::string mAppearanceServiceURL; + + protected: LLAppearanceMgr(); ~LLAppearanceMgr(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 156aa25274..e6e7b8650c 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3449,7 +3449,7 @@ bool process_login_success_response() std::string agent_appearance_url = response["agent_appearance_service"]; if (!agent_appearance_url.empty()) { - gSavedSettings.setString("AgentAppearanceServiceURL", agent_appearance_url); + LLAppearanceMgr::instance().setAppearanceServiceURL(agent_appearance_url); } // Set the location of the snapshot sharing config endpoint diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f6fd8b2409..df44251c32 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4496,7 +4496,8 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) std::string url = ""; if (isUsingServerBakes()) { - if (gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + const std::string& appearance_service_url = LLAppearanceMgr::instance().getAppearanceServiceURL(); + if (appearance_service_url.empty()) { // Probably a server-side issue if we get here: llwarns << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << llendl; @@ -4506,7 +4507,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) { - url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + url = appearance_service_url + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); //llinfos << "baked texture url: " << url << llendl; } } @@ -7256,7 +7257,7 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { - // llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; + LL_DEBUGS("Avatar") << "onBakedTextureLoaded: " << src_vi->getID() << LL_ENDL; LLUUID id = src_vi->getID(); LLUUID *avatar_idp = (LLUUID *)userdata; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index d3c91f3339..3605383c5c 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2469,7 +2469,7 @@ void LLVOAvatarSelf::checkForUnsupportedServerBakeAppearance() return; // if baked image service is unknown, need to refresh. - if (gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + if (LLAppearanceMgr::instance().getAppearanceServiceURL().empty()) { CheckAgentAppearanceServiceResponder::forceAppearanceUpdate(); } -- cgit v1.2.3 From 54cdc322b8f2bd35b289cacf3493622e7cc51194 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 5 Mar 2013 22:05:22 -0800 Subject: Fixing issues with not detecting when LLSD XML parsing fails. Changing most http error handlers to understand LLSD error responses. Fleshing out most http error handler message spam. --- indra/newview/llaccountingcostmanager.cpp | 4 +- indra/newview/llagent.cpp | 13 ++--- indra/newview/llagentpilot.cpp | 2 +- indra/newview/llappearancemgr.cpp | 6 +-- indra/newview/llassetuploadqueue.cpp | 7 +-- indra/newview/llassetuploadresponders.cpp | 15 +++--- indra/newview/llassetuploadresponders.h | 6 +-- indra/newview/llclassifiedstatsresponder.cpp | 5 +- indra/newview/llclassifiedstatsresponder.h | 2 +- indra/newview/llestateinfomodel.cpp | 4 +- indra/newview/lleventpoll.cpp | 12 ++--- indra/newview/llfasttimerview.cpp | 6 +-- indra/newview/llfloateravatarpicker.cpp | 3 +- indra/newview/llfloaterregiondebugconsole.cpp | 2 +- indra/newview/llfloaterregioninfo.cpp | 16 +++--- indra/newview/llfloaterreporter.cpp | 2 +- indra/newview/llfloaterscriptlimits.cpp | 16 +++--- indra/newview/llfloaterscriptlimits.h | 8 +-- indra/newview/llgroupmgr.cpp | 7 +-- indra/newview/llhomelocationresponder.cpp | 4 +- indra/newview/llhomelocationresponder.h | 2 +- indra/newview/llimfloater.cpp | 5 +- indra/newview/llimpanel.cpp | 5 +- indra/newview/llimview.cpp | 11 +++-- indra/newview/llinspectavatar.cpp | 4 +- indra/newview/llinventorymodel.cpp | 10 ++-- indra/newview/llinventorymodel.h | 2 +- indra/newview/llinventorymodelbackgroundfetch.cpp | 14 +++--- indra/newview/llmediadataclient.cpp | 10 ++-- indra/newview/llmediadataclient.h | 4 +- indra/newview/llpathfindingmanager.cpp | 59 +++++++++++++---------- indra/newview/llpathfindingnavmesh.cpp | 5 +- indra/newview/llpathfindingnavmesh.h | 2 +- indra/newview/llproductinforequest.cpp | 6 +-- indra/newview/llremoteparcelrequest.cpp | 6 +-- indra/newview/llremoteparcelrequest.h | 2 +- indra/newview/llspeakers.cpp | 4 +- indra/newview/lluploadfloaterobservers.cpp | 5 +- indra/newview/lluploadfloaterobservers.h | 2 +- indra/newview/llviewerdisplayname.cpp | 4 +- indra/newview/llviewerobjectlist.cpp | 12 ++--- indra/newview/llviewerregion.cpp | 15 +++--- indra/newview/llviewerstats.cpp | 6 +-- indra/newview/llvoavatarself.cpp | 7 +-- indra/newview/llvoicechannel.cpp | 10 ++-- indra/newview/llvoicevivox.cpp | 21 ++++---- indra/newview/llwebsharing.cpp | 16 +++--- indra/newview/llwlhandlers.cpp | 17 ++++--- indra/newview/llwlhandlers.h | 5 +- indra/newview/tests/llmediadataclient_test.cpp | 4 +- 50 files changed, 224 insertions(+), 191 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp index 8767955fcb..7662a9689d 100644 --- a/indra/newview/llaccountingcostmanager.cpp +++ b/indra/newview/llaccountingcostmanager.cpp @@ -56,9 +56,9 @@ public: } } - void error( U32 statusNum, const std::string& reason ) + void errorWithContent( U32 statusNum, const std::string& reason, const LLSD& content ) { - llwarns << "Transport error "<handlePreferredMaturityResult(actualMaturity); } -void LLMaturityPreferencesResponder::error(U32 pStatus, const std::string& pReason) +void LLMaturityPreferencesResponder::errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent) { llwarns << "while attempting to change maturity preference from '" << LLViewerRegion::accessToString(mPreviousMaturity) - << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) << "', we got an error because '" - << pReason << "' [status:" << pStatus << "]" << llendl; + << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) << "', we got an error with [status:" + << pStatus << "]: " << (pContent.isDefined() ? pContent : LLSD(pReason)) << llendl; mAgent->handlePreferredMaturityError(); } @@ -2783,7 +2783,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) // If we don't have a region, report it as an error if (getRegion() == NULL) { - responderPtr->error(0U, "region is not defined"); + responderPtr->errorWithContent(0U, "region is not defined", LLSD()); } else { @@ -2793,7 +2793,8 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) // If the capability is not defined, report it as an error if (url.empty()) { - responderPtr->error(0U, "capability 'UpdateAgentInformation' is not defined for region"); + responderPtr->errorWithContent(0U, + "capability 'UpdateAgentInformation' is not defined for region", LLSD()); } else { diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 734c502fcf..c7872fc5f6 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -139,7 +139,7 @@ void LLAgentPilot::loadXML(const std::string& filename) mActions.reset(); LLSD record; - while (!file.eof() && LLSDSerialize::fromXML(record, file)) + while (!file.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(record, file)) { Action action; action.mTime = record["time"].asReal(); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1561f8d74c..2c76efc7fb 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3308,10 +3308,10 @@ public: app_mgr->mLastUpdateRequestCOFVersion = new_version; } - virtual void error(U32 pStatus, const std::string& pReason) + virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& content) { - llwarns << "While attempting to increment the agent's cof we got an error because '" - << pReason << "' [status:" << pStatus << "]" << llendl; + llwarns << "While attempting to increment the agent's cof we got an error with [status:" + << pStatus << "]: " << content << llendl; F32 seconds_to_wait; if (mRetryPolicy->shouldRetry(pStatus,seconds_to_wait)) { diff --git a/indra/newview/llassetuploadqueue.cpp b/indra/newview/llassetuploadqueue.cpp index f943759bb8..4bdb690225 100644 --- a/indra/newview/llassetuploadqueue.cpp +++ b/indra/newview/llassetuploadqueue.cpp @@ -69,10 +69,11 @@ public: delete mData; } - virtual void error(U32 statusNum, const std::string& reason) + virtual void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llwarns << "Error: " << reason << llendl; - LLUpdateTaskInventoryResponder::error(statusNum, reason); + llwarns << "LLAssetUploadChainResponder Error [status:" + << statusNum << "]: " << content << llendl; + LLUpdateTaskInventoryResponder::errorWithContent(statusNum, reason, content); LLAssetUploadQueue *queue = mSupplier->get(); if (queue) { diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 694bbdfb67..2564802387 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -225,10 +225,10 @@ LLAssetUploadResponder::~LLAssetUploadResponder() } // virtual -void LLAssetUploadResponder::error(U32 statusNum, const std::string& reason) +void LLAssetUploadResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llinfos << "LLAssetUploadResponder::error " << statusNum - << " reason: " << reason << llendl; + llinfos << "LLAssetUploadResponder::error [status:" + << statusNum << "]: " << content << llendl; LLSD args; switch(statusNum) { @@ -340,9 +340,9 @@ LLNewAgentInventoryResponder::LLNewAgentInventoryResponder( } // virtual -void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reason) +void LLNewAgentInventoryResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - LLAssetUploadResponder::error(statusNum, reason); + LLAssetUploadResponder::errorWithContent(statusNum, reason, content); //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE); } @@ -487,9 +487,10 @@ void LLSendTexLayerResponder::uploadComplete(const LLSD& content) } } -void LLSendTexLayerResponder::error(U32 statusNum, const std::string& reason) +void LLSendTexLayerResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llinfos << "status: " << statusNum << " reason: " << reason << llendl; + llinfos << "LLSendTexLayerResponder error [status:" + << statusNum << "]: " << content << llendl; // Invoke the original callback with an error result LLViewerTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE); diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index 381b919c4a..a6d1016136 100644 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -42,7 +42,7 @@ public: LLAssetType::EType asset_type); ~LLAssetUploadResponder(); - virtual void error(U32 statusNum, const std::string& reason); + virtual void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content); virtual void result(const LLSD& content); virtual void uploadUpload(const LLSD& content); virtual void uploadComplete(const LLSD& content); @@ -67,7 +67,7 @@ public: const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type); - virtual void error(U32 statusNum, const std::string& reason); + virtual void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content); virtual void uploadComplete(const LLSD& content); virtual void uploadFailure(const LLSD& content); }; @@ -122,7 +122,7 @@ public: ~LLSendTexLayerResponder(); virtual void uploadComplete(const LLSD& content); - virtual void error(U32 statusNum, const std::string& reason); + virtual void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content); LLBakedUploadData * mBakedUploadData; }; diff --git a/indra/newview/llclassifiedstatsresponder.cpp b/indra/newview/llclassifiedstatsresponder.cpp index b4da31895f..e3cd83e174 100644 --- a/indra/newview/llclassifiedstatsresponder.cpp +++ b/indra/newview/llclassifiedstatsresponder.cpp @@ -62,8 +62,7 @@ void LLClassifiedStatsResponder::result(const LLSD& content) } /*virtual*/ -void LLClassifiedStatsResponder::error(U32 status, const std::string& reason) +void LLClassifiedStatsResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "LLClassifiedStatsResponder::error(" - << status << ": " << reason << ")" << llendl; + llinfos << "LLClassifiedStatsResponder::error [status:" << status << "]: " << content << llendl; } diff --git a/indra/newview/llclassifiedstatsresponder.h b/indra/newview/llclassifiedstatsresponder.h index 3db1868cb2..06dcb62fd0 100644 --- a/indra/newview/llclassifiedstatsresponder.h +++ b/indra/newview/llclassifiedstatsresponder.h @@ -39,7 +39,7 @@ public: virtual void result(const LLSD& content); //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason); + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); protected: LLUUID mClassifiedID; diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp index 0faa888398..2669b0340f 100644 --- a/indra/newview/llestateinfomodel.cpp +++ b/indra/newview/llestateinfomodel.cpp @@ -122,9 +122,9 @@ public: } // if we get an error response - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "Failed to commit estate info (" << status << "): " << reason << llendl; + llwarns << "Failed to commit estate info [status:" << status << "]: " << content << llendl; } }; diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 2c786b7f8b..e0f7223a8c 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -62,7 +62,7 @@ namespace void handleMessage(const LLSD& content); - virtual void error(U32 status, const std::string& reason); + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); virtual void result(const LLSD& content); virtual void completedRaw(U32 status, @@ -187,7 +187,7 @@ namespace } //virtual - void LLEventPollResponder::error(U32 status, const std::string& reason) + void LLEventPollResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { if (mDone) return; @@ -207,13 +207,13 @@ namespace + mErrorCount * EVENT_POLL_ERROR_RETRY_SECONDS_INC , this); - llwarns << "Unexpected HTTP error. status: " << status << ", reason: " << reason << llendl; + llwarns << "LLEventPollResponder error [status:" << status << "]: " << content << llendl; } else { - llwarns << "LLEventPollResponder::error: <" << mCount << "> got " - << status << ": " << reason - << (mDone ? " -- done" : "") << llendl; + llwarns << "LLEventPollResponder error <" << mCount + << "> [status:" << status << "]: " << content + << (mDone ? " -- done" : "") << llendl; stop(); // At this point we have given up and the viewer will not receive HTTP messages from the simulator. diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 19fca9b95d..fbf72b1a85 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1070,7 +1070,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t { //read base log into memory S32 i = 0; std::ifstream is(base.c_str()); - while (!is.eof() && LLSDSerialize::fromXML(cur, is)) + while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) { base_data[i++] = cur; } @@ -1083,7 +1083,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t { //read current log into memory S32 i = 0; std::ifstream is(target.c_str()); - while (!is.eof() && LLSDSerialize::fromXML(cur, is)) + while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) { cur_data[i++] = cur; @@ -1374,7 +1374,7 @@ LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is) stats_map_t time_stats; stats_map_t sample_stats; - while (!is.eof() && LLSDSerialize::fromXML(cur, is)) + while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) { for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) { diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 0290e7cdf0..752aba5e16 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -404,8 +404,7 @@ public: } else { - llinfos << "avatar picker failed " << status - << " reason " << reason << llendl; + llwarns << "avatar picker failed [status:" << status << "]: " << content << llendl; } } diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index c7fab2573f..0cde878055 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -75,7 +75,7 @@ namespace { public: /* virtual */ - void error(U32 status, const std::string& reason) + void errorWithContent(U32 status, const std::string& reason) { sConsoleReplySignal(UNABLE_TO_SEND_COMMAND); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index a36021f971..4a9ea5acf0 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -756,9 +756,10 @@ class ConsoleRequestResponder : public LLHTTPClient::Responder { public: /*virtual*/ - void error(U32 status, const std::string& reason) + void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "requesting mesh_rez_enabled failed" << llendl; + llwarns << "ConsoleRequestResponder error requesting mesh_rez_enabled [status:" + << status << "]: " << content << llendl; } }; @@ -768,9 +769,10 @@ class ConsoleUpdateResponder : public LLHTTPClient::Responder { public: /* virtual */ - void error(U32 status, const std::string& reason) + void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "Updating mesh enabled region setting failed" << llendl; + llwarns << "ConsoleRequestResponder error updating mesh enabled region setting [status:" + << status << "]: " << content << llendl; } }; @@ -2207,10 +2209,10 @@ public: } // if we get an error response - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "LLEstateChangeInfoResponder::error " - << status << ": " << reason << llendl; + llinfos << "LLEstateChangeInfoResponder::error [status:" + << status << "]: " << content << llendl; } private: LLHandle mpPanel; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 86bd15b217..685b566fa8 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -695,7 +695,7 @@ class LLUserReportResponder : public LLHTTPClient::Responder public: LLUserReportResponder(): LLHTTPClient::Responder() {} - void error(U32 status, const std::string& reason) + void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { // *TODO do some user messaging here LLUploadDialog::modalUploadFinished(); diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index a50907601c..17c34f1da0 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -221,9 +221,9 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content) } } -void fetchScriptLimitsRegionInfoResponder::error(U32 status, const std::string& reason) +void fetchScriptLimitsRegionInfoResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "Error from responder " << reason << llendl; + llwarns << "fetchScriptLimitsRegionInfoResponder error [status:" << status << "]: " << content << llendl; } void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref) @@ -308,9 +308,9 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref) } } -void fetchScriptLimitsRegionSummaryResponder::error(U32 status, const std::string& reason) +void fetchScriptLimitsRegionSummaryResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "Error from responder " << reason << llendl; + llwarns << "fetchScriptLimitsRegionSummaryResponder error [status:" << status << "]: " << content << llendl; } void fetchScriptLimitsRegionDetailsResponder::result(const LLSD& content_ref) @@ -417,9 +417,9 @@ result (map) } } -void fetchScriptLimitsRegionDetailsResponder::error(U32 status, const std::string& reason) +void fetchScriptLimitsRegionDetailsResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "Error from responder " << reason << llendl; + llwarns << "fetchScriptLimitsRegionDetailsResponder error [status:" << status << "]: " << content << llendl; } void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) @@ -513,9 +513,9 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) } } -void fetchScriptLimitsAttachmentInfoResponder::error(U32 status, const std::string& reason) +void fetchScriptLimitsAttachmentInfoResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "Error from responder " << reason << llendl; + llwarns << "fetchScriptLimitsAttachmentInfoResponder error [status:" << status << "]: " << content << llendl; } ///---------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h index 9bcfa5fe14..f8732ef94b 100644 --- a/indra/newview/llfloaterscriptlimits.h +++ b/indra/newview/llfloaterscriptlimits.h @@ -89,7 +89,7 @@ class fetchScriptLimitsRegionInfoResponder: public LLHTTPClient::Responder fetchScriptLimitsRegionInfoResponder(const LLSD& info) : mInfo(info) {}; void result(const LLSD& content); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); public: protected: LLSD mInfo; @@ -101,7 +101,7 @@ class fetchScriptLimitsRegionSummaryResponder: public LLHTTPClient::Responder fetchScriptLimitsRegionSummaryResponder(const LLSD& info) : mInfo(info) {}; void result(const LLSD& content); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); public: protected: LLSD mInfo; @@ -113,7 +113,7 @@ class fetchScriptLimitsRegionDetailsResponder: public LLHTTPClient::Responder fetchScriptLimitsRegionDetailsResponder(const LLSD& info) : mInfo(info) {}; void result(const LLSD& content); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); public: protected: LLSD mInfo; @@ -125,7 +125,7 @@ class fetchScriptLimitsAttachmentInfoResponder: public LLHTTPClient::Responder fetchScriptLimitsAttachmentInfoResponder() {}; void result(const LLSD& content); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); public: protected: }; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 81eb1d397e..cbd844cdac 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -1847,14 +1847,15 @@ public: GroupMemberDataResponder() {} virtual ~GroupMemberDataResponder() {} virtual void result(const LLSD& pContent); - virtual void error(U32 pStatus, const std::string& pReason); + virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent); private: LLSD mMemberData; }; -void GroupMemberDataResponder::error(U32 pStatus, const std::string& pReason) +void GroupMemberDataResponder::errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent) { - LL_WARNS("GrpMgr") << "Error receiving group member data." << LL_ENDL; + LL_WARNS("GrpMgr") << "Error receiving group member data [status:" + << pStatus << "]: " << pContent << LL_ENDL; } void GroupMemberDataResponder::result(const LLSD& content) diff --git a/indra/newview/llhomelocationresponder.cpp b/indra/newview/llhomelocationresponder.cpp index 4850d18d99..37428c4a44 100644 --- a/indra/newview/llhomelocationresponder.cpp +++ b/indra/newview/llhomelocationresponder.cpp @@ -97,7 +97,7 @@ void LLHomeLocationResponder::result( const LLSD& content ) } } -void LLHomeLocationResponder::error( U32 status, const std::string& reason ) +void LLHomeLocationResponder::errorWithContent( U32 status, const std::string& reason, const LLSD& content ) { - llinfos << "received error(" << reason << ")" << llendl; + llwarns << "LLHomeLocationResponder error [status:" << status << "]: " << content << llendl; } diff --git a/indra/newview/llhomelocationresponder.h b/indra/newview/llhomelocationresponder.h index d640b9c894..9bf4b12c4e 100644 --- a/indra/newview/llhomelocationresponder.h +++ b/indra/newview/llhomelocationresponder.h @@ -36,7 +36,7 @@ class LLHomeLocationResponder : public LLHTTPClient::Responder { virtual void result( const LLSD& content ); - virtual void error( U32 status, const std::string& reason ); + virtual void errorWithContent( U32 status, const std::string& reason, const LLSD& content ); }; #endif diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 63eedcdfea..fff178f8fe 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -985,9 +985,10 @@ public: mSessionID = session_id; } - void error(U32 statusNum, const std::string& reason) + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llinfos << "Error inviting all agents to session" << llendl; + llwarns << "Error inviting all agents to session [status:" + << statusNum << "]: " << content << llendl; //throw something back to the viewer here? } diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 0250af6a0e..1dab0e67bf 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -394,9 +394,10 @@ public: mSessionID = session_id; } - void error(U32 statusNum, const std::string& reason) + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llinfos << "Error inviting all agents to session" << llendl; + llwarns << "Error inviting all agents to session [status:" + << statusNum << "]: " << content << llendl; //throw something back to the viewer here? } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 57373704ef..20b33c5d08 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1227,7 +1227,7 @@ public: mAgents = agents_to_invite; } - virtual void error(U32 statusNum, const std::string& reason) + virtual void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { //try an "old school" way. if ( statusNum == 400 ) @@ -1239,6 +1239,9 @@ public: mAgents); } + llwarns << "LLStartConferenceChatResponder error [status:" + << statusNum << "]: " << content << llendl; + //else throw an error back to the client? //in theory we should have just have these error strings //etc. set up in this file as opposed to the IMMgr, @@ -1384,8 +1387,10 @@ public: } } - void error(U32 statusNum, const std::string& reason) - { + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) + { + llwarns << "LLViewerChatterBoxInvitationAcceptResponder error [status:" + << statusNum << "]: " << content << llendl; //throw something back to the viewer here? if ( gIMMgr ) { diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 17d0b0ffbb..aafc43b02d 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -501,9 +501,9 @@ void LLInspectAvatar::toggleSelectedVoice(bool enabled) mSessionID = session_id; } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << status << ": " << reason << llendl; + llwarns << "MuteVoiceResponder error [status:" << status << "]: " << content << llendl; if ( gIMMgr ) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ac1f40b486..99e72cdb22 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -424,9 +424,10 @@ public: { } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("InvAPI") << "CreateInventoryCategory failed. status = " << status << ", reasion = \"" << reason << "\"" << LL_ENDL; + LL_WARNS("InvAPI") << "CreateInventoryCategory failed [status:" + << status << "]: " << content << LL_ENDL; } virtual void result(const LLSD& content) @@ -1399,10 +1400,9 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) } //If we get back an error (not found, etc...), handle it here -void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::string& reason) +void LLInventoryModel::fetchInventoryResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "fetchInventory::error " - << status << ": " << reason << llendl; + llwarns << "fetchInventory error [status:" << status << "]: " << content << llendl; gInventory.notifyObservers(); } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 8382e875b4..dfdd237c95 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -84,7 +84,7 @@ public: public: fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; void result(const LLSD& content); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); protected: LLSD mRequestSD; }; diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 024d34519f..f2b39e7186 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -366,7 +366,7 @@ class LLInventoryModelFetchItemResponder : public LLInventoryModel::fetchInvento public: LLInventoryModelFetchItemResponder(const LLSD& request_sd) : LLInventoryModel::fetchInventoryResponder(request_sd) {}; void result(const LLSD& content); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); }; void LLInventoryModelFetchItemResponder::result( const LLSD& content ) @@ -375,9 +375,9 @@ void LLInventoryModelFetchItemResponder::result( const LLSD& content ) LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); } -void LLInventoryModelFetchItemResponder::error( U32 status, const std::string& reason ) +void LLInventoryModelFetchItemResponder::errorWithContent( U32 status, const std::string& reason, const LLSD& content ) { - LLInventoryModel::fetchInventoryResponder::error(status, reason); + LLInventoryModel::fetchInventoryResponder::errorWithContent(status, reason, content); LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); } @@ -391,7 +391,7 @@ public: {}; //LLInventoryModelFetchDescendentsResponder() {}; void result(const LLSD& content); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); protected: BOOL getIsRecursive(const LLUUID& cat_id) const; private: @@ -529,12 +529,12 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) } // If we get back an error (not found, etc...), handle it here. -void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason) +void LLInventoryModelFetchDescendentsResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance(); - llinfos << "LLInventoryModelFetchDescendentsResponder::error " - << status << ": " << reason << llendl; + llinfos << "LLInventoryModelFetchDescendentsResponder::error [status:" + << status << "]: " << content << llendl; fetcher->incrFetchCount(-1); diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index 31038b4aac..e3b46d5d2f 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -564,7 +564,7 @@ LLMediaDataClient::Responder::Responder(const request_ptr_t &request) } /*virtual*/ -void LLMediaDataClient::Responder::error(U32 status, const std::string& reason) +void LLMediaDataClient::Responder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { mRequest->stopTracking(); @@ -596,8 +596,8 @@ void LLMediaDataClient::Responder::error(U32 status, const std::string& reason) } else { - std::string msg = boost::lexical_cast(status) + ": " + reason; - LL_WARNS("LLMediaDataClient") << *mRequest << " http error(" << msg << ")" << LL_ENDL; + LL_WARNS("LLMediaDataClient") << *mRequest << " http error [status:" + << status << "]:" << content << ")" << LL_ENDL; } } @@ -1003,7 +1003,7 @@ LLMediaDataClient::Responder *LLObjectMediaNavigateClient::RequestNavigate::crea } /*virtual*/ -void LLObjectMediaNavigateClient::Responder::error(U32 status, const std::string& reason) +void LLObjectMediaNavigateClient::Responder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { getRequest()->stopTracking(); @@ -1017,7 +1017,7 @@ void LLObjectMediaNavigateClient::Responder::error(U32 status, const std::string // class if (status == HTTP_SERVICE_UNAVAILABLE) { - LLMediaDataClient::Responder::error(status, reason); + LLMediaDataClient::Responder::errorWithContent(status, reason, content); } else { diff --git a/indra/newview/llmediadataclient.h b/indra/newview/llmediadataclient.h index ab90915c55..89e20a28d0 100644 --- a/indra/newview/llmediadataclient.h +++ b/indra/newview/llmediadataclient.h @@ -195,7 +195,7 @@ protected: public: Responder(const request_ptr_t &request); //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason); + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); //If we get back a normal response, handle it here. Default just logs it. virtual void result(const LLSD& content); @@ -400,7 +400,7 @@ protected: public: Responder(const request_ptr_t &request) : LLMediaDataClient::Responder(request) {} - virtual void error(U32 status, const std::string& reason); + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); virtual void result(const LLSD &content); private: void mediaNavigateBounceBack(); diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 2dd01e931e..c277359133 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -108,7 +108,7 @@ public: virtual ~NavMeshStatusResponder(); virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); + virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent); protected: @@ -130,7 +130,7 @@ public: virtual ~NavMeshResponder(); virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); + virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent); protected: @@ -151,7 +151,7 @@ public: virtual ~AgentStateResponder(); virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); + virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent); protected: @@ -170,7 +170,7 @@ public: virtual ~NavMeshRebakeResponder(); virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); + virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent); protected: @@ -190,9 +190,11 @@ public: virtual ~LinksetsResponder(); void handleObjectLinksetsResult(const LLSD &pContent); - void handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); + void handleObjectLinksetsError(U32 pStatus, const std::string &pReason, + const LLSD& pContent, const std::string &pURL); void handleTerrainLinksetsResult(const LLSD &pContent); - void handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); + void handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, + const LLSD& pContent, const std::string &pURL); protected: @@ -230,7 +232,7 @@ public: virtual ~ObjectLinksetsResponder(); virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); + virtual void errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent); protected: @@ -250,7 +252,7 @@ public: virtual ~TerrainLinksetsResponder(); virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); + virtual void errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent); protected: @@ -270,7 +272,7 @@ public: virtual ~CharactersResponder(); virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); + virtual void errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent); protected: @@ -800,9 +802,9 @@ void NavMeshStatusResponder::result(const LLSD &pContent) LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly); } -void NavMeshStatusResponder::error(U32 pStatus, const std::string& pReason) +void NavMeshStatusResponder::errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent) { - llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + llwarns << "NavMeshStatusResponder error [status:" << pStatus << "]: " << pContent << llendl; LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID); LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly); } @@ -828,9 +830,9 @@ void NavMeshResponder::result(const LLSD &pContent) mNavMeshPtr->handleNavMeshResult(pContent, mNavMeshVersion); } -void NavMeshResponder::error(U32 pStatus, const std::string& pReason) +void NavMeshResponder::errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent) { - mNavMeshPtr->handleNavMeshError(pStatus, pReason, mCapabilityURL, mNavMeshVersion); + mNavMeshPtr->handleNavMeshError(pStatus, pReason, pContent, mCapabilityURL, mNavMeshVersion); } //--------------------------------------------------------------------------- @@ -855,9 +857,9 @@ void AgentStateResponder::result(const LLSD &pContent) LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion); } -void AgentStateResponder::error(U32 pStatus, const std::string &pReason) +void AgentStateResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + llwarns << "AgentStateResponder error [status:" << pStatus << "]: " << pContent << llendl; LLPathfindingManager::getInstance()->handleAgentState(FALSE); } @@ -881,9 +883,9 @@ void NavMeshRebakeResponder::result(const LLSD &pContent) mRebakeNavMeshCallback(true); } -void NavMeshRebakeResponder::error(U32 pStatus, const std::string &pReason) +void NavMeshRebakeResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + llwarns << "NavMeshRebakeResponder error [status:" << pStatus << "]: " << pContent << llendl; mRebakeNavMeshCallback(false); } @@ -916,9 +918,11 @@ void LinksetsResponder::handleObjectLinksetsResult(const LLSD &pContent) } } -void LinksetsResponder::handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) +void LinksetsResponder::handleObjectLinksetsError(U32 pStatus, const std::string &pReason, + const LLSD& pContent, const std::string &pURL) { - llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + llwarns << "LinksetsResponder object linksets error with request to URL '" << pURL << "' [status:" + << pStatus << "]: " << pContent << llendl; mObjectMessagingState = kReceivedError; if (mTerrainMessagingState != kWaiting) { @@ -937,8 +941,11 @@ void LinksetsResponder::handleTerrainLinksetsResult(const LLSD &pContent) } } -void LinksetsResponder::handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) +void LinksetsResponder::handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, + const LLSD& pContent, const std::string &pURL) { + llwarns << "LinksetsResponder terrain linksets error with request to URL '" << pURL << "' [status:" + << pStatus << "]: " << pContent << llendl; mTerrainMessagingState = kReceivedError; if (mObjectMessagingState != kWaiting) { @@ -988,9 +995,9 @@ void ObjectLinksetsResponder::result(const LLSD &pContent) mLinksetsResponsderPtr->handleObjectLinksetsResult(pContent); } -void ObjectLinksetsResponder::error(U32 pStatus, const std::string &pReason) +void ObjectLinksetsResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - mLinksetsResponsderPtr->handleObjectLinksetsError(pStatus, pReason, mCapabilityURL); + mLinksetsResponsderPtr->handleObjectLinksetsError(pStatus, pReason, pContent, mCapabilityURL); } //--------------------------------------------------------------------------- @@ -1013,9 +1020,9 @@ void TerrainLinksetsResponder::result(const LLSD &pContent) mLinksetsResponsderPtr->handleTerrainLinksetsResult(pContent); } -void TerrainLinksetsResponder::error(U32 pStatus, const std::string &pReason) +void TerrainLinksetsResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - mLinksetsResponsderPtr->handleTerrainLinksetsError(pStatus, pReason, mCapabilityURL); + mLinksetsResponsderPtr->handleTerrainLinksetsError(pStatus, pReason, pContent, mCapabilityURL); } //--------------------------------------------------------------------------- @@ -1040,9 +1047,9 @@ void CharactersResponder::result(const LLSD &pContent) mCharactersCallback(mRequestId, LLPathfindingManager::kRequestCompleted, characterListPtr); } -void CharactersResponder::error(U32 pStatus, const std::string &pReason) +void CharactersResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + llwarns << "CharactersResponder error [status:" << pStatus << "]: " << pContent << llendl; LLPathfindingObjectListPtr characterListPtr = LLPathfindingObjectListPtr(new LLPathfindingCharacterList()); mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index e01dd3a152..0c23e5ac92 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -184,9 +184,10 @@ void LLPathfindingNavMesh::handleNavMeshError() setRequestStatus(kNavMeshRequestError); } -void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion) +void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const LLSD& pContent, const std::string &pURL, U32 pNavMeshVersion) { - llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + llwarns << "LLPathfindingNavMesh error with request to URL '" << pURL << "' [status:" + << pStatus << "]: " << pContent << llendl; if (mNavMeshStatus.getVersion() == pNavMeshVersion) { handleNavMeshError(); diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 7a844f54ce..b872ccad7c 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -74,7 +74,7 @@ public: void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); void handleNavMeshNotEnabled(); void handleNavMeshError(); - void handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion); + void handleNavMeshError(U32 pStatus, const std::string &pReason, const LLSD& pContent, const std::string &pURL, U32 pNavMeshVersion); protected: diff --git a/indra/newview/llproductinforequest.cpp b/indra/newview/llproductinforequest.cpp index 93bf8b2328..1390000fc5 100644 --- a/indra/newview/llproductinforequest.cpp +++ b/indra/newview/llproductinforequest.cpp @@ -43,10 +43,10 @@ public: } //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "LLProductInfoRequest::error(" - << status << ": " << reason << ")" << llendl; + llwarns << "LLProductInfoRequest error [status:" + << status << ":] " << content << llendl; } }; diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index 3862dac340..500dec7ee5 100644 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -62,10 +62,10 @@ void LLRemoteParcelRequestResponder::result(const LLSD& content) //If we get back an error (not found, etc...), handle it here //virtual -void LLRemoteParcelRequestResponder::error(U32 status, const std::string& reason) +void LLRemoteParcelRequestResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "LLRemoteParcelRequest::error(" - << status << ": " << reason << ")" << llendl; + llwarns << "LLRemoteParcelRequest error [status:" + << status << "]: " << content << llendl; // Panel inspecting the information may be closed and destroyed // before this response is received. diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h index 74cf1616df..b87056573b 100644 --- a/indra/newview/llremoteparcelrequest.h +++ b/indra/newview/llremoteparcelrequest.h @@ -44,7 +44,7 @@ public: /*virtual*/ void result(const LLSD& content); //If we get back an error (not found, etc...), handle it here - /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content); protected: LLHandle mObserverHandle; diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 1c7c6450c7..890bc0f42d 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -726,9 +726,9 @@ public: mSessionID = session_id; } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << status << ": " << reason << llendl; + llwarns << "ModerationResponder error [status:" << status << "]: " << content << llendl; if ( gIMMgr ) { diff --git a/indra/newview/lluploadfloaterobservers.cpp b/indra/newview/lluploadfloaterobservers.cpp index 5a6a17fbca..1d777b3f7f 100644 --- a/indra/newview/lluploadfloaterobservers.cpp +++ b/indra/newview/lluploadfloaterobservers.cpp @@ -33,9 +33,10 @@ LLUploadModelPremissionsResponder::LLUploadModelPremissionsResponder(const LLHan { } -void LLUploadModelPremissionsResponder::error(U32 status, const std::string& reason) +void LLUploadModelPremissionsResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "LLUploadModelPremissionsResponder::error("<< status << ": " << reason << ")" << llendl; + llwarns << "LLUploadModelPremissionsResponder error [status:" + << status << "]: " << content << llendl; LLUploadPermissionsObserver* observer = mObserverHandle.get(); diff --git a/indra/newview/lluploadfloaterobservers.h b/indra/newview/lluploadfloaterobservers.h index 79aad282d7..b43ddb44d9 100644 --- a/indra/newview/lluploadfloaterobservers.h +++ b/indra/newview/lluploadfloaterobservers.h @@ -86,7 +86,7 @@ public: LLUploadModelPremissionsResponder(const LLHandle& observer); - void error(U32 status, const std::string& reason); + void errorWithContent(U32 status, const std::string& reason, const LLSD& content); void result(const LLSD& content); diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index 5741fab29a..1ac6a90894 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -59,8 +59,10 @@ class LLSetDisplayNameResponder : public LLHTTPClient::Responder { public: // only care about errors - /*virtual*/ void error(U32 status, const std::string& reason) + /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { + llwarns << "LLSetDisplayNameResponder error [status:" + << status << "]: " << content << llendl; LLViewerDisplayName::sSetDisplayNameSignal(false, "", LLSD()); LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); } diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index eec44c7a74..0561e731e7 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -691,12 +691,12 @@ public: } } - void error(U32 statusNum, const std::string& reason) + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { llwarns << "Transport error requesting object cost " - << "HTTP status: " << statusNum << ", reason: " - << reason << "." << llendl; + << "[status: " << statusNum << "]: " + << content << llendl; // TODO*: Error message to user // For now just clear the request from the pending list @@ -780,12 +780,12 @@ public: } } - void error(U32 statusNum, const std::string& reason) + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { llwarns << "Transport error requesting object physics flags " - << "HTTP status: " << statusNum << ", reason: " - << reason << "." << llendl; + << "[status: " << statusNum << "]: " + << content << llendl; // TODO*: Error message to user // For now just clear the request from the pending list diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e940dda010..b8b53aa6e4 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -210,9 +210,9 @@ public: virtual ~BaseCapabilitiesComplete() { } - void error(U32 statusNum, const std::string& reason) + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL; + LL_WARNS2("AppInit", "Capabilities") << "[status:" << statusNum << ":] " << content << LL_ENDL; LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { @@ -278,8 +278,11 @@ public: virtual ~BaseCapabilitiesCompleteTracker() { } - void error(U32 statusNum, const std::string& reason) - { } + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) + { + llwarns << "BaseCapabilitiesCompleteTracker error [status:" + << statusNum << "]: " << content << llendl; + } void result(const LLSD& content) { @@ -1731,9 +1734,9 @@ public: { } - void error(U32 statusNum, const std::string& reason) + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - LL_WARNS2("AppInit", "SimulatorFeatures") << statusNum << ": " << reason << LL_ENDL; + LL_WARNS2("AppInit", "SimulatorFeatures") << "[status:" << statusNum << "]: " << content << LL_ENDL; retry(); } diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 17bb03b889..4ed01f36ab 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -530,10 +530,10 @@ class ViewerStatsResponder : public LLHTTPClient::Responder public: ViewerStatsResponder() { } - void error(U32 statusNum, const std::string& reason) + void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llinfos << "ViewerStatsResponder::error " << statusNum << " " - << reason << llendl; + llwarns << "ViewerStatsResponder error [status:" << statusNum << "]: " + << content << llendl; } void result(const LLSD& content) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 3605383c5c..9be1de4f0e 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2264,7 +2264,7 @@ public: else { LL_WARNS("Avatar") << "Failed " << status << " reason " << reason << LL_ENDL; - error(status,reason); + errorWithContent(status,reason,content); } } @@ -2440,11 +2440,12 @@ public: } // Error - /*virtual*/ void error(U32 status, const std::string& reason) + /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { if (isAgentAvatarValid()) { - LL_DEBUGS("Avatar") << "failed, will rebake" << llendl; + LL_DEBUGS("Avatar") << "failed, will rebake [status:" + << status << "]: " << content << llendl; forceAppearanceUpdate(); } } diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index bd12328a6b..181735ee30 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -56,7 +56,8 @@ class LLVoiceCallCapResponder : public LLHTTPClient::Responder public: LLVoiceCallCapResponder(const LLUUID& session_id) : mSessionID(session_id) {}; - virtual void error(U32 status, const std::string& reason); // called with bad status codes + // called with bad status codes + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); virtual void result(const LLSD& content); private: @@ -64,11 +65,10 @@ private: }; -void LLVoiceCallCapResponder::error(U32 status, const std::string& reason) +void LLVoiceCallCapResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("Voice") << "LLVoiceCallCapResponder::error(" - << status << ": " << reason << ")" - << LL_ENDL; + LL_WARNS("Voice") << "LLVoiceCallCapResponder error [status:" + << status << "]: " << content << LL_ENDL; LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID); if ( channelp ) { diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index db0fc3dca7..e112c589e9 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -126,17 +126,18 @@ public: mRetries = retries; } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { + LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, " + << ( (mRetries > 0) ? "retrying" : "too many retries (giving up)" ) + << status << "]: " << content << LL_ENDL; + if ( mRetries > 0 ) { - LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying. status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL; - LLVivoxVoiceClient::getInstance()->requestVoiceAccountProvision( - mRetries - 1); + LLVivoxVoiceClient::getInstance()->requestVoiceAccountProvision(mRetries - 1); } else { - LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up). status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL; LLVivoxVoiceClient::getInstance()->giveUp(); } } @@ -195,18 +196,18 @@ class LLVivoxVoiceClientCapResponder : public LLHTTPClient::Responder public: LLVivoxVoiceClientCapResponder(LLVivoxVoiceClient::state requesting_state) : mRequestingState(requesting_state) {}; - virtual void error(U32 status, const std::string& reason); // called with bad status codes + // called with bad status codes + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); virtual void result(const LLSD& content); private: LLVivoxVoiceClient::state mRequestingState; // state }; -void LLVivoxVoiceClientCapResponder::error(U32 status, const std::string& reason) +void LLVivoxVoiceClientCapResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("Voice") << "LLVivoxVoiceClientCapResponder::error(" - << status << ": " << reason << ")" - << LL_ENDL; + LL_WARNS("Voice") << "LLVivoxVoiceClientCapResponder error [status:" + << status << "]: " << content << LL_ENDL; LLVivoxVoiceClient::getInstance()->sessionTerminate(); } diff --git a/indra/newview/llwebsharing.cpp b/indra/newview/llwebsharing.cpp index 43b1a320c3..3a80051b9b 100644 --- a/indra/newview/llwebsharing.cpp +++ b/indra/newview/llwebsharing.cpp @@ -68,9 +68,9 @@ public: } } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("WebSharing") << "Error [" << status << "]: " << reason << LL_ENDL; + LL_WARNS("WebSharing") << "Error [status:" << status << "]: " << content << LL_ENDL; } virtual void result(const LLSD& content) @@ -99,7 +99,7 @@ public: /// Left empty to override the default LLSD parsing behaviour. } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { if (HTTP_UNAUTHORIZED == status) { @@ -108,7 +108,7 @@ public: } else { - LL_WARNS("WebSharing") << "Error [" << status << "]: " << reason << LL_ENDL; + LL_WARNS("WebSharing") << "Error [status:" << status << "]: " << content << LL_ENDL; LLWebSharing::instance().retryOpenIDAuth(); } @@ -152,9 +152,9 @@ public: } } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("WebSharing") << "Error [" << status << "]: " << reason << LL_ENDL; + LL_WARNS("WebSharing") << "Error [status:" << status << "]: " << content << LL_ENDL; LLWebSharing::instance().retryOpenIDAuth(); } @@ -221,9 +221,9 @@ public: } } - virtual void error(U32 status, const std::string& reason) + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("WebSharing") << "Error [" << status << "]: " << reason << LL_ENDL; + LL_WARNS("WebSharing") << "Error [status:" << status << "]: " << content << LL_ENDL; } virtual void result(const LLSD& content) diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index be3e3ff30e..93eba5b604 100644 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -121,9 +121,11 @@ LLEnvironmentRequestResponder::LLEnvironmentRequestResponder() LLEnvManagerNew::getInstance()->onRegionSettingsResponse(unvalidated_content); } -/*virtual*/ void LLEnvironmentRequestResponder::error(U32 status, const std::string& reason) +/*virtual*/ +void LLEnvironmentRequestResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_INFOS("WindlightCaps") << "Got an error, not using region windlight..." << LL_ENDL; + LL_INFOS("WindlightCaps") << "Got an error, not using region windlight... [status:" + << status << "]: " << content << LL_ENDL; LLEnvManagerNew::getInstance()->onRegionSettingsResponse(LLSD()); } @@ -190,14 +192,15 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content) LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false); } } -/*virtual*/ void LLEnvironmentApplyResponder::error(U32 status, const std::string& reason) +/*virtual*/ +void LLEnvironmentApplyResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - std::stringstream msg; - msg << reason << " (Code " << status << ")"; - - LL_WARNS("WindlightCaps") << "Couldn't apply windlight settings to region! Reason: " << msg << LL_ENDL; + LL_WARNS("WindlightCaps") << "Couldn't apply windlight settings to region! [status:" + << status << "]: " << content << LL_ENDL; LLSD args(LLSD::emptyMap()); + std::stringstream msg; + msg << reason << " (Code " << status << ")"; args["FAIL_REASON"] = msg.str(); LLNotificationsUtil::add("WLRegionApplyFail", args); } diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h index 23558876da..598ce6d52a 100644 --- a/indra/newview/llwlhandlers.h +++ b/indra/newview/llwlhandlers.h @@ -47,7 +47,7 @@ class LLEnvironmentRequestResponder: public LLHTTPClient::Responder LOG_CLASS(LLEnvironmentRequestResponder); public: virtual void result(const LLSD& content); - virtual void error(U32 status, const std::string& reason); + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); private: friend class LLEnvironmentRequest; @@ -89,7 +89,8 @@ public: */ virtual void result(const LLSD& content); - virtual void error(U32 status, const std::string& reason); // non-200 errors only + // non-200 errors only + virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); private: friend class LLEnvironmentApply; diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp index 0254c5881f..41cb344808 100644 --- a/indra/newview/tests/llmediadataclient_test.cpp +++ b/indra/newview/tests/llmediadataclient_test.cpp @@ -126,7 +126,9 @@ void LLHTTPClient::post( result[LLTextureEntry::OBJECT_ID_KEY] = body[LLTextureEntry::OBJECT_ID_KEY]; if ( url == FAKE_OBJECT_MEDIA_CAP_URL_503 ) { - responder->error(HTTP_SERVICE_UNAVAILABLE, "fake reason"); + LLSD content; + content["reason"] = "fake reason"; + responder->errorWithContent(HTTP_SERVICE_UNAVAILABLE, "fake reason", content); return; } else if (url == FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR) -- cgit v1.2.3 From 7b0b5726dd2fcf5b79ed1b112891655fad0f96eb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 6 Mar 2013 09:53:11 -0500 Subject: make it clearer when DebugForceAppearanceRequestFailure is on --- indra/newview/llvoavatar.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f6fd8b2409..1bc26a7133 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2937,6 +2937,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); debug_line += llformat(" - cof: %d req: %d rcv:%d", curr_cof_version, last_request_cof_version, last_received_cof_version); + if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + { + debug_line += " FORCING ERRS"; + } } addDebugText(debug_line); } -- cgit v1.2.3 From fe042430b03667abcd6b72ef9cc27d82d85f4242 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 6 Mar 2013 10:46:43 -0500 Subject: Fix for windows build failure --- indra/newview/llfloaterregiondebugconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index 0cde878055..3a7ca17b73 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -75,7 +75,7 @@ namespace { public: /* virtual */ - void errorWithContent(U32 status, const std::string& reason) + void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { sConsoleReplySignal(UNABLE_TO_SEND_COMMAND); } -- cgit v1.2.3 From 2784a515b0e725f74bf0e5fab47153ba358b26d6 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 6 Mar 2013 17:20:33 -0500 Subject: SH-3954 SH-3941 SH-3910 FIX local appearance does not update We suppress texture downloads for local textures not needed with server side baking. We need to explicitly re-set texture priority for local textures when entering appearance mode. --- indra/newview/llvoavatarself.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index d3c91f3339..66ad4ec394 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2963,8 +2963,9 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) gAgentAvatarp->idleUpdateAppearanceAnimation(); #endif - gAgentAvatarp->invalidateAll(); - gAgentAvatarp->updateMeshTextures(); + gAgentAvatarp->updateTextures(); // call updateTextureStats + gAgentAvatarp->invalidateAll(); // mark all bakes as dirty, request updates + gAgentAvatarp->updateMeshTextures(); // make sure correct textures are applied to the avatar mesh. } } -- cgit v1.2.3 From 5a436e46f6893719fc91a1cb70813671cb2a6d44 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 Mar 2013 17:07:17 -0500 Subject: SH-3959 WIP - pass information about type of fetched image - server bake, host bake, map tile, etc - down the chain so LLTextureFetchWorker can adjust behavior as needed --- indra/newview/llcolorswatch.cpp | 2 +- indra/newview/lldrawpoolterrain.cpp | 2 ++ indra/newview/lldrawpoolwater.cpp | 4 +-- indra/newview/llfloatermodelpreview.cpp | 2 +- indra/newview/llfloaterreporter.cpp | 2 +- indra/newview/llfloaterscriptdebug.cpp | 2 +- indra/newview/lllocalbitmaps.cpp | 6 ++-- indra/newview/llpreviewtexture.cpp | 2 +- indra/newview/llselectmgr.cpp | 6 ++-- indra/newview/lltexturectrl.cpp | 4 +-- indra/newview/lltexturefetch.cpp | 16 ++++++--- indra/newview/lltexturefetch.h | 3 +- indra/newview/llviewerobject.cpp | 6 ++-- indra/newview/llviewertexture.cpp | 47 ++++++++++++++++---------- indra/newview/llviewertexture.h | 29 +++++++++++++---- indra/newview/llviewertexturelist.cpp | 58 +++++++++++++++++++-------------- indra/newview/llviewertexturelist.h | 8 +++-- indra/newview/llviewerwearable.cpp | 2 +- indra/newview/llvoavatar.cpp | 6 ++-- indra/newview/llvoavatarself.cpp | 2 +- indra/newview/llvograss.cpp | 2 +- indra/newview/llvoicevisualizer.cpp | 2 +- indra/newview/llvosky.cpp | 8 ++--- indra/newview/llvotree.cpp | 2 +- indra/newview/llvovolume.cpp | 4 +-- indra/newview/llworldmap.cpp | 4 +-- indra/newview/llworldmipmap.cpp | 2 +- 27 files changed, 142 insertions(+), 91 deletions(-) mode change 100644 => 100755 indra/newview/lltexturefetch.h mode change 100644 => 100755 indra/newview/llviewertexture.h mode change 100644 => 100755 indra/newview/llviewertexturelist.h (limited to 'indra/newview') diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 87fd47cb2c..f1f7da5fd1 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -241,7 +241,7 @@ void LLColorSwatchCtrl::draw() { if (!mFallbackImageName.empty()) { - LLPointer fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, TRUE, + LLPointer fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if( fallback_image->getComponents() == 4 ) { diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 809f34bdff..0adb42428d 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -69,6 +69,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", + FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, format, int_format, @@ -78,6 +79,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c", + FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, format, int_format, diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 26890bd75f..5ddc15df42 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -66,11 +66,11 @@ LLVector3 LLDrawPoolWater::sLightDir; LLDrawPoolWater::LLDrawPoolWater() : LLFacePool(POOL_WATER) { - mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLGLTexture::BOOST_UI); + mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); gGL.getTexUnit(0)->bind(mHBTex[0]) ; mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP); - mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLGLTexture::BOOST_UI); + mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); gGL.getTexUnit(0)->bind(mHBTex[1]); mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index c9f5b42b20..100f1d580b 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2496,7 +2496,7 @@ void LLModelLoader::loadTextures() if(!material.mDiffuseMapFilename.empty()) { material.mDiffuseMap = - LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, TRUE, LLGLTexture::BOOST_PREVIEW); + LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_PREVIEW); material.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE); material.mDiffuseMap->forceToSaveRawImage(0, F32_MAX); mNumOfFetchingTextures++ ; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 685b566fa8..25e92dc17e 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -765,7 +765,7 @@ void LLFloaterReporter::takeScreenshot() // store in the image list so it doesn't try to fetch from the server LLPointer image_in_list = - LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE); + LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid); image_in_list->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER); // the texture picker then uses that texture diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index c987dbb4fb..6c17f62c1e 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -105,7 +105,7 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std: if (objectp) { - objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", TRUE, LLGLTexture::BOOST_UI)); + objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI)); floater_label = llformat("%s(%.0f, %.0f, %.0f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 48f784838c..25df4889b0 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -195,7 +195,7 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate) mLastModified = new_last_modified; LLPointer texture = new LLViewerFetchedTexture - ("file://"+mFilename, mWorldID, LL_LOCAL_USE_MIPMAPS); + ("file://"+mFilename, FTT_LOCAL_FILE, mWorldID, LL_LOCAL_USE_MIPMAPS); texture->createGLTexture(LL_LOCAL_DISCARD_LEVEL, raw_image); texture->setCachedRawImage(LL_LOCAL_DISCARD_LEVEL, raw_image); @@ -437,8 +437,8 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id) LLFace* face = object->mDrawable->getFace(face_iter); if (face && face->getTexture() && face->getTexture()->getID() == old_id) { - object->setTEImage(face_iter, LLViewerTextureManager::getFetchedTexture - (new_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + object->setTEImage(face_iter, LLViewerTextureManager::getFetchedTexture( + new_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); update_obj = true; } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 3784208e37..91a98792eb 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -468,7 +468,7 @@ void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata) void LLPreviewTexture::loadAsset() { - mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); mImageOldBoostLevel = mImage->getBoostLevel(); mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW); mImage->forceToSaveRawImage(0) ; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 1ee9b377ba..4681efd3e5 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1603,7 +1603,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) // Texture picker defaults aren't inventory items // * Don't need to worry about permissions for them // * Can just apply the texture and be done with it. - objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } return true; } @@ -1769,7 +1769,7 @@ BOOL LLSelectMgr::selectionRevertTextures() } else { - object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } } @@ -5183,7 +5183,7 @@ void LLSelectMgr::updateSilhouettes() if (!mSilhouetteImagep) { - mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", TRUE, LLGLTexture::BOOST_UI); + mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI); } mHighlightedObjects->cleanupNodes(); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 3dc506d265..d8438967a2 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -570,7 +570,7 @@ void LLFloaterTexturePicker::draw() mTexturep = NULL; if(mImageAssetID.notNull()) { - mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES); + mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID); mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW); } @@ -1456,7 +1456,7 @@ void LLTextureCtrl::draw() } else if (!mImageAssetID.isNull()) { - LLPointer texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES,LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLPointer texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES,LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW); texture->forceToSaveRawImage(0) ; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 81bc70906d..6f31d768d6 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -389,7 +389,8 @@ public: virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); protected: - LLTextureFetchWorker(LLTextureFetch* fetcher, const std::string& url, const LLUUID& id, const LLHost& host, + LLTextureFetchWorker(LLTextureFetch* fetcher, FTType f_type, + const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, S32 discard, S32 size); private: @@ -506,6 +507,7 @@ private: LLPointer mFormattedImage; LLPointer mRawImage; LLPointer mAuxImage; + FTType mFTType; LLUUID mID; LLHost mHost; std::string mUrl; @@ -827,6 +829,7 @@ volatile bool LLTextureFetch::svMetricsDataBreak(true); // Start with a data bre // called from MAIN THREAD LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, + FTType f_type, // Fetched image type const std::string& url, // Optional URL const LLUUID& id, // Image UUID const LLHost& host, // Simulator host @@ -838,6 +841,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mState(INIT), mWriteToCacheState(NOT_WRITE), mFetcher(fetcher), + mFTType(f_type), mID(id), mHost(host), mUrl(url), @@ -1171,7 +1175,7 @@ bool LLTextureFetchWorker::doWork(S32 param) offset, size, responder); mCacheReadTimer.reset(); } - else if (mUrl.empty() && mFetcher->canLoadFromCache()) + else if ((mUrl.empty()||mFTType==FTT_SERVER_BAKE) && mFetcher->canLoadFromCache()) { setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it @@ -1285,6 +1289,10 @@ bool LLTextureFetchWorker::doWork(S32 param) mCanUseHTTP = false; } } + if (mFTType == FTT_SERVER_BAKE) + { + mWriteToCacheState = CAN_WRITE; + } if (mCanUseHTTP && !mUrl.empty()) { mState = WAIT_HTTP_RESOURCE; @@ -2396,7 +2404,7 @@ LLTextureFetch::~LLTextureFetch() // ~LLQueuedThread() called here } -bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, +bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http) { if(mFetcherLocked) @@ -2479,7 +2487,7 @@ bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, con } else { - worker = new LLTextureFetchWorker(this, url, id, host, priority, desired_discard, desired_size); + worker = new LLTextureFetchWorker(this, f_type, url, id, host, priority, desired_discard, desired_size); lockQueue(); // +Mfq mRequestMap[id] = worker; unlockQueue(); // -Mfq diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h old mode 100644 new mode 100755 index 1e58ba35d4..544499232d --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -52,6 +52,7 @@ class LLHost; class LLViewerAssetStats; class LLTextureFetchDebugger; class LLTextureCache; +enum FTType; // Interface class @@ -77,7 +78,7 @@ public: void shutDownImageDecodeThread(); // Threads: T* (but Tmain mostly) - bool createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, + bool createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http); // Requests that a fetch operation be deleted from the queue. diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index c4b370a4b4..fcf5af76ff 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3273,7 +3273,7 @@ void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) { LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLUUID sculpt_id = sculpt_params->getSculptTexture(); - LLViewerTextureManager::getFetchedTexture(sculpt_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); + LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); } if (boost_children) @@ -4016,7 +4016,7 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) // if (mDrawable.notNull() && mDrawable->isVisible()) // { const LLUUID& image_id = getTE(te)->getID(); - mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); // } } @@ -4066,7 +4066,7 @@ S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( - uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid); + uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid); return setTETextureCore(te,image); } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e9501931eb..1d0bda34a7 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -265,6 +265,7 @@ LLPointer LLViewerTextureManager::getLocalTexture(const U32 wid LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( const LLUUID &image_id, + FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, @@ -272,11 +273,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( LLGLenum primary_format, LLHost request_from_host) { - return gTextureList.getImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; + return gTextureList.getImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( - const std::string& filename, + const std::string& filename, + FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, @@ -284,11 +286,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( LLGLenum primary_format, const LLUUID& force_id) { - return gTextureList.getImageFromFile(filename, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromFile(filename, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; } //static -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url, +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url, + FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, @@ -297,12 +300,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s const LLUUID& force_id ) { - return gTextureList.getImageFromUrl(url, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, LLHost host) +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) { - return gTextureList.getImageFromHost(image_id, host) ; + return gTextureList.getImageFromHost(image_id, f_type, host) ; } // Create a bridge to the viewer texture manager. @@ -375,7 +378,7 @@ void LLViewerTextureManager::init() LLViewerFetchedTexture::sDefaultImagep->dontDiscard(); LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ; - LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, TRUE, LLGLTexture::BOOST_UI); + LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ; image_raw = new LLImageRaw(32,32,3); @@ -396,7 +399,7 @@ void LLViewerTextureManager::init() LLViewerTexture::initClass() ; // Create a texture manager bridge. - gTextureManagerBridgep = new LLViewerTextureManagerBridge(); + gTextureManagerBridgep = new LLViewerTextureManagerBridge; if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName)) { @@ -902,25 +905,28 @@ void LLViewerTexture::updateBindStatsForTester() //start of LLViewerFetchedTexture //---------------------------------------------------------------------------------------------- -LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, const LLHost& host, BOOL usemipmaps) +LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps) : LLViewerTexture(id, usemipmaps), mTargetHost(host) { init(TRUE) ; + mFTType = f_type; generateGLTexture() ; } -LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, BOOL usemipmaps) +LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps) : LLViewerTexture(raw, usemipmaps) { init(TRUE) ; + mFTType = f_type; } -LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, const LLUUID& id, BOOL usemipmaps) +LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps) : LLViewerTexture(id, usemipmaps), mUrl(url) { init(TRUE) ; + mFTType = f_type; generateGLTexture() ; } @@ -986,6 +992,8 @@ void LLViewerFetchedTexture::init(bool firstinit) mLastCallBackActiveTime = 0.f; mInDebug = FALSE; + + mFTType = FTT_UNKNOWN; } LLViewerFetchedTexture::~LLViewerFetchedTexture() @@ -1006,6 +1014,11 @@ S8 LLViewerFetchedTexture::getType() const return LLViewerTexture::FETCHED_TEXTURE ; } +FTType LLViewerFetchedTexture::getFTType() const +{ + return mFTType; +} + void LLViewerFetchedTexture::cleanup() { for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); @@ -1922,7 +1935,7 @@ bool LLViewerFetchedTexture::updateFetch() // bypass texturefetch directly by pulling from LLTextureCache bool fetch_request_created = false; - fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), decode_priority, + fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mFTType, mUrl, getID(), getTargetHost(), decode_priority, w, h, c, desired_discard, needsAux(), mCanUseHTTP); if (fetch_request_created) @@ -2909,14 +2922,14 @@ BOOL LLViewerFetchedTexture::insertToAtlas() //---------------------------------------------------------------------------------------------- //start of LLViewerLODTexture //---------------------------------------------------------------------------------------------- -LLViewerLODTexture::LLViewerLODTexture(const LLUUID& id, const LLHost& host, BOOL usemipmaps) - : LLViewerFetchedTexture(id, host, usemipmaps) +LLViewerLODTexture::LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps) + : LLViewerFetchedTexture(id, f_type, host, usemipmaps) { init(TRUE) ; } -LLViewerLODTexture::LLViewerLODTexture(const std::string& url, const LLUUID& id, BOOL usemipmaps) - : LLViewerFetchedTexture(url, id, usemipmaps) +LLViewerLODTexture::LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps) + : LLViewerFetchedTexture(url, f_type, id, usemipmaps) { init(TRUE) ; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h old mode 100644 new mode 100755 index ba6beec883..f2e1a90713 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -232,6 +232,16 @@ public: }; +enum FTType +{ + FTT_UNKNOWN = -1, + FTT_DEFAULT = 0, // standard texture fetched by id. + FTT_SERVER_BAKE, // texture produced by appearance service and fetched from there. + FTT_HOST_BAKE, // old-style baked texture uploaded by viewer and fetched from avatar's host. + FTT_MAP_TILE, // tiles are fetched from map server directly. + FTT_LOCAL_FILE // fetch directly from a local file. +}; + // //textures are managed in gTextureList. //raw image data is fetched from remote or local cache @@ -245,9 +255,9 @@ class LLViewerFetchedTexture : public LLViewerTexture protected: /*virtual*/ ~LLViewerFetchedTexture(); public: - LLViewerFetchedTexture(const LLUUID& id, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE); - LLViewerFetchedTexture(const LLImageRaw* raw, BOOL usemipmaps); - LLViewerFetchedTexture(const std::string& url, const LLUUID& id, BOOL usemipmaps = TRUE); + LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE); + LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps); + LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE); public: static F32 maxDecodePriority(); @@ -272,6 +282,7 @@ public: public: /*virtual*/ S8 getType() const ; + FTType getFTType() const; /*virtual*/ void forceImmediateUpdate() ; /*virtual*/ void dump() ; @@ -436,7 +447,8 @@ protected: S8 mHasFetcher; // We've made a fecth request S8 mIsFetching; // Fetch request is active bool mCanUseHTTP ; //This texture can be fetched through http if true. - + + FTType mFTType; // What category of image is this - map tile, server bake, etc? mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database. typedef std::list callback_list_t; @@ -496,8 +508,8 @@ protected: /*virtual*/ ~LLViewerLODTexture(){} public: - LLViewerLODTexture(const LLUUID& id, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE); - LLViewerLODTexture(const std::string& url, const LLUUID& id, BOOL usemipmaps = TRUE); + LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE); + LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE); /*virtual*/ S8 getType() const; // Process image stats to determine priority/quality requirements. @@ -611,6 +623,7 @@ public: static LLPointer getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ; static LLViewerFetchedTexture* getFetchedTexture(const LLUUID &image_id, + FTType f_type = FTT_DEFAULT, BOOL usemipmap = TRUE, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, @@ -620,6 +633,7 @@ public: ); static LLViewerFetchedTexture* getFetchedTextureFromFile(const std::string& filename, + FTType f_type = FTT_LOCAL_FILE, BOOL usemipmap = TRUE, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, @@ -629,6 +643,7 @@ public: ); static LLViewerFetchedTexture* getFetchedTextureFromUrl(const std::string& url, + FTType f_type, BOOL usemipmap = TRUE, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, @@ -637,7 +652,7 @@ public: const LLUUID& force_id = LLUUID::null ); - static LLViewerFetchedTexture* getFetchedTextureFromHost(const LLUUID& image_id, LLHost host) ; + static LLViewerFetchedTexture* getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) ; static void init() ; static void cleanup() ; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index beadef34ba..d2af48f528 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -112,10 +112,10 @@ void LLViewerTextureList::doPreloadImages() llassert_always(mUUIDMap.empty()) ; // Set the "missing asset" image - LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); + LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", FTT_LOCAL_FILE, MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); // Set the "white" image - LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); + LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", FTT_LOCAL_FILE, MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); LLUIImageList* image_list = LLUIImageList::getInstance(); @@ -130,33 +130,33 @@ void LLViewerTextureList::doPreloadImages() //uv_test->setMipFilterNearest(TRUE, TRUE); // prefetch specific UUIDs - LLViewerTextureManager::getFetchedTexture(IMG_SHOT, TRUE); - LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF, TRUE); - LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); + LLViewerTextureManager::getFetchedTexture(IMG_SHOT); + LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF); + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); + image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); + image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); + image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, FTT_DEFAULT, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, + image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, 0,0,LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); if (image) { @@ -198,7 +198,7 @@ void LLViewerTextureList::doPrefetchImages() if(LLViewerTexture::FETCHED_TEXTURE == texture_type || LLViewerTexture::LOD_TEXTURE == texture_type) { - LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type); + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type); if (image) { image->addTextureStats((F32)pixel_area); @@ -324,7 +324,8 @@ void LLViewerTextureList::restoreGL() /////////////////////////////////////////////////////////////////////////////// -LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename, +LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename, + FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, @@ -341,15 +342,16 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& if (full_path.empty()) { llwarns << "Failed to find local image file: " << filename << llendl; - return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); } std::string url = "file://" + full_path; - return getImageFromUrl(url, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); + return getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); } LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& url, + FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, @@ -397,10 +399,10 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& switch(texture_type) { case LLViewerTexture::FETCHED_TEXTURE: - imagep = new LLViewerFetchedTexture(url, new_id, usemipmaps); + imagep = new LLViewerFetchedTexture(url, f_type, new_id, usemipmaps); break ; case LLViewerTexture::LOD_TEXTURE: - imagep = new LLViewerLODTexture(url, new_id, usemipmaps); + imagep = new LLViewerLODTexture(url, f_type, new_id, usemipmaps); break ; default: llerrs << "Invalid texture type " << texture_type << llendl ; @@ -430,7 +432,8 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } -LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, +LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, + FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, @@ -449,7 +452,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, if ((&image_id == NULL) || image_id.isNull()) { - return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI)); + return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI)); } LLPointer imagep = findImage(image_id); @@ -468,11 +471,15 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, llwarns << "Requested texture " << image_id << " already exists with a different target host, requested: " << request_from_host << " current: " << texture->getTargetHost() << llendl; } + if (f_type != FTT_DEFAULT && imagep->getFTType() != f_type) + { + llwarns << "FTType mismatch: requested " << f_type << " image has " << imagep->getFTType() << llendl; + } } if (imagep.isNull()) { - imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; + imagep = createImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } imagep->setGLTextureCreated(true); @@ -481,7 +488,8 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, } //when this function is called, there is no such texture in the gTextureList with image_id. -LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, +LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, + FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, @@ -495,10 +503,10 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, switch(texture_type) { case LLViewerTexture::FETCHED_TEXTURE: - imagep = new LLViewerFetchedTexture(image_id, request_from_host, usemipmaps); + imagep = new LLViewerFetchedTexture(image_id, f_type, request_from_host, usemipmaps); break ; case LLViewerTexture::LOD_TEXTURE: - imagep = new LLViewerLODTexture(image_id, request_from_host, usemipmaps); + imagep = new LLViewerLODTexture(image_id, f_type, request_from_host, usemipmaps); break ; default: llerrs << "Invalid texture type " << texture_type << llendl ; @@ -1388,7 +1396,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d U8 *data = new U8[data_size]; msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size); - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (!image) { delete [] data; @@ -1460,7 +1468,7 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d U8 *data = new U8[data_size]; msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size); - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (!image) { delete [] data; @@ -1565,7 +1573,7 @@ LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std { boost_priority = LLGLTexture::BOOST_UI; } - LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, boost_priority); + LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, FTT_LOCAL_FILE, MIPMAP_NO, boost_priority); return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect); } @@ -1576,7 +1584,7 @@ LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, { boost_priority = LLGLTexture::BOOST_UI; } - LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, boost_priority); + LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, MIPMAP_NO, boost_priority); return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect); } diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h old mode 100644 new mode 100755 index 05c7c35f7c..136042620d --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -130,6 +130,7 @@ private: void removeImageFromList(LLViewerFetchedTexture *image); LLViewerFetchedTexture * getImage(const LLUUID &image_id, + FTType f_type = FTT_DEFAULT, BOOL usemipmap = TRUE, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, @@ -139,6 +140,7 @@ private: ); LLViewerFetchedTexture * getImageFromFile(const std::string& filename, + FTType f_type = FTT_LOCAL_FILE, BOOL usemipmap = TRUE, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, @@ -148,6 +150,7 @@ private: ); LLViewerFetchedTexture* getImageFromUrl(const std::string& url, + FTType f_type, BOOL usemipmap = TRUE, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, @@ -157,6 +160,7 @@ private: ); LLViewerFetchedTexture* createImage(const LLUUID &image_id, + FTType f_type, BOOL usemipmap = TRUE, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, @@ -167,8 +171,8 @@ private: // Request image from a specific host, used for baked avatar textures. // Implemented in header in case someone changes default params above. JC - LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, LLHost host) - { return getImage(image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } + LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, FTType f_type, LLHost host) + { return getImage(image_id, f_type, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } public: typedef std::set > image_list_t; diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 4477893063..e8425dc76a 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -350,7 +350,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) { image_id = getDefaultTextureImageID((ETextureIndex) te); } - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. viewer_avatar->setLocalTextureTE(te, image, 0); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cec1dc677f..8cc3416d0e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1813,14 +1813,14 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU { LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl; result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); } else { LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl; LLHost host = getObjectHost(); result = LLViewerTextureManager::getFetchedTexture( - uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + uuid, FTT_HOST_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } } return result; @@ -7011,7 +7011,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index f7902c5302..240ab202f8 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2648,7 +2648,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) { // Baked textures live on other sims. LLHost target_host = getObjectHost(); - setTEImage( te, LLViewerTextureManager::getFetchedTextureFromHost( uuid, target_host ) ); + setTEImage( te, LLViewerTextureManager::getFetchedTextureFromHost( uuid, FTT_HOST_BAKE, target_host ) ); updateMeshTextures(); dirtyMesh(); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 2a7b7cfa37..6a25b765cf 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -102,7 +102,7 @@ void LLVOGrass::updateSpecies() SpeciesMap::const_iterator it = sSpeciesTable.begin(); mSpecies = (*it).first; } - setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 315e618132..2241537aaf 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -136,7 +136,7 @@ LLVoiceVisualizer::LLVoiceVisualizer( const U8 type ) for (int i=0; isetAddressMode(LLTexUnit::TAM_CLAMP); - mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLGLTexture::BOOST_UI); + mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mMoonTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1); mBloomTexturep->setNoDelete() ; @@ -478,9 +478,9 @@ void LLVOSky::restoreGL() { mSkyTex[i].restoreGL(); } - mSunTexturep = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLGLTexture::BOOST_UI); + mSunTexturep = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mSunTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); - mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLGLTexture::BOOST_UI); + mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mMoonTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1); mBloomTexturep->setNoDelete() ; diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 68bb40d727..145a0380d6 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -316,7 +316,7 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, // Load Species-Specific data // static const S32 MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = 32 ; //frames. - mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); mTreeImagep->setMaxVirtualSizeResetInterval(MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); //allow to wait for at most 16 frames to reset virtual size. mBranchLength = sSpeciesTable[mSpecies]->mBranchLength; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 0e65df939a..8730ef66bb 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1006,7 +1006,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if (is404) { - setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLGLTexture::BOOST_UI)); + setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI)); //render prim proxy when mesh loading attempts give up volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE); @@ -1090,7 +1090,7 @@ void LLVOVolume::updateSculptTexture() LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } else diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 4d52f23ddb..c89a00f3a4 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -78,7 +78,7 @@ void LLSimInfo::setLandForSaleImage (LLUUID image_id) // Fetch the image if (mMapImageID.notNull()) { - mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); + mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP); } else @@ -92,7 +92,7 @@ LLPointer LLSimInfo::getLandForSaleImage () if (mOverlayImage.isNull() && mMapImageID.notNull()) { // Fetch the image if it hasn't been done yet (unlikely but...) - mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); + mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP); } if (!mOverlayImage.isNull()) diff --git a/indra/newview/llworldmipmap.cpp b/indra/newview/llworldmipmap.cpp index c9d2a24a4e..895ccaef5a 100644 --- a/indra/newview/llworldmipmap.cpp +++ b/indra/newview/llworldmipmap.cpp @@ -189,7 +189,7 @@ LLPointer LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 // END DEBUG //LL_INFOS("World Map") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL; - LLPointer img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLPointer img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); img->setBoostLevel(LLGLTexture::BOOST_MAP); // Return the smart pointer -- cgit v1.2.3 From 7e967ce2fd78078fb4284f2d61171bc90a669375 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 8 Mar 2013 18:45:33 -0500 Subject: SH-3941 SH-3954 FIX local appearance does not update properly We were using an indicator of whether there *was* a baked texture to whether we were *using* a baked texture. Switched to one of the (several) proper indicators of whether a baked texture was in use. This should allow local texture data to get marked for download when we enter appearance mode. Local testing confirms that old apperances linger for a second or two, but are soon replaced by the correct local renders. --- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatarself.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cec1dc677f..5bc45b3551 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4342,7 +4342,7 @@ void LLVOAvatar::updateTextures() const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; if (texture_dict->mIsLocalTexture) { - addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); + addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, mBakedTextureDatas[baked_index].mIsUsed); } } } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index f7902c5302..36229e51ec 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2964,9 +2964,9 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch) gAgentAvatarp->idleUpdateAppearanceAnimation(); #endif - gAgentAvatarp->updateTextures(); // call updateTextureStats gAgentAvatarp->invalidateAll(); // mark all bakes as dirty, request updates gAgentAvatarp->updateMeshTextures(); // make sure correct textures are applied to the avatar mesh. + gAgentAvatarp->updateTextures(); // call updateTextureStats } } -- cgit v1.2.3 From 175190ac7aa32b71b3f8bed55a98176e030f9eb4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Mar 2013 13:52:29 -0400 Subject: Fix for build failure in tests --- indra/newview/tests/llworldmap_test.cpp | 3 ++- indra/newview/tests/llworldmipmap_test.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 indra/newview/tests/llworldmap_test.cpp (limited to 'indra/newview') diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp old mode 100644 new mode 100755 index 3c68890c36..1ab7d67fce --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -49,7 +49,8 @@ // Stub image calls void LLGLTexture::setBoostLevel(S32 ) { } void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, BOOL, LLGLTexture::EBoostLevel, S8, +enum FTType; +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, LLHost ) { return NULL; } // Stub related map calls diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index 22ebf28f55..0edb1b9809 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -43,7 +43,8 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. void LLGLTexture::setBoostLevel(S32 ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, BOOL, LLGLTexture::EBoostLevel, S8, +enum FTType; +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, const LLUUID& ) { return NULL; } LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name) { } -- cgit v1.2.3 From 957c8303be6bef4182cff3b51fe3ffa06467d6a2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Mar 2013 14:51:45 -0400 Subject: Added gratuitous coupling to stop gcc from complaining --- indra/newview/lltexturefetch.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 544499232d..618784c8ed 100755 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -44,15 +44,14 @@ #include "httpoptions.h" #include "httpheaders.h" #include "httphandler.h" +#include "llviewertexture.h" -class LLViewerTexture; class LLTextureFetchWorker; class LLImageDecodeThread; class LLHost; class LLViewerAssetStats; class LLTextureFetchDebugger; class LLTextureCache; -enum FTType; // Interface class -- cgit v1.2.3 From 9514210beb1ae2ec49f1cf15e5a4f7af5ae56657 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Mar 2013 14:58:55 -0400 Subject: more test build fix --- indra/newview/tests/llworldmap_test.cpp | 1 - indra/newview/tests/llworldmipmap_test.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index 1ab7d67fce..84194adb5d 100755 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -49,7 +49,6 @@ // Stub image calls void LLGLTexture::setBoostLevel(S32 ) { } void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } -enum FTType; LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, LLHost ) { return NULL; } diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index 0edb1b9809..142d75bcfd 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -43,7 +43,6 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. void LLGLTexture::setBoostLevel(S32 ) { } -enum FTType; LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, const LLUUID& ) { return NULL; } -- cgit v1.2.3 From 0123ab0dc67dd9de266f1edac2cadbd43ef0aa4d Mon Sep 17 00:00:00 2001 From: prep linden Date: Tue, 12 Mar 2013 11:02:00 -0400 Subject: Removed unneeded code. --- indra/newview/llinventorymodel.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 3debdf5ac9..5fa4ebaf97 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3324,11 +3324,11 @@ public: * * @param[in, out] items - array of items, not sorted. */ -static void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& items) -{ - static LLViewerInventoryItemSort sort_functor; - std::sort(items.begin(), items.end(), sort_functor); -} +//static void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& items) +//{ +// static LLViewerInventoryItemSort sort_functor; +// std::sort(items.begin(), items.end(), sort_functor); +//} // * @param source_item_id - LLUUID of the source item to be moved into new position // * @param target_item_id - LLUUID of the target item before which source item should be placed. -- cgit v1.2.3 From 71f2032caa090efbcd0c4ad1715848ef85ebb304 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 13 Mar 2013 13:36:45 -0400 Subject: Ported sunshine-internal fixes (Commits: 5271cc5 and b37c09) --- indra/newview/llappviewer.cpp | 2 +- indra/newview/llglsandbox.cpp | 8 ++++---- indra/newview/llmediactrl.cpp | 18 +++++++++--------- indra/newview/lloutputmonitorctrl.h | 2 +- indra/newview/llviewerdisplay.cpp | 10 +++++----- indra/newview/llviewerwindow.cpp | 12 ++++++------ indra/newview/llworldmapview.cpp | 4 ++-- 7 files changed, 28 insertions(+), 28 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0f77c68ec8..dac268ec92 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -803,7 +803,7 @@ bool LLAppViewer::init() LLUIImageList::getInstance(), ui_audio_callback, deferred_ui_audio_callback, - &LLUI::sGLScaleFactor); + &LLUI::getScaleFactor()); LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ; // NOW LLUI::getLanguage() should work. gDirUtilp must know the language diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 1208c9378e..60fa53f491 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -79,10 +79,10 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) S32 top = llmax(y, mDragStartY); S32 bottom =llmin(y, mDragStartY); - left = llround((F32) left * LLUI::sGLScaleFactor.mV[VX]); - right = llround((F32) right * LLUI::sGLScaleFactor.mV[VX]); - top = llround((F32) top * LLUI::sGLScaleFactor.mV[VY]); - bottom = llround((F32) bottom * LLUI::sGLScaleFactor.mV[VY]); + left = llround((F32) left * LLUI::getScaleFactor().mV[VX]); + right = llround((F32) right * LLUI::getScaleFactor().mV[VX]); + top = llround((F32) top * LLUI::getScaleFactor().mV[VY]); + bottom = llround((F32) bottom * LLUI::getScaleFactor().mV[VY]); F32 old_far_plane = LLViewerCamera::getInstance()->getFar(); F32 old_near_plane = LLViewerCamera::getInstance()->getNear(); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 99b4707158..2075aeed63 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -119,8 +119,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : if(!getDecoupleTextureSize()) { - S32 screen_width = llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]); - S32 screen_height = llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]); + S32 screen_width = llround((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]); + S32 screen_height = llround((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]); setTextureSize(screen_width, screen_height); } @@ -469,8 +469,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) { if(!getDecoupleTextureSize()) { - S32 screen_width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]); - S32 screen_height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]); + S32 screen_width = llround((F32)width * LLUI::getScaleFactor().mV[VX]); + S32 screen_height = llround((F32)height * LLUI::getScaleFactor().mV[VY]); // when floater is minimized, these sizes are negative if ( screen_height > 0 && screen_width > 0 ) @@ -667,7 +667,7 @@ bool LLMediaCtrl::ensureMediaSourceExists() mMediaSource->addObserver( this ); mMediaSource->setBackgroundColor( getBackgroundColor() ); mMediaSource->setTrustedBrowser(mTrusted); - mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); + mMediaSource->setPageZoomFactor( LLUI::getScaleFactor().mV[ VX ] ); if(mClearCache) { @@ -750,7 +750,7 @@ void LLMediaCtrl::draw() { gGL.pushUIMatrix(); { - mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); + mMediaSource->setPageZoomFactor( LLUI::getScaleFactor().mV[ VX ] ); // scale texture to fit the space using texture coords gGL.getTexUnit(0)->bind(media_texture); @@ -864,14 +864,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); } - x = llround((F32)x * LLUI::sGLScaleFactor.mV[VX]); + x = llround((F32)x * LLUI::getScaleFactor().mV[VX]); if ( ! coords_opengl ) { - y = llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]); + y = llround((F32)(y) * LLUI::getScaleFactor().mV[VY]); } else { - y = llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]); + y = llround((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]); }; } diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h index a346909027..0682af1278 100644 --- a/indra/newview/lloutputmonitorctrl.h +++ b/indra/newview/lloutputmonitorctrl.h @@ -31,7 +31,7 @@ #include "../llui/llview.h" #include "llmutelist.h" #include "llspeakingindicatormanager.h" -#include "../llui/lluiimage.h" +//#include "../llui/lluiimage.h" class LLTextBox; class LLUICtrlFactory; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index ffeea2f4df..02f82aba63 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1425,7 +1425,7 @@ void render_ui_2d() gGL.pushMatrix(); S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); - gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); + gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f); gGL.translatef((F32)half_width, (F32)half_height, 0.f); F32 zoom = gAgentCamera.mHUDCurZoom; gGL.scalef(zoom,zoom,1.f); @@ -1463,10 +1463,10 @@ void render_ui_2d() LLUI::sDirtyRect = last_rect; last_rect = t_rect; - last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::sGLScaleFactor.mV[0]); - last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::sGLScaleFactor.mV[0]); - last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::sGLScaleFactor.mV[1]); - last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::sGLScaleFactor.mV[1]); + last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::getScaleFactor().mV[0]); + last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::getScaleFactor().mV[0]); + last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::getScaleFactor().mV[1]); + last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::getScaleFactor().mV[1]); LLRect clip_rect(last_rect); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 383eb3c9e4..db3476850b 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2157,7 +2157,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) calcDisplayScale(); - BOOL display_scale_changed = mDisplayScale != LLUI::sGLScaleFactor; + BOOL display_scale_changed = mDisplayScale != LLUI::getScaleFactor(); LLUI::setScaleFactor(mDisplayScale); // update our window rectangle @@ -2363,7 +2363,7 @@ void LLViewerWindow::draw() // scale view by UI global scale factor and aspect ratio correction factor gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); - LLVector2 old_scale_factor = LLUI::sGLScaleFactor; + LLVector2 old_scale_factor = LLUI::getScaleFactor(); // apply camera zoom transform (for high res screenshots) F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); @@ -2377,7 +2377,7 @@ void LLViewerWindow::draw() (F32)getWindowHeightScaled() * -(F32)pos_y, 0.f); gGL.scalef(zoom_factor, zoom_factor, 1.f); - LLUI::sGLScaleFactor *= zoom_factor; + LLUI::getScaleFactor() *= zoom_factor; } // Draw tool specific overlay on world @@ -2425,7 +2425,7 @@ void LLViewerWindow::draw() LLFontGL::HCENTER, LLFontGL::TOP); } - LLUI::sGLScaleFactor = old_scale_factor; + LLUI::setScaleFactor(old_scale_factor); } LLUI::popMatrix(); gGL.popMatrix(); @@ -3230,8 +3230,8 @@ void LLViewerWindow::updateLayout() void LLViewerWindow::updateMouseDelta() { - S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); - S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); + S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::getScaleFactor().mV[VX]); + S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::getScaleFactor().mV[VY]); //RN: fix for asynchronous notification of mouse leaving window not working LLCoordWindow mouse_pos; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index ccc513b80d..ffb0964499 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -421,7 +421,7 @@ void LLWorldMapView::draw() { // Inform the fetch mechanism of the size we need S32 draw_size = llround(sMapScale); - overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); + overlayimage->setKnownDrawSize(llround(draw_size * LLUI::getScaleFactor().mV[VX]), llround(draw_size * LLUI::getScaleFactor().mV[VY])); // Draw something whenever we have enough info if (overlayimage->hasGLTexture()) { @@ -1320,7 +1320,7 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - gGL.translatef((F32)x * LLUI::sGLScaleFactor.mV[VX], (F32)y * LLUI::sGLScaleFactor.mV[VY], 0.f); + gGL.translatef((F32)x * LLUI::getScaleFactor().mV[VX], (F32)y * LLUI::getScaleFactor().mV[VY], 0.f); gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color); gGL.popMatrix(); -- cgit v1.2.3 From 9150757c8179f06058c41b967a69f95e03c3e619 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Wed, 13 Mar 2013 21:01:50 +0000 Subject: More fixes for gcc-4.6 breakage --- indra/newview/llchiclet.cpp | 16 ++++++++-------- indra/newview/llviewerdisplay.cpp | 2 +- indra/newview/llviewerwindow.cpp | 4 ++-- indra/newview/llworldmapview.cpp | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 3dbb43c657..e34130aff2 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -427,14 +427,14 @@ LLChicletPanel::~LLChicletPanel() void LLChicletPanel::onMessageCountChanged(const LLSD& data) { - LLUUID session_id = data["session_id"].asUUID(); - S32 unread = data["participant_unread"].asInteger(); - - LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id); - if (im_floater && im_floater->getVisible() && im_floater->hasFocus()) - { - unread = 0; - } + //LLUUID session_id = data["session_id"].asUUID(); + //S32 unread = data["participant_unread"].asInteger(); + + //LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id); + //if (im_floater && im_floater->getVisible() && im_floater->hasFocus()) + //{ + // unread = 0; + //} } void LLChicletPanel::objectChicletCallback(const LLSD& data) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 02f82aba63..70256d0e78 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1038,7 +1038,7 @@ void render_hud_attachments() if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) { LLCamera hud_cam = *LLViewerCamera::getInstance(); - LLVector3 origin = hud_cam.getOrigin(); + //LLVector3 origin = hud_cam.getOrigin(); hud_cam.setOrigin(-1.f,0,0); hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1)); LLViewerCamera::updateFrustumPlanes(hud_cam, TRUE); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index db3476850b..a6cd2c9ab7 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2837,7 +2837,7 @@ void LLViewerWindow::updateUI() BOOL handled = FALSE; - BOOL handled_by_top_ctrl = FALSE; + //BOOL handled_by_top_ctrl = FALSE; LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); LLView* captor_view = dynamic_cast(mouse_captor); @@ -3022,7 +3022,7 @@ void LLViewerWindow::updateUI() S32 local_x, local_y; top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask); - handled_by_top_ctrl = TRUE; + //handled_by_top_ctrl = TRUE; } if ( !handled ) diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index ffb0964499..c82fc50812 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -965,7 +965,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& S32 text_x = x; S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight()); - BOOL is_in_window = true; + //BOOL is_in_window = true; if( x < 0 || y < 0 @@ -979,7 +979,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& text_x = sTrackingArrowX; text_y = sTrackingArrowY; } - is_in_window = false; + //is_in_window = false; } else if (LLTracker::getTrackingStatus() == LLTracker::TRACKING_LOCATION && LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING) -- cgit v1.2.3 From dd1f89d3a9316a8486460f7f354d54083c8ca688 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Mar 2013 17:21:26 -0400 Subject: SH-3975 WIP - consolidated texture fetch state changes to simplify tracking --- indra/newview/lltexturefetch.cpp | 103 ++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 39 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 0e53fc81b8..ffb7eeab09 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -502,6 +502,7 @@ private: }; static const char* sStateDescs[]; e_state mState; + void setState(e_state new_state); e_write_to_cache_state mWriteToCacheState; LLTextureFetch* mFetcher; LLPointer mFormattedImage; @@ -1028,7 +1029,7 @@ void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size) mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); if ((prioritize && mState == INIT) || mState == DONE) { - mState = INIT; + setState(INIT); U32 work_priority = mWorkPriority | LLWorkerThread::PRIORITY_HIGH; setPriority(work_priority); } @@ -1140,7 +1141,7 @@ bool LLTextureFetchWorker::doWork(S32 param) clearPackets(); // TODO: Shouldn't be necessary mCacheReadHandle = LLTextureCache::nullHandle(); mCacheWriteHandle = LLTextureCache::nullHandle(); - mState = LOAD_FROM_TEXTURE_CACHE; + setState(LOAD_FROM_TEXTURE_CACHE); mInCache = FALSE; mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); // min desired size is TEXTURE_CACHE_ENTRY_SIZE LL_DEBUGS("Texture") << mID << ": Priority: " << llformat("%8.0f",mImagePriority) @@ -1157,7 +1158,7 @@ bool LLTextureFetchWorker::doWork(S32 param) S32 size = mDesiredSize - offset; if (size <= 0) { - mState = CACHE_POST; + setState(CACHE_POST); return false; } mFileSize = 0; @@ -1188,12 +1189,12 @@ bool LLTextureFetchWorker::doWork(S32 param) else if(!mUrl.empty() && mCanUseHTTP) { setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - mState = WAIT_HTTP_RESOURCE; + setState(WAIT_HTTP_RESOURCE); } else { setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - mState = LOAD_FROM_NETWORK; + setState(LOAD_FROM_NETWORK); } } @@ -1203,7 +1204,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mFetcher->mTextureCache->readComplete(mCacheReadHandle, false)) { mCacheReadHandle = LLTextureCache::nullHandle(); - mState = CACHE_POST; + setState(CACHE_POST); // fall through } else @@ -1229,7 +1230,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // we have enough data, decode it llassert_always(mFormattedImage->getDataSize() > 0); mLoadedDiscard = mDesiredDiscard; - mState = DECODE_IMAGE; + setState(DECODE_IMAGE); mInCache = TRUE; mWriteToCacheState = NOT_WRITE ; LL_DEBUGS("Texture") << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize() @@ -1248,7 +1249,7 @@ bool LLTextureFetchWorker::doWork(S32 param) else { LL_DEBUGS("Texture") << mID << ": Not in Cache" << LL_ENDL; - mState = LOAD_FROM_NETWORK; + setState(LOAD_FROM_NETWORK); } // fall through @@ -1295,7 +1296,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } if (mCanUseHTTP && !mUrl.empty()) { - mState = WAIT_HTTP_RESOURCE; + setState(WAIT_HTTP_RESOURCE); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); if(mWriteToCacheState != NOT_WRITE) { @@ -1346,7 +1347,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; // failed } setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - mState = DECODE_IMAGE; + setState(DECODE_IMAGE); mWriteToCacheState = SHOULD_WRITE; recordTextureDone(false); } @@ -1370,14 +1371,14 @@ bool LLTextureFetchWorker::doWork(S32 param) // Otherwise, advance into the HTTP states. if (mFetcher->getHttpWaitersCount() || ! acquireHttpSemaphore()) { - mState = WAIT_HTTP_RESOURCE2; + setState(WAIT_HTTP_RESOURCE2); setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); mFetcher->addHttpWaiter(this->mID); ++mResourceWaitCount; return false; } - mState = SEND_HTTP_REQ; + setState(SEND_HTTP_REQ); // *NOTE: You must invoke releaseHttpSemaphore() if you transition // to a state other than SEND_HTTP_REQ or WAIT_HTTP_REQ or abort // the request. @@ -1410,7 +1411,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // We already have all the data, just decode it mLoadedDiscard = mFormattedImage->getDiscardLevel(); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - mState = DECODE_IMAGE; + setState(DECODE_IMAGE); releaseHttpSemaphore(); return false; } @@ -1474,7 +1475,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mFetcher->addToHTTPQueue(mID); recordTextureStart(true); setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); - mState = WAIT_HTTP_REQ; + setState(WAIT_HTTP_REQ); // fall through } @@ -1492,7 +1493,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { if(mWriteToCacheState == NOT_WRITE) //map tiles { - mState = DONE; + setState(DONE); releaseHttpSemaphore(); return true; // failed, means no map tile on the empty region. } @@ -1502,7 +1503,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // roll back to try UDP if (mCanUseNET) { - mState = INIT; + setState(INIT); mCanUseHTTP = false; mUrl.clear(); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); @@ -1533,14 +1534,14 @@ bool LLTextureFetchWorker::doWork(S32 param) // Use available data mLoadedDiscard = mFormattedImage->getDiscardLevel(); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - mState = DECODE_IMAGE; + setState(DECODE_IMAGE); releaseHttpSemaphore(); return false; } // Fail harder resetFormattedData(); - mState = DONE; + setState(DONE); releaseHttpSemaphore(); return true; // failed } @@ -1563,7 +1564,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } // abort. - mState = DONE; + setState(DONE); releaseHttpSemaphore(); return true; } @@ -1581,7 +1582,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { LL_WARNS("Texture") << "Partial HTTP response produces break in image data for texture " << mID << ". Aborting load." << LL_ENDL; - mState = DONE; + setState(DONE); releaseHttpSemaphore(); return true; } @@ -1629,7 +1630,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mHttpReplyOffset = 0; mLoadedDiscard = mRequestedDiscard; - mState = DECODE_IMAGE; + setState(DECODE_IMAGE); if (mWriteToCacheState != NOT_WRITE) { mWriteToCacheState = SHOULD_WRITE ; @@ -1660,31 +1661,31 @@ bool LLTextureFetchWorker::doWork(S32 param) if (textures_decode_disabled) { // for debug use, don't decode - mState = DONE; + setState(DONE); return true; } if (mDesiredDiscard < 0) { // We aborted, don't decode - mState = DONE; + setState(DONE); return true; } if (mFormattedImage->getDataSize() <= 0) { - //llerrs << "Decode entered with invalid mFormattedImage. ID = " << mID << llendl; + llwarns << "Decode entered with invalid mFormattedImage. ID = " << mID << llendl; //abort, don't decode - mState = DONE; + setState(DONE); return true; } if (mLoadedDiscard < 0) { - //llerrs << "Decode entered with invalid mLoadedDiscard. ID = " << mID << llendl; + llwarns << "Decode entered with invalid mLoadedDiscard. ID = " << mID << llendl; //abort, don't decode - mState = DONE; + setState(DONE); return true; } @@ -1694,7 +1695,7 @@ bool LLTextureFetchWorker::doWork(S32 param) S32 discard = mHaveAllData ? 0 : mLoadedDiscard; U32 image_priority = LLWorkerThread::PRIORITY_NORMAL | mWorkPriority; mDecoded = FALSE; - mState = DECODE_IMAGE_UPDATE; + setState(DECODE_IMAGE_UPDATE); LL_DEBUGS("Texture") << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard << " All Data: " << mHaveAllData << LL_ENDL; mDecodeHandle = mFetcher->mImageDecodeThread->decodeImage(mFormattedImage, image_priority, discard, mNeedsAux, @@ -1722,13 +1723,13 @@ bool LLTextureFetchWorker::doWork(S32 param) mFormattedImage = NULL; ++mRetryAttempt; setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - mState = INIT; + setState(INIT); return false; } else { // llwarns << "UNABLE TO LOAD TEXTURE: " << mID << " RETRIES: " << mRetryAttempt << llendl; - mState = DONE; // failed + setState(DONE); // failed } } else @@ -1737,7 +1738,7 @@ bool LLTextureFetchWorker::doWork(S32 param) LL_DEBUGS("Texture") << mID << ": Decoded. Discard: " << mDecodedDiscard << " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL; setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - mState = WRITE_TO_CACHE; + setState(WRITE_TO_CACHE); } // fall through } @@ -1753,7 +1754,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { // If we're in a local cache or we didn't actually receive any new data, // or we failed to load anything, skip - mState = DONE; + setState(DONE); return false; } S32 datasize = mFormattedImage->getDataSize(); @@ -1772,7 +1773,7 @@ bool LLTextureFetchWorker::doWork(S32 param) setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it U32 cache_priority = mWorkPriority; mWritten = FALSE; - mState = WAIT_ON_WRITE; + setState(WAIT_ON_WRITE); ++mCacheWriteCount; CacheWriteResponder* responder = new CacheWriteResponder(mFetcher, mID); mCacheWriteHandle = mFetcher->mTextureCache->writeToCache(mID, cache_priority, @@ -1785,7 +1786,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (writeToCacheComplete()) { - mState = DONE; + setState(DONE); // fall through } else @@ -1806,7 +1807,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mDecodedDiscard >= 0 && mDesiredDiscard < mDecodedDiscard) { // More data was requested, return to INIT - mState = INIT; + setState(INIT); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); return false; } @@ -2475,7 +2476,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const worker->setCanUseHTTP(can_use_http) ; if (!worker->haveWork()) { - worker->mState = LLTextureFetchWorker::INIT; + worker->setState(LLTextureFetchWorker::INIT); worker->unlockWorkMutex(); // -Mw worker->addWork(0, LLWorkerThread::PRIORITY_HIGH | worker->mWorkPriority); @@ -3168,6 +3169,30 @@ bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size) return true; } +void LLTextureFetchWorker::setState(e_state new_state) +{ + static char* e_state_name[] = + { + "INVALID", + "INIT", + "LOAD_FROM_TEXTURE_CACHE", + "CACHE_POST", + "LOAD_FROM_NETWORK", + "LOAD_FROM_SIMULATOR", + "WAIT_HTTP_RESOURCE", + "WAIT_HTTP_RESOURCE2", + "SEND_HTTP_REQ", + "WAIT_HTTP_REQ", + "DECODE_IMAGE", + "DECODE_IMAGE_UPDATE", + "WRITE_TO_CACHE", + "WAIT_ON_WRITE", + "DONE" + }; + //llinfos << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; + mState = new_state; +} + // Threads: T* bool LLTextureFetch::receiveImageHeader(const LLHost& host, const LLUUID& id, U8 codec, U16 packets, U32 totalbytes, U16 data_size, U8* data) @@ -3224,7 +3249,7 @@ bool LLTextureFetch::receiveImageHeader(const LLHost& host, const LLUUID& id, U8 llassert_always(data_size == FIRST_PACKET_SIZE || data_size == worker->mFileSize); res = worker->insertPacket(0, data, data_size); worker->setPriority(LLWorkerThread::PRIORITY_HIGH | worker->mWorkPriority); - worker->mState = LLTextureFetchWorker::LOAD_FROM_SIMULATOR; + worker->setState(LLTextureFetchWorker::LOAD_FROM_SIMULATOR); worker->unlockWorkMutex(); // -Mw return res; } @@ -3274,7 +3299,7 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 (worker->mState == LLTextureFetchWorker::LOAD_FROM_NETWORK)) { worker->setPriority(LLWorkerThread::PRIORITY_HIGH | worker->mWorkPriority); - worker->mState = LLTextureFetchWorker::LOAD_FROM_SIMULATOR; + worker->setState(LLTextureFetchWorker::LOAD_FROM_SIMULATOR); } else { @@ -3537,7 +3562,7 @@ void LLTextureFetch::releaseHttpWaiters() break; } - worker->mState = LLTextureFetchWorker::SEND_HTTP_REQ; + worker->setState(LLTextureFetchWorker::SEND_HTTP_REQ); worker->setPriority(LLWorkerThread::PRIORITY_HIGH | worker->mWorkPriority); worker->unlockWorkMutex(); // -Mw -- cgit v1.2.3 From 6f193d54da0b0eae2758b99e706cd127966aafa1 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 13 Mar 2013 17:52:40 -0400 Subject: SH-3806 FIX test case for local bakes being wrong Local bakes were following folder links in some cases, causing unworn items to be rendered. Fixed the cof fetcher, now they should no longer show up. --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index a944659e96..c04d6bad94 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2034,7 +2034,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) //dumpCat(getCOF(),"COF, start"); - bool follow_folder_links = true; + bool follow_folder_links = false; LLUUID current_outfit_id = getCOF(); // Find all the wearables that are in the COF's subtree. -- cgit v1.2.3 From 24a6c3fda2ba3aa1f40ee31b6f1fc025a6623833 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 14 Mar 2013 14:43:11 -0400 Subject: modified_cof_cb() issues a updateAppearanceFromCOF() right before this function - removed extra update call. Sh-3650 & Sh-3985 --- indra/newview/llvoavatarself.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 64443f55af..ea39d44c73 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2989,9 +2989,7 @@ void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) { gAgentCamera.changeCameraToDefault(); gAgentCamera.resetView(); - } - - LLAppearanceMgr::instance().updateAppearanceFromCOF(); + } } } -- cgit v1.2.3 From e288ff9695f4f2fbfc0f3963985c6e0fa61f6403 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 15 Mar 2013 13:26:31 -0400 Subject: SH-3850 WIP, SH-3959 WIP - added additional debug logging for texture loading --- indra/newview/app_settings/logcontrol.xml | 0 indra/newview/lltexturefetch.cpp | 29 ++++++++++++++++++++++++----- indra/newview/llviewertexture.cpp | 5 +++-- 3 files changed, 27 insertions(+), 7 deletions(-) mode change 100644 => 100755 indra/newview/app_settings/logcontrol.xml mode change 100644 => 100755 indra/newview/llviewertexture.cpp (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml old mode 100644 new mode 100755 diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 0e53fc81b8..b9d80fe326 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1092,12 +1092,14 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (mState == INIT || mState == LOAD_FROM_NETWORK || mState == LOAD_FROM_SIMULATOR) { + LL_DEBUGS("Texture") << mID << " abort: mImagePriority < F_ALMOST_ZERO" << llendl; return true; // abort } } if(mState > CACHE_POST && !mCanUseNET && !mCanUseHTTP) { //nowhere to get data, abort. + LL_DEBUGS("Texture") << mID << " abort, nowhere to get data" << llendl; return true ; } @@ -1211,6 +1213,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // //This should never happen // + LL_DEBUGS("Texture") << mID << " this should never happen" << llendl; return false; } } @@ -1325,6 +1328,8 @@ bool LLTextureFetchWorker::doWork(S32 param) //mFetcher->addToNetworkQueue(this); //recordTextureStart(false); //setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); + + LL_DEBUGS("Texture") << mID << " does this happen?" << llendl; return false; } } @@ -1343,6 +1348,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { // processSimulatorPackets() failed // llwarns << "processSimulatorPackets() failed to load buffer" << llendl; + LL_DEBUGS("Texture") << mID << " processSimulatorPackets() failed to load buffer" << llendl; return true; // failed } setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); @@ -1394,6 +1400,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (! mCanUseHTTP) { releaseHttpSemaphore(); + LL_DEBUGS("Texture") << mID << " abort: SEND_HTTP_REQ but !mCanUseHTTP" << llendl; return true; // abort } @@ -1417,6 +1424,7 @@ bool LLTextureFetchWorker::doWork(S32 param) else { releaseHttpSemaphore(); + LL_DEBUGS("Texture") << mID << " SEND_HTTP_REQ abort: cur_size " << cur_size << " <=0" << llendl; return true; // abort. } } @@ -1494,6 +1502,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { mState = DONE; releaseHttpSemaphore(); + LL_DEBUGS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << llendl; return true; // failed, means no map tile on the empty region. } @@ -1542,6 +1551,7 @@ bool LLTextureFetchWorker::doWork(S32 param) resetFormattedData(); mState = DONE; releaseHttpSemaphore(); + LL_DEBUGS("Texture") << mID << " abort: fail harder" << llendl; return true; // failed } @@ -1550,6 +1560,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // next time the texture is requested, even if the data have already been fetched. if(mWriteToCacheState != NOT_WRITE) { + // Why do we want to keep url if NOT_WRITE - is this a proxy for map tiles? mUrl.clear(); } @@ -1563,6 +1574,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } // abort. + LL_DEBUGS("Texture") << mID << " abort: no data received" << llendl; mState = DONE; releaseHttpSemaphore(); return true; @@ -1667,6 +1679,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mDesiredDiscard < 0) { // We aborted, don't decode + LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: desired discard " << mDesiredDiscard << "<0" << llendl; mState = DONE; return true; } @@ -1677,6 +1690,7 @@ bool LLTextureFetchWorker::doWork(S32 param) //abort, don't decode mState = DONE; + LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: (mFormattedImage->getDataSize() <= 0)" << llendl; return true; } if (mLoadedDiscard < 0) @@ -1684,6 +1698,7 @@ bool LLTextureFetchWorker::doWork(S32 param) //llerrs << "Decode entered with invalid mLoadedDiscard. ID = " << mID << llendl; //abort, don't decode + LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: mLoadedDiscard < 0" << llendl; mState = DONE; return true; } @@ -1806,6 +1821,9 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mDecodedDiscard >= 0 && mDesiredDiscard < mDecodedDiscard) { // More data was requested, return to INIT + LL_DEBUGS("Texture") << mID << " more data requested, returning to INIT: " + << " mDecodedDiscard " << mDecodedDiscard << ">= 0 && mDesiredDiscard " << mDesiredDiscard + << "<" << " mDecodedDiscard " << mDecodedDiscard << llendl; mState = INIT; setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); return false; @@ -1846,10 +1864,10 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe bool partial = false; LLCore::HttpStatus status(response->getStatus()); - lldebugs << "HTTP COMPLETE: " << mID - << " status: " << status.toHex() - << " '" << status.toString() << "'" - << llendl; + LL_DEBUGS("Texture") << "HTTP COMPLETE: " << mID + << " status: " << status.toHex() + << " '" << status.toString() << "'" + << llendl; // unsigned int offset(0), length(0), full_length(0); // response->getRange(&offset, &length, &full_length); // llwarns << "HTTP COMPLETE: " << mID << " handle: " << handle @@ -2433,6 +2451,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const std::string exten = gDirUtilp->getExtension(url); if (!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C)) { + LL_DEBUGS("Texture") << "full request for " << id << " exten is not J2C: " << exten << llendl; // Only do partial requests for J2C at the moment desired_size = MAX_IMAGE_DATA_SIZE; desired_discard = 0; @@ -2499,7 +2518,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const worker->unlockWorkMutex(); // -Mw } -// llinfos << "REQUESTED: " << id << " Discard: " << desired_discard << llendl; + LL_DEBUGS("Texture") << "REQUESTED: " << id << " Discard: " << desired_discard << " size " << desired_size << llendl; return true; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp old mode 100644 new mode 100755 index 1d0bda34a7..e0e44cfa1e --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1952,11 +1952,12 @@ bool LLViewerFetchedTexture::updateFetch() } else if (mHasFetcher && !mIsFetching) { - // Only delete requests that haven't receeived any network data for a while + // Only delete requests that haven't received any network data for a while const F32 FETCH_IDLE_TIME = 5.f; if (mLastPacketTimer.getElapsedTimeF32() > FETCH_IDLE_TIME) { -// llinfos << "Deleting request: " << getID() << " Discard: " << current_discard << " <= min:" << mMinDiscardLevel << " or priority == 0: " << decode_priority << llendl; + llinfos << "idle timeout, deleting request: " << getID() << " - is discard: " << current_discard << " <= min:" << mMinDiscardLevel << " or priority == 0: " << decode_priority << "?" << llendl; + LL_DEBUGS("Texture") << "exceeded idle time " << FETCH_IDLE_TIME << ", deleting request: " << getID() << llendl; LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); mHasFetcher = FALSE; } -- cgit v1.2.3 From 7d1bd682cdbe5c2ce3b0f18ae1f4bc74db60354e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Mar 2013 13:38:13 -0400 Subject: cut back log spam --- indra/newview/llviewertexture.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e0e44cfa1e..baf01e5565 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1956,7 +1956,6 @@ bool LLViewerFetchedTexture::updateFetch() const F32 FETCH_IDLE_TIME = 5.f; if (mLastPacketTimer.getElapsedTimeF32() > FETCH_IDLE_TIME) { - llinfos << "idle timeout, deleting request: " << getID() << " - is discard: " << current_discard << " <= min:" << mMinDiscardLevel << " or priority == 0: " << decode_priority << "?" << llendl; LL_DEBUGS("Texture") << "exceeded idle time " << FETCH_IDLE_TIME << ", deleting request: " << getID() << llendl; LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); mHasFetcher = FALSE; -- cgit v1.2.3 From a365d7fb3fe3476b693b9547cd40be2d3e345d8c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Mar 2013 16:41:42 -0400 Subject: more urgent notification (DEBUG->WARN) for some texture fetch error cases --- indra/newview/lltexturefetch.cpp | 13 +++++++------ indra/newview/llviewertexture.cpp | 9 +++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 7137d4c681..ceec0e27f1 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1100,7 +1100,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if(mState > CACHE_POST && !mCanUseNET && !mCanUseHTTP) { //nowhere to get data, abort. - LL_DEBUGS("Texture") << mID << " abort, nowhere to get data" << llendl; + LL_WARNS("Texture") << mID << " abort, nowhere to get data" << llendl; return true ; } @@ -1246,6 +1246,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mUrl.compare(0, 7, "file://") == 0) { // failed to load local file, we're done. + LL_WARNS("Texture") << mID << ": abort, failed to load local file " << mUrl << LL_ENDL; return true; } // need more data @@ -1349,7 +1350,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { // processSimulatorPackets() failed // llwarns << "processSimulatorPackets() failed to load buffer" << llendl; - LL_DEBUGS("Texture") << mID << " processSimulatorPackets() failed to load buffer" << llendl; + LL_WARNS("Texture") << mID << " processSimulatorPackets() failed to load buffer" << llendl; return true; // failed } setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); @@ -1401,7 +1402,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (! mCanUseHTTP) { releaseHttpSemaphore(); - LL_DEBUGS("Texture") << mID << " abort: SEND_HTTP_REQ but !mCanUseHTTP" << llendl; + LL_WARNS("Texture") << mID << " abort: SEND_HTTP_REQ but !mCanUseHTTP" << llendl; return true; // abort } @@ -1425,7 +1426,7 @@ bool LLTextureFetchWorker::doWork(S32 param) else { releaseHttpSemaphore(); - LL_DEBUGS("Texture") << mID << " SEND_HTTP_REQ abort: cur_size " << cur_size << " <=0" << llendl; + LL_WARNS("Texture") << mID << " SEND_HTTP_REQ abort: cur_size " << cur_size << " <=0" << llendl; return true; // abort. } } @@ -1552,7 +1553,7 @@ bool LLTextureFetchWorker::doWork(S32 param) resetFormattedData(); setState(DONE); releaseHttpSemaphore(); - LL_DEBUGS("Texture") << mID << " abort: fail harder" << llendl; + LL_WARNS("Texture") << mID << " abort: fail harder" << llendl; return true; // failed } @@ -1576,7 +1577,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // abort. setState(DONE); - LL_DEBUGS("Texture") << mID << " abort: no data received" << llendl; + LL_WARNS("Texture") << mID << " abort: no data received" << llendl; releaseHttpSemaphore(); return true; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index baf01e5565..236b95253c 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1819,7 +1819,10 @@ bool LLViewerFetchedTexture::updateFetch() // We finished but received no data if (current_discard < 0) { - llwarns << "!mIsFetching, setting as missing" << llendl; + llwarns << "!mIsFetching, setting as missing, decode_priority " << decode_priority + << " mRawDiscardLevel " << mRawDiscardLevel + << " current_discard " << current_discard + << llendl; setIsMissingAsset(); desired_discard = -1; } @@ -1952,7 +1955,9 @@ bool LLViewerFetchedTexture::updateFetch() } else if (mHasFetcher && !mIsFetching) { - // Only delete requests that haven't received any network data for a while + // Only delete requests that haven't received any network data + // for a while. Note - this is the normal mechanism for + // deleting requests, not just a place to handle timeouts. const F32 FETCH_IDLE_TIME = 5.f; if (mLastPacketTimer.getElapsedTimeF32() > FETCH_IDLE_TIME) { -- cgit v1.2.3 From ea9a71972dde8f61af06e92c3ed25e5ed5a27000 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Mar 2013 17:00:48 -0400 Subject: Fix for build error --- indra/newview/lltexturefetch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index ceec0e27f1..3502a641cf 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -3191,7 +3191,7 @@ bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size) void LLTextureFetchWorker::setState(e_state new_state) { - static char* e_state_name[] = + static const char* e_state_name[] = { "INVALID", "INIT", -- cgit v1.2.3 From d41e1cf171144a4903f60272dd09076aa5afa43c Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 18 Mar 2013 18:10:40 -0400 Subject: Fix for sh-4014. This was a regression caused by fix for sh-3650. --- indra/newview/llvoavatarself.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index ea39d44c73..d60ce6799b 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2989,7 +2989,12 @@ void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) { gAgentCamera.changeCameraToDefault(); gAgentCamera.resetView(); - } + } + + if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()) + { + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); + } } } -- cgit v1.2.3 From 6fe98861335781973baf032bede81d4f2a55e965 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Mar 2013 18:44:21 -0400 Subject: SH-3980 FIX - fixed most cases of server-bake blurring by disabling caching of server bakes. A better solution is desirable, may not be for initial release --- indra/newview/lltexturefetch.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 3502a641cf..38857abd47 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1178,7 +1178,9 @@ bool LLTextureFetchWorker::doWork(S32 param) offset, size, responder); mCacheReadTimer.reset(); } - else if ((mUrl.empty()||mFTType==FTT_SERVER_BAKE) && mFetcher->canLoadFromCache()) +/* SH-3980 - disabling caching of server bakes until we can fix the blurring problems */ +/* else if ((mUrl.empty()||mFTType==FTT_SERVER_BAKE) && mFetcher->canLoadFromCache()) */ + else if (mUrl.empty() && mFetcher->canLoadFromCache()) { setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it @@ -1294,10 +1296,12 @@ bool LLTextureFetchWorker::doWork(S32 param) mCanUseHTTP = false; } } +#if 0 /* SH-3980 - disabling caching of server bakes until we can fix the blurring problems */ if (mFTType == FTT_SERVER_BAKE) { mWriteToCacheState = CAN_WRITE; } +#endif if (mCanUseHTTP && !mUrl.empty()) { setState(WAIT_HTTP_RESOURCE); -- cgit v1.2.3 From c7a7347a429653f2684752e887381cbc3a95e3a3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 19 Mar 2013 09:34:58 -0400 Subject: still more build failure fixing --- indra/newview/lltexturefetch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 38857abd47..1ee3dd5b1f 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -3213,7 +3213,7 @@ void LLTextureFetchWorker::setState(e_state new_state) "WAIT_ON_WRITE", "DONE" }; - //llinfos << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; + LL_DEBUGS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; mState = new_state; } -- cgit v1.2.3 From 5c19f15dcaab304b555bf659f2d309d0d2afbc89 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Mar 2013 11:43:34 -0400 Subject: Removed avatar stuff from asset metrics, again. Must have gotten broken in a merge at some point. --- indra/newview/llappviewer.cpp | 1 - indra/newview/llviewerassetstats.cpp | 39 +------------------ indra/newview/llviewerassetstats.h | 6 --- indra/newview/tests/llviewerassetstats_test.cpp | 51 ++++++++----------------- 4 files changed, 16 insertions(+), 81 deletions(-) mode change 100644 => 100755 indra/newview/llviewerassetstats.cpp mode change 100644 => 100755 indra/newview/llviewerassetstats.h mode change 100644 => 100755 indra/newview/tests/llviewerassetstats_test.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index dac268ec92..3adf956ae3 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4392,7 +4392,6 @@ void LLAppViewer::idle() // The 5-second interval is nice for this purpose. If the object debug // bit moves or is disabled, please give this a suitable home. LLViewerAssetStatsFF::record_fps_main(gFPSClamped); - LLViewerAssetStatsFF::record_avatar_stats(); } } diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp old mode 100644 new mode 100755 index 4c59fd0371..aaa81c57d4 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -160,9 +160,7 @@ LLViewerAssetStats::LLViewerAssetStats() LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src) : mRegionHandle(src.mRegionHandle), - mResetTimestamp(src.mResetTimestamp), - mPhaseStats(src.mPhaseStats), - mAvatarRezStates(src.mAvatarRezStates) + mResetTimestamp(src.mResetTimestamp) { const PerRegionContainer::const_iterator it_end(src.mRegionStats.end()); for (PerRegionContainer::const_iterator it(src.mRegionStats.begin()); it_end != it; ++it) @@ -258,17 +256,6 @@ LLViewerAssetStats::recordFPS(F32 fps) mCurRegionStats->mFPS.record(fps); } -void -LLViewerAssetStats::recordAvatarStats() -{ - std::vector rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); - mAvatarRezStates = rez_counts; - mPhaseStats.clear(); - mPhaseStats["cloud"] = LLViewerStats::PhaseMap::getPhaseStats("cloud"); - mPhaseStats["cloud-or-gray"] = LLViewerStats::PhaseMap::getPhaseStats("cloud-or-gray"); -} - LLSD LLViewerAssetStats::asLLSD(bool compact_output) { @@ -299,11 +286,6 @@ LLViewerAssetStats::asLLSD(bool compact_output) static const LLSD::String max_tag("max"); static const LLSD::String mean_tag("mean"); - // Avatar sub-tags - static const LLSD::String avatar_tag("avatar"); - static const LLSD::String avatar_nearby_tag("nearby"); - static const LLSD::String avatar_phase_stats_tag("phase_stats"); - const duration_t now = LLViewerAssetStatsFF::get_timestamp(); mCurRegionStats->accumulateTime(now); @@ -362,16 +344,6 @@ LLViewerAssetStats::asLLSD(bool compact_output) LLSD ret = LLSD::emptyMap(); ret["regions"] = regions; ret["duration"] = LLSD::Real((now - mResetTimestamp) * 1.0e-6); - LLSD avatar_info; - avatar_info[avatar_nearby_tag] = LLSD::emptyArray(); - for (S32 rez_stat=0; rez_stat < mAvatarRezStates.size(); ++rez_stat) - { - std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); - avatar_info[avatar_nearby_tag][rez_status_name] = mAvatarRezStates[rez_stat]; - } - avatar_info[avatar_phase_stats_tag]["cloud"] = mPhaseStats["cloud"].getData(); - avatar_info[avatar_phase_stats_tag]["cloud-or-gray"] = mPhaseStats["cloud-or-gray"].getData(); - ret[avatar_tag] = avatar_info; return ret; } @@ -470,15 +442,6 @@ record_fps_main(F32 fps) gViewerAssetStatsMain->recordFPS(fps); } -void -record_avatar_stats() -{ - if (! gViewerAssetStatsMain) - return; - - gViewerAssetStatsMain->recordAvatarStats(); -} - // 'thread1' - should be for TextureFetch thread void diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h old mode 100644 new mode 100755 index 8319752230..e4581d2120 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -256,10 +256,6 @@ protected: // Time of last reset duration_t mResetTimestamp; - - // Nearby avatar stats - std::vector mAvatarRezStates; - LLViewerStats::phase_stats_t mPhaseStats; }; @@ -318,8 +314,6 @@ void record_response_main(LLViewerAssetType::EType at, bool with_http, bool is_t void record_fps_main(F32 fps); -void record_avatar_stats(); - /** * Region context, event and duration loggers for Thread 1. */ diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp old mode 100644 new mode 100755 index f8923b9868..a331d9aa9e --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -37,30 +37,6 @@ #include "llregionhandle.h" #include "../llvoavatar.h" -void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) -{ - counts.resize(3); - counts[0] = 0; - counts[1] = 0; - counts[2] = 1; -} - -// static -std::string LLVOAvatar::rezStatusToString(S32 rez_status) -{ - if (rez_status==0) return "cloud"; - if (rez_status==1) return "gray"; - if (rez_status==2) return "textured"; - return "unknown"; -} - -// static -LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) -{ - static LLViewerStats::StatsAccumulator junk; - return junk; -} - static const char * all_keys[] = { "duration", @@ -123,31 +99,34 @@ is_empty_map(const LLSD & sd) { return sd.isMap() && 0 == sd.size(); } +#endif +#if 0 static bool is_single_key_map(const LLSD & sd, const std::string & key) { return sd.isMap() && 1 == sd.size() && sd.has(key); } +#endif static bool is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & key2) { return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); } -#endif +#if 0 static bool is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) { return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3); } - +#endif static bool is_no_stats_map(const LLSD & sd) { - return is_triple_key_map(sd, "duration", "regions", "avatar"); + return is_double_key_map(sd, "duration", "regions"); } static bool @@ -258,7 +237,7 @@ namespace tut // Once the region is set, we will get a response even with no data collection it->setRegion(region1_handle); sd_full = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd_full, "duration", "regions", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd_full["regions"], region1_handle)); LLSD sd = sd_full["regions"][0]; @@ -299,7 +278,7 @@ namespace tut it->setRegion(region1_handle); LLSD sd = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd[0]; @@ -324,7 +303,7 @@ namespace tut LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); LLSD sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -364,7 +343,7 @@ namespace tut LLSD sd = gViewerAssetStatsThread1->asLLSD(false); ensure("Other collector is empty", is_no_stats_map(sd)); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -414,7 +393,7 @@ namespace tut // std::cout << sd << std::endl; - ensure("Correct double-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); LLSD sd1 = get_region(sd, region1_handle); LLSD sd2 = get_region(sd, region2_handle); @@ -437,7 +416,7 @@ namespace tut // Reset leaves current region in place gViewerAssetStatsMain->reset(); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = sd["regions"][0]; @@ -486,7 +465,7 @@ namespace tut LLSD sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct double-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); LLSD sd1 = get_region(sd, region1_handle); LLSD sd2 = get_region(sd, region2_handle); @@ -509,7 +488,7 @@ namespace tut // Reset leaves current region in place gViewerAssetStatsMain->reset(); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = get_region(sd, region2_handle); ensure("Region2 is present in results", sd2.isMap()); @@ -555,7 +534,7 @@ namespace tut LLSD sd = gViewerAssetStatsThread1->asLLSD(false); ensure("Other collector is empty", is_no_stats_map(sd)); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = get_region(sd, region1_handle); ensure("Region1 is present in results", sd.isMap()); -- cgit v1.2.3 From 38970de543e7946ff1e9700e2f0f43f82e6dbb1a Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 20 Mar 2013 12:04:26 -0400 Subject: SH-3978 FIX Unsaved changes/save options not shown after adding new pants. UI was incorrectly assuming that saving a wearable meant that the outfit did not need to be saved as well. Updated panel switching to actually check whether the outfit matches the base outfit. --- indra/newview/llsidepanelappearance.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 025b20d676..d25d203feb 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -375,7 +375,7 @@ void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_cam if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. { LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - LLAppearanceMgr::getInstance()->setOutfitDirty( FALSE ); + LLAppearanceMgr::getInstance()->updateIsDirty(); } } } @@ -410,7 +410,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearab { // Save changes if closing. mEditWearable->saveChanges(); - LLAppearanceMgr::getInstance()->setOutfitDirty( FALSE ); + LLAppearanceMgr::getInstance()->updateIsDirty(); if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. { LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); -- cgit v1.2.3 From de2c88ca4334886ab48b3c3d474c6585036edb21 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Mar 2013 12:17:06 -0400 Subject: Moved LastUpdateCOF stuff to avatar, so we can track last received for non-self avs --- indra/newview/llappearancemgr.cpp | 29 +++++------------------------ indra/newview/llappearancemgr.h | 9 --------- indra/newview/llvoavatar.cpp | 20 +++++++++++++------- indra/newview/llvoavatar.h | 11 +++++++++++ indra/newview/llvoavatarself.cpp | 0 5 files changed, 29 insertions(+), 40 deletions(-) mode change 100644 => 100755 indra/newview/llappearancemgr.cpp mode change 100644 => 100755 indra/newview/llappearancemgr.h mode change 100644 => 100755 indra/newview/llvoavatar.cpp mode change 100644 => 100755 indra/newview/llvoavatar.h mode change 100644 => 100755 indra/newview/llvoavatarself.cpp (limited to 'indra/newview') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp old mode 100644 new mode 100755 index c04d6bad94..59e07cd843 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1191,21 +1191,6 @@ S32 LLAppearanceMgr::getCOFVersion() const } } -S32 LLAppearanceMgr::getLastUpdateRequestCOFVersion() const -{ - return mLastUpdateRequestCOFVersion; -} - -S32 LLAppearanceMgr::getLastAppearanceUpdateCOFVersion() const -{ - return mLastAppearanceUpdateCOFVersion; -} - -void LLAppearanceMgr::setLastAppearanceUpdateCOFVersion(S32 new_val) -{ - mLastAppearanceUpdateCOFVersion = new_val; -} - const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink() { const LLUUID& current_outfit_cat = getCOF(); @@ -3275,8 +3260,8 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond responder_ptr = new RequestAgentUpdateAppearanceResponder; } LLHTTPClient::post(url, body, responder_ptr); - llassert(cof_version >= mLastUpdateRequestCOFVersion); - mLastUpdateRequestCOFVersion = cof_version; + llassert(cof_version >= gAgentAvatarp->mLastUpdateRequestCOFVersion); + gAgentAvatarp->mLastUpdateRequestCOFVersion = cof_version; } class LLIncrementCofVersionResponder : public LLHTTPClient::Responder @@ -3296,12 +3281,10 @@ public: llinfos << "Successfully incremented agent's COF." << llendl; S32 new_version = pContent["category"]["version"].asInteger(); - LLAppearanceMgr* app_mgr = LLAppearanceMgr::getInstance(); - // cof_version should have increased - llassert(new_version > app_mgr->mLastUpdateRequestCOFVersion); + llassert(new_version > gAgentAvatarp->mLastUpdateRequestCOFVersion); - app_mgr->mLastUpdateRequestCOFVersion = new_version; + gAgentAvatarp->mLastUpdateRequestCOFVersion = new_version; } virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& content) { @@ -3553,9 +3536,7 @@ LLAppearanceMgr::LLAppearanceMgr(): mAttachmentInvLinkEnabled(false), mOutfitIsDirty(false), mOutfitLocked(false), - mIsInUpdateAppearanceFromCOF(false), - mLastUpdateRequestCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN), - mLastAppearanceUpdateCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + mIsInUpdateAppearanceFromCOF(false) { LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h old mode 100644 new mode 100755 index d49f5d6c15..46252afbde --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -97,15 +97,6 @@ public: // Debugging - get truncated LLSD summary of COF contents. LLSD dumpCOF() const; - // COF version of last viewer-initiated appearance update request. - S32 mLastUpdateRequestCOFVersion; - S32 getLastUpdateRequestCOFVersion() const; - - // COF version of last appearance message received for self av. - S32 mLastAppearanceUpdateCOFVersion; - S32 getLastAppearanceUpdateCOFVersion() const; - void setLastAppearanceUpdateCOFVersion(S32 new_val); - // Finds the folder link to the currently worn outfit const LLViewerInventoryItem *getBaseOutfitLink(); bool getBaseOutfitName(std::string &name); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp old mode 100644 new mode 100755 index bc86bfd0a1..d492524789 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -707,7 +707,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), - mUseServerBakes(FALSE) // FIXME DRANO consider using boost::optional, defaulting to unknown. + mUseServerBakes(FALSE), // FIXME DRANO consider using boost::optional, defaulting to unknown. + mLastUpdateRequestCOFVersion(-1), + mLastUpdateReceivedCOFVersion(-1) { //VTResume(); // VTune @@ -3006,11 +3008,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mUseServerBakes, central_bake_version); std::string origin_string = bakedTextureOriginInfo(); debug_line += " [" + origin_string + "]"; + S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + S32 last_request_cof_version = mLastUpdateRequestCOFVersion; + S32 last_received_cof_version = mLastUpdateReceivedCOFVersion; if (isSelf()) { - S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); - S32 last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); - S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); debug_line += llformat(" - cof: %d req: %d rcv:%d", curr_cof_version, last_request_cof_version, last_received_cof_version); if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) @@ -3018,6 +3020,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) debug_line += " FORCING ERRS"; } } + else + { + debug_line += llformat(" - cof rcv:%d", last_received_cof_version); + } addDebugText(debug_line); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) @@ -6951,7 +6957,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } S32 this_update_cof_version = contents.mCOFVersion; - S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + S32 last_update_request_cof_version = mLastUpdateRequestCOFVersion; // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) @@ -6960,8 +6966,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << " last_update_request_cof_version " << last_update_request_cof_version << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; - LLAppearanceMgr::instance().setLastAppearanceUpdateCOFVersion(this_update_cof_version); - if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; @@ -7003,6 +7007,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + mLastUpdateReceivedCOFVersion = this_update_cof_version; + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(contents.mTEContents); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h old mode 100644 new mode 100755 index 3a4cfa5800..c2adaac18e --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -962,6 +962,17 @@ protected: LLFrameTimer mRuthDebugTimer; // For tracking how long it takes for av to rez LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory. + //-------------------------------------------------------------------- + // COF monitoring + //-------------------------------------------------------------------- + +public: + // COF version of last viewer-initiated appearance update request. For non-self avs, this will remain at default. + S32 mLastUpdateRequestCOFVersion; + + // COF version of last appearance message received for this av. + S32 mLastUpdateReceivedCOFVersion; + /** Diagnostics ** ** *******************************************************************************/ diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp old mode 100644 new mode 100755 -- cgit v1.2.3 From b3fc393d1672a96b511e2c07368251504cafac18 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Mar 2013 12:21:24 -0400 Subject: SH-4001 FIX - made local texture loading universal. --- indra/newview/llvoavatarself.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index d60ce6799b..b6dc4a1ff9 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2573,7 +2573,11 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe { if (!isIndexLocalTexture(type)) return; - if (!covered_by_baked) + // Sunshine - ignoring covered_by_baked will force local textures + // to always load. Fix for SH-4001 and many related issues. Do + // not restore this without some more targetted fix for the local + // textures failing to load issue. + //if (!covered_by_baked) { if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR) { -- cgit v1.2.3 From 1a75ba1f7474f55b9c2c27a44ff8ea8137a8cc86 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Mar 2013 12:24:31 -0400 Subject: Disabled QAModeMetrics by default, prior to general release --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/app_settings/settings.xml (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml old mode 100644 new mode 100755 index e3215aae70..f66d8fca5b --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7478,7 +7478,7 @@ Type Boolean Value - 1 + 0 QuietSnapshotsToDisk -- cgit v1.2.3 From 144194b833fce60d4ed003267e132abaef54a5cd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Mar 2013 13:48:27 -0400 Subject: SH-3850 WIP - added some additional debugging output to try to catch gray textures --- indra/newview/lltexturefetch.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 1ee3dd5b1f..d39fcd81ab 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1235,6 +1235,11 @@ bool LLTextureFetchWorker::doWork(S32 param) // we have enough data, decode it llassert_always(mFormattedImage->getDataSize() > 0); mLoadedDiscard = mDesiredDiscard; + if (mLoadedDiscard <= 0) + { + LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard + << ", should be >=0" << llendl; + } setState(DECODE_IMAGE); mInCache = TRUE; mWriteToCacheState = NOT_WRITE ; @@ -1358,6 +1363,11 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; // failed } setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); + if (mLoadedDiscard <= 0) + { + LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard + << ", should be >=0" << llendl; + } setState(DECODE_IMAGE); mWriteToCacheState = SHOULD_WRITE; recordTextureDone(false); @@ -1423,6 +1433,11 @@ bool LLTextureFetchWorker::doWork(S32 param) // We already have all the data, just decode it mLoadedDiscard = mFormattedImage->getDiscardLevel(); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); + if (mLoadedDiscard <= 0) + { + LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard + << ", should be >=0" << llendl; + } setState(DECODE_IMAGE); releaseHttpSemaphore(); return false; @@ -1548,6 +1563,11 @@ bool LLTextureFetchWorker::doWork(S32 param) // Use available data mLoadedDiscard = mFormattedImage->getDiscardLevel(); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); + if (mLoadedDiscard <= 0) + { + LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard + << ", should be >=0" << llendl; + } setState(DECODE_IMAGE); releaseHttpSemaphore(); return false; @@ -1647,6 +1667,11 @@ bool LLTextureFetchWorker::doWork(S32 param) mHttpReplyOffset = 0; mLoadedDiscard = mRequestedDiscard; + if (mLoadedDiscard <= 0) + { + LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard + << ", should be >=0" << llendl; + } setState(DECODE_IMAGE); if (mWriteToCacheState != NOT_WRITE) { -- cgit v1.2.3 From 41100ac9d36b4f4194f9409342700b410b94f1d5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Mar 2013 13:55:39 -0400 Subject: SH-3850 WIP - fixed some warnings --- indra/newview/lltexturefetch.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index d39fcd81ab..be5fde9e2b 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1235,7 +1235,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // we have enough data, decode it llassert_always(mFormattedImage->getDataSize() > 0); mLoadedDiscard = mDesiredDiscard; - if (mLoadedDiscard <= 0) + if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard << ", should be >=0" << llendl; @@ -1363,7 +1363,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; // failed } setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - if (mLoadedDiscard <= 0) + if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard << ", should be >=0" << llendl; @@ -1433,7 +1433,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // We already have all the data, just decode it mLoadedDiscard = mFormattedImage->getDiscardLevel(); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - if (mLoadedDiscard <= 0) + if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard << ", should be >=0" << llendl; @@ -1563,7 +1563,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // Use available data mLoadedDiscard = mFormattedImage->getDiscardLevel(); setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); - if (mLoadedDiscard <= 0) + if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard << ", should be >=0" << llendl; @@ -1667,7 +1667,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mHttpReplyOffset = 0; mLoadedDiscard = mRequestedDiscard; - if (mLoadedDiscard <= 0) + if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard << ", should be >=0" << llendl; -- cgit v1.2.3 From ec525704e97c697be3714b150ca3cbd461930cf7 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Mon, 25 Mar 2013 18:29:01 -0400 Subject: SH-4034 FIX Outfit changes broadcast without exiting appearance edit mode Backing out MAINT-1099 fix. Added line causes us to temporarily exit and re-enter outfit editing mode every time we edit a wearable, which has a host of unintended consequences. Reviewed the original bug, and their fix should not have any impact on the original bug. Repro of the original bug does not repro, with or without the patch. The patch causes regressions but not fixes so removing it. Will send MAINT-1099 back to QA for verification - there is an alternate solution if this causes a regression. --- indra/newview/llsidepanelappearance.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index d25d203feb..74fa5a87bb 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -453,7 +453,6 @@ void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *dat LLSidepanelAppearance *panel = dynamic_cast(data); if (panel) { - panel->showOutfitsInventoryPanel(); panel->showWearableEditPanel(wearable, disable_camera_switch); } } -- cgit v1.2.3 From 8e6d2f8ddc3fe8a1eee3abe99eb5abd3575c5841 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 28 Mar 2013 11:43:12 -0400 Subject: sh-4014: Don't send appearance updates while editing. --- indra/newview/llvoavatarself.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b6dc4a1ff9..e00802630e 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2994,11 +2994,8 @@ void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) gAgentCamera.changeCameraToDefault(); gAgentCamera.resetView(); } - - if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()) - { - LLAppearanceMgr::instance().requestServerAppearanceUpdate(); - } + + LLAppearanceMgr::instance().updateAppearanceFromCOF(); } } -- cgit v1.2.3 From 8e7c04f1d0ef6a7be800a7f3539f301aaededd14 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 29 Mar 2013 18:05:36 -0400 Subject: SUN-57 SH-4039 FIX bake fail on non-ssb regions We were getting the texture ID from the type,index couple, but were not passing in index, which defaulted to 0. texture ID is available from the texture object itself, so using that and removing the index parameter to prevent future confusion. --- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatar.h | 2 +- indra/newview/llvoavatarself.cpp | 4 ++-- indra/newview/llvoavatarself.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d492524789..ea0a30d580 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4403,7 +4403,7 @@ void LLVOAvatar::updateTextures() void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerFetchedTexture* imagep, - F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked, U32 index ) + F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked) { // No local texture stats for non-self avatars return; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c2adaac18e..f2f7ab5e29 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -537,7 +537,7 @@ protected: //-------------------------------------------------------------------- protected: virtual void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0); - virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0); + virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); // MULTI-WEARABLE: make self-only? virtual void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b6dc4a1ff9..6ed69e21fe 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2569,7 +2569,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const } void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTexture* imagep, - F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked, U32 index ) + F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked) { if (!isIndexLocalTexture(type)) return; @@ -2579,7 +2579,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe // textures failing to load issue. //if (!covered_by_baked) { - if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR) + if (imagep->getID() != IMG_DEFAULT_AVATAR) { imagep->setNoDelete(); if (imagep->getDiscardLevel() != 0) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 78728cff20..3b7b6bac64 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -219,7 +219,7 @@ protected: /*virtual*/ void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index); void localTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); void getLocalTextureByteCount(S32* gl_byte_count) const; - /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index); + /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); LLLocalTextureObject* getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 index) const; private: -- cgit v1.2.3 From 7c7ccf27d1638577290ebefcc16dded9390f5f21 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 29 Mar 2013 17:22:53 -0700 Subject: CHUI-807 : Add more defensive coding. Also trace in log the sessions created so we'll have a better idea of what people do with conversations if we see that crash again. --- indra/newview/llimview.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e237cb7f9e..56b80ef57b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2800,6 +2800,8 @@ LLUUID LLIMMgr::addSession( return LLUUID::null; } + llinfos << "LLIMMgr::addSession, name = " << name << llendl; + LLUUID session_id = computeSessionID(dialog,other_participant_id); if (floater_id.notNull()) -- cgit v1.2.3 From 2d84b0605e409664d90dbb5fee2e73c354e1218c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 29 Mar 2013 17:40:16 -0700 Subject: CHUI-807 : Trace add and remove sessions --- indra/newview/llimview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 56b80ef57b..141d43c608 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2800,8 +2800,6 @@ LLUUID LLIMMgr::addSession( return LLUUID::null; } - llinfos << "LLIMMgr::addSession, name = " << name << llendl; - LLUUID session_id = computeSessionID(dialog,other_participant_id); if (floater_id.notNull()) @@ -2846,6 +2844,8 @@ LLUUID LLIMMgr::addSession( //we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions if (!new_session) return session_id; + llinfos << "LLIMMgr::addSession, new session added, name = " << name << ", session id = " << session_id << llendl; + //Per Plan's suggestion commented "explicit offline status warning" out to make Dessie happier (see EXT-3609) //*TODO After February 2010 remove this commented out line if no one will be missing that warning //noteOfflineUsers(session_id, floater, ids); @@ -2881,6 +2881,8 @@ void LLIMMgr::removeSession(const LLUUID& session_id) LLIMModel::getInstance()->clearSession(session_id); + llinfos << "LLIMMgr::removeSession, session removed, session id = " << session_id << llendl; + notifyObserverSessionRemoved(session_id); } -- cgit v1.2.3 From 255159c50f02d37fc40d45107002f5bfe27753ea Mon Sep 17 00:00:00 2001 From: mberezhnoy Date: Mon, 1 Apr 2013 08:53:44 +0300 Subject: CHUI-886 (Time in front of the name is not displayed when the Conversations size is reduced to a minimum.) --- indra/newview/llchathistory.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 53926c1fef..0f138873ac 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -408,16 +408,7 @@ public: S32 user_name_width = user_name_rect.getWidth(); S32 time_box_width = time_box->getRect().getWidth(); - if (time_box->getVisible() && user_name_width <= mMinUserNameWidth) - { - time_box->setVisible(FALSE); - - user_name_rect.mRight += time_box_width; - user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight()); - user_name->setRect(user_name_rect); - } - - if (!time_box->getVisible() && user_name_width > mMinUserNameWidth + time_box_width) + if (!time_box->getVisible() && user_name_width > mMinUserNameWidth) { user_name_rect.mRight -= time_box_width; user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight()); -- cgit v1.2.3 From 56939a2a2b9510bd7f5fc43bed460c0d23a743a0 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Mon, 1 Apr 2013 20:09:37 +0300 Subject: CHUI-904 FIXED Set the focus on the Nearby chat floater after setting visibility. --- indra/newview/llfloaterimnearbychat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index d86e1b3fd7..56b0c15cb9 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -264,7 +264,7 @@ void LLFloaterIMNearbyChat::setVisibleAndFrontmost(BOOL take_focus, const LLSD& if(!isTornOff() && matchesKey(key)) { - LLFloaterIMContainer::getInstance()->selectConversationPair(mSessionID, true, false); + LLFloaterIMContainer::getInstance()->selectConversationPair(mSessionID, true, take_focus); } } -- cgit v1.2.3 From cb4ec925823fdfe09504c78a7d7a96228a4b6219 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 1 Apr 2013 13:04:24 -0700 Subject: CHUI-907 : Prevent warning when parsing menus adding name to menu_item_check --- indra/newview/skins/default/xui/en/menu_login.xml | 15 ++++++++++----- indra/newview/skins/default/xui/en/menu_viewer.xml | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index 101e104eab..52c4fb1613 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -180,7 +180,8 @@ name="Set Logging Level" tear_off="true"> + name="Debug" + label="Debug"> @@ -189,7 +190,8 @@ parameter="0" /> + name="Info" + label="Info"> @@ -198,7 +200,8 @@ parameter="1" /> + name="Warning" + label="Warning"> @@ -207,7 +210,8 @@ parameter="2" /> + name="Error" + label="Error"> @@ -216,7 +220,8 @@ parameter="3" /> + name="None" + label="None"> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 544f06ac0c..67d8e3eaa4 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -131,6 +131,7 @@ name="Status" tear_off="true"> @@ -138,6 +139,7 @@ function="World.SetAway" /> @@ -257,6 +259,7 @@ parameter="speak" /> -- cgit v1.2.3 From c588f6be31a203f05fbd784b0270555c6e1d04d6 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 1 Apr 2013 13:39:14 -0700 Subject: CHUI-907 : Fixed! Suppress inexistant menu item and duplicated registrar entry to avoid warning --- indra/newview/llviewermenu.cpp | 2 -- indra/newview/skins/default/xui/en/menu_viewer.xml | 7 ------- 2 files changed, 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 66db0ac8f3..ab1788d1cb 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8283,8 +8283,6 @@ void initialize_menus() view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts"); - - commit.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::showAgentInventory)); enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed)); // Agent diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 67d8e3eaa4..a11cd13fdb 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3055,13 +3055,6 @@ - - - Date: Mon, 1 Apr 2013 15:36:05 -0700 Subject: CHUI-796 (User doesn't get all messages in 'do not disturb' mode): Now when a conversation is focused by clicking on it's line item, selecting a torn off floater or unminimized a torn off floater the stored notifications for that conversation will be removed. --- indra/newview/llfloaterimcontainer.cpp | 62 +++++++++++++++++++++++++-------- indra/newview/llfloaterimcontainer.h | 1 + indra/newview/llfloaterimnearbychat.cpp | 2 +- indra/newview/llfloaterimsession.cpp | 30 ++++++++++++++++ indra/newview/llfloaterimsession.h | 2 ++ 5 files changed, 82 insertions(+), 15 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 7296ec3ced..58817485fb 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -585,6 +585,28 @@ void LLFloaterIMContainer::returnFloaterToHost() floater->onTearOffClicked(); } +void LLFloaterIMContainer::setMinimized(BOOL b) +{ + bool was_minimized = isMinimized(); + LLMultiFloater::setMinimized(b); + + //Switching from minimized to un-minimized + if(was_minimized && !b) + { + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(mSelectedSession); + + if(session_floater && !session_floater->isTornOff()) + { + //When in DND mode, remove stored IM notifications + //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal + if(gAgent.isDoNotDisturb() && mSelectedSession.notNull()) + { + LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSelectedSession); + } + } + } +} + void LLFloaterIMContainer::setVisible(BOOL visible) { LLFloaterIMNearbyChat* nearby_chat; if (visible) @@ -597,10 +619,21 @@ void LLFloaterIMContainer::setVisible(BOOL visible) // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("nearby_chat"); LLFloaterReg::toggleInstanceOrBringToFront(name); - setSelectedSession(LLUUID(NULL)); + selectConversationPair(LLUUID(NULL), false, false); } openNearbyChat(); - selectConversationPair(getSelectedSession(), false, false); + flashConversationItemWidget(mSelectedSession,false); + + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(mSelectedSession); + if(session_floater && !session_floater->isMinimized()) + { + //When in DND mode, remove stored IM notifications + //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal + if(gAgent.isDoNotDisturb() && mSelectedSession.notNull()) + { + LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSelectedSession); + } + } } nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); @@ -1389,13 +1422,6 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool widget->getParentFolder()->setSelection(widget, FALSE, FALSE); mConversationsRoot->scrollToShowSelection(); } - - //When in DND mode, remove stored IM notifications - //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal - if(gAgent.isDoNotDisturb() && session_id.notNull()) - { - LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, session_id); - } } /* floater processing */ @@ -1420,14 +1446,19 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool { showStub(true); } + + //When in DND mode, remove stored IM notifications + //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal + if(gAgent.isDoNotDisturb() && session_id.notNull()) + { + LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, session_id); + } } // Set the focus on the selected floater - if (!session_floater->hasFocus()) + if (!session_floater->hasFocus() && !session_floater->isMinimized()) { - BOOL is_minimized = session_floater->isMinimized(); session_floater->setFocus(focus_floater); - session_floater->setMinimized(is_minimized); } } flashConversationItemWidget(session_id,false); @@ -1986,8 +2017,11 @@ void LLFloaterIMContainer::closeFloater(bool app_quitting/* = false*/) { // Always unminimize before trying to close. // Most of the time the user will never see this state. - setMinimized(FALSE); - + if(isMinimized()) + { + LLMultiFloater::setMinimized(FALSE); + } + LLFloater::closeFloater(app_quitting); } diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 52b672241f..e39d20ec35 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -59,6 +59,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void draw(); + /*virtual*/ void setMinimized(BOOL b); /*virtual*/ void setVisible(BOOL visible); /*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); /*virtual*/ void updateResizeLimits(); diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 56b0c15cb9..49f36a2f32 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -328,7 +328,7 @@ void LLFloaterIMNearbyChat::onChatFontChange(LLFontGL* fontp) void LLFloaterIMNearbyChat::show() { openFloater(getKey()); - } +} bool LLFloaterIMNearbyChat::isChatVisible() const { diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 6d5145f205..edc25a7d7e 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -39,6 +39,7 @@ #include "llchannelmanager.h" #include "llchiclet.h" #include "llchicletbar.h" +#include "lldonotdisturbnotificationstorage.h" #include "llfloaterreg.h" #include "llfloateravatarpicker.h" #include "llfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container @@ -645,6 +646,23 @@ void LLFloaterIMSession::setDocked(bool docked, bool pop_on_undock) } } +void LLFloaterIMSession::setMinimized(BOOL b) +{ + bool wasMinimized = isMinimized(); + LLFloaterIMSessionTab::setMinimized(b); + + //Switching from minimized state to un-minimized state + if(wasMinimized && !b) + { + //When in DND mode, remove stored IM notifications + //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal + if(gAgent.isDoNotDisturb()) + { + LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSessionID); + } + } +} + void LLFloaterIMSession::setVisible(BOOL visible) { LLNotificationsUI::LLScreenChannel* channel = static_cast @@ -713,6 +731,18 @@ BOOL LLFloaterIMSession::getVisible() return visible; } +void LLFloaterIMSession::setFocus(BOOL focus) +{ + LLFloaterIMSessionTab::setFocus(focus); + + //When in DND mode, remove stored IM notifications + //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal + if(focus && gAgent.isDoNotDisturb()) + { + LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSessionID); + } +} + //static bool LLFloaterIMSession::toggle(const LLUUID& session_id) { diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index cb330bca0f..a0e0171b34 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -65,8 +65,10 @@ public: // LLView overrides /*virtual*/ BOOL postBuild(); + /*virtual*/ void setMinimized(BOOL b); /*virtual*/ void setVisible(BOOL visible); /*virtual*/ BOOL getVisible(); + /*virtual*/ void setFocus(BOOL focus); // Check typing timeout timer. /*virtual*/ void draw(); -- cgit v1.2.3 From 09db2bd9ffb0c559f848bcda7c3b6a975f5c8070 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 1 Apr 2013 19:40:40 +0300 Subject: CHUI-896 : ADD FIX : Line flashing and FUI button flashing not working correctly for CHUI notifications backed out 902caf2 and (partly) d498514; case "NOT_ON_TOP" was fixed --- indra/newview/llimview.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 141d43c608..afac94af07 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -182,18 +182,19 @@ void on_new_message(const LLSD& msg) { conversations_floater_status = CLOSED; } - else if (!session_floater || !LLFloater::isVisible(session_floater) - || session_floater->isMinimized() || !session_floater->hasFocus()) + else if (!im_box->hasFocus() && + !(session_floater && LLFloater::isVisible(session_floater) + && !session_floater->isMinimized() && session_floater->hasFocus())) { conversations_floater_status = NOT_ON_TOP; } - else if ((session_floater->hasFocus()) && (im_box->getSelectedSession() == session_id)) + else if (im_box->getSelectedSession() != session_id) { - conversations_floater_status = ON_TOP_AND_ITEM_IS_SELECTED; + conversations_floater_status = ON_TOP; } else { - conversations_floater_status = ON_TOP; + conversations_floater_status = ON_TOP_AND_ITEM_IS_SELECTED; } // determine user prefs for this session @@ -226,7 +227,7 @@ void on_new_message(const LLSD& msg) // 0. nothing - exit if (("none" == user_preferences || ON_TOP_AND_ITEM_IS_SELECTED == conversations_floater_status) - && session_floater->isMessagePaneExpanded()) + && session_floater->isMessagePaneExpanded()) { return; } -- cgit v1.2.3 From 3f1ad7dbd017b43876ac5f9356ed6913157ddbaa Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 2 Apr 2013 18:56:52 +0300 Subject: CHUI-811 FIXED [CHUIBUG]Too much spacing around the new chat UI elements --- .../skins/default/xui/en/floater_im_session.xml | 62 ++++++++++++++-------- 1 file changed, 40 insertions(+), 22 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 3b56e974d2..2152a9f6e9 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -70,23 +70,26 @@ top="0" left="0" right="-1" - bottom="-1"> + bottom="-3"> + tab_group="1"> + height="35" + right="-1" + left="1"> @@ -196,7 +199,8 @@ + top="1" + bottom="-1"> + auto_resize="false" + bottom="-1" /> + min_width="221" + bottom="-1"> + bottom="-2" + left="0" + right="-1"> + name="input_editor_layout_panel" + auto_resize="true" + user_resize="false" + top="0" + bottom="-1"> + width="30" + top="0" + bottom="-1">