diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 6aea07fd0..8391f3d2f 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -103,12 +103,10 @@ LLAssetDictionary::LLAssetDictionary() //addEntry(LLAssetType::AT_FAVORITE, new AssetEntry("FAVORITE", "favorite", "", 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_CURRENT_OUTFIT, new AssetEntry("FOLDER_LINK", "current", "current outfit", false, false, false)); - //addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", false, false, false)); - //addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", false, false, false)); -#if MESH_ENABLED - addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, false, false)); -#endif //MESH_ENABLED + addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("FOLDER_LINK", "current", "current outfit", false, false, false)); + addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", false, false, false)); + addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", false, false, false)); + addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, true, true)); addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, false, false, false)); }; diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 4590fc831..c253754ab 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -139,18 +139,16 @@ public: // Inventory folder link AT_LINK_FOLDER = 25, - //AT_CURRENT_OUTFIT = 46, + AT_CURRENT_OUTFIT = 46, - //AT_OUTFIT = 47, + AT_OUTFIT = 47, - //AT_MY_OUTFITS = 48, + AT_MY_OUTFITS = 48, -#if MESH_ENABLED AT_MESH = 49, // Mesh data in our proprietary SLM format AT_COUNT = 50, -#endif //MESH_ENABLED // +*********************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | // +*********************************************+ @@ -160,10 +158,6 @@ public: // | 4. ADD TO LLAssetType::mAssetTypeHumanNames | // +*********************************************+ - //AT_COUNT = 49, -#if !MESH_ENABLED - AT_COUNT = 26, -#endif //!MESH_ENABLED AT_NONE = -1 }; diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h index 1a5678dde..ef0582f95 100644 --- a/indra/llcommon/stdenums.h +++ b/indra/llcommon/stdenums.h @@ -55,7 +55,8 @@ enum EDragAndDropType DAD_ANIMATION = 12, DAD_GESTURE = 13, DAD_LINK = 14, - DAD_COUNT = 15, // number of types in this enum + DAD_MESH = 15, + DAD_COUNT = 16, // number of types in this enum }; // Reasons for drags to be denied. diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 0f8c0cd53..ebe961aa8 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -165,7 +165,7 @@ U8* LLImageBase::allocateData(S32 size) { deleteData(); // virtual mBadBufferAllocation = FALSE ; - mData = new U8[size]; + mData = new (std::nothrow) U8[size]; if (!mData) { llwarns << "allocate image data: " << size << llendl; @@ -186,7 +186,7 @@ U8* LLImageBase::reallocateData(S32 size) return mData; LLMemType mt1((LLMemType::EMemType)mMemType); - U8 *new_datap = new U8[size]; + U8 *new_datap = new (std::nothrow) U8[size]; if (!new_datap) { llwarns << "Out of memory in LLImageBase::reallocateData" << llendl; @@ -349,7 +349,7 @@ BOOL LLImageRaw::resize(U16 width, U16 height, S8 components) U8 * LLImageRaw::getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const { LLMemType mt1((LLMemType::EMemType)mMemType); - U8 *data = new U8[width*height*getComponents()]; + U8 *data = new (std::nothrow) U8[width*height*getComponents()]; // Should do some simple bounds checking if (!data) @@ -433,7 +433,7 @@ void LLImageRaw::verticalFlip() { LLMemType mt1((LLMemType::EMemType)mMemType); S32 row_bytes = getWidth() * getComponents(); - U8* line_buffer = new U8[row_bytes]; + U8* line_buffer = new (std::nothrow) U8[row_bytes]; if (!line_buffer ) { llerrs << "Out of memory in LLImageRaw::verticalFlip()" << llendl; @@ -578,7 +578,7 @@ void LLImageRaw::compositeScaled4onto3(LLImageRaw* src) // Vertical: scale but no composite S32 temp_data_size = src->getWidth() * dst->getHeight() * src->getComponents(); - U8* temp_buffer = new U8[ temp_data_size ]; + U8* temp_buffer = new (std::nothrow) U8[ temp_data_size ]; if (!temp_buffer ) { llerrs << "Out of memory in LLImageRaw::compositeScaled4onto3()" << llendl; @@ -835,7 +835,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) // Vertical S32 temp_data_size = src->getWidth() * dst->getHeight() * getComponents(); llassert_always(temp_data_size > 0); - U8* temp_buffer = new U8[ temp_data_size ]; + U8* temp_buffer = new (std::nothrow) U8[ temp_data_size ]; if (!temp_buffer ) { llerrs << "Out of memory in LLImageRaw::copyScaled()" << llendl; @@ -880,7 +880,7 @@ BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height) ratio_x -= 1.0f ; ratio_y -= 1.0f ; - U8* new_data = new U8[new_data_size] ; + U8* new_data = new (std::nothrow) U8[new_data_size] ; llassert_always(new_data != NULL) ; U8* old_data = getData() ; @@ -923,7 +923,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) // Vertical S32 temp_data_size = old_width * new_height * getComponents(); llassert_always(temp_data_size > 0); - U8* temp_buffer = new U8[ temp_data_size ]; + U8* temp_buffer = new (std::nothrow) U8[ temp_data_size ]; if (!temp_buffer ) { llerrs << "Out of memory in LLImageRaw::scale()" << llendl; @@ -951,7 +951,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) { // copy out existing image data S32 temp_data_size = old_width * old_height * getComponents(); - U8* temp_buffer = new U8[ temp_data_size ]; + U8* temp_buffer = new (std::nothrow) U8[ temp_data_size ]; if (!temp_buffer) { llwarns << "Out of memory in LLImageRaw::scale: old (w, h, c) = (" << old_width << ", " << old_height << ", " << (S32)getComponents() << diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index 0aa6840ff..e2de614e1 100644 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -435,7 +435,7 @@ bool LLImageDXT::convertToDXR() S32 nmips = calcNumMips(width,height); S32 total_bytes = getDataSize(); U8* olddata = getData(); - U8* newdata = new U8[total_bytes]; + U8* newdata = new (std::nothrow) U8[total_bytes]; if (!newdata) { llerrs << "Out of memory in LLImageDXT::convertToDXR()" << llendl; diff --git a/indra/llimage/llimagedxt.h b/indra/llimage/llimagedxt.h index bc2d6522d..1a297536b 100644 --- a/indra/llimage/llimagedxt.h +++ b/indra/llimage/llimagedxt.h @@ -33,6 +33,7 @@ #define LL_LLIMAGEDXT_H #include "llimage.h" +#include "llpointer.h" // This class decodes and encodes LL DXT files (which may unclude uncompressed RGB or RGBA mipped data) diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 9640d3e62..fc4829b2b 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -28,6 +28,11 @@ * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ +#if LL_LINUX && defined(LL_STANDALONE) +#include +#include +#endif + #include "linden_common.h" #include "apr_pools.h" @@ -85,9 +90,15 @@ void LLImageJ2C::openDSO() j2cimpl_dso_memory_pool.create(); //attempt to load the shared library +#if LL_LINUX && defined(LL_STANDALONE) + void *dso_handle = dlopen(dso_path.c_str(), RTLD_NOW | RTLD_GLOBAL); + rv = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&j2cimpl_dso_handle, + dso_handle, j2cimpl_dso_memory_pool()); +#else rv = apr_dso_load(&j2cimpl_dso_handle, dso_path.c_str(), j2cimpl_dso_memory_pool()); +#endif //now, check for success if ( rv == APR_SUCCESS ) diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 79353d55b..752ec0ea9 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -43,6 +43,11 @@ LLImageDecodeThread::LLImageDecodeThread(bool threaded) { } +//virtual +LLImageDecodeThread::~LLImageDecodeThread() +{ +} + // MAIN THREAD // virtual S32 LLImageDecodeThread::update(U32 max_time_ms) diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h index 2703af497..061627eba 100644 --- a/indra/llimage/llimageworker.h +++ b/indra/llimage/llimageworker.h @@ -34,7 +34,8 @@ #define LL_LLIMAGEWORKER_H #include "llimage.h" -#include "llqueuedthread.h" +#include "llpointer.h" +#include "llworkerthread.h" class LLImageDecodeThread : public LLQueuedThread { @@ -78,6 +79,8 @@ public: public: LLImageDecodeThread(bool threaded = true); + virtual ~LLImageDecodeThread(); + handle_t decodeImage(LLImageFormatted* image, U32 priority, S32 discard, BOOL needs_aux, Responder* responder); diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index f4ab79d03..f833ec692 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -67,7 +67,9 @@ public: IT_WEARABLE = 18, IT_ANIMATION = 19, IT_GESTURE = 20, - IT_COUNT = 21, + + IT_MESH = 22, + IT_COUNT = 23, IT_NONE = -1 }; diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index f49c657c0..8a941909b 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -332,7 +332,6 @@ public: child = getChild(i); if (child->isInside(data->getPositionGroup())) { - llassert(child->getElementCount() <= gOctreeMaxCapacity); child->insert(data); return false; } diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index 49dbdbd56..242bccde7 100644 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -179,8 +179,8 @@ LLSD LLHTTPAssetRequest::getFullDetails() const double curl_total_time = -1.0f; double curl_size_upload = -1.0f; double curl_size_download = -1.0f; - long curl_content_length_upload = -1; - long curl_content_length_download = -1; + double curl_content_length_upload = -1.0f; + double curl_content_length_download = -1.0f; long curl_request_size = -1; const char* curl_content_type = NULL; @@ -199,8 +199,8 @@ LLSD LLHTTPAssetRequest::getFullDetails() const sd["curl_total_time"] = curl_total_time; sd["curl_size_upload"] = curl_size_upload; sd["curl_size_download"] = curl_size_download; - sd["curl_content_length_upload"] = (int) curl_content_length_upload; - sd["curl_content_length_download"] = (int) curl_content_length_download; + sd["curl_content_length_upload"] = curl_content_length_upload; + sd["curl_content_length_download"] = curl_content_length_download; sd["curl_request_size"] = (int) curl_request_size; if (curl_content_type) { diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index 9bd21f65f..e204eaf2f 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -211,9 +211,9 @@ void LLURLRequest::useProxy(bool use_proxy) } } - lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = \"" << env_proxy << "\"" << llendl; + LL_DEBUGS("Proxy") << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (!env_proxy.empty() ? env_proxy : "(null)") << LL_ENDL; - if (use_proxy) + if (use_proxy && !env_proxy.empty()) { mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, env_proxy); } diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt index 4b5420b6b..231b10bfa 100644 --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -65,6 +65,9 @@ endif (NOT WORD_SIZE EQUAL 32) list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES}) add_library (llplugin ${llplugin_SOURCE_FILES}) +if(LINUX AND STANDALONE) + target_link_libraries (llplugin rt dl) +endif(LINUX AND STANDALONE) add_dependencies(llplugin prepare) diff --git a/indra/llplugin/llplugininstance.cpp b/indra/llplugin/llplugininstance.cpp index 793fb22f4..a8da3051a 100644 --- a/indra/llplugin/llplugininstance.cpp +++ b/indra/llplugin/llplugininstance.cpp @@ -32,6 +32,10 @@ * * @endcond */ +#if LL_LINUX && defined(LL_STANDALONE) +#include +#include +#endif #include "linden_common.h" @@ -83,16 +87,25 @@ int LLPluginInstance::load(std::string &plugin_file) { pluginInitFunction init_function = NULL; +#if LL_LINUX && defined(LL_STANDALONE) + void *dso_handle = dlopen(plugin_file.c_str(), RTLD_NOW | RTLD_GLOBAL); + int result = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&mDSOHandle, + dso_handle, AIAPRRootPool::get()()); +#else int result = apr_dso_load(&mDSOHandle, plugin_file.c_str(), LLAPRRootPool::get()()); +#endif if(result != APR_SUCCESS) { char buf[1024]; apr_dso_error(mDSOHandle, buf, sizeof(buf)); +#if LL_LINUX && defined(LL_STANDALONE) + LL_WARNS("Plugin") << "plugin load " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL; +#else LL_WARNS("Plugin") << "apr_dso_load of " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL; - +#endif } if(result == APR_SUCCESS) diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 0d68738e7..6ba2f323b 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -40,6 +40,7 @@ #include "llpluginmessageclasses.h" #if LL_LINUX #include +#include #endif #include "llapr.h" @@ -406,7 +407,23 @@ void LLPluginProcessParent::idle(void) std::string const terminal_command = (env = getenv("LL_DEBUG_TERMINAL_COMMAND")) ? env : "/usr/bin/xterm -geometry 160x24+0+0 -e %s"; char const* const gdb_path = (env = getenv("LL_DEBUG_GDB_PATH")) ? env : "/usr/bin/gdb"; cmd << gdb_path << " -n /proc/" << mProcess.getProcessID() << "/exe " << mProcess.getProcessID(); - std::vector tokens = boost::program_options::split_unix(terminal_command, " "); + + typedef boost::tokenizer< boost::escaped_list_separator< + char>, typename std::basic_string< + char>::const_iterator, + std::basic_string > tokenizerT; + + tokenizerT tok(terminal_command.begin(), + terminal_command.end(), + boost::escaped_list_separator< char >("\\", + " ", "'\"")); + std::vector< std::basic_string > tokens; + for (typename tokenizerT::iterator + cur_token(tok.begin()), end_token(tok.end()); + cur_token != end_token; ++cur_token) { + if (!cur_token->empty()) + tokens.push_back(*cur_token); + } std::vector::iterator token = tokens.begin(); mDebugger.setExecutable(*token); while (++token != tokens.end()) diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 6c60e507d..fcd577a7d 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -37,7 +37,7 @@ #include "v3math.h" #include "xform.h" #include "message.h" -#include "llmemory.h" +#include "llpointer.h" #include "llvolume.h" #include "lltextureentry.h" #include "llprimtexturelist.h" diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 0a951e7e9..df583eb62 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2418,6 +2418,12 @@ BOOL LLTextEditor::handleEditKey(const KEY key, const MASK mask) } } + if( handled ) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } diff --git a/indra/llvfs/lllfsthread.h b/indra/llvfs/lllfsthread.h index 9b2b542d2..313969330 100644 --- a/indra/llvfs/lllfsthread.h +++ b/indra/llvfs/lllfsthread.h @@ -39,7 +39,7 @@ #include #include "llapr.h" -#include "llmemory.h" // LLPointer +#include "llpointer.h" #include "llqueuedthread.h" //============================================================================ diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 8d927f7e9..e5d61d180 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -49,6 +49,7 @@ set(llwindow_HEADER_FILES set(viewer_SOURCE_FILES llwindow.cpp + llmousehandler.cpp ) set(viewer_HEADER_FILES diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp new file mode 100644 index 000000000..8695e92f7 --- /dev/null +++ b/indra/llwindow/llmousehandler.cpp @@ -0,0 +1,58 @@ +/** + * @file llmousehandler.cpp + * @brief LLMouseHandler class implementation + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llmousehandler.h" + +//virtual +BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) +{ + BOOL handled = FALSE; + if (down) + { + switch (clicktype) + { + case CLICK_LEFT: handled = handleMouseDown(x, y, mask); break; + case CLICK_RIGHT: handled = handleRightMouseDown(x, y, mask); break; + case CLICK_MIDDLE: handled = handleMiddleMouseDown(x, y, mask); break; + case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + default: + llwarns << "Unhandled enum." << llendl; + } + } + else + { + switch (clicktype) + { + case CLICK_LEFT: handled = handleMouseUp(x, y, mask); break; + case CLICK_RIGHT: handled = handleRightMouseUp(x, y, mask); break; + case CLICK_MIDDLE: handled = handleMiddleMouseUp(x, y, mask); break; + case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + default: + llwarns << "Unhandled enum." << llendl; + } + } + return handled; +} diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index f3a2edd8a..7bd0f2eeb 100644 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h @@ -33,9 +33,10 @@ #ifndef LL_MOUSEHANDLER_H #define LL_MOUSEHANDLER_H -#include "llstring.h" +#include "linden_common.h" +#include "llrect.h" -// Abstract interface. +// Mostly-abstract interface. // Intended for use via multiple inheritance. // A class may have as many interfaces as it likes, but never needs to inherit one more than once. @@ -49,13 +50,23 @@ public: SHOW_IF_NOT_BLOCKED, SHOW_ALWAYS, } EShowToolTip; + typedef enum { + CLICK_LEFT, + CLICK_MIDDLE, + CLICK_RIGHT, + CLICK_DOUBLELEFT + } EClickType; + virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + + virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; virtual const std::string& getName() const = 0; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 2023beaf0..59c76d4d0 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1372,7 +1372,7 @@ BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst) BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s) { - return FALSE; // unsupported + return FALSE; // unsupported } #endif // LL_GTK diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index d46ffcdd9..a6b9ff4f9 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -82,6 +82,7 @@ public: /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); /*virtual*/ void setMouseClipping( BOOL b ); + /*virtual*/ BOOL isClipboardTextAvailable(); /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); /*virtual*/ BOOL copyTextToClipboard(const LLWString & src); @@ -89,7 +90,7 @@ public: /*virtual*/ BOOL isPrimaryTextAvailable(); /*virtual*/ BOOL pasteTextFromPrimary(LLWString &dst); /*virtual*/ BOOL copyTextToPrimary(const LLWString & src); - + /*virtual*/ void flashIcon(F32 seconds); /*virtual*/ F32 getGamma(); /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f274020ef..3d3298acc 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -232,6 +232,7 @@ set(viewer_SOURCE_FILES llfloaterproperties.cpp llfloaterregioninfo.cpp llfloaterreporter.cpp + llfloatersearchreplace.cpp llfloaterscriptdebug.cpp llfloatersellland.cpp llfloatersettingsdebug.cpp @@ -478,6 +479,7 @@ set(viewer_SOURCE_FILES llvlmanager.cpp llvoavatar.cpp llvoavatardefines.cpp + llvoavatarself.cpp llvocache.cpp llvoclouds.cpp llvograss.cpp @@ -499,6 +501,7 @@ set(viewer_SOURCE_FILES llwaterparamset.cpp llwearable.cpp llwearablelist.cpp + llwearabletype.cpp llweb.cpp llmediactrl.cpp llwind.cpp @@ -713,6 +716,7 @@ set(viewer_HEADER_FILES llfloaterproperties.h llfloaterregioninfo.h llfloaterreporter.h + llfloatersearchreplace.h llfloaterscriptdebug.h llfloatersellland.h llfloatersettingsdebug.h @@ -960,6 +964,7 @@ set(viewer_HEADER_FILES llvlmanager.h llvoavatar.h llvoavatardefines.h + llvoavatarself.h llvocache.h llvoclouds.h llvograss.h @@ -982,6 +987,7 @@ set(viewer_HEADER_FILES llwaterparamset.h llwearable.h llwearablelist.h + llwearabletype.h llweb.h llmediactrl.h llwind.h diff --git a/indra/newview/app_settings/grass.xml b/indra/newview/app_settings/grass.xml index 4fc3b798a..e59487c2b 100644 --- a/indra/newview/app_settings/grass.xml +++ b/indra/newview/app_settings/grass.xml @@ -1,47 +1,46 @@ - \ No newline at end of file diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ae3059556..3cb5445cd 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -212,7 +212,7 @@ Type Boolean Value - 0 + 1 MediaFilterRect @@ -14538,5 +14538,27 @@ Value 1 + LastGrass + + Comment + The last grass selected in the create dialog + Persist + 1 + Type + String + Value + Random + + LastTree + + Comment + The last tree selected in the create dialog + Persist + 1 + Type + String + Value + Random + diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 4ff96a614..411e159de 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -37,7 +37,7 @@ //project includes #include "llcolorswatch.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llagent.h" #include "llfloaterchat.h" #include "llstartup.h" @@ -98,7 +98,7 @@ void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl, void* userdata) gSavedSettings.setString("AscentReportClientUUID", client_uuid); gSavedSettings.setU32("AscentReportClientIndex", client_index); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (avatar) { diff --git a/indra/newview/cofmgr.cpp b/indra/newview/cofmgr.cpp index 73cd4a930..9de7025f9 100644 --- a/indra/newview/cofmgr.cpp +++ b/indra/newview/cofmgr.cpp @@ -20,7 +20,7 @@ #include "llagentwearables.h" #include "llcommonutils.h" #include "llerror.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "rlvviewer2.h" // ============================================================================ @@ -80,16 +80,16 @@ public: } // Add all currently worn wearables - for (S32 idxType = 0; idxType < WT_COUNT; idxType++) + for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++) { - const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)idxType); + const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType); if (idItem.isNull()) continue; idItems.push_back(idItem); } // Add all currently worn attachments - const LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + const LLVOAvatar* pAvatar = gAgentAvatarp; if (pAvatar) { for (LLVOAvatar::attachment_map_t::const_iterator itAttachPt = pAvatar->mAttachmentPoints.begin(); @@ -335,7 +335,7 @@ void LLCOFMgr::linkPendingAttachments() for (uuid_vec_t::const_iterator itPending = m_PendingAttachLinks.begin(); itPending != m_PendingAttachLinks.end(); ++itPending) { const LLUUID& idAttachItem = *itPending; - if ( (gAgent.getAvatarObject()->isWearingAttachment(idAttachItem)) && (!isLinkInCOF(idAttachItem)) ) + if ( (gAgentAvatarp->isWearingAttachment(idAttachItem)) && (!isLinkInCOF(idAttachItem)) ) { if (!cb) cb = new LLLinkAttachmentCallback(); @@ -354,13 +354,13 @@ void LLCOFMgr::onLinkAttachmentComplete(const LLUUID& idItem) m_PendingAttachLinks.erase(itPending); // It may have been detached already in which case we should remove the COF link - if ( (gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->isWearingAttachment(idItemBase)) ) + if ( (gAgentAvatarp) && (!gAgentAvatarp->isWearingAttachment(idItemBase)) ) removeCOFItemLinks(idItemBase); } void LLCOFMgr::updateAttachments() { - /*const*/ LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + /*const*/ LLVOAvatar* pAvatar = gAgentAvatarp; if (!pAvatar) return; @@ -457,9 +457,9 @@ void LLCOFMgr::synchWearables() // Grab the item UUIDs of all currently worn wearables uuid_vec_t newItems; - for (S32 idxType = 0; idxType < WT_COUNT; idxType++) + for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++) { - const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)idxType); + const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType); if (idItem.isNull()) continue; newItems.push_back(idItem); diff --git a/indra/newview/dofloaterhex.cpp b/indra/newview/dofloaterhex.cpp index c74aff66e..ed700be4c 100644 --- a/indra/newview/dofloaterhex.cpp +++ b/indra/newview/dofloaterhex.cpp @@ -327,7 +327,7 @@ void DOFloaterHex::onClickUpload(void* user_data) fake_asset_id.asString(), item->getType(), item->getInventoryType(), - (EWearableType)item->getFlags(), + (LLWearableType::EType)item->getFlags(), PERM_ITEM_UNRESTRICTED, new NewResourceItemCallback); } diff --git a/indra/newview/floaterao.cpp b/indra/newview/floaterao.cpp index 793c8616a..083891fe8 100644 --- a/indra/newview/floaterao.cpp +++ b/indra/newview/floaterao.cpp @@ -10,7 +10,7 @@ #include "llagent.h" #include "llagentcamera.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llanimationstates.h" #include "lluictrlfactory.h" #include "llinventoryview.h" @@ -420,7 +420,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) { int state = STATE_AGENT_IDLE; std::string stranim = box->getValue().asString(); -// llinfos << "state " << (gAgent.getAvatarObject()->isSitting()) << " - " << getAnimationState() << llendl; +// llinfos << "state " << (gAgentAvatarp->isSitting()) << " - " << getAnimationState() << llendl; if (box->getName() == "walks") { gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_WALK), ANIM_REQUEST_STOP); @@ -441,9 +441,9 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) } else if (box->getName() == "sits") { - if (gAgent.getAvatarObject() && (gSavedSettings.getBOOL("AOEnabled")) && (gSavedSettings.getBOOL("AOSitsEnabled"))) + if (gAgentAvatarp && (gSavedSettings.getBOOL("AOEnabled")) && (gSavedSettings.getBOOL("AOSitsEnabled"))) { - if ((gAgent.getAvatarObject()->isSitting()) && (getAnimationState() == STATE_AGENT_SIT)) + if ((gAgentAvatarp->isSitting()) && (getAnimationState() == STATE_AGENT_SIT)) { // llinfos << "sitting " << GetAnimID(ANIM_AGENT_SIT) << " " << getAssetIDByName(stranim) << llendl; gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_SIT), ANIM_REQUEST_STOP); @@ -456,9 +456,9 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) else if (box->getName() == "gsits") { // llinfos << "gsitting " << GetAnimID(ANIM_AGENT_SIT_GROUND) << " " << getAssetIDByName(stranim) << llendl; - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - if ((gAgent.getAvatarObject()->isSitting()) && (getAnimationState() == STATE_AGENT_GROUNDSIT)) + if ((gAgentAvatarp->isSitting()) && (getAnimationState() == STATE_AGENT_GROUNDSIT)) { // llinfos << "gsitting " << GetAnimID(ANIM_AGENT_SIT_GROUND) << " " << getAssetIDByName(stranim) << llendl; gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_SIT_GROUND), ANIM_REQUEST_STOP); @@ -767,9 +767,9 @@ void LLFloaterAO::run() int LLFloaterAO::getAnimationState() { - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - if (gAgent.getAvatarObject()->isSitting()) setAnimationState(STATE_AGENT_SIT); + if (gAgentAvatarp->isSitting()) setAnimationState(STATE_AGENT_SIT); else if (gAgent.getFlying()) setAnimationState(STATE_AGENT_HOVER); } return mAnimationState; @@ -856,11 +856,11 @@ BOOL LLFloaterAO::ChangeStand() { if (gSavedSettings.getBOOL("AOEnabled")) { - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { if (gSavedSettings.getBOOL("AONoStandsInMouselook") && gAgentCamera.cameraMouselook()) return FALSE; - if (gAgent.getAvatarObject()->isSitting()) + if (gAgentAvatarp->isSitting()) { // stopMotion(getCurrentStandId(), FALSE, TRUE); //stop stand first then set state // if (getAnimationState() != STATE_AGENT_GROUNDSIT) setAnimationState(STATE_AGENT_SIT); @@ -911,9 +911,9 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand) if (id.notNull()) { BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - sitting = gAgent.getAvatarObject()->isSitting(); + sitting = gAgentAvatarp->isSitting(); } if (sitting) return FALSE; gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); diff --git a/indra/newview/floaterlocalassetbrowse.cpp b/indra/newview/floaterlocalassetbrowse.cpp index 90458e09f..5c67eea15 100644 --- a/indra/newview/floaterlocalassetbrowse.cpp +++ b/indra/newview/floaterlocalassetbrowse.cpp @@ -67,7 +67,7 @@ this feature is still a work in progress. /* including to force rebakes when needed */ #include "llagent.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" /* sculpt refresh */ #include "llvovolume.h" @@ -670,7 +670,7 @@ void LocalAssetBrowser::PerformTimedActions(void) // one of the layer bitmaps has been updated, we need to rebake. if ( mLayerUpdated ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (avatar) { avatar->forceBakeAllTextures(SLAM_FOR_DEBUG); } mLayerUpdated = false; diff --git a/indra/newview/hgfloatertexteditor.cpp b/indra/newview/hgfloatertexteditor.cpp index 044c32040..12342b4ba 100644 --- a/indra/newview/hgfloatertexteditor.cpp +++ b/indra/newview/hgfloatertexteditor.cpp @@ -290,7 +290,7 @@ void HGFloaterTextEditor::onClickUpload(void* user_data) fake_asset_id.asString(), item->getType(), item->getInventoryType(), - (EWearableType)item->getFlags(), + (LLWearableType::EType)item->getFlags(), PERM_ITEM_UNRESTRICTED, new NewResourceItemCallback); } diff --git a/indra/newview/importtracker.cpp b/indra/newview/importtracker.cpp index 865f70dd8..af61eec5c 100644 --- a/indra/newview/importtracker.cpp +++ b/indra/newview/importtracker.cpp @@ -306,7 +306,7 @@ struct InventoryImportInfo U32 localid; LLAssetType::EType type; LLInventoryType::EType inv_type; - EWearableType wear_type; + LLWearableType::EType wear_type; LLTransactionID tid; LLUUID assetid; std::string name; diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 34cb59877..64f14a7c8 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -116,10 +116,13 @@ fi export VIEWER_BINARY='singularity-do-not-run-directly' BINARY_TYPE=$(expr match "$(file -b bin/$VIEWER_BINARY)" '\(.*executable\)') +QPP=qt4/plugins/imageformats/ if [ "${BINARY_TYPE}" == "ELF 64-bit LSB executable" ]; then - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib64:"`pwd`"/lib32:"${LD_LIBRARY_PATH}"' + QTPLUGINS=/usr/lib64/$QPP:/lib64/$QPP:/usr/local/lib64/$QPP + export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib64:"`pwd`"/lib32:$QTPLUGINS:"${LD_LIBRARY_PATH}"' else - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:"${LD_LIBRARY_PATH}"' + QTPLUGINS=/usr/lib/$QPP:/lib/$QPP:/usr/local/lib/$QPP + export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:$QTPLUGINS:"${LD_LIBRARY_PATH}"' fi export SL_CMD='$LL_WRAPPER bin/$VIEWER_BINARY' diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f241eeaec..5d733fd8b 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -55,7 +55,6 @@ #include "llmoveview.h" #include "llchatbar.h" #include "llnotificationsutil.h" -#include "llnotify.h" #include "llparcel.h" #include "llrendersphere.h" #include "llsdutil.h" @@ -76,7 +75,7 @@ #include "llviewerparcelmgr.h" #include "llviewerstats.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" #include "llworldmap.h" @@ -141,18 +140,12 @@ BOOL LLAgent::mForceTPose = 0; LLVector3 LLAgent::exlStartMeasurePoint = LLVector3::zero; LLVector3 LLAgent::exlEndMeasurePoint = LLVector3::zero; + const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; std::map LLAgent::sTeleportErrorMessages; std::map LLAgent::sTeleportProgressMessages; -BOOL isAgentAvatarValid() -{ - return (gAgent.getAvatarObject() && - (gAgent.getAvatarObject()->getRegion() != NULL) && - (!gAgent.getAvatarObject()->isDead())); -} - class LLAgentFriendObserver : public LLFriendObserver { public: @@ -209,8 +202,6 @@ LLAgent::LLAgent() : mDistanceTraveled(0.F), mLastPositionGlobal(LLVector3d::zero), - mAvatarObject(NULL), - mRenderState(0), mTypingTimer(), @@ -283,7 +274,6 @@ void LLAgent::init() //----------------------------------------------------------------------------- void LLAgent::cleanup() { - mAvatarObject = NULL; mRegionp = NULL; if(mPendingLure) delete mPendingLure; @@ -329,13 +319,12 @@ void LLAgent::ageChat() 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)); } } - //----------------------------------------------------------------------------- // moveAt() //----------------------------------------------------------------------------- @@ -536,10 +525,10 @@ BOOL LLAgent::getPhantom() void LLAgent::resetClientTag() { - if (!mAvatarObject.isNull()) + if (gAgentAvatarp) { llinfos << "Resetting mClientTag." << llendl; - mAvatarObject->mClientTag = ""; + gAgentAvatarp->mClientTag = ""; } } // @@ -551,13 +540,18 @@ void LLAgent::setFlying(BOOL fly) { if (isAgentAvatarValid()) { - if(fly && mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != mAvatarObject->mSignaledAnimations.end()) + // *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 && 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; } @@ -617,7 +611,7 @@ bool LLAgent::enableFlying() BOOL sitting = FALSE; if (isAgentAvatarValid()) { - sitting = gAgent.getAvatarObject()->isSitting(); + sitting = gAgentAvatarp->isSitting(); } return !sitting; } @@ -820,7 +814,7 @@ LLVector3 LLAgent::getVelocity() const { if (isAgentAvatarValid()) { - return mAvatarObject->getVelocity(); + return gAgentAvatarp->getVelocity(); } else { @@ -839,13 +833,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent) llerrs << "setPositionAgent is not a number" << llendl; } - if (isAgentAvatarValid() && 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); @@ -861,15 +855,14 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent) } } - //----------------------------------------------------------------------------- // getPositionGlobal() //----------------------------------------------------------------------------- const LLVector3d &LLAgent::getPositionGlobal() const { - if (isAgentAvatarValid() && !mAvatarObject->mDrawable.isNull()) + if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull()) { - mPositionGlobal = getPosGlobalFromAgent(mAvatarObject->getRenderPosition()); + mPositionGlobal = getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition()); } else { @@ -884,9 +877,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(); @@ -1018,20 +1011,20 @@ 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 (isAgentAvatarValid() && - mAvatarObject->getParent() && - mAvatarObject->mDrawable.notNull()) + gAgentAvatarp->getParent() && + gAgentAvatarp->mDrawable.notNull()) { 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(); } } @@ -1067,7 +1060,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle) F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward ); - if (isAgentAvatarValid() && mAvatarObject->isSitting()) + if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) { look_down_limit = 130.f * DEG_TO_RAD; } @@ -1215,6 +1208,7 @@ void LLAgent::setAFK() { sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_START); setControlFlags(AGENT_CONTROL_AWAY | AGENT_CONTROL_STOP); + LL_INFOS("AFK") << "Setting Away" << LL_ENDL; gAwayTimer.start(); if (gAFKMenu) { @@ -1237,10 +1231,11 @@ void LLAgent::clearAFK() // without setting the appropriate control flag. JC if (mControlFlags & AGENT_CONTROL_AWAY || (isAgentAvatarValid() - && (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AWAY) != mAvatarObject->mSignaledAnimations.end()))) + && (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatarp->mSignaledAnimations.end()))) { sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP); clearControlFlags(AGENT_CONTROL_AWAY); + LL_INFOS("AFK") << "Clearing Away" << LL_ENDL; if (gAFKMenu) { //*TODO:Translate @@ -1305,7 +1300,8 @@ void LLAgent::startAutoPilotGlobal( const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, - F32 stop_distance, F32 rot_threshold) + F32 stop_distance, + F32 rot_threshold) { if (!isAgentAvatarValid()) { @@ -1360,22 +1356,8 @@ void LLAgent::startAutoPilotGlobal( } mAutoPilot = TRUE; - mAutoPilotTargetGlobal = target_global; + setAutoPilotTargetGlobal(target_global); - // trace ray down to find height of destination from ground - LLVector3d traceEndPt = target_global; - traceEndPt.mdV[VZ] -= 20.f; - - LLVector3d targetOnGround; - LLVector3 groundNorm; - 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]); - - // clamp z value of target to minimum height above ground - mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height; - mAutoPilotTargetDist = (F32)dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal); if (target_rotation) { mAutoPilotUseRotation = TRUE; @@ -1392,6 +1374,32 @@ void LLAgent::startAutoPilotGlobal( } +//----------------------------------------------------------------------------- +// setAutoPilotTargetGlobal +//----------------------------------------------------------------------------- +void LLAgent::setAutoPilotTargetGlobal(const LLVector3d &target_global) +{ + if (mAutoPilot) + { + mAutoPilotTargetGlobal = target_global; + + // trace ray down to find height of destination from ground + LLVector3d traceEndPt = target_global; + traceEndPt.mdV[VZ] -= 20.f; + + LLVector3d targetOnGround; + LLVector3 groundNorm; + LLViewerObject *obj; + + LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj); + 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; + mAutoPilotTargetDist = (F32)dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal); + } +} + //----------------------------------------------------------------------------- // startFollowPilot() //----------------------------------------------------------------------------- @@ -1476,7 +1484,7 @@ void LLAgent::autoPilot(F32 *delta_yaw) if (!isAgentAvatarValid()) return; - if (mAvatarObject->mInAir) + if (gAgentAvatarp->mInAir) { setFlying(TRUE); } @@ -1554,7 +1562,7 @@ void LLAgent::autoPilot(F32 *delta_yaw) { 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) @@ -1637,9 +1645,9 @@ void LLAgent::propagate(const F32 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; @@ -1693,21 +1701,6 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent) // it is no longer needed. Some legacy code must exist in // non-legacy functions, and is labeled with "// legacy" comments. -//----------------------------------------------------------------------------- -// setAvatarObject() -//----------------------------------------------------------------------------- -void LLAgent::setAvatarObject(LLVOAvatar *avatar) -{ - mAvatarObject = avatar; - - if (!avatar) - { - llinfos << "Setting LLAgent::mAvatarObject to NULL" << llendl; - return; - } - gAgentCamera.setAvatarObject(avatar); -} - // TRUE if your own avatar needs to be rendered. Usually only // in third person and build. //----------------------------------------------------------------------------- @@ -1874,24 +1867,24 @@ void LLAgent::endAnimationUpdateUI() // Disable mouselook-specific animations 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); @@ -1966,44 +1959,43 @@ void LLAgent::endAnimationUpdateUI() 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 (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) { @@ -2027,14 +2019,14 @@ void LLAgent::endAnimationUpdateUI() if (isAgentAvatarValid()) { // - //mPauseRequest = mAvatarObject->requestPause(); + //mPauseRequest = gAgentAvatarp->requestPause(); // } } if (isAgentAvatarValid()) { - gAgent.getAvatarObject()->updateAttachmentVisibility(gAgentCamera.getCameraMode()); + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); } gFloaterTools->dirty(); @@ -2121,7 +2113,7 @@ void LLAgent::setStartPosition( U32 location_id ) 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 ); @@ -2211,7 +2203,7 @@ void LLAgent::onAnimStop(const LLUUID& id) setControlFlags(AGENT_CONTROL_FINISH_ANIM); // now trigger dusting self off animation - if (isAgentAvatarValid() && !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) @@ -2390,7 +2382,7 @@ void LLAgent::buildFullname(std::string& name) const { if (isAgentAvatarValid()) { - name = mAvatarObject->getFullname(); + name = gAgentAvatarp->getFullname(); } } @@ -2408,7 +2400,7 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const if (isAgentAvatarValid()) { - name += mAvatarObject->getFullname(); + name += gAgentAvatarp->getFullname(); } } @@ -2554,14 +2546,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO LLQuaternion LLAgent::getHeadRotation() { - if (!isAgentAvatarValid() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp) + if (!isAgentAvatarValid() || !gAgentAvatarp->mPelvisp || !gAgentAvatarp->mHeadp) { return LLQuaternion::DEFAULT; } if (!gAgentCamera.cameraMouselook()) { - return mAvatarObject->getRotation(); + return gAgentAvatarp->getRotation(); } // We must be in mouselook @@ -2570,9 +2562,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; @@ -2718,10 +2710,10 @@ void LLAgent::getName(std::string& name) { name.clear(); - if (mAvatarObject.notNull()) + if (gAgentAvatarp) { - LLNameValue *first_nv = mAvatarObject->getNVPair("FirstName"); - LLNameValue *last_nv = mAvatarObject->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(); @@ -3234,13 +3226,13 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * { gAgentQueryManager.mNumPendingQueries--; - if (!isAgentAvatarValid() || gAgent.getAvatarObject()->isDead()) + if (!isAgentAvatarValid() || gAgentAvatarp->isDead()) { llwarns << "No avatar for user in cached texture update!" << llendl; return; } - if (gAgentCamera.cameraCustomizeAvatar()) + if (isAgentAvatarValid() && gAgentCamera.cameraCustomizeAvatar()) { // ignore baked textures when in customize mode return; @@ -3261,26 +3253,42 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * mesgsys->getUUIDFast(_PREHASH_WearableData, _PREHASH_TextureID, texture_id, texture_block); mesgsys->getU8Fast(_PREHASH_WearableData, _PREHASH_TextureIndex, texture_index, texture_block); - if (texture_id.notNull() - && (S32)texture_index < BAKED_NUM_INDICES - && gAgentQueryManager.mActiveCacheQueries[ texture_index ] == query_id) + + if ((S32)texture_index < TEX_NUM_INDICES ) { - //llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl; - gAgent.getAvatarObject()->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id); - //avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id ); - gAgentQueryManager.mActiveCacheQueries[ texture_index ] = 0; - num_results++; + const LLVOAvatarDictionary::TextureEntry *texture_entry = LLVOAvatarDictionary::instance().getTexture((ETextureIndex)texture_index); + if (texture_entry) + { + EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex; + + if (gAgentQueryManager.mActiveCacheQueries[baked_index] == query_id) + { + if (texture_id.notNull()) + { + //llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl; + gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id); + //gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id ); + gAgentQueryManager.mActiveCacheQueries[baked_index] = 0; + num_results++; + } + else + { + // no cache of this bake. request upload. + gAgentAvatarp->requestLayerSetUpload(baked_index); + } + } + } } } llinfos << "Received cached texture response for " << num_results << " textures." << llendl; - gAgent.getAvatarObject()->updateMeshTextures(); + gAgentAvatarp->updateMeshTextures(); if (gAgentQueryManager.mNumPendingQueries == 0) { // RN: not sure why composites are disabled at this point - gAgent.getAvatarObject()->setCompositeUpdatesEnabled(TRUE); + gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); gAgent.sendAgentSetAppearance(); } } @@ -3335,8 +3343,8 @@ void LLAgent::clearVisualParams(void *data) { if (isAgentAvatarValid()) { - gAgent.getAvatarObject()->clearVisualParamWeights(); - gAgent.getAvatarObject()->updateVisualParams(); + gAgentAvatarp->clearVisualParamWeights(); + gAgentAvatarp->updateVisualParams(); } } @@ -3365,14 +3373,13 @@ bool LLAgent::teleportCore(bool is_local) // Stop all animation before actual teleporting if (isAgentAvatarValid()) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - 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 @@ -3441,8 +3448,8 @@ void LLAgent::teleportRequest( bool is_local = (region_handle == to_region_handle(getPositionGlobal())); if(regionp && teleportCore(is_local)) { - llinfos << "TeleportLocationRequest: '" << region_handle << "':" << pos_local - << llendl; + LL_INFOS("") << "TeleportLocationRequest: '" << region_handle << "':" + << pos_local << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessage("TeleportLocationRequest"); msg->nextBlockFast(_PREHASH_AgentData); @@ -3470,7 +3477,7 @@ void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) if ( (rlv_handler_t::isEnabled()) && ( (gRlvHandler.hasBehaviour(RLV_BHVR_TPLM)) || - ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->isSitting())) )) + ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgentAvatarp) && (gAgentAvatarp->isSitting())) )) { RlvNotifications::notifyBlockedTeleport(); return; @@ -3546,7 +3553,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global) { // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object if ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) || - ( (mAvatarObject.notNull()) && (mAvatarObject->isSitting()) && + ( (gAgentAvatarp) && (gAgentAvatarp->isSitting()) && (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) { RlvNotifications::notifyBlockedTeleport(); @@ -3566,7 +3573,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global) bool calc = gSavedSettings.getBOOL("OptionOffsetTPByAgentHeight"); LLVector3 offset = LLVector3(0.f,0.f,0.f); if(calc) - offset += LLVector3(0.f,0.f,gAgent.getAvatarObject()->getScale().mV[2] / 2.0); + offset += LLVector3(0.f,0.f,gAgentAvatarp->getScale().mV[2] / 2.0); if(regionp && info) { LLVector3d region_origin = info->getGlobalOrigin(); @@ -3674,10 +3681,9 @@ void LLAgent::stopCurrentAnimations() // avatar, propagating this change back to the server. if (isAgentAvatarValid()) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); 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 == @@ -3690,7 +3696,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); } @@ -3803,13 +3809,13 @@ void LLAgent::sendAgentSetAppearance() { if (!isAgentAvatarValid()) return; - if (gAgentQueryManager.mNumPendingQueries > 0 && !gAgentCamera.cameraCustomizeAvatar()) + if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && !gAgentCamera.cameraCustomizeAvatar())) { return; } - llinfos << "TAT: Sent AgentSetAppearance: " << mAvatarObject->getBakedStatusForPrintout() << llendl; + llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << llendl; //dumpAvatarTEs( "sendAgentSetAppearance()" ); LLMessageSystem* msg = gMessageSystem; @@ -3823,7 +3829,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 - LLVector3 body_size = mAvatarObject->mBodySize; + LLVector3 body_size = gAgentAvatarp->mBodySize; body_size.mV[VX] = body_size.mV[VX] + gSavedSettings.getF32("AscentAvatarXModifier"); body_size.mV[VY] = body_size.mV[VY] + gSavedSettings.getF32("AscentAvatarYModifier"); @@ -3838,20 +3844,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->hasPendingBakedUploads() && gAgentWearables.areWearablesLoaded(); + BOOL textures_current = !gAgentAvatarp->hasPendingBakedUploads() && gAgentWearables.areWearablesLoaded(); for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ ) { - const ETextureIndex texture_index = getTextureIndex((EBakedTextureIndex)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(LLWearableType::WT_SKIRT)) { continue; } // IMG_DEFAULT_AVATAR means not baked - if (!mAvatarObject->isTextureDefined(texture_index)) + if (!gAgentAvatarp->isTextureDefined(texture_index)) { textures_current = FALSE; break; @@ -3864,28 +3870,16 @@ void LLAgent::sendAgentSetAppearance() llinfos << "TAT: Sending cached texture data" << llendl; for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = LLVOAvatarDictionary::getInstance()->getWearable((EBakedTextureIndex)baked_index); - LLUUID hash; - for (U8 i=0; i < wearable_dict->mWearablesVec.size(); i++) - { - // EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num]; - const EWearableType wearable_type = wearable_dict->mWearablesVec[i]; - const LLWearable* wearable = gAgentWearables.getWearable(wearable_type); - if (wearable) - { - hash ^= wearable->getID(); - } - } + + const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, true); if (hash.notNull()) { - hash ^= wearable_dict->mHashID; + const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); + + msg->nextBlockFast(_PREHASH_WearableData); + msg->addUUIDFast(_PREHASH_CacheID, hash); + msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index); } - - const ETextureIndex texture_index = getTextureIndex((EBakedTextureIndex)baked_index); - - msg->nextBlockFast(_PREHASH_WearableData); - msg->addUUIDFast(_PREHASH_CacheID, hash); - msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index); } msg->nextBlockFast(_PREHASH_ObjectData); @@ -3903,7 +3897,7 @@ void LLAgent::sendAgentSetAppearance() LLUUID old_teid; U8 client_buffer[UUID_BYTES]; memset(&client_buffer, 0, UUID_BYTES); - LLTextureEntry* entry = (LLTextureEntry*)mAvatarObject->getTE(0); + LLTextureEntry* entry = (LLTextureEntry*)gAgentAvatarp->getTE(0); old_teid = entry->getID(); //You edit this to change the tag in your client. Yes. const char* tag_client = "Ascent"; @@ -3914,16 +3908,16 @@ void LLAgent::sendAgentSetAppearance() //This glow is used to tell if the tag color and name is set or not. entry->setGlow(0.1f); entry->setID(part_a); - mAvatarObject->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID") ); + gAgentAvatarp->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID") ); entry->setID(old_teid); } else {*/ if (gSavedSettings.getBOOL("AscentUseTag")) - mAvatarObject->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID")); + gAgentAvatarp->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID")); else - mAvatarObject->packTEMessage( gMessageSystem, 1, "c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); + gAgentAvatarp->packTEMessage( gMessageSystem, 1, "c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); //} resetClientTag(); @@ -3939,11 +3933,11 @@ void LLAgent::sendAgentSetAppearance() static bool send_physics_params = false; - send_physics_params |= !!gAgentWearables.getWearable(WT_PHYSICS); + send_physics_params |= !!gAgentWearables.getWearable(LLWearableType::WT_PHYSICS); 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) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT { diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 6c36d5392..93e4d84e5 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -87,7 +87,6 @@ struct LLGroupData std::string mName; }; -BOOL isAgentAvatarValid(); // forward declarations @@ -114,12 +113,6 @@ public: void init(); void cleanup(); -//Avatar object decoupled from agent in v2. Access changed to global gAgentAvatarp pointer. Stuff below will vanish. - void setAvatarObject(LLVOAvatar *avatar); //Legacy - LLVOAvatar *getAvatarObject() const { return mAvatarObject; } -private: - LLPointer mAvatarObject; - //-------------------------------------------------------------------- // Login //-------------------------------------------------------------------- @@ -525,8 +518,8 @@ public: F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f); void startFollowPilot(const LLUUID &leader_id); void stopAutoPilot(BOOL user_cancel = FALSE); - void setAutoPilotGlobal(const LLVector3d &pos_global); - void autoPilot(F32 *delta_yaw); // autopilot walking action, angles in radians + void setAutoPilotTargetGlobal(const LLVector3d &target_global); + void autoPilot(F32 *delta_yaw); // Autopilot walking action, angles in radians void renderAutoPilotTarget(); private: BOOL mAutoPilot; diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 2e3f7a829..59325ab3c 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -45,7 +45,7 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llwindow.h" #include "llworld.h" #include "llfloatertools.h" //For gFloaterTools @@ -374,7 +374,7 @@ void LLAgentCamera::unlockView() { if (isAgentAvatarValid()) { - setFocusGlobal(LLVector3d::zero, gAgent.getAvatarObject()->mID); + setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID); } setFocusOnAvatar(FALSE, FALSE); // no animation } @@ -1111,29 +1111,27 @@ void LLAgentCamera::cameraPanUp(F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) { - LLVOAvatar *pAvatar = gAgent.getAvatarObject(); // bleh - static LLVector3 last_at_axis; if (!isAgentAvatarValid()) return; - LLQuaternion av_inv_rot = ~pAvatar->mRoot.getWorldRotation(); - LLVector3 root_at = LLVector3::x_axis * pAvatar->mRoot.getWorldRotation(); + LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot.getWorldRotation(); + LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot.getWorldRotation(); if ((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) && (root_at * last_at_axis > 0.95f)) { - LLVector3 vel = pAvatar->getVelocity(); + LLVector3 vel = gAgentAvatarp->getVelocity(); if (vel.magVecSquared() > 4.f) { - setLookAt(LOOKAT_TARGET_IDLE, pAvatar, vel * av_inv_rot); + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot); } else { // *FIX: rotate mframeagent by sit object's rotation? - LLQuaternion look_rotation = pAvatar->isSitting() ? pAvatar->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current 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, pAvatar, look_offset); + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset); } last_at_axis = root_at; return; @@ -1143,7 +1141,7 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode()) { - setLookAt(LOOKAT_TARGET_NONE, pAvatar, LLVector3(-2.f, 0.f, 0.f)); + setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f)); } else { @@ -1160,9 +1158,9 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) { // range from -.5 to .5 F32 x_from_center = - ((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f; + ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f; F32 y_from_center = - ((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f; + ((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); @@ -1172,7 +1170,7 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) headLookAxis = frameCamera.getAtAxis(); // RN: we use world-space offset for mouselook and freelook //headLookAxis = headLookAxis * av_inv_rot; - setLookAt(lookAtType, pAvatar, headLookAxis); + setLookAt(lookAtType, gAgentAvatarp, headLookAxis); } } @@ -1183,8 +1181,6 @@ void LLAgentCamera::updateCamera() { //static LLFastTimer::DeclareTimer ftm("Camera"); //LLFastTimer t(ftm); - - LLVOAvatar *pAvatar = gAgent.getAvatarObject(); // - changed camera_skyward to the new global "mCameraUpVector" mCameraUpVector = LLVector3::z_axis; @@ -1195,11 +1191,11 @@ void LLAgentCamera::updateCamera() validateFocusObject(); if (isAgentAvatarValid() && - pAvatar->isSitting() && + gAgentAvatarp->isSitting() && camera_mode == CAMERA_MODE_MOUSELOOK) { //changed camera_skyward to the new global "mCameraUpVector" - mCameraUpVector = mCameraUpVector * pAvatar->getRenderRotation(); + mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation(); } if (cameraThirdPerson() && mFocusOnAvatar && LLFollowCamMgr::getActiveFollowCamParams()) @@ -1298,13 +1294,13 @@ void LLAgentCamera::updateCamera() // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. //-------------------------------------------------------------------------------- // *TODO: use combined rotation of frameagent and sit object - LLQuaternion avatarRotationForFollowCam = pAvatar->isSitting() ? pAvatar->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); + LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); if (current_cam) { mFollowCam.copyParams(*current_cam); - mFollowCam.setSubjectPositionAndRotation( pAvatar->getRenderPosition(), avatarRotationForFollowCam ); + mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam ); mFollowCam.update(); LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); } @@ -1380,7 +1376,7 @@ void LLAgentCamera::updateCamera() if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK)) { - pAvatar->updateAttachmentVisibility(mCameraMode); + gAgentAvatarp->updateAttachmentVisibility(mCameraMode); } } else @@ -1476,40 +1472,40 @@ void LLAgentCamera::updateCamera() } gAgent.setLastPositionGlobal(global_pos); - if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !pAvatar->isSitting() && cameraMouselook()) + if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook()) { - LLVector3 head_pos = pAvatar->mHeadp->getWorldPosition() + - LLVector3(0.08f, 0.f, 0.05f) * pAvatar->mHeadp->getWorldRotation() + - LLVector3(0.1f, 0.f, 0.f) * pAvatar->mPelvisp->getWorldRotation(); + 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 * ~pAvatar->mRoot.getWorldRotation(); + diff = diff * ~gAgentAvatarp->mRoot.getWorldRotation(); - LLJoint* torso_joint = pAvatar->mTorsop; - LLJoint* chest_joint = pAvatar->mChestp; + 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 (!pAvatar->mInAir) + 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 = pAvatar->mNeckp; + 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; } - pAvatar->mPelvisp->setPosition(pAvatar->mPelvisp->getPosition() + diff); + gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); - pAvatar->mRoot.updateWorldMatrixChildren(); + gAgentAvatarp->mRoot.updateWorldMatrixChildren(); - for (LLVOAvatar::attachment_map_t::iterator iter = pAvatar->mAttachmentPoints.begin(); - iter != pAvatar->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; @@ -1610,12 +1606,12 @@ LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal() { LLVector3d at_axis(1.0, 0.0, 0.0); LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); - if (isAgentAvatarValid() && gAgent.getAvatarObject()->getParent()) + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) { - LLViewerObject* root_object = (LLViewerObject*)gAgent.getAvatarObject()->getRoot(); + LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot(); if (!root_object->flagCameraDecoupled()) { - agent_rot *= ((LLViewerObject*)(gAgent.getAvatarObject()->getParent()))->getRenderRotation(); + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); } } at_axis = at_axis * agent_rot; @@ -1665,7 +1661,7 @@ LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal() } return mFocusTargetGlobal; } - else if (mSitCameraEnabled && isAgentAvatarValid() && gAgent.getAvatarObject()->isSitting() && mSitCameraReferenceObject.notNull()) + else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull()) { // sit camera LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); @@ -1686,9 +1682,9 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() LLVector3d focus_offset; focus_offset.setVec(gSavedSettings.getVector3("FocusOffsetDefault")); LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); - if (isAgentAvatarValid() && gAgent.getAvatarObject()->getParent()) + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) { - agent_rot *= ((LLViewerObject*)(gAgent.getAvatarObject()->getParent()))->getRenderRotation(); + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); } //focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); @@ -1698,9 +1694,9 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() void LLAgentCamera::setupSitCamera() { // agent frame entering this function is in world coordinates - if (isAgentAvatarValid() && gAgent.getAvatarObject()->getParent()) + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) { - LLQuaternion parent_rot = ((LLViewerObject*)gAgent.getAvatarObject()->getParent())->getRenderRotation(); + 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; @@ -1768,9 +1764,8 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) F32 camera_land_height; LLVector3d frame_center_global = !isAgentAvatarValid() ? gAgent.getPositionGlobal() : - gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mRoot.getWorldPosition()); + gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition()); - LLVOAvatar *pAvatar = gAgent.getAvatarObject(); BOOL isConstrained = FALSE; LLVector3d head_offset; head_offset.setVec(mThirdPersonHeadOffset); @@ -1783,32 +1778,32 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else if (mCameraMode == CAMERA_MODE_MOUSELOOK) { - if (!isAgentAvatarValid() || pAvatar->mDrawable.isNull()) + if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull()) { llwarns << "Null avatar drawable!" << llendl; return LLVector3d::zero; } head_offset.clearVec(); - if (pAvatar->isSitting() && pAvatar->getParent()) + if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent()) { - pAvatar->updateHeadOffset(); - head_offset.mdV[VX] = pAvatar->mHeadOffset.mV[VX]; - head_offset.mdV[VY] = pAvatar->mHeadOffset.mV[VY]; - head_offset.mdV[VZ] = pAvatar->mHeadOffset.mV[VZ] + 0.1f; - const LLMatrix4& mat = ((LLViewerObject*) pAvatar->getParent())->getRenderMatrix(); + 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 - ((gAgent.getAvatarObject()->getPosition()+ - LLVector3(head_offset)*pAvatar->getRotation()) * mat); + ((gAgentAvatarp->getPosition()+ + LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat); } else { - head_offset.mdV[VZ] = pAvatar->mHeadOffset.mV[VZ]; - if (pAvatar->isSitting()) + head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ]; + if (gAgentAvatarp->isSitting()) { head_offset.mdV[VZ] += 0.1; } - camera_position_global = gAgent.getPosGlobalFromAgent(pAvatar->getRenderPosition());//frame_center_global; - head_offset = head_offset * pAvatar->getRenderRotation(); + camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global; + head_offset = head_offset * gAgentAvatarp->getRenderRotation(); camera_position_global = camera_position_global + head_offset; } } @@ -1819,7 +1814,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (mSitCameraEnabled && isAgentAvatarValid() - && pAvatar->isSitting() + && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull()) { // sit camera @@ -1835,9 +1830,9 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); // are we sitting down? - if (isAgentAvatarValid() && pAvatar->getParent()) + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) { - LLQuaternion parent_rot = ((LLViewerObject*)gAgent.getAvatarObject()->getParent())->getRenderRotation(); + 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; @@ -1851,7 +1846,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset ); } - if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !pAvatar->isSitting())) + if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting())) { LLVector3 plane_normal; plane_normal.setVec(mCameraCollidePlane.mV); @@ -1904,7 +1899,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) // set the global camera position LLVector3d camera_offset; - LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : pAvatar->getRenderPosition(); + LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : gAgentAvatarp->getRenderPosition(); camera_offset.setVec( local_camera_offset ); camera_position_global = frame_center_global + head_offset + camera_offset; @@ -1916,8 +1911,8 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LLVector3 vel = gAgent.getVelocity(); // lag by appropriate amount for flying - F32 time_in_air = pAvatar->mTimeInAir.getElapsedTimeF32(); - if(!mCameraAnimating && pAvatar->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) + 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()); @@ -1929,7 +1924,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) lag_interp *= u; - if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == pAvatar->getID()) + if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID()) { // disable camera lag when using mouse-directed steering target_lag.clearVec(); @@ -2149,8 +2144,8 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate) gSavedSettings.setBOOL("BuildBtnState", FALSE); if (isAgentAvatarValid()) { - gAgent.getAvatarObject()->stopMotion(ANIM_AGENT_BODY_NOISE); - gAgent.getAvatarObject()->stopMotion(ANIM_AGENT_BREATHE_ROT); + gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT); } //gViewerWindow->stopGrab(); @@ -2237,9 +2232,9 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate) if (isAgentAvatarValid()) { - gAgent.getAvatarObject()->mPelvisp->setPosition(LLVector3::zero); - gAgent.getAvatarObject()->startMotion( ANIM_AGENT_BODY_NOISE ); - gAgent.getAvatarObject()->startMotion( ANIM_AGENT_BREATHE_ROT ); + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); + gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); + gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT ); } gSavedSettings.setBOOL("FirstPersonBtnState", FALSE); @@ -2279,12 +2274,12 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) if (isAgentAvatarValid()) { - if (!gAgent.getAvatarObject()->isSitting()) + if (!gAgentAvatarp->isSitting()) { - gAgent.getAvatarObject()->mPelvisp->setPosition(LLVector3::zero); + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); } - gAgent.getAvatarObject()->startMotion(ANIM_AGENT_BODY_NOISE); - gAgent.getAvatarObject()->startMotion(ANIM_AGENT_BREATHE_ROT); + gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT); } gSavedSettings.setBOOL("FirstPersonBtnState", FALSE); @@ -2322,9 +2317,9 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) } // Remove any pitch from the avatar - if (isAgentAvatarValid() && gAgent.getAvatarObject()->getParent()) + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) { - LLQuaternion obj_rot = ((LLViewerObject*)gAgent.getAvatarObject()->getParent())->getRenderRotation(); + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; at_axis.normalize(); @@ -2411,8 +2406,8 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); gAgent.setCustomAnim(TRUE); - gAgent.getAvatarObject()->startMotion(ANIM_AGENT_CUSTOMIZE); - LLMotion* turn_motion = gAgent.getAvatarObject()->findMotion(ANIM_AGENT_CUSTOMIZE); + gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); + LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); if (turn_motion) { @@ -2565,7 +2560,7 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object { if (isAgentAvatarValid()) { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mHeadp->getWorldPosition()); + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); } else { @@ -2610,7 +2605,7 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object { if (isAgentAvatarValid()) { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mHeadp->getWorldPosition()); + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); } else { @@ -2747,9 +2742,9 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) if (mCameraMode == CAMERA_MODE_THIRD_PERSON) { LLVector3 at_axis; - if (isAgentAvatarValid() && gAgent.getAvatarObject()->getParent()) + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) { - LLQuaternion obj_rot = ((LLViewerObject*)gAgent.getAvatarObject()->getParent())->getRenderRotation(); + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; at_axis.normalize(); @@ -2782,17 +2777,17 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L if(!mLookAt || mLookAt->isDead()) return FALSE; position.clearVec(); - return mLookAt->setLookAt(LOOKAT_TARGET_NONE, gAgent.getAvatarObject(), position); + return mLookAt->setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, position); } if(object && object->isAttachment()) { LLViewerObject* parent = object; while(parent) { - if (parent == gAgent.getAvatarObject()) + if (parent == gAgentAvatarp) { // looking at an attachment on ourselves, which we don't want to do - object = gAgent.getAvatarObject(); + object = gAgentAvatarp; position.clearVec(); } parent = (LLViewerObject*)parent->getParent(); @@ -2801,7 +2796,7 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L if(!mLookAt || mLookAt->isDead()) { mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); - mLookAt->setSourceObject(gAgent.getAvatarObject()); + mLookAt->setSourceObject(gAgentAvatarp); } return mLookAt->setLookAt(target_type, object, position); @@ -2822,9 +2817,9 @@ void LLAgentCamera::lookAtObject(LLUUID object_id, ECameraPosition camera_pos) if (chatter->isAvatar()) { LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; - if (!gAgent.getAvatarObject() && chatter_av->mHeadp) + if (!gAgentAvatarp && chatter_av->mHeadp) { - delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgent.getAvatarObject()->mHeadp->getWorldPosition(); + delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition(); } else { @@ -2836,7 +2831,7 @@ void LLAgentCamera::lookAtObject(LLUUID object_id, ECameraPosition camera_pos) changeCameraToThirdPerson(); - LLVector3 new_camera_pos = gAgent.getAvatarObject()->mHeadp->getWorldPosition(); + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; left.normVec(); LLVector3 up = left % delta_pos; @@ -2889,7 +2884,7 @@ void LLAgentCamera::lookAtObject(LLUUID object_id, ECameraPosition camera_pos) changeCameraToThirdPerson(); - LLVector3 new_camera_pos = gAgent.getAvatarObject()->mHeadp->getWorldPosition(); + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; left.normVec(); LLVector3 up = left % delta_pos; @@ -2940,7 +2935,7 @@ void LLAgentCamera::lookAtLastChat() LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; if (isAgentAvatarValid() && chatter_av->mHeadp) { - delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgent.getAvatarObject()->mHeadp->getWorldPosition(); + delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition(); } else { @@ -2952,7 +2947,7 @@ void LLAgentCamera::lookAtLastChat() changeCameraToThirdPerson(); - LLVector3 new_camera_pos = gAgent.getAvatarObject()->mHeadp->getWorldPosition(); + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; left.normalize(); LLVector3 up = left % delta_pos; @@ -2984,7 +2979,7 @@ void LLAgentCamera::lookAtLastChat() changeCameraToThirdPerson(); - LLVector3 new_camera_pos = gAgent.getAvatarObject()->mHeadp->getWorldPosition(); + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; left.normalize(); LLVector3 up = left % delta_pos; @@ -3012,7 +3007,7 @@ BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, if (!mPointAt || mPointAt->isDead()) { mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); - mPointAt->setSourceObject(gAgent.getAvatarObject()); + mPointAt->setSourceObject(gAgentAvatarp); } return mPointAt->setPointAt(target_type, object, position); } diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp index c0e1e6e68..c187edf7f 100644 --- a/indra/newview/llagentui.cpp +++ b/indra/newview/llagentui.cpp @@ -44,7 +44,7 @@ void LLAgentUI::buildFullname(std::string& name) { if (isAgentAvatarValid()) - name = gAgent.getAvatarObject()->getFullname(); + name = gAgentAvatarp->getFullname(); } /* diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 33a61ba3b..ef9ecb967 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -45,7 +45,7 @@ #include "llnotificationsutil.h" #include "lltexlayer.h" #include "llviewerregion.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llwearable.h" #include "llwearablelist.h" @@ -84,7 +84,7 @@ void LLAgentWearables::initClass() { } -void LLAgentWearables::setAvatarObject(LLVOAvatar *avatar) +void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar) { if (avatar) { @@ -161,7 +161,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone( // We're changing the asset id, so we both need to set it // locally via setAssetUUID() and via setTransactionID() which // will be decoded on the server. JC - item->setAssetUUID(wearable->getID()); + item->setAssetUUID(wearable->getAssetID()); item->setTransactionID(wearable->getTransactionID()); gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id); item->updateServer(FALSE); @@ -173,7 +173,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() { // First make sure that we have inventory items for each wearable S32 i; - for(i=0; i < WT_COUNT; ++i) + for(i=0; i < LLWearableType::WT_COUNT; ++i) { LLWearable* wearable = mWearableEntry[ i ].mWearable; if (wearable) @@ -210,7 +210,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); LL_DEBUGS("Wearables") << "sendAgentWearablesUpdate()" << LL_ENDL; - for(i=0; i < WT_COUNT; ++i) + for(i=0; i < LLWearableType::WT_COUNT; ++i) { gMessageSystem->nextBlockFast(_PREHASH_WearableData); @@ -233,16 +233,16 @@ void LLAgentWearables::sendAgentWearablesUpdate() } else { - LL_DEBUGS("Wearables") << "Not wearing wearable type " << LLWearable::typeToTypeName((EWearableType)i) << LL_ENDL; + LL_DEBUGS("Wearables") << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << LL_ENDL; gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null ); } - LL_DEBUGS("Wearables") << " " << LLWearable::typeToTypeLabel((EWearableType)i) << " : " << (wearable ? wearable->getID() : LLUUID::null) << LL_ENDL; + LL_DEBUGS("Wearables") << " " << LLWearableType::getTypeLabel((LLWearableType::EType)i) << " : " << (wearable ? wearable->getAssetID() : LLUUID::null) << LL_ENDL; } gAgent.sendReliableMessage(); } -void LLAgentWearables::saveWearable( EWearableType type, BOOL send_update ) +void LLAgentWearables::saveWearable( LLWearableType::EType type, BOOL send_update ) { LLWearable* old_wearable = mWearableEntry[(S32)type].mWearable; if( old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion()) ) @@ -258,7 +258,7 @@ void LLAgentWearables::saveWearable( EWearableType type, BOOL send_update ) new LLViewerInventoryItem(item->getUUID(), item->getParentUUID(), item->getPermissions(), - new_wearable->getID(), + new_wearable->getAssetID(), new_wearable->getAssetType(), item->getInventoryType(), item->getName(), @@ -288,7 +288,7 @@ void LLAgentWearables::saveWearable( EWearableType type, BOOL send_update ) return; } - gAgent.getAvatarObject()->wearableUpdated( type ); + gAgentAvatarp->wearableUpdated( type ); if( send_update ) { @@ -298,7 +298,7 @@ void LLAgentWearables::saveWearable( EWearableType type, BOOL send_update ) } void LLAgentWearables::saveWearableAs( - EWearableType type, + LLWearableType::EType type, const std::string& new_name, BOOL save_in_lost_and_found) { @@ -391,7 +391,7 @@ void LLAgentWearables::saveWearableAs( */ } -void LLAgentWearables::revertWearable( EWearableType type ) +void LLAgentWearables::revertWearable( LLWearableType::EType type ) { LLWearable* wearable = mWearableEntry[(S32)type].mWearable; if( wearable ) @@ -403,9 +403,9 @@ void LLAgentWearables::revertWearable( EWearableType type ) void LLAgentWearables::revertAllWearables() { - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { - revertWearable( (EWearableType)i ); + revertWearable( (LLWearableType::EType)i ); } } @@ -416,9 +416,9 @@ void LLAgentWearables::saveAllWearables() // return; //} - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { - saveWearable( (EWearableType)i, FALSE ); + saveWearable( (LLWearableType::EType)i, FALSE ); } sendAgentWearablesUpdate(); } @@ -426,7 +426,7 @@ void LLAgentWearables::saveAllWearables() // Called when the user changes the name of a wearable inventory item that is currenlty being worn. void LLAgentWearables::setWearableName( const LLUUID& item_id, const std::string& new_name ) { - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { if( mWearableEntry[i].mItemID == item_id ) { @@ -451,7 +451,7 @@ void LLAgentWearables::setWearableName( const LLUUID& item_id, const std::string } -BOOL LLAgentWearables::isWearableModifiable(EWearableType type) const +BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type) const { LLUUID item_id = getWearableItemID(type); return item_id.notNull() ? isWearableModifiable(item_id) : FALSE; @@ -471,7 +471,7 @@ BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const return FALSE; } -BOOL LLAgentWearables::isWearableCopyable(EWearableType type) const +BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type) const { LLUUID item_id = getWearableItemID(type); if(!item_id.isNull()) @@ -486,7 +486,14 @@ BOOL LLAgentWearables::isWearableCopyable(EWearableType type) const return FALSE; } -U32 LLAgentWearables::getWearablePermMask(EWearableType type) const +BOOL LLAgentWearables::areWearablesLoaded() const +{ + if(gSavedSettings.getBOOL("RenderUnloadedAvatar")) + return TRUE; + return mWearablesLoaded; +} + +U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type) const { LLUUID item_id = getWearableItemID(type); if(!item_id.isNull()) @@ -500,7 +507,7 @@ U32 LLAgentWearables::getWearablePermMask(EWearableType type) const return PERM_NONE; } -LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type) +LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type) { LLUUID item_id = getWearableItemID(type); LLInventoryItem* item = NULL; @@ -513,7 +520,7 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type) const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id ) const { - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { if( mWearableEntry[i].mItemID == item_id ) { @@ -525,7 +532,7 @@ const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id ) { - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { if( mWearableEntry[i].mItemID == item_id ) { @@ -549,21 +556,21 @@ void LLAgentWearables::sendAgentWearablesRequest() // static BOOL LLAgentWearables::selfHasWearable( void* userdata ) { - EWearableType type = (EWearableType)(intptr_t)userdata; + LLWearableType::EType type = (LLWearableType::EType)(intptr_t)userdata; return gAgentWearables.getWearable( type ) != NULL; } -LLWearable* LLAgentWearables::getWearable(const EWearableType type) +LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type) { - return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; + return (type < LLWearableType::WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; } -const LLWearable* LLAgentWearables::getWearable(const EWearableType type) const +const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type) const { - return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; + return (type < LLWearableType::WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; } -const LLUUID &LLAgentWearables::getWearableItemID(EWearableType type) const +const LLUUID &LLAgentWearables::getWearableItemID(LLWearableType::EType type) const { - return (type < WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null; + return (type < LLWearableType::WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null; } BOOL LLAgentWearables::isWearingItem( const LLUUID& item_id ) const @@ -584,7 +591,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg LLUUID agent_id; gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar && (agent_id == avatar->getID()) ) { gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum ); @@ -600,17 +607,17 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg //lldebugs << "processAgentInitialWearablesUpdate()" << llendl; // Add wearables - LLUUID asset_id_array[ WT_COUNT ]; + LLUUID asset_id_array[ LLWearableType::WT_COUNT ]; S32 i; for( i=0; i < num_wearables; i++ ) { U8 type_u8 = 0; gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i ); - if( type_u8 >= WT_COUNT ) + if( type_u8 >= LLWearableType::WT_COUNT ) { continue; } - EWearableType type = (EWearableType) type_u8; + LLWearableType::EType type = (LLWearableType::EType) type_u8; LLUUID item_id; gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i ); @@ -623,7 +630,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg } else { - LLAssetType::EType asset_type = LLWearable::typeToAssetType( type ); + LLAssetType::EType asset_type = LLWearableType::getAssetType( type ); if( asset_type == LLAssetType::AT_NONE ) { continue; @@ -633,13 +640,13 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg asset_id_array[type] = asset_id; } - LL_DEBUGS("Wearables") << " " << LLWearable::typeToTypeLabel(type) << " " << asset_id << " item id " << gAgentWearables.mWearableEntry[type].mItemID.asString() << LL_ENDL; + LL_DEBUGS("Wearables") << " " << LLWearableType::getTypeLabel(type) << " " << asset_id << " item id " << gAgentWearables.mWearableEntry[type].mItemID.asString() << LL_ENDL; } LLCOFMgr::instance().fetchCOF(); // now that we have the asset ids...request the wearable assets - for( i = 0; i < WT_COUNT; i++ ) + for( i = 0; i < LLWearableType::WT_COUNT; i++ ) { LL_DEBUGS("Wearables") << " fetching " << asset_id_array[i] << LL_ENDL; if( !gAgentWearables.mWearableEntry[i].mItemID.isNull() ) @@ -647,7 +654,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg gWearableList.getAsset( asset_id_array[i], LLStringUtil::null, - LLWearable::typeToAssetType( (EWearableType) i ), + LLWearableType::getAssetType( (LLWearableType::EType) i ), LLAgentWearables::onInitialWearableAssetArrived, (void*)(intptr_t)i ); } } @@ -661,9 +668,9 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg // static void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void* userdata ) { - EWearableType type = (EWearableType)(intptr_t)userdata; + LLWearableType::EType type = (LLWearableType::EType)(intptr_t)userdata; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( !avatar ) { return; @@ -694,7 +701,7 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void if( !gAgentWearables.mWearablesLoaded ) { gAgentWearables.mWearablesLoaded = TRUE; - for( S32 i = 0; i < WT_COUNT; i++ ) + for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) { if( !gAgentWearables.mWearableEntry[i].mItemID.isNull() && !gAgentWearables.mWearableEntry[i].mWearable ) { @@ -721,11 +728,11 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void // 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.) -void LLAgentWearables::recoverMissingWearable( EWearableType type ) +void LLAgentWearables::recoverMissingWearable( LLWearableType::EType type ) { // Try to recover by replacing missing wearable with a new one. LLNotificationsUtil::add("ReplacedMissingWearable"); - lldebugs << "Wearable " << LLWearable::typeToTypeLabel( type ) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; + lldebugs << "Wearable " << LLWearableType::getTypeLabel( type ) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; LLWearable* new_wearable = gWearableList.createNewWearable(type); S32 type_s32 = (S32) type; @@ -750,7 +757,7 @@ void LLAgentWearables::recoverMissingWearableDone() { // Have all the wearables that the avatar was wearing at log-in arrived or been fabricated? mWearablesLoaded = TRUE; - for( S32 i = 0; i < WT_COUNT; i++ ) + for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) { if( !mWearableEntry[i].mItemID.isNull() && !mWearableEntry[i].mWearable ) { @@ -778,9 +785,9 @@ void LLAgentWearables::createStandardWearables(BOOL female) if (!isAgentAvatarValid()) return; - gAgent.getAvatarObject()->setSex(female ? SEX_FEMALE : SEX_MALE); + gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE); - const BOOL create[WT_COUNT] = + const BOOL create[LLWearableType::WT_COUNT] = { TRUE, //WT_SHAPE TRUE, //WT_SKIN @@ -800,7 +807,7 @@ void LLAgentWearables::createStandardWearables(BOOL female) FALSE, //WT_PHYSICS }; - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { bool once = false; LLPointer donecb = NULL; @@ -812,7 +819,7 @@ void LLAgentWearables::createStandardWearables(BOOL female) donecb = new createStandardWearablesAllDoneCallback; } llassert( mWearableEntry[i].mWearable == NULL ); - LLWearable* wearable = gWearableList.createNewWearable((EWearableType)i); + LLWearable* wearable = gWearableList.createNewWearable((LLWearableType::EType)i); mWearableEntry[i].mWearable = wearable; // no need to update here... LLPointer cb = @@ -844,7 +851,7 @@ void LLAgentWearables::createStandardWearablesAllDone() gAgent.sendAgentSetAppearance(); // Treat this as the first texture entry message, if none received yet - gAgent.getAvatarObject()->onFirstTEMessageReceived(); + gAgentAvatarp->onFirstTEMessageReceived(); } void LLAgentWearables::makeNewOutfit( @@ -853,7 +860,7 @@ void LLAgentWearables::makeNewOutfit( const LLDynamicArray& attachments_to_include, BOOL rename_clothing) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } @@ -911,7 +918,7 @@ void LLAgentWearables::makeNewOutfit( LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); } - if (fUseLinks || isWearableCopyable((EWearableType)index)) + if (fUseLinks || isWearableCopyable((LLWearableType::EType)index)) { LLWearable* new_wearable = gWearableList.createCopy(old_wearable); if (rename_clothing) @@ -934,7 +941,7 @@ void LLAgentWearables::makeNewOutfit( index, new_wearable, todo); - if (isWearableCopyable((EWearableType)index)) + if (isWearableCopyable((LLWearableType::EType)index)) { copy_inventory_item( gAgent.getID(), @@ -981,7 +988,7 @@ void LLAgentWearables::makeNewOutfit( for( S32 i = 0; i < attachments_to_include.count(); i++ ) { S32 attachment_pt = attachments_to_include[i]; - LLViewerJointAttachment* attachment = get_if_there(gAgent.getAvatarObject()->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(); @@ -1079,12 +1086,12 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer new_item = items[i]; llassert(new_wearable); - EWearableType type = new_wearable->getType(); + LLWearableType::EType type = new_wearable->getType(); wearables_to_remove[type] = FALSE; LLWearable* old_wearable = mWearableEntry[ type ].mWearable; if( old_wearable ) { const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; - if( (old_wearable->getID() == new_wearable->getID()) && + if( (old_wearable->getAssetID() == new_wearable->getAssetID()) && (old_item_id == new_item->getUUID()) ) { - lldebugs << "No change to wearable asset and item: " << LLWearable::typeToTypeName( type ) << llendl; + lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName( type ) << llendl; continue; } @@ -1306,7 +1313,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it std::vector wearables_being_removed; - for( i = 0; i < WT_COUNT; i++ ) + for( i = 0; i < LLWearableType::WT_COUNT; i++ ) { if( wearables_to_remove[i] ) { @@ -1352,7 +1359,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it // User has picked "wear on avatar" from a menu. void LLAgentWearables::setWearableItem( LLInventoryItem* new_item, LLWearable* new_wearable ) { - EWearableType type = new_wearable->getType(); + LLWearableType::EType type = new_wearable->getType(); LLWearable* old_wearable = mWearableEntry[ type ].mWearable; @@ -1372,10 +1379,10 @@ void LLAgentWearables::setWearableItem( LLInventoryItem* new_item, LLWearable* n if( old_wearable ) { const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; - if( (old_wearable->getID() == new_wearable->getID()) && + if( (old_wearable->getAssetID() == new_wearable->getAssetID()) && (old_item_id == new_item->getUUID()) ) { - lldebugs << "No change to wearable asset and item: " << LLWearable::typeToTypeName( type ) << llendl; + lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName( type ) << llendl; return; } @@ -1429,10 +1436,10 @@ bool LLAgentWearables::onSetWearableDialog( const LLSD& notification, const LLSD // Called from setWearable() and onSetWearableDialog() to actually set the wearable. void LLAgentWearables::setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable ) { - const EWearableType type = new_wearable->getType(); + const LLWearableType::EType type = new_wearable->getType(); // Replace the old wearable with a new one. - llassert( new_item->getAssetUUID() == new_wearable->getID() ); + llassert( new_item->getAssetUUID() == new_wearable->getAssetID() ); LLUUID old_item_id = mWearableEntry[ type ].mItemID; mWearableEntry[ type ].mItemID = new_item->getUUID(); mWearableEntry[ type ].mWearable = new_wearable; @@ -1454,7 +1461,7 @@ void LLAgentWearables::setWearableFinal( LLInventoryItem* new_item, LLWearable* void LLAgentWearables::queryWearableCache() { - if (!mWearablesLoaded) + if (!areWearablesLoaded()) { return; } @@ -1477,28 +1484,18 @@ void LLAgentWearables::queryWearableCache() S32 num_queries = 0; for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ ) { - const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = LLVOAvatarDictionary::getInstance()->getWearable((EBakedTextureIndex)baked_index); - LLUUID hash; - for (U8 i=0; i < wearable_dict->mWearablesVec.size(); i++) + LLUUID hash_id = computeBakedTextureHash((EBakedTextureIndex) baked_index); + if (hash_id.notNull()) { - // EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num]; - const EWearableType wearable_type = wearable_dict->mWearablesVec[i]; - const LLWearable* wearable = getWearable(wearable_type); - if (wearable) - { - hash ^= wearable->getID(); - } - } - if (hash.notNull()) - { - hash ^= wearable_dict->mHashID; num_queries++; // *NOTE: make sure at least one request gets packed + ETextureIndex te_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); + //llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl; gMessageSystem->nextBlockFast(_PREHASH_WearableData); - gMessageSystem->addUUIDFast(_PREHASH_ID, hash); - gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index); + gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id); + gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)te_index); } gAgentQueryManager.mActiveCacheQueries[ baked_index ] = gAgentQueryManager.mWearablesCacheQueryID; @@ -1513,13 +1510,52 @@ void LLAgentWearables::queryWearableCache() } } +LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index, + BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache +{ + LLUUID hash_id; + bool hash_computed = false; + LLMD5 hash; + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); + + for (U8 i=0; i < baked_dict->mWearables.size(); i++) + { + const LLWearableType::EType baked_type = baked_dict->mWearables[i]; + //TO-DO: MULTI-WEARABLE + const LLWearable* wearable = getWearable(baked_type); + if (wearable) + { + LLUUID asset_id = wearable->getAssetID(); + hash.update((const unsigned char*)asset_id.mData, UUID_BYTES); + hash_computed = true; + } + } + if (hash_computed) + { + hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES); + + // Add some garbage into the hash so that it becomes invalid. + if (!generate_valid_hash) + { + if (isAgentAvatarValid()) + { + hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES); + } + } + hash.finalize(); + hash.raw_digest(hash_id.mData); + } + + return hash_id; +} + // User has picked "remove from avatar" from a menu. // static void LLAgentWearables::userRemoveWearable( void* userdata ) { - EWearableType type = (EWearableType)(intptr_t)userdata; + LLWearableType::EType type = (LLWearableType::EType)(intptr_t)userdata; - if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES) ) //&& + if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES) ) //&& //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) { gAgentWearables.removeWearable( type ); @@ -1543,18 +1579,18 @@ void LLAgentWearables::userRemoveAllClothesStep2( BOOL proceed, void* userdata ) { if( proceed ) { - gAgentWearables.removeWearable( WT_SHIRT ); - gAgentWearables.removeWearable( WT_PANTS ); - gAgentWearables.removeWearable( WT_SHOES ); - gAgentWearables.removeWearable( WT_SOCKS ); - gAgentWearables.removeWearable( WT_JACKET ); - gAgentWearables.removeWearable( WT_GLOVES ); - gAgentWearables.removeWearable( WT_UNDERSHIRT ); - gAgentWearables.removeWearable( WT_UNDERPANTS ); - gAgentWearables.removeWearable( WT_SKIRT ); - gAgentWearables.removeWearable( WT_ALPHA ); - gAgentWearables.removeWearable( WT_TATTOO ); - gAgentWearables.removeWearable( WT_PHYSICS ); + gAgentWearables.removeWearable( LLWearableType::WT_SHIRT ); + gAgentWearables.removeWearable( LLWearableType::WT_PANTS ); + gAgentWearables.removeWearable( LLWearableType::WT_SHOES ); + gAgentWearables.removeWearable( LLWearableType::WT_SOCKS ); + gAgentWearables.removeWearable( LLWearableType::WT_JACKET ); + gAgentWearables.removeWearable( LLWearableType::WT_GLOVES ); + gAgentWearables.removeWearable( LLWearableType::WT_UNDERSHIRT ); + gAgentWearables.removeWearable( LLWearableType::WT_UNDERPANTS ); + gAgentWearables.removeWearable( LLWearableType::WT_SKIRT ); + gAgentWearables.removeWearable( LLWearableType::WT_ALPHA ); + gAgentWearables.removeWearable( LLWearableType::WT_TATTOO ); + gAgentWearables.removeWearable( LLWearableType::WT_PHYSICS ); } } @@ -1570,8 +1606,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* pAvatar = gAgent.getAvatarObject(); - if (!pAvatar) return; + if (!isAgentAvatarValid()) return; std::set requested_item_ids; std::set current_item_ids; @@ -1580,8 +1615,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 = pAvatar->mAttachmentPoints.begin(); - iter != pAvatar->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; @@ -1643,7 +1678,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove) { - if (!gAgent.getAvatarObject()) return; + if (!isAgentAvatarValid()) return; // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a // RELEASE-RLVa: [SL-2.0.0] Check our callers and verify that erasing elements from the passed vector won't break random things @@ -1694,17 +1729,12 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo void LLAgentWearables::userRemoveAllAttachments( void* userdata ) { - 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; diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index f9ae285db..6d052142b 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -46,7 +46,7 @@ #include "llvoavatardefines.h" class LLInventoryItem; -class LLVOAvatar; +class LLVOAvatarSelf; class LLWearable; class LLInitialWearablesFetch; class LLViewerObject; @@ -64,7 +64,7 @@ public: LLAgentWearables(); virtual ~LLAgentWearables(); - void setAvatarObject(LLVOAvatar *avatar); + void setAvatarObject(LLVOAvatarSelf *avatar); void createStandardWearables(BOOL female); void cleanup(); //void dump(); @@ -80,11 +80,11 @@ protected: //-------------------------------------------------------------------- public: BOOL isWearingItem(const LLUUID& item_id) const; - BOOL isWearableModifiable(EWearableType type) const; + BOOL isWearableModifiable(LLWearableType::EType type) const; BOOL isWearableModifiable(const LLUUID& item_id) const; - BOOL isWearableCopyable(EWearableType type) const; - BOOL areWearablesLoaded() const { return mWearablesLoaded; }; + BOOL isWearableCopyable(LLWearableType::EType type) const; + BOOL areWearablesLoaded() const; //void updateWearablesLoaded(); //void checkWearablesLoaded() const; //bool canMoveWearable(const LLUUID& item_id, bool closer_to_body); @@ -94,33 +94,29 @@ public: //void animateAllWearableParams(F32 delta, BOOL upload_bake); - BOOL needsReplacement(EWearableType wearableType, S32 remove); - U32 getWearablePermMask(EWearableType type) const; + BOOL needsReplacement(LLWearableType::EType wearableType, S32 remove); + U32 getWearablePermMask(LLWearableType::EType type) const; //-------------------------------------------------------------------- // Accessors //-------------------------------------------------------------------- public: - const LLUUID& getWearableItemID(EWearableType type ) const; + const LLUUID& getWearableItemID(LLWearableType::EType type ) const; //const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const; const LLWearable* getWearableFromItemID(const LLUUID& item_id) const; LLWearable* getWearableFromItemID(const LLUUID& item_id); //LLWearable* getWearableFromAssetID(const LLUUID& asset_id); - LLInventoryItem* getWearableInventoryItem(EWearableType type); - static BOOL selfHasWearable( void* userdata ); // userdata is EWearableType - LLWearable* getWearable( const EWearableType type ); - const LLWearable* getWearable( const EWearableType type ) const; + LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type); + static BOOL selfHasWearable( void* userdata ); // userdata is LLWearableType::EType + LLWearable* getWearable( const LLWearableType::EType type ); + const LLWearable* getWearable( const LLWearableType::EType type ) const; //const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; //LLWearable* getTopWearable(const LLWearableType::EType type); //LLWearable* getBottomWearable(const LLWearableType::EType type); //U32 getWearableCount(const LLWearableType::EType type) const; //U32 getWearableCount(const U32 tex_index) const; - - static EWearableType getTEWearableType( S32 te ); - static LLUUID getDefaultTEImageID( S32 te ); - - void copyWearableToInventory( EWearableType type ); + void copyWearableToInventory( LLWearableType::EType type ); static const U32 MAX_CLOTHING_PER_TYPE = 5; @@ -168,7 +164,7 @@ protected: const LLUUID& item_id, LLWearable* wearable); - void recoverMissingWearable(EWearableType type); + void recoverMissingWearable(LLWearableType::EType type); void recoverMissingWearableDone(); //-------------------------------------------------------------------- @@ -190,9 +186,9 @@ private: // Removing wearables //-------------------------------------------------------------------- public: - void removeWearable( EWearableType type ); + void removeWearable( LLWearableType::EType type ); private: - void removeWearableFinal( EWearableType type ); + void removeWearableFinal( LLWearableType::EType type ); protected: static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response); static void userRemoveAllClothesStep2(BOOL proceed, void* userdata ); // userdata is NULL @@ -203,8 +199,8 @@ protected: public: // Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant) static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data); - //LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index, - // BOOL generate_valid_hash = TRUE); + LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index, + BOOL generate_valid_hash = TRUE); protected: void sendAgentWearablesUpdate(); @@ -234,18 +230,18 @@ private: // Save Wearables //-------------------------------------------------------------------- public: - void saveWearableAs( EWearableType type, const std::string& new_name, BOOL save_in_lost_and_found ); - void saveWearable( EWearableType type, BOOL send_update = TRUE ); + void saveWearableAs( LLWearableType::EType type, const std::string& new_name, BOOL save_in_lost_and_found ); + void saveWearable( LLWearableType::EType type, BOOL send_update = TRUE ); void saveAllWearables(); - void revertWearable( EWearableType type ); + void revertWearable( LLWearableType::EType type ); void revertAllWearables(); //-------------------------------------------------------------------- // Static UI hooks //-------------------------------------------------------------------- public: - static void userRemoveWearable( void* userdata ); // userdata is EWearableType + static void userRemoveWearable( void* userdata ); // userdata is LLWearableType::EType static void userRemoveAllClothes( void* userdata ); // userdata is NULL // static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array); // [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2.0a) | Added: Catznip-2.2.0a @@ -287,7 +283,7 @@ private: LLUUID mItemID; // ID of the inventory item in the agent's inventory. LLWearable* mWearable; }; - LLWearableEntry mWearableEntry[ WT_COUNT ]; + LLWearableEntry mWearableEntry[ LLWearableType::WT_COUNT ]; BOOL mWearablesLoaded; //-------------------------------------------------------------------------------- diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a9ae29aef..11fb33c26 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -895,6 +895,7 @@ bool LLAppViewer::init() LLViewerJoystick::getInstance()->init(false); + gGLActive = FALSE; return true; } @@ -1894,8 +1895,18 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setString("VersionChannelName", LL_CHANNEL); #ifndef LL_RELEASE_FOR_DOWNLOAD - gSavedSettings.setBOOL("ShowConsoleWindow", TRUE); - gSavedSettings.setBOOL("AllowMultipleViewers", TRUE); + // provide developer build only overrides for these control variables that are not + // persisted to settings.xml + LLControlVariable* c = gSavedSettings.getControl("ShowConsoleWindow"); + if (c) + { + c->setValue(true, false); + } + c = gSavedSettings.getControl("AllowMultipleViewers"); + if (c) + { + c->setValue(true, false); + } #endif //*FIX:Mani - Set default to disabling watchdog mainloop @@ -1952,10 +1963,8 @@ bool LLAppViewer::initConfiguration() if(!initParseCommandLine(clp)) { - llwarns - << "Error parsing command line options. Command Line options ignored." - << llendl; - + llwarns << "Error parsing command line options. Command Line options ignored." << llendl; + llinfos << "Command line usage:\n" << clp << llendl; std::ostringstream msg; @@ -3464,7 +3473,7 @@ void LLAppViewer::saveFinalSnapshot() snap_filename += gDirUtilp->getDirDelimiter(); snap_filename += SCREEN_LAST_FILENAME; // use full pixel dimensions of viewer window (not post-scale dimensions) - gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, TRUE); + gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, TRUE); mSavedFinalSnapshot = TRUE; } } diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp index ee160d015..b475eeedb 100644 --- a/indra/newview/llappviewerlinux_api_dbus.cpp +++ b/indra/newview/llappviewerlinux_api_dbus.cpp @@ -32,6 +32,11 @@ #if LL_DBUS_ENABLED +#ifdef LL_STANDALONE +#include +#include +#endif + #include "linden_common.h" extern "C" { @@ -71,9 +76,17 @@ bool grab_dbus_syms(std::string dbus_dso_name) //attempt to load the shared library apr_pool_create(&sSymDBUSDSOMemoryPool, NULL); +#ifdef LL_STANDALONE + void *dso_handle = dlopen(dbus_dso_name.c_str(), RTLD_NOW | RTLD_GLOBAL); + rv = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&sSymDBUSDSOHandle, + dso_handle, sSymDBUSDSOMemoryPool); + + if ( APR_SUCCESS == rv ) +#else if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle, dbus_dso_name.c_str(), sSymDBUSDSOMemoryPool) )) +#endif { INFOMSG("Found DSO: %s", dbus_dso_name.c_str()); diff --git a/indra/newview/llassetconverter.cpp b/indra/newview/llassetconverter.cpp index 80ef94b4b..19d636dc3 100644 --- a/indra/newview/llassetconverter.cpp +++ b/indra/newview/llassetconverter.cpp @@ -47,10 +47,10 @@ LLAssetType::EType LLAssetConverter::convert(const std::string &src_filename, co conversion_list[i].type : LLAssetType::AT_NONE; } } - EWearableType wear_type = LLWearable::typeNameToType(exten); - if(wear_type != WT_NONE && copyFile(src_filename, filename)) + LLWearableType::EType wear_type = LLWearableType::typeNameToType(exten); + if(wear_type != LLWearableType::WT_NONE && copyFile(src_filename, filename)) { - return LLWearable::typeToAssetType(wear_type); + return LLWearableType::getAssetType(wear_type); } llwarns << "Unhandled extension" << llendl; diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 61d619f40..6332bc03a 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -486,7 +486,7 @@ void LLChatBar::sendChat( EChatType type ) { // Chat with animation #if SHY_MOD //Command handler - if(!SHCommandHandler::handleCommand(true, utf8_revised_text, gAgentID, (LLViewerObject*)gAgent.getAvatarObject()))//returns true if handled + if(!SHCommandHandler::handleCommand(true, utf8_revised_text, gAgentID, (LLViewerObject*)gAgentAvatarp))//returns true if handled #endif //shy_mod sendChatFromViewer(utf8_revised_text, nType, TRUE); } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index f5754505d..0946a4ecc 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1028,8 +1028,8 @@ BOOL LLDrawable::isVisible() const { return TRUE; } - -#if 0 + +#if 1 //disabling this code fixes DEV-20105. Leaving in place in case some other bug pops up as a a result. //should be safe to just always ask the spatial group for visibility. if (isActive()) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index a43169547..4de0b48c8 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -69,7 +69,7 @@ S32 LLDrawPoolAvatar::sDiffuseChannel = 0; #if MESH_ENABLED static bool is_deferred_render = false; -static bool is_skipped_pass = false; +//static bool is_skipped_pass = false; #endif //MESH_ENABLED extern BOOL gUseGLPick; @@ -175,11 +175,11 @@ void LLDrawPoolAvatar::beginDeferredPass(S32 pass) pass += 2; } - if(pass >= 3 && mRiggedFace[pass + 4].empty()) + /*if(pass >= 3 && mRiggedFace[pass + 4].empty()) { is_skipped_pass = true; return; - } + }*/ switch (pass) { @@ -216,11 +216,11 @@ void LLDrawPoolAvatar::endDeferredPass(S32 pass) pass += 2; } - if(is_skipped_pass) +/* if(is_skipped_pass) { is_skipped_pass = false; return; - } + }*/ switch (pass) { @@ -261,11 +261,11 @@ S32 LLDrawPoolAvatar::getNumPostDeferredPasses() void LLDrawPoolAvatar::beginPostDeferredPass(S32 pass) { - if(pass >= 1 && mRiggedFace[pass + (S32)(pass != 1)].empty()) + /*if(pass >= 1 && mRiggedFace[pass + (S32)(pass != 1)].empty()) { is_skipped_pass = true; return; - } + }*/ switch (pass) { @@ -326,11 +326,11 @@ void LLDrawPoolAvatar::endDeferredRiggedAlpha() #endif //MESH_ENABLED void LLDrawPoolAvatar::endPostDeferredPass(S32 pass) { - if(is_skipped_pass) + /*if(is_skipped_pass) { is_skipped_pass = false; return; - } + }*/ switch (pass) { @@ -544,8 +544,8 @@ S32 LLDrawPoolAvatar::getNumDeferredPasses() void LLDrawPoolAvatar::render(S32 pass) { LLFastTimer t(LLFastTimer::FTM_RENDER_CHARACTERS); - if(is_skipped_pass) - return; + //if(is_skipped_pass) + // return; if (LLPipeline::sImpostorRender) { @@ -572,11 +572,11 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass) pass += 2; } - if(pass >= 3 && mRiggedFace[pass - 3].empty()) + /*if(pass >= 3 && mRiggedFace[pass - 3].empty()) { is_skipped_pass = true; return; - } + }*/ switch (pass) { @@ -624,11 +624,11 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass) pass += 2; } - if(is_skipped_pass) + /*if(is_skipped_pass) { is_skipped_pass = false; return; - } + }*/ switch (pass) { diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index e4cc42225..01a0b2237 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -65,7 +65,7 @@ #include "llviewerobjectlist.h" #include "llviewerwindow.h" #include "llviewermenufile.h" // upload_new_resource() -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "pipeline.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" @@ -372,7 +372,7 @@ BOOL LLFloaterAnimPreview::postBuild() // load the keyframe data locally if (mInWorld) { - motionp = (LLKeyframeMotion*)gAgent.getAvatarObject()->createMotion(mMotionID); + motionp = (LLKeyframeMotion*)gAgentAvatarp->createMotion(mMotionID); } else { @@ -517,7 +517,7 @@ LLFloaterAnimPreview::~LLFloaterAnimPreview() { if (mInWorld) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; if (avatarp) { if (mMotionID.notNull()) @@ -587,7 +587,7 @@ void LLFloaterAnimPreview::resetMotion() LLVOAvatar* avatarp; if (mInWorld) { - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -757,11 +757,11 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -805,11 +805,11 @@ void LLFloaterAnimPreview::onBtnStop(void* user_data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -836,11 +836,11 @@ void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -874,11 +874,11 @@ void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -917,11 +917,11 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -953,11 +953,11 @@ void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -990,11 +990,11 @@ void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1027,11 +1027,11 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1087,11 +1087,11 @@ void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1118,11 +1118,11 @@ void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1150,11 +1150,11 @@ void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1182,11 +1182,11 @@ BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return FALSE; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1220,11 +1220,11 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) LLVOAvatar* avatarp; if (previewp->mInWorld) { - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) { return FALSE; } - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1326,7 +1326,7 @@ void LLFloaterAnimPreview::refresh() LLVOAvatar* avatarp; if (mInWorld) { - avatarp = gAgent.getAvatarObject(); + avatarp = gAgentAvatarp; } else { @@ -1379,12 +1379,12 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata) LLFloaterAnimPreview* floaterp = (LLFloaterAnimPreview*)userdata; if (!floaterp->getEnabled()) return; - if ((!floaterp->mInWorld && floaterp->mAnimPreview) || (floaterp->mInWorld && gAgent.getAvatarObject())) + if ((!floaterp->mInWorld && floaterp->mAnimPreview) || (floaterp->mInWorld && gAgentAvatarp)) { LLKeyframeMotion* motionp; if (floaterp->mInWorld) { - motionp = (LLKeyframeMotion*)gAgent.getAvatarObject()->findMotion(floaterp->mMotionID); + motionp = (LLKeyframeMotion*)gAgentAvatarp->findMotion(floaterp->mMotionID); } else { @@ -1451,8 +1451,8 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata) // clear out cache for motion data if (floaterp->mInWorld) { - gAgent.getAvatarObject()->removeMotion(floaterp->mMotionID); - gAgent.getAvatarObject()->deactivateAllMotions(); + gAgentAvatarp->removeMotion(floaterp->mMotionID); + gAgentAvatarp->deactivateAllMotions(); } else { diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp index b199cb939..1382d6e89 100644 --- a/indra/newview/llfloatercustomize.cpp +++ b/indra/newview/llfloatercustomize.cpp @@ -43,7 +43,7 @@ #include "llagent.h" #include "llagentwearables.h" #include "lltoolmorph.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llradiogroup.h" #include "lltoolmgr.h" #include "llviewermenu.h" @@ -162,12 +162,12 @@ public: //////////////////////////////////////////////////////////////////////////// -BOOL edit_wearable_for_teens(EWearableType type) +BOOL edit_wearable_for_teens(LLWearableType::EType type) { switch(type) { - case WT_UNDERSHIRT: - case WT_UNDERPANTS: + case LLWearableType::WT_UNDERSHIRT: + case LLWearableType::WT_UNDERPANTS: return FALSE; default: return TRUE; @@ -191,22 +191,22 @@ public: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_new_outfit_dialog.xml"); // Build list of check boxes - for( S32 i = 0; i < WT_COUNT; i++ ) + for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) { - std::string name = std::string("checkbox_") + LLWearable::typeToTypeLabel( (EWearableType)i ); + std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel( (LLWearableType::EType)i ); mCheckBoxList.push_back(std::make_pair(name,i)); // Hide teen items if (gAgent.isTeen() && - !edit_wearable_for_teens((EWearableType)i)) + !edit_wearable_for_teens((LLWearableType::EType)i)) { // hide wearable checkboxes that don't apply to this account - std::string name = std::string("checkbox_") + LLWearable::typeToTypeLabel( (EWearableType)i ); + std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel( (LLWearableType::EType)i ); childSetVisible(name, FALSE); } } // NOTE: .xml needs to be updated if attachments are added or their names are changed! - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar ) { for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); @@ -265,11 +265,11 @@ public: void setWearableToInclude( S32 wearable, S32 enabled, S32 selected ) { - EWearableType wtType = (EWearableType)wearable; - if ( ( (0 <= wtType) && (wtType < WT_COUNT) ) && - ( (LLAssetType::AT_BODYPART != LLWearable::typeToAssetType(wtType)) || (!gSavedSettings.getBOOL("UseOutfitFolders")) ) ) + LLWearableType::EType wtType = (LLWearableType::EType)wearable; + if ( ( (0 <= wtType) && (wtType < LLWearableType::WT_COUNT) ) && + ( (LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType)) || (!gSavedSettings.getBOOL("UseOutfitFolders")) ) ) { - std::string name = std::string("checkbox_") + LLWearable::typeToTypeLabel(wtType); + std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel(wtType); childSetEnabled(name, enabled); childSetValue(name, selected); } @@ -281,7 +281,7 @@ public: { std::string name = mCheckBoxList[i].first; BOOL checked = childGetValue(name).asBoolean(); - if (i < WT_COUNT ) + if (i < LLWearableType::WT_COUNT ) { if( checked ) { @@ -350,12 +350,12 @@ public: { BOOL fUseOutfits = gSavedSettings.getBOOL("UseOutfitFolders"); - for (S32 idxType = 0; idxType < WT_COUNT; idxType++ ) + for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++ ) { - EWearableType wtType = (EWearableType)idxType; - if (LLAssetType::AT_BODYPART != LLWearable::typeToAssetType(wtType)) + LLWearableType::EType wtType = (LLWearableType::EType)idxType; + if (LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType)) continue; - LLCheckBoxCtrl* pCheckCtrl = getChild(std::string("checkbox_") + LLWearable::typeToTypeLabel(wtType)); + LLCheckBoxCtrl* pCheckCtrl = getChild(std::string("checkbox_") + LLWearableType::getTypeLabel(wtType)); if (!pCheckCtrl) continue; @@ -436,7 +436,7 @@ struct LLSubpart class LLPanelEditWearable : public LLPanel { public: - LLPanelEditWearable( EWearableType type ); + LLPanelEditWearable( LLWearableType::EType type ); virtual ~LLPanelEditWearable(); virtual BOOL postBuild(); @@ -448,8 +448,8 @@ public: void addInvisibilityCheckbox(ETextureIndex te, const std::string& name); void addColorSwatch( ETextureIndex te, const std::string& name ); - const std::string& getLabel() { return LLWearable::typeToTypeLabel( mType ); } - EWearableType getType() { return mType; } + const std::string& getLabel() { return LLWearableType::getTypeLabel( mType ); } + LLWearableType::EType getType() { return mType; } LLSubpart* getCurrentSubpart() { return mSubpartList[mCurrentSubpart]; } ESubpart getDefaultSubpart(); @@ -487,7 +487,7 @@ public: private: - EWearableType mType; + LLWearableType::EType mType; BOOL mCanTakeOff; std::map mTextureList; std::map mInvisibilityList; @@ -499,15 +499,15 @@ private: //////////////////////////////////////////////////////////////////////////// -LLPanelEditWearable::LLPanelEditWearable( EWearableType type ) - : LLPanel( LLWearable::typeToTypeLabel( type ) ), +LLPanelEditWearable::LLPanelEditWearable( LLWearableType::EType type ) + : LLPanel( LLWearableType::getTypeLabel( type ) ), mType( type ) { } BOOL LLPanelEditWearable::postBuild() { - LLAssetType::EType asset_type = LLWearable::typeToAssetType( mType ); + LLAssetType::EType asset_type = LLWearableType::getAssetType( mType ); /*std::string icon_name = (asset_type == LLAssetType::AT_CLOTHING ? "inv_item_clothing.tga" : "inv_item_skin.tga" );*/ @@ -519,8 +519,8 @@ BOOL LLPanelEditWearable::postBuild() // If PG, can't take off underclothing or shirt mCanTakeOff = - LLWearable::typeToAssetType( mType ) == LLAssetType::AT_CLOTHING && - !( gAgent.isTeen() && (mType == WT_UNDERSHIRT || mType == WT_UNDERPANTS) ); + LLWearableType::getAssetType( mType ) == LLAssetType::AT_CLOTHING && + !( gAgent.isTeen() && (mType == LLWearableType::WT_UNDERSHIRT || mType == LLWearableType::WT_UNDERPANTS) ); childSetVisible("Take Off", mCanTakeOff); childSetAction("Take Off", LLPanelEditWearable::onBtnTakeOff, this ); @@ -586,7 +586,7 @@ void LLPanelEditWearable::setSubpart( ESubpart subpart ) { // Update the thumbnails we display LLFloaterCustomize::param_map sorted_params; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; ESex avatar_sex = avatar->getSex(); LLViewerInventoryItem* item; item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(mType); @@ -639,7 +639,7 @@ void LLPanelEditWearable::setSubpart( ESubpart subpart ) gFloaterCustomize->childSetEnabled("Import", can_import); // Update the camera - gMorphView->setCameraTargetJoint( gAgent.getAvatarObject()->getJoint( part->mTargetJoint ) ); + gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( part->mTargetJoint ) ); gMorphView->setCameraTargetOffset( part->mTargetOffset ); gMorphView->setCameraOffset( part->mCameraOffset ); gMorphView->setCameraDistToDefault(); @@ -688,7 +688,7 @@ void LLPanelEditWearable::onBtnSaveAs( void* userdata ) void LLPanelEditWearable::onSaveAsCommit( LLWearableSaveAsDialog* save_as_dialog, void* userdata ) { LLPanelEditWearable* self = (LLPanelEditWearable*) userdata; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar ) { gAgentWearables.saveWearableAs( self->getType(), save_as_dialog->getItemName(), FALSE ); @@ -715,11 +715,11 @@ void LLPanelEditWearable::onBtnCreateNew( void* userdata ) bool LLPanelEditWearable::onSelectAutoWearOption(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if(avatar) { // Create a new wearable in the default folder for the wearable's asset type. - LLWearable* wearable = gWearableList.createNewWearable( (EWearableType)notification["payload"]["wearable_type"].asInteger() ); + LLWearable* wearable = gWearableList.createNewWearable( (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger() ); LLAssetType::EType asset_type = wearable->getAssetType(); LLUUID folder_id; @@ -741,7 +741,7 @@ bool LLPanelEditWearable::textureIsInvisible(ETextureIndex te) { if (gAgentWearables.getWearable(mType)) { - LLVOAvatar *avatar = gAgent.getAvatarObject(); + LLVOAvatar *avatar = gAgentAvatarp; if (avatar) { const LLTextureEntry* current_te = avatar->getTE(te); @@ -763,7 +763,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLUICtrl* ctrl, void* userdata) { LLPanelEditWearable* self = (LLPanelEditWearable*) userdata; LLCheckBoxCtrl* checkbox_ctrl = (LLCheckBoxCtrl*) ctrl; - LLVOAvatar *avatar = gAgent.getAvatarObject(); + LLVOAvatar *avatar = gAgentAvatarp; if (!avatar) { return; @@ -813,7 +813,7 @@ void LLPanelEditWearable::onColorCommit( LLUICtrl* ctrl, void* userdata ) LLPanelEditWearable* self = (LLPanelEditWearable*) userdata; LLColorSwatchCtrl* color_ctrl = (LLColorSwatchCtrl*) ctrl; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( self && color_ctrl && avatar ) { std::map::const_iterator cl_itr = self->mColorList.find(ctrl->getName()); @@ -846,7 +846,7 @@ void LLPanelEditWearable::initPreviousTextureList() void LLPanelEditWearable::initPreviousTextureListEntry(ETextureIndex te) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (!avatar) { return; @@ -872,11 +872,11 @@ void LLPanelEditWearable::addTextureDropTarget( ETextureIndex te, const std::str texture_ctrl->setNonImmediateFilterPermMask(PERM_NONE);//PERM_COPY | PERM_TRANSFER); } mTextureList[name] = te; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (avatar) { LLWearable* wearable = gAgentWearables.getWearable(mType); - if (wearable && mType == WT_ALPHA) + if (wearable && mType == LLWearableType::WT_ALPHA) { const LLTextureEntry* current_te = avatar->getTE(te); if (current_te) @@ -893,7 +893,7 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata ) LLPanelEditWearable* self = (LLPanelEditWearable*) userdata; LLTextureCtrl* texture_ctrl = (LLTextureCtrl*) ctrl; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar ) { ETextureIndex te = (ETextureIndex)(self->mTextureList[ctrl->getName()]); @@ -910,7 +910,7 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata ) avatar->setLocTexTE(te, image, TRUE); avatar->wearableUpdated(self->mType, FALSE); } - if (self->mType == WT_ALPHA && image->getID() != IMG_INVISIBLE) + if (self->mType == LLWearableType::WT_ALPHA && image->getID() != IMG_INVISIBLE) { self->mPreviousTextureList[te] = image->getID(); } @@ -922,22 +922,22 @@ ESubpart LLPanelEditWearable::getDefaultSubpart() { switch( mType ) { - case WT_SHAPE: return SUBPART_SHAPE_WHOLE; - case WT_SKIN: return SUBPART_SKIN_COLOR; - case WT_HAIR: return SUBPART_HAIR_COLOR; - case WT_EYES: return SUBPART_EYES; - case WT_SHIRT: return SUBPART_SHIRT; - case WT_PANTS: return SUBPART_PANTS; - case WT_SHOES: return SUBPART_SHOES; - case WT_SOCKS: return SUBPART_SOCKS; - case WT_JACKET: return SUBPART_JACKET; - case WT_GLOVES: return SUBPART_GLOVES; - case WT_UNDERSHIRT: return SUBPART_UNDERSHIRT; - case WT_UNDERPANTS: return SUBPART_UNDERPANTS; - case WT_SKIRT: return SUBPART_SKIRT; - case WT_ALPHA: return SUBPART_ALPHA; - case WT_TATTOO: return SUBPART_TATTOO; - case WT_PHYSICS: return SUBPART_PHYSICS_BELLY_UPDOWN; + case LLWearableType::WT_SHAPE: return SUBPART_SHAPE_WHOLE; + case LLWearableType::WT_SKIN: return SUBPART_SKIN_COLOR; + case LLWearableType::WT_HAIR: return SUBPART_HAIR_COLOR; + case LLWearableType::WT_EYES: return SUBPART_EYES; + case LLWearableType::WT_SHIRT: return SUBPART_SHIRT; + case LLWearableType::WT_PANTS: return SUBPART_PANTS; + case LLWearableType::WT_SHOES: return SUBPART_SHOES; + case LLWearableType::WT_SOCKS: return SUBPART_SOCKS; + case LLWearableType::WT_JACKET: return SUBPART_JACKET; + case LLWearableType::WT_GLOVES: return SUBPART_GLOVES; + case LLWearableType::WT_UNDERSHIRT: return SUBPART_UNDERSHIRT; + case LLWearableType::WT_UNDERPANTS: return SUBPART_UNDERPANTS; + case LLWearableType::WT_SKIRT: return SUBPART_SKIRT; + case LLWearableType::WT_ALPHA: return SUBPART_ALPHA; + case LLWearableType::WT_TATTOO: return SUBPART_TATTOO; + case LLWearableType::WT_PHYSICS: return SUBPART_PHYSICS_BELLY_UPDOWN; default: llassert(0); return SUBPART_SHAPE_WHOLE; } @@ -951,7 +951,7 @@ void LLPanelEditWearable::draw() return; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( !avatar ) { return; @@ -1029,7 +1029,7 @@ void LLPanelEditWearable::draw() { // *TODO:Translate childSetVisible("title_no_modify", TRUE); - childSetTextArg("title_no_modify", "[DESC]", std::string(LLWearable::typeToTypeLabel( mType ))); + childSetTextArg("title_no_modify", "[DESC]", std::string(LLWearableType::getTypeLabel( mType ))); hideTextureControls(); } @@ -1037,7 +1037,7 @@ void LLPanelEditWearable::draw() { // *TODO:Translate childSetVisible("title_loading", TRUE); - childSetTextArg("title_loading", "[DESC]", std::string(LLWearable::typeToTypeLabel( mType ))); + childSetTextArg("title_loading", "[DESC]", std::string(LLWearableType::getTypeLabel( mType ))); std::string path; const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType() ); @@ -1138,7 +1138,7 @@ void LLPanelEditWearable::draw() { // *TODO:Translate childSetVisible("title_not_worn", TRUE); - childSetTextArg("title_not_worn", "[DESC]", std::string(LLWearable::typeToTypeLabel( mType ))); + childSetTextArg("title_not_worn", "[DESC]", std::string(LLWearableType::getTypeLabel( mType ))); hideTextureControls(); } @@ -1172,7 +1172,7 @@ void LLPanelEditWearable::setWearable(LLWearable* wearable, U32 perm_mask, BOOL if( wearable ) { setUIPermissions(perm_mask, is_complete); - if (mType == WT_ALPHA) + if (mType == LLWearableType::WT_ALPHA) { initPreviousTextureList(); } @@ -1219,7 +1219,7 @@ void LLPanelEditWearable::onCommitSexChange( LLUICtrl*, void* userdata ) { LLPanelEditWearable* self = (LLPanelEditWearable*) userdata; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (!avatar) { return; @@ -1509,7 +1509,7 @@ void updateAvatarHeightDisplay() { if (gFloaterCustomize) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; F32 avatar_size = (avatar->mBodySize.mV[VZ]) + (F32)0.17; //mBodySize is actually quite a bit off. gFloaterCustomize->getChild("HeightTextM")->setValue(llformat("%.2f", avatar_size) + "m"); F32 feet = avatar_size / 0.3048; @@ -1525,13 +1525,13 @@ void LLScrollingPanelParam::onSliderMoved(LLUICtrl* ctrl, void* userdata) LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata; LLViewerVisualParam* param = self->mParam; - F32 current_weight = gAgent.getAvatarObject()->getVisualParamWeight( param ); + F32 current_weight = gAgentAvatarp->getVisualParamWeight( param ); F32 new_weight = self->percentToWeight( (F32)slider->getValue().asReal() ); if (current_weight != new_weight ) { updateAvatarHeightDisplay(); - gAgent.getAvatarObject()->setVisualParamWeight( param, new_weight, FALSE); - gAgent.getAvatarObject()->updateVisualParams(); + gAgentAvatarp->setVisualParamWeight( param, new_weight, FALSE); + gAgentAvatarp->updateVisualParams(); } } @@ -1566,7 +1566,7 @@ void LLScrollingPanelParam::onHintMaxMouseDown( void* userdata ) void LLScrollingPanelParam::onHintMouseDown( LLVisualParamHint* hint ) { // morph towards this result - F32 current_weight = gAgent.getAvatarObject()->getVisualParamWeight( hint->getVisualParam() ); + F32 current_weight = gAgentAvatarp->getVisualParamWeight( hint->getVisualParam() ); // if we have maxed out on this morph, we shouldn't be able to click it if( hint->getVisualParamWeight() != current_weight ) @@ -1592,7 +1592,7 @@ void LLScrollingPanelParam::onHintMaxHeldDown( void* userdata ) void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint ) { - F32 current_weight = gAgent.getAvatarObject()->getVisualParamWeight( hint->getVisualParam() ); + F32 current_weight = gAgentAvatarp->getVisualParamWeight( hint->getVisualParam() ); if (current_weight != hint->getVisualParamWeight() ) { @@ -1619,8 +1619,8 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint ) if (slider->getMinValue() < new_percent && new_percent < slider->getMaxValue()) { - gAgent.getAvatarObject()->setVisualParamWeight( hint->getVisualParam(), new_weight, TRUE); - gAgent.getAvatarObject()->updateVisualParams(); + gAgentAvatarp->setVisualParamWeight( hint->getVisualParam(), new_weight, TRUE); + gAgentAvatarp->updateVisualParams(); slider->setValue( weightToPercent( new_weight ) ); } @@ -1635,7 +1635,7 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata ) F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32(); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (avatar) { LLVisualParamHint* hint = self->mHintMin; @@ -1643,7 +1643,7 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata ) if (elapsed_time < PARAM_STEP_TIME_THRESHOLD) { // step in direction - F32 current_weight = gAgent.getAvatarObject()->getVisualParamWeight( hint->getVisualParam() ); + F32 current_weight = gAgentAvatarp->getVisualParamWeight( hint->getVisualParam() ); F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); // step a fraction in the negative directiona F32 new_weight = current_weight - (range / 10.f); @@ -1670,7 +1670,7 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata ) F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32(); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (avatar) { LLVisualParamHint* hint = self->mHintMax; @@ -1678,7 +1678,7 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata ) if (elapsed_time < PARAM_STEP_TIME_THRESHOLD) { // step in direction - F32 current_weight = gAgent.getAvatarObject()->getVisualParamWeight( hint->getVisualParam() ); + F32 current_weight = gAgentAvatarp->getVisualParamWeight( hint->getVisualParam() ); F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); // step a fraction in the negative direction F32 new_weight = current_weight + (range / 10.f); @@ -1722,14 +1722,14 @@ const std::string& LLFloaterCustomize::getEditGroup() // LLFloaterCustomize // statics -EWearableType LLFloaterCustomize::sCurrentWearableType = WT_INVALID; +LLWearableType::EType LLFloaterCustomize::sCurrentWearableType = LLWearableType::WT_INVALID; struct WearablePanelData { - WearablePanelData(LLFloaterCustomize* floater, EWearableType type) + WearablePanelData(LLFloaterCustomize* floater, LLWearableType::EType type) : mFloater(floater), mType(type) {} LLFloaterCustomize* mFloater; - EWearableType mType; + LLWearableType::EType mType; }; LLFloaterCustomize::LLFloaterCustomize() @@ -1739,9 +1739,9 @@ LLFloaterCustomize::LLFloaterCustomize() mNextStepAfterSaveCallback( NULL ), mNextStepAfterSaveUserdata( NULL ) { - memset(&mWearablePanelList[0],0,sizeof(char*)*WT_COUNT); //Initialize to 0 + memset(&mWearablePanelList[0],0,sizeof(char*)*LLWearableType::WT_COUNT); //Initialize to 0 - gSavedSettings.setU32("AvatarSex", (gAgent.getAvatarObject()->getSex() == SEX_MALE) ); + gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) ); mResetParams = new LLVisualParamReset(); @@ -1750,22 +1750,22 @@ LLFloaterCustomize::LLFloaterCustomize() gInventory.addObserver(mInventoryObserver); LLCallbackMap::map_t factory_map; - factory_map["Shape"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SHAPE) ) ); - factory_map["Skin"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SKIN) ) ); - factory_map["Hair"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_HAIR) ) ); - factory_map["Eyes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_EYES) ) ); - factory_map["Shirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SHIRT) ) ); - factory_map["Pants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_PANTS) ) ); - factory_map["Shoes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SHOES) ) ); - factory_map["Socks"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SOCKS) ) ); - factory_map["Jacket"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_JACKET) ) ); - factory_map["Gloves"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_GLOVES) ) ); - factory_map["Undershirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_UNDERSHIRT) ) ); - factory_map["Underpants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_UNDERPANTS) ) ); - factory_map["Skirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SKIRT) ) ); - factory_map["Alpha"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_ALPHA))); - factory_map["Tattoo"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_TATTOO))); - factory_map["Physics"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_PHYSICS))); + factory_map["Shape"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SHAPE) ) ); + factory_map["Skin"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SKIN) ) ); + factory_map["Hair"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_HAIR) ) ); + factory_map["Eyes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_EYES) ) ); + factory_map["Shirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SHIRT) ) ); + factory_map["Pants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_PANTS) ) ); + factory_map["Shoes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SHOES) ) ); + factory_map["Socks"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SOCKS) ) ); + factory_map["Jacket"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_JACKET) ) ); + factory_map["Gloves"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_GLOVES) ) ); + factory_map["Undershirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_UNDERSHIRT) ) ); + factory_map["Underpants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_UNDERPANTS) ) ); + factory_map["Skirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SKIRT) ) ); + factory_map["Alpha"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_ALPHA))); + factory_map["Tattoo"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_TATTOO))); + factory_map["Physics"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_PHYSICS))); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_customize.xml", &factory_map); } @@ -1784,22 +1784,22 @@ BOOL LLFloaterCustomize::postBuild() initWearablePanels(); // Tab container - childSetTabChangeCallback("customize tab container", "Shape", onTabChanged, (void*)WT_SHAPE, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Skin", onTabChanged, (void*)WT_SKIN, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Hair", onTabChanged, (void*)WT_HAIR, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Eyes", onTabChanged, (void*)WT_EYES, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Shirt", onTabChanged, (void*)WT_SHIRT, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Pants", onTabChanged, (void*)WT_PANTS, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Shoes", onTabChanged, (void*)WT_SHOES, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Socks", onTabChanged, (void*)WT_SOCKS, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Jacket", onTabChanged, (void*)WT_JACKET, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Gloves", onTabChanged, (void*)WT_GLOVES, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Undershirt", onTabChanged, (void*)WT_UNDERSHIRT, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Underpants", onTabChanged, (void*)WT_UNDERPANTS, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Skirt", onTabChanged, (void*)WT_SKIRT, onTabPrecommit ); - childSetTabChangeCallback("customize tab container", "Alpha", onTabChanged, (void*)WT_ALPHA, onTabPrecommit); - childSetTabChangeCallback("customize tab container", "Tattoo", onTabChanged, (void*)WT_TATTOO, onTabPrecommit); - childSetTabChangeCallback("customize tab container", "Physics", onTabChanged, (void*)WT_PHYSICS, onTabPrecommit); + childSetTabChangeCallback("customize tab container", "Shape", onTabChanged, (void*)LLWearableType::WT_SHAPE, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Skin", onTabChanged, (void*)LLWearableType::WT_SKIN, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Hair", onTabChanged, (void*)LLWearableType::WT_HAIR, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Eyes", onTabChanged, (void*)LLWearableType::WT_EYES, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Shirt", onTabChanged, (void*)LLWearableType::WT_SHIRT, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Pants", onTabChanged, (void*)LLWearableType::WT_PANTS, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Shoes", onTabChanged, (void*)LLWearableType::WT_SHOES, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Socks", onTabChanged, (void*)LLWearableType::WT_SOCKS, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Jacket", onTabChanged, (void*)LLWearableType::WT_JACKET, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Gloves", onTabChanged, (void*)LLWearableType::WT_GLOVES, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Undershirt", onTabChanged, (void*)LLWearableType::WT_UNDERSHIRT, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Underpants", onTabChanged, (void*)LLWearableType::WT_UNDERPANTS, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Skirt", onTabChanged, (void*)LLWearableType::WT_SKIRT, onTabPrecommit ); + childSetTabChangeCallback("customize tab container", "Alpha", onTabChanged, (void*)LLWearableType::WT_ALPHA, onTabPrecommit); + childSetTabChangeCallback("customize tab container", "Tattoo", onTabChanged, (void*)LLWearableType::WT_TATTOO, onTabPrecommit); + childSetTabChangeCallback("customize tab container", "Physics", onTabChanged, (void*)LLWearableType::WT_PHYSICS, onTabPrecommit); // Remove underwear panels for teens if (gAgent.isTeen()) @@ -1826,13 +1826,13 @@ void LLFloaterCustomize::open() LLFloater::open(); // childShowTab depends on gFloaterCustomize being defined and therefore must be called after the constructor. - Nyx childShowTab("customize tab container", "Shape", true); - setCurrentWearableType(WT_SHAPE); + setCurrentWearableType(LLWearableType::WT_SHAPE); } //////////////////////////////////////////////////////////////////////////// // static -void LLFloaterCustomize::setCurrentWearableType( EWearableType type ) +void LLFloaterCustomize::setCurrentWearableType( LLWearableType::EType type ) { if( LLFloaterCustomize::sCurrentWearableType != type ) { @@ -1877,7 +1877,7 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) F32 param_weight=0; S32 fields_read; - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { fields_read = fscanf( fp, "type %d\n", &typ); if( fields_read != 1 ) @@ -1900,8 +1900,8 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) llwarns << "Bad parameters list: early end of file" << llendl; return; } - gAgent.getAvatarObject()->setVisualParamWeight( param_id, param_weight, TRUE); - gAgent.getAvatarObject()->updateVisualParams(); + gAgentAvatarp->setVisualParamWeight( param_id, param_weight, TRUE); + gAgentAvatarp->updateVisualParams(); } } @@ -1932,13 +1932,13 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker) FILE* fp = LLFile::fopen(filename, "wb"); - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { is_modifiable = FALSE; - LLWearable* old_wearable = gAgentWearables.getWearable((EWearableType)i); + LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i); if( old_wearable ) { - item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((EWearableType)i); + item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i); if(item) { const LLPermissions& perm = item->getPermissions(); @@ -1956,13 +1956,13 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker) } } - for( S32 i=0; i < WT_COUNT; i++ ) + for( S32 i=0; i < LLWearableType::WT_COUNT; i++ ) { is_modifiable = FALSE; - LLWearable* old_wearable = gAgentWearables.getWearable((EWearableType)i); + LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i); if( old_wearable ) { - item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((EWearableType)i); + item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i); if(item) { const LLPermissions& perm = item->getPermissions(); @@ -1989,7 +1989,7 @@ void LLFloaterCustomize::onBtnOk( void* userdata ) LLFloaterCustomize* floater = (LLFloaterCustomize*) userdata; gAgentWearables.saveAllWearables(); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if ( avatar ) { avatar->invalidateAll(); @@ -2006,18 +2006,18 @@ void LLFloaterCustomize::onBtnOk( void* userdata ) // static void LLFloaterCustomize::onBtnMakeOutfit( void* userdata ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if(avatar) { LLMakeOutfitDialog* dialog = new LLMakeOutfitDialog( onMakeOutfitCommit, NULL ); // LLMakeOutfitDialog deletes itself. - for( S32 i = 0; i < WT_COUNT; i++ ) + for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) { - BOOL enabled = (gAgentWearables.getWearable( (EWearableType) i ) != NULL); - BOOL selected = (enabled && (WT_SHIRT <= i) && (i < WT_COUNT)); // only select clothing by default + BOOL enabled = (gAgentWearables.getWearable( (LLWearableType::EType) i ) != NULL); + BOOL selected = (enabled && (LLWearableType::WT_SHIRT <= i) && (i < LLWearableType::WT_COUNT)); // only select clothing by default if (gAgent.isTeen() - && !edit_wearable_for_teens((EWearableType)i)) + && !edit_wearable_for_teens((LLWearableType::EType)i)) { dialog->setWearableToInclude( i, FALSE, FALSE ); } @@ -2033,7 +2033,7 @@ void LLFloaterCustomize::onBtnMakeOutfit( void* userdata ) // static void LLFloaterCustomize::onMakeOutfitCommit( LLMakeOutfitDialog* dialog, void* userdata ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if(avatar) { LLDynamicArray wearables_to_include; @@ -2051,7 +2051,7 @@ void LLFloaterCustomize::onMakeOutfitCommit( LLMakeOutfitDialog* dialog, void* u void* LLFloaterCustomize::createWearablePanel(void* userdata) { WearablePanelData* data = (WearablePanelData*)userdata; - EWearableType type = data->mType; + LLWearableType::EType type = data->mType; LLPanelEditWearable* panel; if ((gAgent.isTeen() && !edit_wearable_for_teens(data->mType) )) { @@ -2072,7 +2072,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Shape - LLPanelEditWearable* panel = mWearablePanelList[ WT_SHAPE ]; + LLPanelEditWearable* panel = mWearablePanelList[ LLWearableType::WT_SHAPE ]; // body part = new LLSubpart(); @@ -2147,7 +2147,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Skin - panel = mWearablePanelList[ WT_SKIN ]; + panel = mWearablePanelList[ LLWearableType::WT_SKIN ]; part = new LLSubpart(); part->mTargetJoint = "mHead"; @@ -2183,7 +2183,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Hair - panel = mWearablePanelList[ WT_HAIR ]; + panel = mWearablePanelList[ LLWearableType::WT_HAIR ]; part = new LLSubpart(); part->mTargetJoint = "mHead"; @@ -2220,7 +2220,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Eyes - panel = mWearablePanelList[ WT_EYES ]; + panel = mWearablePanelList[ LLWearableType::WT_EYES ]; part = new LLSubpart(); part->mTargetJoint = "mHead"; @@ -2235,7 +2235,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Shirt - panel = mWearablePanelList[ WT_SHIRT ]; + panel = mWearablePanelList[ LLWearableType::WT_SHIRT ]; part = new LLSubpart(); part->mTargetJoint = "mTorso"; @@ -2253,7 +2253,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Pants - panel = mWearablePanelList[ WT_PANTS ]; + panel = mWearablePanelList[ LLWearableType::WT_PANTS ]; part = new LLSubpart(); part->mTargetJoint = "mPelvis"; @@ -2271,7 +2271,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Shoes - panel = mWearablePanelList[ WT_SHOES ]; + panel = mWearablePanelList[ LLWearableType::WT_SHOES ]; if (panel) { @@ -2292,7 +2292,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Socks - panel = mWearablePanelList[ WT_SOCKS ]; + panel = mWearablePanelList[ LLWearableType::WT_SOCKS ]; if (panel) { @@ -2312,7 +2312,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Jacket - panel = mWearablePanelList[ WT_JACKET ]; + panel = mWearablePanelList[ LLWearableType::WT_JACKET ]; if (panel) { @@ -2335,7 +2335,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Skirt - panel = mWearablePanelList[ WT_SKIRT ]; + panel = mWearablePanelList[ LLWearableType::WT_SKIRT ]; if (panel) { @@ -2356,7 +2356,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Gloves - panel = mWearablePanelList[ WT_GLOVES ]; + panel = mWearablePanelList[ LLWearableType::WT_GLOVES ]; if (panel) { @@ -2377,7 +2377,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Undershirt - panel = mWearablePanelList[ WT_UNDERSHIRT ]; + panel = mWearablePanelList[ LLWearableType::WT_UNDERSHIRT ]; if (panel) { @@ -2397,7 +2397,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Underpants - panel = mWearablePanelList[ WT_UNDERPANTS ]; + panel = mWearablePanelList[ LLWearableType::WT_UNDERPANTS ]; if (panel) { @@ -2417,7 +2417,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Alpha - panel = mWearablePanelList[WT_ALPHA]; + panel = mWearablePanelList[LLWearableType::WT_ALPHA]; if (panel) { @@ -2453,7 +2453,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Tattoo - panel = mWearablePanelList[WT_TATTOO]; + panel = mWearablePanelList[LLWearableType::WT_TATTOO]; if (panel) { @@ -2479,7 +2479,7 @@ void LLFloaterCustomize::initWearablePanels() ///////////////////////////////////////// // Physics - panel = mWearablePanelList[WT_PHYSICS]; + panel = mWearablePanelList[LLWearableType::WT_PHYSICS]; if(panel) { @@ -2584,7 +2584,7 @@ void LLFloaterCustomize::draw() BOOL LLFloaterCustomize::isDirty() const { - for(S32 i = 0; i < WT_COUNT; i++) + for(S32 i = 0; i < LLWearableType::WT_COUNT; i++) { if( mWearablePanelList[i] && mWearablePanelList[i]->isDirty() ) @@ -2598,8 +2598,8 @@ BOOL LLFloaterCustomize::isDirty() const // static void LLFloaterCustomize::onTabPrecommit( void* userdata, bool from_click ) { - EWearableType type = (EWearableType)(intptr_t) userdata; - if (type != WT_INVALID && gFloaterCustomize && gFloaterCustomize->getCurrentWearableType() != type) + LLWearableType::EType type = (LLWearableType::EType)(intptr_t) userdata; + if (type != LLWearableType::WT_INVALID && gFloaterCustomize && gFloaterCustomize->getCurrentWearableType() != type) { gFloaterCustomize->askToSaveIfDirty(onCommitChangeTab, userdata); } @@ -2613,8 +2613,8 @@ void LLFloaterCustomize::onTabPrecommit( void* userdata, bool from_click ) // static void LLFloaterCustomize::onTabChanged( void* userdata, bool from_click ) { - EWearableType wearable_type = (EWearableType) (intptr_t)userdata; - if (wearable_type != WT_INVALID) + LLWearableType::EType wearable_type = (LLWearableType::EType) (intptr_t)userdata; + if (wearable_type != LLWearableType::WT_INVALID) { LLFloaterCustomize::setCurrentWearableType(wearable_type); } @@ -2692,10 +2692,10 @@ void LLFloaterCustomize::generateVisualParamHints(LLViewerJointMesh* joint_mesh, } } -void LLFloaterCustomize::setWearable(EWearableType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete) +void LLFloaterCustomize::setWearable(LLWearableType::EType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete) { - llassert( type < WT_COUNT ); - gSavedSettings.setU32("AvatarSex", (gAgent.getAvatarObject()->getSex() == SEX_MALE) ); + llassert( type < LLWearableType::WT_COUNT ); + gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) ); LLPanelEditWearable* panel = mWearablePanelList[ type ]; if( panel ) @@ -2742,7 +2742,7 @@ bool LLFloaterCustomize::onSaveDialog(const LLSD& notification, const LLSD& resp S32 option = LLNotification::getSelectedOption(notification, response); BOOL proceed = FALSE; - EWearableType cur = getCurrentWearableType(); + LLWearableType::EType cur = getCurrentWearableType(); switch( option ) { @@ -2787,9 +2787,9 @@ void LLFloaterCustomize::fetchInventory() // Fetch currently worn items LLInventoryFetchObserver::item_ref_t ids; LLUUID item_id; - for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type) + for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) { - item_id = gAgentWearables.getWearableItemID((EWearableType)type); + item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type); if(item_id.notNull()) { ids.push_back(item_id); @@ -2809,7 +2809,7 @@ void LLFloaterCustomize::updateInventoryUI() U32 perm_mask = 0x0; LLPanelEditWearable* panel; LLViewerInventoryItem* item; - for(S32 i = 0; i < WT_COUNT; ++i) + for(S32 i = 0; i < LLWearableType::WT_COUNT; ++i) { item = NULL; panel = mWearablePanelList[i]; diff --git a/indra/newview/llfloatercustomize.h b/indra/newview/llfloatercustomize.h index 1b7b57705..4bf4ef708 100644 --- a/indra/newview/llfloatercustomize.h +++ b/indra/newview/llfloatercustomize.h @@ -94,7 +94,7 @@ public: const std::string& getEditGroup(); void updateScrollingPanelList(BOOL allow_modify); - void setWearable(EWearableType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete); + void setWearable(LLWearableType::EType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete); LLPanelEditWearable* getCurrentWearablePanel() { return mWearablePanelList[ sCurrentWearableType ]; } virtual BOOL isDirty() const; @@ -103,8 +103,8 @@ public: void switchToDefaultSubpart(); - static void setCurrentWearableType( EWearableType type ); - static EWearableType getCurrentWearableType() { return sCurrentWearableType; } + static void setCurrentWearableType( LLWearableType::EType type ); + static LLWearableType::EType getCurrentWearableType() { return sCurrentWearableType; } // Callbacks static void onBtnOk( void* userdata ); @@ -125,9 +125,9 @@ public: void updateScrollingPanelUI(); protected: - LLPanelEditWearable* mWearablePanelList[ WT_COUNT ]; + LLPanelEditWearable* mWearablePanelList[ LLWearableType::WT_COUNT ]; - static EWearableType sCurrentWearableType; + static LLWearableType::EType sCurrentWearableType; LLScrollingPanelList* mScrollingPanelList; LLScrollableContainerView* mScrollContainer; diff --git a/indra/newview/llfloatersearchreplace.cpp b/indra/newview/llfloatersearchreplace.cpp new file mode 100644 index 000000000..a339a54a8 --- /dev/null +++ b/indra/newview/llfloatersearchreplace.cpp @@ -0,0 +1,114 @@ +#include "llviewerprecompiledheaders.h" +#include "llcheckboxctrl.h" +#include "llfocusmgr.h" +#include "lluictrlfactory.h" + +#include "llfloatersearchreplace.h" + +const S32 SEARCH_REPLACE_WIDTH = 300; +const S32 SEARCH_REPLACE_HEIGHT = 120; +const std::string SEARCH_REPLACE_TITLE = "Search and Replace"; + +LLFloaterSearchReplace* LLFloaterSearchReplace::sInstance = NULL; + +LLFloaterSearchReplace::LLFloaterSearchReplace() : mEditor(NULL), + LLFloater(std::string("searchreplace"), LLRect(0, 0, SEARCH_REPLACE_WIDTH, SEARCH_REPLACE_HEIGHT), SEARCH_REPLACE_TITLE) +{ + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_search_replace.xml"); +} + +LLFloaterSearchReplace::~LLFloaterSearchReplace() +{ + sInstance = NULL; +} + +void LLFloaterSearchReplace::open() +{ + LLFloater::open(); + + if (mEditor) + { + bool fReadOnly = mEditor->isReadOnly(); + childSetEnabled("replace_label", !fReadOnly); + childSetEnabled("replace_text", !fReadOnly); + childSetEnabled("replace_btn", !fReadOnly); + childSetEnabled("replace_all_btn", !fReadOnly); + } + + childSetFocus("search_text", TRUE); +} + +BOOL LLFloaterSearchReplace::postBuild() +{ + childSetAction("search_btn", onBtnSearch, this); + childSetAction("replace_btn", onBtnReplace, this); + childSetAction("replace_all_btn", onBtnReplaceAll, this); + + setDefaultBtn("search_btn"); + + return TRUE; +} + +void LLFloaterSearchReplace::show(LLTextEditor* editor) +{ + if (!sInstance) + { + sInstance = new LLFloaterSearchReplace(); + } + + if ( (sInstance) && (editor) ) + { + sInstance->mEditor = editor; + + LLFloater* newdependee, *olddependee = sInstance->getDependee(); + LLView* viewp = editor->getParent(); + while (viewp) + { + newdependee = dynamic_cast(viewp); + if (newdependee) + { + if (newdependee != olddependee) + { + if (olddependee) + olddependee->removeDependentFloater(sInstance); + + if (!newdependee->getHost()) + newdependee->addDependentFloater(sInstance); + else + newdependee->getHost()->addDependentFloater(sInstance); + } + break; + } + viewp = viewp->getParent(); + } + + sInstance->open(); + } +} + +void LLFloaterSearchReplace::onBtnSearch(void* userdata) +{ + if ( (!sInstance) || (!sInstance->mEditor) || (!sInstance->getDependee()) ) + return; + + LLCheckBoxCtrl* caseChk = sInstance->getChild("case_text"); + sInstance->mEditor->selectNext(sInstance->childGetText("search_text"), caseChk->get()); +} + +void LLFloaterSearchReplace::onBtnReplace(void* userdata) +{ + if ( (!sInstance) || (!sInstance->mEditor) || (!sInstance->getDependee()) ) + return; + + LLCheckBoxCtrl* caseChk = sInstance->getChild("case_text"); + sInstance->mEditor->replaceText(sInstance->childGetText("search_text"), sInstance->childGetText("replace_text"), caseChk->get()); +} + +void LLFloaterSearchReplace::onBtnReplaceAll(void* userdata) +{ + if ( (!sInstance) || (!sInstance->mEditor) || (!sInstance->getDependee()) ) + return; + + LLCheckBoxCtrl* caseChk = sInstance->getChild("case_text"); + sInstance->mEditor->replaceTextAll(sInstance->childGetText("search_text"), sInstance->childGetText("replace_text"), caseChk->get()); +} diff --git a/indra/newview/llfloatersearchreplace.h b/indra/newview/llfloatersearchreplace.h new file mode 100644 index 000000000..9dcd0352b --- /dev/null +++ b/indra/newview/llfloatersearchreplace.h @@ -0,0 +1,32 @@ +#ifndef LL_LLFLOATERSEARCHREPLACE_H +#define LL_LLFLOATERSEARCHREPLACE_H + +#include "llfloater.h" +#include "lltexteditor.h" + +class LLFloaterSearchReplace : public LLFloater +{ +private: + LLFloaterSearchReplace(); + virtual ~LLFloaterSearchReplace(); + +public: + virtual void open(); + virtual BOOL postBuild(); + +public: + static void show(LLTextEditor* editor); + + static void onBtnSearch(void* userdata); + static void onBtnReplace(void* userdata); + static void onBtnReplaceAll(void* userdata); + + static LLFloaterSearchReplace* getInstance() { return sInstance; } + +private: + LLTextEditor* mEditor; + + static LLFloaterSearchReplace* sInstance; +}; + +#endif // LL_LLFLOATERSEARCHREPLACE_H diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 0a9b5dd1d..66fdaa4c4 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -87,6 +87,8 @@ #include "qtoolalign.h" //Thank Qarl! +#include "llvograss.h" +#include "llvotree.h" // Globals LLFloaterTools *gFloaterTools = NULL; @@ -295,6 +297,8 @@ BOOL LLFloaterTools::postBuild() llwarns << "Tool button not found! DOA Pending." << llendl; } } + mComboTreesGrass = getChild("trees_grass"); + childSetCommitCallback("trees_grass", onSelectTreesGrass, (void*)0); mCheckCopySelection = getChild("checkbox copy selection"); childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); mCheckSticky = getChild("checkbox sticky"); @@ -392,6 +396,7 @@ LLFloaterTools::LLFloaterTools() mBtnDuplicate(NULL), mBtnDuplicateInPlace(NULL), + mComboTreesGrass(NULL), mCheckSticky(NULL), mCheckCopySelection(NULL), mCheckCopyCenters(NULL), @@ -721,6 +726,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); + updateTreeGrassCombo(create_visible); + if (mCheckCopySelection && mCheckCopySelection->get()) { @@ -1058,3 +1065,77 @@ void LLFloaterTools::onFocusReceived() LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); LLFloater::onFocusReceived(); } + +// static +void LLFloaterTools::onSelectTreesGrass(LLUICtrl*, void*) +{ + const std::string &selected = gFloaterTools->mComboTreesGrass->getValue(); + LLPCode pcode = LLToolPlacer::getObjectType(); + if (pcode == LLToolPlacerPanel::sTree) + { + gSavedSettings.setString("LastTree", selected); + } + else if (pcode == LLToolPlacerPanel::sGrass) + { + gSavedSettings.setString("LastGrass", selected); + } +} + +void LLFloaterTools::updateTreeGrassCombo(bool visible) +{ + LLTextBox* tree_grass_label = getChild("tree_grass_label"); + if (visible) + { + LLPCode pcode = LLToolPlacer::getObjectType(); + std::map::iterator it, end; + std::string selected; + if (pcode == LLToolPlacerPanel::sTree) + { + tree_grass_label->setVisible(visible); + LLButton* button = getChild("ToolTree"); + tree_grass_label->setText(button->getToolTip()); + + selected = gSavedSettings.getString("LastTree"); + it = LLVOTree::sSpeciesNames.begin(); + end = LLVOTree::sSpeciesNames.end(); + } + else if (pcode == LLToolPlacerPanel::sGrass) + { + tree_grass_label->setVisible(visible); + LLButton* button = getChild("ToolGrass"); + tree_grass_label->setText(button->getToolTip()); + + selected = gSavedSettings.getString("LastGrass"); + it = LLVOGrass::sSpeciesNames.begin(); + end = LLVOGrass::sSpeciesNames.end(); + } + else + { + mComboTreesGrass->removeall(); + mComboTreesGrass->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label + mComboTreesGrass->setEnabled(false); + mComboTreesGrass->setVisible(false); + tree_grass_label->setVisible(false); + return; + } + + mComboTreesGrass->removeall(); + mComboTreesGrass->add("Random"); + + int select = 0, i = 0; + + while (it != end) + { + const std::string &species = it->first; + mComboTreesGrass->add(species); ++i; + if (species == selected) select = i; + ++it; + } + // if saved species not found, default to "Random" + mComboTreesGrass->selectNthItem(select); + mComboTreesGrass->setEnabled(true); + } + + mComboTreesGrass->setVisible(visible); + tree_grass_label->setVisible(visible); +} diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index 85308315f..a06e2728c 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -155,6 +155,7 @@ public: LLButton *mBtnDuplicateInPlace; // Create buttons + LLComboBox *mComboTreesGrass; LLCheckBoxCtrl *mCheckSticky; LLCheckBoxCtrl *mCheckCopySelection; LLCheckBoxCtrl *mCheckCopyCenters; @@ -194,6 +195,9 @@ private: BOOL mDirty; std::map mStatusText; + + void updateTreeGrassCombo(bool visible); + static void onSelectTreesGrass(LLUICtrl*, void*); }; extern LLFloaterTools *gFloaterTools; diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 9bd4015e5..e81a5add0 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -60,7 +60,7 @@ #include "llviewermenu.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llfloaterproperties.h" // RN: HACK @@ -4690,7 +4690,7 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item) BOOL passed = (0x1 << listener->getInventoryType() & mFilterOps.mFilterTypes || listener->getInventoryType() == LLInventoryType::IT_NONE) && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) && (mFilterWorn == false || gAgentWearables.isWearingItem(item_id) || - (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id))) + (gAgentAvatarp && gAgentAvatarp->isWearingAttachment(item_id))) && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); return passed; diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 73e902df0..5dac19b4c 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -55,7 +55,7 @@ #include "lldelayedgestureerror.h" #include "llinventorymodel.h" #include "llviewermessage.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llviewerstats.h" #include "chatbar_as_cmdline.h" @@ -711,7 +711,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) { return; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (!avatar) return; // Of the ones that started playing, have any stopped? @@ -906,7 +906,7 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) if ( cmd_line_chat(chat_text, CHAT_TYPE_NORMAL)) { #if SHY_MOD //Command handler - if(!SHCommandHandler::handleCommand(true, chat_text, gAgentID, gAgent.getAvatarObject()))//returns true if handled + if(!SHCommandHandler::handleCommand(true, chat_text, gAgentID, gAgentAvatarp))//returns true if handled #endif //shy_mod gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); } diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index 14c1f3000..120a31ea7 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -39,7 +39,7 @@ #include "message.h" #include "llagent.h" #include "llagentcamera.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "lldrawable.h" #include "llviewerobjectlist.h" #include "llrendersphere.h" @@ -506,7 +506,7 @@ void LLHUDEffectLookAt::render() static const LLCachedControl private_look_at("PrivateLookAt",false); static const LLCachedControl show_look_at("AscentShowLookAt", false); - if (private_look_at && (gAgent.getAvatarObject() == ((LLVOAvatar*)(LLViewerObject*)mSourceObject))) + if (private_look_at && (gAgentAvatarp == ((LLVOAvatar*)(LLViewerObject*)mSourceObject))) return; if (show_look_at && mSourceObject.notNull()) diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index 9da28a2de..6b9ad6a17 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -213,7 +213,7 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector3& start, const LLVector3& en if (mHidden) return FALSE; - if (mSourceObject.isNull() || mImagep.isNull()) + if (mSourceObject.isNull() || mImagep.isNull() || mSourceObject->mDrawable.isNull()) { markDead(); return FALSE; diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index aa0db9c4e..1858c1871 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -79,7 +79,7 @@ #include "llviewerinventory.h" #include "llviewerobjectlist.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llwearable.h" #include "llwearablelist.h" #include "llviewermessage.h" @@ -392,13 +392,13 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, } else { - EWearableType wear_type = LLWearable::typeNameToType(type); - if(wear_type != WT_INVALID) - { - LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(LLWearable::typeToAssetType(LLWearable::typeNameToType(type))); - LLUUID parent_id = self ? self->getUUID() : gInventory.findCategoryUUIDForType(folder_type); - LLFolderBridge::createWearable(parent_id, wear_type); - } + LLWearableType::EType wear_type = LLWearableType::typeNameToType(type); + if(wear_type != LLWearableType::WT_NONE) + { + LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(LLWearableType::getAssetType(wear_type)); + LLUUID parent_id = self ? self->getUUID() : gInventory.findCategoryUUIDForType(folder_type); + LLFolderBridge::createWearable(parent_id, wear_type); + } } ptr->getRootFolder()->setNeedsAutoRename(TRUE); } @@ -660,7 +660,7 @@ class LLAttachObject : public inventory_panel_listener_t LLUUID id = *selected_items.begin(); std::string joint_name = userdata.asString(); - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatar *avatarp = gAgentAvatarp; LLViewerJointAttachment* attachmentp = NULL; for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) diff --git a/indra/newview/llinventorybackup.cpp b/indra/newview/llinventorybackup.cpp index 3f58e3064..45a1b68bf 100644 --- a/indra/newview/llinventorybackup.cpp +++ b/indra/newview/llinventorybackup.cpp @@ -166,7 +166,7 @@ bool LLInventoryBackup::itemIsFolder(LLInventoryItem* item) ESaveFilter LLInventoryBackup::getSaveFilter(LLInventoryItem* item) { LLAssetType::EType type = item->getType(); - EWearableType wear = (EWearableType)(item->getFlags() & 0xFF); + LLWearableType::EType wear = (LLWearableType::EType)(item->getFlags() & 0xFF); switch(type) { case LLAssetType::AT_TEXTURE: @@ -188,33 +188,33 @@ ESaveFilter LLInventoryBackup::getSaveFilter(LLInventoryItem* item) case LLAssetType::AT_CLOTHING: switch(wear) { - case WT_EYES: + case LLWearableType::WT_EYES: return FFSAVE_EYES; - case WT_GLOVES: + case LLWearableType::WT_GLOVES: return FFSAVE_GLOVES; - case WT_HAIR: + case LLWearableType::WT_HAIR: return FFSAVE_HAIR; - case WT_JACKET: + case LLWearableType::WT_JACKET: return FFSAVE_JACKET; - case WT_PANTS: + case LLWearableType::WT_PANTS: return FFSAVE_PANTS; - case WT_SHAPE: + case LLWearableType::WT_SHAPE: return FFSAVE_SHAPE; - case WT_SHIRT: + case LLWearableType::WT_SHIRT: return FFSAVE_SHIRT; - case WT_SHOES: + case LLWearableType::WT_SHOES: return FFSAVE_SHOES; - case WT_SKIN: + case LLWearableType::WT_SKIN: return FFSAVE_SKIN; - case WT_SKIRT: + case LLWearableType::WT_SKIRT: return FFSAVE_SKIRT; - case WT_SOCKS: + case LLWearableType::WT_SOCKS: return FFSAVE_SOCKS; - case WT_UNDERPANTS: + case LLWearableType::WT_UNDERPANTS: return FFSAVE_UNDERPANTS; - case WT_UNDERSHIRT: + case LLWearableType::WT_UNDERSHIRT: return FFSAVE_UNDERSHIRT; - case WT_PHYSICS: + case LLWearableType::WT_PHYSICS: return FFSAVE_PHYSICS; default: return FFSAVE_ALL; @@ -228,7 +228,7 @@ ESaveFilter LLInventoryBackup::getSaveFilter(LLInventoryItem* item) std::string LLInventoryBackup::getExtension(LLInventoryItem* item) { LLAssetType::EType type = item->getType(); - EWearableType wear = (EWearableType)(item->getFlags() & 0xFF); + LLWearableType::EType wear = (LLWearableType::EType)(item->getFlags() & 0xFF); std::string scratch; switch(type) { @@ -249,7 +249,7 @@ std::string LLInventoryBackup::getExtension(LLInventoryItem* item) return ".landmark"; case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - scratch = LLWearable::typeToTypeName(wear); + scratch = LLWearableType::getTypeName(wear); if(scratch == "invalid") { if(type == LLAssetType::AT_BODYPART) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 57194eba0..0295fa258 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -200,6 +200,7 @@ std::string ICON_NAME[ICON_NAME_COUNT] = "inv_link_item.tga", "inv_link_folder.tga" + "inv_item_mesh.png" }; struct LLWearInfo @@ -218,7 +219,7 @@ BOOL get_is_item_worn(const LLInventoryItem *item) { case LLAssetType::AT_OBJECT: { - if (isAgentAvatarValid() && gAgent.getAvatarObject()->isWearingAttachment(item->getLinkedUUID())) + if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) return TRUE; break; } @@ -1101,7 +1102,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, { llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (EWearableType)flags); + new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (LLWearableType::EType)flags); break; case LLAssetType::AT_CATEGORY: @@ -1119,6 +1120,13 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, // Only should happen for broken links. new_listener = new LLLinkItemBridge(inventory, uuid); break; + case LLAssetType::AT_MESH: + if(!(inv_type == LLInventoryType::IT_MESH)) + { + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + } + new_listener = new LLMeshBridge(inventory, uuid); + break; default: llinfos << "Unhandled asset type (llassetstorage.h): " << (S32)asset_type << llendl; @@ -1644,7 +1652,7 @@ BOOL LLFolderBridge::isItemRemovable() return FALSE; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( !avatar ) { return FALSE; @@ -2819,85 +2827,85 @@ void LLFolderBridge::createNewCategory(void* user_data) void LLFolderBridge::createNewShirt(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHIRT); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHIRT); } void LLFolderBridge::createNewPants(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PANTS); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PANTS); } void LLFolderBridge::createNewShoes(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHOES); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHOES); } void LLFolderBridge::createNewSocks(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SOCKS); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SOCKS); } void LLFolderBridge::createNewJacket(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_JACKET); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_JACKET); } void LLFolderBridge::createNewSkirt(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIRT); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIRT); } void LLFolderBridge::createNewGloves(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_GLOVES); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_GLOVES); } void LLFolderBridge::createNewUndershirt(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERSHIRT); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERSHIRT); } void LLFolderBridge::createNewUnderpants(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERPANTS); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERPANTS); } void LLFolderBridge::createNewAlpha(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_ALPHA); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_ALPHA); } void LLFolderBridge::createNewTattoo(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_TATTOO); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_TATTOO); } void LLFolderBridge::createNewShape(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHAPE); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHAPE); } void LLFolderBridge::createNewSkin(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIN); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIN); } void LLFolderBridge::createNewHair(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_HAIR); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_HAIR); } void LLFolderBridge::createNewEyes(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_EYES); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_EYES); } void LLFolderBridge::createNewPhysics(void* user_data) { - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PHYSICS); + LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PHYSICS); } // static -void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type) +void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::EType type) { if(!bridge) return; LLUUID parent_id = bridge->getUUID(); @@ -2907,7 +2915,7 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type) // Separate function so can be called by global menu as well as right-click // menu. // static -void LLFolderBridge::createWearable(LLUUID parent_id, EWearableType type) +void LLFolderBridge::createWearable(LLUUID parent_id, LLWearableType::EType type) { LLWearable* wearable = gWearableList.createNewWearable(type); LLAssetType::EType asset_type = wearable->getAssetType(); @@ -4003,7 +4011,7 @@ BOOL LLObjectBridge::isItemRemovable() return TRUE; } // - //LLVOAvatar* avatar = gAgent.getAvatarObject(); + //LLVOAvatar* avatar = gAgentAvatarp; //if(!avatar) return FALSE; //if(avatar->isWearingAttachment(mUUID)) return FALSE; // @@ -4065,7 +4073,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model { if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) return; - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; if (!avatarp) return; LLViewerObject* objectp = avatarp->getWornAttachment(mUUID); @@ -4115,7 +4123,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model void LLObjectBridge::openItem() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (!avatar) { return; @@ -4135,7 +4143,7 @@ void LLObjectBridge::openItem() std::string LLObjectBridge::getLabelSuffix() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar && avatar->isWearingAttachment( mUUID ) ) { std::string attachment_point_name = avatar->getAttachedPointName(mUUID); @@ -4169,10 +4177,10 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach // [/RLVa:KB] S32 attach_pt = 0; - if (gAgent.getAvatarObject() && attachment) + if (gAgentAvatarp && 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) { @@ -4209,7 +4217,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response) { - if (!gAgent.getAvatarObject()->canAttachMoreObjects()) + if (!gAgentAvatarp->canAttachMoreObjects()) { LLSD args; args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS); @@ -4259,7 +4267,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryItem* item = getItem(); if(item) { - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatar *avatarp = gAgentAvatarp; if( !avatarp ) { return; @@ -4386,7 +4394,7 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) model->updateItem(new_item); model->notifyObservers(); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar ) { LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); @@ -4450,7 +4458,7 @@ LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLAssetType::EType asset_type, LLInventoryType::EType inv_type, - EWearableType wearable_type) : + LLWearableType::EType wearable_type) : LLItemBridge(inventory, /*root,*/ uuid), mAssetType( asset_type ), mWearableType(wearable_type) @@ -4982,7 +4990,7 @@ void wear_inventory_category_on_avatar_loop(LLWearable* wearable, void* data) iter != holder->mFoundList.end(); ++iter) { LLFoundData* data = *iter; - if(wearable->getID() == data->mAssetID) + if(wearable->getAssetID() == data->mAssetID) { data->mWearable = wearable; break; @@ -5010,7 +5018,7 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B // For each wearable type, find the first instance in the category // that we recursed through. - for( S32 i = 0; i < WT_COUNT; i++ ) + for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) { for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin(); iter != holder->mFoundList.end(); ++iter) @@ -5021,7 +5029,7 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B { LLViewerInventoryItem* item; item = (LLViewerInventoryItem*)gInventory.getLinkedItem(data->mItemID); - if( item && (item->getAssetUUID() == wearable->getID()) ) + if( item && (item->getAssetUUID() == wearable->getAssetID()) ) { //RN: after discussing with Brashears, I disabled this code //Metadata should reside in the item, not the asset @@ -5454,7 +5462,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userda item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); if(item) { - if(item->getAssetUUID() == wearable->getID()) + if(item->getAssetUUID() == wearable->getAssetID()) { //RN: after discussing with Brashears, I disabled this code //Metadata should reside in the item, not the asset @@ -5560,9 +5568,9 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, { if( get_is_item_worn( item_id ) ) { - EWearableType type = wearable->getType(); + LLWearableType::EType type = wearable->getType(); - if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES) ) //&& + if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES) ) //&& //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) { gAgentWearables.removeWearable( type ); @@ -5685,3 +5693,59 @@ const LLUUID &LLLinkFolderBridge::getFolderID() const return LLUUID::null; } +// +=================================================+ +// | LLMeshBridge | +// +=================================================+ + +LLUIImagePtr LLMeshBridge::getIcon() const +{ + return get_item_icon(LLAssetType::AT_TEXTURE, LLInventoryType::IT_TEXTURE, 0, FALSE); +} + +void LLMeshBridge::openItem() +{ + LLViewerInventoryItem* item = getItem(); + + if (item) + { + // open mesh + } +} + +void LLMeshBridge::previewItem() +{ + LLViewerInventoryItem* item = getItem(); + if(item) + { + // preview mesh + } +} + + +void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + lldebugs << "LLMeshBridge::buildContextMenu()" << llendl; + std::vector items; + std::vector disabled_items; + + if(isItemInTrash()) + { + items.push_back(std::string("Purge Item")); + if (!isItemRemovable()) + { + disabled_items.push_back(std::string("Purge Item")); + } + + items.push_back(std::string("Restore Item")); + } + else + { + items.push_back(std::string("Properties")); + + getClipboardEntries(true, items, disabled_items, flags); + } + + + hide_context_entries(menu, items, disabled_items); +} + diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index b2411d53b..5b385f538 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -85,6 +85,7 @@ enum EInventoryIcon LINKITEM_ICON_NAME, LINKFOLDER_ICON_NAME, + MESH_ICON_NAME, ICON_NAME_COUNT }; @@ -258,7 +259,7 @@ public: EDragAndDropType cargo_type, void* cargo_data) { return FALSE; } virtual LLInventoryType::EType getInventoryType() const { return mInvType; } - virtual EWearableType getWearableType() const { return WT_NONE; } + virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } protected: virtual void addTrashContextMenuOptions(menuentry_vec_t &items, @@ -373,8 +374,8 @@ public: virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteableAsLink() const; - static void createWearable(LLFolderBridge* bridge, EWearableType type); - static void createWearable(LLUUID parent_folder_id, EWearableType type); + static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type); + static void createWearable(LLUUID parent_folder_id, LLWearableType::EType type); LLViewerInventoryCategory* getCategory() const; @@ -588,7 +589,7 @@ public: const LLUUID& uuid, LLAssetType::EType asset_type, LLInventoryType::EType inv_type, - EWearableType wearable_type); + LLWearableType::EType wearable_type); virtual LLUIImagePtr getIcon() const; virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void openItem(); @@ -596,7 +597,7 @@ public: virtual std::string getLabelSuffix() const; virtual BOOL isItemRemovable(); virtual BOOL renameItem(const std::string& new_name); - virtual EWearableType getWearableType() const { return mWearableType; } + virtual LLWearableType::EType getWearableType() const { return mWearableType; } static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu static BOOL canWearOnAvatar( void* userdata ); @@ -612,7 +613,7 @@ public: static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata ); protected: LLAssetType::EType mAssetType; - EWearableType mWearableType; + LLWearableType::EType mWearableType; }; class LLLinkItemBridge : public LLItemBridge @@ -646,6 +647,21 @@ protected: static std::string sPrefix; }; +class LLMeshBridge : public LLItemBridge +{ + friend class LLInvFVBridge; +public: + virtual LLUIImagePtr getIcon() const; + virtual void openItem(); + virtual void previewItem(); + virtual void buildContextMenu(LLMenuGL& menu, U32 flags); + +protected: + LLMeshBridge(LLInventoryPanel* inventory, + const LLUUID& uuid) : + LLItemBridge(inventory, uuid) {} +}; + void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment, bool replace = false); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index be94cfd3a..c6c205f86 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3544,7 +3544,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite break; case LLAssetType::AT_OBJECT: - my_avatar = gAgent.getAvatarObject(); + my_avatar = gAgentAvatarp; if(my_avatar && !my_avatar->isWearingAttachment(item->getUUID())) { allowed = true; diff --git a/indra/newview/llinventoryview.cpp b/indra/newview/llinventoryview.cpp index 6b50d56ed..ec1cab830 100644 --- a/indra/newview/llinventoryview.cpp +++ b/indra/newview/llinventoryview.cpp @@ -1479,52 +1479,52 @@ std::string get_item_icon_name(LLAssetType::EType asset_type, } switch(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & attachment_point) { - case WT_SHAPE: + case LLWearableType::WT_SHAPE: idx = BODYPART_SHAPE_ICON_NAME; break; - case WT_SKIN: + case LLWearableType::WT_SKIN: idx = BODYPART_SKIN_ICON_NAME; break; - case WT_HAIR: + case LLWearableType::WT_HAIR: idx = BODYPART_HAIR_ICON_NAME; break; - case WT_EYES: + case LLWearableType::WT_EYES: idx = BODYPART_EYES_ICON_NAME; break; - case WT_SHIRT: + case LLWearableType::WT_SHIRT: idx = CLOTHING_SHIRT_ICON_NAME; break; - case WT_PANTS: + case LLWearableType::WT_PANTS: idx = CLOTHING_PANTS_ICON_NAME; break; - case WT_SHOES: + case LLWearableType::WT_SHOES: idx = CLOTHING_SHOES_ICON_NAME; break; - case WT_SOCKS: + case LLWearableType::WT_SOCKS: idx = CLOTHING_SOCKS_ICON_NAME; break; - case WT_JACKET: + case LLWearableType::WT_JACKET: idx = CLOTHING_JACKET_ICON_NAME; break; - case WT_GLOVES: + case LLWearableType::WT_GLOVES: idx = CLOTHING_GLOVES_ICON_NAME; break; - case WT_UNDERSHIRT: + case LLWearableType::WT_UNDERSHIRT: idx = CLOTHING_UNDERSHIRT_ICON_NAME; break; - case WT_UNDERPANTS: + case LLWearableType::WT_UNDERPANTS: idx = CLOTHING_UNDERPANTS_ICON_NAME; break; - case WT_SKIRT: + case LLWearableType::WT_SKIRT: idx = CLOTHING_SKIRT_ICON_NAME; break; - case WT_ALPHA: + case LLWearableType::WT_ALPHA: idx = CLOTHING_ALPHA_ICON_NAME; break; - case WT_TATTOO: + case LLWearableType::WT_TATTOO: idx = CLOTHING_TATTOO_ICON_NAME; break; - case WT_PHYSICS: + case LLWearableType::WT_PHYSICS: idx = CLOTHING_PHYSICS_ICON_NAME; break; default: @@ -1541,6 +1541,9 @@ std::string get_item_icon_name(LLAssetType::EType asset_type, case LLAssetType::AT_GESTURE: idx = GESTURE_ICON_NAME; break; + case LLAssetType::AT_MESH: + idx = MESH_ICON_NAME; + break; default: break; } diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 90d17bed6..0fbe0099d 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -55,7 +55,7 @@ #include "llselectmgr.h" #include "llstatusbar.h" #include "llui.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llviewercamera.h" #include "llviewerobject.h" #include "llviewerobject.h" @@ -738,7 +738,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 && gAgentAvatarp) { test_axis = test_axis * ~grid_rotation; } @@ -765,7 +765,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 && gAgentAvatarp) { projected_snap_axis = projected_snap_axis * grid_rotation; } @@ -1282,7 +1282,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 && gAgentAvatarp) { test_axis = test_axis * ~grid_rotation; } @@ -1306,7 +1306,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 && gAgentAvatarp) { axis1 = axis1 * grid_rotation; } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 81f2ea618..1764536c7 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -725,7 +725,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) diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index 3f45eda67..ec7428918 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -48,7 +48,7 @@ #include "lltoolmgr.h" #include "lltoolmorph.h" #include "llviewercamera.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llviewerwindow.h" #include "pipeline.h" @@ -91,7 +91,7 @@ void LLMorphView::initialize() mCameraYaw = 0.f; mCameraDist = -1.f; - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatar *avatarp = gAgentAvatarp; if (!avatarp || avatarp->isDead()) { gAgentCamera.changeCameraToDefault(); @@ -113,7 +113,7 @@ void LLMorphView::shutdown() { LLVOAvatar::onCustomizeEnd(); - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatar *avatarp = gAgentAvatarp; if(avatarp && !avatarp->isDead()) { avatarp->startMotion( ANIM_AGENT_BODY_NOISE ); @@ -166,10 +166,10 @@ void LLMorphView::updateCamera() { if (!mCameraTargetJoint) { - setCameraTargetJoint(gAgent.getAvatarObject()->getJoint("mHead")); + setCameraTargetJoint(gAgentAvatarp->getJoint("mHead")); } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( !avatar ) { return; diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index d7a1d9a08..8bdd7b376 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -324,11 +324,11 @@ void LLOverlayBar::refresh() } BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { -// sitting = gAgent.getAvatarObject()->isSitting(); +// sitting = gAgentAvatarp->isSitting(); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) - sitting = gAgent.getAvatarObject()->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); + sitting = gAgentAvatarp->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); // [/RLVa:KB] } button = getChild("Stand Up"); @@ -450,7 +450,7 @@ void LLOverlayBar::onClickMouselook(void*) void LLOverlayBar::onClickStandUp(void*) { // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->isSitting()) ) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgentAvatarp) && (gAgentAvatarp->isSitting()) ) { return; } @@ -529,6 +529,7 @@ void LLOverlayBar::toggleMediaPlay(void*) LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { + LLViewerParcelMedia::sIsUserAction = true; LLViewerParcelMedia::play(parcel); } } @@ -554,7 +555,8 @@ void LLOverlayBar::toggleMusicPlay(void*) // stream is stopped, it doesn't return the right thing - commenting out for now. // if ( gAudiop->isInternetStreamPlaying() == 0 ) { - gAudiop->startInternetStream(parcel->getMusicURL()); + LLViewerParcelMedia::sIsUserAction = true; + LLViewerParcelMedia::playStreamingMusic(parcel); } } } diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index b35b91b6c..a049c58ac 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -137,7 +137,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) // Only check the first (non-)root object because nothing else would result in enabling the button (see below) LLViewerObject* pObj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(TRUE); - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; editable = (pObj) && (pAvatar) && ((!pAvatar->isSitting()) || (pAvatar->getRoot() != pObj->getRootEdit())); } } @@ -186,7 +186,7 @@ void LLPanelContents::onClickNewScript(void *userdata) } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == object->getRootEdit()) ) return; // .. or in a linkset the avie is sitting on under @unsit=n/@sittp=n } diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index 925ca40c7..f000d840b 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -260,6 +260,9 @@ BOOL LLPanelDisplay::postBuild() // Avatar Render Mode mCtrlAvatarCloth = getChild("AvatarCloth"); mCtrlAvatarImpostors = getChild("AvatarImpostors"); + mCtrlAvatarImpostors->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable); + mCtrlAvatarImpostors->setCallbackUserData(this); + mCtrlNonImpostors = getChild("AvatarMaxVisible"); //---------------------------------------------------------------------------- // radio set for lighting detail @@ -417,6 +420,7 @@ void LLPanelDisplay::refresh() // avatar settings mAvatarImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); + mNonImpostors = gSavedSettings.getS32("RenderAvatarMaxVisible"); mAvatarCloth = gSavedSettings.getBOOL("RenderAvatarCloth"); // Draw distance @@ -514,6 +518,9 @@ void LLPanelDisplay::refreshEnabledState() //GI won't do anything with shadows off, but disabling it here is less than intuitive. Ignore shadow setting for now. mCtrlDeferredGI->setEnabled(mCtrlShadowDetail->getEnabled()/* && gSavedSettings.getS32("RenderShadowDetail") > 0*/); + // Disable max non-impostors slider if avatar impostors are off + mCtrlNonImpostors->setEnabled(gSavedSettings.getBOOL("RenderUseImpostors")); + // Vertex Shaders // mCtrlShaderEnable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0a @@ -612,6 +619,7 @@ void LLPanelDisplay::disableUnavailableSettings() { mCtrlAvatarImpostors->setEnabled(FALSE); mCtrlAvatarImpostors->setValue(FALSE); + mCtrlNonImpostors->setEnabled(FALSE); } // disabled deferred if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")) @@ -654,6 +662,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) llassert(mCtrlAvatarVP != NULL); llassert(mCtrlShaderEnable != NULL); llassert(mCtrlAvatarImpostors != NULL); + llassert(mCtrlNonImpostors != NULL); llassert(mCtrlAvatarCloth != NULL); llassert(mRadioLightingDetail2 != NULL); @@ -702,6 +711,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) mCtrlAvatarVP->setVisible(!isHidden); mCtrlShaderEnable->setVisible(!isHidden); mCtrlAvatarImpostors->setVisible(!isHidden); + mCtrlNonImpostors->setVisible(!isHidden); mCtrlAvatarCloth->setVisible(!isHidden); mRadioLightingDetail2->setVisible(!isHidden); @@ -752,6 +762,7 @@ void LLPanelDisplay::cancel() gSavedSettings.setS32("RenderShadowDetail", mShadowDetail); gSavedSettings.setBOOL("RenderUseImpostors", mAvatarImpostors); + gSavedSettings.setS32("RenderAvatarMaxVisible", mNonImpostors); gSavedSettings.setBOOL("RenderAvatarCloth", mAvatarCloth); gSavedSettings.setBOOL("RenderLocalLights", mLocalLights); @@ -994,6 +1005,11 @@ void LLPanelDisplay::onVertexShaderEnable(LLUICtrl* self, void* data) void LLPanelDisplay::setHardwareDefaults(void* user_data) { LLFeatureManager::getInstance()->applyRecommendedSettings(); + LLControlVariable* controlp = gSavedSettings.getControl("RenderAvatarMaxVisible"); + if (controlp) + { + controlp->resetToDefault(true); + } LLFloaterPreference::refreshEnabledGraphics(); } diff --git a/indra/newview/llpaneldisplay.h b/indra/newview/llpaneldisplay.h index a36311390..5631a7ca9 100644 --- a/indra/newview/llpaneldisplay.h +++ b/indra/newview/llpaneldisplay.h @@ -106,6 +106,7 @@ protected: LLSliderCtrl *mCtrlSkyFactor; // LOD for terrain LLSliderCtrl *mCtrlMaxParticle; // Max Particle LLSliderCtrl *mCtrlPostProcess; // Max Particle + LLSliderCtrl *mCtrlNonImpostors; // Max non-impostors LLCheckBoxCtrl *mCtrlBumpShiny; LLCheckBoxCtrl *mCtrlWindLight; @@ -162,6 +163,7 @@ protected: S32 mShadowDetail; BOOL mAvatarImpostors; + S32 mNonImpostors; BOOL mAvatarCloth; S32 mAvatarMode; BOOL mLocalLights; diff --git a/indra/newview/llpanelinventory.cpp b/indra/newview/llpanelinventory.cpp index 4fc93bcc7..a39ee10db 100644 --- a/indra/newview/llpanelinventory.cpp +++ b/indra/newview/llpanelinventory.cpp @@ -449,7 +449,7 @@ BOOL LLTaskInvFVBridge::isItemMovable() } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == pObj->getRootEdit()) ) return FALSE; } @@ -472,7 +472,7 @@ BOOL LLTaskInvFVBridge::isItemRemovable() } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == pObjRoot) ) return FALSE; } diff --git a/indra/newview/llpanelmorph.cpp b/indra/newview/llpanelmorph.cpp index 9776c8ae5..419bb0111 100644 --- a/indra/newview/llpanelmorph.cpp +++ b/indra/newview/llpanelmorph.cpp @@ -134,7 +134,7 @@ void LLPanelMorph::onCommitSexChange( void *data) { // LLRadioGroup *group = (LLRadioGroup *)data; -// LLVOAvatar *avatarp = gAgent.getAvatarObject(); +// LLVOAvatar *avatarp = gAgentAvatarp; // // LLNameValue* avatarSexNV = avatarp->getNVPair("AvatarSex"); // if (!avatarSexNV) @@ -162,7 +162,7 @@ void LLPanelMorph::onCommitSexChange( void *data) void LLPanelMorph::onCommitMorphChange( LLUICtrl* ctrl, void* userdata ) { //#ifdef MORPH_PANEL_SHOW_SPINNERS -// LLVOAvatar *avatarp = gAgent.getAvatarObject(); +// LLVOAvatar *avatarp = gAgentAvatarp; // // LLPanelMorph* self = (LLPanelMorph*) userdata; // @@ -193,14 +193,14 @@ void LLPanelMorph::updateSpinners(LLPolyMesh *mesh) if (mesh != mMesh) return; #ifdef MORPH_PANEL_SHOW_SPINNERS - for(LLViewerVisualParam *param = (LLViewerVisualParam*)gAgent.getAvatarObject()->getFirstVisualParam(); + for(LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam(); param; - param = gAgent.getAvatarObject()->getNextVisualParam()) + param = gAgentAvatarp->getNextVisualParam()) { if (param->getID() == -1 || param->getGroup() != LLVisualParam::VISUAL_PARAM_GROUP_TWEAKABLE) continue; - F32 paramWeight = gAgent.getAvatarObject()->getVisualParamWeight(morphTargetp); + F32 paramWeight = gAgentAvatarp->getVisualParamWeight(morphTargetp); for (S32 i = 0; i < mNumParamSpinners; i++) { @@ -251,9 +251,9 @@ void LLPanelMorph::createSpinners(LLPolyMesh *mesh) #ifdef MORPH_PANEL_SHOW_SPINNERS S32 numSpinners = 0; - for(LLViewerVisualParam *param = (LLViewerVisualParam*)gAgent.getAvatarObject()->getFirstVisualParam(); + for(LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam(); param; - param = gAgent.getAvatarObject()->getNextVisualParam()) + param = gAgentAvatarp->getNextVisualParam()) { if(param->getID() != -1 && param->getGroup() == LLVisualParam::VISUAL_PARAM_GROUP_TWEAKABLE) @@ -312,9 +312,9 @@ void LLPanelMorph::createSpinners(LLPolyMesh *mesh) #ifdef MORPH_PANEL_SHOW_SPINNERS S32 i = 0; - for(LLViewerVisualParam *param = (LLViewerVisualParam*)gAgent.getAvatarObject()->getFirstVisualParam(); + for(LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam(); param; - param = gAgent.getAvatarObject()->getNextVisualParam()) + param = gAgentAvatarp->getNextVisualParam()) { if (param->getID() == -1 || param->getGroup() != LLVisualParam::VISUAL_PARAM_GROUP_TWEAKABLE) continue; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index b92632337..6676cb509 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -497,7 +497,7 @@ void LLPanelObject::getState( ) // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) if ( (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) { - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == objectp->getRootEdit()) ) enable_move = enable_scale = enable_rotate = FALSE; } diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 63742e917..5b2c9cfae 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -47,8 +47,11 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "lldbstrings.h" +#include "llfloatersearchreplace.h" +#include "llpreviewnotecard.h" +#include "llpreviewscript.h" #include "llagent.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llselectmgr.h" #include "llinventoryview.h" #include "llviewerinventory.h" @@ -228,7 +231,7 @@ void LLPreview::onCommit() // update the object itself. if( item->getType() == LLAssetType::AT_OBJECT ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar ) { LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); @@ -579,6 +582,24 @@ void LLMultiPreview::tabOpen(LLFloater* opened_floater, bool from_click) { opened_preview->loadAsset(); } + + LLFloater* search_floater = LLFloaterSearchReplace::getInstance(); + if (search_floater && search_floater->getDependee() == this) + { + LLPreviewNotecard* notecard_preview; LLPreviewLSL* script_preview; + if ((notecard_preview = dynamic_cast(opened_preview)) != NULL) + { + LLFloaterSearchReplace::show(notecard_preview->getEditor()); + } + else if ((script_preview = dynamic_cast(opened_preview)) != NULL) + { + LLFloaterSearchReplace::show(script_preview->getEditor()); + } + else + { + search_floater->setVisible(FALSE); + } + } } //static diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 6963f6a84..803a76ba5 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -37,7 +37,7 @@ #include "llresmgr.h" #include "llinventory.h" #include "llinventoryview.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llagent.h" // gAgent #include "llkeyframemotion.h" #include "statemachine/aifilepicker.h" @@ -76,7 +76,7 @@ LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const // preload the animation if(item) { - gAgent.getAvatarObject()->createMotion(item->getAssetUUID()); + gAgentAvatarp->createMotion(item->getAssetUUID()); } switch ( activate ) @@ -132,7 +132,7 @@ void LLPreviewAnim::playAnim( void *userdata ) self->mPauseRequest = NULL; gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; LLMotion* motion = avatar->findMotion(itemID); if (motion) @@ -142,7 +142,7 @@ void LLPreviewAnim::playAnim( void *userdata ) } else { - gAgent.getAvatarObject()->stopMotion(itemID); + gAgentAvatarp->stopMotion(itemID); gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP); } } @@ -167,9 +167,9 @@ void LLPreviewAnim::auditionAnim( void *userdata ) if (self->childGetValue("Anim audition btn").asBoolean() ) { self->mPauseRequest = NULL; - gAgent.getAvatarObject()->startMotion(item->getAssetUUID()); + gAgentAvatarp->startMotion(item->getAssetUUID()); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; LLMotion* motion = avatar->findMotion(itemID); if (motion) @@ -179,7 +179,7 @@ void LLPreviewAnim::auditionAnim( void *userdata ) } else { - gAgent.getAvatarObject()->stopMotion(itemID); + gAgentAvatarp->stopMotion(itemID); gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP); } } @@ -428,10 +428,10 @@ 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(); + LLVOAvatar* avatar = gAgentAvatarp; LLMotion* motion = avatar->findMotion(item->getAssetUUID()); if (motion) diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 98ed9a409..dea4215df 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -42,6 +42,7 @@ #include "llassetuploadresponders.h" #include "llviewerwindow.h" #include "llbutton.h" +#include "llfloatersearchreplace.h" #include "llinventorymodel.h" #include "lllineeditor.h" #include "llnotificationsutil.h" @@ -112,7 +113,6 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, else { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard.xml"); - childSetAction("Save",onClickSave,this); // childSetAction("Get Items", onClickGetItems, this); // @@ -126,6 +126,7 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, } } } + childSetAction("Save",onClickSave,this); // only assert shape if not hosted in a multifloater if (!getHost()) @@ -154,6 +155,8 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, editor->setHandleEditKeysDirectly(TRUE); } + initMenu(); + gAgentCamera.changeCameraToDefault(); } @@ -223,6 +226,12 @@ BOOL LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) return TRUE; } + if ('F' == key && (mask & MASK_CONTROL) && !(mask & (MASK_SHIFT | MASK_ALT))) + { + LLFloaterSearchReplace::show(getChild("Notecard Editor")); + return TRUE; + } + return LLPreview::handleKeyHere(key, mask); } @@ -776,4 +785,221 @@ LLTextEditor* LLPreviewNotecard::getEditor() return getChild("Notecard Editor"); } +void LLPreviewNotecard::initMenu() +{ + LLMenuItemCallGL* menuItem = getChild("Undo"); + menuItem->setMenuCallback(onUndoMenu, this); + menuItem->setEnabledCallback(enableUndoMenu); + + menuItem = getChild("Redo"); + menuItem->setMenuCallback(onRedoMenu, this); + menuItem->setEnabledCallback(enableRedoMenu); + + menuItem = getChild("Cut"); + menuItem->setMenuCallback(onCutMenu, this); + menuItem->setEnabledCallback(enableCutMenu); + + menuItem = getChild("Copy"); + menuItem->setMenuCallback(onCopyMenu, this); + menuItem->setEnabledCallback(enableCopyMenu); + + menuItem = getChild("Paste"); + menuItem->setMenuCallback(onPasteMenu, this); + menuItem->setEnabledCallback(enablePasteMenu); + + menuItem = getChild("Select All"); + menuItem->setMenuCallback(onSelectAllMenu, this); + menuItem->setEnabledCallback(enableSelectAllMenu); + + menuItem = getChild("Deselect"); + menuItem->setMenuCallback(onDeselectMenu, this); + menuItem->setEnabledCallback(enableDeselectMenu); + + menuItem = getChild("Search / Replace..."); + menuItem->setMenuCallback(onSearchMenu, this); + menuItem->setEnabledCallback(NULL); +} + +// static +void LLPreviewNotecard::onSearchMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + LLFloaterSearchReplace::show(editor); + } + } +} + +// static +void LLPreviewNotecard::onUndoMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + editor->undo(); + } + } +} + +// static +void LLPreviewNotecard::onRedoMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + editor->redo(); + } + } +} + +// static +void LLPreviewNotecard::onCutMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + editor->cut(); + } + } +} + +// static +void LLPreviewNotecard::onCopyMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + editor->copy(); + } + } +} + +// static +void LLPreviewNotecard::onPasteMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + editor->paste(); + } + } +} + +// static +void LLPreviewNotecard::onSelectAllMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + editor->selectAll(); + } + } +} + +// static +void LLPreviewNotecard::onDeselectMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (self) + { + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (editor) + { + editor->deselect(); + } + } +} + +// static +BOOL LLPreviewNotecard::enableUndoMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (!self) return FALSE; + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (!editor) return FALSE; + return editor->canUndo(); +} + +// static +BOOL LLPreviewNotecard::enableRedoMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (!self) return FALSE; + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (!editor) return FALSE; + return editor->canRedo(); +} + +// static +BOOL LLPreviewNotecard::enableCutMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (!self) return FALSE; + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (!editor) return FALSE; + return editor->canCut(); +} + +// static +BOOL LLPreviewNotecard::enableCopyMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (!self) return FALSE; + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (!editor) return FALSE; + return editor->canCopy(); +} + +// static +BOOL LLPreviewNotecard::enablePasteMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (!self) return FALSE; + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (!editor) return FALSE; + return editor->canPaste(); +} + +// static +BOOL LLPreviewNotecard::enableSelectAllMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (!self) return FALSE; + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (!editor) return FALSE; + return editor->canSelectAll(); +} + +// static +BOOL LLPreviewNotecard::enableDeselectMenu(void* userdata) +{ + LLPreviewNotecard* self = (LLPreviewNotecard*)userdata; + if (!self) return FALSE; + LLViewerTextEditor* editor = self->getChild("Notecard Editor"); + if (!editor) return FALSE; + return editor->canDeselect(); +} + // EOF diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 04568bf65..442673c0c 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -45,6 +45,8 @@ class LLTextEditor; class LLViewerTextEditor; +class LLTextEditor; +class LLMenuBarGL; class LLButton; class AIFilePicker; @@ -117,6 +119,25 @@ protected: virtual const char *getTitleName() const { return "Note"; } + void initMenu(); + + static void onSearchMenu(void* userdata); + static void onUndoMenu(void* userdata); + static void onRedoMenu(void* userdata); + static void onCutMenu(void* userdata); + static void onCopyMenu(void* userdata); + static void onPasteMenu(void* userdata); + static void onSelectAllMenu(void* userdata); + static void onDeselectMenu(void* userdata); + + static BOOL enableUndoMenu(void* userdata); + static BOOL enableRedoMenu(void* userdata); + static BOOL enableCutMenu(void* userdata); + static BOOL enableCopyMenu(void* userdata); + static BOOL enablePasteMenu(void* userdata); + static BOOL enableSelectAllMenu(void* userdata); + static BOOL enableDeselectMenu(void* userdata); + protected: LLViewerTextEditor* mEditor; LLButton* mSaveBtn; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 3019fca11..31c977739 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -79,6 +79,7 @@ #include "lldir.h" #include "llcombobox.h" //#include "llfloaterchat.h" +#include "llfloatersearchreplace.h" #include "llviewerstats.h" #include "llviewertexteditor.h" #include "llviewerwindow.h" @@ -136,10 +137,6 @@ const S32 SCRIPT_MIN_HEIGHT = const S32 MAX_EXPORT_SIZE = 1000; -const S32 SCRIPT_SEARCH_WIDTH = 300; -const S32 SCRIPT_SEARCH_HEIGHT = 120; -const S32 SCRIPT_SEARCH_LABEL_WIDTH = 50; -const S32 SCRIPT_SEARCH_BUTTON_WIDTH = 80; const S32 TEXT_EDIT_COLUMN_HEIGHT = 16; const S32 MAX_HISTORY_COUNT = 10; const F32 LIVE_HELP_REFRESH_TIME = 1.f; @@ -150,148 +147,6 @@ static bool have_script_upload_cap(LLUUID& object_id) return object && (! object->getRegion()->getCapability("UpdateScriptTask").empty()); } -/// --------------------------------------------------------------------------- -/// LLFloaterScriptSearch -/// --------------------------------------------------------------------------- -class LLFloaterScriptSearch : public LLFloater -{ -public: - LLFloaterScriptSearch(std::string title, LLRect rect, LLScriptEdCore* editor_core); - ~LLFloaterScriptSearch(); - - static void show(LLScriptEdCore* editor_core); - static void onBtnSearch(void* userdata); - void handleBtnSearch(); - - static void onBtnReplace(void* userdata); - void handleBtnReplace(); - - static void onBtnReplaceAll(void* userdata); - void handleBtnReplaceAll(); - - LLScriptEdCore* getEditorCore() { return mEditorCore; } - static LLFloaterScriptSearch* getInstance() { return sInstance; } - - void open(); /*Flawfinder: ignore*/ - -private: - - LLScriptEdCore* mEditorCore; - - static LLFloaterScriptSearch* sInstance; -}; - -LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL; - -LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLScriptEdCore* editor_core) - : LLFloater("script search",rect,title), mEditorCore(editor_core) -{ - - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml"); - - childSetAction("search_btn", onBtnSearch,this); - childSetAction("replace_btn", onBtnReplace,this); - childSetAction("replace_all_btn", onBtnReplaceAll,this); - - setDefaultBtn("search_btn"); - - if (!getHost()) - { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); - } - - sInstance = this; - - childSetFocus("search_text", TRUE); - - // find floater in which script panel is embedded - LLView* viewp = (LLView*)editor_core; - while(viewp) - { - LLFloater* floaterp = dynamic_cast(viewp); - if (floaterp) - { - floaterp->addDependentFloater(this); - break; - } - viewp = viewp->getParent(); - } -} - -//static -void LLFloaterScriptSearch::show(LLScriptEdCore* editor_core) -{ - if (sInstance && sInstance->mEditorCore && sInstance->mEditorCore != editor_core) - { - sInstance->close(); - delete sInstance; - } - - if (!sInstance) - { - S32 left = 0; - S32 top = 0; - gFloaterView->getNewFloaterPosition(&left,&top); - - // sInstance will be assigned in the constructor. - new LLFloaterScriptSearch("Script Search",LLRect(left,top,left + SCRIPT_SEARCH_WIDTH,top - SCRIPT_SEARCH_HEIGHT),editor_core); - } - - sInstance->open(); /*Flawfinder: ignore*/ -} - -LLFloaterScriptSearch::~LLFloaterScriptSearch() -{ - sInstance = NULL; -} - -// static -void LLFloaterScriptSearch::onBtnSearch(void *userdata) -{ - LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata; - self->handleBtnSearch(); -} - -void LLFloaterScriptSearch::handleBtnSearch() -{ - LLCheckBoxCtrl* caseChk = getChild("case_text"); - mEditorCore->mEditor->selectNext(childGetText("search_text"), caseChk->get()); -} - -// static -void LLFloaterScriptSearch::onBtnReplace(void *userdata) -{ - LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata; - self->handleBtnReplace(); -} - -void LLFloaterScriptSearch::handleBtnReplace() -{ - LLCheckBoxCtrl* caseChk = getChild("case_text"); - mEditorCore->mEditor->replaceText(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); -} - -// static -void LLFloaterScriptSearch::onBtnReplaceAll(void *userdata) -{ - LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata; - self->handleBtnReplaceAll(); -} - -void LLFloaterScriptSearch::handleBtnReplaceAll() -{ - LLCheckBoxCtrl* caseChk = getChild("case_text"); - mEditorCore->mEditor->replaceTextAll(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); -} - -void LLFloaterScriptSearch::open() /*Flawfinder: ignore*/ -{ - LLFloater::open(); /*Flawfinder: ignore*/ - childSetFocus("search_text", TRUE); -} - - /// --------------------------------------------------------------------------- /// LLScriptEdCore /// --------------------------------------------------------------------------- @@ -435,14 +290,6 @@ LLScriptEdCore::LLScriptEdCore( LLScriptEdCore::~LLScriptEdCore() { deleteBridges(); - - // If the search window is up for this editor, close it. - LLFloaterScriptSearch* script_search = LLFloaterScriptSearch::getInstance(); - if (script_search && script_search->getEditorCore() == this) - { - script_search->close(); - delete script_search; - } } BOOL LLScriptEdCore::tick() @@ -486,6 +333,10 @@ void LLScriptEdCore::initMenu() menuItem->setMenuCallback(onSelectAllMenu, this); menuItem->setEnabledCallback(enableSelectAllMenu); + menuItem = getChild("Deselect"); + menuItem->setMenuCallback(onDeselectMenu, this); + menuItem->setEnabledCallback(enableDeselectMenu); + menuItem = getChild("Search / Replace..."); menuItem->setMenuCallback(onSearchMenu, this); menuItem->setEnabledCallback(NULL); @@ -933,7 +784,10 @@ void LLScriptEdCore::onBtnUndoChanges( void* userdata ) void LLScriptEdCore::onSearchMenu(void* userdata) { LLScriptEdCore* sec = (LLScriptEdCore*)userdata; - LLFloaterScriptSearch::show(sec); + if (sec && sec->mEditor) + { + LLFloaterSearchReplace::show(sec->mEditor); + } } // static @@ -1341,7 +1195,10 @@ void LLPreviewLSL::onSearchReplace(void* userdata) { LLPreviewLSL* self = (LLPreviewLSL*)userdata; LLScriptEdCore* sec = self->mScriptEd; - LLFloaterScriptSearch::show(sec); + if (sec && sec->mEditor) + { + LLFloaterSearchReplace::show(sec->mEditor); + } } // static @@ -2195,7 +2052,10 @@ void LLLiveLSLEditor::onSearchReplace(void* userdata) LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; LLScriptEdCore* sec = self->mScriptEd; - LLFloaterScriptSearch::show(sec); + if (sec && sec->mEditor) + { + LLFloaterSearchReplace::show(sec->mEditor); + } } struct LLLiveLSLSaveData diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index f4390927d..436d68d4f 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -51,7 +51,6 @@ class LLScrollListCtrl; class LLViewerObject; struct LLEntryAndEdCore; class LLMenuBarGL; -class LLFloaterScriptSearch; class LLKeywordToken; class AIFilePicker; @@ -61,7 +60,6 @@ class LLScriptEdCore : public LLPanel, public LLEventTimer friend class LLPreviewScript; friend class LLPreviewLSL; friend class LLLiveLSLEditor; - friend class LLFloaterScriptSearch; public: LLScriptEdCore( @@ -204,6 +202,7 @@ protected: static void onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); public: static LLPreviewLSL* getInstance(const LLUUID& uuid); + LLTextEditor* getEditor() { return mScriptEd->mEditor; } protected: static void* createScriptEdPanel(void* userdata); diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index a91cc25d0..a537990fd 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -44,7 +44,7 @@ #include "llviewermessage.h" // send_guid_sound_trigger #include "lluictrlfactory.h" // -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llchat.h" #include "llfloaterchat.h" #include "llviewerwindow.h" // for alert @@ -90,7 +90,7 @@ LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, cons // // that thing above doesn't actually start a sound transfer, so I will do it //LLAudioSource *asp = new LLAudioSource(gAgent.getID(), gAgent.getID(), F32(1.0f), LLAudioEngine::AUDIO_TYPE_UI); - LLAudioSource *asp = gAgent.getAvatarObject()->getAudioSource(gAgent.getID()); + LLAudioSource *asp = gAgentAvatarp->getAudioSource(gAgent.getID()); LLAudioData *datap = gAudiop->getAudioData(item->getAssetUUID()); asp->addAudioData(datap, FALSE); // diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index f9adea36b..a68f14594 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -623,7 +623,7 @@ bool LLSelectMgr::unlinkObjects() { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgent.getAvatarObject()->getRoot()); + RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); if ( (hSel.notNull()) && (hSel->getFirstRootNode(&f, TRUE)) ) return true; } @@ -677,7 +677,7 @@ bool LLSelectMgr::enableUnlinkObjects() { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgent.getAvatarObject()->getRoot()); + RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); new_value = handleSel->getFirstRootNode(&f, TRUE) == NULL; } // [/RLVa:KB] @@ -1610,7 +1610,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) { // 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())); @@ -3852,7 +3852,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point, bool replace) 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)) { if ((!replace || attachment_point != 0) && gHippoGridManager->getConnectedGrid()->supportsInvLinks()) { @@ -5162,7 +5162,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) if (isAgentAvatarValid() && for_hud) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; LLBBox hud_bbox = avatar->getHUDBBox(); F32 cur_zoom = gAgentCamera.mHUDCurZoom; @@ -5938,7 +5938,7 @@ void LLSelectMgr::updateSelectionCenter() if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { - mPauseRequest = gAgent.getAvatarObject()->requestPause(); + mPauseRequest = gAgentAvatarp->requestPause(); } else { @@ -5972,7 +5972,7 @@ void LLSelectMgr::updateSelectionCenter() LLViewerObject* object = node->getObject(); if (!object) continue; - LLViewerObject *myAvatar = gAgent.getAvatarObject(); + LLViewerObject *myAvatar = gAgentAvatarp; LLViewerObject *root = object->getRootEdit(); if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment !root->isChild(myAvatar) && // not the object you're sitting on diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e5a81cef1..c79a77884 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2743,7 +2743,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 + && gAgentAvatarp // can't wear clothes without object && !gAgent.isGenderChosen() ) // nothing already loading { // Start loading the wearables, textures, gestures @@ -2758,7 +2758,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 + && gAgentAvatarp // can't wear clothes without object && !gAgent.isGenderChosen() ) // nothing already loading { // Start loading the wearables, textures, gestures @@ -2766,7 +2766,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) && gAgentAvatarp) || (timeout_frac > 3.f)) { LLStartUp::setStartupState( STATE_WEARABLES_WAIT ); @@ -2822,8 +2822,8 @@ bool idle_startup() if (gAgent.isFirstLogin()) { // wait for avatar to be completely loaded - if (gAgent.getAvatarObject() - && gAgent.getAvatarObject()->isFullyLoaded()) + if (gAgentAvatarp + && gAgentAvatarp->isFullyLoaded()) { //llinfos << "avatar fully loaded" << llendl; LLStartUp::setStartupState( STATE_CLEANUP ); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 5b0b508b5..34b83a1cf 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -715,7 +715,7 @@ void LLStatusBar::setHealth(S32 health) { LLVOAvatar *me; - if ((me = gAgent.getAvatarObject())) + if ((me = gAgentAvatarp)) { if (me->getSex() == SEX_FEMALE) { diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index e2ec067ca..846768928 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -52,7 +52,7 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llxmltree.h" #include "pipeline.h" #include "v4coloru.h" @@ -81,12 +81,12 @@ LLBakedUploadData::LLBakedUploadData( LLVOAvatar* avatar, mID(id) { mStartTime = LLFrameTimer::getTotalTime(); // Record starting time - for( S32 i = 0; i < WT_COUNT; i++ ) + for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) { - LLWearable* wearable = gAgentWearables.getWearable( (EWearableType)i); + LLWearable* wearable = gAgentWearables.getWearable( (LLWearableType::EType)i); if( wearable ) { - mWearableAssets[i] = wearable->getID(); + mWearableAssets[i] = wearable->getAssetID(); } } } @@ -223,7 +223,7 @@ BOOL LLTexLayerSetBuffer::needsRender() BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->getIsAppearanceAnimating(); if (needs_update) { - BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == TEX_SKIRT_BAKED && !avatar->isWearingWearableType(WT_SKIRT); + BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == TEX_SKIRT_BAKED && !avatar->isWearingWearableType(LLWearableType::WT_SKIRT); if (invalid_skirt) { // we were trying to create a skirt texture @@ -407,7 +407,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, this, asset_id ); + new LLBakedUploadData( gAgentAvatarp, this->mTexLayerSet, this, asset_id ); mUploadID = asset_id; // Upload the image @@ -465,8 +465,8 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, if ((result == 0) && isAgentAvatarValid() && - !gAgent.getAvatarObject()->isDead() && - (baked_upload_data->mAvatar == gAgent.getAvatarObject()) && // Sanity check: only the user's avatar should be uploading textures. + !gAgentAvatarp->isDead() && + (baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures. (baked_upload_data->mTexLayerSet->hasComposite())) { LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite(); @@ -492,10 +492,10 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, if (result >= 0) { - ETextureIndex baked_te = gAgent.getAvatarObject()->getBakedTE(layerset_buffer->mTexLayerSet); + ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet); U64 now = LLFrameTimer::getTotalTime(); // Record starting time llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; - gAgent.getAvatarObject()->setNewBakedTexture(baked_te, uuid); + gAgentAvatarp->setNewBakedTexture(baked_te, uuid); } else { @@ -520,7 +520,7 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, llinfos << "Received baked texture out of date, ignored." << llendl; } - gAgent.getAvatarObject()->dirtyMesh(); + gAgentAvatarp->dirtyMesh(); } else { @@ -2059,8 +2059,8 @@ BOOL LLTexLayerParamAlpha::getSkip() } } - EWearableType type = (EWearableType)getWearableType(); - if( (type != WT_INVALID) && !avatar->isWearingWearableType( type ) ) + LLWearableType::EType type = (LLWearableType::EType)getWearableType(); + if( (type != LLWearableType::WT_INVALID) && !avatar->isWearingWearableType( type ) ) { return TRUE; } diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index d88466f50..7acc45be2 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -547,7 +547,7 @@ public: LLVOAvatar* mAvatar; // just backlink, don't LLPointer LLTexLayerSet* mTexLayerSet; LLTexLayerSetBuffer* mLayerSetBuffer; - LLUUID mWearableAssets[WT_COUNT]; + LLUUID mWearableAssets[LLWearableType::WT_COUNT]; U64 mStartTime; // Used to measure time baked texture upload requires }; diff --git a/indra/newview/lltexlayerparams.cpp b/indra/newview/lltexlayerparams.cpp index 40f151925..602c4b1de 100644 --- a/indra/newview/lltexlayerparams.cpp +++ b/indra/newview/lltexlayerparams.cpp @@ -236,7 +236,7 @@ BOOL LLTexLayerParamAlpha::getSkip() const } } - EWearableType type = (EWearableType)getWearableType(); + LLWearableType::EType type = (LLWearableType::EType)getWearableType(); if ((type != WT_INVALID) && !avatar->isWearingWearableType(type)) { return TRUE; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index a72d6b5e0..1f4815d53 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1380,6 +1380,12 @@ bool LLTextureFetchWorker::doWork(S32 param) setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); return false ; } + else + { + // UDP is not an option, we are dead + resetFormattedData(); + return true; // failed + } } else if (mGetStatus == HTTP_SERVICE_UNAVAILABLE) { @@ -1402,7 +1408,9 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mHTTPFailCount >= max_attempts) { - if (cur_size > 0) + // Make max_attempts attempt at decoding what data we have, + // then bail forever on this image + if (cur_size > 0 && (mHTTPFailCount < (max_attempts+1)) ) { // Use available data mLoadedDiscard = mFormattedImage->getDiscardLevel(); @@ -1411,9 +1419,21 @@ bool LLTextureFetchWorker::doWork(S32 param) } else { - resetFormattedData(); - mState = DONE; - return true; // failed + //roll back to try UDP + if(mCanUseNET) + { + mState = INIT ; + mCanUseHTTP = false ; + setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); + return false ; + } + else + { + // UDP is not an option, we are dead + resetFormattedData(); + mState = DONE; + return true; // failed + } } } else diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 1a11957fb..6ebeb870a 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -127,6 +127,20 @@ BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) return FALSE; } +BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask) +{ + // by default, didn't handle it + // llinfos << "LLTool::handleMiddleMouseDown" << llendl; + return FALSE; +} + +BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + // by default, didn't handle it + // llinfos << "LLTool::handleMiddleMouseUp" << llendl; + return FALSE; +} + BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { // by default, didn't handle it diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index 249088fd3..f954a8c24 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -57,6 +57,9 @@ public: // Virtual functions inherited from LLMouseHandler virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 8f5c767a5..06ab0428d 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -293,9 +293,9 @@ void LLToolBar::refresh() setVisible(show && !mouselook); BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - sitting = gAgent.getAvatarObject()->isSitting(); + sitting = gAgentAvatarp->isSitting(); } childSetEnabled("fly_btn", (gAgent.canFly() || gAgent.getFlying() || gSavedSettings.getBOOL("AscentFlyAlwaysEnabled")) && !sitting ); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 64fd39527..fa096d5a5 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1281,7 +1281,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())); @@ -1471,7 +1471,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())); @@ -1539,7 +1539,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())); @@ -1655,7 +1655,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())); @@ -1684,7 +1684,7 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent, llinfos << "LLToolDragAndDrop::giveInventoryCategory() - " << cat->getUUID() << llendl; - LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + LLVOAvatar* my_avatar = gAgentAvatarp; if( !my_avatar ) { return; @@ -1878,7 +1878,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())); @@ -1913,7 +1913,7 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item) if(item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE; // - /*LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + /*LLVOAvatar* my_avatar = gAgentAvatarp; if(!my_avatar) { return FALSE; @@ -1972,7 +1972,7 @@ BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item) return FALSE; } - LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + LLVOAvatar* my_avatar = gAgentAvatarp; if(!my_avatar) { return FALSE; @@ -2033,7 +2033,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL switch(item->getType()) { case LLAssetType::AT_OBJECT: - my_avatar = gAgent.getAvatarObject(); + my_avatar = gAgentAvatarp; if(my_avatar && my_avatar->isWearingAttachment(item->getUUID())) { worn = TRUE; @@ -2071,7 +2071,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == pObjRoot) ) return ACCEPT_NO_LOCKED; // ... or on a linkset the avie is sitting on under @unsit=n/@sittp=n } @@ -2204,7 +2204,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( // must not be already wearing it // - //LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + //LLVOAvatar* my_avatar = gAgentAvatarp; //if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) ) //{ // return ACCEPT_NO; @@ -2273,7 +2273,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( if(!item || !item->isComplete()) return ACCEPT_NO; // - //LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + //LLVOAvatar* my_avatar = gAgentAvatarp; //if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) ) //{ // return ACCEPT_NO; @@ -2349,7 +2349,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( locateInventory(item, cat); if(!item || !item->isComplete()) return ACCEPT_NO; // - //LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + //LLVOAvatar* my_avatar = gAgentAvatarp; //if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) ) //{ // return ACCEPT_NO; @@ -2508,7 +2508,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())); @@ -2858,7 +2858,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( // cannot give away no-transfer objects return ACCEPT_NO; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if(avatar && avatar->isWearingAttachment( item->getUUID() ) ) { // You can't give objects that are attached to you diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index fa25c0c41..de0fe77f7 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -55,7 +55,7 @@ #include "llviewercamera.h" #include "llviewerobject.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llmorphview.h" // Globals @@ -171,7 +171,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) BOOL good_customize_avatar_hit = FALSE; if( hit_obj ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( hit_obj == avatar) { // It's you @@ -222,7 +222,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) gAgentCamera.cameraThirdPerson() && gViewerWindow->getLeftMouseDown() && !freeze_time && - (hit_obj == gAgent.getAvatarObject() || + (hit_obj == gAgentAvatarp || (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf()))) { LLToolCamera::getInstance()->mMouseSteering = TRUE; diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 3862df1c5..167d03a5a 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -725,7 +725,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) { 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 gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 3516bc38c..2cdfe9e6c 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -62,7 +62,7 @@ #include "llviewertexturelist.h" #include "llviewerobject.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "pipeline.h" @@ -146,12 +146,12 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis BOOL LLVisualParamHint::needsRender() { - return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgent.getAvatarObject()->getIsAppearanceAnimating() && mAllowsUpdates; + return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->getIsAppearanceAnimating() && mAllowsUpdates; } void LLVisualParamHint::preRender(BOOL clear_depth) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; mLastParamWeight = avatarp->getVisualParamWeight(mVisualParam); avatarp->setVisualParamWeight(mVisualParam, mVisualParamWeight); @@ -171,7 +171,7 @@ void LLVisualParamHint::preRender(BOOL clear_depth) BOOL LLVisualParamHint::render() { LLVisualParamReset::sDirty = TRUE; - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -304,7 +304,7 @@ BOOL LLVisualParamReset::render() { if (sDirty) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; avatarp->updateComposites(); avatarp->updateVisualParams(); avatarp->updateGeometry(avatarp->mDrawable); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 82e30203e..52d538fee 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -206,7 +206,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // touch behavior down below... break; case CLICK_ACTION_SIT: - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting()) + if ((gAgentAvatarp != NULL) && (!gAgentAvatarp->isSitting()) && (!gSavedSettings.getBOOL("DisableClickSit"))) // agent not already sitting { handle_sit_or_stand(); @@ -317,7 +317,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) } 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()); @@ -554,9 +554,9 @@ ECursorType cursor_from_object(LLViewerObject* object) switch(click_action) { case CLICK_ACTION_SIT: -// if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting? +// if ((gAgentAvatarp != NULL) && (!gAgentAvatarp->isSitting())) // not already sitting? // [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j - if ( ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) && // not already sitting? + if ( ((gAgentAvatarp != NULL) && (!gAgentAvatarp->isSitting())) && // not already sitting? ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, gViewerWindow->getHoverPick().mObjectOffset))) ) // [/RLVa:KB] { @@ -660,8 +660,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) */ - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); - LLViewerObject *object = NULL; LLViewerObject *parent = NULL; // object = gViewerWindow->getHoverPick().getObject(); @@ -811,7 +809,7 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) if (pos_non_zero && (is_land || (is_in_world && !has_touch_handler && !has_click_action))) { LLVector3d pos = mPick.mPosGlobal; - pos.mdV[VZ] += gAgent.getAvatarObject()->getPelvisToFoot(); + pos.mdV[VZ] += gAgentAvatarp->getPelvisToFoot(); gAgent.teleportViaLocationLookAt(pos); return TRUE; } diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 4710a096a..9e59b9cc4 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -175,7 +175,18 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, return TRUE; } - +S32 LLToolPlacer::getTreeGrassSpecies(std::map &table, const char *control, S32 max) +{ + const std::string &species = gSavedSettings.getString(control); + std::map::iterator it; + it = table.find(species); + if (it != table.end()) { + return it->second; + } else { + // if saved species not found, default to "Random" + return (rand() % max); + } +} BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) { LLVector3 ray_start_region; @@ -220,13 +231,13 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) case LL_PCODE_LEGACY_GRASS: // Randomize size of grass patch scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f)); - state = rand() % LLVOGrass::sMaxGrassSpecies; + state = getTreeGrassSpecies(LLVOGrass::sSpeciesNames, "LastGrass", LLVOGrass::sMaxGrassSpecies); break; case LL_PCODE_LEGACY_TREE: case LL_PCODE_TREE_NEW: - state = rand() % LLVOTree::sMaxTreeSpecies; + state = getTreeGrassSpecies(LLVOTree::sSpeciesNames, "LastTree", LLVOTree::sMaxTreeSpecies); break; case LL_PCODE_SPHERE: @@ -463,7 +474,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/lltoolplacer.h b/indra/newview/lltoolplacer.h index d478f7b1c..702fc1f50 100644 --- a/indra/newview/lltoolplacer.h +++ b/indra/newview/lltoolplacer.h @@ -62,6 +62,7 @@ protected: private: BOOL addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ); + S32 getTreeGrassSpecies(std::map &table, const char *control, S32 max); BOOL raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region ); BOOL addDuplicate(S32 x, S32 y); diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index f38928600..c46c505ab 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -216,8 +216,8 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi } if (!gAgentCamera.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 + 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/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp index 5bab702cf..3eee60882 100644 --- a/indra/newview/llviewerassettype.cpp +++ b/indra/newview/llviewerassettype.cpp @@ -86,6 +86,8 @@ LLViewerAssetDictionary::LLViewerAssetDictionary() addEntry(LLViewerAssetType::AT_LINK, new ViewerAssetEntry(DAD_LINK)); addEntry(LLViewerAssetType::AT_LINK_FOLDER, new ViewerAssetEntry(DAD_LINK)); + addEntry(LLViewerAssetType::AT_MESH, new ViewerAssetEntry(DAD_MESH)); + addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE)); }; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 0f13fbb3d..b5a78b01d 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -55,7 +55,7 @@ #include "llviewerthrottle.h" #include "llviewerwindow.h" #include "llwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoiceclient.h" #include "llvosky.h" #include "llvotree.h" @@ -583,8 +583,8 @@ bool handleCloudSettingsChanged(const LLSD& newvalue) bool handleAscentSelfTag(const LLSD& newvalue) { - if(gAgent.getAvatarObject()) - gAgent.getAvatarObject()->mClientTag = ""; + if(gAgentAvatarp) + gAgentAvatarp->mClientTag = ""; return true; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index bef35f755..7fd6dfed0 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -364,9 +364,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo 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 (gAgentAvatarp) { - 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(); @@ -1128,7 +1128,7 @@ LLRect get_whole_screen_region() bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model) { - LLVOAvatar* my_avatarp = gAgent.getAvatarObject(); + LLVOAvatar* my_avatarp = gAgentAvatarp; if (my_avatarp && my_avatarp->hasHUDAttachment()) { F32 zoom_level = gAgentCamera.mHUDCurZoom; diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 2d1bd8c37..2c0a7739a 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -140,7 +140,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) bool handled = !cmd_line_chat(mOutputString, CHAT_TYPE_NORMAL); #if SHY_MOD //Command handler - handled = handled || SHCommandHandler::handleCommand(true, mOutputString, gAgentID, gAgent.getAvatarObject()); + handled = handled || SHCommandHandler::handleCommand(true, mOutputString, gAgentID, gAgentAvatarp); #endif //shy_mod if (!handled && send_chat && !mOutputString.empty()) { diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ef2c4e9ab..2a521e018 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -368,13 +368,13 @@ bool LLViewerInventoryItem::isWearableType() const return (getInventoryType() == LLInventoryType::IT_WEARABLE); } -EWearableType LLViewerInventoryItem::getWearableType() const +LLWearableType::EType LLViewerInventoryItem::getWearableType() const { if (!isWearableType()) { - return WT_INVALID; + return LLWearableType::WT_INVALID; } - return EWearableType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); + return LLWearableType::EType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); } // [/RLVa:KB] @@ -755,7 +755,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& parent, const LLTransactionID& transaction_id, const std::string& name, const std::string& desc, LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, EWearableType wtype, + LLInventoryType::EType inv_type, LLWearableType::EType wtype, U32 next_owner_perm, LLPointer cb) { diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index e6cf73d6d..00782eb25 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -127,7 +127,7 @@ public: //void updateAssetOnServer() const; // [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3a) | Added: RLVa-1.1.3a virtual bool isWearableType() const; - virtual EWearableType getWearableType() const; + virtual LLWearableType::EType getWearableType() const; // [/RLVa:KB] virtual void packMessage(LLMessageSystem* msg) const; @@ -272,13 +272,13 @@ public: extern LLInventoryCallbackManager gInventoryCallbacks; -#define NOT_WEARABLE (EWearableType)0 +#define NOT_WEARABLE (LLWearableType::EType)0 void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& parent, const LLTransactionID& transaction_id, const std::string& name, const std::string& desc, LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, EWearableType wtype, + LLInventoryType::EType inv_type, LLWearableType::EType wtype, U32 next_owner_perm, LLPointer cb); diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index ef0fa8447..622063aa9 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -44,7 +44,7 @@ #include "llmoveview.h" #include "lltoolfocus.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" // // Constants @@ -843,7 +843,7 @@ EKeyboardMode LLViewerKeyboard::getMode() { return MODE_EDIT_AVATAR; } - else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) + else if (gAgentAvatarp && gAgentAvatarp->isSitting()) { return MODE_SITTING; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0debf03b6..9faee6106 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2401,9 +2401,9 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { bool new_value = false; - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) { @@ -2796,9 +2796,9 @@ bool handle_go_to() LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) + if (gAgentAvatarp && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) { - gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgent.getAvatarObject()->getID()); + gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID()); } else { @@ -3515,7 +3515,7 @@ class LLSelfSitOrStand : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) + if (gAgentAvatarp && gAgentAvatarp->isSitting()) { // [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK if (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) @@ -3543,7 +3543,7 @@ class LLSelfEnableSitOrStand : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gAgent.getAvatarObject() && !gAgent.getFlying(); + bool new_value = gAgentAvatarp && !gAgent.getFlying(); // gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); std::string label; @@ -3557,7 +3557,7 @@ class LLSelfEnableSitOrStand : public view_listener_t stand_text = param.substr(offset+1); } - if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) + if (gAgentAvatarp && gAgentAvatarp->isSitting()) { // [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)); @@ -3749,9 +3749,9 @@ void handle_fake_away_status(void*) void handle_force_ground_sit(void*) { - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - if(!gAgent.getAvatarObject()->isSitting()) + if(!gAgentAvatarp->isSitting()) { gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } @@ -3894,8 +3894,8 @@ class LLEditEnableCustomizeAvatar : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = (gAgent.getAvatarObject() && - gAgent.getAvatarObject()->isFullyLoaded() && + bool new_value = (gAgentAvatarp && + gAgentAvatarp->isFullyLoaded() && gAgentWearables.areWearablesLoaded()); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -3945,9 +3945,9 @@ bool handle_sit_or_stand() if (object && object->getPCode() == LL_PCODE_VOLUME) { // [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.1.3b) | Added: RLVa-1.2.1c | OK - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (gAgent.getAvatarObject()) ) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (gAgentAvatarp) ) { - if (gAgent.getAvatarObject()->isSitting()) + if (gAgentAvatarp->isSitting()) { if (gRlvHandler.canStand()) gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); @@ -4011,9 +4011,9 @@ class LLLandSit : public view_listener_t LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal; LLQuaternion target_rot; - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - target_rot = gAgent.getAvatarObject()->getRotation(); + target_rot = gAgentAvatarp->getRotation(); } else { @@ -4062,9 +4062,9 @@ class LLWorldEnableFly : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - sitting = gAgent.getAvatarObject()->isSitting(); + sitting = gAgentAvatarp->isSitting(); } gMenuHolder->findControl(userdata["control"].asString())->setValue(!sitting); return true; @@ -5141,7 +5141,7 @@ BOOL sitting_on_selection() } // Need to determine if avatar is sitting on this object - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (!avatar) { return FALSE; @@ -5744,7 +5744,7 @@ void print_agent_nvpairs(void*) llinfos << "Agent Name Value Pairs" << llendl; - objectp = gAgent.getAvatarObject(); + objectp = gAgentAvatarp; if (objectp) { objectp->printNameValuePairs(); @@ -5906,9 +5906,9 @@ class LLWorldSitOnGround : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - if(!gAgent.getAvatarObject()->isSitting()) + if(!gAgentAvatarp->isSitting()) { gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } @@ -5945,7 +5945,7 @@ class LLWorldEnableSitOnGround : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = (gAgent.getAvatarObject()); + bool new_value = (gAgentAvatarp); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6837,7 +6837,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); // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f | OK // RELEASE-RLVa: [SL-2.2.0] If 'index != 0' then the object will be "add attached" [see LLSelectMgr::sendAttach()] @@ -6871,8 +6871,8 @@ void near_attach_object(BOOL success, void *user_data) U8 attachment_id = 0; if (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) { @@ -7168,7 +7168,7 @@ class LLAttachmentEnableDrop : public view_listener_t if ( object ) { S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState()); - attachment_pt = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); + attachment_pt = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); if ( attachment_pt ) { @@ -7639,7 +7639,7 @@ void handle_toggle_pg(void*) void handle_dump_attachments(void*) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( !avatar ) { llinfos << "NO AVATAR" << llendl; @@ -7851,8 +7851,8 @@ class LLToolsEnableTakeCopy : public view_listener_t // return (!obj->permCopy() || obj->isAttachment()); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) return (!obj->permCopy() || obj->isAttachment()) || - ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && - (gAgent.getAvatarObject()->getRoot() == obj) ); + ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgentAvatarp) && + (gAgentAvatarp->getRoot() == obj) ); // [/RLVa:KB] } } func; @@ -8268,19 +8268,19 @@ void slow_mo_animations(void*) static BOOL slow_mo = FALSE; if (slow_mo) { - gAgent.getAvatarObject()->setAnimTimeFactor(1.f); + gAgentAvatarp->setAnimTimeFactor(1.f); slow_mo = FALSE; } else { - gAgent.getAvatarObject()->setAnimTimeFactor(0.2f); + gAgentAvatarp->setAnimTimeFactor(0.2f); slow_mo = TRUE; } } void handle_dump_avatar_local_textures(void*) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if( avatar ) { avatar->dumpLocalTextures(); @@ -8497,7 +8497,7 @@ static void handle_mesh_save_current_obj_continued(void* data, AIFilePicker* fil return; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if ( avatar ) { LLPolyMesh* mesh = avatar->getMesh (mesh_shared); @@ -8710,7 +8710,7 @@ void handle_debug_avatar_textures(void*) void handle_grab_texture(void* data) { ETextureIndex index = (ETextureIndex)((intptr_t)data); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if ( avatar ) { const LLUUID& asset_id = avatar->grabLocalTexture(index); @@ -8803,7 +8803,7 @@ void handle_grab_texture(void* data) BOOL enable_grab_texture(void* data) { ETextureIndex index = (ETextureIndex)((intptr_t)data); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if ( avatar ) { return avatar->canGrabLocalTexture(index); @@ -9044,7 +9044,7 @@ void handle_buy_currency_test(void*) void handle_rebake_textures(void*) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; if (!avatar) return; // Slam pending upload count to "unstick" things @@ -9165,68 +9165,19 @@ class LLEditEnableTakeOff : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { + bool new_value = false; std::string control_name = userdata["control"].asString(); std::string clothing = userdata["data"].asString(); - bool new_value = false; - if (clothing == "shirt") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_SHIRT); - } - if (clothing == "pants") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_PANTS); - } - if (clothing == "shoes") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_SHOES); - } - if (clothing == "socks") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_SOCKS); - } - if (clothing == "jacket") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_JACKET); - } - if (clothing == "gloves") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_GLOVES); - } - if (clothing == "undershirt") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERSHIRT); - } - if (clothing == "underpants") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERPANTS); - } - if (clothing == "skirt") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_SKIRT); - } - if (clothing == "alpha") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_ALPHA); - } - if (clothing == "tattoo") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_TATTOO); - } - if (clothing == "physics") - { - new_value = LLAgentWearables::selfHasWearable((void *)WT_PHYSICS); - } - + LLWearableType::EType type = LLWearableType::typeNameToType(clothing); + if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT) // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.1.3b) | Modified: RLVa-1.1.3b | OK - // Why aren't they using LLWearable::typeNameToType()? *confuzzled* - if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(LLWearable::typeNameToType(clothing))) ) - { - new_value = false; - } + if ( !(rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(type)) ) // [/RLVa:KB] + + new_value = LLAgentWearables::selfHasWearable((void *)type); gMenuHolder->findControl(control_name)->setValue(new_value); - return true; + return false; } }; @@ -9235,58 +9186,17 @@ class LLEditTakeOff : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { std::string clothing = userdata.asString(); - if (clothing == "shirt") - { - LLAgentWearables::userRemoveWearable((void*)WT_SHIRT); - } - else if (clothing == "pants") - { - LLAgentWearables::userRemoveWearable((void*)WT_PANTS); - } - else if (clothing == "shoes") - { - LLAgentWearables::userRemoveWearable((void*)WT_SHOES); - } - else if (clothing == "socks") - { - LLAgentWearables::userRemoveWearable((void*)WT_SOCKS); - } - else if (clothing == "jacket") - { - LLAgentWearables::userRemoveWearable((void*)WT_JACKET); - } - else if (clothing == "gloves") - { - LLAgentWearables::userRemoveWearable((void*)WT_GLOVES); - } - else if (clothing == "undershirt") - { - LLAgentWearables::userRemoveWearable((void*)WT_UNDERSHIRT); - } - else if (clothing == "underpants") - { - LLAgentWearables::userRemoveWearable((void*)WT_UNDERPANTS); - } - else if (clothing == "skirt") - { - LLAgentWearables::userRemoveWearable((void*)WT_SKIRT); - } - else if (clothing == "alpha") - { - LLAgentWearables::userRemoveWearable((void*)WT_ALPHA); - } - else if (clothing == "tattoo") - { - LLAgentWearables::userRemoveWearable((void*)WT_TATTOO); - } - else if (clothing == "physics") - { - LLAgentWearables::userRemoveWearable((void*)WT_PHYSICS); - } - else if (clothing == "all") + if (clothing == "all") { LLAgentWearables::userRemoveAllClothes(NULL); } + else + { + LLWearableType::EType type = LLWearableType::typeNameToType(clothing); + if (type >= LLWearableType::WT_SHAPE + && type < LLWearableType::WT_COUNT) + LLAgentWearables::userRemoveWearable((void*)type); + } return true; } }; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ea26bda4f..dd5308258 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1845,7 +1845,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) //Generate slurl std::string slrul = gAgent.getSLURL(); //Generate idle time - LLVOAvatar* myavatar = gAgent.getAvatarObject(); + LLVOAvatar* myavatar = gAgentAvatarp; std::string idle_time = ""; if(myavatar)idle_time = llformat("%d mins", (U8)(myavatar->mIdleTimer.getElapsedTimeF32()/60.)); @@ -3748,9 +3748,9 @@ void process_teleport_finish(LLMessageSystem* msg, void**) gAgent.setRegion(regionp); gObjectList.shiftObjects(shift_vector); - if (gAgent.getAvatarObject()) + if (gAgentAvatarp) { - gAgent.getAvatarObject()->clearChatText(); + gAgentAvatarp->clearChatText(); gAgentCamera.slamLookAt(look_at); } gAgent.setPositionAgent(pos); @@ -3844,7 +3844,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) std::string version_channel; msg->getString("SimData", "ChannelVersion", version_channel); - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; if (!avatarp) { // Could happen if you were immediately god-teleported away on login, @@ -4956,7 +4956,7 @@ 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(); + LLVOAvatar* avatar = gAgentAvatarp; if (avatar && dist_vec_squared(camera_eye, camera_at) > 0.0001f) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 71a0e6a58..6b1710b48 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -82,7 +82,7 @@ #include "llviewerstats.h" #include "llviewertextureanim.h" #include "llviewerwindow.h" // For getSpinAxis -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoclouds.h" #include "llvograss.h" #include "llvoground.h" @@ -135,7 +135,29 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco case LL_PCODE_VOLUME: res = new LLVOVolume(id, pcode, regionp); break; case LL_PCODE_LEGACY_AVATAR: - res = new LLVOAvatar(id, pcode, regionp); break; + { + if (id == gAgentID) + { + if (!gAgentAvatarp) + { + lldebugs << "Marking avatar as self " << id << llendl; + gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp); + gAgentAvatarp->initInstance(); + } + else + { + gAgentAvatarp->updateRegion(regionp); + } + res = gAgentAvatarp; + } + else + { + LLVOAvatar *avatar = new LLVOAvatar(id, pcode, regionp); + avatar->initInstance(); + res = avatar; + } + break; + } case LL_PCODE_LEGACY_GRASS: res = new LLVOGrass(id, pcode, regionp); break; case LL_PCODE_LEGACY_PART_SYS: @@ -396,7 +418,7 @@ void LLViewerObject::markDead() if (isAgentAvatarValid()) { // stop motions associated with this object - gAgent.getAvatarObject()->stopMotionFromSource(mID); + gAgentAvatarp->stopMotionFromSource(mID); } } @@ -1982,7 +2004,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } // If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps - if ( isAvatar() && gAgent.getAvatarObject() == this && (mag_sqr > 0.25f) ) + if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) ) { LLViewerStats::getInstance()->mAgentPositionSnaps.push( diff.length() ); } @@ -4574,6 +4596,11 @@ void LLViewerObject::updateText() } } +LLVOAvatar* LLViewerObject::asAvatar() +{ + return NULL; +} + BOOL LLViewerObject::isParticleSource() const { return !mPartSourcep.isNull() && !mPartSourcep->isDead(); @@ -5650,7 +5677,7 @@ std::string LLViewerObject::getAttachmentPointName() S32 point = getAttachmentPoint(); if((point > 0) && (point < 39)) { - return gAgent.getAvatarObject()->mAttachmentPoints[point]->getName(); + return gAgentAvatarp->mAttachmentPoints[point]->getName(); } return llformat("unsupported point %d", point); } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index fe31ec725..0da84ef08 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -145,6 +145,8 @@ public: BOOL isOrphaned() const { return mOrphaned; } BOOL isParticleSource() const; + virtual LLVOAvatar* asAvatar(); + static void initVOClasses(); static void cleanupVOClasses(); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 0330f9670..24860ab25 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -42,7 +42,7 @@ #include "llviewercontrol.h" #include "llface.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llviewerobject.h" #include "llviewerwindow.h" #include "llwindow.h" @@ -1240,7 +1240,7 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) { // Don't commit suicide just because someone thinks you are on a ledge. -SG - if (objectp == gAgent.getAvatarObject()) + if (objectp == gAgentAvatarp) { objectp->setRegion(gAgent.getRegion()); return FALSE; @@ -1299,7 +1299,7 @@ void LLViewerObjectList::killAllObjects() killObject(objectp); // Object must be dead, or it's the LLVOAvatarSelf which never dies. - llassert((objectp == gAgent.getAvatarObject()) || objectp->isDead()); + llassert((objectp == gAgentAvatarp) || objectp->isDead()); } cleanDeadObjects(FALSE); @@ -1746,7 +1746,7 @@ void LLViewerObjectList::generatePickList(LLCamera &camera) // add all hud objects to pick list if (isAgentAvatarValid()) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatar* avatarp = gAgentAvatarp; for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) { diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index d2681503b..031e5fa6a 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -69,6 +69,7 @@ // Library headers from llcommon project: #include "bitpack.h" +#include "lldeleteutils.h" #include "imageids.h" #include "indra_constants.h" //#include "linden_common.h" diff --git a/indra/newview/llviewervisualparam.cpp b/indra/newview/llviewervisualparam.cpp index 8c7700eb6..733fd485e 100644 --- a/indra/newview/llviewervisualparam.cpp +++ b/indra/newview/llviewervisualparam.cpp @@ -45,7 +45,7 @@ //----------------------------------------------------------------------------- LLViewerVisualParamInfo::LLViewerVisualParamInfo() : - mWearableType( WT_INVALID ), + mWearableType( LLWearableType::WT_INVALID ), mCamDist( 0.5f ), mCamAngle( 0.f ), mCamElevation( 0.f ), @@ -76,7 +76,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable"); if( node->getFastAttributeString( wearable_string, wearable) ) { - mWearableType = LLWearable::typeNameToType( wearable ); + mWearableType = LLWearableType::typeNameToType( wearable ); } static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group"); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 3ee8be54f..684c7e405 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -363,9 +363,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 (gAgentAvatarp) { - 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])); } @@ -721,47 +721,84 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh) return false; } -BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) { + std::string buttonname; + std::string buttonstatestr; + BOOL handled = FALSE; S32 x = pos.mX; S32 y = pos.mY; x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage.clear(); + if (down) + buttonstatestr = "down"; + else + buttonstatestr = "up"; - if (gDebugClicks) + switch (clicktype) { - llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl; + case LLMouseHandler::CLICK_LEFT: + mLeftMouseDown = down; + buttonname = "Left"; + break; + case LLMouseHandler::CLICK_RIGHT: + mRightMouseDown = down; + buttonname = "Right"; + break; + case LLMouseHandler::CLICK_MIDDLE: + mMiddleMouseDown = down; + buttonname = "Middle"; + break; + case LLMouseHandler::CLICK_DOUBLELEFT: + mLeftMouseDown = down; + buttonname = "Left Double Click"; + break; } + LLView::sMouseHandlerMessage.clear(); + if (gMenuBarView) { // stop ALT-key access to menu gMenuBarView->resetMenuTrigger(); } - mLeftMouseDown = TRUE; + if (gDebugClicks) + { + llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl; + } // Make sure we get a coresponding mouseup event, even if the mouse leaves the window - mWindow->captureMouse(); + if (down) + { + mWindow->captureMouse(); + } + else + { + mWindow->releaseMouse(); + } // Indicate mouse was active gMouseIdleTimer.reset(); // Hide tooltips on mousedown - mToolTipBlocked = TRUE; + if (down) + { + mToolTipBlocked = TRUE; + mToolTip->setVisible(FALSE); + } - // Also hide hover info on mousedown + // Also hide hover info on mousedown/mouseup if (gHoverView) { gHoverView->cancelHover(); } // Don't let the user move the mouse out of the window until mouse up. - if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) + if (LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown()) { - mWindow->setMouseClipping(TRUE); + mWindow->setMouseClipping(down); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -772,10 +809,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl; } - - return mouse_captor->handleMouseDown(local_x, local_y, mask); + return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); } // Topmost view gets a chance before the hierarchy @@ -784,216 +820,94 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask { S32 local_x, local_y; top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) + + if (down) { - return top_ctrl->handleMouseDown(local_x, local_y, mask); - } + if (top_ctrl->pointInView(local_x, local_y)) + { + return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ; + } + else + { + gFocusMgr.setTopCtrl(NULL); + } + } else - { - gFocusMgr.setTopCtrl(NULL); - } + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); } // Give the UI views a chance to process the click - if( mRootView->handleMouseDown(x, y, mask) ) + if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ) { if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl; } return TRUE; } else if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down not handled by view" << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl; } - // Do not allow tool manager to handle mouseclicks if we have disconnected - if (gDisconnected) + if (down) { - return FALSE; - } + // Do not allow tool manager to handle mouseclicks if we have disconnected + if (gDisconnected) + { + return FALSE; + } - if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) ) + if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) + { + // This is necessary to force clicks in the world to cause edit + // boxes that might have keyboard focus to relinquish it, and hence + // cause a commit to update their value. JC + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; + } + } + else { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; + mWindow->releaseMouse(); + + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + if( !handled ) + { + handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down); + } + + if( !handled ) + { + if (tool) + { + handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down); + } + } } - return FALSE; + return (!down); +} + +BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +{ + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl; - } - - mLeftMouseDown = TRUE; - - // Hide tooltips - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; - } - - return mouse_captor->handleDoubleClick(local_x, local_y, mask); - } - - // Check for hit on UI. - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleDoubleClick(local_x, local_y, mask); - } - else - { - gFocusMgr.setTopCtrl(NULL); - } - } - - if (mRootView->handleDoubleClick(x, y, mask)) - { - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; - } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down not handled by view" << llendl; - } - - // Why is this here? JC 9/3/2002 - if (gNoRender) - { - return TRUE; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) ) - { - return TRUE; - } - - // if we got this far and nothing handled a double click, pass a normal mouse down - return handleMouseDown(window, pos, mask); + // try handling as a double-click first, then a single-click if that + // wasn't handled. + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) || + handleMouseDown(window, pos, mask); } BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse up" << llendl; - } - - mLeftMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - - return mouse_captor->handleMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Left Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } @@ -1006,89 +920,11 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK LLView::sMouseHandlerMessage.clear(); - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl; - } + BOOL down = TRUE; + BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); + if (handle) + return handle; - if (gMenuBarView) - { - // stop ALT-key access to menu - gMenuBarView->resetMenuTrigger(); - } - - mRightMouseDown = TRUE; - - // Make sure we get a coresponding mouseup event, even if the mouse leaves the window - mWindow->captureMouse(); - - // Hide tooltips - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mousedown - if (gHoverView) - { - gHoverView->cancelHover(); - } - - // Don't let the user move the mouse out of the window until mouse up. - if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(TRUE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseDown(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleRightMouseDown(local_x, local_y, mask); - } - else - { - gFocusMgr.setTopCtrl(NULL); - } - } - - if( mRootView->handleRightMouseDown(x, y, mask) ) - { - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl; - } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down not handled by view" << llendl; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } // *HACK: this should be rolled into the composite tool logic, not // hardcoded at the top level. @@ -1106,97 +942,15 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - // Don't care about caps lock for mouse events. - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse up" << llendl; - } - - mRightMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleRightMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Right Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleRightMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); } BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = TRUE; gVoiceClient->middleMouseState(true); + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); // Always handled as far as the OS is concerned. return TRUE; @@ -1204,7 +958,9 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MAS BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = FALSE; gVoiceClient->middleMouseState(false); + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); // Always handled as far as the OS is concerned. return TRUE; @@ -1589,6 +1345,7 @@ LLViewerWindow::LLViewerWindow( mWindowRectRaw(0, height, width, 0), mWindowRectScaled(0, height, width, 0), mLeftMouseDown(FALSE), + mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), mToolTip(NULL), mToolTipBlocked(FALSE), @@ -3429,7 +3186,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); @@ -3532,7 +3289,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, if ( (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) { - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == object->getRootEdit()) ) moveable_object_selected = this_object_movable = FALSE; } diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 036d23bb6..4624245ba 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -50,6 +50,7 @@ #include "llstat.h" #include "llmousehandler.h" #include "llalertdialog.h" +#include "llmousehandler.h" #include "llnotifications.h" class LLView; @@ -159,6 +160,7 @@ public: /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask); /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended + /*virtual*/ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleCloseRequest(LLWindow *window); @@ -236,6 +238,7 @@ public: LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; } BOOL getLeftMouseDown() const { return mLeftMouseDown; } + BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } const LLPickInfo& getLastPick() const { return mLastPick; } @@ -414,6 +417,7 @@ protected: LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame LLStat mMouseVelocityStat; BOOL mLeftMouseDown; + BOOL mMiddleMouseDown; BOOL mRightMouseDown; LLProgressView *mProgressView; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 327f79fd8..514030756 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -43,9 +43,9 @@ #include "cofmgr.h" #include "llagent.h" // Get state values from here +#include "llagentcamera.h" #include "llagentwearables.h" #include "llanimationstates.h" -#include "llagentcamera.h" #include "llviewercontrol.h" #include "lldrawpoolavatar.h" #include "lldriverparam.h" @@ -68,16 +68,15 @@ #include "llmeshrepository.h" #endif //MESH_ENABLED #include "llmutelist.h" -#include "llnotify.h" +#include "llnotificationsutil.h" #include "llquantize.h" +#include "llrand.h" #include "llregionhandle.h" #include "llresmgr.h" #include "llselectmgr.h" #include "llsprite.h" #include "lltargetingmotion.h" #include "lltexlayer.h" -#include "lltoolgrab.h" // for needsRenderBeam -#include "lltoolmgr.h" // for needsRenderBeam #include "lltoolmorph.h" #include "llviewercamera.h" #include "llviewergenericmessage.h" //for Auto Deruth @@ -88,6 +87,7 @@ #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewerstats.h" +#include "llvoavatarself.h" #include "llvovolume.h" #include "llworld.h" #include "pipeline.h" @@ -120,19 +120,11 @@ // disable boost::lexical_cast warning #pragma warning (disable:4702) #endif + #include using namespace LLVOAvatarDefines; -// for macs -#if LL_DARWIN -size_t strnlen(const char *s, size_t n) -{ - const char *p = (const char *)memchr(s, 0, n); - return(p ? p-s : n); -} -#endif - //----------------------------------------------------------------------------- // Global constants //----------------------------------------------------------------------------- @@ -215,6 +207,9 @@ const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); const F32 DERUTHING_TIMEOUT_SECONDS = 30.f; +//Singu note: FADE and ALWAYS are swapped around from LL's source to match our preference panel. +// Changing the "RenderName" order would cause confusion when 'always' setting suddenly gets +// interpreted as 'fade', and vice versa. enum ERenderName { RENDER_NAME_NEVER, @@ -624,20 +619,15 @@ private: //----------------------------------------------------------------------------- LLXmlTree LLVOAvatar::sXMLTree; LLXmlTree LLVOAvatar::sSkeletonXMLTree; -BOOL LLVOAvatar::sDebugAvatarRotation = FALSE; LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; U32 LLVOAvatar::sMaxVisible = 50; -LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames; -LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime; -S32 LLVOAvatar::sScratchTexBytes = 0; + F32 LLVOAvatar::sRenderDistance = 256.f; S32 LLVOAvatar::sNumVisibleAvatars = 0; S32 LLVOAvatar::sNumLODChangesThisFrame = 0; -LLSD LLVOAvatar::sClientResolutionList; - const LLUUID LLVOAvatar::sStepSoundOnLand("e8af4a28-aa83-4310-a7c4-c047e15ea0df"); @@ -665,11 +655,21 @@ F32 LLVOAvatar::sPhysicsLODFactor = 1.f; BOOL LLVOAvatar::sUseImpostors = FALSE; BOOL LLVOAvatar::sJointDebug = FALSE; -EmeraldGlobalBoobConfig LLVOAvatar::sBoobConfig; + F32 LLVOAvatar::sUnbakedTime = 0.f; F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; F32 LLVOAvatar::sGreyTime = 0.f; F32 LLVOAvatar::sGreyUpdateTime = 0.f; + +//Move to LLVOAvatarSelf +BOOL LLVOAvatar::sDebugAvatarRotation = FALSE; +LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames; +LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime; +S32 LLVOAvatar::sScratchTexBytes = 0; + +//Custom stuff. +LLSD LLVOAvatar::sClientResolutionList; +EmeraldGlobalBoobConfig LLVOAvatar::sBoobConfig; bool LLVOAvatar::sDoProperArc = true; //----------------------------------------------------------------------------- @@ -774,7 +774,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mBakedTextureDatas[i].mIsLoaded = false; mBakedTextureDatas[i].mIsUsed = false; mBakedTextureDatas[i].mMaskTexName = 0; - mBakedTextureDatas[i].mTextureIndex = getTextureIndex((EBakedTextureIndex)i); + mBakedTextureDatas[i].mTextureIndex = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); } mDirtyMesh = 2; // Dirty geometry, need to regenerate. @@ -787,7 +787,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNumJoints = 0; mSkeleton = NULL; - mScreenp = NULL; mNumCollisionVolumes = 0; mCollisionVolumes = NULL; @@ -796,18 +795,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mSpeed = 0.f; setAnimationData("Speed", &mSpeed); - if (id == gAgentID) - { - mIsSelf = TRUE; - gAgent.setAvatarObject(this); - gAgentWearables.setAvatarObject(this); - lldebugs << "Marking avatar as self " << id << llendl; - } - else - { - mIsSelf = FALSE; - } - mNeedsImpostorUpdate = TRUE; mNeedsAnimUpdate = TRUE; @@ -842,6 +829,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mOohMorph = NULL; mAahMorph = NULL; + mCurrentGesticulationLevel = 0; + mRuthTimer.reset(); #if MESH_ENABLED @@ -850,173 +839,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mPelvisFixup = 0.0f; mLastPelvisFixup = 0.0f; #endif //MESH_ENABLED - //------------------------------------------------------------------------- - // initialize joint, mesh and shape members - //------------------------------------------------------------------------- - mRoot.setName( "mRoot" ); - - for (LLVOAvatarDictionary::mesh_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - iter++) - { - const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second; - - LLViewerJoint* joint = new LLViewerJoint(); - joint->setName(mesh_dict->mName); - joint->setMeshID(mesh_index); - mMeshLOD.push_back(joint); - - /* mHairLOD.setName("mHairLOD"); - mHairMesh0.setName("mHairMesh0"); - mHairMesh0.setMeshID(MESH_ID_HAIR); - mHairMesh1.setName("mHairMesh1"); */ - for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) - { - LLViewerJointMesh* mesh = new LLViewerJointMesh(); - std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast(lod); - // We pre-pended an m - need to capitalize first character for camelCase - mesh_name[1] = toupper(mesh_name[1]); - mesh->setName(mesh_name); - mesh->setMeshID(mesh_index); - mesh->setPickName(mesh_dict->mPickName); - switch((int)mesh_index) - { - case MESH_ID_HAIR: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_SKIRT: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_EYEBALL_LEFT: - case MESH_ID_EYEBALL_RIGHT: - mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); - break; - } - - joint->mMeshParts.push_back(mesh); - } - } - - //------------------------------------------------------------------------- - // associate baked textures with meshes - //------------------------------------------------------------------------- - for (LLVOAvatarDictionary::mesh_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - iter++) - { - const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second; - const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; - - // Skip it if there's no associated baked texture. - if (baked_texture_index == BAKED_NUM_INDICES) continue; - - for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); - iter != mMeshLOD[mesh_index]->mMeshParts.end(); iter++) - { - LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; - mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh); - } - } - - - //------------------------------------------------------------------------- - // register motions - //------------------------------------------------------------------------- - if (LLCharacter::sInstances.size() == 1) - { - LLKeyframeMotion::setVFS(gStaticVFS); - registerMotion( ANIM_AGENT_BUSY, LLNullMotion::create ); - registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create ); - registerMotion( ANIM_AGENT_FEMALE_RUN_NEW, LLKeyframeWalkMotion::create ); //v2 - registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_FEMALE_WALK_NEW, LLKeyframeWalkMotion::create ); //v2 - registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_RUN_NEW, LLKeyframeWalkMotion::create ); //v2 - registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create ); - registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create ); //v2 - - // motions without a start/stop bit - registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); - registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); - registerMotion( ANIM_AGENT_PHYSICS_MOTION, LLPhysicsMotionController::create ); - registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create ); - registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create ); - registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create ); - registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create ); - registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create ); - registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create ); - registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); - registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); - registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); - - } - - // grab the boob savedparams (prob a better place for this) - sBoobConfig.mass = EmeraldBoobUtils::convertMass(gSavedSettings.getF32("EmeraldBoobMass")); - sBoobConfig.hardness = EmeraldBoobUtils::convertHardness(gSavedSettings.getF32("EmeraldBoobHardness")); - sBoobConfig.velMax = EmeraldBoobUtils::convertVelMax(gSavedSettings.getF32("EmeraldBoobVelMax")); - sBoobConfig.velMin = EmeraldBoobUtils::convertVelMin(gSavedSettings.getF32("EmeraldBoobVelMin")); - sBoobConfig.friction = EmeraldBoobUtils::convertFriction(gSavedSettings.getF32("EmeraldBoobFriction")); - sBoobConfig.enabled = gSavedSettings.getBOOL("EmeraldBreastPhysicsToggle"); - sBoobConfig.XYInfluence = gSavedSettings.getF32("EmeraldBoobXYInfluence"); - sDoProperArc = (bool)gSavedSettings.getBOOL("EmeraldUseProperArc"); - - if (gNoRender) - { - return; - } - buildCharacter(); - - // preload specific motions here - createMotion( ANIM_AGENT_CUSTOMIZE); - createMotion( ANIM_AGENT_CUSTOMIZE_DONE); - - //VTPause(); // VTune - - mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) ); - mCurrentGesticulationLevel = 0; } - - - - - - - - - - //------------------------------------------------------------------------ // LLVOAvatar::~LLVOAvatar() //------------------------------------------------------------------------ @@ -1024,40 +848,25 @@ LLVOAvatar::~LLVOAvatar() { lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; - if (isSelf()) - { - gAgent.setAvatarObject(NULL); - } - mRoot.removeAllChildren(); - delete [] mSkeleton; - mSkeleton = NULL; - - delete mScreenp; - mScreenp = NULL; - - delete [] mCollisionVolumes; - mCollisionVolumes = NULL; - + deleteAndClearArray(mSkeleton); + deleteAndClearArray(mCollisionVolumes); mNumJoints = 0; for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - delete mBakedTextureDatas[i].mTexLayerSet; - mBakedTextureDatas[i].mTexLayerSet = NULL; + deleteAndClear(mBakedTextureDatas[i].mTexLayerSet); + mBakedTextureDatas[i].mMeshes.clear(); } std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); - delete mTexSkinColor; - mTexSkinColor = NULL; - delete mTexHairColor; - mTexHairColor = NULL; - delete mTexEyeColor; - mTexEyeColor = NULL; + deleteAndClear(mTexSkinColor); + deleteAndClear(mTexHairColor); + deleteAndClear(mTexEyeColor); std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); mMeshes.clear(); @@ -1092,8 +901,6 @@ void LLVOAvatar::markDead() sNumVisibleChatBubbles--; } mVoiceVisualizer->markDead(); - - mBeam = NULL; LLViewerObject::markDead(); } @@ -1106,7 +913,7 @@ BOOL LLVOAvatar::isFullyBaked() for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex) - && ( (i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ) ) + && ( (i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ) ) { return FALSE; } @@ -1269,11 +1076,11 @@ void LLVOAvatar::dumpBakedStatus() { llcont << " Unbaked ("; - for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); ++iter) { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second; + const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second; const ETextureIndex index = baked_dict->mTextureIndex; if (!inst->isTextureDefined(index)) { @@ -1474,14 +1281,20 @@ void LLVOAvatar::initClass() // Process XML data // avatar_skeleton.xml - llassert(!sAvatarSkeletonInfo); + if (sAvatarSkeletonInfo) + { //this can happen if a login attempt failed + delete sAvatarSkeletonInfo; + } sAvatarSkeletonInfo = new LLVOAvatarSkeletonInfo; if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot())) { llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; } // parse avatar_lad.xml - llassert(!sAvatarXmlInfo); + if (sAvatarXmlInfo) + { //this can happen if a login attempt failed + deleteAndClear(sAvatarXmlInfo); + } sAvatarXmlInfo = new LLVOAvatarXmlInfo; if (!sAvatarXmlInfo->parseXmlSkeletonNode(root)) { @@ -1523,14 +1336,170 @@ void LLVOAvatar::initClass() void LLVOAvatar::cleanupClass() { - delete sAvatarXmlInfo; - sAvatarXmlInfo = NULL; - delete sAvatarSkeletonInfo; - sAvatarSkeletonInfo = NULL; + deleteAndClear(sAvatarXmlInfo); + deleteAndClear(sAvatarSkeletonInfo); sSkeletonXMLTree.cleanup(); sXMLTree.cleanup(); } +void LLVOAvatar::initInstance(void) +{ + //------------------------------------------------------------------------- + // initialize joint, mesh and shape members + //------------------------------------------------------------------------- + mRoot.setName( "mRoot" ); + + for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); + iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + iter++) + { + const EMeshIndex mesh_index = iter->first; + const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + + LLViewerJoint* joint = new LLViewerJoint(); + joint->setName(mesh_dict->mName); + joint->setMeshID(mesh_index); + mMeshLOD.push_back(joint); + + /* mHairLOD.setName("mHairLOD"); + mHairMesh0.setName("mHairMesh0"); + mHairMesh0.setMeshID(MESH_ID_HAIR); + mHairMesh1.setName("mHairMesh1"); */ + for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) + { + LLViewerJointMesh* mesh = new LLViewerJointMesh(); + std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast(lod); + // We pre-pended an m - need to capitalize first character for camelCase + mesh_name[1] = toupper(mesh_name[1]); + mesh->setName(mesh_name); + mesh->setMeshID(mesh_index); + mesh->setPickName(mesh_dict->mPickName); + switch((int)mesh_index) + { + case MESH_ID_HAIR: + mesh->setIsTransparent(TRUE); + break; + case MESH_ID_SKIRT: + mesh->setIsTransparent(TRUE); + break; + case MESH_ID_EYEBALL_LEFT: + case MESH_ID_EYEBALL_RIGHT: + mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); + break; + } + + joint->mMeshParts.push_back(mesh); + } + } + + //------------------------------------------------------------------------- + // associate baked textures with meshes + //------------------------------------------------------------------------- + for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); + iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + iter++) + { + const EMeshIndex mesh_index = iter->first; + const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; + + // Skip it if there's no associated baked texture. + if (baked_texture_index == BAKED_NUM_INDICES) continue; + + for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); + iter != mMeshLOD[mesh_index]->mMeshParts.end(); iter++) + { + LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; + mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh); + } + } + + + //------------------------------------------------------------------------- + // register motions + //------------------------------------------------------------------------- + if (LLCharacter::sInstances.size() == 1) + { + LLKeyframeMotion::setVFS(gStaticVFS); + registerMotion( ANIM_AGENT_BUSY, LLNullMotion::create ); + registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create ); + registerMotion( ANIM_AGENT_FEMALE_RUN_NEW, LLKeyframeWalkMotion::create ); //v2 + registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_FEMALE_WALK_NEW, LLKeyframeWalkMotion::create ); //v2 + registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_RUN_NEW, LLKeyframeWalkMotion::create ); //v2 + registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create ); + registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create ); //v2 + + // motions without a start/stop bit + registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); + registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); + registerMotion( ANIM_AGENT_PHYSICS_MOTION, LLPhysicsMotionController::create ); + registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create ); + registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create ); + registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create ); + registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create ); + registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create ); + registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create ); + registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); + registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); + registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); + + } + + // grab the boob savedparams (prob a better place for this) + sBoobConfig.mass = EmeraldBoobUtils::convertMass(gSavedSettings.getF32("EmeraldBoobMass")); + sBoobConfig.hardness = EmeraldBoobUtils::convertHardness(gSavedSettings.getF32("EmeraldBoobHardness")); + sBoobConfig.velMax = EmeraldBoobUtils::convertVelMax(gSavedSettings.getF32("EmeraldBoobVelMax")); + sBoobConfig.velMin = EmeraldBoobUtils::convertVelMin(gSavedSettings.getF32("EmeraldBoobVelMin")); + sBoobConfig.friction = EmeraldBoobUtils::convertFriction(gSavedSettings.getF32("EmeraldBoobFriction")); + sBoobConfig.enabled = gSavedSettings.getBOOL("EmeraldBreastPhysicsToggle"); + sBoobConfig.XYInfluence = gSavedSettings.getF32("EmeraldBoobXYInfluence"); + sDoProperArc = (bool)gSavedSettings.getBOOL("EmeraldUseProperArc"); + + if (gNoRender) + { + return; + } + buildCharacter(); + + // preload specific motions here + createMotion( ANIM_AGENT_CUSTOMIZE); + createMotion( ANIM_AGENT_CUSTOMIZE_DONE); + + //VTPause(); // VTune + + mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) ); +} + const LLVector3 LLVOAvatar::getRenderPosition() const { if (mDrawable.isNull() || mDrawable->getGeneration() < 0) @@ -1636,6 +1605,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) { continue ; } + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) @@ -1858,9 +1828,9 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) //------------------------------------------------------------------------- // parse the file //------------------------------------------------------------------------- - BOOL success = sSkeletonXMLTree.parseFile( filename, FALSE ); + BOOL parsesuccess = sSkeletonXMLTree.parseFile( filename, FALSE ); - if (!success) + if (!parsesuccess) { llerrs << "Can't parse skeleton file: " << filename << llendl; return FALSE; @@ -1868,14 +1838,16 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) // now sanity check xml file LLXmlTreeNode* root = sSkeletonXMLTree.getRoot(); - if (!root) + if (!root) { llerrs << "No root node found in avatar skeleton file: " << filename << llendl; + return FALSE; } if( !root->hasName( "linden_skeleton" ) ) { llerrs << "Invalid avatar skeleton file header: " << filename << llendl; + return FALSE; } std::string version; @@ -1883,6 +1855,7 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << llendl; + return FALSE; } return TRUE; @@ -1915,7 +1888,6 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent return FALSE; } joint = (LLViewerJoint*)(&mCollisionVolumes[volume_num]); - joint->setName( info->mName ); } @@ -1926,13 +1898,12 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent } joint->setPosition(info->mPos); - joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY], info->mRot.mV[VZ], LLQuaternion::XYZ)); - joint->setScale(info->mScale); - + joint->setDefaultFromCurrentXform(); + if (info->mIsJoint) { joint->setSkinOffset( info->mPivot ); @@ -2001,22 +1972,14 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) } } - // add special-purpose "screen" joint - if (isSelf()) - { - mScreenp = new LLViewerJoint("mScreen", NULL); - // for now, put screen at origin, as it is only used during special - // HUD rendering mode - F32 aspect = LLViewerCamera::getInstance()->getAspect(); - LLVector3 scale(1.f, aspect, 1.f); - mScreenp->setScale(scale); - mScreenp->setWorldPosition(LLVector3::zero); - mScreenp->mUpdateXform = TRUE; - } - return TRUE; } +LLVOAvatar* LLVOAvatar::asAvatar() +{ + return this; +} + //----------------------------------------------------------------------------- // LLVOAvatar::startDefaultMotions() //----------------------------------------------------------------------------- @@ -2192,223 +2155,6 @@ void LLVOAvatar::buildCharacter() mIsBuilt = TRUE; stop_glerror(); - //------------------------------------------------------------------------- - // build the attach and detach menus - //------------------------------------------------------------------------- - if (isSelf()) - { - // *TODO: Translate - gAttachBodyPartPieMenus[0] = NULL; - gAttachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); - gAttachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); - gAttachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); - gAttachBodyPartPieMenus[4] = NULL; - gAttachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); - gAttachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); - gAttachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); - - gDetachBodyPartPieMenus[0] = NULL; - gDetachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); - gDetachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); - gDetachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); - gDetachBodyPartPieMenus[4] = NULL; - gDetachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); - gDetachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); - gDetachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); - - for (S32 i = 0; i < 8; i++) - { - if (gAttachBodyPartPieMenus[i]) - { - gAttachPieMenu->appendPieMenu( gAttachBodyPartPieMenus[i] ); - } - else - { - BOOL attachment_found = FALSE; - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getGroup() == i) - { - LLMenuItemCallGL* item; -// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) - // We need the userdata param to disable options in this pie menu later on (Left Hand / Right Hand option) - item = new LLMenuItemCallGL(attachment->getName(), - NULL, - object_selected_and_point_valid, attachment); -// [/RLVa:KB] -// item = new LLMenuItemCallGL(attachment->getName(), -// NULL, -// object_selected_and_point_valid); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); - - gAttachPieMenu->append(item); - - attachment_found = TRUE; - break; - - } - } - - - - - - - - if (!attachment_found) - { - gAttachPieMenu->appendSeparator(); - } - } - - if (gDetachBodyPartPieMenus[i]) - { - gDetachPieMenu->appendPieMenu( gDetachBodyPartPieMenus[i] ); - } - else - { - BOOL attachment_found = FALSE; - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getGroup() == i) - { - gDetachPieMenu->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, object_attached, attachment)); - - attachment_found = TRUE; - break; - } - } - - if (!attachment_found) - { - gDetachPieMenu->appendSeparator(); - } - } - } - - // add screen attachments - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getGroup() == 8) - { - LLMenuItemCallGL* item; -// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) - // We need the userdata param to disable options in this pie menu later on - item = new LLMenuItemCallGL(attachment->getName(), - NULL, - object_selected_and_point_valid, attachment); -// [/RLVa:KB] -// item = new LLMenuItemCallGL(attachment->getName(), -// NULL, -// object_selected_and_point_valid); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); - gAttachScreenPieMenu->append(item); - gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, object_attached, attachment)); - } - } - - - - for (S32 pass = 0; pass < 2; pass++) - { - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getIsHUDAttachment() != (pass == 1)) - { - continue; - } - // RELEASE-RLVa: random comment because we want know if LL ever changes this to not include "attachment" as userdata - LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), - NULL, &object_selected_and_point_valid, - &attach_label, attachment); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); - gAttachSubMenu->append(item); - - gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, object_attached, &detach_label, attachment)); - - } - if (pass == 0) - { - // put separator between non-hud and hud attachments - gAttachSubMenu->appendSeparator(); - gDetachSubMenu->appendSeparator(); - } - } - - for (S32 group = 0; group < 8; group++) - { - // skip over groups that don't have sub menus - if (!gAttachBodyPartPieMenus[group] || !gDetachBodyPartPieMenus[group]) - { - continue; - } - - std::multimap attachment_pie_menu_map; - - // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if(attachment->getGroup() == group) - { - // use multimap to provide a partial order off of the pie slice key - S32 pie_index = attachment->getPieSlice(); - attachment_pie_menu_map.insert(std::make_pair(pie_index, curiter->first)); - } - } - - // add in requested order to pie menu, inserting separators as necessary - S32 cur_pie_slice = 0; - for (std::multimap::iterator attach_it = attachment_pie_menu_map.begin(); - attach_it != attachment_pie_menu_map.end(); ++attach_it) - { - S32 requested_pie_slice = attach_it->first; - S32 attach_index = attach_it->second; - while (cur_pie_slice < requested_pie_slice) - { - gAttachBodyPartPieMenus[group]->appendSeparator(); - gDetachBodyPartPieMenus[group]->appendSeparator(); - cur_pie_slice++; - } - - LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); - if (attachment) - { -// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) - // We need the userdata param to disable options in this pie menu later on - LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), - NULL, object_selected_and_point_valid, attachment); -// [/RLVa:KB] -// LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), -// NULL, object_selected_and_point_valid); - gAttachBodyPartPieMenus[group]->append(item); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index); - gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, - object_attached, attachment)); - cur_pie_slice++; - } - } - } - } - mMeshValid = TRUE; } @@ -2464,29 +2210,24 @@ void LLVOAvatar::releaseMeshData() //----------------------------------------------------------------------------- // restoreMeshData() //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::restoreMeshData() { + llassert(!isSelf()); LLMemType mt(LLMemType::MTYPE_AVATAR); //llinfos << "Restoring" << llendl; mMeshValid = TRUE; updateJointLODs(); - if (isSelf()) + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { - updateAttachmentVisibility(gAgentCamera.getCameraMode()); - } - else - { - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) + LLViewerJointAttachment* attachment = iter->second; + if (!attachment->getIsHUDAttachment()) { - LLViewerJointAttachment* attachment = iter->second; - if (!attachment->getIsHUDAttachment()) - { attachment->setAttachmentVisibility(TRUE); - } } } @@ -2697,7 +2438,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()); @@ -2840,16 +2581,6 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) return TRUE; } - //Emerald performs some force-bakes stuff here. Added it in because we noticed slow responses with client tag ident. -HgB - if(isSelf()) - { - for(U8 i=0;iforceActive(); - } - } - idleUpdateVoiceVisualizer( voice_enabled ); idleUpdateMisc( detailed_update ); idleUpdateAppearanceAnimation(); @@ -2861,9 +2592,9 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) idleUpdateBelowWater(); // wind effect uses this idleUpdateWindEffect(); } + idleUpdateNameTag( root_pos_last ); idleUpdateRenderCost(); - idleUpdateTractorBeam(); return TRUE; } @@ -2871,7 +2602,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) BOOL LLVOAvatar::detachAttachmentIntoInventory(const LLUUID &item_id) { LLInventoryItem* item = gInventory.getLinkedItem(item_id); - if ( (item) && (gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->isWearingAttachment(item->getUUID())) ) + if ( (item) && (gAgentAvatarp) && (!gAgentAvatarp->isWearingAttachment(item->getUUID())) ) { LLCOFMgr::instance().removeAttachment(item->getUUID()); return FALSE; @@ -2901,8 +2632,19 @@ BOOL LLVOAvatar::detachAttachmentIntoInventory(const LLUUID &item_id) void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { - // disable voice visualizer when in mouselook - mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(isSelf() && gAgentCamera.cameraMouselook()) ); + bool render_visualizer = voice_enabled; + + // Don't render the user's own voice visualizer when in mouselook + if(isSelf()) + { + if(gAgentCamera.cameraMouselook()/* || gSavedSettings.getBOOL("VoiceDisableMic")*/) + { + render_visualizer = false; + } + } + + mVoiceVisualizer->setVoiceEnabled(render_visualizer); + if ( voice_enabled ) { //---------------------------------------------------------------- @@ -3152,39 +2894,25 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() } else { - F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME); - F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME); - F32 morph_amt; - // if it's over 5 seconds, just forget the bouncy anim - if(APPEARANCE_MORPH_TIME > 5.f) - { - blend_frac = appearance_anim_time / APPEARANCE_MORPH_TIME; - last_blend_frac = mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME; - } - if (last_blend_frac == 1.f) - { - morph_amt = 1.f; - } - else - { - morph_amt = (blend_frac - last_blend_frac) / (1.f - last_blend_frac); - } - + + F32 morph_amt = calcMorphAmount(); LLVisualParam *param; - // animate only top level params - for (param = getFirstVisualParam(); - param; - param = getNextVisualParam()) + if (!isSelf()) { - if (param->isTweakable()) + + // animate only top level params + for (param = getFirstVisualParam(); + param; + param = getNextVisualParam()) { - param->animate(morph_amt, mAppearanceAnimSetByUser); + if (param->isTweakable()) + { + param->animate(morph_amt, mAppearanceAnimSetByUser); + } } } - - // apply all params for (param = getFirstVisualParam(); param; @@ -3199,6 +2927,25 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() } } +F32 LLVOAvatar::calcMorphAmount() +{ + F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32(); + F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME); + F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME); + + F32 morph_amt; + if (last_blend_frac == 1.f) + { + morph_amt = 1.f; + } + else + { + morph_amt = (blend_frac - last_blend_frac) / (1.f - last_blend_frac); + } + + return morph_amt; +} + // ------------------------------------------------------------ // Danny: ZOMG Boob Phsyics go! // ------------------------------------------------------------ @@ -3748,7 +3495,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } } else if (sRenderGroupTitles != mRenderGroupTitles) -// [/RLVa] +// [/RLVa:KB] // if (sRenderGroupTitles != mRenderGroupTitles) { mRenderGroupTitles = sRenderGroupTitles; @@ -3964,7 +3711,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } //idle text std::string idle_string; - if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120.f && gSavedSettings.getBOOL("AscentShowIdleTime")) + if(!isSelf() && mIdleTimer.getElapsedTimeF32() > 120.f && gSavedSettings.getBOOL("AscentShowIdleTime")) { idle_string = getIdleTime(); } @@ -4234,8 +3981,6 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } } -/* Phoenix: Wolfspirit: This allows us to replace one specific nametag of a user */ - void LLVOAvatar::clearNameTag() { mNameString.clear(); @@ -4272,97 +4017,6 @@ void LLVOAvatar::invalidateNameTags() } } - -void LLVOAvatar::idleUpdateTractorBeam() -{ - //-------------------------------------------------------------------- - // draw tractor beam when editing objects - //-------------------------------------------------------------------- - if (!isSelf()) - { - return; - } - - if(gSavedSettings.getBOOL("DisablePointAtAndBeam")) - { - return; - } - // - - const LLPickInfo& pick = gViewerWindow->getLastPick(); - - // No beam for media textures - // TODO: this will change for Media on a Prim - if(pick.getObject() && pick.mObjectFace >= 0) - { - const LLTextureEntry* tep = pick.getObject()->getTE(pick.mObjectFace); - if (tep && LLViewerMedia::textureHasMedia(tep->getID())) - { - return; - } - } - - // This is only done for yourself (maybe it should be in the agent?) - if (!needsRenderBeam() || !mIsBuilt) - { - mBeam = NULL; - } - else if (!mBeam || mBeam->isDead()) - { - // VEFFECT: Tractor Beam - mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); - mBeam->setColor(LLColor4U(gAgent.getEffectColor())); - mBeam->setSourceObject(this); - mBeamTimer.reset(); - } - - if (!mBeam.isNull()) - { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - - if (gAgentCamera.mPointAt.notNull()) - { - // get point from pointat effect - mBeam->setPositionGlobal(gAgentCamera.mPointAt->getPointAtPosGlobal()); - mBeam->triggerLocal(); - } - else if (selection->getFirstRootObject() && - selection->getSelectType() != SELECT_TYPE_HUD) - { - LLViewerObject* objectp = selection->getFirstRootObject(); - mBeam->setTargetObject(objectp); - } - else - { - mBeam->setTargetObject(NULL); - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - if (tool->isEditing()) - { - if (tool->getEditingObject()) - { - mBeam->setTargetObject(tool->getEditingObject()); - } - else - { - mBeam->setPositionGlobal(tool->getEditingPointGlobal()); - } - } - else - { - - mBeam->setPositionGlobal(pick.mPosGlobal); - } - - } - if (mBeamTimer.getElapsedTimeF32() > 0.25f) - { - mBeam->setColor(LLColor4U(gAgent.getEffectColor())); - mBeam->setNeedsSendToSim(TRUE); - mBeamTimer.reset(); - } - } -} - void LLVOAvatar::idleUpdateBelowWater() { F32 avatar_height = (F32)(getPositionGlobal().mdV[VZ]); @@ -4392,16 +4046,6 @@ void LLVOAvatar::slamPosition() BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { LLMemType mt(LLMemType::MTYPE_AVATAR); - // update screen joint size - - if (mScreenp) - { - F32 aspect = LLViewerCamera::getInstance()->getAspect(); - LLVector3 scale(1.f, aspect, 1.f); - mScreenp->setScale(scale); - mScreenp->updateWorldMatrixChildren(); - resetHUDAttachments(); - } // clear debug text mDebugText.clear(); @@ -5105,28 +4749,6 @@ bool LLVOAvatar::shouldAlphaMask() } - -//------------------------------------------------------------------------ -// needsRenderBeam() -//------------------------------------------------------------------------ -BOOL LLVOAvatar::needsRenderBeam() -{ - if (gNoRender) - { - return FALSE; - } - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); - if (LLToolGrab::getInstance()->getEditingObject() && - LLToolGrab::getInstance()->getEditingObject()->isAttachment()) - { - // don't render selection beam on hud objects - is_touching_or_grabbing = FALSE; - } - return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); -} - //----------------------------------------------------------------------------- // renderSkinned() //----------------------------------------------------------------------------- @@ -5162,7 +4784,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry(); mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry(); - if( isWearingWearableType( WT_SKIRT ) ) + if( isWearingWearableType( LLWearableType::WT_SKIRT ) ) { mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry(); } @@ -5328,7 +4950,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) U32 LLVOAvatar::renderTransparent(BOOL first_pass) { U32 num_indices = 0; - if( isWearingWearableType( WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) ) + if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) ) { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE); @@ -5589,7 +5211,7 @@ void LLVOAvatar::updateTextures() /* switch(index) case TEX_HEAD_BODYPAINT: addLocalTextureStats( LOCTEX_HEAD_BODYPAINT, imagep, texel_area_ratio, render_avatar, head_baked ); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)index); + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)index); if (texture_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; @@ -5700,7 +5322,6 @@ void LLVOAvatar::resolveRayCollisionAgent(const LLVector3d start_pt, const LLVec LLWorld::getInstance()->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj); } - void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm) { LLVector3d zVec(0.0f, 0.0f, 0.5f); @@ -5861,6 +5482,7 @@ void LLVOAvatar::processAnimationStateChanges() stop_glerror(); } + //----------------------------------------------------------------------------- // processSingleAnimationStateChange(); //----------------------------------------------------------------------------- @@ -5894,12 +5516,9 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL } } } - - - else if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - mIsSitting = TRUE; + sitDown(TRUE); } @@ -5916,7 +5535,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL { if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - mIsSitting = FALSE; + sitDown(FALSE); } stopMotion(anim_id); result = TRUE; @@ -6061,23 +5680,6 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) //----------------------------------------------------------------------------- void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) { - if (!isSelf()) - { - return; - } - AnimSourceIterator motion_it; - - for(motion_it = mAnimationSources.find(source_id); motion_it != mAnimationSources.end();) - { - gAgent.sendAnimationRequest( motion_it->second, ANIM_REQUEST_STOP ); - mAnimationSources.erase(motion_it++); - } - - LLViewerObject* object = gObjectList.findObject(source_id); - if (object) - { - object->mFlags &= ~FLAGS_ANIM_SOURCE; - } } //----------------------------------------------------------------------------- @@ -6098,11 +5700,6 @@ LLVector3 LLVOAvatar::getVolumePos(S32 joint_index, LLVector3& volume_offset) return mCollisionVolumes[joint_index].getVolumePos(volume_offset); } - - - - - //----------------------------------------------------------------------------- // findCollisionVolume() //----------------------------------------------------------------------------- @@ -6158,15 +5755,7 @@ const LLUUID& LLVOAvatar::getID() // RN: avatar joints are multi-rooted to include screen-based attachments LLJoint *LLVOAvatar::getJoint( const std::string &name ) { - LLJoint* jointp = NULL; - if (mScreenp) - { - jointp = mScreenp->findJoint(name); - } - if (!jointp) - { - jointp = mRoot.findJoint(name); - } + LLJoint* jointp = mRoot.findJoint(name); return jointp; } #if MESH_ENABLED @@ -6372,8 +5961,7 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) //----------------------------------------------------------------------------- BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) { - delete [] mSkeleton; - mSkeleton = NULL; + deleteAndClearArray(mSkeleton); mNumJoints = 0; mSkeleton = new LLViewerJoint[num]; @@ -6397,8 +5985,7 @@ BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) //----------------------------------------------------------------------------- BOOL LLVOAvatar::allocateCollisionVolumes( U32 num ) { - delete [] mCollisionVolumes; - mCollisionVolumes = NULL; + deleteAndClearArray(mCollisionVolumes); mNumCollisionVolumes = 0; mCollisionVolumes = new LLViewerJointCollisionVolume[num]; @@ -6430,12 +6017,6 @@ LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) //----------------------------------------------------------------------------- void LLVOAvatar::requestStopMotion( LLMotion* motion ) { - // Only agent avatars should handle the stop motion notifications. - if ( isSelf() ) - { - // Notify agent that motion has stopped - gAgent.requestStopMotion( motion ); - } } //----------------------------------------------------------------------------- @@ -6532,11 +6113,11 @@ BOOL LLVOAvatar::loadAvatar() return FALSE; } bool found_baked_entry = false; - for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); baked_iter++) { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; if (layer_set->isBodyRegion(baked_dict->mName)) { mBakedTextureDatas[baked_iter->first].mTexLayerSet = layer_set; @@ -6735,12 +6316,12 @@ BOOL LLVOAvatar::loadMeshNodes() switch(lod) case 0: mesh = &mHairMesh0; */ - for (LLVOAvatarDictionary::mesh_map_t::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); + for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); mesh_iter++) { const EMeshIndex mesh_index = mesh_iter->first; - const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = mesh_iter->second; + const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second; if (type.compare(mesh_dict->mName) == 0) { mesh_id = mesh_index; @@ -7124,12 +6705,11 @@ void LLVOAvatar::updateShadowFaces() //----------------------------------------------------------------------------- // updateSexDependentLayerSets() //----------------------------------------------------------------------------- -void LLVOAvatar::updateSexDependentLayerSets( BOOL set_by_user ) +void LLVOAvatar::updateSexDependentLayerSets( BOOL upload_bake ) { - invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user ); - updateMeshTextures(); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, upload_bake ); } //----------------------------------------------------------------------------- @@ -7177,7 +6757,7 @@ void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index ) case LOCTEX_UPPER_SHIRT: if( mUpperBodyLayerSet ) mUpperBodyLayerSet->requestUpdate(); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) return; const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; @@ -7587,34 +7167,24 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) return FALSE; } +//----------------------------------------------------------------------------- +// sitDown() +//----------------------------------------------------------------------------- +void LLVOAvatar::sitDown(BOOL bSitting) +{ + mIsSitting = bSitting; + if (isSelf()) + { + LLFloaterAO::ChangeStand(); + } +} + //----------------------------------------------------------------------------- // sitOnObject() //----------------------------------------------------------------------------- void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) { - if (mDrawable.isNull() || sit_object->mDrawable.isNull()) - { - return; - } - LLQuaternion inv_obj_rot = ~sit_object->getRenderRotation(); - LLVector3 obj_pos = sit_object->getRenderPosition(); - - LLVector3 rel_pos = getRenderPosition() - obj_pos; - rel_pos.rotVec(inv_obj_rot); - - mDrawable->mXform.setPosition(rel_pos); - mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot); - - gPipeline.markMoved(mDrawable, TRUE); - mIsSitting = TRUE; - LLFloaterAO::ChangeStand(); - mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject - mRoot.setPosition(getPosition()); - mRoot.updateWorldMatrixChildren(); - - stopMotion(ANIM_AGENT_BODY_NOISE); - - if (isSelf()) + if (isSelf()) { // [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c if (rlv_handler_t::isEnabled()) @@ -7633,12 +7203,37 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) // make sure we are not trying to autopilot gAgent.stopAutoPilot(); gAgentCamera.setupSitCamera(); - if (gAgentCamera.getForceMouselook()) gAgentCamera.changeCameraToMouselook(); + if (gAgentCamera.getForceMouselook()) + { + gAgentCamera.changeCameraToMouselook(); + } } + + if (mDrawable.isNull() || sit_object->mDrawable.isNull()) + { + return; + } + LLQuaternion inv_obj_rot = ~sit_object->getRenderRotation(); + LLVector3 obj_pos = sit_object->getRenderPosition(); + + LLVector3 rel_pos = getRenderPosition() - obj_pos; + rel_pos.rotVec(inv_obj_rot); + + mDrawable->mXform.setPosition(rel_pos); + mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot); + + gPipeline.markMoved(mDrawable, TRUE); + // Notice that removing sitDown() from here causes avatars sitting on + // objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655. + sitDown(TRUE); + mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject + mRoot.setPosition(getPosition()); + mRoot.updateWorldMatrixChildren(); + + stopMotion(ANIM_AGENT_BODY_NOISE); + } - - //----------------------------------------------------------------------------- // getOffObject() //----------------------------------------------------------------------------- @@ -7677,14 +7272,14 @@ void LLVOAvatar::getOffObject() gPipeline.markMoved(mDrawable, TRUE); - mIsSitting = FALSE; + sitDown(FALSE); + mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject mRoot.setPosition(cur_position_world); mRoot.setRotation(cur_rotation_world); mRoot.getXform()->update(); startMotion(ANIM_AGENT_BODY_NOISE); - LLFloaterAO::ChangeStand(); if (isSelf()) { @@ -7921,7 +7516,7 @@ void LLVOAvatar::updateComposites() for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { if ( mBakedTextureDatas[i].mTexLayerSet - && ((i != BAKED_SKIRT) || isWearingWearableType( WT_SKIRT )) ) + && ((i != BAKED_SKIRT) || isWearingWearableType( LLWearableType::WT_SKIRT )) ) { mBakedTextureDatas[i].mTexLayerSet->updateComposite(); } @@ -7950,7 +7545,7 @@ LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const } -void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user ) +void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) { if( !layerset || !layerset->getUpdatesEnabled() ) { @@ -7992,7 +7587,7 @@ void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user layerset->requestUpdate(); - if( set_by_user ) + if( upload_result ) { llassert( isSelf() ); @@ -8088,7 +7683,7 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**) LLUUID texture_id; msg->getUUID("TextureData", "TextureID", texture_id); - LLVOAvatar* self = gAgent.getAvatarObject(); + LLVOAvatar* self = gAgentAvatarp; if (!self) return; // If this is a texture corresponding to one of our baked entries, @@ -8098,12 +7693,12 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**) /* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] = TEX_HEAD_BAKED, TEX_UPPER_BAKED, */ - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); iter++) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; + const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second; if (text_dict->mIsBakedTexture) { if (texture_id == self->getTEImage(index)->getID()) @@ -8655,12 +8250,12 @@ void LLVOAvatar::updateMeshTextures() /* // Head BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureDatas[BAKED_HEAD].mIsLoaded) || other_culled; setLocalTexture( TEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); */ - for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { const EBakedTextureIndex baked_index = baked_iter->first; - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); @@ -8723,16 +8318,21 @@ void LLVOAvatar::setLocalTexture( ETextureIndex index, LLViewerFetchedTexture* t //----------------------------------------------------------------------------- void LLVOAvatar::requestLayerSetUploads() { + llassert_always(isSelf()); for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); - if ( !layer_baked && mBakedTextureDatas[i].mTexLayerSet ) - { - mBakedTextureDatas[i].mTexLayerSet->requestUpload(); - } + requestLayerSetUpload((EBakedTextureIndex)i); } } +void LLVOAvatar::requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i) +{ + bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); + if ( !layer_baked && mBakedTextureDatas[i].mTexLayerSet ) + { + mBakedTextureDatas[i].mTexLayerSet->requestUpload(); + } +} //----------------------------------------------------------------------------- // setCompositeUpdatesEnabled() @@ -8823,7 +8423,7 @@ BOOL LLVOAvatar::isLocalTextureDataFinal( const LLTexLayerSet* layerset ) { if (layerset == mBakedTextureDatas[i].mTexLayerSet) { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); local_tex_iter++) @@ -8850,7 +8450,7 @@ BOOL LLVOAvatar::isLocalTextureDataAvailable( const LLTexLayerSet* layerset ) { /* if( layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet ) return getLocalDiscardLevel( TEX_HEAD_BODYPAINT ) >= 0; */ - for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); baked_iter++) { @@ -8858,7 +8458,7 @@ BOOL LLVOAvatar::isLocalTextureDataAvailable( const LLTexLayerSet* layerset ) if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) { bool ret = true; - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); local_tex_iter++) @@ -8915,7 +8515,7 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) /* switch(te) case TEX_HEAD_BAKED: llinfos << "New baked texture: HEAD" << llendl; */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(te); + const LLVOAvatarDictionary::TextureEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(te); if (text_dict->mIsBakedTexture) { llinfos << "New baked texture: " << text_dict->mName << " UUID: " << uuid <getBakedTexture((EBakedTextureIndex)baked_index); + const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID if (!isTextureDefined(bakedDicEntry->mTextureIndex) - && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) )) + && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) )) { continue; } @@ -9027,7 +8627,7 @@ void LLVOAvatar::onCustomizeStart() //----------------------------------------------------------------------------- void LLVOAvatar::onCustomizeEnd() { - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatar *avatarp = gAgentAvatarp; if (avatarp) { avatarp->invalidateAll(); @@ -9037,7 +8637,7 @@ void LLVOAvatar::onCustomizeEnd() void LLVOAvatar::onChangeSelfInvisible(BOOL newvalue) { - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatar *avatarp = gAgentAvatarp; if (avatarp) { if (newvalue) @@ -9161,11 +8761,11 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const "TEX_HEAD_BODYPAINT ", "TEX_UPPER_SHIRT ", */ llinfos << (isSelf() ? "Self: " : "Other: ") << context << llendl; - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; + const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second; const LLViewerTexture* te_image = getTEImage(iter->first); if( !te_image ) { @@ -9230,25 +8830,6 @@ void LLVOAvatar::updateAttachmentVisibility(U32 camera_mode) } } -// Given a texture entry, determine which wearable type owns it. -// static -LLUUID LLVOAvatar::getDefaultTEImageID(ETextureIndex index ) -{ - /* switch( index ) - case TEX_UPPER_SHIRT: return LLUUID( gSavedSettings.getString("UIImgDefaultShirtUUID") ); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); - const std::string &default_image_name = text_dict->mDefaultImageName; - if (default_image_name == "") - { - return IMG_DEFAULT_AVATAR; - } - else - { - return LLUUID(gSavedSettings.getString(default_image_name)); - } -} - - void LLVOAvatar::setInvisible(BOOL newvalue) { if (newvalue) @@ -9274,27 +8855,17 @@ LLColor4 LLVOAvatar::getDummyColor() return DUMMY_COLOR; } -// Given a texture entry, determine which wearable type owns it. -// static -EWearableType LLVOAvatar::getTEWearableType(ETextureIndex index ) -{ - /* switch(index) - case TEX_UPPER_SHIRT: - return WT_SHIRT; */ - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mWearableType; -} - // Unlike most wearable functions, this works for both self and other. -BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const +BOOL LLVOAvatar::isWearingWearableType( LLWearableType::EType type ) const { if (mIsDummy) return TRUE; switch( type ) { - case WT_SHAPE: - case WT_SKIN: - case WT_HAIR: - case WT_EYES: + case LLWearableType::WT_SHAPE: + case LLWearableType::WT_SKIN: + case LLWearableType::WT_HAIR: + case LLWearableType::WT_EYES: return TRUE; // everyone has all bodyparts default: break; // Do nothing @@ -9303,12 +8874,12 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const /* switch(type) case WT_SHIRT: indicator_te = TEX_UPPER_SHIRT; */ - for (LLVOAvatarDictionary::texture_map_t::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); ++tex_iter) { const LLVOAvatarDefines::ETextureIndex index = tex_iter->first; - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = tex_iter->second; + const LLVOAvatarDictionary::TextureEntry *text_dict = tex_iter->second; if (text_dict->mWearableType == type) { // If you're checking your own clothing, check the component texture @@ -9330,11 +8901,11 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that // gets baked into a texture that always exists (upper or lower). const std::string name = text_dict->mName; - for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); iter++) { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second; + const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second; if (baked_dict->mName == name) { if (isTextureDefined(baked_dict->mTextureIndex)) @@ -9358,21 +8929,22 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const // forces an update to any baked textures relevant to type. // will force an upload of the resulting bake if the second parameter is TRUE //----------------------------------------------------------------------------- -void LLVOAvatar::wearableUpdated(EWearableType type, BOOL upload_result) +void LLVOAvatar::wearableUpdated(LLWearableType::EType type, BOOL upload_result) { - for (LLVOAvatarDictionary::wearable_map_t::const_iterator wearable_iter = LLVOAvatarDictionary::getInstance()->getWearables().begin(); - wearable_iter != LLVOAvatarDictionary::getInstance()->getWearables().end(); - wearable_iter++) + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + ++baked_iter) { - const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = wearable_iter->second; - const LLVOAvatarDefines::EBakedTextureIndex index = wearable_iter->first; - if (wearable_dict) + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLVOAvatarDefines::EBakedTextureIndex index = baked_iter->first; + + if (baked_dict) { - for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = wearable_dict->mWearablesVec.begin(); - type_iter != wearable_dict->mWearablesVec.end(); - type_iter++) + for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin(); + type_iter != baked_dict->mWearables.end(); + ++type_iter) { - const EWearableType comp_type = *type_iter; + const LLWearableType::EType comp_type = *type_iter; if (comp_type == type) { if (mBakedTextureDatas[index].mTexLayerSet) @@ -9388,7 +8960,7 @@ void LLVOAvatar::wearableUpdated(EWearableType type, BOOL upload_result) // Physics type has no associated baked textures, but change of params needs to be sent to // other avatars. - if (isSelf() && type == WT_PHYSICS) + if (isSelf() && type == LLWearableType::WT_PHYSICS) { gAgent.sendAgentSetAppearance(); } @@ -9793,12 +9365,12 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ bool found_texture_id = false; - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; + const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second; if (text_dict->mIsUsedByBakedTexture) { const ETextureIndex texture_index = iter->first; @@ -9911,7 +9483,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); } - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) @@ -9938,7 +9510,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // static void LLVOAvatar::dumpArchetypeXML( void* ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; LLAPRFile outfile(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER, "new archetype.xml"), LL_APR_WB); apr_file_t* file = outfile.getFileHandle() ; if( !file ) @@ -9951,9 +9523,9 @@ void LLVOAvatar::dumpArchetypeXML( void* ) apr_file_printf( file, "\n\t\n" ); // only body parts, not clothing. - for( S32 type = WT_SHAPE; type <= WT_EYES; type++ ) + for( S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_EYES; type++ ) { - const std::string& wearable_name = LLWearable::typeToTypeName( (EWearableType) type ); + const std::string& wearable_name = LLWearableType::getTypeName( (LLWearableType::EType) type ); apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) @@ -9969,7 +9541,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) for(U8 te = 0; te < TEX_NUM_INDICES; te++) { - if( LLVOAvatar::getTEWearableType((ETextureIndex)te) == type ) + if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type ) { LLViewerTexture* te_image = avatar->getTEImage((ETextureIndex)te); if( te_image ) @@ -10113,11 +9685,11 @@ BOOL LLVOAvatar::canGrabLocalTexture(ETextureIndex index) /* switch(index) case TEX_EYES_BAKED: textures.push_back(TEX_EYES_IRIS); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const LLVOAvatarDictionary::TextureEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); if (!text_dict->mIsUsedByBakedTexture) return FALSE; const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin(); iter != baked_dict->mLocalTextures.end(); iter++) @@ -10172,11 +9744,11 @@ void LLVOAvatar::dumpLocalTextures() /* ETextureIndex baked_equiv[] = { TEX_UPPER_BAKED, if (isTextureDefined(baked_equiv[i])) */ - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); iter++) { - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; + const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second; if (!text_dict->mIsLocalTexture || !text_dict->mIsUsedByBakedTexture) continue; @@ -10235,31 +9807,9 @@ void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound) } } - +// virtual void LLVOAvatar::removeMissingBakedTextures() -{ - if (!isSelf()) return; - - BOOL removed = FALSE; - for (U32 i = 0; i < mBakedTextureDatas.size(); i++) - { - const S32 te = mBakedTextureDatas[i].mTextureIndex; - if (getTEImage(te)->isMissingAsset()) - { - setTEImage(te, LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR)); - removed = TRUE; - } - } - - if (removed) - { - for(U32 i = 0; i < mBakedTextureDatas.size(); i++) - { - invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE); - } - updateMeshTextures(); - requestLayerSetUploads(); - } +{ } //----------------------------------------------------------------------------- @@ -10276,9 +9826,9 @@ LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer()); - delete mTexSkinColorInfo; - delete mTexHairColorInfo; - delete mTexEyeColorInfo; + deleteAndClear(mTexSkinColorInfo); + deleteAndClear(mTexHairColorInfo); + deleteAndClear(mTexEyeColorInfo); std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer()); } @@ -10608,7 +10158,7 @@ BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) mTexSkinColorInfo = new LLTexGlobalColorInfo; if( !mTexSkinColorInfo->parseXml( color_node ) ) { - delete mTexSkinColorInfo; mTexSkinColorInfo = 0; + deleteAndClear(mTexSkinColorInfo); llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl; return FALSE; } @@ -10623,7 +10173,7 @@ BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) mTexHairColorInfo = new LLTexGlobalColorInfo; if( !mTexHairColorInfo->parseXml( color_node ) ) { - delete mTexHairColorInfo; mTexHairColorInfo = 0; + deleteAndClear(mTexHairColorInfo); llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl; return FALSE; } @@ -10709,29 +10259,11 @@ S32 LLVOAvatar::getAttachmentCount() return count; } + //virtual void LLVOAvatar::updateRegion(LLViewerRegion *regionp) { - if (isSelf()) - { - if (regionp->getHandle() != mLastRegionHandle) - { - if (mLastRegionHandle != 0) - { - ++mRegionCrossingCount; - F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); - F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG); - F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); - - F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); - max = llmax(delta, max); - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); - } - mLastRegionHandle = regionp->getHandle(); - } - mRegionCrossingTimer.reset(); - } + LLViewerObject::updateRegion(regionp); } std::string LLVOAvatar::getFullname() const @@ -10756,7 +10288,7 @@ LLTexLayerSet* LLVOAvatar::getLayerSet(ETextureIndex index) const case TEX_HEAD_BAKED: case TEX_HEAD_BODYPAINT: return mHeadLayerSet; */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const LLVOAvatarDictionary::TextureEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); if (text_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; @@ -10986,12 +10518,12 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const { std::string line; - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; + const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second; if (text_dict->mIsBakedTexture) { line += text_dict->mName; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index ad3c2f641..342335b04 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -84,6 +84,8 @@ class LLVOAvatar : public LLViewerObject, public LLCharacter { +public: + friend class LLVOAvatarSelf; protected: struct LLVOAvatarXmlInfo; @@ -94,9 +96,10 @@ protected: public: LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - /*virtual*/ void markDead(); + virtual void markDead(); static void initClass(); // Initialize data that's only init'd once per class. static void cleanupClass(); // Cleanup data that's only init'd once per class. + virtual void initInstance(); // Called after construction to initialize the class. protected: virtual ~LLVOAvatar(); BOOL loadSkeletonNode(); @@ -116,31 +119,32 @@ protected: //-------------------------------------------------------------------- public: virtual void updateGL(); + virtual LLVOAvatar* asAvatar(); virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp); - /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); virtual BOOL updateLOD(); BOOL updateJointLODs(); #if MESH_ENABLED void updateLODRiggedAttachments( void ); #endif //MESH_ENABLED - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. - /*virtual*/ void updateTextures(); - /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. - /*virtual*/ void onShift(const LLVector4a& shift_vector); + virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate. + virtual void updateTextures(); + virtual S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. + virtual void onShift(const LLVector4a& shift_vector); virtual U32 getPartitionType() const; virtual const LLVector3 getRenderPosition() const; virtual void updateDrawable(BOOL force_damped); - /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); + virtual LLDrawable* createDrawable(LLPipeline *pipeline); + virtual BOOL updateGeometry(LLDrawable *drawable); + virtual void setPixelAreaAndAngle(LLAgent &agent); virtual void updateRegion(LLViewerRegion *regionp); - void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); - void getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); - /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + virtual void updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax); + virtual void getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); + virtual BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES BOOL pick_transparent = FALSE, S32* face_hit = NULL, // which face was hit @@ -170,7 +174,7 @@ public: virtual LLJoint* getCharacterJoint(U32 num); virtual BOOL allocateCharacterJoints(U32 num); - LLUUID remapMotionID(const LLUUID& id); + virtual LLUUID remapMotionID(const LLUUID& id); virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); virtual void stopMotionFromSource(const LLUUID& source_id); @@ -212,7 +216,7 @@ public: **/ public: - bool isSelf() const { return mIsSelf; } // True if this avatar is for this viewer's agent + virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent bool isBuilt() const { return mIsBuilt; } private: //aligned members @@ -225,10 +229,10 @@ private: // Updates //-------------------------------------------------------------------- public: - BOOL updateCharacter(LLAgent &agent); + virtual BOOL updateCharacter(LLAgent &agent); void idleUpdateVoiceVisualizer(bool voice_enabled); void idleUpdateMisc(bool detailed_update); - void idleUpdateAppearanceAnimation(); + virtual void idleUpdateAppearanceAnimation(); void idleUpdateLipSync(bool voice_enabled); void idleUpdateLoadingEffect(); void idleUpdateWindEffect(); @@ -239,7 +243,6 @@ public: static void invalidateNameTags(); void idleUpdateRenderCost(); void idleUpdateBelowWater(); - void idleUpdateTractorBeam(); //1.23 void idleUpdateBoobEffect(); //Emerald void updateAttachmentVisibility(U32 camera_mode); //Agent only @@ -284,6 +287,7 @@ public: protected: bool sendAvatarTexturesRequest(); void updateRuthTimer(bool loading); + F32 calcMorphAmount(); private: BOOL mFullyLoaded; BOOL mPreviousFullyLoaded; @@ -321,7 +325,7 @@ public: protected: static BOOL parseSkeletonFile(const std::string& filename); void buildCharacter(); - BOOL loadAvatar(); + virtual BOOL loadAvatar(); BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info); @@ -480,11 +484,6 @@ public: private: static S32 sFreezeCounter; - //-------------------------------------------------------------------- - // Internal functions - //-------------------------------------------------------------------- -protected: - BOOL needsRenderBeam(); /** Rendering ** ** *******************************************************************************/ @@ -509,11 +508,12 @@ protected: // Baked textures //-------------------------------------------------------------------- public: + void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY ! protected: static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); static void onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - void removeMissingBakedTextures(); + virtual void removeMissingBakedTextures(); void useBakedTexture(const LLUUID& id); struct BakedTextureData @@ -546,8 +546,8 @@ protected: // Composites //-------------------------------------------------------------------- public: - void invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user ); - void invalidateAll(); + virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result); + virtual void invalidateAll(); //-------------------------------------------------------------------- // Static texture/mesh/baked dictionary @@ -621,16 +621,14 @@ public: static void processRebakeAvatarTextures(LLMessageSystem* msg, void**); void setNewBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid ); void setCachedBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid ); - void releaseUnnecessaryTextures(); void requestLayerSetUploads(); + void requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i); bool hasPendingBakedUploads(); static void onLocalTextureLoaded( BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); - static enum EWearableType getTEWearableType(LLVOAvatarDefines::ETextureIndex te ); - static LLUUID getDefaultTEImageID(LLVOAvatarDefines::ETextureIndex te ); static void onChangeSelfInvisible(BOOL newvalue); void setInvisible(BOOL newvalue); - void wearableUpdated(EWearableType type, BOOL upload_result = TRUE); + void wearableUpdated(LLWearableType::EType type, BOOL upload_result = TRUE); //-------------------------------------------------------------------- // texture compositing @@ -650,12 +648,12 @@ public: public: void updateMeshTextures(); - void updateSexDependentLayerSets(BOOL set_by_user); + void updateSexDependentLayerSets(BOOL upload_bake); void dirtyMesh(); // Dirty the avatar mesh void updateMeshData(); protected: void releaseMeshData(); - void restoreMeshData(); + virtual void restoreMeshData(); private: void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD @@ -749,7 +747,7 @@ public: **/ public: - BOOL isWearingWearableType( EWearableType type ) const; + BOOL isWearingWearableType( LLWearableType::EType type ) const; //-------------------------------------------------------------------- // Attachments @@ -954,6 +952,7 @@ public: // Sitting //-------------------------------------------------------------------- public: + void sitDown(BOOL bSitting); BOOL isSitting() const {return mIsSitting;} void sitOnObject(LLViewerObject *sit_object); void getOffObject(); @@ -996,7 +995,6 @@ private: public: LLFrameTimer mChatTimer; LLPointer mNameText; -private: private: LLFrameTimer mTimeVisible; std::deque mChats; @@ -1228,10 +1226,6 @@ private: //-------------------------------------------------------------------- // Private member variables. //-------------------------------------------------------------------- - BOOL mIsSelf; // True if this avatar is for this viewer's agent - - LLViewerJoint *mScreenp; // special purpose joint for HUD attachments - // Scratch textures used for compositing static LLMap< LLGLenum, LLGLuint*> sScratchTexNames; static LLMap< LLGLenum, F32*> sScratchTexLastBindTime; @@ -1243,8 +1237,6 @@ private: static void resolveClient(LLColor4& avatar_name_color, std::string& client, LLVOAvatar* avatar); friend class LLFloaterAvatarList; - LLPointer mBeam; - LLFrameTimer mBeamTimer; U64 mLastRegionHandle; LLFrameTimer mRegionCrossingTimer; @@ -1263,7 +1255,7 @@ inline BOOL LLVOAvatar::isTextureDefined(U8 te) const inline BOOL LLVOAvatar::isTextureVisible(U8 te) const { - return ((isTextureDefined(te) || mIsSelf) + return ((isTextureDefined(te) || isSelf()) && (getTEImage(te)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha)); } diff --git a/indra/newview/llvoavatardefines.cpp b/indra/newview/llvoavatardefines.cpp index 359a821d2..ad906d27f 100644 --- a/indra/newview/llvoavatardefines.cpp +++ b/indra/newview/llvoavatardefines.cpp @@ -32,6 +32,7 @@ #include "llviewerprecompiledheaders.h" #include "llvoavatardefines.h" +#include "llviewercontrol.h" // gSavedSettings const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512; const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512; @@ -42,64 +43,90 @@ using namespace LLVOAvatarDefines; /********************************************************************************* * Edit this function to add/remove/change textures and mesh definitions for avatars. */ -void LLVOAvatarDictionary::initData() + +LLVOAvatarDictionary::Textures::Textures() { - // Textures - mTextureMap[TEX_HEAD_BODYPAINT] = new TextureDictionaryEntry("head bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN); - mTextureMap[TEX_UPPER_SHIRT] = new TextureDictionaryEntry("shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", WT_SHIRT); - mTextureMap[TEX_LOWER_PANTS] = new TextureDictionaryEntry("pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", WT_PANTS); - mTextureMap[TEX_EYES_IRIS] = new TextureDictionaryEntry("iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", WT_EYES); - mTextureMap[TEX_HAIR] = new TextureDictionaryEntry("hair", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", WT_HAIR); - mTextureMap[TEX_UPPER_BODYPAINT] = new TextureDictionaryEntry("upper bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN); - mTextureMap[TEX_LOWER_BODYPAINT] = new TextureDictionaryEntry("lower bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN); - mTextureMap[TEX_LOWER_SHOES] = new TextureDictionaryEntry("shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", WT_SHOES); - mTextureMap[TEX_LOWER_SOCKS] = new TextureDictionaryEntry("socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", WT_SOCKS); - mTextureMap[TEX_UPPER_JACKET] = new TextureDictionaryEntry("upper jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET); - mTextureMap[TEX_LOWER_JACKET] = new TextureDictionaryEntry("lower jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET); - mTextureMap[TEX_UPPER_GLOVES] = new TextureDictionaryEntry("gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", WT_GLOVES); - mTextureMap[TEX_UPPER_UNDERSHIRT] = new TextureDictionaryEntry("undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERSHIRT); - mTextureMap[TEX_LOWER_UNDERPANTS] = new TextureDictionaryEntry("underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERPANTS); - mTextureMap[TEX_SKIRT] = new TextureDictionaryEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", WT_SKIRT); - mTextureMap[TEX_LOWER_ALPHA] = new TextureDictionaryEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA); - mTextureMap[TEX_UPPER_ALPHA] = new TextureDictionaryEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA); - mTextureMap[TEX_HEAD_ALPHA] = new TextureDictionaryEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA); - mTextureMap[TEX_EYES_ALPHA] = new TextureDictionaryEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA); - mTextureMap[TEX_HAIR_ALPHA] = new TextureDictionaryEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA); - mTextureMap[TEX_HEAD_TATTOO] = new TextureDictionaryEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO); - mTextureMap[TEX_UPPER_TATTOO] = new TextureDictionaryEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO); - mTextureMap[TEX_LOWER_TATTOO] = new TextureDictionaryEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO); - mTextureMap[TEX_HEAD_BAKED] = new TextureDictionaryEntry("head-baked", FALSE, BAKED_HEAD); - mTextureMap[TEX_UPPER_BAKED] = new TextureDictionaryEntry("upper-baked", FALSE, BAKED_UPPER); - mTextureMap[TEX_LOWER_BAKED] = new TextureDictionaryEntry("lower-baked", FALSE, BAKED_LOWER); - mTextureMap[TEX_EYES_BAKED] = new TextureDictionaryEntry("eyes-baked", FALSE, BAKED_EYES); - mTextureMap[TEX_HAIR_BAKED] = new TextureDictionaryEntry("hair-baked", FALSE, BAKED_HAIR); - mTextureMap[TEX_SKIRT_BAKED] = new TextureDictionaryEntry("skirt-baked", FALSE, BAKED_SKIRT); + addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); + addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT)); + addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS)); + addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES)); + addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR)); + addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); + addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); + addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES)); + addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS)); + addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); + addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); + addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES)); + addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT)); + addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS)); + addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT)); + addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + + addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); + addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); + addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); + + addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD)); + addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER)); + addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER)); + addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES)); + addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR)); + addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT)); +} + +LLVOAvatarDictionary::BakedTextures::BakedTextures() +{ // Baked textures - mBakedTextureMap[BAKED_HEAD] = new BakedDictionaryEntry(TEX_HEAD_BAKED, "head", 3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA); - mBakedTextureMap[BAKED_UPPER] = new BakedDictionaryEntry(TEX_UPPER_BAKED, "upper_body", 7, TEX_UPPER_SHIRT, TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET, TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA); - mBakedTextureMap[BAKED_LOWER] = new BakedDictionaryEntry(TEX_LOWER_BAKED, "lower_body", 8, TEX_LOWER_PANTS, TEX_LOWER_BODYPAINT, TEX_LOWER_SHOES, TEX_LOWER_SOCKS, TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA); - mBakedTextureMap[BAKED_EYES] = new BakedDictionaryEntry(TEX_EYES_BAKED, "eyes", 2, TEX_EYES_IRIS, TEX_EYES_ALPHA); - mBakedTextureMap[BAKED_SKIRT] = new BakedDictionaryEntry(TEX_SKIRT_BAKED, "skirt", 1, TEX_SKIRT); - mBakedTextureMap[BAKED_HAIR] = new BakedDictionaryEntry(TEX_HAIR_BAKED, "hair", 2, TEX_HAIR, TEX_HAIR_ALPHA); - - // Meshes - mMeshMap[MESH_ID_HAIR] = new MeshDictionaryEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4); - mMeshMap[MESH_ID_HEAD] = new MeshDictionaryEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5); - mMeshMap[MESH_ID_EYELASH] = new MeshDictionaryEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0); // no baked mesh associated currently - mMeshMap[MESH_ID_UPPER_BODY] = new MeshDictionaryEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1); - mMeshMap[MESH_ID_LOWER_BODY] = new MeshDictionaryEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2); - mMeshMap[MESH_ID_EYEBALL_LEFT] = new MeshDictionaryEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3); - mMeshMap[MESH_ID_EYEBALL_RIGHT] = new MeshDictionaryEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3); - mMeshMap[MESH_ID_SKIRT] = new MeshDictionaryEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5); + addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED, + "head", "a4b9dc38-e13b-4df9-b284-751efb0566ff", + 3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA, + 5, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA)); - // Wearables - mWearableMap[BAKED_HEAD] = new WearableDictionaryEntry("18ded8d6-bcfc-e415-8539-944c0f5ea7a6", 5, WT_SHAPE, WT_SKIN, WT_HAIR, WT_TATTOO, WT_ALPHA); - mWearableMap[BAKED_UPPER] = new WearableDictionaryEntry("338c29e3-3024-4dbb-998d-7c04cf4fa88f", 8, WT_SHAPE, WT_SKIN, WT_SHIRT, WT_JACKET, WT_GLOVES, WT_UNDERSHIRT, WT_TATTOO, WT_ALPHA); - mWearableMap[BAKED_LOWER] = new WearableDictionaryEntry("91b4a2c7-1b1a-ba16-9a16-1f8f8dcc1c3f", 9, WT_SHAPE, WT_SKIN, WT_PANTS, WT_SHOES, WT_SOCKS, WT_JACKET, WT_UNDERPANTS, WT_TATTOO, WT_ALPHA); - mWearableMap[BAKED_EYES] = new WearableDictionaryEntry("b2cf28af-b840-1071-3c6a-78085d8128b5", 2, WT_EYES, WT_ALPHA); - mWearableMap[BAKED_SKIRT] = new WearableDictionaryEntry("ea800387-ea1a-14e0-56cb-24f2022f969a", 1, WT_SKIRT); - mWearableMap[BAKED_HAIR] = new WearableDictionaryEntry("0af1ef7c-ad24-11dd-8790-001f5bf833e8", 2, WT_HAIR, WT_ALPHA); + addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED, + "upper_body", "5943ff64-d26c-4a90-a8c0-d61f56bd98d4", + 7, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET, + TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA, + 8, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA)); + + addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED, + "lower_body", "2944ee70-90a7-425d-a5fb-d749c782ed7d", + 8, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS, + TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA, + 9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA)); + + addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED, + "eyes", "27b1bc0f-979f-4b13-95fe-b981c2ba9788", + 2, TEX_EYES_IRIS, TEX_EYES_ALPHA, + 2, LLWearableType::WT_EYES, LLWearableType::WT_ALPHA)); + + addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED, + "skirt", "03e7e8cb-1368-483b-b6f3-74850838ba63", + 1, TEX_SKIRT, + 1, LLWearableType::WT_SKIRT)); + + addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED, + "hair", "a60e85a9-74e8-48d8-8a2d-8129f28d9b61", + 2, TEX_HAIR, TEX_HAIR_ALPHA, + 2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA)); +} + +LLVOAvatarDictionary::Meshes::Meshes() +{ + // Meshes + addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4)); + addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5)); + addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0)); // no baked mesh associated currently + addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1)); + addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2)); + addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3)); + addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3)); + addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5)); } /* @@ -108,18 +135,22 @@ void LLVOAvatarDictionary::initData() LLVOAvatarDictionary::LLVOAvatarDictionary() { - initData(); createAssociations(); } +//virtual +LLVOAvatarDictionary::~LLVOAvatarDictionary() +{ +} + // Baked textures are composites of textures; for each such composited texture, // map it to the baked texture. void LLVOAvatarDictionary::createAssociations() { - for (baked_map_t::const_iterator iter = mBakedTextureMap.begin(); iter != mBakedTextureMap.end(); iter++) + for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++) { const EBakedTextureIndex baked_index = (iter->first); - const BakedDictionaryEntry *dict = (iter->second); + const BakedEntry *dict = (iter->second); // For each texture that this baked texture index affects, associate those textures // with this baked texture index. @@ -128,19 +159,19 @@ void LLVOAvatarDictionary::createAssociations() local_texture_iter++) { const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter; - mTextureMap[local_texture_index]->mIsUsedByBakedTexture = true; - mTextureMap[local_texture_index]->mBakedTextureIndex = baked_index; + mTextures[local_texture_index]->mIsUsedByBakedTexture = true; + mTextures[local_texture_index]->mBakedTextureIndex = baked_index; } } } -LLVOAvatarDictionary::TextureDictionaryEntry::TextureDictionaryEntry(const std::string &name, +LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name, bool is_local_texture, EBakedTextureIndex baked_texture_index, const std::string &default_image_name, - EWearableType wearable_type) : - mName(name), + LLWearableType::EType wearable_type) : + LLDictionaryEntry(name), mIsLocalTexture(is_local_texture), mIsBakedTexture(!is_local_texture), mIsUsedByBakedTexture(baked_texture_index != BAKED_NUM_INDICES), @@ -150,87 +181,87 @@ LLVOAvatarDictionary::TextureDictionaryEntry::TextureDictionaryEntry(const std:: { } -LLVOAvatarDictionary::MeshDictionaryEntry::MeshDictionaryEntry(EBakedTextureIndex baked_index, - const std::string &name, - U8 level, - LLViewerJoint::PickName pick) : +LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index, + const std::string &name, + U8 level, + LLViewerJoint::PickName pick) : + LLDictionaryEntry(name), mBakedID(baked_index), - mName(name), mLOD(level), mPickName(pick) { } -LLVOAvatarDictionary::BakedDictionaryEntry::BakedDictionaryEntry(ETextureIndex tex_index, - const std::string &name, - U32 num_local_textures, ... ) : - mName(name), +LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index, + const std::string &name, + const std::string &hash_name, + U32 num_local_textures, + ... ) : + LLDictionaryEntry(name), + mWearablesHashID(LLUUID(hash_name)), mTextureIndex(tex_index) - { va_list argp; + va_start(argp, num_local_textures); + + // Read in local textures for (U8 i=0; i < num_local_textures; i++) { ETextureIndex t = (ETextureIndex)va_arg(argp,int); mLocalTextures.push_back(t); } -} -LLVOAvatarDictionary::WearableDictionaryEntry::WearableDictionaryEntry(const std::string &hash_name, - U32 num_wearables, ... ) : - mHashID(LLUUID(hash_name)) -{ - va_list argp; - va_start(argp, num_wearables); + // Read in number of wearables + const U32 num_wearables = (U32)va_arg(argp,int); + // Read in wearables for (U8 i=0; i < num_wearables; i++) { - EWearableType t = (EWearableType)va_arg(argp,int); - mWearablesVec.push_back(t); + LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int); + mWearables.push_back(t); } } -//virtual -LLVOAvatarDictionary::~LLVOAvatarDictionary() -{ - for (mesh_map_t::iterator iter = mMeshMap.begin(); iter != mMeshMap.end(); iter++) - delete (iter->second); - for (baked_map_t::iterator iter = mBakedTextureMap.begin(); iter != mBakedTextureMap.end(); iter++) - delete (iter->second); - for (texture_map_t::iterator iter = mTextureMap.begin(); iter != mTextureMap.end(); iter++) - delete (iter->second); -} - -const LLVOAvatarDictionary::MeshDictionaryEntry *LLVOAvatarDictionary::getMesh(EMeshIndex index) const -{ - mesh_map_t::const_iterator mesh_iter = mMeshMap.find(index); - if (mesh_iter == mMeshMap.end()) return NULL; - return mesh_iter->second; -} - -const LLVOAvatarDictionary::BakedDictionaryEntry *LLVOAvatarDictionary::getBakedTexture(EBakedTextureIndex index) const -{ - baked_map_t::const_iterator baked_iter = mBakedTextureMap.find(index); - if (baked_iter == mBakedTextureMap.end()) return NULL; - return baked_iter->second; -} - -const LLVOAvatarDictionary::TextureDictionaryEntry *LLVOAvatarDictionary::getTexture(ETextureIndex index) const -{ - texture_map_t::const_iterator texture_iter = mTextureMap.find(index); - if (texture_iter == mTextureMap.end()) return NULL; - return texture_iter->second; -} - -const LLVOAvatarDictionary::WearableDictionaryEntry *LLVOAvatarDictionary::getWearable(EBakedTextureIndex index) const -{ - wearable_map_t::const_iterator wearable_iter = mWearableMap.find(index); - if (wearable_iter == mWearableMap.end()) return NULL; - return wearable_iter->second; -} - - - -ETextureIndex LLVOAvatarDefines::getTextureIndex(EBakedTextureIndex index) +// static +ETextureIndex LLVOAvatarDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index) { return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex; } + +//static +EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name) +{ + U8 index = 0; + while (index < BAKED_NUM_INDICES) + { + const BakedEntry *be = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index); + if (be && be->mName.compare(name) == 0) + { + // baked texture found + return (EBakedTextureIndex) index; + } + index++; + } + // baked texture could not be found + return BAKED_NUM_INDICES; +} + +//static +const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index) +{ + const TextureEntry *texture_dict = getInstance()->getTexture(index); + const std::string &default_image_name = texture_dict->mDefaultImageName; + if (default_image_name == "") + { + return IMG_DEFAULT_AVATAR; + } + else + { + return LLUUID(gSavedSettings.getString(default_image_name)); + } +} + +// static +LLWearableType::EType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index ) +{ + return getInstance()->getTexture(index)->mWearableType; +} diff --git a/indra/newview/llvoavatardefines.h b/indra/newview/llvoavatardefines.h index 29932a7e3..bf157732d 100644 --- a/indra/newview/llvoavatardefines.h +++ b/indra/newview/llvoavatardefines.h @@ -37,6 +37,7 @@ #include #include "llwearable.h" #include "llviewerjoint.h" +#include "lldictionary.h" namespace LLVOAvatarDefines { @@ -82,8 +83,6 @@ enum ETextureIndex TEX_NUM_INDICES }; -typedef std::vector texture_vec_t; - enum EBakedTextureIndex { BAKED_HEAD = 0, @@ -94,7 +93,6 @@ enum EBakedTextureIndex BAKED_HAIR, BAKED_NUM_INDICES }; -typedef std::vector bakedtexture_vec_t; // Reference IDs for each mesh. Used as indices for vector of joints enum EMeshIndex @@ -109,18 +107,14 @@ enum EMeshIndex MESH_ID_SKIRT, MESH_ID_NUM_INDICES }; + +//-------------------------------------------------------------------- +// Vector Types +//-------------------------------------------------------------------- +typedef std::vector texture_vec_t; +typedef std::vector bakedtexture_vec_t; typedef std::vector mesh_vec_t; - -typedef std::vector wearables_vec_t; - -//-------------------------------------------------------------------------------- -// Convenience Functions -//-------------------------------------------------------------------------------- - -// Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED -ETextureIndex getTextureIndex(EBakedTextureIndex t); - - +typedef std::vector wearables_vec_t; //------------------------------------------------------------------------ // LLVOAvatarDictionary @@ -132,20 +126,28 @@ ETextureIndex getTextureIndex(EBakedTextureIndex t); //------------------------------------------------------------------------ class LLVOAvatarDictionary : public LLSingleton { + //-------------------------------------------------------------------- + // Constructors and Destructors + //-------------------------------------------------------------------- public: LLVOAvatarDictionary(); virtual ~LLVOAvatarDictionary(); +private: + void createAssociations(); - struct TextureDictionaryEntry + //-------------------------------------------------------------------- + // Local and baked textures + //-------------------------------------------------------------------- +public: + struct TextureEntry : public LLDictionaryEntry { - TextureDictionaryEntry(const std::string &name, + TextureEntry(const std::string &name, bool is_local_texture, EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES, const std::string &default_image_name = "", - EWearableType wearable_type = WT_INVALID); - const std::string mName; + LLWearableType::EType wearable_type = LLWearableType::WT_INVALID); const std::string mDefaultImageName; - const EWearableType mWearableType; + const LLWearableType::EType mWearableType; // It's either a local texture xor baked BOOL mIsLocalTexture; BOOL mIsBakedTexture; @@ -153,14 +155,24 @@ public: BOOL mIsUsedByBakedTexture; EBakedTextureIndex mBakedTextureIndex; }; - - struct MeshDictionaryEntry + + struct Textures : public LLDictionary { - MeshDictionaryEntry(EBakedTextureIndex baked_index, + Textures(); + } mTextures; + const TextureEntry* getTexture(ETextureIndex index) const { return mTextures.lookup(index); } + const Textures& getTextures() const { return mTextures; } + + //-------------------------------------------------------------------- + // Meshes + //-------------------------------------------------------------------- +public: + struct MeshEntry : public LLDictionaryEntry + { + MeshEntry(EBakedTextureIndex baked_index, const std::string &name, U8 level, LLViewerJoint::PickName pick); - const std::string mName; // names of mesh types as they are used in avatar_lad.xml // Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml // Otherwise meshes will be unable to be found, or levels of detail will be ignored const U8 mLOD; @@ -168,47 +180,52 @@ public: const LLViewerJoint::PickName mPickName; }; - struct BakedDictionaryEntry + struct Meshes : public LLDictionary { - BakedDictionaryEntry(ETextureIndex tex_index, - const std::string &name, - U32 num_local_textures, ... ); + Meshes(); + } mMeshes; + const MeshEntry* getMesh(EMeshIndex index) const { return mMeshes.lookup(index); } + const Meshes& getMeshes() const { return mMeshes; } + + //-------------------------------------------------------------------- + // Baked Textures + //-------------------------------------------------------------------- +public: + struct BakedEntry : public LLDictionaryEntry + { + BakedEntry(ETextureIndex tex_index, + const std::string &name, // unused, but necessary for templating. + const std::string &hash_name, + U32 num_local_textures, ... ); // # local textures, local texture list, # wearables, wearable list + // Local Textures const ETextureIndex mTextureIndex; - const std::string mName; - texture_vec_t mLocalTextures; + texture_vec_t mLocalTextures; + // Wearables + const LLUUID mWearablesHashID; + wearables_vec_t mWearables; }; - struct WearableDictionaryEntry + struct BakedTextures: public LLDictionary { - WearableDictionaryEntry(const std::string &hash_name, - U32 num_wearables, ... ); - const LLUUID mHashID; - wearables_vec_t mWearablesVec; - }; - - typedef std::map baked_map_t; - typedef std::map texture_map_t; - typedef std::map mesh_map_t; - typedef std::map wearable_map_t; - - const MeshDictionaryEntry *getMesh(EMeshIndex index) const; - const BakedDictionaryEntry *getBakedTexture(EBakedTextureIndex index) const; - const TextureDictionaryEntry *getTexture(ETextureIndex index) const; - const WearableDictionaryEntry *getWearable(EBakedTextureIndex index) const; - - const texture_map_t &getTextures() const { return mTextureMap; } - const baked_map_t &getBakedTextures() const { return mBakedTextureMap; } - const mesh_map_t &getMeshes() const { return mMeshMap; } - const wearable_map_t &getWearables() const { return mWearableMap; } + BakedTextures(); + } mBakedTextures; + const BakedEntry* getBakedTexture(EBakedTextureIndex index) const { return mBakedTextures.lookup(index); } + const BakedTextures& getBakedTextures() const { return mBakedTextures; } -private: - void initData(); - void createAssociations(); + //-------------------------------------------------------------------- + // Convenience Functions + //-------------------------------------------------------------------- +public: + // Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED + static ETextureIndex bakedToLocalTextureIndex(EBakedTextureIndex t); - texture_map_t mTextureMap; - baked_map_t mBakedTextureMap; - mesh_map_t mMeshMap; - wearable_map_t mWearableMap; + // find a baked texture index based on its name + static EBakedTextureIndex findBakedByRegionName(std::string name); + + static const LLUUID getDefaultTextureImageID(ETextureIndex index); + + // Given a texture entry, determine which wearable type owns it. + static LLWearableType::EType getTEWearableType(ETextureIndex index); }; // End LLVOAvatarDictionary diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp new file mode 100644 index 000000000..ce1077c9c --- /dev/null +++ b/indra/newview/llvoavatarself.cpp @@ -0,0 +1,674 @@ +/** + * @file llvoavatar.cpp + * @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "llviewerprecompiledheaders.h" + +#include "llvoavatarself.h" +#include "llvoavatar.h" + +#include "pipeline.h" + +#include "llagent.h" // Get state values from here +#include "llagentcamera.h" +#include "llagentwearables.h" +#include "llhudeffecttrail.h" +#include "llhudmanager.h" +#include "llnotificationsutil.h" +#include "llselectmgr.h" +#include "lltoolgrab.h" // for needsRenderBeam +#include "lltoolmgr.h" // for needsRenderBeam +#include "lltoolmorph.h" +#include "llviewercamera.h" +#include "llviewercontrol.h" +#include "llviewermedia.h" +#include "llviewermenu.h" +#include "llviewerobjectlist.h" +#include "llviewerstats.h" +#include "llviewerregion.h" +#include "llmeshrepository.h" +#include "llvovolume.h" +LLVOAvatarSelf *gAgentAvatarp = NULL; +BOOL isAgentAvatarValid() +{ + return (gAgentAvatarp && + (gAgentAvatarp->getRegion() != NULL) && + (!gAgentAvatarp->isDead())); +} + +/********************************************************************************* + ** ** + ** Begin LLVOAvatarSelf Constructor routines + ** + **/ + +LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, + const LLPCode pcode, + LLViewerRegion* regionp) : + LLVOAvatar(id, pcode, regionp), + mScreenp(NULL), + mLastRegionHandle(0), + mRegionCrossingCount(0) +{ + gAgentWearables.setAvatarObject(this); + gAgentCamera.setAvatarObject(this); + + mMotionController.mIsSelf = TRUE; + + lldebugs << "Marking avatar as self " << id << llendl; +} + +void LLVOAvatarSelf::initInstance() +{ + BOOL status = TRUE; + // creates hud joint(mScreen) among other things + status &= loadAvatarSelf(); + + // adds attachment points to mScreen among other things + LLVOAvatar::initInstance(); + + llinfos << "Self avatar object created. Starting timer." << llendl; + /*mDebugSelfLoadTimer.reset(); + // clear all times to -1 for debugging + for (U32 i =0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i) + { + for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j) + { + mDebugTextureLoadTimes[i][j] = -1.0f; + } + } + + for (U32 i =0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i) + { + mDebugBakedTextureTimes[i][0] = -1.0f; + mDebugBakedTextureTimes[i][1] = -1.0f; + }*/ + + status &= buildMenus(); + if (!status) + { + llerrs << "Unable to load user's avatar" << llendl; + return; + } +} + +// virtual +void LLVOAvatarSelf::markDead() +{ + mBeam = NULL; + LLVOAvatar::markDead(); +} + +/*virtual*/ BOOL LLVOAvatarSelf::loadAvatar() +{ + BOOL success = LLVOAvatar::loadAvatar(); + return success; +} + + +BOOL LLVOAvatarSelf::loadAvatarSelf() +{ + BOOL success = TRUE; + // avatar_skeleton.xml + if (!buildSkeletonSelf(sAvatarSkeletonInfo)) + { + llwarns << "avatar file: buildSkeleton() failed" << llendl; + return FALSE; + } + // TODO: make loadLayersets() called only by self. + //success &= loadLayersets(); + + return success; +} + +BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLVOAvatarSkeletonInfo *info) +{ + LLMemType mt(LLMemType::MTYPE_AVATAR); + + // add special-purpose "screen" joint + mScreenp = new LLViewerJoint("mScreen", NULL); + // for now, put screen at origin, as it is only used during special + // HUD rendering mode + F32 aspect = LLViewerCamera::getInstance()->getAspect(); + LLVector3 scale(1.f, aspect, 1.f); + mScreenp->setScale(scale); + mScreenp->setWorldPosition(LLVector3::zero); + // need to update screen agressively when sidebar opens/closes, for example + mScreenp->mUpdateXform = TRUE; + return TRUE; +} + +BOOL LLVOAvatarSelf::buildMenus() +{ + //------------------------------------------------------------------------- + // build the attach and detach menus + //------------------------------------------------------------------------- + if(gNoRender) + return TRUE; + // *TODO: Translate + gAttachBodyPartPieMenus[0] = NULL; + gAttachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); + gAttachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); + gAttachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); + gAttachBodyPartPieMenus[4] = NULL; + gAttachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); + gAttachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); + gAttachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); + + gDetachBodyPartPieMenus[0] = NULL; + gDetachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); + gDetachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); + gDetachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); + gDetachBodyPartPieMenus[4] = NULL; + gDetachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); + gDetachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); + gDetachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); + + for (S32 i = 0; i < 8; i++) + { + if (gAttachBodyPartPieMenus[i]) + { + gAttachPieMenu->appendPieMenu( gAttachBodyPartPieMenus[i] ); + } + else + { + BOOL attachment_found = FALSE; + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (attachment->getGroup() == i) + { + LLMenuItemCallGL* item; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // We need the userdata param to disable options in this pie menu later on (Left Hand / Right Hand option) + item = new LLMenuItemCallGL(attachment->getName(), + NULL, + object_selected_and_point_valid, attachment); +// [/RLVa:KB] +// item = new LLMenuItemCallGL(attachment->getName(), +// NULL, +// object_selected_and_point_valid); + item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", iter->first); + + gAttachPieMenu->append(item); + + attachment_found = TRUE; + break; + + } + } + + + + + + + + if (!attachment_found) + { + gAttachPieMenu->appendSeparator(); + } + } + + if (gDetachBodyPartPieMenus[i]) + { + gDetachPieMenu->appendPieMenu( gDetachBodyPartPieMenus[i] ); + } + else + { + BOOL attachment_found = FALSE; + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (attachment->getGroup() == i) + { + gDetachPieMenu->append(new LLMenuItemCallGL(attachment->getName(), + &handle_detach_from_avatar, object_attached, attachment)); + + attachment_found = TRUE; + break; + } + } + + if (!attachment_found) + { + gDetachPieMenu->appendSeparator(); + } + } + } + + // add screen attachments + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (attachment->getGroup() == 8) + { + LLMenuItemCallGL* item; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // We need the userdata param to disable options in this pie menu later on + item = new LLMenuItemCallGL(attachment->getName(), + NULL, + object_selected_and_point_valid, attachment); +// [/RLVa:KB] +// item = new LLMenuItemCallGL(attachment->getName(), +// NULL, +// object_selected_and_point_valid); + item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", iter->first); + gAttachScreenPieMenu->append(item); + gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), + &handle_detach_from_avatar, object_attached, attachment)); + } + } + + + + for (S32 pass = 0; pass < 2; pass++) + { + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (attachment->getIsHUDAttachment() != (pass == 1)) + { + continue; + } + // RELEASE-RLVa: random comment because we want know if LL ever changes this to not include "attachment" as userdata + LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), + NULL, &object_selected_and_point_valid, + &attach_label, attachment); + item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", iter->first); + gAttachSubMenu->append(item); + + gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(), + &handle_detach_from_avatar, object_attached, &detach_label, attachment)); + + } + if (pass == 0) + { + // put separator between non-hud and hud attachments + gAttachSubMenu->appendSeparator(); + gDetachSubMenu->appendSeparator(); + } + } + + for (S32 group = 0; group < 8; group++) + { + // skip over groups that don't have sub menus + if (!gAttachBodyPartPieMenus[group] || !gDetachBodyPartPieMenus[group]) + { + continue; + } + + std::multimap attachment_pie_menu_map; + + // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if(attachment->getGroup() == group) + { + // use multimap to provide a partial order off of the pie slice key + S32 pie_index = attachment->getPieSlice(); + attachment_pie_menu_map.insert(std::make_pair(pie_index, iter->first)); + } + } + + // add in requested order to pie menu, inserting separators as necessary + S32 cur_pie_slice = 0; + for (std::multimap::iterator attach_it = attachment_pie_menu_map.begin(); + attach_it != attachment_pie_menu_map.end(); ++attach_it) + { + S32 requested_pie_slice = attach_it->first; + S32 attach_index = attach_it->second; + while (cur_pie_slice < requested_pie_slice) + { + gAttachBodyPartPieMenus[group]->appendSeparator(); + gDetachBodyPartPieMenus[group]->appendSeparator(); + cur_pie_slice++; + } + + LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); + if (attachment) + { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // We need the userdata param to disable options in this pie menu later on + LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), + NULL, object_selected_and_point_valid, attachment); +// [/RLVa:KB] +// LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), +// NULL, object_selected_and_point_valid); + gAttachBodyPartPieMenus[group]->append(item); + item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index); + gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), + &handle_detach_from_avatar, + object_attached, attachment)); + cur_pie_slice++; + } + } + } + return TRUE; +} + +void LLVOAvatarSelf::cleanup() +{ + markDead(); + delete mScreenp; + mScreenp = NULL; + mRegionp = NULL; +} + +LLVOAvatarSelf::~LLVOAvatarSelf() +{ + cleanup(); +} +BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent) +{ + LLMemType mt(LLMemType::MTYPE_AVATAR); + + // update screen joint size + if (mScreenp) + { + F32 aspect = LLViewerCamera::getInstance()->getAspect(); + LLVector3 scale(1.f, aspect, 1.f); + mScreenp->setScale(scale); + mScreenp->updateWorldMatrixChildren(); + resetHUDAttachments(); + } + + return LLVOAvatar::updateCharacter(agent); +} + +// virtual +BOOL LLVOAvatarSelf::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) +{ + if (!isAgentAvatarValid()) + { + return TRUE; + } + if(!gNoRender) + { + //Emerald performs some force-bakes stuff here. Added it in because we noticed slow responses with client tag ident. -HgB + for(U8 i=0;iforceActive(); + } + } + LLVOAvatar::idleUpdate(agent,world,time); + if(!gNoRender) + idleUpdateTractorBeam(); + return TRUE; +} + +// virtual +LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) +{ + if (mScreenp) + { + LLJoint* jointp = mScreenp->findJoint(name); + if (jointp) return jointp; + } + return LLVOAvatar::getJoint(name); +} +//virtual +void LLVOAvatarSelf::resetJointPositions( void ) +{ + return LLVOAvatar::resetJointPositions(); +} +// virtual +void LLVOAvatarSelf::requestStopMotion(LLMotion* motion) +{ + // Only agent avatars should handle the stop motion notifications. + + // Notify agent that motion has stopped + gAgent.requestStopMotion(motion); +} + +// virtual +void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id) +{ + for(AnimSourceIterator motion_it = mAnimationSources.find(source_id); motion_it != mAnimationSources.end();) + { + gAgent.sendAnimationRequest( motion_it->second, ANIM_REQUEST_STOP ); + mAnimationSources.erase(motion_it++); + } + + LLViewerObject* object = gObjectList.findObject(source_id); + if (object) + { + object->mFlags &= ~FLAGS_ANIM_SOURCE; + } +} +//virtual +void LLVOAvatarSelf::removeMissingBakedTextures() +{ + BOOL removed = FALSE; + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + const S32 te = mBakedTextureDatas[i].mTextureIndex; + const LLViewerTexture* tex = getTEImage(te); + + // Replace with default if we can't find the asset, assuming the + // default is actually valid (which it should be unless something + // is seriously wrong). + if (!tex || tex->isMissingAsset()) + { + LLViewerTexture *imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR); + if (imagep) + { + setTEImage(te, imagep); + removed = TRUE; + } + } + } + + if (removed) + { + for(U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE); + } + updateMeshTextures(); + requestLayerSetUploads(); + } +} + +//virtual +void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) +{ + // Save the global position + LLVector3d global_pos_from_old_region = getPositionGlobal(); + + // Change the region + setRegion(regionp); + + if (regionp) + { // Set correct region-relative position from global coordinates + setPositionGlobal(global_pos_from_old_region); + + // Diagnostic info + //LLVector3d pos_from_new_region = getPositionGlobal(); + //llinfos << "pos_from_old_region is " << global_pos_from_old_region + // << " while pos_from_new_region is " << pos_from_new_region + // << llendl; + } + + if (!regionp || (regionp->getHandle() != mLastRegionHandle)) + { + if (mLastRegionHandle != 0) + { + ++mRegionCrossingCount; + F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); + F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG); + F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); + + F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); + max = llmax(delta, max); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); + + // Diagnostics + llinfos << "Region crossing took " << (F32)(delta * 1000.0) << " ms " << llendl; + } + if (regionp) + { + mLastRegionHandle = regionp->getHandle(); + } + } + mRegionCrossingTimer.reset(); + LLViewerObject::updateRegion(regionp); +} + +//-------------------------------------------------------------------- +// draw tractor beam when editing objects +//-------------------------------------------------------------------- +//virtual +void LLVOAvatarSelf::idleUpdateTractorBeam() +{ + + + if(gSavedSettings.getBOOL("DisablePointAtAndBeam")) + { + return; + } + // + + const LLPickInfo& pick = gViewerWindow->getLastPick(); + + // No beam for media textures + // TODO: this will change for Media on a Prim + if(pick.getObject() && pick.mObjectFace >= 0) + { + const LLTextureEntry* tep = pick.getObject()->getTE(pick.mObjectFace); + if (tep && LLViewerMedia::textureHasMedia(tep->getID())) + { + return; + } + } + + // This is only done for yourself (maybe it should be in the agent?) + if (!needsRenderBeam() || !mIsBuilt) + { + mBeam = NULL; + } + else if (!mBeam || mBeam->isDead()) + { + // VEFFECT: Tractor Beam + mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); + mBeam->setColor(LLColor4U(gAgent.getEffectColor())); + mBeam->setSourceObject(this); + mBeamTimer.reset(); + } + + if (!mBeam.isNull()) + { + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + + if (gAgentCamera.mPointAt.notNull()) + { + // get point from pointat effect + mBeam->setPositionGlobal(gAgentCamera.mPointAt->getPointAtPosGlobal()); + mBeam->triggerLocal(); + } + else if (selection->getFirstRootObject() && + selection->getSelectType() != SELECT_TYPE_HUD) + { + LLViewerObject* objectp = selection->getFirstRootObject(); + mBeam->setTargetObject(objectp); + } + else + { + mBeam->setTargetObject(NULL); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + if (tool->isEditing()) + { + if (tool->getEditingObject()) + { + mBeam->setTargetObject(tool->getEditingObject()); + } + else + { + mBeam->setPositionGlobal(tool->getEditingPointGlobal()); + } + } + else + { + + mBeam->setPositionGlobal(pick.mPosGlobal); + } + + } + if (mBeamTimer.getElapsedTimeF32() > 0.25f) + { + mBeam->setColor(LLColor4U(gAgent.getEffectColor())); + mBeam->setNeedsSendToSim(TRUE); + mBeamTimer.reset(); + } + } +} +//----------------------------------------------------------------------------- +// restoreMeshData() +//----------------------------------------------------------------------------- +// virtual +void LLVOAvatarSelf::restoreMeshData() +{ + LLMemType mt(LLMemType::MTYPE_AVATAR); + + //llinfos << "Restoring" << llendl; + mMeshValid = TRUE; + updateJointLODs(); + updateAttachmentVisibility(gAgentCamera.getCameraMode()); + + // force mesh update as LOD might not have changed to trigger this + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY, TRUE); +} +//------------------------------------------------------------------------ +// needsRenderBeam() +//------------------------------------------------------------------------ +BOOL LLVOAvatarSelf::needsRenderBeam() +{ + if (gNoRender) + { + return FALSE; + } + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + + BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); + if (LLToolGrab::getInstance()->getEditingObject() && + LLToolGrab::getInstance()->getEditingObject()->isAttachment()) + { + // don't render selection beam on hud objects + is_touching_or_grabbing = FALSE; + } + return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); +} \ No newline at end of file diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h new file mode 100644 index 000000000..24ee48517 --- /dev/null +++ b/indra/newview/llvoavatarself.h @@ -0,0 +1,164 @@ +/** + * @file llvoavatarself.h + * @brief Declaration of LLVOAvatar class which is a derivation fo + * LLViewerObject + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLVOAVATARSELF_H +#define LL_LLVOAVATARSELF_H + +#include "llviewertexture.h" +#include "llvoavatar.h" + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// LLVOAvatarSelf +// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLVOAvatarSelf : + public LLVOAvatar +{ + +/******************************************************************************** + ** ** + ** INITIALIZATION + **/ + +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. + void cleanup(); +protected: + /*virtual*/ BOOL loadAvatar(); + BOOL loadAvatarSelf(); + BOOL buildSkeletonSelf(const LLVOAvatarSkeletonInfo *info); + BOOL buildMenus(); + +/** Initialization + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** INHERITED + **/ + + //-------------------------------------------------------------------- + // LLViewerObject interface and related + //-------------------------------------------------------------------- +public: + /*virtual*/ void updateRegion(LLViewerRegion *regionp); + /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + + //-------------------------------------------------------------------- + // LLCharacter interface and related + //-------------------------------------------------------------------- +public: + /*virtual*/ void stopMotionFromSource(const LLUUID& source_id); + /*virtual*/ void requestStopMotion(LLMotion* motion); + /*virtual*/ LLJoint* getJoint(const std::string &name); + + void resetJointPositions( void ); + + + +/** Initialization + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** STATE + **/ + +public: + /*virtual*/ bool isSelf() const { return true; } + + //-------------------------------------------------------------------- + // Updates + //-------------------------------------------------------------------- +public: + /*virtual*/ BOOL updateCharacter(LLAgent &agent); + /*virtual*/ void idleUpdateTractorBeam(); + + + +private: + U64 mLastRegionHandle; + LLFrameTimer mRegionCrossingTimer; + S32 mRegionCrossingCount; + +/** State + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** RENDERING + **/ + + //-------------------------------------------------------------------- + // Render beam + //-------------------------------------------------------------------- +protected: + BOOL needsRenderBeam(); +private: + LLPointer mBeam; + LLFrameTimer mBeamTimer; + + +/** Rendering + ** ** + *******************************************************************************/ +protected: + /*virtual*/ void removeMissingBakedTextures(); +/******************************************************************************** + ** ** + ** MESHES + **/ +protected: + /*virtual*/ void restoreMeshData(); + +/** Meshes + ** ** + *******************************************************************************/ + + //-------------------------------------------------------------------- + // HUDs + //-------------------------------------------------------------------- +private: + LLViewerJoint* mScreenp; // special purpose joint for HUD attachments + +/** Attachments + ** ** + *******************************************************************************/ +}; + +extern LLVOAvatarSelf *gAgentAvatarp; + +BOOL isAgentAvatarValid(); + +#endif // LL_VO_AVATARSELF_H diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 1d350d635..25337f0ef 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -74,6 +74,8 @@ F32 w_mod[GRASS_MAX_BLADES]; // Factor to modulate wind movement by to rand LLVOGrass::SpeciesMap LLVOGrass::sSpeciesTable; S32 LLVOGrass::sMaxGrassSpecies = 0; +LLVOGrass::SpeciesNames LLVOGrass::sSpeciesNames; + LLVOGrass::LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) : LLAlphaObject(id, pcode, regionp) @@ -198,6 +200,11 @@ void LLVOGrass::initClass() if (species >= sMaxGrassSpecies) sMaxGrassSpecies = species + 1; + std::string name; + static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); + success &= grass_def->getFastAttributeString(name_string, name); + sSpeciesNames[name] = species; + if (!success) { std::string name; diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h index 6a6fcc31c..8519d02cd 100644 --- a/indra/newview/llvograss.h +++ b/indra/newview/llvograss.h @@ -117,6 +117,9 @@ public: F32 mBladeWindAngle; F32 mBWAOverlap; + typedef std::map SpeciesNames; + static SpeciesNames sSpeciesNames; + protected: ~LLVOGrass(); diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 53b7177ce..58fb220f5 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -29,6 +29,9 @@ * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ +#if LL_LINUX && defined(LL_STANDALONE) +#include +#endif #include "llviewerprecompiledheaders.h" #include "llvoiceclient.h" @@ -37,7 +40,7 @@ #include "llsdutil.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llbufferstream.h" #include "llfile.h" #ifdef LL_STANDALONE @@ -1637,10 +1640,23 @@ void LLVoiceClient::stateMachine() { // Launch the voice daemon - // *FIX:Mani - Using the executable dir instead - // of mAppRODataDir, the working directory from which the app - // is launched. - //std::string exe_path = gDirUtilp->getAppRODataDir(); +#if LL_LINUX && defined(LL_STANDALONE) + // Look for the vivox daemon in the executable path list + // using glib first. + char *voice_path = g_find_program_in_path ("SLVoice"); + std::string exe_path; + if (voice_path) { + exe_path = llformat("%s", voice_path); + free(voice_path); + } else { + exe_path = gDirUtilp->getExecutableDir() + + gDirUtilp->getDirDelimiter() + "SLVoice"; + } +#else + // *FIX:Mani - Using the executable dir instead + // of mAppRODataDir, the working directory from which the + // app is launched. + //std::string exe_path = gDirUtilp->getAppRODataDir(); std::string exe_path = gDirUtilp->getExecutableDir(); exe_path += gDirUtilp->getDirDelimiter(); #if LL_WINDOWS @@ -1649,6 +1665,7 @@ void LLVoiceClient::stateMachine() exe_path += "../Resources/SLVoice"; #else exe_path += "SLVoice"; +#endif #endif // See if the vivox executable exists llstat s; @@ -5673,7 +5690,7 @@ void LLVoiceClient::updatePosition(void) if(gVoiceClient) { - LLVOAvatar *agent = gAgent.getAvatarObject(); + LLVOAvatar *agent = gAgentAvatarp; LLViewerRegion *region = gAgent.getRegion(); if(region && agent) { diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 08dbc4df5..8ab942851 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -83,6 +83,8 @@ F32 LLVOTree::sTreeFactor = 1.f; LLVOTree::SpeciesMap LLVOTree::sSpeciesTable; S32 LLVOTree::sMaxTreeSpecies = 0; +LLVOTree::SpeciesNames LLVOTree::sSpeciesNames; + // Tree variables and functions LLVOTree::LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp): @@ -242,6 +244,11 @@ void LLVOTree::initClass() sSpeciesTable[species] = newTree; if (species >= sMaxTreeSpecies) sMaxTreeSpecies = species + 1; + + std::string name; + static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); + success &= tree_def->getFastAttributeString(name_string, name); + sSpeciesNames[name] = species; if (!success) { diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h index 7e961471f..befe3665c 100644 --- a/indra/newview/llvotree.h +++ b/indra/newview/llvotree.h @@ -153,6 +153,10 @@ public: }; static F32 sTreeFactor; // Tree level of detail factor + + typedef std::map SpeciesNames; + static SpeciesNames sSpeciesNames; + static const S32 sMAX_NUM_TREE_LOD_LEVELS ; friend class LLDrawPoolTree; diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index a8adbb527..3e1069f04 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -41,6 +41,7 @@ #include "llagent.h" #include "llagentcamera.h" #include "llagentwearables.h" +#include "lldictionary.h" #include "llnotificationsutil.h" #include "llassetuploadresponders.h" #include "llviewerwindow.h" @@ -49,7 +50,7 @@ #include "llviewertexturelist.h" #include "llviewerinventory.h" #include "llviewerregion.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llwearable.h" using namespace LLVOAvatarDefines; @@ -57,83 +58,13 @@ using namespace LLVOAvatarDefines; // static S32 LLWearable::sCurrentDefinitionVersion = 1; -// static -const std::string LLWearable::sTypeName[ WT_COUNT+1 ] = -{ - "shape", - "skin", - "hair", - "eyes", - "shirt", - "pants", - "shoes", - "socks", - "jacket", - "gloves", - "undershirt", - "underpants", - "skirt", - "alpha", - "tattoo", - "physics", - "invalid" -}; - -// static -const std::string LLWearable::sTypeLabel[ WT_COUNT+1 ] = -{ - "Shape", - "Skin", - "Hair", - "Eyes", - "Shirt", - "Pants", - "Shoes", - "Socks", - "Jacket", - "Gloves", - "Undershirt", - "Underpants", - "Skirt", - "Alpha", - "Tattoo", - "Physics", - "invalid" -}; - - -// static -LLAssetType::EType LLWearable::typeToAssetType(EWearableType wearable_type) -{ - switch( wearable_type ) - { - case WT_SHAPE: - case WT_SKIN: - case WT_HAIR: - case WT_EYES: - return LLAssetType::AT_BODYPART; - case WT_SHIRT: - case WT_PANTS: - case WT_SHOES: - case WT_SOCKS: - case WT_JACKET: - case WT_GLOVES: - case WT_UNDERSHIRT: - case WT_UNDERPANTS: - case WT_SKIRT: - case WT_ALPHA: - case WT_TATTOO: - case WT_PHYSICS: - return LLAssetType::AT_CLOTHING; - default: - return LLAssetType::AT_NONE; - } -} - +// Private local functions +static std::string terse_F32_to_string(F32 f); +static std::string asset_id_to_filename(const LLUUID &asset_id); LLWearable::LLWearable(const LLTransactionID& transaction_id) : mDefinitionVersion(LLWearable::sCurrentDefinitionVersion), - mType(WT_SHAPE) + mType(LLWearableType::WT_INVALID) { mTransactionID = transaction_id; mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); @@ -141,7 +72,7 @@ LLWearable::LLWearable(const LLTransactionID& transaction_id) : LLWearable::LLWearable(const LLAssetID& asset_id) : mDefinitionVersion( LLWearable::sCurrentDefinitionVersion ), - mType(WT_SHAPE) + mType(LLWearableType::WT_INVALID) { mAssetID = asset_id; mTransactionID.setNull(); @@ -151,55 +82,22 @@ LLWearable::~LLWearable() { } - -// static -EWearableType LLWearable::typeNameToType( const std::string& type_name ) +const std::string& LLWearable::getTypeLabel() const { - for( S32 i = 0; i < WT_COUNT; i++ ) - { - if( type_name == LLWearable::sTypeName[ i ] ) - { - return (EWearableType)i; - } - } - return WT_INVALID; + return LLWearableType::getTypeLabel(mType); } - -std::string terse_F32_to_string( F32 f ) +const std::string& LLWearable::getTypeName() const { - std::string r = llformat( "%.2f", f ); - - // "1.20" -> "1.2" - // "24.00" -> "24." - S32 len = r.length(); - while( len > 0 && '0' == r[len - 1] ) - { - r.erase(len-1, 1); - len--; - } - - if( '.' == r[len - 1] ) - { - // "24." -> "24" - r.erase(len-1, 1); - } - else - if( ('-' == r[0]) && ('0' == r[1]) ) - { - // "-0.59" -> "-.59" - r.erase(1, 1); - } - else - if( '0' == r[0] ) - { - // "0.59" -> ".59" - r.erase(0, 1); - } - - return r; + return LLWearableType::getTypeName(mType); } +LLAssetType::EType LLWearable::getAssetType() const +{ + return LLWearableType::getAssetType(mType); +} + + // reX: new function BOOL LLWearable::FileExportParams( FILE* file ) { @@ -244,7 +142,7 @@ BOOL LLWearable::FileExportTextures( FILE* file ) return TRUE; } -BOOL LLWearable::exportFile( LLFILE* file ) +BOOL LLWearable::exportFile(LLFILE* file) const { // header and version if( fprintf( file, "LLWearable version %d\n", mDefinitionVersion ) < 0 ) @@ -290,7 +188,7 @@ BOOL LLWearable::exportFile( LLFILE* file ) return FALSE; } - for (param_map_t::iterator iter = mVisualParamMap.begin(); + for (param_map_t::const_iterator iter = mVisualParamMap.begin(); iter != mVisualParamMap.end(); ++iter) { S32 param_id = iter->first; @@ -308,17 +206,16 @@ BOOL LLWearable::exportFile( LLFILE* file ) return FALSE; } - for (te_map_t::iterator iter = mTEMap.begin(); + for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) { S32 te = iter->first; - LLUUID& image_id = iter->second; + const LLUUID& image_id = iter->second; if( fprintf( file, "%d %s\n", te, image_id.asString().c_str()) < 0 ) { return FALSE; } } - return TRUE; } @@ -350,7 +247,7 @@ BOOL LLWearable::importFile( LLFILE* file ) } // name - char next_char = fgetc( file ); /* Flawfinder: ignore */ + int next_char = fgetc( file ); /* Flawfinder: ignore */ if( '\n' == next_char ) { // no name @@ -444,18 +341,17 @@ BOOL LLWearable::importFile( LLFILE* file ) llwarns << "Bad Wearable asset: bad type" << llendl; return FALSE; } - if( 0 <= type && type < WT_COUNT ) + if( 0 <= type && type < LLWearableType::WT_COUNT ) { - mType = (EWearableType)type; + setType((LLWearableType::EType)type); } else { - mType = WT_COUNT; + mType = LLWearableType::WT_COUNT; llwarns << "Bad Wearable asset: bad type #" << type << llendl; return FALSE; } - // parameters header S32 num_parameters = 0; fields_read = fscanf( file, "parameters %d\n", &num_parameters ); @@ -519,14 +415,9 @@ BOOL LLWearable::importFile( LLFILE* file ) // Avatar parameter and texture definitions can change over time. // This function returns true if parameters or textures have been added or removed // since this wearable was created. -BOOL LLWearable::isOldVersion() +BOOL LLWearable::isOldVersion() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) { @@ -540,9 +431,9 @@ BOOL LLWearable::isOldVersion() } 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->isTweakable()) ) { @@ -562,7 +453,7 @@ BOOL LLWearable::isOldVersion() S32 te_count = 0; for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_count++; if( !is_in_map(mTEMap, te ) ) @@ -586,19 +477,13 @@ BOOL LLWearable::isOldVersion() // * If parameters or textures have been ADDED since the wearable was created, // they are taken to have default values, so we consider the wearable clean // only if those values are the same as the defaults. -BOOL LLWearable::isDirty() +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->isTweakable()) ) { @@ -607,12 +492,12 @@ BOOL LLWearable::isDirty() U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() ); - if(avatar->getAppearanceFlag() == true) + if(gAgentAvatarp->getAppearanceFlag() == true) { //boob if(param->getID() == 507) { - weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualBoobGrav()); + weight = get_if_there(mVisualParamMap, param->getID(), gAgentAvatarp->getActualBoobGrav()); weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); } /*//butt @@ -634,17 +519,17 @@ BOOL LLWearable::isDirty() //boob if(param->getID() == 507) { - a = F32_to_U8( avatar->getActualBoobGrav(), param->getMinWeight(), param->getMaxWeight() ); + a = F32_to_U8( gAgentAvatarp->getActualBoobGrav(), param->getMinWeight(), param->getMaxWeight() ); } /*//butt if(param->getID() == 795) { - a = F32_to_U8( avatar->getActualButtGrav(), param->getMinWeight(), param->getMaxWeight() ); + a = F32_to_U8( gAgentAvatarp->getActualButtGrav(), param->getMinWeight(), param->getMaxWeight() ); } //fat if(param->getID() == 157) { - a = F32_to_U8( avatar->getActualFatGrav(), param->getMinWeight(), param->getMaxWeight() ); + a = F32_to_U8( gAgentAvatarp->getActualFatGrav(), param->getMinWeight(), param->getMaxWeight() ); } */ } @@ -661,15 +546,15 @@ BOOL LLWearable::isDirty() for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == mType ) { - LLViewerTexture* avatar_image = avatar->getTEImage( te ); + LLViewerTexture* avatar_image = gAgentAvatarp->getTEImage( te ); if( !avatar_image ) { llassert( 0 ); continue; } - const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); + const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) ); if( avatar_image->getID() != image_id ) { llwarns << "image ID " << avatar_image->getID() << " was changed." << llendl; @@ -692,15 +577,10 @@ BOOL LLWearable::isDirty() void LLWearable::setParamsToDefaults() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return; - } + if (!isAgentAvatarValid()) return; mVisualParamMap.clear(); - for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable()) ) { @@ -714,9 +594,9 @@ void LLWearable::setTexturesToDefaults() mTEMap.clear(); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { - mTEMap[te] = LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ); + mTEMap[te] = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te); } } } @@ -724,17 +604,12 @@ void LLWearable::setTexturesToDefaults() // Updates the user's avatar's appearance void LLWearable::writeToAvatar( BOOL set_by_user ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - 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() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->isTweakable()) ) { @@ -743,11 +618,11 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) //ZOMG: When switching shapes from inventory if(param_id == 507) - avatar->setActualBoobGrav(weight); + gAgentAvatarp->setActualBoobGrav(weight); /*if(param_id == 795) - avatar->setActualButtGrav(weight); + gAgentAvatarp->setActualButtGrav(weight); if(param_id == 157) - avatar->setActualFatGrav(weight); + gAgentAvatarp->setActualFatGrav(weight); */ // only animate with user-originated changes @@ -757,7 +632,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) } else { - avatar->setVisualParamWeight( param_id, weight, set_by_user ); + gAgentAvatarp->setVisualParamWeight( param_id, weight, set_by_user ); } } } @@ -765,21 +640,21 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) // only interpolate with user-originated changes if (set_by_user) { - avatar->startAppearanceAnimation(TRUE, TRUE); + gAgentAvatarp->startAppearanceAnimation(TRUE, TRUE); } // Pull texture entries for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { - const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); + const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) ); LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id ); - avatar->setLocTexTE( te, image, set_by_user ); + gAgentAvatarp->setLocTexTE( te, image, set_by_user ); } } - avatar->updateVisualParams(); + gAgentAvatarp->updateVisualParams(); if( gFloaterCustomize ) { @@ -800,13 +675,13 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) LLFloaterCustomize::setCurrentWearableType( mType ); } - ESex new_sex = avatar->getSex(); + ESex new_sex = gAgentAvatarp->getSex(); if( old_sex != new_sex ) { - avatar->updateSexDependentLayerSets( set_by_user ); + gAgentAvatarp->updateSexDependentLayerSets( set_by_user ); } - avatar->updateMeshTextures(); + gAgentAvatarp->updateMeshTextures(); // if( set_by_user ) // { @@ -816,31 +691,26 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) // Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values. // static -void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user ) +void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return; - } + if (!isAgentAvatarValid()) return; // You can't just remove body parts. - if( (type == WT_SHAPE) || - (type == WT_SKIN) || - (type == WT_HAIR) || - (type == WT_EYES) ) + if( (type == LLWearableType::WT_SHAPE) || + (type == LLWearableType::WT_SKIN) || + (type == LLWearableType::WT_HAIR) || + (type == LLWearableType::WT_EYES) ) { return; } // 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->isTweakable()) ) { S32 param_id = param->getID(); - avatar->setVisualParamWeight( param_id, param->getDefaultWeight(), set_by_user ); + gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake ); } } @@ -848,9 +718,9 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user ) LLViewerTexture* image =LLViewerTextureManager::getFetchedTexture( IMG_DEFAULT_AVATAR ); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == type ) + if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == type ) { - avatar->setLocTexTE( te, image, set_by_user ); + gAgentAvatarp->setLocTexTE( te, image, upload_bake ); } } @@ -859,21 +729,83 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user ) gFloaterCustomize->setWearable(type, NULL, PERM_ALL, TRUE); } - avatar->updateVisualParams(); - avatar->updateMeshTextures(); + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->updateMeshTextures(); -// if( set_by_user ) +// if( upload_bake ) // { // gAgent.sendAgentSetAppearance(); // } } +// Does not copy mAssetID. +// Definition version is current: removes obsolete enties and creates default values for new ones. +void LLWearable::copyDataFrom( LLWearable* src ) +{ + if (!isAgentAvatarValid()) return; + mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; + + mName = src->mName; + mDescription = src->mDescription; + mPermissions = src->mPermissions; + mSaleInfo = src->mSaleInfo; + setType(src->mType); + + // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) + for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) + { + if( (param->getWearableType() == mType) && (param->isTweakable()) ) + { + S32 id = param->getID(); + F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() ); + //llwarns << "------------------------------" << llendl; + //llwarns << "copydatafrom" << llendl; + //llwarns << "------------------------------" << llendl; + + //if(id == 507) + //{ + // llwarns << "weight = " << weight << llendl; + // llwarns << "actual = " << avatar->getActualBoobGrav() << llendl; + // llwarns << "mVisualParamMap[id] = " << mVisualParamMap[id] << llendl; + //} + + //pretty sure right + if(id == 507) + gAgentAvatarp->setActualBoobGrav(weight); + /*if(id == 795) + gAgentAvatarp->setActualButtGrav(weight); + if(id == 157) + gAgentAvatarp->setActualFatGrav(weight); + */ + + + mVisualParamMap[id] = weight; + } + } + + // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == mType ) + { + const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) ); + mTEMap[te] = image_id; + } + } +} + +void LLWearable::setType(LLWearableType::EType type) +{ + mType = type; +} // Updates asset from the user's avatar void LLWearable::readFromAvatar() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatar* avatar = gAgentAvatarp; llassert( avatar ); if( !avatar ) { @@ -910,7 +842,7 @@ void LLWearable::readFromAvatar() mTEMap.clear(); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == mType ) { LLViewerTexture* image = avatar->getTEImage( te ); if( image ) @@ -926,84 +858,19 @@ void LLWearable::readFromAvatar() //} } -// Does not copy mAssetID. -// Definition version is current: removes obsolete enties and creates default values for new ones. -void LLWearable::copyDataFrom( LLWearable* src ) -{ - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return; - } - mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; - - mName = src->mName; - mDescription = src->mDescription; - mPermissions = src->mPermissions; - mSaleInfo = src->mSaleInfo; - mType = src->mType; - - // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) - for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) - { - if( (param->getWearableType() == mType) && (param->isTweakable()) ) - { - S32 id = param->getID(); - F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() ); - //llwarns << "------------------------------" << llendl; - //llwarns << "copydatafrom" << llendl; - //llwarns << "------------------------------" << llendl; - - //if(id == 507) - //{ - // llwarns << "weight = " << weight << llendl; - // llwarns << "actual = " << avatar->getActualBoobGrav() << llendl; - // llwarns << "mVisualParamMap[id] = " << mVisualParamMap[id] << llendl; - //} - - //pretty sure right - if(id == 507) - avatar->setActualBoobGrav(weight); - /*if(id == 795) - avatar->setActualButtGrav(weight); - if(id == 157) - avatar->setActualFatGrav(weight); - */ - - - mVisualParamMap[id] = weight; - } - } - - // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) - { - const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); - mTEMap[te] = image_id; - } - } -} struct LLWearableSaveData { - EWearableType mType; + LLWearableType::EType mType; }; -void LLWearable::saveNewAsset() +void LLWearable::saveNewAsset() const { // llinfos << "LLWearable::saveNewAsset() type: " << getTypeName() << llendl; //llinfos << *this << llendl; - std::string new_asset_id_string; - mAssetID.toString(new_asset_id_string); - std::string filename; - filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl"; + const std::string filename = asset_id_to_filename(mAssetID); LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ BOOL successful_save = FALSE; if(fp && exportFile(fp)) @@ -1058,7 +925,7 @@ void LLWearable::saveNewAsset() void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLWearableSaveData* data = (LLWearableSaveData*)userdata; - const std::string& type_name = LLWearable::typeToTypeName(data->mType); + const std::string& type_name = LLWearableType::getTypeName(data->mType); if(0 == status) { // Success @@ -1074,10 +941,7 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda } // Delete temp file - std::string new_asset_id_string; - new_asset_id.toString(new_asset_id_string); - std::string src_filename; - src_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl"; + const std::string src_filename = asset_id_to_filename(new_asset_id); LLFile::remove(src_filename); // delete the context data @@ -1095,7 +959,7 @@ BOOL LLWearable::isMatchedToInventoryItem( LLViewerInventoryItem* item ) std::ostream& operator<<(std::ostream &s, const LLWearable &w) { - s << "wearable " << LLWearable::typeToTypeName( w.mType ) << "\n"; + s << "wearable " << LLWearableType::getTypeName( w.mType ) << "\n"; s << " Name: " << w.mName << "\n"; s << " Desc: " << w.mDescription << "\n"; //w.mPermissions @@ -1122,3 +986,40 @@ std::ostream& operator<<(std::ostream &s, const LLWearable &w) } +std::string terse_F32_to_string( F32 f ) +{ + std::string r = llformat("%.2f", f); + S32 len = r.length(); + + // "1.20" -> "1.2" + // "24.00" -> "24." + while (len > 0 && ('0' == r[len - 1])) + { + r.erase(len-1, 1); + len--; + } + if ('.' == r[len - 1]) + { + // "24." -> "24" + r.erase(len-1, 1); + } + else if (('-' == r[0]) && ('0' == r[1])) + { + // "-0.59" -> "-.59" + r.erase(1, 1); + } + else if ('0' == r[0]) + { + // "0.59" -> ".59" + r.erase(0, 1); + } + return r; +} + +std::string asset_id_to_filename(const LLUUID &asset_id) +{ + std::string asset_id_string; + asset_id.toString(asset_id_string); + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl"; + return filename; +} diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h index 1d63f2a6d..c206bc368 100644 --- a/indra/newview/llwearable.h +++ b/indra/newview/llwearable.h @@ -38,84 +38,67 @@ #include "llpermissions.h" #include "llsaleinfo.h" #include "llassetstorage.h" +#include "llwearabletype.h" class LLViewerInventoryItem; -enum EWearableType // If you change this, update LLWearable::getTypeName(), getTypeLabel(), and LLVOAvatar::getTEWearableType() -{ - WT_SHAPE = 0, - WT_SKIN = 1, - WT_HAIR = 2, - WT_EYES = 3, - WT_SHIRT = 4, - WT_PANTS = 5, - WT_SHOES = 6, - WT_SOCKS = 7, - WT_JACKET = 8, - WT_GLOVES = 9, - WT_UNDERSHIRT = 10, - WT_UNDERPANTS = 11, - WT_SKIRT = 12, - WT_ALPHA = 13, - WT_TATTOO = 14, - WT_PHYSICS = 15, - WT_COUNT = 16, - WT_INVALID = 255, - WT_NONE = -1, -}; - class LLWearable { friend class LLWearableList; -public: - ~LLWearable(); - const LLAssetID& getID() const { return mAssetID; } + //-------------------------------------------------------------------- + // Constructors and destructors + //-------------------------------------------------------------------- +private: + // Private constructor used by LLWearableList + LLWearable(const LLTransactionID& transactionID); + LLWearable(const LLAssetID& assetID); +public: + virtual ~LLWearable(); + + //-------------------------------------------------------------------- + // Accessors + //-------------------------------------------------------------------- +public: + const LLUUID& getItemID() const; + const LLAssetID& getAssetID() const { return mAssetID; } const LLTransactionID& getTransactionID() const { return mTransactionID; } - BOOL isDirty(); - BOOL isOldVersion(); - - void writeToAvatar( BOOL set_by_user ); - void readFromAvatar(); - void removeFromAvatar( BOOL set_by_user ) { LLWearable::removeFromAvatar( mType, set_by_user ); } - static void removeFromAvatar( EWearableType type, BOOL set_by_user ); - - BOOL exportFile(LLFILE* file); - BOOL importFile(LLFILE* file); BOOL FileExportParams(FILE* file); BOOL FileExportTextures(FILE* file); - EWearableType getType() const { return mType; } - void setType( EWearableType type ) { mType = type; } + LLWearableType::EType getType() const { return mType; } + void setType( LLWearableType::EType type ); + const std::string& getName() const { return mName; } + void setName( const std::string& name ) { mName = name; } + const std::string& getDescription() const { return mDescription; } + void setDescription( const std::string& desc ) { mDescription = desc; } + const LLPermissions& getPermissions() const { return mPermissions; } + void setPermissions( const LLPermissions& p ) { mPermissions = p; } + const LLSaleInfo& getSaleInfo() const { return mSaleInfo; } + - void setName( const std::string& name ) { mName = name; } - const std::string& getName() const { return mName; } + void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; } + const std::string& getTypeLabel() const; + const std::string& getTypeName() const; + LLAssetType::EType getAssetType() const; - void setDescription( const std::string& desc ) { mDescription = desc; } - const std::string& getDescription() const { return mDescription; } + BOOL isDirty() const; + BOOL isOldVersion() const; - void setPermissions( const LLPermissions& p ) { mPermissions = p; } - const LLPermissions& getPermissions() const { return mPermissions; } + void writeToAvatar( BOOL set_by_user ); + void readFromAvatar(); + void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); } + static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ); - void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; } - const LLSaleInfo& getSaleInfo() const { return mSaleInfo; } - - const std::string& getTypeLabel() const { return LLWearable::sTypeLabel[ mType ]; } - const std::string& getTypeName() const { return LLWearable::sTypeName[ mType ]; } + BOOL exportFile(LLFILE* file) const; + BOOL importFile(LLFILE* file); void setParamsToDefaults(); void setTexturesToDefaults(); - LLAssetType::EType getAssetType() const { return LLWearable::typeToAssetType( mType ); } - - static EWearableType typeNameToType( const std::string& type_name ); - static const std::string& typeToTypeName( EWearableType type ) { return LLWearable::sTypeName[llmin(type,WT_COUNT)]; } - static const std::string& typeToTypeLabel( EWearableType type ) { return LLWearable::sTypeLabel[llmin(type,WT_COUNT)]; } - static LLAssetType::EType typeToAssetType( EWearableType wearable_type ); - - void saveNewAsset(); + void saveNewAsset() const; static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status ); BOOL isMatchedToInventoryItem( LLViewerInventoryItem* item ); @@ -126,10 +109,6 @@ public: friend std::ostream& operator<<(std::ostream &s, const LLWearable &w); -private: - // Private constructor used by LLWearableList - LLWearable(const LLTransactionID& transactionID); - LLWearable(const LLAssetID& assetID); static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. @@ -139,15 +118,12 @@ private: LLSaleInfo mSaleInfo; LLAssetID mAssetID; LLTransactionID mTransactionID; - EWearableType mType; + LLWearableType::EType mType; typedef std::map param_map_t; param_map_t mVisualParamMap; // maps visual param id to weight typedef std::map te_map_t; te_map_t mTEMap; // maps TE to Image ID - - static const std::string sTypeName[ WT_COUNT+1 ]; - static const std::string sTypeLabel[ WT_COUNT+1 ]; }; #endif // LL_LLWEARABLE_H diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 7b514cf04..1e6f65136 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -125,7 +125,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID bool res = wearable->importFile( fp ); if (!res) { - if (wearable->getType() == WT_COUNT) + if (wearable->getType() == LLWearableType::WT_COUNT) { isNewWearable = TRUE; } @@ -271,7 +271,7 @@ LLWearable* LLWearableList::createCopy( LLWearable* old_wearable ) return wearable; } -LLWearable* LLWearableList::createNewWearable( EWearableType type ) +LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) { lldebugs << "LLWearableList::createNewWearable()" << llendl; diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index 8edba5b25..c2a13eb66 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -54,7 +54,7 @@ public: LLWearable* createWearableMatchedToInventoryItem( LLWearable* old_wearable, LLViewerInventoryItem* item ); LLWearable* createCopyFromAvatar( LLWearable* old_wearable, const std::string& new_name = std::string() ); LLWearable* createCopy( LLWearable* old_wearable ); - LLWearable* createNewWearable( EWearableType type ); + LLWearable* createNewWearable( LLWearableType::EType type ); // Callback static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status); diff --git a/indra/newview/llwearabletype.cpp b/indra/newview/llwearabletype.cpp new file mode 100644 index 000000000..44c1d1e93 --- /dev/null +++ b/indra/newview/llwearabletype.cpp @@ -0,0 +1,122 @@ +/** + * @file llwearabletype.cpp + * @brief LLWearableType class implementation + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llwearabletype.h" +#include "lltrans.h" + +struct WearableEntry : public LLDictionaryEntry +{ + WearableEntry(const std::string &name, + const std::string& default_new_name, + LLAssetType::EType assetType) : + LLDictionaryEntry(name), + mAssetType(assetType), + mDefaultNewName(default_new_name), + mLabel(/*(LLTrans::getString*/(name)) + { + + } + const LLAssetType::EType mAssetType; + const std::string mLabel; + const std::string mDefaultNewName; //keep mLabel for backward compatibility +}; + +class LLWearableDictionary : public LLSingleton, + public LLDictionary +{ +public: + LLWearableDictionary(); +}; + +LLWearableDictionary::LLWearableDictionary() +{ + addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART)); + addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART)); + addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART)); + addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART)); + addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING)); + addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING)); + + addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING)); + + addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE)); + addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE)); +} + +// static +LLWearableType::EType LLWearableType::typeNameToType(const std::string& type_name) +{ + const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); + const LLWearableType::EType wearable = dict->lookup(type_name); + return wearable; +} + +// static +const std::string& LLWearableType::getTypeName(LLWearableType::EType type) +{ + const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); + const WearableEntry *entry = dict->lookup(type); + if (!entry) return getTypeName(WT_INVALID); + return entry->mName; +} + +//static +const std::string& LLWearableType::getTypeDefaultNewName(LLWearableType::EType type) +{ + const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); + const WearableEntry *entry = dict->lookup(type); + if (!entry) return getTypeDefaultNewName(WT_INVALID); + return entry->mDefaultNewName; +} + +// static +const std::string& LLWearableType::getTypeLabel(LLWearableType::EType type) +{ + const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); + const WearableEntry *entry = dict->lookup(type); + if (!entry) return getTypeLabel(WT_INVALID); + return entry->mLabel; +} + +// static +LLAssetType::EType LLWearableType::getAssetType(LLWearableType::EType type) +{ + const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); + const WearableEntry *entry = dict->lookup(type); + if (!entry) return getAssetType(WT_INVALID); + return entry->mAssetType; +} + diff --git a/indra/newview/llwearabletype.h b/indra/newview/llwearabletype.h new file mode 100644 index 000000000..602fae71d --- /dev/null +++ b/indra/newview/llwearabletype.h @@ -0,0 +1,73 @@ +/** + * @file llwearabletype.h + * @brief LLWearableType class header file + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLWEARABLETYPE_H +#define LL_LLWEARABLETYPE_H + +#include "llassettype.h" +#include "lldictionary.h" +#include "llsingleton.h" + +class LLWearableType +{ +public: + enum EType + { + WT_SHAPE = 0, + WT_SKIN = 1, + WT_HAIR = 2, + WT_EYES = 3, + WT_SHIRT = 4, + WT_PANTS = 5, + WT_SHOES = 6, + WT_SOCKS = 7, + WT_JACKET = 8, + WT_GLOVES = 9, + WT_UNDERSHIRT = 10, + WT_UNDERPANTS = 11, + WT_SKIRT = 12, + WT_ALPHA = 13, + WT_TATTOO = 14, + WT_PHYSICS = 15, + WT_COUNT = 16, + + WT_INVALID = 255, + WT_NONE = -1, + }; + + static const std::string& getTypeName(EType type); + static const std::string& getTypeDefaultNewName(EType type); + static const std::string& getTypeLabel(EType type); + static LLAssetType::EType getAssetType(EType type); + static EType typeNameToType(const std::string& type_name); + +protected: + LLWearableType() {} + ~LLWearableType() {} +}; + + +#endif // LL_LLWEARABLETYPE_H diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8f8eab62d..2612bf1e2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -316,10 +316,8 @@ void validate_framebuffer_object(); bool addDeferredAttachments(LLRenderTarget& target) { - bool ret1 = target.addColorAttachment(GL_RGBA); - bool ret2 = target.addColorAttachment(GL_RGBA); - return ret1 && //specular - ret2; //normal+z + return target.addColorAttachment(GL_RGBA) && //specular + target.addColorAttachment(GL_RGBA); //normal+z } LLPipeline::LLPipeline() : @@ -2390,7 +2388,8 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) llassert(vobj); // trying to catch a bad assumption if (vobj) // this test may not be needed, see above { - if (vobj->isAvatar() && ((LLVOAvatar*)vobj)->isImpostor()) + const LLVOAvatar* av = vobj->asAvatar(); + if (av && av->isImpostor()) { return; } @@ -2839,6 +2838,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) { + llassert_always(drawablep->isVisible()); /*LLSpatialGroup* group = drawablep->getSpatialGroup(); if (!group || group->changeLOD()) { @@ -4271,7 +4271,7 @@ void LLPipeline::rebuildPools() if (isAgentAvatarValid()) { - gAgent.getAvatarObject()->rebuildHUD(); + gAgentAvatarp->rebuildHUD(); } } @@ -4962,8 +4962,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) light->setAmbient(LLColor4::black); light->setSpecular(LLColor4::black); } - if (isAgentAvatarValid() && - gAgent.getAvatarObject()->mSpecialRenderMode == 3) + if (gAgentAvatarp && + gAgentAvatarp->mSpecialRenderMode == 3) { LLColor4 light_color = LLColor4::white; light_color.mV[3] = 0.0f; @@ -5066,16 +5066,13 @@ void LLPipeline::enableLightsDynamic() U32 mask = 0xff & (~2); // Local lights enableLights(mask); - - 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)); } @@ -7735,15 +7732,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) { if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) { - LLVOAvatar* agent = gAgent.getAvatarObject(); + BOOL skip_avatar_update = FALSE; if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) { - agent = NULL; + skip_avatar_update = TRUE; } - if (agent) + if (!skip_avatar_update) { - agent->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); + gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); } LLVertexBuffer::unbind(); @@ -7969,9 +7966,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) //LLGLState::checkTextureChannels(); //LLGLState::checkClientArrays(); - if (agent) + if (!skip_avatar_update) { - agent->updateAttachmentVisibility(gAgentCamera.getCameraMode()); + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); } LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; diff --git a/indra/newview/rlvextensions.cpp b/indra/newview/rlvextensions.cpp index 818eb9f34..11e89f0e9 100644 --- a/indra/newview/rlvextensions.cpp +++ b/indra/newview/rlvextensions.cpp @@ -218,8 +218,8 @@ std::string RlvExtGetSet::onGetPseudoDebug(const std::string& strSetting) } else { - if (gAgent.getAvatarObject()) - return llformat("%d", (gAgent.getAvatarObject()->getSex() == SEX_MALE)); // [See LLFloaterCustomize::LLFloaterCustomize()] + if (gAgentAvatarp) + return llformat("%d", (gAgentAvatarp->getSex() == SEX_MALE)); // [See LLFloaterCustomize::LLFloaterCustomize()] } } return std::string(); diff --git a/indra/newview/rlvfloaterbehaviour.cpp b/indra/newview/rlvfloaterbehaviour.cpp index c8f33f5e0..072bc7e98 100644 --- a/indra/newview/rlvfloaterbehaviour.cpp +++ b/indra/newview/rlvfloaterbehaviour.cpp @@ -39,11 +39,11 @@ std::string rlvGetItemNameFromObjID(const LLUUID& idObj, bool fIncludeAttachPt = const LLViewerInventoryItem* pItem = ((pObjRoot) && (pObjRoot->isAttachment())) ? gInventory.getItem(pObjRoot->getAttachmentItemID()) : NULL; std::string strItemName = (pItem) ? pItem->getName() : idObj.asString(); - if ( (!fIncludeAttachPt) || (!pObj) || (!pObj->isAttachment()) || (!gAgent.getAvatarObject()) ) + if ( (!fIncludeAttachPt) || (!pObj) || (!pObj->isAttachment()) || (!gAgentAvatarp) ) return strItemName; const LLViewerJointAttachment* pAttachPt = - get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, RlvAttachPtLookup::getAttachPointIndex(pObjRoot), (LLViewerJointAttachment*)NULL); + get_if_there(gAgentAvatarp->mAttachmentPoints, RlvAttachPtLookup::getAttachPointIndex(pObjRoot), (LLViewerJointAttachment*)NULL); std::string strAttachPtName = (pAttachPt) ? pAttachPt->getName() : std::string("Unknown"); return llformat("%s (%s, %s)", strItemName.c_str(), strAttachPtName.c_str(), (pObj == pObjRoot) ? "root" : "child"); } @@ -70,7 +70,7 @@ void RlvFloaterBehaviour::refreshAll() return; pBhvrList->operateOnAll(LLCtrlListInterface::OP_DELETE); - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) return; // diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index eb9b26305..2bd383487 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -735,18 +735,18 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const // Example: #RLV/Separates/Shoes/ChiChi Pumps/.[shoes] with items: "Shoe Base", "Shoe (left foot)" and "Shoe (right foot)" // -> as long as "Shoe Base" is worn, @getattach should not reflect "left foot", nor "right foot" std::string strComposite; LLViewerInventoryCategory* pFolder; - EWearableType type; S32 idxAttachPt; + LLWearableType::EType type; S32 idxAttachPt; if ( (getCompositeInfo(idItem, &strComposite, &pFolder)) && (cstrItemType != strComposite) ) { LLUUID idCompositeItem; - if ((type = LLWearable::typeNameToType(strComposite)) != WT_INVALID) + if ((type = LLWearable::typeNameToType(strComposite)) != LLWearableType::WT_NONE) { idCompositeItem = gAgentWearables.getWearableItemID(type); } else if ((idxAttachPt = getAttachPointIndex(strComposite, true)) != 0) { LLVOAvatar* pAvatar; LLViewerJointAttachment* pAttachmentPt; - if ( ((pAvatar = gAgent.getAvatarObject()) != NULL) && + if ( ((pAvatar = gAgentAvatarp) != NULL) && ((pAttachmentPt = get_if_there(pAvatar->mAttachmentPoints, idxAttachPt, (LLViewerJointAttachment*)NULL)) != NULL) ) { idCompositeItem = pAttachmentPt->getItemID(); @@ -765,7 +765,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const bool RlvHandler::canTakeOffComposite(const LLInventoryCategory* pFolder) const { // Sanity check - if there's no folder or no avatar then there is nothing to take off - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (!pFolder) || (!pAvatar) ) return false; // Sanity check - if nothing is locked then we can definitely take it off @@ -808,7 +808,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const bool RlvHandler::canWearComposite(const LLInventoryCategory* pFolder) const { // Sanity check - if there's no folder or no avatar then there is nothing to wear - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (!pFolder) || (!pAvatar) ) return false; // Sanity check - if nothing is locked then we can definitely wear it @@ -837,7 +837,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const case LLAssetType::AT_CLOTHING: { // NOTE: without its asset we don't know what type the wearable is so we need to look at the item's flags instead - EWearableType wtType = (EWearableType)(pItem->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); + LLWearableType::EType wtType = (LLWearableType::EType)(pItem->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); LLViewerInventoryCategory* pFolder; if ( (!isWearable(wtType)) || ( (gAgent.getWearable(wtType)) && (!isRemovable(wtType)) ) || @@ -956,14 +956,14 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) RlvForceWear::instance().done(); ERlvLockMask eLock = (RLV_BHVR_ADDOUTFIT == eBhvr) ? RLV_LOCK_ADD : RLV_LOCK_REMOVE; - for (int idxType = 0; idxType < WT_COUNT; idxType++) + for (int idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++) { - if ( (rlvCmdOption.isEmpty()) || ((EWearableType)idxType == rlvCmdOption.getWearableType()) ) + if ( (rlvCmdOption.isEmpty()) || ((LLWearableType::EType)idxType == rlvCmdOption.getWearableType()) ) { if (RLV_TYPE_ADD == eType) - gRlvWearableLocks.addWearableTypeLock((EWearableType)idxType, rlvCmd.getObjectID(), eLock); + gRlvWearableLocks.addWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock); else - gRlvWearableLocks.removeWearableTypeLock((EWearableType)idxType, rlvCmd.getObjectID(), eLock); + gRlvWearableLocks.removeWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock); } } } @@ -1292,7 +1292,7 @@ ERlvCmdRet RlvHandler::onAddRemAttach(const RlvCommand& rlvCmd, bool& fRefCount) if ( (!idxAttachPt) && (!rlvCmd.getOption().empty()) ) return RLV_RET_FAILED_OPTION; - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if (!pAvatar) return RLV_RET_FAILED; @@ -1431,7 +1431,7 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const case RLV_BHVR_UNSIT: // @unsit=force - Checked: 2010-03-18 (RLVa-1.2.0c) | Modified: RLVa-0.2.0g { VERIFY_OPTION(rlvCmd.getOption().empty()); - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if ( (pAvatar) && (pAvatar->isSitting()) && (!hasBehaviourExcept(RLV_BHVR_UNSIT, rlvCmd.getObjectID())) ) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); @@ -1522,7 +1522,7 @@ ERlvCmdRet RlvHandler::onForceRemAttach(const RlvCommand& rlvCmd) const RLV_ASSERT(RLV_TYPE_FORCE == rlvCmd.getParamType()); RLV_ASSERT( (RLV_BHVR_REMATTACH == rlvCmd.getBehaviourType()) || (RLV_BHVR_DETACH == rlvCmd.getBehaviourType()) ); - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if (!pAvatar) return RLV_RET_FAILED; @@ -1559,10 +1559,10 @@ ERlvCmdRet RlvHandler::onForceRemOutfit(const RlvCommand& rlvCmd) const if ( (!rlvCmdOption.isWearableType()) && (!rlvCmdOption.isEmpty()) ) return RLV_RET_FAILED_OPTION; - for (int idxType = 0; idxType < WT_COUNT; idxType++) + for (int idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++) { - if ( (rlvCmdOption.isEmpty()) || ((EWearableType)idxType == rlvCmdOption.getWearableType())) - RlvForceWear::instance().forceRemove((EWearableType)idxType); + if ( (rlvCmdOption.isEmpty()) || ((LLWearableType::EType)idxType == rlvCmdOption.getWearableType())) + RlvForceWear::instance().forceRemove((LLWearableType::EType)idxType); } return RLV_RET_SUCCESS; } @@ -1577,9 +1577,9 @@ ERlvCmdRet RlvHandler::onForceSit(const RlvCommand& rlvCmd) const if (!canSit(pObj)) return RLV_RET_FAILED_LOCK; - else if ( (hasBehaviour(RLV_BHVR_STANDTP)) && (gAgent.getAvatarObject()) ) + else if ( (hasBehaviour(RLV_BHVR_STANDTP)) && (gAgentAvatarp) ) { - if (gAgent.getAvatarObject()->isSitting()) + if (gAgentAvatarp->isSitting()) return RLV_RET_FAILED_LOCK; m_posSitSource = gAgent.getPositionGlobal(); } @@ -1693,7 +1693,7 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const case RLV_BHVR_GETSITID: // @getsitid= - Checked: 2009-11-26 (RLVa-1.1.0f) { // NOTE: RLV 1.16.1 returns a NULL UUID if we're not sitting - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); LLUUID idSitObj; + LLVOAvatar* pAvatar = gAgentAvatarp; LLUUID idSitObj; if ( (pAvatar) && (pAvatar->isSitting()) ) { // LLVOAvatar inherits from 2 classes so make sure we get the right vfptr @@ -1795,7 +1795,7 @@ ERlvCmdRet RlvHandler::onGetAttach(const RlvCommand& rlvCmd, std::string& strRep RLV_ASSERT(RLV_TYPE_REPLY == rlvCmd.getParamType()); RLV_ASSERT(RLV_BHVR_GETATTACH == rlvCmd.getBehaviourType()); - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if (!pAvatar) return RLV_RET_FAILED; @@ -1829,7 +1829,7 @@ ERlvCmdRet RlvHandler::onGetAttachNames(const RlvCommand& rlvCmd, std::string& s RLV_ASSERT( (RLV_BHVR_GETATTACHNAMES == rlvCmd.getBehaviourType()) || (RLV_BHVR_GETADDATTACHNAMES == rlvCmd.getBehaviourType()) || (RLV_BHVR_GETREMATTACHNAMES == rlvCmd.getBehaviourType()) ); - LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + LLVOAvatar* pAvatar = gAgentAvatarp; if (!pAvatar) return RLV_RET_FAILED; @@ -1910,7 +1910,7 @@ struct rlv_wear_info { U32 cntWorn, cntTotal, cntChildWorn, cntChildTotal; }; ERlvCmdRet RlvHandler::onGetInvWorn(const RlvCommand& rlvCmd, std::string& strReply) const { // Sanity check - gAgentAvatarp can't be NULL [see RlvForceWearLegacy::isWearingItem()] - if (!gAgent.getAvatarObject()) + if (!gAgentAvatarp) return RLV_RET_FAILED; // Sanity check - folder should exist LLViewerInventoryCategory* pFolder = RlvInventory::instance().getSharedFolder(rlvCmd.getOption()); @@ -1988,25 +1988,25 @@ ERlvCmdRet RlvHandler::onGetOutfit(const RlvCommand& rlvCmd, std::string& strRep RLV_ASSERT(RLV_BHVR_GETOUTFIT == rlvCmd.getBehaviourType()); // (Compatibility: RLV-1.16.1 will execute @getoutfit= if is invalid while we just return failure) - EWearableType wtType = LLWearable::typeNameToType(rlvCmd.getOption()); - if ( (WT_INVALID == wtType) && (!rlvCmd.getOption().empty()) ) + LLWearableType::EType wtType = LLWearableType::typeNameToType(rlvCmd.getOption()); + if ( (LLWearableType::WT_NONE == wtType) && (!rlvCmd.getOption().empty()) ) return RLV_RET_FAILED_OPTION; - const EWearableType wtRlvTypes[] = + const LLWearableType::EType wtRlvTypes[] = { - WT_GLOVES, WT_JACKET, WT_PANTS, WT_SHIRT, WT_SHOES, WT_SKIRT, WT_SOCKS, - WT_UNDERPANTS, WT_UNDERSHIRT, WT_SKIN, WT_EYES, WT_HAIR, WT_SHAPE, WT_ALPHA, WT_TATTOO, WT_PHYSICS + LLWearableType::WT_GLOVES, LLWearableType::WT_JACKET, LLWearableType::WT_PANTS, LLWearableType::WT_SHIRT, LLWearableType::WT_SHOES, LLWearableType::WT_SKIRT, LLWearableType::WT_SOCKS, + LLWearableType::WT_UNDERPANTS, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_SKIN, LLWearableType::WT_EYES, LLWearableType::WT_HAIR, LLWearableType::WT_SHAPE, LLWearableType::WT_ALPHA, LLWearableType::WT_TATTOO, LLWearableType::WT_PHYSICS }; - for (int idxType = 0, cntType = sizeof(wtRlvTypes) / sizeof(EWearableType); idxType < cntType; idxType++) + for (int idxType = 0; idxType < sizeof(wtRlvTypes) / sizeof(wtRlvTypes[0]); ++idxType) { - if ( (WT_INVALID == wtType) || (wtRlvTypes[idxType] == wtType) ) + if ( (LLWearableType::WT_NONE == wtType) || (wtRlvTypes[idxType] == wtType) ) { // We never hide body parts, even if they're "locked" and we're hiding locked layers // (nor do we hide a layer if the issuing object is the only one that has this layer locked) bool fWorn = (gAgentWearables.getWearable(wtRlvTypes[idxType])) && ( (!RlvSettings::getHideLockedLayers()) || - (LLAssetType::AT_BODYPART == LLWearable::typeToAssetType(wtRlvTypes[idxType])) || + (LLAssetType::AT_BODYPART == LLWearableType::getAssetType(wtRlvTypes[idxType])) || (RlvForceWear::isForceRemovable(wtRlvTypes[idxType], true, rlvCmd.getObjectID())) ); strReply.push_back( (fWorn) ? '1' : '0' ); } @@ -2026,9 +2026,9 @@ ERlvCmdRet RlvHandler::onGetOutfitNames(const RlvCommand& rlvCmd, std::string& s return RLV_RET_FAILED_OPTION; // RELEASE-RLVa: [SL-2.0.0] Needs revisiting/rewriting once 'LLAgentWearables::MAX_WEARABLES_PER_TYPE > 1' - for (int idxType = 0; idxType < WT_COUNT; idxType++) + for (int idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++) { - bool fAdd = false; EWearableType wtType = (EWearableType)idxType; + bool fAdd = false; LLWearableType::EType wtType = (LLWearableType::EType)idxType; switch (rlvCmd.getBehaviourType()) { case RLV_BHVR_GETOUTFITNAMES: // Every layer that's worn @@ -2050,7 +2050,7 @@ ERlvCmdRet RlvHandler::onGetOutfitNames(const RlvCommand& rlvCmd, std::string& s { if (!strReply.empty()) strReply.push_back(','); - strReply.append(LLWearable::typeToTypeName((EWearableType)idxType)); + strReply.append(LLWearableType::getTypeName((LLWearableType::EType)idxType)); } } return RLV_RET_SUCCESS; diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index 69f8ad703..5df0a790a 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -244,7 +244,7 @@ inline bool RlvHandler::canSit(LLViewerObject* pObj, const LLVector3& posOffset ( (pObj) && (LL_PCODE_VOLUME == pObj->getPCode()) ) && (!hasBehaviour(RLV_BHVR_SIT)) && ( ((!hasBehaviour(RLV_BHVR_UNSIT)) && (!hasBehaviour(RLV_BHVR_STANDTP))) || - ((gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->isSitting())) ) && + ((gAgentAvatarp) && (!gAgentAvatarp->isSitting())) ) && ( ((NULL == getCurrentCommand() || (RLV_BHVR_SIT != getCurrentCommand()->getBehaviourType())) ? ((!hasBehaviour(RLV_BHVR_SITTP)) && (!hasBehaviour(RLV_BHVR_FARTOUCH))) // [regular sit] : (!hasBehaviourExcept(RLV_BHVR_SITTP, getCurrentObject()))) || // [force sit] @@ -255,7 +255,7 @@ inline bool RlvHandler::canSit(LLViewerObject* pObj, const LLVector3& posOffset inline bool RlvHandler::canStand() const { // NOTE: return FALSE only if we're @unsit=n restricted and the avie is currently sitting on something and TRUE for everything else - return (!hasBehaviour(RLV_BHVR_UNSIT)) || ((gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->isSitting())); + return (!hasBehaviour(RLV_BHVR_UNSIT)) || ((gAgentAvatarp) && (!gAgentAvatarp->isSitting())); } // Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index b7959c31b..dba0db371 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -183,12 +183,12 @@ void RlvCommand::initLookupTable() // Checked: 2010-09-28 (RLVa-1.1.3a) | Added: RLVa-1.2.1c RlvCommandOptionGeneric::RlvCommandOptionGeneric(const std::string& strOption) { - EWearableType wtType(WT_INVALID); LLUUID idOption; ERlvAttachGroupType eAttachGroup(RLV_ATTACHGROUP_INVALID); + LLWearableType::EType wtType(LLWearableType::WT_INVALID); LLUUID idOption; ERlvAttachGroupType eAttachGroup(RLV_ATTACHGROUP_INVALID); LLViewerJointAttachment* pAttachPt = NULL; LLViewerInventoryCategory* pFolder = NULL; if (!(m_fEmpty = strOption.empty())) //