diff options
Diffstat (limited to 'indra')
386 files changed, 11791 insertions, 10459 deletions
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 27a52cdd99..e5b8edf9c3 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -235,7 +235,7 @@ public: // Child process handling (Unix only for now) // // Set a callback to be run on exit of a child process - // WARNING! This callback is run from the signal handler due to the extreme crappiness of + // WARNING! This callback is run from the signal handler due to // Linux threading requiring waitpid() to be called from the thread that spawned the process. // At some point I will make this more behaved, but I'm not going to fix this right now - djs void setChildCallback(pid_t pid, LLAppChildCallback callback); diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 6d5b12d840..1c664e093b 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -45,12 +45,16 @@ struct AssetEntry : public LLDictionaryEntry AssetEntry(const char *desc_name, const char *type_name, // 8 character limit! const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one - bool can_link) // can you create a link to this type? + bool can_link, // can you create a link to this type? + bool can_fetch, // can you fetch this asset by ID? + bool can_know) // can you see this asset's ID? : LLDictionaryEntry(desc_name), mTypeName(type_name), mHumanName(human_name), - mCanLink(can_link) + mCanLink(can_link), + mCanFetch(can_fetch), + mCanKnow(can_know) { llassert(strlen(mTypeName) <= 8); } @@ -58,6 +62,8 @@ struct AssetEntry : public LLDictionaryEntry const char *mTypeName; const char *mHumanName; bool mCanLink; + bool mCanFetch; + bool mCanKnow; }; class LLAssetDictionary : public LLSingleton<LLAssetDictionary>, @@ -69,32 +75,32 @@ public: LLAssetDictionary::LLAssetDictionary() { - // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK? - // |--------------------|-----------|-------------------|-----------| - addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", FALSE)); - addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", FALSE)); - addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", FALSE)); - addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", FALSE)); - addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", FALSE)); - addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", TRUE)); - addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", TRUE)); - addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", FALSE)); - addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", TRUE)); - addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", FALSE)); - addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", FALSE)); - addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", FALSE)); - addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", TRUE)); - addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", FALSE)); - addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", FALSE)); - addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", FALSE)); - addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", FALSE)); - addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", TRUE)); - addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", FALSE)); - - addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", FALSE)); - addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", FALSE)); - - addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE)); + // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK? CAN FETCH? CAN KNOW? + // |--------------------|-----------|-------------------|-----------|-----------|---------| + addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", false, false, true)); + addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", false, true, true)); + addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", false, false, false)); + addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", false, true, true)); + addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", false, false, false)); + addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", true, true, true)); + addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", true, false, false)); + addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", false, false, true)); + addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", true, false, false)); + addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", false, false, false)); + addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", false, false, false)); + addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", false, false, false)); + addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", true, true, true)); + addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", false, false, false)); + addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", false, false, false)); + addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", false, false, false)); + addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", false, true, true)); + addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", true, true, true)); + addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", false, false, false)); + + addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "sym link", false, false, true)); + addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "sym folder link", false, false, true)); + + addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, false, false, false)); }; // static @@ -225,3 +231,27 @@ const std::string &LLAssetType::badLookup() return sBadLookup; } + +// static +bool LLAssetType::lookupIsAssetFetchByIDAllowed(EType asset_type) +{ + const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); + const AssetEntry *entry = dict->lookup(asset_type); + if (entry) + { + return entry->mCanFetch; + } + return false; +} + +// static +bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type) +{ + const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); + const AssetEntry *entry = dict->lookup(asset_type); + if (entry) + { + return entry->mCanKnow; + } + return false; +} diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index c7bbc2e74a..2c2dc27aaa 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -146,6 +146,9 @@ public: static bool lookupCanLink(EType asset_type); static bool lookupIsLinkType(EType asset_type); + static bool lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download + static bool lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer + static const std::string& badLookup(); // error string when a lookup fails protected: diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 06ceeb2bc3..809a626c93 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -133,8 +133,11 @@ S32 LLQueuedThread::updateQueue(U32 max_time_ms) if (mThreaded) { pending = getPending(); + if(pending > 0) + { unpause(); } + } else { while (pending > 0) @@ -459,7 +462,7 @@ S32 LLQueuedThread::processNextRequest() req->setStatus(STATUS_QUEUED); mRequestQueue.insert(req); unlockData(); - if (mThreaded && start_priority <= PRIORITY_LOW) + if (mThreaded && start_priority < PRIORITY_NORMAL) { ms_sleep(1); // sleep the thread a little } diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 5f3d9d6582..b5a73ec1d1 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -911,6 +911,20 @@ bool LLStringUtil::simpleReplacement(std::string &replacement, std::string token return false; } +//static +template<> +void LLStringUtil::setLocale(std::string inLocale) +{ + sLocale = inLocale; +}; + +//static +template<> +std::string LLStringUtil::getLocale(void) +{ + return sLocale; +}; + // static template<> void LLStringUtil::formatNumber(std::string& numStr, std::string decimals) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 62cedcde4e..96588b29b9 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -241,8 +241,8 @@ public: LL_COMMON_API static S32 format(std::basic_string<T>& s, const LLSD& substitutions); LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const format_map_t& substitutions); LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const LLSD& substitutions); - static void setLocale (std::string inLocale) {sLocale = inLocale;}; - static std::string getLocale (void) {return sLocale;}; + LL_COMMON_API static void setLocale (std::string inLocale); + LL_COMMON_API static std::string getLocale (void); static bool isValidIndex(const std::basic_string<T>& string, size_type i) { diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index c78fb12018..3a0d66e4a5 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -133,6 +133,7 @@ public: U8 mData[UUID_BYTES]; }; +typedef std::vector<LLUUID> uuid_vec_t; // Construct inline LLUUID::LLUUID() diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h index 0f1e59a18c..e3663544db 100644 --- a/indra/llcommon/llversionserver.h +++ b/indra/llcommon/llversionserver.h @@ -36,7 +36,7 @@ const S32 LL_VERSION_MAJOR = 1; const S32 LL_VERSION_MINOR = 31; const S32 LL_VERSION_PATCH = 0; -const S32 LL_VERSION_BUILD = 200030; +const S32 LL_VERSION_BUILD = 203110; const char * const LL_CHANNEL = "Second Life Server"; diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 540aea4252..3ab4257fab 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -36,7 +36,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 0; const S32 LL_VERSION_PATCH = 0; -const S32 LL_VERSION_BUILD = 200030; +const S32 LL_VERSION_BUILD = 203110; const char * const LL_CHANNEL = "Second Life Developer"; diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index ec21ae40e7..b08cb28218 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -452,7 +452,7 @@ BOOL LLParcel::allowTerraformBy(const LLUUID &agent_id) const bool LLParcel::isAgentBlockedFromParcel(LLParcel* parcelp, const LLUUID& agent_id, - const std::vector<LLUUID>& group_ids, + const uuid_vec_t& group_ids, const BOOL is_agent_identified, const BOOL is_agent_transacted, const BOOL is_agent_ageverified) diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 2a9a596912..4ee9d9b40f 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -258,7 +258,7 @@ public: void setMediaURLResetTimer(F32 time); virtual void setLocalID(S32 local_id); - // blow away all the extra crap lurking in parcels, including urls, access lists, etc + // blow away all the extra stuff lurking in parcels, including urls, access lists, etc void clearParcel(); // This value is not persisted out to the parcel file, it is only @@ -538,7 +538,7 @@ public: static bool isAgentBlockedFromParcel(LLParcel* parcelp, const LLUUID& agent_id, - const std::vector<LLUUID>& group_ids, + const uuid_vec_t& group_ids, const BOOL is_agent_identified, const BOOL is_agent_transacted, const BOOL is_agent_ageverified); diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 0ab1081200..02523467e8 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -408,6 +408,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo { lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl; + llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl; + if (mShutDown) { return; // don't get the asset or do any callbacks, we are shutting down @@ -471,6 +473,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo // we've already got the file // theoretically, partial files w/o a pending request shouldn't happen // unless there's a weird error + llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl; + if (callback) { callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); @@ -528,6 +532,8 @@ void LLAssetStorage::downloadCompleteCallback( LLAssetType::EType file_type, void* user_data, LLExtStat ext_status) { + llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl; + lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id << "," << LLAssetType::lookup(file_type) << llendl; LLAssetRequest* req = (LLAssetRequest*)user_data; diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 8f36d516d7..43f7c07e94 100644 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -60,7 +60,7 @@ void LLTransferSourceAsset::initTransfer() // to the simulator. This is subset of assets we allow to be // simply pulled straight from the asset system. LLUUID* tidp; - if(is_asset_fetch_by_id_allowed(mParams.getAssetType())) + if(LLAssetType::lookupIsAssetFetchByIDAllowed(mParams.getAssetType())) { tidp = new LLUUID(getID()); gAssetStorage->getAssetData( @@ -131,7 +131,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, *data_handle = tmpp; if (!vf.read(tmpp, max_bytes)) /* Flawfinder: Ignore */ { - // Crap, read failure, need to deal with it. + // Read failure, need to deal with it. delete[] tmpp; *data_handle = NULL; returned_bytes = 0; @@ -257,50 +257,3 @@ BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) return TRUE; } - -/** - * Helper functions - */ -bool is_asset_fetch_by_id_allowed(LLAssetType::EType type) -{ - // *FIX: Make this list smaller. - bool rv = false; - switch(type) - { - case LLAssetType::AT_SOUND: - case LLAssetType::AT_LANDMARK: - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_GESTURE: - rv = true; - break; - default: - break; - } - return rv; -} - -bool is_asset_id_knowable(LLAssetType::EType type) -{ - // *FIX: Make this list smaller. - bool rv = false; - switch(type) - { - case LLAssetType::AT_TEXTURE: - case LLAssetType::AT_SOUND: - case LLAssetType::AT_LANDMARK: - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_NOTECARD: - case LLAssetType::AT_BODYPART: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_GESTURE: - case LLAssetType::AT_LINK: - case LLAssetType::AT_LINK_FOLDER: - rv = true; - break; - default: - break; - } - return rv; -} diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h index 70b09b6aaf..8616595654 100644 --- a/indra/llmessage/lltransfersourceasset.h +++ b/indra/llmessage/lltransfersourceasset.h @@ -84,24 +84,4 @@ protected: S32 mCurPos; }; -/** - * @brief Quick check to see if the asset allows direct download. - * - * This might not be the right place for this function call, but it - * originally started life inside the LLTransferSourceAsset code. - * @param type The type of asset. - * @return Returns true if the asset can be fetched by id. - */ -bool is_asset_fetch_by_id_allowed(LLAssetType::EType type); - -/** - * @brief Quick check to see if all asset data can be known by the viewer. - * - * This might not be the right place for this function call, but it - * originally started life inside the LLTransferSourceAsset code. - * @param type The type of asset. - * @return Returns true if the asset id can be transmitted to the viewer. - */ -bool is_asset_id_knowable(LLAssetType::EType type); - #endif // LL_LLTRANSFERSOURCEASSET_H diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt index 6706775d4f..441becbae0 100644 --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -3,6 +3,7 @@ project(llplugin) include(00-Common) +include(CURL) include(LLCommon) include(LLImage) include(LLMath) @@ -23,6 +24,7 @@ include_directories( set(llplugin_SOURCE_FILES llpluginclassmedia.cpp + llplugincookiestore.cpp llplugininstance.cpp llpluginmessage.cpp llpluginmessagepipe.cpp @@ -36,6 +38,7 @@ set(llplugin_HEADER_FILES llpluginclassmedia.h llpluginclassmediaowner.h + llplugincookiestore.h llplugininstance.h llpluginmessage.h llpluginmessageclasses.h @@ -53,3 +56,19 @@ list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES}) add_library (llplugin ${llplugin_SOURCE_FILES}) add_subdirectory(slplugin) + +# Add tests +include(LLAddBuildTest) +# UNIT TESTS +SET(llplugin_TEST_SOURCE_FILES + llplugincookiestore.cpp + ) + +# llplugincookiestore has a dependency on curl, so we need to link the curl library into the test. +set_source_files_properties( + llplugincookiestore.cpp + PROPERTIES + LL_TEST_ADDITIONAL_LIBRARIES "${CURL_LIBRARIES}" + ) + +LL_ADD_PROJECT_UNIT_TESTS(llplugin "${llplugin_TEST_SOURCE_FILES}") diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index bf0e19473e..e09b511a6e 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -993,6 +993,13 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mClickTargetType = TARGET_NONE; mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW); } + else if(message_name == "cookie_set") + { + if(mOwner) + { + mOwner->handleCookieSet(this, message.getValue("cookie")); + } + } else { LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL; @@ -1076,6 +1083,13 @@ void LLPluginClassMedia::clear_cookies() sendMessage(message); } +void LLPluginClassMedia::set_cookies(const std::string &cookies) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_cookies"); + message.setValue("cookies", cookies); + sendMessage(message); +} + void LLPluginClassMedia::enable_cookies(bool enable) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "enable_cookies"); diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 79356beb68..8c7b00f45b 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -189,6 +189,7 @@ public: void focus(bool focused); void clear_cache(); void clear_cookies(); + void set_cookies(const std::string &cookies); void enable_cookies(bool enable); void proxy_setup(bool enable, const std::string &host = LLStringUtil::null, int port = 0); void browse_stop(); diff --git a/indra/llplugin/llpluginclassmediaowner.h b/indra/llplugin/llpluginclassmediaowner.h index 6d369cd51a..5669b81fd1 100644 --- a/indra/llplugin/llpluginclassmediaowner.h +++ b/indra/llplugin/llpluginclassmediaowner.h @@ -39,6 +39,7 @@ #include <queue> class LLPluginClassMedia; +class LLPluginCookieStore; class LLPluginClassMediaOwner { @@ -78,6 +79,7 @@ public: virtual ~LLPluginClassMediaOwner() {}; virtual void handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent /*event*/) {}; + virtual void handleCookieSet(LLPluginClassMedia* /*self*/, const std::string &/*cookie*/) {}; }; #endif // LL_LLPLUGINCLASSMEDIAOWNER_H diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp new file mode 100644 index 0000000000..85b1e70d78 --- /dev/null +++ b/indra/llplugin/llplugincookiestore.cpp @@ -0,0 +1,659 @@ +/** + * @file llplugincookiestore.cpp + * @brief LLPluginCookieStore provides central storage for http cookies used by plugins + * + * @cond + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + * @endcond + */ + +#include "linden_common.h" +#include "indra_constants.h" + +#include "llplugincookiestore.h" +#include <iostream> + +// for curl_getdate() (apparently parsing RFC 1123 dates is hard) +#include <curl/curl.h> + +LLPluginCookieStore::LLPluginCookieStore(): + mHasChangedCookies(false) +{ +} + + +LLPluginCookieStore::~LLPluginCookieStore() +{ + clearCookies(); +} + + +LLPluginCookieStore::Cookie::Cookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end): + mCookie(s, cookie_start, cookie_end - cookie_start), + mNameStart(0), mNameEnd(0), + mValueStart(0), mValueEnd(0), + mDomainStart(0), mDomainEnd(0), + mPathStart(0), mPathEnd(0), + mDead(false), mChanged(true) +{ +} + +LLPluginCookieStore::Cookie *LLPluginCookieStore::Cookie::createFromString(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, const std::string &host) +{ + Cookie *result = new Cookie(s, cookie_start, cookie_end); + + if(!result->parse(host)) + { + delete result; + result = NULL; + } + + return result; +} + +std::string LLPluginCookieStore::Cookie::getKey() const +{ + std::string result; + if(mDomainEnd > mDomainStart) + { + result += mCookie.substr(mDomainStart, mDomainEnd - mDomainStart); + } + result += ';'; + if(mPathEnd > mPathStart) + { + result += mCookie.substr(mPathStart, mPathEnd - mPathStart); + } + result += ';'; + result += mCookie.substr(mNameStart, mNameEnd - mNameStart); + return result; +} + +bool LLPluginCookieStore::Cookie::parse(const std::string &host) +{ + bool first_field = true; + + std::string::size_type cookie_end = mCookie.size(); + std::string::size_type field_start = 0; + + lldebugs << "parsing cookie: " << mCookie << llendl; + while(field_start < cookie_end) + { + // Finding the start of the next field requires honoring special quoting rules + // see the definition of 'quoted-string' in rfc2616 for details + std::string::size_type next_field_start = findFieldEnd(field_start); + + // The end of this field should not include the terminating ';' or any trailing whitespace + std::string::size_type field_end = mCookie.find_last_not_of("; ", next_field_start); + if(field_end == std::string::npos || field_end < field_start) + { + // This field was empty or all whitespace. Set end = start so it shows as empty. + field_end = field_start; + } + else if (field_end < next_field_start) + { + // we actually want the index of the char _after_ what 'last not of' found + ++field_end; + } + + // find the start of the actual name (skip separator and possible whitespace) + std::string::size_type name_start = mCookie.find_first_not_of("; ", field_start); + if(name_start == std::string::npos || name_start > next_field_start) + { + // Again, nothing but whitespace. + name_start = field_start; + } + + // the name and value are separated by the first equals sign + std::string::size_type name_value_sep = mCookie.find_first_of("=", name_start); + if(name_value_sep == std::string::npos || name_value_sep > field_end) + { + // No separator found, so this is a field without an = + name_value_sep = field_end; + } + + // the name end is before the name-value separator + std::string::size_type name_end = mCookie.find_last_not_of("= ", name_value_sep); + if(name_end == std::string::npos || name_end < name_start) + { + // I'm not sure how we'd hit this case... it seems like it would have to be an empty name. + name_end = name_start; + } + else if (name_end < name_value_sep) + { + // we actually want the index of the char _after_ what 'last not of' found + ++name_end; + } + + // Value is between the name-value sep and the end of the field. + std::string::size_type value_start = mCookie.find_first_not_of("= ", name_value_sep); + if(value_start == std::string::npos || value_start > field_end) + { + // All whitespace or empty value + value_start = field_end; + } + std::string::size_type value_end = mCookie.find_last_not_of("; ", field_end); + if(value_end == std::string::npos || value_end < value_start) + { + // All whitespace or empty value + value_end = value_start; + } + else if (value_end < field_end) + { + // we actually want the index of the char _after_ what 'last not of' found + ++value_end; + } + + lldebugs + << " field name: \"" << mCookie.substr(name_start, name_end - name_start) + << "\", value: \"" << mCookie.substr(value_start, value_end - value_start) << "\"" + << llendl; + + // See whether this field is one we know + if(first_field) + { + // The first field is the name=value pair + mNameStart = name_start; + mNameEnd = name_end; + mValueStart = value_start; + mValueEnd = value_end; + first_field = false; + } + else + { + // Subsequent fields must come from the set in rfc2109 + if(matchName(name_start, name_end, "expires")) + { + std::string date_string(mCookie, value_start, value_end - value_start); + // If the cookie contains an "expires" field, it MUST contain a parsable date. + + // HACK: LLDate apparently can't PARSE an rfc1123-format date, even though it can GENERATE one. + // The curl function curl_getdate can do this, but I'm hesitant to unilaterally introduce a curl dependency in LLDate. +#if 1 + time_t date = curl_getdate(date_string.c_str(), NULL ); + mDate.secondsSinceEpoch((F64)date); + lldebugs << " expire date parsed to: " << mDate.asRFC1123() << llendl; +#else + // This doesn't work (rfc1123-format dates cause it to fail) + if(!mDate.fromString(date_string)) + { + // Date failed to parse. + llwarns << "failed to parse cookie's expire date: " << date << llendl; + return false; + } +#endif + } + else if(matchName(name_start, name_end, "domain")) + { + mDomainStart = value_start; + mDomainEnd = value_end; + } + else if(matchName(name_start, name_end, "path")) + { + mPathStart = value_start; + mPathEnd = value_end; + } + else if(matchName(name_start, name_end, "max-age")) + { + // TODO: how should we handle this? + } + else if(matchName(name_start, name_end, "secure")) + { + // We don't care about the value of this field (yet) + } + else if(matchName(name_start, name_end, "version")) + { + // We don't care about the value of this field (yet) + } + else if(matchName(name_start, name_end, "comment")) + { + // We don't care about the value of this field (yet) + } + else + { + // An unknown field is a parse failure + return false; + } + + } + + + // move on to the next field, skipping this field's separator and any leading whitespace + field_start = mCookie.find_first_not_of("; ", next_field_start); + } + + // The cookie MUST have a name + if(mNameEnd <= mNameStart) + return false; + + // If the cookie doesn't have a domain, add the current host as the domain. + if(mDomainEnd <= mDomainStart) + { + if(host.empty()) + { + // no domain and no current host -- this is a parse failure. + return false; + } + + // Figure out whether this cookie ended with a ";" or not... + std::string::size_type last_char = mCookie.find_last_not_of(" "); + if((last_char != std::string::npos) && (mCookie[last_char] != ';')) + { + mCookie += ";"; + } + + mCookie += " domain="; + mDomainStart = mCookie.size(); + mCookie += host; + mDomainEnd = mCookie.size(); + + lldebugs << "added domain (" << mDomainStart << " to " << mDomainEnd << "), new cookie is: " << mCookie << llendl; + } + + // If the cookie doesn't have a path, add "/". + if(mPathEnd <= mPathStart) + { + // Figure out whether this cookie ended with a ";" or not... + std::string::size_type last_char = mCookie.find_last_not_of(" "); + if((last_char != std::string::npos) && (mCookie[last_char] != ';')) + { + mCookie += ";"; + } + + mCookie += " path="; + mPathStart = mCookie.size(); + mCookie += "/"; + mPathEnd = mCookie.size(); + + lldebugs << "added path (" << mPathStart << " to " << mPathEnd << "), new cookie is: " << mCookie << llendl; + } + + + return true; +} + +std::string::size_type LLPluginCookieStore::Cookie::findFieldEnd(std::string::size_type start, std::string::size_type end) +{ + std::string::size_type result = start; + + if(end == std::string::npos) + end = mCookie.size(); + + bool in_quotes = false; + for(; (result < end); result++) + { + switch(mCookie[result]) + { + case '\\': + if(in_quotes) + result++; // The next character is backslash-quoted. Skip over it. + break; + case '"': + in_quotes = !in_quotes; + break; + case ';': + if(!in_quotes) + return result; + break; + } + } + + // If we got here, no ';' was found. + return end; +} + +bool LLPluginCookieStore::Cookie::matchName(std::string::size_type start, std::string::size_type end, const char *name) +{ + // NOTE: this assumes 'name' is already in lowercase. The code which uses it should be able to arrange this... + + while((start < end) && (*name != '\0')) + { + if(tolower(mCookie[start]) != *name) + return false; + + start++; + name++; + } + + // iff both strings hit the end at the same time, they're equal. + return ((start == end) && (*name == '\0')); +} + +std::string LLPluginCookieStore::getAllCookies() +{ + std::stringstream result; + writeAllCookies(result); + return result.str(); +} + +void LLPluginCookieStore::writeAllCookies(std::ostream& s) +{ + cookie_map_t::iterator iter; + for(iter = mCookies.begin(); iter != mCookies.end(); iter++) + { + // Don't return expired cookies + if(!iter->second->isDead()) + { + s << (iter->second->getCookie()) << "\n"; + } + } + +} + +std::string LLPluginCookieStore::getPersistentCookies() +{ + std::stringstream result; + writePersistentCookies(result); + return result.str(); +} + +void LLPluginCookieStore::writePersistentCookies(std::ostream& s) +{ + cookie_map_t::iterator iter; + for(iter = mCookies.begin(); iter != mCookies.end(); iter++) + { + // Don't return expired cookies or session cookies + if(!iter->second->isDead() && !iter->second->isSessionCookie()) + { + s << iter->second->getCookie() << "\n"; + } + } +} + +std::string LLPluginCookieStore::getChangedCookies(bool clear_changed) +{ + std::stringstream result; + writeChangedCookies(result, clear_changed); + + return result.str(); +} + +void LLPluginCookieStore::writeChangedCookies(std::ostream& s, bool clear_changed) +{ + if(mHasChangedCookies) + { + lldebugs << "returning changed cookies: " << llendl; + cookie_map_t::iterator iter; + for(iter = mCookies.begin(); iter != mCookies.end(); ) + { + cookie_map_t::iterator next = iter; + next++; + + // Only return cookies marked as "changed" + if(iter->second->isChanged()) + { + s << iter->second->getCookie() << "\n"; + + lldebugs << " " << iter->second->getCookie() << llendl; + + // If requested, clear the changed mark + if(clear_changed) + { + if(iter->second->isDead()) + { + // If this cookie was previously marked dead, it needs to be removed entirely. + delete iter->second; + mCookies.erase(iter); + } + else + { + // Not dead, just mark as not changed. + iter->second->setChanged(false); + } + } + } + + iter = next; + } + } + + if(clear_changed) + mHasChangedCookies = false; +} + +void LLPluginCookieStore::setAllCookies(const std::string &cookies, bool mark_changed) +{ + clearCookies(); + setCookies(cookies, mark_changed); +} + +void LLPluginCookieStore::readAllCookies(std::istream& s, bool mark_changed) +{ + clearCookies(); + readCookies(s, mark_changed); +} + +void LLPluginCookieStore::setCookies(const std::string &cookies, bool mark_changed) +{ + std::string::size_type start = 0; + + while(start != std::string::npos) + { + std::string::size_type end = cookies.find_first_of("\r\n", start); + if(end > start) + { + // The line is non-empty. Try to create a cookie from it. + setOneCookie(cookies, start, end, mark_changed); + } + start = cookies.find_first_not_of("\r\n ", end); + } +} + +void LLPluginCookieStore::setCookiesFromHost(const std::string &cookies, const std::string &host, bool mark_changed) +{ + std::string::size_type start = 0; + + while(start != std::string::npos) + { + std::string::size_type end = cookies.find_first_of("\r\n", start); + if(end > start) + { + // The line is non-empty. Try to create a cookie from it. + setOneCookie(cookies, start, end, mark_changed, host); + } + start = cookies.find_first_not_of("\r\n ", end); + } +} + +void LLPluginCookieStore::readCookies(std::istream& s, bool mark_changed) +{ + std::string line; + while(s.good() && !s.eof()) + { + std::getline(s, line); + if(!line.empty()) + { + // Try to create a cookie from this line. + setOneCookie(line, 0, std::string::npos, mark_changed); + } + } +} + +std::string LLPluginCookieStore::quoteString(const std::string &s) +{ + std::stringstream result; + + result << '"'; + + for(std::string::size_type i = 0; i < s.size(); ++i) + { + char c = s[i]; + switch(c) + { + // All these separators need to be quoted in HTTP headers, according to section 2.2 of rfc 2616: + case '(': case ')': case '<': case '>': case '@': + case ',': case ';': case ':': case '\\': case '"': + case '/': case '[': case ']': case '?': case '=': + case '{': case '}': case ' ': case '\t': + result << '\\'; + break; + } + + result << c; + } + + result << '"'; + + return result.str(); +} + +std::string LLPluginCookieStore::unquoteString(const std::string &s) +{ + std::stringstream result; + + bool in_quotes = false; + + for(std::string::size_type i = 0; i < s.size(); ++i) + { + char c = s[i]; + switch(c) + { + case '\\': + if(in_quotes) + { + // The next character is backslash-quoted. Pass it through untouched. + ++i; + if(i < s.size()) + { + result << s[i]; + } + continue; + } + break; + case '"': + in_quotes = !in_quotes; + continue; + break; + } + + result << c; + } + + return result.str(); +} + +// The flow for deleting a cookie is non-obvious enough that I should call it out here... +// Deleting a cookie is done by setting a cookie with the same name, path, and domain, but with an expire timestamp in the past. +// (This is exactly how a web server tells a browser to delete a cookie.) +// When deleting with mark_changed set to true, this replaces the existing cookie in the list with an entry that's marked both dead and changed. +// Some time later when writeChangedCookies() is called with clear_changed set to true, the dead cookie is deleted from the list after being returned, so that the +// delete operation (in the form of the expired cookie) is passed along. +void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed, const std::string &host) +{ + Cookie *cookie = Cookie::createFromString(s, cookie_start, cookie_end, host); + if(cookie) + { + lldebugs << "setting cookie: " << cookie->getCookie() << llendl; + + // Create a key for this cookie + std::string key = cookie->getKey(); + + // Check to see whether this cookie should have expired + if(!cookie->isSessionCookie() && (cookie->getDate() < LLDate::now())) + { + // This cookie has expired. + if(mark_changed) + { + // If we're marking cookies as changed, we should keep it anyway since we'll need to send it out with deltas. + cookie->setDead(true); + lldebugs << " marking dead" << llendl; + } + else + { + // If we're not marking cookies as changed, we don't need to keep this cookie at all. + // If the cookie was already in the list, delete it. + removeCookie(key); + + delete cookie; + cookie = NULL; + + lldebugs << " removing" << llendl; + } + } + + if(cookie) + { + // If it already exists in the map, replace it. + cookie_map_t::iterator iter = mCookies.find(key); + if(iter != mCookies.end()) + { + if(iter->second->getCookie() == cookie->getCookie()) + { + // The new cookie is identical to the old -- don't mark as changed. + // Just leave the old one in the map. + delete cookie; + cookie = NULL; + + lldebugs << " unchanged" << llendl; + } + else + { + // A matching cookie was already in the map. Replace it. + delete iter->second; + iter->second = cookie; + + cookie->setChanged(mark_changed); + if(mark_changed) + mHasChangedCookies = true; + + lldebugs << " replacing" << llendl; + } + } + else + { + // The cookie wasn't in the map. Insert it. + mCookies.insert(std::make_pair(key, cookie)); + + cookie->setChanged(mark_changed); + if(mark_changed) + mHasChangedCookies = true; + + lldebugs << " adding" << llendl; + } + } + } +} + +void LLPluginCookieStore::clearCookies() +{ + while(!mCookies.empty()) + { + cookie_map_t::iterator iter = mCookies.begin(); + delete iter->second; + mCookies.erase(iter); + } +} + +void LLPluginCookieStore::removeCookie(const std::string &key) +{ + cookie_map_t::iterator iter = mCookies.find(key); + if(iter != mCookies.end()) + { + delete iter->second; + mCookies.erase(iter); + } +} + diff --git a/indra/llplugin/llplugincookiestore.h b/indra/llplugin/llplugincookiestore.h new file mode 100644 index 0000000000..a93f0c14f0 --- /dev/null +++ b/indra/llplugin/llplugincookiestore.h @@ -0,0 +1,125 @@ +/** + * @file llplugincookiestore.h + * @brief LLPluginCookieStore provides central storage for http cookies used by plugins + * + * @cond + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + * @endcond + */ + +#ifndef LL_LLPLUGINCOOKIESTORE_H +#define LL_LLPLUGINCOOKIESTORE_H + +#include "lldate.h" +#include <map> +#include <string> +#include <iostream> + +class LLPluginCookieStore +{ + LOG_CLASS(LLPluginCookieStore); +public: + LLPluginCookieStore(); + ~LLPluginCookieStore(); + + // gets all cookies currently in storage -- use when initializing a plugin + std::string getAllCookies(); + void writeAllCookies(std::ostream& s); + + // gets only persistent cookies (i.e. not session cookies) -- use when writing cookies to a file + std::string getPersistentCookies(); + void writePersistentCookies(std::ostream& s); + + // gets cookies which are marked as "changed" -- use when sending periodic updates to plugins + std::string getChangedCookies(bool clear_changed = true); + void writeChangedCookies(std::ostream& s, bool clear_changed = true); + + // (re)initializes internal data structures and bulk-sets cookies -- use when reading cookies from a file + void setAllCookies(const std::string &cookies, bool mark_changed = false); + void readAllCookies(std::istream& s, bool mark_changed = false); + + // sets one or more cookies (without reinitializing anything) -- use when receiving cookies from a plugin + void setCookies(const std::string &cookies, bool mark_changed = true); + void readCookies(std::istream& s, bool mark_changed = true); + + // sets one or more cookies (without reinitializing anything), supplying a hostname the cookies came from -- use when setting a cookie manually + void setCookiesFromHost(const std::string &cookies, const std::string &host, bool mark_changed = true); + + // quote or unquote a string as per the definition of 'quoted-string' in rfc2616 + static std::string quoteString(const std::string &s); + static std::string unquoteString(const std::string &s); + +private: + + void setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed, const std::string &host = LLStringUtil::null); + + class Cookie + { + public: + static Cookie *createFromString(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos, const std::string &host = LLStringUtil::null); + + // Construct a string from the cookie that uniquely represents it, to be used as a key in a std::map. + std::string getKey() const; + + const std::string &getCookie() const { return mCookie; }; + bool isSessionCookie() const { return mDate.isNull(); }; + + bool isDead() const { return mDead; }; + void setDead(bool dead) { mDead = dead; }; + + bool isChanged() const { return mChanged; }; + void setChanged(bool changed) { mChanged = changed; }; + + const LLDate &getDate() const { return mDate; }; + + private: + Cookie(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos); + bool parse(const std::string &host); + std::string::size_type findFieldEnd(std::string::size_type start = 0, std::string::size_type end = std::string::npos); + bool matchName(std::string::size_type start, std::string::size_type end, const char *name); + + std::string mCookie; // The full cookie, in RFC 2109 string format + LLDate mDate; // The expiration date of the cookie. For session cookies, this will be a null date (mDate.isNull() is true). + // Start/end indices of various parts of the cookie string. Stored as indices into the string to save space and time. + std::string::size_type mNameStart, mNameEnd; + std::string::size_type mValueStart, mValueEnd; + std::string::size_type mDomainStart, mDomainEnd; + std::string::size_type mPathStart, mPathEnd; + bool mDead; + bool mChanged; + }; + + typedef std::map<std::string, Cookie*> cookie_map_t; + + cookie_map_t mCookies; + bool mHasChangedCookies; + + void clearCookies(); + void removeCookie(const std::string &key); +}; + +#endif // LL_LLPLUGINCOOKIESTORE_H diff --git a/indra/llplugin/tests/llplugincookiestore_test.cpp b/indra/llplugin/tests/llplugincookiestore_test.cpp new file mode 100644 index 0000000000..020d9c1977 --- /dev/null +++ b/indra/llplugin/tests/llplugincookiestore_test.cpp @@ -0,0 +1,211 @@ +/** + * @file llplugincookiestore_test.cpp + * @brief Unit tests for LLPluginCookieStore. + * + * @cond + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + * @endcond + */ + +#include "linden_common.h" +#include "../test/lltut.h" + +#include "../llplugincookiestore.h" + + +namespace tut +{ + // Main Setup + struct LLPluginCookieStoreFixture + { + LLPluginCookieStoreFixture() + { + // We need dates definitively in the past and the future to properly test cookie expiration. + LLDate now = LLDate::now(); + LLDate past(now.secondsSinceEpoch() - (60.0 * 60.0 * 24.0)); // 1 day in the past + LLDate future(now.secondsSinceEpoch() + (60.0 * 60.0 * 24.0)); // 1 day in the future + + mPastString = past.asRFC1123(); + mFutureString = future.asRFC1123(); + } + + std::string mPastString; + std::string mFutureString; + LLPluginCookieStore mCookieStore; + + // List of cookies used for validation + std::list<std::string> mCookies; + + // This sets up mCookies from a string returned by one of the functions in LLPluginCookieStore + void setCookies(const std::string &cookies) + { + mCookies.clear(); + std::string::size_type start = 0; + + while(start != std::string::npos) + { + std::string::size_type end = cookies.find_first_of("\r\n", start); + if(end > start) + { + std::string line(cookies, start, end - start); + if(line.find_first_not_of("\r\n\t ") != std::string::npos) + { + // The line has some non-whitespace characters. Save it to the list. + mCookies.push_back(std::string(cookies, start, end - start)); + } + } + start = cookies.find_first_not_of("\r\n ", end); + } + } + + // This ensures that a cookie matching the one passed is in the list. + void ensureCookie(const std::string &cookie) + { + std::list<std::string>::iterator iter; + for(iter = mCookies.begin(); iter != mCookies.end(); iter++) + { + if(*iter == cookie) + { + // Found the cookie + // TODO: this should do a smarter equality comparison on the two cookies, instead of just a string compare. + return; + } + } + + // Didn't find this cookie + std::string message = "cookie not found: "; + message += cookie; + ensure(message, false); + } + + // This ensures that the number of cookies in the list matches what's expected. + void ensureSize(const std::string &message, size_t size) + { + if(mCookies.size() != size) + { + std::stringstream full_message; + + full_message << message << " (expected " << size << ", actual " << mCookies.size() << ")"; + ensure(full_message.str(), false); + } + } + }; + + typedef test_group<LLPluginCookieStoreFixture> factory; + typedef factory::object object; + factory tf("LLPluginCookieStore test"); + + // Tests + template<> template<> + void object::test<1>() + { + // Test 1: cookie uniqueness and update lists. + // Valid, distinct cookies: + + std::string cookie01 = "cookieA=value; domain=example.com; path=/"; + std::string cookie02 = "cookieB=value; domain=example.com; path=/"; // different name + std::string cookie03 = "cookieA=value; domain=foo.example.com; path=/"; // different domain + std::string cookie04 = "cookieA=value; domain=example.com; path=/bar/"; // different path + std::string cookie05 = "cookieC; domain=example.com; path=/"; // empty value + std::string cookie06 = "cookieD=value; domain=example.com; path=/; expires="; // different name, persistent cookie + cookie06 += mFutureString; + + mCookieStore.setCookies(cookie01); + mCookieStore.setCookies(cookie02); + mCookieStore.setCookies(cookie03); + mCookieStore.setCookies(cookie04); + mCookieStore.setCookies(cookie05); + mCookieStore.setCookies(cookie06); + + // Invalid cookies (these will get parse errors and not be added to the store) + + std::string badcookie01 = "cookieD=value; domain=example.com; path=/; foo=bar"; // invalid field name + std::string badcookie02 = "cookieE=value; path=/"; // no domain + + mCookieStore.setCookies(badcookie01); + mCookieStore.setCookies(badcookie02); + + // All cookies added so far should have been marked as "changed" + setCookies(mCookieStore.getChangedCookies()); + ensureSize("count of changed cookies", 6); + ensureCookie(cookie01); + ensureCookie(cookie02); + ensureCookie(cookie03); + ensureCookie(cookie04); + ensureCookie(cookie05); + ensureCookie(cookie06); + + // Save off the current state of the cookie store (we'll restore it later) + std::string savedCookies = mCookieStore.getAllCookies(); + + // Test replacing cookies + std::string cookie01a = "cookieA=newvalue; domain=example.com; path=/"; // updated value + std::string cookie02a = "cookieB=newvalue; domain=example.com; path=/; expires="; // remove cookie (by setting an expire date in the past) + cookie02a += mPastString; + + mCookieStore.setCookies(cookie01a); + mCookieStore.setCookies(cookie02a); + + // test for getting changed cookies + setCookies(mCookieStore.getChangedCookies()); + ensureSize("count of updated cookies", 2); + ensureCookie(cookie01a); + ensureCookie(cookie02a); + + // and for the state of the store after getting changed cookies + setCookies(mCookieStore.getAllCookies()); + ensureSize("count of valid cookies", 5); + ensureCookie(cookie01a); + ensureCookie(cookie03); + ensureCookie(cookie04); + ensureCookie(cookie05); + ensureCookie(cookie06); + + // Check that only the persistent cookie is returned here + setCookies(mCookieStore.getPersistentCookies()); + ensureSize("count of persistent cookies", 1); + ensureCookie(cookie06); + + // Restore the cookie store to a previous state and verify + mCookieStore.setAllCookies(savedCookies); + + // Since setAllCookies defaults to not marking cookies as changed, this list should be empty. + setCookies(mCookieStore.getChangedCookies()); + ensureSize("count of changed cookies after restore", 0); + + // Verify that the restore worked as it should have. + setCookies(mCookieStore.getAllCookies()); + ensureSize("count of restored cookies", 6); + ensureCookie(cookie01); + ensureCookie(cookie02); + ensureCookie(cookie03); + ensureCookie(cookie04); + ensureCookie(cookie05); + ensureCookie(cookie06); + } + +} diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 36ac3ff119..3d8bd21609 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1699,8 +1699,8 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) U32 size = pick_width * pick_height; size = (size + 7) / 8; // pixelcount-to-bits mPickMask = new U8[size]; - mPickMaskWidth = pick_width; - mPickMaskHeight = pick_height; + mPickMaskWidth = pick_width - 1; + mPickMaskHeight = pick_height - 1; memset(mPickMask, 0, sizeof(U8) * size); @@ -1743,20 +1743,18 @@ BOOL LLImageGL::getMask(const LLVector2 &tc) llassert(false); } - llassert(mPickMaskWidth > 0 && mPickMaskHeight > 0); - S32 x = llfloor(u * mPickMaskWidth); S32 y = llfloor(v * mPickMaskHeight); - if (LL_UNLIKELY(x >= mPickMaskWidth)) + if (LL_UNLIKELY(x > mPickMaskWidth)) { LL_WARNS_ONCE("render") << "Ooh, width overrun on pick mask read, that coulda been bad." << LL_ENDL; - x = llmax(0, mPickMaskWidth-1); + x = llmax((U16)0, mPickMaskWidth); } - if (LL_UNLIKELY(y >= mPickMaskHeight)) + if (LL_UNLIKELY(y > mPickMaskHeight)) { LL_WARNS_ONCE("render") << "Ooh, height overrun on pick mask read, that woulda been bad." << LL_ENDL; - y = llmax(0, mPickMaskHeight-1); + y = llmax((U16)0, mPickMaskHeight); } S32 idx = y*mPickMaskWidth+x; diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index e12776f83a..0959722aa6 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -465,10 +465,11 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value) reshape(getRect().getWidth(), getRect().getHeight(), FALSE); }; -//vurtual +//virtual BOOL LLAccordionCtrlTab::postBuild() { - mHeader->setVisible(mHeaderVisible); + if(mHeader) + mHeader->setVisible(mHeaderVisible); static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -504,7 +505,8 @@ BOOL LLAccordionCtrlTab::postBuild() mScrollbar->setVisible(false); } - mContainerPanel->setVisible(mDisplayChildren); + if(mContainerPanel) + mContainerPanel->setVisible(mDisplayChildren); return LLUICtrl::postBuild(); } diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 462ccc6d53..4b8b22405e 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -35,8 +35,9 @@ #include <string> #include "llrect.h" +#include "lluictrl.h" +#include "lluicolor.h" -class LLUICtrl; class LLUICtrlFactory; class LLUIImage; class LLButton; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 1d4dc35cee..33c6a8b6ac 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -824,7 +824,7 @@ void LLButton::draw() x = text_right; break; case LLFontGL::HCENTER: - x = getRect().getWidth() / 2; + x = text_left + (text_width / 2); break; case LLFontGL::LEFT: default: diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 3a8efadaa4..cc107c972d 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -495,7 +495,6 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) params.max_length_bytes(mMaxChars); params.commit_callback.function(boost::bind(&LLComboBox::onTextCommit, this, _2)); params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1)); - params.handle_edit_keys_directly(true); params.commit_on_focus_lost(false); params.follows.flags(FOLLOWS_ALL); params.label(mLabel); diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 832f148902..9d4e2fa495 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -248,15 +248,14 @@ void LLDragHandleTop::reshapeTitleBox() return; } const LLFontGL* font = LLFontGL::getFontSansSerif(); - S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_HPAD; - if (getMaxTitleWidth() > 0) - title_width = llmin(title_width, getMaxTitleWidth()); + S32 title_width = getRect().getWidth(); + title_width -= 2 * LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth(); S32 title_height = llround(font->getLineHeight()); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, getRect().getHeight() - title_vpad, - getRect().getWidth() - LEFT_PAD - RIGHT_PAD, + title_width, title_height); // calls reshape on mTitleBox diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index dc5410787b..825bc9303e 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -71,6 +71,8 @@ public: BOOL getForeground() const { return mForeground; } void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } S32 getMaxTitleWidth() const { return mMaxTitleWidth; } + void setButtonsRect(const LLRect& rect){ mButtonsRect = rect; } + LLRect getButtonsRect() { return mButtonsRect; } void setTitleVisible(BOOL visible); virtual void setTitle( const std::string& title ) = 0; @@ -88,6 +90,7 @@ protected: LLTextBox* mTitleBox; private: + LLRect mButtonsRect; S32 mDragLastScreenX; S32 mDragLastScreenY; S32 mLastMouseScreenX; diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp index 821afae8fd..245bce76f5 100644 --- a/indra/llui/lleditmenuhandler.cpp +++ b/indra/llui/lleditmenuhandler.cpp @@ -37,3 +37,10 @@ /* static */ LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = NULL; +LLEditMenuHandler::~LLEditMenuHandler() +{ + if (gEditMenuHandler == this) + { + gEditMenuHandler = NULL; + } +} diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h index 1de9c56afb..d72283cd99 100644 --- a/indra/llui/lleditmenuhandler.h +++ b/indra/llui/lleditmenuhandler.h @@ -38,7 +38,7 @@ class LLEditMenuHandler { public: // this is needed even though this is just an interface class. - virtual ~LLEditMenuHandler() {}; + virtual ~LLEditMenuHandler(); virtual void undo() {}; virtual BOOL canUndo() const { return FALSE; } diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 2e5aeec41d..35f5a6bbb9 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -243,7 +243,7 @@ LLUUID LLFlatListView::getSelectedUUID() const } } -void LLFlatListView::getSelectedUUIDs(std::vector<LLUUID>& selected_uuids) const +void LLFlatListView::getSelectedUUIDs(uuid_vec_t& selected_uuids) const { if (mSelectedItemPairs.empty()) return; @@ -558,15 +558,6 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) } break; } - case 'A': - { - if(MASK_CONTROL & mask) - { - selectAll(); - handled = TRUE; - } - break; - } default: break; } @@ -791,10 +782,15 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti return false; } -bool LLFlatListView::selectAll() +BOOL LLFlatListView::canSelectAll() const { - if (!mAllowSelection) - return false; + return !mItemPairs.empty() && mAllowSelection && mMultipleSelection; +} + +void LLFlatListView::selectAll() +{ + if (!mAllowSelection || !mMultipleSelection) + return; mSelectedItemPairs.clear(); @@ -814,8 +810,6 @@ bool LLFlatListView::selectAll() // Stretch selected item rect to ensure it won't be clipped mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); - - return true; } bool LLFlatListView::isSelected(item_pair_t* item_pair) const @@ -953,11 +947,17 @@ void LLFlatListView::getValues(std::vector<LLSD>& values) const void LLFlatListView::onFocusReceived() { mSelectedItemsBorder->setVisible(TRUE); + gEditMenuHandler = this; } // virtual void LLFlatListView::onFocusLost() { mSelectedItemsBorder->setVisible(FALSE); + // Route menu back to the default + if( gEditMenuHandler == this ) + { + gEditMenuHandler = NULL; + } } //virtual diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 92cb40332e..e3c07e811f 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -58,7 +58,7 @@ * - Order of returned selected items are not guaranteed * - The control assumes that all items being added are unique. */ -class LLFlatListView : public LLScrollContainer +class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler { public: @@ -114,8 +114,6 @@ public: Params(); }; - virtual ~LLFlatListView() { clear(); }; - /** * Connects callback to signal called when Return key is pressed. */ @@ -224,7 +222,7 @@ public: * Get LLUUIDs associated with selected items * @param selected_uuids An std::vector being populated with LLUUIDs associated with selected items */ - virtual void getSelectedUUIDs(std::vector<LLUUID>& selected_uuids) const; + virtual void getSelectedUUIDs(uuid_vec_t& selected_uuids) const; /** Get the top selected item */ virtual LLPanel* getSelectedItem() const; @@ -344,7 +342,8 @@ protected: virtual bool selectNextItemPair(bool is_up_direction, bool reset_selection); - virtual bool selectAll(); + virtual BOOL canSelectAll() const; + virtual void selectAll(); virtual bool isSelected(item_pair_t* item_pair) const; @@ -379,11 +378,14 @@ private: void setNoItemsCommentVisible(bool visible) const; -private: +protected: /** Comparator to use when sorting the list. */ const ItemComparator* mItemComparator; + +private: + LLPanel* mItemsPanel; S32 mItemsNoScrollWidth; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index ab14c08948..e672252a50 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -346,7 +346,7 @@ void LLFloater::layoutDragHandle() rect = getLocalRect(); } mDragHandle->setRect(rect); - updateButtons(); + updateTitleButtons(); applyTitle(); } @@ -1061,11 +1061,10 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); } - - applyTitle (); make_ui_sound("UISndWindowClose"); - updateButtons(); + updateTitleButtons(); + applyTitle (); } void LLFloater::setFocus( BOOL b ) @@ -1121,6 +1120,7 @@ void LLFloater::setIsChrome(BOOL is_chrome) setFocus(FALSE); // can't Ctrl-Tab to "chrome" floaters setFocusRoot(FALSE); + mButtons[BUTTON_CLOSE]->setToolTip(LLStringExplicit(getButtonTooltip(Params(), BUTTON_CLOSE, is_chrome))); } // no titles displayed on "chrome" floaters @@ -1190,7 +1190,7 @@ void LLFloater::setHost(LLMultiFloater* host) mButtonScale = 1.f; //mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE; } - updateButtons(); + updateTitleButtons(); if (host) { mHostHandle = host->getHandle(); @@ -1389,7 +1389,7 @@ void LLFloater::setCanDock(bool b) mButtonsEnabled[BUTTON_DOCK] = FALSE; } } - updateButtons(); + updateTitleButtons(); } void LLFloater::setDocked(bool docked, bool pop_on_undock) @@ -1398,7 +1398,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) { mDocked = docked; mButtonsEnabled[BUTTON_DOCK] = !mDocked; - updateButtons(); + updateTitleButtons(); storeDockStateControl(); } @@ -1451,7 +1451,7 @@ void LLFloater::onClickTearOff(LLFloater* self) } self->setTornOff(false); } - self->updateButtons(); + self->updateTitleButtons(); } // static @@ -1691,7 +1691,7 @@ void LLFloater::setCanMinimize(BOOL can_minimize) mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); mButtonsEnabled[BUTTON_RESTORE] = can_minimize && isMinimized(); - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanClose(BOOL can_close) @@ -1699,7 +1699,7 @@ void LLFloater::setCanClose(BOOL can_close) mCanClose = can_close; mButtonsEnabled[BUTTON_CLOSE] = can_close; - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanTearOff(BOOL can_tear_off) @@ -1707,7 +1707,7 @@ void LLFloater::setCanTearOff(BOOL can_tear_off) mCanTearOff = can_tear_off; mButtonsEnabled[BUTTON_TEAR_OFF] = mCanTearOff && !mHostHandle.isDead(); - updateButtons(); + updateTitleButtons(); } @@ -1731,10 +1731,11 @@ void LLFloater::setCanDrag(BOOL can_drag) } } -void LLFloater::updateButtons() +void LLFloater::updateTitleButtons() { static LLUICachedControl<S32> floater_close_box_size ("UIFloaterCloseBoxSize", 0); static LLUICachedControl<S32> close_box_from_top ("UICloseBoxFromTop", 0); + LLRect buttons_rect; S32 button_count = 0; for (S32 i = 0; i < BUTTON_COUNT; i++) { @@ -1785,6 +1786,15 @@ void LLFloater::updateButtons() llround((F32)floater_close_box_size * mButtonScale)); } + if(!buttons_rect.isValid()) + { + buttons_rect = btn_rect; + } + else + { + mDragOnLeft ? buttons_rect.mRight + btn_rect.mRight : + buttons_rect.mLeft = btn_rect.mLeft; + } mButtons[i]->setRect(btn_rect); mButtons[i]->setVisible(TRUE); // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater @@ -1796,7 +1806,10 @@ void LLFloater::updateButtons() } } if (mDragHandle) - mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (floater_close_box_size + 1))); + { + localRectToOtherView(buttons_rect, &buttons_rect, mDragHandle); + mDragHandle->setButtonsRect(buttons_rect); + } } void LLFloater::buildButtons(const Params& floater_params) @@ -1844,7 +1857,7 @@ void LLFloater::buildButtons(const Params& floater_params) p.click_callback.function(boost::bind(sButtonCallbacks[i], this)); p.tab_stop(false); p.follows.flags(FOLLOWS_TOP|FOLLOWS_RIGHT); - p.tool_tip = getButtonTooltip(floater_params, (EFloaterButton)i); + p.tool_tip = getButtonTooltip(floater_params, (EFloaterButton)i, getIsChrome()); p.scale_image(true); p.chrome(true); @@ -1853,7 +1866,7 @@ void LLFloater::buildButtons(const Params& floater_params) mButtons[i] = buttonp; } - updateButtons(); + updateTitleButtons(); } // static @@ -1899,8 +1912,15 @@ LLUIImage* LLFloater::getButtonPressedImage(const Params& p, EFloaterButton e) } // static -std::string LLFloater::getButtonTooltip(const Params& p, EFloaterButton e) +std::string LLFloater::getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome) { + // EXT-4081 (Lag Meter: Ctrl+W does not close floater) + // If floater is chrome set 'Close' text for close button's tooltip + if(is_chrome && BUTTON_CLOSE == e) + { + static std::string close_tooltip_chrome = LLTrans::getString("BUTTON_CLOSE_CHROME"); + return close_tooltip_chrome; + } // TODO: per-floater localizable tooltips set in XML return sButtonToolTips[e]; } @@ -2810,3 +2830,15 @@ bool LLFloater::isShown(const LLFloater* floater) { return floater && floater->isShown(); } + +/* static */ +bool LLFloater::isMinimized(const LLFloater* floater) +{ + return floater && floater->isMinimized(); +} + +/* static */ +bool LLFloater::isVisible(const LLFloater* floater) +{ + return floater && floater->getVisible(); +} diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index c1e8813f87..403723d9d8 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -194,6 +194,8 @@ public: /// The static isShown() can accept a NULL pointer (which of course /// returns false). When non-NULL, it calls the non-static isShown(). static bool isShown(const LLFloater* floater); + static bool isVisible(const LLFloater* floater); + static bool isMinimized(const LLFloater* floater); BOOL isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts BOOL isFrontmost(); BOOL isDependent() { return !mDependeeHandle.isDead(); } @@ -309,19 +311,26 @@ protected: virtual void onClickCloseBtn(); + virtual void updateTitleButtons(); + private: void setForeground(BOOL b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters void createMinimizeButton(); - void updateButtons(); void buildButtons(const Params& p); // Images and tooltips are named in the XML, but we want to look them // up by index. static LLUIImage* getButtonImage(const Params& p, EFloaterButton e); static LLUIImage* getButtonPressedImage(const Params& p, EFloaterButton e); - static std::string getButtonTooltip(const Params& p, EFloaterButton e); + /** + * @params is_chrome - if floater is Chrome it means that floater will never get focus. + * Therefore it can't be closed with 'Ctrl+W'. So the tooltip text of close button( X ) + * should be 'Close' not 'Close(Ctrl+W)' as for usual floaters. + */ + static std::string getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome); + BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); void addResizeCtrls(); void layoutResizeCtrls(); diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 5de3934c8a..7588d8ab7a 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -272,11 +272,11 @@ bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key) } //static -// returns true if the instance exists and is visible +// returns true if the instance exists and is visible (doesnt matter minimized or not) bool LLFloaterReg::instanceVisible(const std::string& name, const LLSD& key) { LLFloater* instance = findInstance(name, key); - return LLFloater::isShown(instance); + return LLFloater::isVisible(instance); } //static @@ -463,3 +463,12 @@ bool LLFloaterReg::floaterInstanceVisible(const LLSD& sdname) return instanceVisible(name, key); } +//static +bool LLFloaterReg::floaterInstanceMinimized(const LLSD& sdname) +{ + LLSD key; + std::string name = sdname.asString(); + parse_name_key(name, key); + LLFloater* instance = findInstance(name, key); + return LLFloater::isShown(instance); +} diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 8a11d5c3f2..5cacf76771 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -134,6 +134,7 @@ public: static void hideFloaterInstance(const LLSD& sdname); static void toggleFloaterInstance(const LLSD& sdname); static bool floaterInstanceVisible(const LLSD& sdname); + static bool floaterInstanceMinimized(const LLSD& sdname); // Typed find / get / show template <class T> diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 483a394bbd..843f72d8e4 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -91,7 +91,6 @@ LLLineEditor::Params::Params() background_image_disabled("background_image_disabled"), background_image_focused("background_image_focused"), select_on_focus("select_on_focus", false), - handle_edit_keys_directly("handle_edit_keys_directly", false), revert_on_esc("revert_on_esc", true), commit_on_focus_lost("commit_on_focus_lost", true), ignore_tab("ignore_tab", true), @@ -136,7 +135,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mIgnoreArrowKeys( FALSE ), mIgnoreTab( p.ignore_tab ), mDrawAsterixes( FALSE ), - mHandleEditKeysDirectly(p.handle_edit_keys_directly), mSelectAllonFocusReceived( p.select_on_focus ), mPassDelete(FALSE), mReadOnly(FALSE), @@ -192,12 +190,8 @@ LLLineEditor::~LLLineEditor() { mCommitOnFocusLost = FALSE; + // calls onCommit() while LLLineEditor still valid gFocusMgr.releaseFocusIfNeeded( this ); - - if( gEditMenuHandler == this ) - { - gEditMenuHandler = NULL; - } } @@ -497,6 +491,7 @@ void LLLineEditor::selectAll() setCursor(mSelectionEnd); //mScrollHPos = 0; mIsSelecting = TRUE; + updatePrimary(); } @@ -788,7 +783,7 @@ void LLLineEditor::removeChar() } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -827,7 +822,7 @@ void LLLineEditor::addChar(const llwchar uni_char) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } getWindow()->hideCursorUntilMouseMove(); @@ -916,7 +911,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } break; @@ -932,7 +927,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } break; @@ -958,22 +953,6 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } } - if (!handled && mHandleEditKeysDirectly) - { - if( (MASK_CONTROL & mask) && ('A' == key) ) - { - if( canSelectAll() ) - { - selectAll(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - } - if(handled) { // take selection to 'primary' clipboard @@ -1020,7 +999,7 @@ void LLLineEditor::cut() if( need_to_rollback ) { rollback.doRollback( this ); - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else if( mKeystrokeCallback ) @@ -1129,7 +1108,7 @@ void LLLineEditor::pasteHelper(bool is_primary) } // Truncate the clean string at the limit of what will fit clean_string = clean_string.substr(0, wchars_that_fit); - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } mText.insert(getCursor(), clean_string); @@ -1141,7 +1120,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if( need_to_rollback ) { rollback.doRollback( this ); - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else if( mKeystrokeCallback ) @@ -1206,7 +1185,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } handled = TRUE; @@ -1255,7 +1234,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1282,7 +1261,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1299,7 +1278,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1316,7 +1295,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1339,64 +1318,6 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) break; } - if( !handled && mHandleEditKeysDirectly ) - { - // Standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system. - if( KEY_DELETE == key ) - { - if( canDoDelete() ) - { - doDelete(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - else - if( MASK_CONTROL & mask ) - { - if( 'C' == key ) - { - if( canCopy() ) - { - copy(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - else - if( 'V' == key ) - { - if( canPaste() ) - { - paste(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - else - if( 'X' == key ) - { - if( canCut() ) - { - cut(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - } - } return handled; } @@ -1451,7 +1372,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) { rollback.doRollback(this); - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } // Notify owner if requested @@ -1499,7 +1420,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) { rollback.doRollback( this ); - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } // Notify owner if requested @@ -1544,7 +1465,7 @@ void LLLineEditor::doDelete() if( need_to_rollback ) { rollback.doRollback( this ); - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else { @@ -1879,11 +1800,6 @@ S32 LLLineEditor::findPixelNearestPos(const S32 cursor_offset) const return result; } -void LLLineEditor::reportBadKeystroke() -{ - make_ui_sound("UISndBadKeystroke"); -} - //virtual void LLLineEditor::clear() { diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index b62138426b..9489e723e3 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -81,7 +81,6 @@ public: background_image_focused; Optional<bool> select_on_focus, - handle_edit_keys_directly, revert_on_esc, commit_on_focus_lost, ignore_tab; @@ -215,7 +214,6 @@ public: void extendSelection(S32 new_cursor_pos); void deleteSelection(); - void setHandleEditKeysDirectly( BOOL b ) { mHandleEditKeysDirectly = b; } void setSelectAllonFocusReceived(BOOL b); typedef boost::function<void (LLLineEditor* caller, void* user_data)> callback_t; @@ -247,7 +245,6 @@ private: void addChar(const llwchar c); void setCursorAtLocalPos(S32 local_mouse_x); S32 findPixelNearestPos(S32 cursor_offset = 0) const; - void reportBadKeystroke(); BOOL handleSpecialKey(KEY key, MASK mask); BOOL handleSelectionKey(KEY key, MASK mask); BOOL handleControlKey(KEY key, MASK mask); @@ -325,7 +322,6 @@ protected: BOOL mIgnoreTab; BOOL mDrawAsterixes; - BOOL mHandleEditKeysDirectly; // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system BOOL mSelectAllonFocusReceived; BOOL mPassDelete; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index fb4a9d032d..e0e86ae228 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3345,7 +3345,7 @@ void LLMenuHolderGL::draw() LLView::draw(); // now draw last selected item as overlay LLMenuItemGL* selecteditem = (LLMenuItemGL*)sItemLastSelectedHandle.get(); - if (selecteditem && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME) + if (selecteditem && selecteditem->getVisible() && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME) { // make sure toggle items, for example, show the proper state when fading out selecteditem->buildDrawLabel(); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 39d1986461..6f0f83d4b9 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -295,7 +295,7 @@ private: // class, by allowing another method to be specified which determines // if the menu item should consider itself checked as true or not. Be // careful that the provided callback is fast - it needs to be VERY -// FUCKING EFFICIENT, because it may need to be checked a lot. +// EFFICIENT because it may need to be checked a lot. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLMenuItemCheckGL diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 4af9108329..3aea648562 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -345,7 +345,7 @@ void LLMultiFloater::setVisible(BOOL visible) BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) { - if (key == 'W' && mask == MASK_CONTROL) + if (key == 'W' && mask == (MASK_CONTROL|MASK_SHIFT)) { LLFloater* floater = getActiveFloater(); // is user closeable and is system closeable diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index d7424cf05a..65ef53443b 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1552,3 +1552,11 @@ std::ostream& operator<<(std::ostream& s, const LLNotification& notification) return s; } +void LLPostponedNotification::onCachedNameReceived(const LLUUID& id, const std::string& first, + const std::string& last, bool is_group) +{ + gCacheName->getFullName(id, mName); + modifyNotificationParams(); + LLNotifications::instance().add(mParams); + cleanup(); +} diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 400491a154..1799ca65b7 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -104,6 +104,7 @@ #include "llinitparam.h" #include "llnotificationslistener.h" #include "llnotificationptr.h" +#include "llcachename.h" typedef enum e_notification_priority @@ -949,6 +950,62 @@ private: boost::scoped_ptr<LLNotificationsListener> mListener; }; +/** + * Abstract class for postponed notifications. + * Provides possibility to add notification after specified by id avatar or group will be + * received from cache name. The object of this type automatically well be deleted + * by cleanup method after respond will be received from cache name. + * + * To add custom postponed notification to the notification system client should: + * 1 create class derived from LLPostponedNotification; + * 2 call LLPostponedNotification::add method; + */ +class LLPostponedNotification +{ +public: + /** + * Performs hooking cache name callback which will add notification to notifications system. + * Type of added notification should be specified by template parameter T + * and non-private derived from LLPostponedNotification class, + * otherwise compilation error will occur. + */ + template<class T> + static void add(const LLNotification::Params& params, + const LLUUID& id, bool is_group) + { + // upcast T to the base type to restrict T derivation from LLPostponedNotification + LLPostponedNotification* thiz = new T(); + + thiz->mParams = params; + + gCacheName->get(id, is_group, boost::bind( + &LLPostponedNotification::onCachedNameReceived, thiz, _1, _2, + _3, _4)); + } + +private: + void onCachedNameReceived(const LLUUID& id, const std::string& first, + const std::string& last, bool is_group); + + void cleanup() + { + delete this; + } + +protected: + LLPostponedNotification() {} + virtual ~LLPostponedNotification() {} + + /** + * Abstract method provides possibility to modify notification parameters and + * will be called after cache name retrieve information about avatar or group + * and before notification will be added to the notification system. + */ + virtual void modifyNotificationParams() = 0; + + LLNotification::Params mParams; + std::string mName; +}; #endif//LL_LLNOTIFICATIONS_H diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 77caaaa425..db0f2bd6e2 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -324,11 +324,6 @@ LLScrollListCtrl::~LLScrollListCtrl() delete mSortCallback; std::for_each(mItemList.begin(), mItemList.end(), DeletePointer()); - - if( gEditMenuHandler == this ) - { - gEditMenuHandler = NULL; - } } @@ -957,14 +952,14 @@ void LLScrollListCtrl::mouseOverHighlightNthItem(S32 target_index) } } -S32 LLScrollListCtrl::selectMultiple( std::vector<LLUUID> ids ) +S32 LLScrollListCtrl::selectMultiple( uuid_vec_t ids ) { item_list::iterator iter; S32 count = 0; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) { LLScrollListItem* item = *iter; - std::vector<LLUUID>::iterator iditr; + uuid_vec_t::iterator iditr; for(iditr = ids.begin(); iditr != ids.end(); ++iditr) { if (item->getEnabled() && (item->getUUID() == (*iditr))) diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index ebdc82115f..1f0ef585db 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -379,7 +379,7 @@ public: BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } BOOL hasSortOrder() const; - S32 selectMultiple( std::vector<LLUUID> ids ); + S32 selectMultiple( uuid_vec_t ids ); // conceptually const, but mutates mItemList void updateSort() const; // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 5f4b16ec9e..e08026eaf4 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -962,7 +962,18 @@ void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight()) { + //EXT-4288 + //to keep consistance scrolling behaviour + //when scrolling from top and from bottom... + bool is_scrolled_to_end = (mScroller!=NULL) && scrolledToEnd(); + LLUICtrl::reshape( width, height, called_from_parent ); + + if (is_scrolled_to_end) + { + deselect(); + endOfDoc(); + } // do this first after reshape, because other things depend on // up-to-date mVisibleTextRect @@ -1048,6 +1059,13 @@ void LLTextBase::setValue(const LLSD& value ) } //virtual +BOOL LLTextBase::canDeselect() const +{ + return hasSelection(); +} + + +//virtual void LLTextBase::deselect() { mSelectionStart = 0; diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 5b24c63557..8ed0680df9 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -132,6 +132,7 @@ public: /*virtual*/ LLTextViewModel* getViewModel() const; // LLEditMenuHandler interface + /*virtual*/ BOOL canDeselect() const; /*virtual*/ void deselect(); // used by LLTextSegment layout code diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 7d230f7d42..a1cae4bb98 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -240,7 +240,6 @@ LLTextEditor::Params::Params() prevalidate_callback("prevalidate_callback"), embedded_items("embedded_items", false), ignore_tab("ignore_tab", true), - handle_edit_keys_directly("handle_edit_keys_directly", false), show_line_numbers("show_line_numbers", false), default_color("default_color"), commit_on_focus_lost("commit_on_focus_lost", false), @@ -258,7 +257,6 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mShowLineNumbers ( p.show_line_numbers ), mCommitOnFocusLost( p.commit_on_focus_lost), mAllowEmbeddedItems( p.embedded_items ), - mHandleEditKeysDirectly( p.handle_edit_keys_directly ), mMouseDownX(0), mMouseDownY(0), mTabsToNextField(p.ignore_tab), @@ -305,12 +303,6 @@ LLTextEditor::~LLTextEditor() { gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() while LLTextEditor still valid - // Route menu back to the default - if( gEditMenuHandler == this ) - { - gEditMenuHandler = NULL; - } - // Scrollbar is deleted by LLView std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); @@ -507,21 +499,6 @@ void LLTextEditor::getSegmentsInRange(LLTextEditor::segment_vec_t& segments_out, } } -// virtual -BOOL LLTextEditor::canDeselect() const -{ - return hasSelection(); -} - - -void LLTextEditor::deselect() -{ - mSelectionStart = 0; - mSelectionEnd = 0; - mIsSelecting = FALSE; -} - - BOOL LLTextEditor::selectionContainsLineBreaks() { if (hasSelection()) @@ -668,6 +645,7 @@ void LLTextEditor::selectAll() mSelectionStart = getLength(); mSelectionEnd = 0; setCursorPos(mSelectionEnd); + updatePrimary(); } BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) @@ -1025,7 +1003,7 @@ void LLTextEditor::removeCharOrTab() } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -1048,7 +1026,7 @@ void LLTextEditor::removeChar() } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -1198,22 +1176,6 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) } } - if( !handled && mHandleEditKeysDirectly ) - { - if( (MASK_CONTROL & mask) && ('A' == key) ) - { - if( canSelectAll() ) - { - selectAll(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - } - if( handled ) { // take selection to 'primary' clipboard @@ -1247,6 +1209,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) case KEY_DOWN: changeLine( 1 ); + deselect(); break; case KEY_PAGE_DOWN: @@ -1260,7 +1223,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) case KEY_LEFT: if( hasSelection() ) { - setCursorPos(llmin( mCursorPos - 1, mSelectionStart, mSelectionEnd )); + setCursorPos(llmin( mSelectionStart, mSelectionEnd )); } else { @@ -1270,7 +1233,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } break; @@ -1278,7 +1241,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) case KEY_RIGHT: if( hasSelection() ) { - setCursorPos(llmax( mCursorPos + 1, mSelectionStart, mSelectionEnd )); + setCursorPos(llmax( mSelectionStart, mSelectionEnd )); } else { @@ -1288,7 +1251,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } break; @@ -1299,6 +1262,11 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) } } + if (handled) + { + deselect(); + } + return handled; } @@ -1551,75 +1519,13 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) return handled; } -BOOL LLTextEditor::handleEditKey(const KEY key, const MASK mask) -{ - BOOL handled = FALSE; - // Standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system. - if( KEY_DELETE == key ) - { - if( canDoDelete() ) - { - doDelete(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - else - if( MASK_CONTROL & mask ) +BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) { - if( 'C' == key ) - { - if( canCopy() ) - { - copy(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - else - if( 'V' == key ) - { - if( canPaste() ) - { - paste(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - else - if( 'X' == key ) - { - if( canCut() ) - { - cut(); - } - else - { - reportBadKeystroke(); - } - handled = TRUE; - } - } - - return handled; -} - - -BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit) -{ - *return_key_hit = FALSE; BOOL handled = TRUE; + if (mReadOnly) return FALSE; + switch( key ) { case KEY_INSERT: @@ -1641,7 +1547,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return } else { - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } break; @@ -1694,6 +1600,10 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return break; } + if (handled) + { + onKeyStroke(); + } return handled; } @@ -1714,9 +1624,6 @@ void LLTextEditor::unindentLineBeforeCloseBrace() BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) { BOOL handled = FALSE; - BOOL selection_modified = FALSE; - BOOL return_key_hit = FALSE; - BOOL text_may_have_changed = TRUE; // Special case for TAB. If want to move to next field, report // not handled and let the parent take care of field movement. @@ -1724,116 +1631,24 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) { return FALSE; } - /* - if (KEY_F10 == key) - { - LLComboBox::Params cp; - cp.name = "combo box"; - cp.label = "my combo"; - cp.rect.width = 100; - cp.rect.height = 20; - cp.items.add().label = "item 1"; - cp.items.add().label = "item 2"; - cp.items.add().label = "item 3"; - appendWidget(LLUICtrlFactory::create<LLComboBox>(cp), "combo", true, false); - } - if (KEY_F11 == key) - { - LLButton::Params bp; - bp.name = "text button"; - bp.label = "Click me"; - bp.rect.width = 100; - bp.rect.height = 20; - - appendWidget(LLUICtrlFactory::create<LLButton>(bp), "button", true, false); - } - */ - if (mReadOnly) + if (mReadOnly && mScroller) { - if(mScroller) - { - handled = mScroller->handleKeyHere( key, mask ); + handled = (mScroller && mScroller->handleKeyHere( key, mask )) + || handleSelectionKey(key, mask) + || handleControlKey(key, mask); } else { - handled = handleNavigationKey( key, mask ); - } - - } - else - { - // handle navigation keys ourself - handled = handleNavigationKey( key, mask ); - } - - - if( handled ) - { - text_may_have_changed = FALSE; - } - - if( !handled ) - { - handled = handleSelectionKey( key, mask ); - if( handled ) - { - selection_modified = TRUE; - } - } - - if( !handled ) - { - handled = handleControlKey( key, mask ); - if( handled ) - { - selection_modified = TRUE; - } - } - - if( !handled && mHandleEditKeysDirectly ) - { - handled = handleEditKey( key, mask ); - if( handled ) - { - selection_modified = TRUE; - text_may_have_changed = TRUE; - } - } - - // Handle most keys only if the text editor is writeable. - if( !mReadOnly ) - { - if( !handled ) - { - handled = handleSpecialKey( key, mask, &return_key_hit ); - if( handled ) - { - selection_modified = TRUE; - text_may_have_changed = TRUE; - } - } - + handled = handleNavigationKey( key, mask ) + || handleSelectionKey(key, mask) + || handleControlKey(key, mask) + || handleSpecialKey(key, mask); } if( handled ) { resetCursorBlink(); - - // Most keystrokes will make the selection box go away, but not all will. - if( !selection_modified && - KEY_SHIFT != key && - KEY_CONTROL != key && - KEY_ALT != key && - KEY_CAPSLOCK ) - { - deselect(); - } - - if(text_may_have_changed) - { - onKeyStroke(); - } needsScroll(); } @@ -2334,7 +2149,7 @@ void LLTextEditor::getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wo void LLTextEditor::autoIndent() { // Count the number of spaces in the current line - S32 line = getLineNumFromDocIndex(mCursorPos); + S32 line = getLineNumFromDocIndex(mCursorPos, false); S32 line_start = getLineStart(line); S32 space_count = 0; S32 i; diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 71d937b2c4..9b3ab9414c 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -68,7 +68,6 @@ public: Optional<bool> embedded_items, ignore_tab, - handle_edit_keys_directly, show_line_numbers, commit_on_focus_lost, show_context_menu; @@ -146,8 +145,6 @@ public: virtual BOOL canDoDelete() const; virtual void selectAll(); virtual BOOL canSelectAll() const; - virtual void deselect(); - virtual BOOL canDeselect() const; void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); @@ -218,13 +215,10 @@ protected: S32 indentLine( S32 pos, S32 spaces ); void unindentLineBeforeCloseBrace(); - void reportBadKeystroke() { make_ui_sound("UISndBadKeystroke"); } - BOOL handleNavigationKey(const KEY key, const MASK mask); - BOOL handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit); + BOOL handleSpecialKey(const KEY key, const MASK mask); BOOL handleSelectionKey(const KEY key, const MASK mask); BOOL handleControlKey(const KEY key, const MASK mask); - BOOL handleEditKey(const KEY key, const MASK mask); BOOL selectionContainsLineBreaks(); void deleteSelection(BOOL transient_operation); @@ -329,10 +323,6 @@ private: LLUUID mSourceID; - // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here - //instead of routed by the menu system - BOOL mHandleEditKeysDirectly; - LLCoordGL mLastIMEPosition; // Last position of the IME editor keystroke_signal_t mKeystrokeSignal; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index b049895526..f9a4ed7285 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1914,7 +1914,12 @@ void LLUI::clearPopups() } } - +//static +void LLUI::reportBadKeystroke() +{ + make_ui_sound("UISndBadKeystroke"); +} + //static // spawn_x and spawn_y are top left corner of view in screen GL coordinates void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 30f3623ded..c18262ef76 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -217,6 +217,8 @@ public: static void removePopup(LLView*); static void clearPopups(); + static void reportBadKeystroke(); + // Ensures view does not overlap mouse cursor, but is inside // the view's parent rectangle. Used for tooltips, inspectors. // Optionally override the view's default X/Y, which are relative to the diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 55b221e716..52132c38d3 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -160,7 +160,7 @@ public: virtual void setLanguageTextInput( const LLCoordGL & pos ) {}; virtual void updateLanguageTextInputArea() {} virtual void interruptLanguageTextInput() {} - virtual void spawnWebBrowser(const std::string& escaped_url) {}; + virtual void spawnWebBrowser(const std::string& escaped_url, bool async) {}; static std::vector<std::string> getDynamicFallbackFontList(); diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 022b97f481..7026a3f7a6 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -3178,7 +3178,7 @@ S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32 // Open a URL with the user's default web browser. // Must begin with protocol identifier. -void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url) +void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) { bool found = false; S32 i; diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 7c6b324029..5ac74bb004 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -116,7 +116,7 @@ public: /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b); /*virtual*/ void interruptLanguageTextInput(); - /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); + /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); static std::vector<std::string> getDynamicFallbackFontList(); diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 1f705f9e60..399d284402 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -2074,6 +2074,9 @@ void LLWindowSDL::initCursors() mSDLCursors[UI_CURSOR_TOOLPAUSE] = makeSDLCursorFromBMP("toolpause.BMP",0,0); mSDLCursors[UI_CURSOR_TOOLMEDIAOPEN] = makeSDLCursorFromBMP("toolmediaopen.BMP",0,0); mSDLCursors[UI_CURSOR_PIPETTE] = makeSDLCursorFromBMP("lltoolpipette.BMP",2,28); + mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",20,15); + mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",20,15); + mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",20,15); if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) { llinfos << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << llendl; @@ -2465,7 +2468,7 @@ void exec_cmd(const std::string& cmd, const std::string& arg) // Open a URL with the user's default web browser. // Must begin with protocol identifier. -void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url) +void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) { llinfos << "spawn_web_browser: " << escaped_url << llendl; @@ -2543,6 +2546,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() // Use libfontconfig to find us a nice ordered list of fallback fonts // specific to this system. std::string final_fallback("/usr/share/fonts/truetype/kochi/kochi-gothic.ttf"); + const int max_font_count_cutoff = 40; // fonts are expensive in the current system, don't enumerate an arbitrary number of them // Our 'ideal' font properties which define the sorting results. // slant=0 means Roman, index=0 means the first face in a font file // (the one we actually use), weight=80 means medium weight, @@ -2558,7 +2562,6 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() std::vector<std::string> rtns; FcFontSet *fs = NULL; FcPattern *sortpat = NULL; - int font_count = 0; llinfos << "Getting system font list from FontConfig..." << llendl; @@ -2602,12 +2605,13 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() FcPatternDestroy(sortpat); } + int found_font_count = 0; if (fs) { // Get the full pathnames to the fonts, where available, // which is what we really want. - int i; - for (i=0; i<fs->nfont; ++i) + found_font_count = fs->nfont; + for (int i=0; i<fs->nfont; ++i) { FcChar8 *filename; if (FcResultMatch == FcPatternGetString(fs->fonts[i], @@ -2616,7 +2620,8 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() && filename) { rtns.push_back(std::string((const char*)filename)); - ++font_count; + if (rtns.size() >= max_font_count_cutoff) + break; // hit limit } } FcFontSetDestroy (fs); @@ -2629,7 +2634,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() { lldebugs << " file: " << *it << llendl; } - llinfos << "Using " << font_count << " system font(s)." << llendl; + llinfos << "Using " << rtns.size() << "/" << found_font_count << " system fonts." << llendl; rtns.push_back(final_fallback); return rtns; diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index e6bdd46a77..8e65a2f324 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -125,7 +125,7 @@ public: /*virtual*/ void *getPlatformWindow(); /*virtual*/ void bringToFront(); - /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); + /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); static std::vector<std::string> getDynamicFallbackFontList(); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 8df9dad581..95c1980dd6 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2959,7 +2959,7 @@ S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 t } -void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) +void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async) { bool found = false; S32 i; @@ -2989,84 +2989,16 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) // let the OS decide what to use to open the URL SHELLEXECUTEINFO sei = { sizeof( sei ) }; - sei.fMask = SEE_MASK_FLAG_DDEWAIT; + // NOTE: this assumes that SL will stick around long enough to complete the DDE message exchange + // necessary for ShellExecuteEx to complete + if (async) + { + sei.fMask = SEE_MASK_ASYNCOK; + } sei.nShow = SW_SHOWNORMAL; sei.lpVerb = L"open"; sei.lpFile = url_utf16.c_str(); ShellExecuteEx( &sei ); - - //// TODO: LEAVING OLD CODE HERE SO I DON'T BONE OTHER MERGES - //// DELETE THIS ONCE THE MERGES ARE DONE - - // Figure out the user's default web browser - // HKEY_CLASSES_ROOT\http\shell\open\command - /* - std::string reg_path_str = gURLProtocolWhitelistHandler[i] + "\\shell\\open\\command"; - WCHAR reg_path_wstr[256]; - mbstowcs( reg_path_wstr, reg_path_str.c_str(), LL_ARRAY_SIZE(reg_path_wstr) ); - - HKEY key; - WCHAR browser_open_wstr[1024]; - DWORD buffer_length = 1024; - RegOpenKeyEx(HKEY_CLASSES_ROOT, reg_path_wstr, 0, KEY_QUERY_VALUE, &key); - RegQueryValueEx(key, NULL, NULL, NULL, (LPBYTE)browser_open_wstr, &buffer_length); - RegCloseKey(key); - - // Convert to STL string - LLWString browser_open_wstring = utf16str_to_wstring(browser_open_wstr); - - if (browser_open_wstring.length() < 2) - { - LL_WARNS("Window") << "Invalid browser executable in registry " << browser_open_wstring << LL_ENDL; - return; - } - - // Extract the process that's supposed to be launched - LLWString browser_executable; - if (browser_open_wstring[0] == '"') - { - // executable is quoted, find the matching quote - size_t quote_pos = browser_open_wstring.find('"', 1); - // copy out the string including both quotes - browser_executable = browser_open_wstring.substr(0, quote_pos+1); - } - else - { - // executable not quoted, find a space - size_t space_pos = browser_open_wstring.find(' ', 1); - browser_executable = browser_open_wstring.substr(0, space_pos); - } - - LL_DEBUGS("Window") << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << LL_ENDL; - LL_INFOS("Window") << "Browser executable: " << wstring_to_utf8str(browser_executable) << LL_ENDL; - - // Convert URL to wide string for Windows API - // Assume URL is UTF8, as can come from scripts - LLWString url_wstring = utf8str_to_wstring(escaped_url); - llutf16string url_utf16 = wstring_to_utf16str(url_wstring); - - // Convert executable and path to wide string for Windows API - llutf16string browser_exec_utf16 = wstring_to_utf16str(browser_executable); - - // ShellExecute returns HINSTANCE for backwards compatiblity. - // MS docs say to cast to int and compare to 32. - HWND our_window = NULL; - LPCWSTR directory_wstr = NULL; - int retval = (int) ShellExecute(our_window, // Flawfinder: ignore - L"open", - browser_exec_utf16.c_str(), - url_utf16.c_str(), - directory_wstr, - SW_SHOWNORMAL); - if (retval > 32) - { - LL_DEBUGS("Window") << "load_url success with " << retval << LL_ENDL; - } - else - { - LL_INFOS("Window") << "load_url failure with " << retval << LL_ENDL; - } - */ } /* diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 9d57735772..d4a3446515 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -114,7 +114,7 @@ public: /*virtual*/ void setLanguageTextInput( const LLCoordGL & pos ); /*virtual*/ void updateLanguageTextInputArea(); /*virtual*/ void interruptLanguageTextInput(); - /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); + /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url ); diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index e849fa9a6e..8de54aeda5 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -520,7 +520,7 @@ void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, const L } else { - llwarns << "Shit, somehow got an event that we're not registered for!" << llendl; + llwarns << "Somehow got an event that we're not registered for!" << llendl; } delete eventdata; } diff --git a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp index a69da3ff5a..033c4ba2f3 100644 --- a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp +++ b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp @@ -141,6 +141,7 @@ private: // Very GStreamer-specific GMainLoop *mPump; // event pump for this media GstElement *mPlaybin; + GstElement *mVisualizer; GstSLVideo *mVideoSink; }; @@ -159,6 +160,7 @@ MediaPluginGStreamer010::MediaPluginGStreamer010( mSeekDestination(0.0), mPump ( NULL ), mPlaybin ( NULL ), + mVisualizer ( NULL ), mVideoSink ( NULL ), mCommand ( COMMAND_NONE ) { @@ -686,6 +688,33 @@ MediaPluginGStreamer010::load() this); llgst_object_unref (bus); + // get a visualizer element (bonus feature!) + char* vis_name = getenv("LL_GST_VIS_NAME"); + if (!vis_name || + (vis_name && std::string(vis_name)!="none")) + { + if (vis_name) + { + mVisualizer = llgst_element_factory_make (vis_name, "vis"); + } + if (!mVisualizer) + { + mVisualizer = llgst_element_factory_make ("libvisual_jess", "vis"); + if (!mVisualizer) + { + mVisualizer = llgst_element_factory_make ("goom", "vis"); + if (!mVisualizer) + { + mVisualizer = llgst_element_factory_make ("libvisual_lv_scope", "vis"); + if (!mVisualizer) + { + // That's okay, we don't NEED this. + } + } + } + } + } + if (NULL == getenv("LL_GSTREAMER_EXTERNAL")) { // instantiate a custom video sink mVideoSink = @@ -702,6 +731,11 @@ MediaPluginGStreamer010::load() g_object_set(mPlaybin, "video-sink", mVideoSink, NULL); } + if (mVisualizer) + { + g_object_set(mPlaybin, "vis-plugin", mVisualizer, NULL); + } + return true; } @@ -724,6 +758,12 @@ MediaPluginGStreamer010::unload () mPlaybin = NULL; } + if (mVisualizer) + { + llgst_object_unref (GST_OBJECT (mVisualizer)); + mVisualizer = NULL; + } + if (mPump) { g_main_loop_quit(mPump); diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 0462fce236..436e077e9b 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -89,6 +89,7 @@ private: std::string mProfileDir; std::string mHostLanguage; + std::string mUserAgent; bool mCookiesEnabled; bool mJavascriptEnabled; bool mPluginsEnabled; @@ -300,7 +301,7 @@ private: LLQtWebKit::getInstance()->addObserver( mBrowserWindowId, this ); // append details to agent string - LLQtWebKit::getInstance()->setBrowserAgentId( "LLPluginMedia Web Browser" ); + LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); #if !LL_QTWEBKIT_USES_PIXMAPS // don't flip bitmap @@ -507,6 +508,19 @@ private: sendMessage(message); } + + //////////////////////////////////////////////////////////////////////////////// + // virtual + void onCookieChanged(const EventType& event) + { + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "cookie_set"); + message.setValue("cookie", event.getStringValue()); + // These could be passed through as well, but aren't really needed. +// message.setValue("uri", event.getEventUri()); +// message.setValueBoolean("dead", (event.getIntValue() != 0)) + sendMessage(message); + } + LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers) { int result = 0; @@ -675,6 +689,7 @@ MediaPluginWebKit::MediaPluginWebKit(LLPluginInstance::sendMessageFunction host_ mHostLanguage = "en"; // default to english mJavascriptEnabled = true; // default to on mPluginsEnabled = true; // default to on + mUserAgent = "LLPluginMedia Web Browser"; } MediaPluginWebKit::~MediaPluginWebKit() @@ -1051,6 +1066,10 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) mJavascriptEnabled = message_in.getValueBoolean("enable"); //LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); } + else if(message_name == "set_cookies") + { + LLQtWebKit::getInstance()->setCookies(message_in.getValue("cookies")); + } else if(message_name == "proxy_setup") { bool val = message_in.getValueBoolean("enable"); @@ -1086,8 +1105,8 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) } else if(message_name == "set_user_agent") { - std::string user_agent = message_in.getValue("user_agent"); - LLQtWebKit::getInstance()->setBrowserAgentId( user_agent ); + mUserAgent = message_in.getValue("user_agent"); + LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); } else if(message_name == "init_history") { diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index ffbc7bad91..e0a31875c8 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -67,6 +67,7 @@ include_directories( set(viewer_SOURCE_FILES llagent.cpp llagentaccess.cpp + llagentcamera.cpp llagentdata.cpp llagentlanguage.cpp llagentlistener.cpp @@ -74,6 +75,7 @@ set(viewer_SOURCE_FILES llagentpilot.cpp llagentui.cpp llagentwearables.cpp + llagentwearablesfetch.cpp llanimstatelabels.cpp llappearancemgr.cpp llappviewer.cpp @@ -253,6 +255,7 @@ set(viewer_SOURCE_FILES llinventoryfilter.cpp llinventoryfunctions.cpp llinventorymodel.cpp + llinventorymodelbackgroundfetch.cpp llinventoryobserver.cpp llinventorypanel.cpp lljoystickbutton.cpp @@ -317,7 +320,6 @@ set(viewer_SOURCE_FILES llpanellandmedia.cpp llpanellogin.cpp llpanelloginlistener.cpp - llpanellookinfo.cpp llpanelmaininventory.cpp llpanelmediasettingsgeneral.cpp llpanelmediasettingspermissions.cpp @@ -326,6 +328,7 @@ set(viewer_SOURCE_FILES llpanelnearbymedia.cpp llpanelobject.cpp llpanelobjectinventory.cpp + llpaneloutfitedit.cpp llpaneloutfitsinventory.cpp llpanelpeople.cpp llpanelpeoplemenus.cpp @@ -568,6 +571,7 @@ set(viewer_HEADER_FILES ViewerInstall.cmake llagent.h llagentaccess.h + llagentcamera.h llagentdata.h llagentlanguage.h llagentlistener.h @@ -575,6 +579,7 @@ set(viewer_HEADER_FILES llagentpilot.h llagentui.h llagentwearables.h + llagentwearablesfetch.h llanimstatelabels.h llappearance.h llappearancemgr.h @@ -756,6 +761,7 @@ set(viewer_HEADER_FILES llinventoryfilter.h llinventoryfunctions.h llinventorymodel.h + llinventorymodelbackgroundfetch.h llinventoryobserver.h llinventorypanel.h lljoystickbutton.h @@ -816,7 +822,6 @@ set(viewer_HEADER_FILES llpanellandmedia.h llpanellogin.h llpanelloginlistener.h - llpanellookinfo.h llpanelmaininventory.h llpanelmediasettingsgeneral.h llpanelmediasettingspermissions.h @@ -825,6 +830,7 @@ set(viewer_HEADER_FILES llpanelnearbymedia.h llpanelobject.h llpanelobjectinventory.h + llpaneloutfitedit.h llpaneloutfitsinventory.h llpanelpeople.h llpanelpeoplemenus.h diff --git a/indra/newview/English.lproj/InfoPlist.strings b/indra/newview/English.lproj/InfoPlist.strings index 879408d6e4..02c3dfc6e0 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.0.0.200030"; -CFBundleGetInfoString = "Second Life version 2.0.0.200030, Copyright 2004-2009 Linden Research, Inc."; +CFBundleShortVersionString = "Second Life version 2.0.0.203110"; +CFBundleGetInfoString = "Second Life version 2.0.0.203110, Copyright 2004-2009 Linden Research, Inc."; diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index a800f4ba79..7436c5642e 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -60,7 +60,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>2.0.0.200030</string> + <string>2.0.0.203110</string> <key>CSResourcesFileMapped</key> <true/> </dict> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6bb780e254..442cd5d31e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2609,6 +2609,17 @@ <key>Value</key> <real>0.10000000149</real> </map> + <key>DragAndDropDistanceThreshold</key> + <map> + <key>Comment</key> + <string>Number of pixels that mouse should move before triggering drag and drop mode</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>3</integer> + </map> <key>DropShadowButton</key> <map> <key>Comment</key> @@ -8709,17 +8720,6 @@ <key>Value</key> <integer>1</integer> </map> - <key>SmallAvatarNames</key> - <map> - <key>Comment</key> - <string>Display avatar name text in smaller font</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>1</integer> - </map> <key>SnapEnabled</key> <map> <key>Comment</key> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e4d7c86595..37d1bd15e1 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -35,6 +35,7 @@ #include "pipeline.h" +#include "llagentcamera.h" #include "llagentlistener.h" #include "llagentwearables.h" #include "llagentui.h" @@ -43,7 +44,6 @@ #include "llcallingcard.h" #include "llchannelmanager.h" #include "llconsole.h" -//#include "llfirstuse.h" #include "llfloatercamera.h" #include "llfloatercustomize.h" #include "llfloaterreg.h" @@ -59,6 +59,7 @@ #include "llnearbychatbar.h" #include "llnotificationsutil.h" #include "llparcel.h" +#include "llrendersphere.h" #include "llsdutil.h" #include "llsidetray.h" #include "llsky.h" @@ -88,77 +89,18 @@ const BOOL ANIMATE = TRUE; const U8 AGENT_STATE_TYPING = 0x04; const U8 AGENT_STATE_EDITING = 0x10; -//drone wandering constants -const F32 MAX_WANDER_TIME = 20.f; // seconds -const F32 MAX_HEADING_HALF_ERROR = 0.2f; // radians -const F32 WANDER_MAX_SLEW_RATE = 2.f * DEG_TO_RAD; // radians / frame -const F32 WANDER_TARGET_MIN_DISTANCE = 10.f; // meters - // Autopilot constants -const F32 AUTOPILOT_HEADING_HALF_ERROR = 10.f * DEG_TO_RAD; // radians -const F32 AUTOPILOT_MAX_SLEW_RATE = 1.f * DEG_TO_RAD; // radians / frame -const F32 AUTOPILOT_STOP_DISTANCE = 2.f; // meters const F32 AUTOPILOT_HEIGHT_ADJUST_DISTANCE = 8.f; // meters const F32 AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND = 1.f; // meters const F32 AUTOPILOT_MAX_TIME_NO_PROGRESS = 1.5f; // seconds -// face editing constants -const LLVector3d FACE_EDIT_CAMERA_OFFSET(0.4f, -0.05f, 0.07f); -const LLVector3d FACE_EDIT_TARGET_OFFSET(0.f, 0.f, 0.05f); - -// Mousewheel camera zoom -const F32 MIN_ZOOM_FRACTION = 0.25f; -const F32 INITIAL_ZOOM_FRACTION = 1.f; -const F32 MAX_ZOOM_FRACTION = 8.f; -const F32 METERS_PER_WHEEL_CLICK = 1.f; - -const F32 MAX_TIME_DELTA = 1.f; - -const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds -const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds - -const F32 CAMERA_FOCUS_HALF_LIFE = 0.f;//0.02f; -const F32 CAMERA_LAG_HALF_LIFE = 0.25f; -const F32 MIN_CAMERA_LAG = 0.5f; -const F32 MAX_CAMERA_LAG = 5.f; - -const F32 CAMERA_COLLIDE_EPSILON = 0.1f; -const F32 MIN_CAMERA_DISTANCE = 0.1f; -const F32 AVATAR_ZOOM_MIN_X_FACTOR = 0.55f; -const F32 AVATAR_ZOOM_MIN_Y_FACTOR = 0.7f; -const F32 AVATAR_ZOOM_MIN_Z_FACTOR = 1.15f; - -const F32 MAX_CAMERA_DISTANCE_FROM_AGENT = 50.f; - -const F32 MAX_CAMERA_SMOOTH_DISTANCE = 50.0f; - -const F32 HEAD_BUFFER_SIZE = 0.3f; -const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.2f; - -const F32 LAND_MIN_ZOOM = 0.15f; -const F32 AVATAR_MIN_ZOOM = 0.5f; -const F32 OBJECT_MIN_ZOOM = 0.02f; - -const F32 APPEARANCE_MIN_ZOOM = 0.39f; -const F32 APPEARANCE_MAX_ZOOM = 8.f; +const F32 MAX_VELOCITY_AUTO_LAND_SQUARED = 4.f * 4.f; +const F64 CHAT_AGE_FAST_RATE = 3.0; // fidget constants const F32 MIN_FIDGET_TIME = 8.f; // seconds const F32 MAX_FIDGET_TIME = 20.f; // seconds -const S32 MAX_NUM_CHAT_POSITIONS = 10; -const F32 GROUND_TO_AIR_CAMERA_TRANSITION_TIME = 0.5f; -const F32 GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME = 0.5f; - -const F32 MAX_VELOCITY_AUTO_LAND_SQUARED = 4.f * 4.f; - -const F32 MAX_FOCUS_OFFSET = 20.f; - -const F32 OBJECT_EXTENTS_PADDING = 0.5f; - -const F32 MIN_RADIUS_ALPHA_SIZZLE = 0.5f; - -const F64 CHAT_AGE_FAST_RATE = 3.0; // The agent instance. LLAgent gAgent; @@ -193,11 +135,11 @@ bool handleSlowMotionAnimation(const LLSD& newvalue) { if (newvalue.asBoolean()) { - gAgent.getAvatarObject()->setAnimTimeFactor(0.2f); + gAgentAvatarp->setAnimTimeFactor(0.2f); } else { - gAgent.getAvatarObject()->setAnimTimeFactor(1.0f); + gAgentAvatarp->setAnimTimeFactor(1.0f); } return true; } @@ -218,20 +160,12 @@ bool handleSlowMotionAnimation(const LLSD& newvalue) // LLAgent() //----------------------------------------------------------------------------- LLAgent::LLAgent() : - mDrawDistance( DEFAULT_FAR_PLANE ), - mGroupPowers(0), mHideGroupTitle(FALSE), mGroupID(), - mLookAt(NULL), - mPointAt(NULL), - - mHUDTargetZoom(1.f), - mHUDCurZoom(1.f), mInitialized(FALSE), mListener(), - mForceMouselook(FALSE), mDoubleTapRunTimer(), mDoubleTapRunMode(DOUBLETAP_NONE), @@ -249,78 +183,17 @@ LLAgent::LLAgent() : mDistanceTraveled(0.F), mLastPositionGlobal(LLVector3d::zero), - mAvatarObject(NULL), - mRenderState(0), mTypingTimer(), - mCameraMode( CAMERA_MODE_THIRD_PERSON ), - mLastCameraMode( CAMERA_MODE_THIRD_PERSON ), mViewsPushed(FALSE), - mCameraPreset(CAMERA_PRESET_REAR_VIEW), - mCustomAnim(FALSE), mShowAvatar(TRUE), - mCameraAnimating( FALSE ), - mAnimationCameraStartGlobal(), - mAnimationFocusStartGlobal(), - mAnimationTimer(), - mAnimationDuration(0.33f), - - mCameraFOVZoomFactor(0.f), - mCameraCurrentFOVZoomFactor(0.f), - mCameraFocusOffset(), - mCameraFOVDefault(DEFAULT_FIELD_OF_VIEW), - - mCameraCollidePlane(), - - mCurrentCameraDistance(2.f), // meters, set in init() - mTargetCameraDistance(2.f), - mCameraZoomFraction(1.f), // deprecated - mThirdPersonHeadOffset(0.f, 0.f, 1.f), - mSitCameraEnabled(FALSE), - mCameraSmoothingLastPositionGlobal(), - mCameraSmoothingLastPositionAgent(), - mCameraSmoothingStop(FALSE), - - mCameraUpVector(LLVector3::z_axis), // default is straight up - - mFocusOnAvatar(TRUE), - mFocusGlobal(), - mFocusTargetGlobal(), - mFocusObject(NULL), - mFocusObjectDist(0.f), - mFocusObjectOffset(), - mFocusDotRadius( 0.1f ), // meters - mTrackFocusObject(TRUE), - mUIOffset(0.f), - mFrameAgent(), mIsBusy(FALSE), - mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed - mWalkKey(0), // like AtKey, but causes less forward thrust - mLeftKey(0), - mUpKey(0), - mYawKey(0.f), - mPitchKey(0.f), - - mOrbitLeftKey(0.f), - mOrbitRightKey(0.f), - mOrbitUpKey(0.f), - mOrbitDownKey(0.f), - mOrbitInKey(0.f), - mOrbitOutKey(0.f), - - mPanUpKey(0.f), - mPanDownKey(0.f), - mPanLeftKey(0.f), - mPanRightKey(0.f), - mPanInKey(0.f), - mPanOutKey(0.f), - mControlFlags(0x00000000), mbFlagsDirty(FALSE), mbFlagsNeedReset(FALSE), @@ -358,7 +231,6 @@ LLAgent::LLAgent() : mControlsTakenPassedOnCount[i] = 0; } - mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); mListener.reset(new LLAgentListener(*this)); } @@ -372,37 +244,10 @@ void LLAgent::init() gSavedSettings.declareBOOL("SlowMotionAnimation", FALSE, "Declared in code", FALSE); gSavedSettings.getControl("SlowMotionAnimation")->getSignal()->connect(boost::bind(&handleSlowMotionAnimation, _2)); - mDrawDistance = gSavedSettings.getF32("RenderFarClip"); - // *Note: this is where LLViewerCamera::getInstance() used to be constructed. - LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW); - // Leave at 0.1 meters until we have real near clip management - LLViewerCamera::getInstance()->setNear(0.1f); - LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h - LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape - LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape - setFlying( gSavedSettings.getBOOL("FlyingAtExit") ); - mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); - - mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - - mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3("CameraOffsetRearView"); - mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3("CameraOffsetFrontView"); - mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3("CameraOffsetGroupView"); - - mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3d("FocusOffsetRearView"); - mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3d("FocusOffsetFrontView"); - mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3d("FocusOffsetGroupView"); - - mCameraCollidePlane.clearVec(); - mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); - mTargetCameraDistance = mCurrentCameraDistance; - mCameraZoomFraction = 1.f; - mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); - mEffectColor = LLUIColorTable::instance().getColor("EffectColor"); gSavedSettings.getControl("PreferredMaturity")->getValidateSignal()->connect(boost::bind(&LLAgent::validateMaturity, this, _2)); @@ -416,22 +261,7 @@ void LLAgent::init() //----------------------------------------------------------------------------- void LLAgent::cleanup() { - setSitCamera(LLUUID::null); - - mAvatarObject = NULL; - - if(mLookAt) - { - mLookAt->markDead() ; - mLookAt = NULL; - } - if(mPointAt) - { - mPointAt->markDead() ; - mPointAt = NULL; - } mRegionp = NULL; - setFocusObject(NULL); } //----------------------------------------------------------------------------- @@ -444,83 +274,6 @@ LLAgent::~LLAgent() // *Note: this is where LLViewerCamera::getInstance() used to be deleted. } -// Change camera back to third person, stop the autopilot, -// deselect stuff, etc. -//----------------------------------------------------------------------------- -// resetView() -//----------------------------------------------------------------------------- -void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) -{ - if (mAutoPilot) - { - stopAutoPilot(TRUE); - } - - if (!gNoRender) - { - LLSelectMgr::getInstance()->unhighlightAll(); - - // By popular request, keep land selection while walking around. JC - // LLViewerParcelMgr::getInstance()->deselectLand(); - - // force deselect when walking and attachment is selected - // this is so people don't wig out when their avatar moves without animating - if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) - { - LLSelectMgr::getInstance()->deselectAll(); - } - - // Hide all popup menus - gMenuHolder->hideMenus(); - } - - if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) - { - changeCameraToDefault(); - - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - handle_toggle_flycam(); - } - - // reset avatar mode from eventual residual motion - if (LLToolMgr::getInstance()->inBuildMode()) - { - LLViewerJoystick::getInstance()->moveAvatar(true); - } - - //Camera Tool is needed for Free Camera Control Mode - if (!LLFloaterCamera::inFreeCameraMode()) - { - LLFloaterReg::hideInstance("build"); - - // Switch back to basic toolset - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - gViewerWindow->showCursor(); - } - - - if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) - { - if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) - { - // leaving mouse-steer mode - LLVector3 agent_at_axis = getAtAxis(); - agent_at_axis -= projected_vec(agent_at_axis, getReferenceUpVector()); - agent_at_axis.normalize(); - gAgent.resetAxes(lerp(getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f))); - } - - setFocusOnAvatar(TRUE, ANIMATE); - - mCameraFOVZoomFactor = 0.f; - } - - mHUDTargetZoom = 1.f; -} - // Handle any actions that need to be performed when the main app gains focus // (such as through alt-tab). //----------------------------------------------------------------------------- @@ -528,9 +281,9 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) //----------------------------------------------------------------------------- void LLAgent::onAppFocusGained() { - if (CAMERA_MODE_MOUSELOOK == mCameraMode) + if (CAMERA_MODE_MOUSELOOK == gAgentCamera.getCameraMode()) { - changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); LLToolMgr::getInstance()->clearSavedTool(); } } @@ -538,32 +291,15 @@ void LLAgent::onAppFocusGained() void LLAgent::ageChat() { - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { // get amount of time since I last chatted - F64 elapsed_time = (F64)mAvatarObject->mChatTimer.getElapsedTimeF32(); + F64 elapsed_time = (F64)gAgentAvatarp->mChatTimer.getElapsedTimeF32(); // add in frame time * 3 (so it ages 4x) - mAvatarObject->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0)); + gAgentAvatarp->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0)); } } -// Allow camera to be moved somewhere other than behind avatar. -//----------------------------------------------------------------------------- -// unlockView() -//----------------------------------------------------------------------------- -void LLAgent::unlockView() -{ - if (getFocusOnAvatar()) - { - if (mAvatarObject.notNull()) - { - setFocusGlobal( LLVector3d::zero, mAvatarObject->mID ); - } - setFocusOnAvatar(FALSE, FALSE); // no animation - } -} - - //----------------------------------------------------------------------------- // moveAt() //----------------------------------------------------------------------------- @@ -572,7 +308,7 @@ void LLAgent::moveAt(S32 direction, bool reset) // age chat timer so it fades more quickly when you are intentionally moving ageChat(); - setKey(direction, mAtKey); + gAgentCamera.setAtKey(LLAgentCamera::directionToKey(direction)); if (direction > 0) { @@ -585,7 +321,7 @@ void LLAgent::moveAt(S32 direction, bool reset) if (reset) { - resetView(); + gAgentCamera.resetView(); } } @@ -597,7 +333,7 @@ void LLAgent::moveAtNudge(S32 direction) // age chat timer so it fades more quickly when you are intentionally moving ageChat(); - setKey(direction, mWalkKey); + gAgentCamera.setWalkKey(LLAgentCamera::directionToKey(direction)); if (direction > 0) { @@ -608,7 +344,7 @@ void LLAgent::moveAtNudge(S32 direction) setControlFlags(AGENT_CONTROL_NUDGE_AT_NEG); } - resetView(); + gAgentCamera.resetView(); } //----------------------------------------------------------------------------- @@ -619,7 +355,7 @@ void LLAgent::moveLeft(S32 direction) // age chat timer so it fades more quickly when you are intentionally moving ageChat(); - setKey(direction, mLeftKey); + gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction)); if (direction > 0) { @@ -630,7 +366,7 @@ void LLAgent::moveLeft(S32 direction) setControlFlags(AGENT_CONTROL_LEFT_NEG | AGENT_CONTROL_FAST_LEFT); } - resetView(); + gAgentCamera.resetView(); } //----------------------------------------------------------------------------- @@ -641,7 +377,7 @@ void LLAgent::moveLeftNudge(S32 direction) // age chat timer so it fades more quickly when you are intentionally moving ageChat(); - setKey(direction, mLeftKey); + gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction)); if (direction > 0) { @@ -652,7 +388,7 @@ void LLAgent::moveLeftNudge(S32 direction) setControlFlags(AGENT_CONTROL_NUDGE_LEFT_NEG); } - resetView(); + gAgentCamera.resetView(); } //----------------------------------------------------------------------------- @@ -663,7 +399,7 @@ void LLAgent::moveUp(S32 direction) // age chat timer so it fades more quickly when you are intentionally moving ageChat(); - setKey(direction, mUpKey); + gAgentCamera.setUpKey(LLAgentCamera::directionToKey(direction)); if (direction > 0) { @@ -674,7 +410,7 @@ void LLAgent::moveUp(S32 direction) setControlFlags(AGENT_CONTROL_UP_NEG | AGENT_CONTROL_FAST_UP); } - resetView(); + gAgentCamera.resetView(); } //----------------------------------------------------------------------------- @@ -682,7 +418,7 @@ void LLAgent::moveUp(S32 direction) //----------------------------------------------------------------------------- void LLAgent::moveYaw(F32 mag, bool reset_view) { - mYawKey = mag; + gAgentCamera.setYawKey(mag); if (mag > 0) { @@ -695,7 +431,7 @@ void LLAgent::moveYaw(F32 mag, bool reset_view) if (reset_view) { - resetView(); + gAgentCamera.resetView(); } } @@ -704,7 +440,7 @@ void LLAgent::moveYaw(F32 mag, bool reset_view) //----------------------------------------------------------------------------- void LLAgent::movePitch(F32 mag) { - mPitchKey = mag; + gAgentCamera.setPitchKey(mag); if (mag > 0) { @@ -747,20 +483,20 @@ BOOL LLAgent::getFlying() const //----------------------------------------------------------------------------- void LLAgent::setFlying(BOOL fly) { - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { // *HACK: Don't allow to start the flying mode if we got ANIM_AGENT_STANDUP signal // because in this case we won't get a signal to start avatar flying animation and // it will be walking with flying mode "ON" indication. However we allow to switch // the flying mode off if we get ANIM_AGENT_STANDUP signal. See process_avatar_animation(). // See EXT-2781. - if(fly && mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != mAvatarObject->mSignaledAnimations.end()) + if(fly && gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != gAgentAvatarp->mSignaledAnimations.end()) { return; } // don't allow taking off while sitting - if (fly && mAvatarObject->isSitting()) + if (fly && gAgentAvatarp->isSitting()) { return; } @@ -806,16 +542,16 @@ void LLAgent::toggleFlying() BOOL fly = !gAgent.getFlying(); gAgent.setFlying( fly ); - gAgent.resetView(); + gAgentCamera.resetView(); } // static bool LLAgent::enableFlying() { BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - sitting = gAgent.getAvatarObject()->isSitting(); + sitting = gAgentAvatarp->isSitting(); } return !sitting; } @@ -985,9 +721,9 @@ void LLAgent::sendReliableMessage() //----------------------------------------------------------------------------- LLVector3 LLAgent::getVelocity() const { - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { - return mAvatarObject->getVelocity(); + return gAgentAvatarp->getVelocity(); } else { @@ -1006,13 +742,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent) llerrs << "setPositionAgent is not a number" << llendl; } - if (mAvatarObject.notNull() && mAvatarObject->getParent()) + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) { LLVector3 pos_agent_sitting; LLVector3d pos_agent_d; - LLViewerObject *parent = (LLViewerObject*)mAvatarObject->getParent(); + LLViewerObject *parent = (LLViewerObject*)gAgentAvatarp->getParent(); - pos_agent_sitting = mAvatarObject->getPosition() * parent->getRotation() + parent->getPositionAgent(); + pos_agent_sitting = gAgentAvatarp->getPosition() * parent->getRotation() + parent->getPositionAgent(); pos_agent_d.setVec(pos_agent_sitting); mFrameAgent.setOrigin(pos_agent_sitting); @@ -1029,24 +765,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent) } //----------------------------------------------------------------------------- -// slamLookAt() -//----------------------------------------------------------------------------- -void LLAgent::slamLookAt(const LLVector3 &look_at) -{ - LLVector3 look_at_norm = look_at; - look_at_norm.mV[VZ] = 0.f; - look_at_norm.normalize(); - resetAxes(look_at_norm); -} - -//----------------------------------------------------------------------------- // getPositionGlobal() //----------------------------------------------------------------------------- const LLVector3d &LLAgent::getPositionGlobal() const { - if (mAvatarObject.notNull() && !mAvatarObject->mDrawable.isNull()) + if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull()) { - mPositionGlobal = getPosGlobalFromAgent(mAvatarObject->getRenderPosition()); + mPositionGlobal = getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition()); } else { @@ -1061,9 +786,9 @@ const LLVector3d &LLAgent::getPositionGlobal() const //----------------------------------------------------------------------------- const LLVector3 &LLAgent::getPositionAgent() { - if(mAvatarObject.notNull() && !mAvatarObject->mDrawable.isNull()) + if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull()) { - mFrameAgent.setOrigin(mAvatarObject->getRenderPosition()); + mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition()); } return mFrameAgent.getOrigin(); @@ -1189,21 +914,21 @@ LLVector3 LLAgent::getReferenceUpVector() { // this vector is in the coordinate frame of the avatar's parent object, or the world if none LLVector3 up_vector = LLVector3::z_axis; - if (mAvatarObject.notNull() && - mAvatarObject->getParent() && - mAvatarObject->mDrawable.notNull()) + if (isAgentAvatarValid() && + gAgentAvatarp->getParent() && + gAgentAvatarp->mDrawable.notNull()) { - U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; + U32 camera_mode = gAgentCamera.getCameraAnimating() ? gAgentCamera.getLastCameraMode() : gAgentCamera.getCameraMode(); // and in third person... if (camera_mode == CAMERA_MODE_THIRD_PERSON) { // make the up vector point to the absolute +z axis - up_vector = up_vector * ~((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); + up_vector = up_vector * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); } else if (camera_mode == CAMERA_MODE_MOUSELOOK) { // make the up vector point to the avatar's +z axis - up_vector = up_vector * mAvatarObject->mDrawable->getRotation(); + up_vector = up_vector * gAgentAvatarp->mDrawable->getRotation(); } } @@ -1239,7 +964,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle) F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward ); - if (mAvatarObject.notNull() && mAvatarObject->isSitting()) + if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) { look_down_limit = 130.f * DEG_TO_RAD; } @@ -1292,736 +1017,11 @@ LLQuaternion LLAgent::getQuat() const return mFrameAgent.getQuaternion(); } - -//----------------------------------------------------------------------------- -// calcFocusOffset() -//----------------------------------------------------------------------------- -LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, LLVector3 original_focus_point, S32 x, S32 y) -{ - LLMatrix4 obj_matrix = object->getRenderMatrix(); - LLQuaternion obj_rot = object->getRenderRotation(); - LLVector3 obj_pos = object->getRenderPosition(); - - BOOL is_avatar = object->isAvatar(); - // if is avatar - don't do any funk heuristics to position the focal point - // see DEV-30589 - if (is_avatar) - { - return original_focus_point - obj_pos; - } - - - LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation - LLVector3 object_extents = object->getScale(); - // make sure they object extents are non-zero - object_extents.clamp(0.001f, F32_MAX); - - // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object - LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin(); - obj_to_cam_ray.rotVec(inv_obj_rot); - obj_to_cam_ray.normalize(); - - // obj_to_cam_ray_proportions are the (positive) ratios of - // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions. - LLVector3 obj_to_cam_ray_proportions; - obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]); - obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]); - obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]); - - // find the largest ratio stored in obj_to_cam_ray_proportions - // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera - LLVector3 longest_object_axis; - // is x-axis longest? - if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY] - && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ]) - { - // then grab it - longest_object_axis.setVec(obj_matrix.getFwdRow4()); - } - // is y-axis longest? - else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ]) - { - // then grab it - longest_object_axis.setVec(obj_matrix.getLeftRow4()); - } - // otherwise, use z axis - else - { - longest_object_axis.setVec(obj_matrix.getUpRow4()); - } - - // Use this axis as the normal to project mouse click on to plane with that normal, at the object center. - // This generates a point behind the mouse cursor that is approximately in the middle of the object in - // terms of depth. - // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera. - // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable - // eccentricity to the object orientation - LLVector3 focus_plane_normal(longest_object_axis); - focus_plane_normal.normalize(); - - LLVector3d focus_pt_global; - gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal); - LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global); - - // find vector from camera to focus point in object space - LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin(); - camera_to_focus_vec.rotVec(inv_obj_rot); - - // find vector from object origin to focus point in object coordinates - LLVector3 focus_offset_from_object_center = focus_pt - obj_pos; - // convert to object-local space - focus_offset_from_object_center.rotVec(inv_obj_rot); - - // We need to project the focus point back into the bounding box of the focused object. - // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis - LLVector3 clip_fraction; - - // for each axis... - for (U32 axis = VX; axis <= VZ; axis++) - { - //...calculate distance that focus offset sits outside of bounding box along that axis... - //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center - F32 dist_out_of_bounds; - if (focus_offset_from_object_center.mV[axis] > 0.f) - { - dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f)); - } - else - { - dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f)); - } - - //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis - if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f) - { - // don't divide by very small number - clip_fraction.mV[axis] = 0.f; - } - else - { - clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis]; - } - } - - LLVector3 abs_clip_fraction = clip_fraction; - abs_clip_fraction.abs(); - - // find axis of focus offset that is *most* outside the bounding box and use that to - // rescale focus offset to inside object extents - if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY] - && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ]) - { - focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec; - } - else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ]) - { - focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec; - } - else - { - focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec; - } - - // convert back to world space - focus_offset_from_object_center.rotVec(obj_rot); - - // now, based on distance of camera from object relative to object size - // push the focus point towards the near surface of the object when (relatively) close to the objcet - // or keep the focus point in the object middle when (relatively) far - // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars - // is almost always "tumble about middle" and not "spin around surface point" - if (!is_avatar) - { - LLVector3 obj_rel = original_focus_point - object->getRenderPosition(); - - //now that we have the object relative position, we should bias toward the center of the object - //based on the distance of the camera to the focus point vs. the distance of the camera to the focus - - F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis()); - F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin()); - - - LLBBox obj_bbox = object->getBoundingBoxAgent(); - F32 bias = 0.f; - - // virtual_camera_pos is the camera position we are simulating by backing the camera off - // and adjusting the FOV - LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor)); - - // if the camera is inside the object (large, hollow objects, for example) - // leave focus point all the way to destination depth, away from object center - if(!obj_bbox.containsPointAgent(virtual_camera_pos)) - { - // perform magic number biasing of focus point towards surface vs. planar center - bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f); - obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias); - } - - focus_offset_from_object_center = obj_rel; - } - - return focus_offset_from_object_center; -} - -//----------------------------------------------------------------------------- -// calcCameraMinDistance() -//----------------------------------------------------------------------------- -BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) -{ - BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) - - if (!mFocusObject || mFocusObject->isDead()) - { - obj_min_distance = 0.f; - return TRUE; - } - - if (mFocusObject->mDrawable.isNull()) - { -#ifdef LL_RELEASE_FOR_DOWNLOAD - llwarns << "Focus object with no drawable!" << llendl; -#else - mFocusObject->dump(); - llerrs << "Focus object with no drawable!" << llendl; -#endif - obj_min_distance = 0.f; - return TRUE; - } - - LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation(); - LLVector3 target_offset_origin = mFocusObjectOffset; - LLVector3 camera_offset_target(getCameraPositionAgent() - getPosAgentFromGlobal(mFocusTargetGlobal)); - - // convert offsets into object local space - camera_offset_target.rotVec(inv_object_rot); - target_offset_origin.rotVec(inv_object_rot); - - // push around object extents based on target offset - LLVector3 object_extents = mFocusObject->getScale(); - if (mFocusObject->isAvatar()) - { - // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom) - object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR; - object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR; - object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR; - soft_limit = TRUE; - } - LLVector3 abs_target_offset = target_offset_origin; - abs_target_offset.abs(); - - LLVector3 target_offset_dir = target_offset_origin; - F32 object_radius = mFocusObject->getVObjRadius(); - - BOOL target_outside_object_extents = FALSE; - - for (U32 i = VX; i <= VZ; i++) - { - if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING) - { - target_outside_object_extents = TRUE; - } - if (camera_offset_target.mV[i] > 0.f) - { - object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f; - } - else - { - object_extents.mV[i] += target_offset_origin.mV[i] * 2.f; - } - } - - // don't shrink the object extents so far that the object inverts - object_extents.clamp(0.001f, F32_MAX); - - // move into first octant - LLVector3 camera_offset_target_abs_norm = camera_offset_target; - camera_offset_target_abs_norm.abs(); - // make sure offset is non-zero - camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); - camera_offset_target_abs_norm.normalize(); - - // find camera position relative to normalized object extents - LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; - camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX]; - camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY]; - camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ]; - - if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] && - camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ]) - { - if (camera_offset_target_abs_norm.mV[VX] < 0.001f) - { - obj_min_distance = object_extents.mV[VX] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX]; - } - } - else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ]) - { - if (camera_offset_target_abs_norm.mV[VY] < 0.001f) - { - obj_min_distance = object_extents.mV[VY] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY]; - } - } - else - { - if (camera_offset_target_abs_norm.mV[VZ] < 0.001f) - { - obj_min_distance = object_extents.mV[VZ] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ]; - } - } - - LLVector3 object_split_axis; - LLVector3 target_offset_scaled = target_offset_origin; - target_offset_scaled.abs(); - target_offset_scaled.normalize(); - target_offset_scaled.mV[VX] /= object_extents.mV[VX]; - target_offset_scaled.mV[VY] /= object_extents.mV[VY]; - target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; - - if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] && - target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ]) - { - object_split_axis = LLVector3::x_axis; - } - else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ]) - { - object_split_axis = LLVector3::y_axis; - } - else - { - object_split_axis = LLVector3::z_axis; - } - - 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; - - // target has moved outside of object extents - // check to see if camera and target are on same side - if (target_outside_object_extents) - { - if (camera_offset_clip > 0.f && target_offset_clip > 0.f) - { - return FALSE; - } - else if (camera_offset_clip < 0.f && target_offset_clip < 0.f) - { - return FALSE; - } - } - - // clamp obj distance to diagonal of 10 by 10 cube - obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3); - - obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); - - return TRUE; -} - -F32 LLAgent::getCameraZoomFraction() -{ - // 0.f -> camera zoomed all the way out - // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // already [0,1] - return mHUDTargetZoom; - } - else if (mFocusOnAvatar && cameraThirdPerson()) - { - return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); - } - else if (cameraCustomizeAvatar()) - { - F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); - return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f ); - } - else - { - F32 min_zoom; - const F32 DIST_FUDGE = 16.f; // meters - F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, - MAX_CAMERA_DISTANCE_FROM_AGENT); - - F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - else - { - min_zoom = LAND_MIN_ZOOM; - } - - return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f); - } -} - -void LLAgent::setCameraZoomFraction(F32 fraction) -{ - // 0.f -> camera zoomed all the way out - // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - mHUDTargetZoom = fraction; - } - else if (mFocusOnAvatar && cameraThirdPerson()) - { - mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); - } - else if (cameraCustomizeAvatar()) - { - LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normalize(); - mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); - } - else - { - F32 min_zoom = LAND_MIN_ZOOM; - const F32 DIST_FUDGE = 16.f; // meters - F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, - MAX_CAMERA_DISTANCE_FROM_AGENT); - - if (mFocusObject.notNull()) - { - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - } - - LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normalize(); - mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); - } - startCameraAnimation(); -} - - -//----------------------------------------------------------------------------- -// cameraOrbitAround() -//----------------------------------------------------------------------------- -void LLAgent::cameraOrbitAround(const F32 radians) -{ - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // do nothing for hud selection - } - else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW)) - { - mFrameAgent.rotate(radians, getReferenceUpVector()); - } - else - { - mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); - - cameraZoomIn(1.f); - } -} - - -//----------------------------------------------------------------------------- -// cameraOrbitOver() -//----------------------------------------------------------------------------- -void LLAgent::cameraOrbitOver(const F32 angle) -{ - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // do nothing for hud selection - } - else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - pitch(angle); - } - else - { - LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); - camera_offset_unit.normalize(); - - F32 angle_from_up = acos( camera_offset_unit * getReferenceUpVector() ); - - LLVector3d left_axis; - left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); - F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); - mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); - - cameraZoomIn(1.f); - } -} - -//----------------------------------------------------------------------------- -// cameraZoomIn() -//----------------------------------------------------------------------------- -void LLAgent::cameraZoomIn(const F32 fraction) -{ - if (gDisconnected) - { - return; - } - - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // just update hud zoom level - mHUDTargetZoom /= fraction; - return; - } - - - LLVector3d camera_offset(mCameraFocusOffsetTarget); - LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 min_zoom = LAND_MIN_ZOOM; - F32 current_distance = (F32)camera_offset_unit.normalize(); - F32 new_distance = current_distance * fraction; - - // Don't move through focus point - if (mFocusObject) - { - LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); - - if (mFocusObject->isAvatar()) - { - calcCameraMinDistance(min_zoom); - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - - new_distance = llmax(new_distance, min_zoom); - - // Don't zoom too far back - const F32 DIST_FUDGE = 16.f; // meters - F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); - - if (new_distance > max_distance) - { - new_distance = max_distance; - - /* - // Unless camera is unlocked - if (!LLViewerCamera::sDisableCameraConstraints) - { - return; - } - */ - } - - if( cameraCustomizeAvatar() ) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - - mCameraFocusOffsetTarget = new_distance * camera_offset_unit; -} - -//----------------------------------------------------------------------------- -// cameraOrbitIn() -//----------------------------------------------------------------------------- -void LLAgent::cameraOrbitIn(const F32 meters) -{ - if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale")); - - mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; - - if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) - { - // No need to animate, camera is already there. - changeCameraToMouselook(FALSE); - } - - mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION); - } - else - { - LLVector3d camera_offset(mCameraFocusOffsetTarget); - LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 current_distance = (F32)camera_offset_unit.normalize(); - F32 new_distance = current_distance - meters; - F32 min_zoom = LAND_MIN_ZOOM; - - // Don't move through focus point - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - - new_distance = llmax(new_distance, min_zoom); - - // Don't zoom too far back - const F32 DIST_FUDGE = 16.f; // meters - F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); - - if (new_distance > max_distance) - { - // Unless camera is unlocked - if (!gSavedSettings.getBOOL("DisableCameraConstraints")) - { - return; - } - } - - if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - - // Compute new camera offset - mCameraFocusOffsetTarget = new_distance * camera_offset_unit; - cameraZoomIn(1.f); - } -} - - -//----------------------------------------------------------------------------- -// cameraPanIn() -//----------------------------------------------------------------------------- -void LLAgent::cameraPanIn(F32 meters) -{ - LLVector3d at_axis; - at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); - - mFocusTargetGlobal += meters * at_axis; - mFocusGlobal = mFocusTargetGlobal; - // don't enforce zoom constraints as this is the only way for users to get past them easily - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); -} - -//----------------------------------------------------------------------------- -// cameraPanLeft() -//----------------------------------------------------------------------------- -void LLAgent::cameraPanLeft(F32 meters) -{ - LLVector3d left_axis; - left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); - - mFocusTargetGlobal += meters * left_axis; - mFocusGlobal = mFocusTargetGlobal; - - // disable smoothing for camera pan, which causes some residents unhappiness - mCameraSmoothingStop = TRUE; - - cameraZoomIn(1.f); - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); -} - -//----------------------------------------------------------------------------- -// cameraPanUp() -//----------------------------------------------------------------------------- -void LLAgent::cameraPanUp(F32 meters) -{ - LLVector3d up_axis; - up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); - - mFocusTargetGlobal += meters * up_axis; - mFocusGlobal = mFocusTargetGlobal; - - // disable smoothing for camera pan, which causes some residents unhappiness - mCameraSmoothingStop = TRUE; - - cameraZoomIn(1.f); - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); -} - -//----------------------------------------------------------------------------- -// setKey() -//----------------------------------------------------------------------------- -void LLAgent::setKey(const S32 direction, S32 &key) -{ - if (direction > 0) - { - key = 1; - } - else if (direction < 0) - { - key = -1; - } - else - { - key = 0; - } -} - - //----------------------------------------------------------------------------- // getControlFlags() //----------------------------------------------------------------------------- U32 LLAgent::getControlFlags() { -/* - // HACK -- avoids maintenance of control flags when camera mode is turned on or off, - // only worries about it when the flags are measured - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - if ( !(mControlFlags & AGENT_CONTROL_MOUSELOOK) ) - { - mControlFlags |= AGENT_CONTROL_MOUSELOOK; - } - } -*/ return mControlFlags; } @@ -2117,10 +1117,9 @@ void LLAgent::clearAFK() // Gods can sometimes get into away state (via gestures) // without setting the appropriate control flag. JC - LLVOAvatar* av = mAvatarObject; if (mControlFlags & AGENT_CONTROL_AWAY - || (av - && (av->mSignaledAnimations.find(ANIM_AGENT_AWAY) != av->mSignaledAnimations.end()))) + || (isAgentAvatarValid() + && (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatarp->mSignaledAnimations.end()))) { sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP); clearControlFlags(AGENT_CONTROL_AWAY); @@ -2181,7 +1180,7 @@ BOOL LLAgent::getBusy() const //----------------------------------------------------------------------------- void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold) { - if (!gAgent.getAvatarObject()) + if (!isAgentAvatarValid()) { return; } @@ -2242,7 +1241,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s LLViewerObject *obj; LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj); - F64 target_height = llmax((F64)gAgent.getAvatarObject()->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]); + F64 target_height = llmax((F64)gAgentAvatarp->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]); // clamp z value of target to minimum height above ground mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height; @@ -2342,12 +1341,9 @@ void LLAgent::autoPilot(F32 *delta_yaw) mAutoPilotTargetGlobal = object->getPositionGlobal(); } - if (mAvatarObject.isNull()) - { - return; - } + if (!isAgentAvatarValid()) return; - if (mAvatarObject->mInAir) + if (gAgentAvatarp->mInAir) { setFlying(TRUE); } @@ -2423,9 +1419,9 @@ void LLAgent::autoPilot(F32 *delta_yaw) // If we're flying, handle autopilot points above or below you. if (getFlying() && xy_distance < AUTOPILOT_HEIGHT_ADJUST_DISTANCE) { - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { - F64 current_height = mAvatarObject->getPositionGlobal().mdV[VZ]; + F64 current_height = gAgentAvatarp->getPositionGlobal().mdV[VZ]; F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height); F32 slope = delta_z / xy_distance; if (slope > 0.45f && delta_z > 6.f) @@ -2490,30 +1486,30 @@ void LLAgent::propagate(const F32 dt) LLFloaterMove *floater_move = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview"); if (floater_move) { - floater_move->mForwardButton ->setToggleState( mAtKey > 0 || mWalkKey > 0 ); - floater_move->mBackwardButton ->setToggleState( mAtKey < 0 || mWalkKey < 0 ); - floater_move->mTurnLeftButton ->setToggleState( mYawKey > 0.f ); - floater_move->mTurnRightButton ->setToggleState( mYawKey < 0.f ); - floater_move->mMoveUpButton ->setToggleState( mUpKey > 0 ); - floater_move->mMoveDownButton ->setToggleState( mUpKey < 0 ); + floater_move->mForwardButton ->setToggleState( gAgentCamera.getAtKey() > 0 || gAgentCamera.getWalkKey() > 0 ); + floater_move->mBackwardButton ->setToggleState( gAgentCamera.getAtKey() < 0 || gAgentCamera.getWalkKey() < 0 ); + floater_move->mTurnLeftButton ->setToggleState( gAgentCamera.getYawKey() > 0.f ); + floater_move->mTurnRightButton ->setToggleState( gAgentCamera.getYawKey() < 0.f ); + floater_move->mMoveUpButton ->setToggleState( gAgentCamera.getUpKey() > 0 ); + floater_move->mMoveDownButton ->setToggleState( gAgentCamera.getUpKey() < 0 ); } // handle rotation based on keyboard levels const F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second - yaw(YAW_RATE * mYawKey * dt); + yaw(YAW_RATE * gAgentCamera.getYawKey() * dt); const F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second - pitch(PITCH_RATE * mPitchKey * dt); + pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt); // handle auto-land behavior - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { - BOOL in_air = mAvatarObject->mInAir; + BOOL in_air = gAgentAvatarp->mInAir; LLVector3 land_vel = getVelocity(); land_vel.mV[VZ] = 0.f; if (!in_air - && mUpKey < 0 + && gAgentCamera.getUpKey() < 0 && land_vel.magVecSquared() < MAX_VELOCITY_AUTO_LAND_SQUARED && gSavedSettings.getBOOL("AutomaticFly")) { @@ -2522,13 +1518,7 @@ void LLAgent::propagate(const F32 dt) } } - // clear keys - mAtKey = 0; - mWalkKey = 0; - mLeftKey = 0; - mUpKey = 0; - mYawKey = 0.f; - mPitchKey = 0.f; + gAgentCamera.clearGeneralKeys(); } //----------------------------------------------------------------------------- @@ -2546,79 +1536,7 @@ void LLAgent::updateAgentPosition(const F32 dt, const F32 yaw_radians, const S32 // Check for water and land collision, set underwater flag // - updateLookAt(mouse_x, mouse_y); -} - -//----------------------------------------------------------------------------- -// updateLookAt() -//----------------------------------------------------------------------------- -void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y) -{ - static LLVector3 last_at_axis; - - - if (mAvatarObject.isNull()) - { - return; - } - - LLQuaternion av_inv_rot = ~mAvatarObject->mRoot.getWorldRotation(); - LLVector3 root_at = LLVector3::x_axis * mAvatarObject->mRoot.getWorldRotation(); - - if ((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) && - (root_at * last_at_axis > 0.95f )) - { - LLVector3 vel = mAvatarObject->getVelocity(); - if (vel.magVecSquared() > 4.f) - { - setLookAt(LOOKAT_TARGET_IDLE, mAvatarObject, vel * av_inv_rot); - } - else - { - // *FIX: rotate mframeagent by sit object's rotation? - LLQuaternion look_rotation = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); // use camera's current rotation - LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; - setLookAt(LOOKAT_TARGET_IDLE, mAvatarObject, look_offset); - } - last_at_axis = root_at; - return; - } - - last_at_axis = root_at; - - if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode()) - { - setLookAt(LOOKAT_TARGET_NONE, mAvatarObject, LLVector3(-2.f, 0.f, 0.f)); - } - else - { - // Move head based on cursor position - ELookAtType lookAtType = LOOKAT_TARGET_NONE; - LLVector3 headLookAxis; - LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); - - if (cameraMouselook()) - { - lookAtType = LOOKAT_TARGET_MOUSELOOK; - } - else if (cameraThirdPerson()) - { - // range from -.5 to .5 - F32 x_from_center = - ((F32) mouse_x / (F32) gViewerWindow->getWindowWidthScaled() ) - 0.5f; - F32 y_from_center = - ((F32) mouse_y / (F32) gViewerWindow->getWindowHeightScaled() ) - 0.5f; - - frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); - frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); - lookAtType = LOOKAT_TARGET_FREELOOK; - } - - headLookAxis = frameCamera.getAtAxis(); - // RN: we use world-space offset for mouselook and freelook - //headLookAxis = headLookAxis * av_inv_rot; - setLookAt(lookAtType, mAvatarObject, headLookAxis); - } + gAgentCamera.updateLookAt(mouse_x, mouse_y); } // friends and operators @@ -2633,44 +1551,6 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent) return s; } - -// ------------------- Beginning of legacy LLCamera hack ---------------------- -// This section is included for legacy LLCamera support until -// it is no longer needed. Some legacy code must exist in -// non-legacy functions, and is labeled with "// legacy" comments. - -//----------------------------------------------------------------------------- -// setAvatarObject() -//----------------------------------------------------------------------------- -void LLAgent::setAvatarObject(LLVOAvatarSelf *avatar) -{ - mAvatarObject = avatar; - - if (!avatar) - { - llinfos << "Setting LLAgent::mAvatarObject to NULL" << llendl; - return; - } - - if (!mLookAt) - { - mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); - } - if (!mPointAt) - { - mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); - } - - if (!mLookAt.isNull()) - { - mLookAt->setSourceObject(avatar); - } - if (!mPointAt.isNull()) - { - mPointAt->setSourceObject(avatar); - } -} - // TRUE if your own avatar needs to be rendered. Usually only // in third person and build. //----------------------------------------------------------------------------- @@ -2678,7 +1558,7 @@ void LLAgent::setAvatarObject(LLVOAvatarSelf *avatar) //----------------------------------------------------------------------------- BOOL LLAgent::needsRenderAvatar() { - if (cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) + if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) { return FALSE; } @@ -2689,7 +1569,7 @@ BOOL LLAgent::needsRenderAvatar() // TRUE if we need to render your own avatar's head. BOOL LLAgent::needsRenderHead() { - return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !cameraMouselook()); + return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook()); } //----------------------------------------------------------------------------- @@ -2711,7 +1591,7 @@ void LLAgent::startTyping() LLViewerObject* chatter = gObjectList.findObject(mLastChatterID); if (chatter && chatter->isAvatar()) { - gAgent.setLookAt(LOOKAT_TARGET_RESPOND, chatter, LLVector3::zero); + gAgentCamera.setLookAt(LOOKAT_TARGET_RESPOND, chatter, LLVector3::zero); } } @@ -2790,14 +1670,14 @@ U8 LLAgent::getRenderState() //----------------------------------------------------------------------------- void LLAgent::endAnimationUpdateUI() { - if (mCameraMode == mLastCameraMode) + if (gAgentCamera.getCameraMode() == gAgentCamera.getLastCameraMode()) { // We're already done endAnimationUpdateUI for this transition. return; } // clean up UI from mode we're leaving - if ( mLastCameraMode == CAMERA_MODE_MOUSELOOK ) + if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_MOUSELOOK ) { // show mouse cursor gViewerWindow->showCursor(); @@ -2835,33 +1715,33 @@ void LLAgent::endAnimationUpdateUI() } - gAgent.setLookAt(LOOKAT_TARGET_CLEAR); + gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); if( gMorphView ) { gMorphView->setVisible( FALSE ); } // Disable mouselook-specific animations - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { - if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) ) + if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) ) { - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_START); } - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_START); } - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_START); } - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_START); @@ -2869,8 +1749,7 @@ void LLAgent::endAnimationUpdateUI() } } } - else - if( mLastCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR ) + else if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) { // make sure we ask to save changes @@ -2881,7 +1760,7 @@ void LLAgent::endAnimationUpdateUI() gMorphView->setVisible( FALSE ); } - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { if(mCustomAnim) { @@ -2892,13 +1771,13 @@ void LLAgent::endAnimationUpdateUI() } } - setLookAt(LOOKAT_TARGET_CLEAR); + gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); } //--------------------------------------------------------------------- // Set up UI for mode we're entering //--------------------------------------------------------------------- - if (mCameraMode == CAMERA_MODE_MOUSELOOK) + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { // hide menus gMenuBarView->setVisible(FALSE); @@ -2913,7 +1792,7 @@ void LLAgent::endAnimationUpdateUI() LLPanelStandStopFlying::getInstance()->setVisible(FALSE); // clear out camera lag effect - mCameraLag.clearVec(); + gAgentCamera.clearCameraLag(); // JC - Added for always chat in third person option gFocusMgr.setKeyboardFocus(NULL); @@ -2941,49 +1820,49 @@ void LLAgent::endAnimationUpdateUI() gConsole->setVisible( TRUE ); - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { // Trigger mouselook-specific animations - if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) ) + if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) ) { - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_START); } - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_START); } - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_START); } - if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != mAvatarObject->mSignaledAnimations.end()) + if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != gAgentAvatarp->mSignaledAnimations.end()) { sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_START); } } - if (mAvatarObject->getParent()) + if (gAgentAvatarp->getParent()) { LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); - LLViewerObject* root_object = (LLViewerObject*)mAvatarObject->getRoot(); + LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot(); if (root_object->flagCameraDecoupled()) { resetAxes(at_axis); } else { - resetAxes(at_axis * ~((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation()); + resetAxes(at_axis * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation()); } } } } - else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) + else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) { LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); @@ -2993,1588 +1872,22 @@ void LLAgent::endAnimationUpdateUI() } // freeze avatar - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { - mPauseRequest = mAvatarObject->requestPause(); + mPauseRequest = gAgentAvatarp->requestPause(); } } - if (getAvatarObject()) + if (isAgentAvatarValid()) { - getAvatarObject()->updateAttachmentVisibility(mCameraMode); + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); } gFloaterTools->dirty(); // Don't let this be called more than once if the camera // mode hasn't changed. --JC - mLastCameraMode = mCameraMode; - -} - - -//----------------------------------------------------------------------------- -// updateCamera() -//----------------------------------------------------------------------------- -void LLAgent::updateCamera() -{ - static LLFastTimer::DeclareTimer ftm("Camera"); - LLFastTimer t(ftm); - - //Ventrella - changed camera_skyward to the new global "mCameraUpVector" - mCameraUpVector = LLVector3::z_axis; - //LLVector3 camera_skyward(0.f, 0.f, 1.f); - //end Ventrella - - U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; - - validateFocusObject(); - - if (mAvatarObject.notNull() && - mAvatarObject->isSitting() && - camera_mode == CAMERA_MODE_MOUSELOOK) - { - //Ventrella - //changed camera_skyward to the new global "mCameraUpVector" - mCameraUpVector = mCameraUpVector * mAvatarObject->getRenderRotation(); - //end Ventrella - } - - if (cameraThirdPerson() && mFocusOnAvatar && LLFollowCamMgr::getActiveFollowCamParams()) - { - changeCameraToFollow(); - } - - //Ventrella - //NOTE - this needs to be integrated into a general upVector system here within llAgent. - if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) - { - mCameraUpVector = mFollowCam.getUpVector(); - } - //end Ventrella - - if (mSitCameraEnabled) - { - if (mSitCameraReferenceObject->isDead()) - { - setSitCamera(LLUUID::null); - } - } - - // Update UI with our camera inputs - LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera"); - if (camera_floater) - { - camera_floater->mRotate->setToggleState( - mOrbitRightKey > 0.f, // left - mOrbitUpKey > 0.f, // top - mOrbitLeftKey > 0.f, // right - mOrbitDownKey > 0.f); // bottom - - camera_floater->mTrack->setToggleState( - mPanLeftKey > 0.f, // left - mPanUpKey > 0.f, // top - mPanRightKey > 0.f, // right - mPanDownKey > 0.f); // bottom - } - - // Handle camera movement based on keyboard. - const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second - const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second - const F32 PAN_RATE = 5.f; // meters per second - - if( mOrbitUpKey || mOrbitDownKey ) - { - F32 input_rate = mOrbitUpKey - mOrbitDownKey; - cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped ); - } - - if( mOrbitLeftKey || mOrbitRightKey) - { - F32 input_rate = mOrbitLeftKey - mOrbitRightKey; - cameraOrbitAround( input_rate * ORBIT_AROUND_RATE / gFPSClamped ); - } - - if( mOrbitInKey || mOrbitOutKey ) - { - F32 input_rate = mOrbitInKey - mOrbitOutKey; - - LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal(); - F32 distance_to_focus = (F32)to_focus.magVec(); - // Move at distance (in meters) meters per second - cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped ); - } - - if( mPanInKey || mPanOutKey ) - { - F32 input_rate = mPanInKey - mPanOutKey; - cameraPanIn( input_rate * PAN_RATE / gFPSClamped ); - } - - if( mPanRightKey || mPanLeftKey ) - { - F32 input_rate = mPanRightKey - mPanLeftKey; - cameraPanLeft( input_rate * -PAN_RATE / gFPSClamped ); - } - - if( mPanUpKey || mPanDownKey ) - { - F32 input_rate = mPanUpKey - mPanDownKey; - cameraPanUp( input_rate * PAN_RATE / gFPSClamped ); - } - - // Clear camera keyboard keys. - mOrbitLeftKey = 0.f; - mOrbitRightKey = 0.f; - mOrbitUpKey = 0.f; - mOrbitDownKey = 0.f; - mOrbitInKey = 0.f; - mOrbitOutKey = 0.f; - - mPanRightKey = 0.f; - mPanLeftKey = 0.f; - mPanUpKey = 0.f; - mPanDownKey = 0.f; - mPanInKey = 0.f; - mPanOutKey = 0.f; - - // lerp camera focus offset - mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); - - //Ventrella - if ( mCameraMode == CAMERA_MODE_FOLLOW ) - { - if ( mAvatarObject.notNull() ) - { - //-------------------------------------------------------------------------------- - // this is where the avatar's position and rotation are given to followCam, and - // where it is updated. All three of its attributes are updated: (1) position, - // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. - //-------------------------------------------------------------------------------- - // *TODO: use combined rotation of frameagent and sit object - LLQuaternion avatarRotationForFollowCam = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); - - LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); - if (current_cam) - { - mFollowCam.copyParams(*current_cam); - mFollowCam.setSubjectPositionAndRotation( mAvatarObject->getRenderPosition(), avatarRotationForFollowCam ); - mFollowCam.update(); - LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); - } - else - { - changeCameraToThirdPerson(TRUE); - } - } - } - // end Ventrella - - BOOL hit_limit; - LLVector3d camera_pos_global; - LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit); - mCameraVirtualPositionAgent = getPosAgentFromGlobal(camera_target_global); - LLVector3d focus_target_global = calcFocusPositionTargetGlobal(); - - // perform field of view correction - mCameraFOVZoomFactor = calcCameraFOVZoomFactor(); - camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor); - - mShowAvatar = TRUE; // can see avatar by default - - // Adjust position for animation - if (mCameraAnimating) - { - F32 time = mAnimationTimer.getElapsedTimeF32(); - - // yet another instance of critically damped motion, hooray! - // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE); - - // linear interpolation - F32 fraction_of_animation = time / mAnimationDuration; - - BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; - BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; - F32 fraction_animation_to_skip; - - if (mAnimationCameraStartGlobal == camera_target_global) - { - fraction_animation_to_skip = 0.f; - } - else - { - LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global; - fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec(); - } - F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f; - F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f; - - if (fraction_of_animation < animation_finish_fraction) - { - if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction ) - { - mShowAvatar = FALSE; - } - - // ...adjust position for animation - F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation); - camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation); - mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation); - } - else - { - // ...animation complete - mCameraAnimating = FALSE; - - camera_pos_global = camera_target_global; - mFocusGlobal = focus_target_global; - - endAnimationUpdateUI(); - mShowAvatar = TRUE; - } - - if (getAvatarObject() && mCameraMode != CAMERA_MODE_MOUSELOOK) - { - getAvatarObject()->updateAttachmentVisibility(mCameraMode); - } - } - else - { - camera_pos_global = camera_target_global; - mFocusGlobal = focus_target_global; - mShowAvatar = TRUE; - } - - // smoothing - if (TRUE) - { - LLVector3d agent_pos = getPositionGlobal(); - LLVector3d camera_pos_agent = camera_pos_global - agent_pos; - // Sitting on what you're manipulating can cause camera jitter with smoothing. - // This turns off smoothing while editing. -MG - mCameraSmoothingStop |= (BOOL)LLToolMgr::getInstance()->inBuildMode(); - - if (cameraThirdPerson() && !mCameraSmoothingStop) - { - const F32 SMOOTHING_HALF_LIFE = 0.02f; - - F32 smoothing = LLCriticalDamp::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); - - if (!mFocusObject) // we differentiate on avatar mode - { - // for avatar-relative focus, we smooth in avatar space - - // the avatar moves too jerkily w/r/t global space to smooth there. - - LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent; - if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please - { - camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing); - camera_pos_global = camera_pos_agent + agent_pos; - } - } - else - { - LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal; - if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please - { - camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing); - } - } - } - - mCameraSmoothingLastPositionGlobal = camera_pos_global; - mCameraSmoothingLastPositionAgent = camera_pos_agent; - mCameraSmoothingStop = FALSE; - } - - - mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(FOV_ZOOM_HALF_LIFE)); - -// llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl; - - F32 ui_offset = 0.f; - if( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode ) - { - ui_offset = calcCustomizeAvatarUIOffset( camera_pos_global ); - } - - - LLVector3 focus_agent = getPosAgentFromGlobal(mFocusGlobal); - - mCameraPositionAgent = getPosAgentFromGlobal(camera_pos_global); - - // Move the camera - - //Ventrella - LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); - //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); - //end Ventrella - - //RN: translate UI offset after camera is oriented properly - LLViewerCamera::getInstance()->translate(LLViewerCamera::getInstance()->getLeftAxis() * ui_offset); - - // Change FOV - LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); - - // follow camera when in customize mode - if (cameraCustomizeAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent); - } - - // update the travel distance stat - // this isn't directly related to the camera - // but this seemed like the best place to do this - LLVector3d global_pos = getPositionGlobal(); - if (! mLastPositionGlobal.isExactlyZero()) - { - LLVector3d delta = global_pos - mLastPositionGlobal; - mDistanceTraveled += delta.magVec(); - } - mLastPositionGlobal = global_pos; - - if (LLVOAvatar::sVisibleInFirstPerson && mAvatarObject.notNull() && !mAvatarObject->isSitting() && cameraMouselook()) - { - LLVector3 head_pos = mAvatarObject->mHeadp->getWorldPosition() + - LLVector3(0.08f, 0.f, 0.05f) * mAvatarObject->mHeadp->getWorldRotation() + - LLVector3(0.1f, 0.f, 0.f) * mAvatarObject->mPelvisp->getWorldRotation(); - LLVector3 diff = mCameraPositionAgent - head_pos; - diff = diff * ~mAvatarObject->mRoot.getWorldRotation(); - - LLJoint* torso_joint = mAvatarObject->mTorsop; - LLJoint* chest_joint = mAvatarObject->mChestp; - LLVector3 torso_scale = torso_joint->getScale(); - LLVector3 chest_scale = chest_joint->getScale(); - - // shorten avatar skeleton to avoid foot interpenetration - if (!mAvatarObject->mInAir) - { - LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation(); - F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f); - F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f); - torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); - - LLJoint* neck_joint = mAvatarObject->mNeckp; - LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation(); - scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f); - chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); - diff.mV[VZ] = 0.f; - } - - mAvatarObject->mPelvisp->setPosition(mAvatarObject->mPelvisp->getPosition() + diff); - - mAvatarObject->mRoot.updateWorldMatrixChildren(); - - for (LLVOAvatar::attachment_map_t::iterator iter = mAvatarObject->mAttachmentPoints.begin(); - iter != mAvatarObject->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 && !attached_object->isDead() && attached_object->mDrawable.notNull()) - { - // clear any existing "early" movements of attachment - attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE); - gPipeline.updateMoveNormalAsync(attached_object->mDrawable); - attached_object->updateText(); - } - } - } - - torso_joint->setScale(torso_scale); - chest_joint->setScale(chest_scale); - } -} - -void LLAgent::updateFocusOffset() -{ - validateFocusObject(); - if (mFocusObject.notNull()) - { - LLVector3d obj_pos = getPosGlobalFromAgent(mFocusObject->getRenderPosition()); - mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos); - } -} - -void LLAgent::validateFocusObject() -{ - if (mFocusObject.notNull() && - (mFocusObject->isDead())) - { - mFocusObjectOffset.clearVec(); - clearFocusObject(); - mCameraFOVZoomFactor = 0.f; - } -} - -//----------------------------------------------------------------------------- -// calcCustomizeAvatarUIOffset() -//----------------------------------------------------------------------------- -F32 LLAgent::calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global ) -{ - F32 ui_offset = 0.f; - - if( gFloaterCustomize ) - { - const LLRect& rect = gFloaterCustomize->getRect(); - - // Move the camera so that the avatar isn't covered up by this floater. - F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidthScaled())))); - F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); // radians - F32 offset = tan(apparent_angle); - - if( rect.mLeft < (gViewerWindow->getWindowWidthScaled() - rect.mRight) ) - { - // Move the avatar to the right (camera to the left) - ui_offset = offset; - } - else - { - // Move the avatar to the left (camera to the right) - ui_offset = -offset; - } - } - F32 range = (F32)dist_vec(camera_pos_global, gAgent.getFocusGlobal()); - mUIOffset = lerp(mUIOffset, ui_offset, LLCriticalDamp::getInterpolant(0.05f)); - return mUIOffset * range; -} - -//----------------------------------------------------------------------------- -// calcFocusPositionTargetGlobal() -//----------------------------------------------------------------------------- -LLVector3d LLAgent::calcFocusPositionTargetGlobal() -{ - if (mFocusObject.notNull() && mFocusObject->isDead()) - { - clearFocusObject(); - } - - // Ventrella - if ( mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) - { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus()); - return mFocusTargetGlobal; - }// End Ventrella - else if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - LLVector3d at_axis(1.0, 0.0, 0.0); - LLQuaternion agent_rot = mFrameAgent.getQuaternion(); - if (mAvatarObject.notNull() && mAvatarObject->getParent()) - { - LLViewerObject* root_object = (LLViewerObject*)mAvatarObject->getRoot(); - if (!root_object->flagCameraDecoupled()) - { - agent_rot *= ((LLViewerObject*)(mAvatarObject->getParent()))->getRenderRotation(); - } - } - at_axis = at_axis * agent_rot; - mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis; - return mFocusTargetGlobal; - } - else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) - { - return mFocusTargetGlobal; - } - else if (!mFocusOnAvatar) - { - if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull()) - { - LLDrawable* drawablep = mFocusObject->mDrawable; - - if (mTrackFocusObject && - drawablep && - drawablep->isActive()) - { - if (!mFocusObject->isAvatar()) - { - if (mFocusObject->isSelected()) - { - gPipeline.updateMoveNormalAsync(drawablep); - } - else - { - if (drawablep->isState(LLDrawable::MOVE_UNDAMPED)) - { - gPipeline.updateMoveNormalAsync(drawablep); - } - else - { - gPipeline.updateMoveDampedAsync(drawablep); - } - } - } - } - // if not tracking object, update offset based on new object position - else - { - updateFocusOffset(); - } - LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset; - mFocusTargetGlobal.setVec(getPosGlobalFromAgent(focus_agent)); - } - return mFocusTargetGlobal; - } - else if (mSitCameraEnabled && mAvatarObject.notNull() && mAvatarObject->isSitting() && mSitCameraReferenceObject.notNull()) - { - // sit camera - LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); - LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); - - LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot); - return getPosGlobalFromAgent(target_pos); - } - else - { - return getPositionGlobal() + calcThirdPersonFocusOffset(); - } -} - -LLVector3d LLAgent::calcThirdPersonFocusOffset() -{ - // ...offset from avatar - LLVector3d focus_offset; - - LLQuaternion agent_rot = mFrameAgent.getQuaternion(); - if (!mAvatarObject.isNull() && mAvatarObject->getParent()) - { - agent_rot *= ((LLViewerObject*)(mAvatarObject->getParent()))->getRenderRotation(); - } - - focus_offset = mFocusOffsetInitial[mCameraPreset] * agent_rot; - return focus_offset; -} - -void LLAgent::setupSitCamera() -{ - // agent frame entering this function is in world coordinates - if (mAvatarObject.notNull() && mAvatarObject->getParent()) - { - LLQuaternion parent_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); - // slam agent coordinate frame to proper parent local version - LLVector3 at_axis = mFrameAgent.getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - resetAxes(at_axis * ~parent_rot); - } -} - -//----------------------------------------------------------------------------- -// getCameraPositionAgent() -//----------------------------------------------------------------------------- -const LLVector3 &LLAgent::getCameraPositionAgent() const -{ - return LLViewerCamera::getInstance()->getOrigin(); -} - -//----------------------------------------------------------------------------- -// getCameraPositionGlobal() -//----------------------------------------------------------------------------- -LLVector3d LLAgent::getCameraPositionGlobal() const -{ - return getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); -} - -//----------------------------------------------------------------------------- -// calcCameraFOVZoomFactor() -//----------------------------------------------------------------------------- -F32 LLAgent::calcCameraFOVZoomFactor() -{ - LLVector3 camera_offset_dir; - camera_offset_dir.setVec(mCameraFocusOffset); - - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - return 0.f; - } - 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()); - - mFocusObjectDist = obj_min_dist - current_distance; - - F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f); - return new_fov_zoom; - } - else // focusing on land or avatar - { - // keep old field of view until user changes focus explicitly - return mCameraFOVZoomFactor; - //return 0.f; - } -} - -//----------------------------------------------------------------------------- -// calcCameraPositionTargetGlobal() -//----------------------------------------------------------------------------- -LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) -{ - // Compute base camera position and look-at points. - F32 camera_land_height; - LLVector3d frame_center_global = mAvatarObject.isNull() ? getPositionGlobal() - : getPosGlobalFromAgent(mAvatarObject->mRoot.getWorldPosition()); - - BOOL isConstrained = FALSE; - LLVector3d head_offset; - head_offset.setVec(mThirdPersonHeadOffset); - - LLVector3d camera_position_global; - - // Ventrella - if ( mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) - { - camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition()); - }// End Ventrella - else if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - if (mAvatarObject.isNull() || mAvatarObject->mDrawable.isNull()) - { - llwarns << "Null avatar drawable!" << llendl; - return LLVector3d::zero; - } - head_offset.clearVec(); - if (mAvatarObject->isSitting() && mAvatarObject->getParent()) - { - mAvatarObject->updateHeadOffset(); - head_offset.mdV[VX] = mAvatarObject->mHeadOffset.mV[VX]; - head_offset.mdV[VY] = mAvatarObject->mHeadOffset.mV[VY]; - head_offset.mdV[VZ] = mAvatarObject->mHeadOffset.mV[VZ] + 0.1f; - const LLMatrix4& mat = ((LLViewerObject*) mAvatarObject->getParent())->getRenderMatrix(); - camera_position_global = getPosGlobalFromAgent - ((mAvatarObject->getPosition()+ - LLVector3(head_offset)*mAvatarObject->getRotation()) * mat); - } - else - { - head_offset.mdV[VZ] = mAvatarObject->mHeadOffset.mV[VZ]; - if (mAvatarObject->isSitting()) - { - head_offset.mdV[VZ] += 0.1; - } - camera_position_global = getPosGlobalFromAgent(mAvatarObject->getRenderPosition());//frame_center_global; - head_offset = head_offset * mAvatarObject->getRenderRotation(); - camera_position_global = camera_position_global + head_offset; - } - } - else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar) - { - LLVector3 local_camera_offset; - F32 camera_distance = 0.f; - - if (mSitCameraEnabled - && mAvatarObject.notNull() - && mAvatarObject->isSitting() - && mSitCameraReferenceObject.notNull()) - { - // sit camera - LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); - LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); - - LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot); - - camera_position_global = getPosGlobalFromAgent(target_pos); - } - else - { - local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); - - // are we sitting down? - if (mAvatarObject.notNull() && mAvatarObject->getParent()) - { - LLQuaternion parent_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); - // slam agent coordinate frame to proper parent local version - LLVector3 at_axis = mFrameAgent.getAtAxis() * parent_rot; - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - resetAxes(at_axis * ~parent_rot); - - local_camera_offset = local_camera_offset * mFrameAgent.getQuaternion() * parent_rot; - } - else - { - local_camera_offset = mFrameAgent.rotateToAbsolute( local_camera_offset ); - } - - if (!mCameraCollidePlane.isExactlyZero() && (mAvatarObject.isNull() || !mAvatarObject->isSitting())) - { - LLVector3 plane_normal; - plane_normal.setVec(mCameraCollidePlane.mV); - - F32 offset_dot_norm = local_camera_offset * plane_normal; - if (llabs(offset_dot_norm) < 0.001f) - { - offset_dot_norm = 0.001f; - } - - camera_distance = local_camera_offset.normalize(); - - F32 pos_dot_norm = getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; - - // if agent is outside the colliding half-plane - if (pos_dot_norm > mCameraCollidePlane.mV[VW]) - { - // check to see if camera is on the opposite side (inside) the half-plane - if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW]) - { - // diminish offset by factor to push it back outside the half-plane - camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm; - } - } - else - { - if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW]) - { - camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm; - } - } - } - else - { - camera_distance = local_camera_offset.normalize(); - } - - mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); - - if (mTargetCameraDistance != mCurrentCameraDistance) - { - F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(CAMERA_ZOOM_HALF_LIFE); - - mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); - } - - // Make the camera distance current - local_camera_offset *= mCurrentCameraDistance; - - // set the global camera position - LLVector3d camera_offset; - - LLVector3 av_pos = mAvatarObject.isNull() ? LLVector3::zero : mAvatarObject->getRenderPosition(); - camera_offset.setVec( local_camera_offset ); - camera_position_global = frame_center_global + head_offset + camera_offset; - - if (mAvatarObject.notNull()) - { - LLVector3d camera_lag_d; - F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE); - LLVector3 target_lag; - LLVector3 vel = getVelocity(); - - // lag by appropriate amount for flying - F32 time_in_air = mAvatarObject->mTimeInAir.getElapsedTimeF32(); - if(!mCameraAnimating && mAvatarObject->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) - { - LLVector3 frame_at_axis = mFrameAgent.getAtAxis(); - frame_at_axis -= projected_vec(frame_at_axis, getReferenceUpVector()); - frame_at_axis.normalize(); - - //transition smoothly in air mode, to avoid camera pop - F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; - u = llclamp(u, 0.f, 1.f); - - lag_interp *= u; - - if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == mAvatarObject->getID()) - { - // disable camera lag when using mouse-directed steering - target_lag.clearVec(); - } - else - { - target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f; - } - - mCameraLag = lerp(mCameraLag, target_lag, lag_interp); - - F32 lag_dist = mCameraLag.magVec(); - if (lag_dist > MAX_CAMERA_LAG) - { - mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist; - } - - // clamp camera lag so that avatar is always in front - F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis; - if (dot < -(MIN_CAMERA_LAG * u)) - { - mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis; - } - } - else - { - mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(0.15f)); - } - - camera_lag_d.setVec(mCameraLag); - camera_position_global = camera_position_global - camera_lag_d; - } - } - } - else - { - LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal(); - // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value - camera_position_global = focusPosGlobal + mCameraFocusOffset; - } - - if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike()) - { - LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal( - camera_position_global); - bool constrain = true; - if(regionp && regionp->canManageEstate()) - { - constrain = false; - } - if(constrain) - { - F32 max_dist = ( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode ) ? - APPEARANCE_MAX_ZOOM : mDrawDistance; - - LLVector3d camera_offset = camera_position_global - - gAgent.getPositionGlobal(); - F32 camera_distance = (F32)camera_offset.magVec(); - - if(camera_distance > max_dist) - { - camera_position_global = gAgent.getPositionGlobal() + - (max_dist / camera_distance) * camera_offset; - isConstrained = TRUE; - } - } - -// JC - Could constrain camera based on parcel stuff here. -// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); -// -// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) -// { -// camera_position_global = last_position_global; -// -// isConstrained = TRUE; -// } - } - - // Don't let camera go underground - F32 camera_min_off_ground = getCameraMinOffGround(); - - camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); - - if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) - { - camera_position_global.mdV[VZ] = camera_land_height + camera_min_off_ground; - isConstrained = TRUE; - } - - - if (hit_limit) - { - *hit_limit = isConstrained; - } - - return camera_position_global; -} - - -LLVector3 LLAgent::getCameraOffsetInitial() -{ - return mCameraOffsetInitial[mCameraPreset]; -} - - -//----------------------------------------------------------------------------- -// handleScrollWheel() -//----------------------------------------------------------------------------- -void LLAgent::handleScrollWheel(S32 clicks) -{ - if ( mCameraMode == CAMERA_MODE_FOLLOW && gAgent.getFocusOnAvatar()) - { - if ( ! mFollowCam.getPositionLocked() ) // not if the followCam position is locked in place - { - mFollowCam.zoom( clicks ); - if ( mFollowCam.isZoomedToMinimumDistance() ) - { - changeCameraToMouselook(FALSE); - } - } - } - else - { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2); - - // Block if camera is animating - if (mCameraAnimating) - { - return; - } - - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - F32 zoom_factor = (F32)pow(0.8, -clicks); - cameraZoomIn(zoom_factor); - } - else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); - - F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); - current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks); - - cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); - } - else - { - F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec(); - cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks))); - } - } -} - - -//----------------------------------------------------------------------------- -// getCameraMinOffGround() -//----------------------------------------------------------------------------- -F32 LLAgent::getCameraMinOffGround() -{ - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - return 0.f; - } - else - { - if (gSavedSettings.getBOOL("DisableCameraConstraints")) - { - return -1000.f; - } - else - { - return 0.5f; - } - } -} - - -//----------------------------------------------------------------------------- -// resetCamera() -//----------------------------------------------------------------------------- -void LLAgent::resetCamera() -{ - // Remove any pitch from the avatar - LLVector3 at = mFrameAgent.getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - // have to explicitly clear field of view zoom now - mCameraFOVZoomFactor = 0.f; - - updateCamera(); -} - -//----------------------------------------------------------------------------- -// changeCameraToMouselook() -//----------------------------------------------------------------------------- -void LLAgent::changeCameraToMouselook(BOOL animate) -{ - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - // visibility changes at end of animation - gViewerWindow->getWindow()->resetBusyCount(); - - // unpause avatar animation - mPauseRequest = NULL; - - LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); - - if (mAvatarObject.notNull()) - { - mAvatarObject->stopMotion( ANIM_AGENT_BODY_NOISE ); - mAvatarObject->stopMotion( ANIM_AGENT_BREATHE_ROT ); - } - - //gViewerWindow->stopGrab(); - LLSelectMgr::getInstance()->deselectAll(); - gViewerWindow->hideCursor(); - gViewerWindow->moveCursorToCenter(); - - if( mCameraMode != CAMERA_MODE_MOUSELOOK ) - { - gFocusMgr.setKeyboardFocus( NULL ); - - mLastCameraMode = mCameraMode; - mCameraMode = CAMERA_MODE_MOUSELOOK; - U32 old_flags = mControlFlags; - setControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != mControlFlags) - { - mbFlagsDirty = TRUE; - } - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - endAnimationUpdateUI(); - } - } -} - - -//----------------------------------------------------------------------------- -// changeCameraToDefault() -//----------------------------------------------------------------------------- -void LLAgent::changeCameraToDefault() -{ - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - if (LLFollowCamMgr::getActiveFollowCamParams()) - { - changeCameraToFollow(); - } - else - { - changeCameraToThirdPerson(); - } -} - - -// Ventrella -//----------------------------------------------------------------------------- -// changeCameraToFollow() -//----------------------------------------------------------------------------- -void LLAgent::changeCameraToFollow(BOOL animate) -{ - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - if( mCameraMode != CAMERA_MODE_FOLLOW ) - { - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - animate = FALSE; - } - startCameraAnimation(); - - mLastCameraMode = mCameraMode; - mCameraMode = CAMERA_MODE_FOLLOW; - - // bang-in the current focus, position, and up vector of the follow cam - mFollowCam.reset( mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis ); - - if (gBasicToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - if (mAvatarObject.notNull()) - { - mAvatarObject->mPelvisp->setPosition(LLVector3::zero); - mAvatarObject->startMotion( ANIM_AGENT_BODY_NOISE ); - mAvatarObject->startMotion( ANIM_AGENT_BREATHE_ROT ); - } - - // unpause avatar animation - mPauseRequest = NULL; - - U32 old_flags = mControlFlags; - clearControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != mControlFlags) - { - mbFlagsDirty = TRUE; - } - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - endAnimationUpdateUI(); - } - } -} - -//----------------------------------------------------------------------------- -// changeCameraToThirdPerson() -//----------------------------------------------------------------------------- -void LLAgent::changeCameraToThirdPerson(BOOL animate) -{ - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - gViewerWindow->getWindow()->resetBusyCount(); - - mCameraZoomFraction = INITIAL_ZOOM_FRACTION; - - if (mAvatarObject.notNull()) - { - if (!mAvatarObject->isSitting()) - { - mAvatarObject->mPelvisp->setPosition(LLVector3::zero); - } - mAvatarObject->startMotion( ANIM_AGENT_BODY_NOISE ); - mAvatarObject->startMotion( ANIM_AGENT_BREATHE_ROT ); - } - - LLVector3 at_axis; - - // unpause avatar animation - mPauseRequest = NULL; - - if( mCameraMode != CAMERA_MODE_THIRD_PERSON ) - { - if (gBasicToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - mCameraLag.clearVec(); - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - mCurrentCameraDistance = MIN_CAMERA_DISTANCE; - mTargetCameraDistance = MIN_CAMERA_DISTANCE; - animate = FALSE; - } - mLastCameraMode = mCameraMode; - mCameraMode = CAMERA_MODE_THIRD_PERSON; - U32 old_flags = mControlFlags; - clearControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != mControlFlags) - { - mbFlagsDirty = TRUE; - } - - } - - // Remove any pitch from the avatar - if (mAvatarObject.notNull() && mAvatarObject->getParent()) - { - LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - resetAxes(at_axis * ~obj_rot); - } - else - { - at_axis = mFrameAgent.getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - resetAxes(at_axis); - } - - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - endAnimationUpdateUI(); - } -} - -//----------------------------------------------------------------------------- -// changeCameraToCustomizeAvatar() -//----------------------------------------------------------------------------- -void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_animate) -{ - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - standUp(); // force stand up - gViewerWindow->getWindow()->resetBusyCount(); - - if (gFaceEditToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); - } - - if (camera_animate) - { - startCameraAnimation(); - } - - // Remove any pitch from the avatar - //LLVector3 at = mFrameAgent.getAtAxis(); - //at.mV[VZ] = 0.f; - //at.normalize(); - //gAgent.resetAxes(at); - - if( mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR ) - { - mLastCameraMode = mCameraMode; - mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR; - U32 old_flags = mControlFlags; - clearControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != mControlFlags) - { - mbFlagsDirty = TRUE; - } - - gFocusMgr.setKeyboardFocus( NULL ); - gFocusMgr.setMouseCapture( NULL ); - - LLVOAvatarSelf::onCustomizeStart(); - } - - if (mAvatarObject.notNull()) - { - if(avatar_animate) - { - // Remove any pitch from the avatar - LLVector3 at = mFrameAgent.getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - - sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); - mCustomAnim = TRUE ; - mAvatarObject->startMotion(ANIM_AGENT_CUSTOMIZE); - LLMotion* turn_motion = mAvatarObject->findMotion(ANIM_AGENT_CUSTOMIZE); - - if (turn_motion) - { - mAnimationDuration = turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP; - - } - else - { - mAnimationDuration = gSavedSettings.getF32("ZoomTime"); - } - } - - - - gAgent.setFocusGlobal(LLVector3d::zero); - } - else - { - mCameraAnimating = FALSE; - endAnimationUpdateUI(); - } - -} - - -void LLAgent::switchCameraPreset(ECameraPreset preset) -{ - //zoom is supposed to be reset for the front and group views - mCameraZoomFraction = 1.f; - - //focusing on avatar in that case means following him on movements - mFocusOnAvatar = TRUE; - - mCameraPreset = preset; - - gSavedSettings.setU32("CameraPreset", mCameraPreset); -} - - -// -// Focus point management -// - -//----------------------------------------------------------------------------- -// startCameraAnimation() -//----------------------------------------------------------------------------- -void LLAgent::startCameraAnimation() -{ - mAnimationCameraStartGlobal = getCameraPositionGlobal(); - mAnimationFocusStartGlobal = mFocusGlobal; - mAnimationTimer.reset(); - mCameraAnimating = TRUE; - mAnimationDuration = gSavedSettings.getF32("ZoomTime"); -} - -//----------------------------------------------------------------------------- -// stopCameraAnimation() -//----------------------------------------------------------------------------- -void LLAgent::stopCameraAnimation() -{ - mCameraAnimating = FALSE; -} - -void LLAgent::clearFocusObject() -{ - if (mFocusObject.notNull()) - { - startCameraAnimation(); - - setFocusObject(NULL); - mFocusObjectOffset.clearVec(); - } -} - -void LLAgent::setFocusObject(LLViewerObject* object) -{ - mFocusObject = object; -} - -// Focus on a point, but try to keep camera position stable. -//----------------------------------------------------------------------------- -// setFocusGlobal() -//----------------------------------------------------------------------------- -void LLAgent::setFocusGlobal(const LLPickInfo& pick) -{ - LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID); - - if (objectp) - { - // focus on object plus designated offset - // which may or may not be same as pick.mPosGlobal - setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID); - } - else - { - // focus directly on point where user clicked - setFocusGlobal(pick.mPosGlobal, pick.mObjectID); - } -} - - -void LLAgent::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id) -{ - setFocusObject(gObjectList.findObject(object_id)); - LLVector3d old_focus = mFocusTargetGlobal; - LLViewerObject *focus_obj = mFocusObject; - - // if focus has changed - if (old_focus != focus) - { - if (focus.isExactlyZero()) - { - if (mAvatarObject.notNull()) - { - mFocusTargetGlobal = getPosGlobalFromAgent(mAvatarObject->mHeadp->getWorldPosition()); - } - else - { - mFocusTargetGlobal = getPositionGlobal(); - } - mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal; - mCameraFocusOffset = mCameraFocusOffsetTarget; - setLookAt(LOOKAT_TARGET_CLEAR); - } - else - { - mFocusTargetGlobal = focus; - if (!focus_obj) - { - mCameraFOVZoomFactor = 0.f; - } - - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal; - - startCameraAnimation(); - - if (focus_obj) - { - if (focus_obj->isAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, focus_obj); - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation()); - } - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, getPosAgentFromGlobal(mFocusTargetGlobal)); - } - } - } - else // focus == mFocusTargetGlobal - { - if (focus.isExactlyZero()) - { - if (mAvatarObject.notNull()) - { - mFocusTargetGlobal = getPosGlobalFromAgent(mAvatarObject->mHeadp->getWorldPosition()); - } - else - { - mFocusTargetGlobal = getPositionGlobal(); - } - } - mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);; - mCameraFocusOffset = mCameraFocusOffsetTarget; - } - - if (mFocusObject.notNull()) - { - // for attachments, make offset relative to avatar, not the attachment - if (mFocusObject->isAttachment()) - { - while (mFocusObject.notNull() // DEV-29123 - can crash with a messed-up attachment - && !mFocusObject->isAvatar()) - { - mFocusObject = (LLViewerObject*) mFocusObject->getParent(); - } - setFocusObject((LLViewerObject*)mFocusObject); - } - updateFocusOffset(); - } -} - -// Used for avatar customization -//----------------------------------------------------------------------------- -// setCameraPosAndFocusGlobal() -//----------------------------------------------------------------------------- -void LLAgent::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id) -{ - LLVector3d old_focus = mFocusTargetGlobal; - - F64 focus_delta_squared = (old_focus - focus).magVecSquared(); - const F64 ANIM_EPSILON_SQUARED = 0.0001; - if( focus_delta_squared > ANIM_EPSILON_SQUARED ) - { - startCameraAnimation(); - - if( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode ) - { - // Compensate for the fact that the camera has already been offset to make room for LLFloaterCustomize. - mAnimationCameraStartGlobal -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * calcCustomizeAvatarUIOffset( mAnimationCameraStartGlobal )); - } - } - - //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); - setFocusObject(gObjectList.findObject(object_id)); - mFocusTargetGlobal = focus; - mCameraFocusOffsetTarget = camera_pos - focus; - mCameraFocusOffset = mCameraFocusOffsetTarget; - - if (mFocusObject) - { - if (mFocusObject->isAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject); - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation()); - } - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, getPosAgentFromGlobal(mFocusTargetGlobal)); - } - - if( mCameraAnimating ) - { - const F64 ANIM_METERS_PER_SECOND = 10.0; - const F64 MIN_ANIM_SECONDS = 0.5; - const F64 MAX_ANIM_SECONDS = 10.0; - F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND ); - anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS ); - setAnimationDuration( (F32)anim_duration ); - } - - updateFocusOffset(); -} - -//----------------------------------------------------------------------------- -// setSitCamera() -//----------------------------------------------------------------------------- -void LLAgent::setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos, const LLVector3 &camera_focus) -{ - BOOL camera_enabled = !object_id.isNull(); - - if (camera_enabled) - { - LLViewerObject *reference_object = gObjectList.findObject(object_id); - if (reference_object) - { - //convert to root object relative? - mSitCameraPos = camera_pos; - mSitCameraFocus = camera_focus; - mSitCameraReferenceObject = reference_object; - mSitCameraEnabled = TRUE; - } - } - else - { - mSitCameraPos.clearVec(); - mSitCameraFocus.clearVec(); - mSitCameraReferenceObject = NULL; - mSitCameraEnabled = FALSE; - } -} - -//----------------------------------------------------------------------------- -// setFocusOnAvatar() -//----------------------------------------------------------------------------- -void LLAgent::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) -{ - if (focus_on_avatar != mFocusOnAvatar) - { - if (animate) - { - startCameraAnimation(); - } - else - { - stopCameraAnimation(); - } - } - - //RN: when focused on the avatar, we're not "looking" at it - // looking implies intent while focusing on avatar means - // you're just walking around with a camera on you...eesh. - if (!mFocusOnAvatar && focus_on_avatar) - { - setFocusGlobal(LLVector3d::zero); - mCameraFOVZoomFactor = 0.f; - if (mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - LLVector3 at_axis; - if (mAvatarObject.notNull() && mAvatarObject->getParent()) - { - LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - resetAxes(at_axis * ~obj_rot); - } - else - { - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - resetAxes(at_axis); - } - } - } - // unlocking camera from avatar - else if (mFocusOnAvatar && !focus_on_avatar) - { - // keep camera focus point consistent, even though it is now unlocked - setFocusGlobal(getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID()); - } - - mFocusOnAvatar = focus_on_avatar; + gAgentCamera.updateLastCamera(); } //----------------------------------------------------------------------------- @@ -4592,90 +1905,13 @@ void LLAgent::heardChat(const LLUUID& id) if (ll_rand(2) == 0) { LLViewerObject *chatter = gObjectList.findObject(mLastChatterID); - setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero); + gAgentCamera.setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero); } mLastChatterID = id; mChatTimer.reset(); } -//----------------------------------------------------------------------------- -// lookAtLastChat() -//----------------------------------------------------------------------------- -void LLAgent::lookAtLastChat() -{ - // Block if camera is animating or not in normal third person camera mode - if (mCameraAnimating || !cameraThirdPerson()) - { - return; - } - - LLViewerObject *chatter = gObjectList.findObject(mLastChatterID); - if (chatter) - { - LLVector3 delta_pos; - if (chatter->isAvatar()) - { - LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; - if (mAvatarObject.notNull() && chatter_av->mHeadp) - { - delta_pos = chatter_av->mHeadp->getWorldPosition() - mAvatarObject->mHeadp->getWorldPosition(); - } - else - { - delta_pos = chatter->getPositionAgent() - getPositionAgent(); - } - delta_pos.normalize(); - - setControlFlags(AGENT_CONTROL_STOP); - - changeCameraToThirdPerson(); - - LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); - LLVector3 left = delta_pos % LLVector3::z_axis; - left.normalize(); - LLVector3 up = left % delta_pos; - up.normalize(); - new_camera_pos -= delta_pos * 0.4f; - new_camera_pos += left * 0.3f; - new_camera_pos += up * 0.2f; - if (chatter_av->mHeadp) - { - setFocusGlobal(getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), mLastChatterID); - mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); - } - else - { - setFocusGlobal(chatter->getPositionGlobal(), mLastChatterID); - mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); - } - setFocusOnAvatar(FALSE, TRUE); - } - else - { - delta_pos = chatter->getRenderPosition() - getPositionAgent(); - delta_pos.normalize(); - - setControlFlags(AGENT_CONTROL_STOP); - - changeCameraToThirdPerson(); - - LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); - LLVector3 left = delta_pos % LLVector3::z_axis; - left.normalize(); - LLVector3 up = left % delta_pos; - up.normalize(); - new_camera_pos -= delta_pos * 0.4f; - new_camera_pos += left * 0.3f; - new_camera_pos += up * 0.2f; - - setFocusGlobal(chatter->getPositionGlobal(), mLastChatterID); - mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); - setFocusOnAvatar(FALSE, TRUE); - } - } -} - const F32 SIT_POINT_EXTENTS = 0.2f; LLSD ll_sdmap_from_vector3(const LLVector3& vec) @@ -4720,10 +1956,10 @@ void LLAgent::setStartPosition( U32 location_id ) LLVector3 agent_pos = getPositionAgent(); - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { // the z height is at the agent's feet - agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ]; + agent_pos.mV[VZ] -= 0.5f * gAgentAvatarp->mBodySize.mV[VZ]; } agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); @@ -4830,7 +2066,7 @@ void LLAgent::onAnimStop(const LLUUID& id) setControlFlags(AGENT_CONTROL_FINISH_ANIM); // now trigger dusting self off animation - if (mAvatarObject.notNull() && !mAvatarObject->mBelowWater && rand() % 3 == 0) + if (isAgentAvatarValid() && !gAgentAvatarp->mBelowWater && rand() % 3 == 0) sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START ); } else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND) @@ -5029,9 +2265,9 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const name.erase(0, name.length()); } - if (mAvatarObject.notNull()) + if (isAgentAvatarValid()) { - name += mAvatarObject->getFullname(); + name += gAgentAvatarp->getFullname(); } } @@ -5177,14 +2413,14 @@ BOOL LLAgent::canJoinGroups() const LLQuaternion LLAgent::getHeadRotation() { - if (mAvatarObject.isNull() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp) + if (!isAgentAvatarValid() || !gAgentAvatarp->mPelvisp || !gAgentAvatarp->mHeadp) { return LLQuaternion::DEFAULT; } - if (!gAgent.cameraMouselook()) + if (!gAgentCamera.cameraMouselook()) { - return mAvatarObject->getRotation(); + return gAgentAvatarp->getRotation(); } // We must be in mouselook @@ -5193,9 +2429,9 @@ LLQuaternion LLAgent::getHeadRotation() LLVector3 left = up % look_dir; LLQuaternion rot(look_dir, left, up); - if (mAvatarObject->getParent()) + if (gAgentAvatarp->getParent()) { - rot = rot * ~mAvatarObject->getParent()->getRotation(); + rot = rot * ~gAgentAvatarp->getParent()->getRotation(); } return rot; @@ -5353,10 +2589,11 @@ void LLAgent::initOriginGlobal(const LLVector3d &origin_global) BOOL LLAgent::leftButtonGrabbed() const { - return (!cameraMouselook() && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) - || (cameraMouselook() && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0) - || (!cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) - || (cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0); + const BOOL camera_mouse_look = gAgentCamera.cameraMouselook(); + return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) + || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0) + || (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) + || (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0); } BOOL LLAgent::rotateGrabbed() const @@ -5817,14 +3054,13 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * { gAgentQueryManager.mNumPendingQueries--; - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if (!avatarp || avatarp->isDead()) + if (!isAgentAvatarValid() || gAgentAvatarp->isDead()) { llwarns << "No avatar for user in cached texture update!" << llendl; return; } - if (gAgent.cameraCustomizeAvatar()) + if (gAgentCamera.cameraCustomizeAvatar()) { // ignore baked textures when in customize mode return; @@ -5851,27 +3087,27 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * if (texture_id.notNull()) { //llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl; - avatarp->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id); - //avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id ); + gAgentAvatarp->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id); + //gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id ); gAgentQueryManager.mActiveCacheQueries[texture_index] = 0; num_results++; } else { // no cache of this bake. request upload. - avatarp->requestLayerSetUpload((EBakedTextureIndex)texture_index); + gAgentAvatarp->requestLayerSetUpload((EBakedTextureIndex)texture_index); } } } llinfos << "Received cached texture response for " << num_results << " textures." << llendl; - avatarp->updateMeshTextures(); + gAgentAvatarp->updateMeshTextures(); if (gAgentQueryManager.mNumPendingQueries == 0) { // RN: not sure why composites are disabled at this point - avatarp->setCompositeUpdatesEnabled(TRUE); + gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); gAgent.sendAgentSetAppearance(); } } @@ -5924,11 +3160,10 @@ BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global ) void LLAgent::clearVisualParams(void *data) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) + if (isAgentAvatarValid()) { - avatarp->clearVisualParamWeights(); - avatarp->updateVisualParams(); + gAgentAvatarp->clearVisualParamWeights(); + gAgentAvatarp->updateVisualParams(); } } @@ -5952,16 +3187,15 @@ bool LLAgent::teleportCore(bool is_local) // sync with other viewers. Discuss in DEV-14145/VWR-6744 before reenabling. // Stop all animation before actual teleporting - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) + if (isAgentAvatarValid()) { - for ( LLVOAvatar::AnimIterator anim_it= avatarp->mPlayingAnimations.begin(); - anim_it != avatarp->mPlayingAnimations.end(); + for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatarp->mPlayingAnimations.begin(); + anim_it != gAgentAvatarp->mPlayingAnimations.end(); ++anim_it) { - avatarp->stopMotion(anim_it->first); + gAgentAvatarp->stopMotion(anim_it->first); } - avatarp->processAnimationStateChanges(); + gAgentAvatarp->processAnimationStateChanges(); } #endif @@ -5969,9 +3203,9 @@ bool LLAgent::teleportCore(bool is_local) // yet if the teleport will succeed. Look in // process_teleport_location_reply - // close the map and find panels so we can see our destination + // close the map panel so we can see our destination. + // we don't close search floater, see EXT-5840. LLFloaterReg::hideInstance("world_map"); - LLFloaterReg::hideInstance("search"); // hide land floater too - it'll be out of date LLFloaterReg::hideInstance("about_land"); @@ -5981,7 +3215,7 @@ bool LLAgent::teleportCore(bool is_local) // Close all pie menus, deselect land, etc. // Don't change the camera until we know teleport succeeded. JC - resetView(FALSE); + gAgentCamera.resetView(FALSE); // local logic LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TELEPORT_COUNT); @@ -6154,13 +3388,11 @@ void LLAgent::stopCurrentAnimations() { // This function stops all current overriding animations on this // avatar, propagating this change back to the server. - - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) + if (isAgentAvatarValid()) { for ( LLVOAvatar::AnimIterator anim_it = - avatarp->mPlayingAnimations.begin(); - anim_it != avatarp->mPlayingAnimations.end(); + gAgentAvatarp->mPlayingAnimations.begin(); + anim_it != gAgentAvatarp->mPlayingAnimations.end(); anim_it++) { if (anim_it->first == @@ -6173,7 +3405,7 @@ void LLAgent::stopCurrentAnimations() else { // stop this animation locally - avatarp->stopMotion(anim_it->first, TRUE); + gAgentAvatarp->stopMotion(anim_it->first, TRUE); // ...and tell the server to tell everyone. sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP); } @@ -6280,15 +3512,15 @@ void LLAgent::requestLeaveGodMode() //----------------------------------------------------------------------------- void LLAgent::sendAgentSetAppearance() { - if (mAvatarObject.isNull()) return; + if (!isAgentAvatarValid()) return; - if (gAgentQueryManager.mNumPendingQueries > 0 && !gAgent.cameraCustomizeAvatar()) + if (gAgentQueryManager.mNumPendingQueries > 0 && !gAgentCamera.cameraCustomizeAvatar()) { return; } - llinfos << "TAT: Sent AgentSetAppearance: " << mAvatarObject->getBakedStatusForPrintout() << llendl; + llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << llendl; //dumpAvatarTEs( "sendAgentSetAppearance()" ); LLMessageSystem* msg = gMessageSystem; @@ -6302,7 +3534,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 = mAvatarObject->mBodySize; + const LLVector3 body_size = gAgentAvatarp->mBodySize; msg->addVector3Fast(_PREHASH_Size, body_size); // To guard against out of order packets @@ -6312,20 +3544,20 @@ void LLAgent::sendAgentSetAppearance() // is texture data current relative to wearables? // KLW - TAT this will probably need to check the local queue. - BOOL textures_current = mAvatarObject->areTexturesCurrent(); + BOOL textures_current = gAgentAvatarp->areTexturesCurrent(); for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ ) { const ETextureIndex texture_index = LLVOAvatarDictionary::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 && !mAvatarObject->isWearingWearableType(WT_SKIRT)) + if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT)) { continue; } // IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures - if (!mAvatarObject->isTextureDefined(texture_index, 0)) + if (!gAgentAvatarp->isTextureDefined(texture_index, 0)) { textures_current = FALSE; break; @@ -6363,7 +3595,7 @@ void LLAgent::sendAgentSetAppearance() msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index); } msg->nextBlockFast(_PREHASH_ObjectData); - mAvatarObject->sendAppearanceMessage( gMessageSystem ); + gAgentAvatarp->sendAppearanceMessage( gMessageSystem ); } else { @@ -6376,9 +3608,9 @@ void LLAgent::sendAgentSetAppearance() S32 transmitted_params = 0; - for (LLViewerVisualParam* param = (LLViewerVisualParam*)mAvatarObject->getFirstVisualParam(); + for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*)mAvatarObject->getNextVisualParam()) + param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam()) { if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) { @@ -6500,7 +3732,39 @@ void LLAgent::dumpGroupInfo() //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl; } +// Draw a representation of current autopilot target +void LLAgent::renderAutoPilotTarget() +{ + if (mAutoPilot) + { + F32 height_meters; + LLVector3d target_global; + + glMatrixMode(GL_MODELVIEW); + gGL.pushMatrix(); + + // not textured + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + // lovely green + glColor4f(0.f, 1.f, 1.f, 1.f); + + target_global = mAutoPilotTargetGlobal; + + gGL.translatef((F32)(target_global.mdV[VX]), (F32)(target_global.mdV[VY]), (F32)(target_global.mdV[VZ])); + + height_meters = 1.f; + + glScalef(height_meters, height_meters, height_meters); + + gSphere.render(1500.f); + + gGL.popMatrix(); + } +} + /********************************************************************************/ + LLAgentQueryManager gAgentQueryManager; LLAgentQueryManager::LLAgentQueryManager() : diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index a3ce091c6b..32f9b00135 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -39,9 +39,6 @@ #include "llagentconstants.h" #include "llagentdata.h" // gAgentID, gAgentSessionID #include "llcharacter.h" // LLAnimPauseRequest -#include "llfollowcam.h" // Ventrella -#include "llhudeffectlookat.h" // EPointAtType -#include "llhudeffectpointat.h" // ELookAtType #include "llpointer.h" #include "lluicolor.h" #include "llvoavatardefines.h" @@ -52,7 +49,6 @@ extern const U8 AGENT_STATE_TYPING; // Typing indication extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected class LLChat; -class LLVOAvatarSelf; class LLViewerRegion; class LLMotion; class LLToolset; @@ -67,26 +63,6 @@ class LLAgentDropGroupViewerNode; //-------------------------------------------------------------------- // Types //-------------------------------------------------------------------- -enum ECameraMode -{ - CAMERA_MODE_THIRD_PERSON, - CAMERA_MODE_MOUSELOOK, - CAMERA_MODE_CUSTOMIZE_AVATAR, - CAMERA_MODE_FOLLOW -}; - -/** Camera Presets for CAMERA_MODE_THIRD_PERSON */ -enum ECameraPreset -{ - /** Default preset, what the Third Person Mode actually was */ - CAMERA_PRESET_REAR_VIEW, - - /** "Looking at the Avatar from the front" */ - CAMERA_PRESET_FRONT_VIEW, - - /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ - CAMERA_PRESET_GROUP_VIEW -}; enum EAnimRequest { @@ -130,7 +106,6 @@ public: virtual ~LLAgent(); void init(); void cleanup(); - void setAvatarObject(LLVOAvatarSelf *avatar); //-------------------------------------------------------------------- // Login @@ -140,11 +115,12 @@ public: void setFirstLogin(BOOL b) { mFirstLogin = b; } // Return TRUE if the database reported this login as the first for this particular user. BOOL isFirstLogin() const { return mFirstLogin; } + BOOL isInitialized() const { return mInitialized; } public: - BOOL mInitialized; - BOOL mFirstLogin; std::string mMOTD; // Message of the day private: + BOOL mInitialized; + BOOL mFirstLogin; boost::shared_ptr<LLAgentListener> mListener; //-------------------------------------------------------------------- @@ -193,20 +169,6 @@ private: /******************************************************************************** ** ** - ** GENERAL ACCESSORS - **/ - -public: - LLVOAvatarSelf* getAvatarObject() const { return mAvatarObject; } -private: - LLPointer<LLVOAvatarSelf> mAvatarObject; // NULL until avatar object sent down from simulator - -/** General Accessors - ** ** - *******************************************************************************/ - -/******************************************************************************** - ** ** ** POSITION **/ @@ -237,7 +199,7 @@ public: // Coordinate System //-------------------------------------------------------------------- public: - LLCoordFrame getFrameAgent() const { return mFrameAgent; } + const LLCoordFrame& getFrameAgent() const { return mFrameAgent; } void initOriginGlobal(const LLVector3d &origin_global); // Only to be used in ONE place void resetAxes(); void resetAxes(const LLVector3 &look_at); // Makes reasonable left and up @@ -280,6 +242,10 @@ private: public: S32 getRegionsVisited() const; F64 getDistanceTraveled() const; + void setDistanceTraveled(F64 dist) { mDistanceTraveled = dist; } + + const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; } + void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; } private: std::set<U64> mRegionsVisited; // Stat - what distinct regions has the avatar been to? F64 mDistanceTraveled; // Stat - how far has the avatar moved? @@ -322,7 +288,6 @@ public: //-------------------------------------------------------------------- public: void heardChat(const LLUUID& id); - void lookAtLastChat(); F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); } LLUUID getLastChatter() const { return mLastChatterID; } F32 getNearChatRadius() { return mNearChatRadius; } @@ -431,6 +396,8 @@ public: // Send message to simulator to force grabbed controls to be // released, in case of a poorly written script. void forceReleaseControls(); + void setFlagsDirty() { mbFlagsDirty = TRUE; } + private: S32 mControlsTakenCount[TOTAL_CONTROLS]; S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS]; @@ -448,9 +415,11 @@ public: void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request); void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); void endAnimationUpdateUI(); + void unpauseAnimation() { mPauseRequest = NULL; } + BOOL getCustomAnim() const { return mCustomAnim; } + void setCustomAnim(BOOL anim) { mCustomAnim = anim; } + private: - LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active - F32 mAnimationDuration; // In seconds BOOL mCustomAnim; // Current animation is ANIM_AGENT_CUSTOMIZE ? LLAnimPauseRequest mPauseRequest; BOOL mViewsPushed; // Keep track of whether or not we have pushed views @@ -463,19 +432,6 @@ private: ** ** ** MOVEMENT **/ - - //-------------------------------------------------------------------- - // Keys - //-------------------------------------------------------------------- -public: - void setKey(const S32 direction, S32 &key); // Sets key to +1 for +direction, -1 for -direction -private: - S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed - S32 mWalkKey; // Like AtKey, but causes less forward thrust - S32 mLeftKey; - S32 mUpKey; - F32 mYawKey; - F32 mPitchKey; //-------------------------------------------------------------------- // Movement from user input @@ -493,42 +449,6 @@ public: void movePitch(F32 mag); //-------------------------------------------------------------------- - // Orbit - //-------------------------------------------------------------------- -public: - void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } - void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } - void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } - void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } - void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } - void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } -private: - F32 mOrbitLeftKey; - F32 mOrbitRightKey; - F32 mOrbitUpKey; - F32 mOrbitDownKey; - F32 mOrbitInKey; - F32 mOrbitOutKey; - - //-------------------------------------------------------------------- - // Pan - //-------------------------------------------------------------------- -public: - void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } - void setPanRightKey(F32 mag) { mPanRightKey = mag; } - void setPanUpKey(F32 mag) { mPanUpKey = mag; } - void setPanDownKey(F32 mag) { mPanDownKey = mag; } - void setPanInKey(F32 mag) { mPanInKey = mag; } - void setPanOutKey(F32 mag) { mPanOutKey = mag; } -private: - F32 mPanUpKey; - F32 mPanDownKey; - F32 mPanLeftKey; - F32 mPanRightKey; - F32 mPanInKey; - F32 mPanOutKey; - - //-------------------------------------------------------------------- // Move the avatar's frame //-------------------------------------------------------------------- public: @@ -641,232 +561,6 @@ private: /******************************************************************************** ** ** - ** CAMERA - **/ - - //-------------------------------------------------------------------- - // Mode - //-------------------------------------------------------------------- -public: - void changeCameraToDefault(); - void changeCameraToMouselook(BOOL animate = TRUE); - void changeCameraToThirdPerson(BOOL animate = TRUE); - void changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // Trigger transition animation - void changeCameraToFollow(BOOL animate = TRUE); // Ventrella - BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } - BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } - BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } - BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } - ECameraMode getCameraMode() const { return mCameraMode; } - void updateCamera(); // Call once per frame to update camera location/orientation - void resetCamera(); // Slam camera into its default position -private: - ECameraMode mCameraMode; // Target mode after transition animation is done - ECameraMode mLastCameraMode; - - //-------------------------------------------------------------------- - // Preset - //-------------------------------------------------------------------- -public: - void switchCameraPreset(ECameraPreset preset); - -private: - - /** Determines default camera offset depending on the current camera preset */ - LLVector3 getCameraOffsetInitial(); - - /** Camera preset in Third Person Mode */ - ECameraPreset mCameraPreset; - - /** Initial camera offsets */ - std::map<ECameraPreset, LLVector3> mCameraOffsetInitial; - - /** Initial focus offsets */ - std::map<ECameraPreset, LLVector3d> mFocusOffsetInitial; - - - //-------------------------------------------------------------------- - // Position - //-------------------------------------------------------------------- -public: - LLVector3d getCameraPositionGlobal() const; - const LLVector3 &getCameraPositionAgent() const; - LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target - F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters - void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } - BOOL calcCameraMinDistance(F32 &obj_min_distance); - F32 calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global); - F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } -private: - F32 mCurrentCameraDistance; // Current camera offset from avatar - F32 mTargetCameraDistance; // Target camera offset from avatar - F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object - F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom - F32 mCameraFOVDefault; // Default field of view that is basis for FOV zoom effect - LLVector4 mCameraCollidePlane; // Colliding plane for camera - F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom - LLVector3 mCameraPositionAgent; // Camera position in agent coordinates - LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom - LLVector3d mCameraSmoothingLastPositionGlobal; - LLVector3d mCameraSmoothingLastPositionAgent; - BOOL mCameraSmoothingStop; - LLVector3 mCameraLag; // Third person camera lag - LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view) - - //-------------------------------------------------------------------- - // Follow - //-------------------------------------------------------------------- -public: - void setUsingFollowCam(bool using_follow_cam); -private: - LLFollowCam mFollowCam; // Ventrella - - //-------------------------------------------------------------------- - // Sit - //-------------------------------------------------------------------- -public: - void setupSitCamera(); - BOOL sitCameraEnabled() { return mSitCameraEnabled; } - void setSitCamera(const LLUUID &object_id, - const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); -private: - LLPointer<LLViewerObject> mSitCameraReferenceObject; // Object to which camera is related when sitting - BOOL mSitCameraEnabled; // Use provided camera information when sitting? - LLVector3 mSitCameraPos; // Root relative camera pos when sitting - LLVector3 mSitCameraFocus; // Root relative camera target when sitting - - //-------------------------------------------------------------------- - // Animation - //-------------------------------------------------------------------- -public: - void setCameraAnimating(BOOL b) { mCameraAnimating = b; } - BOOL getCameraAnimating() { return mCameraAnimating; } - void setAnimationDuration(F32 seconds) { mAnimationDuration = seconds; } - void startCameraAnimation(); - void stopCameraAnimation(); -private: - BOOL mCameraAnimating; // Camera is transitioning from one mode to another - LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords - LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords - - //-------------------------------------------------------------------- - // Focus - //-------------------------------------------------------------------- -public: - LLVector3d calcFocusPositionTargetGlobal(); - LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); - BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } - LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; } - F32 getFocusObjectDist() const { return mFocusObjectDist; } - void updateFocusOffset(); - void validateFocusObject(); - void setFocusGlobal(const LLPickInfo& pick); - void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); - void setFocusOnAvatar(BOOL focus, BOOL animate); - void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); - void clearFocusObject(); - void setFocusObject(LLViewerObject* object); - void setObjectTracking(BOOL track) { mTrackFocusObject = track; } - const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } - const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } -private: - LLVector3d mCameraFocusOffset; // Offset from focus point in build mode - LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset - BOOL mFocusOnAvatar; - LLVector3d mFocusGlobal; - LLVector3d mFocusTargetGlobal; - LLPointer<LLViewerObject> mFocusObject; - F32 mFocusObjectDist; - LLVector3 mFocusObjectOffset; - F32 mFocusDotRadius; // Meters - BOOL mTrackFocusObject; - F32 mUIOffset; - - //-------------------------------------------------------------------- - // Lookat / Pointat - //-------------------------------------------------------------------- -public: - void updateLookAt(const S32 mouse_x, const S32 mouse_y); - BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - ELookAtType getLookAtType(); - void slamLookAt(const LLVector3 &look_at); // Set the physics data - BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - EPointAtType getPointAtType(); -public: - LLPointer<LLHUDEffectLookAt> mLookAt; - LLPointer<LLHUDEffectPointAt> mPointAt; - - //-------------------------------------------------------------------- - // Third person - //-------------------------------------------------------------------- -public: - LLVector3d calcThirdPersonFocusOffset(); - void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } -private: - LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position - - //-------------------------------------------------------------------- - // Orbit - //-------------------------------------------------------------------- -public: - void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point - void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point - void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point - - //-------------------------------------------------------------------- - // Zoom - //-------------------------------------------------------------------- -public: - void handleScrollWheel(S32 clicks); // Mousewheel driven zoom - void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance - F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom - void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom - F32 calcCameraFOVZoomFactor(); - - //-------------------------------------------------------------------- - // Pan - //-------------------------------------------------------------------- -public: - void cameraPanIn(const F32 meters); - void cameraPanLeft(const F32 meters); - void cameraPanUp(const F32 meters); - - //-------------------------------------------------------------------- - // View - //-------------------------------------------------------------------- -public: - // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. - void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); - // Called on camera movement. Unlocks camera from the default position behind the avatar. - void unlockView(); - - //-------------------------------------------------------------------- - // Mouselook - //-------------------------------------------------------------------- -public: - BOOL getForceMouselook() const { return mForceMouselook; } - void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } -private: - BOOL mForceMouselook; - - //-------------------------------------------------------------------- - // HUD - //-------------------------------------------------------------------- -public: - const LLColor4 &getEffectColor(); - void setEffectColor(const LLColor4 &color); -public: - F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) - F32 mHUDCurZoom; // Current animated zoom level for HUD objects -private: - LLUIColor mEffectColor; - -/** Camera - ** ** - *******************************************************************************/ - -/******************************************************************************** - ** ** ** ACCESS **/ @@ -939,8 +633,9 @@ public: LLQuaternion getHeadRotation(); BOOL needsRenderAvatar(); // TRUE when camera mode is such that your own avatar should draw BOOL needsRenderHead(); -public: - F32 mDrawDistance; + void setShowAvatar(BOOL show) { mShowAvatar = show; } + BOOL getShowAvatar() const { return mShowAvatar; } + private: BOOL mShowAvatar; // Should we render the avatar? U32 mAppearanceSerialNum; @@ -955,6 +650,15 @@ public: private: U8 mRenderState; // Current behavior state of agent + //-------------------------------------------------------------------- + // HUD + //-------------------------------------------------------------------- +public: + const LLColor4 &getEffectColor(); + void setEffectColor(const LLColor4 &color); +private: + LLUIColor mEffectColor; + /** Rendering ** ** *******************************************************************************/ diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp new file mode 100644 index 0000000000..9638d0e94f --- /dev/null +++ b/indra/newview/llagentcamera.cpp @@ -0,0 +1,2869 @@ +/** + * @file llagentcamera.cpp + * @brief LLAgent class implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llagentcamera.h" + +#include "pipeline.h" + +#include "llagent.h" +#include "llanimationstates.h" +#include "llfloatercamera.h" +#include "llfloatercustomize.h" +#include "llfloaterreg.h" +#include "llhudmanager.h" +#include "lljoystickbutton.h" +#include "llselectmgr.h" +#include "llsmoothstep.h" +#include "lltoolmgr.h" +#include "llviewercamera.h" +#include "llviewercontrol.h" +#include "llviewerjoystick.h" +#include "llviewerobjectlist.h" +#include "llviewerregion.h" +#include "llviewerwindow.h" +#include "llvoavatarself.h" +#include "llwindow.h" +#include "llworld.h" + +using namespace LLVOAvatarDefines; + +extern LLMenuBarGL* gMenuBarView; + +// Mousewheel camera zoom +const F32 MIN_ZOOM_FRACTION = 0.25f; +const F32 INITIAL_ZOOM_FRACTION = 1.f; +const F32 MAX_ZOOM_FRACTION = 8.f; + +const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds +const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds + +const F32 CAMERA_FOCUS_HALF_LIFE = 0.f;//0.02f; +const F32 CAMERA_LAG_HALF_LIFE = 0.25f; +const F32 MIN_CAMERA_LAG = 0.5f; +const F32 MAX_CAMERA_LAG = 5.f; + +const F32 CAMERA_COLLIDE_EPSILON = 0.1f; +const F32 MIN_CAMERA_DISTANCE = 0.1f; + +const F32 AVATAR_ZOOM_MIN_X_FACTOR = 0.55f; +const F32 AVATAR_ZOOM_MIN_Y_FACTOR = 0.7f; +const F32 AVATAR_ZOOM_MIN_Z_FACTOR = 1.15f; + +const F32 MAX_CAMERA_DISTANCE_FROM_AGENT = 50.f; + +const F32 MAX_CAMERA_SMOOTH_DISTANCE = 50.0f; + +const F32 HEAD_BUFFER_SIZE = 0.3f; + +const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.2f; + +const F32 LAND_MIN_ZOOM = 0.15f; + +const F32 AVATAR_MIN_ZOOM = 0.5f; +const F32 OBJECT_MIN_ZOOM = 0.02f; + +const F32 APPEARANCE_MIN_ZOOM = 0.39f; +const F32 APPEARANCE_MAX_ZOOM = 8.f; + +const F32 GROUND_TO_AIR_CAMERA_TRANSITION_TIME = 0.5f; +const F32 GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME = 0.5f; + +const F32 OBJECT_EXTENTS_PADDING = 0.5f; + +// The agent instance. +LLAgentCamera gAgentCamera; + +//----------------------------------------------------------------------------- +// LLAgentCamera() +//----------------------------------------------------------------------------- +LLAgentCamera::LLAgentCamera() : + mInitialized(false), + + mDrawDistance( DEFAULT_FAR_PLANE ), + + mLookAt(NULL), + mPointAt(NULL), + + mHUDTargetZoom(1.f), + mHUDCurZoom(1.f), + + mForceMouselook(FALSE), + + mCameraMode( CAMERA_MODE_THIRD_PERSON ), + mLastCameraMode( CAMERA_MODE_THIRD_PERSON ), + + mCameraPreset(CAMERA_PRESET_REAR_VIEW), + + mCameraAnimating( FALSE ), + mAnimationCameraStartGlobal(), + mAnimationFocusStartGlobal(), + mAnimationTimer(), + mAnimationDuration(0.33f), + + mCameraFOVZoomFactor(0.f), + mCameraCurrentFOVZoomFactor(0.f), + mCameraFocusOffset(), + mCameraFOVDefault(DEFAULT_FIELD_OF_VIEW), + + mCameraCollidePlane(), + + mCurrentCameraDistance(2.f), // meters, set in init() + mTargetCameraDistance(2.f), + mCameraZoomFraction(1.f), // deprecated + mThirdPersonHeadOffset(0.f, 0.f, 1.f), + mSitCameraEnabled(FALSE), + mCameraSmoothingLastPositionGlobal(), + mCameraSmoothingLastPositionAgent(), + mCameraSmoothingStop(false), + + mCameraUpVector(LLVector3::z_axis), // default is straight up + + mFocusOnAvatar(TRUE), + mFocusGlobal(), + mFocusTargetGlobal(), + mFocusObject(NULL), + mFocusObjectDist(0.f), + mFocusObjectOffset(), + mFocusDotRadius( 0.1f ), // meters + mTrackFocusObject(TRUE), + mUIOffset(0.f), + + mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed + mWalkKey(0), // like AtKey, but causes less forward thrust + mLeftKey(0), + mUpKey(0), + mYawKey(0.f), + mPitchKey(0.f), + + mOrbitLeftKey(0.f), + mOrbitRightKey(0.f), + mOrbitUpKey(0.f), + mOrbitDownKey(0.f), + mOrbitInKey(0.f), + mOrbitOutKey(0.f), + + mPanUpKey(0.f), + mPanDownKey(0.f), + mPanLeftKey(0.f), + mPanRightKey(0.f), + mPanInKey(0.f), + mPanOutKey(0.f) +{ + mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); + + clearGeneralKeys(); + clearOrbitKeys(); + clearPanKeys(); +} + +// Requires gSavedSettings to be initialized. +//----------------------------------------------------------------------------- +// init() +//----------------------------------------------------------------------------- +void LLAgentCamera::init() +{ + // *Note: this is where LLViewerCamera::getInstance() used to be constructed. + + mDrawDistance = gSavedSettings.getF32("RenderFarClip"); + + LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW); + // Leave at 0.1 meters until we have real near clip management + LLViewerCamera::getInstance()->setNear(0.1f); + LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h + LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape + + mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); + + mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); + + mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3("CameraOffsetRearView"); + mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3("CameraOffsetFrontView"); + mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3("CameraOffsetGroupView"); + + mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3d("FocusOffsetRearView"); + mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3d("FocusOffsetFrontView"); + mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3d("FocusOffsetGroupView"); + + mCameraCollidePlane.clearVec(); + mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); + mTargetCameraDistance = mCurrentCameraDistance; + mCameraZoomFraction = 1.f; + mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); + + mInitialized = true; +} + +//----------------------------------------------------------------------------- +// cleanup() +//----------------------------------------------------------------------------- +void LLAgentCamera::cleanup() +{ + setSitCamera(LLUUID::null); + + if(mLookAt) + { + mLookAt->markDead() ; + mLookAt = NULL; + } + if(mPointAt) + { + mPointAt->markDead() ; + mPointAt = NULL; + } + setFocusObject(NULL); +} + +void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar) +{ + if (!mLookAt) + { + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + } + if (!mPointAt) + { + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + } + + if (!mLookAt.isNull()) + { + mLookAt->setSourceObject(avatar); + } + if (!mPointAt.isNull()) + { + mPointAt->setSourceObject(avatar); + } +} + +//----------------------------------------------------------------------------- +// LLAgent() +//----------------------------------------------------------------------------- +LLAgentCamera::~LLAgentCamera() +{ + cleanup(); + + // *Note: this is where LLViewerCamera::getInstance() used to be deleted. +} + +// Change camera back to third person, stop the autopilot, +// deselect stuff, etc. +//----------------------------------------------------------------------------- +// resetView() +//----------------------------------------------------------------------------- +void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) +{ + if (gAgent.getAutoPilot()) + { + gAgent.stopAutoPilot(TRUE); + } + + if (!gNoRender) + { + LLSelectMgr::getInstance()->unhighlightAll(); + + // By popular request, keep land selection while walking around. JC + // LLViewerParcelMgr::getInstance()->deselectLand(); + + // force deselect when walking and attachment is selected + // this is so people don't wig out when their avatar moves without animating + if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) + { + LLSelectMgr::getInstance()->deselectAll(); + } + + // Hide all popup menus + gMenuHolder->hideMenus(); + } + + if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) + { + changeCameraToDefault(); + + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + handle_toggle_flycam(); + } + + // reset avatar mode from eventual residual motion + if (LLToolMgr::getInstance()->inBuildMode()) + { + LLViewerJoystick::getInstance()->moveAvatar(true); + } + + //Camera Tool is needed for Free Camera Control Mode + if (!LLFloaterCamera::inFreeCameraMode()) + { + LLFloaterReg::hideInstance("build"); + + // Switch back to basic toolset + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + gViewerWindow->showCursor(); + } + + + if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) + { + if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) + { + // leaving mouse-steer mode + LLVector3 agent_at_axis = gAgent.getAtAxis(); + agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); + agent_at_axis.normalize(); + gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f))); + } + + setFocusOnAvatar(TRUE, ANIMATE); + + mCameraFOVZoomFactor = 0.f; + } + + mHUDTargetZoom = 1.f; +} + +// Allow camera to be moved somewhere other than behind avatar. +//----------------------------------------------------------------------------- +// unlockView() +//----------------------------------------------------------------------------- +void LLAgentCamera::unlockView() +{ + if (getFocusOnAvatar()) + { + if (isAgentAvatarValid()) + { + setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID); + } + setFocusOnAvatar(FALSE, FALSE); // no animation + } +} + +//----------------------------------------------------------------------------- +// slamLookAt() +//----------------------------------------------------------------------------- +void LLAgentCamera::slamLookAt(const LLVector3 &look_at) +{ + LLVector3 look_at_norm = look_at; + look_at_norm.mV[VZ] = 0.f; + look_at_norm.normalize(); + gAgent.resetAxes(look_at_norm); +} + +//----------------------------------------------------------------------------- +// calcFocusOffset() +//----------------------------------------------------------------------------- +LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 original_focus_point, S32 x, S32 y) +{ + LLMatrix4 obj_matrix = object->getRenderMatrix(); + LLQuaternion obj_rot = object->getRenderRotation(); + LLVector3 obj_pos = object->getRenderPosition(); + + BOOL is_avatar = object->isAvatar(); + // if is avatar - don't do any funk heuristics to position the focal point + // see DEV-30589 + if (is_avatar) + { + return original_focus_point - obj_pos; + } + + + LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation + LLVector3 object_extents = object->getScale(); + // make sure they object extents are non-zero + object_extents.clamp(0.001f, F32_MAX); + + // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object + LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin(); + obj_to_cam_ray.rotVec(inv_obj_rot); + obj_to_cam_ray.normalize(); + + // obj_to_cam_ray_proportions are the (positive) ratios of + // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions. + LLVector3 obj_to_cam_ray_proportions; + obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]); + obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]); + obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]); + + // find the largest ratio stored in obj_to_cam_ray_proportions + // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera + LLVector3 longest_object_axis; + // is x-axis longest? + if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY] + && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ]) + { + // then grab it + longest_object_axis.setVec(obj_matrix.getFwdRow4()); + } + // is y-axis longest? + else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ]) + { + // then grab it + longest_object_axis.setVec(obj_matrix.getLeftRow4()); + } + // otherwise, use z axis + else + { + longest_object_axis.setVec(obj_matrix.getUpRow4()); + } + + // Use this axis as the normal to project mouse click on to plane with that normal, at the object center. + // This generates a point behind the mouse cursor that is approximately in the middle of the object in + // terms of depth. + // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera. + // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable + // eccentricity to the object orientation + LLVector3 focus_plane_normal(longest_object_axis); + focus_plane_normal.normalize(); + + LLVector3d focus_pt_global; + gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal); + LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global); + + // find vector from camera to focus point in object space + LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin(); + camera_to_focus_vec.rotVec(inv_obj_rot); + + // find vector from object origin to focus point in object coordinates + LLVector3 focus_offset_from_object_center = focus_pt - obj_pos; + // convert to object-local space + focus_offset_from_object_center.rotVec(inv_obj_rot); + + // We need to project the focus point back into the bounding box of the focused object. + // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis + LLVector3 clip_fraction; + + // for each axis... + for (U32 axis = VX; axis <= VZ; axis++) + { + //...calculate distance that focus offset sits outside of bounding box along that axis... + //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center + F32 dist_out_of_bounds; + if (focus_offset_from_object_center.mV[axis] > 0.f) + { + dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f)); + } + else + { + dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f)); + } + + //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis + if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f) + { + // don't divide by very small number + clip_fraction.mV[axis] = 0.f; + } + else + { + clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis]; + } + } + + LLVector3 abs_clip_fraction = clip_fraction; + abs_clip_fraction.abs(); + + // find axis of focus offset that is *most* outside the bounding box and use that to + // rescale focus offset to inside object extents + if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY] + && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ]) + { + focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec; + } + else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ]) + { + focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec; + } + else + { + focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec; + } + + // convert back to world space + focus_offset_from_object_center.rotVec(obj_rot); + + // now, based on distance of camera from object relative to object size + // push the focus point towards the near surface of the object when (relatively) close to the objcet + // or keep the focus point in the object middle when (relatively) far + // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars + // is almost always "tumble about middle" and not "spin around surface point" + if (!is_avatar) + { + LLVector3 obj_rel = original_focus_point - object->getRenderPosition(); + + //now that we have the object relative position, we should bias toward the center of the object + //based on the distance of the camera to the focus point vs. the distance of the camera to the focus + + F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis()); + F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin()); + + + LLBBox obj_bbox = object->getBoundingBoxAgent(); + F32 bias = 0.f; + + // virtual_camera_pos is the camera position we are simulating by backing the camera off + // and adjusting the FOV + LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor)); + + // if the camera is inside the object (large, hollow objects, for example) + // leave focus point all the way to destination depth, away from object center + if(!obj_bbox.containsPointAgent(virtual_camera_pos)) + { + // perform magic number biasing of focus point towards surface vs. planar center + bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f); + obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias); + } + + focus_offset_from_object_center = obj_rel; + } + + return focus_offset_from_object_center; +} + +//----------------------------------------------------------------------------- +// calcCameraMinDistance() +//----------------------------------------------------------------------------- +BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) +{ + BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) + + if (!mFocusObject || mFocusObject->isDead()) + { + obj_min_distance = 0.f; + return TRUE; + } + + if (mFocusObject->mDrawable.isNull()) + { +#ifdef LL_RELEASE_FOR_DOWNLOAD + llwarns << "Focus object with no drawable!" << llendl; +#else + mFocusObject->dump(); + llerrs << "Focus object with no drawable!" << llendl; +#endif + obj_min_distance = 0.f; + return TRUE; + } + + LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation(); + LLVector3 target_offset_origin = mFocusObjectOffset; + LLVector3 camera_offset_target(getCameraPositionAgent() - gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + + // convert offsets into object local space + camera_offset_target.rotVec(inv_object_rot); + target_offset_origin.rotVec(inv_object_rot); + + // push around object extents based on target offset + LLVector3 object_extents = mFocusObject->getScale(); + if (mFocusObject->isAvatar()) + { + // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom) + object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR; + object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR; + object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR; + soft_limit = TRUE; + } + LLVector3 abs_target_offset = target_offset_origin; + abs_target_offset.abs(); + + LLVector3 target_offset_dir = target_offset_origin; + F32 object_radius = mFocusObject->getVObjRadius(); + + BOOL target_outside_object_extents = FALSE; + + for (U32 i = VX; i <= VZ; i++) + { + if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING) + { + target_outside_object_extents = TRUE; + } + if (camera_offset_target.mV[i] > 0.f) + { + object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f; + } + else + { + object_extents.mV[i] += target_offset_origin.mV[i] * 2.f; + } + } + + // don't shrink the object extents so far that the object inverts + object_extents.clamp(0.001f, F32_MAX); + + // move into first octant + LLVector3 camera_offset_target_abs_norm = camera_offset_target; + camera_offset_target_abs_norm.abs(); + // make sure offset is non-zero + camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); + camera_offset_target_abs_norm.normalize(); + + // find camera position relative to normalized object extents + LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; + camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX]; + camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY]; + camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ]; + + if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] && + camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ]) + { + if (camera_offset_target_abs_norm.mV[VX] < 0.001f) + { + obj_min_distance = object_extents.mV[VX] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX]; + } + } + else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ]) + { + if (camera_offset_target_abs_norm.mV[VY] < 0.001f) + { + obj_min_distance = object_extents.mV[VY] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY]; + } + } + else + { + if (camera_offset_target_abs_norm.mV[VZ] < 0.001f) + { + obj_min_distance = object_extents.mV[VZ] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ]; + } + } + + LLVector3 object_split_axis; + LLVector3 target_offset_scaled = target_offset_origin; + target_offset_scaled.abs(); + target_offset_scaled.normalize(); + target_offset_scaled.mV[VX] /= object_extents.mV[VX]; + target_offset_scaled.mV[VY] /= object_extents.mV[VY]; + target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; + + if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] && + target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ]) + { + object_split_axis = LLVector3::x_axis; + } + else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ]) + { + object_split_axis = LLVector3::y_axis; + } + else + { + object_split_axis = LLVector3::z_axis; + } + + 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; + + // target has moved outside of object extents + // check to see if camera and target are on same side + if (target_outside_object_extents) + { + if (camera_offset_clip > 0.f && target_offset_clip > 0.f) + { + return FALSE; + } + else if (camera_offset_clip < 0.f && target_offset_clip < 0.f) + { + return FALSE; + } + } + + // clamp obj distance to diagonal of 10 by 10 cube + obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3); + + obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); + + return TRUE; +} + +F32 LLAgentCamera::getCameraZoomFraction() +{ + // 0.f -> camera zoomed all the way out + // 1.f -> camera zoomed all the way in + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // already [0,1] + return mHUDTargetZoom; + } + else if (mFocusOnAvatar && cameraThirdPerson()) + { + return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); + } + else if (cameraCustomizeAvatar()) + { + F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); + return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f ); + } + else + { + F32 min_zoom; + const F32 DIST_FUDGE = 16.f; // meters + F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, + MAX_CAMERA_DISTANCE_FROM_AGENT); + + F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + else + { + min_zoom = LAND_MIN_ZOOM; + } + + return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f); + } +} + +void LLAgentCamera::setCameraZoomFraction(F32 fraction) +{ + // 0.f -> camera zoomed all the way out + // 1.f -> camera zoomed all the way in + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + mHUDTargetZoom = fraction; + } + else if (mFocusOnAvatar && cameraThirdPerson()) + { + mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); + } + else if (cameraCustomizeAvatar()) + { + LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; + camera_offset_dir.normalize(); + mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); + } + else + { + F32 min_zoom = LAND_MIN_ZOOM; + const F32 DIST_FUDGE = 16.f; // meters + F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, + MAX_CAMERA_DISTANCE_FROM_AGENT); + + if (mFocusObject.notNull()) + { + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + } + + LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; + camera_offset_dir.normalize(); + mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); + } + startCameraAnimation(); +} + + +//----------------------------------------------------------------------------- +// cameraOrbitAround() +//----------------------------------------------------------------------------- +void LLAgentCamera::cameraOrbitAround(const F32 radians) +{ + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // do nothing for hud selection + } + else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW)) + { + gAgent.yaw(radians); + } + else + { + mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); + + cameraZoomIn(1.f); + } +} + + +//----------------------------------------------------------------------------- +// cameraOrbitOver() +//----------------------------------------------------------------------------- +void LLAgentCamera::cameraOrbitOver(const F32 angle) +{ + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // do nothing for hud selection + } + else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + gAgent.pitch(angle); + } + else + { + LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); + camera_offset_unit.normalize(); + + F32 angle_from_up = acos( camera_offset_unit * gAgent.getReferenceUpVector() ); + + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); + mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); + + cameraZoomIn(1.f); + } +} + +//----------------------------------------------------------------------------- +// cameraZoomIn() +//----------------------------------------------------------------------------- +void LLAgentCamera::cameraZoomIn(const F32 fraction) +{ + if (gDisconnected) + { + return; + } + + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // just update hud zoom level + mHUDTargetZoom /= fraction; + return; + } + + + LLVector3d camera_offset(mCameraFocusOffsetTarget); + LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); + F32 min_zoom = LAND_MIN_ZOOM; + F32 current_distance = (F32)camera_offset_unit.normalize(); + F32 new_distance = current_distance * fraction; + + // Don't move through focus point + if (mFocusObject) + { + LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); + + if (mFocusObject->isAvatar()) + { + calcCameraMinDistance(min_zoom); + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + + new_distance = llmax(new_distance, min_zoom); + + // Don't zoom too far back + const F32 DIST_FUDGE = 16.f; // meters + F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); + + if (new_distance > max_distance) + { + new_distance = max_distance; + + /* + // Unless camera is unlocked + if (!LLViewerCamera::sDisableCameraConstraints) + { + return; + } + */ + } + + if( cameraCustomizeAvatar() ) + { + new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); + } + + mCameraFocusOffsetTarget = new_distance * camera_offset_unit; +} + +//----------------------------------------------------------------------------- +// cameraOrbitIn() +//----------------------------------------------------------------------------- +void LLAgentCamera::cameraOrbitIn(const F32 meters) +{ + if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale")); + + mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; + + if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) + { + // No need to animate, camera is already there. + changeCameraToMouselook(FALSE); + } + + mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION); + } + else + { + LLVector3d camera_offset(mCameraFocusOffsetTarget); + LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); + F32 current_distance = (F32)camera_offset_unit.normalize(); + F32 new_distance = current_distance - meters; + F32 min_zoom = LAND_MIN_ZOOM; + + // Don't move through focus point + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + + new_distance = llmax(new_distance, min_zoom); + + // Don't zoom too far back + const F32 DIST_FUDGE = 16.f; // meters + F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); + + if (new_distance > max_distance) + { + // Unless camera is unlocked + if (!gSavedSettings.getBOOL("DisableCameraConstraints")) + { + return; + } + } + + if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) + { + new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); + } + + // Compute new camera offset + mCameraFocusOffsetTarget = new_distance * camera_offset_unit; + cameraZoomIn(1.f); + } +} + + +//----------------------------------------------------------------------------- +// cameraPanIn() +//----------------------------------------------------------------------------- +void LLAgentCamera::cameraPanIn(F32 meters) +{ + LLVector3d at_axis; + at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); + + mFocusTargetGlobal += meters * at_axis; + mFocusGlobal = mFocusTargetGlobal; + // don't enforce zoom constraints as this is the only way for users to get past them easily + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); +} + +//----------------------------------------------------------------------------- +// cameraPanLeft() +//----------------------------------------------------------------------------- +void LLAgentCamera::cameraPanLeft(F32 meters) +{ + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + + mFocusTargetGlobal += meters * left_axis; + mFocusGlobal = mFocusTargetGlobal; + + // disable smoothing for camera pan, which causes some residents unhappiness + mCameraSmoothingStop = true; + + cameraZoomIn(1.f); + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); +} + +//----------------------------------------------------------------------------- +// cameraPanUp() +//----------------------------------------------------------------------------- +void LLAgentCamera::cameraPanUp(F32 meters) +{ + LLVector3d up_axis; + up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); + + mFocusTargetGlobal += meters * up_axis; + mFocusGlobal = mFocusTargetGlobal; + + // disable smoothing for camera pan, which causes some residents unhappiness + mCameraSmoothingStop = true; + + cameraZoomIn(1.f); + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); +} + +//----------------------------------------------------------------------------- +// updateLookAt() +//----------------------------------------------------------------------------- +void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) +{ + static LLVector3 last_at_axis; + + if (!isAgentAvatarValid()) return; + + 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)) + { + LLVector3 vel = gAgentAvatarp->getVelocity(); + if (vel.magVecSquared() > 4.f) + { + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot); + } + else + { + // *FIX: rotate mframeagent by sit object's rotation? + LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation + LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset); + } + last_at_axis = root_at; + return; + } + + last_at_axis = root_at; + + if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode()) + { + setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f)); + } + else + { + // Move head based on cursor position + ELookAtType lookAtType = LOOKAT_TARGET_NONE; + LLVector3 headLookAxis; + LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); + + if (cameraMouselook()) + { + lookAtType = LOOKAT_TARGET_MOUSELOOK; + } + else if (cameraThirdPerson()) + { + // range from -.5 to .5 + F32 x_from_center = + ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f; + F32 y_from_center = + ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f; + + frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); + frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); + lookAtType = LOOKAT_TARGET_FREELOOK; + } + + headLookAxis = frameCamera.getAtAxis(); + // RN: we use world-space offset for mouselook and freelook + //headLookAxis = headLookAxis * av_inv_rot; + setLookAt(lookAtType, gAgentAvatarp, headLookAxis); + } +} + +//----------------------------------------------------------------------------- +// updateCamera() +//----------------------------------------------------------------------------- +void LLAgentCamera::updateCamera() +{ + static LLFastTimer::DeclareTimer ftm("Camera"); + LLFastTimer t(ftm); + + //Ventrella - changed camera_skyward to the new global "mCameraUpVector" + mCameraUpVector = LLVector3::z_axis; + //LLVector3 camera_skyward(0.f, 0.f, 1.f); + //end Ventrella + + U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; + + validateFocusObject(); + + if (isAgentAvatarValid() && + gAgentAvatarp->isSitting() && + camera_mode == CAMERA_MODE_MOUSELOOK) + { + //Ventrella + //changed camera_skyward to the new global "mCameraUpVector" + mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation(); + //end Ventrella + } + + if (cameraThirdPerson() && mFocusOnAvatar && LLFollowCamMgr::getActiveFollowCamParams()) + { + changeCameraToFollow(); + } + + //Ventrella + //NOTE - this needs to be integrated into a general upVector system here within llAgent. + if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) + { + mCameraUpVector = mFollowCam.getUpVector(); + } + //end Ventrella + + if (mSitCameraEnabled) + { + if (mSitCameraReferenceObject->isDead()) + { + setSitCamera(LLUUID::null); + } + } + + // Update UI with our camera inputs + LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera"); + if (camera_floater) + { + camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f, // left + gAgentCamera.getOrbitUpKey() > 0.f, // top + gAgentCamera.getOrbitLeftKey() > 0.f, // right + gAgentCamera.getOrbitDownKey() > 0.f); // bottom + + camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f, // left + gAgentCamera.getPanUpKey() > 0.f, // top + gAgentCamera.getPanRightKey() > 0.f, // right + gAgentCamera.getPanDownKey() > 0.f); // bottom + } + + // Handle camera movement based on keyboard. + const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second + const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second + const F32 PAN_RATE = 5.f; // meters per second + + if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey()) + { + F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey(); + cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped ); + } + + if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey()) + { + F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey(); + cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped); + } + + if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey()) + { + F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey(); + + LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal(); + F32 distance_to_focus = (F32)to_focus.magVec(); + // Move at distance (in meters) meters per second + cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped ); + } + + if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey()) + { + F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey(); + cameraPanIn(input_rate * PAN_RATE / gFPSClamped); + } + + if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey()) + { + F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey(); + cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped ); + } + + if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey()) + { + F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey(); + cameraPanUp(input_rate * PAN_RATE / gFPSClamped ); + } + + // Clear camera keyboard keys. + gAgentCamera.clearOrbitKeys(); + gAgentCamera.clearPanKeys(); + + // lerp camera focus offset + mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); + + //Ventrella + if ( mCameraMode == CAMERA_MODE_FOLLOW ) + { + if (isAgentAvatarValid()) + { + //-------------------------------------------------------------------------------- + // this is where the avatar's position and rotation are given to followCam, and + // where it is updated. All three of its attributes are updated: (1) position, + // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. + //-------------------------------------------------------------------------------- + // *TODO: use combined rotation of frameagent and sit object + LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); + + LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); + if (current_cam) + { + mFollowCam.copyParams(*current_cam); + mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam ); + mFollowCam.update(); + LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); + } + else + { + changeCameraToThirdPerson(TRUE); + } + } + } + // end Ventrella + + BOOL hit_limit; + LLVector3d camera_pos_global; + LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit); + mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global); + LLVector3d focus_target_global = calcFocusPositionTargetGlobal(); + + // perform field of view correction + mCameraFOVZoomFactor = calcCameraFOVZoomFactor(); + camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor); + + gAgent.setShowAvatar(TRUE); // can see avatar by default + + // Adjust position for animation + if (mCameraAnimating) + { + F32 time = mAnimationTimer.getElapsedTimeF32(); + + // yet another instance of critically damped motion, hooray! + // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE); + + // linear interpolation + F32 fraction_of_animation = time / mAnimationDuration; + + BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; + BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; + F32 fraction_animation_to_skip; + + if (mAnimationCameraStartGlobal == camera_target_global) + { + fraction_animation_to_skip = 0.f; + } + else + { + LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global; + fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec(); + } + F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f; + F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f; + + if (fraction_of_animation < animation_finish_fraction) + { + if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction ) + { + gAgent.setShowAvatar(FALSE); + } + + // ...adjust position for animation + F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation); + camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation); + mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation); + } + else + { + // ...animation complete + mCameraAnimating = FALSE; + + camera_pos_global = camera_target_global; + mFocusGlobal = focus_target_global; + + gAgent.endAnimationUpdateUI(); + gAgent.setShowAvatar(TRUE); + } + + if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK)) + { + gAgentAvatarp->updateAttachmentVisibility(mCameraMode); + } + } + else + { + camera_pos_global = camera_target_global; + mFocusGlobal = focus_target_global; + gAgent.setShowAvatar(TRUE); + } + + // smoothing + if (TRUE) + { + LLVector3d agent_pos = gAgent.getPositionGlobal(); + LLVector3d camera_pos_agent = camera_pos_global - agent_pos; + // Sitting on what you're manipulating can cause camera jitter with smoothing. + // This turns off smoothing while editing. -MG + bool in_build_mode = LLToolMgr::getInstance()->inBuildMode(); + mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode; + + if (cameraThirdPerson() && !mCameraSmoothingStop) + { + const F32 SMOOTHING_HALF_LIFE = 0.02f; + + F32 smoothing = LLCriticalDamp::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); + + if (!mFocusObject) // we differentiate on avatar mode + { + // for avatar-relative focus, we smooth in avatar space - + // the avatar moves too jerkily w/r/t global space to smooth there. + + LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent; + if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please + { + camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing); + camera_pos_global = camera_pos_agent + agent_pos; + } + } + else + { + LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal; + if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please + { + camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing); + } + } + } + + mCameraSmoothingLastPositionGlobal = camera_pos_global; + mCameraSmoothingLastPositionAgent = camera_pos_agent; + mCameraSmoothingStop = false; + } + + + mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(FOV_ZOOM_HALF_LIFE)); + +// llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl; + + F32 ui_offset = 0.f; + if( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode ) + { + ui_offset = calcCustomizeAvatarUIOffset( camera_pos_global ); + } + + + LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal); + + mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global); + + // Move the camera + + //Ventrella + LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); + //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); + //end Ventrella + + //RN: translate UI offset after camera is oriented properly + LLViewerCamera::getInstance()->translate(LLViewerCamera::getInstance()->getLeftAxis() * ui_offset); + + // Change FOV + LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); + + // follow camera when in customize mode + if (cameraCustomizeAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent); + } + + // update the travel distance stat + // this isn't directly related to the camera + // but this seemed like the best place to do this + LLVector3d global_pos = gAgent.getPositionGlobal(); + if (!gAgent.getLastPositionGlobal().isExactlyZero()) + { + LLVector3d delta = global_pos - gAgent.getLastPositionGlobal(); + gAgent.setDistanceTraveled(gAgent.getDistanceTraveled() + delta.magVec()); + } + gAgent.setLastPositionGlobal(global_pos); + + if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook()) + { + LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() + + 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(); + + LLJoint* torso_joint = gAgentAvatarp->mTorsop; + LLJoint* chest_joint = gAgentAvatarp->mChestp; + LLVector3 torso_scale = torso_joint->getScale(); + LLVector3 chest_scale = chest_joint->getScale(); + + // shorten avatar skeleton to avoid foot interpenetration + if (!gAgentAvatarp->mInAir) + { + LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation(); + F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f); + F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f); + torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); + + LLJoint* neck_joint = gAgentAvatarp->mNeckp; + LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation(); + scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f); + chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); + diff.mV[VZ] = 0.f; + } + + gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); + + gAgentAvatarp->mRoot.updateWorldMatrixChildren(); + + 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 && !attached_object->isDead() && attached_object->mDrawable.notNull()) + { + // clear any existing "early" movements of attachment + attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE); + gPipeline.updateMoveNormalAsync(attached_object->mDrawable); + attached_object->updateText(); + } + } + } + + torso_joint->setScale(torso_scale); + chest_joint->setScale(chest_scale); + } +} + +void LLAgentCamera::updateLastCamera() +{ + mLastCameraMode = mCameraMode; +} + +void LLAgentCamera::updateFocusOffset() +{ + validateFocusObject(); + if (mFocusObject.notNull()) + { + LLVector3d obj_pos = gAgent.getPosGlobalFromAgent(mFocusObject->getRenderPosition()); + mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos); + } +} + +void LLAgentCamera::validateFocusObject() +{ + if (mFocusObject.notNull() && + mFocusObject->isDead()) + { + mFocusObjectOffset.clearVec(); + clearFocusObject(); + mCameraFOVZoomFactor = 0.f; + } +} + +//----------------------------------------------------------------------------- +// calcCustomizeAvatarUIOffset() +//----------------------------------------------------------------------------- +F32 LLAgentCamera::calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global) +{ + F32 ui_offset = 0.f; + + if (gFloaterCustomize) + { + const LLRect& rect = gFloaterCustomize->getRect(); + + // Move the camera so that the avatar isn't covered up by this floater. + F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidthScaled())))); + F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); // radians + F32 offset = tan(apparent_angle); + + if( rect.mLeft < (gViewerWindow->getWindowWidthScaled() - rect.mRight) ) + { + // Move the avatar to the right (camera to the left) + ui_offset = offset; + } + else + { + // Move the avatar to the left (camera to the right) + ui_offset = -offset; + } + } + F32 range = (F32)dist_vec(camera_pos_global, getFocusGlobal()); + mUIOffset = lerp(mUIOffset, ui_offset, LLCriticalDamp::getInterpolant(0.05f)); + return mUIOffset * range; +} + +//----------------------------------------------------------------------------- +// calcFocusPositionTargetGlobal() +//----------------------------------------------------------------------------- +LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal() +{ + if (mFocusObject.notNull() && mFocusObject->isDead()) + { + clearFocusObject(); + } + + // Ventrella + if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus()); + return mFocusTargetGlobal; + }// End Ventrella + else if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + LLVector3d at_axis(1.0, 0.0, 0.0); + LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot(); + if (!root_object->flagCameraDecoupled()) + { + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); + } + } + at_axis = at_axis * agent_rot; + mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis; + return mFocusTargetGlobal; + } + else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) + { + return mFocusTargetGlobal; + } + else if (!mFocusOnAvatar) + { + if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull()) + { + LLDrawable* drawablep = mFocusObject->mDrawable; + + if (mTrackFocusObject && + drawablep && + drawablep->isActive()) + { + if (!mFocusObject->isAvatar()) + { + if (mFocusObject->isSelected()) + { + gPipeline.updateMoveNormalAsync(drawablep); + } + else + { + if (drawablep->isState(LLDrawable::MOVE_UNDAMPED)) + { + gPipeline.updateMoveNormalAsync(drawablep); + } + else + { + gPipeline.updateMoveDampedAsync(drawablep); + } + } + } + } + // if not tracking object, update offset based on new object position + else + { + updateFocusOffset(); + } + LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset; + mFocusTargetGlobal.setVec(gAgent.getPosGlobalFromAgent(focus_agent)); + } + return mFocusTargetGlobal; + } + else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull()) + { + // sit camera + LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); + LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); + + LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot); + return gAgent.getPosGlobalFromAgent(target_pos); + } + else + { + return gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(); + } +} + +LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() +{ + // ...offset from avatar + LLVector3d focus_offset; + LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); + } + + focus_offset = mFocusOffsetInitial[mCameraPreset] * agent_rot; + return focus_offset; +} + +void LLAgentCamera::setupSitCamera() +{ + // agent frame entering this function is in world coordinates + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + // slam agent coordinate frame to proper parent local version + LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~parent_rot); + } +} + +//----------------------------------------------------------------------------- +// getCameraPositionAgent() +//----------------------------------------------------------------------------- +const LLVector3 &LLAgentCamera::getCameraPositionAgent() const +{ + return LLViewerCamera::getInstance()->getOrigin(); +} + +//----------------------------------------------------------------------------- +// getCameraPositionGlobal() +//----------------------------------------------------------------------------- +LLVector3d LLAgentCamera::getCameraPositionGlobal() const +{ + return gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); +} + +//----------------------------------------------------------------------------- +// calcCameraFOVZoomFactor() +//----------------------------------------------------------------------------- +F32 LLAgentCamera::calcCameraFOVZoomFactor() +{ + LLVector3 camera_offset_dir; + camera_offset_dir.setVec(mCameraFocusOffset); + + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + return 0.f; + } + 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()); + + mFocusObjectDist = obj_min_dist - current_distance; + + F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f); + return new_fov_zoom; + } + else // focusing on land or avatar + { + // keep old field of view until user changes focus explicitly + return mCameraFOVZoomFactor; + //return 0.f; + } +} + +//----------------------------------------------------------------------------- +// calcCameraPositionTargetGlobal() +//----------------------------------------------------------------------------- +LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) +{ + // Compute base camera position and look-at points. + F32 camera_land_height; + LLVector3d frame_center_global = !isAgentAvatarValid() ? + gAgent.getPositionGlobal() : + gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition()); + + BOOL isConstrained = FALSE; + LLVector3d head_offset; + head_offset.setVec(mThirdPersonHeadOffset); + + LLVector3d camera_position_global; + + // Ventrella + if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) + { + camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition()); + }// End Ventrella + else if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull()) + { + llwarns << "Null avatar drawable!" << llendl; + return LLVector3d::zero; + } + head_offset.clearVec(); + if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent()) + { + gAgentAvatarp->updateHeadOffset(); + head_offset.mdV[VX] = gAgentAvatarp->mHeadOffset.mV[VX]; + head_offset.mdV[VY] = gAgentAvatarp->mHeadOffset.mV[VY]; + head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ] + 0.1f; + const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix(); + camera_position_global = gAgent.getPosGlobalFromAgent + ((gAgentAvatarp->getPosition()+ + LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat); + } + else + { + head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ]; + if (gAgentAvatarp->isSitting()) + { + head_offset.mdV[VZ] += 0.1; + } + camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global; + head_offset = head_offset * gAgentAvatarp->getRenderRotation(); + camera_position_global = camera_position_global + head_offset; + } + } + else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar) + { + LLVector3 local_camera_offset; + F32 camera_distance = 0.f; + + if (mSitCameraEnabled + && isAgentAvatarValid() + && gAgentAvatarp->isSitting() + && mSitCameraReferenceObject.notNull()) + { + // sit camera + LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); + LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); + + LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot); + + camera_position_global = gAgent.getPosGlobalFromAgent(target_pos); + } + else + { + local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); + + // are we sitting down? + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + // slam agent coordinate frame to proper parent local version + LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot; + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~parent_rot); + + local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot; + } + else + { + local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset ); + } + + if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting())) + { + LLVector3 plane_normal; + plane_normal.setVec(mCameraCollidePlane.mV); + + F32 offset_dot_norm = local_camera_offset * plane_normal; + if (llabs(offset_dot_norm) < 0.001f) + { + offset_dot_norm = 0.001f; + } + + camera_distance = local_camera_offset.normalize(); + + F32 pos_dot_norm = gAgent.getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; + + // if agent is outside the colliding half-plane + if (pos_dot_norm > mCameraCollidePlane.mV[VW]) + { + // check to see if camera is on the opposite side (inside) the half-plane + if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW]) + { + // diminish offset by factor to push it back outside the half-plane + camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm; + } + } + else + { + if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW]) + { + camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm; + } + } + } + else + { + camera_distance = local_camera_offset.normalize(); + } + + mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); + + if (mTargetCameraDistance != mCurrentCameraDistance) + { + F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(CAMERA_ZOOM_HALF_LIFE); + + mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); + } + + // Make the camera distance current + local_camera_offset *= mCurrentCameraDistance; + + // 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; + + if (isAgentAvatarValid()) + { + LLVector3d camera_lag_d; + F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE); + LLVector3 target_lag; + LLVector3 vel = gAgent.getVelocity(); + + // lag by appropriate amount for flying + F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32(); + if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) + { + LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis(); + frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector()); + frame_at_axis.normalize(); + + //transition smoothly in air mode, to avoid camera pop + F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; + u = llclamp(u, 0.f, 1.f); + + lag_interp *= u; + + if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID()) + { + // disable camera lag when using mouse-directed steering + target_lag.clearVec(); + } + else + { + target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f; + } + + mCameraLag = lerp(mCameraLag, target_lag, lag_interp); + + F32 lag_dist = mCameraLag.magVec(); + if (lag_dist > MAX_CAMERA_LAG) + { + mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist; + } + + // clamp camera lag so that avatar is always in front + F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis; + if (dot < -(MIN_CAMERA_LAG * u)) + { + mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis; + } + } + else + { + mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(0.15f)); + } + + camera_lag_d.setVec(mCameraLag); + camera_position_global = camera_position_global - camera_lag_d; + } + } + } + else + { + LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal(); + // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value + camera_position_global = focusPosGlobal + mCameraFocusOffset; + } + + if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike()) + { + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); + bool constrain = true; + if(regionp && regionp->canManageEstate()) + { + constrain = false; + } + if(constrain) + { + F32 max_dist = (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) ? APPEARANCE_MAX_ZOOM : mDrawDistance; + + LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal(); + F32 camera_distance = (F32)camera_offset.magVec(); + + if(camera_distance > max_dist) + { + camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset; + isConstrained = TRUE; + } + } + +// JC - Could constrain camera based on parcel stuff here. +// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); +// +// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) +// { +// camera_position_global = last_position_global; +// +// isConstrained = TRUE; +// } + } + + // Don't let camera go underground + F32 camera_min_off_ground = getCameraMinOffGround(); + + camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); + + if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) + { + camera_position_global.mdV[VZ] = camera_land_height + camera_min_off_ground; + isConstrained = TRUE; + } + + + if (hit_limit) + { + *hit_limit = isConstrained; + } + + return camera_position_global; +} + + +LLVector3 LLAgentCamera::getCameraOffsetInitial() +{ + return mCameraOffsetInitial[mCameraPreset]; +} + + +//----------------------------------------------------------------------------- +// handleScrollWheel() +//----------------------------------------------------------------------------- +void LLAgentCamera::handleScrollWheel(S32 clicks) +{ + if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar()) + { + if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place + { + mFollowCam.zoom(clicks); + if (mFollowCam.isZoomedToMinimumDistance()) + { + changeCameraToMouselook(FALSE); + } + } + } + else + { + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2); + + // Block if camera is animating + if (mCameraAnimating) + { + return; + } + + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + F32 zoom_factor = (F32)pow(0.8, -clicks); + cameraZoomIn(zoom_factor); + } + else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON)) + { + F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); + + F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks); + + cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + } + else + { + F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec(); + cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks))); + } + } +} + + +//----------------------------------------------------------------------------- +// getCameraMinOffGround() +//----------------------------------------------------------------------------- +F32 LLAgentCamera::getCameraMinOffGround() +{ + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + return 0.f; + } + else + { + if (gSavedSettings.getBOOL("DisableCameraConstraints")) + { + return -1000.f; + } + else + { + return 0.5f; + } + } +} + + +//----------------------------------------------------------------------------- +// resetCamera() +//----------------------------------------------------------------------------- +void LLAgentCamera::resetCamera() +{ + // Remove any pitch from the avatar + LLVector3 at = gAgent.getFrameAgent().getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); + // have to explicitly clear field of view zoom now + mCameraFOVZoomFactor = 0.f; + + updateCamera(); +} + +//----------------------------------------------------------------------------- +// changeCameraToMouselook() +//----------------------------------------------------------------------------- +void LLAgentCamera::changeCameraToMouselook(BOOL animate) +{ + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + // visibility changes at end of animation + gViewerWindow->getWindow()->resetBusyCount(); + + // unpause avatar animation + gAgent.unpauseAnimation(); + + LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); + + if (isAgentAvatarValid()) + { + gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT); + } + + //gViewerWindow->stopGrab(); + LLSelectMgr::getInstance()->deselectAll(); + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); + + if (mCameraMode != CAMERA_MODE_MOUSELOOK) + { + gFocusMgr.setKeyboardFocus(NULL); + + updateLastCamera(); + mCameraMode = CAMERA_MODE_MOUSELOOK; + const U32 old_flags = gAgent.getControlFlags(); + gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK); + if (old_flags != gAgent.getControlFlags()) + { + gAgent.setFlagsDirty(); + } + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } + } +} + + +//----------------------------------------------------------------------------- +// changeCameraToDefault() +//----------------------------------------------------------------------------- +void LLAgentCamera::changeCameraToDefault() +{ + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + if (LLFollowCamMgr::getActiveFollowCamParams()) + { + changeCameraToFollow(); + } + else + { + changeCameraToThirdPerson(); + } +} + + +// Ventrella +//----------------------------------------------------------------------------- +// changeCameraToFollow() +//----------------------------------------------------------------------------- +void LLAgentCamera::changeCameraToFollow(BOOL animate) +{ + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + if(mCameraMode != CAMERA_MODE_FOLLOW) + { + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + animate = FALSE; + } + startCameraAnimation(); + + updateLastCamera(); + mCameraMode = CAMERA_MODE_FOLLOW; + + // bang-in the current focus, position, and up vector of the follow cam + mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis); + + if (gBasicToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + if (isAgentAvatarValid()) + { + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); + gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); + gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT ); + } + + // unpause avatar animation + gAgent.unpauseAnimation(); + + const U32 old_flags = gAgent.getControlFlags(); + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + if (old_flags != gAgent.getControlFlags()) + { + gAgent.setFlagsDirty(); + } + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } + } +} + +//----------------------------------------------------------------------------- +// changeCameraToThirdPerson() +//----------------------------------------------------------------------------- +void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) +{ + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + gViewerWindow->getWindow()->resetBusyCount(); + + mCameraZoomFraction = INITIAL_ZOOM_FRACTION; + + if (isAgentAvatarValid()) + { + if (!gAgentAvatarp->isSitting()) + { + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); + } + gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT); + } + + LLVector3 at_axis; + + // unpause avatar animation + gAgent.unpauseAnimation(); + + if (mCameraMode != CAMERA_MODE_THIRD_PERSON) + { + if (gBasicToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + mCameraLag.clearVec(); + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + mCurrentCameraDistance = MIN_CAMERA_DISTANCE; + mTargetCameraDistance = MIN_CAMERA_DISTANCE; + animate = FALSE; + } + updateLastCamera(); + mCameraMode = CAMERA_MODE_THIRD_PERSON; + const U32 old_flags = gAgent.getControlFlags(); + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + if (old_flags != gAgent.getControlFlags()) + { + gAgent.setFlagsDirty(); + } + + } + + // Remove any pitch from the avatar + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~obj_rot); + } + else + { + at_axis = gAgent.getFrameAgent().getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis); + } + + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } +} + +//----------------------------------------------------------------------------- +// changeCameraToCustomizeAvatar() +//----------------------------------------------------------------------------- +void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_animate) +{ + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + gAgent.standUp(); // force stand up + gViewerWindow->getWindow()->resetBusyCount(); + + if (gFaceEditToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); + } + + if (camera_animate) + { + startCameraAnimation(); + } + + // Remove any pitch from the avatar + //LLVector3 at = gAgent.getFrameAgent().getAtAxis(); + //at.mV[VZ] = 0.f; + //at.normalize(); + //gAgent.resetAxes(at); + + if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR) + { + updateLastCamera(); + mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR; + const U32 old_flags = gAgent.getControlFlags(); + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + if (old_flags != gAgent.getControlFlags()) + { + gAgent.setFlagsDirty(); + } + + gFocusMgr.setKeyboardFocus( NULL ); + gFocusMgr.setMouseCapture( NULL ); + + LLVOAvatarSelf::onCustomizeStart(); + } + + if (isAgentAvatarValid()) + { + if(avatar_animate) + { + // Remove any pitch from the avatar + LLVector3 at = gAgent.getFrameAgent().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); + + if (turn_motion) + { + mAnimationDuration = turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP; + + } + else + { + mAnimationDuration = gSavedSettings.getF32("ZoomTime"); + } + } + setFocusGlobal(LLVector3d::zero); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } +} + + +void LLAgentCamera::switchCameraPreset(ECameraPreset preset) +{ + //zoom is supposed to be reset for the front and group views + mCameraZoomFraction = 1.f; + + //focusing on avatar in that case means following him on movements + mFocusOnAvatar = TRUE; + + mCameraPreset = preset; + + gSavedSettings.setU32("CameraPreset", mCameraPreset); +} + + +// +// Focus point management +// + +//----------------------------------------------------------------------------- +// startCameraAnimation() +//----------------------------------------------------------------------------- +void LLAgentCamera::startCameraAnimation() +{ + mAnimationCameraStartGlobal = getCameraPositionGlobal(); + mAnimationFocusStartGlobal = mFocusGlobal; + mAnimationTimer.reset(); + mCameraAnimating = TRUE; + mAnimationDuration = gSavedSettings.getF32("ZoomTime"); +} + +//----------------------------------------------------------------------------- +// stopCameraAnimation() +//----------------------------------------------------------------------------- +void LLAgentCamera::stopCameraAnimation() +{ + mCameraAnimating = FALSE; +} + +void LLAgentCamera::clearFocusObject() +{ + if (mFocusObject.notNull()) + { + startCameraAnimation(); + + setFocusObject(NULL); + mFocusObjectOffset.clearVec(); + } +} + +void LLAgentCamera::setFocusObject(LLViewerObject* object) +{ + mFocusObject = object; +} + +// Focus on a point, but try to keep camera position stable. +//----------------------------------------------------------------------------- +// setFocusGlobal() +//----------------------------------------------------------------------------- +void LLAgentCamera::setFocusGlobal(const LLPickInfo& pick) +{ + LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID); + + if (objectp) + { + // focus on object plus designated offset + // which may or may not be same as pick.mPosGlobal + setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID); + } + else + { + // focus directly on point where user clicked + setFocusGlobal(pick.mPosGlobal, pick.mObjectID); + } +} + + +void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id) +{ + setFocusObject(gObjectList.findObject(object_id)); + LLVector3d old_focus = mFocusTargetGlobal; + LLViewerObject *focus_obj = mFocusObject; + + // if focus has changed + if (old_focus != focus) + { + if (focus.isExactlyZero()) + { + if (isAgentAvatarValid()) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); + } + else + { + mFocusTargetGlobal = gAgent.getPositionGlobal(); + } + mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal; + mCameraFocusOffset = mCameraFocusOffsetTarget; + setLookAt(LOOKAT_TARGET_CLEAR); + } + else + { + mFocusTargetGlobal = focus; + if (!focus_obj) + { + mCameraFOVZoomFactor = 0.f; + } + + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal; + + startCameraAnimation(); + + if (focus_obj) + { + if (focus_obj->isAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, focus_obj); + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (gAgent.getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation()); + } + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + } + } + } + else // focus == mFocusTargetGlobal + { + if (focus.isExactlyZero()) + { + if (isAgentAvatarValid()) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); + } + else + { + mFocusTargetGlobal = gAgent.getPositionGlobal(); + } + } + mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);; + mCameraFocusOffset = mCameraFocusOffsetTarget; + } + + if (mFocusObject.notNull()) + { + // for attachments, make offset relative to avatar, not the attachment + if (mFocusObject->isAttachment()) + { + while (mFocusObject.notNull() && !mFocusObject->isAvatar()) + { + mFocusObject = (LLViewerObject*) mFocusObject->getParent(); + } + setFocusObject((LLViewerObject*)mFocusObject); + } + updateFocusOffset(); + } +} + +// Used for avatar customization +//----------------------------------------------------------------------------- +// setCameraPosAndFocusGlobal() +//----------------------------------------------------------------------------- +void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id) +{ + LLVector3d old_focus = mFocusTargetGlobal; + + F64 focus_delta_squared = (old_focus - focus).magVecSquared(); + const F64 ANIM_EPSILON_SQUARED = 0.0001; + if (focus_delta_squared > ANIM_EPSILON_SQUARED) + { + startCameraAnimation(); + + if (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) + { + // Compensate for the fact that the camera has already been offset to make room for LLFloaterCustomize. + mAnimationCameraStartGlobal -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * calcCustomizeAvatarUIOffset( mAnimationCameraStartGlobal )); + } + } + + //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); + setFocusObject(gObjectList.findObject(object_id)); + mFocusTargetGlobal = focus; + mCameraFocusOffsetTarget = camera_pos - focus; + mCameraFocusOffset = mCameraFocusOffsetTarget; + + if (mFocusObject) + { + if (mFocusObject->isAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject); + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (gAgent.getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation()); + } + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + } + + if (mCameraAnimating) + { + const F64 ANIM_METERS_PER_SECOND = 10.0; + const F64 MIN_ANIM_SECONDS = 0.5; + const F64 MAX_ANIM_SECONDS = 10.0; + F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND ); + anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS ); + setAnimationDuration( (F32)anim_duration ); + } + + updateFocusOffset(); +} + +//----------------------------------------------------------------------------- +// setSitCamera() +//----------------------------------------------------------------------------- +void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos, const LLVector3 &camera_focus) +{ + BOOL camera_enabled = !object_id.isNull(); + + if (camera_enabled) + { + LLViewerObject *reference_object = gObjectList.findObject(object_id); + if (reference_object) + { + //convert to root object relative? + mSitCameraPos = camera_pos; + mSitCameraFocus = camera_focus; + mSitCameraReferenceObject = reference_object; + mSitCameraEnabled = TRUE; + } + } + else + { + mSitCameraPos.clearVec(); + mSitCameraFocus.clearVec(); + mSitCameraReferenceObject = NULL; + mSitCameraEnabled = FALSE; + } +} + +//----------------------------------------------------------------------------- +// setFocusOnAvatar() +//----------------------------------------------------------------------------- +void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) +{ + if (focus_on_avatar != mFocusOnAvatar) + { + if (animate) + { + startCameraAnimation(); + } + else + { + stopCameraAnimation(); + } + } + + //RN: when focused on the avatar, we're not "looking" at it + // looking implies intent while focusing on avatar means + // you're just walking around with a camera on you...eesh. + if (!mFocusOnAvatar && focus_on_avatar) + { + setFocusGlobal(LLVector3d::zero); + mCameraFOVZoomFactor = 0.f; + if (mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + LLVector3 at_axis; + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~obj_rot); + } + else + { + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis); + } + } + } + // unlocking camera from avatar + else if (mFocusOnAvatar && !focus_on_avatar) + { + // keep camera focus point consistent, even though it is now unlocked + setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID()); + } + + mFocusOnAvatar = focus_on_avatar; +} + + +BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) +{ + if(object && object->isAttachment()) + { + LLViewerObject* parent = object; + while(parent) + { + if (parent == gAgentAvatarp) + { + // looking at an attachment on ourselves, which we don't want to do + object = gAgentAvatarp; + position.clearVec(); + } + parent = (LLViewerObject*)parent->getParent(); + } + } + if(!mLookAt || mLookAt->isDead()) + { + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + mLookAt->setSourceObject(gAgentAvatarp); + } + + return mLookAt->setLookAt(target_type, object, position); +} + +//----------------------------------------------------------------------------- +// lookAtLastChat() +//----------------------------------------------------------------------------- +void LLAgentCamera::lookAtLastChat() +{ + // Block if camera is animating or not in normal third person camera mode + if (mCameraAnimating || !cameraThirdPerson()) + { + return; + } + + LLViewerObject *chatter = gObjectList.findObject(gAgent.getLastChatter()); + if (!chatter) + { + return; + } + + LLVector3 delta_pos; + if (chatter->isAvatar()) + { + LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; + if (isAgentAvatarValid() && chatter_av->mHeadp) + { + delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition(); + } + else + { + delta_pos = chatter->getPositionAgent() - gAgent.getPositionAgent(); + } + delta_pos.normalize(); + + gAgent.setControlFlags(AGENT_CONTROL_STOP); + + changeCameraToThirdPerson(); + + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); + LLVector3 left = delta_pos % LLVector3::z_axis; + left.normalize(); + LLVector3 up = left % delta_pos; + up.normalize(); + new_camera_pos -= delta_pos * 0.4f; + new_camera_pos += left * 0.3f; + new_camera_pos += up * 0.2f; + if (chatter_av->mHeadp) + { + setFocusGlobal(gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); + } + else + { + setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); + } + setFocusOnAvatar(FALSE, TRUE); + } + else + { + delta_pos = chatter->getRenderPosition() - gAgent.getPositionAgent(); + delta_pos.normalize(); + + gAgent.setControlFlags(AGENT_CONTROL_STOP); + + changeCameraToThirdPerson(); + + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); + LLVector3 left = delta_pos % LLVector3::z_axis; + left.normalize(); + LLVector3 up = left % delta_pos; + up.normalize(); + new_camera_pos -= delta_pos * 0.4f; + new_camera_pos += left * 0.3f; + new_camera_pos += up * 0.2f; + + setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); + setFocusOnAvatar(FALSE, TRUE); + } +} + +BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) +{ + // disallow pointing at attachments and avatars + if (object && (object->isAttachment() || object->isAvatar())) + { + return FALSE; + } + if (!mPointAt || mPointAt->isDead()) + { + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + mPointAt->setSourceObject(gAgentAvatarp); + } + return mPointAt->setPointAt(target_type, object, position); +} + +ELookAtType LLAgentCamera::getLookAtType() +{ + if (mLookAt) + { + return mLookAt->getLookAtType(); + } + return LOOKAT_TARGET_NONE; +} + +EPointAtType LLAgentCamera::getPointAtType() +{ + if (mPointAt) + { + return mPointAt->getPointAtType(); + } + return POINTAT_TARGET_NONE; +} + +void LLAgentCamera::clearGeneralKeys() +{ + mAtKey = 0; + mWalkKey = 0; + mLeftKey = 0; + mUpKey = 0; + mYawKey = 0.f; + mPitchKey = 0.f; +} + +void LLAgentCamera::clearOrbitKeys() +{ + mOrbitLeftKey = 0.f; + mOrbitRightKey = 0.f; + mOrbitUpKey = 0.f; + mOrbitDownKey = 0.f; + mOrbitInKey = 0.f; + mOrbitOutKey = 0.f; +} + +void LLAgentCamera::clearPanKeys() +{ + mPanRightKey = 0.f; + mPanLeftKey = 0.f; + mPanUpKey = 0.f; + mPanDownKey = 0.f; + mPanInKey = 0.f; + mPanOutKey = 0.f; +} + +// static +S32 LLAgentCamera::directionToKey(S32 direction) +{ + if (direction > 0) return 1; + if (direction < 0) return -1; + return 0; +} + + +// EOF + diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h new file mode 100644 index 0000000000..5cbb1de6f4 --- /dev/null +++ b/indra/newview/llagentcamera.h @@ -0,0 +1,400 @@ +/** + * @file llagent.h + * @brief LLAgent class header file + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLAGENTCAMERA_H +#define LL_LLAGENTCAMERA_H + +#include "llfollowcam.h" // Ventrella +#include "llhudeffectlookat.h" // EPointAtType +#include "llhudeffectpointat.h" // ELookAtType + +class LLPickInfo; +class LLVOAvatarSelf; + +//-------------------------------------------------------------------- +// Types +//-------------------------------------------------------------------- +enum ECameraMode +{ + CAMERA_MODE_THIRD_PERSON, + CAMERA_MODE_MOUSELOOK, + CAMERA_MODE_CUSTOMIZE_AVATAR, + CAMERA_MODE_FOLLOW +}; + +/** Camera Presets for CAMERA_MODE_THIRD_PERSON */ +enum ECameraPreset +{ + /** Default preset, what the Third Person Mode actually was */ + CAMERA_PRESET_REAR_VIEW, + + /** "Looking at the Avatar from the front" */ + CAMERA_PRESET_FRONT_VIEW, + + /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ + CAMERA_PRESET_GROUP_VIEW +}; + +//------------------------------------------------------------------------ +// LLAgentCamera +//------------------------------------------------------------------------ +class LLAgentCamera +{ + LOG_CLASS(LLAgentCamera); + +public: + //-------------------------------------------------------------------- + // Constructors / Destructors + //-------------------------------------------------------------------- +public: + LLAgentCamera(); + virtual ~LLAgentCamera(); + void init(); + void cleanup(); + void setAvatarObject(LLVOAvatarSelf* avatar); +private: + bool mInitialized; + + + //-------------------------------------------------------------------- + // Mode + //-------------------------------------------------------------------- +public: + void changeCameraToDefault(); + void changeCameraToMouselook(BOOL animate = TRUE); + void changeCameraToThirdPerson(BOOL animate = TRUE); + void changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // Trigger transition animation + void changeCameraToFollow(BOOL animate = TRUE); // Ventrella + BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } + BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } + BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } + BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } + ECameraMode getCameraMode() const { return mCameraMode; } + ECameraMode getLastCameraMode() const { return mLastCameraMode; } + void updateCamera(); // Call once per frame to update camera location/orientation + void resetCamera(); // Slam camera into its default position + void updateLastCamera(); // Set last camera to current camera + +private: + ECameraMode mCameraMode; // Target mode after transition animation is done + ECameraMode mLastCameraMode; + + //-------------------------------------------------------------------- + // Preset + //-------------------------------------------------------------------- +public: + void switchCameraPreset(ECameraPreset preset); +private: + /** Determines default camera offset depending on the current camera preset */ + LLVector3 getCameraOffsetInitial(); + + /** Camera preset in Third Person Mode */ + ECameraPreset mCameraPreset; + + /** Initial camera offsets */ + std::map<ECameraPreset, LLVector3> mCameraOffsetInitial; + + /** Initial focus offsets */ + std::map<ECameraPreset, LLVector3d> mFocusOffsetInitial; + + //-------------------------------------------------------------------- + // Position + //-------------------------------------------------------------------- +public: + LLVector3d getCameraPositionGlobal() const; + const LLVector3 &getCameraPositionAgent() const; + LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target + F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters + void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } + BOOL calcCameraMinDistance(F32 &obj_min_distance); + F32 calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global); + F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } + void clearCameraLag() { mCameraLag.clearVec(); } +private: + F32 mCurrentCameraDistance; // Current camera offset from avatar + F32 mTargetCameraDistance; // Target camera offset from avatar + F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object + F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom + F32 mCameraFOVDefault; // Default field of view that is basis for FOV zoom effect + LLVector4 mCameraCollidePlane; // Colliding plane for camera + F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom + LLVector3 mCameraPositionAgent; // Camera position in agent coordinates + LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom + LLVector3d mCameraSmoothingLastPositionGlobal; + LLVector3d mCameraSmoothingLastPositionAgent; + bool mCameraSmoothingStop; + LLVector3 mCameraLag; // Third person camera lag + LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view) + + //-------------------------------------------------------------------- + // Follow + //-------------------------------------------------------------------- +public: + void setUsingFollowCam(bool using_follow_cam); +private: + LLFollowCam mFollowCam; // Ventrella + + //-------------------------------------------------------------------- + // Sit + //-------------------------------------------------------------------- +public: + void setupSitCamera(); + BOOL sitCameraEnabled() { return mSitCameraEnabled; } + void setSitCamera(const LLUUID &object_id, + const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); +private: + LLPointer<LLViewerObject> mSitCameraReferenceObject; // Object to which camera is related when sitting + BOOL mSitCameraEnabled; // Use provided camera information when sitting? + LLVector3 mSitCameraPos; // Root relative camera pos when sitting + LLVector3 mSitCameraFocus; // Root relative camera target when sitting + + //-------------------------------------------------------------------- + // Animation + //-------------------------------------------------------------------- +public: + void setCameraAnimating(BOOL b) { mCameraAnimating = b; } + BOOL getCameraAnimating() { return mCameraAnimating; } + void setAnimationDuration(F32 seconds) { mAnimationDuration = seconds; } + void startCameraAnimation(); + void stopCameraAnimation(); +private: + LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active + F32 mAnimationDuration; // In seconds + BOOL mCameraAnimating; // Camera is transitioning from one mode to another + LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords + LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords + + //-------------------------------------------------------------------- + // Focus + //-------------------------------------------------------------------- +public: + LLVector3d calcFocusPositionTargetGlobal(); + LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); + BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } + LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; } + F32 getFocusObjectDist() const { return mFocusObjectDist; } + void updateFocusOffset(); + void validateFocusObject(); + void setFocusGlobal(const LLPickInfo& pick); + void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); + void setFocusOnAvatar(BOOL focus, BOOL animate); + void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); + void clearFocusObject(); + void setFocusObject(LLViewerObject* object); + void setObjectTracking(BOOL track) { mTrackFocusObject = track; } + const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } + const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } +private: + LLVector3d mCameraFocusOffset; // Offset from focus point in build mode + LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset + BOOL mFocusOnAvatar; + LLVector3d mFocusGlobal; + LLVector3d mFocusTargetGlobal; + LLPointer<LLViewerObject> mFocusObject; + F32 mFocusObjectDist; + LLVector3 mFocusObjectOffset; + F32 mFocusDotRadius; // Meters + BOOL mTrackFocusObject; + F32 mUIOffset; + + //-------------------------------------------------------------------- + // Lookat / Pointat + //-------------------------------------------------------------------- +public: + void updateLookAt(const S32 mouse_x, const S32 mouse_y); + BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + ELookAtType getLookAtType(); + void lookAtLastChat(); + void slamLookAt(const LLVector3 &look_at); // Set the physics data + BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + EPointAtType getPointAtType(); +public: + LLPointer<LLHUDEffectLookAt> mLookAt; + LLPointer<LLHUDEffectPointAt> mPointAt; + + //-------------------------------------------------------------------- + // Third person + //-------------------------------------------------------------------- +public: + LLVector3d calcThirdPersonFocusOffset(); + void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } +private: + LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position + + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- +public: + void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point + void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point + void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point + + //-------------------------------------------------------------------- + // Zoom + //-------------------------------------------------------------------- +public: + void handleScrollWheel(S32 clicks); // Mousewheel driven zoom + void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance + F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom + void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom + F32 calcCameraFOVZoomFactor(); + + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- +public: + void cameraPanIn(const F32 meters); + void cameraPanLeft(const F32 meters); + void cameraPanUp(const F32 meters); + + //-------------------------------------------------------------------- + // View + //-------------------------------------------------------------------- +public: + // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. + void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); + // Called on camera movement. Unlocks camera from the default position behind the avatar. + void unlockView(); +public: + F32 mDrawDistance; + + //-------------------------------------------------------------------- + // Mouselook + //-------------------------------------------------------------------- +public: + BOOL getForceMouselook() const { return mForceMouselook; } + void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } +private: + BOOL mForceMouselook; + + //-------------------------------------------------------------------- + // HUD + //-------------------------------------------------------------------- +public: + F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) + F32 mHUDCurZoom; // Current animated zoom level for HUD objects + + +/******************************************************************************** + ** ** + ** KEYS + **/ + +public: + S32 getAtKey() const { return mAtKey; } + S32 getWalkKey() const { return mWalkKey; } + S32 getLeftKey() const { return mLeftKey; } + S32 getUpKey() const { return mUpKey; } + F32 getYawKey() const { return mYawKey; } + F32 getPitchKey() const { return mPitchKey; } + + void setAtKey(S32 mag) { mAtKey = mag; } + void setWalkKey(S32 mag) { mWalkKey = mag; } + void setLeftKey(S32 mag) { mLeftKey = mag; } + void setUpKey(S32 mag) { mUpKey = mag; } + void setYawKey(F32 mag) { mYawKey = mag; } + void setPitchKey(F32 mag) { mPitchKey = mag; } + + void clearGeneralKeys(); + static S32 directionToKey(S32 direction); // Changes direction to -1/0/1 + +private: + S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed + S32 mWalkKey; // Like AtKey, but causes less forward thrust + S32 mLeftKey; + S32 mUpKey; + F32 mYawKey; + F32 mPitchKey; + + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- +public: + F32 getOrbitLeftKey() const { return mOrbitLeftKey; } + F32 getOrbitRightKey() const { return mOrbitRightKey; } + F32 getOrbitUpKey() const { return mOrbitUpKey; } + F32 getOrbitDownKey() const { return mOrbitDownKey; } + F32 getOrbitInKey() const { return mOrbitInKey; } + F32 getOrbitOutKey() const { return mOrbitOutKey; } + + void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } + void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } + void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } + void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } + void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } + void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } + + void clearOrbitKeys(); +private: + F32 mOrbitLeftKey; + F32 mOrbitRightKey; + F32 mOrbitUpKey; + F32 mOrbitDownKey; + F32 mOrbitInKey; + F32 mOrbitOutKey; + + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- +public: + F32 getPanLeftKey() const { return mPanLeftKey; } + F32 getPanRightKey() const { return mPanRightKey; } + F32 getPanUpKey() const { return mPanUpKey; } + F32 getPanDownKey() const { return mPanDownKey; } + F32 getPanInKey() const { return mPanInKey; } + F32 getPanOutKey() const { return mPanOutKey; } + + void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } + void setPanRightKey(F32 mag) { mPanRightKey = mag; } + void setPanUpKey(F32 mag) { mPanUpKey = mag; } + void setPanDownKey(F32 mag) { mPanDownKey = mag; } + void setPanInKey(F32 mag) { mPanInKey = mag; } + void setPanOutKey(F32 mag) { mPanOutKey = mag; } + + void clearPanKeys(); +private: + F32 mPanUpKey; + F32 mPanDownKey; + F32 mPanLeftKey; + F32 mPanRightKey; + F32 mPanInKey; + F32 mPanOutKey; + +/** Keys + ** ** + *******************************************************************************/ + +}; + +extern LLAgentCamera gAgentCamera; + +#endif diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp index 9b9be1feb8..15d9f36b74 100644 --- a/indra/newview/llagentui.cpp +++ b/indra/newview/llagentui.cpp @@ -49,12 +49,10 @@ void LLAgentUI::buildName(std::string& name) { name.clear(); - - LLVOAvatarSelf* avatar_object = gAgent.getAvatarObject(); - if (avatar_object) + if (isAgentAvatarValid()) { - LLNameValue *first_nv = avatar_object->getNVPair("FirstName"); - LLNameValue *last_nv = avatar_object->getNVPair("LastName"); + LLNameValue *first_nv = gAgentAvatarp->getNVPair("FirstName"); + LLNameValue *last_nv = gAgentAvatarp->getNVPair("LastName"); if (first_nv && last_nv) { name = first_nv->printData() + " " + last_nv->printData(); @@ -73,7 +71,8 @@ void LLAgentUI::buildName(std::string& name) //static void LLAgentUI::buildFullname(std::string& name) { - if (gAgent.getAvatarObject()) name = gAgent.getAvatarObject()->getFullname(); + if (isAgentAvatarValid()) + name = gAgentAvatarp->getFullname(); } //static diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index ebadd8a165..0542e73bfd 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -31,104 +31,33 @@ */ #include "llviewerprecompiledheaders.h" - -#include "llagent.h" #include "llagentwearables.h" +#include "llaccordionctrltab.h" +#include "llagent.h" +#include "llagentcamera.h" +#include "llagentwearablesfetch.h" +#include "llappearancemgr.h" #include "llcallbacklist.h" #include "llfloatercustomize.h" +#include "llfolderview.h" +#include "llgesturemgr.h" #include "llinventorybridge.h" +#include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" +#include "llmd5.h" #include "llnotificationsutil.h" +#include "llpaneloutfitsinventory.h" +#include "llsidetray.h" +#include "lltexlayer.h" #include "llviewerregion.h" #include "llvoavatarself.h" #include "llwearable.h" #include "llwearablelist.h" -#include "llgesturemgr.h" -#include "llappearancemgr.h" -#include "lltexlayer.h" -#include "llsidetray.h" -#include "llpaneloutfitsinventory.h" -#include "llfolderview.h" -#include "llaccordionctrltab.h" #include <boost/scoped_ptr.hpp> -#define USE_CURRENT_OUTFIT_FOLDER - -//-------------------------------------------------------------------- -// Classes for fetching initial wearables data -//-------------------------------------------------------------------- -// Outfit folder fetching callback structure. -class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver -{ -public: - LLInitialWearablesFetch() {} - ~LLInitialWearablesFetch(); - virtual void done(); - - struct InitialWearableData - { - EWearableType mType; - LLUUID mItemID; - LLUUID mAssetID; - InitialWearableData(EWearableType type, LLUUID& itemID, LLUUID& assetID) : - mType(type), - mItemID(itemID), - mAssetID(assetID) - {} - }; - - typedef std::vector<InitialWearableData> initial_wearable_data_vec_t; - initial_wearable_data_vec_t mCOFInitialWearables; // Wearables from the Current Outfit Folder - initial_wearable_data_vec_t mAgentInitialWearables; // Wearables from the old agent wearables msg - -protected: - void processWearablesMessage(); - void processContents(); -}; - -class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver -{ -public: - enum ELibraryOutfitFetchStep { - LOFS_FOLDER = 0, - LOFS_OUTFITS, - LOFS_LIBRARY, - LOFS_IMPORTED, - LOFS_CONTENTS - }; - LLLibraryOutfitsFetch() : mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) - { - mMyOutfitsID = LLUUID::null; - mClothingID = LLUUID::null; - mLibraryClothingID = LLUUID::null; - mImportedClothingID = LLUUID::null; - mImportedClothingName = "Imported Library Clothing"; - } - ~LLLibraryOutfitsFetch() {} - virtual void done(); - void doneIdle(); - LLUUID mMyOutfitsID; - void importedFolderFetch(); -protected: - void folderDone(void); - void outfitsDone(void); - void libraryDone(void); - void importedFolderDone(void); - void contentsDone(void); - enum ELibraryOutfitFetchStep mCurrFetchStep; - typedef std::vector<LLUUID> clothing_folder_vec_t; - clothing_folder_vec_t mLibraryClothingFolders; - clothing_folder_vec_t mImportedClothingFolders; - bool mOutfitsPopulated; - LLUUID mClothingID; - LLUUID mLibraryClothingID; - LLUUID mImportedClothingID; - std::string mImportedClothingName; -}; - LLAgentWearables gAgentWearables; BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE; @@ -218,8 +147,7 @@ struct LLAgentDumper }; LLAgentWearables::LLAgentWearables() : - mWearablesLoaded(FALSE), - mAvatarObject(NULL) + mWearablesLoaded(FALSE) { } @@ -230,12 +158,10 @@ LLAgentWearables::~LLAgentWearables() void LLAgentWearables::cleanup() { - mAvatarObject = NULL; } void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar) { - mAvatarObject = avatar; if (avatar) { sendAgentWearablesRequest(); @@ -293,7 +219,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i } if (mTodo & CALL_RECOVERDONE) { - LLAppearanceManager::instance().addCOFItemLink(inv_item,false); + LLAppearanceMgr::instance().addCOFItemLink(inv_item,false); gAgentWearables.recoverMissingWearableDone(); } /* @@ -301,7 +227,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i */ if (mTodo & CALL_CREATESTANDARDDONE) { - LLAppearanceManager::instance().addCOFItemLink(inv_item,false); + LLAppearanceMgr::instance().addCOFItemLink(inv_item,false); gAgentWearables.createStandardWearablesDone(mType, mIndex); } if (mTodo & CALL_MAKENEWOUTFITDONE) @@ -310,7 +236,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i } if (mTodo & CALL_WEARITEM) { - LLAppearanceManager::instance().addCOFItemLink(inv_item, true); + LLAppearanceMgr::instance().addCOFItemLink(inv_item, true); } } @@ -487,7 +413,7 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B return; } - gAgent.getAvatarObject()->wearableUpdated( type, TRUE ); + gAgentAvatarp->wearableUpdated( type, TRUE ); if (send_update) { @@ -686,13 +612,13 @@ const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) return NULL; } -const LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id) const +LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id) { for (S32 i=0; i < WT_COUNT; i++) { for (U32 j=0; j < getWearableCount((EWearableType)i); j++) { - const LLWearable * curr_wearable = getWearable((EWearableType)i, j); + LLWearable * curr_wearable = getWearable((EWearableType)i, j); if (curr_wearable && (curr_wearable->getAssetID() == asset_id)) { return curr_wearable; @@ -785,7 +711,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl void LLAgentWearables::wearableUpdated(LLWearable *wearable) { - mAvatarObject->wearableUpdated(wearable->getType(), TRUE); + gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE); wearable->refreshName(); wearable->setLabelUpdated(); @@ -829,7 +755,7 @@ void LLAgentWearables::popWearable(const EWearableType type, U32 index) if (wearable) { mWearableDatas[type].erase(mWearableDatas[type].begin() + index); - mAvatarObject->wearableUpdated(wearable->getType(), TRUE); + gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE); wearable->setLabelUpdated(); } } @@ -961,8 +887,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs LLUUID agent_id; gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if (avatar && (agent_id == avatar->getID())) + if (isAgentAvatarValid() && (agent_id == gAgentAvatarp->getID())) { gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum); @@ -1019,8 +944,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs // Store initial wearables data until we know whether we have the current outfit folder or need to use the data. LLInitialWearablesFetch::InitialWearableData wearable_data(type, item_id, asset_id); // MULTI-WEARABLE: update - outfit->mAgentInitialWearables.push_back(wearable_data); - + outfit->add(wearable_data); } lldebugs << " " << LLWearableDictionary::getTypeLabel(type) << llendl; @@ -1028,7 +952,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs // Get the complete information on the items in the inventory and set up an observer // that will trigger when the complete information is fetched. - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + uuid_vec_t folders; folders.push_back(current_outfit_id); outfit->fetchDescendents(folders); if(outfit->isEverythingComplete()) @@ -1046,64 +970,6 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs } } -// A single wearable that the avatar was wearing on start-up has arrived from the database. -// static -void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void* userdata) -{ - boost::scoped_ptr<LLInitialWearablesFetch::InitialWearableData> wear_data((LLInitialWearablesFetch::InitialWearableData*)userdata); - const EWearableType type = wear_data->mType; - U32 index = 0; - - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if (!avatar) - { - return; - } - - if (wearable) - { - llassert(type == wearable->getType()); - wearable->setItemID(wear_data->mItemID); - index = gAgentWearables.pushWearable(type, wearable); - gAgentWearables.mItemsAwaitingWearableUpdate.erase(wear_data->mItemID); - - // disable composites if initial textures are baked - avatar->setupComposites(); - - avatar->setCompositeUpdatesEnabled(TRUE); - gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable->getItemID()); - } - else - { - // Somehow the asset doesn't exist in the database. - gAgentWearables.recoverMissingWearable(type,index); - } - - - gInventory.notifyObservers(); - - // Have all the wearables that the avatar was wearing at log-in arrived? - // MULTI-WEARABLE: update when multiple wearables can arrive per type. - - gAgentWearables.updateWearablesLoaded(); - if (gAgentWearables.areWearablesLoaded()) - { - - // Can't query cache until all wearables have arrived, so calling this earlier is a no-op. - gAgentWearables.queryWearableCache(); - - // Make sure that the server's idea of the avatar's wearables actually match the wearables. - gAgent.sendAgentSetAppearance(); - - // Check to see if there are any baked textures that we hadn't uploaded before we logged off last time. - // If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive. - if (gAgent.cameraCustomizeAvatar()) - { - avatar->requestLayerSetUploads(); - } - } -} - // Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the // database. If for some reason, we can't load one of those assets, we can try to reconstruct it so that // the user isn't left without a shape, for example. (We can do that only after the inventory has loaded.) @@ -1179,7 +1045,7 @@ public: { llinfos << "All items created" << llendl; LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; - LLAppearanceManager::instance().linkAll(LLAppearanceManager::instance().getCOF(), + LLAppearanceMgr::instance().linkAll(LLAppearanceMgr::instance().getCOF(), mItemsToLink, link_waiter); } @@ -1239,12 +1105,9 @@ void LLAgentWearables::createStandardWearables(BOOL female) llwarns << "Creating Standard " << (female ? "female" : "male") << " Wearables" << llendl; - if (mAvatarObject.isNull()) - { - return; - } + if (!isAgentAvatarValid()) return; - mAvatarObject->setSex(female ? SEX_FEMALE : SEX_MALE); + gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE); const BOOL create[WT_COUNT] = { @@ -1291,10 +1154,9 @@ void LLAgentWearables::createStandardWearables(BOOL female) void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index) { llinfos << "type " << type << " index " << index << llendl; - if (mAvatarObject) - { - mAvatarObject->updateVisualParams(); - } + + if (!isAgentAvatarValid()) return; + gAgentAvatarp->updateVisualParams(); } void LLAgentWearables::createStandardWearablesAllDone() @@ -1309,7 +1171,7 @@ void LLAgentWearables::createStandardWearablesAllDone() updateServer(); // Treat this as the first texture entry message, if none received yet - mAvatarObject->onFirstTEMessageReceived(); + gAgentAvatarp->onFirstTEMessageReceived(); } // MULTI-WEARABLE: Properly handle multiwearables later. @@ -1331,10 +1193,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name, const LLDynamicArray<S32>& attachments_to_include, BOOL rename_clothing) { - if (mAvatarObject.isNull()) - { - return; - } + if (!isAgentAvatarValid()) return; // First, make a folder in the Clothes directory. LLUUID folder_id = gInventory.createNewCategory( @@ -1432,7 +1291,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name, for (S32 i = 0; i < attachments_to_include.count(); i++) { S32 attachment_pt = attachments_to_include[i]; - LLViewerJointAttachment* attachment = get_if_there(mAvatarObject->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL); + LLViewerJointAttachment* attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL); if (!attachment) continue; for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); attachment_iter != attachment->mAttachedObjects.end(); @@ -1493,8 +1352,8 @@ public: tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren()); } - LLAppearanceManager::instance().updateIsDirty(); - LLAppearanceManager::instance().updatePanelOutfitName(""); + LLAppearanceMgr::instance().updateIsDirty(); + LLAppearanceMgr::instance().updatePanelOutfitName(""); } virtual void fire(const LLUUID&) @@ -1507,10 +1366,7 @@ private: LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name) { - if (mAvatarObject.isNull()) - { - return LLUUID::null; - } + if (!isAgentAvatarValid()) return LLUUID::null; // First, make a folder in the My Outfits directory. const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); @@ -1520,8 +1376,8 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name) new_folder_name); LLPointer<LLInventoryCallback> cb = new LLShowCreatedOutfit(folder_id); - LLAppearanceManager::instance().shallowCopyCategoryContents(LLAppearanceManager::instance().getCOF(),folder_id, cb); - LLAppearanceManager::instance().createBaseOutfitLink(folder_id, cb); + LLAppearanceMgr::instance().shallowCopyCategoryContents(LLAppearanceMgr::instance().getCOF(),folder_id, cb); + LLAppearanceMgr::instance().createBaseOutfitLink(folder_id, cb); return folder_id; } @@ -1588,6 +1444,7 @@ void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_a { LLSD payload; payload["wearable_type"] = (S32)type; + payload["wearable_index"] = (S32)index; // Bring up view-modal dialog: Save changes? Yes, No, Cancel LLNotificationsUtil::add("WearableSave", LLSD(), payload, &LLAgentWearables::onRemoveWearableDialog); return; @@ -1601,22 +1458,21 @@ void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_a } -// MULTI_WEARABLE: assuming one wearable per type. -// MULTI_WEARABLE: hardwiring 0th elt for now - notification needs to change. // static bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger(); + S32 index = (S32)notification["payload"]["wearable_index"].asInteger(); switch(option) { case 0: // "Save" - gAgentWearables.saveWearable(type, 0); - gAgentWearables.removeWearableFinal(type, false, 0); + gAgentWearables.saveWearable(type, index); + gAgentWearables.removeWearableFinal(type, false, index); break; case 1: // "Don't Save" - gAgentWearables.removeWearableFinal(type, false, 0); + gAgentWearables.removeWearableFinal(type, false, index); break; case 2: // "Cancel" @@ -1668,30 +1524,25 @@ void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_rem } // Assumes existing wearables are not dirty. -// MULTI_WEARABLE: assumes one wearable per type. void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove) { llinfos << "setWearableOutfit() start" << llendl; - BOOL wearables_to_remove[WT_COUNT]; - wearables_to_remove[WT_SHAPE] = FALSE; - wearables_to_remove[WT_SKIN] = FALSE; - wearables_to_remove[WT_HAIR] = FALSE; - wearables_to_remove[WT_EYES] = FALSE; - wearables_to_remove[WT_SHIRT] = remove; - wearables_to_remove[WT_PANTS] = remove; - wearables_to_remove[WT_SHOES] = remove; - wearables_to_remove[WT_SOCKS] = remove; - wearables_to_remove[WT_JACKET] = remove; - wearables_to_remove[WT_GLOVES] = remove; - wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; - wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; - wearables_to_remove[WT_SKIRT] = remove; - wearables_to_remove[WT_ALPHA] = remove; - wearables_to_remove[WT_TATTOO] = remove; - + // TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later + if (remove) + { + // note: shirt is the first non-body part wearable item. Update if wearable order changes. + // This loop should remove all clothing, but not any body parts + for (S32 type = 0; type < (S32)WT_COUNT; type++) + { + if (LLWearableDictionary::getAssetType((EWearableType)type) == LLAssetType::AT_CLOTHING) + { + removeWearable((EWearableType)type, true, 0); + } + } + } S32 count = wearables.count(); llassert(items.count() == count); @@ -1706,82 +1557,31 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it if (new_wearable) { const EWearableType type = new_wearable->getType(); - wearables_to_remove[type] = FALSE; + + new_wearable->setName(new_item->getName()); + new_wearable->setItemID(new_item->getUUID()); - // MULTI_WEARABLE: using 0th - LLWearable* old_wearable = getWearable(type, 0); - if (old_wearable) + if (LLWearableDictionary::getAssetType(type) == LLAssetType::AT_BODYPART) { - // Special case where you're putting on a wearable that has the same assetID - // as the previous (e.g. wear a shirt then wear a copy of that shirt) since in this - // case old_wearable == new_wearable. - if (old_wearable == new_wearable) - { - old_wearable->setLabelUpdated(); - new_wearable->setName(new_item->getName()); - new_wearable->setItemID(new_item->getUUID()); - } - - const LLUUID& old_item_id = getWearableItemID(type, 0); - if ((old_wearable->getAssetID() == new_wearable->getAssetID()) && - (old_item_id == new_item->getUUID())) - { - lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl; - continue; - } - - // Assumes existing wearables are not dirty. - if (old_wearable->isDirty()) - { - llassert(0); - continue; - } + // exactly one wearable per body part + setWearable(type,0,new_wearable); } - - new_wearable->setItemID(new_item->getUUID()); - setWearable(type,0,new_wearable); - } - } - - std::vector<LLWearable*> wearables_being_removed; - - for (i = 0; i < WT_COUNT; i++) - { - if (wearables_to_remove[i]) - { - // MULTI_WEARABLE: assuming 0th - LLWearable* wearable = getWearable((EWearableType)i, 0); - const LLUUID &item_id = getWearableItemID((EWearableType)i,0); - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - if (wearable) + else { - wearables_being_removed.push_back(wearable); + pushWearable(type,new_wearable); } - removeWearable((EWearableType)i,true,0); + wearableUpdated(new_wearable); + checkWearableAgainstInventory(new_wearable); } } gInventory.notifyObservers(); - - std::vector<LLWearable*>::iterator wearable_iter; - - for (wearable_iter = wearables_being_removed.begin(); - wearable_iter != wearables_being_removed.end(); - ++wearable_iter) - { - LLWearable* wearablep = *wearable_iter; - if (wearablep) - { - wearablep->removeFromAvatar(TRUE); - } - } - - if (mAvatarObject) + if (isAgentAvatarValid()) { - mAvatarObject->setCompositeUpdatesEnabled(TRUE); - mAvatarObject->updateVisualParams(); - mAvatarObject->invalidateAll(); + gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->invalidateAll(); } // Start rendering & update the server @@ -1840,6 +1640,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); LLInventoryItem* new_item = gInventory.getItem(notification["payload"]["item_id"].asUUID()); + U32 index = gAgentWearables.getWearableIndex(wearable); if (!new_item) { delete wearable; @@ -1849,8 +1650,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& switch(option) { case 0: // "Save" -// MULTI_WEARABLE: assuming 0th - gAgentWearables.saveWearable(wearable->getType(),0); + gAgentWearables.saveWearable(wearable->getType(),index); gAgentWearables.setWearableFinal(new_item, wearable); break; @@ -1940,30 +1740,35 @@ void LLAgentWearables::queryWearableCache() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); - LLUUID hash; + LLMD5 hash; + bool hash_computed = false; for (U8 i=0; i < baked_dict->mWearables.size(); i++) { const EWearableType baked_type = baked_dict->mWearables[i]; - // MULTI_WEARABLE: not order-dependent const U32 num_wearables = getWearableCount(baked_type); for (U32 index = 0; index < num_wearables; ++index) { const LLWearable* wearable = getWearable(baked_type,index); if (wearable) { - hash ^= wearable->getAssetID(); + LLUUID asset_id = wearable->getAssetID(); + hash.update((const unsigned char*)asset_id.mData, UUID_BYTES); + hash_computed = true; } } } - if (hash.notNull()) + hash.finalize(); + if (hash_computed) { - hash ^= baked_dict->mWearablesHashID; + LLUUID hash_id; + hash.raw_digest(hash_id.mData); + hash_id ^= baked_dict->mWearablesHashID; num_queries++; // *NOTE: make sure at least one request gets packed //llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl; gMessageSystem->nextBlockFast(_PREHASH_WearableData); - gMessageSystem->addUUIDFast(_PREHASH_ID, hash); + gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id); gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index); } @@ -1976,16 +1781,24 @@ void LLAgentWearables::queryWearableCache() gAgentQueryManager.mWearablesCacheQueryID++; } -// MULTI_WEARABLE: need a way to specify by wearable rather than by type. // User has picked "remove from avatar" from a menu. // static -void LLAgentWearables::userRemoveWearable(EWearableType& type) +void LLAgentWearables::userRemoveWearable(const EWearableType &type, const U32 &index) { - if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR)) //&& + if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&& //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT))) { - // MULTI_WEARABLE: fixed to 0th for now. - gAgentWearables.removeWearable(type,false,0); + gAgentWearables.removeWearable(type,false,index); + } +} + +//static +void LLAgentWearables::userRemoveWearablesOfType(const EWearableType &type) +{ + if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&& + //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT))) + { + gAgentWearables.removeWearable(type,true,0); } } @@ -2031,12 +1844,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj // already wearing and in request set -> leave alone. // not wearing and in request set -> put on. - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (!avatarp) - { - llwarns << "No avatar found." << llendl; - return; - } + if (!isAgentAvatarValid()) return; std::set<LLUUID> requested_item_ids; std::set<LLUUID> current_item_ids; @@ -2045,8 +1853,8 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj // Build up list of objects to be removed and items currently attached. llvo_vec_t objects_to_remove; - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end();) + 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; @@ -2102,12 +1910,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (!avatarp) - { - llwarns << "No avatar found." << llendl; - return; - } + if (!isAgentAvatarValid()) return; if (objects_to_remove.empty()) return; @@ -2130,17 +1933,12 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo void LLAgentWearables::userRemoveAllAttachments() { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (!avatarp) - { - llwarns << "No avatar found." << llendl; - return; - } + if (!isAgentAvatarValid()) return; llvo_vec_t objects_to_remove; - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end();) + 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; @@ -2267,7 +2065,7 @@ void LLAgentWearables::populateMyOutfitsFolder(void) // Get the complete information on the items in the inventory and // setup an observer that will wait for that to happen. - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + uuid_vec_t folders; outfits->mMyOutfitsID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); folders.push_back(outfits->mMyOutfitsID); @@ -2278,473 +2076,3 @@ void LLAgentWearables::populateMyOutfitsFolder(void) outfits->done(); } } - -void LLLibraryOutfitsFetch::done() -{ - // Delay this until idle() routine, since it's a heavy operation and - // we also can't have it run within notifyObservers. - doOnIdle(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this)); - gInventory.removeObserver(this); // Prevent doOnIdle from being added twice. -} - -void LLLibraryOutfitsFetch::doneIdle() -{ - gInventory.addObserver(this); // Add this back in since it was taken out during ::done() - - switch (mCurrFetchStep) - { - case LOFS_FOLDER: - folderDone(); - mCurrFetchStep = LOFS_OUTFITS; - break; - case LOFS_OUTFITS: - outfitsDone(); - mCurrFetchStep = LOFS_LIBRARY; - break; - case LOFS_LIBRARY: - libraryDone(); - mCurrFetchStep = LOFS_IMPORTED; - break; - case LOFS_IMPORTED: - importedFolderDone(); - mCurrFetchStep = LOFS_CONTENTS; - break; - case LOFS_CONTENTS: - contentsDone(); - break; - default: - llwarns << "Got invalid state for outfit fetch: " << mCurrFetchStep << llendl; - mOutfitsPopulated = TRUE; - break; - } - - // We're completely done. Cleanup. - if (mOutfitsPopulated) - { - gInventory.removeObserver(this); - delete this; - return; - } -} - -void LLLibraryOutfitsFetch::folderDone(void) -{ - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t wearable_array; - gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH); - // Early out if we already have items in My Outfits. - if (cat_array.count() > 0 || wearable_array.count() > 0) - { - mOutfitsPopulated = true; - return; - } - - mClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); - mLibraryClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING, false, true); - - // If Library->Clothing->Initial Outfits exists, use that. - LLNameCategoryCollector matchFolderFunctor("Initial Outfits"); - gInventory.collectDescendentsIf(mLibraryClothingID, - cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH, - matchFolderFunctor); - if (cat_array.count() > 0) - { - const LLViewerInventoryCategory *cat = cat_array.get(0); - mLibraryClothingID = cat->getUUID(); - } - - mCompleteFolders.clear(); - - // Get the complete information on the items in the inventory. - LLInventoryFetchDescendentsObserver::folder_ref_t folders; - folders.push_back(mClothingID); - folders.push_back(mLibraryClothingID); - fetchDescendents(folders); - if (isEverythingComplete()) - { - done(); - } -} - -void LLLibraryOutfitsFetch::outfitsDone(void) -{ - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t wearable_array; - LLInventoryFetchDescendentsObserver::folder_ref_t folders; - - // Collect the contents of the Library's Clothing folder - gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH); - - llassert(cat_array.count() > 0); - for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin(); - iter != cat_array.end(); - ++iter) - { - const LLViewerInventoryCategory *cat = iter->get(); - - // Get the names and id's of every outfit in the library, skip "Ruth" - // because it's a low quality legacy outfit - if (cat->getName() != "Ruth") - { - // Get the name of every outfit in the library - folders.push_back(cat->getUUID()); - mLibraryClothingFolders.push_back(cat->getUUID()); - } - } - cat_array.clear(); - wearable_array.clear(); - - // Check if you already have an "Imported Library Clothing" folder - LLNameCategoryCollector matchFolderFunctor(mImportedClothingName); - gInventory.collectDescendentsIf(mClothingID, - cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH, - matchFolderFunctor); - if (cat_array.size() > 0) - { - const LLViewerInventoryCategory *cat = cat_array.get(0); - mImportedClothingID = cat->getUUID(); - } - - mCompleteFolders.clear(); - - fetchDescendents(folders); - if (isEverythingComplete()) - { - done(); - } -} - -class LLLibraryOutfitsCopyDone: public LLInventoryCallback -{ -public: - LLLibraryOutfitsCopyDone(LLLibraryOutfitsFetch * fetcher): - mFireCount(0), mLibraryOutfitsFetcher(fetcher) - { - } - - virtual ~LLLibraryOutfitsCopyDone() - { - if (!LLApp::isExiting() && mLibraryOutfitsFetcher) - { - gInventory.addObserver(mLibraryOutfitsFetcher); - mLibraryOutfitsFetcher->done(); - } - } - - /* virtual */ void fire(const LLUUID& inv_item) - { - mFireCount++; - } -private: - U32 mFireCount; - LLLibraryOutfitsFetch * mLibraryOutfitsFetcher; -}; - -// Copy the clothing folders from the library into the imported clothing folder -void LLLibraryOutfitsFetch::libraryDone(void) -{ - if (mImportedClothingID != LLUUID::null) - { - // Skip straight to fetching the contents of the imported folder - importedFolderFetch(); - return; - } - - // Remove observer; next autopopulation step will be triggered externally by LLLibraryOutfitsCopyDone. - gInventory.removeObserver(this); - - LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this); - mImportedClothingID = gInventory.createNewCategory(mClothingID, - LLFolderType::FT_NONE, - mImportedClothingName); - // Copy each folder from library into clothing unless it already exists. - for (clothing_folder_vec_t::const_iterator iter = mLibraryClothingFolders.begin(); - iter != mLibraryClothingFolders.end(); - ++iter) - { - const LLUUID& src_folder_id = (*iter); // Library clothing folder ID - const LLViewerInventoryCategory *cat = gInventory.getCategory(src_folder_id); - if (!cat) - { - llwarns << "Library folder import for uuid:" << src_folder_id << " failed to find folder." << llendl; - continue; - } - - if (!LLAppearanceManager::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id)) - { - llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl; - continue; - } - - // Don't copy the category if it already exists. - LLNameCategoryCollector matchFolderFunctor(cat->getName()); - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t wearable_array; - gInventory.collectDescendentsIf(mImportedClothingID, - cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH, - matchFolderFunctor); - if (cat_array.size() > 0) - { - continue; - } - - LLUUID dst_folder_id = gInventory.createNewCategory(mImportedClothingID, - LLFolderType::FT_NONE, - cat->getName()); - LLAppearanceManager::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter); - } -} - -void LLLibraryOutfitsFetch::importedFolderFetch(void) -{ - // Fetch the contents of the Imported Clothing Folder - LLInventoryFetchDescendentsObserver::folder_ref_t folders; - folders.push_back(mImportedClothingID); - - mCompleteFolders.clear(); - - fetchDescendents(folders); - if (isEverythingComplete()) - { - done(); - } -} - -void LLLibraryOutfitsFetch::importedFolderDone(void) -{ - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t wearable_array; - LLInventoryFetchDescendentsObserver::folder_ref_t folders; - - // Collect the contents of the Imported Clothing folder - gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH); - - for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin(); - iter != cat_array.end(); - ++iter) - { - const LLViewerInventoryCategory *cat = iter->get(); - - // Get the name of every imported outfit - folders.push_back(cat->getUUID()); - mImportedClothingFolders.push_back(cat->getUUID()); - } - - mCompleteFolders.clear(); - fetchDescendents(folders); - if (isEverythingComplete()) - { - done(); - } -} - -void LLLibraryOutfitsFetch::contentsDone(void) -{ - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t wearable_array; - - for (clothing_folder_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin(); - folder_iter != mImportedClothingFolders.end(); - ++folder_iter) - { - const LLUUID &folder_id = (*folder_iter); - const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id); - if (!cat) - { - llwarns << "Library folder import for uuid:" << folder_id << " failed to find folder." << llendl; - continue; - } - - // First, make a folder in the My Outfits directory. - LLUUID new_outfit_folder_id = gInventory.createNewCategory(mMyOutfitsID, LLFolderType::FT_OUTFIT, cat->getName()); - - cat_array.clear(); - wearable_array.clear(); - // Collect the contents of each imported clothing folder, so we can create new outfit links for it - gInventory.collectDescendents(folder_id, cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH); - - for (LLInventoryModel::item_array_t::const_iterator wearable_iter = wearable_array.begin(); - wearable_iter != wearable_array.end(); - ++wearable_iter) - { - const LLViewerInventoryItem *item = wearable_iter->get(); - link_inventory_item(gAgent.getID(), - item->getLinkedUUID(), - new_outfit_folder_id, - item->getName(), - LLAssetType::AT_LINK, - NULL); - } - } - - mOutfitsPopulated = true; -} - -//-------------------------------------------------------------------- -// InitialWearablesFetch -// -// This grabs contents from the COF and processes them. -// The processing is handled in idle(), i.e. outside of done(), -// to avoid gInventory.notifyObservers recursion. -//-------------------------------------------------------------------- - -LLInitialWearablesFetch::~LLInitialWearablesFetch() -{ -} - -// virtual -void LLInitialWearablesFetch::done() -{ - // Delay processing the actual results of this so it's not handled within - // gInventory.notifyObservers. The results will be handled in the next - // idle tick instead. - gInventory.removeObserver(this); - doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this)); -} - -void LLInitialWearablesFetch::processContents() -{ - // Fetch the wearable items from the Current Outfit Folder - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t wearable_array; - LLFindWearables is_wearable; - gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array, - LLInventoryModel::EXCLUDE_TRASH, is_wearable); - - LLAppearanceManager::instance().setAttachmentInvLinkEnable(true); - if (wearable_array.count() > 0) - { - LLAppearanceManager::instance().updateAppearanceFromCOF(); - } - else - { - // if we're constructing the COF from the wearables message, we don't have a proper outfit link - LLAppearanceManager::instance().setOutfitDirty(true); - processWearablesMessage(); - } - delete this; -} - -class LLFetchAndLinkObserver: public LLInventoryFetchObserver -{ -public: - LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids): - m_ids(ids), - LLInventoryFetchObserver(true) // retry for missing items - { - } - ~LLFetchAndLinkObserver() - { - } - virtual void done() - { - gInventory.removeObserver(this); - - // Link to all fetched items in COF. - LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; - for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin(); - it != m_ids.end(); - ++it) - { - LLUUID id = *it; - LLViewerInventoryItem *item = gInventory.getItem(*it); - if (!item) - { - llwarns << "fetch failed!" << llendl; - continue; - } - - link_inventory_item(gAgent.getID(), - item->getLinkedUUID(), - LLAppearanceManager::instance().getCOF(), - item->getName(), - LLAssetType::AT_LINK, - link_waiter); - } - } -private: - LLInventoryFetchObserver::item_ref_t m_ids; -}; - -void LLInitialWearablesFetch::processWearablesMessage() -{ - if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead. - { - const LLUUID current_outfit_id = LLAppearanceManager::instance().getCOF(); - LLInventoryFetchObserver::item_ref_t ids; - for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) - { - // Populate the current outfit folder with links to the wearables passed in the message - InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback. - - if (wearable_data->mAssetID.notNull()) - { -#ifdef USE_CURRENT_OUTFIT_FOLDER - ids.push_back(wearable_data->mItemID); -#endif -#if 0 -// // Fetch the wearables -// LLWearableList::instance().getAsset(wearable_data->mAssetID, -// LLStringUtil::null, -// LLWearableDictionary::getAssetType(wearable_data->mType), -// LLAgentWearables::onInitialWearableAssetArrived, (void*)(wearable_data)); -#endif - } - else - { - llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID " - << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl; - delete wearable_data; - } - } - - // Add all current attachments to the requested items as well. - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar ) - { - for (LLVOAvatar::attachment_map_t::const_iterator iter = avatar->mAttachmentPoints.begin(); - iter != avatar->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->getItemID(); - if (item_id.isNull()) continue; - ids.push_back(item_id); - } - } - } - - // Need to fetch the inventory items for ids, then create links to them after they arrive. - LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); - fetcher->fetchItems(ids); - // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. - if (fetcher->isEverythingComplete()) - { - fetcher->done(); - } - else - { - gInventory.addObserver(fetcher); - } - } - else - { - LL_WARNS("Wearables") << "No current outfit folder items found and no initial wearables fallback message received." << LL_ENDL; - } -} - - diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 858540a5f5..9f8aadeae7 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -89,7 +89,7 @@ public: const LLUUID getWearableItemID(EWearableType type, U32 index /*= 0*/) const; const LLUUID getWearableAssetID(EWearableType type, U32 index /*= 0*/) const; const LLWearable* getWearableFromItemID(const LLUUID& item_id) const; - const LLWearable* getWearableFromAssetID(const LLUUID& asset_id) const; + LLWearable* getWearableFromAssetID(const LLUUID& asset_id); LLInventoryItem* getWearableInventoryItem(EWearableType type, U32 index /*= 0*/); // MULTI-WEARABLE: assuming one per type. static BOOL selfHasWearable(EWearableType type); @@ -193,8 +193,8 @@ public: // Static UI hooks //-------------------------------------------------------------------- public: - // MULTI-WEARABLE: assuming one wearable per type. Need upstream changes. - static void userRemoveWearable(EWearableType& type); + static void userRemoveWearable(const EWearableType &type, const U32 &index); + static void userRemoveWearablesOfType(const EWearableType &type); static void userRemoveAllClothes(); typedef std::vector<LLViewerObject*> llvo_vec_t; @@ -218,7 +218,6 @@ private: static BOOL mInitialWearablesUpdateReceived; BOOL mWearablesLoaded; std::set<LLUUID> mItemsAwaitingWearableUpdate; - LLPointer<LLVOAvatarSelf> mAvatarObject; // NULL until avatar object sent down from simulator //-------------------------------------------------------------------------------- // Support classes diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp new file mode 100644 index 0000000000..45274a8e2c --- /dev/null +++ b/indra/newview/llagentwearablesfetch.cpp @@ -0,0 +1,516 @@ +/** + * @file llagentwearablesfetch.cpp + * @brief LLAgentWearblesFetch class implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llagentwearablesfetch.h" + +#include "llagent.h" +#include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llinventoryfunctions.h" +#include "llvoavatarself.h" + +LLInitialWearablesFetch::LLInitialWearablesFetch() +{ +} + +LLInitialWearablesFetch::~LLInitialWearablesFetch() +{ +} + +// virtual +void LLInitialWearablesFetch::done() +{ + // Delay processing the actual results of this so it's not handled within + // gInventory.notifyObservers. The results will be handled in the next + // idle tick instead. + gInventory.removeObserver(this); + doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this)); +} + +void LLInitialWearablesFetch::add(InitialWearableData &data) + +{ + mAgentInitialWearables.push_back(data); +} + +void LLInitialWearablesFetch::processContents() +{ + // Fetch the wearable items from the Current Outfit Folder + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t wearable_array; + LLFindWearables is_wearable; + gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH, is_wearable); + + LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); + if (wearable_array.count() > 0) + { + LLAppearanceMgr::instance().updateAppearanceFromCOF(); + } + else + { + // if we're constructing the COF from the wearables message, we don't have a proper outfit link + LLAppearanceMgr::instance().setOutfitDirty(true); + processWearablesMessage(); + } + delete this; +} + +class LLFetchAndLinkObserver: public LLInventoryFetchObserver +{ +public: + LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids): + m_ids(ids), + LLInventoryFetchObserver(true) // retry for missing items + { + } + ~LLFetchAndLinkObserver() + { + } + virtual void done() + { + gInventory.removeObserver(this); + + // Link to all fetched items in COF. + LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; + for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin(); + it != m_ids.end(); + ++it) + { + LLUUID id = *it; + LLViewerInventoryItem *item = gInventory.getItem(*it); + if (!item) + { + llwarns << "fetch failed!" << llendl; + continue; + } + + link_inventory_item(gAgent.getID(), + item->getLinkedUUID(), + LLAppearanceMgr::instance().getCOF(), + item->getName(), + LLAssetType::AT_LINK, + link_waiter); + } + } +private: + LLInventoryFetchObserver::item_ref_t m_ids; +}; + +void LLInitialWearablesFetch::processWearablesMessage() +{ + if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead. + { + const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF(); + LLInventoryFetchObserver::item_ref_t ids; + for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) + { + // Populate the current outfit folder with links to the wearables passed in the message + InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback. + + if (wearable_data->mAssetID.notNull()) + { + ids.push_back(wearable_data->mItemID); + } + else + { + llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID " + << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl; + delete wearable_data; + } + } + + // Add all current attachments to the requested items as well. + 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->getItemID(); + if (item_id.isNull()) continue; + ids.push_back(item_id); + } + } + } + + // Need to fetch the inventory items for ids, then create links to them after they arrive. + LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); + fetcher->fetchItems(ids); + // If no items to be fetched, done will never be triggered. + // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. + if (fetcher->isEverythingComplete()) + { + fetcher->done(); + } + else + { + gInventory.addObserver(fetcher); + } + } + else + { + LL_WARNS("Wearables") << "No current outfit folder items found and no initial wearables fallback message received." << LL_ENDL; + } +} + +LLLibraryOutfitsFetch::LLLibraryOutfitsFetch() : + mCurrFetchStep(LOFS_FOLDER), + mOutfitsPopulated(false) +{ + mMyOutfitsID = LLUUID::null; + mClothingID = LLUUID::null; + mLibraryClothingID = LLUUID::null; + mImportedClothingID = LLUUID::null; + mImportedClothingName = "Imported Library Clothing"; +} + +LLLibraryOutfitsFetch::~LLLibraryOutfitsFetch() +{ +} + +void LLLibraryOutfitsFetch::done() +{ + // Delay this until idle() routine, since it's a heavy operation and + // we also can't have it run within notifyObservers. + doOnIdle(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this)); + gInventory.removeObserver(this); // Prevent doOnIdle from being added twice. +} + +void LLLibraryOutfitsFetch::doneIdle() +{ + gInventory.addObserver(this); // Add this back in since it was taken out during ::done() + + switch (mCurrFetchStep) + { + case LOFS_FOLDER: + folderDone(); + mCurrFetchStep = LOFS_OUTFITS; + break; + case LOFS_OUTFITS: + outfitsDone(); + mCurrFetchStep = LOFS_LIBRARY; + break; + case LOFS_LIBRARY: + libraryDone(); + mCurrFetchStep = LOFS_IMPORTED; + break; + case LOFS_IMPORTED: + importedFolderDone(); + mCurrFetchStep = LOFS_CONTENTS; + break; + case LOFS_CONTENTS: + contentsDone(); + break; + default: + llwarns << "Got invalid state for outfit fetch: " << mCurrFetchStep << llendl; + mOutfitsPopulated = TRUE; + break; + } + + // We're completely done. Cleanup. + if (mOutfitsPopulated) + { + gInventory.removeObserver(this); + delete this; + return; + } +} + +void LLLibraryOutfitsFetch::folderDone(void) +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t wearable_array; + gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH); + // Early out if we already have items in My Outfits. + if (cat_array.count() > 0 || wearable_array.count() > 0) + { + mOutfitsPopulated = true; + return; + } + + mClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); + mLibraryClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING, false, true); + + // If Library->Clothing->Initial Outfits exists, use that. + LLNameCategoryCollector matchFolderFunctor("Initial Outfits"); + gInventory.collectDescendentsIf(mLibraryClothingID, + cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH, + matchFolderFunctor); + if (cat_array.count() > 0) + { + const LLViewerInventoryCategory *cat = cat_array.get(0); + mLibraryClothingID = cat->getUUID(); + } + + mCompleteFolders.clear(); + + // Get the complete information on the items in the inventory. + uuid_vec_t folders; + folders.push_back(mClothingID); + folders.push_back(mLibraryClothingID); + fetchDescendents(folders); + if (isEverythingComplete()) + { + done(); + } +} + +void LLLibraryOutfitsFetch::outfitsDone(void) +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t wearable_array; + uuid_vec_t folders; + + // Collect the contents of the Library's Clothing folder + gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH); + + llassert(cat_array.count() > 0); + for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin(); + iter != cat_array.end(); + ++iter) + { + const LLViewerInventoryCategory *cat = iter->get(); + + // Get the names and id's of every outfit in the library, skip "Ruth" + // because it's a low quality legacy outfit + if (cat->getName() != "Ruth") + { + // Get the name of every outfit in the library + folders.push_back(cat->getUUID()); + mLibraryClothingFolders.push_back(cat->getUUID()); + } + } + cat_array.clear(); + wearable_array.clear(); + + // Check if you already have an "Imported Library Clothing" folder + LLNameCategoryCollector matchFolderFunctor(mImportedClothingName); + gInventory.collectDescendentsIf(mClothingID, + cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH, + matchFolderFunctor); + if (cat_array.size() > 0) + { + const LLViewerInventoryCategory *cat = cat_array.get(0); + mImportedClothingID = cat->getUUID(); + } + + mCompleteFolders.clear(); + + fetchDescendents(folders); + if (isEverythingComplete()) + { + done(); + } +} + +class LLLibraryOutfitsCopyDone: public LLInventoryCallback +{ +public: + LLLibraryOutfitsCopyDone(LLLibraryOutfitsFetch * fetcher): + mFireCount(0), mLibraryOutfitsFetcher(fetcher) + { + } + + virtual ~LLLibraryOutfitsCopyDone() + { + if (!LLApp::isExiting() && mLibraryOutfitsFetcher) + { + gInventory.addObserver(mLibraryOutfitsFetcher); + mLibraryOutfitsFetcher->done(); + } + } + + /* virtual */ void fire(const LLUUID& inv_item) + { + mFireCount++; + } +private: + U32 mFireCount; + LLLibraryOutfitsFetch * mLibraryOutfitsFetcher; +}; + +// Copy the clothing folders from the library into the imported clothing folder +void LLLibraryOutfitsFetch::libraryDone(void) +{ + if (mImportedClothingID != LLUUID::null) + { + // Skip straight to fetching the contents of the imported folder + importedFolderFetch(); + return; + } + + // Remove observer; next autopopulation step will be triggered externally by LLLibraryOutfitsCopyDone. + gInventory.removeObserver(this); + + LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this); + mImportedClothingID = gInventory.createNewCategory(mClothingID, + LLFolderType::FT_NONE, + mImportedClothingName); + // Copy each folder from library into clothing unless it already exists. + for (uuid_vec_t::const_iterator iter = mLibraryClothingFolders.begin(); + iter != mLibraryClothingFolders.end(); + ++iter) + { + const LLUUID& src_folder_id = (*iter); // Library clothing folder ID + const LLViewerInventoryCategory *cat = gInventory.getCategory(src_folder_id); + if (!cat) + { + llwarns << "Library folder import for uuid:" << src_folder_id << " failed to find folder." << llendl; + continue; + } + + if (!LLAppearanceMgr::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id)) + { + llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl; + continue; + } + + // Don't copy the category if it already exists. + LLNameCategoryCollector matchFolderFunctor(cat->getName()); + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t wearable_array; + gInventory.collectDescendentsIf(mImportedClothingID, + cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH, + matchFolderFunctor); + if (cat_array.size() > 0) + { + continue; + } + + LLUUID dst_folder_id = gInventory.createNewCategory(mImportedClothingID, + LLFolderType::FT_NONE, + cat->getName()); + LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter); + } +} + +void LLLibraryOutfitsFetch::importedFolderFetch(void) +{ + // Fetch the contents of the Imported Clothing Folder + uuid_vec_t folders; + folders.push_back(mImportedClothingID); + + mCompleteFolders.clear(); + + fetchDescendents(folders); + if (isEverythingComplete()) + { + done(); + } +} + +void LLLibraryOutfitsFetch::importedFolderDone(void) +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t wearable_array; + uuid_vec_t folders; + + // Collect the contents of the Imported Clothing folder + gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH); + + for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin(); + iter != cat_array.end(); + ++iter) + { + const LLViewerInventoryCategory *cat = iter->get(); + + // Get the name of every imported outfit + folders.push_back(cat->getUUID()); + mImportedClothingFolders.push_back(cat->getUUID()); + } + + mCompleteFolders.clear(); + fetchDescendents(folders); + if (isEverythingComplete()) + { + done(); + } +} + +void LLLibraryOutfitsFetch::contentsDone(void) +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t wearable_array; + + for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin(); + folder_iter != mImportedClothingFolders.end(); + ++folder_iter) + { + const LLUUID &folder_id = (*folder_iter); + const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id); + if (!cat) + { + llwarns << "Library folder import for uuid:" << folder_id << " failed to find folder." << llendl; + continue; + } + + // First, make a folder in the My Outfits directory. + LLUUID new_outfit_folder_id = gInventory.createNewCategory(mMyOutfitsID, LLFolderType::FT_OUTFIT, cat->getName()); + + cat_array.clear(); + wearable_array.clear(); + // Collect the contents of each imported clothing folder, so we can create new outfit links for it + gInventory.collectDescendents(folder_id, cat_array, wearable_array, + LLInventoryModel::EXCLUDE_TRASH); + + for (LLInventoryModel::item_array_t::const_iterator wearable_iter = wearable_array.begin(); + wearable_iter != wearable_array.end(); + ++wearable_iter) + { + const LLViewerInventoryItem *item = wearable_iter->get(); + link_inventory_item(gAgent.getID(), + item->getLinkedUUID(), + new_outfit_folder_id, + item->getName(), + LLAssetType::AT_LINK, + NULL); + } + } + + mOutfitsPopulated = true; +} + diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h new file mode 100644 index 0000000000..72063114b8 --- /dev/null +++ b/indra/newview/llagentwearablesfetch.h @@ -0,0 +1,118 @@ +/** + * @file llagentwearablesinitialfetch.h + * @brief LLAgentWearablesInitialFetch class header file + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLAGENTWEARABLESINITIALFETCH_H +#define LL_LLAGENTWEARABLESINITIALFETCH_H + +#include "llinventoryobserver.h" +#include "llwearabledictionary.h" +#include "lluuid.h" + +//-------------------------------------------------------------------- +// InitialWearablesFetch +// +// This grabs contents from the COF and processes them. +// The processing is handled in idle(), i.e. outside of done(), +// to avoid gInventory.notifyObservers recursion. +//-------------------------------------------------------------------- +class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver +{ +public: + LLInitialWearablesFetch(); + ~LLInitialWearablesFetch(); + virtual void done(); + + struct InitialWearableData + { + EWearableType mType; + LLUUID mItemID; + LLUUID mAssetID; + InitialWearableData(EWearableType type, LLUUID& itemID, LLUUID& assetID) : + mType(type), + mItemID(itemID), + mAssetID(assetID) + {} + }; + + void add(InitialWearableData &data); + +protected: + void processWearablesMessage(); + void processContents(); + +private: + typedef std::vector<InitialWearableData> initial_wearable_data_vec_t; + initial_wearable_data_vec_t mAgentInitialWearables; // Wearables from the old agent wearables msg +}; + +//-------------------------------------------------------------------- +// InitialWearablesFetch +// +// This grabs outfits from the Library and copies those over to the user's +// outfits folder, typically during first-ever login. +//-------------------------------------------------------------------- +class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver +{ +public: + enum ELibraryOutfitFetchStep + { + LOFS_FOLDER = 0, + LOFS_OUTFITS, + LOFS_LIBRARY, + LOFS_IMPORTED, + LOFS_CONTENTS + }; + + LLLibraryOutfitsFetch(); + ~LLLibraryOutfitsFetch(); + + virtual void done(); + void doneIdle(); + LLUUID mMyOutfitsID; + void importedFolderFetch(); +protected: + void folderDone(void); + void outfitsDone(void); + void libraryDone(void); + void importedFolderDone(void); + void contentsDone(void); + enum ELibraryOutfitFetchStep mCurrFetchStep; + uuid_vec_t mLibraryClothingFolders; + uuid_vec_t mImportedClothingFolders; + bool mOutfitsPopulated; + LLUUID mClothingID; + LLUUID mLibraryClothingID; + LLUUID mImportedClothingID; + std::string mImportedClothingName; +}; + +#endif // LL_AGENTWEARABLESINITIALFETCH_H diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0159ca3523..8c5352ded7 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -39,6 +39,7 @@ #include "llfloatercustomize.h" #include "llgesturemgr.h" #include "llinventorybridge.h" +#include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llnotificationsutil.h" #include "llsidepanelappearance.h" @@ -119,7 +120,7 @@ protected: // If the inventory callback manager goes away, we're shutting down, no longer want the callback. if( LLInventoryCallbackManager::is_instantiated() ) { - LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); + LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); } else { @@ -228,7 +229,7 @@ void LLOutfitObserver::doWearCategory() else { // Wear the inventory category. - LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); + LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); } delete this; } @@ -310,9 +311,9 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy() { llinfos << "done update appearance on destroy" << llendl; - if (!LLApp::isExiting() && !LLApp::isStopped()) + if (!LLApp::isExiting()) { - LLAppearanceManager::instance().updateAppearanceFromCOF(); + LLAppearanceMgr::instance().updateAppearanceFromCOF(); } } @@ -368,6 +369,7 @@ public: void recoverMissingWearable(EWearableType type); void clearCOFLinksForMissingWearables(); + void onWearableAssetFetch(LLWearable *wearable); void onAllComplete(); typedef std::list<LLFoundData> found_list_t; @@ -450,12 +452,12 @@ void LLWearableHoldingPattern::onAllComplete() { llinfos << "Activating " << mGestItems.count() << " gestures" << llendl; - LLGestureManager::instance().activateGestures(mGestItems); + LLGestureMgr::instance().activateGestures(mGestItems); // Update the inventory item labels to reflect the fact // they are active. LLViewerInventoryCategory* catp = - gInventory.getCategory(LLAppearanceManager::instance().getCOF()); + gInventory.getCategory(LLAppearanceMgr::instance().getCOF()); if (catp) { @@ -466,11 +468,10 @@ void LLWearableHoldingPattern::onAllComplete() // Update wearables. llinfos << "Updating agent wearables with " << mResolved << " wearable items " << llendl; - LLAppearanceManager::instance().updateAgentWearables(this, false); + LLAppearanceMgr::instance().updateAgentWearables(this, false); // Update attachments to match those requested. - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( avatar ) + if (isAgentAvatarValid()) { llinfos << "Updating " << mObjItems.count() << " attachments" << llendl; LLAgentWearables::userUpdateAttachments(mObjItems); @@ -581,7 +582,7 @@ public: { link_inventory_item( gAgent.getID(), item_id, - LLAppearanceManager::instance().getCOF(), + LLAppearanceMgr::instance().getCOF(), itemp->getName(), LLAssetType::AT_LINK, cb); @@ -632,7 +633,7 @@ void LLWearableHoldingPattern::clearCOFLinksForMissingWearables() { // Wearable link that was never resolved; remove links to it from COF llinfos << "removing link for unresolved item " << data.mItemID.asString() << llendl; - LLAppearanceManager::instance().removeCOFItemLinks(data.mItemID,false); + LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID,false); } } } @@ -657,11 +658,10 @@ bool LLWearableHoldingPattern::pollMissingWearables() return done; } -static void onWearableAssetFetch(LLWearable* wearable, void* data) +void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable) { - LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data; - holder->mResolved += 1; // just counting callbacks, not successes. - llinfos << "onWearableAssetFetch, resolved count " << holder->mResolved << " of requested " << holder->mFoundList.size() << llendl; + mResolved += 1; // just counting callbacks, not successes. + llinfos << "onWearableAssetFetch, resolved count " << mResolved << " of requested " << mFoundList.size() << llendl; if (wearable) { llinfos << "wearable found, type " << wearable->getType() << " asset " << wearable->getAssetID() << llendl; @@ -671,7 +671,7 @@ static void onWearableAssetFetch(LLWearable* wearable, void* data) llwarns << "no wearable found" << llendl; } - if (holder->mFired) + if (mFired) { llwarns << "called after holder fired" << llendl; return; @@ -682,8 +682,8 @@ static void onWearableAssetFetch(LLWearable* wearable, void* data) return; } - for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin(); - iter != holder->mFoundList.end(); ++iter) + for (LLWearableHoldingPattern::found_list_t::iterator iter = mFoundList.begin(); + iter != mFoundList.end(); ++iter) { LLFoundData& data = *iter; if(wearable->getAssetID() == data.mAssetID) @@ -696,6 +696,12 @@ static void onWearableAssetFetch(LLWearable* wearable, void* data) } } +static void onWearableAssetFetch(LLWearable* wearable, void* data) +{ + LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data; + holder->onWearableAssetFetch(wearable); +} + static void removeDuplicateItems(LLInventoryModel::item_array_t& items) { @@ -724,13 +730,13 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) items = new_items; } -const LLUUID LLAppearanceManager::getCOF() const +const LLUUID LLAppearanceMgr::getCOF() const { return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); } -const LLViewerInventoryItem* LLAppearanceManager::getBaseOutfitLink() +const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink() { const LLUUID& current_outfit_cat = getCOF(); LLInventoryModel::cat_array_t cat_array; @@ -758,7 +764,7 @@ const LLViewerInventoryItem* LLAppearanceManager::getBaseOutfitLink() return NULL; } -bool LLAppearanceManager::getBaseOutfitName(std::string& name) +bool LLAppearanceMgr::getBaseOutfitName(std::string& name) { const LLViewerInventoryItem* outfit_link = getBaseOutfitLink(); if(outfit_link) @@ -774,15 +780,15 @@ bool LLAppearanceManager::getBaseOutfitName(std::string& name) } // Update appearance from outfit folder. -void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append) +void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool append) { if (!proceed) return; - LLAppearanceManager::instance().updateCOF(category,append); + LLAppearanceMgr::instance().updateCOF(category,append); } // Create a copy of src_id + contents as a subfolder of dst_id. -void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id, +void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id, LLPointer<LLInventoryCallback> cb) { LLInventoryCategory *src_cat = gInventory.getCategory(src_id); @@ -805,7 +811,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID } // Copy contents of src_id to dst_id. -void LLAppearanceManager::shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id, +void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id, LLPointer<LLInventoryCallback> cb) { LLInventoryModel::cat_array_t* cats; @@ -861,7 +867,7 @@ void LLAppearanceManager::shallowCopyCategoryContents(const LLUUID& src_id, cons } } -BOOL LLAppearanceManager::getCanMakeFolderIntoOutfit(const LLUUID& folder_id) +BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id) { // These are the wearable items that are required for considering this // folder as containing a complete outfit. @@ -893,7 +899,7 @@ BOOL LLAppearanceManager::getCanMakeFolderIntoOutfit(const LLUUID& folder_id) } -void LLAppearanceManager::purgeBaseOutfitLink(const LLUUID& category) +void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -915,7 +921,7 @@ void LLAppearanceManager::purgeBaseOutfitLink(const LLUUID& category) } } -void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit_links) +void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_links) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -935,7 +941,7 @@ void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit // Keep the last N wearables of each type. For viewer 2.0, N is 1 for // both body parts and clothing items. -void LLAppearanceManager::filterWearableItems( +void LLAppearanceMgr::filterWearableItems( LLInventoryModel::item_array_t& items, S32 max_per_type) { // Divvy items into arrays by wearable type. @@ -971,7 +977,7 @@ void LLAppearanceManager::filterWearableItems( } // Create links to all listed items. -void LLAppearanceManager::linkAll(const LLUUID& category, +void LLAppearanceMgr::linkAll(const LLUUID& category, LLInventoryModel::item_array_t& items, LLPointer<LLInventoryCallback> cb) { @@ -987,7 +993,7 @@ void LLAppearanceManager::linkAll(const LLUUID& category, } } -void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) +void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) { LLViewerInventoryCategory *pcat = gInventory.getCategory(category); llinfos << "starting, cat " << (pcat ? pcat->getName() : "[UNKNOWN]") << llendl; @@ -1002,9 +1008,9 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) for(S32 i = 0; i < gest_items.count(); ++i) { LLViewerInventoryItem *gest_item = gest_items.get(i); - if ( LLGestureManager::instance().isGestureActive( gest_item->getLinkedUUID()) ) + if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) ) { - LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() ); + LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() ); } } } @@ -1027,7 +1033,7 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING, false); // Reduce wearables to max of one per type. removeDuplicateItems(wear_items); - filterWearableItems(wear_items, 1); + filterWearableItems(wear_items, 5); // - Attachments: include COF contents only if appending. LLInventoryModel::item_array_t obj_items; @@ -1065,7 +1071,7 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) llinfos << "waiting for LLUpdateAppearanceOnDestroy" << llendl; } -void LLAppearanceManager::updatePanelOutfitName(const std::string& name) +void LLAppearanceMgr::updatePanelOutfitName(const std::string& name) { LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); @@ -1075,7 +1081,7 @@ void LLAppearanceManager::updatePanelOutfitName(const std::string& name) } } -void LLAppearanceManager::createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter) +void LLAppearanceMgr::createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter) { const LLUUID cof = getCOF(); LLViewerInventoryCategory* catp = gInventory.getCategory(category); @@ -1093,7 +1099,7 @@ void LLAppearanceManager::createBaseOutfitLink(const LLUUID& category, LLPointer updatePanelOutfitName(new_outfit_name); } -void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) +void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) { lldebugs << "updateAgentWearables()" << llendl; LLInventoryItem::item_array_t items; @@ -1117,7 +1123,6 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, items.put(item); wearables.put(wearable); } - break; } } } @@ -1146,7 +1151,7 @@ static void remove_non_link_items(LLInventoryModel::item_array_t &items) items = pruned_items; } -void LLAppearanceManager::updateAppearanceFromCOF() +void LLAppearanceMgr::updateAppearanceFromCOF() { // update dirty flag to see if the state of the COF matches // the saved outfit stored as a folder link @@ -1160,7 +1165,7 @@ void LLAppearanceManager::updateAppearanceFromCOF() LLUUID current_outfit_id = getCOF(); // Find all the wearables that are in the COF's subtree. - lldebugs << "LLAppearanceManager::updateFromCOF()" << llendl; + lldebugs << "LLAppearanceMgr::updateFromCOF()" << llendl; LLInventoryModel::item_array_t wear_items; LLInventoryModel::item_array_t obj_items; LLInventoryModel::item_array_t gest_items; @@ -1186,9 +1191,6 @@ void LLAppearanceManager::updateAppearanceFromCOF() // callback will be called (and this object deleted) // before the final getNextData(). - // BAP future cleanup - no point having found_container when - // mFoundList already has all the info. - LLDynamicArray<LLFoundData> found_container; for(S32 i = 0; i < wear_items.count(); ++i) { LLViewerInventoryItem *item = wear_items.get(i); @@ -1214,7 +1216,6 @@ void LLAppearanceManager::updateAppearanceFromCOF() #endif holder->mFoundList.push_front(found); - found_container.put(found); } else { @@ -1229,9 +1230,10 @@ void LLAppearanceManager::updateAppearanceFromCOF() } } - for(S32 i = 0; i < found_container.count(); ++i) + for (LLWearableHoldingPattern::found_list_t::iterator it = holder->mFoundList.begin(); + it != holder->mFoundList.end(); ++it) { - LLFoundData& found = found_container.get(i); + LLFoundData& found = *it; llinfos << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << llendl; @@ -1248,10 +1250,9 @@ void LLAppearanceManager::updateAppearanceFromCOF() { doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollFetchCompletion,holder)); } - } -void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category, +void LLAppearanceMgr::getDescendentsOfAssetType(const LLUUID& category, LLInventoryModel::item_array_t& items, LLAssetType::EType type, bool follow_folder_links) @@ -1266,7 +1267,7 @@ void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category, follow_folder_links); } -void LLAppearanceManager::getUserDescendents(const LLUUID& category, +void LLAppearanceMgr::getUserDescendents(const LLUUID& category, LLInventoryModel::item_array_t& wear_items, LLInventoryModel::item_array_t& obj_items, LLInventoryModel::item_array_t& gest_items, @@ -1301,7 +1302,7 @@ void LLAppearanceManager::getUserDescendents(const LLUUID& category, follow_folder_links); } -void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append) +void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append) { if(!category) return; @@ -1312,7 +1313,7 @@ void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, b // the inventory, and set up an observer that will wait for that to // happen. LLOutfitFetch* outfit_fetcher = new LLOutfitFetch(copy, append); - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + uuid_vec_t folders; folders.push_back(category->getUUID()); outfit_fetcher->fetchDescendents(folders); //inc_busy_count(); @@ -1330,7 +1331,7 @@ void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, b } // *NOTE: hack to get from avatar inventory to avatar -void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* category, bool append ) +void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* category, bool append ) { // Avoid unintentionally overwriting old wearables. We have to do // this up front to avoid having to deal with the case of multiple @@ -1342,17 +1343,17 @@ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* ca if( gFloaterCustomize ) { - gFloaterCustomize->askToSaveIfDirty(boost::bind(&LLAppearanceManager::changeOutfit, - &LLAppearanceManager::instance(), + gFloaterCustomize->askToSaveIfDirty(boost::bind(&LLAppearanceMgr::changeOutfit, + &LLAppearanceMgr::instance(), _1, category->getUUID(), append)); } else { - LLAppearanceManager::changeOutfit(TRUE, category->getUUID(), append); + LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append); } } -void LLAppearanceManager::wearOutfitByName(const std::string& name) +void LLAppearanceMgr::wearOutfitByName(const std::string& name) { llinfos << "Wearing category " << name << llendl; //inc_busy_count(); @@ -1388,7 +1389,7 @@ void LLAppearanceManager::wearOutfitByName(const std::string& name) if(cat) { - LLAppearanceManager::wearInventoryCategory(cat, copy_items, false); + LLAppearanceMgr::wearInventoryCategory(cat, copy_items, false); } else { @@ -1424,7 +1425,7 @@ public: if (item) { gInventory.removeObserver(this); - LLAppearanceManager::instance().addCOFItemLink(item,mDoUpdate); + LLAppearanceMgr::instance().addCOFItemLink(item,mDoUpdate); delete this; } } @@ -1435,7 +1436,7 @@ private: }; -void LLAppearanceManager::addCOFItemLink(const LLUUID &item_id, bool do_update ) +void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update ) { const LLInventoryItem *item = gInventory.getItem(item_id); if (!item) @@ -1449,7 +1450,7 @@ void LLAppearanceManager::addCOFItemLink(const LLUUID &item_id, bool do_update ) } } -void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_update ) +void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update ) { const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item); if (!vitem) @@ -1462,7 +1463,7 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(LLAppearanceManager::getCOF(), + gInventory.collectDescendents(LLAppearanceMgr::getCOF(), cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH); @@ -1490,7 +1491,7 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up { if (do_update) { - LLAppearanceManager::updateAppearanceFromCOF(); + LLAppearanceMgr::updateAppearanceFromCOF(); } return; } @@ -1507,7 +1508,8 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up return; } -void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_update ) +// 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. @@ -1521,13 +1523,13 @@ void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_upd #endif } -void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_update) +void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update) { gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(LLAppearanceManager::getCOF(), + gInventory.collectDescendents(LLAppearanceMgr::getCOF(), cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH); @@ -1541,11 +1543,11 @@ void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_upda } if (do_update) { - LLAppearanceManager::updateAppearanceFromCOF(); + LLAppearanceMgr::updateAppearanceFromCOF(); } } -void LLAppearanceManager::updateIsDirty() +void LLAppearanceMgr::updateIsDirty() { LLUUID cof = getCOF(); LLUUID base_outfit; @@ -1614,7 +1616,7 @@ void LLAppearanceManager::updateIsDirty() } } -void LLAppearanceManager::onFirstFullyVisible() +void LLAppearanceMgr::onFirstFullyVisible() { // If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account) // then auto-populate outfits from the library into the My Outfits folder. @@ -1633,7 +1635,7 @@ void LLAppearanceManager::onFirstFullyVisible() //#define DUMP_CAT_VERBOSE -void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg) +void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -1654,7 +1656,7 @@ void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg) llinfos << msg << " count " << items.count() << llendl; } -void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& items, +void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg) { llinfos << msg << llendl; @@ -1666,17 +1668,17 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it llinfos << llendl; } -LLAppearanceManager::LLAppearanceManager(): +LLAppearanceMgr::LLAppearanceMgr(): mAttachmentInvLinkEnabled(false), mOutfitIsDirty(false) { } -LLAppearanceManager::~LLAppearanceManager() +LLAppearanceMgr::~LLAppearanceMgr() { } -void LLAppearanceManager::setAttachmentInvLinkEnable(bool val) +void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val) { llinfos << "setAttachmentInvLinkEnable => " << (int) val << llendl; mAttachmentInvLinkEnabled = val; @@ -1699,7 +1701,7 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg) llinfos << llendl; } -void LLAppearanceManager::registerAttachment(const LLUUID& item_id) +void LLAppearanceMgr::registerAttachment(const LLUUID& item_id) { mRegisteredAttachments.insert(item_id); gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); @@ -1707,7 +1709,7 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) if (mAttachmentInvLinkEnabled) { - LLAppearanceManager::addCOFItemLink(item_id, false); // Add COF link for item. + LLAppearanceMgr::addCOFItemLink(item_id, false); // Add COF link for item. } else { @@ -1715,7 +1717,7 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) } } -void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id) +void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id) { mRegisteredAttachments.erase(item_id); gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); @@ -1724,8 +1726,8 @@ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id) if (mAttachmentInvLinkEnabled) { - //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Removing attachment link:"); - LLAppearanceManager::removeCOFItemLinks(item_id, false); + //LLAppearanceMgr::dumpCat(LLAppearanceMgr::getCOF(),"Removing attachment link:"); + LLAppearanceMgr::removeCOFItemLinks(item_id, false); } else { @@ -1733,7 +1735,7 @@ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id) } } -void LLAppearanceManager::linkRegisteredAttachments() +void LLAppearanceMgr::linkRegisteredAttachments() { for (std::set<LLUUID>::iterator it = mRegisteredAttachments.begin(); it != mRegisteredAttachments.end(); @@ -1745,12 +1747,12 @@ void LLAppearanceManager::linkRegisteredAttachments() mRegisteredAttachments.clear(); } -BOOL LLAppearanceManager::getIsInCOF(const LLUUID& obj_id) const +BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const { return gInventory.isObjectDescendentOf(obj_id, getCOF()); } -BOOL LLAppearanceManager::getIsProtectedCOFItem(const LLUUID& obj_id) const +BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const { if (!getIsInCOF(obj_id)) return FALSE; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 9d6cd34ad7..2d6a0a10ed 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -43,9 +43,9 @@ class LLWearable; class LLWearableHoldingPattern; class LLInventoryCallback; -class LLAppearanceManager: public LLSingleton<LLAppearanceManager> +class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr> { - friend class LLSingleton<LLAppearanceManager>; + friend class LLSingleton<LLAppearanceMgr>; public: void updateAppearanceFromCOF(); @@ -120,8 +120,8 @@ public: void onFirstFullyVisible(); protected: - LLAppearanceManager(); - ~LLAppearanceManager(); + LLAppearanceMgr(); + ~LLAppearanceMgr(); private: @@ -324,7 +324,7 @@ template <class T> void callAfterCategoryFetch(const LLUUID& cat_id, T callable) { CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(callable); - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + uuid_vec_t folders; folders.push_back(cat_id); stage1->fetchDescendents(folders); if (stage1->isEverythingComplete()) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8f4e5ecd89..2a355474b1 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -44,6 +44,7 @@ #include "llviewertexturelist.h" #include "llgroupmgr.h" #include "llagent.h" +#include "llagentcamera.h" #include "llagentwearables.h" #include "llwindow.h" #include "llviewerstats.h" @@ -78,6 +79,7 @@ #include "lllocationhistory.h" #include "llfasttimerview.h" #include "llvoicechannel.h" +#include "llvoavatarself.h" #include "llsidetray.h" @@ -358,7 +360,7 @@ void request_initial_instant_messages() if (!requested && gMessageSystem && LLMuteList::getInstance()->isLoaded() - && gAgent.getAvatarObject()) + && isAgentAvatarValid()) { // Auto-accepted inventory items may require the avatar object // to build a correct name. Likewise, inventory offers from @@ -1086,12 +1088,15 @@ bool LLAppViewer::mainLoop() ms_sleep(500); } - + static const F64 FRAME_SLOW_THRESHOLD = 0.5; //2 frames per seconds const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms const F64 max_idle_time = run_multiple_threads ? min_idle_time : llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second idleTimer.reset(); - while(1) + bool is_slow = (frameTimer.getElapsedTimeF64() > FRAME_SLOW_THRESHOLD) ; + S32 total_work_pending = 0; + S32 total_io_pending = 0; + while(!is_slow)//do not unpause threads if the frame rates are very low. { S32 work_pending = 0; S32 io_pending = 0; @@ -1122,6 +1127,8 @@ bool LLAppViewer::mainLoop() ms_sleep(llmin(io_pending/100,100)); // give the vfs some time to catch up } + total_work_pending += work_pending ; + total_io_pending += io_pending ; F64 frame_time = frameTimer.getElapsedTimeF64(); F64 idle_time = idleTimer.getElapsedTimeF64(); if (frame_time >= min_frame_time && @@ -1131,25 +1138,32 @@ bool LLAppViewer::mainLoop() break; } } - if ((LLStartUp::getStartupState() >= STATE_CLEANUP) && - (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD)) - { - gFrameStalls++; - } - frameTimer.reset(); // Prevent the worker threads from running while rendering. // if (LLThread::processorCount()==1) //pause() should only be required when on a single processor client... if (run_multiple_threads == FALSE) { - LLFastTimer ftm(FTM_PAUSE_THREADS); - - LLAppViewer::getTextureCache()->pause(); - LLAppViewer::getImageDecodeThread()->pause(); - // LLAppViewer::getTextureFetch()->pause(); // Don't pause the fetch (IO) thread + //LLFastTimer ftm(FTM_PAUSE_THREADS); //not necessary. + + if(!total_work_pending) //pause texture fetching threads if nothing to process. + { + LLAppViewer::getTextureCache()->pause(); + LLAppViewer::getImageDecodeThread()->pause(); + LLAppViewer::getTextureFetch()->pause(); + } + if(!total_io_pending) //pause file threads if nothing to process. + { + LLVFSThread::sLocal->pause(); + LLLFSThread::sLocal->pause(); + } + } + + if ((LLStartUp::getStartupState() >= STATE_CLEANUP) && + (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD)) + { + gFrameStalls++; } - //LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering. - //LLLFSThread::sLocal->pause(); // Prevent the LFS thread from running while rendering. + frameTimer.reset(); resumeMainloopTimeout(); @@ -1485,6 +1499,8 @@ bool LLAppViewer::cleanup() LLLocationHistory::getInstance()->save(); LLAvatarIconIDCache::getInstance()->save(); + + LLViewerMedia::saveCookieFile(); llinfos << "Shutting down Threads" << llendflush; @@ -1605,7 +1621,7 @@ bool LLAppViewer::cleanup() // HACK: Attempt to wait until the screen res. switch is complete. ms_sleep(1000); - LLWeb::loadURLExternal( gLaunchFileOnQuit ); + LLWeb::loadURLExternal( gLaunchFileOnQuit, false ); llinfos << "File launched." << llendflush; } @@ -2432,9 +2448,9 @@ void LLAppViewer::cleanupSavedSettings() gSavedSettings.setF32("MapScale", LLWorldMapView::sMapScale ); // Some things are cached in LLAgent. - if (gAgent.mInitialized) + if (gAgent.isInitialized()) { - gSavedSettings.setF32("RenderFarClip", gAgent.mDrawDistance); + gSavedSettings.setF32("RenderFarClip", gAgentCamera.mDrawDistance); } } @@ -3269,10 +3285,10 @@ void LLAppViewer::saveFinalSnapshot() { if (!mSavedFinalSnapshot && !gNoRender) { - gSavedSettings.setVector3d("FocusPosOnLogout", gAgent.calcFocusPositionTargetGlobal()); - gSavedSettings.setVector3d("CameraPosOnLogout", gAgent.calcCameraPositionTargetGlobal()); + gSavedSettings.setVector3d("FocusPosOnLogout", gAgentCamera.calcFocusPositionTargetGlobal()); + gSavedSettings.setVector3d("CameraPosOnLogout", gAgentCamera.calcCameraPositionTargetGlobal()); gViewerWindow->setCursor(UI_CURSOR_WAIT); - gAgent.changeCameraToThirdPerson( FALSE ); // don't animate, need immediate switch + gAgentCamera.changeCameraToThirdPerson( FALSE ); // don't animate, need immediate switch gSavedSettings.setBOOL("ShowParcelOwners", FALSE); idle(); @@ -3554,7 +3570,7 @@ void LLAppViewer::idle() // Handle pending gesture processing static LLFastTimer::DeclareTimer ftm("Agent Position"); LLFastTimer t(ftm); - LLGestureManager::instance().update(); + LLGestureMgr::instance().update(); gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY); } @@ -3682,7 +3698,7 @@ void LLAppViewer::idle() LLViewerJoystick::getInstance()->moveObjects(); } - gAgent.updateCamera(); + gAgentCamera.updateCamera(); } // update media focus @@ -4016,7 +4032,7 @@ void LLAppViewer::disconnectViewer() LLFloaterInventory::cleanup(); gAgentWearables.cleanup(); - + gAgentCamera.cleanup(); // Also writes cached agent settings to gSavedSettings gAgent.cleanup(); diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 63d9ed19ad..60a6d2f072 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -469,7 +469,7 @@ bool LLAppViewerWin32::initHardwareTest() if (OSBTN_NO== button) { LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL; - LLWeb::loadURLExternal(DIRECTX_9_URL); + LLWeb::loadURLExternal(DIRECTX_9_URL, false); return false; } gWarningSettings.setBOOL("AboutDirectX9", FALSE); diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 8441796219..370ecc0665 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -202,13 +202,19 @@ void LLAssetUploadResponder::uploadComplete(const LLSD& content) LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const LLUUID& vfile_id, - LLAssetType::EType asset_type) -: LLAssetUploadResponder(post_data, vfile_id, asset_type) + LLAssetType::EType asset_type, + boost::function<void(const LLUUID& uuid)> callback) +: LLAssetUploadResponder(post_data, vfile_id, asset_type), + mCallback(callback) { } -LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type) -: LLAssetUploadResponder(post_data, file_name, asset_type) +LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, + const std::string& file_name, + LLAssetType::EType asset_type, + boost::function<void(const LLUUID& uuid)> callback) +: LLAssetUploadResponder(post_data, file_name, asset_type), + mCallback(callback) { } @@ -286,6 +292,12 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) creation_date_now); gInventory.updateItem(item); gInventory.notifyObservers(); + + if (mCallback) + { + // call the callback with the new Asset UUID + mCallback(item->getAssetUUID()); + } // Show the preview panel for textures and sounds to let // user know that the image (or snapshot) arrived intact. @@ -333,13 +345,11 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) U32 group_perms = mPostData.has("group_mask") ? mPostData.get("group_mask" ).asInteger() : PERM_NONE; U32 next_owner_perms = mPostData.has("next_owner_mask") ? mPostData.get("next_owner_mask").asInteger() : PERM_NONE; std::string display_name = LLStringUtil::null; - LLAssetStorage::LLStoreAssetCallback callback = NULL; - void *userdata = NULL; upload_new_resource(next_file, asset_name, asset_name, - 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLFolderType::FT_NONE, LLInventoryType::IT_NONE, next_owner_perms, group_perms, everyone_perms, display_name, - callback, expected_upload_cost, userdata); + NULL, expected_upload_cost); } } @@ -477,10 +487,10 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content) { // If this gesture is active, then we need to update the in-memory // active map with the new pointer. - if (LLGestureManager::instance().isGestureActive(item_id)) + if (LLGestureMgr::instance().isGestureActive(item_id)) { LLUUID asset_id = new_item->getAssetUUID(); - LLGestureManager::instance().replaceGesture(item_id, asset_id); + LLGestureMgr::instance().replaceGesture(item_id, asset_id); gInventory.notifyObservers(); } diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index e656351305..ade9c96758 100644 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -33,6 +33,7 @@ #ifndef LL_LLASSETUPLOADRESPONDER_H #define LL_LLASSETUPLOADRESPONDER_H +#include "llassetstorage.h" #include "llhttpclient.h" // Abstract class for supporting asset upload @@ -66,10 +67,15 @@ class LLNewAgentInventoryResponder : public LLAssetUploadResponder public: LLNewAgentInventoryResponder(const LLSD& post_data, const LLUUID& vfile_id, - LLAssetType::EType asset_type); - LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name, - LLAssetType::EType asset_type); + LLAssetType::EType asset_type, + boost::function<void(const LLUUID& uuid)> callback = NULL); + LLNewAgentInventoryResponder(const LLSD& post_data, + const std::string& file_name, + LLAssetType::EType asset_type, + boost::function<void(const LLUUID& uuid)> callback = NULL); virtual void uploadComplete(const LLSD& content); + + boost::function<void(const LLUUID& uuid)> mCallback; }; class LLBakedUploadData; diff --git a/indra/newview/llaudiosourcevo.cpp b/indra/newview/llaudiosourcevo.cpp index 5e71e64b2f..50363ea2e7 100644 --- a/indra/newview/llaudiosourcevo.cpp +++ b/indra/newview/llaudiosourcevo.cpp @@ -35,7 +35,7 @@ #include "llaudiosourcevo.h" -#include "llagent.h" +#include "llagentcamera.h" #include "llmutelist.h" #include "llviewerparcelmgr.h" @@ -148,7 +148,7 @@ void LLAudioSourceVO::update() updateGain(); if (mObjectp->isHUDAttachment()) { - mPositionGlobal = gAgent.getCameraPositionGlobal(); + mPositionGlobal = gAgentCamera.getCameraPositionGlobal(); } else { diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index f1722e52dc..48a85dc73f 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -113,13 +113,13 @@ void LLAvatarActions::removeFriendDialog(const LLUUID& id) if (id.isNull()) return; - std::vector<LLUUID> ids; + uuid_vec_t ids; ids.push_back(id); removeFriendsDialog(ids); } // static -void LLAvatarActions::removeFriendsDialog(const std::vector<LLUUID>& ids) +void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids) { if(ids.size() == 0) return; @@ -144,7 +144,7 @@ void LLAvatarActions::removeFriendsDialog(const std::vector<LLUUID>& ids) } LLSD payload; - for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { payload["ids"].append(*it); } @@ -161,13 +161,21 @@ void LLAvatarActions::offerTeleport(const LLUUID& invitee) if (invitee.isNull()) return; + //waiting until Name Cache gets updated with corresponding avatar name + std::string just_to_request_name; + if (!gCacheName->getFullName(invitee, just_to_request_name)) + { + gCacheName->get(invitee, FALSE, boost::bind((void (*)(const LLUUID&)) &LLAvatarActions::offerTeleport, invitee)); + return; + } + LLDynamicArray<LLUUID> ids; ids.push_back(invitee); offerTeleport(ids); } // static -void LLAvatarActions::offerTeleport(const std::vector<LLUUID>& ids) +void LLAvatarActions::offerTeleport(const uuid_vec_t& ids) { if (ids.size() == 0) return; @@ -228,7 +236,7 @@ void LLAvatarActions::startCall(const LLUUID& id) } // static -void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids) +void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) { if (ids.size() == 0) { @@ -237,7 +245,7 @@ void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids) // convert vector into LLDynamicArray for addSession LLDynamicArray<LLUUID> id_array; - for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { id_array.push_back(*it); } @@ -278,11 +286,11 @@ bool LLAvatarActions::canCall() } // static -void LLAvatarActions::startConference(const std::vector<LLUUID>& ids) +void LLAvatarActions::startConference(const uuid_vec_t& ids) { // *HACK: Copy into dynamic array LLDynamicArray<LLUUID> id_array; - for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { id_array.push_back(*it); } @@ -434,6 +442,20 @@ void LLAvatarActions::toggleBlock(const LLUUID& id) LLMuteList::getInstance()->add(mute); } } +// static +bool LLAvatarActions::canOfferTeleport(const LLUUID& id) +{ + // First use LLAvatarTracker::isBuddy() + // If LLAvatarTracker::instance().isBuddyOnline function only is used + // then for avatars that are online and not a friend it will return false. + // But we should give an ability to offer a teleport for such avatars. + if(LLAvatarTracker::instance().isBuddy(id)) + { + return LLAvatarTracker::instance().isBuddyOnline(id); + } + + return true; +} void LLAvatarActions::inviteToGroup(const LLUUID& id) { @@ -499,7 +521,7 @@ bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response, // static void LLAvatarActions::callback_invite_to_group(LLUUID group_id, LLUUID id) { - std::vector<LLUUID> agent_ids; + uuid_vec_t agent_ids; agent_ids.push_back(id); LLFloaterGroupInvite::showForGroup(group_id, &agent_ids); diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index a7f3acad4f..9d8b4b4e23 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -60,13 +60,13 @@ public: * Show a friend removal dialog. */ static void removeFriendDialog(const LLUUID& id); - static void removeFriendsDialog(const std::vector<LLUUID>& ids); + static void removeFriendsDialog(const uuid_vec_t& ids); /** * Show teleport offer dialog. */ static void offerTeleport(const LLUUID& invitee); - static void offerTeleport(const std::vector<LLUUID>& ids); + static void offerTeleport(const uuid_vec_t& ids); /** * Start instant messaging session. @@ -86,12 +86,12 @@ public: /** * Start an ad-hoc conference voice call with multiple users */ - static void startAdhocCall(const std::vector<LLUUID>& ids); + static void startAdhocCall(const uuid_vec_t& ids); /** * Start conference chat with the given avatars. */ - static void startConference(const std::vector<LLUUID>& ids); + static void startConference(const uuid_vec_t& ids); /** * Show avatar profile. @@ -171,6 +171,12 @@ public: */ static void csr(const LLUUID& id, std::string name); + /** + * Checks whether can offer teleport to the avatar + * Can't offer only for offline friends + */ + static bool canOfferTeleport(const LLUUID& id); + private: static bool callbackAddFriend(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 45c540b3a3..6ec62a61a0 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -204,17 +204,17 @@ void LLAvatarList::refresh() bool have_filter = !mNameFilter.empty(); // Save selection. - std::vector<LLUUID> selected_ids; + uuid_vec_t selected_ids; getSelectedUUIDs(selected_ids); LLUUID current_id = getSelectedUUID(); // Determine what to add and what to remove. - std::vector<LLUUID> added, removed; + uuid_vec_t added, removed; LLAvatarList::computeDifference(getIDs(), added, removed); // Handle added items. unsigned nadded = 0; - for (std::vector<LLUUID>::const_iterator it=added.begin(); it != added.end(); it++) + for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++) { std::string name; const LLUUID& buddy_id = *it; @@ -236,7 +236,7 @@ void LLAvatarList::refresh() } // Handle removed items. - for (std::vector<LLUUID>::const_iterator it=removed.begin(); it != removed.end(); it++) + for (uuid_vec_t::const_iterator it=removed.begin(); it != removed.end(); it++) { removeItemByUUID(*it); modified = true; @@ -334,6 +334,17 @@ boost::signals2::connection LLAvatarList::setItemDoubleClickCallback(const mouse return mItemDoubleClickSignal.connect(cb); } +//virtual +S32 LLAvatarList::notifyParent(const LLSD& info) +{ + if (info.has("sort") && &NAME_COMPARATOR == mItemComparator) + { + sort(); + return 1; + } + return LLFlatListView::notifyParent(info); +} + void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos) { LLAvatarListItem* item = new LLAvatarListItem(); @@ -358,7 +369,7 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask); if ( mContextMenu ) { - std::vector<LLUUID> selected_uuids; + uuid_vec_t selected_uuids; getSelectedUUIDs(selected_uuids); mContextMenu->show(this, selected_uuids, x, y); } @@ -366,12 +377,12 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask) } void LLAvatarList::computeDifference( - const std::vector<LLUUID>& vnew_unsorted, - std::vector<LLUUID>& vadded, - std::vector<LLUUID>& vremoved) + const uuid_vec_t& vnew_unsorted, + uuid_vec_t& vadded, + uuid_vec_t& vremoved) { - std::vector<LLUUID> vcur; - std::vector<LLUUID> vnew = vnew_unsorted; + uuid_vec_t vcur; + uuid_vec_t vnew = vnew_unsorted; // Convert LLSDs to LLUUIDs. { @@ -385,7 +396,7 @@ void LLAvatarList::computeDifference( std::sort(vcur.begin(), vcur.end()); std::sort(vnew.begin(), vnew.end()); - std::vector<LLUUID>::iterator it; + uuid_vec_t::iterator it; size_t maxsize = llmax(vcur.size(), vnew.size()); vadded.resize(maxsize); vremoved.resize(maxsize); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 00c72f1f9d..5a55975413 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -53,7 +53,7 @@ class LLAvatarList : public LLFlatListView { LOG_CLASS(LLAvatarList); public: - typedef std::vector<LLUUID> uuid_vector_t; + typedef uuid_vec_t uuid_vector_t; struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> { @@ -96,14 +96,16 @@ public: boost::signals2::connection setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb); + virtual S32 notifyParent(const LLSD& info); + protected: void refresh(); void addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM); void computeDifference( - const std::vector<LLUUID>& vnew, - std::vector<LLUUID>& vadded, - std::vector<LLUUID>& vremoved); + const uuid_vec_t& vnew, + uuid_vec_t& vadded, + uuid_vec_t& vremoved); void updateLastInteractionTimes(); void onItemDoucleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask); diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 9645e75e60..44f88cce29 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -119,8 +119,9 @@ S32 LLAvatarListItem::notifyParent(const LLSD& info) if (info.has("visibility_changed")) { updateChildren(); + return 1; } - return 0; + return LLPanel::notifyParent(info); } void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask) @@ -334,6 +335,9 @@ void LLAvatarListItem::onNameCache(const std::string& first_name, const std::str { std::string name = first_name + " " + last_name; setName(name); + + //requesting the list to resort + notifyParent(LLSD().with("sort", LLSD())); } // Convert given number of seconds to a string like "23 minutes", "15 hours" or "3 years", diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index cecb64add7..2db6484a30 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -70,7 +70,7 @@ public: class ContextMenu { public: - virtual void show(LLView* spawning_view, const std::vector<LLUUID>& selected_uuids, S32 x, S32 y) = 0; + virtual void show(LLView* spawning_view, const uuid_vec_t& selected_uuids, S32 x, S32 y) = 0; }; /** diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index d5796458b4..9824f59358 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -35,7 +35,7 @@ #define LLBOTTOMTRAY_CPP #include "llbottomtray.h" -#include "llagent.h" +#include "llagentcamera.h" #include "llchiclet.h" #include "llfloaterreg.h" #include "llflyoutbutton.h" @@ -125,7 +125,7 @@ public: void onFocusLost() { - if (gAgent.cameraMouselook()) + if (gAgentCamera.cameraMouselook()) { LLBottomTray::getInstance()->setVisible(FALSE); } @@ -160,10 +160,6 @@ LLBottomTray::LLBottomTray(const LLSD&) LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); - mChicletPanel = getChild<LLChicletPanel>("chiclet_list"); - - mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); - LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraPresets, _2)); //this is to fix a crash that occurs because LLBottomTray is a singleton @@ -171,8 +167,6 @@ LLBottomTray::LLBottomTray(const LLSD&) //destroyed LLBottomTray requires some subsystems that are long gone //LLUI::getRootView()->addChild(this); - initStateProcessedObjectMap(); - // Necessary for focus movement among child controls setFocusRoot(TRUE); @@ -371,6 +365,23 @@ void LLBottomTray::setVisible(BOOL visible) gFloaterView->setSnapOffsetBottom(0); } +S32 LLBottomTray::notifyParent(const LLSD& info) +{ + if(info.has("well_empty")) // implementation of EXT-3397 + { + const std::string chiclet_name = info["well_name"]; + + // only "im_well" or "notification_well" names are expected. + // They are set in panel_bottomtray.xml in <chiclet_im_well> & <chiclet_notification> + llassert("im_well" == chiclet_name || "notification_well" == chiclet_name); + + BOOL should_be_visible = !info["well_empty"]; + showWellButton("im_well" == chiclet_name ? RS_IM_WELL : RS_NOTIFICATION_WELL, should_be_visible); + return 1; + } + return LLPanel::notifyParent(info); +} + void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask) { // We should show BottomTrayContextMenu in last turn @@ -487,6 +498,15 @@ BOOL LLBottomTray::postBuild() mNearbyChatBar->getChatBox()->setContextMenu(NULL); + mChicletPanel = getChild<LLChicletPanel>("chiclet_list"); + mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); + + initStateProcessedObjectMap(); + + // update wells visibility: + showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty()); + showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty()); + return TRUE; } @@ -855,6 +875,7 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width) { lldebugs << "Trying to show object type: " << shown_object_type << llendl; + llassert(mStateProcessedObjectMap[shown_object_type] != NULL); LLPanel* panel = mStateProcessedObjectMap[shown_object_type]; if (NULL == panel) @@ -886,6 +907,7 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width) { lldebugs << "Trying to hide object type: " << processed_object_type << llendl; + llassert(mStateProcessedObjectMap[processed_object_type] != NULL); LLPanel* panel = mStateProcessedObjectMap[processed_object_type]; if (NULL == panel) @@ -963,6 +985,7 @@ void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32* required_width) { + llassert(mStateProcessedObjectMap[processed_object_type] != NULL); LLPanel* panel = mStateProcessedObjectMap[processed_object_type]; if (NULL == panel) { @@ -1046,6 +1069,7 @@ void LLBottomTray::processExtendButtons(S32* available_width) void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32* available_width) { + llassert(mStateProcessedObjectMap[processed_object_type] != NULL); LLPanel* panel = mStateProcessedObjectMap[processed_object_type]; if (NULL == panel) { @@ -1126,6 +1150,7 @@ void LLBottomTray::initStateProcessedObjectMap() void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible) { + llassert(mStateProcessedObjectMap[shown_object_type] != NULL); LLPanel* panel = mStateProcessedObjectMap[shown_object_type]; if (NULL == panel) { @@ -1264,4 +1289,29 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible return is_set; } +void LLBottomTray::showWellButton(EResizeState object_type, bool visible) +{ + llassert( ((RS_NOTIFICATION_WELL | RS_IM_WELL) & object_type) == object_type ); + + const std::string panel_name = RS_IM_WELL == object_type ? "im_well_panel" : "notification_well_panel"; + + LLView * panel = getChild<LLView>(panel_name); + + // if necessary visibility is set nothing to do here + if (panel->getVisible() == (BOOL)visible) return; + + S32 panel_width = panel->getRect().getWidth(); + panel->setVisible(visible); + + if (visible) + { + // method assumes that input param is a negative value + processWidthDecreased(-panel_width); + } + else + { + processWidthIncreased(panel_width); + } +} + //EOF diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 18c14e5e19..3c45777645 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -83,6 +83,8 @@ public: virtual void setVisible(BOOL visible); + /*virtual*/ S32 notifyParent(const LLSD& info); + // Implements LLVoiceClientStatusObserver::onChange() to enable the speak // button when voice is available /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); @@ -116,6 +118,8 @@ private: , RS_BUTTON_MOVEMENT = 0x0010 , RS_BUTTON_GESTURES = 0x0020 , RS_BUTTON_SPEAK = 0x0040 + , RS_IM_WELL = 0x0080 + , RS_NOTIFICATION_WELL = 0x0100 /** * Specifies buttons which can be hidden when bottom tray is shrunk. @@ -184,6 +188,15 @@ private: */ bool setVisibleAndFitWidths(EResizeState object_type, bool visible); + /** + * Shows/hides panel with specified well button (IM or Notification) + * + * @param[in] object_type - type of well button to be processed. + * Must be one of RS_IM_WELL or RS_NOTIFICATION_WELL. + * @param[in] visible - flag specified whether button should be shown or hidden. + */ + void showWellButton(EResizeState object_type, bool visible); + MASK mResizeState; typedef std::map<EResizeState, LLPanel*> state_object_map_t; diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 25b4671f91..132e4f0933 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -54,7 +54,7 @@ #include "llvoicechannel.h" #include "llviewerparcelmgr.h" -static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids); +static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids); void reshape_floater(LLCallFloater* floater, S32 delta_height); class LLNonAvatarCaller : public LLAvatarListItem @@ -210,9 +210,9 @@ void LLCallFloater::onChange() updateParticipantsVoiceState(); // Add newly joined participants. - std::vector<LLUUID> speakers_uuids; + uuid_vec_t speakers_uuids; get_voice_participants_uuids(speakers_uuids); - for (std::vector<LLUUID>::const_iterator it = speakers_uuids.begin(); it != speakers_uuids.end(); it++) + for (uuid_vec_t::const_iterator it = speakers_uuids.begin(); it != speakers_uuids.end(); it++) { mParticipants->addAvatarIDExceptAgent(*it); } @@ -465,7 +465,7 @@ void LLCallFloater::updateAgentModeratorState() mAgentPanel->childSetValue("user_text", name); } -static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids) +static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids) { // Get a list of participants from VoiceClient std::set<LLUUID> participants; @@ -489,7 +489,7 @@ void LLCallFloater::initParticipantsVoiceState() it_end = items.end(); - std::vector<LLUUID> speakers_uuids; + uuid_vec_t speakers_uuids; get_voice_participants_uuids(speakers_uuids); for(; it != it_end; ++it) @@ -500,7 +500,7 @@ void LLCallFloater::initParticipantsVoiceState() LLUUID speaker_id = item->getAvatarId(); - std::vector<LLUUID>::const_iterator speaker_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), speaker_id); + uuid_vec_t::const_iterator speaker_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), speaker_id); // If an avatarID assigned to a panel is found in a speakers list // obtained from VoiceClient we assign the JOINED status to the owner @@ -529,10 +529,10 @@ void LLCallFloater::initParticipantsVoiceState() void LLCallFloater::updateParticipantsVoiceState() { - std::vector<LLUUID> speakers_list; + uuid_vec_t speakers_list; // Get a list of participants from VoiceClient - std::vector<LLUUID> speakers_uuids; + uuid_vec_t speakers_uuids; get_voice_participants_uuids(speakers_uuids); // Updating the status for each participant already in list. @@ -550,7 +550,7 @@ void LLCallFloater::updateParticipantsVoiceState() const LLUUID participant_id = item->getAvatarId(); bool found = false; - std::vector<LLUUID>::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id); + uuid_vec_t::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id); LL_DEBUGS("Voice") << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << LL_ENDL; @@ -690,7 +690,7 @@ bool LLCallFloater::validateSpeaker(const LLUUID& speaker_id) case VC_LOCAL_CHAT: { // A nearby chat speaker is considered valid it it's known to LLVoiceClient (i.e. has enabled voice). - std::vector<LLUUID> speakers; + uuid_vec_t speakers; get_voice_participants_uuids(speakers); is_valid = std::find(speakers.begin(), speakers.end(), speaker_id) != speakers.end(); } diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index b32a955038..67d5d21b2a 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -107,7 +107,7 @@ LLChatBar::LLChatBar() LLChatBar::~LLChatBar() { - LLGestureManager::instance().removeObserver(mObserver); + LLGestureMgr::instance().removeObserver(mObserver); delete mObserver; mObserver = NULL; // LLView destructor cleans up children @@ -209,8 +209,8 @@ void LLChatBar::refreshGestures() // collect list of unique gestures std::map <std::string, BOOL> unique; - LLGestureManager::item_map_t::const_iterator it; - const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures(); + LLGestureMgr::item_map_t::const_iterator it; + const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures(); for (it = active_gestures.begin(); it != active_gestures.end(); ++it) { LLMultiGesture* gesture = (*it).second; @@ -296,7 +296,7 @@ void LLChatBar::setGestureCombo(LLComboBox* combo) // now register observer since we have a place to put the results mObserver = new LLChatBarGestureObserver(this); - LLGestureManager::instance().addObserver(mObserver); + LLGestureMgr::instance().addObserver(mObserver); // refresh list from current active gestures refreshGestures(); @@ -377,7 +377,7 @@ void LLChatBar::sendChat( EChatType type ) if (0 == channel) { // discard returned "found" boolean - LLGestureManager::instance().triggerAndReviseString(utf8text, &utf8_revised_text); + LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); } else { @@ -516,7 +516,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) std::string utf8_trigger = wstring_to_utf8str(raw_text); std::string utf8_out_str(utf8_trigger); - if (LLGestureManager::instance().matchPrefix(utf8_trigger, &utf8_out_str)) + if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str)) { if (self->mInputEditor) { @@ -653,7 +653,7 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl) // substitution and logging. std::string text(trigger); std::string revised_text; - LLGestureManager::instance().triggerAndReviseString(text, &revised_text); + LLGestureMgr::instance().triggerAndReviseString(text, &revised_text); revised_text = utf8str_trim(revised_text); if (!revised_text.empty()) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index c043db81df..1e404d611c 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -447,7 +447,6 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p) : LLUICtrl(p), mMessageHeaderFilename(p.message_header), mMessageSeparatorFilename(p.message_separator), - mMessagePlaintextSeparatorFilename(p.message_plaintext_separator), mLeftTextPad(p.left_text_pad), mRightTextPad(p.right_text_pad), mLeftWidgetPad(p.left_widget_pad), @@ -535,12 +534,6 @@ LLView* LLChatHistory::getSeparator() return separator; } -LLView* LLChatHistory::getPlaintextSeparator() -{ - LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessagePlaintextSeparatorFilename, NULL, LLPanel::child_registry_t::instance()); - return separator; -} - LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params) { LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename); @@ -639,16 +632,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (use_plain_text_chat_history) { - // append plaintext separator - LLView* separator = getPlaintextSeparator(); - LLInlineViewSegment::Params p; - p.force_newline = true; - p.left_pad = mLeftWidgetPad; - p.right_pad = mRightWidgetPad; - p.view = separator; - //mEditor->appendWidget(p, "\n", false); // TODO: this is absolute minimal fix for EXT-3818 because it's late for 2.0 - mEditor->appendWidget(p, "", false); // This should be properly fixed in 2.1 - mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params); if (utf8str_trim(chat.mFromName).size() != 0) @@ -751,7 +734,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (notification != NULL) { LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( - notification); + notification, chat.mSessionID); //we can't set follows in xml since it broke toasts behavior notify_box->setFollowsLeft(); notify_box->setFollowsRight(); diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index dfe5ea98e6..950b32861b 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -47,8 +47,6 @@ class LLChatHistory : public LLUICtrl Optional<std::string> message_header; //Message separator filename Optional<std::string> message_separator; - //Message plaintext separator filename - Optional<std::string> message_plaintext_separator; //Text left padding from the scroll rect Optional<S32> left_text_pad; //Text right padding from the scroll rect @@ -71,7 +69,6 @@ class LLChatHistory : public LLUICtrl Params() : message_header("message_header"), message_separator("message_separator"), - message_plaintext_separator("message_plaintext_separator"), left_text_pad("left_text_pad"), right_text_pad("right_text_pad"), left_widget_pad("left_widget_pad"), @@ -100,11 +97,6 @@ class LLChatHistory : public LLUICtrl */ LLView* getSeparator(); /** - * Builds a message plaintext separator. - * @return pointer to LLView separator object. - */ - LLView* getPlaintextSeparator(); - /** * Builds a message header. * @return pointer to LLView header object. */ @@ -141,7 +133,6 @@ class LLChatHistory : public LLUICtrl std::string mMessageHeaderFilename; std::string mMessageSeparatorFilename; - std::string mMessagePlaintextSeparatorFilename; S32 mLeftTextPad; S32 mRightTextPad; diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 1f92686a43..e39384b7b2 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -229,6 +229,11 @@ void LLSysWellChiclet::setNewMessagesState(bool new_messages) void LLSysWellChiclet::updateWidget(bool is_window_empty) { mButton->setEnabled(!is_window_empty); + + LLSD params; + params["well_empty"] = is_window_empty; + params["well_name"] = getName(); + notifyParent(params); } // virtual BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 830e975e8a..ebd767d654 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -118,13 +118,12 @@ void LLDriverParamInfo::toStream(std::ostream &out) out << std::endl; - LLVOAvatarSelf *avatar = gAgent.getAvatarObject(); - if(avatar) + if(isAgentAvatarValid()) { for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++) { LLDrivenEntryInfo driven = *iter; - LLViewerVisualParam *param = (LLViewerVisualParam*)avatar->getVisualParam(driven.mDrivenID); + LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getVisualParam(driven.mDrivenID); if (param) { param->getInfo()->toStream(out); @@ -146,7 +145,7 @@ void LLDriverParamInfo::toStream(std::ostream &out) } else { - llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << avatar << " for driver parameter " << getID() << llendl; + llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp << " for driver parameter " << getID() << llendl; } out << std::endl; } @@ -626,13 +625,13 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake) { - LLVOAvatarSelf *avatar_self = gAgent.getAvatarObject(); - if(mWearablep && + if(isAgentAvatarValid() && + mWearablep && driven->mParam->getCrossWearable() && mWearablep->isOnTop()) { // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values - avatar_self->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake ); + gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake ); } else { diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 362010d65a..149ba2478d 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -112,13 +112,12 @@ private: }; LLExpandableTextBox::LLTextBoxEx::Params::Params() -: more_label("more_label") { } LLExpandableTextBox::LLTextBoxEx::LLTextBoxEx(const Params& p) : LLTextEditor(p), - mExpanderLabel(p.more_label), + mExpanderLabel(p.label), mExpanderVisible(false) { setIsChrome(TRUE); diff --git a/indra/newview/llexpandabletextbox.h b/indra/newview/llexpandabletextbox.h index 9d4a8aef76..5872592fae 100644 --- a/indra/newview/llexpandabletextbox.h +++ b/indra/newview/llexpandabletextbox.h @@ -54,7 +54,6 @@ protected: public: struct Params : public LLInitParam::Block<Params, LLTextEditor::Params> { - Mandatory<std::string> more_label; Params(); }; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index bf7c735488..ba92c33d59 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -31,7 +31,6 @@ */ #include "llviewerprecompiledheaders.h" - #include "llfavoritesbar.h" #include "llfloaterreg.h" @@ -47,6 +46,7 @@ #include "llclipboard.h" #include "llinventoryclipboard.h" #include "llinventorybridge.h" +#include "llinventoryfunctions.h" #include "llfloaterworldmap.h" #include "lllandmarkactions.h" #include "llnotificationsutil.h" diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 5ec58c8dd6..434c89e8ba 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -568,7 +568,7 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data) { LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); - if(!avatarp->isMotionActive(previewp->mMotionID)) + if (!avatarp->isMotionActive(previewp->mMotionID)) { previewp->resetMotion(); previewp->mPauseRequest = NULL; @@ -593,7 +593,7 @@ void LLFloaterAnimPreview::onBtnPause(void* user_data) { LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); - if(avatarp->isMotionActive(previewp->mMotionID)) + if (avatarp->isMotionActive(previewp->mMotionID)) { if (!avatarp->areAnimationsPaused()) { @@ -1001,19 +1001,18 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata) { std::string name = floaterp->childGetValue("name_form").asString(); std::string desc = floaterp->childGetValue("description_form").asString(); - LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - void *userdata = NULL; upload_new_resource(floaterp->mTransactionID, // tid LLAssetType::AT_ANIMATION, name, desc, - 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms(), + LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), name, - callback, expected_upload_cost, userdata); + NULL, + expected_upload_cost); } else { diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index a0b2de85f0..2cb0cdf368 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -157,7 +157,7 @@ void LLFloaterAvatarPicker::onBtnFind() find(); } -static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, std::vector<LLUUID>& avatar_ids) +static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, uuid_vec_t& avatar_ids) { std::vector<LLScrollListItem*> items = from->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter) @@ -203,7 +203,7 @@ void LLFloaterAvatarPicker::onBtnSelect() if(list) { std::vector<std::string> avatar_names; - std::vector<LLUUID> avatar_ids; + uuid_vec_t avatar_ids; getSelectedAvatarData(list, avatar_names, avatar_ids); mSelectionCallback(avatar_names, avatar_ids); } @@ -247,7 +247,7 @@ void LLFloaterAvatarPicker::populateNearMe() LLScrollListCtrl* near_me_scroller = getChild<LLScrollListCtrl>("NearMe"); near_me_scroller->deleteAllItems(); - std::vector<LLUUID> avatar_ids; + uuid_vec_t avatar_ids; LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); for(U32 i=0; i<avatar_ids.size(); i++) { @@ -499,7 +499,7 @@ bool LLFloaterAvatarPicker::isSelectBtnEnabled() if(list) { - std::vector<LLUUID> avatar_ids; + uuid_vec_t avatar_ids; std::vector<std::string> avatar_names; getSelectedAvatarData(list, avatar_names, avatar_ids); return mOkButtonValidateSignal(avatar_ids); diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index e35466cec8..860f3930ef 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -40,11 +40,11 @@ class LLFloaterAvatarPicker : public LLFloater { public: - typedef boost::signals2::signal<bool(const std::vector<LLUUID>&), boost_boolean_combiner> validate_signal_t; + typedef boost::signals2::signal<bool(const uuid_vec_t&), boost_boolean_combiner> validate_signal_t; typedef validate_signal_t::slot_type validate_callback_t; // The callback function will be called with an avatar name and UUID. - typedef boost::function<void (const std::vector<std::string>&, const std::vector<LLUUID>&)> select_callback_t; + typedef boost::function<void (const std::vector<std::string>&, const uuid_vec_t&)> select_callback_t; // Call this to select an avatar. static LLFloaterAvatarPicker* show(select_callback_t callback, BOOL allow_multiple = FALSE, diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 8c7899af3e..18db60705b 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -31,15 +31,14 @@ */ #include "llviewerprecompiledheaders.h" - #include "llfloateravatartextures.h" +#include "llagent.h" +#include "llagentwearables.h" #include "lltexturectrl.h" - #include "lluictrlfactory.h" #include "llviewerobjectlist.h" #include "llvoavatar.h" -#include "llagentwearables.h" using namespace LLVOAvatarDefines; @@ -75,7 +74,6 @@ void LLFloaterAvatarTextures::draw() LLFloater::draw(); } -#if !LL_RELEASE_FOR_DOWNLOAD static void update_texture_ctrl(LLVOAvatar* avatarp, LLTextureCtrl* ctrl, ETextureIndex te) @@ -132,72 +130,68 @@ static LLVOAvatar* find_avatar(const LLUUID& id) void LLFloaterAvatarTextures::refresh() { - LLVOAvatar *avatarp = find_avatar(mID); - if (avatarp) + if (gAgent.isGodlike()) { - std::string fullname; - if (gCacheName->getFullName(avatarp->getID(), fullname)) + LLVOAvatar *avatarp = find_avatar(mID); + if (avatarp) { - setTitle(mTitle + ": " + fullname); + std::string fullname; + if (gCacheName->getFullName(avatarp->getID(), fullname)) + { + setTitle(mTitle + ": " + fullname); + } + for (U32 i=0; i < TEX_NUM_INDICES; i++) + { + update_texture_ctrl(avatarp, mTextures[i], ETextureIndex(i)); + } } - for (U32 i=0; i < TEX_NUM_INDICES; i++) + else { - update_texture_ctrl(avatarp, mTextures[i], ETextureIndex(i)); + setTitle(mTitle + ": " + getString("InvalidAvatar") + " (" + mID.asString() + ")"); } } - else - { - setTitle(mTitle + ": " + getString("InvalidAvatar") + " (" + mID.asString() + ")"); - } } -#else - -void LLFloaterAvatarTextures::refresh() -{ -} - -#endif - // static void LLFloaterAvatarTextures::onClickDump(void* data) { -#if !LL_RELEASE_FOR_DOWNLOAD - LLFloaterAvatarTextures* self = (LLFloaterAvatarTextures*)data; - LLVOAvatar* avatarp = find_avatar(self->mID); - if (!avatarp) return; - - for (S32 i = 0; i < avatarp->getNumTEs(); i++) + if (gAgent.isGodlike()) { - const LLTextureEntry* te = avatarp->getTE(i); - if (!te) continue; + LLFloaterAvatarTextures* self = (LLFloaterAvatarTextures*)data; + LLVOAvatar* avatarp = find_avatar(self->mID); + if (!avatarp) return; - if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i)) + for (S32 i = 0; i < avatarp->getNumTEs(); i++) { - LLUUID id = IMG_DEFAULT_AVATAR; - EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i); - LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); - if (wearable) + const LLTextureEntry* te = avatarp->getTE(i); + if (!te) continue; + + if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i)) { - LLLocalTextureObject *lto = wearable->getLocalTextureObject(i); - if (lto) + LLUUID id = IMG_DEFAULT_AVATAR; + EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i); + LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); + if (wearable) { - id = lto->getID(); + LLLocalTextureObject *lto = wearable->getLocalTextureObject(i); + if (lto) + { + id = lto->getID(); + } + } + if (id != IMG_DEFAULT_AVATAR) + { + llinfos << "Avatar TE " << i << " id " << id << llendl; + } + else + { + llinfos << "Avatar TE " << i << " id " << "<DEFAULT>" << llendl; } - } - if (id != IMG_DEFAULT_AVATAR) - { - llinfos << "Avatar TE " << i << " id " << id << llendl; } else { - llinfos << "Avatar TE " << i << " id " << "<DEFAULT>" << llendl; + llinfos << "Avatar TE " << i << " id " << te->getID() << llendl; } } - else - { - llinfos << "Avatar TE " << i << " id " << te->getID() << llendl; - } } -#endif } diff --git a/indra/newview/llfloaterbeacons.cpp b/indra/newview/llfloaterbeacons.cpp index 13a7888f60..975c888a2b 100644 --- a/indra/newview/llfloaterbeacons.cpp +++ b/indra/newview/llfloaterbeacons.cpp @@ -71,7 +71,7 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) { LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; std::string name = check->getName(); - if( name == "touch_only") + if(name == "touch_only") { LLPipeline::toggleRenderScriptedTouchBeacons(NULL); // Don't allow both to be ON at the same time. Toggle the other one off if both now on. @@ -81,7 +81,9 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) { LLPipeline::setRenderScriptedBeacons(FALSE); getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(FALSE)); + getChild<LLCheckBoxCtrl>("scripted")->setValue(FALSE); getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("touch_only")->setValue(TRUE); } } else if(name == "scripted") @@ -94,7 +96,9 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) { LLPipeline::setRenderScriptedTouchBeacons(FALSE); getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(FALSE)); + getChild<LLCheckBoxCtrl>("touch_only")->setValue(FALSE); getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("scripted")->setValue(TRUE); } } else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get()); @@ -110,7 +114,9 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) { LLPipeline::setRenderBeacons(TRUE); getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(TRUE)); + getChild<LLCheckBoxCtrl>("beacons")->setValue(TRUE); getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("highlights")->setValue(FALSE); } } else if(name == "beacons") @@ -123,7 +129,9 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) { LLPipeline::setRenderHighlights(TRUE); getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(TRUE)); + getChild<LLCheckBoxCtrl>("highlights")->setValue(TRUE); getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("beacons")->setValue(FALSE); } } } diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index d0188352c7..d84ebef1dd 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -38,11 +38,11 @@ #include "llfloaterreg.h" // Viewer includes +#include "llagentcamera.h" #include "lljoystickbutton.h" #include "llviewercontrol.h" #include "llviewercamera.h" #include "llbottomtray.h" -#include "llagent.h" #include "lltoolmgr.h" #include "lltoolfocus.h" #include "llslider.h" @@ -104,7 +104,7 @@ BOOL LLPanelCameraZoom::postBuild() void LLPanelCameraZoom::draw() { - mSlider->setValue(gAgent.getCameraZoomFraction()); + mSlider->setValue(gAgentCamera.getCameraZoomFraction()); LLPanel::draw(); } @@ -131,7 +131,7 @@ void LLPanelCameraZoom::onZoomMinusHeldDown() void LLPanelCameraZoom::onSliderValueChanged() { F32 zoom_level = mSlider->getValueF32(); - gAgent.setCameraZoomFraction(zoom_level); + gAgentCamera.setCameraZoomFraction(zoom_level); } void activate_camera_tool() @@ -146,7 +146,7 @@ void activate_camera_tool() /*static*/ bool LLFloaterCamera::inFreeCameraMode() { LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgent.getCameraMode() != CAMERA_MODE_MOUSELOOK) + if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) { return true; } @@ -265,7 +265,7 @@ ECameraControlMode LLFloaterCamera::determineMode() return CAMERA_CTRL_MODE_FREE_CAMERA; } - if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { return CAMERA_CTRL_MODE_AVATAR_VIEW; } @@ -421,7 +421,7 @@ void LLFloaterCamera::updateCameraPresetButtons() childSetValue("rear_view", preset == CAMERA_PRESET_REAR_VIEW); childSetValue("group_view", preset == CAMERA_PRESET_GROUP_VIEW); childSetValue("front_view", preset == CAMERA_PRESET_FRONT_VIEW); - childSetValue("mouselook_view", gAgent.cameraMouselook()); + childSetValue("mouselook_view", gAgentCamera.cameraMouselook()); } void LLFloaterCamera::onClickCameraPresets(const LLSD& param) @@ -430,19 +430,19 @@ void LLFloaterCamera::onClickCameraPresets(const LLSD& param) if ("rear_view" == name) { - gAgent.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); } else if ("group_view" == name) { - gAgent.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); + gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); } else if ("front_view" == name) { - gAgent.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); + gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); } else if ("mouselook_view" == name) { - gAgent.changeCameraToMouselook(); + gAgentCamera.changeCameraToMouselook(); } LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 9c1ac2631d..0aca12bc5e 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -36,6 +36,7 @@ #include "llinventory.h" #include "llinventorybridge.h" +#include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "llinventoryclipboard.h" @@ -106,7 +107,7 @@ LLFloaterGesture::LLFloaterGesture(const LLSD& key) : LLFloater(key) { mObserver = new LLFloaterGestureObserver(this); - LLGestureManager::instance().addObserver(mObserver); + LLGestureMgr::instance().addObserver(mObserver); mCommitCallbackRegistrar.add("Gesture.Action.ToogleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this)); mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this)); @@ -125,7 +126,7 @@ void LLFloaterGesture::done() // we load only gesture folder without childred. LLInventoryModel::cat_array_t* categories; LLInventoryModel::item_array_t* items; - LLInventoryFetchDescendentsObserver::folder_ref_t unloaded_folders; + uuid_vec_t unloaded_folders; LL_DEBUGS("Gesture")<< "Get subdirs of Gesture Folder...." << LL_ENDL; gInventory.getDirectDescendentsOf(mGestureFolderID, categories, items); if (categories->empty()) @@ -165,7 +166,7 @@ void LLFloaterGesture::done() // virtual LLFloaterGesture::~LLFloaterGesture() { - LLGestureManager::instance().removeObserver(mObserver); + LLGestureMgr::instance().removeObserver(mObserver); delete mObserver; mObserver = NULL; gInventory.removeObserver(this); @@ -197,7 +198,7 @@ BOOL LLFloaterGesture::postBuild() setDefaultBtn("play_btn"); mGestureFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE, false); - folder_ref_t folders; + uuid_vec_t folders; folders.push_back(mGestureFolderID); //perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details. gInventory.addObserver(this); @@ -246,13 +247,13 @@ void LLFloaterGesture::refreshAll() void LLFloaterGesture::buildGestureList() { S32 scroll_pos = mGestureList->getScrollPos(); - std::vector<LLUUID> selected_items; + uuid_vec_t selected_items; getSelectedIds(selected_items); LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL; mGestureList->deleteAllItems(); - LLGestureManager::item_map_t::const_iterator it; - const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures(); + LLGestureMgr::item_map_t::const_iterator it; + const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures(); for (it = active_gestures.begin(); it != active_gestures.end(); ++it) { addGesture(it->first,it->second, mGestureList); @@ -278,7 +279,7 @@ void LLFloaterGesture::buildGestureList() // attempt to preserve scroll position through re-builds // since we do re-build whenever something gets dirty - for(std::vector<LLUUID>::iterator it = selected_items.begin(); it != selected_items.end(); it++) + for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++) { mGestureList->selectByID(*it); } @@ -354,10 +355,10 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur element["columns"][0]["value"] = ""; element["columns"][0]["font"]["name"] = "SANSSERIF"; element["columns"][0]["font"]["style"] = font_style; - element["columns"][0]["column"] = "trigger"; - element["columns"][0]["value"] = "---"; - element["columns"][0]["font"]["name"] = "SANSSERIF"; - element["columns"][0]["font"]["style"] = font_style; + element["columns"][1]["column"] = "shortcut"; + element["columns"][1]["value"] = "---"; + element["columns"][1]["font"]["name"] = "SANSSERIF"; + element["columns"][1]["font"]["style"] = font_style; element["columns"][2]["column"] = "key"; element["columns"][2]["value"] = "~~~"; element["columns"][2]["font"]["name"] = "SANSSERIF"; @@ -371,13 +372,13 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM); if(sl_item) { - LLFontGL::StyleFlags style = LLGestureManager::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL; + LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL; // *TODO find out why ["font"]["style"] does not affect font style ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style); } } -void LLFloaterGesture::getSelectedIds(std::vector<LLUUID>& ids) +void LLFloaterGesture::getSelectedIds(uuid_vec_t& ids) { std::vector<LLScrollListItem*> items = mGestureList->getAllSelected(); for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++) @@ -421,17 +422,17 @@ void LLFloaterGesture::onClickPlay() if(item_id.isNull()) return; LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL; - if(!LLGestureManager::instance().isGestureActive(item_id)) + if(!LLGestureMgr::instance().isGestureActive(item_id)) { // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList. BOOL inform_server = TRUE; BOOL deactivate_similar = FALSE; - LLGestureManager::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id)); + LLGestureMgr::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id)); LLViewerInventoryItem *item = gInventory.getItem(item_id); llassert(item); if (item) { - LLGestureManager::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar); + LLGestureMgr::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar); LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL; } } @@ -451,13 +452,13 @@ void LLFloaterGesture::onClickNew() void LLFloaterGesture::onActivateBtnClick() { - std::vector<LLUUID> ids; + uuid_vec_t ids; getSelectedIds(ids); if(ids.empty()) return; - LLGestureManager* gm = LLGestureManager::getInstance(); - std::vector<LLUUID>::const_iterator it = ids.begin(); + LLGestureMgr* gm = LLGestureMgr::getInstance(); + uuid_vec_t::const_iterator it = ids.begin(); BOOL first_gesture_state = gm->isGestureActive(*it); BOOL is_mixed = FALSE; while( ++it != ids.end() ) @@ -468,7 +469,7 @@ void LLFloaterGesture::onActivateBtnClick() break; } } - for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++) + for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) { if(is_mixed) { @@ -494,11 +495,11 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command) // since we select this comman inventory item had already arrived . if("copy_gesture" == command_name) { - std::vector<LLUUID> ids; + uuid_vec_t ids; getSelectedIds(ids); // make sure that clopboard is empty LLInventoryClipboard::instance().reset(); - for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) + for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE) @@ -558,7 +559,7 @@ void LLFloaterGesture::onCommitList() const LLUUID& item_id = mGestureList->getCurrentID(); mSelectedID = item_id; - if (LLGestureManager::instance().isGesturePlaying(item_id)) + if (LLGestureMgr::instance().isGesturePlaying(item_id)) { childSetVisible("play_btn", false); childSetVisible("stop_btn", true); @@ -572,14 +573,14 @@ void LLFloaterGesture::onCommitList() void LLFloaterGesture::onDeleteSelected() { - std::vector<LLUUID> ids; + uuid_vec_t ids; getSelectedIds(ids); if(ids.empty()) return; const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - LLGestureManager* gm = LLGestureManager::getInstance(); - for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++) + LLGestureMgr* gm = LLGestureMgr::getInstance(); + for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) { const LLUUID& selected_item = *it; LLInventoryItem* inv_item = gInventory.getItem(selected_item); @@ -610,10 +611,10 @@ void LLFloaterGesture::onDeleteSelected() void LLFloaterGesture::addToCurrentOutFit() { - std::vector<LLUUID> ids; + uuid_vec_t ids; getSelectedIds(ids); - LLAppearanceManager* am = LLAppearanceManager::getInstance(); - for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++) + LLAppearanceMgr* am = LLAppearanceMgr::getInstance(); + for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) { am->addCOFItemLink(*it); } @@ -623,12 +624,12 @@ void LLFloaterGesture::playGesture(LLUUID item_id) { LL_DEBUGS("Gesture")<<"Playing gesture "<< item_id<<LL_ENDL; - if (LLGestureManager::instance().isGesturePlaying(item_id)) + if (LLGestureMgr::instance().isGesturePlaying(item_id)) { - LLGestureManager::instance().stopGesture(item_id); + LLGestureMgr::instance().stopGesture(item_id); } else { - LLGestureManager::instance().playGesture(item_id); + LLGestureMgr::instance().playGesture(item_id); } } diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h index 629d77b949..1676542c77 100644 --- a/indra/newview/llfloatergesture.h +++ b/indra/newview/llfloatergesture.h @@ -85,7 +85,7 @@ private: * Therefore we have to copy these items to avoid viewer crash. * @see LLFloaterGesture::onActivateBtnClick */ - void getSelectedIds(std::vector<LLUUID>& ids); + void getSelectedIds(uuid_vec_t& ids); bool isActionEnabled(const LLSD& command); /** * @brief Activation rules: diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index eb56f387cd..e7b2da043f 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -828,7 +828,6 @@ const F32 HOURS_TO_RADIANS = (2.f*F_PI)/24.f; LLPanelGridTools::LLPanelGridTools() : LLPanel() { - mCommitCallbackRegistrar.add("GridTools.KickAll", boost::bind(&LLPanelGridTools::onClickKickAll, this)); mCommitCallbackRegistrar.add("GridTools.FlushMapVisibilityCaches", boost::bind(&LLPanelGridTools::onClickFlushMapVisibilityCaches, this)); } @@ -846,46 +845,6 @@ void LLPanelGridTools::refresh() { } -void LLPanelGridTools::onClickKickAll() -{ - LLNotificationsUtil::add("KickAllUsers", LLSD(), LLSD(), LLPanelGridTools::confirmKick); -} - - -bool LLPanelGridTools::confirmKick(const LLSD& notification, const LLSD& response) -{ - if (LLNotificationsUtil::getSelectedOption(notification, response) == 0) - { - LLSD payload; - payload["kick_message"] = response["message"].asString(); - LLNotificationsUtil::add("ConfirmKick", LLSD(), payload, LLPanelGridTools::finishKick); - } - return false; -} - - -// static -bool LLPanelGridTools::finishKick(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - - if (option == 0) - { - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, LL_UUID_ALL_AGENTS ); - msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); - msg->addStringFast(_PREHASH_Reason, notification["payload"]["kick_message"].asString()); - gAgent.sendReliableMessage(); - } - return false; -} - void LLPanelGridTools::onClickFlushMapVisibilityCaches() { LLNotificationsUtil::add("FlushMapVisibilityCaches", LLSD(), LLSD(), flushMapVisibilityCachesConfirm); @@ -1191,7 +1150,7 @@ void LLPanelObjectTools::onClickSetBySelection(void* data) panelp->childSetValue("target_avatar_name", name); } -void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (ids.empty() || names.empty()) return; mTargetAvatar = ids[0]; diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index ef5ce02749..aee9db78a3 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -198,9 +198,6 @@ public: void refresh(); - void onClickKickAll(); - static bool confirmKick(const LLSD& notification, const LLSD& response); - static bool finishKick(const LLSD& notification, const LLSD& response); static void onDragSunPhase(LLUICtrl *ctrl, void *userdata); void onClickFlushMapVisibilityCaches(); static bool flushMapVisibilityCachesConfirm(const LLSD& notification, const LLSD& response); @@ -234,7 +231,7 @@ public: void onChangeAnything(); void onApplyChanges(); void onClickSet(); - void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids); void onClickDeletePublicOwnedBy(); void onClickDeleteAllScriptedOwnedBy(); void onClickDeleteAllOwnedBy(); diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp index bf484c6343..5d1864b4c8 100644 --- a/indra/newview/llfloatergroupinvite.cpp +++ b/indra/newview/llfloatergroupinvite.cpp @@ -112,7 +112,7 @@ LLFloaterGroupInvite::~LLFloaterGroupInvite() } // static -void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, std::vector<LLUUID> *agent_ids) +void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, uuid_vec_t *agent_ids) { const LLFloater::Params& floater_params = LLFloater::getDefaultParams(); S32 floater_header_size = floater_params.header_height; diff --git a/indra/newview/llfloatergroupinvite.h b/indra/newview/llfloatergroupinvite.h index b3f5d75ac1..68943724df 100644 --- a/indra/newview/llfloatergroupinvite.h +++ b/indra/newview/llfloatergroupinvite.h @@ -43,7 +43,7 @@ class LLFloaterGroupInvite public: virtual ~LLFloaterGroupInvite(); - static void showForGroup(const LLUUID &group_id, std::vector<LLUUID> *agent_ids = NULL); + static void showForGroup(const LLUUID &group_id, uuid_vec_t *agent_ids = NULL); protected: LLFloaterGroupInvite(const LLUUID& group_id = LLUUID::null); diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp index 6842d3dc74..4bffd41d29 100644 --- a/indra/newview/llfloaterinventory.cpp +++ b/indra/newview/llfloaterinventory.cpp @@ -34,7 +34,7 @@ #include "llfloaterinventory.h" -#include "llagent.h" +#include "llagentcamera.h" //#include "llfirstuse.h" #include "llfloaterreg.h" #include "llinventorymodel.h" @@ -79,7 +79,7 @@ LLFloaterInventory* LLFloaterInventory::showAgentInventory() instance_num = (instance_num + 1) % S32_MAX; LLFloaterInventory* iv = NULL; - if (!gAgent.cameraMouselook()) + if (!gAgentCamera.cameraMouselook()) { iv = LLFloaterReg::showTypedInstance<LLFloaterInventory>("inventory", LLSD(instance_num)); } diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index 85186cee6b..100cbdb217 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -206,7 +206,7 @@ void LLFloaterLagMeter::determineNetwork() // *FIXME: We can't blame a large ping time on anything in // particular if the frame rate is low, because a low frame - // rate is a sure recipe for crappy ping times right now until + // rate is a sure recipe for bad ping times right now until // the network handlers are de-synched from the rendering. F32 client_frame_time_ms = 1000.0f * LLViewerStats::getInstance()->mFPSStat.getMeanDuration(); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 282760f988..25d3f971b5 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1611,7 +1611,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo item_params.columns.add().value(object_count_str).font(FONT).column("count"); item_params.columns.add().value(LLDate((time_t)most_recent_time)).font(FONT).column("mostrecent").type("date"); - self->mOwnerList->addRow(item_params); + self->mOwnerList->addNameItemRow(item_params); lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent") << ") owns " << object_count << " objects." << llendl; @@ -2773,7 +2773,7 @@ void LLPanelLandAccess::onClickAddAccess() gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1,_2)) ); } -void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (!names.empty() && !ids.empty()) { @@ -2818,7 +2818,7 @@ void LLPanelLandAccess::onClickAddBanned() } // static -void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (!names.empty() && !ids.empty()) { diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index a4785e8f5b..fe80766a74 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -167,7 +167,7 @@ public: static void onClickSet(void* data); static void onClickClear(void* data); static void onClickShow(void* data); - static void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); + static void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data); static void finalizeAvatarPick(void* data); static void callbackHighlightTransferable(S32 option, void* userdata); static void onClickStartAuction(void*); @@ -374,8 +374,8 @@ public: void onClickAddAccess(); void onClickAddBanned(); - void callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); - void callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void callbackAvatarCBBanned(const std::vector<std::string>& names, const uuid_vec_t& ids); + void callbackAvatarCBAccess(const std::vector<std::string>& names, const uuid_vec_t& ids); protected: LLNameListCtrl* mListAccess; diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 051ab585e2..5677899dd9 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -41,7 +41,7 @@ #include "llglheaders.h" // Viewer includes -#include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "llnetmap.h" #include "lltracker.h" @@ -196,7 +196,7 @@ void LLFloaterMap::draw() setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong. - if( gAgent.cameraMouselook()) + if(gAgentCamera.cameraMouselook()) { setMouseOpaque(FALSE); getDragHandle()->setMouseOpaque(FALSE); @@ -215,6 +215,20 @@ void LLFloaterMap::draw() LLFloater::draw(); } +// virtual +void LLFloaterMap::onFocusReceived() +{ + setBackgroundOpaque(true); + LLPanel::onFocusReceived(); +} + +// virtual +void LLFloaterMap::onFocusLost() +{ + setBackgroundOpaque(false); + LLPanel::onFocusLost(); +} + void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent) { LLFloater::reshape(width, height, called_from_parent); diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index 6c9138c6a7..9ff2f03180 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -53,6 +53,8 @@ public: /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); /*virtual*/ void draw(); + /*virtual*/ void onFocusLost(); + /*virtual*/ void onFocusReceived(); private: void handleZoom(const LLSD& userdata); diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 159ce41b79..5c343ecb22 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -169,16 +169,14 @@ void LLFloaterNameDesc::onBtnOK( ) { childDisable("ok_btn"); // don't allow inadvertent extra uploads - LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). - void *nruserdata = NULL; std::string display_name = LLStringUtil::null; upload_new_resource(mFilenameAndPath, // file childGetValue("name_form").asString(), childGetValue("description_form").asString(), - 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), - display_name, callback, expected_upload_cost, nruserdata); + display_name, NULL, expected_upload_cost); closeFloater(false); } diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5af4ed3c2c..3a73037ae8 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -182,7 +182,6 @@ void LLVoiceSetKeyDialog::onCancel(void* user_data) // if creating/destroying these is too slow, we'll need to create // a static member and update all our static callbacks -void handleNameTagOptionChanged(const LLSD& newvalue); bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); //bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); @@ -218,15 +217,6 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response return false; } -void handleNameTagOptionChanged(const LLSD& newvalue) -{ - S32 name_tag_option = S32(newvalue); - if(name_tag_option==2) - { - gSavedSettings.setBOOL("SmallAvatarNames", TRUE); - } -} - /*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -319,8 +309,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); sSkin = gSavedSettings.getString("SkinCurrent"); - - gSavedSettings.getControl("AvatarNameTagMode")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); } BOOL LLFloaterPreference::postBuild() @@ -336,8 +324,6 @@ BOOL LLFloaterPreference::postBuild() LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core"); if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); - S32 show_avatar_nametag_options = gSavedSettings.getS32("AvatarNameTagMode"); - handleNameTagOptionChanged(LLSD(show_avatar_nametag_options)); std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); childSetText("cache_location", cache_location); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 39916eba1d..8c219cb3fd 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -610,7 +610,7 @@ void LLPanelRegionGeneralInfo::onClickKick() parent_floater->addDependentFloater(child_floater); } -void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (names.empty() || ids.empty()) return; if(ids[0].notNull()) @@ -848,7 +848,7 @@ void LLPanelRegionDebugInfo::onClickChooseAvatar() } -void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (ids.empty() || names.empty()) return; mTargetAvatar = ids[0]; @@ -1531,7 +1531,7 @@ void LLPanelEstateInfo::onClickKickUser() parent_floater->addDependentFloater(child_floater); } -void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (names.empty() || ids.empty()) return; @@ -1616,7 +1616,6 @@ bool LLPanelEstateInfo::isLindenEstate() return (estate_id <= ESTATE_LAST_LINDEN); } -typedef std::vector<LLUUID> AgentOrGroupIDsVector; struct LLEstateAccessChangeInfo { LLEstateAccessChangeInfo(const LLSD& sd) @@ -1637,7 +1636,7 @@ struct LLEstateAccessChangeInfo LLSD sd; sd["name"] = mDialogName; sd["operation"] = (S32)mOperationFlag; - for (AgentOrGroupIDsVector::const_iterator it = mAgentOrGroupIDs.begin(); + for (uuid_vec_t::const_iterator it = mAgentOrGroupIDs.begin(); it != mAgentOrGroupIDs.end(); ++it) { @@ -1648,7 +1647,7 @@ struct LLEstateAccessChangeInfo U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. std::string mDialogName; - AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change + uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change }; // Special case callback for groups, since it has different callback format than names @@ -1716,7 +1715,7 @@ bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& res } // static -void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) +void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data) { LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data; if (!change_info) return; diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 8d315bdb78..482ebb3303 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -168,7 +168,7 @@ public: protected: virtual BOOL sendUpdate(); void onClickKick(); - void onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void onKickCommit(const std::vector<std::string>& names, const uuid_vec_t& ids); static void onClickKickAll(void* userdata); bool onKickAllCommit(const LLSD& notification, const LLSD& response); static void onClickMessage(void* userdata); @@ -193,7 +193,7 @@ protected: virtual BOOL sendUpdate(); void onClickChooseAvatar(); - void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids); static void onClickReturn(void *); bool callbackReturn(const LLSD& notification, const LLSD& response); static void onClickTopColliders(void*); @@ -284,7 +284,7 @@ public: // Core methods for all above add/remove button clicks static void accessAddCore(U32 operation_flag, const std::string& dialog_name); static bool accessAddCore2(const LLSD& notification, const LLSD& response); - static void accessAddCore3(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); + static void accessAddCore3(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data); static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name); static bool accessRemoveCore2(const LLSD& notification, const LLSD& response); @@ -296,7 +296,7 @@ public: // Send the actual EstateOwnerRequest "estateaccessdelta" message static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id); - void onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void onKickUserCommit(const std::vector<std::string>& names, const uuid_vec_t& ids); static void onClickMessageEstate(void* data); bool onMessageCommit(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index feadd045aa..f7c8855bf6 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -309,7 +309,7 @@ void LLFloaterReporter::onClickSelectAbuser() gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE )); } -void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (ids.empty() || names.empty()) return; diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 7c6473f975..23784b7650 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -123,7 +123,7 @@ private: void setPosBox(const LLVector3d &pos); void enableControls(BOOL own_avatar); void getObjectInfo(const LLUUID& object_id); - void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids); void setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name = LLStringUtil::null); private: diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index daba3d8460..4792d761d8 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -644,7 +644,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) std::string msg_parcels = LLTrans::getString("ScriptLimitsParcelsOwned", args_parcels); childSetValue("parcels_listed", LLSD(msg_parcels)); - std::vector<LLUUID> names_requested; + uuid_vec_t names_requested; // This makes the assumption that all objects will have the same set // of attributes, ie they will all have, or none will have locations diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index eae6121e79..980b456497 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -96,7 +96,7 @@ private: static void doShowObjects(void *userdata); static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response); - void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids); public: virtual BOOL postBuild(); @@ -391,7 +391,7 @@ void LLFloaterSellLandUI::doSelectAgent() addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE)); } -void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids) { LLParcel* parcel = mParcelSelection->getParcel(); diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index a0031f0193..aae379afe2 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -38,28 +38,34 @@ // Viewer includes #include "llagent.h" -#include "llcallbacklist.h" -#include "llcriticaldamp.h" -#include "llui.h" -#include "llfocusmgr.h" +#include "llagentcamera.h" +#include "llagentui.h" +#include "llavatarpropertiesprocessor.h" +#include "llbottomtray.h" #include "llbutton.h" +#include "llcallbacklist.h" +#include "llcheckboxctrl.h" #include "llcombobox.h" +#include "llcriticaldamp.h" #include "lleconomy.h" +#include "llfloaterpostcard.h" +#include "llfocusmgr.h" +#include "lllandmarkactions.h" +#include "llradiogroup.h" #include "llsliderctrl.h" +#include "llslurl.h" #include "llspinctrl.h" -#include "llviewercontrol.h" +#include "lltoolfocus.h" +#include "lltoolmgr.h" +#include "llui.h" #include "lluictrlfactory.h" -#include "llviewerstats.h" #include "llviewercamera.h" -#include "llviewerwindow.h" +#include "llviewercontrol.h" #include "llviewermenufile.h" // upload_new_resource() -#include "llfloaterpostcard.h" -#include "llcheckboxctrl.h" -#include "llradiogroup.h" -#include "lltoolfocus.h" -#include "lltoolmgr.h" +#include "llviewerstats.h" +#include "llviewerwindow.h" +#include "llweb.h" #include "llworld.h" -#include "llagentui.h" // Linden library includes #include "llfontgl.h" @@ -113,6 +119,7 @@ public: enum ESnapshotType { SNAPSHOT_POSTCARD, + SNAPSHOT_WEB, SNAPSHOT_TEXTURE, SNAPSHOT_LOCAL }; @@ -161,8 +168,9 @@ public: void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; } void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f); LLFloaterPostcard* savePostcard(); - void saveTexture(); + void saveTexture(bool set_as_profile_pic = false); BOOL saveLocal(); + void saveWeb(std::string url); BOOL setThumbnailImageSize() ; void generateThumbnailImage(BOOL force_update = FALSE) ; @@ -171,6 +179,9 @@ public: // Returns TRUE when snapshot generated, FALSE otherwise. static BOOL onIdle( void* snapshot_preview ); + + // callback for region name resolve + void regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z); private: LLColor4 mColor; @@ -292,7 +303,7 @@ F32 LLSnapshotLivePreview::getAspect() F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]); F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()); - if (!mKeepAspectRatio)//gSavedSettings.getBOOL("KeepAspectForSnapshot")) + if (!mKeepAspectRatio) { return image_aspect_ratio; } @@ -625,20 +636,20 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() F32 window_aspect_ratio = ((F32)window_width) / ((F32)window_height); // UI size for thumbnail - S32 max_width = LLFloaterSnapshot::getUIWinWidth() - 20; - S32 max_height = 90; + LLFloater* floater = LLFloaterReg::getInstance("snapshot"); + mThumbnailWidth = floater->getChild<LLView>("thumbnail_placeholder")->getRect().getWidth(); + mThumbnailHeight = floater->getChild<LLView>("thumbnail_placeholder")->getRect().getHeight(); - if (window_aspect_ratio > (F32)max_width / max_height) + + if (window_aspect_ratio > (F32)mThumbnailWidth / mThumbnailHeight) { // image too wide, shrink to width - mThumbnailWidth = max_width; - mThumbnailHeight = llround((F32)max_width / window_aspect_ratio); + mThumbnailHeight = llround((F32)mThumbnailWidth / window_aspect_ratio); } else { // image too tall, shrink to height - mThumbnailHeight = max_height; - mThumbnailWidth = llround((F32)max_height * window_aspect_ratio); + mThumbnailWidth = llround((F32)mThumbnailHeight * window_aspect_ratio); } if(mThumbnailWidth > window_width || mThumbnailHeight > window_height) @@ -824,10 +835,21 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { // delete any existing image previewp->mFormattedImage = NULL; + // now create the new one of the appropriate format. - // note: postcards hardcoded to use jpeg always. - LLFloaterSnapshot::ESnapshotFormat format = previewp->getSnapshotType() == SNAPSHOT_POSTCARD - ? LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG : previewp->getSnapshotFormat(); + // note: postcards and web hardcoded to use jpeg always. + LLFloaterSnapshot::ESnapshotFormat format; + + if (previewp->getSnapshotType() == SNAPSHOT_POSTCARD || + previewp->getSnapshotType() == SNAPSHOT_WEB) + { + format = LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; + } + else + { + format = previewp->getSnapshotFormat(); + } + switch(format) { case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: @@ -892,7 +914,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mSnapshotUpToDate = TRUE; previewp->generateThumbnailImage(TRUE) ; - previewp->mPosTakenGlobal = gAgent.getCameraPositionGlobal(); + previewp->mPosTakenGlobal = gAgentCamera.getCameraPositionGlobal(); previewp->mShineCountdown = 4; // wait a few frames to avoid animation glitch due to readback this frame } } @@ -954,13 +976,21 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard() return floater; } -void LLSnapshotLivePreview::saveTexture() +// Callback for asset upload +void profile_pic_upload_callback(const LLUUID& uuid) +{ + LLFloaterSnapshot* floater = LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot"); + floater->setAsProfilePic(uuid); +} + + +void LLSnapshotLivePreview::saveTexture(bool set_as_profile_pic) { // gen a new uuid for this asset LLTransactionID tid; tid.generate(); LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - + LLPointer<LLImageJ2C> formatted = new LLImageJ2C; LLPointer<LLImageRaw> scaled = new LLImageRaw(mPreviewImage->getData(), mPreviewImage->getWidth(), @@ -971,26 +1001,30 @@ void LLSnapshotLivePreview::saveTexture() if (formatted->encode(scaled, 0.0f)) { + boost::function<void(const LLUUID& uuid)> callback = NULL; + + if (set_as_profile_pic) + { + callback = profile_pic_upload_callback; + } + LLVFile::writeFile(formatted->getData(), formatted->getDataSize(), gVFS, new_asset_id, LLAssetType::AT_TEXTURE); std::string pos_string; LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL); std::string who_took_it; LLAgentUI::buildFullname(who_took_it); - LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - void *userdata = NULL; upload_new_resource(tid, // tid LLAssetType::AT_TEXTURE, "Snapshot : " + pos_string, "Taken by " + who_took_it + " at " + pos_string, - 0, LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT, PERM_ALL, // Note: Snapshots to inventory is a special case of content upload PERM_NONE, // that ignores the user's premissions preferences and continues to PERM_NONE, // always use these fairly permissive hard-coded initial perms. - MG "Snapshot : " + pos_string, - callback, expected_upload_cost, userdata); + callback, expected_upload_cost); gViewerWindow->playSnapshotAnimAndSound(); } else @@ -1020,6 +1054,81 @@ BOOL LLSnapshotLivePreview::saveLocal() return success; } + +class LLSendWebResponder : public LLHTTPClient::Responder +{ +public: + + virtual void error(U32 status, const std::string& reason) + { + llwarns << status << ": " << reason << llendl; + LLNotificationsUtil::add("ShareToWebFailed"); + } + + virtual void result(const LLSD& content) + { + std::string response_url = content["response_url"].asString(); + + if (!response_url.empty()) + { + LLWeb::loadURLExternal(response_url); + } + else + { + LLNotificationsUtil::add("ShareToWebFailed"); + } + } + +}; + +void LLSnapshotLivePreview::saveWeb(std::string url) +{ + if (url.empty()) + { + llwarns << "No share to web url" << llendl; + return; + } + + LLImageJPEG* jpg = dynamic_cast<LLImageJPEG*>(mFormattedImage.get()); + if(!jpg) + { + llwarns << "Formatted image not a JPEG" << llendl; + return; + } + +/* figure out if there's a better way to serialize */ + LLSD body; + std::vector<U8> binary_image; + U8* data = jpg->getData(); + for (int i = 0; i < jpg->getDataSize(); i++) + { + binary_image.push_back(data[i]); + } + + body["image"] = binary_image; + + body["description"] = getChild<LLLineEditor>("description")->getText(); + + std::string name; + LLAgentUI::buildFullname(name); + + body["avatar_name"] = name; + + LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(gAgentCamera.getCameraPositionGlobal(), + boost::bind(&LLSnapshotLivePreview::regionNameCallback, this, url, body, _1, _2, _3, _4)); + + gViewerWindow->playSnapshotAnimAndSound(); +} + + +void LLSnapshotLivePreview::regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z) +{ + body["slurl"] = LLSLURL(name, LLVector3d(x, y, z)).getSLURLString(); + + LLHTTPClient::post(url, body, + new LLSendWebResponder()); +} + ///---------------------------------------------------------------------------- /// Class LLFloaterSnapshot::Impl ///---------------------------------------------------------------------------- @@ -1039,9 +1148,6 @@ public: mAvatarPauseHandles.clear(); } - static void onClickDiscard(void* data); - static void onClickKeep(void* data); - static void onCommitSave(LLUICtrl* ctrl, void* data); static void onClickNewSnapshot(void* data); static void onClickAutoSnap(LLUICtrl *ctrl, void* data); //static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data); @@ -1056,9 +1162,11 @@ public: static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); - static void onCommitSnapshotType(LLUICtrl* ctrl, void* data); static void onCommitSnapshotFormat(LLUICtrl* ctrl, void* data); static void onCommitCustomResolution(LLUICtrl *ctrl, void* data); + static void onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type); + static void onCommitProfilePic(LLFloaterSnapshot* view); + static void onToggleAdvanced(LLUICtrl *ctrl, void* data); static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ; static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); @@ -1066,10 +1174,8 @@ public: static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname); static void updateControls(LLFloaterSnapshot* floater); static void updateLayout(LLFloaterSnapshot* floater); - static void updateResolutionTextEntry(LLFloaterSnapshot* floater); private: - static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater); static LLViewerWindow::ESnapshotType getLayerType(LLFloaterSnapshot* floater); static void comboSetCustom(LLFloaterSnapshot *floater, const std::string& comboname); @@ -1092,22 +1198,6 @@ LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot } // static -LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater) -{ - LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; - LLSD value = floater->childGetValue("snapshot_type_radio"); - const std::string id = value.asString(); - if (id == "postcard") - index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; - else if (id == "texture") - index = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; - else if (id == "local") - index = LLSnapshotLivePreview::SNAPSHOT_LOCAL; - return index; -} - - -// static LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater) { ESnapshotFormat index = SNAPSHOT_FORMAT_PNG; @@ -1155,20 +1245,12 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) { LLSnapshotLivePreview* previewp = getPreviewView(floaterp); - S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ; - if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution { previewp->mKeepAspectRatio = TRUE; - floaterp->getChild<LLComboBox>("postcard_size_combo")->setCurrentByIndex(0); - gSavedSettings.setS32("SnapshotPostcardLastResolution", 0); - - floaterp->getChild<LLComboBox>("texture_size_combo")->setCurrentByIndex(0); - gSavedSettings.setS32("SnapshotTextureLastResolution", 0); - - floaterp->getChild<LLComboBox>("local_size_combo")->setCurrentByIndex(0); - gSavedSettings.setS32("SnapshotLocalLastResolution", 0); + floaterp->getChild<LLComboBox>("snapshot_size_combo")->setCurrentByIndex(0); + gSavedSettings.setS32("SnapshotLastResolution", 0); LLSnapshotLivePreview* previewp = getPreviewView(floaterp); previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); @@ -1181,9 +1263,6 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) // stop all mouse events at fullscreen preview layer floaterp->getParent()->setMouseOpaque(TRUE); - // shrink to smaller layout - floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height); - // can see and interact with fullscreen preview now if (previewp) { @@ -1212,7 +1291,6 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) else // turning off freeze frame mode { floaterp->getParent()->setMouseOpaque(FALSE); - floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height); if (previewp) { previewp->setVisible(FALSE); @@ -1241,127 +1319,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) // static void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) { - LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); - snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType")); - LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater); - ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); - LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); - - floater->childSetVisible("postcard_size_combo", FALSE); - floater->childSetVisible("texture_size_combo", FALSE); - floater->childSetVisible("local_size_combo", FALSE); - - floater->getChild<LLComboBox>("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); - floater->getChild<LLComboBox>("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); - floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); - floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); - - floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); - floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); - floater->childSetVisible("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); - floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); - floater->childSetEnabled("layer_types", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); - - BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot"); - BOOL is_local = shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL; - BOOL show_slider = - shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD - || (is_local && shot_format == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); - - floater->childSetVisible("more_btn", !is_advance); // the only item hidden in advanced mode - floater->childSetVisible("less_btn", is_advance); - floater->childSetVisible("type_label2", is_advance); - floater->childSetVisible("format_label", is_advance && is_local); - floater->childSetVisible("local_format_combo", is_advance && is_local); - floater->childSetVisible("layer_types", is_advance); - floater->childSetVisible("layer_type_label", is_advance); - floater->childSetVisible("snapshot_width", is_advance); - floater->childSetVisible("snapshot_height", is_advance); - floater->childSetVisible("keep_aspect_check", is_advance); - floater->childSetVisible("ui_check", is_advance); - floater->childSetVisible("hud_check", is_advance); - floater->childSetVisible("keep_open_check", is_advance); - floater->childSetVisible("freeze_frame_check", is_advance); - floater->childSetVisible("auto_snapshot_check", is_advance); - floater->childSetVisible("image_quality_slider", is_advance && show_slider); - - LLSnapshotLivePreview* previewp = getPreviewView(floater); - BOOL got_bytes = previewp && previewp->getDataSize() > 0; - BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); - - floater->childSetEnabled("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE); - floater->childSetEnabled("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE && got_snap); - floater->childSetEnabled("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL && got_snap); - - LLLocale locale(LLLocale::USER_LOCALE); - std::string bytes_string; - if (got_snap) - { - LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); - } - S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost)); - floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost)); - floater->childSetTextArg("file_size_label", "[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); - floater->childSetColor("file_size_label", - shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD - && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); - - switch(shot_type) - { - case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: - layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - floater->childSetValue("layer_types", "colors"); - if(is_advance) - { - setResolution(floater, "postcard_size_combo"); - } - break; - case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: - layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - floater->childSetValue("layer_types", "colors"); - if(is_advance) - { - setResolution(floater, "texture_size_combo"); - } - break; - case LLSnapshotLivePreview::SNAPSHOT_LOCAL: - if(is_advance) - { - setResolution(floater, "local_size_combo"); - } - break; - default: - break; - } - - updateResolutionTextEntry(floater); - - if (previewp) - { - previewp->setSnapshotType(shot_type); - previewp->setSnapshotFormat(shot_format); - previewp->setSnapshotBufferType(layer_type); - } -} - -// static -void LLFloaterSnapshot::Impl::updateResolutionTextEntry(LLFloaterSnapshot* floater) -{ - LLSpinCtrl* width_spinner = floater->getChild<LLSpinCtrl>("snapshot_width"); - LLSpinCtrl* height_spinner = floater->getChild<LLSpinCtrl>("snapshot_height"); - if(getTypeIndex(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) - { - width_spinner->setAllowEdit(FALSE); - height_spinner->setAllowEdit(FALSE); - } - else - { - width_spinner->setAllowEdit(TRUE); - height_spinner->setAllowEdit(TRUE); - } } // static @@ -1375,70 +1333,6 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, } // static -void LLFloaterSnapshot::Impl::onClickDiscard(void* data) -{ - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - - if (view) - { - view->closeFloater(); - } -} - - -// static -void LLFloaterSnapshot::Impl::onCommitSave(LLUICtrl* ctrl, void* data) -{ - if (ctrl->getValue().asString() == "save as") - { - gViewerWindow->resetSnapshotLoc(); - } - onClickKeep(data); -} - -// static -void LLFloaterSnapshot::Impl::onClickKeep(void* data) -{ - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - LLSnapshotLivePreview* previewp = getPreviewView(view); - - if (previewp) - { - if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_POSTCARD) - { - LLFloaterPostcard* floater = previewp->savePostcard(); - // if still in snapshot mode, put postcard floater in snapshot floaterview - // and link it to snapshot floater - if (floater && !gSavedSettings.getBOOL("CloseSnapshotOnKeep")) - { - gFloaterView->removeChild(floater); - gSnapshotFloaterView->addChild(floater); - view->addDependentFloater(floater, FALSE); - } - } - else if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) - { - previewp->saveTexture(); - } - else - { - previewp->saveLocal(); - } - - if (gSavedSettings.getBOOL("CloseSnapshotOnKeep")) - { - view->closeFloater(); - } - else - { - checkAutoSnapshot(previewp); - } - - updateControls(view); - } -} - -// static void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data) { LLSnapshotLivePreview* previewp = getPreviewView((LLFloaterSnapshot *)data); @@ -1674,10 +1568,8 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL } // save off all selected resolution values - gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild<LLComboBox>("postcard_size_combo")->getCurrentIndex()); - gSavedSettings.setS32("SnapshotTextureLastResolution", view->getChild<LLComboBox>("texture_size_combo")->getCurrentIndex()); - gSavedSettings.setS32("SnapshotLocalLastResolution", view->getChild<LLComboBox>("local_size_combo")->getCurrentIndex()); - + gSavedSettings.setS32("SnapshotLastResolution", view->getChild<LLComboBox>("snapshot_size_combo")->getCurrentIndex()); + std::string sdstring = combobox->getSelectedValue(); LLSD sdres; std::stringstream sstream(sdstring); @@ -1757,17 +1649,130 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data) } //static -void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data) +void LLFloaterSnapshot::Impl::onToggleAdvanced(LLUICtrl* ctrl, void* data) { - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - if (view) + LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; + + LLPanel* advanced_panel = view->getChild<LLPanel>("snapshot_advanced"); + + if (advanced_panel->getVisible()) { - gSavedSettings.setS32("LastSnapshotType", getTypeIndex(view)); - getPreviewView(view)->updateSnapshot(TRUE); - updateControls(view); + advanced_panel->setVisible(false); + + // shrink floater back to original size + view->reshape(view->getRect().getWidth() - advanced_panel->getRect().getWidth(), view->getRect().getHeight()); + + view->getChild<LLButton>("hide_advanced")->setVisible(false); + view->getChild<LLButton>("show_advanced")->setVisible(true); + } + else + { + advanced_panel->setVisible(true); + // stretch the floater so it can accommodate the advanced panel + view->reshape(view->getRect().getWidth() + advanced_panel->getRect().getWidth(), view->getRect().getHeight()); + + view->getChild<LLButton>("hide_advanced")->setVisible(true); + view->getChild<LLButton>("show_advanced")->setVisible(false); + } +} + +// This object represents a pending request for avatar properties information +class LLAvatarDataRequest : public LLAvatarPropertiesObserver +{ +public: + LLAvatarDataRequest(const LLUUID& avatar_id, const LLUUID& image_id, LLFloaterSnapshot* floater) + : mAvatarID(avatar_id), + mImageID(image_id), + mSnapshotFloater(floater) + + { + } + + ~LLAvatarDataRequest() + { + // remove ourselves as an observer + LLAvatarPropertiesProcessor::getInstance()-> + removeObserver(mAvatarID, this); + } + + void processProperties(void* data, EAvatarProcessorType type) + { + // route the data to the inspector + if (data + && type == APT_PROPERTIES) + { + + LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data); + + LLAvatarData new_data(*avatar_data); + new_data.image_id = mImageID; + + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&new_data); + + delete this; + } + } + + // Store avatar ID so we can un-register the observer on destruction + LLUUID mAvatarID; + LLUUID mImageID; + LLFloaterSnapshot* mSnapshotFloater; +}; + +void LLFloaterSnapshot::Impl::onCommitProfilePic(LLFloaterSnapshot* view) +{ + //first save to harddrive + LLSnapshotLivePreview* previewp = getPreviewView(view); + + if(previewp) + { + previewp->saveTexture(true); } } +void LLFloaterSnapshot::Impl::onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type) +{ + LLSnapshotLivePreview* previewp = getPreviewView(view); + + if (previewp) + { + previewp->setSnapshotType(type); + + if (type == LLSnapshotLivePreview::SNAPSHOT_WEB) + { + previewp->saveWeb(view->getString("share_to_web_url")); + } + else if (type == LLSnapshotLivePreview::SNAPSHOT_LOCAL) + { + previewp->saveLocal(); + } + else if (type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) + { + previewp->saveTexture(); + } + else if (type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD) + { + LLFloaterPostcard* floater = previewp->savePostcard(); + // if still in snapshot mode, put postcard floater in snapshot floaterview + // and link it to snapshot floater + if (floater && !gSavedSettings.getBOOL("CloseSnapshotOnKeep")) + { + gFloaterView->removeChild(floater); + gSnapshotFloaterView->addChild(floater); + view->addDependentFloater(floater, FALSE); + } + } + + if (gSavedSettings.getBOOL("CloseSnapshotOnKeep")) + { + view->closeFloater(); + } + else + { + checkAutoSnapshot(previewp); + } + } +} //static void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) @@ -1781,8 +1786,6 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) } } - - // Sets the named size combo to "custom" mode. // static void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) @@ -1791,24 +1794,11 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const s combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index - if(comboname == "postcard_size_combo") - { - gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); - } - else if(comboname == "texture_size_combo") - { - gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); - } - else if(comboname == "local_size_combo") - { - gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); - } + gSavedSettings.setS32("SnapshotLastResolution", combo->getCurrentIndex()); checkAspectRatio(floater, -1); // -1 means custom } - - //static BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value) { @@ -1949,9 +1939,7 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat previewp->setSize(w,h); checkAutoSnapshot(previewp, FALSE); previewp->updateSnapshot(FALSE, TRUE); - comboSetCustom(view, "postcard_size_combo"); - comboSetCustom(view, "texture_size_combo"); - comboSetCustom(view, "local_size_combo"); + comboSetCustom(view, "snapshot_size_combo"); } } @@ -1968,7 +1956,7 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat // Default constructor LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key) - : LLFloater(key), + : LLTransientDockableFloater(NULL, true, key), impl (*(new Impl)) { //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE); @@ -1993,7 +1981,20 @@ LLFloaterSnapshot::~LLFloaterSnapshot() BOOL LLFloaterSnapshot::postBuild() { - childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this); + + getChild<LLButton>("share")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SHARE)); + getChild<LLButton>("save")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SAVE)); + getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_MAIN)); + + getChild<LLButton>("share_to_web")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_WEB)); + getChild<LLButton>("share_to_email")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_POSTCARD)); + getChild<LLButton>("save_to_inventory")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_TEXTURE)); + getChild<LLButton>("save_to_computer")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_LOCAL)); + getChild<LLButton>("set_profile_pic")->setCommitCallback(boost::bind(&Impl::onCommitProfilePic, this)); + + childSetCommitCallback("show_advanced", Impl::onToggleAdvanced, this); + childSetCommitCallback("hide_advanced", Impl::onToggleAdvanced, this); + childSetCommitCallback("local_format_combo", Impl::onCommitSnapshotFormat, this); childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); @@ -2001,11 +2002,6 @@ BOOL LLFloaterSnapshot::postBuild() childSetAction("more_btn", Impl::onClickMore, this); childSetAction("less_btn", Impl::onClickLess, this); - childSetAction("upload_btn", Impl::onClickKeep, this); - childSetAction("send_btn", Impl::onClickKeep, this); - childSetCommitCallback("save_btn", Impl::onCommitSave, this); - childSetAction("discard_btn", Impl::onClickDiscard, this); - childSetCommitCallback("image_quality_slider", Impl::onCommitQuality, this); childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality")); @@ -2026,7 +2022,6 @@ BOOL LLFloaterSnapshot::postBuild() childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this); childSetValue("layer_types", "colors"); - childSetEnabled("layer_types", FALSE); childSetValue("snapshot_width", gSavedSettings.getS32(lastSnapshotWidthName())); childSetValue("snapshot_height", gSavedSettings.getS32(lastSnapshotHeightName())); @@ -2037,9 +2032,7 @@ BOOL LLFloaterSnapshot::postBuild() childSetValue("auto_snapshot_check", gSavedSettings.getBOOL("AutoSnapshot")); childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); - childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this); - childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); - childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); + childSetCommitCallback("snapshot_size_combo", Impl::onCommitResolution, this); // create preview window LLRect full_screen_rect = getRootView()->getRect(); @@ -2060,8 +2053,14 @@ BOOL LLFloaterSnapshot::postBuild() impl.mPreviewHandle = previewp->getHandle(); impl.updateControls(this); impl.updateLayout(this); + + //save off the refresh button's rectangle so we can apply offsets with thumbnail resize + mRefreshBtnRect = getChild<LLButton>("new_snapshot_btn")->getRect(); + + // make sure we share/hide the general buttons + updateButtons(SNAPSHOT_MAIN); - return TRUE; + return LLDockableFloater::postBuild(); } void LLFloaterSnapshot::draw() @@ -2074,15 +2073,19 @@ void LLFloaterSnapshot::draw() return; } - LLFloater::draw(); + LLDockableFloater::draw(); + + LLButton* refresh_btn = getChild<LLButton>("new_snapshot_btn"); + // revert the refresh button to original intended position + LLRect refresh_rect = mRefreshBtnRect; if (previewp) { if(previewp->getThumbnailImage()) { - LLRect thumbnail_rect = getChild<LLUICtrl>("thumbnail_placeholder")->getRect(); + LLRect thumbnail_rect = getChild<LLView>("thumbnail_placeholder")->getRect(); - S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ; + S32 offset_x = (thumbnail_rect.getWidth() - previewp->getThumbnailWidth()) / 2 + thumbnail_rect.mLeft; S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ; glMatrixMode(GL_MODELVIEW); @@ -2091,8 +2094,14 @@ void LLFloaterSnapshot::draw() previewp->getThumbnailImage(), LLColor4::white); previewp->drawPreviewRect(offset_x, offset_y) ; + + refresh_rect.translate(offset_x - thumbnail_rect.mLeft, offset_y - thumbnail_rect.mBottom); } } + + refresh_btn->setRect(refresh_rect); + drawChild(refresh_btn); + } void LLFloaterSnapshot::onOpen(const LLSD& key) @@ -2106,6 +2115,12 @@ void LLFloaterSnapshot::onOpen(const LLSD& key) gSnapshotFloaterView->setEnabled(TRUE); gSnapshotFloaterView->setVisible(TRUE); gSnapshotFloaterView->adjustToFitScreen(this, FALSE); + + LLButton *snapshots = LLBottomTray::getInstance()->getChild<LLButton>("snapshots"); + + setDockControl(new LLDockControl( + snapshots, this, + getDockTongue(), LLDockControl::TOP)); } void LLFloaterSnapshot::onClose(bool app_quitting) @@ -2133,6 +2148,33 @@ void LLFloaterSnapshot::update() } } +bool LLFloaterSnapshot::updateButtons(ESnapshotMode mode) +{ + childSetVisible("share", mode == SNAPSHOT_MAIN); + childSetVisible("save", mode == SNAPSHOT_MAIN); + childSetVisible("set_profile_pic", mode == SNAPSHOT_MAIN); + + childSetVisible("share_to_web", mode == SNAPSHOT_SHARE); + childSetVisible("share_to_email", mode == SNAPSHOT_SHARE); + + childSetVisible("save_to_inventory", mode == SNAPSHOT_SAVE); + childSetVisible("save_to_computer", mode == SNAPSHOT_SAVE); + + childSetVisible("cancel", mode != SNAPSHOT_MAIN); + + return true; +} + +void LLFloaterSnapshot::setAsProfilePic(const LLUUID& image_id) +{ + LLAvatarDataRequest* avatar_data_request = new LLAvatarDataRequest(gAgent.getID(), image_id, this); + + LLAvatarPropertiesProcessor* processor = + LLAvatarPropertiesProcessor::getInstance(); + + processor->addObserver(gAgent.getID(), avatar_data_request); + processor->sendAvatarPropertiesRequest(gAgent.getID()); +} ///---------------------------------------------------------------------------- /// Class LLSnapshotFloaterView diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 1333497bd2..931d355748 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -34,9 +34,10 @@ #define LL_LLFLOATERSNAPSHOT_H #include "llfloater.h" +#include "lltransientdockablefloater.h" -class LLFloaterSnapshot : public LLFloater +class LLFloaterSnapshot : public LLTransientDockableFloater { public: typedef enum e_snapshot_format @@ -46,6 +47,13 @@ public: SNAPSHOT_FORMAT_BMP } ESnapshotFormat; + enum ESnapshotMode + { + SNAPSHOT_SHARE, + SNAPSHOT_SAVE, + SNAPSHOT_MAIN + }; + LLFloaterSnapshot(const LLSD& key); virtual ~LLFloaterSnapshot(); @@ -56,6 +64,10 @@ public: static void update(); + void setAsProfilePic(const LLUUID& image_id); + + bool updateButtons(ESnapshotMode mode); + static S32 getUIWinHeightLong() {return sUIWinHeightLong ;} static S32 getUIWinHeightShort() {return sUIWinHeightShort ;} static S32 getUIWinWidth() {return sUIWinWidth ;} @@ -67,6 +79,8 @@ private: static S32 sUIWinHeightLong ; static S32 sUIWinHeightShort ; static S32 sUIWinWidth ; + + LLRect mRefreshBtnRect; }; class LLSnapshotFloaterView : public LLFloaterView diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 7c42a581ff..d8d7057c4e 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -38,7 +38,7 @@ #include "llcoord.h" //#include "llgl.h" -#include "llagent.h" +#include "llagentcamera.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" @@ -533,7 +533,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // multiply by correction factor because volume sliders go [0, 0.5] - childSetValue( "slider zoom", gAgent.getCameraZoomFraction() * 0.5f); + childSetValue( "slider zoom", gAgentCamera.getCameraZoomFraction() * 0.5f); // Move buttons BOOL move_visible = (tool == LLToolGrab::getInstance()); @@ -766,7 +766,7 @@ void LLFloaterTools::onClose(bool app_quitting) // Different from handle_reset_view in that it doesn't actually // move the camera if EditCameraMovement is not set. - gAgent.resetView(gSavedSettings.getBOOL("EditCameraMovement")); + gAgentCamera.resetView(gSavedSettings.getBOOL("EditCameraMovement")); // exit component selection mode LLSelectMgr::getInstance()->promoteSelectionToRoot(); @@ -847,7 +847,7 @@ void commit_slider_zoom(LLUICtrl *ctrl) { // renormalize value, since max "volume" level is 0.5 for some reason F32 zoom_level = (F32)ctrl->getValue().asReal() * 2.f; // / 0.5f; - gAgent.setCameraZoomFraction(zoom_level); + gAgentCamera.setCameraZoomFraction(zoom_level); } void click_popup_rotate_left(void*) diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 8ab050beaa..84ea353dab 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -315,7 +315,7 @@ void LLFloaterTopObjects::doToObjects(int action, bool all) LLCtrlListInterface *list = childGetListInterface("objects_list"); if (!list || list->getItemCount() == 0) return; - std::vector<LLUUID>::iterator id_itor; + uuid_vec_t::iterator id_itor; bool start_message = true; diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h index ee3c5d3cce..8fb89a3cc5 100644 --- a/indra/newview/llfloatertopobjects.h +++ b/indra/newview/llfloatertopobjects.h @@ -89,7 +89,7 @@ private: std::string mMethod; LLSD mObjectListData; - std::vector<LLUUID> mObjectListIDs; + uuid_vec_t mObjectListIDs; U32 mCurrentMode; U32 mFlags; diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 0975040696..896c410e32 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -41,6 +41,7 @@ #include "llfloaterworldmap.h" #include "llagent.h" +#include "llagentcamera.h" #include "llbutton.h" #include "llcallingcard.h" #include "llcombobox.h" @@ -50,7 +51,9 @@ //#include "llfirstuse.h" #include "llfloaterreg.h" // getTypedInstance() #include "llfocusmgr.h" +#include "llinventoryfunctions.h" #include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "lllandmarklist.h" #include "lllineeditor.h" @@ -321,7 +324,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) // Start speculative download of landmarks const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); - gInventory.startBackgroundFetch(landmark_folder_id); + LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id); childSetFocus("location", TRUE); gFocusMgr.triggerFocusFlash(); @@ -1211,12 +1214,12 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) { // We've got the position finally, so we're no longer busy. JC // getWindow()->decBusyCount(); - pos_global = LLTracker::getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal(); + pos_global = LLTracker::getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal(); } } else if(LLWorldMap::getInstance()->isTracking()) { - pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal();; + pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();; } else { diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index f74d912842..83eb9579b2 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -39,6 +39,7 @@ #include "llinventoryclipboard.h" // *TODO: remove this once hack below gone. #include "llinventoryfilter.h" #include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "llfoldertype.h" #include "llfloaterinventory.h"// hacked in for the bonus context menu items. @@ -275,11 +276,6 @@ LLFolderView::~LLFolderView( void ) mRenamer = NULL; mStatusTextBox = NULL; - if( gEditMenuHandler == this ) - { - gEditMenuHandler = NULL; - } - mAutoOpenItems.removeAllNodes(); gIdleCallbacks.deleteFunction(idle, this); @@ -865,7 +861,7 @@ BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection) const BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) { std::vector<EDragAndDropType> types; - std::vector<LLUUID> cargo_ids; + uuid_vec_t cargo_ids; selected_items_t::iterator item_it; BOOL can_drag = TRUE; if (!mSelectedItems.empty()) @@ -943,7 +939,7 @@ void LLFolderView::draw() } else { - if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration()) + if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration()) { mStatusText = LLTrans::getString("Searching"); //font->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); @@ -979,7 +975,6 @@ void LLFolderView::finishRenamingItem( void ) if( mRenameItem ) { setSelectionFromRoot( mRenameItem, TRUE ); - mRenameItem = NULL; } // List is re-sorted alphabeticly, so scroll to make sure the selected item is visible. diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index bb4c75d3ac..c916e4b98c 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -38,6 +38,7 @@ #include "llfoldervieweventlistener.h" #include "llinventorybridge.h" // for LLItemBridge in LLInventorySort::operator() #include "llinventoryfilter.h" +#include "llinventorymodelbackgroundfetch.h" #include "llpanel.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewerwindow.h" // Argh, only for setCursor() @@ -436,11 +437,8 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation) S32 LLFolderViewItem::getItemHeight() { - if (mHidden) return 0; + if (getHidden()) return 0; - //S32 icon_height = mIcon->getHeight(); - //S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight()); - //return llmax( icon_height, label_height ) + ICON_PAD; return mItemHeight; } @@ -823,32 +821,34 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return handled; } - void LLFolderViewItem::draw() { - if (mHidden) return; + if (getHidden()) + { + return; + } static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); - static LLUIColor sFocusOutlineColor = - LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); + static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemSuffixColor", DEFAULT_WHITE); static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); - const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>(); const S32 TOP_PAD = default_params.item_top_pad; + const S32 FOCUS_LEFT = 1; + const LLFontGL* font = getLabelFontForStyle(mLabelStyle); - bool possibly_has_children = false; - bool up_to_date = mListener && mListener->isUpToDate(); - if((up_to_date && hasVisibleChildren() ) || // we fetched our children and some of them have passed the filter... - (!up_to_date && mListener && mListener->hasChildren())) // ...or we know we have children but haven't fetched them (doesn't obey filter) - { - possibly_has_children = true; - } - if(/*mControlLabel[0] != '\0' && */possibly_has_children) + + //--------------------------------------------------------------------------------// + // Draw open folder arrow + // + const bool up_to_date = mListener && mListener->isUpToDate(); + const bool possibly_has_children = ((up_to_date && hasVisibleChildren()) || // we fetched our children and some of them have passed the filter... + (!up_to_date && mListener && mListener->hasChildren())); // ...or we know we have children but haven't fetched them (doesn't obey filter) + if (possibly_has_children) { LLUIImage* arrow_image = default_params.folder_arrow_image; gl_draw_scaled_rotated_image( @@ -856,22 +856,16 @@ void LLFolderViewItem::draw() ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, arrow_image->getImage(), sFgColor); } - // See also LLFolderView::updateRenamerPosition() - F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation); - - LLFontGL* font = getLabelFontForStyle(mLabelStyle); - - // If we have keyboard focus, draw selection filled - BOOL show_context = getRoot()->getShowSelectionContext(); - BOOL filled = show_context || (getRoot()->getParentPanel()->hasFocus()); - const S32 FOCUS_LEFT = 1; - S32 focus_top = getRect().getHeight(); - S32 focus_bottom = getRect().getHeight() - mItemHeight; - bool folder_open = (getRect().getHeight() > mItemHeight + 4); - // always render "current" item, only render other selected items if - // mShowSingleSelection is FALSE - if( mIsSelected ) + //--------------------------------------------------------------------------------// + // Draw highlight for selected items + // + const BOOL show_context = getRoot()->getShowSelectionContext(); + const BOOL filled = show_context || (getRoot()->getParentPanel()->hasFocus()); // If we have keyboard focus, draw selection filled + const S32 focus_top = getRect().getHeight(); + const S32 focus_bottom = getRect().getHeight() - mItemHeight; + const bool folder_open = (getRect().getHeight() > mItemHeight + 4); + if (mIsSelected) // always render "current" item. Only render other selected items if mShowSingleSelection is FALSE { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLColor4 bg_color = sHighlightBgColor; @@ -890,152 +884,169 @@ void LLFolderViewItem::draw() bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]); } } - - gl_rect_2d( - FOCUS_LEFT, - focus_top, - getRect().getWidth() - 2, - focus_bottom, - bg_color, filled); + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + bg_color, filled); if (mIsCurSelection) { - gl_rect_2d( - FOCUS_LEFT, - focus_top, - getRect().getWidth() - 2, - focus_bottom, - sFocusOutlineColor, FALSE); + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + sFocusOutlineColor, FALSE); } if (folder_open) { - gl_rect_2d( - FOCUS_LEFT, - focus_bottom + 1, // overlap with bottom edge of above rect - getRect().getWidth() - 2, - 0, - sFocusOutlineColor, FALSE); + gl_rect_2d(FOCUS_LEFT, + focus_bottom + 1, // overlap with bottom edge of above rect + getRect().getWidth() - 2, + 0, + sFocusOutlineColor, FALSE); if (show_context) { - gl_rect_2d( - FOCUS_LEFT, - focus_bottom + 1, - getRect().getWidth() - 2, - 0, - sHighlightBgColor, TRUE); + gl_rect_2d(FOCUS_LEFT, + focus_bottom + 1, + getRect().getWidth() - 2, + 0, + sHighlightBgColor, TRUE); } } } + + //--------------------------------------------------------------------------------// + // Draw DragNDrop highlight + // if (mDragAndDropTarget) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d( - FOCUS_LEFT, - focus_top, - getRect().getWidth() - 2, - focus_bottom, - sHighlightBgColor, FALSE); + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + sHighlightBgColor, FALSE); if (folder_open) { - gl_rect_2d( - FOCUS_LEFT, - focus_bottom + 1, // overlap with bottom edge of above rect - getRect().getWidth() - 2, - 0, - sHighlightBgColor, FALSE); + gl_rect_2d(FOCUS_LEFT, + focus_bottom + 1, // overlap with bottom edge of above rect + getRect().getWidth() - 2, + 0, + sHighlightBgColor, FALSE); } mDragAndDropTarget = FALSE; } - S32 icon_x = mIndentation + ARROW_SIZE + TEXT_PAD; - // First case is used for open folders - if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80)) + + //--------------------------------------------------------------------------------// + // Draw open icon + // + const S32 icon_x = mIndentation + ARROW_SIZE + TEXT_PAD; + if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80)) // For open folders { mIconOpen->draw(icon_x, getRect().getHeight() - mIconOpen->getHeight() - TOP_PAD + 1); } - else if(mIcon) + else if (mIcon) { mIcon->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1); } - if (!mLabel.empty()) + + //--------------------------------------------------------------------------------// + // Exit if no label to draw + // + if (mLabel.empty()) { - // highlight filtered text - BOOL debug_filters = getRoot()->getDebugFilters(); - LLColor4 color = ( (mIsSelected && filled) ? sHighlightFgColor : sFgColor ); - F32 right_x; - F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; + return; + } - if (debug_filters) - { - if (!getFiltered() && !possibly_has_children) - { - color.mV[VALPHA] *= 0.5f; - } + LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor; + F32 right_x = 0; + F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; + F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation); - LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? LLColor4(0.5f, 0.8f, 0.5f, 1.f) : LLColor4(0.8f, 0.5f, 0.5f, 1.f); - LLFontGL::getFontMonospace()->renderUTF8( - mStatusText, 0, text_left, y, filter_color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, S32_MAX, &right_x, FALSE ); - text_left = right_x; + //--------------------------------------------------------------------------------// + // Highlight filtered text + // + if (getRoot()->getDebugFilters()) + { + if (!getFiltered() && !possibly_has_children) + { + color.mV[VALPHA] *= 0.5f; } + LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? + LLColor4(0.5f, 0.8f, 0.5f, 1.f) : + LLColor4(0.8f, 0.5f, 0.5f, 1.f); + LLFontGL::getFontMonospace()->renderUTF8(mStatusText, 0, text_left, y, filter_color, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + S32_MAX, S32_MAX, &right_x, FALSE ); + text_left = right_x; + } - font->renderUTF8( mLabel, 0, text_left, y, color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, getRect().getWidth() - (S32) text_left, &right_x, TRUE); + //--------------------------------------------------------------------------------// + // Draw the actual label text + // + font->renderUTF8(mLabel, 0, text_left, y, color, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + S32_MAX, getRect().getWidth() - (S32) text_left, &right_x, TRUE); -// LLViewerInventoryCategory *item = 0; -// if (getListener()) -// item = gInventory.getCategory(getListener()->getUUID()); - bool root_is_loading = false; - if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(),gInventory.getRootFolderID())) - { - // Descendent of my inventory. - root_is_loading = gInventory.myInventoryFetchInProgress(); - } - if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(),gInventory.getLibraryRootFolderID())) - { - // Descendent of library - root_is_loading = gInventory.libraryFetchInProgress(); - } - - if ( (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime")) - || (LLInventoryModel::backgroundFetchActive() && root_is_loading && mShowLoadStatus) ) - { - std::string load_string = " ( " + LLTrans::getString("LoadingData") + " ) "; - font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE); - } + //--------------------------------------------------------------------------------// + // Draw "Loading..." text + // + bool root_is_loading = false; + if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), + gInventory.getRootFolderID())) // Descendent of my inventory + { + root_is_loading = LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress(); + } + if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), + gInventory.getLibraryRootFolderID())) // Descendent of library + { + root_is_loading = LLInventoryModelBackgroundFetch::instance().libraryFetchInProgress(); + } + if ((mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime")) || + (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && root_is_loading && (mShowLoadStatus || mHidden))) + { + std::string load_string = " ( " + LLTrans::getString("LoadingData") + " ) "; + font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + S32_MAX, S32_MAX, &right_x, FALSE); + } - if (!mLabelSuffix.empty()) - { - font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, S32_MAX, &right_x, FALSE ); - } + //--------------------------------------------------------------------------------// + // Draw label suffix + // + if (!mLabelSuffix.empty()) + { + font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + S32_MAX, S32_MAX, &right_x, FALSE ); + } - if (mStringMatchOffset != std::string::npos) + //--------------------------------------------------------------------------------// + // Highlight string match + // + if (mStringMatchOffset != std::string::npos) + { + // don't draw backgrounds for zero-length strings + S32 filter_string_length = getRoot()->getFilterSubString().size(); + if (filter_string_length > 0) { - // don't draw backgrounds for zero-length strings - S32 filter_string_length = getRoot()->getFilterSubString().size(); - if (filter_string_length > 0) - { - std::string combined_string = mLabel + mLabelSuffix; - S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1; - S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; - S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); - S32 top = getRect().getHeight() - TOP_PAD; + std::string combined_string = mLabel + mLabelSuffix; + S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1; + S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; + S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); + S32 top = getRect().getHeight() - TOP_PAD; - LLUIImage* box_image = default_params.selection_image; - LLRect box_rect(left, top, right, bottom); - box_image->draw(box_rect, sFilterBGColor); - F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset); - F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; - font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy, - sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - filter_string_length, S32_MAX, &right_x, FALSE ); - } + LLUIImage* box_image = default_params.selection_image; + LLRect box_rect(left, top, right, bottom); + box_image->draw(box_rect, sFilterBGColor); + F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset); + F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; + font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy, + sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + filter_string_length, S32_MAX, &right_x, FALSE ); } } } @@ -1317,7 +1328,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) // when applying a filter, matching folders get their contents downloaded first if (filter.isNotDefault() && getFiltered(filter.getMinRequiredGeneration()) && (mListener && !gInventory.isCategoryComplete(mListener->getUUID()))) { - gInventory.startBackgroundFetch(mListener->getUUID()); + LLInventoryModelBackgroundFetch::instance().start(mListener->getUUID()); } // now query children diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 18f81fe506..a848128d67 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -33,6 +33,7 @@ #include "llviewerprecompiledheaders.h" #include "llinventory.h" +#include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "lltrans.h" @@ -322,7 +323,7 @@ void LLFriendCardsManager::collectFriendsLists(folderid_buddies_map_t& folderBud if (NULL == items) continue; - std::vector<LLUUID> buddyUUIDs; + uuid_vec_t buddyUUIDs; for (itBuddy = items->begin(); itBuddy != items->end(); ++itBuddy) { buddyUUIDs.push_back((*itBuddy)->getCreatorUUID()); @@ -409,7 +410,7 @@ void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_i // This instance will be deleted in LLInitialFriendCardsFetch::done(). LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(cb); - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + uuid_vec_t folders; folders.push_back(folder_id); fetch->fetchDescendents(folders); diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h index 1cda52c1d7..638a1eca84 100644 --- a/indra/newview/llfriendcard.h +++ b/indra/newview/llfriendcard.h @@ -49,7 +49,7 @@ class LLFriendCardsManager friend class CreateFriendCardCallback; public: - typedef std::map<LLUUID, std::vector<LLUUID> > folderid_buddies_map_t; + typedef std::map<LLUUID, uuid_vec_t > folderid_buddies_map_t; // LLFriendObserver implementation void changed(U32 mask) diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 0ba7bdf613..fbacbd704f 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -67,7 +67,7 @@ static const LLUUID& get_linked_uuid(const LLUUID& item_id); // Lightweight constructor. // init() does the heavy lifting. -LLGestureManager::LLGestureManager() +LLGestureMgr::LLGestureMgr() : mValid(FALSE), mPlaying(), mActive(), @@ -79,7 +79,7 @@ LLGestureManager::LLGestureManager() // We own the data for gestures, so clean them up. -LLGestureManager::~LLGestureManager() +LLGestureMgr::~LLGestureMgr() { item_map_t::iterator it; for (it = mActive.begin(); it != mActive.end(); ++it) @@ -93,12 +93,12 @@ LLGestureManager::~LLGestureManager() } -void LLGestureManager::init() +void LLGestureMgr::init() { // TODO } -void LLGestureManager::changed(U32 mask) +void LLGestureMgr::changed(U32 mask) { LLInventoryFetchObserver::changed(mask); @@ -136,7 +136,7 @@ void LLGestureManager::changed(U32 mask) // Use this version when you have the item_id but not the asset_id, // and you KNOW the inventory is loaded. -void LLGestureManager::activateGesture(const LLUUID& item_id) +void LLGestureMgr::activateGesture(const LLUUID& item_id) { LLViewerInventoryItem* item = gInventory.getItem(item_id); if (!item) return; @@ -152,7 +152,7 @@ void LLGestureManager::activateGesture(const LLUUID& item_id) } -void LLGestureManager::activateGestures(LLViewerInventoryItem::item_array_t& items) +void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items) { // Load up the assets S32 count = 0; @@ -248,7 +248,7 @@ struct LLLoadInfo /** * It will load a gesture from remote storage */ -void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id, +void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, BOOL inform_server, BOOL deactivate_similar) @@ -257,7 +257,7 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id, if( !gAssetStorage ) { - llwarns << "LLGestureManager::activateGestureWithAsset without valid gAssetStorage" << llendl; + llwarns << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << llendl; return; } // If gesture is already active, nothing to do. @@ -299,7 +299,7 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id, } -void LLGestureManager::deactivateGesture(const LLUUID& item_id) +void LLGestureMgr::deactivateGesture(const LLUUID& item_id) { const LLUUID& base_item_id = get_linked_uuid(item_id); item_map_t::iterator it = mActive.find(base_item_id); @@ -338,16 +338,16 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id) gAgent.sendReliableMessage(); - LLAppearanceManager::instance().removeCOFItemLinks(base_item_id, false); + LLAppearanceMgr::instance().removeCOFItemLinks(base_item_id, false); notifyObservers(); } -void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id) +void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id) { const LLUUID& base_in_item_id = get_linked_uuid(in_item_id); - std::vector<LLUUID> gest_item_ids; + uuid_vec_t gest_item_ids; // Deactivate all gestures that match item_map_t::iterator it; @@ -386,7 +386,7 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI // Inform database of the change LLMessageSystem* msg = gMessageSystem; BOOL start_message = TRUE; - std::vector<LLUUID>::const_iterator vit = gest_item_ids.begin(); + uuid_vec_t::const_iterator vit = gest_item_ids.begin(); while (vit != gest_item_ids.end()) { if (start_message) @@ -431,7 +431,7 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI } -BOOL LLGestureManager::isGestureActive(const LLUUID& item_id) +BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id) { const LLUUID& base_item_id = get_linked_uuid(item_id); item_map_t::iterator it = mActive.find(base_item_id); @@ -439,7 +439,7 @@ BOOL LLGestureManager::isGestureActive(const LLUUID& item_id) } -BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id) +BOOL LLGestureMgr::isGesturePlaying(const LLUUID& item_id) { const LLUUID& base_item_id = get_linked_uuid(item_id); @@ -452,7 +452,7 @@ BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id) return gesture->mPlaying; } -BOOL LLGestureManager::isGesturePlaying(LLMultiGesture* gesture) +BOOL LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture) { if(!gesture) { @@ -462,7 +462,7 @@ BOOL LLGestureManager::isGesturePlaying(LLMultiGesture* gesture) return gesture->mPlaying; } -void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id) +void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id) { const LLUUID& base_item_id = get_linked_uuid(item_id); @@ -504,11 +504,11 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new notifyObservers(); } -void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id) +void LLGestureMgr::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id) { const LLUUID& base_item_id = get_linked_uuid(item_id); - item_map_t::iterator it = LLGestureManager::instance().mActive.find(base_item_id); + item_map_t::iterator it = LLGestureMgr::instance().mActive.find(base_item_id); if (it == mActive.end()) { llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl; @@ -517,10 +517,10 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_a // mActive owns this gesture pointer, so clean up memory. LLMultiGesture* gesture = (*it).second; - LLGestureManager::instance().replaceGesture(base_item_id, gesture, new_asset_id); + LLGestureMgr::instance().replaceGesture(base_item_id, gesture, new_asset_id); } -void LLGestureManager::playGesture(LLMultiGesture* gesture) +void LLGestureMgr::playGesture(LLMultiGesture* gesture) { if (!gesture) return; @@ -539,7 +539,7 @@ void LLGestureManager::playGesture(LLMultiGesture* gesture) // Convenience function that looks up the item_id for you. -void LLGestureManager::playGesture(const LLUUID& item_id) +void LLGestureMgr::playGesture(const LLUUID& item_id) { const LLUUID& base_item_id = get_linked_uuid(item_id); @@ -556,7 +556,7 @@ void LLGestureManager::playGesture(const LLUUID& item_id) // Iterates through space delimited tokens in string, triggering any gestures found. // Generates a revised string that has the found tokens replaced by their replacement strings // and (as a minor side effect) has multiple spaces in a row replaced by single spaces. -BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::string* revised_string) +BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string) { std::string tokenized = utf8str; @@ -649,7 +649,7 @@ BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::s } -BOOL LLGestureManager::triggerGesture(KEY key, MASK mask) +BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask) { std::vector <LLMultiGesture *> matching; item_map_t::iterator it; @@ -683,7 +683,7 @@ BOOL LLGestureManager::triggerGesture(KEY key, MASK mask) } -S32 LLGestureManager::getPlayingCount() const +S32 LLGestureMgr::getPlayingCount() const { return mPlaying.size(); } @@ -697,7 +697,7 @@ struct IsGesturePlaying : public std::unary_function<LLMultiGesture*, bool> } }; -void LLGestureManager::update() +void LLGestureMgr::update() { S32 i; for (i = 0; i < (S32)mPlaying.size(); ++i) @@ -740,14 +740,13 @@ void LLGestureManager::update() // Run all steps until you're either done or hit a wait. -void LLGestureManager::stepGesture(LLMultiGesture* gesture) +void LLGestureMgr::stepGesture(LLMultiGesture* gesture) { if (!gesture) { return; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if (!avatar) return; + if (!isAgentAvatarValid()) return; // Of the ones that started playing, have any stopped? @@ -758,8 +757,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture) { // look in signaled animations (simulator's view of what is // currently playing. - LLVOAvatar::AnimIterator play_it = avatar->mSignaledAnimations.find(*gest_it); - if (play_it != avatar->mSignaledAnimations.end()) + LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it); + if (play_it != gAgentAvatarp->mSignaledAnimations.end()) { ++gest_it; } @@ -777,8 +776,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture) gest_it != gesture->mRequestedAnimIDs.end(); ) { - LLVOAvatar::AnimIterator play_it = avatar->mSignaledAnimations.find(*gest_it); - if (play_it != avatar->mSignaledAnimations.end()) + LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it); + if (play_it != gAgentAvatarp->mSignaledAnimations.end()) { // Hooray, this animation has started playing! // Copy into playing. @@ -888,7 +887,7 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture) } -void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step) +void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) { switch(step->getType()) { @@ -975,7 +974,7 @@ void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step) // static -void LLGestureManager::onLoadComplete(LLVFS *vfs, +void LLGestureMgr::onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) @@ -988,7 +987,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, delete info; info = NULL; - LLGestureManager& self = LLGestureManager::instance(); + LLGestureMgr& self = LLGestureMgr::instance(); self.mLoadingCount--; if (0 == status) @@ -1094,12 +1093,12 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, llwarns << "Problem loading gesture: " << status << llendl; - LLGestureManager::instance().mActive.erase(item_id); + LLGestureMgr::instance().mActive.erase(item_id); } } -void LLGestureManager::stopGesture(LLMultiGesture* gesture) +void LLGestureMgr::stopGesture(LLMultiGesture* gesture) { if (!gesture) return; @@ -1139,7 +1138,7 @@ void LLGestureManager::stopGesture(LLMultiGesture* gesture) } -void LLGestureManager::stopGesture(const LLUUID& item_id) +void LLGestureMgr::stopGesture(const LLUUID& item_id) { const LLUUID& base_item_id = get_linked_uuid(item_id); @@ -1153,12 +1152,12 @@ void LLGestureManager::stopGesture(const LLUUID& item_id) } -void LLGestureManager::addObserver(LLGestureManagerObserver* observer) +void LLGestureMgr::addObserver(LLGestureManagerObserver* observer) { mObservers.push_back(observer); } -void LLGestureManager::removeObserver(LLGestureManagerObserver* observer) +void LLGestureMgr::removeObserver(LLGestureManagerObserver* observer) { std::vector<LLGestureManagerObserver*>::iterator it; it = std::find(mObservers.begin(), mObservers.end(), observer); @@ -1171,9 +1170,9 @@ void LLGestureManager::removeObserver(LLGestureManagerObserver* observer) // Call this method when it's time to update everyone on a new state. // Copy the list because an observer could respond by removing itself // from the list. -void LLGestureManager::notifyObservers() +void LLGestureMgr::notifyObservers() { - lldebugs << "LLGestureManager::notifyObservers" << llendl; + lldebugs << "LLGestureMgr::notifyObservers" << llendl; std::vector<LLGestureManagerObserver*> observers = mObservers; @@ -1185,7 +1184,7 @@ void LLGestureManager::notifyObservers() } } -BOOL LLGestureManager::matchPrefix(const std::string& in_str, std::string* out_str) +BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { S32 in_len = in_str.length(); @@ -1216,7 +1215,7 @@ BOOL LLGestureManager::matchPrefix(const std::string& in_str, std::string* out_s } -void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids) +void LLGestureMgr::getItemIDs(uuid_vec_t* ids) { item_map_t::const_iterator it; for (it = mActive.begin(); it != mActive.end(); ++it) @@ -1225,7 +1224,7 @@ void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids) } } -void LLGestureManager::done() +void LLGestureMgr::done() { bool notify = false; for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it) diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index 3dd184ddc7..081ca983a9 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -54,7 +54,7 @@ public: virtual void changed() = 0; }; -class LLGestureManager : public LLSingleton<LLGestureManager>, public LLInventoryFetchObserver +class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchObserver { public: @@ -63,8 +63,8 @@ public: typedef std::map<LLUUID, LLMultiGesture*> item_map_t; typedef std::map<LLUUID, gesture_loaded_callback_t> callback_map_t; - LLGestureManager(); - ~LLGestureManager(); + LLGestureMgr(); + ~LLGestureMgr(); void init(); @@ -146,7 +146,7 @@ public: BOOL matchPrefix(const std::string& in_str, std::string* out_str); // Copy item ids into the vector - void getItemIDs(std::vector<LLUUID>* ids); + void getItemIDs(uuid_vec_t* ids); protected: // Handle the processing of a single gesture diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 8569e208eb..2aba0b5c09 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -71,99 +71,6 @@ // Height of the yellow selection highlight posts for land const F32 PARCEL_POST_HEIGHT = 0.666f; -BOOL LLAgent::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) -{ - if(object && object->isAttachment()) - { - LLViewerObject* parent = object; - while(parent) - { - if (parent == mAvatarObject) - { - // looking at an attachment on ourselves, which we don't want to do - object = mAvatarObject; - position.clearVec(); - } - parent = (LLViewerObject*)parent->getParent(); - } - } - if(!mLookAt || mLookAt->isDead()) - { - mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); - mLookAt->setSourceObject(mAvatarObject); - } - - return mLookAt->setLookAt(target_type, object, position); -} - -BOOL LLAgent::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) -{ - // disallow pointing at attachments and avatars - if (object && (object->isAttachment() || object->isAvatar())) - { - return FALSE; - } - - if(!mPointAt || mPointAt->isDead()) - { - mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); - mPointAt->setSourceObject(mAvatarObject); - } - - return mPointAt->setPointAt(target_type, object, position); -} - -ELookAtType LLAgent::getLookAtType() -{ - if (mLookAt) - { - return mLookAt->getLookAtType(); - } - - return LOOKAT_TARGET_NONE; -} - -EPointAtType LLAgent::getPointAtType() -{ - if (mPointAt) - { - return mPointAt->getPointAtType(); - } - - return POINTAT_TARGET_NONE; -} - -// Draw a representation of current autopilot target -void LLAgent::renderAutoPilotTarget() -{ - if (mAutoPilot) - { - F32 height_meters; - LLVector3d target_global; - - glMatrixMode(GL_MODELVIEW); - gGL.pushMatrix(); - - // not textured - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // lovely green - glColor4f(0.f, 1.f, 1.f, 1.f); - - target_global = mAutoPilotTargetGlobal; - - gGL.translatef((F32)(target_global.mdV[VX]), (F32)(target_global.mdV[VY]), (F32)(target_global.mdV[VZ])); - - height_meters = 1.f; - - glScalef(height_meters, height_meters, height_meters); - - gSphere.render(1500.f); - - gGL.popMatrix(); - } -} - // Returns true if you got at least one object void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) { diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 00e2365ffd..d4eecc8c48 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -105,7 +105,7 @@ public: { if (group_id.isNull()) return true; - LLGroupActions::show(group_id); + LLGroupActions::inspect(group_id); return true; } return false; @@ -246,6 +246,12 @@ static bool isGroupUIVisible() return panel->isInVisibleChain(); } +// static +void LLGroupActions::inspect(const LLUUID& group_id) +{ + LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", group_id)); +} + // static void LLGroupActions::show(const LLUUID& group_id) { diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h index e99df86cd9..55cae4db0b 100644 --- a/indra/newview/llgroupactions.h +++ b/indra/newview/llgroupactions.h @@ -66,6 +66,11 @@ public: static void show(const LLUUID& group_id); /** + * Show group inspector floater. + */ + static void inspect(const LLUUID& group_id); + + /** * Refresh group information panel. */ static void refresh(const LLUUID& group_id); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 7f93a357de..996553ccf7 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -160,7 +160,7 @@ LLGroupRoleData::~LLGroupRoleData() { } -S32 LLGroupRoleData::getMembersInRole(std::vector<LLUUID> members, +S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, BOOL needs_sort) { if (mRoleID.isNull()) @@ -184,8 +184,8 @@ S32 LLGroupRoleData::getMembersInRole(std::vector<LLUUID> members, // Return the number of members in the intersection. S32 max_size = llmin( members.size(), mMemberIDs.size() ); - std::vector<LLUUID> in_role( max_size ); - std::vector<LLUUID>::iterator in_role_end; + uuid_vec_t in_role( max_size ); + uuid_vec_t::iterator in_role_end; in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(), members.begin(), members.end(), in_role.begin()); @@ -200,7 +200,7 @@ void LLGroupRoleData::addMember(const LLUUID& member) bool LLGroupRoleData::removeMember(const LLUUID& member) { - std::vector<LLUUID>::iterator it = std::find(mMemberIDs.begin(),mMemberIDs.end(),member); + uuid_vec_t::iterator it = std::find(mMemberIDs.begin(),mMemberIDs.end(),member); if (it != mMemberIDs.end()) { @@ -1736,7 +1736,7 @@ void LLGroupMgr::sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID, //static void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, - std::vector<LLUUID>& member_ids) + uuid_vec_t& member_ids) { bool start_message = true; LLMessageSystem* msg = gMessageSystem; @@ -1746,7 +1746,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap) return; - for (std::vector<LLUUID>::iterator it = member_ids.begin(); + for (uuid_vec_t::iterator it = member_ids.begin(); it != member_ids.end(); ++it) { LLUUID& ejected_member_id = (*it); diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 2c86de8b97..82df631b8c 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -139,8 +139,8 @@ public: const LLUUID& getID() const { return mRoleID; } - const std::vector<LLUUID>& getRoleMembers() const { return mMemberIDs; } - S32 getMembersInRole(std::vector<LLUUID> members, BOOL needs_sort = TRUE); + const uuid_vec_t& getRoleMembers() const { return mMemberIDs; } + S32 getMembersInRole(uuid_vec_t members, BOOL needs_sort = TRUE); S32 getTotalMembersInRole() { return mMemberIDs.size(); } LLRoleData getRoleData() const { return mRoleData; } @@ -150,10 +150,10 @@ public: bool removeMember(const LLUUID& member); void clearMembers(); - const std::vector<LLUUID>::const_iterator getMembersBegin() const + const uuid_vec_t::const_iterator getMembersBegin() const { return mMemberIDs.begin(); } - const std::vector<LLUUID>::const_iterator getMembersEnd() const + const uuid_vec_t::const_iterator getMembersEnd() const { return mMemberIDs.end(); } @@ -164,7 +164,7 @@ protected: LLUUID mRoleID; LLRoleData mRoleData; - std::vector<LLUUID> mMemberIDs; + uuid_vec_t mMemberIDs; S32 mMemberCount; private: @@ -340,7 +340,7 @@ public: static void sendGroupMemberJoin(const LLUUID& group_id); static void sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,LLUUID>& role_member_pairs); static void sendGroupMemberEjects(const LLUUID& group_id, - std::vector<LLUUID>& member_ids); + uuid_vec_t& member_ids); void cancelGroupRoleChanges(const LLUUID& group_id); diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index 07b81ef134..3be0fcbc5f 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -38,6 +38,7 @@ #include "message.h" #include "llagent.h" +#include "llagentcamera.h" #include "llvoavatar.h" #include "lldrawable.h" #include "llviewerobjectlist.h" @@ -316,7 +317,7 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) LLUUID dataId; mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, dataId, blocknum); - if (!gAgent.mLookAt.isNull() && dataId == gAgent.mLookAt->getID()) + if (!gAgentCamera.mLookAt.isNull() && dataId == gAgentCamera.mLookAt->getID()) { return; } @@ -637,7 +638,7 @@ bool LLHUDEffectLookAt::calcTargetPosition() // mouselook and freelook target offsets are absolute target_rot = LLQuaternion::DEFAULT; } - else if (looking_at_self && gAgent.cameraCustomizeAvatar()) + else if (looking_at_self && gAgentCamera.cameraCustomizeAvatar()) { // *NOTE: We have to do this because animation // overrides do not set lookat behavior. diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index a13ee8572f..01dfb50b10 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -38,6 +38,7 @@ #include "llrender.h" #include "llagent.h" +#include "llagentcamera.h" #include "lldrawable.h" #include "llviewerobjectlist.h" #include "llvoavatar.h" @@ -152,7 +153,7 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, dataId, blocknum); // ignore messages from ourselves - if (!gAgent.mPointAt.isNull() && dataId == gAgent.mPointAt->getID()) + if (!gAgentCamera.mPointAt.isNull() && dataId == gAgentCamera.mPointAt->getID()) { return; } diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index dc55aba0db..2b73ed1dcd 100644 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -43,6 +43,7 @@ #include "llhudeffectbeam.h" #include "llhudeffecttrail.h" #include "llhudeffectlookat.h" +#include "llhudeffectpointat.h" #include "llvoicevisualizer.h" diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 95510fd49b..9704c7537a 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -44,6 +44,7 @@ #include "llchiclet.h" #include "llfloaterreg.h" #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container +#include "llinventoryfunctions.h" #include "lllayoutstack.h" #include "lllineeditor.h" #include "lllogchat.h" @@ -921,7 +922,7 @@ BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) { if(drop) { - std::vector<LLUUID> ids; + uuid_vec_t ids; ids.push_back(item->getCreatorUUID()); inviteToSession(ids); } @@ -954,7 +955,7 @@ BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) } else if(drop) { - std::vector<LLUUID> ids; + uuid_vec_t ids; ids.reserve(count); for(S32 i = 0; i < count; ++i) { @@ -991,7 +992,7 @@ private: LLUUID mSessionID; }; -BOOL LLIMFloater::inviteToSession(const std::vector<LLUUID>& ids) +BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) { LLViewerRegion* region = gAgent.getRegion(); if (!region) diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 2f034d02b8..763dd5655b 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -129,7 +129,7 @@ private: BOOL dropCategory(LLInventoryCategory* category, BOOL drop); BOOL isInviteAllowed() const; - BOOL inviteToSession(const std::vector<LLUUID>& agent_ids); + BOOL inviteToSession(const uuid_vec_t& agent_ids); static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ); static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 06c3a0be50..5201f92dbc 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -36,6 +36,7 @@ #include "llfloaterreg.h" #include "llfontgl.h" +#include "llgl.h" #include "llrect.h" #include "llerror.h" #include "llbutton.h" @@ -80,6 +81,9 @@ const static std::string ADHOC_NAME_SUFFIX(" Conference"); const static std::string NEARBY_P2P_BY_OTHER("nearby_P2P_by_other"); const static std::string NEARBY_P2P_BY_AGENT("nearby_P2P_by_agent"); +/** Timeout of outgoing session initialization (in seconds) */ +const static U32 SESSION_INITIALIZATION_TIMEOUT = 30; + std::string LLCallDialogManager::sPreviousSessionlName = ""; LLIMModel::LLIMSession::SType LLCallDialogManager::sPreviousSessionType = LLIMModel::LLIMSession::P2P_SESSION; std::string LLCallDialogManager::sCurrentSessionlName = ""; @@ -91,6 +95,19 @@ const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-141 // LLIMMgr* gIMMgr = NULL; + +BOOL LLSessionTimeoutTimer::tick() +{ + if (mSessionId.isNull()) return TRUE; + + LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId); + if (session && !session->mSessionInitialized) + { + gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId); + } + return TRUE; +} + void toast_callback(const LLSD& msg){ // do not show toast in busy mode or it goes from agent if (gAgent.getBusy() || gAgent.getID() == msg["from_id"]) @@ -146,7 +163,7 @@ LLIMModel::LLIMModel() addNewMsgCallback(toast_callback); } -LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice) +LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice) : mSessionID(session_id), mName(name), mType(type), @@ -214,6 +231,11 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& //so we're already initialized mSessionInitialized = true; } + else + { + //tick returns TRUE - timer will be deleted after the tick + new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT); + } if (IM_NOTHING_SPECIAL == type) { @@ -423,7 +445,7 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const } //*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code -LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const std::vector<LLUUID>& ids) +LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids) { S32 num = ids.size(); if (!num) return NULL; @@ -440,7 +462,7 @@ LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const std::vector<LLUUID>& std::list<LLUUID> tmp_list(session->mInitialTargetIDs.begin(), session->mInitialTargetIDs.end()); - std::vector<LLUUID>::const_iterator iter = ids.begin(); + uuid_vec_t::const_iterator iter = ids.begin(); while (iter != ids.end()) { tmp_list.remove(*iter); @@ -571,7 +593,7 @@ void LLIMModel::testMessages() //session name should not be empty bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, - const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice) + const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice) { if (name.empty()) { @@ -596,7 +618,7 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice) { - std::vector<LLUUID> no_ids; + uuid_vec_t no_ids; return newSession(session_id, name, type, other_participant_id, no_ids, voice); } @@ -1002,7 +1024,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text, } else { - for(std::vector<LLUUID>::iterator it = session->mInitialTargetIDs.begin(); + for(uuid_vec_t::iterator it = session->mInitialTargetIDs.begin(); it!=session->mInitialTargetIDs.end();++it) { const LLUUID id = *it; @@ -1134,7 +1156,7 @@ private: bool LLIMModel::sendStartSession( const LLUUID& temp_session_id, const LLUUID& other_participant_id, - const std::vector<LLUUID>& ids, + const uuid_vec_t& ids, EInstantMessage dialog) { if ( dialog == IM_SESSION_GROUP_START ) @@ -1538,6 +1560,11 @@ LLCallDialog::LLCallDialog(const LLSD& payload) setDocked(true); } +LLCallDialog::~LLCallDialog() +{ + LLUI::removePopup(this); +} + void LLCallDialog::getAllowedRect(LLRect& rect) { rect = gViewerWindow->getWorldViewRectScaled(); @@ -1591,7 +1618,7 @@ void LLCallDialog::onOpen(const LLSD& key) LLDockableFloater::onOpen(key); // it should be over the all floaters. EXT-5116 - gFloaterView->bringToFront(this, FALSE); + LLUI::addPopup(this); } void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index f1693d0e17..ffa8a16797 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -34,6 +34,7 @@ #define LL_LLIMVIEW_H #include "lldockablefloater.h" +#include "lleventtimer.h" #include "llinstantmessage.h" #include "lllogchat.h" @@ -45,7 +46,24 @@ class LLFriendObserver; class LLCallDialogManager; class LLIMSpeakerMgr; +/** + * Timeout Timer for outgoing Ad-Hoc/Group IM sessions which being initialized by the server + */ +class LLSessionTimeoutTimer : public LLEventTimer +{ +public: + LLSessionTimeoutTimer(const LLUUID& session_id, F32 period) : LLEventTimer(period), mSessionId(session_id) {} + virtual ~LLSessionTimeoutTimer() {}; + /* virtual */ BOOL tick(); + +private: + LLUUID mSessionId; +}; + +/** + * Model (MVC) for IM Sessions + */ class LLIMModel : public LLSingleton<LLIMModel> { public: @@ -61,7 +79,7 @@ public: } SType; LLIMSession(const LLUUID& session_id, const std::string& name, - const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice); + const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice); virtual ~LLIMSession(); void sessionInitReplyReceived(const LLUUID& new_session_id); @@ -93,7 +111,7 @@ public: EInstantMessage mType; SType mSessionType; LLUUID mOtherParticipantID; - std::vector<LLUUID> mInitialTargetIDs; + uuid_vec_t mInitialTargetIDs; std::string mHistoryFileName; // connection to voice channel state change signal @@ -152,7 +170,7 @@ public: * Find an Ad-Hoc IM Session with specified participants * @return first found Ad-Hoc session or NULL if the session does not exist */ - LLIMSession* findAdHocIMSession(const std::vector<LLUUID>& ids); + LLIMSession* findAdHocIMSession(const uuid_vec_t& ids); /** * Rebind session data to a new session id. @@ -167,7 +185,7 @@ public: * @param name session name should not be empty, will return false if empty */ bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, - const std::vector<LLUUID>& ids, bool voice = false); + const uuid_vec_t& ids, bool voice = false); bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice = false); @@ -255,7 +273,7 @@ public: static void sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id); static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id, - const std::vector<LLUUID>& ids, EInstantMessage dialog); + const uuid_vec_t& ids, EInstantMessage dialog); static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing); static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id, const LLUUID& other_participant_id, EInstantMessage dialog); @@ -477,7 +495,7 @@ class LLCallDialog : public LLDockableFloater { public: LLCallDialog(const LLSD& payload); - ~LLCallDialog() {} + ~LLCallDialog(); virtual BOOL postBuild(); diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index dfc69db3f1..1299324105 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -137,6 +137,7 @@ private: void onVolumeChange(const LLSD& data); bool enableMute(); bool enableUnmute(); + bool enableTeleportOffer(); // Is used to determine if "Add friend" option should be enabled in gear menu bool isNotFriend(); @@ -235,6 +236,7 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd) boost::bind(&LLInspectAvatar::onVisibleZoomIn, this)); mEnableCallbackRegistrar.add("InspectAvatar.Gear.Enable", boost::bind(&LLInspectAvatar::isNotFriend, this)); mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableCall", boost::bind(&LLAvatarActions::canCall)); + mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableTeleportOffer", boost::bind(&LLInspectAvatar::enableTeleportOffer, this)); mEnableCallbackRegistrar.add("InspectAvatar.EnableMute", boost::bind(&LLInspectAvatar::enableMute, this)); mEnableCallbackRegistrar.add("InspectAvatar.EnableUnmute", boost::bind(&LLInspectAvatar::enableUnmute, this)); @@ -764,6 +766,11 @@ bool LLInspectAvatar::enableUnmute() } } +bool LLInspectAvatar::enableTeleportOffer() +{ + return LLAvatarActions::canOfferTeleport(mAvatarID); +} + ////////////////////////////////////////////////////////////////////////////// // LLInspectAvatarUtil ////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 6fedd9ac4d..0fbf3148ac 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -31,12 +31,15 @@ */ #include "llviewerprecompiledheaders.h" +#include "llinventorybridge.h" + // external projects #include "lltransfersourceasset.h" -#include "llinventorybridge.h" + #include "llagent.h" +#include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" #include "llavataractions.h" @@ -51,6 +54,7 @@ #include "llinventoryclipboard.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "llnotifications.h" #include "llnotificationsutil.h" @@ -192,7 +196,7 @@ BOOL LLInvFVBridge::isItemRemovable() const } // Disable delete from COF folder; have users explicitly choose "detach/take off". - if (LLAppearanceManager::instance().getIsProtectedCOFItem(mUUID)) + if (LLAppearanceMgr::instance().getIsProtectedCOFItem(mUUID)) { return FALSE; } @@ -259,7 +263,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc { if(LLAssetType::AT_GESTURE == item->getType()) { - LLGestureManager::instance().deactivateGesture(item->getUUID()); + LLGestureMgr::instance().deactivateGesture(item->getUUID()); } } } @@ -275,7 +279,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc { if(LLAssetType::AT_GESTURE == descendent_items[j]->getType()) { - LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID()); + LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID()); } } } @@ -296,7 +300,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener* LLMessageSystem* msg = gMessageSystem; const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); LLViewerInventoryItem* item = NULL; - std::vector<LLUUID> move_ids; + uuid_vec_t move_ids; LLInventoryModel::update_map_t update; bool start_new_message = true; S32 count = batch.count(); @@ -397,8 +401,8 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener* } // move everything. - std::vector<LLUUID>::iterator it = move_ids.begin(); - std::vector<LLUUID>::iterator end = move_ids.end(); + uuid_vec_t::iterator it = move_ids.begin(); + uuid_vec_t::iterator end = move_ids.end(); for(; it != end; ++it) { gInventory.moveObject((*it), trash_id); @@ -592,7 +596,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); if (inv_item) { - is_asset_knowable = is_asset_id_knowable(inv_item->getType()); + is_asset_knowable = LLAssetType::lookupIsAssetIDKnowable(inv_item->getType()); } if ( !is_asset_knowable // disable menu item for Inventory items with unknown asset. EXT-5308 || (! ( isItemPermissive() || gAgent.isGodlike() ) ) @@ -728,7 +732,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const if (*type == DAD_CATEGORY) { - gInventory.startBackgroundFetch(obj->getUUID()); + LLInventoryModelBackgroundFetch::instance().start(obj->getUUID()); } rv = TRUE; @@ -801,7 +805,7 @@ BOOL LLInvFVBridge::isAgentInventory() const BOOL LLInvFVBridge::isCOFFolder() const { - return LLAppearanceManager::instance().getIsInCOF(mUUID); + return LLAppearanceMgr::instance().getIsInCOF(mUUID); } BOOL LLInvFVBridge::isItemPermissive() const @@ -1505,14 +1509,10 @@ BOOL LLFolderBridge::isItemRemovable() const return FALSE; } - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( !avatar ) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; LLInventoryCategory* category = model->getCategory(mUUID); - if( !category ) + if(!category) { return FALSE; } @@ -1660,8 +1660,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(!avatar) return FALSE; + if (!isAgentAvatarValid()) return FALSE; // cannot drag categories into library if(!isAgentInventory()) @@ -1747,9 +1746,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { LLInventoryItem* item = descendent_items[i]; if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(item->getUUID())) + && LLGestureMgr::instance().isGestureActive(item->getUUID())) { - LLGestureManager::instance().deactivateGesture(item->getUUID()); + LLGestureMgr::instance().deactivateGesture(item->getUUID()); } } } @@ -1762,7 +1761,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { // traverse category and add all contents to currently worn. BOOL append = true; - LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append); + LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append); } else { @@ -1770,7 +1769,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH); - LLAppearanceManager::instance().linkAll(mUUID,items,NULL); + LLAppearanceMgr::instance().linkAll(mUUID,items,NULL); } } else @@ -1779,7 +1778,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // BAP - should skip if dup. if (move_is_into_current_outfit) { - LLAppearanceManager::instance().addEnsembleLink(inv_cat); + LLAppearanceMgr::instance().addEnsembleLink(inv_cat); } else { @@ -1926,50 +1925,6 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, return accept; } -bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - // Valid COF items are: - // - links to wearables (body parts or clothing) - // - links to attachments - // - links to gestures - // - links to ensemble folders - LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem(); - if (linked_item) - { - LLAssetType::EType type = linked_item->getType(); - return (type == LLAssetType::AT_CLOTHING || - type == LLAssetType::AT_BODYPART || - type == LLAssetType::AT_GESTURE || - type == LLAssetType::AT_OBJECT); - } - else - { - LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory(); - // BAP remove AT_NONE support after ensembles are fully working? - return (linked_category && - ((linked_category->getPreferredType() == LLFolderType::FT_NONE) || - (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType())))); - } -} - - -bool LLFindWearables::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - if(item) - { - if((item->getType() == LLAssetType::AT_CLOTHING) - || (item->getType() == LLAssetType::AT_BODYPART)) - { - return TRUE; - } - } - return FALSE; -} - - - //Used by LLFolderBridge as callback for directory recursion. class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver { @@ -2137,7 +2092,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) mContentsCount) { gInventory.removeObserver(this); - LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE); + LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE); delete this; } } @@ -2187,7 +2142,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model if(!model) return; LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; - LLAppearanceManager::instance().addEnsembleLink(cat,true); + LLAppearanceMgr::instance().addEnsembleLink(cat,true); return; } #endif @@ -2417,9 +2372,9 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re const LLViewerInventoryItem* item = (*iter); const LLUUID& item_id = item->getUUID(); if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(item_id)) + && LLGestureMgr::instance().isGestureActive(item_id)) { - LLGestureManager::instance().deactivateGesture(item_id); + LLGestureMgr::instance().deactivateGesture(item_id); } } @@ -2722,7 +2677,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) addDeleteContextMenuOptions(mItems, mDisabledItems); // EXT-4030: disallow deletion of currently worn outfit - const LLViewerInventoryItem *base_outfit_link = LLAppearanceManager::instance().getBaseOutfitLink(); + const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory())) { mDisabledItems.push_back(std::string("Delete")); @@ -2754,7 +2709,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) sSelf = this; LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE); - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + uuid_vec_t folders; LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); if (category) { @@ -2970,7 +2925,7 @@ void LLFolderBridge::modifyOutfit(BOOL append) LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; - LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append ); + LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append ); } // helper stuff @@ -3025,8 +2980,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, return FALSE; } - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(!avatar) return FALSE; + if (!isAgentAvatarValid()) return FALSE; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL accept = FALSE; @@ -3048,7 +3002,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_outof_current_outfit = LLAppearanceManager::instance().getIsInCOF(inv_item->getUUID()); + const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) @@ -3080,9 +3034,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if(accept && drop) { if (inv_item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) + && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) { - LLGestureManager::instance().deactivateGesture(inv_item->getUUID()); + LLGestureMgr::instance().deactivateGesture(inv_item->getUUID()); } // If an item is being dragged between windows, unselect // everything in the active window so that we don't follow @@ -3135,7 +3089,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // BAP - should skip if dup. if (move_is_into_current_outfit) { - LLAppearanceManager::instance().addCOFItemLink(inv_item); + LLAppearanceMgr::instance().addCOFItemLink(inv_item); } else { @@ -3794,7 +3748,7 @@ LLUIImagePtr LLGestureBridge::getIcon() const LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const { - if( LLGestureManager::instance().isGestureActive(mUUID) ) + if( LLGestureMgr::instance().isGestureActive(mUUID) ) { return LLFontGL::BOLD; } @@ -3806,7 +3760,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const std::string LLGestureBridge::getLabelSuffix() const { - if( LLGestureManager::instance().isGestureActive(mUUID) ) + if( LLGestureMgr::instance().isGestureActive(mUUID) ) { LLStringUtil::format_map_t args; args["[GESLABEL]"] = LLItemBridge::getLabelSuffix(); @@ -3823,7 +3777,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode { if (isAddAction(action)) { - LLGestureManager::instance().activateGesture(mUUID); + LLGestureMgr::instance().activateGesture(mUUID); LLViewerInventoryItem* item = gInventory.getItem(mUUID); if (!item) return; @@ -3835,7 +3789,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode } else if (isRemoveAction(action)) { - LLGestureManager::instance().deactivateGesture(mUUID); + LLGestureMgr::instance().deactivateGesture(mUUID); LLViewerInventoryItem* item = gInventory.getItem(mUUID); if (!item) return; @@ -3847,17 +3801,17 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode } else if("play" == action) { - if(!LLGestureManager::instance().isGestureActive(mUUID)) + if(!LLGestureMgr::instance().isGestureActive(mUUID)) { // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList. BOOL inform_server = TRUE; BOOL deactivate_similar = FALSE; - LLGestureManager::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID)); + LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID)); LLViewerInventoryItem* item = gInventory.getItem(mUUID); llassert(item); if (item) { - LLGestureManager::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar); + LLGestureMgr::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar); } } else @@ -3899,7 +3853,7 @@ BOOL LLGestureBridge::removeItem() // This will also force close the preview window, if it exists. // This may actually delete *this, if mUUID is in the COF. - LLGestureManager::instance().deactivateGesture(item_id); + LLGestureMgr::instance().deactivateGesture(item_id); // If deactivateGesture deleted *this, then return out immediately. if (!model->getObject(item_id)) @@ -3932,7 +3886,7 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) getClipboardEntries(true, items, disabled_items, flags); items.push_back(std::string("Gesture Separator")); - if (LLGestureManager::instance().isGestureActive(getUUID())) + if (LLGestureMgr::instance().isGestureActive(getUUID())) { items.push_back(std::string("Deactivate")); } @@ -3947,13 +3901,13 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // static void LLGestureBridge::playGesture(const LLUUID& item_id) { - if (LLGestureManager::instance().isGesturePlaying(item_id)) + if (LLGestureMgr::instance().isGesturePlaying(item_id)) { - LLGestureManager::instance().stopGesture(item_id); + LLGestureMgr::instance().stopGesture(item_id); } else { - LLGestureManager::instance().playGesture(item_id); + LLGestureMgr::instance().playGesture(item_id); } } @@ -4154,8 +4108,7 @@ std::string LLObjectBridge::getLabelSuffix() const { if (get_is_item_worn(mUUID)) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - std::string attachment_point_name = avatar->getAttachedPointName(mUUID); + std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID); // e.g. "(worn on ...)" / "(attached to ...)" LLStringUtil::format_map_t args; @@ -4174,10 +4127,10 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link. S32 attach_pt = 0; - if (gAgent.getAvatarObject() && attachment) + if (isAgentAvatarValid() && attachment) { - for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin(); - iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) { if (iter->second == attachment) { @@ -4203,9 +4156,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response) { - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - - if (!avatarp->canAttachMoreObjects()) + if (!gAgentAvatarp->canAttachMoreObjects()) { LLSD args; args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS); @@ -4267,11 +4218,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryItem *item = getItem(); if(item) { - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if( !avatarp ) - { - return; - } + if (!isAgentAvatarValid()) return; if( get_is_item_worn( mUUID ) ) { @@ -4287,7 +4234,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // commented out for DEV-32347 //items.push_back(std::string("Restore to Last Position")); - if (!avatarp->canAttachMoreObjects()) + if (!gAgentAvatarp->canAttachMoreObjects()) { disabled_items.push_back(std::string("Object Wear")); disabled_items.push_back(std::string("Attach To")); @@ -4295,15 +4242,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE); LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE); - LLVOAvatar *avatarp = gAgent.getAvatarObject(); if (attach_menu && (attach_menu->getChildCount() == 0) && attach_hud_menu && (attach_hud_menu->getChildCount() == 0) - && avatarp) + && isAgentAvatarValid()) { - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + 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; @@ -4353,11 +4299,10 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) model->notifyObservers(); - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar ) + if (isAgentAvatarValid()) { - LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); - if( obj ) + LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() ); + if(obj) { LLSelectMgr::getInstance()->deselectAll(); LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); @@ -4409,7 +4354,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item ) lldebugs << "wear_inventory_item_on_avatar( " << item->getName() << " )" << llendl; - LLAppearanceManager::instance().addCOFItemLink(item); + LLAppearanceMgr::instance().addCOFItemLink(item); } } @@ -4546,7 +4491,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ LLViewerInventoryItem *gest_item = gest_item_array.get(i); if (get_is_item_worn(gest_item->getUUID())) { - LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() ); + LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() ); gInventory.updateItem( gest_item ); gInventory.notifyObservers(); } @@ -4906,10 +4851,10 @@ void LLWearableBridge::editOnAvatar() if (gFloaterCustomize) gFloaterCustomize->setCurrentWearableType( wearable->getType() ); - if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() ) + if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() ) { // Start Avatar Customization - gAgent.changeCameraToCustomizeAvatar(); + gAgentCamera.changeCameraToCustomizeAvatar(); } } } @@ -4960,28 +4905,15 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&& //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) { - // MULTI_WEARABLE: FIXME HACK - always remove all bool do_remove_all = false; - gAgentWearables.removeWearable( type, do_remove_all, 0 ); + U32 index = gAgentWearables.getWearableIndex(wearable); + gAgentWearables.removeWearable( type, do_remove_all, index ); } } } // Find and remove this item from the COF. - // FIXME 2.1 - call removeCOFItemLinks in llappearancemgr instead. - LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF()); - if (items.size() != 1) - { - llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl; - } - for (LLInventoryModel::item_array_t::const_iterator iter = items.begin(); - iter != items.end(); - ++iter) - { - const LLViewerInventoryItem *linked_item = (*iter); - const LLUUID &item_id = linked_item->getUUID(); - gInventory.purgeObject(item_id); - } + LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); gInventory.notifyObservers(); delete on_remove_struct; @@ -5007,20 +4939,7 @@ void LLWearableBridge::removeAllClothesFromAvatar() continue; // Find and remove this item from the COF. - LLInventoryModel::item_array_t items = gInventory.collectLinkedItems( - item_id, LLAppearanceManager::instance().getCOF()); - if (items.size() != 1) - { - llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl; - } - for (LLInventoryModel::item_array_t::const_iterator iter = items.begin(); - iter != items.end(); - ++iter) - { - const LLViewerInventoryItem *linked_item = (*iter); - const LLUUID &item_id = linked_item->getUUID(); - gInventory.purgeObject(item_id); - } + LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); } gInventory.notifyObservers(); diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index cd20d64ca8..1a488175ac 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -37,7 +37,8 @@ // viewer includes #include "llfoldervieweventlistener.h" #include "llfolderviewitem.h" -#include "llinventorymodel.h" // gInventory.backgroundFetchActive() +#include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" #include "llviewercontrol.h" #include "llfolderview.h" @@ -713,7 +714,7 @@ const std::string& LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (!gInventory.backgroundFetchActive() + if (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && filtered_by_type && !filtered_by_all_types) { diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 3553137f53..3e16dfea5f 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -86,6 +86,218 @@ BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; + +///---------------------------------------------------------------------------- +/// LLInventoryCollectFunctor implementations +///---------------------------------------------------------------------------- + +// static +bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item) +{ + if (!item) + return false; + + bool allowed = false; + + switch(item->getType()) + { + case LLAssetType::AT_CALLINGCARD: + // not allowed + break; + + case LLAssetType::AT_OBJECT: + if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID())) + { + allowed = true; + } + break; + + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_CLOTHING: + if(!gAgentWearables.isWearingItem(item->getUUID())) + { + allowed = true; + } + break; + + default: + allowed = true; + break; + } + + return allowed; +} + +bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) +{ + if(mType == LLAssetType::AT_CATEGORY) + { + if(cat) return TRUE; + } + if(item) + { + if(item->getType() == mType) return TRUE; + } + return FALSE; +} + +bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) +{ + if(mType == LLAssetType::AT_CATEGORY) + { + if(cat) return FALSE; + } + if(item) + { + if(item->getType() == mType) return FALSE; + else return TRUE; + } + return TRUE; +} + +bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item) +{ + if(mType == LLAssetType::AT_CATEGORY) + { + if(cat) + { + return TRUE; + } + } + if(item) + { + if(item->getType() == mType) + { + LLPermissions perm = item->getPermissions(); + if ((perm.getMaskBase() & mPerm) == mPerm) + { + return TRUE; + } + } + } + return FALSE; +} + +bool LLBuddyCollector::operator()(LLInventoryCategory* cat, + LLInventoryItem* item) +{ + if(item) + { + if((LLAssetType::AT_CALLINGCARD == item->getType()) + && (!item->getCreatorUUID().isNull()) + && (item->getCreatorUUID() != gAgent.getID())) + { + return true; + } + } + return false; +} + + +bool LLUniqueBuddyCollector::operator()(LLInventoryCategory* cat, + LLInventoryItem* item) +{ + if(item) + { + if((LLAssetType::AT_CALLINGCARD == item->getType()) + && (item->getCreatorUUID().notNull()) + && (item->getCreatorUUID() != gAgent.getID())) + { + mSeen.insert(item->getCreatorUUID()); + return true; + } + } + return false; +} + + +bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat, + LLInventoryItem* item) +{ + if(item) + { + if((LLAssetType::AT_CALLINGCARD == item->getType()) + && (item->getCreatorUUID() == mBuddyID)) + { + return TRUE; + } + } + return FALSE; +} + + +bool LLNameCategoryCollector::operator()( + LLInventoryCategory* cat, LLInventoryItem* item) +{ + if(cat) + { + if (!LLStringUtil::compareInsensitive(mName, cat->getName())) + { + return true; + } + } + return false; +} + +bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat, + LLInventoryItem* item) +{ + // Valid COF items are: + // - links to wearables (body parts or clothing) + // - links to attachments + // - links to gestures + // - links to ensemble folders + LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem(); + if (linked_item) + { + LLAssetType::EType type = linked_item->getType(); + return (type == LLAssetType::AT_CLOTHING || + type == LLAssetType::AT_BODYPART || + type == LLAssetType::AT_GESTURE || + type == LLAssetType::AT_OBJECT); + } + else + { + LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory(); + // BAP remove AT_NONE support after ensembles are fully working? + return (linked_category && + ((linked_category->getPreferredType() == LLFolderType::FT_NONE) || + (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType())))); + } +} + +bool LLFindWearables::operator()(LLInventoryCategory* cat, + LLInventoryItem* item) +{ + if(item) + { + if((item->getType() == LLAssetType::AT_CLOTHING) + || (item->getType() == LLAssetType::AT_BODYPART)) + { + return TRUE; + } + } + return FALSE; +} + +///---------------------------------------------------------------------------- +/// LLAssetIDMatches +///---------------------------------------------------------------------------- +bool LLAssetIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item) +{ + return (item && item->getAssetUUID() == mAssetID); +} + +///---------------------------------------------------------------------------- +/// LLLinkedItemIDMatches +///---------------------------------------------------------------------------- +bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item) +{ + return (item && + (item->getIsLinkType()) && + (item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID. +} + void LLSaveFolderState::setApply(BOOL apply) { mApply = apply; @@ -352,8 +564,7 @@ BOOL get_is_item_worn(const LLUUID& id) { case LLAssetType::AT_OBJECT: { - const LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); - if(my_avatar && my_avatar->isWearingAttachment(item->getLinkedUUID())) + if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) return TRUE; break; } @@ -363,7 +574,7 @@ BOOL get_is_item_worn(const LLUUID& id) return TRUE; break; case LLAssetType::AT_GESTURE: - if (LLGestureManager::instance().isGestureActive(item->getLinkedUUID())) + if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID())) return TRUE; break; default: diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 968db84819..eb33763670 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -38,15 +38,221 @@ #include "llfolderview.h" #include "llfolderviewitem.h" +/******************************************************************************** + ** ** + ** INVENTORY COLLECTOR FUNCTIONS + **/ + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryCollectFunctor +// +// Base class for LLInventoryModel::collectDescendentsIf() method +// which accepts an instance of one of these objects to use as the +// function to determine if it should be added. Derive from this class +// and override the () operator to return TRUE if you want to collect +// the category or item passed in. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLInventoryCollectFunctor +{ +public: + virtual ~LLInventoryCollectFunctor(){}; + virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0; + + static bool itemTransferCommonlyAllowed(LLInventoryItem* item); +}; + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLAssetIDMatches +// +// This functor finds inventory items pointing to the specified asset +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLViewerInventoryItem; + +class LLAssetIDMatches : public LLInventoryCollectFunctor +{ +public: + LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {} + virtual ~LLAssetIDMatches() {} + bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); + +protected: + LLUUID mAssetID; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLLinkedItemIDMatches +// +// This functor finds inventory items linked to the specific inventory id. +// Assumes the inventory id is itself not a linked item. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLLinkedItemIDMatches : public LLInventoryCollectFunctor +{ +public: + LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {} + virtual ~LLLinkedItemIDMatches() {} + bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); + +protected: + LLUUID mBaseItemID; +}; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLIsType // -// This is a collection of miscellaneous functions and classes -// that don't fit cleanly into any other class header. Eventually, -// we should figure out where to put these functions so that we can -// get rid of this generic file. +// Implementation of a LLInventoryCollectFunctor which returns TRUE if +// the type is the type passed in during construction. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLIsType : public LLInventoryCollectFunctor +{ +public: + LLIsType(LLAssetType::EType type) : mType(type) {} + virtual ~LLIsType() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +protected: + LLAssetType::EType mType; +}; + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLIsNotType // +// Implementation of a LLInventoryCollectFunctor which returns FALSE if the +// type is the type passed in during construction, otherwise false. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLIsNotType : public LLInventoryCollectFunctor +{ +public: + LLIsNotType(LLAssetType::EType type) : mType(type) {} + virtual ~LLIsNotType() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +protected: + LLAssetType::EType mType; +}; + +class LLIsTypeWithPermissions : public LLInventoryCollectFunctor +{ +public: + LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id) + : mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {} + virtual ~LLIsTypeWithPermissions() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +protected: + LLAssetType::EType mType; + PermissionBit mPerm; + LLUUID mAgentID; + LLUUID mGroupID; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLBuddyCollector +// +// Simple class that collects calling cards that are not null, and not +// the agent. Duplicates are possible. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLBuddyCollector : public LLInventoryCollectFunctor +{ +public: + LLBuddyCollector() {} + virtual ~LLBuddyCollector() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLUniqueBuddyCollector +// +// Simple class that collects calling cards that are not null, and not +// the agent. Duplicates are discarded. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLUniqueBuddyCollector : public LLInventoryCollectFunctor +{ +public: + LLUniqueBuddyCollector() {} + virtual ~LLUniqueBuddyCollector() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); + +protected: + std::set<LLUUID> mSeen; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLParticularBuddyCollector +// +// Simple class that collects calling cards that match a particular uuid +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLParticularBuddyCollector : public LLInventoryCollectFunctor +{ +public: + LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {} + virtual ~LLParticularBuddyCollector() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +protected: + LLUUID mBuddyID; +}; + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLNameCategoryCollector +// +// Collects categories based on case-insensitive match of prefix +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLNameCategoryCollector : public LLInventoryCollectFunctor +{ +public: + LLNameCategoryCollector(const std::string& name) : mName(name) {} + virtual ~LLNameCategoryCollector() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +protected: + std::string mName; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFindCOFValidItems +// +// Collects items that can be legitimately linked to in the COF. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLFindCOFValidItems : public LLInventoryCollectFunctor +{ +public: + LLFindCOFValidItems() {} + virtual ~LLFindCOFValidItems() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); + +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFindWearables +// +// Collects wearables based on item type. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLFindWearables : public LLInventoryCollectFunctor +{ +public: + LLFindWearables() {} + virtual ~LLFindWearables() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +}; + +/** Inventory Collector Functions + ** ** + *******************************************************************************/ + class LLInventoryState { public: diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c10cdd9efd..b6202c6a8c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -57,32 +57,16 @@ #include "process.h" #endif -BOOL LLInventoryModel::sBackgroundFetchActive = FALSE; -BOOL LLInventoryModel::sAllFoldersFetched = FALSE; -BOOL LLInventoryModel::sMyInventoryFetchStarted = FALSE; -BOOL LLInventoryModel::sLibraryFetchStarted = FALSE; -S32 LLInventoryModel::sNumFetchRetries = 0; -F32 LLInventoryModel::sMinTimeBetweenFetches = 0.3f; -F32 LLInventoryModel::sMaxTimeBetweenFetches = 10.f; -BOOL LLInventoryModel::sTimelyFetchPending = FALSE; -LLFrameTimer LLInventoryModel::sFetchTimer; -S16 LLInventoryModel::sBulkFetchCount = 0; -BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; - // Increment this if the inventory contents change in a non-backwards-compatible way. // For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect. const S32 LLInventoryModel::sCurrentInvCacheVersion = 2; - -// RN: for some reason, using std::queue in the header file confuses the compiler which things it's an xmlrpc_queue -static std::deque<LLUUID> sFetchQueue; +BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- //BOOL decompress_file(const char* src_filename, const char* dst_filename); -const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f; -const S32 MAX_FETCH_RETRIES = 10; const char CACHE_FORMAT_STRING[] = "%s.inv"; struct InventoryIDPtrLess @@ -1345,548 +1329,6 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) return cat->fetchDescendents(); } -//Initialize statics. -bool LLInventoryModel::isBulkFetchProcessingComplete() -{ - return sFetchQueue.empty() && sBulkFetchCount<=0; -} - -class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder -{ - public: - LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; - //LLInventoryModelFetchDescendentsResponder() {}; - void result(const LLSD& content); - void error(U32 status, const std::string& reason); - public: - typedef std::vector<LLViewerInventoryCategory*> folder_ref_t; - protected: - LLSD mRequestSD; -}; - -//If we get back a normal response, handle it here -void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) -{ - if (content.has("folders")) - { - - for(LLSD::array_const_iterator folder_it = content["folders"].beginArray(); - folder_it != content["folders"].endArray(); - ++folder_it) - { - LLSD folder_sd = *folder_it; - - - //LLUUID agent_id = folder_sd["agent_id"]; - - //if(agent_id != gAgent.getID()) //This should never happen. - //{ - // llwarns << "Got a UpdateInventoryItem for the wrong agent." - // << llendl; - // break; - //} - - LLUUID parent_id = folder_sd["folder_id"]; - LLUUID owner_id = folder_sd["owner_id"]; - S32 version = (S32)folder_sd["version"].asInteger(); - S32 descendents = (S32)folder_sd["descendents"].asInteger(); - LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id); - - if (parent_id.isNull()) - { - LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; - for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray(); - item_it != folder_sd["items"].endArray(); - ++item_it) - { - const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - if (lost_uuid.notNull()) - { - LLSD item = *item_it; - titem->unpackMessage(item); - - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - - titem->setParent(lost_uuid); - titem->updateParentOnServer(FALSE); - gInventory.updateItem(titem); - gInventory.notifyObservers("fetchDescendents"); - - } - } - } - - LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id); - if (!pcat) - { - continue; - } - - for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray(); - category_it != folder_sd["categories"].endArray(); - ++category_it) - { - LLSD category = *category_it; - tcategory->fromLLSD(category); - - if (LLInventoryModel::sMyInventoryFetchStarted || - LLInventoryModel::sLibraryFetchStarted) - { - sFetchQueue.push_back(tcategory->getUUID()); - } - else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) ) - { - gInventory.updateCategory(tcategory); - } - - } - LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; - for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray(); - item_it != folder_sd["items"].endArray(); - ++item_it) - { - LLSD item = *item_it; - titem->unpackMessage(item); - - gInventory.updateItem(titem); - } - - // set version and descendentcount according to message. - LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); - if(cat) - { - cat->setVersion(version); - cat->setDescendentCount(descendents); - cat->determineFolderType(); - } - - } - } - - if (content.has("bad_folders")) - { - for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray(); - folder_it != content["bad_folders"].endArray(); - ++folder_it) - { - LLSD folder_sd = *folder_it; - - //These folders failed on the dataserver. We probably don't want to retry them. - llinfos << "Folder " << folder_sd["folder_id"].asString() - << "Error: " << folder_sd["error"].asString() << llendl; - } - } - - LLInventoryModel::incrBulkFetch(-1); - - if (LLInventoryModel::isBulkFetchProcessingComplete()) - { - llinfos << "Inventory fetch completed" << llendl; - LLInventoryModel::setAllFoldersFetched(); - } - - gInventory.notifyObservers("fetchDescendents"); -} - -//If we get back an error (not found, etc...), handle it here -void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason) -{ - llinfos << "LLInventoryModelFetchDescendentsResponder::error " - << status << ": " << reason << llendl; - - LLInventoryModel::incrBulkFetch(-1); - - if (status==499) //timed out. Let's be awesome! - { - for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray(); - folder_it != mRequestSD["folders"].endArray(); - ++folder_it) - { - LLSD folder_sd = *folder_it; - LLUUID folder_id = folder_sd["folder_id"]; - sFetchQueue.push_front(folder_id); - } - } - else - { - if (LLInventoryModel::isBulkFetchProcessingComplete()) - { - LLInventoryModel::setAllFoldersFetched(); - } - } - gInventory.notifyObservers("fetchDescendents"); -} - -//static Bundle up a bunch of requests to send all at once. -void LLInventoryModel::bulkFetch(std::string url) -{ - //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped. - //If there are items in sFetchQueue, we want to check the time since the last bulkFetch was - //sent. If it exceeds our retry time, go ahead and fire off another batch. - //Stopbackgroundfetch will be run from the Responder instead of here. - - S16 max_concurrent_fetches=8; - F32 new_min_time = 0.5f; //HACK! Clean this up when old code goes away entirely. - if (sMinTimeBetweenFetches < new_min_time) sMinTimeBetweenFetches=new_min_time; //HACK! See above. - - if(gDisconnected - || sBulkFetchCount > max_concurrent_fetches - || sFetchTimer.getElapsedTimeF32() < sMinTimeBetweenFetches) - { - return; // just bail if we are disconnected. - } - - U32 folder_count=0; - U32 max_batch_size=5; - - U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1; - - LLSD body; - LLSD body_lib; - while( !(sFetchQueue.empty() ) && (folder_count < max_batch_size) ) - { - if (sFetchQueue.front().isNull()) //DEV-17797 - { - LLSD folder_sd; - folder_sd["folder_id"] = LLUUID::null.asString(); - folder_sd["owner_id"] = gAgent.getID(); - folder_sd["sort_order"] = (LLSD::Integer)sort_order; - folder_sd["fetch_folders"] = (LLSD::Boolean)FALSE; - folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; - body["folders"].append(folder_sd); - folder_count++; - } - else - { - - - LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front()); - - if (cat) - { - if ( LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) - { - LLSD folder_sd; - folder_sd["folder_id"] = cat->getUUID(); - folder_sd["owner_id"] = cat->getOwnerID(); - folder_sd["sort_order"] = (LLSD::Integer)sort_order; - folder_sd["fetch_folders"] = TRUE; //(LLSD::Boolean)sFullFetchStarted; - folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; - - if (gAgent.getID() == cat->getOwnerID()) - { - body["folders"].append(folder_sd); - } - else - { - body_lib["folders"].append(folder_sd); - } - - folder_count++; - } - if (sMyInventoryFetchStarted || - sLibraryFetchStarted) - { //Already have this folder but append child folders to list. - // add all children to queue - parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID()); - if (cat_it != gInventory.mParentChildCategoryTree.end()) - { - cat_array_t* child_categories = cat_it->second; - - for (S32 child_num = 0; child_num < child_categories->count(); child_num++) - { - sFetchQueue.push_back(child_categories->get(child_num)->getUUID()); - } - } - - } - } - } - sFetchQueue.pop_front(); - } - - if (folder_count > 0) - { - sBulkFetchCount++; - if (body["folders"].size()) - { - LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0); - } - if (body_lib["folders"].size()) - { - std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents"); - LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0); - } - sFetchTimer.reset(); - } - else if (isBulkFetchProcessingComplete()) - { - setAllFoldersFetched(); - } -} - -bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) -{ - for (std::deque<LLUUID>::iterator it = sFetchQueue.begin(); - it != sFetchQueue.end(); ++it) - { - const LLUUID& fetch_id = *it; - if (gInventory.isObjectDescendentOf(fetch_id, cat_id)) - return false; - } - return true; -} - -/* static */ -bool LLInventoryModel::libraryFetchStarted() -{ - return sLibraryFetchStarted; -} - -/* static */ -bool LLInventoryModel::libraryFetchCompleted() -{ - return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID()); -} - -/* static */ -bool LLInventoryModel::libraryFetchInProgress() -{ - return libraryFetchStarted() && !libraryFetchCompleted(); -} - -/* static */ -bool LLInventoryModel::myInventoryFetchStarted() -{ - return sMyInventoryFetchStarted; -} - -/* static */ -bool LLInventoryModel::myInventoryFetchCompleted() -{ - return myInventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID()); -} - -/* static */ -bool LLInventoryModel::myInventoryFetchInProgress() -{ - return myInventoryFetchStarted() && !myInventoryFetchCompleted(); -} - -// static -bool LLInventoryModel::isEverythingFetched() -{ - return sAllFoldersFetched; -} - -//static -BOOL LLInventoryModel::backgroundFetchActive() -{ - return sBackgroundFetchActive; -} - -void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id) -{ - if (!sAllFoldersFetched) - { - sBackgroundFetchActive = TRUE; - if (cat_id.isNull()) - { - if (!sMyInventoryFetchStarted) - { - sMyInventoryFetchStarted = TRUE; - sFetchQueue.push_back(gInventory.getRootFolderID()); - gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL); - } - if (!sLibraryFetchStarted) - { - sLibraryFetchStarted = TRUE; - sFetchQueue.push_back(gInventory.getLibraryRootFolderID()); - gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL); - } - } - else - { - // specific folder requests go to front of queue - if (sFetchQueue.empty() || sFetchQueue.front() != cat_id) - { - sFetchQueue.push_front(cat_id); - gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL); - } - if (cat_id == gInventory.getLibraryRootFolderID()) - { - sLibraryFetchStarted = TRUE; - } - if (cat_id == gInventory.getRootFolderID()) - { - sMyInventoryFetchStarted = TRUE; - } - } - } -} - -//static -void LLInventoryModel::findLostItems() -{ - sBackgroundFetchActive = TRUE; - sFetchQueue.push_back(LLUUID::null); - gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL); -} - -//static -void LLInventoryModel::stopBackgroundFetch() -{ - if (sBackgroundFetchActive) - { - sBackgroundFetchActive = FALSE; - gIdleCallbacks.deleteFunction(&LLInventoryModel::backgroundFetch, NULL); - sBulkFetchCount=0; - sMinTimeBetweenFetches=0.0f; - } -} - -// static -void LLInventoryModel::setAllFoldersFetched() -{ - if (sMyInventoryFetchStarted && - sLibraryFetchStarted) - { - sAllFoldersFetched = TRUE; - } - stopBackgroundFetch(); -} - -//static -void LLInventoryModel::backgroundFetch(void*) -{ - if (sBackgroundFetchActive && gAgent.getRegion()) - { - //If we'll be using the capability, we'll be sending batches and the background thing isn't as important. - std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); - if (!url.empty()) - { - bulkFetch(url); - return; - } - - //DEPRECATED OLD CODE FOLLOWS. - // no more categories to fetch, stop fetch process - if (sFetchQueue.empty()) - { - llinfos << "Inventory fetch completed" << llendl; - - setAllFoldersFetched(); - return; - } - - F32 fast_fetch_time = lerp(sMinTimeBetweenFetches, sMaxTimeBetweenFetches, 0.1f); - F32 slow_fetch_time = lerp(sMinTimeBetweenFetches, sMaxTimeBetweenFetches, 0.5f); - if (sTimelyFetchPending && sFetchTimer.getElapsedTimeF32() > slow_fetch_time) - { - // double timeouts on failure - sMinTimeBetweenFetches = llmin(sMinTimeBetweenFetches * 2.f, 10.f); - sMaxTimeBetweenFetches = llmin(sMaxTimeBetweenFetches * 2.f, 120.f); - llinfos << "Inventory fetch times grown to (" << sMinTimeBetweenFetches << ", " << sMaxTimeBetweenFetches << ")" << llendl; - // fetch is no longer considered "timely" although we will wait for full time-out - sTimelyFetchPending = FALSE; - } - - while(1) - { - if (sFetchQueue.empty()) - { - break; - } - - if(gDisconnected) - { - // just bail if we are disconnected. - break; - } - - LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front()); - - // category has been deleted, remove from queue. - if (!cat) - { - sFetchQueue.pop_front(); - continue; - } - - if (sFetchTimer.getElapsedTimeF32() > sMinTimeBetweenFetches && - LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) - { - // category exists but has no children yet, fetch the descendants - // for now, just request every time and rely on retry timer to throttle - if (cat->fetchDescendents()) - { - sFetchTimer.reset(); - sTimelyFetchPending = TRUE; - } - else - { - // The catagory also tracks if it has expired and here it says it hasn't - // yet. Get out of here because nothing is going to happen until we - // update the timers. - break; - } - } - // do I have all my children? - else if (gInventory.isCategoryComplete(sFetchQueue.front())) - { - // finished with this category, remove from queue - sFetchQueue.pop_front(); - - // add all children to queue - parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID()); - if (cat_it != gInventory.mParentChildCategoryTree.end()) - { - cat_array_t* child_categories = cat_it->second; - - for (S32 child_num = 0; child_num < child_categories->count(); child_num++) - { - sFetchQueue.push_back(child_categories->get(child_num)->getUUID()); - } - } - - // we received a response in less than the fast time - if (sTimelyFetchPending && sFetchTimer.getElapsedTimeF32() < fast_fetch_time) - { - // shrink timeouts based on success - sMinTimeBetweenFetches = llmax(sMinTimeBetweenFetches * 0.8f, 0.3f); - sMaxTimeBetweenFetches = llmax(sMaxTimeBetweenFetches * 0.8f, 10.f); - //llinfos << "Inventory fetch times shrunk to (" << sMinTimeBetweenFetches << ", " << sMaxTimeBetweenFetches << ")" << llendl; - } - - sTimelyFetchPending = FALSE; - continue; - } - else if (sFetchTimer.getElapsedTimeF32() > sMaxTimeBetweenFetches) - { - // received first packet, but our num descendants does not match db's num descendants - // so try again later - LLUUID fetch_id = sFetchQueue.front(); - sFetchQueue.pop_front(); - - if (sNumFetchRetries++ < MAX_FETCH_RETRIES) - { - // push on back of queue - sFetchQueue.push_back(fetch_id); - } - sTimelyFetchPending = FALSE; - sFetchTimer.reset(); - break; - } - - // not enough time has elapsed to do a new fetch - break; - } - } -} - void LLInventoryModel::cache( const LLUUID& parent_folder_id, const LLUUID& agent_id) @@ -2600,7 +2042,7 @@ void LLInventoryModel::buildParentChildMap() } count = items.count(); lost = 0; - std::vector<LLUUID> lost_item_ids; + uuid_vec_t lost_item_ids; for(i = 0; i < count; ++i) { LLPointer<LLViewerInventoryItem> item; @@ -2639,7 +2081,7 @@ void LLInventoryModel::buildParentChildMap() LLMessageSystem* msg = gMessageSystem; BOOL start_new_message = TRUE; const LLUUID lnf = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - for(std::vector<LLUUID>::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it) + for(uuid_vec_t::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it) { if(start_new_message) { @@ -3099,7 +2541,7 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) return; } S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); - std::vector<LLUUID> item_ids; + uuid_vec_t item_ids; update_map_t update; for(S32 i = 0; i < count; ++i) { @@ -3115,7 +2557,7 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) } } gInventory.accountForUpdate(update); - for(std::vector<LLUUID>::iterator it = item_ids.begin(); it != item_ids.end(); ++it) + for(uuid_vec_t::iterator it = item_ids.begin(); it != item_ids.end(); ++it) { gInventory.deleteObject(*it); } @@ -3195,7 +2637,7 @@ void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, << llendl; return; } - std::vector<LLUUID> folder_ids; + uuid_vec_t folder_ids; update_map_t update; S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); for(S32 i = 0; i < count; ++i) @@ -3209,7 +2651,7 @@ void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, } } gInventory.accountForUpdate(update); - for(std::vector<LLUUID>::iterator it = folder_ids.begin(); it != folder_ids.end(); ++it) + for(uuid_vec_t::iterator it = folder_ids.begin(); it != folder_ids.end(); ++it) { gInventory.deleteObject(*it); } @@ -3322,7 +2764,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) count = msg->getNumberOfBlocksFast(_PREHASH_ItemData); - std::vector<LLUUID> wearable_ids; + uuid_vec_t wearable_ids; item_array_t items; std::list<InventoryCallbackInfo> cblist; for(i = 0; i < count; ++i) @@ -3769,207 +3211,6 @@ void LLInventoryModel::dumpInventory() const } ///---------------------------------------------------------------------------- -/// LLInventoryCollectFunctor implementations -///---------------------------------------------------------------------------- - -// static -bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item) -{ - if (!item) - return false; - - bool allowed = false; - LLVOAvatarSelf* my_avatar = NULL; - - switch(item->getType()) - { - case LLAssetType::AT_CALLINGCARD: - // not allowed - break; - - case LLAssetType::AT_OBJECT: - my_avatar = gAgent.getAvatarObject(); - if(my_avatar && !my_avatar->isWearingAttachment(item->getUUID())) - { - allowed = true; - } - break; - - case LLAssetType::AT_BODYPART: - case LLAssetType::AT_CLOTHING: - if(!gAgentWearables.isWearingItem(item->getUUID())) - { - allowed = true; - } - break; - - default: - allowed = true; - break; - } - - return allowed; -} - -bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) -{ - if(mType == LLAssetType::AT_CATEGORY) - { - if(cat) return TRUE; - } - if(item) - { - if(item->getType() == mType) return TRUE; - } - return FALSE; -} - -bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) -{ - if(mType == LLAssetType::AT_CATEGORY) - { - if(cat) return FALSE; - } - if(item) - { - if(item->getType() == mType) return FALSE; - else return TRUE; - } - return TRUE; -} - -bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item) -{ - if(mType == LLAssetType::AT_CATEGORY) - { - if(cat) - { - return TRUE; - } - } - if(item) - { - if(item->getType() == mType) - { - LLPermissions perm = item->getPermissions(); - if ((perm.getMaskBase() & mPerm) == mPerm) - { - return TRUE; - } - } - } - return FALSE; -} - - -//bool LLIsClone::operator()(LLInventoryCategory* cat, LLInventoryItem* item) -//{ -// if(cat) return FALSE; -// if(item) -// { -// if(mItemMap->getType() == LLAssetType::AT_CALLINGCARD) -// { -// if((item->getType() == LLAssetType::AT_CALLINGCARD) -// && !(item->getCreatorUUID().isNull()) -// && (item->getCreatorUUID() == mItemMap->getCreatorUUID())) -// { -// return TRUE; -// } -// } -// else -// { -// if((item->getType() == mItemMap->getType()) -// && !(item->getAssetUUID().isNull()) -// && (item->getAssetUUID() == mItemMap->getAssetUUID()) -// && (item->getName() == mItemMap->getName())) -// { -// return TRUE; -// } -// } -// } -// return FALSE; -//} - -bool LLBuddyCollector::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - if(item) - { - if((LLAssetType::AT_CALLINGCARD == item->getType()) - && (!item->getCreatorUUID().isNull()) - && (item->getCreatorUUID() != gAgent.getID())) - { - return true; - } - } - return false; -} - - -bool LLUniqueBuddyCollector::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - if(item) - { - if((LLAssetType::AT_CALLINGCARD == item->getType()) - && (item->getCreatorUUID().notNull()) - && (item->getCreatorUUID() != gAgent.getID())) - { - mSeen.insert(item->getCreatorUUID()); - return true; - } - } - return false; -} - - -bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - if(item) - { - if((LLAssetType::AT_CALLINGCARD == item->getType()) - && (item->getCreatorUUID() == mBuddyID)) - { - return TRUE; - } - } - return FALSE; -} - - -bool LLNameCategoryCollector::operator()( - LLInventoryCategory* cat, LLInventoryItem* item) -{ - if(cat) - { - if (!LLStringUtil::compareInsensitive(mName, cat->getName())) - { - return true; - } - } - return false; -} - -///---------------------------------------------------------------------------- -/// LLAssetIDMatches -///---------------------------------------------------------------------------- -bool LLAssetIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item) -{ - return (item && item->getAssetUUID() == mAssetID); -} - -///---------------------------------------------------------------------------- -/// LLLinkedItemIDMatches -///---------------------------------------------------------------------------- -bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item) -{ - return (item && - (item->getIsLinkType()) && - (item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID. -} - -///---------------------------------------------------------------------------- /// Local function definitions ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 2a2b48ce3c..b7c1b57397 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -81,7 +81,6 @@ public: CHILDREN_MAYBE }; - // These are used a lot... typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t; typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t; typedef std::set<LLUUID> changed_items_t; @@ -368,8 +367,6 @@ public: // Utility Functions void removeItem(const LLUUID& item_id); - static void findLostItems(); - // Data about the agent's root folder and root library folder // are stored here, rather than in LLAgent where it used to be, because // gInventory is a singleton and represents the agent's inventory. @@ -501,12 +498,6 @@ private: LLUUID mLibraryRootFolderID; LLUUID mLibraryOwnerID; - static BOOL sTimelyFetchPending; - static S32 sNumFetchRetries; - static LLFrameTimer sFetchTimer; - static F32 sMinTimeBetweenFetches; - static F32 sMaxTimeBetweenFetches; - // Expected inventory cache version const static S32 sCurrentInvCacheVersion; @@ -532,41 +523,6 @@ public: // *NOTE: DEBUG functionality void dumpInventory() const; - - //////////////////////////////////////////////////////////////////////////////// - // Bulk fetch -public: - // Start and stop background breadth-first fetching of inventory contents. - // This gets triggered when performing a filter-search - void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null); - static BOOL backgroundFetchActive(); - static bool isEverythingFetched(); - static void backgroundFetch(void*); // background fetch idle function - static void incrBulkFetch(S16 fetching) { sBulkFetchCount+=fetching; if (sBulkFetchCount<0) sBulkFetchCount=0; } - static void stopBackgroundFetch(); // stop fetch process - static bool isBulkFetchProcessingComplete(); - - // Add categories to a list to be fetched in bulk. - static void bulkFetch(std::string url); - - static bool libraryFetchStarted(); - static bool libraryFetchCompleted(); - static bool libraryFetchInProgress(); - - static bool myInventoryFetchStarted(); - static bool myInventoryFetchCompleted(); - static bool myInventoryFetchInProgress(); - -private: - static BOOL sMyInventoryFetchStarted; - static BOOL sLibraryFetchStarted; - static BOOL sAllFoldersFetched; - static void setAllFoldersFetched(); - - // completing the fetch once per session should be sufficient - static BOOL sBackgroundFetchActive; - static S16 sBulkFetchCount; - //////////////////////////////////////////////////////////////////////////////// // Login status public: @@ -578,234 +534,5 @@ private: // a special inventory model for the agent extern LLInventoryModel gInventory; -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryCollectFunctor -// -// Base class for LLInventoryModel::collectDescendentsIf() method -// which accepts an instance of one of these objects to use as the -// function to determine if it should be added. Derive from this class -// and override the () operator to return TRUE if you want to collect -// the category or item passed in. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLInventoryCollectFunctor -{ -public: - virtual ~LLInventoryCollectFunctor(){}; - virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0; - - static bool itemTransferCommonlyAllowed(LLInventoryItem* item); -}; - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLAssetIDMatches -// -// This functor finds inventory items pointing to the specified asset -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLViewerInventoryItem; - -class LLAssetIDMatches : public LLInventoryCollectFunctor -{ -public: - LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {} - virtual ~LLAssetIDMatches() {} - bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); - -protected: - LLUUID mAssetID; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLLinkedItemIDMatches -// -// This functor finds inventory items linked to the specific inventory id. -// Assumes the inventory id is itself not a linked item. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLLinkedItemIDMatches : public LLInventoryCollectFunctor -{ -public: - LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {} - virtual ~LLLinkedItemIDMatches() {} - bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); - -protected: - LLUUID mBaseItemID; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLIsType -// -// Implementation of a LLInventoryCollectFunctor which returns TRUE if -// the type is the type passed in during construction. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLIsType : public LLInventoryCollectFunctor -{ -public: - LLIsType(LLAssetType::EType type) : mType(type) {} - virtual ~LLIsType() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); -protected: - LLAssetType::EType mType; -}; - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLIsNotType -// -// Implementation of a LLInventoryCollectFunctor which returns FALSE if the -// type is the type passed in during construction, otherwise false. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLIsNotType : public LLInventoryCollectFunctor -{ -public: - LLIsNotType(LLAssetType::EType type) : mType(type) {} - virtual ~LLIsNotType() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); -protected: - LLAssetType::EType mType; -}; - -class LLIsTypeWithPermissions : public LLInventoryCollectFunctor -{ -public: - LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id) - : mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {} - virtual ~LLIsTypeWithPermissions() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); -protected: - LLAssetType::EType mType; - PermissionBit mPerm; - LLUUID mAgentID; - LLUUID mGroupID; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLIsClone -// -// Implementation of a LLInventoryCollectFunctor which returns TRUE if -// the object is a clone of the item passed in during -// construction. -// -// *NOTE: Since clone information is determined based off of asset id -// (or creator with calling cards), if the id is NULL, it has no -// clones - even itself. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -//class LLIsClone : public LLInventoryCollectFunctor -//{ -//public: -// LLIsClone(LLViewerInventoryItem* item) : mItem(item) {} -// virtual ~LLIsClone() {} -// virtual bool operator()(LLViewerInventoryCategory* cat, -// LLViewerInventoryItem* item); -//protected: -// LLPointer<LLViewerInventoryItem> mItem; -//}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLBuddyCollector -// -// Simple class that collects calling cards that are not null, and not -// the agent. Duplicates are possible. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLBuddyCollector : public LLInventoryCollectFunctor -{ -public: - LLBuddyCollector() {} - virtual ~LLBuddyCollector() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLUniqueBuddyCollector -// -// Simple class that collects calling cards that are not null, and not -// the agent. Duplicates are discarded. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLUniqueBuddyCollector : public LLInventoryCollectFunctor -{ -public: - LLUniqueBuddyCollector() {} - virtual ~LLUniqueBuddyCollector() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); - -protected: - std::set<LLUUID> mSeen; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLParticularBuddyCollector -// -// Simple class that collects calling cards that match a particular uuid -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLParticularBuddyCollector : public LLInventoryCollectFunctor -{ -public: - LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {} - virtual ~LLParticularBuddyCollector() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); -protected: - LLUUID mBuddyID; -}; - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLNameCategoryCollector -// -// Collects categories based on case-insensitive match of prefix -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLNameCategoryCollector : public LLInventoryCollectFunctor -{ -public: - LLNameCategoryCollector(const std::string& name) : mName(name) {} - virtual ~LLNameCategoryCollector() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); -protected: - std::string mName; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFindCOFValidItems -// -// Collects items that can be legitimately linked to in the COF. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFindCOFValidItems : public LLInventoryCollectFunctor -{ -public: - LLFindCOFValidItems() {} - virtual ~LLFindCOFValidItems() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); - -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFindWearables -// -// Collects wearables based on item type. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFindWearables : public LLInventoryCollectFunctor -{ -public: - LLFindWearables() {} - virtual ~LLFindWearables() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); -}; - #endif // LL_LLINVENTORYMODEL_H diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp new file mode 100644 index 0000000000..72e5c0dd75 --- /dev/null +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -0,0 +1,603 @@ +/** + * @file llinventorymodel.cpp + * @brief Implementation of the inventory model used to track agent inventory. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llinventorymodelbackgroundfetch.h" + +// Seraph clean this up +#include "llagent.h" +#include "llinventorypanel.h" +#include "llviewercontrol.h" +#include "llviewermessage.h" +#include "llviewerwindow.h" +#include "llappviewer.h" +#include "llviewerregion.h" +#include "llcallbacklist.h" + +const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f; +const S32 MAX_FETCH_RETRIES = 10; + +// RN: for some reason, using std::queue in the header file confuses the compiler which thinks it's an xmlrpc_queue +static std::deque<LLUUID> sFetchQueue; +bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) +{ + for (std::deque<LLUUID>::iterator it = sFetchQueue.begin(); + it != sFetchQueue.end(); ++it) + { + const LLUUID& fetch_id = *it; + if (gInventory.isObjectDescendentOf(fetch_id, cat_id)) + return false; + } + return true; +} + + +LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() : + mBackgroundFetchActive(FALSE), + mAllFoldersFetched(FALSE), + mInventoryFetchStarted(FALSE), + mLibraryFetchStarted(FALSE), + mNumFetchRetries(0), + mMinTimeBetweenFetches(0.3f), + mMaxTimeBetweenFetches(10.f), + mTimelyFetchPending(FALSE), + mBulkFetchCount(0) +{ +} + +LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() +{ +} + +bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() +{ + return sFetchQueue.empty() && mBulkFetchCount<=0; +} + +bool LLInventoryModelBackgroundFetch::libraryFetchStarted() +{ + return mLibraryFetchStarted; +} + +bool LLInventoryModelBackgroundFetch::libraryFetchCompleted() +{ + return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID()); +} + +bool LLInventoryModelBackgroundFetch::libraryFetchInProgress() +{ + return libraryFetchStarted() && !libraryFetchCompleted(); +} + +bool LLInventoryModelBackgroundFetch::inventoryFetchStarted() +{ + return mInventoryFetchStarted; +} + +bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted() +{ + return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID()); +} + +bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress() +{ + return inventoryFetchStarted() && !inventoryFetchCompleted(); +} + +bool LLInventoryModelBackgroundFetch::isEverythingFetched() +{ + return mAllFoldersFetched; +} + +BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive() +{ + return mBackgroundFetchActive; +} + +void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id) +{ + if (!mAllFoldersFetched) + { + mBackgroundFetchActive = TRUE; + if (cat_id.isNull()) + { + if (!mInventoryFetchStarted) + { + mInventoryFetchStarted = TRUE; + sFetchQueue.push_back(gInventory.getRootFolderID()); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + } + if (!mLibraryFetchStarted) + { + mLibraryFetchStarted = TRUE; + sFetchQueue.push_back(gInventory.getLibraryRootFolderID()); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + } + } + else + { + // specific folder requests go to front of queue + if (sFetchQueue.empty() || sFetchQueue.front() != cat_id) + { + sFetchQueue.push_front(cat_id); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + } + if (cat_id == gInventory.getLibraryRootFolderID()) + { + mLibraryFetchStarted = TRUE; + } + if (cat_id == gInventory.getRootFolderID()) + { + mInventoryFetchStarted = TRUE; + } + } + } +} + +void LLInventoryModelBackgroundFetch::findLostItems() +{ + mBackgroundFetchActive = TRUE; + sFetchQueue.push_back(LLUUID::null); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); +} + +void LLInventoryModelBackgroundFetch::stopBackgroundFetch() +{ + if (mBackgroundFetchActive) + { + mBackgroundFetchActive = FALSE; + gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + mBulkFetchCount=0; + mMinTimeBetweenFetches=0.0f; + } +} + +void LLInventoryModelBackgroundFetch::setAllFoldersFetched() +{ + if (mInventoryFetchStarted && + mLibraryFetchStarted) + { + mAllFoldersFetched = TRUE; + } + stopBackgroundFetch(); +} + +void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *) +{ + LLInventoryModelBackgroundFetch::instance().backgroundFetch(); +} + +void LLInventoryModelBackgroundFetch::backgroundFetch() +{ + if (mBackgroundFetchActive && gAgent.getRegion()) + { + //If we'll be using the capability, we'll be sending batches and the background thing isn't as important. + std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); + if (!url.empty()) + { + bulkFetch(url); + return; + } + + //DEPRECATED OLD CODE FOLLOWS. + // no more categories to fetch, stop fetch process + if (sFetchQueue.empty()) + { + llinfos << "Inventory fetch completed" << llendl; + + setAllFoldersFetched(); + return; + } + + F32 fast_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.1f); + F32 slow_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.5f); + if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() > slow_fetch_time) + { + // double timeouts on failure + mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f); + mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f); + llinfos << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl; + // fetch is no longer considered "timely" although we will wait for full time-out + mTimelyFetchPending = FALSE; + } + + while(1) + { + if (sFetchQueue.empty()) + { + break; + } + + if(gDisconnected) + { + // just bail if we are disconnected. + break; + } + + LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front()); + + // category has been deleted, remove from queue. + if (!cat) + { + sFetchQueue.pop_front(); + continue; + } + + if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && + LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) + { + // category exists but has no children yet, fetch the descendants + // for now, just request every time and rely on retry timer to throttle + if (cat->fetchDescendents()) + { + mFetchTimer.reset(); + mTimelyFetchPending = TRUE; + } + else + { + // The catagory also tracks if it has expired and here it says it hasn't + // yet. Get out of here because nothing is going to happen until we + // update the timers. + break; + } + } + // do I have all my children? + else if (gInventory.isCategoryComplete(sFetchQueue.front())) + { + // finished with this category, remove from queue + sFetchQueue.pop_front(); + + // add all children to queue + LLInventoryModel::cat_array_t* categories; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items); + for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); + it != categories->end(); + ++it) + { + sFetchQueue.push_back((*it)->getUUID()); + } + + // we received a response in less than the fast time + if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time) + { + // shrink timeouts based on success + mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f); + mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f); + //llinfos << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl; + } + + mTimelyFetchPending = FALSE; + continue; + } + else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches) + { + // received first packet, but our num descendants does not match db's num descendants + // so try again later + LLUUID fetch_id = sFetchQueue.front(); + sFetchQueue.pop_front(); + + if (mNumFetchRetries++ < MAX_FETCH_RETRIES) + { + // push on back of queue + sFetchQueue.push_back(fetch_id); + } + mTimelyFetchPending = FALSE; + mFetchTimer.reset(); + break; + } + + // not enough time has elapsed to do a new fetch + break; + } + } +} + +void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching) +{ + mBulkFetchCount += fetching; + if (mBulkFetchCount < 0) + { + mBulkFetchCount = 0; + } +} + + +class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder +{ + public: + LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; + //LLInventoryModelFetchDescendentsResponder() {}; + void result(const LLSD& content); + void error(U32 status, const std::string& reason); + public: + typedef std::vector<LLViewerInventoryCategory*> folder_ref_t; + protected: + LLSD mRequestSD; +}; + +//If we get back a normal response, handle it here +void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) +{ + if (content.has("folders")) + { + + for(LLSD::array_const_iterator folder_it = content["folders"].beginArray(); + folder_it != content["folders"].endArray(); + ++folder_it) + { + LLSD folder_sd = *folder_it; + + + //LLUUID agent_id = folder_sd["agent_id"]; + + //if(agent_id != gAgent.getID()) //This should never happen. + //{ + // llwarns << "Got a UpdateInventoryItem for the wrong agent." + // << llendl; + // break; + //} + + LLUUID parent_id = folder_sd["folder_id"]; + LLUUID owner_id = folder_sd["owner_id"]; + S32 version = (S32)folder_sd["version"].asInteger(); + S32 descendents = (S32)folder_sd["descendents"].asInteger(); + LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id); + + if (parent_id.isNull()) + { + LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; + for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray(); + item_it != folder_sd["items"].endArray(); + ++item_it) + { + const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); + if (lost_uuid.notNull()) + { + LLSD item = *item_it; + titem->unpackMessage(item); + + LLInventoryModel::update_list_t update; + LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1); + update.push_back(new_folder); + gInventory.accountForUpdate(update); + + titem->setParent(lost_uuid); + titem->updateParentOnServer(FALSE); + gInventory.updateItem(titem); + gInventory.notifyObservers("fetchDescendents"); + + } + } + } + + LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id); + if (!pcat) + { + continue; + } + + for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray(); + category_it != folder_sd["categories"].endArray(); + ++category_it) + { + LLSD category = *category_it; + tcategory->fromLLSD(category); + + if (LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted() || + LLInventoryModelBackgroundFetch::instance().libraryFetchStarted()) + { + sFetchQueue.push_back(tcategory->getUUID()); + } + else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) ) + { + gInventory.updateCategory(tcategory); + } + + } + LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; + for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray(); + item_it != folder_sd["items"].endArray(); + ++item_it) + { + LLSD item = *item_it; + titem->unpackMessage(item); + + gInventory.updateItem(titem); + } + + // set version and descendentcount according to message. + LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); + if(cat) + { + cat->setVersion(version); + cat->setDescendentCount(descendents); + cat->determineFolderType(); + } + + } + } + + if (content.has("bad_folders")) + { + for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray(); + folder_it != content["bad_folders"].endArray(); + ++folder_it) + { + LLSD folder_sd = *folder_it; + + //These folders failed on the dataserver. We probably don't want to retry them. + llinfos << "Folder " << folder_sd["folder_id"].asString() + << "Error: " << folder_sd["error"].asString() << llendl; + } + } + + LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1); + + if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete()) + { + llinfos << "Inventory fetch completed" << llendl; + LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched(); + } + + gInventory.notifyObservers("fetchDescendents"); +} + +//If we get back an error (not found, etc...), handle it here +void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason) +{ + llinfos << "LLInventoryModelFetchDescendentsResponder::error " + << status << ": " << reason << llendl; + + LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1); + + if (status==499) //timed out. Let's be awesome! + { + for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray(); + folder_it != mRequestSD["folders"].endArray(); + ++folder_it) + { + LLSD folder_sd = *folder_it; + LLUUID folder_id = folder_sd["folder_id"]; + sFetchQueue.push_front(folder_id); + } + } + else + { + if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete()) + { + LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched(); + } + } + gInventory.notifyObservers("fetchDescendents"); +} + +//static Bundle up a bunch of requests to send all at once. +void LLInventoryModelBackgroundFetch::bulkFetch(std::string url) +{ + //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped. + //If there are items in sFetchQueue, we want to check the time since the last bulkFetch was + //sent. If it exceeds our retry time, go ahead and fire off another batch. + //Stopbackgroundfetch will be run from the Responder instead of here. + + S16 max_concurrent_fetches=8; + F32 new_min_time = 0.5f; //HACK! Clean this up when old code goes away entirely. + if (mMinTimeBetweenFetches < new_min_time) + { + mMinTimeBetweenFetches=new_min_time; //HACK! See above. + } + + if (gDisconnected || + (mBulkFetchCount > max_concurrent_fetches) || + (mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches)) + { + return; // just bail if we are disconnected. + } + + U32 folder_count=0; + U32 max_batch_size=5; + + U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1; + + LLSD body; + LLSD body_lib; + while (!(sFetchQueue.empty()) && (folder_count < max_batch_size)) + { + if (sFetchQueue.front().isNull()) //DEV-17797 + { + LLSD folder_sd; + folder_sd["folder_id"] = LLUUID::null.asString(); + folder_sd["owner_id"] = gAgent.getID(); + folder_sd["sort_order"] = (LLSD::Integer)sort_order; + folder_sd["fetch_folders"] = (LLSD::Boolean)FALSE; + folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; + body["folders"].append(folder_sd); + folder_count++; + } + else + { + LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front()); + + if (cat) + { + if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) + { + LLSD folder_sd; + folder_sd["folder_id"] = cat->getUUID(); + folder_sd["owner_id"] = cat->getOwnerID(); + folder_sd["sort_order"] = (LLSD::Integer)sort_order; + folder_sd["fetch_folders"] = TRUE; //(LLSD::Boolean)sFullFetchStarted; + folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; + + if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID()) + body_lib["folders"].append(folder_sd); + else + body["folders"].append(folder_sd); + folder_count++; + } + if (mInventoryFetchStarted || mLibraryFetchStarted) + { //Already have this folder but append child folders to list. + // add all children to queue + LLInventoryModel::cat_array_t* categories; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items); + for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); + it != categories->end(); + ++it) + { + sFetchQueue.push_back((*it)->getUUID()); + } + } + } + } + sFetchQueue.pop_front(); + } + + if (folder_count > 0) + { + mBulkFetchCount++; + if (body["folders"].size()) + { + LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0); + } + if (body_lib["folders"].size()) + { + std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents"); + LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0); + } + mFetchTimer.reset(); + } + else if (isBulkFetchProcessingComplete()) + { + setAllFoldersFetched(); + } +} diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h new file mode 100644 index 0000000000..94606fae23 --- /dev/null +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -0,0 +1,119 @@ +/** + * @file llinventorymodelbackgroundfetch.h + * @brief LLInventoryModelBackgroundFetch class header file + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLINVENTORYMODELBACKGROUNDFETCH_H +#define LL_LLINVENTORYMODELBACKGROUNDFETCH_H + +// Seraph clean this up +#include "llassettype.h" +#include "llfoldertype.h" +#include "lldarray.h" +#include "llframetimer.h" +#include "llhttpclient.h" +#include "lluuid.h" +#include "llpermissionsflags.h" +#include "llstring.h" +#include <map> +#include <set> +#include <string> +#include <vector> + +// Seraph clean this up +class LLInventoryObserver; +class LLInventoryObject; +class LLInventoryItem; +class LLInventoryCategory; +class LLViewerInventoryItem; +class LLViewerInventoryCategory; +class LLViewerInventoryItem; +class LLViewerInventoryCategory; +class LLMessageSystem; +class LLInventoryCollectFunctor; + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryModelBackgroundFetch +// +// This class handles background fetch. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch> +{ +public: + LLInventoryModelBackgroundFetch(); + ~LLInventoryModelBackgroundFetch(); + + // Start and stop background breadth-first fetching of inventory contents. + // This gets triggered when performing a filter-search + void start(const LLUUID& cat_id = LLUUID::null); + BOOL backgroundFetchActive(); + bool isEverythingFetched(); + void incrBulkFetch(S16 fetching); + void stopBackgroundFetch(); // stop fetch process + bool isBulkFetchProcessingComplete(); + + // Add categories to a list to be fetched in bulk. + void bulkFetch(std::string url); + + bool libraryFetchStarted(); + bool libraryFetchCompleted(); + bool libraryFetchInProgress(); + + bool inventoryFetchStarted(); + bool inventoryFetchCompleted(); + bool inventoryFetchInProgress(); + void findLostItems(); + + void setAllFoldersFetched(); + + static void backgroundFetchCB(void*); // background fetch idle function + void backgroundFetch(); + +private: + BOOL mInventoryFetchStarted; + BOOL mLibraryFetchStarted; + BOOL mAllFoldersFetched; + + // completing the fetch once per session should be sufficient + BOOL mBackgroundFetchActive; + S16 mBulkFetchCount; + BOOL mTimelyFetchPending; + S32 mNumFetchRetries; + + LLFrameTimer mFetchTimer; + F32 mMinTimeBetweenFetches; + F32 mMaxTimeBetweenFetches; + +}; + +#endif // LL_LLINVENTORYMODELBACKGROUNDFETCH_H + diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 62c2d80609..9913be2e88 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -77,7 +77,7 @@ void LLInventoryCompletionObserver::changed(U32 mask) // appropriate. if(!mIncomplete.empty()) { - for(item_ref_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) + for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { LLViewerInventoryItem* item = gInventory.getItem(*it); if(!item) @@ -262,7 +262,7 @@ void LLInventoryFetchObserver::fetchItems( // virtual void LLInventoryFetchDescendentsObserver::changed(U32 mask) { - for(folder_ref_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();) + for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();) { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); if(!cat) @@ -285,9 +285,9 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask) } void LLInventoryFetchDescendentsObserver::fetchDescendents( - const folder_ref_t& ids) + const uuid_vec_t& ids) { - for(folder_ref_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); if(!cat) continue; @@ -355,7 +355,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask) { if(!mIncompleteItems.empty()) { - for(item_ref_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); ) + for(uuid_vec_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); ) { LLViewerInventoryItem* item = gInventory.getItem(*it); if(!item) @@ -364,7 +364,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask) continue; } if(item->isComplete()) - { + { mCompleteItems.push_back(*it); it = mIncompleteItems.erase(it); continue; @@ -374,7 +374,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask) } if(!mIncompleteFolders.empty()) { - for(folder_ref_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();) + for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();) { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); if(!cat) @@ -399,11 +399,11 @@ void LLInventoryFetchComboObserver::changed(U32 mask) } void LLInventoryFetchComboObserver::fetch( - const folder_ref_t& folder_ids, - const item_ref_t& item_ids) + const uuid_vec_t& folder_ids, + const uuid_vec_t& item_ids) { lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl; - for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit) + for(uuid_vec_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit) { LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); if(!cat) continue; @@ -426,7 +426,7 @@ void LLInventoryFetchComboObserver::fetch( // have to fetch it individually. LLSD items_llsd; LLUUID owner_id; - for(item_ref_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit) + for(uuid_vec_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit) { LLViewerInventoryItem* item = gInventory.getItem(*iit); if(!item) @@ -564,8 +564,8 @@ void LLInventoryTransactionObserver::changed(U32 mask) if(id == mTransactionID) { // woo hoo, we found it - folder_ref_t folders; - item_ref_t items; + uuid_vec_t folders; + uuid_vec_t items; S32 count; count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); S32 i; diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index d6dded52d4..e1c8bd3faf 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -93,9 +93,8 @@ public: protected: virtual void done() = 0; - typedef std::vector<LLUUID> item_ref_t; - item_ref_t mComplete; - item_ref_t mIncomplete; + uuid_vec_t mComplete; + uuid_vec_t mIncomplete; }; @@ -113,7 +112,7 @@ public: LLInventoryFetchObserver(bool retry_if_missing = false): mRetryIfMissing(retry_if_missing) {} virtual void changed(U32 mask); - typedef std::vector<LLUUID> item_ref_t; + typedef uuid_vec_t item_ref_t; bool isEverythingComplete() const; void fetchItems(const item_ref_t& ids); @@ -138,15 +137,14 @@ public: LLInventoryFetchDescendentsObserver() {} virtual void changed(U32 mask); - typedef std::vector<LLUUID> folder_ref_t; - void fetchDescendents(const folder_ref_t& ids); + void fetchDescendents(const uuid_vec_t& ids); bool isEverythingComplete() const; virtual void done() = 0; protected: bool isComplete(LLViewerInventoryCategory* cat); - folder_ref_t mIncompleteFolders; - folder_ref_t mCompleteFolders; + uuid_vec_t mIncompleteFolders; + uuid_vec_t mCompleteFolders; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -163,18 +161,16 @@ public: LLInventoryFetchComboObserver() : mDone(false) {} virtual void changed(U32 mask); - typedef std::vector<LLUUID> folder_ref_t; - typedef std::vector<LLUUID> item_ref_t; - void fetch(const folder_ref_t& folder_ids, const item_ref_t& item_ids); + void fetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); virtual void done() = 0; protected: bool mDone; - folder_ref_t mCompleteFolders; - folder_ref_t mIncompleteFolders; - item_ref_t mCompleteItems; - item_ref_t mIncompleteItems; + uuid_vec_t mCompleteFolders; + uuid_vec_t mIncompleteFolders; + uuid_vec_t mCompleteItems; + uuid_vec_t mIncompleteItems; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -197,7 +193,7 @@ public: protected: virtual void done() = 0; - typedef std::vector<LLUUID> item_ref_t; + typedef uuid_vec_t item_ref_t; item_ref_t mExist; item_ref_t mMIA; }; @@ -221,8 +217,7 @@ public: protected: virtual void done() = 0; - typedef std::vector<LLUUID> item_ref_t; - item_ref_t mAdded; + uuid_vec_t mAdded; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -242,9 +237,7 @@ public: virtual void changed(U32 mask); protected: - typedef std::vector<LLUUID> folder_ref_t; - typedef std::vector<LLUUID> item_ref_t; - virtual void done(const folder_ref_t& folders, const item_ref_t& items) = 0; + virtual void done(const uuid_vec_t& folders, const uuid_vec_t& items) = 0; LLTransactionID mTransactionID; }; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index d7720b735c..83c2d62ee8 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -43,6 +43,8 @@ #include "llimfloater.h" #include "llimview.h" #include "llinventorybridge.h" +#include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llsidepanelinventory.h" #include "llsidetray.h" #include "llscrollcontainer.h" @@ -643,7 +645,7 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) if(handled) { ECursorType cursor = getWindow()->getCursor(); - if (LLInventoryModel::backgroundFetchActive() && cursor == UI_CURSOR_ARROW) + if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && cursor == UI_CURSOR_ARROW) { // replace arrow cursor with arrow and hourglass cursor getWindow()->setCursor(UI_CURSOR_WORKING); @@ -723,7 +725,7 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc { // Don't select objects in COF (e.g. to prevent refocus when items are worn). const LLInventoryObject *obj = gInventory.getObject(obj_id); - if (obj && obj->getParentUUID() == LLAppearanceManager::instance().getCOF()) + if (obj && obj->getParentUUID() == LLAppearanceMgr::instance().getCOF()) { return; } @@ -871,10 +873,9 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata) mFolders->getSelectionList(selected_items); std::string joint_name = userdata.asString(); - LLVOAvatar *avatarp = static_cast<LLVOAvatar*>(gAgent.getAvatarObject()); LLViewerJointAttachment* attachmentp = NULL; - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + 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; diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 2cc5c8335d..9e1dc3a4b0 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -42,6 +42,7 @@ // Project includes #include "llui.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewertexture.h" #include "llviewertexturelist.h" #include "llviewerwindow.h" @@ -482,25 +483,25 @@ void LLJoystickCameraRotate::onHeldDown() // left-right rotation if (dx > mHorizSlopNear) { - gAgent.unlockView(); - gAgent.setOrbitLeftKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitLeftKey(getOrbitRate()); } else if (dx < -mHorizSlopNear) { - gAgent.unlockView(); - gAgent.setOrbitRightKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitRightKey(getOrbitRate()); } // over/under rotation if (dy > mVertSlopNear) { - gAgent.unlockView(); - gAgent.setOrbitUpKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitUpKey(getOrbitRate()); } else if (dy < -mVertSlopNear) { - gAgent.unlockView(); - gAgent.setOrbitDownKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitDownKey(getOrbitRate()); } } @@ -625,25 +626,25 @@ void LLJoystickCameraTrack::onHeldDown() if (dx > mVertSlopNear) { - gAgent.unlockView(); - gAgent.setPanRightKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setPanRightKey(getOrbitRate()); } else if (dx < -mVertSlopNear) { - gAgent.unlockView(); - gAgent.setPanLeftKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setPanLeftKey(getOrbitRate()); } // over/under rotation if (dy > mVertSlopNear) { - gAgent.unlockView(); - gAgent.setPanUpKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setPanUpKey(getOrbitRate()); } else if (dy < -mVertSlopNear) { - gAgent.unlockView(); - gAgent.setPanDownKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setPanDownKey(getOrbitRate()); } } @@ -692,26 +693,26 @@ void LLJoystickCameraZoom::onHeldDown() if (dy > mVertSlopFar) { // Zoom in fast - gAgent.unlockView(); - gAgent.setOrbitInKey(FAST_RATE); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitInKey(FAST_RATE); } else if (dy > mVertSlopNear) { // Zoom in slow - gAgent.unlockView(); - gAgent.setOrbitInKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitInKey(getOrbitRate()); } else if (dy < -mVertSlopFar) { // Zoom out fast - gAgent.unlockView(); - gAgent.setOrbitOutKey(FAST_RATE); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitOutKey(FAST_RATE); } else if (dy < -mVertSlopNear) { // Zoom out slow - gAgent.unlockView(); - gAgent.setOrbitOutKey(getOrbitRate()); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitOutKey(getOrbitRate()); } } diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index eaa3a715cb..539ca97a93 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -36,6 +36,7 @@ #include "roles_constants.h" #include "llinventory.h" +#include "llinventoryfunctions.h" #include "lllandmark.h" #include "llparcel.h" #include "llregionhandle.h" diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index b6e793522a..3b4a4a1344 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -108,7 +108,7 @@ public: private: /*virtual*/ void done() { - std::vector<LLUUID>::const_iterator it = mAdded.begin(), end = mAdded.end(); + uuid_vec_t::const_iterator it = mAdded.begin(), end = mAdded.end(); for(; it != end; ++it) { LLInventoryItem* item = gInventory.getItem(*it); @@ -227,7 +227,6 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) params.default_text(LLStringUtil::null); params.max_length_bytes(p.max_chars); params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1)); - params.handle_edit_keys_directly(true); params.commit_on_focus_lost(false); params.follows.flags(FOLLOWS_ALL); mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params); diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index a96240e31c..957e88960d 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -43,6 +43,7 @@ #include "llviewertexturelist.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "lldrawable.h" #include "llfontgl.h" @@ -180,7 +181,7 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto LLVector3 cam_to_reference; if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - cam_to_reference = LLVector3(1.f / gAgent.mHUDCurZoom, 0.f, 0.f); + cam_to_reference = LLVector3(1.f / gAgentCamera.mHUDCurZoom, 0.f, 0.f); } else { @@ -265,8 +266,8 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { BOOL result = FALSE; - F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; - F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom; + F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgentCamera.mHUDCurZoom; LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin); LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y); @@ -304,15 +305,15 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidthScaled()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; - F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeightScaled()) - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidthScaled()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom; + F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeightScaled()) - 0.5f) / gAgentCamera.mHUDCurZoom; a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y); a2 = a1 + LLVector3(1.f, 0.f, 0.f); } else { - a1 = gAgent.getCameraPositionAgent(); - a2 = gAgent.getCameraPositionAgent() + LLVector3(gViewerWindow->mouseDirectionGlobal(x, y)); + a1 = gAgentCamera.getCameraPositionAgent(); + a2 = gAgentCamera.getCameraPositionAgent() + LLVector3(gViewerWindow->mouseDirectionGlobal(x, y)); } BOOL parallel = TRUE; @@ -491,7 +492,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons LLVector3 render_pos = pos; if (hud_selection) { - F32 zoom_amt = gAgent.mHUDCurZoom; + F32 zoom_amt = gAgentCamera.mHUDCurZoom; F32 inv_zoom_amt = 1.f / zoom_amt; // scale text back up to counter-act zoom level render_pos = pos * zoom_amt; @@ -549,7 +550,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string LLVector3 render_pos = pos; if (hud_selection) { - F32 zoom_amt = gAgent.mHUDCurZoom; + F32 zoom_amt = gAgentCamera.mHUDCurZoom; F32 inv_zoom_amt = 1.f / zoom_amt; // scale text back up to counter-act zoom level render_pos = pos * zoom_amt; diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 8535d52015..6747bcb9c9 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -45,6 +45,7 @@ // viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llbox.h" #include "llbutton.h" #include "llviewercontrol.h" @@ -64,6 +65,7 @@ #include "lldrawable.h" #include "llglheaders.h" #include "lltrans.h" +#include "llvoavatarself.h" const F32 RADIUS_PIXELS = 100.f; // size in screen space const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS; @@ -138,7 +140,7 @@ void LLManipRotate::render() glPushMatrix(); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - F32 zoom = gAgent.mHUDCurZoom; + F32 zoom = gAgentCamera.mHUDCurZoom; glScalef(zoom, zoom, zoom); } @@ -690,7 +692,7 @@ void LLManipRotate::drag( S32 x, S32 y ) LLSelectMgr::getInstance()->updateSelectionCenter(); // RN: just clear focus so camera doesn't follow spurious object updates - gAgent.clearFocusObject(); + gAgentCamera.clearFocusObject(); dialog_refresh_all(); } @@ -730,7 +732,7 @@ void LLManipRotate::renderSnapGuides() } else { - cam_at_axis = center - gAgent.getCameraPositionAgent(); + cam_at_axis = center - gAgentCamera.getCameraPositionAgent(); cam_at_axis.normVec(); } @@ -738,7 +740,7 @@ void LLManipRotate::renderSnapGuides() LLVector3 test_axis = constraint_axis; BOOL constrain_to_ref_object = FALSE; - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { test_axis = test_axis * ~grid_rotation; } @@ -765,7 +767,7 @@ void LLManipRotate::renderSnapGuides() } LLVector3 projected_snap_axis = world_snap_axis; - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { projected_snap_axis = projected_snap_axis * grid_rotation; } @@ -1097,12 +1099,12 @@ BOOL LLManipRotate::updateVisiblity() LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - mCenterToCam = LLVector3(-1.f / gAgent.mHUDCurZoom, 0.f, 0.f); + mCenterToCam = LLVector3(-1.f / gAgentCamera.mHUDCurZoom, 0.f, 0.f); mCenterToCamNorm = mCenterToCam; mCenterToCamMag = mCenterToCamNorm.normVec(); mRadiusMeters = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); - mRadiusMeters /= gAgent.mHUDCurZoom; + mRadiusMeters /= gAgentCamera.mHUDCurZoom; mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm; @@ -1110,8 +1112,8 @@ BOOL LLManipRotate::updateVisiblity() // x axis range is (-aspect * 0.5f, +aspect * 0.5) // y axis range is (-0.5, 0.5) // so use getWorldViewHeightRaw as scale factor when converting to pixel coordinates - mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()), - (S32)((center.mV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled())); + mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()), + (S32)((center.mV[VZ] + 0.5f) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled())); visible = TRUE; } else @@ -1119,7 +1121,7 @@ BOOL LLManipRotate::updateVisiblity() visible = LLViewerCamera::getInstance()->projectPosAgentToScreen(center, mCenterScreen ); if( visible ) { - mCenterToCam = gAgent.getCameraPositionAgent() - center; + mCenterToCam = gAgentCamera.getCameraPositionAgent() - center; mCenterToCamNorm = mCenterToCam; mCenterToCamMag = mCenterToCamNorm.normVec(); LLVector3 cameraAtAxis = LLViewerCamera::getInstance()->getAtAxis(); @@ -1165,7 +1167,7 @@ BOOL LLManipRotate::updateVisiblity() LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y ) { - LLVector3 cam = gAgent.getCameraPositionAgent(); + LLVector3 cam = gAgentCamera.getCameraPositionAgent(); LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); mMouseCur = intersectMouseWithSphere( x, y, center, mRadiusMeters); @@ -1281,7 +1283,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) LLVector3 axis2; LLVector3 test_axis = constraint_axis; - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { test_axis = test_axis * ~grid_rotation; } @@ -1305,7 +1307,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) axis1 = LLVector3::x_axis; } - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { axis1 = axis1 * grid_rotation; } @@ -1333,7 +1335,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } else { - cam_to_snap_plane = snap_plane_center - gAgent.getCameraPositionAgent(); + cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent(); cam_to_snap_plane.normVec(); } @@ -1383,7 +1385,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } else { - cam_to_snap_plane = snap_plane_center - gAgent.getCameraPositionAgent(); + cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent(); cam_to_snap_plane.normVec(); } @@ -1430,7 +1432,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } else { - cam_at_axis = snap_plane_center - gAgent.getCameraPositionAgent(); + cam_at_axis = snap_plane_center - gAgentCamera.getCameraPositionAgent(); cam_at_axis.normVec(); } @@ -1627,15 +1629,15 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_ { if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD) { - F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgent.mHUDCurZoom; - F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgentCamera.mHUDCurZoom; + F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgentCamera.mHUDCurZoom; *ray_pt = LLVector3(-1.f, -mouse_x, mouse_y); *ray_dir = LLVector3(1.f, 0.f, 0.f); } else { - *ray_pt = gAgent.getCameraPositionAgent(); + *ray_pt = gAgentCamera.getCameraPositionAgent(); LLViewerCamera::getInstance()->projectScreenToPosAgent(x, y, ray_dir); *ray_dir -= *ray_pt; ray_dir->normVec(); diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index ee3ffa2450..63643a7fc6 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -45,6 +45,7 @@ // viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llbbox.h" #include "llbox.h" #include "llviewercontrol.h" @@ -210,7 +211,7 @@ void LLManipScale::render() glPushMatrix(); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - F32 zoom = gAgent.mHUDCurZoom; + F32 zoom = gAgentCamera.mHUDCurZoom; glScalef(zoom, zoom, zoom); } @@ -227,11 +228,11 @@ void LLManipScale::render() if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); - mBoxHandleSize /= gAgent.mHUDCurZoom; + mBoxHandleSize /= gAgentCamera.mHUDCurZoom; } else { - range = dist_vec(gAgent.getCameraPositionAgent(), center_agent); + range = dist_vec(gAgentCamera.getCameraPositionAgent(), center_agent); range_from_agent = dist_vec(gAgent.getPositionAgent(), center_agent); // Don't draw manip if object too far away @@ -438,7 +439,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) LLMatrix4 cfr(OGL_TO_CFR_ROTATION); transform *= cfr; LLMatrix4 window_scale; - F32 zoom_level = 2.f * gAgent.mHUDCurZoom; + F32 zoom_level = 2.f * gAgentCamera.mHUDCurZoom; window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), LLQuaternion::DEFAULT, LLVector3::zero); @@ -635,7 +636,7 @@ void LLManipScale::renderFaces( const LLBBox& bbox ) } // Find nearest vertex - LLVector3 orientWRTHead = bbox.agentToLocalBasis( bbox.getCenterAgent() - gAgent.getCameraPositionAgent() ); + LLVector3 orientWRTHead = bbox.agentToLocalBasis( bbox.getCenterAgent() - gAgentCamera.getCameraPositionAgent() ); U32 nearest = (orientWRTHead.mV[0] < 0.0f ? 1 : 0) + (orientWRTHead.mV[1] < 0.0f ? 2 : 0) + @@ -825,7 +826,7 @@ void LLManipScale::drag( S32 x, S32 y ) } LLSelectMgr::getInstance()->updateSelectionCenter(); - gAgent.clearFocusObject(); + gAgentCamera.clearFocusObject(); } // Scale around the @@ -1364,7 +1365,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) if(mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - mSnapRegimeOffset = SNAP_GUIDE_SCREEN_OFFSET / gAgent.mHUDCurZoom; + mSnapRegimeOffset = SNAP_GUIDE_SCREEN_OFFSET / gAgentCamera.mHUDCurZoom; } else @@ -1377,7 +1378,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { cam_at_axis.setVec(1.f, 0.f, 0.f); - snap_guide_length = SNAP_GUIDE_SCREEN_LENGTH / gAgent.mHUDCurZoom; + snap_guide_length = SNAP_GUIDE_SCREEN_LENGTH / gAgentCamera.mHUDCurZoom; } else { diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 52fe31fbba..5f0c5e1795 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -42,6 +42,7 @@ #include "llrender.h" #include "llagent.h" +#include "llagentcamera.h" #include "llbbox.h" #include "llbox.h" #include "llviewercontrol.h" @@ -437,12 +438,12 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { if (x < ROTATE_H_MARGIN) { - gAgent.cameraOrbitAround(rotate_angle); + gAgentCamera.cameraOrbitAround(rotate_angle); rotated = TRUE; } else if (x > world_rect.getWidth() - ROTATE_H_MARGIN) { - gAgent.cameraOrbitAround(-rotate_angle); + gAgentCamera.cameraOrbitAround(-rotate_angle); rotated = TRUE; } } @@ -713,7 +714,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // in position changes even when the mouse moves object->setPosition(new_position_local); rebuild(object); - gAgent.getAvatarObject()->clampAttachmentPositions(); + gAgentAvatarp->clampAttachmentPositions(); new_position_local = object->getPosition(); if (selectNode->mIndividualSelection) @@ -789,7 +790,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } LLSelectMgr::getInstance()->updateSelectionCenter(); - gAgent.clearFocusObject(); + gAgentCamera.clearFocusObject(); dialog_refresh_all(); // ??? is this necessary? lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (active)" << llendl; @@ -830,7 +831,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) LLMatrix4 cfr(OGL_TO_CFR_ROTATION); transform *= cfr; LLMatrix4 window_scale; - F32 zoom_level = 2.f * gAgent.mHUDCurZoom; + F32 zoom_level = 2.f * gAgentCamera.mHUDCurZoom; window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), LLQuaternion::DEFAULT, LLVector3::zero); @@ -1075,7 +1076,7 @@ void LLManipTranslate::render() gGL.pushMatrix(); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - F32 zoom = gAgent.mHUDCurZoom; + F32 zoom = gAgentCamera.mHUDCurZoom; glScalef(zoom, zoom, zoom); } { @@ -1239,7 +1240,7 @@ void LLManipTranslate::renderSnapGuides() if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - guide_size_meters = 1.f / gAgent.mHUDCurZoom; + guide_size_meters = 1.f / gAgentCamera.mHUDCurZoom; mSnapOffsetMeters = mArrowLengthMeters * 1.5f; } else @@ -1822,11 +1823,11 @@ void LLManipTranslate::renderTranslationHandles() if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWorldViewHeightRaw(); - mArrowLengthMeters /= gAgent.mHUDCurZoom; + mArrowLengthMeters /= gAgentCamera.mHUDCurZoom; } else { - LLVector3 camera_pos_agent = gAgent.getCameraPositionAgent(); + LLVector3 camera_pos_agent = gAgentCamera.getCameraPositionAgent(); F32 range = dist_vec(camera_pos_agent, selection_center); F32 range_from_agent = dist_vec(gAgent.getPositionAgent(), selection_center); @@ -2108,7 +2109,7 @@ void LLManipTranslate::renderTranslationHandles() // Copied from LLDrawable::updateGeometry LLVector3 pos_agent = first_object->getPositionAgent(); - LLVector3 camera_agent = gAgent.getCameraPositionAgent(); + LLVector3 camera_agent = gAgentCamera.getCameraPositionAgent(); LLVector3 headPos = pos_agent - camera_agent; LLVector3 orientWRTHead = headPos * invRotation; @@ -2150,7 +2151,7 @@ void LLManipTranslate::renderTranslationHandles() } else { - camera_axis.setVec(gAgent.getCameraPositionAgent() - first_object->getPositionAgent()); + camera_axis.setVec(gAgentCamera.getCameraPositionAgent() - first_object->getPositionAgent()); } for (U32 i = 0; i < NUM_AXES*2; i++) diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index 8d950f072d..e6ca0dabda 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -42,7 +42,7 @@ #include "llstring.h" #include "message.h" -#include "llagent.h" +#include "llagentcamera.h" #include "llcallingcard.h" #include "llviewercontrol.h" //#include "llfirstuse.h" @@ -66,7 +66,7 @@ void handle_mouselook(void*) { - gAgent.changeCameraToMouselook(); + gAgentCamera.changeCameraToMouselook(); } diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index b95e8bd3a2..d670eb6ffd 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -37,6 +37,7 @@ #include "lljoint.h" #include "llagent.h" +#include "llagentcamera.h" #include "lldrawable.h" #include "lldrawpoolavatar.h" #include "llface.h" @@ -88,15 +89,14 @@ void LLMorphView::initialize() mCameraYaw = 0.f; mCameraDist = -1.f; - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - if (!avatarp || avatarp->isDead()) + if (!isAgentAvatarValid() || gAgentAvatarp->isDead()) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); return; } - avatarp->stopMotion( ANIM_AGENT_BODY_NOISE ); - avatarp->mSpecialRenderMode = 3; + gAgentAvatarp->stopMotion( ANIM_AGENT_BODY_NOISE ); + gAgentAvatarp->mSpecialRenderMode = 3; // set up camera for close look at avatar mOldCameraNearClip = LLViewerCamera::getInstance()->getNear(); @@ -110,11 +110,10 @@ void LLMorphView::shutdown() { LLVOAvatarSelf::onCustomizeEnd(); - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - if(avatarp && !avatarp->isDead()) + if (isAgentAvatarValid()) { - avatarp->startMotion( ANIM_AGENT_BODY_NOISE ); - avatarp->mSpecialRenderMode = 0; + gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); + gAgentAvatarp->mSpecialRenderMode = 0; // reset camera LLViewerCamera::getInstance()->setNear(mOldCameraNearClip); } @@ -163,15 +162,11 @@ void LLMorphView::updateCamera() { if (!mCameraTargetJoint) { - setCameraTargetJoint(gAgent.getAvatarObject()->getJoint("mHead")); - } - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( !avatar ) - { - return; - } - LLJoint* root_joint = avatar->getRootJoint(); + setCameraTargetJoint(gAgentAvatarp->getJoint("mHead")); + } + if (!isAgentAvatarValid()) return; + + LLJoint* root_joint = gAgentAvatarp->getRootJoint(); if( !root_joint ) { return; @@ -187,7 +182,7 @@ void LLMorphView::updateCamera() LLVector3d camera_pos = joint_pos + mCameraOffset * camera_rot_pitch * camera_rot_yaw * avatar_rot; - gAgent.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() ); + gAgentCamera.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() ); } void LLMorphView::setCameraDrivenByKeys(BOOL b) diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 1853b511be..0f22a50093 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -41,7 +41,8 @@ // Viewer includes #include "llagent.h" -#include "llvoavatarself.h" // to check gAgent.getAvatarObject()->isSitting() +#include "llagentcamera.h" +#include "llvoavatarself.h" // to check gAgentAvatarp->isSitting() #include "llbottomtray.h" #include "llbutton.h" #include "llfloaterreg.h" @@ -331,7 +332,7 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode) updateButtonsWithMovementMode(mode); bool bHideModeButtons = MM_FLY == mode - || (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()); + || (isAgentAvatarValid() && gAgentAvatarp->isSitting()); showModeButtons(!bHideModeButtons); @@ -387,9 +388,9 @@ void LLFloaterMove::initMovementMode() } setMovementMode(initMovementMode); - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - setEnabled(!gAgent.getAvatarObject()->isSitting()); + setEnabled(!gAgentAvatarp->isSitting()); } } @@ -490,7 +491,7 @@ void LLFloaterMove::onOpen(const LLSD& key) showModeButtons(FALSE); } - if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) + if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) { setSittingMode(TRUE); showModeButtons(FALSE); @@ -593,7 +594,7 @@ BOOL LLPanelStandStopFlying::postBuild() void LLPanelStandStopFlying::setVisible(BOOL visible) { //we dont need to show the panel if these buttons are not activated - if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false; + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false; if (visible) { diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 7a538e372b..9611c286eb 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -148,16 +148,30 @@ void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index ) if(0 <= cur_index && cur_index < (S32)getItemList().size()) { LLScrollListItem* item = getItemList()[cur_index]; - LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex)); - if(cell) - cell->setTextWidth(cell->getTextWidth() + info_icon_size); + if (item) + { + LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex)); + if (cell) + cell->setTextWidth(cell->getTextWidth() + info_icon_size); + } + else + { + llwarns << "highlighted name list item is NULL" << llendl; + } } if(target_index != -1) { LLScrollListItem* item = getItemList()[target_index]; LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex)); - if(cell) - cell->setTextWidth(cell->getTextWidth() - info_icon_size); + if (item) + { + if (cell) + cell->setTextWidth(cell->getTextWidth() - info_icon_size); + } + else + { + llwarns << "target name item is NULL" << llendl; + } } } diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index af711b6943..1507b7d324 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -103,7 +103,7 @@ LLGestureComboList::LLGestureComboList(const LLGestureComboList::Params& p) setCommitCallback(boost::bind(&LLGestureComboList::onCommitGesture, this)); // now register us as observer since we have a place to put the results - LLGestureManager::instance().addObserver(this); + LLGestureMgr::instance().addObserver(this); // refresh list from current active gestures refreshGestures(); @@ -244,8 +244,8 @@ void LLGestureComboList::refreshGestures() mList->clearRows(); mGestures.clear(); - LLGestureManager::item_map_t::const_iterator it; - const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures(); + LLGestureMgr::item_map_t::const_iterator it; + const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures(); LLSD::Integer idx(0); for (it = active_gestures.begin(); it != active_gestures.end(); ++it) { @@ -289,7 +289,7 @@ void LLGestureComboList::refreshGestures() gesture = mGestures.at(index); } - if(gesture && LLGestureManager::instance().isGesturePlaying(gesture)) + if(gesture && LLGestureMgr::instance().isGesturePlaying(gesture)) { return; } @@ -321,7 +321,7 @@ void LLGestureComboList::onCommitGesture() LLMultiGesture* gesture = mGestures.at(index); if(gesture) { - LLGestureManager::instance().playGesture(gesture); + LLGestureMgr::instance().playGesture(gesture); if(!gesture->mReplaceText.empty()) { LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE); @@ -332,7 +332,7 @@ void LLGestureComboList::onCommitGesture() LLGestureComboList::~LLGestureComboList() { - LLGestureManager::instance().removeObserver(this); + LLGestureMgr::instance().removeObserver(this); } LLNearbyChatBar::LLNearbyChatBar() @@ -476,7 +476,7 @@ void LLNearbyChatBar::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) std::string utf8_trigger = wstring_to_utf8str(raw_text); std::string utf8_out_str(utf8_trigger); - if (LLGestureManager::instance().matchPrefix(utf8_trigger, &utf8_out_str)) + if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str)) { std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part @@ -558,7 +558,7 @@ void LLNearbyChatBar::sendChat( EChatType type ) if (0 == channel) { // discard returned "found" boolean - LLGestureManager::instance().triggerAndReviseString(utf8text, &utf8_revised_text); + LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); } else { @@ -807,8 +807,11 @@ public: { if (tokens.size() < 2) return false; S32 channel = tokens[0].asInteger(); - std::string mesg = tokens[1].asString(); - send_chat_from_viewer(mesg, CHAT_TYPE_NORMAL, channel); + + // Send unescaped message, see EXT-6353. + std::string unescaped_mesg (LLURI::unescape(tokens[1].asString())); + + send_chat_from_viewer(unescaped_mesg, CHAT_TYPE_NORMAL, channel); return true; } }; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 05623198ab..a8dee8a24a 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -49,6 +49,7 @@ // Viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llappviewer.h" // for gDisconnected #include "llcallingcard.h" // LLAvatarTracker #include "lltracker.h" @@ -87,7 +88,7 @@ LLNetMap::LLNetMap (const Params & p) mCurPanX(0.f), mCurPanY(0.f), mUpdateNow(FALSE), - mObjectImageCenterGlobal( gAgent.getCameraPositionGlobal() ), + mObjectImageCenterGlobal( gAgentCamera.getCameraPositionGlobal() ), mObjectRawImagep(), mObjectImagep(), mClosestAgentToCursor(), @@ -203,7 +204,7 @@ void LLNetMap::draw() LLViewerRegion* regionp = *iter; // Find x and y position relative to camera's center. LLVector3 origin_agent = regionp->getOriginAgent(); - LLVector3 rel_region_pos = origin_agent - gAgent.getCameraPositionAgent(); + LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent(); F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale; F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale; @@ -264,7 +265,7 @@ void LLNetMap::draw() LLVector3d old_center = mObjectImageCenterGlobal; - LLVector3d new_center = gAgent.getCameraPositionGlobal(); + LLVector3d new_center = gAgentCamera.getCameraPositionGlobal(); new_center.mdV[0] = (5.f/mObjectMapTPM)*floor(0.2f*mObjectMapTPM*new_center.mdV[0]); new_center.mdV[1] = (5.f/mObjectMapTPM)*floor(0.2f*mObjectMapTPM*new_center.mdV[1]); @@ -289,7 +290,7 @@ void LLNetMap::draw() } LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal); - map_center_agent -= gAgent.getCameraPositionAgent(); + map_center_agent -= gAgentCamera.getCameraPositionAgent(); map_center_agent.mV[VX] *= mScale/region_width; map_center_agent.mV[VY] *= mScale/region_width; @@ -461,7 +462,7 @@ void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) { - LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal(); + LLVector3d relative_pos_global = global_pos - gAgentCamera.getCameraPositionGlobal(); LLVector3 pos_local; pos_local.setVec(relative_pos_global); // convert to floats from doubles @@ -529,7 +530,7 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) LLVector3d pos_global; pos_global.setVec( pos_local ); - pos_global += gAgent.getCameraPositionGlobal(); + pos_global += gAgentCamera.getCameraPositionGlobal(); return pos_global; } diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 1dc0e414a2..99a1fedcf3 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -42,6 +42,8 @@ #include "llinstantmessage.h" #include "llnotificationptr.h" +class LLIMFloater; + namespace LLNotificationsUI { // ENotificationType enumerates all possible types of notifications that could be met @@ -304,8 +306,6 @@ public: /** * Checks if passed notification can create toast. - * - * It returns false only for inventory accepted/declined notifications if respective IM window is open (EXT-5909) */ static bool canSpawnToast(const LLNotificationPtr& notification); @@ -315,6 +315,11 @@ public: static bool isIMFloaterOpened(const LLNotificationPtr& notification); /** + * Determines whether IM floater is focused. + */ + static bool isIMFloaterFocused(const LLNotificationPtr& notification); + + /** * Writes notification message to IM session. */ static void logToIM(const EInstantMessage& session_type, @@ -375,6 +380,14 @@ public: * Decrements counter of IM messages. */ static void decIMMesageCounter(const LLNotificationPtr& notification); + +private: + + /** + * Find IM floater based on "from_id" + */ + static LLIMFloater* findIMFloater(const LLNotificationPtr& notification); + }; } diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index d3ad61128d..3f551f6b32 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -128,7 +128,8 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"), FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"), SERVER_OBJECT_MESSAGE("ServerObjectMessage"), TELEPORT_OFFERED("TeleportOffered"), - TELEPORT_OFFER_SENT("TeleportOfferSent"); + TELEPORT_OFFER_SENT("TeleportOfferSent"), + IM_SYSTEM_MESSAGE_TIP("IMSystemMessageTip"); // static @@ -147,7 +148,8 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) || INVENTORY_DECLINED == notification->getName() || USER_GIVE_ITEM == notification->getName() || TELEPORT_OFFERED == notification->getName() - || TELEPORT_OFFER_SENT == notification->getName(); + || TELEPORT_OFFER_SENT == notification->getName() + || IM_SYSTEM_MESSAGE_TIP == notification->getName(); } // static @@ -157,7 +159,8 @@ bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification) && FRIEND_ONLINE != notification->getName() && FRIEND_OFFLINE != notification->getName() && INVENTORY_ACCEPTED != notification->getName() - && INVENTORY_DECLINED != notification->getName(); + && INVENTORY_DECLINED != notification->getName() + && IM_SYSTEM_MESSAGE_TIP != notification->getName(); } // static @@ -193,10 +196,36 @@ bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notificat // static bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification) { - bool cannot_spawn = isIMFloaterOpened(notification) && (INVENTORY_DECLINED == notification->getName() - || INVENTORY_ACCEPTED == notification->getName()); - - return !cannot_spawn; + if(INVENTORY_DECLINED == notification->getName() + || INVENTORY_ACCEPTED == notification->getName()) + { + // return false for inventory accepted/declined notifications if respective IM window is open (EXT-5909) + return ! isIMFloaterOpened(notification); + } + + if(FRIENDSHIP_ACCEPTED == notification->getName()) + { + // don't show FRIENDSHIP_ACCEPTED if IM window is opened and focused - EXT-6441 + return ! isIMFloaterFocused(notification); + } + + if(OFFER_FRIENDSHIP == notification->getName() + || USER_GIVE_ITEM == notification->getName() + || TELEPORT_OFFERED == notification->getName()) + { + // When ANY offer arrives, show toast, unless IM window is already open - EXT-5904 + return ! isIMFloaterOpened(notification); + } + + return true; +} + +// static +LLIMFloater* LLHandlerUtil::findIMFloater(const LLNotificationPtr& notification) +{ + LLUUID from_id = notification->getPayload()["from_id"]; + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); + return LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id); } // static @@ -204,12 +233,7 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) { bool res = false; - LLUUID from_id = notification->getPayload()["from_id"]; - LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, - from_id); - - LLIMFloater* im_floater = LLFloaterReg::findTypedInstance<LLIMFloater>( - "impanel", session_id); + LLIMFloater* im_floater = findIMFloater(notification); if (im_floater != NULL) { res = im_floater->getVisible() == TRUE; @@ -218,6 +242,19 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) return res; } +bool LLHandlerUtil::isIMFloaterFocused(const LLNotificationPtr& notification) +{ + bool res = false; + + LLIMFloater* im_floater = findIMFloater(notification); + if (im_floater != NULL) + { + res = im_floater->hasFocus() == TRUE; + } + + return res; +} + // static void LLHandlerUtil::logToIM(const EInstantMessage& session_type, const std::string& session_name, const std::string& from_name, @@ -286,7 +323,7 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi { const std::string name = LLHandlerUtil::getSubstitutionName(notification); - std::string session_name = notification->getPayload().has( + const std::string& session_name = notification->getPayload().has( "SESSION_NAME") ? notification->getPayload()["SESSION_NAME"].asString() : name; // don't create IM p2p session with objects, it's necessary condition to log @@ -295,12 +332,6 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi { LLUUID from_id = notification->getPayload()["from_id"]; - //*HACK for ServerObjectMessage the sesson name is really weird, see EXT-4779 - if (SERVER_OBJECT_MESSAGE == notification->getName()) - { - session_name = "chat"; - } - //there still appears a log history file with weird name " .txt" if (" " == session_name || "{waiting}" == session_name || "{nobody}" == session_name) { @@ -355,6 +386,7 @@ void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChat LLChat chat_msg(notification->getMessage()); chat_msg.mSourceType = type; chat_msg.mFromName = SYSTEM_FROM; + chat_msg.mFromID = LLUUID::null; nearby_chat->addMessage(chat_msg); } } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index e93aec9d01..c5960a9040 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -115,15 +115,11 @@ bool LLOfferHandler::processNotification(const LLSD& notify) session_id = LLHandlerUtil::spawnIMSession(name, from_id); } - bool show_toast = true; + bool show_toast = LLHandlerUtil::canSpawnToast(notification); bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification); if (add_notid_to_im) { LLHandlerUtil::addNotifPanelToIM(notification); - if (LLHandlerUtil::isIMFloaterOpened(notification)) - { - show_toast = false; - } } if (notification->getPayload().has("SUPPRESS_TOAST") diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index a186bc926c..c72f0f8012 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -186,7 +186,7 @@ void LLPanelBlockedList::onBlockByNameClick() LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName); } -void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) +void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const uuid_vec_t& ids) { if (names.empty() || ids.empty()) return; LLMute mute(ids[0], names[0], LLMute::AGENT); diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 1ef16a02f4..a100577e43 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -78,7 +78,7 @@ private: void onPickBtnClick(); void onBlockByNameClick(); - void callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void callbackBlockPicked(const std::vector<std::string>& names, const uuid_vec_t& ids); static void callbackBlockByName(const std::string& text); private: diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index e7acc68b93..805016f089 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -602,7 +602,7 @@ LLPanel* LLPanelEditWearable::getPanel(EWearableType type) void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std::string &edit_group) { LLWearable::visual_param_vec_t param_list; - ESex avatar_sex = gAgent.getAvatarObject()->getSex(); + ESex avatar_sex = gAgentAvatarp->getSex(); mWearablePtr->getVisualParams(param_list); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index af6f240a2d..716166a945 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -59,6 +59,8 @@ #include "llaccordionctrltab.h" #include "llaccordionctrl.h" +#include "lltrans.h" + static LLRegisterPanelClassWrapper<LLPanelGroup> t_panel_group("panel_group_info_sidetray"); @@ -333,8 +335,9 @@ void LLPanelGroup::update(LLGroupChange gc) LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID); if(gdatap) { - childSetValue("group_name", gdatap->mName); - childSetToolTip("group_name",gdatap->mName); + std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; + childSetValue("group_name", group_name); + childSetToolTip("group_name",group_name); LLGroupData agent_gdatap; bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlike(); @@ -379,8 +382,9 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID); if(gdatap) { - childSetValue("group_name", gdatap->mName); - childSetToolTip("group_name",gdatap->mName); + std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; + childSetValue("group_name", group_name); + childSetToolTip("group_name",group_name); } LLButton* button_apply = findChild<LLButton>("btn_apply"); diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 05261a65de..11d3768a3d 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -57,7 +57,7 @@ public: ~impl(); void addUsers(const std::vector<std::string>& names, - const std::vector<LLUUID>& agent_ids); + const uuid_vec_t& agent_ids); void submitInvitations(); void addRoleNames(LLGroupMgrGroupData* gdatap); void handleRemove(); @@ -69,7 +69,7 @@ public: static void callbackClickRemove(void* userdata); static void callbackSelect(LLUICtrl* ctrl, void* userdata); static void callbackAddUsers(const std::vector<std::string>& names, - const std::vector<LLUUID>& agent_ids, + const uuid_vec_t& agent_ids, void* user_data); bool inviteOwnerCallback(const LLSD& notification, const LLSD& response); @@ -111,7 +111,7 @@ LLPanelGroupInvite::impl::~impl() } void LLPanelGroupInvite::impl::addUsers(const std::vector<std::string>& names, - const std::vector<LLUUID>& agent_ids) + const uuid_vec_t& agent_ids) { std::string name; LLUUID id; @@ -361,7 +361,7 @@ void LLPanelGroupInvite::impl::callbackClickOK(void* userdata) //static void LLPanelGroupInvite::impl::callbackAddUsers(const std::vector<std::string>& names, - const std::vector<LLUUID>& ids, + const uuid_vec_t& ids, void* user_data) { impl* selfp = (impl*) user_data; @@ -399,7 +399,7 @@ void LLPanelGroupInvite::clear() mImplementation->mOKButton->setEnabled(FALSE); } -void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids) +void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids) { std::vector<std::string> names; for (S32 i = 0; i < (S32)agent_ids.size(); i++) @@ -456,7 +456,7 @@ void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids) void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const std::string& first_name, const std::string& last_name) { std::vector<std::string> names; - std::vector<LLUUID> agent_ids; + uuid_vec_t agent_ids; std::string full_name = first_name + " " + last_name; agent_ids.push_back(id); names.push_back(first_name + " " + last_name); diff --git a/indra/newview/llpanelgroupinvite.h b/indra/newview/llpanelgroupinvite.h index b095dd2395..2ed443ed46 100644 --- a/indra/newview/llpanelgroupinvite.h +++ b/indra/newview/llpanelgroupinvite.h @@ -42,7 +42,7 @@ public: LLPanelGroupInvite(const LLUUID& group_id); ~LLPanelGroupInvite(); - void addUsers(std::vector<LLUUID>& agent_ids); + void addUsers(uuid_vec_t& agent_ids); /** * this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers(). */ diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 9023afc602..f276df8573 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -1600,6 +1600,8 @@ void LLPanelGroupLandMoney::setGroupID(const LLUUID& id) mImplementationp->mMoneySalesTabEHp->setGroupID(mGroupID); } + mImplementationp->mBeenActivated = true; + activate(); } diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index c6287472fe..0c24e6ad22 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -859,7 +859,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() if (selection.empty()) return; // Build a vector of all selected members, and gather allowed actions. - std::vector<LLUUID> selected_members; + uuid_vec_t selected_members; U64 allowed_by_all = 0xffffffffffffLL; U64 allowed_by_some = 0; @@ -925,8 +925,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() if (cb_enable && (count > 0) && role_id == gdatap->mOwnerRole) { // Check if any owners besides this agent are selected. - std::vector<LLUUID>::const_iterator member_iter; - std::vector<LLUUID>::const_iterator member_end = + uuid_vec_t::const_iterator member_iter; + uuid_vec_t::const_iterator member_end = selected_members.end(); for (member_iter = selected_members.begin(); member_iter != member_end; @@ -952,7 +952,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() //now see if there are any role changes for the selected //members and remember to include them - std::vector<LLUUID>::iterator sel_mem_iter = selected_members.begin(); + uuid_vec_t::iterator sel_mem_iter = selected_members.begin(); for (; sel_mem_iter != selected_members.end(); sel_mem_iter++) { LLRoleMemberChangeType type; @@ -1009,7 +1009,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() check->setTentative( (0 != count) && (selected_members.size() != - (std::vector<LLUUID>::size_type)count)); + (uuid_vec_t::size_type)count)); //NOTE: as of right now a user can break the group //by removing himself from a role if he is the @@ -1084,7 +1084,7 @@ void LLPanelGroupMembersSubTab::onEjectMembers(void *userdata) void LLPanelGroupMembersSubTab::handleEjectMembers() { //send down an eject message - std::vector<LLUUID> selected_members; + uuid_vec_t selected_members; std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); if (selection.empty()) return; @@ -1105,13 +1105,13 @@ void LLPanelGroupMembersSubTab::handleEjectMembers() selected_members); } -void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const std::vector<LLUUID>& selected_members) +void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members) { LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id); if (group_data) { - for (std::vector<LLUUID>::const_iterator i = selected_members.begin(); i != selected_members.end(); ++i) + for (uuid_vec_t::const_iterator i = selected_members.begin(); i != selected_members.end(); ++i) { LLSD args; std::string name; @@ -1437,7 +1437,7 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag if ( role_change_datap ) { - std::vector<LLUUID> roles_to_be_removed; + uuid_vec_t roles_to_be_removed; for (role_change_data_map_t::iterator role = role_change_datap->begin(); role != role_change_datap->end(); ++ role) @@ -2086,8 +2086,8 @@ void LLPanelGroupRolesSubTab::buildMembersList() LLGroupRoleData* rdatap = (*rit).second; if (rdatap) { - std::vector<LLUUID>::const_iterator mit = rdatap->getMembersBegin(); - std::vector<LLUUID>::const_iterator end = rdatap->getMembersEnd(); + uuid_vec_t::const_iterator mit = rdatap->getMembersBegin(); + uuid_vec_t::const_iterator end = rdatap->getMembersEnd(); for ( ; mit != end; ++mit) { mAssignedMembersList->addNameItem((*mit)); diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index eac22a6338..98cebe9882 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -173,7 +173,7 @@ public: static void onEjectMembers(void*); void handleEjectMembers(); - void sendEjectNotifications(const LLUUID& group_id, const std::vector<LLUUID>& selected_members); + void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members); static void onRoleCheck(LLUICtrl* check, void* user_data); void handleRoleCheck(const LLUUID& role_id, diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index 143a64d08b..4ffd43cb0f 100644 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -36,6 +36,7 @@ #include "llcombobox.h" #include "lliconctrl.h" +#include "llinventoryfunctions.h" #include "lllineeditor.h" #include "lltextbox.h" #include "lltexteditor.h" @@ -396,17 +397,20 @@ std::string LLPanelLandmarkInfo::getFullFolderName(const LLViewerInventoryCatego if (is_under_root_category || cat->getParentUUID() == gInventory.getRootFolderID()) { std::string localized_name; + + // Looking for translation only for protected type categories + // to avoid warnings about non existent string in strings.xml. + bool is_protected_type = LLFolderType::lookupIsProtectedType(cat->getPreferredType()); + if (is_under_root_category) { // translate category name, if it's right below the root - // FIXME: it can throw notification about non existent string in strings.xml - bool is_found = LLTrans::findString(localized_name, "InvFolder " + name); + bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + name); name = is_found ? localized_name : name; } else { - // FIXME: it can throw notification about non existent string in strings.xml - bool is_found = LLTrans::findString(localized_name, "InvFolder " + cat->getName()); + bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + cat->getName()); // add translated category name to folder's full name name = (is_found ? localized_name : cat->getName()) + "/" + name; diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index e3b8581aca..c7793bbc43 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -49,6 +49,7 @@ #include "lldndbutton.h" #include "llfloaterworldmap.h" #include "llfolderviewitem.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "lllandmarkactions.h" #include "llplacesinventorybridge.h" @@ -556,7 +557,7 @@ void LLLandmarksPanel::initLibraryInventoryPanel() const LLUUID &landmarks_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false, true); if (landmarks_cat.notNull()) { - gInventory.startBackgroundFetch(landmarks_cat); + LLInventoryModelBackgroundFetch::instance().start(landmarks_cat); } // Expanding "Library" tab for new users who have no landmarks in "My Inventory". @@ -620,7 +621,7 @@ void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesI if (!gInventory.isCategoryComplete(cat_id)) */ { - gInventory.startBackgroundFetch(cat_id); + LLInventoryModelBackgroundFetch::instance().start(cat_id); } // Apply filter substring because it might have been changed @@ -923,12 +924,7 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const return false; } } - else if (!root_folder_view && "category" != command_name) - { - return false; - } else if ( "paste" == command_name - || "rename" == command_name || "cut" == command_name || "copy" == command_name || "delete" == command_name @@ -940,17 +936,16 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const } else if ( "teleport" == command_name || "more_info" == command_name - || "rename" == command_name || "show_on_map" == command_name || "copy_slurl" == command_name ) { // disable some commands for multi-selection. EXT-1757 - if (root_folder_view && - root_folder_view->getSelectedCount() > 1) - { - return false; - } + return root_folder_view && root_folder_view->getSelectedCount() == 1; + } + else if ("rename" == command_name) + { + return root_folder_view && root_folder_view->getSelectedCount() == 1 && canSelectedBeModified(command_name); } else if("category" == command_name) { @@ -1079,7 +1074,7 @@ bool LLLandmarksPanel::canSelectedBeModified(const std::string& command_name) co } else if ("delete" == command_name) { - can_be_modified = listenerp ? listenerp->isItemRemovable() : false; + can_be_modified = listenerp ? listenerp->isItemRemovable() && !listenerp->isItemInTrash() : false; } else if("paste" == command_name) { diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 0b0ef38d77..9301c263da 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -87,6 +87,7 @@ public: // inherited from LLViewerMediaObserver /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); + static void updateServer(); // update the combo box, change the login page to the new server, clear the combo private: friend class LLPanelLoginListener; @@ -103,7 +104,6 @@ private: static void updateServerCombo(); static void onSelectLocation(LLUICtrl*, void*); - static void updateServer(); // update the combo box, change the login page to the new server, clear the combo static void updateLoginPanelLinks(); private: diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index d40141c91d..dbc40959d7 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -40,6 +40,7 @@ #include "llfloaterinventory.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "llfiltereditor.h" #include "llfloaterreg.h" @@ -419,7 +420,7 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) return; } - gInventory.startBackgroundFetch(); + LLInventoryModelBackgroundFetch::instance().start(); mFilterSubString = search_string; if (mActivePanel->getFilterSubString().empty() && mFilterSubString.empty()) @@ -499,7 +500,7 @@ void LLPanelMainInventory::onFilterSelected() if (filter->isActive()) { // If our filter is active we may be the first thing requiring a fetch so we better start it here. - gInventory.startBackgroundFetch(); + LLInventoryModelBackgroundFetch::instance().start(); } setFilterTextFromFilter(); } @@ -566,11 +567,11 @@ void LLPanelMainInventory::updateItemcountText() std::string text = ""; - if (LLInventoryModel::backgroundFetchActive()) + if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive()) { text = getString("ItemcountFetching", string_args); } - else if (LLInventoryModel::isEverythingFetched()) + else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) { text = getString("ItemcountCompleted", string_args); } @@ -600,7 +601,7 @@ void LLPanelMainInventory::toggleFindOptions() if (parent_floater) // Seraph: Fix this, shouldn't be null even for sidepanel parent_floater->addDependentFloater(mFinderHandle); // start background fetch of folders - gInventory.startBackgroundFetch(); + LLInventoryModelBackgroundFetch::instance().start(); } else { diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 3504cbd1ef..35acf8edcc 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -36,6 +36,7 @@ #include "llavatarconstants.h" #include "llpanelme.h" #include "llagent.h" +#include "llagentcamera.h" #include "llagentwearables.h" #include "lliconctrl.h" #include "llsidetray.h" @@ -144,7 +145,7 @@ void LLPanelMe::onEditAppearanceClicked() { if (gAgentWearables.areWearablesLoaded()) { - gAgent.changeCameraToCustomizeAvatar(); + gAgentCamera.changeCameraToCustomizeAvatar(); } } diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp new file mode 100644 index 0000000000..ba22adc01c --- /dev/null +++ b/indra/newview/llpaneloutfitedit.cpp @@ -0,0 +1,519 @@ +/** + * @file llpaneloutfitedit.cpp + * @brief Displays outfit edit information in Side Tray. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpaneloutfitedit.h" + +// *TODO: reorder includes to match the coding standard +#include "llagent.h" +#include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llinventory.h" +#include "llviewercontrol.h" +#include "llui.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "llinventoryfunctions.h" +#include "llinventorypanel.h" +#include "llviewerwindow.h" +#include "llviewerinventory.h" +#include "llbutton.h" +#include "llcombobox.h" +#include "llfiltereditor.h" +#include "llfloaterinventory.h" +#include "llinventorybridge.h" +#include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" +#include "lluiconstants.h" +#include "llscrolllistctrl.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llsdutil.h" +#include "llsidepanelappearance.h" +#include "llwearablelist.h" + +static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit"); + +const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE); +const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT); +const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK; + +class LLInventoryLookObserver : public LLInventoryObserver +{ +public: + LLInventoryLookObserver(LLPanelOutfitEdit *panel) : mPanel(panel) {} + virtual ~LLInventoryLookObserver() + { + if (gInventory.containsObserver(this)) + { + gInventory.removeObserver(this); + } + } + + virtual void changed(U32 mask) + { + if (mask & (LLInventoryObserver::ADD | LLInventoryObserver::REMOVE)) + { + mPanel->updateLookInfo(); + } + } +protected: + LLPanelOutfitEdit *mPanel; +}; + +class LLLookFetchObserver : public LLInventoryFetchDescendentsObserver +{ +public: + LLLookFetchObserver(LLPanelOutfitEdit *panel) : + mPanel(panel) + {} + LLLookFetchObserver() {} + virtual void done() + { + mPanel->lookFetched(); + if(gInventory.containsObserver(this)) + { + gInventory.removeObserver(this); + } + } +private: + LLPanelOutfitEdit *mPanel; +}; + + + +LLPanelOutfitEdit::LLPanelOutfitEdit() +: LLPanel(), mLookID(), mFetchLook(NULL), mSearchFilter(NULL), +mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToLookBtn(NULL), +mRemoveFromLookBtn(NULL), mLookObserver(NULL), mNumItemsInLook(0) +{ + mSavedFolderState = new LLSaveFolderState(); + mSavedFolderState->setApply(FALSE); + + mFetchLook = new LLLookFetchObserver(this); + mLookObserver = new LLInventoryLookObserver(this); + gInventory.addObserver(mLookObserver); + + mLookItemTypes.reserve(NUM_LOOK_ITEM_TYPES); + for (U32 i = 0; i < NUM_LOOK_ITEM_TYPES; i++) + { + mLookItemTypes.push_back(LLLookItemType()); + } + + // TODO: make these strings translatable + mLookItemTypes[LIT_ALL] = LLLookItemType("All Items", ALL_ITEMS_MASK); + mLookItemTypes[LIT_WEARABLE] = LLLookItemType("Shape & Clothing", WEARABLE_MASK); + mLookItemTypes[LIT_ATTACHMENT] = LLLookItemType("Attachments", ATTACHMENT_MASK); + +} + +LLPanelOutfitEdit::~LLPanelOutfitEdit() +{ + delete mSavedFolderState; + if (gInventory.containsObserver(mFetchLook)) + { + gInventory.removeObserver(mFetchLook); + } + delete mFetchLook; + + if (gInventory.containsObserver(mLookObserver)) + { + gInventory.removeObserver(mLookObserver); + } + delete mLookObserver; +} + +BOOL LLPanelOutfitEdit::postBuild() +{ + // gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels + + mLookName = getChild<LLTextBox>("curr_look_name"); + + childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL); + + /* + mLookContents->setDoubleClickCallback(onDoubleClickSpeaker, this); + mLookContents->setCommitOnSelectionChange(TRUE); + mLookContents->setCommitCallback(boost::bind(&LLPanelActiveSpeakers::handleSpeakerSelect, this, _2)); + mLookContents->setSortChangedCallback(boost::bind(&LLPanelActiveSpeakers::onSortChanged, this)); + mLookContents->setContextMenu(LLScrollListCtrl::MENU_AVATAR); + */ + + mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items"); + mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); + mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + // mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); + // mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); + + LLComboBox* type_filter = getChild<LLComboBox>("inventory_filter"); + type_filter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onTypeFilterChanged, this, _1)); + type_filter->removeall(); + for (U32 i = 0; i < mLookItemTypes.size(); ++i) + { + type_filter->add(mLookItemTypes[i].displayName); + } + type_filter->setCurrentByIndex(LIT_ALL); + + mSearchFilter = getChild<LLFilterEditor>("look_item_filter"); + mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2)); + + /* Removing add to look inline button (not part of mvp for viewer 2) + LLButton::Params add_params; + add_params.name("add_to_look"); + add_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this)); + add_params.label("+"); + + mAddToLookBtn = LLUICtrlFactory::create<LLButton>(add_params); + mAddToLookBtn->setEnabled(FALSE); + mAddToLookBtn->setVisible(FALSE); */ + + childSetAction("add_item_btn", boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this), this); + + mUpBtn = getChild<LLButton>("up_btn"); + mUpBtn->setEnabled(TRUE); + mUpBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onUpClicked, this)); + + mLookContents = getChild<LLScrollListCtrl>("look_items_list"); + mLookContents->sortByColumn("look_item_sort", TRUE); + mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onLookItemSelectionChange, this)); + + /* + LLButton::Params remove_params; + remove_params.name("remove_from_look"); + remove_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this)); + remove_params.label("-"); */ + + //mRemoveFromLookBtn = LLUICtrlFactory::create<LLButton>(remove_params); + mRemoveFromLookBtn = getChild<LLButton>("remove_from_look_btn"); + mRemoveFromLookBtn->setEnabled(FALSE); + mRemoveFromLookBtn->setVisible(FALSE); + //childSetAction("remove_from_look_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this); + mRemoveFromLookBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this)); + //getChild<LLPanel>("look_info_group_bar")->addChild(mRemoveFromLookBtn); remove_item_btn + + mEditWearableBtn = getChild<LLButton>("edit_wearable_btn"); + mEditWearableBtn->setEnabled(FALSE); + mEditWearableBtn->setVisible(FALSE); + mEditWearableBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this)); + + childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this); + + return TRUE; +} + +void LLPanelOutfitEdit::showAddWearablesPanel() +{ + childSetVisible("add_wearables_panel", childGetValue("add_btn")); +} + +void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl) +{ + LLComboBox* type_filter = dynamic_cast<LLComboBox*>(ctrl); + llassert(type_filter); + if (type_filter) + { + U32 curr_filter_type = type_filter->getCurrentIndex(); + mInventoryItemsPanel->setFilterTypes(mLookItemTypes[curr_filter_type].inventoryMask); + } + + mSavedFolderState->setApply(TRUE); + mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + + LLOpenFoldersWithSelection opener; + mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener); + mInventoryItemsPanel->getRootFolder()->scrollToShowSelection(); + + LLInventoryModelBackgroundFetch::instance().start(); +} + +void LLPanelOutfitEdit::onSearchEdit(const std::string& string) +{ + if (mSearchString != string) + { + mSearchString = string; + + // Searches are case-insensitive + LLStringUtil::toUpper(mSearchString); + LLStringUtil::trimHead(mSearchString); + } + + if (mSearchString == "") + { + mInventoryItemsPanel->setFilterSubString(LLStringUtil::null); + + // re-open folders that were initially open + mSavedFolderState->setApply(TRUE); + mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + LLOpenFoldersWithSelection opener; + mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener); + mInventoryItemsPanel->getRootFolder()->scrollToShowSelection(); + } + + LLInventoryModelBackgroundFetch::instance().start(); + + if (mInventoryItemsPanel->getFilterSubString().empty() && mSearchString.empty()) + { + // current filter and new filter empty, do nothing + return; + } + + // save current folder open state if no filter currently applied + if (mInventoryItemsPanel->getRootFolder()->getFilterSubString().empty()) + { + mSavedFolderState->setApply(FALSE); + mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + } + + // set new filter string + mInventoryItemsPanel->setFilterSubString(mSearchString); +} + +void LLPanelOutfitEdit::onAddToLookClicked(void) +{ + LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); + LLFolderViewEventListener* listenerp = curr_item->getListener(); + link_inventory_item(gAgent.getID(), listenerp->getUUID(), mLookID, listenerp->getName(), + LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL)); + updateLookInfo(); +} + + +void LLPanelOutfitEdit::onRemoveFromLookClicked(void) +{ + LLUUID id_to_remove = mLookContents->getSelectionInterface()->getCurrentID(); + + LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove); + + if (item_to_remove) + { + // returns null if not a wearable (attachment, etc). + const LLWearable* wearable_to_remove = gAgentWearables.getWearableFromAssetID(item_to_remove->getAssetUUID()); + if (!wearable_to_remove || gAgentWearables.canWearableBeRemoved( wearable_to_remove )) + { + gInventory.purgeObject( id_to_remove ); + updateLookInfo(); + mRemoveFromLookBtn->setEnabled(FALSE); + if (mRemoveFromLookBtn->getVisible()) + { + mRemoveFromLookBtn->setVisible(FALSE); + } + } + } +} + + +void LLPanelOutfitEdit::onUpClicked(void) +{ + LLUUID inv_id = mLookContents->getSelectionInterface()->getCurrentID(); + if (inv_id.isNull()) + { + //nothing selected, do nothing + return; + } + + LLViewerInventoryItem *link_item = gInventory.getItem(inv_id); + if (!link_item) + { + llwarns << "could not find inventory item based on currently worn link." << llendl; + return; + } + + + LLUUID asset_id = link_item->getAssetUUID(); + if (asset_id.isNull()) + { + llwarns << "inventory link has null Asset ID. could not get object reference" << llendl; + } + + static const std::string empty = ""; + LLWearableList::instance().getAsset(asset_id, + empty, // don't care about wearable name + link_item->getActualType(), + LLSidepanelAppearance::editWearable, + (void*)getParentUICtrl()); +} + + +void LLPanelOutfitEdit::onEditWearableClicked(void) +{ + LLUUID id_to_edit = mLookContents->getSelectionInterface()->getCurrentID(); + + LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit); + + if (item_to_edit) + { + // returns null if not a wearable (attachment, etc). + LLWearable* wearable_to_edit = gAgentWearables.getWearableFromAssetID(item_to_edit->getAssetUUID()); + if (!wearable_to_edit || !wearable_to_edit->getPermissions().allowModifyBy(gAgent.getID()) ) + { + LLSidepanelAppearance::editWearable(wearable_to_edit, getParent()); + if (mEditWearableBtn->getVisible()) + { + mEditWearableBtn->setVisible(FALSE); + } + } + } +} + +void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action) +{ + LLFolderViewItem* current_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); + if (!current_item) + { + return; + } + + /* Removing add to look inline button (not part of mvp for viewer 2) + LLRect btn_rect(current_item->getLocalRect().mRight - 50, + current_item->getLocalRect().mTop, + current_item->getLocalRect().mRight - 30, + current_item->getLocalRect().mBottom); + + mAddToLookBtn->setRect(btn_rect); + mAddToLookBtn->setEnabled(TRUE); + if (!mAddToLookBtn->getVisible()) + { + mAddToLookBtn->setVisible(TRUE); + } + + current_item->addChild(mAddToLookBtn); */ +} + +void LLPanelOutfitEdit::onLookItemSelectionChange(void) +{ + S32 left_offset = -4; + S32 top_offset = -10; + LLRect rect = mLookContents->getLastSelectedItem()->getRect(); + LLRect btn_rect( + left_offset + rect.mRight - 50, + top_offset + rect.mTop, + left_offset + rect.mRight - 30, + top_offset + rect.mBottom); + + mEditWearableBtn->setRect(btn_rect); + + mEditWearableBtn->setEnabled(TRUE); + if (!mEditWearableBtn->getVisible()) + { + mEditWearableBtn->setVisible(TRUE); + } + //mLookContents->addChild(mRemoveFromLookBtn); +} + +void LLPanelOutfitEdit::changed(U32 mask) +{ +} + +void LLPanelOutfitEdit::lookFetched(void) +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + + // collectDescendentsIf takes non-const reference: + LLFindCOFValidItems is_cof_valid; + gInventory.collectDescendentsIf(mLookID, + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH, + is_cof_valid); + for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); + iter != item_array.end(); + iter++) + { + const LLViewerInventoryItem *item = (*iter); + + LLSD row; + row["id"] = item->getUUID(); + LLSD& columns = row["columns"]; + columns[0]["column"] = "look_item"; + columns[0]["type"] = "text"; + columns[0]["value"] = item->getName(); + columns[1]["column"] = "look_item_sort"; + columns[1]["type"] = "text"; // TODO: multi-wearable sort "type" should go here. + columns[1]["value"] = "BAR"; // TODO: Multi-wearable sort index should go here + + mLookContents->addElement(row); + } + + if (mLookContents->getItemCount() != mNumItemsInLook) + { + mNumItemsInLook = mLookContents->getItemCount(); + LLAppearanceMgr::instance().updateCOF(mLookID); + } +} + +void LLPanelOutfitEdit::updateLookInfo() +{ + if (getVisible()) + { + mLookContents->clearRows(); + + uuid_vec_t folders; + folders.push_back(mLookID); + mFetchLook->fetchDescendents(folders); + if (mFetchLook->isEverythingComplete()) + { + mFetchLook->done(); + } + else + { + gInventory.addObserver(mFetchLook); + } + } +} + +void LLPanelOutfitEdit::displayLookInfo(const LLInventoryCategory* pLook) +{ + if (!pLook) + { + return; + } + + if (!getVisible()) + { + setVisible(TRUE); + } + + if (mLookID != pLook->getUUID()) + { + mLookID = pLook->getUUID(); + mLookName->setText(pLook->getName()); + updateLookInfo(); + } +} + +void LLPanelOutfitEdit::reset() +{ + mLookID.setNull(); +} + diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h new file mode 100644 index 0000000000..5c00f84e0e --- /dev/null +++ b/indra/newview/llpaneloutfitedit.h @@ -0,0 +1,129 @@ +/** + * @file llpaneloutfitedit.h + * @brief Displays outfit edit information in Side Tray. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELOUTFITEDIT_H +#define LL_LLPANELOUTFITEDIT_H + +#include "llpanel.h" + +#include "v3dmath.h" +#include "lluuid.h" + +#include "lliconctrl.h" + +#include "llremoteparcelrequest.h" +#include "llinventory.h" +#include "llinventorymodel.h" + +class LLButton; +class LLTextBox; +class LLInventoryCategory; +class LLInventoryLookObserver; +class LLInventoryPanel; +class LLSaveFolderState; +class LLFolderViewItem; +class LLScrollListCtrl; +class LLLookFetchObserver; +class LLFilterEditor; + +class LLPanelOutfitEdit : public LLPanel +{ +public: + + // NOTE: initialize mLookItemTypes at the index of any new enum you add in the LLPanelOutfitEdit() constructor + typedef enum e_look_item_type + { + LIT_ALL = 0, + LIT_WEARABLE, // clothing or shape + LIT_ATTACHMENT, + NUM_LOOK_ITEM_TYPES + } ELookItemType; + + struct LLLookItemType { + std::string displayName; + U64 inventoryMask; + LLLookItemType() : displayName("NONE"), inventoryMask(0) {} + LLLookItemType(std::string name, U64 mask) : displayName(name), inventoryMask(mask) {} + }; + + LLPanelOutfitEdit(); + /*virtual*/ ~LLPanelOutfitEdit(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void changed(U32 mask); + + void reset(); + // Ignore all old information, useful if you are + // recycling an existing dialog and need to clear it. + + /*virtual*/ void setParcelID(const LLUUID& parcel_id); + // Sends a request for data about the given parcel, which will + // only update the location if there is none already available. + + void showAddWearablesPanel(); + + void onTypeFilterChanged(LLUICtrl* ctrl); + void onSearchEdit(const std::string& string); + void onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); + void onAddToLookClicked(void); + void onLookItemSelectionChange(void); + void onRemoveFromLookClicked(void); + void onEditWearableClicked(void); + void onUpClicked(void); + + void displayLookInfo(const LLInventoryCategory* pLook); + + void lookFetched(void); + + void updateLookInfo(void); + +private: + + LLUUID mLookID; + LLTextBox* mLookName; + LLScrollListCtrl* mLookContents; + LLInventoryPanel* mInventoryItemsPanel; + LLFilterEditor* mSearchFilter; + LLSaveFolderState* mSavedFolderState; + std::string mSearchString; + LLButton* mAddToLookBtn; + LLButton* mRemoveFromLookBtn; + LLButton* mUpBtn; + LLButton* mEditWearableBtn; + S32 mNumItemsInLook; + + LLLookFetchObserver* mFetchLook; + LLInventoryLookObserver* mLookObserver; + std::vector<LLLookItemType> mLookItemTypes; +}; + +#endif // LL_LLPANELOUTFITEDIT_H diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index c2f2d32142..7137022447 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -43,10 +43,12 @@ #include "llfloaterinventory.h" #include "llfoldervieweventlistener.h" #include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "lllandmark.h" #include "lllineeditor.h" #include "llmodaldialog.h" +#include "llnotificationsutil.h" #include "llsidepanelappearance.h" #include "llsidetray.h" #include "lltabcontainer.h" @@ -67,75 +69,13 @@ static const std::string COF_TAB_NAME = "cof_tab"; static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory"); bool LLPanelOutfitsInventory::sShowDebugEditor = false; -class LLOutfitSaveAsDialog : public LLModalDialog -{ -private: - std::string mItemName; - std::string mTempItemName; - - boost::signals2::signal<void (const std::string&)> mSaveAsSignal; - -public: - LLOutfitSaveAsDialog( const LLSD& key ) - : LLModalDialog( key ), - mTempItemName(key.asString()) - { - } - - BOOL postBuild() - { - getChild<LLUICtrl>("Save")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onSave, this )); - getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onCancel, this )); - - childSetTextArg("name ed", "[DESC]", mTempItemName); - return TRUE; - } - - void setSaveAsCommit( const boost::signals2::signal<void (const std::string&)>::slot_type& cb ) - { - mSaveAsSignal.connect(cb); - } - - virtual void onOpen(const LLSD& key) - { - LLLineEditor* edit = getChild<LLLineEditor>("name ed"); - if (edit) - { - edit->setFocus(TRUE); - edit->selectAll(); - } - } - void onSave() - { - mItemName = childGetValue("name ed").asString(); - LLStringUtil::trim(mItemName); - if( !mItemName.empty() ) - { - mSaveAsSignal(mItemName); - closeFloater(); // destroys this object - } - } - - void onCancel() - { - closeFloater(); // destroys this object - } -}; - LLPanelOutfitsInventory::LLPanelOutfitsInventory() : mActivePanel(NULL), mParent(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); - - static bool registered_dialog = false; - if (!registered_dialog) - { - LLFloaterReg::add("outfit_save_as", "floater_outfit_save_as.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutfitSaveAsDialog>); - registered_dialog = true; - } } LLPanelOutfitsInventory::~LLPanelOutfitsInventory() @@ -217,7 +157,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string) getRootFolder()->scrollToShowSelection(); } - gInventory.startBackgroundFetch(); + LLInventoryModelBackgroundFetch::instance().start(); if (mActivePanel->getFilterSubString().empty() && string.empty()) { @@ -267,32 +207,56 @@ void LLPanelOutfitsInventory::onEdit() { } +bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + std::string outfit_name = response["message"].asString(); + LLStringUtil::trim(outfit_name); + if( !outfit_name.empty() ) + { + LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name); + LLSD key; + LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); + + if (mAppearanceTabs) + { + mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME); + } + } + } + + return false; +} + + + void LLPanelOutfitsInventory::onSave() { std::string outfit_name; - if (!LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name)) + if (!LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) { outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT); } + LLSD args; + args["DESC"] = outfit_name; + + LLSD payload; + //payload["ids"].append(*it); + + LLNotificationsUtil::add("SaveOutfitAs", args, payload, boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1, _2)); + + //) + +/* LLOutfitSaveAsDialog* save_as_dialog = LLFloaterReg::showTypedInstance<LLOutfitSaveAsDialog>("outfit_save_as", LLSD(outfit_name), TRUE); if (save_as_dialog) { save_as_dialog->setSaveAsCommit(boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1 )); - } -} - -void LLPanelOutfitsInventory::onSaveCommit(const std::string& outfit_name) -{ - LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name); - LLSD key; - LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); - - if (mAppearanceTabs) - { - mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME); - } + }*/ } void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action) diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index ab25ef0a49..a4d38df740 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -61,7 +61,7 @@ public: void onEdit(); void onSave(); - void onSaveCommit(const std::string& item_name); + bool onSaveCommit(const LLSD& notification, const LLSD& response); void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); void onSelectorButtonClicked(); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 1194732df4..7f5e63adee 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -134,13 +134,13 @@ public: typedef std::map < LLUUID, LLVector3d > id_to_pos_map_t; LLAvatarItemDistanceComparator() {}; - void updateAvatarsPositions(std::vector<LLVector3d>& positions, std::vector<LLUUID>& uuids) + void updateAvatarsPositions(std::vector<LLVector3d>& positions, uuid_vec_t& uuids) { std::vector<LLVector3d>::const_iterator pos_it = positions.begin(), pos_end = positions.end(); - std::vector<LLUUID>::const_iterator + uuid_vec_t::const_iterator id_it = uuids.begin(), id_end = uuids.end(); @@ -178,8 +178,8 @@ public: protected: virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const { - LLPointer<LLSpeaker> lhs = LLLocalSpeakerMgr::instance().findSpeaker(item1->getAvatarId()); - LLPointer<LLSpeaker> rhs = LLLocalSpeakerMgr::instance().findSpeaker(item2->getAvatarId()); + LLPointer<LLSpeaker> lhs = LLActiveSpeakerMgr::instance().findSpeaker(item1->getAvatarId()); + LLPointer<LLSpeaker> rhs = LLActiveSpeakerMgr::instance().findSpeaker(item2->getAvatarId()); if ( lhs.notNull() && rhs.notNull() ) { // Compare by last speaking time @@ -672,11 +672,6 @@ void LLPanelPeople::updateFriendList() lldebugs << "Friends Cards were not found" << llendl; } - // show special help text for just created account to help found friends. EXT-4836 - static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_msg"); - no_friends_text->setVisible(all_friendsp.size() == 0); - - LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin(); for (; buddy_it != all_buddies.end(); ++buddy_it) { @@ -685,6 +680,14 @@ void LLPanelPeople::updateFriendList() online_friendsp.push_back(buddy_id); } + // show special help text for just created account to help found friends. EXT-4836 + static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_msg"); + + // Seems sometimes all_friends can be empty because of issue with Inventory loading (clear cache, slow connection...) + // So, lets check all lists to avoid overlapping the text with online list. See EXT-6448. + bool any_friend_exists = (all_friendsp.size() > 0) || (online_friendsp.size() > 0); + no_friends_text->setVisible(!any_friend_exists); + /* * Avatarlists will be hidden by showFriendsAccordionsIfNeeded(), if they do not have items. * But avatarlist can be updated only if it is visible @see LLAvatarList::draw(); @@ -708,7 +711,7 @@ void LLPanelPeople::updateNearbyList() mNearbyList->setDirty(); DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs()); - LLLocalSpeakerMgr::instance().update(TRUE); + LLActiveSpeakerMgr::instance().update(TRUE); } void LLPanelPeople::updateRecentList() @@ -756,7 +759,7 @@ void LLPanelPeople::updateButtons() //bool recent_tab_active = (cur_tab == RECENT_TAB_NAME); LLUUID selected_id; - std::vector<LLUUID> selected_uuids; + uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); bool item_selected = (selected_uuids.size() == 1); bool multiple_selected = (selected_uuids.size() >= 1); @@ -852,7 +855,7 @@ LLUUID LLPanelPeople::getCurrentItemID() const return LLUUID::null; } -void LLPanelPeople::getCurrentItemIDs(std::vector<LLUUID>& selected_uuids) const +void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const { std::string cur_tab = getActiveTabName(); @@ -1063,10 +1066,10 @@ void LLPanelPeople::onAddFriendButtonClicked() } } -bool LLPanelPeople::isItemsFreeOfFriends(const std::vector<LLUUID>& uuids) +bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) { const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); - for ( std::vector<LLUUID>::const_iterator + for ( uuid_vec_t::const_iterator id = uuids.begin(), id_end = uuids.end(); id != id_end; ++id ) @@ -1094,7 +1097,7 @@ void LLPanelPeople::onAddFriendWizButtonClicked() void LLPanelPeople::onDeleteFriendButtonClicked() { - std::vector<LLUUID> selected_uuids; + uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); if (selected_uuids.size() == 1) @@ -1121,7 +1124,7 @@ void LLPanelPeople::onChatButtonClicked() void LLPanelPeople::onImButtonClicked() { - std::vector<LLUUID> selected_uuids; + uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); if ( selected_uuids.size() == 1 ) { @@ -1143,7 +1146,7 @@ void LLPanelPeople::onActivateButtonClicked() // static void LLPanelPeople::onAvatarPicked( const std::vector<std::string>& names, - const std::vector<LLUUID>& ids) + const uuid_vec_t& ids) { if (!names.empty() && !ids.empty()) LLAvatarActions::requestFriendshipDialog(ids[0], names[0]); @@ -1293,7 +1296,7 @@ bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata) void LLPanelPeople::onCallButtonClicked() { - std::vector<LLUUID> selected_uuids; + uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); if (selected_uuids.size() == 1) diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 6d3d436156..891381e2de 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -78,12 +78,12 @@ private: void updateRecentList(); bool isFriendOnline(const LLUUID& id); - bool isItemsFreeOfFriends(const std::vector<LLUUID>& uuids); + bool isItemsFreeOfFriends(const uuid_vec_t& uuids); void updateButtons(); std::string getActiveTabName() const; LLUUID getCurrentItemID() const; - void getCurrentItemIDs(std::vector<LLUUID>& selected_uuids) const; + void getCurrentItemIDs(uuid_vec_t& selected_uuids) const; void buttonSetVisible(std::string btn_name, BOOL visible); void buttonSetEnabled(const std::string& btn_name, bool enabled); void buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb); @@ -134,7 +134,7 @@ private: // misc callbacks static void onAvatarPicked( const std::vector<std::string>& names, - const std::vector<LLUUID>& ids); + const uuid_vec_t& ids); void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list); diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 854651cd01..862e32cca8 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -72,7 +72,7 @@ ContextMenu::~ContextMenu() } } -void ContextMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y) +void ContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y) { if (mMenu) { @@ -177,7 +177,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) bool result = (mUUIDs.size() > 0); - std::vector<LLUUID>::const_iterator + uuid_vec_t::const_iterator id = mUUIDs.begin(), uuids_end = mUUIDs.end(); @@ -200,7 +200,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) bool result = (mUUIDs.size() > 0); - std::vector<LLUUID>::const_iterator + uuid_vec_t::const_iterator id = mUUIDs.begin(), uuids_end = mUUIDs.end(); @@ -226,6 +226,11 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) || gAgent.isGodlike(); } + else if(item == std::string("can_offer_teleport")) + { + const LLUUID& id = mUUIDs.front(); + return LLAvatarActions::canOfferTeleport(id); + } return false; } diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h index 913638d8c8..8e12710afc 100644 --- a/indra/newview/llpanelpeoplemenus.h +++ b/indra/newview/llpanelpeoplemenus.h @@ -52,7 +52,7 @@ public: * * @param uuids - an array of avatar or group ids */ - /*virtual*/ void show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y); + /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y); virtual void hide(); @@ -60,7 +60,7 @@ protected: virtual LLContextMenu* createMenu() = 0; - std::vector<LLUUID> mUUIDs; + uuid_vec_t mUUIDs; LLContextMenu* mMenu; LLHandle<LLView> mMenuHandle; }; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 01b6e8ffad..71d16a08b4 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -195,8 +195,8 @@ void LLPanelPermissions::disableAll() childSetEnabled("Owner Name", FALSE); childSetEnabled("Group:", FALSE); - childSetText("Group Name", LLStringUtil::null); - childSetEnabled("Group Name", FALSE); + childSetText("Group Name Proxy", LLStringUtil::null); + childSetEnabled("Group Name Proxy", FALSE); childSetEnabled("button set group", FALSE); childSetText("Object Name", LLStringUtil::null); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 6f920cf4b9..bde8d02885 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -288,7 +288,8 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type) LLAvatarClassifieds* c_info = static_cast<LLAvatarClassifieds*>(data); if(c_info && getAvatarId() == c_info->target_id) { - mClassifiedsList->clear(); + // do not clear classified list in case we will receive two or more data packets. + // list has been cleared in updateData(). (fix for EXT-6436) LLAvatarClassifieds::classifieds_list_t::const_iterator it = c_info->classifieds_list.begin(); for(; c_info->classifieds_list.end() != it; ++it) diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index f9ba6f625d..54455afa4f 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -551,7 +551,9 @@ void LLPanelPlaces::onTeleportButtonClicked() { LLSD payload; payload["asset_id"] = mItem->getAssetUUID(); - LLNotificationsUtil::add("TeleportFromLandmark", LLSD(), payload); + LLSD args; + args["LOCATION"] = mItem->getName(); + LLNotificationsUtil::add("TeleportFromLandmark", args, payload); } else if (mPlaceInfoType == AGENT_INFO_TYPE || mPlaceInfoType == REMOTE_PLACE_INFO_TYPE || @@ -1006,9 +1008,9 @@ void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos) updateVerbs(); } -void LLPanelPlaces::showAddedLandmarkInfo(const std::vector<LLUUID>& items) +void LLPanelPlaces::showAddedLandmarkInfo(const uuid_vec_t& items) { - for (std::vector<LLUUID>::const_iterator item_iter = items.begin(); + for (uuid_vec_t::const_iterator item_iter = items.begin(); item_iter != items.end(); ++item_iter) { diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index 78fcbbb11d..97cf43d222 100644 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -73,7 +73,7 @@ public: void changedGlobalPos(const LLVector3d &global_pos); // Opens landmark info panel when agent creates or receives landmark. - void showAddedLandmarkInfo(const std::vector<LLUUID>& items); + void showAddedLandmarkInfo(const uuid_vec_t& items); void setItem(LLInventoryItem* item); diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index a53a3ba1ad..ab2f9284f7 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -33,6 +33,7 @@ //LLPanelPrimMediaControls #include "llagent.h" +#include "llagentcamera.h" #include "llparcel.h" #include "llpanel.h" #include "llselectmgr.h" @@ -1010,7 +1011,7 @@ void LLPanelPrimMediaControls::updateZoom() { case ZOOM_NONE: { - gAgent.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); break; } case ZOOM_FAR: @@ -1030,7 +1031,7 @@ void LLPanelPrimMediaControls::updateZoom() } default: { - gAgent.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); break; } } diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 90c8f2551f..0a34531eee 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -348,7 +348,7 @@ LLContextMenu* LLTeleportHistoryPanel::ContextMenu::createMenu() void LLTeleportHistoryPanel::ContextMenu::onTeleport() { - LLTeleportHistoryStorage::getInstance()->goToItem(mIndex); + confirmTeleport(mIndex); } void LLTeleportHistoryPanel::ContextMenu::onInfo() @@ -507,7 +507,7 @@ void LLTeleportHistoryPanel::onTeleport() return; // teleport to existing item in history, so we don't add it again - mTeleportHistory->goToItem(itemp->getIndex()); + confirmTeleport(itemp->getIndex()); } /* @@ -1058,3 +1058,27 @@ void LLTeleportHistoryPanel::onAccordionExpand(LLUICtrl* ctrl, const LLSD& param mLastSelectedFlatlList->resetSelection(); } } + +// static +void LLTeleportHistoryPanel::confirmTeleport(S32 hist_idx) +{ + LLSD args; + args["HISTORY_ENTRY"] = LLTeleportHistoryStorage::getInstance()->getItems()[hist_idx].mTitle; + LLNotificationsUtil::add("TeleportToHistoryEntry", args, LLSD(), + boost::bind(&LLTeleportHistoryPanel::onTeleportConfirmation, _1, _2, hist_idx)); +} + +// Called when user reacts upon teleport confirmation dialog. +// static +bool LLTeleportHistoryPanel::onTeleportConfirmation(const LLSD& notification, const LLSD& response, S32 hist_idx) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (0 == option) + { + // Teleport to given history item. + LLTeleportHistoryStorage::getInstance()->goToItem(hist_idx); + } + + return false; +} diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index 4eeaec7705..5e2ccc0c93 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -103,6 +103,9 @@ private: bool isAccordionCollapsedByUser(LLUICtrl* acc_tab); void onAccordionExpand(LLUICtrl* ctrl, const LLSD& param); + static void confirmTeleport(S32 hist_idx); + static bool onTeleportConfirmation(const LLSD& notification, const LLSD& response, S32 hist_idx); + LLTeleportHistoryStorage* mTeleportHistory; LLAccordionCtrl* mHistoryAccordion; diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 89672b7a0f..268738d88c 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -444,7 +444,7 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu() return main_menu; } -void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y) +void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y) { LLPanelPeopleMenus::ContextMenu::show(spawning_view, uuids, x, y); @@ -614,7 +614,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& bool result = (mUUIDs.size() > 0); - std::vector<LLUUID>::const_iterator + uuid_vec_t::const_iterator id = mUUIDs.begin(), uuids_end = mUUIDs.end(); diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index e1b1b5af00..d9ca4230a9 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -152,7 +152,7 @@ class LLParticipantList public: LLParticipantListMenu(LLParticipantList& parent):mParent(parent){}; /*virtual*/ LLContextMenu* createMenu(); - /*virtual*/ void show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y); + /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y); protected: LLParticipantList& mParent; private: diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 0b0c03e9e9..d5ec3a36c3 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -179,10 +179,9 @@ void LLPreview::onCommit() // update the object itself. if( item->getType() == LLAssetType::AT_OBJECT ) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar ) + if (isAgentAvatarValid()) { - LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); + LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() ); if( obj ) { LLSelectMgr::getInstance()->deselectAll(); diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 0cc747f789..262961b73b 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -71,7 +71,7 @@ BOOL LLPreviewAnim::postBuild() const LLInventoryItem* item = getItem(); if(item) { - gAgent.getAvatarObject()->createMotion(item->getAssetUUID()); // preload the animation + gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation childSetText("desc", item->getDescription()); } @@ -125,10 +125,7 @@ void LLPreviewAnim::playAnim( void *userdata ) { self->mPauseRequest = NULL; gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START); - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLMotion* motion = avatar->findMotion(itemID); - + LLMotion* motion = gAgentAvatarp->findMotion(itemID); if (motion) { motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle()))); @@ -136,7 +133,7 @@ void LLPreviewAnim::playAnim( void *userdata ) } else { - gAgent.getAvatarObject()->stopMotion(itemID); + gAgentAvatarp->stopMotion(itemID); gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP); } } @@ -161,10 +158,8 @@ void LLPreviewAnim::auditionAnim( void *userdata ) if (self->childGetValue("Anim audition btn").asBoolean() ) { self->mPauseRequest = NULL; - gAgent.getAvatarObject()->startMotion(item->getAssetUUID()); - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLMotion* motion = avatar->findMotion(itemID); + gAgentAvatarp->startMotion(item->getAssetUUID()); + LLMotion* motion = gAgentAvatarp->findMotion(itemID); if (motion) { @@ -173,7 +168,7 @@ void LLPreviewAnim::auditionAnim( void *userdata ) } else { - gAgent.getAvatarObject()->stopMotion(itemID); + gAgentAvatarp->stopMotion(itemID); gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP); } } @@ -186,11 +181,9 @@ void LLPreviewAnim::onClose(bool app_quitting) if(item) { - gAgent.getAvatarObject()->stopMotion(item->getAssetUUID()); + gAgentAvatarp->stopMotion(item->getAssetUUID()); gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP); - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLMotion* motion = avatar->findMotion(item->getAssetUUID()); + LLMotion* motion = gAgentAvatarp->findMotion(item->getAssetUUID()); if (motion) { diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 57a8ca3d12..11cde47744 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -42,6 +42,8 @@ #include "llstring.h" #include "lldir.h" #include "llfloaterreg.h" +#include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llmultigesture.h" #include "llnotificationsutil.h" #include "llvfile.h" @@ -97,7 +99,7 @@ protected: void LLInventoryGestureAvailable::done() { - for(item_ref_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it) + for(uuid_vec_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it) { LLPreviewGesture* preview = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", *it); if(preview) @@ -131,10 +133,10 @@ LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& ob // Start speculative download of sounds and animations const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION); - gInventory.startBackgroundFetch(animation_folder_id); + LLInventoryModelBackgroundFetch::instance().start(animation_folder_id); const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND); - gInventory.startBackgroundFetch(sound_folder_id); + LLInventoryModelBackgroundFetch::instance().start(sound_folder_id); // this will call refresh when we have everything. LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem(); @@ -269,7 +271,7 @@ BOOL LLPreviewGesture::canClose() // virtual void LLPreviewGesture::onClose(bool app_quitting) { - LLGestureManager::instance().stopGesture(mPreviewGesture); + LLGestureMgr::instance().stopGesture(mPreviewGesture); } // virtual @@ -293,13 +295,13 @@ bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const L switch(option) { case 0: // "Yes" - LLGestureManager::instance().stopGesture(mPreviewGesture); + LLGestureMgr::instance().stopGesture(mPreviewGesture); mCloseAfterSave = TRUE; onClickSave(this); break; case 1: // "No" - LLGestureManager::instance().stopGesture(mPreviewGesture); + LLGestureMgr::instance().stopGesture(mPreviewGesture); mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog... closeFloater(); break; @@ -784,7 +786,7 @@ void LLPreviewGesture::refresh() mOptionsText->setText(optionstext); - BOOL active = LLGestureManager::instance().isGestureActive(mItemUUID); + BOOL active = LLGestureMgr::instance().isGestureActive(mItemUUID); mActiveCheck->set(active); // Can only preview if there are steps @@ -1138,10 +1140,10 @@ void LLPreviewGesture::saveIfNeeded() // If this gesture is active, then we need to update the in-memory // active map with the new pointer. - if (!delayedUpload && LLGestureManager::instance().isGestureActive(mItemUUID)) + if (!delayedUpload && LLGestureMgr::instance().isGestureActive(mItemUUID)) { // gesture manager now owns the pointer - LLGestureManager::instance().replaceGesture(mItemUUID, gesture, asset_id); + LLGestureMgr::instance().replaceGesture(mItemUUID, gesture, asset_id); // replaceGesture may deactivate other gestures so let the // inventory know. @@ -1702,13 +1704,13 @@ void LLPreviewGesture::onClickDelete(void* data) void LLPreviewGesture::onCommitActive(LLUICtrl* ctrl, void* data) { LLPreviewGesture* self = (LLPreviewGesture*)data; - if (!LLGestureManager::instance().isGestureActive(self->mItemUUID)) + if (!LLGestureMgr::instance().isGestureActive(self->mItemUUID)) { - LLGestureManager::instance().activateGesture(self->mItemUUID); + LLGestureMgr::instance().activateGesture(self->mItemUUID); } else { - LLGestureManager::instance().deactivateGesture(self->mItemUUID); + LLGestureMgr::instance().deactivateGesture(self->mItemUUID); } // Make sure the (active) label in the inventory gets updated. @@ -1747,14 +1749,14 @@ void LLPreviewGesture::onClickPreview(void* data) self->mPreviewBtn->setLabel(self->getString("stop_txt")); // play it, and delete when done - LLGestureManager::instance().playGesture(self->mPreviewGesture); + LLGestureMgr::instance().playGesture(self->mPreviewGesture); self->refresh(); } else { // Will call onDonePreview() below - LLGestureManager::instance().stopGesture(self->mPreviewGesture); + LLGestureMgr::instance().stopGesture(self->mPreviewGesture); self->refresh(); } diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index ee8e3f1db6..bfd9a840f2 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -38,6 +38,7 @@ #include "llagent.h" #include "llassetuploadresponders.h" +#include "lldraghandle.h" #include "llviewerwindow.h" #include "llbutton.h" #include "llfloaterreg.h" @@ -188,6 +189,20 @@ void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id) loadAsset(); } +void LLPreviewNotecard::updateTitleButtons() +{ + LLPreview::updateTitleButtons(); + + LLUICtrl* lock_btn = getChild<LLUICtrl>("lock"); + if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. + { + LLRect lock_rc = lock_btn->getRect(); + LLRect buttons_rect = getDragHandle()->getButtonsRect(); + buttons_rect.mLeft = lock_rc.mLeft; + getDragHandle()->setButtonsRect(buttons_rect); + } +} + void LLPreviewNotecard::loadAsset() { // request the asset. diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 5b8cf1c2f6..e0363eef54 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -79,6 +79,7 @@ public: protected: + void updateTitleButtons(); virtual void loadAsset(); bool saveIfNeeded(LLInventoryItem* copyitem = NULL); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index f5a9f82d50..4167408fc3 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1090,8 +1090,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save) // Save needs to compile the text in the buffer. If the compile // succeeds, then save both assets out to the database. If the compile -// fails, go ahead and save the text anyway so that the user doesn't -// get too fucked. +// fails, go ahead and save the text anyway. void LLPreviewLSL::saveIfNeeded() { // llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl; diff --git a/indra/newview/llrecentpeople.cpp b/indra/newview/llrecentpeople.cpp index bd46b5b56a..62c2ddfd9f 100644 --- a/indra/newview/llrecentpeople.cpp +++ b/indra/newview/llrecentpeople.cpp @@ -63,7 +63,7 @@ bool LLRecentPeople::contains(const LLUUID& id) const return mPeople.find(id) != mPeople.end(); } -void LLRecentPeople::get(std::vector<LLUUID>& result) const +void LLRecentPeople::get(uuid_vec_t& result) const { result.clear(); for (recent_people_t::const_iterator pos = mPeople.begin(); pos != mPeople.end(); ++pos) diff --git a/indra/newview/llrecentpeople.h b/indra/newview/llrecentpeople.h index e0f2faaec5..c718997f7e 100644 --- a/indra/newview/llrecentpeople.h +++ b/indra/newview/llrecentpeople.h @@ -79,7 +79,7 @@ public: * * @param result where to put the result. */ - void get(std::vector<LLUUID>& result) const; + void get(uuid_vec_t& result) const; const LLDate& getDate(const LLUUID& id) const; diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index dc64296521..7980fe1945 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -209,7 +209,7 @@ void LLScrollingPanelParam::onSliderMoved(LLUICtrl* ctrl, void* userdata) if (current_weight != new_weight ) { self->mWearable->setVisualParamWeight( param->getID(), new_weight, FALSE ); - gAgent.getAvatarObject()->updateVisualParams(); + gAgentAvatarp->updateVisualParams(); } } @@ -298,7 +298,7 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint ) && new_percent < slider->getMaxValue()) { mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight, FALSE); - gAgent.getAvatarObject()->updateVisualParams(); + gAgentAvatarp->updateVisualParams(); slider->setValue( weightToPercent( new_weight ) ); } @@ -344,8 +344,7 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata ) F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32(); - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if (avatar) + if (isAgentAvatarValid()) { LLVisualParamHint* hint = self->mHintMax; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 63b3bc959b..3ef810c3e9 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -56,6 +56,7 @@ // viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llviewerwindow.h" #include "lldrawable.h" #include "llfloaterinspect.h" @@ -1474,7 +1475,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) object->sendTEUpdate(); // 1 particle effect per object LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject(gAgent.getAvatarObject()); + effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(object); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -2872,7 +2873,7 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response, effectp->setDuration(duration); } - gAgent.setLookAt(LOOKAT_TARGET_CLEAR); + gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); // Keep track of how many objects have been deleted. F64 obj_delete_count = LLViewerStats::getInstance()->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT); @@ -3618,7 +3619,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point) { LLViewerObject* attach_object = mSelectedObjects->getFirstRootObject(); - if (!attach_object || !gAgent.getAvatarObject() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD) + if (!attach_object || !isAgentAvatarValid() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD) { return; } @@ -3629,7 +3630,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point) BOOL build_mode = LLToolMgr::getInstance()->inEdit(); // Special case: Attach to default location for this object. if (0 == attachment_point || - get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL)) + get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL)) { sendListToRegions( "ObjectAttach", @@ -4391,7 +4392,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, sit_name, i); //unpack TE IDs - std::vector<LLUUID> texture_ids; + uuid_vec_t texture_ids; S32 size = msg->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_TextureID); if (size > 0) { @@ -4626,8 +4627,8 @@ void LLSelectMgr::updateSilhouettes() { S32 num_sils_genned = 0; - LLVector3d cameraPos = gAgent.getCameraPositionGlobal(); - F32 currentCameraZoom = gAgent.getCurrentCameraBuildOffset(); + LLVector3d cameraPos = gAgentCamera.getCameraPositionGlobal(); + F32 currentCameraZoom = gAgentCamera.getCurrentCameraBuildOffset(); if (!mSilhouetteImagep) { @@ -4648,7 +4649,7 @@ void LLSelectMgr::updateSilhouettes() } func; getSelection()->applyToObjects(&func); - mLastCameraPos = gAgent.getCameraPositionGlobal(); + mLastCameraPos = gAgentCamera.getCameraPositionGlobal(); } std::vector<LLViewerObject*> changed_objects; @@ -4910,12 +4911,11 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) LLGLEnable blend(GL_BLEND); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if (for_hud && avatar) + if (isAgentAvatarValid() && for_hud) { - LLBBox hud_bbox = avatar->getHUDBBox(); + LLBBox hud_bbox = gAgentAvatarp->getHUDBBox(); - F32 cur_zoom = gAgent.mHUDCurZoom; + F32 cur_zoom = gAgentCamera.mHUDCurZoom; // set up transform to encompass bounding box of HUD glMatrixMode(GL_PROJECTION); @@ -5022,7 +5022,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) } } - if (for_hud && avatar) + if (isAgentAvatarValid() && for_hud) { glMatrixMode(GL_PROJECTION); gGL.popMatrix(); @@ -5207,13 +5207,13 @@ void LLSelectNode::saveColors() } } -void LLSelectNode::saveTextures(const std::vector<LLUUID>& textures) +void LLSelectNode::saveTextures(const uuid_vec_t& textures) { if (mObject.notNull()) { mSavedTextures.clear(); - for (std::vector<LLUUID>::const_iterator texture_it = textures.begin(); + for (uuid_vec_t::const_iterator texture_it = textures.begin(); texture_it != textures.end(); ++texture_it) { mSavedTextures.push_back(*texture_it); @@ -5398,9 +5398,9 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) if (volume) { F32 silhouette_thickness; - if (is_hud_object && gAgent.getAvatarObject()) + if (isAgentAvatarValid() && is_hud_object) { - silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgent.mHUDCurZoom; + silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgentCamera.mHUDCurZoom; } else { @@ -5420,7 +5420,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) LLGLEnable fog(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR); float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec(); - LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgent.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0); + LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0); glFogf(GL_FOG_START, d); glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); glFogfv(GL_FOG_COLOR, fogCol.mV); @@ -5608,20 +5608,20 @@ void LLSelectMgr::updateSelectionCenter() { mSelectedObjects->mSelectType = getSelectTypeForObject(object); - if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { - mPauseRequest = gAgent.getAvatarObject()->requestPause(); + mPauseRequest = gAgentAvatarp->requestPause(); } else { mPauseRequest = NULL; } - if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject()) + if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && isAgentAvatarValid()) { // reset hud ZOOM - gAgent.mHUDTargetZoom = 1.f; - gAgent.mHUDCurZoom = 1.f; + gAgentCamera.mHUDTargetZoom = 1.f; + gAgentCamera.mHUDCurZoom = 1.f; } mShowSelection = FALSE; @@ -5640,10 +5640,10 @@ void LLSelectMgr::updateSelectionCenter() LLViewerObject* object = node->getObject(); if (!object) continue; - LLViewerObject *myAvatar = gAgent.getAvatarObject(); + LLViewerObject *root = object->getRootEdit(); if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment - !root->isChild(myAvatar) && // not the object you're sitting on + !root->isChild(gAgentAvatarp) && // not the object you're sitting on !object->isAvatar()) // not another avatar { mShowSelection = TRUE; @@ -5713,26 +5713,26 @@ void LLSelectMgr::updatePointAt() select_offset.setVec(pick.mObjectOffset); select_offset.rotVec(~click_object->getRenderRotation()); - gAgent.setPointAt(POINTAT_TARGET_SELECT, click_object, select_offset); - gAgent.setLookAt(LOOKAT_TARGET_SELECT, click_object, select_offset); + gAgentCamera.setPointAt(POINTAT_TARGET_SELECT, click_object, select_offset); + gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, click_object, select_offset); } else { // didn't click on an object this time, revert to pointing at center of first object - gAgent.setPointAt(POINTAT_TARGET_SELECT, mSelectedObjects->getFirstObject()); - gAgent.setLookAt(LOOKAT_TARGET_SELECT, mSelectedObjects->getFirstObject()); + gAgentCamera.setPointAt(POINTAT_TARGET_SELECT, mSelectedObjects->getFirstObject()); + gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, mSelectedObjects->getFirstObject()); } } else { - gAgent.setPointAt(POINTAT_TARGET_CLEAR); - gAgent.setLookAt(LOOKAT_TARGET_CLEAR); + gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR); + gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); } } else { - gAgent.setPointAt(POINTAT_TARGET_CLEAR); - gAgent.setLookAt(LOOKAT_TARGET_CLEAR); + gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR); + gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); } } @@ -5922,20 +5922,20 @@ BOOL LLSelectMgr::setForceSelection(BOOL force) void LLSelectMgr::resetAgentHUDZoom() { - gAgent.mHUDTargetZoom = 1.f; - gAgent.mHUDCurZoom = 1.f; + gAgentCamera.mHUDTargetZoom = 1.f; + gAgentCamera.mHUDCurZoom = 1.f; } void LLSelectMgr::getAgentHUDZoom(F32 &target_zoom, F32 ¤t_zoom) const { - target_zoom = gAgent.mHUDTargetZoom; - current_zoom = gAgent.mHUDCurZoom; + target_zoom = gAgentCamera.mHUDTargetZoom; + current_zoom = gAgentCamera.mHUDCurZoom; } void LLSelectMgr::setAgentHUDZoom(F32 target_zoom, F32 current_zoom) { - gAgent.mHUDTargetZoom = target_zoom; - gAgent.mHUDCurZoom = current_zoom; + gAgentCamera.mHUDTargetZoom = target_zoom; + gAgentCamera.mHUDCurZoom = current_zoom; } ///////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 00474827ca..d315f40ff3 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -147,7 +147,7 @@ public: void setObject(LLViewerObject* object); // *NOTE: invalidate stored textures and colors when # faces change void saveColors(); - void saveTextures(const std::vector<LLUUID>& textures); + void saveTextures(const uuid_vec_t& textures); void saveTextureScaleRatios(); BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const; @@ -183,7 +183,7 @@ public: std::string mSitName; U64 mCreationDate; std::vector<LLColor4> mSavedColors; - std::vector<LLUUID> mSavedTextures; + uuid_vec_t mSavedTextures; std::vector<LLVector3> mTextureScaleRatios; std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index cd4a821774..b951434010 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -34,6 +34,7 @@ #include "llaccordionctrltab.h" #include "llagent.h" +#include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" #include "llinventorypanel.h" @@ -92,7 +93,7 @@ LLSidepanelAppearance::LLSidepanelAppearance() : LLPanel(), mFilterSubString(LLStringUtil::null), mFilterEditor(NULL), - mLookInfo(NULL), + mOutfitEdit(NULL), mCurrOutfitPanel(NULL) { } @@ -128,10 +129,10 @@ BOOL LLSidepanelAppearance::postBuild() mPanelOutfitsInventory = dynamic_cast<LLPanelOutfitsInventory *>(getChild<LLPanel>("panel_outfits_inventory")); mPanelOutfitsInventory->setParent(this); - mLookInfo = dynamic_cast<LLPanelLookInfo*>(getChild<LLPanel>("panel_look_info")); - if (mLookInfo) + mOutfitEdit = dynamic_cast<LLPanelOutfitEdit*>(getChild<LLPanel>("panel_outfit_edit")); + if (mOutfitEdit) { - LLButton* back_btn = mLookInfo->getChild<LLButton>("back_btn"); + LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn"); if (back_btn) { back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onBackButtonClicked, this)); @@ -176,7 +177,7 @@ void LLSidepanelAppearance::onOpen(const LLSD& key) if(key.size() == 0) return; - toggleLookInfoPanel(TRUE); + toggleOutfitEditPanel(TRUE); updateVerbs(); mLookInfoType = key["type"].asString(); @@ -185,7 +186,7 @@ void LLSidepanelAppearance::onOpen(const LLSD& key) { LLInventoryCategory *pLook = gInventory.getCategory(key["id"].asUUID()); if (pLook) - mLookInfo->displayLookInfo(pLook); + mOutfitEdit->displayLookInfo(pLook); } } @@ -205,7 +206,7 @@ void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) void LLSidepanelAppearance::onOpenOutfitButtonClicked() { - const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getBaseOutfitLink(); + const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); if (!outfit_link) return; if (!outfit_link->getIsLinkType()) @@ -234,15 +235,15 @@ void LLSidepanelAppearance::onEditAppearanceButtonClicked() { if (gAgentWearables.areWearablesLoaded()) { - gAgent.changeCameraToCustomizeAvatar(); + gAgentCamera.changeCameraToCustomizeAvatar(); } } void LLSidepanelAppearance::onEditButtonClicked() { - toggleLookInfoPanel(FALSE); + toggleOutfitEditPanel(FALSE); toggleWearableEditPanel(TRUE, NULL); - /*if (mLookInfo->getVisible()) + /*if (mOutfitEdit->getVisible()) { } else @@ -253,7 +254,7 @@ void LLSidepanelAppearance::onEditButtonClicked() void LLSidepanelAppearance::onNewOutfitButtonClicked() { - if (!mLookInfo->getVisible()) + if (!mOutfitEdit->getVisible()) { mPanelOutfitsInventory->onSave(); } @@ -262,22 +263,22 @@ void LLSidepanelAppearance::onNewOutfitButtonClicked() void LLSidepanelAppearance::onBackButtonClicked() { - toggleLookInfoPanel(FALSE); + toggleOutfitEditPanel(FALSE); } void LLSidepanelAppearance::onEditWearBackClicked() { mEditWearable->saveChanges(); toggleWearableEditPanel(FALSE, NULL); - toggleLookInfoPanel(TRUE); + toggleOutfitEditPanel(TRUE); } -void LLSidepanelAppearance::toggleLookInfoPanel(BOOL visible) +void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible) { - if (!mLookInfo) + if (!mOutfitEdit) return; - mLookInfo->setVisible(visible); + mOutfitEdit->setVisible(visible); if (mPanelOutfitsInventory) mPanelOutfitsInventory->setVisible(!visible); mFilterEditor->setVisible(!visible); mEditBtn->setVisible(!visible); @@ -297,13 +298,14 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we } mEditWearable->setVisible(visible); + mEditWearable->setWearable(wearable); mFilterEditor->setVisible(!visible); mPanelOutfitsInventory->setVisible(!visible); } void LLSidepanelAppearance::updateVerbs() { - bool is_look_info_visible = mLookInfo->getVisible(); + bool is_look_info_visible = mOutfitEdit->getVisible(); if (mPanelOutfitsInventory && !is_look_info_visible) { @@ -318,11 +320,11 @@ void LLSidepanelAppearance::updateVerbs() void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) { - mOutfitDirtyTag->setVisible(LLAppearanceManager::getInstance()->isOutfitDirty()); + mOutfitDirtyTag->setVisible(LLAppearanceMgr::getInstance()->isOutfitDirty()); if (name == "") { std::string outfit_name; - if (LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name)) + if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) { mCurrentLookName->setText(outfit_name); return; @@ -342,7 +344,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) void LLSidepanelAppearance::editWearable(LLWearable *wearable, void *data) { LLSidepanelAppearance *panel = (LLSidepanelAppearance*) data; - panel->toggleLookInfoPanel(FALSE); + panel->toggleOutfitEditPanel(FALSE); panel->toggleWearableEditPanel(TRUE, wearable); } @@ -356,19 +358,20 @@ void LLSidepanelAppearance::fetchInventory() LLUUID item_id; for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type) { - // MULTI_WEARABLE: - item_id = gAgentWearables.getWearableItemID((EWearableType)type,0); - if(item_id.notNull()) + for (U32 index = 0; index < gAgentWearables.getWearableCount((EWearableType)type); ++index) { - ids.push_back(item_id); + item_id = gAgentWearables.getWearableItemID((EWearableType)type, index); + if(item_id.notNull()) + { + ids.push_back(item_id); + } } } - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar ) + if (isAgentAvatarValid()) { - for (LLVOAvatar::attachment_map_t::const_iterator iter = avatar->mAttachmentPoints.begin(); - iter != avatar->mAttachmentPoints.end(); ++iter) + for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) { LLViewerJointAttachment* attachment = iter->second; if (!attachment) continue; diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index aa2e67fd16..1d78e92a84 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -36,7 +36,7 @@ #include "llinventoryobserver.h" #include "llinventory.h" -#include "llpanellookinfo.h" +#include "llpaneloutfitedit.h" class LLFilterEditor; class LLCurrentlyWornFetchObserver; @@ -71,12 +71,12 @@ private: void onEditButtonClicked(); void onBackButtonClicked(); void onEditWearBackClicked(); - void toggleLookInfoPanel(BOOL visible); + void toggleOutfitEditPanel(BOOL visible); void toggleWearableEditPanel(BOOL visible, LLWearable* wearable); LLFilterEditor* mFilterEditor; LLPanelOutfitsInventory* mPanelOutfitsInventory; - LLPanelLookInfo* mLookInfo; + LLPanelOutfitEdit* mOutfitEdit; LLPanelEditWearable* mEditWearable; LLButton* mOpenOutfitBtn; diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index fba1503b4a..3ec1855484 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -34,7 +34,7 @@ #include "lltextbox.h" -#include "llagent.h" +#include "llagentcamera.h" #include "llbottomtray.h" #include "llsidetray.h" #include "llviewerwindow.h" @@ -730,7 +730,7 @@ void LLSideTray::updateSidetrayVisibility() // set visibility of parent container based on collapsed state if (getParent()) { - getParent()->setVisible(!mCollapsed && !gAgent.cameraMouselook()); + getParent()->setVisible(!mCollapsed && !gAgentCamera.cameraMouselook()); } } diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp index 7fb813792c..ff7e479368 100644 --- a/indra/newview/llslurl.cpp +++ b/indra/newview/llslurl.cpp @@ -270,7 +270,19 @@ LLSLURL::LLSLURL(const std::string& slurl) // parse the x, y, z if(path_array.size() >= 3) { - mPosition = LLVector3(path_array); + + mPosition = LLVector3(path_array); + if((F32(mPosition[VX]) < 0.f) || + (mPosition[VX] > REGION_WIDTH_METERS) || + (F32(mPosition[VY]) < 0.f) || + (mPosition[VY] > REGION_WIDTH_METERS) || + (F32(mPosition[VZ]) < 0.f) || + (mPosition[VZ] > REGION_HEIGHT_METERS)) + { + mType = INVALID; + return; + } + } else { diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 9ad98f9372..b9534fac9a 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -881,7 +881,7 @@ void LLLocalSpeakerMgr::updateSpeakerList() } // pick up non-voice speakers in chat range - std::vector<LLUUID> avatar_ids; + uuid_vec_t avatar_ids; std::vector<LLVector3d> positions; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS); for(U32 i=0; i<avatar_ids.size(); i++) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6bdae3cba9..4f1bcde302 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -62,6 +62,7 @@ #include "llimfloater.h" #include "lllocationhistory.h" #include "llimageworker.h" + #include "llloginflags.h" #include "llmd5.h" #include "llmemorystream.h" @@ -88,6 +89,7 @@ #include "v3math.h" #include "llagent.h" +#include "llagentcamera.h" #include "llagentpicksinfo.h" #include "llagentwearables.h" #include "llagentpilot.h" @@ -115,6 +117,7 @@ #include "llimagebmp.h" #include "llinventorybridge.h" #include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" #include "llfriendcard.h" #include "llkeyboard.h" #include "llloginhandler.h" // gLoginHandler, SLURL support @@ -892,6 +895,9 @@ bool idle_startup() // Load Avatars icons cache LLAvatarIconIDCache::getInstance()->load(); + + // Load media plugin cookies + LLViewerMedia::loadCookieFile(); //------------------------------------------------- // Handle startup progress screen @@ -1134,6 +1140,7 @@ bool idle_startup() // Finish agent initialization. (Requires gSavedSettings, builds camera) gAgent.init(); + gAgentCamera.init(); set_underclothes_menu_options(); // Since we connected, save off the settings so the user doesn't have to @@ -1172,7 +1179,7 @@ bool idle_startup() // World initialization must be done after above window init // User might have overridden far clip - LLWorld::getInstance()->setLandFarClip( gAgent.mDrawDistance ); + LLWorld::getInstance()->setLandFarClip(gAgentCamera.mDrawDistance); // Before we create the first region, we need to set the agent's mOriginGlobal // This is necessary because creating objects before this is set will result in a @@ -1336,8 +1343,8 @@ bool idle_startup() gAgent.setPositionAgent(agent_start_position_region); gAgent.resetAxes(gAgentStartLookAt); - gAgent.stopCameraAnimation(); - gAgent.resetCamera(); + gAgentCamera.stopCameraAnimation(); + gAgentCamera.resetCamera(); // Initialize global class data needed for surfaces (i.e. textures) if (!gNoRender) @@ -1741,7 +1748,7 @@ bool idle_startup() { LL_DEBUGS("AppInit") << "Gesture Manager loading " << gesture_options.size() << LL_ENDL; - std::vector<LLUUID> item_ids; + uuid_vec_t item_ids; for(LLSD::array_const_iterator resp_it = gesture_options.beginArray(), end = gesture_options.endArray(); resp_it != end; ++resp_it) { @@ -1755,7 +1762,7 @@ bool idle_startup() // Could schedule and delay these for later. const BOOL no_inform_server = FALSE; const BOOL no_deactivate_similar = FALSE; - LLGestureManager::instance().activateGestureWithAsset(item_id, asset_id, + LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id, no_inform_server, no_deactivate_similar); // We need to fetch the inventory items for these gestures @@ -1764,7 +1771,7 @@ bool idle_startup() } } // no need to add gesture to inventory observer, it's already made in constructor - LLGestureManager::instance().fetchItems(item_ids); + LLGestureMgr::instance().fetchItems(item_ids); } } gDisplaySwapBuffers = TRUE; @@ -1813,15 +1820,15 @@ bool idle_startup() if (samename) { // restore old camera pos - gAgent.setFocusOnAvatar(FALSE, FALSE); - gAgent.setCameraPosAndFocusGlobal(gSavedSettings.getVector3d("CameraPosOnLogout"), gSavedSettings.getVector3d("FocusPosOnLogout"), LLUUID::null); + gAgentCamera.setFocusOnAvatar(FALSE, FALSE); + gAgentCamera.setCameraPosAndFocusGlobal(gSavedSettings.getVector3d("CameraPosOnLogout"), gSavedSettings.getVector3d("FocusPosOnLogout"), LLUUID::null); BOOL limit_hit = FALSE; - gAgent.calcCameraPositionTargetGlobal(&limit_hit); + gAgentCamera.calcCameraPositionTargetGlobal(&limit_hit); if (limit_hit) { - gAgent.setFocusOnAvatar(TRUE, FALSE); + gAgentCamera.setFocusOnAvatar(TRUE, FALSE); } - gAgent.stopCameraAnimation(); + gAgentCamera.stopCameraAnimation(); } } else @@ -1850,7 +1857,7 @@ bool idle_startup() } //DEV-17797. get null folder. Any items found here moved to Lost and Found - LLInventoryModel::findLostItems(); + LLInventoryModelBackgroundFetch::instance().findLostItems(); LLStartUp::setStartupState( STATE_PRECACHE ); timeout.reset(); @@ -1868,7 +1875,7 @@ bool idle_startup() if (gAgent.isFirstLogin() && !sInitialOutfit.empty() // registration set up an outfit && !sInitialOutfitGender.empty() // and a gender - && gAgent.getAvatarObject() // can't wear clothes without object + && isAgentAvatarValid() // can't wear clothes without object && !gAgent.isGenderChosen() ) // nothing already loading { // Start loading the wearables, textures, gestures @@ -1876,7 +1883,7 @@ bool idle_startup() } // wait precache-delay and for agent's avatar or a lot longer. - if(((timeout_frac > 1.f) && gAgent.getAvatarObject()) + if(((timeout_frac > 1.f) && isAgentAvatarValid()) || (timeout_frac > 3.f)) { LLStartUp::setStartupState( STATE_WEARABLES_WAIT ); @@ -1932,8 +1939,8 @@ bool idle_startup() if (gAgent.isFirstLogin()) { // wait for avatar to be completely loaded - if (gAgent.getAvatarObject() - && gAgent.getAvatarObject()->isFullyLoaded()) + if (isAgentAvatarValid() + && gAgentAvatarp->isFullyLoaded()) { //llinfos << "avatar fully loaded" << llendl; LLStartUp::setStartupState( STATE_CLEANUP ); @@ -2395,7 +2402,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, llinfos << "starting" << llendl; // Not going through the processAgentInitialWearables path, so need to set this here. - LLAppearanceManager::instance().setAttachmentInvLinkEnable(true); + LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); // Initiate creation of COF, since we're also bypassing that. gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); @@ -2426,13 +2433,13 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, bool do_copy = true; bool do_append = false; LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); - LLAppearanceManager::instance().wearInventoryCategory(cat, do_copy, do_append); + LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append); } // Copy gestures LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); LLPointer<LLInventoryCallback> cb(NULL); - LLAppearanceManager *app_mgr = &(LLAppearanceManager::instance()); + LLAppearanceMgr *app_mgr = &(LLAppearanceMgr::instance()); // - Copy gender-specific gestures. LLUUID gestures_cat_id = findDescendentCategoryIDByName( @@ -2441,7 +2448,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, if (gestures_cat_id.notNull()) { callAfterCategoryFetch(gestures_cat_id, - boost::bind(&LLAppearanceManager::shallowCopyCategory, + boost::bind(&LLAppearanceMgr::shallowCopyCategory, app_mgr, gestures_cat_id, dst_id, @@ -2455,7 +2462,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, if (common_gestures_cat_id.notNull()) { callAfterCategoryFetch(common_gestures_cat_id, - boost::bind(&LLAppearanceManager::shallowCopyCategory, + boost::bind(&LLAppearanceMgr::shallowCopyCategory, app_mgr, common_gestures_cat_id, dst_id, @@ -2583,6 +2590,8 @@ void LLStartUp::postStartupState() void reset_login() { + gAgentWearables.cleanup(); + gAgentCamera.cleanup(); gAgent.cleanup(); LLWorld::getInstance()->destroyClass(); @@ -3094,6 +3103,13 @@ bool process_login_success_response() } } + // Start the process of fetching the OpenID session cookie for this user login + std::string openid_url = response["openid_url"]; + if(!openid_url.empty()) + { + std::string openid_token = response["openid_token"]; + LLViewerMedia::openIDSetup(openid_url, openid_token); + } bool success = false; // JC: gesture loading done below, when we have an asset system diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 9206b4a43a..b660a2b8ea 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -36,6 +36,7 @@ // viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llbutton.h" #include "llcommandhandler.h" #include "llviewercontrol.h" @@ -313,7 +314,7 @@ void LLStatusBar::refresh() childSetVisible("scriptout", false); } - if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK && + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK && ((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage()))) { // set visibility based on flashing @@ -371,6 +372,8 @@ void LLStatusBar::setVisibleForMouselook(bool visible) mTextTime->setVisible(visible); getChild<LLUICtrl>("buycurrency")->setVisible(visible); getChild<LLUICtrl>("buyL")->setVisible(visible); + mBtnVolume->setVisible(visible); + mMediaToggle->setVisible(visible); mSGBandwidth->setVisible(visible); mSGPacketLoss->setVisible(visible); setBackgroundVisible(visible); @@ -444,11 +447,9 @@ void LLStatusBar::setHealth(S32 health) { if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) { - LLVOAvatar *me; - - if ((me = gAgent.getAvatarObject())) + if (isAgentAvatarValid()) { - if (me->getSex() == SEX_FEMALE) + if (gAgentAvatarp->getSex() == SEX_FEMALE) { make_ui_sound("UISndHealthReductionF"); } diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 1d479bac8c..ddb5d08e07 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -44,6 +44,7 @@ #include "llviewerobjectlist.h" #include "llregionhandle.h" #include "llagent.h" +#include "llagentcamera.h" #include "llappviewer.h" #include "llworld.h" #include "llviewercontrol.h" @@ -606,7 +607,7 @@ void LLSurface::moveZ(const S32 x, const S32 y, const F32 delta) void LLSurface::updatePatchVisibilities(LLAgent &agent) { - LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(gAgent.getCameraPositionGlobal()); + LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(gAgentCamera.getCameraPositionGlobal()); LLSurfacePatch *patchp; diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 66373feb93..cbb030836e 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -58,7 +58,8 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(N mSysWellChiclet(NULL), mSeparator(NULL), NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"), - IM_WELL_ANCHOR_NAME("im_well_panel") + IM_WELL_ANCHOR_NAME("im_well_panel"), + mIsReshapedByUser(false) { mTypedItemsCount[IT_NOTIFICATION] = 0; @@ -100,6 +101,13 @@ void LLSysWellWindow::setMinimized(BOOL minimize) } //--------------------------------------------------------------------------------- +void LLSysWellWindow::handleReshape(const LLRect& rect, bool by_user) +{ + mIsReshapedByUser |= by_user; // mark floater that it is reshaped by user + LLTransientDockableFloater::handleReshape(rect, by_user); +} + +//--------------------------------------------------------------------------------- void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask) { // just set floater visible. Screen channels will be cleared. @@ -211,7 +219,7 @@ void LLSysWellWindow::reshapeWindow() // it includes height from floater top to list top and from floater bottom and list bottom static S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight(); - if (isDocked()) // Don't reshape undocked Well window. See EXT-5715. + if (!mIsReshapedByUser) // Don't reshape Well window, if it ever was reshaped by user. See EXT-5715. { S32 notif_list_height = mMessageList->getItemsRect().getHeight() + 2 * mMessageList->getBorderWidth(); diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index 3790aa3ea9..296bdf7482 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -70,6 +70,7 @@ public: /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); // override LLFloater's minimization according to EXT-1216 /*virtual*/ void setMinimized(BOOL minimize); + /*virtual*/ void handleReshape(const LLRect& rect, bool by_user); void onStartUpToastClick(S32 x, S32 y, MASK mask); @@ -121,7 +122,7 @@ protected: typedef std::map<EItemType, S32> typed_items_count_t; typed_items_count_t mTypedItemsCount; - + bool mIsReshapedByUser; }; /** diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 386b636367..3f4dab4fea 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -284,8 +284,6 @@ void LLTexLayerSetBuffer::readBackAndUpload() llinfos << "Baked " << mTexLayerSet->getBodyRegion() << llendl; LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES); - llassert( gAgent.getAvatarObject() == mTexLayerSet->getAvatar() ); - // We won't need our caches since we're baked now. (Techically, we won't // really be baked until this image is sent to the server and the Avatar // Appearance message is received.) @@ -352,7 +350,7 @@ void LLTexLayerSetBuffer::readBackAndUpload() { // baked_upload_data is owned by the responder and deleted after the request completes LLBakedUploadData* baked_upload_data = - new LLBakedUploadData(gAgent.getAvatarObject(), this->mTexLayerSet, asset_id); + new LLBakedUploadData(gAgentAvatarp, this->mTexLayerSet, asset_id); mUploadID = asset_id; // upload the image @@ -409,12 +407,10 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, { LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata; - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if (0 == result && - avatar && - !avatar->isDead() && - baked_upload_data->mAvatar == avatar && // Sanity check: only the user's avatar should be uploading textures. + isAgentAvatarValid() && + !gAgentAvatarp->isDead() && + baked_upload_data->mAvatar == gAgentAvatarp && // Sanity check: only the user's avatar should be uploading textures. baked_upload_data->mTexLayerSet->hasComposite() ) { @@ -439,11 +435,11 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, if (result >= 0) { - LLVOAvatarDefines::ETextureIndex baked_te = avatar->getBakedTE(layerset_buffer->mTexLayerSet); + 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 texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; - avatar->setNewBakedTexture(baked_te, uuid); + gAgentAvatarp->setNewBakedTexture(baked_te, uuid); } else { @@ -457,7 +453,7 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, llinfos << "Received baked texture out of date, ignored." << llendl; } - avatar->dirtyMesh(); + gAgentAvatarp->dirtyMesh(); } else { diff --git a/indra/newview/lltexlayerparams.cpp b/indra/newview/lltexlayerparams.cpp index d55468841d..5e5d344461 100644 --- a/indra/newview/lltexlayerparams.cpp +++ b/indra/newview/lltexlayerparams.cpp @@ -33,7 +33,7 @@ #include "lltexlayerparams.h" -#include "llagent.h" +#include "llagentcamera.h" #include "llimagetga.h" #include "lltexlayer.h" #include "llvoavatarself.h" @@ -180,7 +180,7 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake) if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param. { - if (gAgent.cameraCustomizeAvatar()) + if (gAgentCamera.cameraCustomizeAvatar()) { upload_bake = FALSE; } diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 7a0712f8aa..08bc8220d9 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -852,8 +852,8 @@ bool LLTextureCache::updateTextureEntryList(const LLUUID& id, S32 bodysize) } else if (oldbodysize != entry.mBodySize) { - // TODO: change to llwarns - llerrs << "Entry mismatch in mTextureSizeMap / mHeaderIDMap" + // only happens to 64 bits systems, do not know why. + llwarns << "Entry mismatch in mTextureSizeMap / mHeaderIDMap" << " idx=" << idx << " oldsize=" << oldbodysize << " entrysize=" << entry.mBodySize << llendl; } updateEntry(idx, entry, entry.mImageSize, bodysize); @@ -1221,9 +1221,17 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries) mFreeList.clear(); mTexturesSizeTotal = 0; - LLAPRFile* aprfile = openHeaderEntriesFile(true, 0); - updatedHeaderEntriesFile() ; - aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo)); + LLAPRFile* aprfile = NULL; + if(mUpdatedEntryMap.empty()) + { + aprfile = openHeaderEntriesFile(true, (S32)sizeof(EntriesInfo)); + } + else //update the header file first. + { + aprfile = openHeaderEntriesFile(false, 0); + updatedHeaderEntriesFile() ; + aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo)); + } for (U32 idx=0; idx<num_entries; idx++) { Entry entry; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 2b846d33fc..a1b3c8dabd 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -48,6 +48,7 @@ #include "llfoldervieweventlistener.h" #include "llinventory.h" #include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" #include "llfloaterinventory.h" @@ -1053,7 +1054,7 @@ public: { // We need to find textures in all folders, so get the main // background download going. - gInventory.startBackgroundFetch(); + LLInventoryModelBackgroundFetch::instance().start(); gInventory.removeObserver(this); delete this; } @@ -1074,9 +1075,9 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { showPicker(FALSE); //grab textures first... - gInventory.startBackgroundFetch(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); + LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); //...then start full inventory fetch. - gInventory.startBackgroundFetch(); + LLInventoryModelBackgroundFetch::instance().start(); handled = TRUE; } diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 1c7b3a0fe0..2ea6e5936d 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -292,7 +292,10 @@ public: const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { - if ((gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog")) || (gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"))) + static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); + + if (log_to_viewer_log || log_to_sim) { mFetcher->mTextureInfo.setRequestStartTime(mID, mStartTime); U64 timeNow = LLTimer::getTotalTime(); @@ -715,10 +718,10 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mState == LOAD_FROM_NETWORK) { - bool get_url = gSavedSettings.getBOOL("ImagePipelineUseHTTP"); - if (!mUrl.empty()) get_url = false; + static LLCachedControl<bool> use_http(gSavedSettings,"ImagePipelineUseHTTP"); + // if (mHost != LLHost::invalid) get_url = false; - if ( get_url ) + if ( use_http && mUrl.empty())//get http url. { LLViewerRegion* region = NULL; if (mHost == LLHost::invalid) @@ -1717,7 +1720,8 @@ S32 LLTextureFetch::update(U32 max_time_ms) { S32 res; - mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); + static LLCachedControl<F32> band_width(gSavedSettings,"ThrottleBandwidthKBPS"); + mMaxBandwidth = band_width ; res = LLWorkerThread::update(max_time_ms); @@ -1923,7 +1927,9 @@ void LLTextureFetch::sendRequestListToSimulators() // llinfos << "IMAGE REQUEST: " << req->mID << " Discard: " << req->mDesiredDiscard // << " Packet: " << packet << " Priority: " << req->mImagePriority << llendl; - if ((gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog")) || (gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"))) + static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); + if (log_to_viewer_log || log_to_sim) { mTextureInfo.setRequestStartTime(req->mID, LLTimer::getTotalTime()); mTextureInfo.setRequestOffset(req->mID, 0); @@ -2144,7 +2150,10 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 if(packet_num >= (worker->mTotalPackets - 1)) { - if ((gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog")) || (gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"))) + static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); + + if (log_to_viewer_log || log_to_sim) { U64 timeNow = LLTimer::getTotalTime(); mTextureInfo.setRequestSize(id, worker->mFileSize); diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index c3ccb9380b..986ccdf19b 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -281,9 +281,6 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal mLineEditor->setText(edit_text_contents); mLineEditor->setMaxTextLength(STD_STRING_STR_LEN - 1); - // make sure all edit keys get handled properly (DEV-22396) - mLineEditor->setHandleEditKeysDirectly(TRUE); - LLToastPanel::addChild(mLineEditor); mLineEditor->setDrawAsterixes(is_password); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 907740a88e..c9d2d404c0 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -45,6 +45,7 @@ #include "lltrans.h" #include "llnotificationsutil.h" #include "llviewermessage.h" +#include "llimfloater.h" const S32 BOTTOM_PAD = VPAD * 3; const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding @@ -531,12 +532,26 @@ void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification ////////////////////////////////////////////////////////////////////////// -LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect /* = LLRect::null */) - : LLToastNotifyPanel(pNotification, rect) +LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect /* = LLRect::null */) + : mSessionID(session_id), LLToastNotifyPanel(pNotification, rect) { mTextBox->setFollowsAll(); } +LLIMToastNotifyPanel::~LLIMToastNotifyPanel() +{ + // We shouldn't delete notification when IM floater exists + // since that notification will be reused by IM floater. + // This may happened when IM floater reloads messages, exactly when user + // changes layout of IM chat log(disable/enable plaintext mode). + // See EXT-6500 + LLIMFloater* im_floater = LLIMFloater::findInstance(mSessionID); + if (im_floater != NULL && !im_floater->isDead()) + { + mCloseNotificationOnDestroy = false; + } +} + void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) { S32 text_height = mTextBox->getTextBoundingRect().getHeight(); diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index a8d2d03236..1c68e4c6b3 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -138,9 +138,14 @@ class LLIMToastNotifyPanel : public LLToastNotifyPanel { public: - LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null); + LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect = LLRect::null); + + ~LLIMToastNotifyPanel(); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + +protected: + LLUUID mSessionID; }; #endif /* LLTOASTNOTIFYPANEL_H_ */ diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index fff18df442..d05bfc53e5 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -54,6 +54,7 @@ #include "llviewerobject.h" #include "llviewerwindow.h" #include "llagent.h" +#include "llagentcamera.h" #include "llfloatertools.h" #include "llviewercontrol.h" @@ -784,7 +785,7 @@ BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (clicks > 0) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } return TRUE; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 47e60a966e..f37efd778f 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -37,6 +37,7 @@ #include "llnotificationsutil.h" // project headers #include "llagent.h" +#include "llagentcamera.h" #include "llagentui.h" #include "llagentwearables.h" #include "llappearancemgr.h" @@ -49,6 +50,7 @@ #include "llhudeffecttrail.h" #include "llimview.h" #include "llinventorybridge.h" +#include "llinventoryfunctions.h" #include "llmutelist.h" #include "llpreviewnotecard.h" #include "llrecentpeople.h" @@ -79,7 +81,7 @@ public: virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) { - if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE)) + if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE)) { return true; } @@ -95,8 +97,8 @@ public: virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) { - if(item) return true; - if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE)) + if (item) return true; + if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE)) { return true; } @@ -123,18 +125,18 @@ bool LLDroppableItem::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { bool allowed = false; - if(item) + if (item) { allowed = itemTransferCommonlyAllowed(item); - if(allowed + if (allowed && mIsTransfer && !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { allowed = false; } - if(allowed && !item->getPermissions().allowCopyBy(gAgent.getID())) + if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID())) { ++mCountLosing; } @@ -154,7 +156,7 @@ bool LLUncopyableItems::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { bool uncopyable = false; - if(item) + if (item) { if (itemTransferCommonlyAllowed(item) && !item->getPermissions().allowCopyBy(gAgent.getID())) @@ -179,10 +181,10 @@ bool LLDropCopyableItems::operator()( LLInventoryItem* item) { bool allowed = false; - if(item) + if (item) { allowed = itemTransferCommonlyAllowed(item); - if(allowed && + if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID())) { // whoops, can't copy it - don't allow it. @@ -211,16 +213,16 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item) return true; bool allowed = false; - if(item) + if (item) { allowed = itemTransferCommonlyAllowed(item); - if(allowed && + if (allowed && !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { allowed = FALSE; } - if(allowed && + if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID())) { ++mCountLosing; @@ -261,7 +263,7 @@ void LLCategoryDropObserver::done() { gInventory.removeObserver(this); LLViewerObject* dst_obj = gObjectList.findObject(mObjectID); - if(dst_obj) + if (dst_obj) { // *FIX: coalesce these... LLInventoryItem* item = NULL; @@ -270,7 +272,7 @@ void LLCategoryDropObserver::done() for(; it < end; ++it) { item = gInventory.getItem(*it); - if(item) + if (item) { LLToolDragAndDrop::dropInventory( dst_obj, @@ -303,8 +305,8 @@ void LLCategoryDropDescendentsObserver::done() { gInventory.removeObserver(this); - folder_ref_t::iterator it = mCompleteFolders.begin(); - folder_ref_t::iterator end = mCompleteFolders.end(); + uuid_vec_t::iterator it = mCompleteFolders.begin(); + uuid_vec_t::iterator end = mCompleteFolders.end(); LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; for(; it != end; ++it) @@ -317,7 +319,7 @@ void LLCategoryDropDescendentsObserver::done() } S32 count = items.count(); - if(count) + if (count) { std::set<LLUUID> unique_ids; for(S32 i = 0; i < count; ++i) @@ -330,7 +332,7 @@ void LLCategoryDropDescendentsObserver::done() LLCategoryDropObserver* dropper; dropper = new LLCategoryDropObserver(mObjectID, mSource); dropper->fetchItems(ids); - if(dropper->isEverythingComplete()) + if (dropper->isEverythingComplete()) { dropper->done(); } @@ -410,9 +412,12 @@ void LLToolDragAndDrop::setDragStart(S32 x, S32 y) BOOL LLToolDragAndDrop::isOverThreshold(S32 x,S32 y) { - const S32 MIN_MANHATTAN_DIST = 3; - S32 manhattan_dist = llabs( x - mDragStartX ) + llabs( y - mDragStartY ); - return manhattan_dist >= MIN_MANHATTAN_DIST; + static LLCachedControl<S32> drag_and_drop_threshold(gSavedSettings,"DragAndDropDistanceThreshold"); + + S32 mouse_delta_x = x - mDragStartX; + S32 mouse_delta_y = y - mDragStartY; + + return (mouse_delta_x * mouse_delta_x) + (mouse_delta_y * mouse_delta_y) > drag_and_drop_threshold * drag_and_drop_threshold; } void LLToolDragAndDrop::beginDrag(EDragAndDropType type, @@ -421,7 +426,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, const LLUUID& source_id, const LLUUID& object_id) { - if(type == DAD_NONE) + if (type == DAD_NONE) { llwarns << "Attempted to start drag without a cargo type" << llendl; return; @@ -437,24 +442,24 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, setMouseCapture( TRUE ); LLToolMgr::getInstance()->setTransientTool( this ); mCursor = UI_CURSOR_NO; - if((mCargoTypes[0] == DAD_CATEGORY) + if ((mCargoTypes[0] == DAD_CATEGORY) && ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))) { LLInventoryCategory* cat = gInventory.getCategory(cargo_id); // go ahead and fire & forget the descendents if we are not // dragging a protected folder. - if(cat) + if (cat) { LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLNoPreferredTypeOrItem is_not_preferred; - LLInventoryFetchComboObserver::folder_ref_t folder_ids; - LLInventoryFetchComboObserver::item_ref_t item_ids; - if(is_not_preferred(cat, NULL)) + uuid_vec_t folder_ids; + uuid_vec_t item_ids; + if (is_not_preferred(cat, NULL)) { folder_ids.push_back(cargo_id); } - gInventory.collectDescendentsIf( + gInventory.collectDescendentsIf ( cargo_id, cats, items, @@ -471,7 +476,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, { item_ids.push_back(items.get(i)->getUUID()); } - if(!folder_ids.empty() || !item_ids.empty()) + if (!folder_ids.empty() || !item_ids.empty()) { LLCategoryFireAndForget fetcher; fetcher.fetch(folder_ids, item_ids); @@ -482,7 +487,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, void LLToolDragAndDrop::beginMultiDrag( const std::vector<EDragAndDropType> types, - const std::vector<LLUUID>& cargo_ids, + const uuid_vec_t& cargo_ids, ESource source, const LLUUID& source_id) { @@ -492,7 +497,7 @@ void LLToolDragAndDrop::beginMultiDrag( std::vector<EDragAndDropType>::const_iterator types_it; for (types_it = types.begin(); types_it != types.end(); ++types_it) { - if(DAD_NONE == *types_it) + if (DAD_NONE == *types_it) { llwarns << "Attempted to start drag without a cargo type" << llendl; return; @@ -506,7 +511,7 @@ void LLToolDragAndDrop::beginMultiDrag( setMouseCapture( TRUE ); LLToolMgr::getInstance()->setTransientTool( this ); mCursor = UI_CURSOR_NO; - if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) + if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) { // find categories (i.e. inventory folders) in the cargo. LLInventoryCategory* cat = NULL; @@ -515,16 +520,16 @@ void LLToolDragAndDrop::beginMultiDrag( for(S32 i = 0; i < count; ++i) { cat = gInventory.getCategory(cargo_ids[i]); - if(cat) + if (cat) { LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLNoPreferredType is_not_preferred; - if(is_not_preferred(cat, NULL)) + if (is_not_preferred(cat, NULL)) { cat_ids.insert(cat->getUUID()); } - gInventory.collectDescendentsIf( + gInventory.collectDescendentsIf ( cat->getUUID(), cats, items, @@ -537,11 +542,11 @@ void LLToolDragAndDrop::beginMultiDrag( } } } - if(!cat_ids.empty()) + if (!cat_ids.empty()) { - LLInventoryFetchComboObserver::folder_ref_t folder_ids; - LLInventoryFetchComboObserver::item_ref_t item_ids; - std::back_insert_iterator<LLInventoryFetchDescendentsObserver::folder_ref_t> copier(folder_ids); + uuid_vec_t folder_ids; + uuid_vec_t item_ids; + std::back_insert_iterator<uuid_vec_t> copier(folder_ids); std::copy(cat_ids.begin(), cat_ids.end(), copier); LLCategoryFireAndForget fetcher; fetcher.fetch(folder_ids, item_ids); @@ -569,7 +574,7 @@ void LLToolDragAndDrop::onMouseCaptureLost() BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask ) { - if( hasMouseCapture() ) + if (hasMouseCapture()) { EAcceptance acceptance = ACCEPT_NO; dragOrDrop( x, y, mask, TRUE, &acceptance ); @@ -580,7 +585,7 @@ BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask ) ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance ) { - switch( acceptance ) + switch (acceptance) { case ACCEPT_YES_MULTI: if (mCargoIDs.size() > 1) @@ -697,7 +702,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, mToolTipMsg.clear(); - if(top_view) + if (top_view) { handled = TRUE; @@ -762,7 +767,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, } } - if(!handled) + if (!handled) { handled = TRUE; @@ -820,7 +825,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, } } - if ( !handled ) + if (!handled) { dragOrDrop3D( x, y, mask, drop, acceptance ); } @@ -873,7 +878,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info) if (hit_obj->isAttachment() && !hit_obj->isHUDAttachment()) { LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment( hit_obj ); - if( !avatar ) + if (!avatar) { mLastAccept = ACCEPT_NO; mCursor = UI_CURSOR_NO; @@ -885,7 +890,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info) if (hit_obj->isAvatar()) { - if(((LLVOAvatar*) hit_obj)->isSelf()) + if (((LLVOAvatar*) hit_obj)->isSelf()) { target = DT_SELF; hit_face = -1; @@ -959,7 +964,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info) gViewerWindow->getWindow()->setCursor( cursor ); mLastHitPos = pick_info.mPosGlobal; - mLastCameraPos = gAgent.getCameraPositionGlobal(); + mLastCameraPos = gAgentCamera.getCameraPositionGlobal(); } // static @@ -971,7 +976,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, // Always succeed if.... // texture is from the library // or already in the contents of the object - if(SOURCE_LIBRARY == source) + if (SOURCE_LIBRARY == source) { // dropping a texture from the library always just works. return TRUE; @@ -999,7 +1004,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, if (!item) return FALSE; LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - if(!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) + if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) { // Check that we can add the texture as inventory to the object if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE ) @@ -1007,20 +1012,20 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, return FALSE; } // make sure the object has the texture in it's inventory. - if(SOURCE_AGENT == source) + if (SOURCE_AGENT == source) { // Remove the texture from local inventory. The server // will actually remove the item from agent inventory. gInventory.deleteObject(item->getUUID()); gInventory.notifyObservers(); } - else if(SOURCE_WORLD == source) + else if (SOURCE_WORLD == source) { // *FIX: if the objects are in different regions, and the // source region has crashed, you can bypass these // permissions. LLViewerObject* src_obj = gObjectList.findObject(src_id); - if(src_obj) + if (src_obj) { src_obj->removeInventory(item->getUUID()); } @@ -1035,7 +1040,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, // TODO: Check to see if adding the item was successful; if not, then // we should return false here. } - else if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, + else if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { // Check that we can add the texture as inventory to the object @@ -1067,7 +1072,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj, } LLUUID asset_id = item->getAssetUUID(); BOOL success = handleDropTextureProtections(hit_obj, item, source, src_id); - if(!success) + if (!success) { return; } @@ -1109,7 +1114,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj, } LLUUID asset_id = item->getAssetUUID(); BOOL success = handleDropTextureProtections(hit_obj, item, source, src_id); - if(!success) + if (!success) { return; } @@ -1132,32 +1137,32 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, { // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) + if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource)) { llwarns << "Call to LLToolDragAndDrop::dropScript() from world" << " or notecard." << llendl; return; } - if(hit_obj && item) + if (hit_obj && item) { LLPointer<LLViewerInventoryItem> new_script = new LLViewerInventoryItem(item); - if(!item->getPermissions().allowCopyBy(gAgent.getID())) + if (!item->getPermissions().allowCopyBy(gAgent.getID())) { - if(SOURCE_AGENT == source) + if (SOURCE_AGENT == source) { // Remove the script from local inventory. The server // will actually remove the item from agent inventory. gInventory.deleteObject(item->getUUID()); gInventory.notifyObservers(); } - else if(SOURCE_WORLD == source) + else if (SOURCE_WORLD == source) { // *FIX: if the objects are in different regions, and // the source region has crashed, you can bypass // these permissions. LLViewerObject* src_obj = gObjectList.findObject(src_id); - if(src_obj) + if (src_obj) { src_obj->removeInventory(item->getUUID()); } @@ -1173,7 +1178,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, // VEFFECT: SetScript LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject(gAgent.getAvatarObject()); + effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(hit_obj); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -1197,7 +1202,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return; + if (!item || !item->isComplete()) return; //if (regionp // && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)) @@ -1208,7 +1213,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // this will remove the object from inventory after rez. Only // bother with this check if we would not normally remove from // inventory. - if(!remove_from_inventory + if (!remove_from_inventory && !item->getPermissions().allowCopyBy(gAgent.getID())) { remove_from_inventory = TRUE; @@ -1219,7 +1224,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // hitting objects that were clipped by the near plane or culled // on the viewer. LLUUID ray_target_id; - if( raycast_target ) + if (raycast_target) { ray_target_id = raycast_target->getID(); } @@ -1231,7 +1236,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // Check if it's in the trash. bool is_in_trash = false; const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) + if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { is_in_trash = true; remove_from_inventory = TRUE; @@ -1289,7 +1294,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); LLUUID folder_id = item->getParentUUID(); - if((SOURCE_LIBRARY == mSource) || (is_in_trash)) + if ((SOURCE_LIBRARY == mSource) || (is_in_trash)) { // since it's coming from the library or trash, we want to not // 'take' it back to the same place. @@ -1323,7 +1328,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, gViewerWindow->getWindow()->incBusyCount(); } - if(remove_from_inventory) + if (remove_from_inventory) { // Delete it from inventory immediately so that users cannot // easily bypass copy protection in laggy situations. If the @@ -1334,7 +1339,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // VEFFECT: DropObject LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject(gAgent.getAvatarObject()); + effectp->setSourceObject(gAgentAvatarp); effectp->setPositionGlobal(mLastHitPos); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -1349,7 +1354,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, { // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) + if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource)) { llwarns << "Call to LLToolDragAndDrop::dropInventory() from world" @@ -1361,9 +1366,9 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, time_t creation_date = time_corrected(); new_item->setCreationDate(creation_date); - if(!item->getPermissions().allowCopyBy(gAgent.getID())) + if (!item->getPermissions().allowCopyBy(gAgent.getID())) { - if(SOURCE_AGENT == source) + if (SOURCE_AGENT == source) { // Remove the inventory item from local inventory. The // server will actually remove the item from agent @@ -1371,13 +1376,13 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, gInventory.deleteObject(item->getUUID()); gInventory.notifyObservers(); } - else if(SOURCE_WORLD == source) + else if (SOURCE_WORLD == source) { // *FIX: if the objects are in different regions, and the // source region has crashed, you can bypass these // permissions. LLViewerObject* src_obj = gObjectList.findObject(src_id); - if(src_obj) + if (src_obj) { src_obj->removeInventory(item->getUUID()); } @@ -1397,7 +1402,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, // VEFFECT: AddToInventory LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject(gAgent.getAvatarObject()); + effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(hit_obj); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -1410,11 +1415,11 @@ void LLToolDragAndDrop::giveInventory(const LLUUID& to_agent, { llinfos << "LLToolDragAndDrop::giveInventory()" << llendl; - if(!isInventoryGiveAcceptable(item)) + if (!isInventoryGiveAcceptable(item)) { return; } - if(item->getPermissions().allowCopyBy(gAgent.getID())) + if (item->getPermissions().allowCopyBy(gAgent.getID())) { // just give it away. LLToolDragAndDrop::commitGiveInventoryItem(to_agent, item, im_session_id); @@ -1438,7 +1443,7 @@ bool LLToolDragAndDrop::handleCopyProtectedItem(const LLSD& notification, const { case 0: // "Yes" item = gInventory.getItem(notification["payload"]["item_id"].asUUID()); - if(item) + if (item) { LLToolDragAndDrop::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(), item); @@ -1465,7 +1470,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent, LLInventoryItem* item, const LLUUID& im_session_id) { - if(!item) return; + if (!item) return; std::string name; LLAgentUI::buildFullname(name); LLUUID transaction_id; @@ -1495,7 +1500,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent, // VEFFECT: giveInventory LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject(gAgent.getAvatarObject()); + effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -1542,21 +1547,17 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent, const LLUUID& im_session_id) { - if(!cat) return; + if (!cat) return; llinfos << "LLToolDragAndDrop::giveInventoryCategory() - " << cat->getUUID() << llendl; - LLVOAvatar* my_avatar = gAgent.getAvatarObject(); - if( !my_avatar ) - { - return; - } + if (!isAgentAvatarValid()) return; // Test out how many items are being given. LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLGiveable giveable; - gInventory.collectDescendentsIf(cat->getUUID(), + gInventory.collectDescendentsIf (cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, @@ -1565,31 +1566,31 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent, bool complete = true; for(S32 i = 0; i < count; ++i) { - if(!gInventory.isCategoryComplete(cats.get(i)->getUUID())) + if (!gInventory.isCategoryComplete(cats.get(i)->getUUID())) { complete = false; break; } } - if(!complete) + if (!complete) { LLNotificationsUtil::add("IncompleteInventory"); return; } count = items.count() + cats.count(); - if(count > MAX_ITEMS) + if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); return; } - else if(count == 0) + else if (count == 0) { LLNotificationsUtil::add("NoItems"); return; } else { - if(0 == giveable.countNoCopy()) + if (0 == giveable.countNoCopy()) { LLToolDragAndDrop::commitGiveInventoryCategory(to_agent, cat, im_session_id); } @@ -1615,14 +1616,14 @@ bool LLToolDragAndDrop::handleCopyProtectedCategory(const LLSD& notification, co { case 0: // "Yes" cat = gInventory.getCategory(notification["payload"]["folder_id"].asUUID()); - if(cat) + if (cat) { LLToolDragAndDrop::commitGiveInventoryCategory(notification["payload"]["agent_id"].asUUID(), cat); LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLUncopyableItems remove; - gInventory.collectDescendentsIf(cat->getUUID(), + gInventory.collectDescendentsIf (cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, @@ -1653,7 +1654,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, const LLUUID& im_session_id) { - if(!cat) return; + if (!cat) return; llinfos << "LLToolDragAndDrop::commitGiveInventoryCategory() - " << cat->getUUID() << llendl; @@ -1664,7 +1665,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLGiveable giveable; - gInventory.collectDescendentsIf(cat->getUUID(), + gInventory.collectDescendentsIf (cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, @@ -1674,12 +1675,12 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, // MTUBYTES or 18 * count < 1200 => count < 1200/18 => // 66. I've cut it down a bit from there to give some pad. S32 count = items.count() + cats.count(); - if(count > MAX_ITEMS) + if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); return; } - else if(count == 0) + else if (count == 0) { LLNotificationsUtil::add("NoItems"); return; @@ -1738,7 +1739,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, // VEFFECT: giveInventoryCategory LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject(gAgent.getAvatarObject()); + effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -1753,35 +1754,31 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, // static BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item) { - if(!item) + if (!item) { return FALSE; } - if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { return FALSE; } BOOL copyable = FALSE; - if(item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE; + if (item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE; - LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); - if(!my_avatar) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; BOOL acceptable = TRUE; switch(item->getType()) { case LLAssetType::AT_OBJECT: - if(my_avatar->isWearingAttachment(item->getUUID())) + if (gAgentAvatarp->isWearingAttachment(item->getUUID())) { acceptable = FALSE; } break; case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - if(!copyable && gAgentWearables.isWearingItem(item->getUUID())) + if (!copyable && gAgentWearables.isWearingItem(item->getUUID())) { acceptable = FALSE; } @@ -1795,33 +1792,29 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item) // Static BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item) { - if(!item) + if (!item) { return FALSE; } // These permissions are double checked in the simulator in // LLGroupNoticeInventoryItemFetch::result(). - if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { return FALSE; } - if(!item->getPermissions().allowCopyBy(gAgent.getID())) + if (!item->getPermissions().allowCopyBy(gAgent.getID())) { return FALSE; } - LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); - if(!my_avatar) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; BOOL acceptable = TRUE; switch(item->getType()) { case LLAssetType::AT_OBJECT: - if(my_avatar->isWearingAttachment(item->getUUID())) + if (gAgentAvatarp->isWearingAttachment(item->getUUID())) { acceptable = FALSE; } @@ -1847,7 +1840,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // help make sure that drops that are from an object to an object // don't have to worry about order of evaluation. Think of this // like check for self in assignment. - if(obj->getID() == item->getParentUUID()) + if (obj->getID() == item->getParentUUID()) { return ACCEPT_NO; } @@ -1856,19 +1849,17 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // gAgent.getGroupID()) // && (obj->mPermModify || obj->mFlagAllowInventoryAdd)); BOOL worn = FALSE; - LLVOAvatarSelf* my_avatar = NULL; switch(item->getType()) { case LLAssetType::AT_OBJECT: - my_avatar = gAgent.getAvatarObject(); - if(my_avatar && my_avatar->isWearingAttachment(item->getUUID())) + if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getUUID())) { worn = TRUE; } break; case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - if(gAgentWearables.isWearingItem(item->getUUID())) + if (gAgentWearables.isWearingItem(item->getUUID())) { worn = TRUE; } @@ -1879,7 +1870,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL const LLPermissions& perm = item->getPermissions(); BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd()); BOOL transfer = FALSE; - if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID())) + if ((obj->permYouOwner() && (perm.getOwner() == gAgent.getID())) || perm.allowOperationBy(PERM_TRANSFER, gAgent.getID())) { transfer = TRUE; @@ -1887,15 +1878,15 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL BOOL volume = (LL_PCODE_VOLUME == obj->getPCode()); BOOL attached = obj->isAttachment(); BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; - if(attached && !unrestricted) + if (attached && !unrestricted) { return ACCEPT_NO_LOCKED; } - else if(modify && transfer && volume && !worn) + else if (modify && transfer && volume && !worn) { return ACCEPT_YES_MULTI; } - else if(!modify) + else if (!modify) { return ACCEPT_NO_LOCKED; } @@ -1926,12 +1917,12 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_ case DAD_CALLINGCARD: { LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data; - if(gInventory.getItem(inv_item->getUUID()) + if (gInventory.getItem(inv_item->getUUID()) && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item)) { // *TODO: get multiple object transfers working *accept = ACCEPT_YES_COPY_SINGLE; - if(drop) + if (drop) { LLToolDragAndDrop::giveInventory(dest_agent, inv_item, session_id); } @@ -1949,11 +1940,11 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_ case DAD_CATEGORY: { LLViewerInventoryCategory* inv_cat = (LLViewerInventoryCategory*)cargo_data; - if( gInventory.getCategory( inv_cat->getUUID() ) ) + if (gInventory.getCategory(inv_cat->getUUID())) { // *TODO: get multiple object transfers working *accept = ACCEPT_YES_COPY_SINGLE; - if(drop) + if (drop) { LLToolDragAndDrop::giveInventoryCategory(dest_agent, inv_cat, session_id); } @@ -1994,7 +1985,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( { lldebugs << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << llendl; // must be in the user's inventory - if(mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY) + if (mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY) { return ACCEPT_NO; } @@ -2002,25 +1993,24 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; // must not be in the trash const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) ) + if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { return ACCEPT_NO; } // must not be already wearing it - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( !avatar || avatar->isWearingAttachment(item->getUUID()) ) + if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID())) { return ACCEPT_NO; } - if( drop ) + if (drop) { - if(mSource == SOURCE_LIBRARY) + if (mSource == SOURCE_LIBRARY) { LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0); copy_inventory_item( @@ -2052,10 +2042,9 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; - LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); - if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) ) + if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID())) { return ACCEPT_NO; } @@ -2080,7 +2069,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( // check if the item can be copied. If not, send that to the sim // which will remove the inventory item. - if(!item->getPermissions().allowCopyBy(gAgent.getID())) + if (!item->getPermissions().allowCopyBy(gAgent.getID())) { accept = ACCEPT_YES_SINGLE; remove_inventory = TRUE; @@ -2088,13 +2077,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( // Check if it's in the trash. const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) + if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { accept = ACCEPT_YES_SINGLE; remove_inventory = TRUE; } - if(drop) + if (drop) { dropObject(obj, TRUE, FALSE, remove_inventory); } @@ -2115,24 +2104,23 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; - LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); - if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) ) + if (!item || !item->isComplete()) return ACCEPT_NO; + if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID())) { return ACCEPT_NO; } - if((mask & MASK_CONTROL)) + if ((mask & MASK_CONTROL)) { // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if(mSource == SOURCE_NOTECARD) + if (mSource == SOURCE_NOTECARD) { return ACCEPT_NO; } EAcceptance rv = willObjectAcceptInventory(obj, item); - if(drop && (ACCEPT_YES_SINGLE <= rv)) + if (drop && (ACCEPT_YES_SINGLE <= rv)) { dropInventory(obj, item, mSource, mSourceID); } @@ -2158,7 +2146,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( // check if the item can be copied. If not, send that to the sim // which will remove the inventory item. - if(!item->getPermissions().allowCopyBy(gAgent.getID())) + if (!item->getPermissions().allowCopyBy(gAgent.getID())) { accept = ACCEPT_YES_SINGLE; remove_inventory = TRUE; @@ -2166,13 +2154,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( // Check if it's in the trash. const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) + if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { accept = ACCEPT_YES_SINGLE; remove_inventory = TRUE; } - if(drop) + if (drop) { dropObject(obj, FALSE, FALSE, remove_inventory); } @@ -2187,7 +2175,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript( // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) + if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) { return ACCEPT_NO; } @@ -2195,9 +2183,9 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; EAcceptance rv = willObjectAcceptInventory(obj, item); - if(drop && (ACCEPT_YES_SINGLE <= rv)) + if (drop && (ACCEPT_YES_SINGLE <= rv)) { // rez in the script active by default, rez in inactive if the // control key is being held down. @@ -2225,7 +2213,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject( // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) + if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) { return ACCEPT_NO; } @@ -2233,29 +2221,29 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; EAcceptance rv = willObjectAcceptInventory(obj, item); - if((mask & MASK_CONTROL)) + if ((mask & MASK_CONTROL)) { - if((ACCEPT_YES_SINGLE <= rv) && drop) + if ((ACCEPT_YES_SINGLE <= rv) && drop) { dropInventory(obj, item, mSource, mSourceID); } return rv; } - if(!obj->permModify()) + if (!obj->permModify()) { return ACCEPT_NO_LOCKED; } //If texture !copyable don't texture or you'll never get it back. - if(!item->getPermissions().allowCopyBy(gAgent.getID())) + if (!item->getPermissions().allowCopyBy(gAgent.getID())) { return ACCEPT_NO; } - if(drop && (ACCEPT_YES_SINGLE <= rv)) + if (drop && (ACCEPT_YES_SINGLE <= rv)) { - if((mask & MASK_SHIFT)) + if ((mask & MASK_SHIFT)) { dropTextureAllFaces(obj, item, mSource, mSourceID); } @@ -2266,7 +2254,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject( // VEFFECT: SetTexture LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject(gAgent.getAvatarObject()); + effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(obj); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -2280,9 +2268,9 @@ EAcceptance LLToolDragAndDrop::dad3dTextureSelf( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { lldebugs << "LLToolDragAndDrop::dad3dTextureAvatar()" << llendl; - if(drop) + if (drop) { - if( !(mask & MASK_SHIFT) ) + if (!(mask & MASK_SHIFT)) { dropTextureOneFaceAvatar( (LLVOAvatar*)obj, face, (LLInventoryItem*)mCargoData); } @@ -2298,18 +2286,18 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; - if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) + if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) { // it's in the agent inventory const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) ) + if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { return ACCEPT_NO; } - if( drop ) + if (drop) { // Don't wear anything until initial wearables are loaded, can // destroy clothing items. @@ -2319,7 +2307,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( return ACCEPT_NO; } - if(mSource == SOURCE_LIBRARY) + if (mSource == SOURCE_LIBRARY) { // create item based on that one, and put it on if that // was a success. @@ -2353,21 +2341,21 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; - if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) + if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) { // it's in the agent inventory const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) ) + if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { return ACCEPT_NO; } - if( drop ) + if (drop) { LLUUID item_id; - if(mSource == SOURCE_LIBRARY) + if (mSource == SOURCE_LIBRARY) { // create item based on that one, and put it on if that // was a success. @@ -2382,7 +2370,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( } else { - LLGestureManager::instance().activateGesture(item->getUUID()); + LLGestureMgr::instance().activateGesture(item->getUUID()); gInventory.updateItem(item); gInventory.notifyObservers(); } @@ -2402,7 +2390,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( LLViewerInventoryItem* item; LLViewerInventoryCategory* category; locateInventory(item, category); - if(!category) return ACCEPT_NO; + if (!category) return ACCEPT_NO; if (drop) { @@ -2415,26 +2403,26 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( } } - if(mSource == SOURCE_AGENT) + if (mSource == SOURCE_AGENT) { const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) ) + if (gInventory.isObjectDescendentOf(category->getUUID(), trash_id)) { return ACCEPT_NO; } - if(drop) + if (drop) { BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE ); - LLAppearanceManager::instance().wearInventoryCategory(category, false, append); + LLAppearanceMgr::instance().wearInventoryCategory(category, false, append); } return ACCEPT_YES_MULTI; } - else if(mSource == SOURCE_LIBRARY) + else if (mSource == SOURCE_LIBRARY) { - if(drop) + if (drop) { - LLAppearanceManager::instance().wearInventoryCategory(category, true, false); + LLAppearanceMgr::instance().wearInventoryCategory(category, true, false); } return ACCEPT_YES_MULTI; } @@ -2453,7 +2441,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) + if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) { return ACCEPT_NO; } @@ -2461,7 +2449,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; LLViewerObject* root_object = obj; if (obj && obj->getParent()) { @@ -2473,7 +2461,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( } EAcceptance rv = willObjectAcceptInventory(root_object, item); - if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv)) + if (root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv)) { dropInventory(root_object, item, mSource, mSourceID); } @@ -2517,7 +2505,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( LLDroppableItem droppable(!obj->permYouOwner()); LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; - gInventory.collectDescendentsIf(cat->getUUID(), + gInventory.collectDescendentsIf (cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, @@ -2546,7 +2534,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( { const LLViewerInventoryCategory *cat = (*cat_iter); rv = gInventory.isCategoryComplete(cat->getUUID()) ? ACCEPT_YES_MULTI : ACCEPT_NO; - if(rv < ACCEPT_YES_SINGLE) + if (rv < ACCEPT_YES_SINGLE) { lldebugs << "Category " << cat->getUUID() << "is not complete." << llendl; break; @@ -2589,7 +2577,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( } LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource); dropper->fetchItems(ids); - if(dropper->isEverythingComplete()) + if (dropper->isEverythingComplete()) { dropper->done(); } @@ -2614,27 +2602,26 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << llendl; // item has to be in agent inventory. - if(mSource != SOURCE_AGENT) return ACCEPT_NO; + if (mSource != SOURCE_AGENT) return ACCEPT_NO; // find the item now. LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; - if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { // cannot give away no-transfer objects return ACCEPT_NO; } - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(avatar && avatar->isWearingAttachment( item->getUUID() ) ) + if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getUUID())) { // You can't give objects that are attached to you return ACCEPT_NO; } - if( obj && avatar ) + if (obj && isAgentAvatarValid()) { - if(drop) + if (drop) { giveInventory(obj->getID(), item ); } @@ -2651,16 +2638,16 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory( { lldebugs << "LLToolDragAndDrop::dad3dGiveInventory()" << llendl; // item has to be in agent inventory. - if(mSource != SOURCE_AGENT) return ACCEPT_NO; + if (mSource != SOURCE_AGENT) return ACCEPT_NO; LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; - if(!isInventoryGiveAcceptable(item)) + if (!item || !item->isComplete()) return ACCEPT_NO; + if (!isInventoryGiveAcceptable(item)) { return ACCEPT_NO; } - if(drop && obj) + if (drop && obj) { giveInventory(obj->getID(), item); } @@ -2673,12 +2660,12 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << llendl; - if(drop && obj) + if (drop && obj) { LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!cat) return ACCEPT_NO; + if (!cat) return ACCEPT_NO; giveInventoryCategory(obj->getID(), cat); } // *TODO: deal with all the issues surrounding multi-object @@ -2694,14 +2681,14 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( LLViewerInventoryItem* item = NULL; LLViewerInventoryCategory* cat = NULL; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isComplete()) return ACCEPT_NO; - if(!gAgent.allowOperation(PERM_COPY, item->getPermissions()) + if (!gAgent.allowOperation(PERM_COPY, item->getPermissions()) || !item->getPermissions().allowTransferTo(LLUUID::null)) { return ACCEPT_NO_LOCKED; } - if(drop) + if (drop) { dropObject(obj, TRUE, TRUE, FALSE); } @@ -2715,8 +2702,8 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if(!item || !item->isComplete()) return ACCEPT_NO; - if((mask & MASK_CONTROL)) + if (!item || !item->isComplete()) return ACCEPT_NO; + if ((mask & MASK_CONTROL)) { // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. @@ -2724,19 +2711,19 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject( // *HACK: uncomment this when appropriate //EAcceptance rv = willObjectAcceptInventory(obj, item); - //if(drop && (ACCEPT_YES_SINGLE <= rv)) + //if (drop && (ACCEPT_YES_SINGLE <= rv)) //{ // dropInventory(obj, item, mSource, mSourceID); //} //return rv; } - if(!item->getPermissions().allowCopyBy(gAgent.getID(), + if (!item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) || !item->getPermissions().allowTransferTo(LLUUID::null)) { return ACCEPT_NO_LOCKED; } - if(drop) + if (drop) { dropObject(obj, FALSE, TRUE, FALSE); } @@ -2752,23 +2739,23 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand( LLInventoryItem* item; LLInventoryCategory* cat; locateInventory(item, cat); - if(!cat) return ACCEPT_NO; + if (!cat) return ACCEPT_NO; EAcceptance rv = ACCEPT_NO; // find all the items in the category LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLDropCopyableItems droppable; - gInventory.collectDescendentsIf(cat->getUUID(), + gInventory.collectDescendentsIf (cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, droppable); - if(items.count() > 0) + if (items.count() > 0) { rv = ACCEPT_YES_SINGLE; } - if((rv >= ACCEPT_YES_COPY_SINGLE) && drop) + if ((rv >= ACCEPT_YES_COPY_SINGLE) && drop) { createContainer(items, cat->getName()); return ACCEPT_NO; @@ -2791,19 +2778,19 @@ EAcceptance LLToolDragAndDrop::dad3dAssetOnLand( LLViewerInventoryItem::item_array_t items; LLViewerInventoryItem::item_array_t copyable_items; locateMultipleInventory(items, cats); - if(!items.count()) return ACCEPT_NO; + if (!items.count()) return ACCEPT_NO; EAcceptance rv = ACCEPT_NO; for (S32 i = 0; i < items.count(); i++) { LLInventoryItem* item = items[i]; - if(item->getPermissions().allowCopyBy(gAgent.getID())) + if (item->getPermissions().allowCopyBy(gAgent.getID())) { copyable_items.put(item); rv = ACCEPT_YES_SINGLE; } } - if((rv >= ACCEPT_YES_COPY_SINGLE) && drop) + if ((rv >= ACCEPT_YES_COPY_SINGLE) && drop) { createContainer(copyable_items, NULL); } @@ -2818,20 +2805,20 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory( { item = NULL; cat = NULL; - if(mCargoIDs.empty()) return NULL; - if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) + if (mCargoIDs.empty()) return NULL; + if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) { // The object should be in user inventory. item = (LLViewerInventoryItem*)gInventory.getItem(mCargoIDs[mCurItemIndex]); cat = (LLViewerInventoryCategory*)gInventory.getCategory(mCargoIDs[mCurItemIndex]); } - else if(mSource == SOURCE_WORLD) + else if (mSource == SOURCE_WORLD) { // This object is in some task inventory somewhere. LLViewerObject* obj = gObjectList.findObject(mSourceID); - if(obj) + if (obj) { - if((mCargoTypes[mCurItemIndex] == DAD_CATEGORY) + if ((mCargoTypes[mCurItemIndex] == DAD_CATEGORY) || (mCargoTypes[mCurItemIndex] == DAD_ROOT_CATEGORY)) { cat = (LLViewerInventoryCategory*)obj->getInventoryObject(mCargoIDs[mCurItemIndex]); @@ -2842,16 +2829,16 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory( } } } - else if(mSource == SOURCE_NOTECARD) + else if (mSource == SOURCE_NOTECARD) { LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", mSourceID); - if(preview) + if (preview) { item = (LLViewerInventoryItem*)preview->getDragItem(); } } - if(item) return item; - if(cat) return cat; + if (item) return item; + if (cat) return cat; return NULL; } @@ -2859,8 +2846,8 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory( LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryCategory::cat_array_t& cats, LLViewerInventoryItem::item_array_t& items) { - if(mCargoIDs.count() == 0) return NULL; - if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) + if (mCargoIDs.count() == 0) return NULL; + if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) { // The object should be in user inventory. for (S32 i = 0; i < mCargoIDs.count(); i++) @@ -2877,13 +2864,13 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC } } } - else if(mSource == SOURCE_WORLD) + else if (mSource == SOURCE_WORLD) { // This object is in some task inventory somewhere. LLViewerObject* obj = gObjectList.findObject(mSourceID); - if(obj) + if (obj) { - if((mCargoType == DAD_CATEGORY) + if ((mCargoType == DAD_CATEGORY) || (mCargoType == DAD_ROOT_CATEGORY)) { // The object should be in user inventory. @@ -2909,17 +2896,17 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC } } } - else if(mSource == SOURCE_NOTECARD) + else if (mSource == SOURCE_NOTECARD) { LLPreviewNotecard* card; card = (LLPreviewNotecard*)LLPreview::find(mSourceID); - if(card) + if (card) { items.put((LLInventoryItem*)card->getDragItem()); } } - if(items.count()) return items[0]; - if(cats.count()) return cats[0]; + if (items.count()) return items[0]; + if (cats.count()) return cats[0]; return NULL; } */ diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 0da13dac8b..85d003e5fc 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -81,7 +81,7 @@ public: const LLUUID& source_id = LLUUID::null, const LLUUID& object_id = LLUUID::null); void beginMultiDrag(const std::vector<EDragAndDropType> types, - const std::vector<LLUUID>& cargo_ids, + const uuid_vec_t& cargo_ids, ESource source, const LLUUID& source_id = LLUUID::null); void endDrag(); @@ -125,7 +125,7 @@ protected: std::vector<EDragAndDropType> mCargoTypes; //void* mCargoData; - std::vector<LLUUID> mCargoIDs; + uuid_vec_t mCargoIDs; ESource mSource; LLUUID mSourceID; LLUUID mObjectID; diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 2320ae57df..032714cabf 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -42,6 +42,7 @@ // Viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llbutton.h" #include "llviewercontrol.h" #include "lldrawable.h" @@ -167,19 +168,17 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) } } - if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode() ) + if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) { BOOL good_customize_avatar_hit = FALSE; if( hit_obj ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( hit_obj == avatar) + if (isAgentAvatarValid() && (hit_obj == gAgentAvatarp)) { // It's you good_customize_avatar_hit = TRUE; } - else - if( hit_obj->isAttachment() && hit_obj->permYouOwner() ) + else if (hit_obj->isAttachment() && hit_obj->permYouOwner()) { // It's an attachment that you're wearing good_customize_avatar_hit = TRUE; @@ -207,23 +206,23 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) // ...clicked on a world object, so focus at its position if (!hit_obj->isHUDAttachment()) { - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(pick_info); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(pick_info); } } else if (!pick_info.mPosGlobal.isExactlyZero()) { // Hit the ground - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(pick_info); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(pick_info); } if (!(pick_info.mKeyMask & MASK_ALT) && - gAgent.cameraThirdPerson() && + gAgentCamera.cameraThirdPerson() && gViewerWindow->getLeftMouseDown() && !gSavedSettings.getBOOL("FreezeTime") && - (hit_obj == gAgent.getAvatarObject() || - (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf()))) + (hit_obj == gAgentAvatarp || + (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf()))) { LLToolCamera::getInstance()->mMouseSteering = TRUE; } @@ -232,14 +231,14 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) LLToolCamera::getInstance()->mValidClickPoint = TRUE; - if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode() ) + if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) { - gAgent.setFocusOnAvatar(FALSE, FALSE); + gAgentCamera.setFocusOnAvatar(FALSE, FALSE); - LLVector3d cam_pos = gAgent.getCameraPositionGlobal(); - cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgent.calcCustomizeAvatarUIOffset( cam_pos )); + LLVector3d cam_pos = gAgentCamera.getCameraPositionGlobal(); + cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgentCamera.calcCustomizeAvatarUIOffset( cam_pos )); - gAgent.setCameraPosAndFocusGlobal( cam_pos, pick_info.mPosGlobal, pick_info.mObjectID); + gAgentCamera.setCameraPosAndFocusGlobal( cam_pos, pick_info.mPosGlobal, pick_info.mObjectID); } } @@ -280,10 +279,10 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) { if (mValidClickPoint) { - if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode() ) + if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) { LLCoordGL mouse_pos; - LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgent.getFocusGlobal()); + LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgentCamera.getFocusGlobal()); BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos); if (success) { @@ -369,12 +368,12 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) if (dx != 0) { - gAgent.cameraOrbitAround( -dx * RADIANS_PER_PIXEL ); + gAgentCamera.cameraOrbitAround( -dx * RADIANS_PER_PIXEL ); } if (dy != 0) { - gAgent.cameraOrbitOver( -dy * RADIANS_PER_PIXEL ); + gAgentCamera.cameraOrbitOver( -dy * RADIANS_PER_PIXEL ); } gViewerWindow->moveCursorToCenter(); @@ -388,8 +387,8 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) // Pan tool if (hasMouseCapture()) { - LLVector3d camera_to_focus = gAgent.getCameraPositionGlobal(); - camera_to_focus -= gAgent.getFocusGlobal(); + LLVector3d camera_to_focus = gAgentCamera.getCameraPositionGlobal(); + camera_to_focus -= gAgentCamera.getFocusGlobal(); F32 dist = (F32) camera_to_focus.normVec(); // Fudge factor for pan @@ -397,12 +396,12 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) if (dx != 0) { - gAgent.cameraPanLeft( dx * meters_per_pixel ); + gAgentCamera.cameraPanLeft( dx * meters_per_pixel ); } if (dy != 0) { - gAgent.cameraPanUp( -dy * meters_per_pixel ); + gAgentCamera.cameraPanUp( -dy * meters_per_pixel ); } gViewerWindow->moveCursorToCenter(); @@ -419,7 +418,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) if (dx != 0) { - gAgent.cameraOrbitAround( -dx * RADIANS_PER_PIXEL ); + gAgentCamera.cameraOrbitAround( -dx * RADIANS_PER_PIXEL ); } const F32 IN_FACTOR = 0.99f; @@ -428,11 +427,11 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) { if (mMouseSteering) { - gAgent.cameraOrbitOver( -dy * RADIANS_PER_PIXEL ); + gAgentCamera.cameraOrbitOver( -dy * RADIANS_PER_PIXEL ); } else { - gAgent.cameraZoomIn( pow( IN_FACTOR, dy ) ); + gAgentCamera.cameraZoomIn( pow( IN_FACTOR, dy ) ); } } diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index d837a334f1..04d873f91b 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -46,6 +46,7 @@ // newview headers #include "llagent.h" +#include "llagentcamera.h" #include "lldrawable.h" #include "llfloatertools.h" #include "llhudeffect.h" @@ -225,7 +226,7 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info) // non-touchable objects. If it has a touch handler, we // do grab it (so llDetectedGrab works), but movement is // blocked on the server side. JC - if (gAgent.cameraMouselook()) + if (gAgentCamera.cameraMouselook()) { mMode = GRAB_LOCKED; } @@ -285,8 +286,8 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info) LLVector3 local_edit_point = gAgent.getPosAgentFromGlobal(info.mPosGlobal); local_edit_point -= edit_object->getPositionAgent(); local_edit_point = local_edit_point * ~edit_object->getRenderRotation(); - gAgent.setPointAt(POINTAT_TARGET_GRAB, edit_object, local_edit_point ); - gAgent.setLookAt(LOOKAT_TARGET_SELECT, edit_object, local_edit_point ); + gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, edit_object, local_edit_point ); + gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, edit_object, local_edit_point ); } // on transient grabs (clicks on world objects), kill the grab immediately @@ -390,7 +391,7 @@ void LLToolGrab::startGrab() // This planar drag starts at the grab point mDragStartPointGlobal = grab_start_global; - mDragStartFromCamera = grab_start_global - gAgent.getCameraPositionGlobal(); + mDragStartFromCamera = grab_start_global - gAgentCamera.getCameraPositionGlobal(); LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrab); @@ -502,7 +503,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) mVerticalDragging = FALSE; mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp); - mDragStartFromCamera = mDragStartPointGlobal - gAgent.getCameraPositionGlobal(); + mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal(); } else if (!mVerticalDragging && (mask == MASK_VERTICAL) ) { @@ -510,7 +511,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) mVerticalDragging = TRUE; mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp); - mDragStartFromCamera = mDragStartPointGlobal - gAgent.getCameraPositionGlobal(); + mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal(); } const F32 RADIANS_PER_PIXEL_X = 0.01f; @@ -598,7 +599,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) // need to return offset from mGrabStartPoint LLVector3d grab_point_global; - grab_point_global = gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; + grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; /* Snap to grid disabled for grab tool - very confusing // Handle snapping to grid, but only when the tool is formally selected. @@ -632,7 +633,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global); // propagate constrained grab point back to grab offset - mGrabHiddenOffsetFromCamera = grab_point_global - gAgent.getCameraPositionGlobal(); + mGrabHiddenOffsetFromCamera = grab_point_global - gAgentCamera.getCameraPositionGlobal(); // Handle auto-rotation at screen edge. LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global ); @@ -646,24 +647,24 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) // ...build mode moves camera about focus point if (grab_center_gl.mX < ROTATE_H_MARGIN) { - if (gAgent.getFocusOnAvatar()) + if (gAgentCamera.getFocusOnAvatar()) { gAgent.yaw(rotate_angle); } else { - gAgent.cameraOrbitAround(rotate_angle); + gAgentCamera.cameraOrbitAround(rotate_angle); } } else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthScaled() - ROTATE_H_MARGIN) { - if (gAgent.getFocusOnAvatar()) + if (gAgentCamera.getFocusOnAvatar()) { gAgent.yaw(-rotate_angle); } else { - gAgent.cameraOrbitAround(-rotate_angle); + gAgentCamera.cameraOrbitAround(-rotate_angle); } } @@ -705,17 +706,17 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) // once we've initiated a drag, lock the camera down if (mHasMoved) { - if (!gAgent.cameraMouselook() && + if (!gAgentCamera.cameraMouselook() && !objectp->isHUDAttachment() && - objectp->getRoot() == gAgent.getAvatarObject()->getRoot()) + objectp->getRoot() == gAgentAvatarp->getRoot()) { // force focus to point in space where we were looking previously - gAgent.setFocusGlobal(gAgent.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); } else { - gAgent.clearFocusObject(); + gAgentCamera.clearFocusObject(); } } @@ -814,7 +815,7 @@ void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask) } // need to return offset from mGrabStartPoint - LLVector3d grab_point_global = gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; + LLVector3d grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global ); } @@ -872,8 +873,8 @@ void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask) LLVector3 local_edit_point = pick.mIntersection; local_edit_point -= objectp->getPositionAgent(); local_edit_point = local_edit_point * ~objectp->getRenderRotation(); - gAgent.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point ); - gAgent.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point ); + gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point ); + gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point ); } @@ -892,7 +893,7 @@ void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask) // Only works in fullscreen if (gSavedSettings.getBOOL("WindowFullScreen")) { - if (gAgent.cameraThirdPerson() ) + if (gAgentCamera.cameraThirdPerson() ) { if (x == 0) { @@ -994,7 +995,7 @@ void LLToolGrab::onMouseCaptureLost() return; } // First, fix cursor placement - if( !gAgent.cameraMouselook() + if( !gAgentCamera.cameraMouselook() && (GRAB_ACTIVE_CENTER == mMode)) { if (objectp->isHUDAttachment()) @@ -1035,8 +1036,8 @@ void LLToolGrab::onMouseCaptureLost() mGrabPick.mObjectID.setNull(); LLSelectMgr::getInstance()->updateSelectionCenter(); - gAgent.setPointAt(POINTAT_TARGET_CLEAR); - gAgent.setLookAt(LOOKAT_TARGET_CLEAR); + gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR); + gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); dialog_refresh_all(); } @@ -1128,7 +1129,7 @@ LLVector3d LLToolGrab::getGrabPointGlobal() case GRAB_ACTIVE_CENTER: case GRAB_NONPHYSICAL: case GRAB_LOCKED: - return gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; + return gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; case GRAB_NOOBJECT: case GRAB_INACTIVE: diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index a441d653c7..c815f1e96a 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -36,6 +36,7 @@ #include "llviewerwindow.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "llsky.h" #include "llappviewer.h" @@ -83,7 +84,7 @@ BOOL LLToolGun::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) { - if( gAgent.cameraMouselook() && mIsSelected ) + if( gAgentCamera.cameraMouselook() && mIsSelected ) { const F32 NOMINAL_MOUSE_SENSITIVITY = 0.0025f; diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index fd12163fd3..a8696c22ef 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -56,6 +56,7 @@ #include "lltoolobjpicker.h" #include "lltoolpipette.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "llviewerjoystick.h" #include "llviewermenu.h" @@ -262,7 +263,7 @@ void LLToolMgr::toggleBuildMode() else { // manually disable edit mode, but do not affect the camera - gAgent.resetView(false); + gAgentCamera.resetView(false); LLFloaterReg::hideInstance("build"); gViewerWindow->showCursor(); } @@ -271,7 +272,7 @@ void LLToolMgr::toggleBuildMode() } else { - ECameraMode camMode = gAgent.getCameraMode(); + ECameraMode camMode = gAgentCamera.getCameraMode(); if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode) { // pull the user out of mouselook or appearance mode when entering build mode @@ -286,13 +287,13 @@ void LLToolMgr::toggleBuildMode() handle_toggle_flycam(); } - if (gAgent.getFocusOnAvatar()) + if (gAgentCamera.getFocusOnAvatar()) { // zoom in if we're looking at the avatar - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis())); - gAgent.cameraZoomIn(0.666f); - gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis())); + gAgentCamera.cameraZoomIn(0.666f); + gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); } } @@ -303,7 +304,7 @@ void LLToolMgr::toggleBuildMode() // Could be first use //LLFirstUse::useBuild(); - gAgent.resetView(false); + gAgentCamera.resetView(false); // avoid spurious avatar movements LLViewerJoystick::getInstance()->setNeedsReset(); @@ -317,7 +318,7 @@ bool LLToolMgr::inBuildMode() // cameraMouselook() actually starts returning true. Also, appearance edit // sets build mode to true, so let's exclude that. bool b=(inEdit() - && !gAgent.cameraMouselook() + && !gAgentCamera.cameraMouselook() && mCurrentToolset != gFaceEditToolset); return b; diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 5f825b461e..969049ee65 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -139,22 +139,20 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis BOOL LLVisualParamHint::needsRender() { - return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgent.getAvatarObject()->mAppearanceAnimating && mAllowsUpdates; + return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->mAppearanceAnimating && mAllowsUpdates; } void LLVisualParamHint::preRender(BOOL clear_depth) { - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - mLastParamWeight = mVisualParam->getWeight(); mVisualParam->setWeight(mVisualParamWeight, FALSE); - avatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE); - avatarp->setVisualParamWeight("Blink_Left", 0.f); - avatarp->setVisualParamWeight("Blink_Right", 0.f); - avatarp->updateComposites(); - avatarp->updateVisualParams(); - avatarp->updateGeometry(avatarp->mDrawable); - avatarp->updateLOD(); + gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE); + gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f); + gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f); + gAgentAvatarp->updateComposites(); + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable); + gAgentAvatarp->updateLOD(); LLViewerDynamicTexture::preRender(clear_depth); } @@ -165,7 +163,6 @@ void LLVisualParamHint::preRender(BOOL clear_depth) BOOL LLVisualParamHint::render() { LLVisualParamReset::sDirty = TRUE; - LLVOAvatar* avatarp = gAgent.getAvatarObject(); gGL.pushUIMatrix(); gGL.loadUIIdentity(); @@ -196,7 +193,7 @@ BOOL LLVisualParamHint::render() const std::string& cam_target_mesh_name = mVisualParam->getCameraTargetName(); if( !cam_target_mesh_name.empty() ) { - cam_target_joint = (LLViewerJointMesh*)avatarp->getJoint( cam_target_mesh_name ); + cam_target_joint = (LLViewerJointMesh*)gAgentAvatarp->getJoint( cam_target_mesh_name ); } if( !cam_target_joint ) { @@ -204,11 +201,11 @@ BOOL LLVisualParamHint::render() } if( !cam_target_joint ) { - cam_target_joint = (LLViewerJointMesh*)avatarp->getJoint("mHead"); + cam_target_joint = (LLViewerJointMesh*)gAgentAvatarp->getJoint("mHead"); } LLQuaternion avatar_rotation; - LLJoint* root_joint = avatarp->getRootJoint(); + LLJoint* root_joint = gAgentAvatarp->getRootJoint(); if( root_joint ) { avatar_rotation = root_joint->getWorldRotation(); @@ -236,17 +233,17 @@ BOOL LLVisualParamHint::render() LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); - if (avatarp->mDrawable.notNull()) + if (gAgentAvatarp->mDrawable.notNull()) { - LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); + LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatarp->mDrawable->getFace(0)->getPool(); LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); gGL.setAlphaRejectSettings(LLRender::CF_ALWAYS); gGL.setSceneBlendType(LLRender::BT_REPLACE); - avatarPoolp->renderAvatars(avatarp); // renders only one avatar + avatarPoolp->renderAvatars(gAgentAvatarp); // renders only one avatar gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } - avatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight); + gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight); mVisualParam->setWeight(mLastParamWeight, FALSE); gGL.color4f(1,1,1,1); mGLTexturep->setGLTextureCreated(true); @@ -297,10 +294,9 @@ BOOL LLVisualParamReset::render() { if (sDirty) { - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - avatarp->updateComposites(); - avatarp->updateVisualParams(); - avatarp->updateGeometry(avatarp->mDrawable); + gAgentAvatarp->updateComposites(); + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable); sDirty = FALSE; } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index d15db536e6..84c463495b 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -39,6 +39,7 @@ #include "llparcel.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "llfocusmgr.h" //#include "llfirstuse.h" @@ -204,15 +205,15 @@ BOOL LLToolPie::pickLeftMouseDownCallback() // touch behavior down below... break; case CLICK_ACTION_SIT: - - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting { - handle_object_sit_or_stand(); - // put focus in world when sitting on an object - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } // else nothing (fall through to touch) - + if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // agent not already sitting + { + handle_object_sit_or_stand(); + // put focus in world when sitting on an object + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; + } // else nothing (fall through to touch) + } case CLICK_ACTION_PAY: if ((object && object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) @@ -263,7 +264,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() if (object) { - gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); LLBBox bbox = object->getBoundingBoxAgent() ; F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); @@ -273,7 +274,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() obj_to_cam.normVec(); LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent()); - gAgent.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance), + gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance), object_center_global, mPick.mObjectID ); } @@ -329,14 +330,14 @@ BOOL LLToolPie::pickLeftMouseDownCallback() } object = (LLViewerObject*)object->getParent(); } - if (object && object == gAgent.getAvatarObject()) + if (object && object == gAgentAvatarp) { // we left clicked on avatar, switch to focus mode LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); gViewerWindow->hideCursor(); LLToolCamera::getInstance()->setMouseCapture(TRUE); LLToolCamera::getInstance()->pickCallback(mPick); - gAgent.setFocusOnAvatar(TRUE, TRUE); + gAgentCamera.setFocusOnAvatar(TRUE, TRUE); return TRUE; } @@ -410,9 +411,11 @@ ECursorType cursor_from_object(LLViewerObject* object) switch(click_action) { case CLICK_ACTION_SIT: - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting? { - cursor = UI_CURSOR_TOOLSIT; + if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting? + { + cursor = UI_CURSOR_TOOLSIT; + } } break; case CLICK_ACTION_BUY: @@ -496,6 +499,8 @@ void LLToolPie::selectionPropertiesReceived() BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) { mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE); + // perform a separate pick that detects transparent objects since they respond to 1-click actions + LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, TRUE); // Show screen-space highlight glow effect bool show_highlight = false; @@ -507,10 +512,11 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) parent = object->getRootEdit(); } - if (object && useClickAction(mask, object, parent)) + LLViewerObject* click_action_object = click_action_pick.getObject(); + if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit())) { show_highlight = true; - ECursorType cursor = cursor_from_object(object); + ECursorType cursor = cursor_from_object(click_action_object); gViewerWindow->setCursor(cursor); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; } @@ -592,7 +598,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) mGrabMouseButtonDown = FALSE; LLToolMgr::getInstance()->clearTransientTool(); - gAgent.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on + gAgentCamera.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on return LLTool::handleMouseUp(x, y, mask); } diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 612bcc03bd..91f01f0b36 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -56,11 +56,13 @@ #include "llvolumemessage.h" #include "llhudmanager.h" #include "llagent.h" +#include "llagentcamera.h" #include "llaudioengine.h" #include "llhudeffecttrail.h" #include "llviewerobjectlist.h" #include "llviewercamera.h" #include "llviewerstats.h" +#include "llvoavatarself.h" // linden library headers #include "llprimitive.h" @@ -120,7 +122,7 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, } // Make sure the surface isn't too far away. - LLVector3d ray_start_global = gAgent.getCameraPositionGlobal(); + LLVector3d ray_start_global = gAgentCamera.getCameraPositionGlobal(); F32 dist_to_surface_sq = (F32)((surface_pos_global - ray_start_global).magVecSquared()); if( dist_to_surface_sq > (max_dist_from_camera * max_dist_from_camera) ) { @@ -432,7 +434,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) // VEFFECT: AddObject LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); - effectp->setSourceObject((LLViewerObject*)gAgent.getAvatarObject()); + effectp->setSourceObject((LLViewerObject*)gAgentAvatarp); effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 97e2865179..2065ba1791 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -35,6 +35,7 @@ #include "lltoolselect.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "lldrawable.h" #include "llmanip.h" @@ -167,9 +168,9 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi LLSelectMgr::getInstance()->setAgentHUDZoom(target_zoom, current_zoom); } - if (!gAgent.getFocusOnAvatar() && // if camera not glued to avatar - LLVOAvatar::findAvatarFromAttachment(object) != gAgent.getAvatarObject() && // and it's not one of your attachments - object != gAgent.getAvatarObject()) // and it's not you + if (!gAgentCamera.getFocusOnAvatar() && // if camera not glued to avatar + LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatarp && // and it's not one of your attachments + object != gAgentAvatarp) // and it's not you { // have avatar turn to face the selected object(s) LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal(); diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 407cc23d0d..9a69adae31 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -50,6 +50,7 @@ #include "llappviewer.h" #include "lltracker.h" #include "llagent.h" +#include "llagentcamera.h" #include "llcallingcard.h" #include "llfloaterworldmap.h" #include "llhudtext.h" @@ -480,14 +481,14 @@ void LLTracker::renderBeacon(LLVector3d pos_global, const std::string& label ) { sCheesyBeacon = gSavedSettings.getBOOL("CheesyBeacon"); - LLVector3d to_vec = pos_global - gAgent.getCameraPositionGlobal(); + LLVector3d to_vec = pos_global - gAgentCamera.getCameraPositionGlobal(); F32 dist = (F32)to_vec.magVec(); F32 color_frac = 1.f; if (dist > 0.99f * LLViewerCamera::getInstance()->getFar()) { color_frac = 0.4f; - // pos_global = gAgent.getCameraPositionGlobal() + 0.99f*(LLViewerCamera::getInstance()->getFar()/dist)*to_vec; + // pos_global = gAgentCamera.getCameraPositionGlobal() + 0.99f*(LLViewerCamera::getInstance()->getFar()/dist)*to_vec; } else { diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index ef71965771..a31c3a0f1b 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -166,6 +166,10 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, // static bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, bool right_mouse) { + if(slurl.getType() != LLSLURL::LOCATION) + { + return false; + } // Before we're logged in, need to update the startup screen // to tell the user where they are going. if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) @@ -192,7 +196,11 @@ bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, bool right_mouse) /*static*/ void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport) { - regionHandleCallback(region_handle, slurl, snapshot_id, teleport); + + if(slurl.getType() == LLSLURL::LOCATION) + { + regionHandleCallback(region_handle, slurl, snapshot_id, teleport); + } } /* static */ @@ -220,7 +228,6 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& return; } - LLVector3d global_pos = from_region_handle(region_handle); global_pos += LLVector3d(slurl.getPosition()); diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp index 2a5c7cbea1..8488527185 100644 --- a/indra/newview/llurllineeditorctrl.cpp +++ b/indra/newview/llurllineeditorctrl.cpp @@ -72,7 +72,7 @@ void LLURLLineEditor::cut() if( need_to_rollback ) { rollback.doRollback( this ); - reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else if( mKeystrokeCallback ) @@ -96,8 +96,3 @@ void LLURLLineEditor::copyEscapedURLToClipboard() gClipboard.copyFromString( text_to_copy ); } -// Makes UISndBadKeystroke sound -void LLURLLineEditor::reportBadKeystroke() -{ - make_ui_sound("UISndBadKeystroke"); -} diff --git a/indra/newview/llurllineeditorctrl.h b/indra/newview/llurllineeditorctrl.h index 618f29dfbf..ebe417e855 100644 --- a/indra/newview/llurllineeditorctrl.h +++ b/indra/newview/llurllineeditorctrl.h @@ -55,8 +55,6 @@ protected: private: // util function to escape selected text and copy it to clipboard void copyEscapedURLToClipboard(); - // send a beep signal if keystroke is bad. As it is private at LLLineEditor we need own function - void reportBadKeystroke(); // Helper class to do rollback if needed class LLURLLineEditorRollback diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 2b45ccac8e..ef6f4194e0 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -34,6 +34,7 @@ #include "llaudioengine.h" #include "llagent.h" +#include "llagentcamera.h" #include "llappviewer.h" #include "llvieweraudio.h" #include "llviewercamera.h" @@ -51,7 +52,7 @@ void init_audio() llwarns << "Failed to create an appropriate Audio Engine" << llendl; return; } - LLVector3d lpos_global = gAgent.getCameraPositionGlobal(); + LLVector3d lpos_global = gAgentCamera.getCameraPositionGlobal(); LLVector3 lpos_global_f; lpos_global_f.setVec(lpos_global); @@ -180,7 +181,7 @@ void audio_update_listener() if (gAudiop) { // update listener position because agent has moved - LLVector3d lpos_global = gAgent.getCameraPositionGlobal(); + LLVector3d lpos_global = gAgentCamera.getCameraPositionGlobal(); LLVector3 lpos_global_f; lpos_global_f.setVec(lpos_global); @@ -203,7 +204,7 @@ void audio_update_wind(bool force_update) if (region) { static F32 last_camera_water_height = -1000.f; - LLVector3 camera_pos = gAgent.getCameraPositionAgent(); + LLVector3 camera_pos = gAgentCamera.getCameraPositionAgent(); F32 camera_water_height = camera_pos.mV[VZ] - region->getWaterHeight(); // diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 0051f46716..aa82c216d9 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -37,6 +37,7 @@ // Viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" @@ -354,7 +355,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection, } else { - z_far = gAgent.mDrawDistance; + z_far = gAgentCamera.mDrawDistance; } } else diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 27a23fbe74..ef6379948a 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -41,6 +41,7 @@ // For Listeners #include "llaudioengine.h" #include "llagent.h" +#include "llagentcamera.h" #include "llconsole.h" #include "lldrawpoolterrain.h" #include "llflexibleobject.h" @@ -73,6 +74,7 @@ #include "llnavigationbar.h" #include "llfloatertools.h" #include "llpaneloutfitsinventory.h" +#include "llpanellogin.h" #ifdef TOGGLE_HACKED_GODLIKE_VIEWER BOOL gHackGodmode = FALSE; @@ -102,7 +104,7 @@ static bool handleRenderAvatarMouselookChanged(const LLSD& newvalue) static bool handleRenderFarClipChanged(const LLSD& newvalue) { F32 draw_distance = (F32) newvalue.asReal(); - gAgent.mDrawDistance = draw_distance; + gAgentCamera.mDrawDistance = draw_distance; LLWorld::getInstance()->setLandFarClip(draw_distance); return true; } @@ -439,6 +441,12 @@ bool handleVelocityInterpolate(const LLSD& newvalue) return true; } +bool handleForceShowGrid(const LLSD& newvalue) +{ + LLPanelLogin::updateServer( ); + return true; +} + bool toggle_agent_pause(const LLSD& newvalue) { if ( newvalue.asBoolean() ) @@ -644,6 +652,7 @@ void settings_setup_listeners() gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2)); gSavedSettings.getControl("ShowDebugAppearanceEditor")->getSignal()->connect(boost::bind(&toggle_show_appearance_editor, _2)); gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2)); + gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 6c1c1d1096..823466e33e 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -38,6 +38,7 @@ #include "llrender.h" #include "llglheaders.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "llcoord.h" #include "llcriticaldamp.h" @@ -174,8 +175,8 @@ void display_update_camera() // Cut draw distance in half when customizing avatar, // but on the viewer only. - F32 final_far = gAgent.mDrawDistance; - if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode()) + F32 final_far = gAgentCamera.mDrawDistance; + if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode()) { final_far *= 0.5f; } @@ -344,9 +345,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. S32 attach_count = 0; - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - attach_count = gAgent.getAvatarObject()->getAttachmentCount(); + attach_count = gAgentAvatarp->getAttachmentCount(); } F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count; F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32(); @@ -393,7 +394,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gAgent.setTeleportMessage( LLAgent::sTeleportProgressMessages["arriving"]); gTextureList.mForceResetTextureStats = TRUE; - gAgent.resetView(TRUE, TRUE); + gAgentCamera.resetView(TRUE, TRUE); break; case LLAgent::TELEPORT_ARRIVING: @@ -920,9 +921,9 @@ void render_hud_attachments() glh::matrix4f current_mod = glh_get_current_modelview(); // clamp target zoom level to reasonable values - gAgent.mHUDTargetZoom = llclamp(gAgent.mHUDTargetZoom, 0.1f, 1.f); + gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f); // smoothly interpolate current zoom level - gAgent.mHUDCurZoom = lerp(gAgent.mHUDCurZoom, gAgent.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f)); + gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f)); if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) { @@ -1031,11 +1032,10 @@ LLRect get_whole_screen_region() bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model) { - LLVOAvatar* my_avatarp = gAgent.getAvatarObject(); - if (my_avatarp && my_avatarp->hasHUDAttachment()) + if (isAgentAvatarValid() && gAgentAvatarp->hasHUDAttachment()) { - F32 zoom_level = gAgent.mHUDCurZoom; - LLBBox hud_bbox = my_avatarp->getHUDBBox(); + F32 zoom_level = gAgentCamera.mHUDCurZoom; + LLBBox hud_bbox = gAgentAvatarp->getHUDBBox(); F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); @@ -1299,14 +1299,14 @@ void render_ui_2d() gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); // render outline for HUD - if (gAgent.getAvatarObject() && gAgent.mHUDCurZoom < 0.98f) + if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f) { glPushMatrix(); S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); glScalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); glTranslatef((F32)half_width, (F32)half_height, 0.f); - F32 zoom = gAgent.mHUDCurZoom; + F32 zoom = gAgentCamera.mHUDCurZoom; glScalef(zoom,zoom,1.f); gGL.color4fv(LLColor4::white.mV); gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 4fd02ff864..17221219eb 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -38,11 +38,14 @@ #include "message.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewerfoldertype.h" #include "llfolderview.h" #include "llviewercontrol.h" #include "llconsole.h" +#include "llinventoryfunctions.h" #include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" #include "llgesturemgr.h" #include "llsidetray.h" @@ -100,7 +103,7 @@ public: const std::string verb = params[1].asString(); if (verb == "select") { - std::vector<LLUUID> items_to_open; + uuid_vec_t items_to_open; items_to_open.push_back(inventory_id); //inventory_handler is just a stub, because we don't know from who this offer open_inventory_offer(items_to_open, "inventory_handler"); @@ -540,7 +543,7 @@ bool LLViewerInventoryCategory::fetchDescendents() std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); if (!url.empty()) //Capability found. Build up LLSD and use it. { - gInventory.startBackgroundFetch(mUUID); + LLInventoryModelBackgroundFetch::instance().start(mUUID); } else { //Deprecated, but if we don't have a capability, use the old system. @@ -793,8 +796,8 @@ void WearOnAvatarCallback::fire(const LLUUID& inv_item) void ModifiedCOFCallback::fire(const LLUUID& inv_item) { - LLAppearanceManager::instance().updateAppearanceFromCOF(); - if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode() ) + LLAppearanceMgr::instance().updateAppearanceFromCOF(); + if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) { // If we're in appearance editing mode, the current tab may need to be refreshed if (gFloaterCustomize) @@ -829,7 +832,7 @@ void ActivateGestureCallback::fire(const LLUUID& inv_item) if (inv_item.isNull()) return; - LLGestureManager::instance().activateGesture(inv_item); + LLGestureMgr::instance().activateGesture(inv_item); } void CreateGestureCallback::fire(const LLUUID& inv_item) @@ -837,7 +840,7 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) if (inv_item.isNull()) return; - LLGestureManager::instance().activateGesture(inv_item); + LLGestureMgr::instance().activateGesture(inv_item); LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) return; diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index b593fbfb00..b758f6c701 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -43,6 +43,7 @@ #include "llselectmgr.h" #include "llviewermenu.h" #include "llagent.h" +#include "llagentcamera.h" #include "llfocusmgr.h" @@ -106,7 +107,7 @@ void LLViewerJoystick::setOverrideCamera(bool val) if (mOverrideCamera) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } } @@ -432,7 +433,7 @@ void LLViewerJoystick::agentPitch(F32 pitch_inc) void LLViewerJoystick::agentYaw(F32 yaw_inc) { // Cannot steer some vehicles in mouselook if the script grabs the controls - if (gAgent.cameraMouselook() && !gSavedSettings.getBOOL("JoystickMouselookYaw")) + if (gAgentCamera.cameraMouselook() && !gSavedSettings.getBOOL("JoystickMouselookYaw")) { gAgent.rotate(-yaw_inc, gAgent.getReferenceUpVector()); } @@ -1005,7 +1006,7 @@ bool LLViewerJoystick::toggleFlycam() if (!mOverrideCamera) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME) diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index f757155b94..dd7390a907 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -36,6 +36,7 @@ #include "llviewerkeyboard.h" #include "llmath.h" #include "llagent.h" +#include "llagentcamera.h" #include "llnearbychatbar.h" #include "llviewercontrol.h" #include "llfocusmgr.h" @@ -279,22 +280,22 @@ F32 get_orbit_rate() void camera_spin_around_ccw( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitLeftKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitLeftKey( get_orbit_rate() ); } void camera_spin_around_cw( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitRightKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitRightKey( get_orbit_rate() ); } void camera_spin_around_ccw_sitting( EKeystate s ) { if( KEYSTATE_UP == s ) return; - if (gAgent.rotateGrabbed() || gAgent.sitCameraEnabled()) + if (gAgent.rotateGrabbed() || gAgentCamera.sitCameraEnabled()) { //send keystrokes, but do not change camera agent_turn_right(s); @@ -302,7 +303,7 @@ void camera_spin_around_ccw_sitting( EKeystate s ) else { //change camera but do not send keystrokes - gAgent.setOrbitLeftKey( get_orbit_rate() ); + gAgentCamera.setOrbitLeftKey( get_orbit_rate() ); } } @@ -310,7 +311,7 @@ void camera_spin_around_ccw_sitting( EKeystate s ) void camera_spin_around_cw_sitting( EKeystate s ) { if( KEYSTATE_UP == s ) return; - if (gAgent.rotateGrabbed() || gAgent.sitCameraEnabled()) + if (gAgent.rotateGrabbed() || gAgentCamera.sitCameraEnabled()) { //send keystrokes, but do not change camera agent_turn_left(s); @@ -318,7 +319,7 @@ void camera_spin_around_cw_sitting( EKeystate s ) else { //change camera but do not send keystrokes - gAgent.setOrbitRightKey( get_orbit_rate() ); + gAgentCamera.setOrbitRightKey( get_orbit_rate() ); } } @@ -326,22 +327,22 @@ void camera_spin_around_cw_sitting( EKeystate s ) void camera_spin_over( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitUpKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitUpKey( get_orbit_rate() ); } void camera_spin_under( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitDownKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitDownKey( get_orbit_rate() ); } void camera_spin_over_sitting( EKeystate s ) { if( KEYSTATE_UP == s ) return; - if (gAgent.upGrabbed() || gAgent.sitCameraEnabled()) + if (gAgent.upGrabbed() || gAgentCamera.sitCameraEnabled()) { //send keystrokes, but do not change camera agent_jump(s); @@ -349,7 +350,7 @@ void camera_spin_over_sitting( EKeystate s ) else { //change camera but do not send keystrokes - gAgent.setOrbitUpKey( get_orbit_rate() ); + gAgentCamera.setOrbitUpKey( get_orbit_rate() ); } } @@ -357,7 +358,7 @@ void camera_spin_over_sitting( EKeystate s ) void camera_spin_under_sitting( EKeystate s ) { if( KEYSTATE_UP == s ) return; - if (gAgent.downGrabbed() || gAgent.sitCameraEnabled()) + if (gAgent.downGrabbed() || gAgentCamera.sitCameraEnabled()) { //send keystrokes, but do not change camera agent_push_down(s); @@ -365,35 +366,35 @@ void camera_spin_under_sitting( EKeystate s ) else { //change camera but do not send keystrokes - gAgent.setOrbitDownKey( get_orbit_rate() ); + gAgentCamera.setOrbitDownKey( get_orbit_rate() ); } } void camera_move_forward( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitInKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitInKey( get_orbit_rate() ); } void camera_move_backward( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitOutKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitOutKey( get_orbit_rate() ); } void camera_move_forward_sitting( EKeystate s ) { if( KEYSTATE_UP == s ) return; - if (gAgent.forwardGrabbed() || gAgent.sitCameraEnabled()) + if (gAgent.forwardGrabbed() || gAgentCamera.sitCameraEnabled()) { agent_push_forward(s); } else { - gAgent.setOrbitInKey( get_orbit_rate() ); + gAgentCamera.setOrbitInKey( get_orbit_rate() ); } } @@ -402,70 +403,70 @@ void camera_move_backward_sitting( EKeystate s ) { if( KEYSTATE_UP == s ) return; - if (gAgent.backwardGrabbed() || gAgent.sitCameraEnabled()) + if (gAgent.backwardGrabbed() || gAgentCamera.sitCameraEnabled()) { agent_push_backward(s); } else { - gAgent.setOrbitOutKey( get_orbit_rate() ); + gAgentCamera.setOrbitOutKey( get_orbit_rate() ); } } void camera_pan_up( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setPanUpKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setPanUpKey( get_orbit_rate() ); } void camera_pan_down( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setPanDownKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setPanDownKey( get_orbit_rate() ); } void camera_pan_left( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setPanLeftKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setPanLeftKey( get_orbit_rate() ); } void camera_pan_right( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setPanRightKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setPanRightKey( get_orbit_rate() ); } void camera_pan_in( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setPanInKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setPanInKey( get_orbit_rate() ); } void camera_pan_out( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setPanOutKey( get_orbit_rate() ); + gAgentCamera.unlockView(); + gAgentCamera.setPanOutKey( get_orbit_rate() ); } void camera_move_forward_fast( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitInKey(2.5f); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitInKey(2.5f); } void camera_move_backward_fast( EKeystate s ) { if( KEYSTATE_UP == s ) return; - gAgent.unlockView(); - gAgent.setOrbitOutKey(2.5f); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitOutKey(2.5f); } @@ -473,7 +474,7 @@ void edit_avatar_spin_ccw( EKeystate s ) { if( KEYSTATE_UP == s ) return; gMorphView->setCameraDrivenByKeys( TRUE ); - gAgent.setOrbitLeftKey( get_orbit_rate() ); + gAgentCamera.setOrbitLeftKey( get_orbit_rate() ); //gMorphView->orbitLeft( get_orbit_rate() ); } @@ -482,7 +483,7 @@ void edit_avatar_spin_cw( EKeystate s ) { if( KEYSTATE_UP == s ) return; gMorphView->setCameraDrivenByKeys( TRUE ); - gAgent.setOrbitRightKey( get_orbit_rate() ); + gAgentCamera.setOrbitRightKey( get_orbit_rate() ); //gMorphView->orbitRight( get_orbit_rate() ); } @@ -490,7 +491,7 @@ void edit_avatar_spin_over( EKeystate s ) { if( KEYSTATE_UP == s ) return; gMorphView->setCameraDrivenByKeys( TRUE ); - gAgent.setOrbitUpKey( get_orbit_rate() ); + gAgentCamera.setOrbitUpKey( get_orbit_rate() ); //gMorphView->orbitUp( get_orbit_rate() ); } @@ -499,7 +500,7 @@ void edit_avatar_spin_under( EKeystate s ) { if( KEYSTATE_UP == s ) return; gMorphView->setCameraDrivenByKeys( TRUE ); - gAgent.setOrbitDownKey( get_orbit_rate() ); + gAgentCamera.setOrbitDownKey( get_orbit_rate() ); //gMorphView->orbitDown( get_orbit_rate() ); } @@ -507,7 +508,7 @@ void edit_avatar_move_forward( EKeystate s ) { if( KEYSTATE_UP == s ) return; gMorphView->setCameraDrivenByKeys( TRUE ); - gAgent.setOrbitInKey( get_orbit_rate() ); + gAgentCamera.setOrbitInKey( get_orbit_rate() ); //gMorphView->orbitIn(); } @@ -516,7 +517,7 @@ void edit_avatar_move_backward( EKeystate s ) { if( KEYSTATE_UP == s ) return; gMorphView->setCameraDrivenByKeys( TRUE ); - gAgent.setOrbitOutKey( get_orbit_rate() ); + gAgentCamera.setOrbitOutKey( get_orbit_rate() ); //gMorphView->orbitOut(); } @@ -868,7 +869,7 @@ S32 LLViewerKeyboard::loadBindings(const std::string& filename) EKeyboardMode LLViewerKeyboard::getMode() { - if ( gAgent.cameraMouselook() ) + if ( gAgentCamera.cameraMouselook() ) { return MODE_FIRST_PERSON; } @@ -876,7 +877,7 @@ EKeyboardMode LLViewerKeyboard::getMode() { return MODE_EDIT_AVATAR; } - else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) + else if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) { return MODE_SITTING; } diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 2fcd3f1114..e0cbddafae 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -45,6 +45,7 @@ #include "llviewertexturelist.h" #include "llvovolume.h" #include "llpluginclassmedia.h" +#include "llplugincookiestore.h" #include "llviewerwindow.h" #include "llfocusmgr.h" #include "llcallbacklist.h" @@ -256,6 +257,43 @@ public: LLViewerMediaImpl *mMediaImpl; bool mInitialized; }; + +class LLViewerMediaOpenIDResponder : public LLHTTPClient::Responder +{ +LOG_CLASS(LLViewerMediaOpenIDResponder); +public: + LLViewerMediaOpenIDResponder( ) + { + } + + ~LLViewerMediaOpenIDResponder() + { + } + + /* virtual */ void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + LL_DEBUGS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL; + LL_DEBUGS("MediaAuth") << content << LL_ENDL; + std::string cookie = content["set-cookie"].asString(); + + LLViewerMedia::openIDCookieResponse(cookie); + } + + /* virtual */ void completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + // This is just here to disable the default behavior (attempting to parse the response as llsd). + // We don't care about the content of the response, only the set-cookie header. + } + +}; + +LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL; +LLURL LLViewerMedia::sOpenIDURL; +std::string LLViewerMedia::sOpenIDCookie; static LLViewerMedia::impl_list sViewerMediaImplList; static LLViewerMedia::impl_id_map sViewerMediaTextureIDMap; static LLTimer sMediaCreateTimer; @@ -264,6 +302,8 @@ static F32 sGlobalVolume = 1.0f; static F64 sLowestLoadableImplInterest = 0.0f; static bool sAnyMediaShowing = false; static boost::signals2::connection sTeleportFinishConnection; +static std::string sUpdatedCookies; +static const char *PLUGIN_COOKIE_FILE_NAME = "plugin_cookies.txt"; ////////////////////////////////////////////////////////////////////////////////////////// static void add_media_impl(LLViewerMediaImpl* media) @@ -399,7 +439,6 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s media_impl->setHomeURL(media_entry->getHomeURL()); media_impl->mMediaAutoPlay = media_entry->getAutoPlay(); media_impl->mMediaEntryURL = media_entry->getCurrentURL(); - if(media_impl->isAutoPlayable()) { needs_navigate = true; @@ -698,6 +737,13 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi void LLViewerMedia::updateMedia(void *dummy_arg) { sAnyMediaShowing = false; + sUpdatedCookies = getCookieStore()->getChangedCookies(); + if(!sUpdatedCookies.empty()) + { + lldebugs << "updated cookies will be sent to all loaded plugins: " << llendl; + lldebugs << sUpdatedCookies << llendl; + } + impl_list::iterator iter = sViewerMediaImplList.begin(); impl_list::iterator end = sViewerMediaImplList.end(); @@ -998,6 +1044,9 @@ void LLViewerMedia::clearAllCookies() } } + // Clear all cookies from the cookie store + getCookieStore()->setAllCookies(""); + // FIXME: this may not be sufficient, since the on-disk cookie file won't get written until some browser instance exits cleanly. // It also won't clear cookies for other accounts, or for any account if we're not logged in, and won't do anything at all if there are no webkit plugins loaded. // Until such time as we can centralize cookie storage, the following hack should cover these cases: @@ -1008,6 +1057,7 @@ void LLViewerMedia::clearAllCookies() // Places that cookie files can be: // <getOSUserAppDir>/browser_profile/cookies // <getOSUserAppDir>/first_last/browser_profile/cookies (note that there may be any number of these!) + // <getOSUserAppDir>/first_last/plugin_cookies.txt (note that there may be any number of these!) std::string base_dir = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter(); std::string target; @@ -1040,9 +1090,21 @@ void LLViewerMedia::clearAllCookies() { LLFile::remove(target); } + + // Other accounts may have new-style cookie files too -- delete them as well + target = base_dir; + target += filename; + target += gDirUtilp->getDirDelimiter(); + target += PLUGIN_COOKIE_FILE_NAME; + lldebugs << "target = " << target << llendl; + if(LLFile::isfile(target)) + { + LLFile::remove(target); + } } - + // If we have an OpenID cookie, re-add it to the cookie store. + setOpenIDCookie(); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1095,6 +1157,185 @@ void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int por ///////////////////////////////////////////////////////////////////////////////////////// // static +///////////////////////////////////////////////////////////////////////////////////////// +// static +LLPluginCookieStore *LLViewerMedia::getCookieStore() +{ + if(sCookieStore == NULL) + { + sCookieStore = new LLPluginCookieStore; + } + + return sCookieStore; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::loadCookieFile() +{ + // build filename for each user + std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME); + + if (resolved_filename.empty()) + { + llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl; + return; + } + + // open the file for reading + llifstream file(resolved_filename); + if (!file.is_open()) + { + llwarns << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << llendl; + return; + } + + getCookieStore()->readAllCookies(file, true); + + file.close(); + + // send the clear_cookies message to all loaded plugins + impl_list::iterator iter = sViewerMediaImplList.begin(); + impl_list::iterator end = sViewerMediaImplList.end(); + for (; iter != end; iter++) + { + LLViewerMediaImpl* pimpl = *iter; + if(pimpl->mMediaSource) + { + pimpl->mMediaSource->clear_cookies(); + } + } + + // If we have an OpenID cookie, re-add it to the cookie store. + setOpenIDCookie(); +} + + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::saveCookieFile() +{ + // build filename for each user + std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME); + + if (resolved_filename.empty()) + { + llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl; + return; + } + + // open a file for writing + llofstream file (resolved_filename); + if (!file.is_open()) + { + llwarns << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << llendl; + return; + } + + getCookieStore()->writePersistentCookies(file); + + file.close(); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path, bool secure) +{ + std::stringstream cookie; + + cookie << name << "=" << LLPluginCookieStore::quoteString(value); + + if(expires.notNull()) + { + cookie << "; expires=" << expires.asRFC1123(); + } + + cookie << "; domain=" << domain; + + cookie << "; path=" << path; + + if(secure) + { + cookie << "; secure"; + } + + getCookieStore()->setCookies(cookie.str()); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path, bool secure) +{ + // A session cookie just has a NULL date. + addCookie(name, value, domain, LLDate(), path, secure); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::removeCookie(const std::string &name, const std::string &domain, const std::string &path ) +{ + // To remove a cookie, add one with the same name, domain, and path that expires in the past. + + addCookie(name, "", domain, LLDate(LLDate::now().secondsSinceEpoch() - 1.0), path); +} + + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::setOpenIDCookie() +{ + if(!sOpenIDCookie.empty()) + { + getCookieStore()->setCookiesFromHost(sOpenIDCookie, sOpenIDURL.mAuthority); + } +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string &openid_token) +{ + LL_DEBUGS("MediaAuth") << "url = \"" << openid_url << "\", token = \"" << openid_token << "\"" << LL_ENDL; + + // post the token to the url + // the responder will need to extract the cookie(s). + + // Save the OpenID URL for later -- we may need the host when adding the cookie. + sOpenIDURL.init(openid_url.c_str()); + + // We shouldn't ever do this twice, but just in case this code gets repurposed later, clear existing cookies. + sOpenIDCookie.clear(); + + LLSD headers = LLSD::emptyMap(); + // Keep LLHTTPClient from adding an "Accept: application/llsd+xml" header + headers["Accept"] = "*/*"; + // and use the expected content-type for a post, instead of the LLHTTPClient::postRaw() default of "application/octet-stream" + headers["Content-Type"] = "application/x-www-form-urlencoded"; + + // postRaw() takes ownership of the buffer and releases it later, so we need to allocate a new buffer here. + size_t size = openid_token.size(); + U8 *data = new U8[size]; + memcpy(data, openid_token.data(), size); + + LLHTTPClient::postRaw( + openid_url, + data, + size, + new LLViewerMediaOpenIDResponder(), + headers); + +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::openIDCookieResponse(const std::string &cookie) +{ + LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL; + + sOpenIDCookie += cookie; + + setOpenIDCookie(); +} + bool LLViewerMedia::hasInWorldMedia() { if (sInWorldMediaDisabled) return false; @@ -1232,11 +1473,6 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, ////////////////////////////////////////////////////////////////////////////////////////// LLViewerMediaImpl::~LLViewerMediaImpl() { - if( gEditMenuHandler == this ) - { - gEditMenuHandler = NULL; - } - destroyMediaSource(); LLViewerMediaTexture::removeMediaImplFromTexture(mTextureId) ; @@ -1296,7 +1532,10 @@ void LLViewerMediaImpl::createMediaSource() } else if(! mMimeType.empty()) { - initializeMedia(mMimeType); + if (!initializeMedia(mMimeType)) + { + LL_WARNS("Media") << "Failed to initialize media for mime type " << mMimeType << LL_ENDL; + } } } @@ -1455,6 +1694,17 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) media_source->clear_cache(); } + // TODO: Only send cookies to plugins that need them + // Ideally, the plugin should tell us whether it handles cookies or not -- either via the init response or through a separate message. + // Due to the ordering of messages, it's possible we wouldn't get that information back in time to send cookies before sending a navigate message, + // which could cause odd race conditions. + std::string all_cookies = LLViewerMedia::getCookieStore()->getAllCookies(); + lldebugs << "setting cookies: " << all_cookies << llendl; + if(!all_cookies.empty()) + { + media_source->set_cookies(all_cookies); + } + mMediaSource = media_source; updateVolume(); @@ -2152,6 +2402,16 @@ void LLViewerMediaImpl::update() } } } + else + { + // If we didn't just create the impl, it may need to get cookie updates. + if(!sUpdatedCookies.empty()) + { + // TODO: Only send cookies to plugins that need them + mMediaSource->set_cookies(sUpdatedCookies); + } + } + if(mMediaSource == NULL) { @@ -2614,6 +2874,13 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla //////////////////////////////////////////////////////////////////////////////// // virtual +void LLViewerMediaImpl::handleCookieSet(LLPluginClassMedia* self, const std::string &cookie) +{ + LLViewerMedia::getCookieStore()->setCookies(cookie); +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual void LLViewerMediaImpl::cut() { @@ -3025,7 +3292,7 @@ bool LLViewerMediaImpl::isObjectAttachedToAnotherAvatar(LLVOVolume *obj) if (NULL != object) { LLVOAvatar *avatar = object->asAvatar(); - if (NULL != avatar && avatar != gAgent.getAvatarObject()) + if ((NULL != avatar) && (avatar != gAgentAvatarp)) { result = true; break; diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index f9870fb3b9..e829d7a5b4 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -44,12 +44,15 @@ #include "llpluginclassmedia.h" #include "v4color.h" +#include "llurl.h" + class LLViewerMediaImpl; class LLUUID; class LLViewerMediaTexture; class LLMediaEntry; class LLVOVolume; class LLMimeDiscoveryResponder; +class LLPluginCookieStore; typedef LLPointer<LLViewerMediaImpl> viewer_media_t; /////////////////////////////////////////////////////////////////////////////// @@ -145,8 +148,23 @@ public: // Set the proxy config for all loaded plugins static void setProxyConfig(bool enable, const std::string &host, int port); + static LLPluginCookieStore *getCookieStore(); + static void loadCookieFile(); + static void saveCookieFile(); + static void addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path = std::string("/"), bool secure = false ); + static void addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path = std::string("/"), bool secure = false ); + static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") ); + + static void openIDSetup(const std::string &openid_url, const std::string &openid_token); + static void openIDCookieResponse(const std::string &cookie); + private: + static void setOpenIDCookie(); static void onTeleportFinished(); + + static LLPluginCookieStore *sCookieStore; + static LLURL sOpenIDURL; + static std::string sOpenIDCookie; }; // Implementation functions not exported into header file @@ -294,6 +312,7 @@ public: // Inherited from LLPluginClassMediaOwner /*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent); + /*virtual*/ void handleCookieSet(LLPluginClassMedia* self, const std::string &cookie); // LLEditMenuHandler overrides /*virtual*/ void cut(); diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index b8179f7fc2..c1e851350b 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -38,6 +38,7 @@ #include "llpanelprimmediacontrols.h" #include "llpluginclassmedia.h" #include "llagent.h" +#include "llagentcamera.h" #include "lltoolpie.h" #include "llviewercamera.h" #include "llviewermedia.h" @@ -201,7 +202,7 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, { if (object) { - gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); LLBBox bbox = object->getBoundingBoxAgent(); LLVector3d center = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent()); @@ -260,7 +261,7 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, // orientation with respect to the face. In other words, if before zoom // the media appears "upside down" from the camera, after zooming it will // still be upside down, but at least it will not flip. - LLVector3d cur_camera_pos = LLVector3d(gAgent.getCameraPositionGlobal()); + LLVector3d cur_camera_pos = LLVector3d(gAgentCamera.getCameraPositionGlobal()); LLVector3d delta = (cur_camera_pos - camera_pos); F64 len = delta.length(); delta.normalize(); @@ -271,18 +272,18 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, // If we are not allowing zooming out and the old camera position is closer to // the center then the new intended camera position, don't move camera and return if (zoom_in_only && - (dist_vec_squared(gAgent.getCameraPositionGlobal(), target_pos) < dist_vec_squared(camera_pos, target_pos))) + (dist_vec_squared(gAgentCamera.getCameraPositionGlobal(), target_pos) < dist_vec_squared(camera_pos, target_pos))) { return; } - gAgent.setCameraPosAndFocusGlobal(camera_pos, target_pos, object->getID() ); + gAgentCamera.setCameraPosAndFocusGlobal(camera_pos, target_pos, object->getID() ); } else { // If we have no object, focus back on the avatar. - gAgent.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); } } void LLViewerMediaFocus::onFocusReceived() diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 502bd718d3..a8b1257cf6 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -42,6 +42,7 @@ // newview includes #include "llagent.h" +#include "llagentcamera.h" #include "llagentwearables.h" #include "llagentpilot.h" #include "llbottomtray.h" @@ -72,6 +73,7 @@ #include "llhudmanager.h" #include "llimview.h" #include "llinventorybridge.h" +#include "llinventoryfunctions.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" #include "llmenucommands.h" @@ -134,6 +136,7 @@ extern BOOL gDebugWindowProc; LLMenuBarGL *gMenuBarView = NULL; LLViewerMenuHolderGL *gMenuHolder = NULL; LLMenuGL *gPopupMenuView = NULL; +LLMenuGL *gEditMenu = NULL; LLMenuBarGL *gLoginMenuBarView = NULL; // Pie menus @@ -381,8 +384,10 @@ void init_menus() /// /// Context menus /// + const widget_registry_t& registry = LLViewerMenuHolderGL::child_registry_t::instance(); + gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry); gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>( "menu_avatar_self.xml", gMenuHolder, registry); gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>( @@ -1800,9 +1805,10 @@ class LLAdvancedDebugAvatarTextures : public view_listener_t { bool handleEvent(const LLSD& userdata) { -#ifndef LL_RELEASE_FOR_DOWNLOAD - handle_debug_avatar_textures(NULL); -#endif + if (gAgent.isGodlike()) + { + handle_debug_avatar_textures(NULL); + } return true; } }; @@ -2482,18 +2488,18 @@ class LLObjectBuild : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) + if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); - gAgent.cameraZoomIn(0.666f); - gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); + gAgentCamera.cameraZoomIn(0.666f); + gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); gViewerWindow->moveCursorToCenter(); } else if ( gSavedSettings.getBOOL("EditCameraMovement") ) { - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); + gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); gViewerWindow->moveCursorToCenter(); } @@ -2511,7 +2517,7 @@ void handle_object_edit() { LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) + if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); @@ -2519,19 +2525,19 @@ void handle_object_edit() { // always freeze camera in space, even if camera doesn't move // so, for example, follow cam scripts can't affect you when in build mode - gAgent.setFocusGlobal(gAgent.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); } else { - gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); LLViewerObject* selected_objectp = selection->getFirstRootObject(); if (selected_objectp) { // zoom in on object center instead of where we clicked, as we need to see the manipulator handles - gAgent.setFocusGlobal(selected_objectp->getPositionGlobal(), selected_objectp->getID()); - gAgent.cameraZoomIn(0.666f); - gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); + gAgentCamera.setFocusGlobal(selected_objectp->getPositionGlobal(), selected_objectp->getID()); + gAgentCamera.cameraZoomIn(0.666f); + gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); gViewerWindow->moveCursorToCenter(); } } @@ -2576,19 +2582,19 @@ class LLLandBuild : public view_listener_t { LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) + if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); - gAgent.cameraZoomIn(0.666f); - gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); + gAgentCamera.cameraZoomIn(0.666f); + gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); gViewerWindow->moveCursorToCenter(); } else if ( gSavedSettings.getBOOL("EditCameraMovement") ) { // otherwise just move focus - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); + gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); gViewerWindow->moveCursorToCenter(); } @@ -2691,11 +2697,10 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t bool handleEvent(const LLSD& userdata) { bool new_value = false; - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + 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; @@ -2823,14 +2828,14 @@ bool handle_go_to() LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) + if (isAgentAvatarValid() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) { - gAgent.setFocusGlobal(gAgent.getFocusTargetGlobal(), gAgent.getAvatarObject()->getID()); + gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID()); } else { // Snap camera back to behind avatar - gAgent.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); } // Could be first use @@ -3364,7 +3369,7 @@ class LLSelfStandUp : public view_listener_t bool enable_standup_self() { - bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting(); + bool new_value = isAgentAvatarValid() && gAgentAvatarp->isSitting(); return new_value; } @@ -3693,9 +3698,9 @@ class LLLandSit : public view_listener_t LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal; LLQuaternion target_rot; - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - target_rot = gAgent.getAvatarObject()->getRotation(); + target_rot = gAgentAvatarp->getRotation(); } else { @@ -3717,14 +3722,14 @@ void reset_view_final( BOOL proceed ); void handle_reset_view() { - if( (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode()) && gFloaterCustomize ) + if( (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode()) && gFloaterCustomize ) { // Show dialog box if needed. gFloaterCustomize->askToSaveIfDirty( reset_view_final ); } else { - gAgent.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); reset_view_final( TRUE ); LLFloaterCamera::resetCameraMode(); } @@ -3747,15 +3752,15 @@ void reset_view_final( BOOL proceed ) return; } - gAgent.resetView(TRUE, TRUE); - gAgent.setLookAt(LOOKAT_TARGET_CLEAR); + gAgentCamera.resetView(TRUE, TRUE); + gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); } class LLViewLookAtLastChatter : public view_listener_t { bool handleEvent(const LLSD& userdata) { - gAgent.lookAtLastChat(); + gAgentCamera.lookAtLastChat(); return true; } }; @@ -3764,13 +3769,13 @@ class LLViewMouselook : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if (!gAgent.cameraMouselook()) + if (!gAgentCamera.cameraMouselook()) { - gAgent.changeCameraToMouselook(); + gAgentCamera.changeCameraToMouselook(); } else { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } return true; } @@ -3989,9 +3994,9 @@ void handle_god_request_avatar_geometry(void *) void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) { - if(gAgent.cameraMouselook()) + if(gAgentCamera.cameraMouselook()) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } //gInventoryView->setPanelOpen(TRUE); @@ -4586,13 +4591,9 @@ BOOL sitting_on_selection() } // Need to determine if avatar is sitting on this object - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if (!avatar) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; - return (avatar->isSitting() && avatar->getRoot() == root_object); + return (gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == root_object); } class LLToolsSaveToInventory : public view_listener_t @@ -5034,7 +5035,7 @@ class LLViewEnableLastChatter : public view_listener_t bool handleEvent(const LLSD& userdata) { // *TODO: add check that last chatter is in range - bool new_value = (gAgent.cameraThirdPerson() && gAgent.getLastChatter().notNull()); + bool new_value = (gAgentCamera.cameraThirdPerson() && gAgent.getLastChatter().notNull()); return new_value; } }; @@ -5148,7 +5149,7 @@ void print_agent_nvpairs(void*) llinfos << "Can't find agent object" << llendl; } - llinfos << "Camera at " << gAgent.getCameraPositionGlobal() << llendl; + llinfos << "Camera at " << gAgentCamera.getCameraPositionGlobal() << llendl; } void show_debug_menus() @@ -5185,10 +5186,6 @@ void toggle_debug_menus(void*) { BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus"); gSavedSettings.setBOOL("UseDebugMenus", visible); - if(visible) - { - //LLFirstUse::useDebugMenus(); - } show_debug_menus(); } @@ -5339,7 +5336,7 @@ void handle_look_at_selection(const LLSD& param) BOOL zoom = (param.asString() == "zoom"); if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { - gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); @@ -5356,17 +5353,17 @@ void handle_look_at_selection(const LLSD& param) if (zoom) { // Make sure we are not increasing the distance between the camera and object - LLVector3d orig_distance = gAgent.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal(); + LLVector3d orig_distance = gAgentCamera.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal(); distance = llmin(distance, (F32) orig_distance.length()); - gAgent.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), + gAgentCamera.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id ); } else { - gAgent.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id ); + gAgentCamera.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id ); } } } @@ -5379,7 +5376,7 @@ void handle_zoom_to_object(LLUUID object_id) if (object) { - gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); LLBBox bbox = object->getBoundingBoxAgent() ; F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); @@ -5391,7 +5388,7 @@ void handle_zoom_to_object(LLUUID object_id) LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent()); - gAgent.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance), + gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance), object_center_global, object_id ); } @@ -5589,7 +5586,7 @@ void handle_customize_avatar() { if (gAgentWearables.areWearablesLoaded()) { - gAgent.changeCameraToCustomizeAvatar(); + gAgentCamera.changeCameraToCustomizeAvatar(); } } @@ -5775,18 +5772,18 @@ class LLLandEdit : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if (gAgent.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") ) + if (gAgentCamera.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); - gAgent.cameraOrbitOver( F_PI * 0.25f ); + gAgentCamera.cameraOrbitOver( F_PI * 0.25f ); gViewerWindow->moveCursorToCenter(); } else if ( gSavedSettings.getBOOL("EditCameraMovement") ) { - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); + gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); gViewerWindow->moveCursorToCenter(); } @@ -5845,7 +5842,7 @@ private: S32 index = userdata.asInteger(); LLViewerJointAttachment* attachment_point = NULL; if (index > 0) - attachment_point = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL); + attachment_point = get_if_there(gAgentAvatarp->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL); confirm_replace_attachment(0, attachment_point); } return true; @@ -5866,8 +5863,8 @@ void near_attach_object(BOOL success, void *user_data) U8 attachment_id = 0; if (attachment) { - for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin(); - iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter) + for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) { if (iter->second == attachment) { @@ -5912,7 +5909,7 @@ void confirm_replace_attachment(S32 option, void* user_data) walkToSpot -= delta; gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(walkToSpot), "Attach", NULL, near_attach_object, user_data, stop_distance); - gAgent.clearFocusObject(); + gAgentCamera.clearFocusObject(); } } } @@ -5992,7 +5989,7 @@ class LLAttachmentDetachFromPoint : public view_listener_t { bool handleEvent(const LLSD& user_data) { - const LLViewerJointAttachment *attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL); + const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL); if (attachment->getNumObjects() > 0) { gMessageSystem->newMessage("ObjectDetach"); @@ -6020,7 +6017,7 @@ static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data) LLMenuItemGL* menu = dynamic_cast<LLMenuItemGL*>(ctrl); if (menu) { - const LLViewerJointAttachment *attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL); + const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL); if (attachment) { label = data["label"].asString(); @@ -6138,7 +6135,7 @@ class LLAttachmentEnableDrop : public view_listener_t if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES )) { S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState()); - attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); + attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); if (attachment) { @@ -6270,8 +6267,8 @@ class LLAttachmentPointFilled : public view_listener_t bool handleEvent(const LLSD& user_data) { bool enable = false; - LLVOAvatar::attachment_map_t::iterator found_it = gAgent.getAvatarObject()->mAttachmentPoints.find(user_data.asInteger()); - if (found_it != gAgent.getAvatarObject()->mAttachmentPoints.end()) + LLVOAvatar::attachment_map_t::iterator found_it = gAgentAvatarp->mAttachmentPoints.find(user_data.asInteger()); + if (found_it != gAgentAvatarp->mAttachmentPoints.end()) { enable = found_it->second->getNumObjects() > 0; } @@ -6467,13 +6464,13 @@ void handle_selected_texture_info(void*) void handle_test_male(void*) { - LLAppearanceManager::instance().wearOutfitByName("Male Shape & Outfit"); + LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit"); //gGestureList.requestResetFromServer( TRUE ); } void handle_test_female(void*) { - LLAppearanceManager::instance().wearOutfitByName("Female Shape & Outfit"); + LLAppearanceMgr::instance().wearOutfitByName("Female Shape & Outfit"); //gGestureList.requestResetFromServer( FALSE ); } @@ -6488,15 +6485,10 @@ void handle_toggle_pg(void*) void handle_dump_attachments(void*) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( !avatar ) - { - llinfos << "NO AVATAR" << llendl; - return; - } + if(!isAgentAvatarValid()) return; - for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); - iter != avatar->mAttachmentPoints.end(); ) + 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; @@ -6758,7 +6750,7 @@ class LLViewEnableMouselook : public view_listener_t { // You can't go directly from customize avatar to mouselook. // TODO: write code with appropriate dialogs to handle this transition. - bool new_value = (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() && !gSavedSettings.getBOOL("FreezeTime")); + bool new_value = (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() && !gSavedSettings.getBOOL("FreezeTime")); return new_value; } }; @@ -6916,7 +6908,7 @@ void reload_vertex_shader(void *) void handle_dump_avatar_local_textures(void*) { - gAgent.getAvatarObject()->dumpLocalTextures(); + gAgentAvatarp->dumpLocalTextures(); } void handle_dump_timers() @@ -6936,86 +6928,83 @@ void handle_debug_avatar_textures(void*) void handle_grab_texture(void* data) { ETextureIndex tex_index = (ETextureIndex)((intptr_t)data); - const LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if ( avatar ) - { - // MULTI-WEARABLE: change to support an index - const LLUUID& asset_id = avatar->grabLocalTexture(tex_index, 0); - LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl; - LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE; - LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE; - const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type)); - if(folder_id.notNull()) - { - std::string name = "Unknown"; - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index); - if (texture_dict->mIsBakedTexture) - { - EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized; - } - name += " Texture"; - - LLUUID item_id; - item_id.generate(); - LLPermissions perm; - perm.init(gAgentID, - gAgentID, - LLUUID::null, - LLUUID::null); - U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER; - perm.initMasks(PERM_ALL, - PERM_ALL, - PERM_NONE, - PERM_NONE, - next_owner_perm); - time_t creation_date_now = time_corrected(); - LLPointer<LLViewerInventoryItem> item - = new LLViewerInventoryItem(item_id, - folder_id, - perm, - asset_id, - asset_type, - inv_type, - name, - LLStringUtil::null, - LLSaleInfo::DEFAULT, - LLInventoryItem::II_FLAGS_NONE, - creation_date_now); - - item->updateServer(TRUE); - gInventory.updateItem(item); - gInventory.notifyObservers(); - - // Show the preview panel for textures to let - // user know that the image is now in inventory. - LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); - if(active_panel) - { - LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); - - active_panel->setSelection(item_id, TAKE_FOCUS_NO); - active_panel->openSelected(); - //LLFloaterInventory::dumpSelectionInformation((void*)view); - // restore keyboard focus - gFocusMgr.setKeyboardFocus(focus_ctrl); - } - } - else - { - llwarns << "Can't find a folder to put it in" << llendl; + if (!isAgentAvatarValid()) return; + + // MULTI-WEARABLE: change to support an index + const LLUUID& asset_id = gAgentAvatarp->grabLocalTexture(tex_index, 0); + LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl; + LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE; + LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE; + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type)); + if(folder_id.notNull()) + { + std::string name = "Unknown"; + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index); + if (texture_dict->mIsBakedTexture) + { + EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized; + } + name += " Texture"; + + LLUUID item_id; + item_id.generate(); + LLPermissions perm; + perm.init(gAgentID, + gAgentID, + LLUUID::null, + LLUUID::null); + U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER; + perm.initMasks(PERM_ALL, + PERM_ALL, + PERM_NONE, + PERM_NONE, + next_owner_perm); + time_t creation_date_now = time_corrected(); + LLPointer<LLViewerInventoryItem> item + = new LLViewerInventoryItem(item_id, + folder_id, + perm, + asset_id, + asset_type, + inv_type, + name, + LLStringUtil::null, + LLSaleInfo::DEFAULT, + LLInventoryItem::II_FLAGS_NONE, + creation_date_now); + + item->updateServer(TRUE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + + // Show the preview panel for textures to let + // user know that the image is now in inventory. + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if(active_panel) + { + LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); + + active_panel->setSelection(item_id, TAKE_FOCUS_NO); + active_panel->openSelected(); + //LLFloaterInventory::dumpSelectionInformation((void*)view); + // restore keyboard focus + gFocusMgr.setKeyboardFocus(focus_ctrl); } } + else + { + llwarns << "Can't find a folder to put it in" << llendl; + } } BOOL enable_grab_texture(void* data) { ETextureIndex index = (ETextureIndex)((intptr_t)data); - const LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if ( avatar ) + if (isAgentAvatarValid()) { // MULTI-WEARABLE: - return avatar->canGrabLocalTexture(index,0); + return gAgentAvatarp->canGrabLocalTexture(index,0); } return FALSE; } @@ -7226,12 +7215,11 @@ void handle_buy_currency_test(void*) void handle_rebake_textures(void*) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if (!avatar) return; + if (!isAgentAvatarValid()) return; // Slam pending upload count to "unstick" things bool slam_for_debug = true; - avatar->forceBakeAllTextures(slam_for_debug); + gAgentAvatarp->forceBakeAllTextures(slam_for_debug); } void toggle_visibility(void* user_data) diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index d3c34f0de4..d72ea00077 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -157,6 +157,7 @@ extern const std::string SAVE_INTO_INVENTORY; extern LLMenuBarGL* gMenuBarView; //extern LLView* gMenuBarHolder; +extern LLMenuGL* gEditMenu; extern LLMenuGL* gPopupMenuView; extern LLViewerMenuHolderGL* gMenuHolder; extern LLMenuBarGL* gLoginMenuBarView; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index dfde9a9d1d..c575656b24 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -36,6 +36,7 @@ // project includes #include "llagent.h" +#include "llagentcamera.h" #include "llfilepicker.h" #include "llfloaterreg.h" #include "llfloaterbuycurrency.h" @@ -140,9 +141,9 @@ std::string build_extensions_string(LLFilePicker::ELoadFilter filter) **/ const std::string upload_pick(void* data) { - if( gAgent.cameraMouselook() ) + if( gAgentCamera.cameraMouselook() ) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); // This doesn't seem necessary. JC // display(); } @@ -289,9 +290,9 @@ class LLFileUploadBulk : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if( gAgent.cameraMouselook() ) + if( gAgentCamera.cameraMouselook() ) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } // TODO: @@ -317,13 +318,11 @@ class LLFileUploadBulk : public view_listener_t LLStringUtil::trim(asset_name); std::string display_name = LLStringUtil::null; - LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - void *userdata = NULL; - upload_new_resource(filename, asset_name, asset_name, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + upload_new_resource(filename, asset_name, asset_name, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), display_name, - callback, expected_upload_cost, userdata); + NULL, expected_upload_cost); // *NOTE: Ew, we don't iterate over the file list here, // we handle the next files in upload_done_callback() @@ -480,16 +479,15 @@ void handle_compress_image(void*) } void upload_new_resource(const std::string& src_filename, std::string name, - std::string desc, S32 compression_info, + std::string desc, LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, U32 everyone_perms, const std::string& display_name, - LLAssetStorage::LLStoreAssetCallback callback, - S32 expected_upload_cost, - void *userdata) + boost::function<void(const LLUUID& uuid)> callback, + S32 expected_upload_cost) { // Generate the temporary UUID. std::string filename = gDirUtilp->getTempFilename(); @@ -771,9 +769,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, { t_disp_name = src_filename; } - upload_new_resource(tid, asset_type, name, desc, compression_info, // tid + upload_new_resource(tid, asset_type, name, desc, destination_folder_type, inv_type, next_owner_perms, group_perms, everyone_perms, - display_name, callback, expected_upload_cost, userdata); + display_name, callback, expected_upload_cost); } else { @@ -892,30 +890,28 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt LLStringUtil::trim(asset_name); std::string display_name = LLStringUtil::null; - LLAssetStorage::LLStoreAssetCallback callback = NULL; - void *userdata = NULL; upload_new_resource(next_file, asset_name, asset_name, // file - 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLFolderType::FT_NONE, LLInventoryType::IT_NONE, PERM_NONE, PERM_NONE, PERM_NONE, display_name, - callback, - expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost - userdata); + NULL, + expected_upload_cost); // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost + } } -void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type, +void upload_new_resource(const LLTransactionID &tid, + LLAssetType::EType asset_type, std::string name, - std::string desc, S32 compression_info, + std::string desc, LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, U32 everyone_perms, const std::string& display_name, - LLAssetStorage::LLStoreAssetCallback callback, - S32 expected_upload_cost, - void *userdata) + boost::function<void(const LLUUID& uuid)> callback, + S32 expected_upload_cost) { if(gDisconnected) { @@ -959,78 +955,26 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty upload_message.append(display_name); LLUploadDialog::modalUploadDialog(upload_message); - llinfos << "*** Uploading: " << llendl; - llinfos << "Type: " << LLAssetType::lookup(asset_type) << llendl; - llinfos << "UUID: " << uuid << llendl; - llinfos << "Name: " << name << llendl; - llinfos << "Desc: " << desc << llendl; - llinfos << "Expected Upload Cost: " << expected_upload_cost << llendl; - lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << llendl; - lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl; std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory"); - if (!url.empty()) - { - llinfos << "New Agent Inventory via capability" << llendl; - LLSD body; - body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type); - body["asset_type"] = LLAssetType::lookup(asset_type); - body["inventory_type"] = LLInventoryType::lookup(inv_type); - body["name"] = name; - body["description"] = desc; - body["next_owner_mask"] = LLSD::Integer(next_owner_perms); - body["group_mask"] = LLSD::Integer(group_perms); - body["everyone_mask"] = LLSD::Integer(everyone_perms); - body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost); - - //std::ostringstream llsdxml; - //LLSDSerialize::toPrettyXML(body, llsdxml); - //llinfos << "posting body to capability: " << llsdxml.str() << llendl; - - LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type)); + + if (url.empty()) { + llwarns << "Could not get NewFileAgentInventory capability" << llendl; + return; } - else - { - llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl; - // check for adequate funds - // TODO: do this check on the sim - if (LLAssetType::AT_SOUND == asset_type || - LLAssetType::AT_TEXTURE == asset_type || - LLAssetType::AT_ANIMATION == asset_type) - { - S32 balance = gStatusBar->getBalance(); - if (balance < expected_upload_cost) - { - // insufficient funds, bail on this upload - LLStringUtil::format_map_t args; - args["AMOUNT"] = llformat("%d", expected_upload_cost); - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs", args), expected_upload_cost); - return; - } - } - LLResourceData* data = new LLResourceData; - data->mAssetInfo.mTransactionID = tid; - data->mAssetInfo.mUuid = uuid; - data->mAssetInfo.mType = asset_type; - data->mAssetInfo.mCreatorID = gAgentID; - data->mInventoryType = inv_type; - data->mNextOwnerPerm = next_owner_perms; - data->mExpectedUploadCost = expected_upload_cost; - data->mUserData = userdata; - data->mAssetInfo.setName(name); - data->mAssetInfo.setDescription(desc); - data->mPreferredLocation = destination_folder_type; - - LLAssetStorage::LLStoreAssetCallback asset_callback = &upload_done_callback; - if (callback) - { - asset_callback = callback; - } - gAssetStorage->storeAssetData(data->mAssetInfo.mTransactionID, data->mAssetInfo.mType, - asset_callback, - (void*)data, - FALSE); - } + llinfos << "New Agent Inventory via capability" << llendl; + LLSD body; + body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type); + body["asset_type"] = LLAssetType::lookup(asset_type); + body["inventory_type"] = LLInventoryType::lookup(inv_type); + body["name"] = name; + body["description"] = desc; + body["next_owner_mask"] = LLSD::Integer(next_owner_perms); + body["group_mask"] = LLSD::Integer(group_perms); + body["everyone_mask"] = LLSD::Integer(everyone_perms); + body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost); + + LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type, callback)); } void init_menu_file() diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 1e6d13f1c6..33f8243ac0 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -34,41 +34,35 @@ #define LLVIEWERMENUFILE_H #include "llfoldertype.h" -#include "llassetstorage.h" #include "llinventorytype.h" class LLTransactionID; - void init_menu_file(); void upload_new_resource(const std::string& src_filename, std::string name, std::string desc, - S32 compression_info, LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, U32 everyone_perms, const std::string& display_name, - LLAssetStorage::LLStoreAssetCallback callback, - S32 expected_upload_cost, - void *userdata); + boost::function<void(const LLUUID& uuid)> callback, + S32 expected_upload_cost); void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType type, std::string name, std::string desc, - S32 compression_info, LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, U32 everyone_perms, const std::string& display_name, - LLAssetStorage::LLStoreAssetCallback callback, - S32 expected_upload_cost, - void *userdata); + boost::function<void(const LLUUID& uuid)> callback, + S32 expected_upload_cost); #endif diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3c66deb8e5..7346b2a76e 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -51,6 +51,7 @@ #include "mean_collision_data.h" #include "llagent.h" +#include "llagentcamera.h" #include "llcallingcard.h" //#include "llfirstuse.h" #include "llfloaterbuycurrency.h" @@ -62,6 +63,7 @@ #include "llfloaterpreference.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" +#include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" #include "llnearbychat.h" @@ -869,9 +871,9 @@ bool check_offer_throttle(const std::string& from_name, bool check_only) } } -void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name) +void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name) { - for (std::vector<LLUUID>::const_iterator item_iter = items.begin(); + for (uuid_vec_t::const_iterator item_iter = items.begin(); item_iter != items.end(); ++item_iter) { @@ -1262,8 +1264,8 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // Disabled logging to old chat floater to fix crash in group notices - EXT-4149 // LLFloaterChat::addChatHistory(chat); - LLInventoryFetchComboObserver::folder_ref_t folders; - LLInventoryFetchComboObserver::item_ref_t items; + uuid_vec_t folders; + uuid_vec_t items; items.push_back(mObjectID); LLDiscardAgentOffer* discard_agent_offer; discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); @@ -1683,6 +1685,18 @@ bool inspect_remote_object_callback(const LLSD& notification, const LLSD& respon } static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback); +class LLPostponedServerObjectNotification: public LLPostponedNotification +{ +protected: + /* virtual */ + void modifyNotificationParams() + { + LLSD payload = mParams.payload; + payload["SESSION_NAME"] = mName; + mParams.payload = payload; + } +}; + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -1752,17 +1766,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) std::string separator_string(": "); LLSD args; + LLSD payload; switch(dialog) { case IM_CONSOLE_AND_CHAT_HISTORY: - // These are used for system messages, hence don't need the name, - // as it is always "Second Life". // *TODO: Translate args["MESSAGE"] = message; - - // Note: don't put the message in the IM history, even though was sent - // via the IM mechanism. - LLNotificationsUtil::add("SystemMessageTip",args); + payload["SESSION_NAME"] = name; + payload["from_id"] = from_id; + LLNotificationsUtil::add("IMSystemMessageTip",args, payload); break; case IM_NOTHING_SPECIAL: @@ -1985,7 +1997,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // For requested notices, we don't want to send the popups. if (dialog != IM_GROUP_NOTICE_REQUESTED) { - LLSD payload; payload["subject"] = subj; payload["message"] = mes; payload["sender_name"] = name; @@ -2221,7 +2232,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if(SYSTEM_FROM == name) { // System's UUID is NULL (fixes EXT-4766) - chat.mFromID = from_id = LLUUID::null; + chat.mFromID = LLUUID::null; } LLSD query_string; @@ -2264,13 +2275,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["slurl"] = location; payload["name"] = name; std::string session_name; - gCacheName->getFullName(from_id, session_name); - payload["SESSION_NAME"] = session_name; if (from_group) { payload["group_owned"] = "true"; } - LLNotificationsUtil::add("ServerObjectMessage", substitutions, payload); + + LLNotification::Params params("ServerObjectMessage"); + params.substitutions = substitutions; + params.payload = payload; + + LLPostponedNotification::add<LLPostponedServerObjectNotification>(params, from_id, false); } break; case IM_FROM_TASK_AS_ALERT: @@ -2313,7 +2327,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { LLSD args; // *TODO: Translate -> [FIRST] [LAST] (maybe) - args["NAME"] = name; + args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); args["MESSAGE"] = message; LLSD payload; payload["from_id"] = from_id; @@ -2379,7 +2393,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { - args["[NAME]"] = name; + args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); if(message.empty()) { //support for frienship offers from clients before July 2008 @@ -2840,8 +2854,8 @@ public: LLInventoryModel::cat_array_t land_cats; LLInventoryModel::item_array_t land_items; - folder_ref_t::iterator it = mCompleteFolders.begin(); - folder_ref_t::iterator end = mCompleteFolders.end(); + uuid_vec_t::iterator it = mCompleteFolders.begin(); + uuid_vec_t::iterator end = mCompleteFolders.end(); for(; it != end; ++it) { gInventory.collectDescendentsIf( @@ -2902,7 +2916,7 @@ BOOL LLPostTeleportNotifiers::tick() if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE ) { // get callingcards and landmarks available to the user arriving. - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + uuid_vec_t folders; const LLUUID callingcard_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); if(callingcard_id.notNull()) folders.push_back(callingcard_id); @@ -2942,6 +2956,9 @@ void process_teleport_finish(LLMessageSystem* msg, void**) LL_WARNS("Messaging") << "Got teleport notification for wrong agent!" << LL_ENDL; return; } + + // Teleport is finished; it can't be cancelled now. + gViewerWindow->setProgressCancelButtonVisible(FALSE); // Do teleport effect for where you're leaving // VEFFECT: TeleportStart @@ -2987,18 +3004,18 @@ void process_teleport_finish(LLMessageSystem* msg, void**) /* // send camera update to new region - gAgent.updateCamera(); + gAgentCamera.updateCamera(); // likewise make sure the camera is behind the avatar - gAgent.resetView(TRUE); + gAgentCamera.resetView(TRUE); LLVector3 shift_vector = regionp->getPosRegionFromGlobal(gAgent.getRegion()->getOriginGlobal()); gAgent.setRegion(regionp); gObjectList.shiftObjects(shift_vector); - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - gAgent.getAvatarObject()->clearChatText(); - gAgent.slamLookAt(look_at); + gAgentAvatarp->clearChatText(); + gAgentCamera.slamLookAt(look_at); } gAgent.setPositionAgent(pos); gAssetStorage->setUpstream(sim); @@ -3077,8 +3094,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) std::string version_channel; msg->getString("SimData", "ChannelVersion", version_channel); - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (!avatarp) + if (!isAgentAvatarValid()) { // Could happen if you were immediately god-teleported away on login, // maybe other cases. Continue, but warn. @@ -3122,9 +3138,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) if( is_teleport ) { // Force the camera back onto the agent, don't animate. - gAgent.setFocusOnAvatar(TRUE, FALSE); - gAgent.slamLookAt(look_at); - gAgent.updateCamera(); + gAgentCamera.setFocusOnAvatar(TRUE, FALSE); + gAgentCamera.slamLookAt(look_at); + gAgentCamera.updateCamera(); gAgent.setTeleportState( LLAgent::TELEPORT_START_ARRIVAL ); @@ -3132,7 +3148,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) // know what you look like. gAgent.sendAgentSetAppearance(); - if (avatarp) + if (isAgentAvatarValid()) { // Chat the "back" SLURL. (DEV-4907) @@ -3147,9 +3163,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) LLNotificationsUtil::add("SystemMessageTip", args); // Set the new position - avatarp->setPositionAgent(agent_pos); - avatarp->clearChat(); - avatarp->slamPosition(); + gAgentAvatarp->setPositionAgent(agent_pos); + gAgentAvatarp->clearChat(); + gAgentAvatarp->slamPosition(); } } else @@ -3175,7 +3191,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) global_agent_pos[1] += y; look_at = (LLVector3)beacon_pos - global_agent_pos; look_at.normVec(); - gAgent.slamLookAt(look_at); + gAgentCamera.slamLookAt(look_at); } } @@ -3209,9 +3225,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) gAgent.clearBusy(); } - if (avatarp) + if (isAgentAvatarValid()) { - avatarp->mFootPlane.clearVec(); + gAgentAvatarp->mFootPlane.clearVec(); } // send walk-vs-run status @@ -3352,7 +3368,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion(); LLQuaternion head_rotation = gAgent.getHeadRotation(); - camera_pos_agent = gAgent.getCameraPositionAgent(); + camera_pos_agent = gAgentCamera.getCameraPositionAgent(); render_state = gAgent.getRenderState(); @@ -3475,7 +3491,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis()); msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis()); msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis()); - msg->addF32Fast(_PREHASH_Far, gAgent.mDrawDistance); + msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance); msg->addU32Fast(_PREHASH_ControlFlags, control_flags); @@ -4112,7 +4128,7 @@ void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data) mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); LLVOAvatar* avatarp = (LLVOAvatar *)gObjectList.findObject(uuid); - if( avatarp ) + if (avatarp) { avatarp->processAvatarAppearance( mesgsys ); } @@ -4127,7 +4143,7 @@ void process_camera_constraint(LLMessageSystem *mesgsys, void **user_data) LLVector4 cameraCollidePlane; mesgsys->getVector4Fast(_PREHASH_CameraCollidePlane, _PREHASH_Plane, cameraCollidePlane); - gAgent.setCameraCollidePlane(cameraCollidePlane); + gAgentCamera.setCameraCollidePlane(cameraCollidePlane); } void near_sit_object(BOOL success, void *data) @@ -4160,20 +4176,18 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) BOOL force_mouselook; mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook); - LLVOAvatar* avatar = gAgent.getAvatarObject(); - - if (avatar && dist_vec_squared(camera_eye, camera_at) > 0.0001f) + if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > 0.0001f) { - gAgent.setSitCamera(sitObjectID, camera_eye, camera_at); + gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at); } - gAgent.setForceMouselook(force_mouselook); + gAgentCamera.setForceMouselook(force_mouselook); LLViewerObject* object = gObjectList.findObject(sitObjectID); if (object) { LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation()); - if (!use_autopilot || (avatar && avatar->isSitting() && avatar->getRoot() == object->getRoot())) + if (!use_autopilot || isAgentAvatarValid() && gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == object->getRoot()) { //we're already sitting on this object, so don't autopilot } @@ -5218,9 +5232,9 @@ void container_inventory_arrived(LLViewerObject* object, void* data) { LL_DEBUGS("Messaging") << "container_inventory_arrived()" << LL_ENDL; - if( gAgent.cameraMouselook() ) + if( gAgentCamera.cameraMouselook() ) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); @@ -5445,13 +5459,13 @@ void process_teleport_local(LLMessageSystem *msg,void**) } gAgent.setPositionAgent(pos); - gAgent.slamLookAt(look_at); + gAgentCamera.slamLookAt(look_at); // likewise make sure the camera is behind the avatar - gAgent.resetView(TRUE, TRUE); + gAgentCamera.resetView(TRUE, TRUE); // send camera update to new region - gAgent.updateCamera(); + gAgentCamera.updateCamera(); send_agent_update(TRUE, TRUE); @@ -5587,8 +5601,12 @@ void handle_lure(const LLUUID& invitee) } // Prompt for a message to the invited user. -void handle_lure(const std::vector<LLUUID>& ids) +void handle_lure(const uuid_vec_t& ids) { + if (ids.empty()) return; + + if (!gAgent.getRegion()) return; + LLSD edit_args; edit_args["REGION"] = gAgent.getRegion()->getName(); diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 88f9697037..0ba4ac0c8d 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -157,7 +157,7 @@ void send_group_notice(const LLUUID& group_id, const LLInventoryItem* item); void handle_lure(const LLUUID& invitee); -void handle_lure(const std::vector<LLUUID>& ids); +void handle_lure(const uuid_vec_t& ids); // always from gAgent and // routes through the gAgent's current simulator @@ -201,7 +201,7 @@ void invalid_message_callback(LLMessageSystem*, void*, EMessageException); void process_initiate_download(LLMessageSystem* msg, void**); void start_new_inventory_observer(); -void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name); +void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name); // Returns true if item is not in certain "quiet" folder which don't need UI // notification (e.g. trash, cof, lost-and-found) and agent is not AFK, false otherwise. diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index bb2aed09ad..e6d14079c9 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -60,6 +60,7 @@ #include "llaudiosourcevo.h" #include "llagent.h" +#include "llagentcamera.h" #include "llbbox.h" #include "llbox.h" #include "llcylinder.h" @@ -133,7 +134,15 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco { if (id == gAgentID) { - res = new LLVOAvatarSelf(id, pcode, regionp); + if (!gAgentAvatarp) + { + gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp); + } + else + { + gAgentAvatarp->updateRegion(regionp); + } + res = gAgentAvatarp; } else { @@ -222,7 +231,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mClickAction(0), mAttachmentItemID(LLUUID::null) { - if(!is_global) + if (!is_global) { llassert(mRegionp); } @@ -234,7 +243,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mPositionRegion = LLVector3(0.f, 0.f, 0.f); - if(!is_global) + if (!is_global && mRegionp) { mPositionAgent = mRegionp->getOriginAgent(); } @@ -376,11 +385,10 @@ void LLViewerObject::markDead() if (flagAnimSource()) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp && !avatarp->isDead()) + if (isAgentAvatarValid()) { // stop motions associated with this object - avatarp->stopMotionFromSource(mID); + gAgentAvatarp->stopMotionFromSource(mID); } } @@ -2757,7 +2765,7 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) return; } - LLVector3 viewer_pos_agent = agent.getCameraPositionAgent(); + LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent(); LLVector3 pos_agent = getRenderPosition(); F32 dx = viewer_pos_agent.mV[VX] - pos_agent.mV[VX]; @@ -4919,7 +4927,6 @@ void LLViewerObject::setIncludeInSearch(bool include_in_search) void LLViewerObject::setRegion(LLViewerRegion *regionp) { - llassert(regionp); mLatestRecvPacketID = 0; mRegionp = regionp; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 6347090f71..752aeaaab0 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -47,6 +47,7 @@ #include "llviewerwindow.h" #include "llnetmap.h" #include "llagent.h" +#include "llagentcamera.h" #include "pipeline.h" #include "llspatialpartition.h" #include "lltooltip.h" @@ -288,7 +289,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, LLMemType mt(LLMemType::MTYPE_OBJECT_PROCESS_UPDATE); LLFastTimer t(FTM_PROCESS_OBJECTS); - LLVector3d camera_global = gAgent.getCameraPositionGlobal(); + LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal(); LLViewerObject *objectp; S32 num_objects; U32 local_id; @@ -473,7 +474,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, if (objectp->getRegion() != regionp) { // Object changed region, so update it - objectp->setRegion(regionp); objectp->updateRegion(regionp); // for LLVOAvatar } } @@ -614,7 +614,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) } // Focused - objectp = gAgent.getFocusObject(); + objectp = gAgentCamera.getFocusObject(); if (objectp) { objectp->boostTexturePriority(); @@ -894,6 +894,13 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) { + // Don't ever kill gAgentAvatarp, just mark it as null region instead. + if (objectp == gAgentAvatarp) + { + objectp->setRegion(NULL); + return FALSE; + } + // When we're killing objects, all we do is mark them as dead. // We clean up the dead objects later. @@ -942,7 +949,8 @@ void LLViewerObjectList::killAllObjects() { objectp = *iter; killObject(objectp); - llassert(objectp->isDead()); + // Object must be dead, or it's the LLVOAvatarSelf which never dies. + llassert((objectp == gAgentAvatarp) || objectp->isDead()); } cleanDeadObjects(FALSE); @@ -1209,11 +1217,10 @@ void LLViewerObjectList::generatePickList(LLCamera &camera) } // add all hud objects to pick list - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) + if (isAgentAvatarValid()) { - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + 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; @@ -1281,7 +1288,7 @@ void LLViewerObjectList::renderPickList(const LLRect& screen_rect, BOOL pick_par gViewerWindow->renderSelections( TRUE, pick_parcel_wall, FALSE ); //fix for DEV-19335. Don't pick hud objects when customizing avatar (camera mode doesn't play nice with nametags). - if (!gAgent.cameraCustomizeAvatar()) + if (!gAgentCamera.cameraCustomizeAvatar()) { // render pickable ui elements, like names, etc. LLHUDObject::renderAllForSelect(); diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 9de1ef7190..2d17ea7bcd 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -43,11 +43,11 @@ #include "v2math.h" // newview includes +#include "llagentcamera.h" #include "llviewertexture.h" #include "llviewercontrol.h" #include "llsurface.h" #include "llviewerregion.h" -#include "llagent.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llselectmgr.h" @@ -760,7 +760,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () LLGLDepthTest mDepthTest(GL_TRUE); // Find camera height off the ground (not from zero) - F32 ground_height_at_camera = land.resolveHeightGlobal( gAgent.getCameraPositionGlobal() ); + F32 ground_height_at_camera = land.resolveHeightGlobal( gAgentCamera.getCameraPositionGlobal() ); F32 camera_z = LLViewerCamera::getInstance()->getOrigin().mV[VZ]; F32 camera_height = camera_z - ground_height_at_camera; @@ -791,7 +791,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () const S32 vertex_per_edge = 3 + 2 * (GRID_STEP-1) + 3; // Stomp the camera into two dimensions - LLVector3 camera_region = mRegion->getPosRegionFromGlobal( gAgent.getCameraPositionGlobal() ); + LLVector3 camera_region = mRegion->getPosRegionFromGlobal( gAgentCamera.getCameraPositionGlobal() ); // Set up a cull plane 2 * PARCEL_GRID_STEP_METERS behind // the camera. The cull plane normal is the camera's at axis. diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ce627494c8..07d4ac664f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -47,6 +47,7 @@ #include "v4math.h" #include "llagent.h" +#include "llagentcamera.h" #include "llcallingcard.h" #include "llcaphttpsender.h" #include "llcommandhandler.h" @@ -819,7 +820,7 @@ void LLViewerRegion::calculateCenterGlobal() void LLViewerRegion::calculateCameraDistance() { - mCameraDistanceSquared = (F32)(gAgent.getCameraPositionGlobal() - getCenterGlobal()).magVecSquared(); + mCameraDistanceSquared = (F32)(gAgentCamera.getCameraPositionGlobal() - getCenterGlobal()).magVecSquared(); } std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion) diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 80dbb4b375..bdc34d0f18 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -52,6 +52,7 @@ #include "llsurface.h" #include "llvlmanager.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "llfloatertools.h" #include "lldebugview.h" @@ -577,11 +578,11 @@ void update_statistics(U32 frame_count) // make sure we have a valid time delta for this frame if (gFrameIntervalSeconds > 0.f) { - if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { LLViewerStats::getInstance()->incStat(LLViewerStats::ST_MOUSELOOK_SECONDS, gFrameIntervalSeconds); } - else if (gAgent.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) + else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) { LLViewerStats::getInstance()->incStat(LLViewerStats::ST_AVATAR_EDIT_SECONDS, gFrameIntervalSeconds); } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9fbffdac35..af0dcd8e35 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1578,12 +1578,12 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } else if (!isJustBound() && mCachedRawImageReady) { - //if(mBoostLevel < BOOST_HIGH) - //{ - // // We haven't rendered this in a while, de-prioritize it - // desired_discard += 2; - //} - //else + if(mBoostLevel < BOOST_HIGH) + { + // We haven't rendered this in a while, de-prioritize it + desired_discard += 2; + } + else { // We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is desired_discard = cur_discard; @@ -1591,7 +1591,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } S32 ddiscard = cur_discard - desired_discard; - ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); + ddiscard = llclamp(ddiscard, -1, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8ebd7d325f..4c6a02db87 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -44,6 +44,8 @@ #include <fstream> #include <algorithm> +#include "llagent.h" +#include "llagentcamera.h" #include "llfloaterreg.h" #include "llpanellogin.h" #include "llviewerkeyboard.h" @@ -362,9 +364,9 @@ public: agent_center_text = llformat("AgentCenter %f %f %f", (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - tvector = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->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])); } @@ -382,7 +384,7 @@ public: agent_left_text = llformat("AgentLeftAxis %f %f %f", (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); - tvector = gAgent.getCameraPositionGlobal(); + tvector = gAgentCamera.getCameraPositionGlobal(); camera_center_text = llformat("CameraCenter %f %f %f", (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); @@ -775,7 +777,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK // *HACK: this should be rolled into the composite tool logic, not // hardcoded at the top level. - if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() && LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance()) + if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() && LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance()) { // If the current tool didn't process the click, we should show // the pie menu. This can be done by passing the event to the pie @@ -1145,9 +1147,9 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) } // SL-53351: Make sure we're not in mouselook when minimised, to prevent control issues - if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } send_agent_pause(); @@ -1165,7 +1167,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) BOOL LLViewerWindow::handleActivateApp(LLWindow *window, BOOL activating) { - //if (!activating) gAgent.changeCameraToDefault(); + //if (!activating) gAgentCamera.changeCameraToDefault(); LLViewerJoystick::getInstance()->setNeedsReset(true); return FALSE; @@ -2082,7 +2084,7 @@ void LLViewerWindow::draw() // Draw tool specific overlay on world LLToolMgr::getInstance()->getCurrentTool()->draw(); - if( gAgent.cameraMouselook() ) + if( gAgentCamera.cameraMouselook() || LLFloaterCamera::inFreeCameraMode() ) { drawMouselookInstructions(); stop_glerror(); @@ -2137,12 +2139,14 @@ void LLViewerWindow::draw() // Takes a single keydown event, usually when UI is visible BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { + // hide tooltips on keypress + LLToolTipMgr::instance().blockToolTips(); + if (gFocusMgr.getKeyboardFocus() && !(mask & (MASK_CONTROL | MASK_ALT)) && !gFocusMgr.getKeystrokesOnly()) { // We have keyboard focus, and it's not an accelerator - if (key < 0x80) { // Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first. @@ -2150,68 +2154,48 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } - // hide tooltips on keypress - LLToolTipMgr::instance().blockToolTips(); - - // Explicit hack for debug menu. - if ((MASK_ALT & mask) && - (MASK_CONTROL & mask) && - ('D' == key || 'd' == key)) + // let menus handle navigation keys for navigation + if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE)) + ||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE)) + ||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE))) { - toggle_debug_menus(NULL); + return TRUE; } - // Explicit hack for debug menu. - if ((mask == (MASK_SHIFT | MASK_CONTROL)) && - ('G' == key || 'g' == key)) + // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus + // as long as focus isn't locked + if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked()) { - if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page + if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) + ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) { - BOOL visible = ! gSavedSettings.getBOOL("ForceShowGrid"); - gSavedSettings.setBOOL("ForceShowGrid", visible); - - // Initialize visibility (and don't force visibility - use prefs) - LLPanelLogin::updateLocationCombo( false ); + return TRUE; } } - // Debugging view for unified notifications: CTRL-SHIFT-5 - // *FIXME: Having this special-cased right here (just so this can be invoked from the login screen) sucks. - if ((MASK_SHIFT & mask) - && (!(MASK_ALT & mask)) - && (MASK_CONTROL & mask) - && ('5' == key)) + // give floaters first chance to handle TAB key + // so frontmost floater gets focus + // if nothing has focus, go to first or last UI element as appropriate + if (key == KEY_TAB && (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL)) { - //LLFloaterNotificationConsole::showInstance(); - LLFloaterReg::showInstance("notifications_console"); - return TRUE; - } - - // handle escape key - //if (key == KEY_ESCAPE && mask == MASK_NONE) - //{ + if (gMenuHolder) gMenuHolder->hideMenus(); - // *TODO: get this to play well with mouselook and hidden - // cursor modes, etc, and re-enable. - //if (gFocusMgr.getMouseCapture()) - //{ - // gFocusMgr.setMouseCapture(NULL); - // return TRUE; - //} - //} + // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode + gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0); - // let menus handle navigation keys - if (gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE)) - { - return TRUE; - } - // let menus handle navigation keys - if (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE)) - { + // do CTRL-TAB and CTRL-SHIFT-TAB logic + if (mask & MASK_SHIFT) + { + mRootView->focusPrevRoot(); + } + else + { + mRootView->focusNextRoot(); + } return TRUE; } - //some of context menus use this container, let context menu handle navigation keys - if(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)) + // hidden edit menu for cut/copy/paste + if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask)) { return TRUE; } @@ -2264,7 +2248,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } // Try for a new-format gesture - if (LLGestureManager::instance().triggerGesture(key, mask)) + if (LLGestureMgr::instance().triggerGesture(key, mask)) { return TRUE; } @@ -2276,50 +2260,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } - // Topmost view gets a chance before the hierarchy - // *FIX: get rid of this? - //LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - //if (top_ctrl) - //{ - // if( top_ctrl->handleKey( key, mask, TRUE ) ) - // { - // return TRUE; - // } - //} - - // give floaters first chance to handle TAB key - // so frontmost floater gets focus - if (key == KEY_TAB) - { - // if nothing has focus, go to first or last UI element as appropriate - if (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL) - { - if (gMenuHolder) gMenuHolder->hideMenus(); - - // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode - gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0); - // do CTRL-TAB and CTRL-SHIFT-TAB logic - if (mask & MASK_SHIFT) - { - mRootView->focusPrevRoot(); - } - else - { - mRootView->focusNextRoot(); - } - return TRUE; - } - } - - // give menus a chance to handle keys - if (gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) - { - return TRUE; - } - - // give menus a chance to handle keys - if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)) + // give menus a chance to handle unmodified accelerator keys + if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) + ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) { return TRUE; } @@ -2418,7 +2362,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) // Zoom the camera in and out behavior if(top_ctrl == 0 && getWorldViewRectScaled().pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) ) - gAgent.handleScrollWheel(clicks); + gAgentCamera.handleScrollWheel(clicks); return; } @@ -3142,7 +3086,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, // setup HUD render if (selection->getSelectType() == SELECT_TYPE_HUD && LLSelectMgr::getInstance()->getSelection()->getObjectCount()) { - LLBBox hud_bbox = gAgent.getAvatarObject()->getHUDBBox(); + LLBBox hud_bbox = gAgentAvatarp->getHUDBBox(); // set up transform to encompass bounding box of HUD glMatrixMode(GL_PROJECTION); @@ -3169,7 +3113,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, glPushMatrix(); if (selection->getSelectType() == SELECT_TYPE_HUD) { - F32 zoom = gAgent.mHUDCurZoom; + F32 zoom = gAgentCamera.mHUDCurZoom; glScalef(zoom, zoom, zoom); } @@ -3288,7 +3232,7 @@ LLVector3d LLViewerWindow::clickPointInWorldGlobal(S32 x, S32 y_from_bot, LLView // world at the location of the mouse click LLVector3 mouse_direction_global = mouseDirectionGlobal( x, y_from_bot ); - LLVector3d relative_object = clicked_object->getPositionGlobal() - gAgent.getCameraPositionGlobal(); + LLVector3d relative_object = clicked_object->getPositionGlobal() - gAgentCamera.getCameraPositionGlobal(); // make mouse vector as long as object vector, so it touchs a point near // where the user clicked on the object @@ -3297,7 +3241,7 @@ LLVector3d LLViewerWindow::clickPointInWorldGlobal(S32 x, S32 y_from_bot, LLView LLVector3d new_pos; new_pos.setVec(mouse_direction_global); // transform mouse vector back to world coords - new_pos += gAgent.getCameraPositionGlobal(); + new_pos += gAgentCamera.getCameraPositionGlobal(); return new_pos; } @@ -3564,7 +3508,7 @@ LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const F32 hud_x = -((F32)x - center_x) / height; F32 hud_y = ((F32)y - center_y) / height; - return LLVector3(0.f, hud_x/gAgent.mHUDCurZoom, hud_y/gAgent.mHUDCurZoom); + return LLVector3(0.f, hud_x/gAgentCamera.mHUDCurZoom, hud_y/gAgentCamera.mHUDCurZoom); } // Returns unit vector relative to camera in camera space @@ -3611,7 +3555,7 @@ BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, con LLVector3d plane_normal_global_d; plane_normal_global_d.setVec(plane_normal_global); F64 plane_mouse_dot = (plane_normal_global_d * mouse_direction_global_d); - LLVector3d plane_origin_camera_rel = plane_point_global - gAgent.getCameraPositionGlobal(); + LLVector3d plane_origin_camera_rel = plane_point_global - gAgentCamera.getCameraPositionGlobal(); F64 mouse_look_at_scale = (plane_normal_global_d * plane_origin_camera_rel) / plane_mouse_dot; if (llabs(plane_mouse_dot) < 0.00001) @@ -3625,7 +3569,7 @@ BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, con mouse_look_at_scale = plane_origin_camera_rel.magVec() / (plane_origin_dir * mouse_direction_global_d); } - point = gAgent.getCameraPositionGlobal() + mouse_look_at_scale * mouse_direction_global_d; + point = gAgentCamera.getCameraPositionGlobal() + mouse_look_at_scale * mouse_direction_global_d; return mouse_look_at_scale > 0.0; } @@ -3643,12 +3587,12 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d const F32 SECOND_PASS_STEP = 0.1f; // meters LLVector3d camera_pos_global; - camera_pos_global = gAgent.getCameraPositionGlobal(); + camera_pos_global = gAgentCamera.getCameraPositionGlobal(); LLVector3d probe_point_global; LLVector3 probe_point_region; // walk forwards to find the point - for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < gAgent.mDrawDistance; mouse_dir_scale += FIRST_PASS_STEP) + for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < gAgentCamera.mDrawDistance; mouse_dir_scale += FIRST_PASS_STEP) { LLVector3d mouse_direction_global_d; mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale); @@ -5033,9 +4977,9 @@ bool LLViewerWindow::onAlert(const LLSD& notify) // 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( gAgent.cameraMouselook() ) + if( gAgentCamera.cameraMouselook() ) { - gAgent.changeCameraToDefault(); + gAgentCamera.changeCameraToDefault(); } return false; } @@ -5147,7 +5091,7 @@ void LLPickInfo::fetchResults() { mPickType = PICK_OBJECT; } - mObjectOffset = gAgent.calcFocusOffset(objectp, intersection, mPickPt.mX, mPickPt.mY); + mObjectOffset = gAgentCamera.calcFocusOffset(objectp, intersection, mPickPt.mX, mPickPt.mY); mObjectID = objectp->mID; mObjectFace = (te_offset == NO_FACE) ? -1 : (S32)te_offset; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 431aa6f955..540cb47710 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -48,6 +48,7 @@ #include "sound_ids.h" #include "llagent.h" // Get state values from here +#include "llagentcamera.h" #include "llagentwearables.h" #include "llanimationstates.h" #include "llavatarpropertiesprocessor.h" @@ -754,11 +755,6 @@ LLVOAvatar::~LLVOAvatar() { lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; - if (isSelf()) - { - gAgent.setAvatarObject(NULL); - } - mRoot.removeAllChildren(); deleteAndClearArray(mSkeleton); @@ -885,7 +881,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) // static void LLVOAvatar::dumpBakedStatus() { - LLVector3d camera_pos_global = gAgent.getCameraPositionGlobal(); + LLVector3d camera_pos_global = gAgentCamera.getCameraPositionGlobal(); for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) @@ -964,15 +960,14 @@ void LLVOAvatar::dumpBakedStatus() //static void LLVOAvatar::restoreGL() { - LLVOAvatar* self = gAgent.getAvatarObject(); - if (!self) - return; - self->setCompositeUpdatesEnabled(TRUE); - for (U32 i = 0; i < self->mBakedTextureDatas.size(); i++) + if (!isAgentAvatarValid()) return; + + gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); + for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++) { - self->invalidateComposite(self->mBakedTextureDatas[i].mTexLayerSet, FALSE); + gAgentAvatarp->invalidateComposite(gAgentAvatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE); } - self->updateMeshTextures(); + gAgentAvatarp->updateMeshTextures(); } //static @@ -2084,7 +2079,7 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, if(retval & LLViewerObject::INVALID_UPDATE) { - if(this == gAgent.getAvatarObject()) + if (isSelf()) { //tell sim to cancel this update gAgent.teleportViaLocation(gAgent.getPositionGlobal()); @@ -2225,7 +2220,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { // disable voice visualizer when in mouselook - mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(isSelf() && gAgent.cameraMouselook()) ); + mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(isSelf() && gAgentCamera.cameraMouselook()) ); if ( voice_enabled ) { //---------------------------------------------------------------- @@ -2253,7 +2248,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) else { llinfos << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << llendl; } // this is the call that Karl S. created for triggering gestures from within the code. - LLGestureManager::instance().triggerAndReviseString( gestureString ); + LLGestureMgr::instance().triggerAndReviseString( gestureString ); } } @@ -2546,7 +2541,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() llinfos << "self isFullyLoaded, first_fully_visible" << llendl; first_fully_visible = false; - LLAppearanceManager::instance().onFirstFullyVisible(); + LLAppearanceMgr::instance().onFirstFullyVisible(); } } if (isFullyLoaded()) @@ -2671,7 +2666,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) if (isSelf()) { render_name = render_name - && !gAgent.cameraMouselook() + && !gAgentCamera.cameraMouselook() && (visible_chat || (gSavedSettings.getBOOL("RenderNameShowSelf") && gSavedSettings.getS32("AvatarNameTagMode") )); } @@ -2934,14 +2929,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } else { - if (gSavedSettings.getBOOL("SmallAvatarNames")) - { - mNameText->setFont(LLFontGL::getFontSansSerif()); - } - else - { - mNameText->setFont(LLFontGL::getFontSansSerifBig()); - } + mNameText->setFont(LLFontGL::getFontSansSerif()); mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); mNameText->setVisibleOffScreen(FALSE); @@ -3235,7 +3223,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } LLVector3 fwdDir = lerp(primDir, velDir, clamp_rescale(speed, 0.5f, 2.0f, 0.0f, 1.0f)); - if (isSelf() && gAgent.cameraMouselook()) + if (isSelf() && gAgentCamera.cameraMouselook()) { // make sure fwdDir stays in same general direction as primdir if (gAgent.getFlying()) @@ -3266,7 +3254,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // When moving very slow, the pelvis is allowed to deviate from the // forward direction to allow it to hold it's position while the torso // and head turn. Once in motion, it must conform however. - BOOL self_in_mouselook = isSelf() && gAgent.cameraMouselook(); + BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook(); LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST); @@ -5206,7 +5194,7 @@ BOOL LLVOAvatar::updateJointLODs() { if (isSelf()) { - if(gAgent.cameraCustomizeAvatar() || gAgent.cameraMouselook()) + if(gAgentCamera.cameraCustomizeAvatar() || gAgentCamera.cameraMouselook()) { mAdjustedPixelArea = MAX_PIXEL_AREA; } @@ -5352,7 +5340,7 @@ void LLVOAvatar::updateShadowFaces() // Render sprite sprite.setNormal(normal); - if (isSelf() && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (isSelf() && gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { sprite.setColor(0.f, 0.f, 0.f, 0.f); } @@ -5385,7 +5373,7 @@ void LLVOAvatar::updateShadowFaces() // Render sprite sprite.setNormal(normal); - if (isSelf() && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (isSelf() && gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { sprite.setColor(0.f, 0.f, 0.f, 0.f); } @@ -5440,7 +5428,7 @@ BOOL LLVOAvatar::setParent(LLViewerObject* parent) ret = LLViewerObject::setParent(parent); if (isSelf()) { - gAgent.resetCamera(); + gAgentCamera.resetCamera(); } } else @@ -5625,15 +5613,15 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) //LLFirstUse::useSit(); gAgent.setFlying(FALSE); - gAgent.setThirdPersonHeadOffset(LLVector3::zero); + gAgentCamera.setThirdPersonHeadOffset(LLVector3::zero); //interpolate to new camera position - gAgent.startCameraAnimation(); + gAgentCamera.startCameraAnimation(); // make sure we are not trying to autopilot gAgent.stopAutoPilot(); - gAgent.setupSitCamera(); - if (gAgent.getForceMouselook()) + gAgentCamera.setupSitCamera(); + if (gAgentCamera.getForceMouselook()) { - gAgent.changeCameraToMouselook(); + gAgentCamera.changeCameraToMouselook(); } } @@ -5720,9 +5708,9 @@ void LLVOAvatar::getOffObject() //reset orientation // mRoot.setRotation(avWorldRot); - gAgent.setThirdPersonHeadOffset(LLVector3(0.f, 0.f, 1.f)); + gAgentCamera.setThirdPersonHeadOffset(LLVector3(0.f, 0.f, 1.f)); - gAgent.setSitCamera(LLUUID::null); + gAgentCamera.setSitCamera(LLUUID::null); } } @@ -5937,7 +5925,7 @@ void LLVOAvatar::updateMeshTextures() } } - const BOOL self_customizing = isSelf() && gAgent.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures + const BOOL self_customizing = isSelf() && gAgentCamera.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures const BOOL other_culled = !isSelf() && mCulled; std::vector<BOOL> is_layer_baked; @@ -6858,8 +6846,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // static void LLVOAvatar::dumpArchetypeXML( void* ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLAPRFile outfile ; + LLAPRFile outfile; outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB ); apr_file_t* file = outfile.getFileHandle() ; if (!file) @@ -6877,7 +6864,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type); apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() ); - for (LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam()) + for (LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; if( (viewer_param->getWearableType() == type) && @@ -6893,7 +6880,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? - LLViewerTexture* te_image = avatar->getImage((ETextureIndex)te, 0); + LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0); if( te_image ) { std::string uuid_str; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 98ca76ed01..c15dbeb8c6 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -44,9 +44,11 @@ #include "pipeline.h" #include "llagent.h" // Get state values from here +#include "llagentcamera.h" #include "llagentwearables.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" +#include "llinventoryfunctions.h" #include "llselectmgr.h" #include "lltoolgrab.h" // for needsRenderBeam #include "lltoolmgr.h" // for needsRenderBeam @@ -66,6 +68,14 @@ #include <boost/lexical_cast.hpp> +LLVOAvatarSelf *gAgentAvatarp = NULL; +BOOL isAgentAvatarValid() +{ + return (gAgentAvatarp && + (gAgentAvatarp->getRegion() != NULL) && + (!gAgentAvatarp->isDead())); +} + using namespace LLVOAvatarDefines; /********************************************************************************* @@ -77,14 +87,14 @@ using namespace LLVOAvatarDefines; struct LocalTextureData { LocalTextureData() : - mIsBakedReady(FALSE), + mIsBakedReady(false), mDiscard(MAX_DISCARD_LEVEL+1), mImage(NULL), mWearableID(IMG_DEFAULT_AVATAR), mTexEntry(NULL) {} LLPointer<LLViewerFetchedTexture> mImage; - BOOL mIsBakedReady; + bool mIsBakedReady; S32 mDiscard; LLUUID mWearableID; // UUID of the wearable that this texture belongs to, not of the image itself LLTextureEntry *mTexEntry; @@ -132,7 +142,6 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, mLastRegionHandle(0), mRegionCrossingCount(0) { - gAgent.setAvatarObject(this); gAgentWearables.setAvatarObject(this); lldebugs << "Marking avatar as self " << id << llendl; @@ -510,16 +519,17 @@ BOOL LLVOAvatarSelf::buildMenus() return TRUE; } +void LLVOAvatarSelf::cleanup() +{ + markDead(); + delete mScreenp; + mScreenp = NULL; + mRegionp = NULL; +} + LLVOAvatarSelf::~LLVOAvatarSelf() { - // gAgents pointer might have been set to a different Avatar Self, don't get rid of it if so. - if (gAgent.getAvatarObject() == this) - { - gAgent.setAvatarObject(NULL); - gAgentWearables.setAvatarObject(NULL); - } - delete mScreenp; - mScreenp = NULL; + cleanup(); } /** @@ -610,6 +620,17 @@ BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent) } // virtual +BOOL LLVOAvatarSelf::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) +{ + if (!isAgentAvatarValid()) + { + return TRUE; + } + LLVOAvatar::idleUpdate(agent, world, time); + return TRUE; +} + +// virtual LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) { if (mScreenp) @@ -620,7 +641,8 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) return LLVOAvatar::getJoint(name); } -/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake ) +// virtual +BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake ) { if (!which_param) { @@ -630,7 +652,8 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) return setParamWeight(param,weight,upload_bake); } -/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake ) +// virtual +BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake ) { if (!param_name) { @@ -640,7 +663,8 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) return setParamWeight(param,weight,upload_bake); } -/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake ) +// virtual +BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake ) { LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(index); return setParamWeight(param,weight,upload_bake); @@ -776,7 +800,8 @@ void LLVOAvatarSelf::removeMissingBakedTextures() //virtual void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) { - if (regionp->getHandle() != mLastRegionHandle) + setRegion(regionp); + if (!regionp || (regionp->getHandle() != mLastRegionHandle)) { if (mLastRegionHandle != 0) { @@ -790,7 +815,10 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) max = llmax(delta, max); LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); } - mLastRegionHandle = regionp->getHandle(); + if (regionp) + { + mLastRegionHandle = regionp->getHandle(); + } } mRegionCrossingTimer.reset(); } @@ -819,10 +847,10 @@ void LLVOAvatarSelf::idleUpdateTractorBeam() { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (gAgent.mPointAt.notNull()) + if (gAgentCamera.mPointAt.notNull()) { // get point from pointat effect - mBeam->setPositionGlobal(gAgent.mPointAt->getPointAtPosGlobal()); + mBeam->setPositionGlobal(gAgentCamera.mPointAt->getPointAtPosGlobal()); mBeam->triggerLocal(); } else if (selection->getFirstRootObject() && @@ -873,7 +901,7 @@ void LLVOAvatarSelf::restoreMeshData() //llinfos << "Restoring" << llendl; mMeshValid = TRUE; updateJointLODs(); - updateAttachmentVisibility(gAgent.getCameraMode()); + updateAttachmentVisibility(gAgentCamera.getCameraMode()); // force mesh update as LOD might not have changed to trigger this gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY, TRUE); @@ -938,7 +966,7 @@ void LLVOAvatarSelf::wearableUpdated( EWearableType type, BOOL upload_result ) // if we're editing our appearance, ensure that we're not using baked textures // The baked texture for alpha masks is set explicitly when you hit "save" - if (gAgent.cameraCustomizeAvatar()) + if (gAgentCamera.cameraCustomizeAvatar()) { setNewBakedTexture(index,IMG_DEFAULT_AVATAR); } @@ -1027,7 +1055,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view return 0; } - updateAttachmentVisibility(gAgent.getCameraMode()); + updateAttachmentVisibility(gAgentCamera.getCameraMode()); // Then make sure the inventory is in sync with the avatar. @@ -1035,7 +1063,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view if (attachment->isObjectAttached(viewer_object)) { const LLUUID& attachment_id = viewer_object->getItemID(); - LLAppearanceManager::instance().registerAttachment(attachment_id); + LLAppearanceMgr::instance().registerAttachment(attachment_id); } return attachment; @@ -1068,13 +1096,13 @@ 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 (gAgent.getAvatarObject() == NULL) + if (!isAgentAvatarValid()) { llinfos << "removeItemLinks skipped, avatar is under destruction" << llendl; } else { - LLAppearanceManager::instance().unregisterAttachment(attachment_id); + LLAppearanceMgr::instance().unregisterAttachment(attachment_id); } return TRUE; @@ -1115,11 +1143,11 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr discard_level < local_tex_obj->getDiscard()) { local_tex_obj->setDiscard(discard_level); - if (!gAgent.cameraCustomizeAvatar()) + if (!gAgentCamera.cameraCustomizeAvatar()) { requestLayerSetUpdate(index); } - else if (gAgent.cameraCustomizeAvatar()) + else if (gAgentCamera.cameraCustomizeAvatar()) { LLVisualParamHint::requestHintUpdates(); } @@ -1523,11 +1551,11 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te if (tex_discard >= 0 && tex_discard <= desired_discard) { local_tex_obj->setDiscard(tex_discard); - if (isSelf() && !gAgent.cameraCustomizeAvatar()) + if (isSelf() && !gAgentCamera.cameraCustomizeAvatar()) { requestLayerSetUpdate(type); } - else if (isSelf() && gAgent.cameraCustomizeAvatar()) + else if (isSelf() && gAgentCamera.cameraCustomizeAvatar()) { LLVisualParamHint::requestHintUpdates(); } @@ -1667,7 +1695,7 @@ void LLVOAvatarSelf::onLocalTextureLoaded(BOOL success, LLViewerFetchedTexture * void LLVOAvatarSelf::dumpTotalLocalTextureByteCount() { S32 gl_bytes = 0; - gAgent.getAvatarObject()->getLocalTextureByteCount(&gl_bytes); + gAgentAvatarp->getLocalTextureByteCount(&gl_bytes); llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl; } @@ -1924,9 +1952,7 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) { LLUUID texture_id; msg->getUUID("TextureData", "TextureID", texture_id); - - LLVOAvatarSelf* self = gAgent.getAvatarObject(); - if (!self) return; + if (!isAgentAvatarValid()) return; // If this is a texture corresponding to one of our baked entries, // just rebake that layer set. @@ -1943,13 +1969,13 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsBakedTexture) { - if (texture_id == self->getTEImage(index)->getID()) + if (texture_id == gAgentAvatarp->getTEImage(index)->getID()) { - LLTexLayerSet* layer_set = self->getLayerSet(index); + LLTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index); if (layer_set) { llinfos << "TAT: rebake - matched entry " << (S32)index << llendl; - self->invalidateComposite(layer_set, TRUE); + gAgentAvatarp->invalidateComposite(layer_set, TRUE); found = TRUE; LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); } @@ -1960,12 +1986,12 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) // If texture not found, rebake all entries. if (!found) { - self->forceBakeAllTextures(); + gAgentAvatarp->forceBakeAllTextures(); } else { // Not sure if this is necessary, but forceBakeAllTextures() does it. - self->updateMeshTextures(); + gAgentAvatarp->updateMeshTextures(); } } @@ -2045,10 +2071,9 @@ void LLVOAvatarSelf::onCustomizeStart() // static void LLVOAvatarSelf::onCustomizeEnd() { - LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); - if (avatarp) + if (isAgentAvatarValid()) { - avatarp->invalidateAll(); + gAgentAvatarp->invalidateAll(); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 9514abc5bc..4856e82275 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -55,7 +55,8 @@ public: LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); virtual ~LLVOAvatarSelf(); virtual void markDead(); - virtual void initInstance(); // Called after construction to initialize the class. + virtual void initInstance(); // Called after construction to initialize the class. + void cleanup(); protected: /*virtual*/ BOOL loadAvatar(); BOOL loadAvatarSelf(); @@ -77,6 +78,7 @@ protected: //-------------------------------------------------------------------- public: /*virtual*/ void updateRegion(LLViewerRegion *regionp); + /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); //-------------------------------------------------------------------- // LLCharacter interface and related @@ -122,12 +124,10 @@ public: public: /*virtual*/ BOOL updateIsFullyLoaded(); private: - BOOL mIsBaked; // are the stored baked textures up to date? //-------------------------------------------------------------------- // Region state //-------------------------------------------------------------------- -private: U64 mLastRegionHandle; LLFrameTimer mRegionCrossingTimer; S32 mRegionCrossingCount; @@ -333,4 +333,8 @@ public: }; +extern LLVOAvatarSelf *gAgentAvatarp; + +BOOL isAgentAvatarValid(); + #endif // LL_VO_AVATARSELF_H diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index e311f07912..a82afbeb76 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -37,7 +37,7 @@ #include "imageids.h" #include "llviewercontrol.h" -#include "llagent.h" +#include "llagentcamera.h" #include "llnotificationsutil.h" #include "lldrawable.h" #include "llface.h" @@ -306,7 +306,7 @@ BOOL LLVOGrass::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) void LLVOGrass::setPixelAreaAndAngle(LLAgent &agent) { // This should be the camera's center, as soon as we move to all region-local. - LLVector3 relative_position = getPositionAgent() - agent.getCameraPositionAgent(); + LLVector3 relative_position = getPositionAgent() - gAgentCamera.getCameraPositionAgent(); F32 range = relative_position.length(); F32 max_scale = getMaxScale(); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index bf09cdef37..2f3bd567da 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -4950,9 +4950,8 @@ void LLVivoxVoiceClient::enforceTether(void) void LLVivoxVoiceClient::updatePosition(void) { - LLVOAvatarSelf *agent = gAgent.getAvatarObject(); LLViewerRegion *region = gAgent.getRegion(); - if(region && agent) + if(region && isAgentAvatarValid()) { LLMatrix3 rot; LLVector3d pos; @@ -4970,9 +4969,9 @@ void LLVivoxVoiceClient::updatePosition(void) rot); // rotation matrix // Send the current avatar position to the voice code - rot = agent->getRootJoint()->getWorldRotation().getMatrix3(); - - pos = agent->getPositionGlobal(); + rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3(); + pos = gAgentAvatarp->getPositionGlobal(); + // TODO: Can we get the head offset from outside the LLVOAvatar? // pos += LLVector3d(mHeadOffset); pos += LLVector3d(0.f, 0.f, 1.f); diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 139d2fbd88..3ba4ecad0c 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -40,7 +40,7 @@ #include "message.h" #include "v2math.h" -#include "llagent.h" +#include "llagentcamera.h" #include "lldrawable.h" #include "llface.h" #include "llsky.h" @@ -136,7 +136,7 @@ F32 LLVOPartGroup::getPartSize(S32 idx) LLVector3 LLVOPartGroup::getCameraPosition() const { - return gAgent.getCameraPositionAgent(); + return gAgentCamera.getCameraPositionAgent(); } static LLFastTimer::DeclareTimer FTM_UPDATE_PARTICLES("Update Particles"); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 0550ed770b..d73850cb49 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -41,6 +41,7 @@ #include "timing.h" #include "llagent.h" +#include "llagentcamera.h" #include "lldrawable.h" #include "llface.h" #include "llcubemap.h" @@ -357,7 +358,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mFace[i] = NULL; } - mCameraPosAgent = gAgent.getCameraPositionAgent(); + mCameraPosAgent = gAgentCamera.getCameraPositionAgent(); mAtmHeight = ATM_HEIGHT; mEarthCenter = LLVector3(mCameraPosAgent.mV[0], mCameraPosAgent.mV[1], -EARTH_RADIUS); @@ -2034,7 +2035,7 @@ void LLVOSky::updateFog(const F32 distance) const F32 water_height = gAgent.getRegion() ? gAgent.getRegion()->getWaterHeight() : 0.f; // LLWorld::getInstance()->getWaterHeight(); - F32 camera_height = gAgent.getCameraPositionAgent().mV[2]; + F32 camera_height = gAgentCamera.getCameraPositionAgent().mV[2]; F32 near_clip_height = LLViewerCamera::getInstance()->getAtAxis().mV[VZ] * LLViewerCamera::getInstance()->getNear(); camera_height += near_clip_height; diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 55e2c58a52..b89c0cd638 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -44,7 +44,7 @@ #include "material_codes.h" #include "object_flags.h" -#include "llagent.h" +#include "llagentcamera.h" #include "lldrawable.h" #include "llface.h" #include "llviewercamera.h" @@ -444,7 +444,7 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) // Re-calculate mPixelArea accurately // This should be the camera's center, as soon as we move to all region-local. - LLVector3 relative_position = getPositionAgent() - agent.getCameraPositionAgent(); + LLVector3 relative_position = getPositionAgent() - gAgentCamera.getCameraPositionAgent(); F32 range = relative_position.length(); // ugh, square root F32 max_scale = mBillboardScale * getMaxScale(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index cb362d557c..6b052b8e99 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -369,7 +369,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, S32 res2 = unpackTEMessage(*dp); if (TEM_INVALID == res2) { - // Well, crap, there's something bogus in the data that we're unpacking. + // There's something bogus in the data that we're unpacking. dp->dumpBufferToLog(); llwarns << "Flushing cache files" << llendl; std::string mask; diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 8be8f494da..436cd478b4 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -54,6 +54,7 @@ #include "llviewercontrol.h" #include "lldrawpoolwater.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewerregion.h" #include "llwlparammanager.h" @@ -434,7 +435,7 @@ F32 LLWaterParamManager::getFogDensity(void) // modify if we're underwater const F32 water_height = gAgent.getRegion() ? gAgent.getRegion()->getWaterHeight() : 0.f; - F32 camera_height = gAgent.getCameraPositionAgent().mV[2]; + F32 camera_height = gAgentCamera.getCameraPositionAgent().mV[2]; if(camera_height <= water_height) { // raise it to the underwater fog density modifier diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index 3334c17a8f..63f99273fe 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -62,13 +62,12 @@ class LLOverrideBakedTextureUpdate public: LLOverrideBakedTextureUpdate(bool temp_state) { - mAvatar = gAgent.getAvatarObject(); U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { - composite_enabled[index] = mAvatar->isCompositeUpdateEnabled(index); + composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index); } - mAvatar->setCompositeUpdatesEnabled(temp_state); + gAgentAvatarp->setCompositeUpdatesEnabled(temp_state); } ~LLOverrideBakedTextureUpdate() @@ -76,13 +75,11 @@ public: U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { - mAvatar->setCompositeUpdatesEnabled(index, composite_enabled[index]); - } + gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]); + } } - private: bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES]; - LLVOAvatarSelf *mAvatar; }; // Private local functions @@ -205,10 +202,9 @@ BOOL LLWearable::exportFile(LLFILE* file) const void LLWearable::createVisualParams() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam()) + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) { if (param->getWearableType() == mType) { @@ -228,7 +224,7 @@ void LLWearable::createVisualParams() param->resetDrivenParams(); if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) { - if( !param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatarSelf*)avatar,_1 ), true)) + if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp,_1 ), true)) { llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; continue; @@ -464,12 +460,7 @@ BOOL LLWearable::importFile( LLFILE* file ) // since this wearable was created. BOOL LLWearable::isOldVersion() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) { @@ -483,9 +474,9 @@ BOOL LLWearable::isOldVersion() const } S32 param_count = 0; - for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) { if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { @@ -531,17 +522,11 @@ BOOL LLWearable::isOldVersion() const // only if those values are the same as the defaults. BOOL LLWearable::isDirty() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return FALSE; - } - + if (!isAgentAvatarValid()) return FALSE; - for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) { if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) @@ -602,14 +587,9 @@ BOOL LLWearable::isDirty() const void LLWearable::setParamsToDefaults() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return; - } + if (!isAgentAvatarValid()) return; - for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { @@ -645,18 +625,12 @@ void LLWearable::setTexturesToDefaults() // Updates the user's avatar's appearance void LLWearable::writeToAvatar() { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - llerrs << "could not get avatar object to write to for wearable " << this->getName() << llendl; - return; - } + if (!isAgentAvatarValid()) return; - ESex old_sex = avatar->getSex(); + ESex old_sex = gAgentAvatarp->getSex(); // Pull params - for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) + 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. @@ -665,7 +639,7 @@ void LLWearable::writeToAvatar() S32 param_id = param->getID(); F32 weight = getVisualParamWeight(param_id); - avatar->setVisualParamWeight( param_id, weight, FALSE ); + gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE ); } } @@ -686,14 +660,14 @@ void LLWearable::writeToAvatar() } LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: replace hard-coded 0 - avatar->setLocalTextureTE(te, image, 0); + gAgentAvatarp->setLocalTextureTE(te, image, 0); } } - ESex new_sex = avatar->getSex(); + ESex new_sex = gAgentAvatarp->getSex(); if( old_sex != new_sex ) { - avatar->updateSexDependentLayerSets( FALSE ); + gAgentAvatarp->updateSexDependentLayerSets( FALSE ); } // if( upload_bake ) @@ -707,12 +681,7 @@ void LLWearable::writeToAvatar() // static void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake ) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return; - } + if (!isAgentAvatarValid()) return; // You can't just remove body parts. if( (type == WT_SHAPE) || @@ -724,12 +693,12 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake ) } // Pull params - for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { S32 param_id = param->getID(); - avatar->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake ); + gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake ); } } @@ -738,8 +707,8 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake ) gFloaterCustomize->setWearable(type, NULL, PERM_ALL, TRUE); } - avatar->updateVisualParams(); - avatar->wearableUpdated(type, TRUE); + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->wearableUpdated(type, TRUE); // if( upload_bake ) // { @@ -751,12 +720,7 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake ) // Definition version is current: removes obsolete enties and creates default values for new ones. void LLWearable::copyDataFrom(const LLWearable* src) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return; - } + if (!isAgentAvatarValid()) return; mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; @@ -769,9 +733,9 @@ void LLWearable::copyDataFrom(const LLWearable* src) mSavedVisualParamMap.clear(); // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) - for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) { if( (param->getWearableType() == mType) ) { @@ -783,7 +747,7 @@ void LLWearable::copyDataFrom(const LLWearable* src) 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++ ) + for (S32 te = 0; te < TEX_NUM_INDICES; te++) { if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { @@ -876,14 +840,12 @@ void LLWearable::addVisualParam(LLVisualParam *param) void LLWearable::setVisualParams() { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - 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(); - avatar->setVisualParamWeight(id, value, FALSE); + gAgentAvatarp->setVisualParamWeight(id, value, FALSE); } } @@ -1024,9 +986,8 @@ BOOL LLWearable::isOnTop() const void LLWearable::createLayers(S32 te) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - LLTexLayerSet *layer_set = avatar->getLayerSet((ETextureIndex)te); - if( layer_set ) + LLTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); + if (layer_set) { layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); } @@ -1123,10 +1084,9 @@ void LLWearable::destroyTextures() void LLWearable::pullCrossWearableValues() { // scan through all of the avatar's visual parameters - LLVOAvatar* avatar = gAgent.getAvatarObject(); - for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam()) + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) { if( param ) { diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 9973c8dd7b..aa03b1afd1 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -103,8 +103,18 @@ void LLWeb::loadURLInternal(const std::string &url) // static void LLWeb::loadURLExternal(const std::string& url) { + loadURLExternal(url, true); +} + + +// static +void LLWeb::loadURLExternal(const std::string& url, bool async) +{ std::string escaped_url = escapeURL(url); - gViewerWindow->getWindow()->spawnWebBrowser(escaped_url); + if (gViewerWindow) + { + gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, async); + } } diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index f4666c9280..1119b80bb4 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -54,8 +54,10 @@ public: static void loadURL(const char* url) { loadURL( ll_safe_string(url) ); } /// Load the given url in the Second Life internal web browser static void loadURLInternal(const std::string &url); - /// Load the given url in the operating system's web browser + /// Load the given url in the operating system's web browser, async if we want to return immediately + /// before browser has spawned static void loadURLExternal(const std::string& url); + static void loadURLExternal(const std::string& url, bool async); /// Returns escaped url (eg, " " to "%20") - used by all loadURL methods static std::string escapeURL(const std::string& url); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 9f210c60e9..58b9f5ce18 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1210,7 +1210,7 @@ static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3 return pos_global; } -void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const +void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const { if(avatar_ids != NULL) { diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 48025c700b..502f7b0320 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -158,7 +158,7 @@ public: // All arguments are optional. Given containers will be emptied and then filled. // Not supplying origin or radius input returns data on all avatars in the known regions. void getAvatars( - std::vector<LLUUID>* avatar_ids = NULL, + uuid_vec_t* avatar_ids = NULL, std::vector<LLVector3d>* positions = NULL, const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 27757d19e5..0c37bb6eb1 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -44,6 +44,7 @@ #include "lltooltip.h" #include "llagent.h" +#include "llagentcamera.h" #include "llcallingcard.h" #include "llcommandhandler.h" #include "llviewercontrol.h" @@ -311,7 +312,7 @@ void LLWorldMapView::draw() const S32 height = getRect().getHeight(); const F32 half_width = F32(width) / 2.0f; const F32 half_height = F32(height) / 2.0f; - LLVector3d camera_global = gAgent.getCameraPositionGlobal(); + LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal(); S32 level = LLWorldMipmap::scaleToLevel(sMapScale); @@ -885,35 +886,43 @@ void LLWorldMapView::drawFrustum() F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 ); F32 half_width_pixels = half_width_meters * meters_to_pixels; - F32 ctr_x = getRect().getWidth() * 0.5f + sPanX; - F32 ctr_y = getRect().getHeight() * 0.5f + sPanY; + F32 ctr_x = getLocalRect().getWidth() * 0.5f + sPanX; + F32 ctr_y = getLocalRect().getHeight() * 0.5f + sPanY; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Since we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); + { gGL.translatef( ctr_x, ctr_y, 0 ); - glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); // Draw triangle with more alpha in far pixels to make it // fade out in distance. gGL.begin( LLRender::TRIANGLES ); + { + LLVector2 cam_lookat(LLViewerCamera::instance().getAtAxis().mV[VX], LLViewerCamera::instance().getAtAxis().mV[VY]); + LLVector2 cam_left(LLViewerCamera::instance().getLeftAxis().mV[VX], LLViewerCamera::instance().getLeftAxis().mV[VY]); + gGL.color4f(1.f, 1.f, 1.f, 0.25f); gGL.vertex2f( 0, 0 ); gGL.color4f(1.f, 1.f, 1.f, 0.02f); - gGL.vertex2f( -half_width_pixels, far_clip_pixels ); + + LLVector2 vert = cam_lookat * far_clip_pixels + cam_left * half_width_pixels; + gGL.vertex2f(vert.mV[VX], vert.mV[VY]); - gGL.color4f(1.f, 1.f, 1.f, 0.02f); - gGL.vertex2f( half_width_pixels, far_clip_pixels ); + vert = cam_lookat * far_clip_pixels - cam_left * half_width_pixels; + gGL.vertex2f(vert.mV[VX], vert.mV[VY]); + } gGL.end(); + } gGL.popMatrix(); } LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos ) { - LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal(); + LLVector3d relative_pos_global = global_pos - gAgentCamera.getCameraPositionGlobal(); LLVector3 pos_local; pos_local.setVec(relative_pos_global); // convert to floats from doubles @@ -1006,7 +1015,7 @@ LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y ) LLVector3d pos_global; pos_global.setVec( pos_local ); - pos_global += gAgent.getCameraPositionGlobal(); + pos_global += gAgentCamera.getCameraPositionGlobal(); if(gAgent.isGodlike()) { pos_global.mdV[VZ] = GODLY_TELEPORT_HEIGHT; // Godly height should always be 200. @@ -1638,7 +1647,7 @@ void LLWorldMapView::updateVisibleBlocks() // Load the blocks visible in the current World Map view // Get the World Map view coordinates and boundaries - LLVector3d camera_global = gAgent.getCameraPositionGlobal(); + LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal(); const S32 width = getRect().getWidth(); const S32 height = getRect().getHeight(); const F32 half_width = F32(width) / 2.0f; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 259ca21e93..4ca251af3e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -56,6 +56,7 @@ // newview includes #include "llagent.h" +#include "llagentcamera.h" #include "lldrawable.h" #include "lldrawpoolalpha.h" #include "lldrawpoolavatar.h" @@ -3855,15 +3856,14 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects, BOOL render } // pick HUD objects - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp && sShowHUDAttachments) + if (isAgentAvatarValid() && sShowHUDAttachments) { glh::matrix4f save_proj(glh_get_current_projection()); glh::matrix4f save_model(glh_get_current_modelview()); setup_hud_matrices(screen_rect); - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + 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; @@ -3963,9 +3963,9 @@ void LLPipeline::rebuildPools() max_count--; } - if (gAgent.getAvatarObject()) + if (isAgentAvatarValid()) { - gAgent.getAvatarObject()->rebuildHUD(); + gAgentAvatarp->rebuildHUD(); } } @@ -4361,7 +4361,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) // mNearbyLight (and all light_set_t's) are sorted such that // begin() == the closest light and rbegin() == the farthest light const S32 MAX_LOCAL_LIGHTS = 6; -// LLVector3 cam_pos = gAgent.getCameraPositionAgent(); +// LLVector3 cam_pos = gAgentCamera.getCameraPositionAgent(); LLVector3 cam_pos = LLViewerJoystick::getInstance()->getOverrideCamera() ? camera.getOrigin() : gAgent.getPositionAgent(); @@ -4597,8 +4597,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) glLightfv(gllight, GL_SPECULAR, LLColor4::black.mV); } - if (gAgent.getAvatarObject() && - gAgent.getAvatarObject()->mSpecialRenderMode == 3) + if (isAgentAvatarValid() && + gAgentAvatarp->mSpecialRenderMode == 3) { LLColor4 light_color = LLColor4::white; light_color.mV[3] = 0.0f; @@ -4707,15 +4707,13 @@ void LLPipeline::enableLightsDynamic() glColor4f(0.f, 0.f, 0.f, 1.f); // no local lighting by default } - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - - if (avatarp && getLightingDetail() <= 0) + if (isAgentAvatarValid() && getLightingDetail() <= 0) { - if (avatarp->mSpecialRenderMode == 0) // normal + if (gAgentAvatarp->mSpecialRenderMode == 0) // normal { gPipeline.enableLightsAvatar(); } - else if (avatarp->mSpecialRenderMode >= 1) // anim preview + else if (gAgentAvatarp->mSpecialRenderMode >= 1) // anim preview { gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f)); } @@ -7100,15 +7098,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) { if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if (gAgent.getCameraAnimating() || gAgent.getCameraMode() != CAMERA_MODE_MOUSELOOK) + BOOL skip_avatar_update = FALSE; + if (gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) { - avatar = NULL; + skip_avatar_update = TRUE; } - if (avatar) + if (!skip_avatar_update) { - avatar->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); + gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); } LLVertexBuffer::unbind(); @@ -7332,9 +7330,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); - if (avatar) + if (!skip_avatar_update) { - avatar->updateAttachmentVisibility(gAgent.getCameraMode()); + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); } } } diff --git a/indra/newview/res-sdl/toolbuy.BMP b/indra/newview/res-sdl/toolbuy.BMP Binary files differnew file mode 100644 index 0000000000..07e9273721 --- /dev/null +++ b/indra/newview/res-sdl/toolbuy.BMP diff --git a/indra/newview/res-sdl/toolopen.BMP b/indra/newview/res-sdl/toolopen.BMP Binary files differnew file mode 100644 index 0000000000..5b87979304 --- /dev/null +++ b/indra/newview/res-sdl/toolopen.BMP diff --git a/indra/newview/res-sdl/toolsit.BMP b/indra/newview/res-sdl/toolsit.BMP Binary files differnew file mode 100644 index 0000000000..8ce59ae97a --- /dev/null +++ b/indra/newview/res-sdl/toolsit.BMP diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index 7a965cf57e..ecdcacec46 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -129,8 +129,8 @@ TOOLBUY CURSOR "toolbuy.cur" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,3422 - PRODUCTVERSION 2,0,0,3422 + FILEVERSION 2,0,0,203110 + PRODUCTVERSION 2,0,0,203110 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -147,12 +147,12 @@ BEGIN BEGIN VALUE "CompanyName", "Linden Lab" VALUE "FileDescription", "Second Life" - VALUE "FileVersion", "2.0.0.200030" + VALUE "FileVersion", "2.0.0.203110" VALUE "InternalName", "Second Life" VALUE "LegalCopyright", "Copyright © 2001-2008, Linden Research, Inc." VALUE "OriginalFilename", "SecondLife.exe" VALUE "ProductName", "Second Life" - VALUE "ProductVersion", "2.0.0.200030" + VALUE "ProductVersion", "2.0.0.203110" END END BLOCK "VarFileInfo" diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index fcf5cfadb2..0a906a8063 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -61,7 +61,7 @@ value="0.26 0.345 0.263 1" /> <color name="Red" - value="0.729 0 0.121 1" /> + value="1 0 0 1" /> <color name="Blue" value="0 0 1 1" /> @@ -197,7 +197,7 @@ value="0.5 0.5 0.5 1" /> <color name="ColorPaletteEntry03" - value="0.3344 0.5456 0.5159 1" /> + value="0.5 0 0 1" /> <color name="ColorPaletteEntry04" value="0.5 0.5 0 1" /> @@ -239,7 +239,7 @@ reference="LtYellow" /> <color name="ColorPaletteEntry17" - reference="LtGreen" /> + reference="White" /> <color name="ColorPaletteEntry18" reference="LtGray" /> @@ -248,7 +248,7 @@ reference="Red" /> <color name="ColorPaletteEntry20" - reference=".5 .5 1 0" /> + reference="Yellow" /> <color name="ColorPaletteEntry21" reference="Green" /> @@ -524,7 +524,7 @@ reference="Unused?" /> <color name="NetMapBackgroundColor" - value="0 0 0 0.3" /> + value="0 0 0 0" /> <color name="NetMapGroupOwnAboveWater" reference="Purple" /> diff --git a/indra/newview/skins/default/textures/arrow_down.tga b/indra/newview/skins/default/textures/arrow_down.tga Binary files differdeleted file mode 100644 index 81dc9d3b6c..0000000000 --- a/indra/newview/skins/default/textures/arrow_down.tga +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png Binary files differdeleted file mode 100644 index 4d4f1e1bee..0000000000 --- a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_1.png b/indra/newview/skins/default/textures/icons/Progress_1.png Binary files differdeleted file mode 100644 index 58b56003c4..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_1.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_10.png b/indra/newview/skins/default/textures/icons/Progress_10.png Binary files differdeleted file mode 100644 index 07fe0be8a3..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_10.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_11.png b/indra/newview/skins/default/textures/icons/Progress_11.png Binary files differdeleted file mode 100644 index 215d68cc46..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_11.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_12.png b/indra/newview/skins/default/textures/icons/Progress_12.png Binary files differdeleted file mode 100644 index d755588621..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_12.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_2.png b/indra/newview/skins/default/textures/icons/Progress_2.png Binary files differdeleted file mode 100644 index 6640ee227b..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_2.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_3.png b/indra/newview/skins/default/textures/icons/Progress_3.png Binary files differdeleted file mode 100644 index 5decbe977e..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_3.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_4.png b/indra/newview/skins/default/textures/icons/Progress_4.png Binary files differdeleted file mode 100644 index 56e81c17aa..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_4.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_5.png b/indra/newview/skins/default/textures/icons/Progress_5.png Binary files differdeleted file mode 100644 index a89bf2ac62..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_5.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_6.png b/indra/newview/skins/default/textures/icons/Progress_6.png Binary files differdeleted file mode 100644 index 233c479540..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_6.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_7.png b/indra/newview/skins/default/textures/icons/Progress_7.png Binary files differdeleted file mode 100644 index 631d7a6819..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_7.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_8.png b/indra/newview/skins/default/textures/icons/Progress_8.png Binary files differdeleted file mode 100644 index ac0e3f13f7..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_8.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/icons/Progress_9.png b/indra/newview/skins/default/textures/icons/Progress_9.png Binary files differdeleted file mode 100644 index 17fb4a0335..0000000000 --- a/indra/newview/skins/default/textures/icons/Progress_9.png +++ /dev/null diff --git a/indra/newview/skins/default/textures/locked_image.j2c b/indra/newview/skins/default/textures/locked_image.j2c Binary files differdeleted file mode 100644 index 9e8998d675..0000000000 --- a/indra/newview/skins/default/textures/locked_image.j2c +++ /dev/null diff --git a/indra/newview/skins/default/textures/map_infohub.tga b/indra/newview/skins/default/textures/map_infohub.tga Binary files differdeleted file mode 100644 index 545b8e532c..0000000000 --- a/indra/newview/skins/default/textures/map_infohub.tga +++ /dev/null diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index fed326c25e..41bcc62220 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -1,4 +1,4 @@ -<!-- +<!-- This file contains metadata about how to load, display, and scale textures for rendering in the UI. Images do *NOT* have to appear in this file in order to use them as textures in the UI...simply refer to them by filename (relative to textures directory). @@ -46,13 +46,9 @@ with the same filename but different name <texture name="AddItem_Press" file_name="icons/AddItem_Press.png" preload="false" /> <texture name="Arrow_Left_Off" file_name="navbar/Arrow_Left_Off.png" preload="true" /> - <texture name="Arrow_Left_Press" file_name="navbar/Arrow_Left_Press.png" preload="true" /> <texture name="Arrow_Right_Off" file_name="navbar/Arrow_Right_Off.png" preload="true" /> - <texture name="Arrow_Right_Press" file_name="navbar/Arrow_Right_Press.png" preload="true" /> <!-- - <texture name="Arrow_Left" file_name="widgets/Arrow_Left.png" preload="true" /> - <texture name="Arrow_Right" file_name="widgets/Arrow_Right.png" preload="true" /> --> <texture name="Arrow_Small_Up" file_name="widgets/Arrow_Small_Up.png" preload="true" /> @@ -64,49 +60,28 @@ with the same filename but different name <texture name="AudioMute_Off" file_name="icons/AudioMute_Off.png" preload="false" /> <texture name="AudioMute_Over" file_name="icons/AudioMute_Over.png" preload="false" /> - <texture name="AudioMute_Press" file_name="icons/AudioMute_Press.png" preload="false" /> <texture name="Audio_Off" file_name="icons/Audio_Off.png" preload="false" /> - <texture name="Audio_Over" file_name="icons/Audio_Over.png" preload="false" /> <texture name="Audio_Press" file_name="icons/Audio_Press.png" preload="false" /> <texture name="Avaline_Icon" file_name="icons/avaline_default_icon.jpg" preload="true" /> - <texture name="BackArrow_Disabled" file_name="icons/BackArrow_Disabled.png" preload="false" /> <texture name="BackArrow_Off" file_name="icons/BackArrow_Off.png" preload="false" /> - <texture name="BackArrow_Press" file_name="icons/BackArrow_Press.png" preload="false" /> <texture name="Blank" file_name="Blank.png" preload="false" /> - <texture name="BottomTray_BG" file_name="bottomtray/BottomTray_BG.png" preload="false" /> - <texture name="BottomTray_Scroll_Right" file_name="navbar/Arrow_Right_Off.png" preload="false" /> - <texture name="BottomTray_Scroll_Left" file_name="navbar/Arrow_Left_Off.png" preload="false" /> - <texture name="BuyArrow_Off" file_name="navbar/BuyArrow_Off.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" /> <texture name="BuyArrow_Over" file_name="navbar/BuyArrow_Over.png" preload="true" scale.left="0" scale.top="1" scale.right="0" scale.bottom="0" /> <texture name="BuyArrow_Press" file_name="navbar/BuyArrow_Press.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" /> - <texture name="Cam_Avatar_Disabled" file_name="bottomtray/Cam_Avatar_Disabled.png" preload="false" /> - <texture name="Cam_Avatar_Over" file_name="bottomtray/Cam_Avatar_Over.png" preload="false" /> <texture name="Cam_Avatar_Off" file_name="bottomtray/Cam_Avatar_Off.png" preload="false" /> - <texture name="Cam_Avatar_Press" file_name="bottomtray/Cam_Avatar_Press.png" preload="false" /> - <texture name="Cam_FreeCam_Disabled" file_name="bottomtray/Cam_FreeCam_Disabled.png" preload="false" /> <texture name="Cam_FreeCam_Off" file_name="bottomtray/Cam_FreeCam_Off.png" preload="false" /> - <texture name="Cam_FreeCam_Over" file_name="bottomtray/Cam_FreeCam_Over.png" preload="false" /> - <texture name="Cam_FreeCam_Press" file_name="bottomtray/Cam_FreeCam_Press.png" preload="false" /> - <texture name="Cam_Orbit_Disabled" file_name="bottomtray/Cam_Orbit_Disabled.png" preload="false" /> <texture name="Cam_Orbit_Off" file_name="bottomtray/Cam_Orbit_Off.png" preload="false" /> - <texture name="Cam_Orbit_Over" file_name="bottomtray/Cam_Orbit_Over.png" preload="false" /> - <texture name="Cam_Orbit_Press" file_name="bottomtray/Cam_Orbit_Press.png" preload="false" /> - <texture name="Cam_Pan_Disabled" file_name="bottomtray/Cam_Pan_Disabled.png" preload="false" /> <texture name="Cam_Pan_Off" file_name="bottomtray/Cam_Pan_Off.png" preload="false" /> - <texture name="Cam_Pan_Over" file_name="bottomtray/CCam_Pan_Over.png" preload="false" /> - <texture name="Cam_Pan_Press" file_name="bottomtray/Cam_Pan_Press.png" preload="false" /> <texture name="Cam_Preset_Back_Off" file_name="bottomtray/Cam_Preset_Back_Off.png" preload="false" /> <texture name="Cam_Preset_Back_On" file_name="bottomtray/Cam_Preset_Back_On.png" preload="false" /> <texture name="Cam_Preset_Eye_Off" file_name="bottomtray/Cam_Preset_Eye_Off.png" preload="false" /> - <texture name="Cam_Preset_Eye_On" file_name="bottomtray/Cam_Preset_Eye_On.png" preload="false" /> <texture name="Cam_Preset_Front_Off" file_name="bottomtray/Cam_Preset_Front_Off.png" preload="false" /> <texture name="Cam_Preset_Front_On" file_name="bottomtray/Cam_Preset_Front_On.png" preload="false" /> <texture name="Cam_Preset_Side_Off" file_name="bottomtray/Cam_Preset_Side_Off.png" preload="false" /> @@ -116,8 +91,6 @@ with the same filename but different name <texture name="Cam_Rotate_Out" file_name="bottomtray/Cam_Rotate_Out.png" preload="false" /> <texture name="Cam_Tracking_In" file_name="bottomtray/Cam_Tracking_In.png" preload="false" /> <texture name="Cam_Tracking_Out" file_name="bottomtray/Cam_Tracking_Out.png" preload="false" /> - <texture name="CameraView_Off" file_name="bottomtray/CameraView_Off.png" preload="false" /> - <texture name="CameraView_Over" file_name="bottomtray/CameraView_Over.png" preload="false" /> <texture name="Checkbox_Off_Disabled" file_name="widgets/Checkbox_Disabled.png" preload="true" /> <texture name="Checkbox_On_Disabled" file_name="widgets/Checkbox_On_Disabled.png" preload="true" /> @@ -127,8 +100,6 @@ with the same filename but different name <texture name="Checkbox_Press" file_name="widgets/Checkbox_Press.png" preload="true" /> <texture name="ComboButton_Disabled" file_name="widgets/ComboButton_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="ComboButton_Over" file_name="widgets/ComboButton_Over.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="ComboButton_Press" file_name="widgets/ComboButton_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_Selected" file_name="widgets/ComboButton_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_UpSelected" file_name="widgets/ComboButton_UpSelected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_Up_On_Selected" file_name="widgets/ComboButton_Up_On_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> @@ -136,25 +107,18 @@ with the same filename but different name <texture name="ComboButton_UpOff" file_name="widgets/ComboButton_UpOff.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="Container" file_name="containers/Container.png" preload="false" /> - <texture name="DisclosureArrow_Closed_Off" file_name="widgets/DisclosureArrow_Closed_Off.png" preload="true" /> - <texture name="DisclosureArrow_Closed_Press" file_name="widgets/DisclosureArrow_Closed_Press.png" preload="true" /> <texture name="DisclosureArrow_Opened_Off" file_name="widgets/DisclosureArrow_Opened_Off.png" preload="true" /> - <texture name="DisclosureArrow_Opened_Press" file_name="widgets/DisclosureArrow_Opened_Press.png" preload="true" /> <texture name="DownArrow" file_name="bottomtray/DownArrow.png" preload="false" /> <texture name="DropDown_Disabled" file_name="widgets/DropDown_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" /> - <texture name="DropDown_Over" file_name="widgets/DropDown_Over.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" /> <texture name="DropDown_Press" file_name="widgets/DropDown_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" /> - <texture name="DropDown_Selected" file_name="widgets/DropDown_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" /> <texture name="DropDown_On" file_name="widgets/DropDown_On.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" /> <texture name="DropDown_Off" file_name="widgets/DropDown_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" /> <texture name="DropTarget" file_name="widgets/DropTarget.png" preload="false" /> <texture name="ExternalBrowser_Off" file_name="icons/ExternalBrowser_Off.png" preload="false" /> - <texture name="ExternalBrowser_Over" file_name="icons/ExternalBrowser_Over.png" preload="false" /> - <texture name="ExternalBrowser_Press" file_name="icons/ExternalBrowser_Press.png" preload="false" /> <texture name="Favorite_Star_Active" file_name="navbar/Favorite_Star_Active.png" preload="false" /> <texture name="Favorite_Star_Off" file_name="navbar/Favorite_Star_Off.png" preload="false" /> @@ -162,8 +126,6 @@ with the same filename but different name <texture name="Favorite_Star_Over" file_name="navbar/Favorite_Star_Over.png" preload="false" /> <texture name="Favorite_Link_Over" file_name="navbar/Favorite_Link_Over.png" preload="false" /> - <texture name="FileMenu_BarSelect" file_name="navbar/FileMenu_BarSelect.png" preload="false" scale.left="2" scale.top="0" scale.right="2" scale.bottom="0" /> - <texture name="FileMenu_BG" file_name="navbar/FileMenu_BG.png" preload="false" /> <texture name="Flag" file_name="navbar/Flag.png" preload="false" /> @@ -174,22 +136,16 @@ with the same filename but different name <texture name="Generic_Group" file_name="icons/Generic_Group.png" preload="false" /> <texture name="icon_group.tga" file_name="icons/Generic_Group.png" preload="false" /> - <texture name="Generic_Group_Large" file_name="icons/Generic_Group_Large.png" preload="false" /> - <texture name="Generic_Object_Medium" file_name="icons/Generic_Object_Medium.png" preload="false" /> <texture name="Generic_Object_Small" file_name="icons/Generic_Object_Small.png" preload="false" /> - <texture name="Generic_Object_Large" file_name="icons/Generic_Object_Large.png" preload="false" /> <texture name="Generic_Person" file_name="icons/Generic_Person.png" preload="false" /> <texture name="Generic_Person_Large" file_name="icons/Generic_Person_Large.png" preload="false" /> <texture name="Health" file_name="icons/Health.png" preload="false" /> - <texture name="Help_Off" file_name="navbar/Help_Off.png" preload="false" /> <texture name="Help_Press" file_name="navbar/Help_Press.png" preload="false" /> - <texture name="History_Arrow" file_name="navbar/History_Arrow.png" preload="true" /> <texture name="Home_Off" file_name="navbar/Home_Off.png" preload="false" /> - <texture name="Home_Press" file_name="navbar/Home_Press.png" preload="false" /> <texture name="Icon_Close_Foreground" file_name="windows/Icon_Close_Foreground.png" preload="true" /> <texture name="Icon_Close_Press" file_name="windows/Icon_Close_Press.png" preload="true" /> @@ -206,7 +162,6 @@ with the same filename but different name <texture name="Icon_Help_Foreground" file_name="windows/Icon_Help_Foreground.png" preload="true" /> <texture name="Icon_Help_Press" file_name="windows/Icon_Help_Press.png" preload="true" /> - <texture name="Icon_Info" file_name="windows/Icon_Info.png" preload="false" /> <texture name="Icon_Minimize_Foreground" file_name="windows/Icon_Minimize_Foreground.png" preload="true" /> <texture name="Icon_Minimize_Press" file_name="windows/Icon_Minimize_Press.png" preload="true" /> @@ -225,13 +180,11 @@ with the same filename but different name <texture name="Inspector_Hover" file_name="windows/Inspector_Hover.png" preload="false" /> <texture name="Inspector_I" file_name="windows/Inspector_I.png" preload="false" /> - <texture name="Inv_Acessories" file_name="icons/Inv_Accessories.png" preload="false" /> <texture name="Inv_Alpha" file_name="icons/Inv_Alpha.png" preload="false" /> <texture name="Inv_Animation" file_name="icons/Inv_Animation.png" preload="false" /> <texture name="Inv_BodyShape" file_name="icons/Inv_BodyShape.png" preload="false" /> <texture name="Inv_CallingCard" file_name="icons/Inv_CallingCard.png" preload="false" /> <texture name="Inv_Clothing" file_name="icons/Inv_Clothing.png" preload="false" /> - <texture name="Inv_DangerousScript" file_name="icons/Inv_DangerousScript.png" preload="false" /> <texture name="Inv_Eye" file_name="icons/Inv_Eye.png" preload="false" /> <texture name="Inv_FolderClosed" file_name="icons/Inv_FolderClosed.png" preload="false" /> <texture name="Inv_FolderOpen" file_name="icons/Inv_FolderOpen.png" preload="false" /> @@ -239,7 +192,6 @@ with the same filename but different name <texture name="Inv_Gloves" file_name="icons/Inv_Gloves.png" preload="false" /> <texture name="Inv_Hair" file_name="icons/Inv_Hair.png" preload="false" /> <texture name="Inv_LinkItem" file_name="icons/Inv_LinkItem.png" preload="false" /> - <texture name="Inv_LinkItem_Broken" file_name="icons/Inv_LinkItem_Broken.png" preload="false" /> <texture name="Inv_LinkFolder" file_name="icons/Inv_LinkFolder.png" preload="false" /> <texture name="Inv_Jacket" file_name="icons/Inv_Jacket.png" preload="false" /> <texture name="Inv_LookFolderOpen" file_name="icons/Inv_LookFolderOpen.png" preload="false" /> @@ -259,7 +211,6 @@ with the same filename but different name <texture name="Inv_Sound" file_name="icons/Inv_Sound.png" preload="false" /> <texture name="Inv_Tattoo" file_name="icons/Inv_Tattoo.png" preload="false" /> <texture name="Inv_Texture" file_name="icons/Inv_Texture.png" preload="false" /> - <texture name="Inv_Trash" file_name="icons/Inv_Trash.png" preload="false" /> <texture name="Inv_Underpants" file_name="icons/Inv_Underpants.png" preload="false" /> <texture name="Inv_Undershirt" file_name="icons/Inv_Undershirt.png" preload="false" /> @@ -272,9 +223,7 @@ with the same filename but different name <texture name="Lock" file_name="icons/Lock.png" preload="false" /> <texture name="Lock2" file_name="navbar/Lock.png" preload="false" /> - <texture name="Login_Pod" file_name="windows/Login_Pod.png" preload="true" /> - <texture name="Microphone_Mute" file_name="icons/Microphone_Mute.png" preload="false" /> <texture name="Microphone_On" file_name="icons/Microphone_On.png" preload="false" /> <texture name="MinusItem_Disabled" file_name="icons/MinusItem_Disabled.png" preload="false" /> @@ -283,18 +232,9 @@ with the same filename but different name <texture name="menu_separator" file_name="navbar/FileMenu_Divider.png" scale.left="4" scale.top="166" scale.right="0" scale.bottom="0" /> - <texture name="Move_Fly_Disabled" file_name="bottomtray/Move_Fly_Disabled.png" preload="false" /> <texture name="Move_Fly_Off" file_name="bottomtray/Move_Fly_Off.png" preload="false" /> - <texture name="Move_Fly_Over" file_name="bottomtray/Move_Fly_Over.png" preload="false" /> - <texture name="Move_Fly_Press" file_name="bottomtray/Move_Fly_Press.png" preload="false" /> - <texture name="Move_Run_Disabled" file_name="bottomtray/Move_Run_Disabled.png" preload="false" /> <texture name="Move_Run_Off" file_name="bottomtray/Move_Run_Off.png" preload="false" /> - <texture name="Move_Run_Over" file_name="bottomtray/Move_Run_Over.png" preload="false" /> - <texture name="Move_Run_Press" file_name="bottomtray/Move_Run_Press.png" preload="false" /> - <texture name="Move_Walk_Disabled" file_name="bottomtray/Move_Walk_Disabled.png" preload="false" /> <texture name="Move_Walk_Off" file_name="bottomtray/Move_Walk_Off.png" preload="false" /> - <texture name="Move_Walk_Over" file_name="bottomtray/Move_Walk_Over.png" preload="false" /> - <texture name="Move_Walk_Press" file_name="bottomtray/Move_Walk_Press.png" preload="false" /> <texture name="Movement_Backward_Off" file_name="bottomtray/Movement_Backward_Off.png" preload="false" /> <texture name="Movement_Backward_On" file_name="bottomtray/Movement_Backward_On.png" preload="false" /> <texture name="Movement_Down_Off" file_name="bottomtray/Movement_Down_Off.png" preload="false" /> @@ -311,10 +251,6 @@ with the same filename but different name <texture name="NavBar_BG_NoFav" file_name="navbar/NavBar_BG_NoFav.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" /> <texture name="NavBar_BG" file_name="navbar/NavBar_BG.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" /> - <texture name="NearbyVoice_Lvl1" file_name="bottomtray/NearbyVoice_Lvl1.png" preload="false" /> - <texture name="NearbyVoice_Lvl2" file_name="bottomtray/NearbyVoice_Lvl2.png" preload="false" /> - <texture name="NearbyVoice_Lvl3" file_name="bottomtray/NearbyVoice_Lvl3.png" preload="false" /> - <texture name="NearbyVoice_On" file_name="bottomtray/NearbyVoice_On.png" preload="false" /> <texture name="Notices_Unread" file_name="bottomtray/Notices_Unread.png" preload="true" /> @@ -356,27 +292,15 @@ with the same filename but different name <texture name="OptionsMenu_Off" file_name="icons/OptionsMenu_Off.png" preload="false" /> <texture name="OptionsMenu_Press" file_name="icons/OptionsMenu_Press.png" preload="false" /> - <texture name="Overhead_Arrow_L" file_name="world/Overhead_Arrow_L.png" preload="false" /> - <texture name="Overhead_Arrow_M" file_name="world/Overhead_Arrow_M.png" preload="false" /> - <texture name="Overhead_Arrow_S" file_name="world/Overhead_Arrow_S.png" preload="false" /> - <texture name="Overhead_L" file_name="world/Overhead_L.png" preload="false" /> - <texture name="Overhead_M" file_name="world/Overhead_M.png" preload="false" /> - <texture name="Overhead_S" file_name="world/Overhead_S.png" preload="false" /> - <texture name="Parcel_Evry_Color" file_name="icons/Parcel_Evry_Color.png" preload="false" /> <texture name="Parcel_Exp_Color" file_name="icons/Parcel_Exp_Color.png" preload="false" /> - <texture name="Parcel_M_Color" file_name="icons/Parcel_M_Color.png" preload="false" /> <texture name="Parcel_Build_Dark" file_name="icons/Parcel_Build_Dark.png" preload="false" /> <texture name="Parcel_BuildNo_Dark" file_name="icons/Parcel_BuildNo_Dark.png" preload="false" /> <texture name="Parcel_Damage_Dark" file_name="icons/Parcel_Damage_Dark.png" preload="false" /> <texture name="Parcel_DamageNo_Dark" file_name="icons/Parcel_DamageNo_Dark.png" preload="false" /> - <texture name="Parcel_Evry_Dark" file_name="icons/Parcel_Evry_Dark.png" preload="false" /> - <texture name="Parcel_Exp_Dark" file_name="icons/Parcel_Exp_Dark.png" preload="false" /> <texture name="Parcel_Fly_Dark" file_name="icons/Parcel_Fly_Dark.png" preload="false" /> <texture name="Parcel_FlyNo_Dark" file_name="icons/Parcel_FlyNo_Dark.png" preload="false" /> - <texture name="Parcel_ForSale_Dark" file_name="icons/Parcel_ForSale_Dark.png" preload="false" /> - <texture name="Parcel_ForSaleNo_Dark" file_name="icons/Parcel_ForSaleNo_Dark.png" preload="false" /> <texture name="Parcel_Health_Dark" file_name="icons/Parcel_Health_Dark.png" preload="false" /> <texture name="Parcel_M_Dark" file_name="icons/Parcel_M_Dark.png" preload="false" /> <texture name="Parcel_PG_Dark" file_name="icons/Parcel_PG_Dark.png" preload="false" /> @@ -388,22 +312,13 @@ with the same filename but different name <texture name="Parcel_Voice_Dark" file_name="icons/Parcel_Voice_Dark.png" preload="false" /> <texture name="Parcel_VoiceNo_Dark" file_name="icons/Parcel_VoiceNo_Dark.png" preload="false" /> - <texture name="Parcel_Build_Light" file_name="icons/Parcel_Build_Light.png" preload="false" /> <texture name="Parcel_BuildNo_Light" file_name="icons/Parcel_BuildNo_Light.png" preload="false" /> - <texture name="Parcel_Damage_Light" file_name="icons/Parcel_Damage_Light.png" preload="false" /> - <texture name="Parcel_DamageNo_Light" file_name="icons/Parcel_DamageNo_Light.png" preload="false" /> - <texture name="Parcel_Evry_Light" file_name="icons/Parcel_Evry_Light.png" preload="false" /> - <texture name="Parcel_Exp_Light" file_name="icons/Parcel_Exp_Light.png" preload="false" /> - <texture name="Parcel_Fly_Light" file_name="icons/Parcel_Fly_Light.png" preload="false" /> <texture name="Parcel_FlyNo_Light" file_name="icons/Parcel_FlyNo_Light.png" preload="false" /> <texture name="Parcel_ForSale_Light" file_name="icons/Parcel_ForSale_Light.png" preload="false" /> - <texture name="Parcel_ForSaleNo_Light" file_name="icons/Parcel_ForSaleNo_Light.png" preload="false" /> <texture name="Parcel_M_Light" file_name="icons/Parcel_M_Light.png" preload="false" /> <texture name="Parcel_PG_Light" file_name="icons/Parcel_PG_Light.png" preload="false" /> - <texture name="Parcel_Push_Light" file_name="icons/Parcel_Push_Light.png" preload="false" /> <texture name="Parcel_PushNo_Light" file_name="icons/Parcel_PushNo_Light.png" preload="false" /> <texture name="Parcel_R_Light" file_name="icons/Parcel_R_Light.png" preload="false" /> - <texture name="Parcel_Scripts_Light" file_name="icons/Parcel_Scripts_Light.png" preload="false" /> <texture name="Parcel_ScriptsNo_Light" file_name="icons/Parcel_ScriptsNo_Dark.png" preload="false" /> <texture name="Parcel_Voice_Light" file_name="icons/Parcel_Voice_Light.png" preload="false" /> <texture name="Parcel_VoiceNo_Light" file_name="icons/Parcel_VoiceNo_Light.png" preload="false" /> @@ -415,18 +330,6 @@ with the same filename but different name <texture name="Play_Over" file_name="icons/Play_Over.png" preload="false" /> <texture name="Play_Press" file_name="icons/Play_Press.png" preload="false" /> - <texture name="Progress_1" file_name="icons/Progress_1.png" preload="false" /> - <texture name="Progress_2" file_name="icons/Progress_2.png" preload="false" /> - <texture name="Progress_3" file_name="icons/Progress_3.png" preload="false" /> - <texture name="Progress_4" file_name="icons/Progress_4.png" preload="false" /> - <texture name="Progress_5" file_name="icons/Progress_5.png" preload="false" /> - <texture name="Progress_6" file_name="icons/Progress_6.png" preload="false" /> - <texture name="Progress_7" file_name="icons/Progress_7.png" preload="false" /> - <texture name="Progress_8" file_name="icons/Progress_8.png" preload="false" /> - <texture name="Progress_9" file_name="icons/Progress_9.png" preload="false" /> - <texture name="Progress_10" file_name="icons/Progress_10.png" preload="false" /> - <texture name="Progress_11" file_name="icons/Progress_11.png" preload="false" /> - <texture name="Progress_12" file_name="icons/Progress_12.png" preload="false" /> <texture name="ProgressBar" file_name="widgets/ProgressBar.png" preload="true" scale.left="4" scale.top="10" scale.right="48" scale.bottom="2" /> <texture name="ProgressTrack" file_name="widgets/ProgressTrack.png" preload="true" scale.left="4" scale.top="13" scale.right="148" scale.bottom="2" /> @@ -435,7 +338,6 @@ with the same filename but different name <texture name="PushButton_Off" file_name="widgets/PushButton_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> <texture name="PushButton_On" file_name="widgets/PushButton_On.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> <texture name="PushButton_On_Selected" file_name="widgets/PushButton_On_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> - <texture name="PushButton_On_Disabled" file_name="widgets/PushButton_On_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> <texture name="PushButton_Press" file_name="widgets/PushButton_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> <texture name="PushButton_Selected" file_name="widgets/PushButton_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> <texture name="PushButton_Selected_Press" file_name="widgets/PushButton_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> @@ -448,12 +350,8 @@ with the same filename but different name <texture name="RadioButton_Disabled" file_name="widgets/RadioButton_Disabled.png" preload="true" /> <texture name="RadioButton_On_Disabled" file_name="widgets/RadioButton_On_Disabled.png" preload="true" /> - <texture name="Rec_Off" file_name="icons/Rec_Off.png" preload="false" /> - <texture name="Rec_On" file_name="icons/Rec_On.png" preload="false" /> - <texture name="Refresh_Disabled" file_name="icons/Refresh_Disabled.png" preload="false" /> <texture name="Refresh_Off" file_name="icons/Refresh_Off.png" preload="false" /> - <texture name="Refresh_Press" file_name="icons/Refresh_Press.png" preload="false" /> <texture name="Resize_Corner" file_name="windows/Resize_Corner.png" preload="true" /> @@ -470,11 +368,6 @@ with the same filename but different name <texture name="ScrollTrack_Vert" file_name="widgets/ScrollTrack_Vert.png" preload="true" scale.left="2" scale.top="40" scale.bottom="13" scale.right="0" /> <texture name="ScrollTrack_Horiz" file_name="widgets/ScrollTrack_Horiz.png" preload="true" scale.left="4" scale.top="0" scale.bottom="0" scale.right="2" /> - <texture name="ScrubberThumb_Disabled" file_name="widgets/ScrubberThumb_Disabled.png" preload="false" /> - <texture name="ScrubberThumb_Focus" file_name="widgets/ScrubberThumb_Focus.png" preload="false" /> - <texture name="ScrubberThumb_Off" file_name="widgets/ScrubberThumb_Off.png" preload="false" /> - <texture name="ScrubberThumb_Over" file_name="widgets/ScrubberThumb_Over.png" preload="false" /> - <texture name="ScrubberThumb_Press" file_name="widgets/ScrubberThumb_Press.png" preload="false" /> <texture name="Search" file_name="navbar/Search.png" preload="false" /> @@ -487,8 +380,6 @@ with the same filename but different name <texture name="SegmentedBtn_Left_Selected_Press" file_name="widgets/SegmentedBtn_Left_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Left_Selected_Disabled" file_name="widgets/SegmentedBtn_Left_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Middle_Off" file_name="widgets/SegmentedBtn_Middle_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Middle_Press" file_name="widgets/SegmentedBtn_Middle_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Middle_Disabled" file_name="widgets/SegmentedBtn_Middle_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Middle_Selected" file_name="widgets/SegmentedBtn_Middle_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Middle_Selected_Press" file_name="widgets/SegmentedBtn_Middle_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> @@ -503,11 +394,7 @@ with the same filename but different name <texture name="SegmentedBtn_Right_Selected_Disabled" file_name="widgets/SegmentedBtn_Right_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SkipBackward_Off" file_name="icons/SkipBackward_Off.png" preload="false" /> - <texture name="SkipBackward_Over" file_name="icons/SkipBackward_Over.png" preload="false" /> - <texture name="SkipBackward_Press" file_name="icons/SkipBackward_Press.png" preload="false" /> <texture name="SkipForward_Off" file_name="icons/SkipForward_Off.png" preload="false" /> - <texture name="SkipForward_Over" file_name="icons/SkipForward_Over.png" preload="false" /> - <texture name="SkipForward_Press" file_name="icons/SkipForward_Press.png" preload="false" /> <texture name="SliderTrack_Horiz" file_name="widgets/SliderTrack_Horiz.png" scale.left="4" scale.top="4" scale.right="100" scale.bottom="2" /> <texture name="SliderTrack_Vert" file_name="widgets/SliderTrack_Vert.png" scale.left="2" scale.top="100" scale.right="4" scale.bottom="4" /> @@ -520,63 +407,35 @@ with the same filename but different name <texture name="Unknown_Icon" file_name="icons/unknown_icon.png" preload="true" /> <texture name="Snapshot_Off" file_name="bottomtray/Snapshot_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="Snapshot_Over" file_name="bottomtray/Snapshot_Over.png" preload="false" /> - <texture name="Snapshot_Press" file_name="bottomtray/Snapshot_Press.png" preload="false" /> <texture name="startup_logo" file_name="windows/startup_logo.png" preload="true" /> - <texture name="Stepper_Down_Disabled" file_name="widgets/Stepper_Down_Disabled.png" preload="false" /> <texture name="Stepper_Down_Off" file_name="widgets/Stepper_Down_Off.png" preload="false" /> <texture name="Stepper_Down_Press" file_name="widgets/Stepper_Down_Press.png" preload="false" /> - <texture name="Stepper_Up_Disabled" file_name="widgets/Stepper_Up_Disabled.png" preload="false" /> <texture name="Stepper_Up_Off" file_name="widgets/Stepper_Up_Off.png" preload="false" /> <texture name="Stepper_Up_Press" file_name="widgets/Stepper_Up_Press.png" preload="false" /> <texture name="Stop_Off" file_name="icons/Stop_Off.png" preload="false" /> - <texture name="Stop_Over" file_name="icons/Stop_Over.png" preload="false" /> - <texture name="Stop_Press" file_name="icons/Stop_Press.png" preload="false" /> <texture name="StopReload_Off" file_name="icons/StopReload_Off.png" preload="false" /> <texture name="StopReload_Over" file_name="icons/StopReload_Over.png" preload="false" /> - <texture name="StopReload_Press" file_name="icons/StopReload_Press.png" preload="false" /> - <texture name="TabIcon_Appearance_Large" file_name="taskpanel/TabIcon_Appearance_Large.png" preload="false" /> <texture name="TabIcon_Appearance_Off" file_name="taskpanel/TabIcon_Appearance_Off.png" preload="false" /> - <texture name="TabIcon_Appearance_Over" file_name="taskpanel/TabIcon_Appearance_Over.png" preload="false" /> <texture name="TabIcon_Appearance_Selected" file_name="taskpanel/TabIcon_Appearance_Selected.png" preload="false" /> <texture name="TabIcon_Close_Off" file_name="taskpanel/TabIcon_Close_Off.png" preload="false" /> - <texture name="TabIcon_Close_Over" file_name="taskpanel/TabIcon_Close_Over.png" preload="false" /> - <texture name="TabIcon_Inventory_Large" file_name="taskpanel/TabIcon_Inventory_Large.png" preload="false" /> - <texture name="TabIcon_Inventory_Off" file_name="taskpanel/TabIcon_Inventory_Off.png" preload="false" /> - <texture name="TabIcon_Inventory_Over" file_name="taskpanel/TabIcon_Inventory_Over.png" preload="false" /> - <texture name="TabIcon_Inventory_Selected" file_name="taskpanel/TabIcon_Inventory_Selected.png" preload="false" /> - <texture name="TabIcon_Home_Large" file_name="taskpanel/TabIcon_Home_Large.png" preload="false" /> <texture name="TabIcon_Home_Off" file_name="taskpanel/TabIcon_Home_Off.png" preload="false" /> - <texture name="TabIcon_Home_Over" file_name="taskpanel/TabIcon_Home_Over.png" preload="false" /> <texture name="TabIcon_Home_Selected" file_name="taskpanel/TabIcon_Home_Selected.png" preload="false" /> - <texture name="TabIcon_Me_Large" file_name="taskpanel/TabIcon_Me_Large.png" preload="false" /> <texture name="TabIcon_Me_Off" file_name="taskpanel/TabIcon_Me_Off.png" preload="false" /> - <texture name="TabIcon_Me_Over" file_name="taskpanel/TabIcon_Me_Over.png" preload="false" /> <texture name="TabIcon_Me_Selected" file_name="taskpanel/TabIcon_Me_Selected.png" preload="false" /> <texture name="TabIcon_Open_Off" file_name="taskpanel/TabIcon_Open_Off.png" preload="false" /> - <texture name="TabIcon_Open_Over" file_name="taskpanel/TabIcon_Open_Over.png" preload="false" /> - <texture name="TabIcon_People_Large" file_name="taskpanel/TabIcon_People_Large.png" preload="false" /> <texture name="TabIcon_People_Off" file_name="taskpanel/TabIcon_People_Off.png" preload="false" /> - <texture name="TabIcon_People_Over" file_name="taskpanel/TabIcon_People_Over.png" preload="false" /> <texture name="TabIcon_People_Selected" file_name="taskpanel/TabIcon_People_Selected.png" preload="false" /> <texture name="TabIcon_Places_Large" file_name="taskpanel/TabIcon_Places_Large.png" preload="false" /> <texture name="TabIcon_Places_Off" file_name="taskpanel/TabIcon_Places_Off.png" preload="false" /> - <texture name="TabIcon_Places_Over" file_name="taskpanel/TabIcon_Places_Over.png" preload="false" /> <texture name="TabIcon_Places_Selected" file_name="taskpanel/TabIcon_Places_Selected.png" preload="false" /> - <texture name="TabIcon_Things_Large" file_name="taskpanel/TabIcon_Things_Large.png" preload="false" /> <texture name="TabIcon_Things_Off" file_name="taskpanel/TabIcon_Things_Off.png" preload="false" /> - <texture name="TabIcon_Things_Over" file_name="taskpanel/TabIcon_Things_Over.png" preload="false" /> <texture name="TabIcon_Things_Selected" file_name="taskpanel/TabIcon_Things_Selected.png" preload="false" /> - <texture name="TabTop_Divider" file_name="containers/TabTop_Divider.png" preload="false" /> - <texture name="TabTop_Left_Press" file_name="containers/TabTop_Left_Press.png" preload="false" /> - <texture name="TabTop_Middle_Press" file_name="containers/TabTop_Middle_Press.png" preload="false" /> <texture name="TabTop_Right_Off" file_name="containers/TabTop_Right_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="62" scale.bottom="9" /> - <texture name="TabTop_Right_Press" file_name="containers/TabTop_Right_Press.png" preload="false" /> <texture name="TabTop_Right_Selected" file_name="containers/TabTop_Right_Selected.png" preload="false" scale.left="8" scale.top="8" scale.right="62" scale.bottom="9" /> <texture name="TabTop_Middle_Off" file_name="containers/TabTop_Middle_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9" /> <texture name="TabTop_Middle_Selected" file_name="containers/TabTop_Middle_Selected.png" preload="false" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9" /> @@ -585,8 +444,6 @@ with the same filename but different name <texture name="TaskPanel_Tab_Off" file_name="taskpanel/TaskPanel_Tab_Off.png" preload="false" scale.left="4" scale.top="29" scale.right="36" scale.bottom="4" /> <texture name="TaskPanel_Tab_Selected" file_name="taskpanel/TaskPanel_Tab_Selected.png" preload="false" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" /> - <texture name="TaskPanel_BG" file_name="taskpanel/TaskPanel_BG.png" preload="false" scale.left="4" scale.top="146" scale.right="146" scale.bottom="4" /> - <texture name="TaskPanel_Tab_Unselected" file_name="taskpanel/TaskPanel_Tab_Over.png" preload="false" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" /> <texture name="TextField_Search_Disabled" file_name="widgets/TextField_Search_Disabled.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" /> <texture name="TextField_Off" file_name="widgets/TextField_Off.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" /> @@ -595,7 +452,6 @@ with the same filename but different name <texture name="TextField_Disabled" file_name="widgets/TextField_Disabled.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" /> <texture name="TextField_Active" file_name="widgets/TextField_Active.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" /> - <texture name="TimeBasedMediaBackground" file_name="windows/TimeBasedMediaBackground.png" preload="false" /> <texture name="Toast_CloseBtn" file_name="windows/Toast_CloseBtn.png" preload="true" /> <texture name="Toast_Background" file_name="windows/Toast_Background.png" preload="true" @@ -604,28 +460,19 @@ with the same filename but different name scale.left="4" scale.top="28" scale.right="60" scale.bottom="4" /> <texture name="Tool_Create" file_name="build/Tool_Create.png" preload="false" /> - <texture name="Tool_Create_Selected" file_name="build/Tool_Create_Selected.png" preload="false" /> <texture name="Tool_Dozer" file_name="build/Tool_Dozer.png" preload="false" /> - <texture name="Tool_Dozer_Selected" file_name="build/Tool_Dozer_Selected.png" preload="false" /> <texture name="Tool_Face" file_name="build/Tool_Face.png" preload="false" /> - <texture name="Tool_Face_Selected" file_name="build/Tool_Face_Selected.png" preload="false" /> <texture name="Tool_Grab" file_name="build/Tool_Grab.png" preload="false" /> - <texture name="Tool_Grab_Selected" file_name="build/Tool_Grab_Selected.png" preload="false" /> <texture name="Tool_Zoom" file_name="build/Tool_Zoom.png" preload="false" /> - <texture name="Tool_Zoom_Selected" file_name="build/Tool_Zoom_Selected.png" preload="false" /> - <texture name="Toolbar_Divider" file_name="containers/Toolbar_Divider.png" preload="false" /> <texture name="Toolbar_Left_Off" file_name="containers/Toolbar_Left_Off.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" /> <texture name="Toolbar_Left_Over" file_name="containers/Toolbar_Left_Over.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" /> - <texture name="Toolbar_Left_Press" file_name="containers/Toolbar_Left_Press.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" /> <texture name="Toolbar_Left_Selected" file_name="containers/Toolbar_Left_Selected.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" /> <texture name="Toolbar_Middle_Off" file_name="containers/Toolbar_Middle_Off.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" /> <texture name="Toolbar_Middle_Over" file_name="containers/Toolbar_Middle_Over.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" /> - <texture name="Toolbar_Middle_Press" file_name="containers/Toolbar_Middle_Press.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" /> <texture name="Toolbar_Middle_Selected" file_name="containers/Toolbar_Middle_Selected.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" /> <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" /> <texture name="Toolbar_Right_Over" file_name="containers/Toolbar_Right_Over.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" /> - <texture name="Toolbar_Right_Press" file_name="containers/Toolbar_Right_Press.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" /> <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" /> <texture name="Tooltip" file_name="widgets/Tooltip.png" preload="true" scale.left="2" scale.top="16" scale.right="100" scale.bottom="3" /> @@ -635,7 +482,6 @@ with the same filename but different name <texture name="TrashItem_Press" file_name="icons/TrashItem_Press.png" preload="false" /> <texture name="Unread_Chiclet" file_name="bottomtray/Unread_Chiclet.png" preload="false" /> - <texture name="Unread_Msg" file_name="bottomtray/Unread_Msg.png" preload="false" /> <texture name="Unread_IM" file_name="bottomtray/Unread_IM.png" preload="false" /> <texture name="Volume_Background" file_name="windows/Volume_Background.png" preload="false" @@ -650,10 +496,7 @@ with the same filename but different name <texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> <texture name="WellButton_Lit_Selected" file_name="bottomtray/WellButton_Lit_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> - <texture name="WebBasedMediaBackground" file_name="windows/WebBasedMediaBackground.png" preload="false" /> - <texture name="Widget_DownArrow" file_name="icons/Widget_DownArrow.png" preload="true" /> - <texture name="Widget_UpArrow" file_name="icons/Widget_UpArrow.png" preload="true" /> <texture name="Window_Background" file_name="windows/Window_Background.png" preload="true" scale.left="4" scale.top="24" scale.right="26" scale.bottom="4" /> @@ -667,17 +510,7 @@ with the same filename but different name <texture name="YouAreHere_Badge" file_name="icons/YouAreHere_Badge.png" preload="false" /> <texture name="Zoom_Off" file_name="icons/Zoom_Off.png" preload="false" /> - <texture name="Zoom_Over" file_name="icons/Zoom_Over.png" preload="false" /> - <texture name="Zoom_Press" file_name="icons/Zoom_Press.png" preload="false" /> <texture name="UnZoom_Off" file_name="icons/UnZoom_Off.png" preload="false" /> - <texture name="UnZoom_Over" file_name="icons/UnZoom_Over.png" preload="false" /> - <texture name="UnZoom_Press" file_name="icons/UnZoom_Press.png" preload="false" /> - <texture name="PowerOn_Off" file_name="icons/PowerOn_Off.png" preload="false" /> - <texture name="PowerOn_Over" file_name="icons/PowerOn_Over.png" preload="false" /> - <texture name="PowerOn_Press" file_name="icons/PowerOn_Press.png" preload="false" /> - <texture name="PowerOff_Off" file_name="icons/PowerOff_Off.png" preload="false" /> - <texture name="PowerOff_Over" file_name="icons/PowerOff_Over.png" preload="false" /> - <texture name="PowerOff_Press" file_name="icons/PowerOff_Press.png" preload="false" /> <texture name="pixiesmall.j2c" use_mips="true" /> <texture name="script_error.j2c" use_mips="true" /> @@ -687,7 +520,6 @@ with the same filename but different name <texture name="transparent.j2c" use_mips="true" /> <!--WARNING OLD ART BELOW *do not use*--> - <texture name="icn_chatbar.tga" /> <texture name="icn_media_web.tga" preload="true" /> <texture name="icn_media_movie.tga" preload="true" /> <texture name="icn_speaker-muted_dark.tga" /> @@ -717,8 +549,6 @@ with the same filename but different name <texture name="icn_label_media.tga" /> <texture name="icn_rounded-text-field.tga" scale.left="14" scale.bottom="16" scale.top="16" scale.right="114" /> - <texture name="toggle_button_off" file_name="toggle_button_off.png" preload="true" /> - <texture name="toggle_button_selected" file_name="toggle_button_selected.png" preload="true" /> <texture name="color_swatch_alpha.tga" preload="true" /> <texture name="button_anim_pause.tga" /> @@ -728,15 +558,11 @@ with the same filename but different name <texture name="crosshairs.tga" /> <texture name="direction_arrow.tga" file_name="world/BeaconArrow.png" /> - <texture name="icon_auction.tga" /> <texture name="icon_avatar_offline.tga" /> <texture name="icon_avatar_online.tga" /> <texture name="icon_day_cycle.tga" /> <texture name="icon_diurnal.tga" /> - <texture name="icon_event.tga" /> - <texture name="icon_event_mature.tga" /> <texture name="icon_for_sale.tga" /> - <texture name="icon_place_for_sale.tga" /> <texture name="icon_top_pick.tga" /> <texture name="lag_status_critical.tga" /> @@ -747,7 +573,6 @@ with the same filename but different name <texture name="map_avatar_16.tga" /> <texture name="map_avatar_8.tga" /> - <texture name="map_avatar_you_8.tga" /> <texture name="map_event.tga" /> <texture name="map_event_mature.tga" /> <texture name="map_home.tga" /> @@ -756,15 +581,10 @@ with the same filename but different name <texture name="map_track_16.tga" /> <texture name="notify_caution_icon.tga" /> - <texture name="notify_next.png" preload="true" /> - <texture name="notify_box_icon.tga" /> <texture name="icn_active-speakers-dot-lvl0.tga" /> <texture name="icn_active-speakers-dot-lvl1.tga" /> <texture name="icn_active-speakers-dot-lvl2.tga" /> - <texture name="icn_active-speakers-typing1.tga" /> - <texture name="icn_active-speakers-typing2.tga" /> - <texture name="icn_active-speakers-typing3.tga" /> <texture name="icn_voice_ptt-off.tga" /> <texture name="icn_voice_ptt-on.tga" /> @@ -780,5 +600,4 @@ with the same filename but different name <texture name="default_profile_picture.j2c" /> <texture name="locked_image.j2c" /> - <texture name="media_floater_border_16.png" scale_top="12" scale_left="4" scale_bottom="4" scale_right="12" /> </textures> diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png Binary files differindex db74b93afd..93d62a8d4f 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png Binary files differindex 1032e45f7e..b2b2a77a88 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png Binary files differindex 01dbde102b..67bd399358 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png Binary files differindex 6614bdd165..6fc3744d6b 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png diff --git a/indra/newview/skins/default/xui/da/language_settings.xml b/indra/newview/skins/default/xui/da/language_settings.xml index 71418d446a..fa8a788605 100644 --- a/indra/newview/skins/default/xui/da/language_settings.xml +++ b/indra/newview/skins/default/xui/da/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">danish</string> + <string name="DarwinLocale">da_DK.UTF-8</string> + <string name="LinuxLocale">da_DK.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/de/language_settings.xml b/indra/newview/skins/default/xui/de/language_settings.xml index 71418d446a..3e357007ff 100644 --- a/indra/newview/skins/default/xui/de/language_settings.xml +++ b/indra/newview/skins/default/xui/de/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">german</string> + <string name="DarwinLocale">de_DE.UTF-8</string> + <string name="LinuxLocale">de_DE.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/en/alert_line_editor.xml b/indra/newview/skins/default/xui/en/alert_line_editor.xml index 97991153d8..82bf5fc8da 100644 --- a/indra/newview/skins/default/xui/en/alert_line_editor.xml +++ b/indra/newview/skins/default/xui/en/alert_line_editor.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <line_editor select_on_focus="false" - handle_edit_keys_directly="false" revert_on_esc="true" commit_on_focus_lost="true" ignore_tab="true" diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml index e0f22b4ee2..a55201fd53 100644 --- a/indra/newview/skins/default/xui/en/floater_about.xml +++ b/indra/newview/skins/default/xui/en/floater_about.xml @@ -76,7 +76,7 @@ Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number allow_html="true" follows="top|left" font="SansSerif" - height="350" + height="343" bg_readonly_color="Transparent" left="5" max_length="65536" diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index 51bd7a0a16..59f1889808 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -636,7 +636,6 @@ Leyla Linden </text> length="1" enabled="false" follows="all" - handle_edit_keys_directly="true" height="200" layout="topleft" left="10" diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml index e02d32596a..637f9f55d4 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml @@ -24,13 +24,13 @@ <text type="string" length="1" - follows="top|left" + follows="top|left|right" font="SansSerifHuge" layout="topleft" left="20" height="30" top="25" - width="300" + width="340" name="info_need_more"> You need more L$ </text> @@ -55,7 +55,7 @@ left="20" height="30" top="25" - width="200" + width="300" name="info_buying"> Buy L$ </text> @@ -178,8 +178,8 @@ follows="top|left" height="16" halign="right" - left="140" - width="180" + left="20" + width="300" layout="topleft" name="buy_action"> [ACTION] diff --git a/indra/newview/skins/default/xui/en/floater_buy_land.xml b/indra/newview/skins/default/xui/en/floater_buy_land.xml index 125b080519..df44b61632 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_land.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_land.xml @@ -356,7 +356,6 @@ supports [AMOUNT2] objects length="1" enabled="false" follows="top|right" - handle_edit_keys_directly="false" height="237" layout="topleft" left="444" diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml index 0255e202fb..d9c9d63c72 100644 --- a/indra/newview/skins/default/xui/en/floater_event.xml +++ b/indra/newview/skins/default/xui/en/floater_event.xml @@ -244,6 +244,7 @@ layout="topleft" left="6" name="event_desc" + textbox.label="More" width="322"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</expandable_text> </layout_panel> diff --git a/indra/newview/skins/default/xui/en/floater_god_tools.xml b/indra/newview/skins/default/xui/en/floater_god_tools.xml index 36ef6beb59..240871ec25 100644 --- a/indra/newview/skins/default/xui/en/floater_god_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_god_tools.xml @@ -31,19 +31,6 @@ <button follows="left|top" height="20" - label="Kick all Residents" - label_selected="Kick all Residents" - layout="topleft" - left="10" - name="Kick all users" - top="30" - width="120"> - <button.commit_callback - function="GridTools.KickAll" /> - </button> - <button - follows="left|top" - height="20" label="Flush This Region's Map Visibility Caches" label_selected="Flush This Region's Map Visibility Caches" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml index 5d35275e17..e21e44204d 100644 --- a/indra/newview/skins/default/xui/en/floater_map.xml +++ b/indra/newview/skins/default/xui/en/floater_map.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater + bg_alpha_image_overlay="DkGray_66" legacy_header_height="18" can_minimize="true" can_resize="true" diff --git a/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml index a2938e8574..1d73d516d0 100644 --- a/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml +++ b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml @@ -45,7 +45,6 @@ as a new Outfit: border_style="line" border_thickness="1" follows="left|top" - handle_edit_keys_directly="true" height="23" layout="topleft" left_delta="0" diff --git a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml index e9099211a3..14c0081c0d 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml @@ -72,7 +72,6 @@ max_length="65536" name="Notecard Editor" allow_html="false" - handle_edit_keys_directly="true" tab_group="1" top="46" width="392" diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index dda14f02ff..7dcf2aab99 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -1,395 +1,127 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater legacy_header_height="18" - can_minimize="false" - can_close="true" + can_minimize="true" + can_close="false" follows="left|top" - height="516" + height="340" layout="topleft" name="Snapshot" help_topic="snapshot" save_rect="true" save_visibility="true" - title="SNAPSHOT PREVIEW" - width="215"> - <floater.string - name="unknown"> - unknown - </floater.string> - <radio_group - height="58" - label="Snapshot type" - layout="topleft" - left="10" - name="snapshot_type_radio" - top="25" - width="205"> - <radio_item - bottom="19" - height="16" - label="Email" - layout="topleft" - name="postcard" /> - <radio_item - bottom="38" - height="16" - label="My inventory (L$[AMOUNT])" - layout="topleft" - name="texture" /> - <radio_item - bottom="57" - height="16" - label="Save to my computer" - layout="topleft" - name="local" /> - </radio_group> - <ui_ctrl - height="90" - width="125" + can_dock="true" + title="Snapshot" + width="250"> + <floater.string + name="unknown"> + unknown + </floater.string> + <floater.string + name="share_to_web_url" translate="false"> + http://pdp36.lindenlab.com:12777/ + </floater.string> + <view + height="160" + width="230" layout="topleft" name="thumbnail_placeholder" - top_pad="6" + top_pad="30" follows="left|top" left="10" /> - <text - type="string" - font="SansSerifSmall" - length="1" - follows="left|top" - height="14" - layout="topleft" - right="-5" - left_delta="0" - halign="right" - name="file_size_label" - top_pad="10" - width="195"> - [SIZE] KB - </text> - <button - follows="left|top" + <button + follows="left|top" + height="22" + image_overlay="Refresh_Off" + layout="topleft" + left="20" + top_pad="-30" + name="new_snapshot_btn" + width="23" /> + <line_editor + border_style="line" + border_thickness="1" + follows="left|top" + height="20" + layout="topleft" + left="10" + max_length="500" + name="description" + top_pad="15" + width="230" + label="Description"/> + <button + label="Share Snapshot" + name="share" + top_pad="20" + left="10" + width="130"/> + <button + label="Share to Web" + name="share_to_web" + top_delta="0" + left="10" + width="130"/> + <button + label="Save to My Inventory" + name="save_to_inventory" + top_delta="0" + left="10" + width="130"/> + <button + label="Save Snapshot" + name="save" + top_pad="7" + left="10" + width="130"/> + <button + label="Email Snapshot" + name="share_to_email" + top_delta="0" + left="10" + width="130"/> + <button + label="Save to My Computer" + name="save_to_computer" + top_delta="0" + left="10" + width="130"/> + <button + label="Set As Profile Pic" + name="set_profile_pic" + top_pad="7" + left="10" + width="130"/> + <button + label="Back" + name="cancel" + top_delta="0" + left="10" + width="130"/> + <button + follows="left" height="22" - image_overlay="Refresh_Off" - layout="topleft" - left="10" - name="new_snapshot_btn" - width="23" /> - <button - follows="left|top" - height="23" - label="Send" - layout="topleft" - left_pad="5" - right="-5" - name="send_btn" - width="100" /> - <button - follows="left|top" - height="23" - label="Save (L$[AMOUNT])" - layout="topleft" - right="-5" - name="upload_btn" - top_delta="0" - width="100" /> - <flyout_button - follows="left|top" - height="23" - label="Save" - layout="topleft" - right="-5" - name="save_btn" - tool_tip="Save image to a file" - top_delta="0" - width="100"> - <flyout_button.item - label="Save" - name="save_item" - value="save" /> - <flyout_button.item - label="Save As..." - name="saveas_item" - value="save as" /> - </flyout_button> - <button - follows="left|top" - height="23" - label="More" - layout="topleft" - left="10" - name="more_btn" - tool_tip="Advanced options" - width="80" /> - <button - follows="left|top" - height="23" - label="Less" - layout="topleft" - left_delta="0" - name="less_btn" - tool_tip="Advanced options" - top_delta="0" - width="80" /> - <button - follows="left|top" - height="23" - label="Cancel" - layout="topleft" - right="-5" - left_pad="5" - name="discard_btn" - width="100" /> - <text - type="string" - length="1" - follows="top|left" - height="12" - layout="topleft" - left="10" - name="type_label2" - top_pad="5" - width="127"> - Size - </text> - <text - type="string" - length="1" - follows="top|left" - height="12" - layout="topleft" - left_pad="5" - name="format_label" - top_delta="0" - width="70"> - Format - </text> - <combo_box - height="23" - label="Resolution" - layout="topleft" - left="10" - name="postcard_size_combo" - width="120"> - <combo_box.item - label="Current Window" - name="CurrentWindow" - value="[i0,i0]" /> - <combo_box.item - label="640x480" - name="640x480" - value="[i640,i480]" /> - <combo_box.item - label="800x600" - name="800x600" - value="[i800,i600]" /> - <combo_box.item - label="1024x768" - name="1024x768" - value="[i1024,i768]" /> - <combo_box.item - label="Custom" - name="Custom" - value="[i-1,i-1]" /> - </combo_box> - <combo_box - height="23" - label="Resolution" layout="topleft" - left_delta="0" - name="texture_size_combo" - top_delta="0" - width="127"> - <combo_box.item - label="Current Window" - name="CurrentWindow" - value="[i0,i0]" /> - <combo_box.item - label="Small (128x128)" - name="Small(128x128)" - value="[i128,i128]" /> - <combo_box.item - label="Medium (256x256)" - name="Medium(256x256)" - value="[i256,i256]" /> - <combo_box.item - label="Large (512x512)" - name="Large(512x512)" - value="[i512,i512]" /> - <combo_box.item - label="Custom" - name="Custom" - value="[i-1,i-1]" /> - </combo_box> - <combo_box - height="23" - label="Resolution" - layout="topleft" - left_delta="0" - name="local_size_combo" - top_delta="0" - width="127"> - <combo_box.item - label="Current Window" - name="CurrentWindow" - value="[i0,i0]" /> - <combo_box.item - label="320x240" - name="320x240" - value="[i320,i240]" /> - <combo_box.item - label="640x480" - name="640x480" - value="[i640,i480]" /> - <combo_box.item - label="800x600" - name="800x600" - value="[i800,i600]" /> - <combo_box.item - label="1024x768" - name="1024x768" - value="[i1024,i768]" /> - <combo_box.item - label="1280x1024" - name="1280x1024" - value="[i1280,i1024]" /> - <combo_box.item - label="1600x1200" - name="1600x1200" - value="[i1600,i1200]" /> - <combo_box.item - label="Custom" - name="Custom" - value="[i-1,i-1]" /> - </combo_box> - <combo_box - height="23" - label="Format" - layout="topleft" - left_pad="5" - name="local_format_combo" - width="70"> - <combo_box.item - label="PNG" - name="PNG" /> - <combo_box.item - label="JPEG" - name="JPEG" /> - <combo_box.item - label="BMP" - name="BMP" /> - </combo_box> - <spinner - allow_text_entry="false" - decimal_digits="0" - follows="left|top" - height="20" - increment="32" - label="Width" - label_width="40" - layout="topleft" - left="10" - max_val="6016" - min_val="32" - name="snapshot_width" - top_pad="10" - width="95" /> - <spinner - allow_text_entry="false" - decimal_digits="0" - follows="left|top" - height="20" - increment="32" - label="Height" - label_width="40" + left="210" + name="show_advanced" + image_overlay="TabIcon_Close_Off" + top_delta="1" + width="30"/> + <button + follows="left" + height="22" layout="topleft" - left_pad="5" - max_val="6016" - min_val="32" - name="snapshot_height" + left="210" + visible="false" + name="hide_advanced" + image_overlay="TabIcon_Open_Off" top_delta="0" - width="95" /> - <check_box - bottom_delta="20" - label="Constrain proportions" - layout="topleft" - left="10" - name="keep_aspect_check" /> - <slider - decimal_digits="0" - follows="left|top" - height="15" - increment="1" - initial_value="75" - label="Image quality" - label_width="100" - layout="topleft" - left_delta="0" - max_val="100" - name="image_quality_slider" - top_pad="5" - width="205" /> - <text - type="string" - length="1" - follows="left|top" - height="13" - layout="topleft" - left="10" - name="layer_type_label" - top_pad="5" - width="50"> - Capture: - </text> - <combo_box - height="23" - label="Image Layers" - layout="topleft" - left="30" - name="layer_types" - width="145"> - <combo_box.item - label="Colors" - name="Colors" - value="colors" /> - <combo_box.item - label="Depth" - name="Depth" - value="depth" /> - </combo_box> - <check_box - label="Interface" - layout="topleft" - left="30" - top_pad="10" - width="180" - name="ui_check" /> - <check_box - label="HUDs" - layout="topleft" - left="30" - top_pad="10" - width="180" - name="hud_check" /> - <check_box - label="Keep open after saving" - layout="topleft" - left="10" - top_pad="8" - width="180" - name="keep_open_check" /> - <check_box - label="Freeze frame (fullscreen)" - layout="topleft" - left="10" - top_pad="8" - width="180" - name="freeze_frame_check" /> - <check_box - label="Auto-refresh" - layout="topleft" - left="10" - top_pad="8" - width="180" - name="auto_snapshot_check" /> + width="30"/> + <panel + visible="false" + left="250" + top="17" + name="snapshot_advanced" + filename="panel_snapshot_advanced.xml"/> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml index b730f0e511..548e24efba 100644 --- a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml +++ b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml @@ -14,6 +14,7 @@ name="test_text_editor" tool_tip="text editor" top="25" + word_wrap="true" width="200"> Text Editor </text_editor> diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 957ab240ee..4c67698943 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2701,15 +2701,15 @@ even though the user gets a free copy. <button follows="top|left" tool_tip="Edit this Media" - height="18" - image_disabled="OptionsMenu_Disabled" - image_selected="OptionsMenu_Press" - image_unselected="OptionsMenu_Off" + height="12" + image_disabled="Icon_Gear_Foreground" + image_selected="Icon_Gear_Background" + image_unselected="Icon_Gear_Press" layout="topleft" left_pad="10" name="edit_media" - top_delta="0" - width="18"> + top_delta="3" + width="12"> <button.commit_callback function="BuildTool.EditMedia"/> </button> diff --git a/indra/newview/skins/default/xui/en/floater_ui_preview.xml b/indra/newview/skins/default/xui/en/floater_ui_preview.xml index 3a981adfdf..3b10a57c50 100644 --- a/indra/newview/skins/default/xui/en/floater_ui_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_ui_preview.xml @@ -238,7 +238,6 @@ border_thickness="1" follows="left|bottom" font="SansSerif" - handle_edit_keys_directly="true" height="20" layout="topleft" left_delta="100" @@ -278,7 +277,6 @@ border_thickness="1" follows="left|bottom" font="SansSerif" - handle_edit_keys_directly="true" height="20" layout="topleft" left_delta="100" @@ -320,7 +318,6 @@ border_thickness="1" follows="left|bottom" font="SansSerif" - handle_edit_keys_directly="true" height="20" layout="topleft" left_delta="65" diff --git a/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml b/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml index b4b57f2dbc..71812bd1a6 100644 --- a/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml +++ b/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml @@ -44,7 +44,6 @@ border_style="line" border_thickness="1" follows="left|top" - handle_edit_keys_directly="true" height="23" layout="topleft" left_delta="0" diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml index 00e00b9694..b8a7222e8e 100644 --- a/indra/newview/skins/default/xui/en/inspect_object.xml +++ b/indra/newview/skins/default/xui/en/inspect_object.xml @@ -26,6 +26,7 @@ owner [OWNER] <string name="Touch">Touch</string> <string name="Sit">Sit</string> <text + allow_html="false" follows="all" font="SansSerifLarge" height="16" diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index e8f9d65be5..b2e4a7ad95 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -164,15 +164,6 @@ tab_group="-2" width="1024"/> <panel top="0" - follows="all" - height="768" - mouse_opaque="true" - name="progress_view" - filename="panel_progress.xml" - class="progress_view" - width="1024" - visible="false"/> - <panel top="0" follows="all" mouse_opaque="false" left="0" @@ -193,6 +184,15 @@ <panel top="0" follows="all" height="768" + mouse_opaque="true" + name="progress_view" + filename="panel_progress.xml" + class="progress_view" + width="1024" + visible="false"/> + <panel top="0" + follows="all" + height="768" mouse_opaque="false" name="popup_holder" class="popup_holder" diff --git a/indra/newview/skins/default/xui/en/menu_edit.xml b/indra/newview/skins/default/xui/en/menu_edit.xml new file mode 100644 index 0000000000..68f3cb532c --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_edit.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<menu create_jump_keys="true" + label="Edit" + name="Edit" + visible="false"> + <menu_item_call + label="Undo" + name="Undo" + shortcut="control|Z"> + <menu_item_call.on_click + function="Edit.Undo" /> + <menu_item_call.on_enable + function="Edit.EnableUndo" /> + </menu_item_call> + <menu_item_call + label="Redo" + name="Redo" + shortcut="control|Y"> + <menu_item_call.on_click + function="Edit.Redo" /> + <menu_item_call.on_enable + function="Edit.EnableRedo" /> + </menu_item_call> + <menu_item_separator/> + <menu_item_call + label="Cut" + name="Cut" + shortcut="control|X"> + <menu_item_call.on_click + function="Edit.Cut" /> + <menu_item_call.on_enable + function="Edit.EnableCut" /> + </menu_item_call> + <menu_item_call + label="Copy" + name="Copy" + shortcut="control|C"> + <menu_item_call.on_click + function="Edit.Copy" /> + <menu_item_call.on_enable + function="Edit.EnableCopy" /> + </menu_item_call> + <menu_item_call + label="Paste" + name="Paste" + shortcut="control|V"> + <menu_item_call.on_click + function="Edit.Paste" /> + <menu_item_call.on_enable + function="Edit.EnablePaste" /> + </menu_item_call> + <menu_item_call + label="Delete" + name="Delete" + shortcut="Del"> + <menu_item_call.on_click + function="Edit.Delete" /> + <menu_item_call.on_enable + function="Edit.EnableDelete" /> + </menu_item_call> + <menu_item_call + label="Duplicate" + name="Duplicate" + shortcut="control|D"> + <menu_item_call.on_click + function="Edit.Duplicate" /> + <menu_item_call.on_enable + function="Edit.EnableDuplicate" /> + </menu_item_call> + <menu_item_separator/> + <menu_item_call + label="Select All" + name="Select All" + shortcut="control|A"> + <menu_item_call.on_click + function="Edit.SelectAll" /> + <menu_item_call.on_enable + function="Edit.EnableSelectAll" /> + </menu_item_call> + <menu_item_call + label="Deselect" + name="Deselect" + shortcut="control|E"> + <menu_item_call.on_click + function="Edit.Deselect" /> + <menu_item_call.on_enable + function="Edit.EnableDeselect" /> + </menu_item_call> +</menu>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/menu_group_plus.xml b/indra/newview/skins/default/xui/en/menu_group_plus.xml index e83d07baec..fce7414d80 100644 --- a/indra/newview/skins/default/xui/en/menu_group_plus.xml +++ b/indra/newview/skins/default/xui/en/menu_group_plus.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <menu name="menu_group_plus" left="0" bottom="0" visible="false" - mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false"> + mouse_opaque="false"> <menu_item_call name="item_join" label="Join Group..."> <menu_item_call.on_click function="People.Group.Plus.Action" userdata="join_group" /> </menu_item_call> 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 1b002b1c32..a5ac5f76e1 100644 --- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml @@ -40,6 +40,8 @@ name="teleport"> <menu_item_call.on_click function="InspectAvatar.Teleport"/> + <menu_item_call.on_enable + function="InspectAvatar.Gear.EnableTeleportOffer"/> </menu_item_call> <menu_item_call label="Invite to Group" diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index ba74104594..4655fa8c46 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -29,14 +29,6 @@ function="File.Quit" /> </menu_item_call> </menu> -<!-- Edit menu merged into the Me menu above - <menu - create_jump_keys="true" - label="Edit" - name="Edit" - width="153"> - </menu> ---> <menu create_jump_keys="true" label="Help" @@ -59,105 +51,24 @@ parameter="sl_about" /> </menu_item_call> </menu> + <menu_item_check + label="Show Debug Menu" + name="Show Debug Menu" + visible="false" + shortcut="control|alt|D"> + <on_check + function="CheckControl" + parameter="UseDebugMenus" /> + <on_click + function="ToggleControl" + parameter="UseDebugMenus" /> + </menu_item_check> <menu visible="false" create_jump_keys="true" label="Debug" name="Debug" tear_off="true"> - <!-- Need a copy of the edit menu here so keyboard shortcuts like - control-C work to copy text at login screen and About dialog (for QA) - --> - <menu - create_jump_keys="true" - label="Edit" - name="Edit" - tear_off="true"> - <menu_item_call - label="Undo" - name="Undo" - shortcut="control|Z"> - <menu_item_call.on_click - function="Edit.Undo" /> - <menu_item_call.on_enable - function="Edit.EnableUndo" /> - </menu_item_call> - <menu_item_call - label="Redo" - name="Redo" - shortcut="control|Y"> - <menu_item_call.on_click - function="Edit.Redo" /> - <menu_item_call.on_enable - function="Edit.EnableRedo" /> - </menu_item_call> - <menu_item_separator /> - <menu_item_call - label="Cut" - name="Cut" - shortcut="control|X"> - <menu_item_call.on_click - function="Edit.Cut" /> - <menu_item_call.on_enable - function="Edit.EnableCut" /> - </menu_item_call> - <menu_item_call - label="Copy" - name="Copy" - shortcut="control|C"> - <menu_item_call.on_click - function="Edit.Copy" /> - <menu_item_call.on_enable - function="Edit.EnableCopy" /> - </menu_item_call> - <menu_item_call - label="Paste" - name="Paste" - shortcut="control|V"> - <menu_item_call.on_click - function="Edit.Paste" /> - <menu_item_call.on_enable - function="Edit.EnablePaste" /> - </menu_item_call> - <menu_item_call - label="Delete" - name="Delete" - shortcut="Del"> - <menu_item_call.on_click - function="Edit.Delete" /> - <menu_item_call.on_enable - function="Edit.EnableDelete" /> - </menu_item_call> - <menu_item_call - label="Duplicate" - name="Duplicate" - shortcut="control|D"> - <menu_item_call.on_click - function="Edit.Duplicate" /> - <menu_item_call.on_enable - function="Edit.EnableDuplicate" /> - </menu_item_call> - <menu_item_separator /> - <menu_item_call - label="Select All" - name="Select All" - shortcut="control|A"> - <menu_item_call.on_click - function="Edit.SelectAll" /> - <menu_item_call.on_enable - function="Edit.EnableSelectAll" /> - </menu_item_call> - <menu_item_call - label="Deselect" - name="Deselect" - shortcut="control|E"> - <menu_item_call.on_click - function="Edit.Deselect" /> - <menu_item_call.on_enable - function="Edit.EnableDeselect" /> - </menu_item_call> - </menu> - <menu_item_separator /> <menu_item_call label="Show Debug Settings" name="Debug Settings"> @@ -270,5 +181,27 @@ function="Advanced.WebBrowserTest" parameter="http://join.secondlife.com/"/> </menu_item_call> + <menu_item_separator/> + <menu_item_check + label="Show Grid Picker" + name="Show Grid Picker" + visible="false" + shortcut="control|shift|G"> + <on_check + function="CheckControl" + parameter="ForceShowGrid" /> + <on_click + function="ToggleControl" + parameter="ForceShowGrid" /> + </menu_item_check> + <menu_item_call + label="Show Notifications Console" + name="Show Notifications Console" + visible="false" + shortcut="control|shift|5"> + <on_click + function="Floater.Toggle" + parameter="notifications_console" /> + </menu_item_call> </menu> </menu_bar> diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml index f1117d1419..92752a0fee 100644 --- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <menu name="menu_group_plus" left="0" bottom="0" visible="false" - mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false"> + mouse_opaque="false"> <menu_item_check label="Sort by Name" name="sort_name"> diff --git a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml index df3cb26b04..2efb204ffb 100644 --- a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <menu name="menu_group_plus" left="0" bottom="0" visible="false" - mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false"> + mouse_opaque="false"> <menu_item_check label="Display Group Icons" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml index 014a52bb4f..d2e35e4cc0 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml @@ -88,5 +88,8 @@ name="teleport"> <menu_item_call.on_click function="Avatar.OfferTeleport"/> + <menu_item_call.on_enable + function="Avatar.EnableItem" + parameter="can_offer_teleport"/> </menu_item_call> </context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml index 39f9e48609..69b3831738 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <menu name="menu_group_plus" left="0" bottom="0" visible="false" - mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false"> + mouse_opaque="false"> <menu_item_check label="Sort by Recent Speakers" name="sort_by_recent_speakers"> diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml index cfd6dc78b6..5c9555db92 100644 --- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <menu name="menu_group_plus" left="0" bottom="0" visible="false" - mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false"> + mouse_opaque="false"> <menu_item_check label="Sort by Most Recent" name="sort_most"> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index a08bc16066..8b4554502a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2,16 +2,13 @@ <menu_bar bg_visible="false" follows="left|top|right" - layout="topleft" name="Main Menu"> <menu label="Me" - layout="topleft" name="Me" tear_off="true"> <menu_item_call label="Preferences" - layout="topleft" name="Preferences" shortcut="control|P"> <menu_item_call.on_click @@ -20,7 +17,6 @@ </menu_item_call> <menu_item_call label="My Dashboard" - layout="topleft" name="Manage My Account"> <menu_item_call.on_click function="PromptShowURL" @@ -29,16 +25,13 @@ </menu_item_call> <menu_item_call label="Buy L$" - layout="topleft" name="Buy and Sell L$"> <menu_item_call.on_click function="BuyCurrency" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="My Profile" - layout="topleft" name="Profile"> <menu_item_call.on_click function="ShowAgentProfile" @@ -46,7 +39,6 @@ </menu_item_call> <menu_item_call label="My Appearance" - layout="topleft" name="Appearance"> <menu_item_call.on_click function="CustomizeAvatar" /> @@ -56,7 +48,6 @@ <menu_item_check label="My Inventory" name="Inventory" - layout="topleft" shortcut="control|shift|I" visible="false"> <menu_item_check.on_check @@ -69,7 +60,6 @@ <menu_item_check label="My Inventory" name="ShowSidetrayInventory" - layout="topleft" shortcut="control|I" visible="true"> <menu_item_check.on_check @@ -81,7 +71,6 @@ </menu_item_check> <menu_item_check label="My Gestures" - layout="topleft" name="Gestures" shortcut="control|G"> <menu_item_check.on_check @@ -93,21 +82,17 @@ </menu_item_check> <menu label="My Status" - layout="topleft" name="Status" tear_off="true"> <menu_item_call label="Away" - layout="topleft" name="Set Away"> <menu_item_call.on_click function="World.SetAway" /> </menu_item_call> - <menu_item_separator - layout="topleft"/> + <menu_item_separator/> <menu_item_call label="Busy" - layout="topleft" name="Set Busy"> <menu_item_call.on_click function="World.SetBusy"/> @@ -115,7 +100,6 @@ </menu> <menu_item_call label="Request Admin Status" - layout="topleft" name="Request Admin Options" shortcut="control|alt|G" visible="false"> @@ -124,18 +108,15 @@ </menu_item_call> <menu_item_call label="Leave Admin Status" - layout="topleft" name="Leave Admin Options" shortcut="control|alt|shift|G" visible="false"> <menu_item_call.on_click function="Advanced.LeaveAdminStatus" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Quit [APP_NAME]" - layout="topleft" name="Quit" shortcut="control|Q"> <menu_item_call.on_click @@ -144,12 +125,10 @@ </menu> <menu label="Communicate" - layout="topleft" name="Communicate" tear_off="true"> <menu_item_call label="My Friends" - layout="topleft" name="My Friends" shortcut="control|shift|F"> <menu_item_call.on_click @@ -158,24 +137,21 @@ </menu_item_call> <menu_item_call label="My Groups" - layout="topleft" - name="My Groups"> + name="My Groups" + shortcut="control|shift|G"> <menu_item_call.on_click function="SideTray.PanelPeopleTab" parameter="groups_panel" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <!--menu_item_call label="Chat" - layout="topleft" name="Chat"> <menu_item_call.on_click function="World.Chat" /> </menu_item_call--> <menu_item_check label="Nearby Chat" - layout="topleft" name="Nearby Chat" shortcut="control|H" use_mac_ctrl="true"> @@ -188,7 +164,6 @@ </menu_item_check> <menu_item_call label="Nearby People" - layout="topleft" name="Active Speakers" shortcut="control|shift|A"> <menu_item_call.on_click @@ -198,12 +173,10 @@ </menu> <menu label="World" - layout="topleft" name="World" tear_off="true"> <menu_item_check label="Mini-Map" - layout="topleft" name="Mini-Map" shortcut="control|shift|M"> <menu_item_check.on_check @@ -215,7 +188,6 @@ </menu_item_check> <menu_item_check label="World Map" - layout="topleft" name="World Map" shortcut="control|M" use_mac_ctrl="true"> @@ -228,7 +200,6 @@ </menu_item_check> <menu_item_call label="Snapshot" - layout="topleft" name="Take Snapshot" shortcut="control|shift|S"> <menu_item_call.on_click @@ -237,7 +208,6 @@ </menu_item_call> <menu_item_call label="Landmark This Place" - layout="topleft" name="Create Landmark Here"> <menu_item_call.on_click function="World.CreateLandmark" /> @@ -247,12 +217,10 @@ <menu create_jump_keys="true" label="Place Profile" - layout="topleft" name="Land" tear_off="true"> <menu_item_call label="About Land" - layout="topleft" name="About Land"> <menu_item_call.on_click function="Floater.Show" @@ -260,18 +228,15 @@ </menu_item_call> <menu_item_call label="Region/Estate" - layout="topleft" name="Region/Estate"> <menu_item_call.on_click function="Floater.Show" parameter="region_info" /> </menu_item_call> </menu> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Buy This Land" - layout="topleft" name="Buy Land"> <menu_item_call.on_click function="Land.Buy" /> @@ -280,7 +245,6 @@ </menu_item_call> <menu_item_call label="My Land" - layout="topleft" name="My Land"> <menu_item_call.on_click function="Floater.Show" @@ -289,12 +253,10 @@ <menu create_jump_keys="true" label="Show" - layout="topleft" name="LandShow" tear_off="true"> <menu_item_check label="Move Controls" - layout="topleft" name="Movement Controls"> <menu_item_check.on_check function="Floater.Visible" @@ -304,7 +266,6 @@ </menu_item_check> <menu_item_check label="View Controls" - layout="topleft" name="Camera Controls"> <menu_item_check.on_check function="Floater.Visible" @@ -314,7 +275,6 @@ </menu_item_check> <menu_item_check label="Ban Lines" - layout="topleft" name="Ban Lines"> <menu_item_check.on_check control="ShowBanLines" /> @@ -324,7 +284,6 @@ </menu_item_check> <menu_item_check label="Beacons" - layout="topleft" name="beacons" shortcut="control|alt|shift|N"> <menu_item_check.on_check @@ -336,7 +295,6 @@ </menu_item_check> <menu_item_check label="Property Lines" - layout="topleft" name="Property Lines" shortcut="control|alt|shift|P"> <menu_item_check.on_check @@ -347,7 +305,6 @@ </menu_item_check> <menu_item_check label="Land Owners" - layout="topleft" name="Land Owners"> <menu_item_check.on_check control="ShowParcelOwners" /> @@ -374,11 +331,9 @@ control="NavBarShowParcelProperties" /> </menu_item_check> </menu> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Teleport Home" - layout="topleft" name="Teleport Home" shortcut="control|shift|H"> <menu_item_call.on_click @@ -388,7 +343,6 @@ </menu_item_call> <menu_item_call label="Set Home to Here" - layout="topleft" name="Set Home to Here"> <menu_item_call.on_click function="World.SetHomeLocation" /> @@ -397,7 +351,6 @@ </menu_item_call> <!-- <menu_item_check label="Show Navigation Bar" - layout="topleft" name="ShowNavbarNavigationPanel"> <menu_item_check.on_click function="ToggleControl" @@ -408,7 +361,6 @@ </menu_item_check> <menu_item_check label="Show Favorites Bar" - layout="topleft" name="ShowNavbarFavoritesPanel"> <menu_item_check.on_click function="ToggleControl" @@ -417,19 +369,15 @@ function="CheckControl" parameter="ShowNavbarFavoritesPanel" /> </menu_item_check> - <menu_item_separator - layout="topleft" />--> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> + <menu_item_separator/> <menu create_jump_keys="true" label="Sun" - layout="topleft" name="Environment Settings" tear_off="true"> <menu_item_call label="Sunrise" - layout="topleft" name="Sunrise"> <menu_item_call.on_click function="World.EnvSettings" @@ -437,7 +385,6 @@ </menu_item_call> <menu_item_call label="Midday" - layout="topleft" name="Noon" shortcut="control|shift|Y"> <menu_item_call.on_click @@ -446,7 +393,6 @@ </menu_item_call> <menu_item_call label="Sunset" - layout="topleft" name="Sunset" shortcut="control|shift|N"> <menu_item_call.on_click @@ -455,7 +401,6 @@ </menu_item_call> <menu_item_call label="Midnight" - layout="topleft" name="Midnight"> <menu_item_call.on_click function="World.EnvSettings" @@ -463,17 +408,14 @@ </menu_item_call> <menu_item_call label="Estate Time" - layout="topleft" name="Revert to Region Default"> <menu_item_call.on_click function="World.EnvSettings" parameter="default" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Environment Editor" - layout="topleft" name="Environment Editor"> <menu_item_call.on_click function="World.EnvSettings" @@ -484,13 +426,11 @@ <menu create_jump_keys="true" label="Build" - layout="topleft" name="BuildTools" tear_off="true" visible="true"> <menu_item_check label="Build" - layout="topleft" name="Show Build Tools" shortcut="control|B"> <menu_item_check.on_check @@ -503,12 +443,10 @@ <menu create_jump_keys="true" label="Select Build Tool" - layout="topleft" name="Select Tool" tear_off="true"> <menu_item_call label="Focus Tool" - layout="topleft" name="Focus" shortcut="control|1"> <menu_item_call.on_click @@ -517,7 +455,6 @@ </menu_item_call> <menu_item_call label="Move Tool" - layout="topleft" name="Move" shortcut="control|2"> <menu_item_call.on_click @@ -526,7 +463,6 @@ </menu_item_call> <menu_item_call label="Edit Tool" - layout="topleft" name="Edit" shortcut="control|3"> <menu_item_call.on_click @@ -535,7 +471,6 @@ </menu_item_call> <menu_item_call label="Create Tool" - layout="topleft" name="Create" shortcut="control|4"> <menu_item_call.on_click @@ -544,7 +479,6 @@ </menu_item_call> <menu_item_call label="Land Tool" - layout="topleft" name="Land" shortcut="control|5"> <menu_item_call.on_click @@ -552,112 +486,8 @@ parameter="land" /> </menu_item_call> </menu> - <menu - create_jump_keys="true" - label="Edit" - layout="topleft" - name="Edit" - tear_off="true"> - <menu_item_call - label="Undo" - layout="topleft" - name="Undo" - shortcut="control|Z"> - <menu_item_call.on_click - function="Edit.Undo" /> - <menu_item_call.on_enable - function="Edit.EnableUndo" /> - </menu_item_call> - <menu_item_call - label="Redo" - layout="topleft" - name="Redo" - shortcut="control|Y"> - <menu_item_call.on_click - function="Edit.Redo" /> - <menu_item_call.on_enable - function="Edit.EnableRedo" /> - </menu_item_call> - <menu_item_separator - layout="topleft" /> - <menu_item_call - label="Cut" - layout="topleft" - name="Cut" - shortcut="control|X"> - <menu_item_call.on_click - function="Edit.Cut" /> - <menu_item_call.on_enable - function="Edit.EnableCut" /> - </menu_item_call> - <menu_item_call - label="Copy" - layout="topleft" - name="Copy" - shortcut="control|C"> - <menu_item_call.on_click - function="Edit.Copy" /> - <menu_item_call.on_enable - function="Edit.EnableCopy" /> - </menu_item_call> - <menu_item_call - label="Paste" - layout="topleft" - name="Paste" - shortcut="control|V"> - <menu_item_call.on_click - function="Edit.Paste" /> - <menu_item_call.on_enable - function="Edit.EnablePaste" /> - </menu_item_call> - <menu_item_call - label="Delete" - layout="topleft" - name="Delete" - shortcut="Del"> - <menu_item_call.on_click - function="Edit.Delete" /> - <menu_item_call.on_enable - function="Edit.EnableDelete" /> - </menu_item_call> - <menu_item_call - label="Duplicate" - layout="topleft" - name="Duplicate" - shortcut="control|D"> - <menu_item_call.on_click - function="Edit.Duplicate" /> - <menu_item_call.on_enable - function="Edit.EnableDuplicate" /> - </menu_item_call> - <menu_item_separator - layout="topleft" /> - <menu_item_call - label="Select All" - layout="topleft" - name="Select All" - shortcut="control|A"> - <menu_item_call.on_click - function="Edit.SelectAll" /> - <menu_item_call.on_enable - function="Edit.EnableSelectAll" /> - </menu_item_call> - <menu_item_call - label="Deselect" - layout="topleft" - name="Deselect" - shortcut="control|E"> - <menu_item_call.on_click - function="Edit.Deselect" /> - <menu_item_call.on_enable - function="Edit.EnableDeselect" /> - </menu_item_call> - </menu> - <menu_item_separator - layout="topleft" /> <menu_item_call label="Link" - layout="topleft" name="Link" shortcut="control|L"> <menu_item_call.on_click @@ -667,7 +497,6 @@ </menu_item_call> <menu_item_call label="Unlink" - layout="topleft" name="Unlink" shortcut="control|shift|L"> <menu_item_call.on_click @@ -677,7 +506,6 @@ </menu_item_call> <menu_item_check label="Edit Linked Parts" - layout="topleft" name="Edit Linked Parts"> <menu_item_check.on_check control="EditLinkedParts" /> @@ -687,11 +515,9 @@ <menu_item_check.on_enable function="Tools.EnableToolNotPie" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Focus on Selection" - layout="topleft" name="Focus on Selection" shortcut="H"> <menu_item_call.on_click @@ -702,7 +528,6 @@ </menu_item_call> <menu_item_call label="Zoom to Selection" - layout="topleft" name="Zoom to Selection" shortcut="shift|H"> <menu_item_call.on_click @@ -711,17 +536,14 @@ <menu_item_call.on_enable function="Tools.SomethingSelectedNoHUD" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu create_jump_keys="true" label="Object" - layout="topleft" name="Object" tear_off="true"> <menu_item_call label="Buy" - layout="topleft" name="Menu Object Buy"> <menu_item_call.on_click function="Tools.BuyOrTake"/> @@ -732,7 +554,6 @@ </menu_item_call> <menu_item_call label="Take" - layout="topleft" name="Menu Object Take"> <menu_item_call.on_click function="Tools.BuyOrTake"/> @@ -743,7 +564,6 @@ </menu_item_call> <menu_item_call label="Take Copy" - layout="topleft" name="Take Copy"> <menu_item_call.on_click function="Tools.TakeCopy" /> @@ -752,7 +572,6 @@ </menu_item_call> <menu_item_call label="Save Back to My Inventory" - layout="topleft" name="Save Object Back to My Inventory"> <menu_item_call.on_click function="Tools.SaveToInventory" /> @@ -761,7 +580,6 @@ </menu_item_call> <menu_item_call label="Save Back to Object Contents" - layout="topleft" name="Save Object Back to Object Contents"> <menu_item_call.on_click function="Tools.SaveToObjectInventory" /> @@ -772,12 +590,10 @@ <menu create_jump_keys="true" label="Scripts" - layout="topleft" name="Scripts" tear_off="true"> <menu_item_call label="Recompile Scripts (Mono)" - layout="topleft" name="Mono"> <menu_item_call.on_click function="Tools.SelectedScriptAction" @@ -787,7 +603,6 @@ </menu_item_call> <menu_item_call label="Recompile Scripts (LSL)" - layout="topleft" name="LSL"> <menu_item_call.on_click function="Tools.SelectedScriptAction" @@ -797,7 +612,6 @@ </menu_item_call> <menu_item_call label="Reset Scripts" - layout="topleft" name="Reset Scripts"> <menu_item_call.on_click function="Tools.SelectedScriptAction" @@ -807,7 +621,6 @@ </menu_item_call> <menu_item_call label="Set Scripts to Running" - layout="topleft" name="Set Scripts to Running"> <menu_item_call.on_click function="Tools.SelectedScriptAction" @@ -817,7 +630,6 @@ </menu_item_call> <menu_item_call label="Set Scripts to Not Running" - layout="topleft" name="Set Scripts to Not Running"> <menu_item_call.on_click function="Tools.SelectedScriptAction" @@ -826,17 +638,14 @@ function="EditableSelected" /> </menu_item_call> </menu> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu create_jump_keys="true" label="Options" - layout="topleft" name="Options" tear_off="true"> <menu_item_call label="Set Default Upload Permissions" - layout="topleft" name="perm prefs"> <menu_item_call.on_click function="Floater.Toggle" @@ -844,7 +653,6 @@ </menu_item_call> <menu_item_check label="Show Advanced Permissions" - layout="topleft" name="DebugPermissions"> <menu_item_check.on_check function="CheckControl" @@ -853,11 +661,9 @@ function="ToggleControl" parameter="DebugPermissions" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Select Only My Objects" - layout="topleft" name="Select Only My Objects"> <menu_item_check.on_check control="SelectOwnedOnly" /> @@ -867,7 +673,6 @@ </menu_item_check> <menu_item_check label="Select Only Movable Objects" - layout="topleft" name="Select Only Movable Objects"> <menu_item_check.on_check control="SelectMovableOnly" /> @@ -877,18 +682,15 @@ </menu_item_check> <menu_item_check label="Select By Surrounding" - layout="topleft" name="Select By Surrounding"> <menu_item_check.on_check control="RectangleSelectInclusive" /> <menu_item_check.on_click function="Tools.SelectBySurrounding" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Show Hidden Selection" - layout="topleft" name="Show Hidden Selection"> <menu_item_check.on_check control="RenderHiddenSelections" /> @@ -897,7 +699,6 @@ </menu_item_check> <menu_item_check label="Show Light Radius for Selection" - layout="topleft" name="Show Light Radius for Selection"> <menu_item_check.on_check control="RenderLightRadius" /> @@ -906,7 +707,6 @@ </menu_item_check> <menu_item_check label="Show Selection Beam" - layout="topleft" name="Show Selection Beam"> <menu_item_check.on_check control="ShowSelectionBeam" /> @@ -914,11 +714,9 @@ function="ToggleControl" parameter="ShowSelectionBeam" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Snap to Grid" - layout="topleft" name="Snap to Grid" shortcut="G"> <menu_item_check.on_check @@ -931,7 +729,6 @@ </menu_item_check> <menu_item_call label="Snap Object XY to Grid" - layout="topleft" name="Snap Object XY to Grid" shortcut="shift|X"> <menu_item_call.on_click @@ -941,7 +738,6 @@ </menu_item_call> <menu_item_call label="Use Selection for Grid" - layout="topleft" name="Use Selection for Grid" shortcut="shift|G"> <menu_item_call.on_click @@ -951,7 +747,6 @@ </menu_item_call> <menu_item_call label="Grid Options" - layout="topleft" name="Grid Options" shortcut="control|shift|B"> <menu_item_call.on_click @@ -964,12 +759,10 @@ <menu create_jump_keys="true" label="Select Linked Parts" - layout="topleft" name="Select Linked Parts" tear_off="true"> <menu_item_call label="Select Next Part" - layout="topleft" name="Select Next Part" shortcut="control|."> <menu_item_call.on_click @@ -980,7 +773,6 @@ </menu_item_call> <menu_item_call label="Select Previous Part" - layout="topleft" name="Select Previous Part" shortcut="control|,"> <menu_item_call.on_click @@ -991,7 +783,6 @@ </menu_item_call> <menu_item_call label="Include Next Part" - layout="topleft" name="Include Next Part" shortcut="control|shift|."> <menu_item_call.on_click @@ -1002,7 +793,6 @@ </menu_item_call> <menu_item_call label="Include Previous Part" - layout="topleft" name="Include Previous Part" shortcut="control|shift|,"> <menu_item_call.on_click @@ -1015,48 +805,40 @@ </menu> <menu label="Help" - layout="topleft" name="Help" tear_off="true"> <menu_item_call label="[SECOND_LIFE] Help" - layout="topleft" name="Second Life Help" shortcut="F1"> <menu_item_call.on_click function="ShowHelp" parameter="f1_help" /> </menu_item_call> - <!-- <menu_item_call + <menu_item_call label="Tutorial" - layout="topleft" name="Tutorial"> <menu_item_call.on_click function="Floater.Show" parameter="hud" /> </menu_item_call>--> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Report Abuse" - layout="topleft" name="Report Abuse"> <menu_item_call.on_click function="ReportAbuse" /> </menu_item_call> <menu_item_call label="Report Bug" - layout="topleft" name="Report Bug"> <menu_item_call.on_click function="ShowHelp" parameter="report_bug" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="About [APP_NAME]" - layout="topleft" name="About Second Life"> <menu_item_call.on_click function="Floater.Show" @@ -1065,20 +847,28 @@ </menu> <menu label="Advanced" - layout="topleft" name="Advanced" tear_off="true" visible="false"> + <menu_item_check + label="Show Advanced Menu" + name="Show Advanced Menu" + shortcut="control|alt|D"> + <on_check + function="CheckControl" + parameter="UseDebugMenus" /> + <on_click + function="ToggleControl" + parameter="UseDebugMenus" /> + </menu_item_check> <menu_item_call label="Stop Animating Me" - layout="topleft" name="Stop Animating My Avatar"> <menu_item_call.on_click function="Tools.StopAllAnimations" /> </menu_item_call> <menu_item_call label="Rebake Textures" - layout="topleft" name="Rebake Texture" shortcut="control|alt|R"> <menu_item_call.on_click @@ -1086,7 +876,6 @@ </menu_item_call> <menu_item_call label="Set UI Size to Default" - layout="topleft" name="Set UI Size to Default"> <menu_item_call.on_click function="View.DefaultUISize" /> @@ -1101,7 +890,6 @@ <menu_item_separator/> <menu_item_check label="Limit Select Distance" - layout="topleft" name="Limit Select Distance"> <menu_item_check.on_check function="CheckControl" @@ -1112,7 +900,6 @@ </menu_item_check> <menu_item_check label="Disable Camera Constraints" - layout="topleft" name="Disable Camera Distance"> <menu_item_check.on_check function="CheckControl" @@ -1121,11 +908,9 @@ function="ToggleControl" parameter="DisableCameraConstraints" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="High-res Snapshot" - layout="topleft" name="HighResSnapshot"> <menu_item_check.on_check function="CheckControl" @@ -1136,7 +921,6 @@ </menu_item_check> <menu_item_check label="Quiet Snapshots to Disk" - layout="topleft" name="QuietSnapshotsToDisk"> <menu_item_check.on_check function="CheckControl" @@ -1147,7 +931,6 @@ </menu_item_check> <menu_item_check label="Compress Snapshots to Disk" - layout="topleft" name="CompressSnapshotsToDisk"> <menu_item_check.on_check function="CheckControl" @@ -1156,17 +939,14 @@ function="ToggleControl" parameter="CompressSnapshotsToDisk" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu create_jump_keys="true" label="Performance Tools" - layout="topleft" name="Performance Tools" tear_off="true"> <menu_item_call label="Lag Meter" - layout="topleft" name="Lag Meter"> <menu_item_call.on_click function="Floater.Show" @@ -1174,7 +954,6 @@ </menu_item_call> <menu_item_check label="Statistics Bar" - layout="topleft" name="Statistics Bar" shortcut="control|shift|1"> <menu_item_check.on_check @@ -1186,7 +965,6 @@ </menu_item_check> <menu_item_check label="Show Avatar Rendering Cost" - layout="topleft" name="Avatar Rendering Cost"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -1199,12 +977,10 @@ <menu create_jump_keys="true" label="Highlighting and Visibility" - layout="topleft" name="Highlighting and Visibility" tear_off="true"> <menu_item_check label="Cheesy Beacon" - layout="topleft" name="Cheesy Beacon"> <menu_item_check.on_check function="CheckControl" @@ -1215,7 +991,6 @@ </menu_item_check> <menu_item_check label="Hide Particles" - layout="topleft" name="Hide Particles" shortcut="control|alt|shift|="> <menu_item_check.on_check @@ -1227,7 +1002,6 @@ </menu_item_check> <menu_item_check label="Hide Selected" - layout="topleft" name="Hide Selected"> <menu_item_check.on_check function="CheckControl" @@ -1238,7 +1012,6 @@ </menu_item_check> <menu_item_check label="Highlight Transparent" - layout="topleft" name="Highlight Transparent" shortcut="control|alt|T"> <menu_item_check.on_check @@ -1248,7 +1021,6 @@ </menu_item_check> <menu_item_check label="Show HUD Attachments" - layout="topleft" name="Show HUD Attachments" shortcut="alt|shift|H"> <menu_item_check.on_check @@ -1258,7 +1030,6 @@ </menu_item_check> <menu_item_check label="Show Mouselook Crosshairs" - layout="topleft" name="ShowCrosshairs"> <menu_item_check.on_check function="CheckControl" @@ -1270,12 +1041,10 @@ <!-- <menu create_jump_keys="true" label="Hover Tips" - layout="topleft" name="Hover Tips" tear_off="true"> <menu_item_check label="Show Tips" - layout="topleft" name="Show Tips" shortcut="control|shift|T"> <menu_item_check.on_check @@ -1283,11 +1052,9 @@ <menu_item_check.on_click function="View.ShowHoverTips" /> </menu_item_check> - <menu_item_separator - layout="topleft" />--> + <menu_item_separator/> <menu_item_check label="Show Land Tooltips" - layout="topleft" name="Land Tips"> <menu_item_check.on_check control="ShowLandHoverTip" /> @@ -1297,9 +1064,8 @@ <menu_item_check.on_enable function="View.CheckShowHoverTips" /> </menu_item_check> - <!-- <menu_item_check + <menu_item_check label="Show Tips On All Objects" - layout="topleft" name="Tips On All Objects"> <menu_item_check.on_check control="ShowAllObjectHoverTip" /> @@ -1316,12 +1082,10 @@ <menu create_jump_keys="true" label="Rendering Types" - layout="topleft" name="Rendering Types" tear_off="true"> <menu_item_check label="Simple" - layout="topleft" name="Simple" shortcut="control|alt|shift|1"> <menu_item_check.on_check @@ -1333,7 +1097,6 @@ </menu_item_check> <menu_item_check label="Alpha" - layout="topleft" name="Alpha" shortcut="control|alt|shift|2"> <menu_item_check.on_check @@ -1345,7 +1108,6 @@ </menu_item_check> <menu_item_check label="Tree" - layout="topleft" name="Tree" shortcut="control|alt|shift|3"> <menu_item_check.on_check @@ -1357,7 +1119,6 @@ </menu_item_check> <menu_item_check label="Avatars" - layout="topleft" name="Character" shortcut="control|alt|shift|4"> <menu_item_check.on_check @@ -1369,7 +1130,6 @@ </menu_item_check> <menu_item_check label="SurfacePath" - layout="topleft" name="SurfacePath" shortcut="control|alt|shift|5"> <menu_item_check.on_check @@ -1381,7 +1141,6 @@ </menu_item_check> <menu_item_check label="Sky" - layout="topleft" name="Sky" shortcut="control|alt|shift|6"> <menu_item_check.on_check @@ -1393,7 +1152,6 @@ </menu_item_check> <menu_item_check label="Water" - layout="topleft" name="Water" shortcut="control|alt|shift|7"> <menu_item_check.on_check @@ -1405,7 +1163,6 @@ </menu_item_check> <menu_item_check label="Ground" - layout="topleft" name="Ground" shortcut="control|alt|shift|8"> <menu_item_check.on_check @@ -1417,7 +1174,6 @@ </menu_item_check> <menu_item_check label="Volume" - layout="topleft" name="Volume" shortcut="control|alt|shift|9"> <menu_item_check.on_check @@ -1429,7 +1185,6 @@ </menu_item_check> <menu_item_check label="Grass" - layout="topleft" name="Grass" shortcut="control|alt|shift|0"> <menu_item_check.on_check @@ -1441,7 +1196,6 @@ </menu_item_check> <menu_item_check label="Clouds" - layout="topleft" name="Clouds" shortcut="control|alt|shift|-"> <menu_item_check.on_check @@ -1453,7 +1207,6 @@ </menu_item_check> <menu_item_check label="Particles" - layout="topleft" name="Particles" shortcut="control|alt|shift|="> <menu_item_check.on_check @@ -1465,7 +1218,6 @@ </menu_item_check> <menu_item_check label="Bump" - layout="topleft" name="Bump" shortcut="control|alt|shift|\"> <menu_item_check.on_check @@ -1479,12 +1231,10 @@ <menu create_jump_keys="true" label="Rendering Features" - layout="topleft" name="Rendering Features" tear_off="true"> <menu_item_check label="UI" - layout="topleft" name="UI" shortcut="control|alt|F1"> <menu_item_check.on_check @@ -1496,7 +1246,6 @@ </menu_item_check> <menu_item_check label="Selected" - layout="topleft" name="Selected" shortcut="control|alt|F2"> <menu_item_check.on_check @@ -1508,7 +1257,6 @@ </menu_item_check> <menu_item_check label="Highlighted" - layout="topleft" name="Highlighted" shortcut="control|alt|F3"> <menu_item_check.on_check @@ -1520,7 +1268,6 @@ </menu_item_check> <menu_item_check label="Dynamic Textures" - layout="topleft" name="Dynamic Textures" shortcut="control|alt|F4"> <menu_item_check.on_check @@ -1532,7 +1279,6 @@ </menu_item_check> <menu_item_check label="Foot Shadows" - layout="topleft" name="Foot Shadows" shortcut="control|alt|F5"> <menu_item_check.on_check @@ -1544,7 +1290,6 @@ </menu_item_check> <menu_item_check label="Fog" - layout="topleft" name="Fog" shortcut="control|alt|F6"> <menu_item_check.on_check @@ -1556,7 +1301,6 @@ </menu_item_check> <menu_item_check label="Test FRInfo" - layout="topleft" name="Test FRInfo" shortcut="control|alt|F8"> <menu_item_check.on_check @@ -1568,7 +1312,6 @@ </menu_item_check> <menu_item_check label="Flexible Objects" - layout="topleft" name="Flexible Objects" shortcut="control|alt|F9"> <menu_item_check.on_check @@ -1581,7 +1324,6 @@ </menu> <menu_item_check label="Run Multiple Threads" - layout="topleft" name="Run Multiple Threads"> <menu_item_check.on_check function="CheckControl" @@ -1592,7 +1334,6 @@ </menu_item_check> <menu_item_call label="Clear Group Cache" - layout="topleft" name="ClearGroupCache"> <menu_item_call.on_click function="Advanced.ClearGroupCache" @@ -1600,7 +1341,6 @@ </menu_item_call> <menu_item_check label="Mouse Smoothing" - layout="topleft" name="Mouse Smoothing"> <menu_item_check.on_check function="CheckControl" @@ -1609,17 +1349,14 @@ function="ToggleControl" parameter="MouseSmooth" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu label="Shortcuts" - layout="topleft" name="Shortcuts" tear_off="true" visible="false"> <menu_item_call label="Image (L$[COST])..." - layout="topleft" name="Upload Image" shortcut="control|U"> <menu_item_call.on_click @@ -1630,7 +1367,6 @@ </menu_item_call> <menu_item_check label="Search" - layout="topleft" name="Search" shortcut="control|F"> <menu_item_check.on_check @@ -1643,7 +1379,6 @@ <menu_item_call enabled="false" label="Release Keys" - layout="topleft" name="Release Keys"> <menu_item_call.on_click function="Tools.ReleaseKeys" @@ -1654,16 +1389,13 @@ </menu_item_call> <menu_item_call label="Set UI Size to Default" - layout="topleft" name="Set UI Size to Default"> <menu_item_call.on_click function="View.DefaultUISize" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Always Run" - layout="topleft" name="Always Run" shortcut="control|R"> <menu_item_check.on_check @@ -1673,7 +1405,6 @@ </menu_item_check> <menu_item_check label="Fly" - layout="topleft" name="Fly" shortcut="Home"> <menu_item_check.on_check @@ -1683,11 +1414,9 @@ <menu_item_check.on_enable function="Agent.enableFlying" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Close Window" - layout="topleft" name="Close Window" shortcut="control|W"> <menu_item_call.on_click @@ -1697,7 +1426,6 @@ </menu_item_call> <menu_item_call label="Close All Windows" - layout="topleft" name="Close All Windows" shortcut="control|shift|W"> <menu_item_call.on_click @@ -1705,22 +1433,18 @@ <menu_item_call.on_enable function="File.EnableCloseAllWindows" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Snapshot to Disk" - layout="topleft" name="Snapshot to Disk" shortcut="control|`" use_mac_ctrl="true"> <menu_item_call.on_click function="File.TakeSnapshotToDisk" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Mouselook" - layout="topleft" name="Mouselook" shortcut="M"> <menu_item_call.on_click @@ -1730,7 +1454,6 @@ </menu_item_call> <menu_item_check label="Joystick Flycam" - layout="topleft" name="Joystick Flycam" shortcut="alt|shift|F"> <menu_item_check.on_check @@ -1742,7 +1465,6 @@ </menu_item_check> <menu_item_call label="Reset View" - layout="topleft" name="Reset View" shortcut="Esc"> <menu_item_call.on_click @@ -1750,7 +1472,6 @@ </menu_item_call> <menu_item_call label="Look at Last Chatter" - layout="topleft" name="Look at Last Chatter" shortcut="control|\"> <menu_item_call.on_click @@ -1758,17 +1479,14 @@ <menu_item_call.on_enable function="View.EnableLastChatter" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu create_jump_keys="true" label="Select Build Tool" - layout="topleft" name="Select Tool" tear_off="true"> <menu_item_call label="Focus Tool" - layout="topleft" name="Focus" shortcut="control|1"> <menu_item_call.on_click @@ -1777,7 +1495,6 @@ </menu_item_call> <menu_item_call label="Move Tool" - layout="topleft" name="Move" shortcut="control|2"> <menu_item_call.on_click @@ -1786,7 +1503,6 @@ </menu_item_call> <menu_item_call label="Edit Tool" - layout="topleft" name="Edit" shortcut="control|3"> <menu_item_call.on_click @@ -1795,7 +1511,6 @@ </menu_item_call> <menu_item_call label="Create Tool" - layout="topleft" name="Create" shortcut="control|4"> <menu_item_call.on_click @@ -1804,7 +1519,6 @@ </menu_item_call> <menu_item_call label="Land Tool" - layout="topleft" name="Land" shortcut="control|5"> <menu_item_call.on_click @@ -1812,11 +1526,9 @@ parameter="land" /> </menu_item_call> </menu> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Zoom In" - layout="topleft" name="Zoom In" shortcut="control|0"> <menu_item_call.on_click @@ -1824,7 +1536,6 @@ </menu_item_call> <menu_item_call label="Zoom Default" - layout="topleft" name="Zoom Default" shortcut="control|9"> <menu_item_call.on_click @@ -1832,17 +1543,14 @@ </menu_item_call> <menu_item_call label="Zoom Out" - layout="topleft" name="Zoom Out" shortcut="control|8"> <menu_item_call.on_click function="View.ZoomOut" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Toggle Fullscreen" - layout="topleft" name="Toggle Fullscreen" > <!-- Note: shortcut="alt|Enter" was deleted from the preceding node--> @@ -1850,11 +1558,9 @@ function="View.Fullscreen" /> </menu_item_call> </menu> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Show Debug Settings" - layout="topleft" name="Debug Settings"> <menu_item_call.on_click function="Advanced.ShowDebugSettings" @@ -1862,7 +1568,6 @@ </menu_item_call> <menu_item_check label="Show Develop Menu" - layout="topleft" name="Debug Mode" shortcut="control|alt|Q"> <menu_item_check.on_check @@ -1872,23 +1577,21 @@ function="ToggleControl" parameter="QAMode" /> </menu_item_check> + </menu> <menu create_jump_keys="true" label="Develop" - layout="topleft" name="Develop" tear_off="true" visible="false"> <menu create_jump_keys="true" label="Consoles" - layout="topleft" name="Consoles" tear_off="true"> <menu_item_check label="Texture Console" - layout="topleft" name="Texture Console" shortcut="control|shift|3" use_mac_ctrl="true"> @@ -1901,7 +1604,6 @@ </menu_item_check> <menu_item_check label="Debug Console" - layout="topleft" name="Debug Console" shortcut="control|shift|4" use_mac_ctrl="true"> @@ -1914,7 +1616,6 @@ </menu_item_check> <menu_item_call label="Notifications Console" - layout="topleft" name="Notifications" shortcut="control|shift|5"> <menu_item_call.on_click @@ -1923,7 +1624,6 @@ </menu_item_call> <menu_item_check label="Texture Size Console" - layout="topleft" name="Texture Size" shortcut="control|shift|6"> <menu_item_check.on_check @@ -1935,7 +1635,6 @@ </menu_item_check> <menu_item_check label="Texture Category Console" - layout="topleft" name="Texture Category" shortcut="control|shift|7"> <menu_item_check.on_check @@ -1947,7 +1646,6 @@ </menu_item_check> <menu_item_check label="Fast Timers" - layout="topleft" name="Fast Timers" shortcut="control|shift|9" use_mac_ctrl="true"> @@ -1960,7 +1658,6 @@ </menu_item_check> <menu_item_check label="Memory" - layout="topleft" name="Memory" shortcut="control|shift|0" use_mac_ctrl="true"> @@ -1971,11 +1668,9 @@ function="Advanced.ToggleConsole" parameter="memory view" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Region Info to Debug Console" - layout="topleft" name="Region Info to Debug Console"> <menu_item_call.on_click function="Advanced.DumpInfoToConsole" @@ -1983,7 +1678,6 @@ </menu_item_call> <menu_item_call label="Group Info to Debug Console" - layout="topleft" name="Group Info to Debug Console"> <menu_item_call.on_click function="Advanced.DumpInfoToConsole" @@ -1991,17 +1685,14 @@ </menu_item_call> <menu_item_call label="Capabilities Info to Debug Console" - layout="topleft" name="Capabilities Info to Debug Console"> <menu_item_call.on_click function="Advanced.DumpInfoToConsole" parameter="capabilities" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Camera" - layout="topleft" name="Camera"> <menu_item_check.on_check function="Advanced.CheckHUDInfo" @@ -2012,7 +1703,6 @@ </menu_item_check> <menu_item_check label="Wind" - layout="topleft" name="Wind"> <menu_item_check.on_check function="Advanced.CheckHUDInfo" @@ -2023,7 +1713,6 @@ </menu_item_check> <menu_item_check label="FOV" - layout="topleft" name="FOV"> <menu_item_check.on_check function="Advanced.CheckHUDInfo" @@ -2034,7 +1723,6 @@ </menu_item_check> <menu_item_check label="Badge" - layout="topleft" name="Badge" shortcut="alt|control|shift|h"> <menu_item_check.on_check @@ -2048,12 +1736,10 @@ <menu create_jump_keys="true" label="Show Info" - layout="topleft" name="Display Info" tear_off="true"> <menu_item_check label="Show Time" - layout="topleft" name="Show Time"> <menu_item_check.on_check function="CheckControl" @@ -2064,7 +1750,6 @@ </menu_item_check> <menu_item_check label="Show Render Info" - layout="topleft" name="Show Render Info"> <menu_item_check.on_check function="CheckControl" @@ -2075,7 +1760,6 @@ </menu_item_check> <menu_item_check label="Show Matrices" - layout="topleft" name="Show Matrices"> <menu_item_check.on_check function="CheckControl" @@ -2086,7 +1770,6 @@ </menu_item_check> <menu_item_check label="Show Color Under Cursor" - layout="topleft" name="Show Color Under Cursor"> <menu_item_check.on_check function="CheckControl" @@ -2095,11 +1778,9 @@ function="ToggleControl" parameter="DebugShowColor" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Show Updates to Objects" - layout="topleft" name="Show Updates" shortcut="control|alt|shift|U"> <menu_item_check.on_check @@ -2109,17 +1790,14 @@ function="Advanced.ToggleShowObjectUpdates" /> </menu_item_check> </menu> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu create_jump_keys="true" label="Force an Error" - layout="topleft" name="Force Errors" tear_off="true"> <menu_item_call label="Force Breakpoint" - layout="topleft" name="Force Breakpoint" shortcut="control|alt|shift|B"> <menu_item_call.on_click @@ -2127,49 +1805,42 @@ </menu_item_call> <menu_item_call label="Force LLError And Crash" - layout="topleft" name="Force LLError And Crash"> <menu_item_call.on_click function="Advanced.ForceErrorLlerror" /> </menu_item_call> <menu_item_call label="Force Bad Memory Access" - layout="topleft" name="Force Bad Memory Access"> <menu_item_call.on_click function="Advanced.ForceErrorBadMemoryAccess" /> </menu_item_call> <menu_item_call label="Force Infinite Loop" - layout="topleft" name="Force Infinite Loop"> <menu_item_call.on_click function="Advanced.ForceErrorInfiniteLoop" /> </menu_item_call> <menu_item_call label="Force Driver Crash" - layout="topleft" name="Force Driver Carsh"> <menu_item_call.on_click function="Advanced.ForceErrorDriverCrash" /> </menu_item_call> <menu_item_call label="Force Software Exception" - layout="topleft" name="Force Software Exception"> <menu_item_call.on_click function="Advanced.ForceErrorSoftwareException" /> </menu_item_call> <menu_item_call label="Force Disconnect Viewer" - layout="topleft" name="Force Disconnect Viewer"> <menu_item_call.on_click function="Advanced.ForceErrorDisconnectViewer" /> </menu_item_call> <menu_item_call label="Simulate a Memory Leak" - layout="topleft" name="Memory Leaking Simulation"> <menu_item_call.on_click function="Floater.Show" @@ -2179,12 +1850,10 @@ <menu create_jump_keys="true" label="Render Tests" - layout="topleft" name="Render Tests" tear_off="true"> <menu_item_check label="Camera Offset" - layout="topleft" name="Camera Offset"> <menu_item_check.on_check function="CheckControl" @@ -2195,7 +1864,6 @@ </menu_item_check> <menu_item_check label="Randomize Framerate" - layout="topleft" name="Randomize Framerate"> <menu_item_check.on_check function="Advanced.CheckRandomizeFramerate" @@ -2205,7 +1873,6 @@ </menu_item_check> <menu_item_check label="Periodic Slow Frame" - layout="topleft" name="Periodic Slow Frame"> <menu_item_check.on_check function="Advanced.CheckPeriodicSlowFrame" @@ -2216,7 +1883,6 @@ </menu_item_check> <menu_item_check label="Frame Test" - layout="topleft" name="Frame Test"> <menu_item_check.on_check function="Advanced.CheckFrameTest" @@ -2228,12 +1894,10 @@ <menu create_jump_keys="true" label="Render Metadata" - layout="topleft" name="Render Metadata" tear_off="true"> <menu_item_check label="Bounding Boxes" - layout="topleft" name="Bounding Boxes"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2244,7 +1908,6 @@ </menu_item_check> <menu_item_check label="Octree" - layout="topleft" name="Octree"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2255,7 +1918,6 @@ </menu_item_check> <menu_item_check label="Shadow Frusta" - layout="topleft" name="Shadow Frusta"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2266,7 +1928,6 @@ </menu_item_check> <menu_item_check label="Occlusion" - layout="topleft" name="Occlusion"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2277,7 +1938,6 @@ </menu_item_check> <menu_item_check label="Render Batches" - layout="topleft" name="Render Batches"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2288,7 +1948,6 @@ </menu_item_check> <menu_item_check label="Texture Anim" - layout="topleft" name="Texture Anim"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2299,7 +1958,6 @@ </menu_item_check> <menu_item_check label="Texture Priority" - layout="topleft" name="Texture Priority"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2310,7 +1968,6 @@ </menu_item_check> <menu_item_check label="Texture Area" - layout="topleft" name="Texture Area"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2321,7 +1978,6 @@ </menu_item_check> <menu_item_check label="Face Area" - layout="topleft" name="Face Area"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2332,7 +1988,6 @@ </menu_item_check> <menu_item_check label="Lights" - layout="topleft" name="Lights"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2343,7 +1998,6 @@ </menu_item_check> <menu_item_check label="Collision Skeleton" - layout="topleft" name="Collision Skeleton"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2354,7 +2008,6 @@ </menu_item_check> <menu_item_check label="Raycast" - layout="topleft" name="Raycast"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -2367,7 +2020,6 @@ <menu create_jump_keys="true" label="Rendering" - layout="topleft" name="Rendering" tear_off="true"> <menu_item_check @@ -2509,7 +2161,6 @@ </menu_item_check> <menu_item_check label="Full Res Textures" - layout="topleft" name="Rull Res Textures"> <menu_item_check.on_check function="CheckControl" @@ -2520,7 +2171,6 @@ </menu_item_check> <menu_item_check label="Audit Textures" - layout="topleft" name="Audit Textures"> <menu_item_check.on_check function="CheckControl" @@ -2574,12 +2224,10 @@ <menu create_jump_keys="true" label="Network" - layout="topleft" name="Network" tear_off="true"> <menu_item_check label="Pause Agent" - layout="topleft" name="AgentPause"> <menu_item_check.on_check function="CheckControl" @@ -2588,27 +2236,22 @@ function="ToggleControl" parameter="AgentPause" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Enable Message Log" - layout="topleft" name="Enable Message Log"> <menu_item_call.on_click function="Advanced.EnableMessageLog" /> </menu_item_call> <menu_item_call label="Disable Message Log" - layout="topleft" name="Disable Message Log"> <menu_item_call.on_click function="Advanced.DisableMessageLog" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Velocity Interpolate Objects" - layout="topleft" name="Velocity Interpolate Objects"> <menu_item_check.on_check function="CheckControl" @@ -2619,7 +2262,6 @@ </menu_item_check> <menu_item_check label="Ping Interpolate Object Positions" - layout="topleft" name="Ping Interpolate Object Positions"> <menu_item_check.on_check function="CheckControl" @@ -2628,11 +2270,9 @@ function="ToggleControl" parameter="PingInterpolate" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Drop a Packet" - layout="topleft" name="Drop a Packet" shortcut="control|alt|L"> <menu_item_call.on_click @@ -2641,14 +2281,12 @@ </menu> <menu_item_call label="Dump Scripted Camera" - layout="topleft" name="Dump Scripted Camera"> <menu_item_call.on_click function="Advanced.DumpScriptedCamera" /> </menu_item_call> <menu_item_call label="Bumps, Pushes & Hits" - layout="topleft" name="Bumps, Pushes &amp; Hits"> <menu_item_call.on_click function="Floater.Show" @@ -2658,12 +2296,10 @@ <menu create_jump_keys="true" label="Recorder" - layout="topleft" name="Recorder" tear_off="true"> <menu_item_call label="Start Playback" - layout="topleft" name="Start Playback"> <menu_item_call.on_click function="Advanced.AgentPilot" @@ -2671,7 +2307,6 @@ </menu_item_call> <menu_item_call label="Stop Playback" - layout="topleft" name="Stop Playback"> <menu_item_call.on_click function="Advanced.AgentPilot" @@ -2679,7 +2314,6 @@ </menu_item_call> <menu_item_check label="Loop Playback" - layout="topleft" name="Loop Playback"> <menu_item_check.on_check function="Advanced.CheckAgentPilotLoop" @@ -2689,7 +2323,6 @@ </menu_item_check> <menu_item_call label="Start Record" - layout="topleft" name="Start Record"> <menu_item_call.on_click function="Advanced.AgentPilot" @@ -2697,7 +2330,6 @@ </menu_item_call> <menu_item_call label="Stop Record" - layout="topleft" name="Stop Record"> <menu_item_call.on_click function="Advanced.AgentPilot" @@ -2708,12 +2340,10 @@ <menu create_jump_keys="true" label="World" - layout="topleft" name="World" tear_off="true"> <menu_item_check label="Sim Sun Override" - layout="topleft" name="Sim Sun Override"> <menu_item_check.on_check function="CheckControl" @@ -2724,7 +2354,6 @@ </menu_item_check> <menu_item_check label="Cheesy Beacon" - layout="topleft" name="Cheesy Beacon"> <menu_item_check.on_check function="CheckControl" @@ -2735,7 +2364,6 @@ </menu_item_check> <menu_item_check label="Fixed Weather" - layout="topleft" name="Fixed Weather"> <menu_item_check.on_check function="CheckControl" @@ -2746,7 +2374,6 @@ </menu_item_check> <menu_item_call label="Dump Region Object Cache" - layout="topleft" name="Dump Region Object Cache"> <menu_item_call.on_click function="Advanced.DumpRegionObjectCache" /> @@ -2755,12 +2382,10 @@ <menu create_jump_keys="true" label="UI" - layout="topleft" name="UI" tear_off="true"> <!-- <menu_item_check label="New Bottom Bar" - layout="topleft" name="New Bottom Bar"> <menu_item_check.on_check function="CheckControl" @@ -2771,7 +2396,6 @@ </menu_item_check>--> <menu_item_call label="Web Browser Test" - layout="topleft" name="Web Browser Test"> <menu_item_call.on_click function="Advanced.WebBrowserTest" @@ -2779,14 +2403,12 @@ </menu_item_call> <menu_item_call label="Dump SelectMgr" - layout="topleft" name="Dump SelectMgr"> <menu_item_call.on_click function="Advanced.DumpSelectMgr" /> </menu_item_call> <menu_item_call label="Dump Inventory" - layout="topleft" name="Dump Inventory"> <menu_item_call.on_click function="Advanced.DumpInventory" /> @@ -2799,14 +2421,12 @@ </menu_item_call> <menu_item_call label="Dump Focus Holder" - layout="topleft" name="Dump Focus Holder"> <menu_item_call.on_click function="Advanced.DumpFocusHolder" /> </menu_item_call> <menu_item_call label="Print Selected Object Info" - layout="topleft" name="Print Selected Object Info" shortcut="control|shift|P"> <menu_item_call.on_click @@ -2814,7 +2434,6 @@ </menu_item_call> <menu_item_call label="Print Agent Info" - layout="topleft" name="Print Agent Info" shortcut="shift|P"> <menu_item_call.on_click @@ -2822,7 +2441,6 @@ </menu_item_call> <menu_item_call label="Memory Stats" - layout="topleft" name="Memory Stats" shortcut="control|alt|shift|M"> <menu_item_call.on_click @@ -2830,7 +2448,6 @@ </menu_item_call> <menu_item_check label="Double-ClickAuto-Pilot" - layout="topleft" name="Double-ClickAuto-Pilot"> <menu_item_check.on_check function="CheckControl" @@ -2843,7 +2460,6 @@ <menu_item_separator /> <menu_item_check label="Debug SelectMgr" - layout="topleft" name="Debug SelectMgr"> <menu_item_check.on_check function="CheckControl" @@ -2854,7 +2470,6 @@ </menu_item_check> <menu_item_check label="Debug Clicks" - layout="topleft" name="Debug Clicks"> <menu_item_check.on_check function="Advanced.CheckDebugClicks" @@ -2865,7 +2480,6 @@ </menu_item_check> <menu_item_check label="Debug Views" - layout="topleft" name="Debug Views"> <menu_item_check.on_check function="Advanced.CheckDebugViews" /> @@ -2874,7 +2488,6 @@ </menu_item_check> <menu_item_check label="Debug Name Tooltips" - layout="topleft" name="Debug Name Tooltips"> <menu_item_check.on_check function="Advanced.CheckXUINameTooltips" @@ -2884,7 +2497,6 @@ </menu_item_check> <menu_item_check label="Debug Mouse Events" - layout="topleft" name="Debug Mouse Events"> <menu_item_check.on_check function="Advanced.CheckDebugMouseEvents" @@ -2894,7 +2506,6 @@ </menu_item_check> <menu_item_check label="Debug Keys" - layout="topleft" name="Debug Keys"> <menu_item_check.on_check function="Advanced.CheckDebugKeys" @@ -2904,7 +2515,6 @@ </menu_item_check> <menu_item_check label="Debug WindowProc" - layout="topleft" name="Debug WindowProc"> <menu_item_check.on_check function="Advanced.CheckDebugWindowProc" @@ -2921,14 +2531,12 @@ tear_off="true"> <menu_item_call label="Reload Color Settings" - layout="topleft" name="Reload Color Settings"> <menu_item_call.on_click function="Advanced.ReloadColorSettings" /> </menu_item_call> <menu_item_call label="Show Font Test" - layout="topleft" name="Show Font Test"> <menu_item_call.on_click function="Floater.Show" @@ -2936,21 +2544,18 @@ </menu_item_call> <menu_item_call label="Load from XML" - layout="topleft" name="Load from XML"> <menu_item_call.on_click function="Advanced.LoadUIFromXML" /> </menu_item_call> <menu_item_call label="Save to XML" - layout="topleft" name="Save to XML"> <menu_item_call.on_click function="Advanced.SaveUIToXML" /> </menu_item_call> <menu_item_check label="Show XUI Names" - layout="topleft" name="Show XUI Names"> <menu_item_check.on_check function="Advanced.CheckXUINames" @@ -2960,7 +2565,6 @@ </menu_item_check> <menu_item_call label="Send Test IMs" - layout="topleft" name="Send Test IMs"> <menu_item_call.on_click function="Advanced.SendTestIMs" /> @@ -2969,18 +2573,15 @@ <menu create_jump_keys="true" label="Avatar" - layout="topleft" name="Character" tear_off="true"> <menu create_jump_keys="true" label="Grab Baked Texture" - layout="topleft" name="Grab Baked Texture" tear_off="true"> <menu_item_call label="Iris" - layout="topleft" name="Iris"> <menu_item_call.on_click function="Advanced.GrabBakedTexture" @@ -2991,7 +2592,6 @@ </menu_item_call> <menu_item_call label="Head" - layout="topleft" name="Head"> <menu_item_call.on_click function="Advanced.GrabBakedTexture" @@ -3002,7 +2602,6 @@ </menu_item_call> <menu_item_call label="Upper Body" - layout="topleft" name="Upper Body"> <menu_item_call.on_click function="Advanced.GrabBakedTexture" @@ -3013,7 +2612,6 @@ </menu_item_call> <menu_item_call label="Lower Body" - layout="topleft" name="Lower Body"> <menu_item_call.on_click function="Advanced.GrabBakedTexture" @@ -3024,7 +2622,6 @@ </menu_item_call> <menu_item_call label="Skirt" - layout="topleft" name="Skirt"> <menu_item_call.on_click function="Advanced.GrabBakedTexture" @@ -3037,19 +2634,16 @@ <menu create_jump_keys="true" label="Character Tests" - layout="topleft" name="Character Tests" tear_off="true"> <menu_item_call label="Appearance To XML" - layout="topleft" name="Appearance To XML"> <menu_item_call.on_click function="Advanced.AppearanceToXML" /> </menu_item_call> <menu_item_call label="Toggle Character Geometry" - layout="topleft" name="Toggle Character Geometry"> <menu_item_call.on_click function="Advanced.ToggleCharacterGeometry" /> @@ -3058,28 +2652,24 @@ </menu_item_call> <menu_item_call label="Test Male" - layout="topleft" name="Test Male"> <menu_item_call.on_click function="Advanced.TestMale" /> </menu_item_call> <menu_item_call label="Test Female" - layout="topleft" name="Test Female"> <menu_item_call.on_click function="Advanced.TestFemale" /> </menu_item_call> <menu_item_call label="Toggle PG" - layout="topleft" name="Toggle PG"> <menu_item_call.on_click function="Advanced.TogglePG" /> </menu_item_call> <menu_item_check label="Allow Select Avatar" - layout="topleft" name="Allow Select Avatar"> <menu_item_check.on_check function="CheckControl" @@ -3091,14 +2681,12 @@ </menu> <menu_item_call label="Force Params to Default" - layout="topleft" name="Force Params to Default"> <menu_item_call.on_click function="Advanced.ForceParamsToDefault" /> </menu_item_call> <menu_item_check label="Animation Info" - layout="topleft" name="Animation Info"> <menu_item_check.on_check function="Advanced.CheckAnimationInfo" @@ -3109,7 +2697,6 @@ </menu_item_check> <menu_item_check label="Slow Motion Animations" - layout="topleft" name="Slow Motion Animations"> <menu_item_check.on_check function="CheckControl" @@ -3120,7 +2707,6 @@ </menu_item_check> <menu_item_check label="Show Look At" - layout="topleft" name="Show Look At"> <menu_item_check.on_check function="Advanced.CheckShowLookAt" @@ -3130,7 +2716,6 @@ </menu_item_check> <menu_item_check label="Show Point At" - layout="topleft" name="Show Point At"> <menu_item_check.on_check function="Advanced.CheckShowPointAt" @@ -3140,7 +2725,6 @@ </menu_item_check> <menu_item_check label="Debug Joint Updates" - layout="topleft" name="Debug Joint Updates"> <menu_item_check.on_check function="Advanced.CheckDebugJointUpdates" @@ -3150,7 +2734,6 @@ </menu_item_check> <menu_item_check label="Disable LOD" - layout="topleft" name="Disable LOD"> <menu_item_check.on_check function="Advanced.CheckDisableLOD" @@ -3160,7 +2743,6 @@ </menu_item_check> <menu_item_check label="Debug Character Vis" - layout="topleft" name="Debug Character Vis"> <menu_item_check.on_check function="Advanced.CheckDebugCharacterVis" @@ -3170,7 +2752,6 @@ </menu_item_check> <menu_item_check label="Show Collision Skeleton" - layout="topleft" name="Show Collision Skeleton"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -3181,7 +2762,6 @@ </menu_item_check> <menu_item_check label="Display Agent Target" - layout="topleft" name="Display Agent Target"> <menu_item_check.on_check function="Advanced.CheckInfoDisplay" @@ -3193,7 +2773,6 @@ <!-- Appears not to exist anymore <menu_item_check label="Debug Rotation" - layout="topleft" name="Debug Rotation"> <menu_item_check.on_check function="CheckControl" @@ -3205,14 +2784,12 @@ --> <menu_item_call label="Dump Attachments" - layout="topleft" name="Dump Attachments"> <menu_item_call.on_click function="Advanced.DumpAttachments" /> </menu_item_call> <menu_item_call label="Debug Avatar Textures" - layout="topleft" name="Debug Avatar Textures" shortcut="control|alt|shift|A"> <menu_item_call.on_click @@ -3220,18 +2797,15 @@ </menu_item_call> <menu_item_call label="Dump Local Textures" - layout="topleft" name="Dump Local Textures" shortcut="alt|shift|M"> <menu_item_call.on_click function="Advanced.DumpAvatarLocalTextures" /> </menu_item_call> </menu> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="HTTP Textures" - layout="topleft" name="HTTP Textures"> <menu_item_check.on_check function="CheckControl" @@ -3242,14 +2816,12 @@ </menu_item_check> <menu_item_call label="Compress Images" - layout="topleft" name="Compress Images"> <menu_item_call.on_click function="Advanced.CompressImage" /> </menu_item_call> <menu_item_check label="Output Debug Minidump" - layout="topleft" name="Output Debug Minidump"> <menu_item_check.on_check function="CheckControl" @@ -3260,7 +2832,6 @@ </menu_item_check> <menu_item_check label="Console Window on next Run" - layout="topleft" name="Console Window"> <menu_item_check.on_check function="CheckControl" @@ -3269,11 +2840,9 @@ function="ToggleControl" parameter="ShowConsoleWindow" /> </menu_item_check> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_check label="Show Admin Menu" - layout="topleft" name="View Admin Options"> <menu_item_check.on_check function="Advanced.CheckViewAdminOptions" @@ -3283,7 +2852,6 @@ </menu_item_check> <menu_item_call label="Request Admin Status" - layout="topleft" name="Request Admin Options" shortcut="control|alt|G"> <menu_item_call.on_click @@ -3291,7 +2859,6 @@ </menu_item_call> <menu_item_call label="Leave Admin Status" - layout="topleft" name="Leave Admin Options" shortcut="control|alt|shift|G"> <menu_item_call.on_click @@ -3301,18 +2868,15 @@ <menu create_jump_keys="true" label="Admin" - layout="topleft" name="Admin" tear_off="true" visible="false"> <menu create_jump_keys="true" label="Object" - layout="topleft" tear_off="true"> <menu_item_call label="Take Copy" - layout="topleft" name="Take Copy" shortcut="control|alt|shift|O"> <menu_item_call.on_click @@ -3322,7 +2886,6 @@ </menu_item_call> <menu_item_call label="Force Owner To Me" - layout="topleft" name="Force Owner To Me"> <menu_item_call.on_click function="Admin.HandleObjectOwnerSelf" /> @@ -3331,7 +2894,6 @@ </menu_item_call> <menu_item_call label="Force Owner Permissive" - layout="topleft" name="Force Owner Permissive"> <menu_item_call.on_click function="Admin.HandleObjectOwnerPermissive" /> @@ -3340,7 +2902,6 @@ </menu_item_call> <menu_item_call label="Delete" - layout="topleft" name="Delete" shortcut="control|alt|shift|Del"> <menu_item_call.on_click @@ -3350,7 +2911,6 @@ </menu_item_call> <menu_item_call label="Lock" - layout="topleft" name="Lock" shortcut="control|alt|shift|L"> <menu_item_call.on_click @@ -3360,7 +2920,6 @@ </menu_item_call> <menu_item_call label="Get Assets IDs" - layout="topleft" name="Get Assets IDs" shortcut="control|alt|shift|I"> <menu_item_call.on_click @@ -3372,12 +2931,10 @@ <menu create_jump_keys="true" label="Parcel" - layout="topleft" name="Parcel" tear_off="true"> <menu_item_call label="Force Owner To Me" - layout="topleft" name="Owner To Me"> <menu_item_call.on_click function="Admin.HandleForceParcelOwnerToMe" /> @@ -3386,7 +2943,6 @@ </menu_item_call> <menu_item_call label="Set to Linden Content" - layout="topleft" name="Set to Linden Content" shortcut="control|alt|shift|C"> <menu_item_call.on_click @@ -3396,7 +2952,6 @@ </menu_item_call> <menu_item_call label="Claim Public Land" - layout="topleft" name="Claim Public Land"> <menu_item_call.on_click function="Admin.HandleClaimPublicLand" /> @@ -3407,12 +2962,10 @@ <menu create_jump_keys="true" label="Region" - layout="topleft" name="Region" tear_off="true"> <menu_item_call label="Dump Temp Asset Data" - layout="topleft" name="Dump Temp Asset Data"> <menu_item_call.on_click function="Admin.HandleRegionDumpTempAssetData" /> @@ -3421,7 +2974,6 @@ </menu_item_call> <menu_item_call label="Save Region State" - layout="topleft" name="Save Region State"> <menu_item_call.on_click function="Admin.OnSaveState" /> @@ -3431,7 +2983,6 @@ </menu> <menu_item_call label="God Tools" - layout="topleft" name="God Tools"> <menu_item_call.on_click function="Floater.Show" @@ -3443,34 +2994,29 @@ <menu create_jump_keys="true" label="Admin" - layout="topleft" name="Deprecated" tear_off="true" visible="false"> <menu create_jump_keys="true" label="Attach Object" - layout="topleft" mouse_opaque="false" name="Attach Object" tear_off="true" /> <menu create_jump_keys="true" label="Detach Object" - layout="topleft" mouse_opaque="false" name="Detach Object" tear_off="true" /> <menu create_jump_keys="true" label="Take Off Clothing" - layout="topleft" mouse_opaque="false" name="Take Off Clothing" tear_off="true"> <menu_item_call label="Shirt" - layout="topleft" name="Shirt"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3481,7 +3027,6 @@ </menu_item_call> <menu_item_call label="Pants" - layout="topleft" name="Pants"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3492,7 +3037,6 @@ </menu_item_call> <menu_item_call label="Shoes" - layout="topleft" name="Shoes"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3503,7 +3047,6 @@ </menu_item_call> <menu_item_call label="Socks" - layout="topleft" name="Socks"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3514,7 +3057,6 @@ </menu_item_call> <menu_item_call label="Jacket" - layout="topleft" name="Jacket"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3525,7 +3067,6 @@ </menu_item_call> <menu_item_call label="Gloves" - layout="topleft" name="Gloves"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3536,7 +3077,6 @@ </menu_item_call> <menu_item_call label="Undershirt" - layout="topleft" name="Menu Undershirt"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3547,7 +3087,6 @@ </menu_item_call> <menu_item_call label="Underpants" - layout="topleft" name="Menu Underpants"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3558,7 +3097,6 @@ </menu_item_call> <menu_item_call label="Skirt" - layout="topleft" name="Skirt"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3569,7 +3107,6 @@ </menu_item_call> <menu_item_call label="Alpha" - layout="topleft" name="Alpha"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3580,7 +3117,6 @@ </menu_item_call> <menu_item_call label="Tattoo" - layout="topleft" name="Tattoo"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3591,7 +3127,6 @@ </menu_item_call> <menu_item_call label="All Clothes" - layout="topleft" name="All Clothes"> <menu_item_call.on_click function="Edit.TakeOff" @@ -3601,12 +3136,10 @@ <menu create_jump_keys="true" label="Help" - layout="topleft" name="Help" tear_off="true"> <menu_item_call label="Official Linden Blog" - layout="topleft" name="Official Linden Blog"> <menu_item_call.on_click function="PromptShowURL" @@ -3615,7 +3148,6 @@ </menu_item_call> <menu_item_call label="Scripting Portal" - layout="topleft" name="Scripting Portal"> <menu_item_call.on_click function="PromptShowURL" @@ -3625,12 +3157,10 @@ <menu create_jump_keys="true" label="Bug Reporting" - layout="topleft" name="Bug Reporting" tear_off="true"> <menu_item_call label="Public Issue Tracker" - layout="topleft" name="Public Issue Tracker"> <menu_item_call.on_click function="PromptShowURL" @@ -3639,18 +3169,15 @@ </menu_item_call> <menu_item_call label="Public Issue Tracker Help" - layout="topleft" name="Publc Issue Tracker Help"> <menu_item_call.on_click function="PromptShowURL" name="PublicIssueTrackerHelp_url" parameter="WebLaunchPublicIssueHelp,http://wiki.secondlife.com/wiki/Issue_tracker" /> </menu_item_call> - <menu_item_separator - layout="topleft" /> + <menu_item_separator/> <menu_item_call label="Bug Reporting 101" - layout="topleft" name="Bug Reporing 101"> <menu_item_call.on_click function="PromptShowURL" @@ -3659,7 +3186,6 @@ </menu_item_call> <menu_item_call label="Security Issues" - layout="topleft" name="Security Issues"> <menu_item_call.on_click function="PromptShowURL" @@ -3668,7 +3194,6 @@ </menu_item_call> <menu_item_call label="QA Wiki" - layout="topleft" name="QA Wiki"> <menu_item_call.on_click function="PromptShowURL" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 09dac75660..c42b846dbb 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2036,6 +2036,28 @@ Would you be my friend? </notification> <notification + icon="alertmodal.tga" + label="Save Outfit" + name="SaveOutfitAs" + type="alertmodal"> + Save what I'm wearing as a new Outfit: + <form name="form"> + <input name="message" type="text"> + [DESC] (new) + </input> + <button + default="true" + index="0" + name="Offer" + text="OK"/> + <button + index="1" + name="Cancel" + text="Cancel"/> + </form> + </notification> + + <notification icon="alertmodal.tga" name="RemoveFromFriends" type="alertmodal"> @@ -3174,6 +3196,18 @@ Teleport to [PICK]? </notification> <notification + icon="alertmodal.tga" + name="TeleportToHistoryEntry" + type="alertmodal"> +Teleport to [HISTORY_ENTRY]? + <usetemplate + ignoretext="Confirm that I want to teleport to a history location" + name="okcancelignore" + notext="Cancel" + yestext="Teleport"/> + </notification> + + <notification icon="alert.tga" label="Message everyone in your Estate" name="MessageEstate" @@ -4332,6 +4366,13 @@ The string [STRING_NAME] is missing from strings.xml type="notifytip"> [MESSAGE] </notification> + + <notification + icon="notifytip.tga" + name="IMSystemMessageTip" + type="notifytip"> +[MESSAGE] + </notification> <notification icon="notifytip.tga" @@ -5166,7 +5207,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th icon="notify.tga" name="TeleportOffered" type="offer"> -[NAME] has offered to teleport you to their location: +[NAME_SLURL] has offered to teleport you to their location: [MESSAGE] <form name="form"> @@ -5211,7 +5252,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th icon="notify.tga" name="OfferFriendship" type="offer"> -[NAME] is offering friendship. +[NAME_SLURL] is offering friendship. [MESSAGE] @@ -5357,6 +5398,13 @@ Failed to find [TYPE] named [DESC] in database. <notification icon="notify.tga" + name="ShareToWebFailed" + type="notify"> + Failed to upload image to web. + </notification> + + <notification + icon="notify.tga" name="InvalidWearable" type="notify"> The item you are trying to wear uses a feature that your Viewer can't read. Please upgrade your version of [APP_NAME] to wear this item. diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index 58c5c11e51..c34a367c32 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -263,7 +263,7 @@ top="0" name="chiclet_list_panel" width="189" - min_width="60" + min_width="95" user_resize="false" auto_resize="true"> <!--*NOTE: min_width of the chiclet_panel (chiclet_list) must be the same @@ -274,7 +274,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. height="24" layout="topleft" left="1" - min_width="60" + min_width="95" name="chiclet_list" top="7" chiclet_padding="4" @@ -330,7 +330,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. min_width="4" name="DUMMY" top="0" - width="5"/> + width="4"/> <layout_panel auto_resize="false" follows="right" @@ -339,8 +339,8 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. min_height="28" top="0" name="im_well_panel" - width="35" - min_width="35" + width="37" + min_width="37" user_resize="false"> <chiclet_im_well max_displayed_count="99" @@ -388,22 +388,10 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well layout="topleft" min_height="28" top="0" - left_pad="3" name="notification_well_panel" - width="40" - min_width="40" + width="37" + min_width="37" user_resize="false"> - <icon - auto_resize="false" - color="0 0 0 0" - follows="left|right" - height="10" - image_name="spacer24.tga" - layout="topleft" - left="0" - min_width="4" - top="0" - width="5" /> <chiclet_notification flash_period="0.25" follows="right" @@ -434,17 +422,6 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well function="Button.SetDockableFloaterToggle" parameter="notification_well_window" /> </button> - <icon - auto_resize="false" - color="0 0 0 0" - follows="left|right" - height="10" - image_name="spacer24.tga" - layout="topleft" - left="0" - min_width="4" - top="0" - width="5" /> </chiclet_notification> </layout_panel> </layout_stack> diff --git a/indra/newview/skins/default/xui/en/panel_chat_header.xml b/indra/newview/skins/default/xui/en/panel_chat_header.xml index 250dadd390..9124ad528d 100644 --- a/indra/newview/skins/default/xui/en/panel_chat_header.xml +++ b/indra/newview/skins/default/xui/en/panel_chat_header.xml @@ -21,6 +21,7 @@ top="3" width="18" /> <text + allow_html="false" allow_scroll="false" v_pad = "7" read_only = "true" diff --git a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml index 996e28c575..af3315ebfe 100644 --- a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml @@ -65,6 +65,7 @@ left="103" name="description" textbox.max_length="1024" + textbox.label="More" textbox.show_context_menu="false" top_pad="0" width="178" diff --git a/indra/newview/skins/default/xui/en/panel_group_notices.xml b/indra/newview/skins/default/xui/en/panel_group_notices.xml index 731b3c119c..479629f6ea 100644 --- a/indra/newview/skins/default/xui/en/panel_group_notices.xml +++ b/indra/newview/skins/default/xui/en/panel_group_notices.xml @@ -131,6 +131,7 @@ Maximum 200 per group daily Subject: </text> <line_editor + follows="left|top|right" border_style="line" border_thickness="1" height="16" @@ -153,6 +154,7 @@ Maximum 200 per group daily Message: </text> <text_editor + follows="left|top|right" height="90" layout="topleft" left_pad="3" @@ -173,6 +175,7 @@ Maximum 200 per group daily Attach: </text> <line_editor + follows="left|top|right" enabled="false" height="19" layout="topleft" @@ -222,7 +225,7 @@ Maximum 200 per group daily label="Send" label_selected="Send" layout="topleft" - right="-10" + right="-25" top_pad="10" name="send_notice" width="100" /> diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml index 88566ea037..7d7e21d4b0 100644 --- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml @@ -16,7 +16,7 @@ border_size="0" clip="false" follows="all" - height="168" + height="183" layout="topleft" left="5" name="button_stack" diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml index befeb182f9..31ba539c44 100644 --- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml +++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml @@ -133,6 +133,7 @@ layout="topleft" left="10" name="description" + textbox.label="More" top_pad="10" value="Du waltz die spritz" width="280" /> diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml index 639e5d30ef..a7e87f2a1e 100644 --- a/indra/newview/skins/default/xui/en/panel_landmarks.xml +++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml @@ -16,7 +16,7 @@ bg_alpha_color="DkGray2" bg_opaque_color="DkGray2" follows="all" - height="369" + height="373" layout="topleft" left="3" name="landmarks_accordion" diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index dd6c75d497..539c5f785c 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -64,7 +64,6 @@ Username: </text> <line_editor follows="left|bottom" -handle_edit_keys_directly="true" height="22" label="Username" left_delta="0" @@ -86,7 +85,6 @@ top="20" </text> <line_editor follows="left|bottom" -handle_edit_keys_directly="true" height="22" max_length="16" name="password_edit" diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index bef62f48e0..1b04d01abf 100644 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -9,22 +9,22 @@ min_width="240" name="main inventory panel" width="330"> - <panel.string - name="Itemcount"> - </panel.string> - <panel.string - name="ItemcountFetching"> - Fetching [ITEM_COUNT] Items... [FILTER] - </panel.string> - <panel.string - name="ItemcountCompleted"> - [ITEM_COUNT] Items [FILTER] - </panel.string> - <panel.string - name="ItemcountUnknown"> + <panel.string + name="Itemcount"> + </panel.string> + <panel.string + name="ItemcountFetching"> + Fetching [ITEM_COUNT] Items... [FILTER] + </panel.string> + <panel.string + name="ItemcountCompleted"> + [ITEM_COUNT] Items [FILTER] + </panel.string> + <panel.string + name="ItemcountUnknown"> - </panel.string> - <text + </panel.string> + <text type="string" length="1" follows="left|top" @@ -36,487 +36,124 @@ text_color="EmphasisColor" top_pad="0" width="300"> - Items: - </text> - <menu_bar - bg_visible="false" - follows="left|top|right" - height="20" + Items: + </text> + <filter_editor + text_pad_left="10" + follows="left|top|right" + height="23" + label="Filter Inventory" + layout="topleft" + left="10" + max_length="300" + name="inventory search editor" + top="3" + width="303" /> + <tab_container + bg_alpha_color="DkGray" + bg_opaque_color="DkGray" + background_visible="true" + background_opaque="true" + follows="all" + halign="center" + height="339" layout="topleft" - left="10" - mouse_opaque="false" - name="Inventory Menu" - top="+10" - visible="true" - width="290"> - <menu - height="101" - label="File" - layout="topleft" - left="0" - mouse_opaque="false" - name="File" - tear_off="true" - top="-117" - width="128"> - <menu_item_call - label="Open" - layout="topleft" - name="Open"> - <menu_item_call.on_click - function="Inventory.DoToSelected" - parameter="open" /> - </menu_item_call> - <menu - create_jump_keys="true" - label="Upload" - layout="topleft" - name="upload" - tear_off="true"> - <menu_item_call - label="Image (L$[COST])..." - layout="topleft" - name="Upload Image" - shortcut="control|U"> - <menu_item_call.on_click - function="File.UploadImage" - parameter="" /> - <menu_item_call.on_enable - function="File.EnableUpload" /> - </menu_item_call> - <menu_item_call - label="Sound (L$[COST])..." - layout="topleft" - name="Upload Sound"> - <menu_item_call.on_click - function="File.UploadSound" - parameter="" /> - <menu_item_call.on_enable - function="File.EnableUpload" /> - </menu_item_call> - <menu_item_call - label="Animation (L$[COST])..." - layout="topleft" - name="Upload Animation"> - <menu_item_call.on_click - function="File.UploadAnim" - parameter="" /> - <menu_item_call.on_enable - function="File.EnableUpload" /> - </menu_item_call> - <menu_item_call - label="Bulk (L$[COST] per file)..." - layout="topleft" - name="Bulk Upload"> - <menu_item_call.on_click - function="File.UploadBulk" - parameter="" /> - </menu_item_call> - <menu_item_separator - layout="topleft" /> - </menu> - <menu_item_separator - layout="topleft" /> - <menu_item_call - label="New Window" - layout="topleft" - name="New Window"> - <menu_item_call.on_click - function="Inventory.NewWindow" /> - </menu_item_call> - <menu_item_separator - layout="topleft" - name="separator2" /> - <menu_item_call - label="Show Filters" - layout="topleft" - name="Show Filters"> - <menu_item_call.on_click - function="Inventory.ShowFilters" /> - </menu_item_call> - <menu_item_call - label="Reset Filters" - layout="topleft" - name="Reset Current"> - <menu_item_call.on_click - function="Inventory.ResetFilters" /> - </menu_item_call> - <menu_item_call - label="Close All Folders" - layout="topleft" - name="Close All Folders"> - <menu_item_call.on_click - function="Inventory.CloseAllFolders" /> - </menu_item_call> - <menu_item_separator - layout="topleft" - name="separator3" /> - <menu_item_call - label="Empty Trash" - layout="topleft" - name="Empty Trash"> - <menu_item_call.on_click - function="Inventory.EmptyTrash" /> - </menu_item_call> - <menu_item_call - label="Empty Lost And Found" - layout="topleft" - name="Empty Lost And Found"> - <menu_item_call.on_click - function="Inventory.EmptyLostAndFound" /> - </menu_item_call> - </menu> - <menu - height="121" - label="Create" - layout="topleft" - left="0" - mouse_opaque="false" - name="Create" - tear_off="true" - top="-201" - width="121"> - <menu_item_call - label="New Folder" - layout="topleft" - name="New Folder"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="category" /> - </menu_item_call> - <menu_item_call - label="New Script" - layout="topleft" - name="New Script"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="lsl" /> - </menu_item_call> - <menu_item_call - label="New Notecard" - layout="topleft" - name="New Note"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="notecard" /> - </menu_item_call> - <menu_item_call - label="New Gesture" - layout="topleft" - name="New Gesture"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="gesture" /> - </menu_item_call> - <menu - height="175" - label="New Clothes" - layout="topleft" - left_delta="0" - mouse_opaque="false" - name="New Clothes" - top_pad="514" - width="125"> - <menu_item_call - label="New Shirt" - layout="topleft" - name="New Shirt"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="shirt" /> - </menu_item_call> - <menu_item_call - label="New Pants" - layout="topleft" - name="New Pants"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="pants" /> - </menu_item_call> - <menu_item_call - label="New Shoes" - layout="topleft" - name="New Shoes"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="shoes" /> - </menu_item_call> - <menu_item_call - label="New Socks" - layout="topleft" - name="New Socks"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="socks" /> - </menu_item_call> - <menu_item_call - label="New Jacket" - layout="topleft" - name="New Jacket"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="jacket" /> - </menu_item_call> - <menu_item_call - label="New Skirt" - layout="topleft" - name="New Skirt"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="skirt" /> - </menu_item_call> - <menu_item_call - label="New Gloves" - layout="topleft" - name="New Gloves"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="gloves" /> - </menu_item_call> - <menu_item_call - label="New Undershirt" - layout="topleft" - name="New Undershirt"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="undershirt" /> - </menu_item_call> - <menu_item_call - label="New Underpants" - layout="topleft" - name="New Underpants"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="underpants" /> - </menu_item_call> - <menu_item_call - label="New Alpha" - layout="topleft" - name="New Alpha"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="alpha" /> - </menu_item_call> - <menu_item_call - label="New Tattoo" - layout="topleft" - name="New Tattoo"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="tattoo" /> - </menu_item_call> - </menu> - <menu - height="85" - label="New Body Parts" - layout="topleft" - left_delta="0" - mouse_opaque="false" - name="New Body Parts" - top_pad="514" - width="118"> - <menu_item_call - label="New Shape" - layout="topleft" - name="New Shape"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="shape" /> - </menu_item_call> - <menu_item_call - label="New Skin" - layout="topleft" - name="New Skin"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="skin" /> - </menu_item_call> - <menu_item_call - label="New Hair" - layout="topleft" - name="New Hair"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="hair" /> - </menu_item_call> - <menu_item_call - label="New Eyes" - layout="topleft" - name="New Eyes"> - <menu_item_call.on_click - function="Inventory.DoCreate" - parameter="eyes" /> - </menu_item_call> - </menu> - </menu> - <menu - height="49" - label="Sort" - layout="topleft" - left="0" - mouse_opaque="false" - name="Sort" - tear_off="true" - top="-113" - width="118"> - <menu_item_check - control_name="Inventory.SortByName" - label="By Name" - layout="topleft" - name="By Name"> - <menu_item_check.on_click - function="Inventory.SetSortBy" - parameter="name" /> - </menu_item_check> - <menu_item_check - control_name="Inventory.SortByDate" - label="By Date" - layout="topleft" - name="By Date"> - <menu_item_check.on_click - function="Inventory.SetSortBy" - parameter="date" /> - </menu_item_check> - <menu_item_separator - layout="topleft" /> - <menu_item_check - control_name="Inventory.FoldersAlwaysByName" - label="Folders Always By Name" - layout="topleft" - name="Folders Always By Name"> - <menu_item_check.on_click - function="Inventory.SetSortBy" - parameter="foldersalwaysbyname" /> - </menu_item_check> - <menu_item_check - control_name="Inventory.SystemFoldersToTop" - label="System Folders To Top" - layout="topleft" - name="System Folders To Top"> - <menu_item_check.on_click - function="Inventory.SetSortBy" - parameter="systemfolderstotop" /> - </menu_item_check> - </menu> - </menu_bar> - <filter_editor - text_pad_left="10" - follows="left|top|right" - height="23" - label="Filter Inventory" + left="7" + name="inventory filter tabs" + tab_height="30" + tab_position="top" + tab_min_width="100" + top_pad="10" + width="312"> + <inventory_panel + bg_opaque_color="DkGray2" + bg_alpha_color="DkGray2" + background_visible="true" + background_opaque="true" + border="false" + bevel_style="none" + follows="all" + height="338" + label="MY INVENTORY" + help_topic="my_inventory_tab" layout="topleft" - left="10" - max_length="300" - name="inventory search editor" - top="+31" - width="303" /> - <tab_container - bg_opaque_color="DkGray2" - bg_alpha_color="DkGray2" - background_visible="true" - background_opaque="true" - follows="all" - halign="center" - height="306" - layout="topleft" - left="7" - name="inventory filter tabs" - tab_height="30" - tab_position="top" - tab_min_width="100" - top_pad="10" - width="312"> - <inventory_panel - bg_opaque_color="DkGray2" - bg_alpha_color="DkGray2" - background_visible="true" - background_opaque="true" - border="false" - bevel_style="none" - follows="all" - height="295" - label="MY INVENTORY" - help_topic="my_inventory_tab" - layout="topleft" - left="0" - name="All Items" - sort_order_setting="InventorySortOrder" - top="16" - width="288" /> - <inventory_panel - bg_opaque_color="DkGray2" - bg_alpha_color="DkGray2" - background_visible="true" - background_opaque="true" - border="false" - bevel_style="none" - follows="all" - height="293" - label="RECENT" - help_topic="recent_inventory_tab" - layout="topleft" - left_delta="0" - name="Recent Items" - width="290" /> - </tab_container> - - <panel - background_visible="true" + left="0" + name="All Items" + sort_order_setting="InventorySortOrder" + top="16" + width="288" /> + <inventory_panel + bg_opaque_color="DkGray2" + bg_alpha_color="DkGray2" + background_visible="true" + background_opaque="true" + border="false" bevel_style="none" - follows="left|right|bottom" - height="27" + follows="all" + height="338" + label="RECENT" + help_topic="recent_inventory_tab" layout="topleft" - top_pad="4" - left="10" - name="bottom_panel" - width="310"> - <button - follows="bottom|left" - tool_tip="Show additional options" - height="25" - image_hover_unselected="Toolbar_Left_Over" - image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Left_Selected" - image_unselected="Toolbar_Left_Off" - layout="topleft" - left="0" - name="options_gear_btn" - top="1" - width="31" /> - <button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="AddItem_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="add_btn" - tool_tip="Add new item" - width="31" /> - <icon - follows="bottom|left" - height="25" - image_name="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="dummy_icon" - width="209" - /> - <dnd_button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Right_Over" - image_overlay="TrashItem_Off" - image_selected="Toolbar_Right_Selected" - image_unselected="Toolbar_Right_Off" - left_pad="1" - layout="topleft" - name="trash_btn" - tool_tip="Remove selected item" - width="31"/> - </panel> + left_delta="0" + name="Recent Items" + width="290" /> + </tab_container> - + <panel + background_visible="true" + bevel_style="none" + follows="left|right|bottom" + height="27" + layout="topleft" + top_pad="-1" + left="10" + name="bottom_panel" + width="310"> + <button + follows="bottom|left" + tool_tip="Show additional options" + height="25" + image_hover_unselected="Toolbar_Left_Over" + image_overlay="OptionsMenu_Off" + image_selected="Toolbar_Left_Selected" + image_unselected="Toolbar_Left_Off" + layout="topleft" + left="0" + name="options_gear_btn" + top="1" + width="31" /> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="AddItem_Off" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + layout="topleft" + left_pad="1" + name="add_btn" + tool_tip="Add new item" + width="31" /> + <icon + follows="bottom|left" + height="25" + image_name="Toolbar_Middle_Off" + layout="topleft" + left_pad="1" + name="dummy_icon" + width="209" + /> + <dnd_button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Right_Over" + image_overlay="TrashItem_Off" + image_selected="Toolbar_Right_Selected" + image_unselected="Toolbar_Right_Off" + left_pad="1" + layout="topleft" + name="trash_btn" + tool_tip="Remove selected item" + width="31"/> + </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml index 4112b65635..5e41d65720 100644 --- a/indra/newview/skins/default/xui/en/panel_my_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_my_profile.xml @@ -117,6 +117,8 @@ layout="topleft" left="107" textbox.max_length="512" + textbox.label="More" + textbox.show_context_menu="true" name="sl_description_edit" top_pad="-3" translate="false" @@ -171,6 +173,8 @@ layout="topleft" left="107" textbox.max_length="512" + textbox.label="More" + textbox.show_context_menu="true" name="fl_description_edit" top_pad="-3" translate="false" @@ -311,6 +315,8 @@ name="sl_groups" top_pad="0" translate="false" + textbox.label="More" + textbox.show_context_menu="true" width="298" expanded_bg_visible="true" expanded_bg_color="DkGray"> diff --git a/indra/newview/skins/default/xui/en/panel_nearby_media.xml b/indra/newview/skins/default/xui/en/panel_nearby_media.xml index d14712a7fa..53dda1927a 100644 --- a/indra/newview/skins/default/xui/en/panel_nearby_media.xml +++ b/indra/newview/skins/default/xui/en/panel_nearby_media.xml @@ -2,34 +2,34 @@ <panel can_resize="true" can_close="false" - mouse_opaque="true" - bg_opaque_image="Volume_Background" - bg_alpha_image="Volume_Background" - background_opaque="true" + bg_opaque_image="Volume_Background" + bg_alpha_image="Volume_Background" + background_opaque="true" background_visible="true" layout="topleft" width="270" - height="235" + height="230" name="nearby_media" help_topic="nearby_media"> + <string name="media_item_count_format">(%ld media items)</string> <string name="empty_item_text"><empty></string> <string name="parcel_media_name">Parcel Streaming Media</string> <string name="parcel_audio_name">Parcel Streaming Audio</string> <string name="playing_suffix">(playing)</string> <panel bevel_style="in" - background_visible="false" + background_visible="false" follows="left|right|top" top="0" - height="30" + height="35" name="minimized_controls" left="0"> <button name="all_nearby_media_disable_btn" follows="left" tool_tip="Turn all nearby media off" - left="15" - width="60" + left="8" + width="66" height="22" label="Stop All"> <button.commit_callback @@ -40,7 +40,7 @@ follows="left" tool_tip="Turn all nearby media on" left_pad="4" - width="60" + width="66" height="22" label="Start All"> <button.commit_callback @@ -68,8 +68,8 @@ follows="right" tool_tip="Advanced Controls" top_delta="0" - right="-10" - width="60" + right="-8" + width="66" height="22" toggle="true" label="More >>" @@ -95,7 +95,6 @@ follows="top|left" font="SansSerif" left="10" - name="nearby_media" width="100"> Nearby Media </text> @@ -106,7 +105,6 @@ font="SansSerif" top_pad="15" left="10" - name="show" width="40"> Show: </text> @@ -135,7 +133,6 @@ name="OnOthers" /> </combo_box> <scroll_list - name="media_list" follows="left|top|bottom|right" column_padding="0" height="105" @@ -144,7 +141,8 @@ bg_stripe_color="0.25 0.25 0.25 0.25" top_pad="8" left="10" - right="-10"> + right="-10" + name="media_list"> <scroll_list.columns type="checkbox" width="-1" @@ -181,7 +179,6 @@ top_pad="5" height="30" left="10" - name="media_controls_panel" right="-10"> <layout_stack name="media_controls" @@ -190,12 +187,14 @@ height="26" layout="topleft" top="4" - left="10" + left="8" right="-10" border_size="0" + mouse_opaque="false" orientation="horizontal"> <layout_panel name="stop" + mouse_opaque="false" auto_resize="false" user_resize="false" layout="topleft" @@ -223,6 +222,7 @@ </layout_panel> <layout_panel name="play" + mouse_opaque="false" auto_resize="false" user_resize="false" layout="topleft" @@ -250,6 +250,7 @@ </layout_panel> <layout_panel name="pause" + mouse_opaque="false" auto_resize="false" user_resize="false" layout="topleft" @@ -276,6 +277,7 @@ </layout_panel> <layout_panel name="volume_slider_ctrl" + mouse_opaque="false" auto_resize="true" user_resize="false" follows="left|right" @@ -300,6 +302,7 @@ </layout_panel> <layout_panel name="mute" + mouse_opaque="false" auto_resize="false" user_resize="false" layout="topleft" @@ -328,6 +331,7 @@ </layout_panel> <layout_panel name="zoom" + mouse_opaque="false" auto_resize="false" user_resize="false" layout="topleft" @@ -355,6 +359,7 @@ </layout_panel> <layout_panel name="unzoom" + mouse_opaque="false" auto_resize="false" user_resize="false" layout="topleft" @@ -383,6 +388,7 @@ <layout_panel name="right_bookend" width="0" + mouse_opaque="false" user_resize="false" /> </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml new file mode 100644 index 0000000000..4d3ee07195 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -0,0 +1,346 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- Side tray Outfit Edit panel --> +<panel + background_visible="true" + border="false" + height="600" + follows="all" + label="Outfit Edit" + layout="topleft" + left="0" + min_height="350" + name="outfit_edit" + top="0" + width="320"> + + <panel.string + name="not_available"> + (N\A) + </panel.string> + <panel.string + name="unknown"> + (unknown) + </panel.string> + + + <button + follows="top|left" + height="23" + image_overlay="BackArrow_Off" + layout="topleft" + name="back_btn" + left="5" + tab_stop="false" + top="2" + width="23" /> + <text + follows="top|right" + font="SansSerifHugeBold" + height="26" + layout="topleft" + left_pad="20" + name="title" + text_color="LtGray" + top="0" + value="Edit Outfit" + use_ellipses="true" + width="275" /> + +<!-- "HEADER WITH ICON, STATUS TEXT AND OUTFIT NAME" --> + <panel + bevel_style="none" + follows="top|left|right" + height="45" + label="bottom_panel" + layout="topleft" + left="5" + name="header_panel" + top_pad="5" + width="300"> + <icon + follows="left|top" + height="40" + image_name="t-shirt-image" + left="2" + mouse_opaque="false" + name="outfit_icon" + top="1" + scale_image="true" + visible="true" + width="35" /> + <panel + bevel_style="none" + follows="top|right" + height="40" + label="bottom_panel" + layout="topleft" + left_pad="10" + name="outfit_name_and_status" + top="2" + width="200"> + <text + follows="top|left|right" + font="SansSerif" + height="13" + layout="topleft" + name="status" + text_color="Green" + top="0" + value="Editing..." + use_ellipses="true" + width="275" /> + <text + follows="bottom|left|right" + font="SansSerifHugeBold" + height="26" + layout="topleft" + name="curr_look_name" + text_color="LtGray" + top_pad="0" + value="[Current Outfit]" + use_ellipses="true" + width="275" /> + </panel> + </panel> + + +<!-- LIST OF WEARABLES (CURRENT OUTFIT/ WEARABLES TO ADD) --> + <layout_stack + animate="false" + default_tab_group="2" + follows="all" + height="470" + width="300" + layout="topleft" + orientation="vertical" + name="im_panels" + tab_group="1" + top_pad="10" + left="5"> + <layout_panel + layout="topleft" + follows="left|top|right" + height="220" + label="IM Control Panel" + min_height="100" + name="outfit_wearables_panel" + width="300" + auto_resize="true" + user_resize="true"> + + <scroll_list + width="300" + column_padding="0" + draw_heading="false" + draw_stripes="false" + follows="left|top|right|bottom" + layout="topleft" + name="look_items_list" + search_column="1" + sort_column="2" + left="0" + height="193" + top="0"> + <scroll_list.columns + label="Look Item" + name="look_item" + width="285" /> + <scroll_list.columns + label="Outfit Item Sort" + width="0" + sort_column="look_item_sort" + name="look_item_sort" /> + </scroll_list> + + <panel + background_visible="true" + bevel_style="none" + follows="bottom|left|right" + height="27" + label="bottom_panel" + layout="topleft" + left="0" + name="edit_panel" + top_pad="0" + width="300"> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Left_Over" + image_overlay="OptionsMenu_Off" + image_selected="Toolbar_Left_Selected" + image_unselected="Toolbar_Left_Off" + layout="topleft" + left="0" + name="gear_menu_btn" + top="1" + width="31" /> + <button + is_toggle="true" + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="AddItem_Off" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + layout="topleft" + left_pad="1" + name="add_btn" + top="1" + width="31" /> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + layout="topleft" + left_pad="1" + name="new_btn" + top="1" + width="31" /> + <button + follows="bottom|right" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="TrashItem_Off" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + layout="topleft" + name="trash_btn" + right="-1" + top="1" + width="31" /> + </panel> + </layout_panel> + + + <layout_panel + auto_resize="true" + default_tab_group="3" + height="250" + min_height="120" + name="add_wearables_panel" + width="300" + tab_group="2" + user_resize="true" + visible="false"> + + <text + follows="top|left|right" + font="SansSerifBold" + height="13" + layout="topleft" + left="5" + name="status" + text_color="LtGray" + top="5" + value="Add Wearables" + use_ellipses="true" + width="275" /> + + <filter_editor + background_image="TextField_Search_Off" + follows="left|top|right" + font="SansSerif" + label="Filter" + layout="topleft" + left="5" + width="290" + height="20" + name="look_item_filter" + text_color="black" + text_pad_left="25" /> + + <inventory_panel + allow_multi_select="true" + border="false" + follows="left|top|right|bottom" + height="176" + layout="topleft" + left="0" + mouse_opaque="false" + name="inventory_items" + top_pad="5" + width="300"/> + + <panel + background_visible="true" + bevel_style="none" + follows="left|right|bottom" + height="27" + label="add_wearables_button_bar" + layout="topleft" + left="0" + name="add_wearables_button_bar" + top_pad="0" + width="300"> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Left_Over" + image_overlay="OptionsMenu_Off" + image_selected="Toolbar_Left_Selected" + image_unselected="Toolbar_Left_Off" + layout="topleft" + left="0" + name="wearables_gear_menu_btn" + top="1" + width="31" /> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + label="F" + layout="topleft" + left_pad="1" + name="folder_view_btn" + top="1" + width="31" /> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + label="L" + layout="topleft" + left_pad="1" + name="list_view_btn" + top="1" + width="31" /> + </panel> + </layout_panel> + </layout_stack> + + <panel + follows="left|right|bottom" + height="30" + layout="topleft" + left="5" + top_pad="10" + name="save_revert_button_bar" + width="300"> + <button + follows="bottom|left|right" + height="23" + label="Save" + left="0" + layout="topleft" + name="save_btn" + width="145" /> + <button + follows="bottom|left|right" + height="23" + left_pad="15" + label="Revert" + layout="topleft" + name="revert_btn" + width="145" /> + </panel> +</panel> diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml index 66ef373168..f9ad525642 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml @@ -14,7 +14,7 @@ border="false"> <tab_container follows="all" - height="497" + height="501" layout="topleft" left="7" name="appearance_tabs" @@ -58,7 +58,7 @@ height="73" layout="topleft" left="9" - top_pad="3" + top_pad="-1" visible="true" name="bottom_panel" width="310"> @@ -119,13 +119,13 @@ <button follows="bottom|left" height="23" - label="M" + label="Edit Outfit" layout="topleft" right="-140" name="look_edit_btn" top="26" visible="false" - width="20" /> + width="50" /> </panel> </panel>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 85841da48f..6152dd1587 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -81,7 +81,7 @@ bg_alpha_color="DkGray2" bg_opaque_color="DkGray2" follows="all" - height="352" + height="356" ignore_online_status="true" layout="topleft" left="3" @@ -97,6 +97,7 @@ layout="topleft" left="3" name="bottom_panel" + top_pad="0" width="313"> <button follows="bottom|left" @@ -156,7 +157,7 @@ bg_alpha_color="DkGray2" bg_opaque_color="DkGray2" follows="all" - height="352" + height="356" layout="topleft" left="3" name="friends_accordion" @@ -204,6 +205,7 @@ layout="topleft" left="3" name="bottom_panel" + top_pad="0" width="313"> <button follows="bottom|left" @@ -237,7 +239,7 @@ layout="topleft" left_pad="1" name="dummy_icon" - width="210" + width="209" /> <button follows="bottom|left" @@ -287,7 +289,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t bg_alpha_color="DkGray2" bg_opaque_color="DkGray2" follows="all" - height="352" + height="356" layout="topleft" left="3" name="group_list" @@ -303,6 +305,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t layout="topleft" left="0" name="bottom_panel" + top_pad="0" width="313"> <button follows="bottom|left" @@ -372,7 +375,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t bg_alpha_color="DkGray2" bg_opaque_color="DkGray2" follows="all" - height="352" + height="356" layout="topleft" left="3" multi_select="true" @@ -388,6 +391,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t layout="topleft" left="0" name="bottom_panel" + top_pad="0" width="313"> <button follows="bottom|left" diff --git a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml index 715dc5f23c..41651edaa0 100644 --- a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml @@ -65,6 +65,7 @@ left="103" name="picture_descr" textbox.max_length="1024" + textbox.label="More" textbox.show_context_menu="false" top_pad="0" width="178" diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml index 9e5ef10d42..a43b244fa0 100644 --- a/indra/newview/skins/default/xui/en/panel_place_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml @@ -275,6 +275,7 @@ layout="topleft" left="5" name="description" + textbox.label="More" top_pad="10" value="Du waltz die spritz" width="300" /> @@ -742,7 +743,6 @@ bg_focus_color="DkGray2" bg_readonly_color="DkGray2" follows="left|top|right" - handle_edit_keys_directly="true" height="90" layout="topleft" left="10" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index e604e401f6..69e8e6fdcc 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -186,6 +186,32 @@ Automatic position for: function="Pref.applyUIColor" parameter="BackgroundChatColor" /> </color_swatch> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left="30" + name="UI Size:" + top_pad="5" + width="300"> + UI size + </text> + <slider + control_name="UIScaleFactor" + decimal_digits="2" + follows="left|top" + height="17" + increment="0.025" + initial_value="1" + layout="topleft" + left_delta="52" + max_val="1.4" + min_val="0.75" + name="ui_scale_slider" + top_pad="-14" + width="180" /> <check_box control_name="ShowScriptErrors" follows="left|top" @@ -193,6 +219,7 @@ Automatic position for: label="Show script errors in:" layout="topleft" left="30" + top_pad="10" name="show_script_errors" width="256" /> <radio_group @@ -247,6 +274,7 @@ Automatic position for: top_pad="5" width="200" /> <button + layout="topleft" follows="top|left" enabled_control="EnableVoiceChat" height="23" @@ -257,8 +285,8 @@ Automatic position for: <button.commit_callback function="Pref.VoiceSetKey" /> </button> - <button - enabled_control="EnableVoiceChat" + <button + enabled_control="EnableVoiceChat" follows="top|left" halign="center" height="23" @@ -271,4 +299,15 @@ Automatic position for: <button.commit_callback function="Pref.VoiceSetMiddleMouse" /> </button> + <button + height="23" + label="Other Devices" + left="30" + name="joystick_setup_button" + top_pad="12" + width="155"> + <button.commit_callback + function="Floater.Show" + parameter="pref_joystick" /> + </button> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index e667fa9a2b..9eaabbe77b 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -177,7 +177,7 @@ layout="topleft" left="30" name="start_location_textbox" - top_pad="10" + top_pad="15" width="394"> Start location: </text> @@ -256,26 +256,15 @@ left="50" name="show_my_name_checkbox1" width="300" /> - <check_box - enabled_control="AvatarNameTagMode" - control_name="SmallAvatarNames" - height="16" - initial_value="true" - label="Small name tags" - layout="topleft" - left_delta="175" - name="small_avatar_names_checkbox" - width="200" /> <check_box enabled_control="AvatarNameTagMode" control_name="RenderShowGroupTitleAll" height="16" label="Show group titles" layout="topleft" - left_delta="-175" + left_delta="175" name="show_all_title_checkbox1" - top_pad="5" - width="300" /> + width="200" /> <text type="string" length="1" @@ -354,7 +343,7 @@ left="30" mouse_opaque="false" name="text_box3" - top_pad="10" + top_pad="15" width="240"> Busy mode response: </text> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index c74de043e9..44c44f5f59 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -16,35 +16,8 @@ height="12" layout="topleft" left="30" - name="UI Size:" - top="10" - width="300"> - UI size: - </text> - <slider - can_edit_text="true" - control_name="UIScaleFactor" - decimal_digits="2" - follows="left|top" - height="15" - increment="0.025" - initial_value="1" - layout="topleft" - left_delta="52" - max_val="1.4" - min_val="0.75" - name="ui_scale_slider" - top_pad="2" - width="180" /> - <text - type="string" - length="1" - follows="left|top" - height="12" - layout="topleft" - left="30" name="QualitySpeed" - top_pad="4" + top="10" width="400"> Quality and speed: </text> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 2123e62daa..500e65b916 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -9,18 +9,6 @@ name="Input panel" top="1" width="517"> - <button - height="23" - label="Other Devices" - layout="topleft" - left="30" - name="joystick_setup_button" - top="10" - width="155"> - <button.commit_callback - function="Floater.Show" - parameter="pref_joystick" /> - </button> <text type="string" length="1" @@ -29,7 +17,7 @@ layout="topleft" left="30" name="Mouselook:" - top_pad="10" + top="10" width="300"> Mouselook: </text> @@ -210,7 +198,6 @@ enabled="false" follows="left|top" font="SansSerif" - handle_edit_keys_directly="true" height="23" layout="topleft" left="80" diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml index 30191aecb6..a666608103 100644 --- a/indra/newview/skins/default/xui/en/panel_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_profile.xml @@ -107,6 +107,8 @@ layout="topleft" left="107" textbox.max_length="512" + textbox.label="More" + textbox.show_context_menu="true" name="sl_description_edit" top_pad="-3" translate="false" @@ -151,6 +153,8 @@ layout="topleft" left="107" textbox.max_length="512" + textbox.label="More" + textbox.show_context_menu="true" name="fl_description_edit" top_pad="-3" translate="false" @@ -289,6 +293,8 @@ left="7" name="sl_groups" textbox.max_length="512" + textbox.label="More" + textbox.show_context_menu="true" top_pad="0" translate="false" width="290" diff --git a/indra/newview/skins/default/xui/en/panel_region_covenant.xml b/indra/newview/skins/default/xui/en/panel_region_covenant.xml index dc8f71c868..2b2ea78fac 100644 --- a/indra/newview/skins/default/xui/en/panel_region_covenant.xml +++ b/indra/newview/skins/default/xui/en/panel_region_covenant.xml @@ -113,7 +113,6 @@ max_length="65535" name="covenant_editor" top_delta="30" - handle_edit_keys_directly="true" width="340" word_wrap="true"> There is no Covenant provided for this Estate. diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index d444420550..c5c66c04d5 100644 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -143,7 +143,6 @@ name="Script Editor" width="487" show_line_numbers="true" - handle_edit_keys_directly="true" word_wrap="true"> Loading... </text_editor> diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml index cbcaf1a58c..21addb8e6f 100644 --- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml +++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml @@ -6,7 +6,7 @@ bg_alpha_color="DkGray"> <accordion follows="left|top|right|bottom" - height="369" + height="373" layout="topleft" left="3" top="0" diff --git a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml index cd66c56ca1..7b22b2cce1 100644 --- a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml @@ -32,9 +32,9 @@ parameter="MuteAudio" /> </slider> <button - left="7" + left="10" top_pad="9" - width="18" + width="12" height="12" follows="top|left" name="prefs_btn" diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml index b3d55fec65..20a1de59fc 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml @@ -102,14 +102,17 @@ width="333"> name="newlook_btn" width="100" />--> <panel - class="panel_look_info" - filename="panel_look_info.xml" + class="panel_outfit_edit" + filename="panel_outfit_edit.xml" + height="550" follows="all" layout="topleft" - left="0" - name="panel_look_info" - top="35" - visible="false" /> + left="5" + min_height="410" + name="panel_outfit_edit" + top="5" + visible="false" + width="320"/> <panel class="panel_edit_wearable" filename="panel_edit_wearable.xml" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2a936778fa..9ac4ef9b37 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -123,6 +123,7 @@ or.</string> <!-- ButtonToolTips, llfloater.cpp --> <string name="BUTTON_CLOSE_DARWIN">Close (⌘W)</string> <string name="BUTTON_CLOSE_WIN">Close (Ctrl+W)</string> + <string name="BUTTON_CLOSE_CHROME">Close</string>> <string name="BUTTON_RESTORE">Restore</string> <string name="BUTTON_MINIMIZE">Minimize</string> <string name="BUTTON_TEAR_OFF">Tear Off</string> @@ -3057,6 +3058,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. <string name="unread_chat_multiple"> [SOURCES] have said something new </string>" + <string name="session_initialization_timed_out_error"> + The session initialization is timed out + </string> <!-- Financial operations strings --> <string name="paid_you_ldollars">[NAME] paid you L$[AMOUNT]</string> diff --git a/indra/newview/skins/default/xui/en/widgets/chat_history.xml b/indra/newview/skins/default/xui/en/widgets/chat_history.xml index aa3ea736b8..ef885e8045 100644 --- a/indra/newview/skins/default/xui/en/widgets/chat_history.xml +++ b/indra/newview/skins/default/xui/en/widgets/chat_history.xml @@ -2,7 +2,6 @@ <chat_history message_header="panel_chat_header.xml" message_separator="panel_chat_separator.xml" - message_plaintext_separator="panel_chat_plaintext_separator.xml" left_text_pad="10" right_text_pad="15" left_widget_pad="0" diff --git a/indra/newview/skins/default/xui/en/widgets/expandable_text.xml b/indra/newview/skins/default/xui/en/widgets/expandable_text.xml index d9b6387f0d..6190ea7872 100644 --- a/indra/newview/skins/default/xui/en/widgets/expandable_text.xml +++ b/indra/newview/skins/default/xui/en/widgets/expandable_text.xml @@ -5,7 +5,7 @@ allow_html="true" allow_scroll="true" bg_visible="false" - more_label="More" + label="More" follows="left|top|right" name="text" read_only="true" diff --git a/indra/newview/skins/default/xui/en/widgets/line_editor.xml b/indra/newview/skins/default/xui/en/widgets/line_editor.xml index a21e3f2645..a054960bf8 100644 --- a/indra/newview/skins/default/xui/en/widgets/line_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/line_editor.xml @@ -3,7 +3,6 @@ background_image_disabled="TextField_Disabled" background_image_focused="TextField_Active" select_on_focus="false" - handle_edit_keys_directly="false" commit_on_focus_lost="true" ignore_tab="true" cursor_color="TextCursorColor" diff --git a/indra/newview/skins/default/xui/en/widgets/text.xml b/indra/newview/skins/default/xui/en/widgets/text.xml index 855584a0db..998ec5b170 100644 --- a/indra/newview/skins/default/xui/en/widgets/text.xml +++ b/indra/newview/skins/default/xui/en/widgets/text.xml @@ -15,6 +15,7 @@ bg_visible="false" border_visible="false" hover="false" + sound_flags="0" text_color="LabelTextColor" v_pad="0" max_length="4096"/> diff --git a/indra/newview/skins/default/xui/es/language_settings.xml b/indra/newview/skins/default/xui/es/language_settings.xml index 71418d446a..1ade4ba300 100644 --- a/indra/newview/skins/default/xui/es/language_settings.xml +++ b/indra/newview/skins/default/xui/es/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">spanish</string> + <string name="DarwinLocale">es_ES.UTF-8</string> + <string name="LinuxLocale">es_ES.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/fr/language_settings.xml b/indra/newview/skins/default/xui/fr/language_settings.xml index 71418d446a..117ae16ee8 100644 --- a/indra/newview/skins/default/xui/fr/language_settings.xml +++ b/indra/newview/skins/default/xui/fr/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">french</string> + <string name="DarwinLocale">fr_FR.UTF-8</string> + <string name="LinuxLocale">fr_FR.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/it/language_settings.xml b/indra/newview/skins/default/xui/it/language_settings.xml index 71418d446a..82cf789a6b 100644 --- a/indra/newview/skins/default/xui/it/language_settings.xml +++ b/indra/newview/skins/default/xui/it/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">italian</string> + <string name="DarwinLocale">it_IT.UTF-8</string> + <string name="LinuxLocale">it_IT.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/ja/language_settings.xml b/indra/newview/skins/default/xui/ja/language_settings.xml index 71418d446a..72382417d9 100644 --- a/indra/newview/skins/default/xui/ja/language_settings.xml +++ b/indra/newview/skins/default/xui/ja/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">japanese</string> + <string name="DarwinLocale">ja_JP.UTF-8</string> + <string name="LinuxLocale">ja_JP.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/nl/language_settings.xml b/indra/newview/skins/default/xui/nl/language_settings.xml index 71418d446a..dc4663705f 100644 --- a/indra/newview/skins/default/xui/nl/language_settings.xml +++ b/indra/newview/skins/default/xui/nl/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">dutch</string> + <string name="DarwinLocale">nl_NL.UTF-8</string> + <string name="LinuxLocale">nl_NL.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/pl/language_settings.xml b/indra/newview/skins/default/xui/pl/language_settings.xml index 71418d446a..debc451a33 100644 --- a/indra/newview/skins/default/xui/pl/language_settings.xml +++ b/indra/newview/skins/default/xui/pl/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">polish</string> + <string name="DarwinLocale">pl_PL.UTF-8</string> + <string name="LinuxLocale">pl_PL.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/newview/skins/default/xui/pt/language_settings.xml b/indra/newview/skins/default/xui/pt/language_settings.xml index 71418d446a..f25e77574d 100644 --- a/indra/newview/skins/default/xui/pt/language_settings.xml +++ b/indra/newview/skins/default/xui/pt/language_settings.xml @@ -3,9 +3,9 @@ <strings> <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> + <string name="MicrosoftLocale">portuguese</string> + <string name="DarwinLocale">pt_PT.UTF-8</string> + <string name="LinuxLocale">pt_PT.UTF-8</string> <!-- datetimeToCodes["wkday"] = "%a"; // Thu diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index 5677308fb0..7e9a8336e7 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -1955,7 +1955,7 @@ void LLMediaPluginTest::updateStatusBar() cached_distance == mDistanceCameraToSelectedGeometry ) { - // nothing changed so don't spend time in this shitty function + // nothing changed so don't spend time here return; }; |