diff options
Diffstat (limited to 'indra')
195 files changed, 3563 insertions, 3469 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 272b4092a9..1486024538 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -65,9 +65,7 @@ if (WINDOWS) # http://www.cmake.org/pipermail/cmake/2009-September/032143.html string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - # zlib has assembly-language object files incompatible with SAFESEH add_link_options(/LARGEADDRESSAWARE - /SAFESEH:NO /NODEFAULTLIB:LIBCMT /IGNORE:4099) @@ -86,6 +84,7 @@ if (WINDOWS) /Oy- /fp:fast /MP + /permissive- ) # Nicky: x64 implies SSE2 diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake index 21139319c3..97b316c4c7 100644 --- a/indra/cmake/APR.cmake +++ b/indra/cmake/APR.cmake @@ -18,6 +18,7 @@ if (WINDOWS) ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apr-1.lib ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}aprutil-1.lib ) + target_compile_definitions( ll::apr INTERFACE APR_DECLARE_STATIC=1 APU_DECLARE_STATIC=1 API_DECLARE_STATIC=1) elseif (DARWIN) if (LLCOMMON_LINK_SHARED) set(APR_selector "0.dylib") @@ -28,16 +29,15 @@ elseif (DARWIN) endif (LLCOMMON_LINK_SHARED) target_link_libraries( ll::apr INTERFACE - libapr-1.${APR_selector} - libaprutil-1.${APRUTIL_selector} + ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.${APR_selector} + ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.${APR_selector} iconv ) -else (WINDOWS) +else() target_link_libraries( ll::apr INTERFACE - apr-1 - aprutil-1 - uuid + ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.a + ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.a rt ) -endif (WINDOWS) +endif () target_include_directories( ll::apr SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/apr-1 ) diff --git a/indra/cmake/CURL.cmake b/indra/cmake/CURL.cmake index b9f685f37b..eea0a2da62 100644 --- a/indra/cmake/CURL.cmake +++ b/indra/cmake/CURL.cmake @@ -1,5 +1,6 @@ # -*- cmake -*- include(Prebuilt) +include(Linking) include_guard() add_library( ll::libcurl INTERFACE IMPORTED ) @@ -7,8 +8,18 @@ add_library( ll::libcurl INTERFACE IMPORTED ) use_system_binary(libcurl) use_prebuilt_binary(curl) if (WINDOWS) - target_link_libraries(ll::libcurl INTERFACE libcurl.lib) -else (WINDOWS) - target_link_libraries(ll::libcurl INTERFACE libcurl.a) -endif (WINDOWS) + target_link_libraries(ll::libcurl INTERFACE + ${ARCH_PREBUILT_DIRS_RELEASE}/libcurl.lib + ll::openssl + ll::nghttp2 + ll::zlib-ng + ) +else () + target_link_libraries(ll::libcurl INTERFACE + ${ARCH_PREBUILT_DIRS_RELEASE}/libcurl.a + ll::openssl + ll::nghttp2 + ll::zlib-ng + ) +endif () target_include_directories( ll::libcurl SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 4626e9d0d9..ced012426f 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -54,19 +54,12 @@ if(WINDOWS) set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(release_files openjp2.dll - libapr-1.dll - libaprutil-1.dll - nghttp2.dll ) - # OpenSSL - if(ADDRESS_SIZE EQUAL 64) - set(release_files ${release_files} libcrypto-1_1-x64.dll) - set(release_files ${release_files} libssl-1_1-x64.dll) - else(ADDRESS_SIZE EQUAL 64) - set(release_files ${release_files} libcrypto-1_1.dll) - set(release_files ${release_files} libssl-1_1.dll) - endif(ADDRESS_SIZE EQUAL 64) + if(LLCOMMON_LINK_SHARED) + set(release_files ${release_files} libapr-1.dll) + set(release_files ${release_files} libaprutil-1.dll) + endif() # Filenames are different for 32/64 bit BugSplat file and we don't # have any control over them so need to branch. @@ -162,10 +155,6 @@ if(WINDOWS) MESSAGE(STATUS "Redist lib ${release_msvc_file} not found") endif() endforeach() - MESSAGE(STATUS "Will copy redist files for MSVC ${MSVC_VER}:") - foreach(target ${third_party_targets}) - MESSAGE(STATUS "${target}") - endforeach() elseif(DARWIN) set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") @@ -179,16 +168,18 @@ elseif(DARWIN) ) set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(release_files - libapr-1.0.dylib - libapr-1.dylib - libaprutil-1.0.dylib - libaprutil-1.dylib - ${EXPAT_COPY} libndofdev.dylib - libnghttp2.dylib - libnghttp2.14.dylib ) + if(LLCOMMON_LINK_SHARED) + set(release_files ${release_files} + libapr-1.0.dylib + libapr-1.dylib + libaprutil-1.0.dylib + libaprutil-1.dylib + ) + endif() + if (TARGET ll::openal) list(APPEND release_files libalut.dylib libopenal.dylib) endif () @@ -219,14 +210,20 @@ elseif(LINUX) set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") # *FIX - figure out what to do with duplicate libalut.so here -brad set(release_files - ${EXPAT_COPY} - ) + ) if( USE_AUTOBUILD_3P ) list( APPEND release_files libapr-1.so.0 libaprutil-1.so.0 ) + + if(LLCOMMON_LINK_SHARED) + set(release_files ${release_files} + libapr-1.so.0 + libaprutil-1.so.0 + ) + endif() endif() else(WINDOWS) diff --git a/indra/cmake/EXPAT.cmake b/indra/cmake/EXPAT.cmake index 327fe8aa72..1a0b8789dc 100644 --- a/indra/cmake/EXPAT.cmake +++ b/indra/cmake/EXPAT.cmake @@ -7,14 +7,13 @@ add_library( ll::expat INTERFACE IMPORTED ) use_system_binary(expat) use_prebuilt_binary(expat) if (WINDOWS) - target_link_libraries( ll::expat INTERFACE libexpatMT ) - set(EXPAT_COPY libexpatMT.dll) -else (WINDOWS) - target_link_libraries( ll::expat INTERFACE expat ) - if (DARWIN) - set(EXPAT_COPY libexpat.1.dylib libexpat.dylib) - else () - set(EXPAT_COPY libexpat.so.1 libexpat.so) - endif () -endif (WINDOWS) + target_compile_definitions( ll::expat INTERFACE XML_STATIC=1) + target_link_libraries( ll::expat INTERFACE + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libexpatd.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.lib) +else () + target_link_libraries( ll::expat INTERFACE + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libexpat.a + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.a) +endif () target_include_directories( ll::expat SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include ) diff --git a/indra/cmake/FreeType.cmake b/indra/cmake/FreeType.cmake index e7e28a44d0..47ac96f793 100644 --- a/indra/cmake/FreeType.cmake +++ b/indra/cmake/FreeType.cmake @@ -1,14 +1,19 @@ # -*- cmake -*- include(Prebuilt) +include(Linking) include_guard() add_library( ll::freetype INTERFACE IMPORTED ) - use_system_binary(freetype) - use_prebuilt_binary(freetype) - target_include_directories( ll::freetype SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/freetype2/) -if( LINUX ) +use_system_binary(freetype) +use_prebuilt_binary(freetype) +target_include_directories( ll::freetype SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/freetype2/) + +if (WINDOWS) + target_link_libraries( ll::freetype INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/freetype.lib) +elseif( LINUX ) target_link_libraries( ll::freetype INTERFACE ${LIBS_PREBUILT_DIR}/lib/release/libfreetype.a ${LIBS_PREBUILT_DIR}/lib/release/libpng16.a) else() - target_link_libraries( ll::freetype INTERFACE freetype ) + target_link_libraries( ll::freetype INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libfreetype.a) endif() + diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 1e81532551..d0a52ffb63 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -2,6 +2,7 @@ # these should be moved to their own cmake file include(Prebuilt) +include(Linking) include(Boost) include_guard() @@ -24,15 +25,15 @@ use_prebuilt_binary(minizip-ng) # needed for colladadom use_prebuilt_binary(libxml2) if (WINDOWS) - target_link_libraries( ll::minizip-ng INTERFACE libminizip ) + target_link_libraries( ll::minizip-ng INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/minizip.lib ) else() - target_link_libraries( ll::minizip-ng INTERFACE minizip ) + target_link_libraries( ll::minizip-ng INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libminizip.a ) endif() if (WINDOWS) - target_link_libraries( ll::libxml INTERFACE libxml2_a) + target_link_libraries( ll::libxml INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libxml2.lib Bcrypt.lib) else() - target_link_libraries( ll::libxml INTERFACE xml2) + target_link_libraries( ll::libxml INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libxml2.a) endif() target_include_directories( ll::colladadom SYSTEM INTERFACE @@ -40,9 +41,9 @@ target_include_directories( ll::colladadom SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/collada/1.4 ) if (WINDOWS) - target_link_libraries(ll::colladadom INTERFACE libcollada14dom23-s ll::libxml ll::minizip-ng ) + target_link_libraries(ll::colladadom INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libcollada14dom23-s.lib ll::libxml ll::minizip-ng ) elseif (DARWIN) - target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) + target_link_libraries(ll::colladadom INTERFACE collada14dom ll::boost ll::libxml ll::minizip-ng) elseif (LINUX) - target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) + target_link_libraries(ll::colladadom INTERFACE collada14dom ll::boost ll::libxml ll::minizip-ng) endif() diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index e6ce902b61..2bdf0a8aa1 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -20,6 +20,7 @@ if (WINDOWS OR DARWIN ) endif() else() set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>) + set(SYMBOLS_STAGING_DIR ${CMAKE_BINARY_DIR}/symbols/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/${VIEWER_CHANNEL}) endif() if( DARWIN ) diff --git a/indra/cmake/NGHTTP2.cmake b/indra/cmake/NGHTTP2.cmake index 6396a5bd01..7b2aa5971f 100644 --- a/indra/cmake/NGHTTP2.cmake +++ b/indra/cmake/NGHTTP2.cmake @@ -8,9 +8,7 @@ use_system_binary(nghttp2) use_prebuilt_binary(nghttp2) if (WINDOWS) target_link_libraries( ll::nghttp2 INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/nghttp2.lib) -elseif (DARWIN) - target_link_libraries( ll::nghttp2 INTERFACE libnghttp2.dylib) -else (WINDOWS) - target_link_libraries( ll::nghttp2 INTERFACE libnghttp2.a ) -endif (WINDOWS) +else () + target_link_libraries( ll::nghttp2 INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libnghttp2.a) +endif () target_include_directories( ll::nghttp2 SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/nghttp2) diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake index 3387c74f45..67a84e14af 100644 --- a/indra/cmake/OpenSSL.cmake +++ b/indra/cmake/OpenSSL.cmake @@ -1,5 +1,6 @@ # -*- cmake -*- include(Prebuilt) +include(Linking) include_guard() add_library( ll::openssl INTERFACE IMPORTED ) @@ -7,9 +8,9 @@ add_library( ll::openssl INTERFACE IMPORTED ) use_system_binary(openssl) use_prebuilt_binary(openssl) if (WINDOWS) - target_link_libraries(ll::openssl INTERFACE libssl libcrypto) + target_link_libraries(ll::openssl INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libssl.lib ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto.lib Crypt32.lib) elseif (LINUX) - target_link_libraries(ll::openssl INTERFACE ssl crypto dl) + target_link_libraries(ll::openssl INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libssl.a ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto.a dl) else() target_link_libraries(ll::openssl INTERFACE ssl crypto) endif (WINDOWS) diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake index 044262bc8d..e5893e9a20 100644 --- a/indra/cmake/PNG.cmake +++ b/indra/cmake/PNG.cmake @@ -7,8 +7,8 @@ add_library( ll::libpng INTERFACE IMPORTED ) use_system_binary(libpng) use_prebuilt_binary(libpng) if (WINDOWS) - target_link_libraries(ll::libpng INTERFACE libpng16) + target_link_libraries(ll::libpng INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libpng16.lib) else() - target_link_libraries(ll::libpng INTERFACE png16 ) + target_link_libraries(ll::libpng INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libpng16.a) endif() target_include_directories( ll::libpng SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/libpng16) diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake index 32c02edb93..3339c51ba0 100644 --- a/indra/cmake/Tracy.cmake +++ b/indra/cmake/Tracy.cmake @@ -4,14 +4,26 @@ include(Prebuilt) include_guard() add_library( ll::tracy INTERFACE IMPORTED ) -set(USE_TRACY OFF CACHE BOOL "Use Tracy profiler.") +option(USE_TRACY "Use Tracy profiler." OFF) if (USE_TRACY) + option(USE_TRACY_ON_DEMAND "Use Tracy profiler." ON) + option(USE_TRACY_LOCAL_ONLY "Use Tracy profiler." OFF) + use_system_binary(tracy) use_prebuilt_binary(tracy) target_include_directories( ll::tracy SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/tracy) - target_link_libraries( ll::tracy INTERFACE TracyClient ) + + target_compile_definitions(ll::tracy INTERFACE -DTRACY_ENABLE=1 -DTRACY_ONLY_IPV4=1) + + if (USE_TRACY_ON_DEMAND) + target_compile_definitions(ll::tracy INTERFACE -DTRACY_ON_DEMAND=1) + endif () + + if (USE_TRACY_LOCAL_ONLY) + target_compile_definitions(ll::tracy INTERFACE -DTRACY_NO_BROADCAST=1 -DTRACY_ONLY_LOCALHOST=1) + endif () # See: indra/llcommon/llprofiler.h add_compile_definitions(LL_PROFILER_CONFIGURATION=3) diff --git a/indra/cmake/ZLIBNG.cmake b/indra/cmake/ZLIBNG.cmake index 5d99cd9709..d7b920da26 100644 --- a/indra/cmake/ZLIBNG.cmake +++ b/indra/cmake/ZLIBNG.cmake @@ -12,9 +12,9 @@ endif() use_prebuilt_binary(zlib-ng) if (WINDOWS) - target_link_libraries( ll::zlib-ng INTERFACE zlib ) + target_link_libraries( ll::zlib-ng INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/zlib.lib ) else() - target_link_libraries( ll::zlib-ng INTERFACE z ) + target_link_libraries( ll::zlib-ng INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libz.a ) endif (WINDOWS) if( NOT LINUX ) diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp index c69517cb22..580e6433c5 100644 --- a/indra/llappearance/llavatarappearancedefines.cpp +++ b/indra/llappearance/llavatarappearancedefines.cpp @@ -252,6 +252,7 @@ LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index, LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int); mWearables.push_back(t); } + va_end(argp); } ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index) const diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 6da28f0692..6143ec8cd1 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -245,6 +245,24 @@ public: S32 getVisualParamCount() const { return (S32)mVisualParamIndexMap.size(); } LLVisualParam* getVisualParam(const char *name); + void animateTweakableVisualParams(F32 delta) + { + for (auto& it : mVisualParamIndexMap) + { + if (it.second->isTweakable()) + { + it.second->animate(delta); + } + } + } + + void applyAllVisualParams(ESex avatar_sex) + { + for (auto& it : mVisualParamIndexMap) + { + it.second->apply(avatar_sex); + } + } ESex getSex() const { return mSex; } void setSex( ESex sex ) { mSex = sex; } diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 8e43627a5f..c4041f0c79 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -18,8 +18,6 @@ set(llcommon_SOURCE_FILES commoncontrol.cpp indra_constants.cpp lazyeventapi.cpp - llallocator.cpp - llallocator_heap_profile.cpp llapp.cpp llapr.cpp llassettype.cpp @@ -127,8 +125,6 @@ set(llcommon_HEADER_FILES lazyeventapi.h linden_common.h llalignedarray.h - llallocator.h - llallocator_heap_profile.h llapp.h llapr.h llassettype.h @@ -267,6 +263,10 @@ if (DARWIN) list(APPEND llcommon_SOURCE_FILES llsys_objc.mm) endif (DARWIN) +if (USE_TRACY) + list(APPEND llcommon_SOURCE_FILES llprofiler.cpp) +endif () + list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) add_library (llcommon ${llcommon_SOURCE_FILES}) diff --git a/indra/llcommon/llallocator_heap_profile.cpp b/indra/llcommon/llallocator_heap_profile.cpp deleted file mode 100644 index 85e56b4db4..0000000000 --- a/indra/llcommon/llallocator_heap_profile.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/** - * @file llallocator_heap_profile.cpp - * @brief Implementation of the parser for tcmalloc heap profile data. - * @author Brad Kittenbrink - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "llallocator_heap_profile.h" - -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#pragma warning (disable:4702) -#endif - -#include <boost/algorithm/string/split.hpp> -#include <boost/bind.hpp> -#include <boost/lexical_cast.hpp> -#include <boost/range/iterator_range.hpp> - -static const std::string HEAP_PROFILE_MAGIC_STR = "heap profile:"; - -static bool is_separator(char c) -{ - return isspace(c) || c == '[' || c == ']' || c == ':'; -} - -void LLAllocatorHeapProfile::parse(std::string const & prof_text) -{ - // a typedef for handling a token in the string buffer - // it's a begin/end pair of string::const_iterators - typedef boost::iterator_range<std::string::const_iterator> range_t; - - mLines.clear(); - - if(prof_text.compare(0, HEAP_PROFILE_MAGIC_STR.length(), HEAP_PROFILE_MAGIC_STR) != 0) - { - // *TODO - determine if there should be some better error state than - // mLines being empty. -brad - LL_WARNS() << "invalid heap profile data passed into parser." << LL_ENDL; - return; - } - - std::vector< range_t > prof_lines; - - std::string::const_iterator prof_begin = prof_text.begin() + HEAP_PROFILE_MAGIC_STR.length(); - - range_t prof_range(prof_begin, prof_text.end()); - boost::algorithm::split(prof_lines, - prof_range, - boost::bind(std::equal_to<llwchar>(), '\n', _1)); - - std::vector< range_t >::const_iterator i; - for(i = prof_lines.begin(); i != prof_lines.end() && !i->empty(); ++i) - { - range_t const & line_text = *i; - - std::vector<range_t> line_elems; - - boost::algorithm::split(line_elems, - line_text, - is_separator); - - std::vector< range_t >::iterator j; - j = line_elems.begin(); - - while(j != line_elems.end() && j->empty()) { ++j; } // skip any separator tokens - llassert_always(j != line_elems.end()); - U32 live_count = boost::lexical_cast<U32>(*j); - ++j; - - while(j != line_elems.end() && j->empty()) { ++j; } // skip any separator tokens - llassert_always(j != line_elems.end()); - U64 live_size = boost::lexical_cast<U64>(*j); - ++j; - - while(j != line_elems.end() && j->empty()) { ++j; } // skip any separator tokens - llassert_always(j != line_elems.end()); - U32 tot_count = boost::lexical_cast<U32>(*j); - ++j; - - while(j != line_elems.end() && j->empty()) { ++j; } // skip any separator tokens - llassert_always(j != line_elems.end()); - U64 tot_size = boost::lexical_cast<U64>(*j); - ++j; - - while(j != line_elems.end() && j->empty()) { ++j; } // skip any separator tokens - llassert(j != line_elems.end()); - if (j != line_elems.end()) - { - ++j; // skip the '@' - - mLines.push_back(line(live_count, live_size, tot_count, tot_size)); - line & current_line = mLines.back(); - - for(; j != line_elems.end(); ++j) - { - if(!j->empty()) - { - U32 marker = boost::lexical_cast<U32>(*j); - current_line.mTrace.push_back(marker); - } - } - } - } - // *TODO - parse MAPPED_LIBRARIES section here if we're ever interested in it -} - -void LLAllocatorHeapProfile::dump(std::ostream & out) const -{ - for (const LLAllocatorHeapProfile::line& line : mLines) - { - out << line.mLiveCount << ": " << line.mLiveSize << '[' << line.mTotalCount << ": " << line.mTotalSize << "] @"; - - for (const stack_marker marker : line.mTrace) - { - out << ' ' << marker; - } - out << '\n'; - } - out.flush(); -} - diff --git a/indra/llcommon/llallocator_heap_profile.h b/indra/llcommon/llallocator_heap_profile.h deleted file mode 100644 index 22f284b703..0000000000 --- a/indra/llcommon/llallocator_heap_profile.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @file llallocator_heap_profile.h - * @brief Declaration of the parser for tcmalloc heap profile data. - * @author Brad Kittenbrink - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLALLOCATOR_HEAP_PROFILE_H -#define LL_LLALLOCATOR_HEAP_PROFILE_H - -#include "stdtypes.h" - -#include <map> -#include <vector> - -class LLAllocatorHeapProfile -{ -public: - typedef int stack_marker; - - typedef std::vector<stack_marker> stack_trace; - - struct line { - line(U32 live_count, U64 live_size, U32 tot_count, U64 tot_size) : - mLiveSize(live_size), - mTotalSize(tot_size), - mLiveCount(live_count), - mTotalCount(tot_count) - { - } - U64 mLiveSize, mTotalSize; - U32 mLiveCount, mTotalCount; - stack_trace mTrace; - }; - - typedef std::vector<line> lines_t; - - LLAllocatorHeapProfile() - { - } - - void parse(std::string const & prof_text); - - void dump(std::ostream & out) const; - -public: - lines_t mLines; -}; - - -#endif // LL_LLALLOCATOR_HEAP_PROFILE_H diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 237f07288e..c6080a7f9f 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -55,6 +55,7 @@ #include "llsingleton.h" #include "llstl.h" #include "lltimer.h" +#include "llprofiler.h" // On Mac, got: // #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define @@ -506,7 +507,7 @@ namespace LLError::TimeFunction mTimeFunction; Recorders mRecorders; - LLCoros::RMutex mRecorderMutex; + LL_PROFILE_MUTEX_NAMED(LLCoros::RMutex, mRecorderMutex, "Log Recorders"); int mShouldLogCallCounter; @@ -529,7 +530,6 @@ namespace mCrashFunction(NULL), mTimeFunction(NULL), mRecorders(), - mRecorderMutex(), mShouldLogCallCounter(0) { } @@ -1044,7 +1044,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); s->mRecorders.push_back(recorder); } @@ -1055,7 +1055,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); s->mRecorders.erase(std::remove(s->mRecorders.begin(), s->mRecorders.end(), recorder), s->mRecorders.end()); } @@ -1104,7 +1104,7 @@ namespace LLError std::shared_ptr<RECORDER> findRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); return findRecorderPos<RECORDER>(s).first; } @@ -1115,7 +1115,7 @@ namespace LLError bool removeRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); auto found = findRecorderPos<RECORDER>(s); if (found.first) { @@ -1221,7 +1221,7 @@ namespace std::string escaped_message; - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); for (LLError::RecorderPtr& r : s->mRecorders) { if (!r->enabled()) @@ -1280,24 +1280,21 @@ namespace } namespace { - // We need a couple different mutexes, but we want to use the same mechanism - // for both. Make getMutex() a template function with different instances - // for different MutexDiscriminator values. - enum MutexDiscriminator - { - LOG_MUTEX, - STACKS_MUTEX - }; // Some logging calls happen very early in processing -- so early that our // module-static variables aren't yet initialized. getMutex() wraps a // function-static LLMutex so that early calls can still have a valid // LLMutex instance. - template <MutexDiscriminator MTX> - LLMutex* getMutex() + auto getLogMutex() + { + // guaranteed to be initialized the first time control reaches here + static LL_PROFILE_MUTEX_NAMED(std::recursive_mutex, sLogMutex, "Log Mutex"); + return &sLogMutex; + } + auto getStacksMutex() { // guaranteed to be initialized the first time control reaches here - static LLMutex sMutex; - return &sMutex; + static LL_PROFILE_MUTEX_NAMED(std::recursive_mutex, sStacksMutex, "Stacks Mutex"); + return &sStacksMutex; } bool checkLevelMap(const LevelMap& map, const std::string& key, @@ -1347,8 +1344,8 @@ namespace LLError bool Log::shouldLog(CallSite& site) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING; - LLMutexTrylock lock(getMutex<LOG_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getLogMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getLogMutex()); + if (!lock) { return false; } @@ -1392,8 +1389,8 @@ namespace LLError void Log::flush(const std::ostringstream& out, const CallSite& site) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING; - LLMutexTrylock lock(getMutex<LOG_MUTEX>(),5); - if (!lock.isLocked()) + std::unique_lock lock(*getLogMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getLogMutex()); + if (!lock) { return; } @@ -1523,8 +1520,8 @@ namespace LLError //static void LLCallStacks::push(const char* function, const int line) { - LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex()); + if (!lock) { return; } @@ -1548,8 +1545,8 @@ namespace LLError //static void LLCallStacks::end(const std::ostringstream& out) { - LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex()); + if (!lock) { return; } @@ -1565,8 +1562,8 @@ namespace LLError //static void LLCallStacks::print() { - LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex()); + if (!lock) { return; } diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 2be443ca37..1845fc42db 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -198,7 +198,7 @@ namespace LLError }; /** - * @NOTE: addRecorder() and removeRecorder() uses the boost::shared_ptr to allow for shared ownership + * @NOTE: addRecorder() and removeRecorder() uses the std::shared_ptr to allow for shared ownership * while still ensuring that the allocated memory is eventually freed */ LL_COMMON_API void addRecorder(RecorderPtr); diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index f97fca0a32..4bf1fa07a2 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -38,16 +38,8 @@ #include <vector> #include <deque> #include <functional> -#if LL_WINDOWS - #pragma warning (push) - #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch - #pragma warning (disable : 4264) -#endif -#include <boost/signals2.hpp> -#if LL_WINDOWS - #pragma warning (pop) -#endif +#include <boost/signals2.hpp> #include <boost/bind.hpp> #include <boost/utility.hpp> // noncopyable #include <boost/optional/optional.hpp> diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 9045324bf2..ed94ef21ef 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -293,7 +293,7 @@ int LLFile::rename(const std::string& filename, const std::string& newname, int return warnif(STRINGIZE("rename to '" << newname << "' from"), filename, rc, supress_error); } -bool LLFile::copy(const std::string from, const std::string to) +bool LLFile::copy(const std::string& from, const std::string& to) { bool copied = false; LLFILE* in = LLFile::fopen(from, "rb"); /* Flawfinder: ignore */ @@ -424,7 +424,7 @@ LLFILE * LLFile::_Fiopen(const std::string& filename, if (valid[n] == 0) return (0); // no valid mode - else if (norepflag && mode & (ios_base::out || ios_base::app) + else if (norepflag && mode & (ios_base::out | ios_base::app) && (fp = LLFile::fopen(filename, "r")) != 0) /* Flawfinder: ignore */ { // file must not exist, close and fail fclose(fp); diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 74110343fc..1661cbeb55 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -77,7 +77,7 @@ public: static int rmdir(const std::string& filename); static int remove(const std::string& filename, int supress_error = 0); static int rename(const std::string& filename,const std::string& newname, int supress_error = 0); - static bool copy(const std::string from, const std::string to); + static bool copy(const std::string& from, const std::string& to); static int stat(const std::string& filename,llstat* file_status); static bool isdir(const std::string& filename); @@ -160,7 +160,7 @@ private: * Does The Right Thing when passed a non-ASCII pathname. Sadly, that isn't * true of Microsoft's std::ifstream. */ -class LL_COMMON_API llifstream : public std::ifstream +class LL_COMMON_API llifstream : public std::ifstream { // input stream associated with a C stream public: @@ -205,7 +205,7 @@ class LL_COMMON_API llifstream : public std::ifstream * Right Thing when passed a non-ASCII pathname. Sadly, that isn't true of * Microsoft's std::ofstream. */ -class LL_COMMON_API llofstream : public std::ofstream +class LL_COMMON_API llofstream : public std::ofstream { public: // Constructors: @@ -241,7 +241,7 @@ class LL_COMMON_API llofstream : public std::ofstream /** - * @breif filesize helpers. + * @brief filesize helpers. * * The file size helpers are not considered particularly efficient, * and should only be used for config files and the like -- not in a diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index ac52f90c9f..b4bcc80ac4 100644 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp @@ -185,7 +185,7 @@ canonise_fl(FL_Locale *l) { #define RML(pn,sn) MAKELANGID(LANG_##pn, SUBLANG_##sn) struct IDToCode { LANGID id; - char* code; + const char* code; }; static const IDToCode both_to_code[] = { {ML(ENGLISH,US), "en_US.ISO_8859-1"}, diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 3232a0e219..92b26354a1 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -52,7 +52,7 @@ namespace LLInstanceTrackerPrivate struct StaticBase { // We need to be able to lock static data while manipulating it. - std::mutex mMutex; + LL_PROFILE_MUTEX_NAMED(std::mutex, mMutex, "InstanceTracker Data"); }; void logerrs(const char* cls, const std::string&, const std::string&, const std::string&); @@ -101,7 +101,8 @@ public: static size_t instanceCount() { - return LockStatic()->mMap.size(); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + return lock->mMap.size(); } // snapshot of std::pair<const KEY, std::shared_ptr<SUBCLASS>> pairs, for @@ -236,7 +237,7 @@ public: static ptr_t getInstance(const KEY& k) { - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); const InstanceMap& map(lock->mMap); typename InstanceMap::const_iterator found = map.find(k); return (found == map.end()) ? NULL : found->second; @@ -252,19 +253,19 @@ protected: ptr_t ptr(static_cast<T*>(this), [](T*){}); // save corresponding weak_ptr for future reference mSelf = ptr; - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); add_(lock, key, ptr); } public: virtual ~LLInstanceTracker() { - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); remove_(lock); } protected: virtual void setKey(KEY key) { - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); // Even though the shared_ptr we store in our map has a no-op deleter // for T itself, letting the use count decrement to 0 will still // delete the use-count object. Capture the shared_ptr we just removed @@ -376,7 +377,8 @@ public: static size_t instanceCount() { - return LockStatic()->mSet.size(); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + return lock->mSet.size(); } // snapshot of std::shared_ptr<SUBCLASS> pointers @@ -488,14 +490,16 @@ protected: // save corresponding weak_ptr for future reference mSelf = ptr; // Also store it in our class-static set to track this instance. - LockStatic()->mSet.emplace(ptr); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + lock->mSet.emplace(ptr); } public: virtual ~LLInstanceTracker() { // convert weak_ptr to shared_ptr because that's what we store in our // InstanceSet - LockStatic()->mSet.erase(mSelf.lock()); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + lock->mSet.erase(mSelf.lock()); } protected: LLInstanceTracker(const LLInstanceTracker& other): diff --git a/indra/llcommon/llprofiler.cpp b/indra/llcommon/llprofiler.cpp new file mode 100644 index 0000000000..bdddabf977 --- /dev/null +++ b/indra/llcommon/llprofiler.cpp @@ -0,0 +1,30 @@ +/** +* @file llprofiler.cpp +* @brief Implementation of llprofiler +* @author Rye Cogtail +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "linden_common.h" + +#include "TracyClient.cpp" diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 732436cc4f..f6a4d24747 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -78,12 +78,6 @@ extern thread_local bool gProfilerEnabled; #if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER - #define TRACY_ENABLE 1 -// Normally these would be enabled but we want to be able to build any viewer with Tracy enabled and run the Tracy server on another machine -// They must be undefined in order to work across multiple machines -// #define TRACY_NO_BROADCAST 1 -// #define TRACY_ONLY_LOCALHOST 1 - #define TRACY_ONLY_IPV4 1 #include "tracy/Tracy.hpp" // Enable OpenGL profiling @@ -108,6 +102,12 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red + + #define LL_PROFILE_MUTEX(type, varname) TracyLockable(type, varname) + #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) TracyLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_SHARED(type, varname) TracySharedLockable(type, varname) + #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); } #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER #define LL_PROFILER_FRAME_END @@ -124,6 +124,12 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) (void)(name); // Not supported #define LL_PROFILE_ZONE_INFO(name) (void)(name); // Not supported #define LL_PROFILE_ZONE_WARN(name) (void)(name); // Not supported + + #define LL_PROFILE_MUTEX(type, varname) type varname + #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) type varname + #define LL_PROFILE_MUTEX_SHARED(type, varname) type varname + #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) type varname + #define LL_PROFILE_MUTEX_LOCK(varname) // LL_PROFILE_MUTEX_LOCK is a no-op when Tracy is disabled #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define LL_PROFILER_FRAME_END FrameMark @@ -139,6 +145,12 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red + + #define LL_PROFILE_MUTEX(type, varname) TracyLockable(type, varname) + #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) TracyLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_SHARED(type, varname) TracySharedLockable(type, varname) + #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); } // see https://github.com/wolfpld/tracy/issues/575 #endif #else #define LL_PROFILER_FRAME_END diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp index e95d2e6c1c..5d38e55686 100644 --- a/indra/llcommon/llsdjson.cpp +++ b/indra/llcommon/llsdjson.cpp @@ -35,16 +35,7 @@ #include "llerror.h" #include "../llmath/llmath.h" -#if LL_WINDOWS -#pragma warning (push) -#pragma warning (disable : 4702) // compiler thinks unreachable code -#endif #include <boost/json/src.hpp> -#if LL_WINDOWS -#pragma warning (pop) -#endif - - //========================================================================= LLSD LlsdFromJson(const boost::json::value& val) diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index d00e703a10..05dc3cde79 100644 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -59,9 +59,8 @@ private: // it's safe to log -- which involves querying a different LLSingleton -- // which requires accessing the master list. typedef std::recursive_mutex mutex_t; - typedef std::unique_lock<mutex_t> lock_t; - - mutex_t mMutex; + LL_PROFILE_MUTEX_NAMED(mutex_t, mMutex, "Singleton MasterList"); + typedef std::unique_lock<decltype(mMutex)> lock_t; public: // Instantiate this to both obtain a reference to MasterList::instance() diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 316831cd74..b5659e053c 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -35,6 +35,8 @@ #include "lockstatic.h" #include "llthread.h" // on_main_thread() #include "llmainthreadtask.h" +#include "llprofiler.h" +#include "llerror.h" #ifdef LL_WINDOWS #pragma warning(push) @@ -298,7 +300,7 @@ private: // Use a recursive_mutex in case of constructor circularity. With a // non-recursive mutex, that would result in deadlock. typedef std::recursive_mutex mutex_t; - mutex_t mMutex; // LockStatic looks for mMutex + LL_PROFILE_MUTEX_NAMED(mutex_t, mMutex, "Singleton Data"); // LockStatic looks for mMutex EInitState mInitState{UNINITIALIZED}; DERIVED_TYPE* mInstance{nullptr}; @@ -420,7 +422,7 @@ protected: // deleteSingleton() to defend against manual deletion. When we moved // cleanup to deleteSingleton(), we hit crashes due to dangling // pointers in the MasterList. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); lk->mInstance = nullptr; lk->mInitState = DELETED; @@ -448,7 +450,7 @@ public: // Hold the lock while we call cleanupSingleton() and the destructor. // Our destructor also instantiates LockStatic, requiring a recursive // mutex. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); // of course, only cleanup and delete if there's something there if (lk->mInstance) { @@ -505,7 +507,7 @@ public: { // nested scope for 'lk' // In case racing threads call getInstance() at the same moment, // serialize the calls. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); switch (lk->mInitState) { @@ -595,7 +597,7 @@ public: static bool instanceExists() { // defend any access to sData from racing threads - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); return lk->mInitState == INITIALIZED; } @@ -605,7 +607,7 @@ public: static bool wasDeleted() { // defend any access to sData from racing threads - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); return lk->mInitState == DELETED; } }; @@ -644,7 +646,7 @@ private: // In case racing threads both call initParamSingleton() at the same // time, serialize them. One should initialize; the other should see // mInitState already set. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); // For organizational purposes this function shouldn't be called twice if (lk->mInitState != super::UNINITIALIZED) { @@ -708,7 +710,7 @@ public: { // In case racing threads call getInstance() at the same moment as // initParamSingleton(), serialize the calls. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); switch (lk->mInitState) { diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index bda3579f60..ca8f4299d9 100644 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -33,10 +33,7 @@ #include <sstream> #include "llwin32headerslean.h" -#pragma warning (push) -#pragma warning (disable:4091) // a microsoft header has warnings. Very nice. #include <dbghelp.h> -#pragma warning (pop) typedef USHORT NTAPI RtlCaptureStackBackTrace_Function( IN ULONG frames_to_skip, diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index c57f8b1e96..505789f9ea 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -900,6 +900,11 @@ void HeapFree_deleter(void* ptr) } // anonymous namespace +unsigned long windows_get_last_error() +{ + return GetLastError(); +} + template<> std::wstring windows_message<std::wstring>(DWORD error) { diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index b69a068830..db716b1431 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -46,7 +46,6 @@ #endif #include <string.h> -#include <boost/scoped_ptr.hpp> const char LL_UNKNOWN_CHAR = '?'; class LLSD; @@ -832,8 +831,10 @@ template<> LL_COMMON_API std::wstring windows_message<std::wstring>(unsigned long error); /// Get Windows message string, implicitly calling GetLastError() +LL_COMMON_API unsigned long windows_get_last_error(); + template<typename STRING> -STRING windows_message() { return windows_message<STRING>(GetLastError()); } +STRING windows_message() { return windows_message<STRING>(windows_get_last_error()); } //@} diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 3b37365ec7..7aeabc3c4a 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -31,6 +31,7 @@ // ugh, this is ugly. We need to straighten out our linking for this library #pragma comment(lib, "IPHLPAPI.lib") #include <iphlpapi.h> +#include <nb30.h> #endif #include "llapp.h" diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index 0057a1f639..b1a284225e 100644 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp @@ -46,12 +46,6 @@ #include "../test/lltut.h" - -#if LL_WINDOWS -// disable overflow warnings -#pragma warning(disable: 4307) -#endif - namespace tut { struct sd_data diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index a00262c132..b141171516 100644 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -131,45 +131,6 @@ if (LL_TESTS AND LLCOREHTTP_TESTS) "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llcorehttp_peer.py" ) -if (DARWIN) - # Path inside the app bundle where we'll need to copy libraries - set(LL_TEST_DESTINATION_DIR - ${CMAKE_BINARY_DIR}/sharedlibs/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,,../>Resources - ) - - # Create the Contents/Resources directory - add_custom_command( - TARGET INTEGRATION_TEST_llcorehttp PRE_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - make_directory - ${LL_TEST_DESTINATION_DIR} - COMMENT "Creating Resources directory in app bundle." - ) - - # Copy the required libraries to the package app. We used to use a sequence - # of '${CMAKE_COMMAND} -E copy' commands, but 'cmake -E copy' does only a - # single file at a time: it doesn't understand wildcards. 'cmake -E copy' is - # for portability. This operation is Darwin-specific. We can count on the - # 'cp' command. - set(copy_dylibs - libapr-1.0.dylib - libaprutil-1.0.dylib - libnghttp2*.dylib - ${EXPAT_COPY} - ) - - add_custom_command(TARGET INTEGRATION_TEST_llcorehttp PRE_BUILD - WORKING_DIRECTORY "${AUTOBUILD_INSTALL_DIR}/lib/release" - COMMAND cp -v - ${copy_dylibs} - ${LL_TEST_DESTINATION_DIR} - DEPENDS ${copy_dylibs} - ) - -endif (DARWIN) - # # Example Programs # diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index 216d407deb..2aaf71f8a4 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -489,6 +489,7 @@ HttpStatus HttpRequest::createService() HttpRequestQueue::init(); HttpRequestQueue * rq = HttpRequestQueue::instanceOf(); HttpService::init(rq); + HTTPStats::createInstance(); has_inited = true; } @@ -502,6 +503,7 @@ HttpStatus HttpRequest::destroyService() if (has_inited) { + HTTPStats::deleteSingleton(); HttpService::term(); HttpRequestQueue::term(); has_inited = false; diff --git a/indra/llcorehttp/httpstats.h b/indra/llcorehttp/httpstats.h index f12e59da0c..5c0f26d34e 100644 --- a/indra/llcorehttp/httpstats.h +++ b/indra/llcorehttp/httpstats.h @@ -35,12 +35,12 @@ namespace LLCore { - class HTTPStats : public LLSingleton<HTTPStats> + class HTTPStats final : public LLSimpleton<HTTPStats> { - LLSINGLETON(HTTPStats); - virtual ~HTTPStats(); - public: + HTTPStats(); + ~HTTPStats(); + void resetStats(); typedef LLStatsAccumulator StatsAccumulator; diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 86b1e2ac81..49904911a9 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -39,15 +39,25 @@ #include "lldiskcache.h" -LLDiskCache::LLDiskCache(const std::string cache_dir, + /** + * The prefix inserted at the start of a cache file filename to + * help identify it as a cache file. It's probably not required + * (just the presence in the cache folder is enough) but I am + * paranoid about the cache folder being set to something bad + * like the users' OS system dir by mistake or maliciously and + * this will help to offset any damage if that happens. + */ +static const std::string CACHE_FILENAME_PREFIX("sl_cache"); + +std::string LLDiskCache::sCacheDir; + +LLDiskCache::LLDiskCache(const std::string& cache_dir, const uintmax_t max_size_bytes, const bool enable_cache_debug_info) : - mCacheDir(cache_dir), mMaxSizeBytes(max_size_bytes), mEnableCacheDebugInfo(enable_cache_debug_info) { - mCacheFilenamePrefix = "sl_cache"; - + sCacheDir = cache_dir; LLFile::mkdir(cache_dir); } @@ -83,7 +93,7 @@ void LLDiskCache::purge() { if (mEnableCacheDebugInfo) { - LL_INFOS() << "Total dir size before purge is " << dirFileSize(mCacheDir) << LL_ENDL; + LL_INFOS() << "Total dir size before purge is " << dirFileSize(sCacheDir) << LL_ENDL; } boost::system::error_code ec; @@ -93,9 +103,9 @@ void LLDiskCache::purge() std::vector<file_info_t> file_info; #if LL_WINDOWS - std::wstring cache_path(utf8str_to_utf16str(mCacheDir)); + std::wstring cache_path(utf8str_to_utf16str(sCacheDir)); #else - std::string cache_path(mCacheDir); + std::string cache_path(sCacheDir); #endif if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) { @@ -104,7 +114,7 @@ void LLDiskCache::purge() { if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) { - if ((*iter).path().string().find(mCacheFilenamePrefix) != std::string::npos) + if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { uintmax_t file_size = boost::filesystem::file_size(*iter, ec); if (ec.failed()) @@ -181,144 +191,14 @@ void LLDiskCache::purge() LL_INFOS() << line.str() << LL_ENDL; } - LL_INFOS() << "Total dir size after purge is " << dirFileSize(mCacheDir) << LL_ENDL; + LL_INFOS() << "Total dir size after purge is " << dirFileSize(sCacheDir) << LL_ENDL; LL_INFOS() << "Cache purge took " << execute_time << " ms to execute for " << file_info.size() << " files" << LL_ENDL; } } -const std::string LLDiskCache::assetTypeToString(LLAssetType::EType at) -{ - /** - * Make use of the handy C++17 feature that allows - * for inline initialization of an std::map<> - */ - typedef std::map<LLAssetType::EType, std::string> asset_type_to_name_t; - asset_type_to_name_t asset_type_to_name = - { - { LLAssetType::AT_TEXTURE, "TEXTURE" }, - { LLAssetType::AT_SOUND, "SOUND" }, - { LLAssetType::AT_CALLINGCARD, "CALLINGCARD" }, - { LLAssetType::AT_LANDMARK, "LANDMARK" }, - { LLAssetType::AT_SCRIPT, "SCRIPT" }, - { LLAssetType::AT_CLOTHING, "CLOTHING" }, - { LLAssetType::AT_OBJECT, "OBJECT" }, - { LLAssetType::AT_NOTECARD, "NOTECARD" }, - { LLAssetType::AT_CATEGORY, "CATEGORY" }, - { LLAssetType::AT_LSL_TEXT, "LSL_TEXT" }, - { LLAssetType::AT_LSL_BYTECODE, "LSL_BYTECODE" }, - { LLAssetType::AT_TEXTURE_TGA, "TEXTURE_TGA" }, - { LLAssetType::AT_BODYPART, "BODYPART" }, - { LLAssetType::AT_SOUND_WAV, "SOUND_WAV" }, - { LLAssetType::AT_IMAGE_TGA, "IMAGE_TGA" }, - { LLAssetType::AT_IMAGE_JPEG, "IMAGE_JPEG" }, - { LLAssetType::AT_ANIMATION, "ANIMATION" }, - { LLAssetType::AT_GESTURE, "GESTURE" }, - { LLAssetType::AT_SIMSTATE, "SIMSTATE" }, - { LLAssetType::AT_LINK, "LINK" }, - { LLAssetType::AT_LINK_FOLDER, "LINK_FOLDER" }, - { LLAssetType::AT_MARKETPLACE_FOLDER, "MARKETPLACE_FOLDER" }, - { LLAssetType::AT_WIDGET, "WIDGET" }, - { LLAssetType::AT_PERSON, "PERSON" }, - { LLAssetType::AT_MESH, "MESH" }, - { LLAssetType::AT_SETTINGS, "SETTINGS" }, - { LLAssetType::AT_MATERIAL, "MATERIAL" }, - { LLAssetType::AT_GLTF, "GLTF" }, - { LLAssetType::AT_GLTF_BIN, "GLTF_BIN" }, - { LLAssetType::AT_UNKNOWN, "UNKNOWN" } - }; - - asset_type_to_name_t::iterator iter = asset_type_to_name.find(at); - if (iter != asset_type_to_name.end()) - { - return iter->second; - } - - return std::string("UNKNOWN"); -} - -const std::string LLDiskCache::metaDataToFilepath(const std::string id, - LLAssetType::EType at, - const std::string extra_info) +const std::string LLDiskCache::metaDataToFilepath(const LLUUID& id, LLAssetType::EType at) { - std::ostringstream file_path; - - file_path << mCacheDir; - file_path << gDirUtilp->getDirDelimiter(); - file_path << mCacheFilenamePrefix; - file_path << "_"; - file_path << id; - file_path << "_"; - file_path << (extra_info.empty() ? "0" : extra_info); - //file_path << "_"; - //file_path << assetTypeToString(at); // see SL-14210 Prune descriptive tag from new cache filenames - // for details of why it was removed. Note that if you put it - // back or change the format of the filename, the cache files - // files will be invalidated (and perhaps, more importantly, - // never deleted unless you delete them manually). - file_path << ".asset"; - - return file_path.str(); -} - -void LLDiskCache::updateFileAccessTime(const std::string file_path) -{ - /** - * Threshold in time_t units that is used to decide if the last access time - * time of the file is updated or not. Added as a precaution for the concern - * outlined in SL-14582 about frequent writes on older SSDs reducing their - * lifespan. I think this is the right place for the threshold value - rather - * than it being a pref - do comment on that Jira if you disagree... - * - * Let's start with 1 hour in time_t units and see how that unfolds - */ - const std::time_t time_threshold = 1 * 60 * 60; - - // current time - const std::time_t cur_time = std::time(nullptr); - - boost::system::error_code ec; -#if LL_WINDOWS - // file last write time - const std::time_t last_write_time = boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), ec); - if (ec.failed()) - { - LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; - return; - } - - // delta between cur time and last time the file was written - const std::time_t delta_time = cur_time - last_write_time; - - // we only write the new value if the time in time_threshold has elapsed - // before the last one - if (delta_time > time_threshold) - { - boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), cur_time, ec); - } -#else - // file last write time - const std::time_t last_write_time = boost::filesystem::last_write_time(file_path, ec); - if (ec.failed()) - { - LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; - return; - } - - // delta between cur time and last time the file was written - const std::time_t delta_time = cur_time - last_write_time; - - // we only write the new value if the time in time_threshold has elapsed - // before the last one - if (delta_time > time_threshold) - { - boost::filesystem::last_write_time(file_path, cur_time, ec); - } -#endif - - if (ec.failed()) - { - LL_WARNS() << "Failed to update last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; - } + return llformat("%s%s%s_%s_0.asset", sCacheDir.c_str(), gDirUtilp->getDirDelimiter().c_str(), CACHE_FILENAME_PREFIX.c_str(), id.asString().c_str()); } const std::string LLDiskCache::getCacheInfo() @@ -326,7 +206,7 @@ const std::string LLDiskCache::getCacheInfo() std::ostringstream cache_info; F32 max_in_mb = (F32)mMaxSizeBytes / (1024.0f * 1024.0f); - F32 percent_used = ((F32)dirFileSize(mCacheDir) / (F32)mMaxSizeBytes) * 100.0f; + F32 percent_used = ((F32)dirFileSize(sCacheDir) / (F32)mMaxSizeBytes) * 100.0f; cache_info << std::fixed; cache_info << std::setprecision(1); @@ -346,9 +226,9 @@ void LLDiskCache::clearCache() */ boost::system::error_code ec; #if LL_WINDOWS - std::wstring cache_path(utf8str_to_utf16str(mCacheDir)); + std::wstring cache_path(utf8str_to_utf16str(sCacheDir)); #else - std::string cache_path(mCacheDir); + std::string cache_path(sCacheDir); #endif if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) { @@ -357,7 +237,7 @@ void LLDiskCache::clearCache() { if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) { - if ((*iter).path().string().find(mCacheFilenamePrefix) != std::string::npos) + if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { boost::filesystem::remove(*iter, ec); if (ec.failed()) @@ -405,7 +285,7 @@ void LLDiskCache::removeOldVFSFiles() } } -uintmax_t LLDiskCache::dirFileSize(const std::string dir) +uintmax_t LLDiskCache::dirFileSize(const std::string& dir) { uintmax_t total_file_size = 0; @@ -431,7 +311,7 @@ uintmax_t LLDiskCache::dirFileSize(const std::string dir) { if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) { - if ((*iter).path().string().find(mCacheFilenamePrefix) != std::string::npos) + if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { uintmax_t file_size = boost::filesystem::file_size(*iter, ec); if (!ec.failed()) diff --git a/indra/llfilesystem/lldiskcache.h b/indra/llfilesystem/lldiskcache.h index b60e74f8c9..f07b26c2d7 100644 --- a/indra/llfilesystem/lldiskcache.h +++ b/indra/llfilesystem/lldiskcache.h @@ -81,7 +81,7 @@ class LLDiskCache : * a child of the main Viewer cache directory. Defined * by the setting at 'DiskCacheDirName' */ - const std::string cache_dir, + const std::string& cache_dir, /** * The maximum size of the cache in bytes - Based on the * setting at 'CacheSize' and 'DiskCachePercentOfTotal' @@ -104,16 +104,7 @@ class LLDiskCache : * so many things had to be pushed back there to accomodate it, that I * decided to move it here. Still not sure that's completely right. */ - const std::string metaDataToFilepath(const std::string id, - LLAssetType::EType at, - const std::string extra_info); - - /** - * Update the "last write time" of a file to "now". This must be called whenever a - * file in the cache is read (not written) so that the last time the file was - * accessed is up to date (This is used in the mechanism for purging the cache) - */ - void updateFileAccessTime(const std::string file_path); + static const std::string metaDataToFilepath(const LLUUID& id, LLAssetType::EType at); /** * Purge the oldest items in the cache so that the combined size of all files @@ -148,13 +139,7 @@ class LLDiskCache : * directory. Primarily used here to determine the directory size * before and after the cache purge */ - uintmax_t dirFileSize(const std::string dir); - - /** - * Utility function to convert an LLAssetType enum into a - * string that we use as part of the cache file filename - */ - const std::string assetTypeToString(LLAssetType::EType at); + uintmax_t dirFileSize(const std::string& dir); private: /** @@ -170,17 +155,7 @@ class LLDiskCache : * setting could potentially point it at a non-cache directory (for example, * the Windows System dir) with disastrous results. */ - std::string mCacheDir; - - /** - * The prefix inserted at the start of a cache file filename to - * help identify it as a cache file. It's probably not required - * (just the presence in the cache folder is enough) but I am - * paranoid about the cache folder being set to something bad - * like the users' OS system dir by mistake or maliciously and - * this will help to offset any damage if that happens. - */ - std::string mCacheFilenamePrefix; + static std::string sCacheDir; /** * When enabled, displays additional debugging information in diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 7d2a6bd6f5..c8ce9531c2 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -34,10 +34,12 @@ #include "llfasttimer.h" #include "lldiskcache.h" -const S32 LLFileSystem::READ = 0x00000001; -const S32 LLFileSystem::WRITE = 0x00000002; -const S32 LLFileSystem::READ_WRITE = 0x00000003; // LLFileSystem::READ & LLFileSystem::WRITE -const S32 LLFileSystem::APPEND = 0x00000006; // 0x00000004 & LLFileSystem::WRITE +#include "boost/filesystem.hpp" + +constexpr S32 LLFileSystem::READ = 0x00000001; +constexpr S32 LLFileSystem::WRITE = 0x00000002; +constexpr S32 LLFileSystem::READ_WRITE = 0x00000003; // LLFileSystem::READ & LLFileSystem::WRITE +constexpr S32 LLFileSystem::APPEND = 0x00000006; // 0x00000004 & LLFileSystem::WRITE static LLTrace::BlockTimerStatHandle FTM_VFILE_WAIT("VFile Wait"); @@ -55,10 +57,7 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_ if (mode == LLFileSystem::READ) { // build the filename (TODO: we do this in a few places - perhaps we should factor into a single function) - std::string id; - mFileID.toString(id); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id, mFileType, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(mFileID, mFileType); // update the last access time for the file if it exists - this is required // even though we are reading and not writing because this is the @@ -67,23 +66,16 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_ bool exists = gDirUtilp->fileExists(filename); if (exists) { - LLDiskCache::getInstance()->updateFileAccessTime(filename); + updateFileAccessTime(filename); } } } -LLFileSystem::~LLFileSystem() -{ -} - // static bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType file_type) { LL_PROFILE_ZONE_SCOPED; - std::string id_str; - file_id.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, file_type, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); llifstream file(filename, std::ios::binary); if (file.is_open()) @@ -97,10 +89,7 @@ bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType fil // static bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error /*= 0*/) { - std::string id_str; - file_id.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, file_type, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); LLFile::remove(filename.c_str(), suppress_error); @@ -111,14 +100,8 @@ bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType fi bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::EType old_file_type, const LLUUID& new_file_id, const LLAssetType::EType new_file_type) { - std::string old_id_str; - old_file_id.toString(old_id_str); - const std::string extra_info = ""; - const std::string old_filename = LLDiskCache::getInstance()->metaDataToFilepath(old_id_str, old_file_type, extra_info); - - std::string new_id_str; - new_file_id.toString(new_id_str); - const std::string new_filename = LLDiskCache::getInstance()->metaDataToFilepath(new_id_str, new_file_type, extra_info); + const std::string old_filename = LLDiskCache::metaDataToFilepath(old_file_id, old_file_type); + const std::string new_filename = LLDiskCache::metaDataToFilepath(new_file_id, new_file_type); // Rename needs the new file to not exist. LLFileSystem::removeFile(new_file_id, new_file_type, ENOENT); @@ -129,7 +112,7 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp // failed but the original code does not and doing so seems to // break a lot of things so we go with the flow... //return false; - LL_WARNS() << "Failed to rename " << old_file_id << " to " << new_id_str << " reason: " << strerror(errno) << LL_ENDL; + LL_WARNS() << "Failed to rename " << old_file_id << " to " << new_file_id << " reason: " << strerror(errno) << LL_ENDL; } return true; @@ -138,10 +121,7 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp // static S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType file_type) { - std::string id_str; - file_id.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, file_type, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); S32 file_size = 0; llifstream file(filename, std::ios::binary); @@ -158,10 +138,7 @@ bool LLFileSystem::read(U8* buffer, S32 bytes) { bool success = false; - std::string id; - mFileID.toString(id); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id, mFileType, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(mFileID, mFileType); llifstream file(filename, std::ios::binary); if (file.is_open()) @@ -191,22 +168,19 @@ bool LLFileSystem::read(U8* buffer, S32 bytes) return success; } -S32 LLFileSystem::getLastBytesRead() +S32 LLFileSystem::getLastBytesRead() const { return mBytesRead; } -bool LLFileSystem::eof() +bool LLFileSystem::eof() const { return mPosition >= getSize(); } bool LLFileSystem::write(const U8* buffer, S32 bytes) { - std::string id_str; - mFileID.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, mFileType, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(mFileID, mFileType); bool success = false; @@ -217,12 +191,11 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) { ofs.write((const char*)buffer, bytes); - mPosition = (S32)ofs.tellp(); // <FS:Ansariel> Fix asset caching + mPosition = (S32)ofs.tellp(); success = true; } } - // <FS:Ansariel> Fix asset caching else if (mMode == READ_WRITE) { // Don't truncate if file already exists @@ -246,7 +219,6 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) } } } - // </FS:Ansariel> else { llofstream ofs(filename, std::ios::binary); @@ -298,12 +270,12 @@ S32 LLFileSystem::tell() const return mPosition; } -S32 LLFileSystem::getSize() +S32 LLFileSystem::getSize() const { return LLFileSystem::getFileSize(mFileID, mFileType); } -S32 LLFileSystem::getMaxSize() +S32 LLFileSystem::getMaxSize() const { // offer up a huge size since we don't care what the max is return INT_MAX; @@ -319,9 +291,69 @@ bool LLFileSystem::rename(const LLUUID& new_id, const LLAssetType::EType new_typ return true; } -bool LLFileSystem::remove() +bool LLFileSystem::remove() const { LLFileSystem::removeFile(mFileID, mFileType); - return true; } + +void LLFileSystem::updateFileAccessTime(const std::string& file_path) +{ + /** + * Threshold in time_t units that is used to decide if the last access time + * time of the file is updated or not. Added as a precaution for the concern + * outlined in SL-14582 about frequent writes on older SSDs reducing their + * lifespan. I think this is the right place for the threshold value - rather + * than it being a pref - do comment on that Jira if you disagree... + * + * Let's start with 1 hour in time_t units and see how that unfolds + */ + constexpr std::time_t time_threshold = 1 * 60 * 60; + + // current time + const std::time_t cur_time = std::time(nullptr); + + boost::system::error_code ec; +#if LL_WINDOWS + // file last write time + const std::time_t last_write_time = boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), ec); + if (ec.failed()) + { + LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; + return; + } + + // delta between cur time and last time the file was written + const std::time_t delta_time = cur_time - last_write_time; + + // we only write the new value if the time in time_threshold has elapsed + // before the last one + if (delta_time > time_threshold) + { + boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), cur_time, ec); + } +#else + // file last write time + const std::time_t last_write_time = boost::filesystem::last_write_time(file_path, ec); + if (ec.failed()) + { + LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; + return; + } + + // delta between cur time and last time the file was written + const std::time_t delta_time = cur_time - last_write_time; + + // we only write the new value if the time in time_threshold has elapsed + // before the last one + if (delta_time > time_threshold) + { + boost::filesystem::last_write_time(file_path, cur_time, ec); + } +#endif + + if (ec.failed()) + { + LL_WARNS() << "Failed to update last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; + } +} diff --git a/indra/llfilesystem/llfilesystem.h b/indra/llfilesystem/llfilesystem.h index ea1b9cf3a1..10649b6920 100644 --- a/indra/llfilesystem/llfilesystem.h +++ b/indra/llfilesystem/llfilesystem.h @@ -38,20 +38,27 @@ class LLFileSystem { public: LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_type, S32 mode = LLFileSystem::READ); - ~LLFileSystem(); + ~LLFileSystem() = default; bool read(U8* buffer, S32 bytes); - S32 getLastBytesRead(); - bool eof(); + S32 getLastBytesRead() const; + bool eof() const; bool write(const U8* buffer, S32 bytes); bool seek(S32 offset, S32 origin = -1); S32 tell() const; - S32 getSize(); - S32 getMaxSize(); + S32 getSize() const; + S32 getMaxSize() const; bool rename(const LLUUID& new_id, const LLAssetType::EType new_type); - bool remove(); + bool remove() const; + + /** + * Update the "last write time" of a file to "now". This must be called whenever a + * file in the cache is read (not written) so that the last time the file was + * accessed is up to date (This is used in the mechanism for purging the cache) + */ + void updateFileAccessTime(const std::string& file_path); static bool getExists(const LLUUID& file_id, const LLAssetType::EType file_type); static bool removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error = 0); @@ -71,8 +78,6 @@ class LLFileSystem S32 mPosition; S32 mMode; S32 mBytesRead; -//private: -// static const std::string idToFilepath(const std::string id, LLAssetType::EType at); }; #endif // LL_FILESYSTEM_H diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index add6657117..012b87a42d 100644 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -31,7 +31,6 @@ #include "llimage.h" -#include "llwin32headerslean.h" extern "C" { #ifdef LL_USESYSTEMLIBS # include <jpeglib.h> diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 3dd1a5638d..8fa8983d3c 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -53,6 +53,7 @@ struct InventoryEntry : public LLDictionaryEntry LLAssetType::EType t = (LLAssetType::EType)va_arg(argp,int); mAssetTypes.push_back(t); } + va_end(argp); } const std::string mHumanName; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index abf746ef2c..1e7de94414 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -28,7 +28,6 @@ #include "llsettingsdaycycle.h" #include "llerror.h" #include <algorithm> -#include <boost/make_shared.hpp> #include "lltrace.h" #include "llfasttimer.h" #include "v3colorutil.h" diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 4cd84970ff..161b8cda25 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -27,7 +27,6 @@ #include "llsettingswater.h" #include <algorithm> -#include <boost/make_shared.hpp> #include "lltrace.h" #include "llfasttimer.h" #include "v3colorutil.h" diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index 11462170fb..a407f51029 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -33,20 +33,6 @@ typedef __m128 LLQuad; - -#if LL_WINDOWS -#pragma warning(push) -#pragma warning( disable : 4800 3 ) // Disable warning about casting int to bool for this class. -#if defined(_MSC_VER) && (_MSC_VER < 1500) -// VC++ 2005 is missing these intrinsics -// __forceinline is MSVC specific and attempts to override compiler inlining judgment. This is so -// even in debug builds this call is a NOP. -__forceinline const __m128 _mm_castsi128_ps( const __m128i a ) { return reinterpret_cast<const __m128&>(a); } -__forceinline const __m128i _mm_castps_si128( const __m128 a ) { return reinterpret_cast<const __m128i&>(a); } -#endif // _MSC_VER - -#endif // LL_WINDOWS - class LLBool32 { public: @@ -63,10 +49,6 @@ private: int m_bool{ 0 }; }; -#if LL_WINDOWS -#pragma warning(pop) -#endif - class LLSimdScalar { public: diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp index ed036e396d..3973565e22 100644 --- a/indra/llmessage/llblowfishcipher.cpp +++ b/indra/llmessage/llblowfishcipher.cpp @@ -88,7 +88,7 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) src_len)) { LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << LL_ENDL; - goto ERROR; + goto BF_ENCRYPT_ERROR; } // There may be some final data left to encrypt if the input is @@ -96,14 +96,14 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) if (!EVP_EncryptFinal_ex(context, (unsigned char*)(dst + output_len), &temp_len)) { LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << LL_ENDL; - goto ERROR; + goto BF_ENCRYPT_ERROR; } output_len += temp_len; EVP_CIPHER_CTX_free(context); return output_len; -ERROR: +BF_ENCRYPT_ERROR: EVP_CIPHER_CTX_free(context); return 0; } diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index ac17a43217..34af3ffece 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -24,10 +24,8 @@ * $/LicenseInfo$ */ -#if LL_MSVC -#pragma warning (disable : 4263) -#pragma warning (disable : 4264) -#endif +#include "linden_common.h" + #include "dae.h" #include "dom/domAsset.h" #include "dom/domBind_material.h" @@ -48,10 +46,6 @@ #include "dom/domScale.h" #include "dom/domTranslate.h" #include "dom/domVisual_scene.h" -#if LL_MSVC -#pragma warning (default : 4263) -#pragma warning (default : 4264) -#endif #include "lldaeloader.h" #include "llsdserialize.h" diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp index e8f40d1ffd..414df66680 100644 --- a/indra/llprimitive/tests/llmediaentry_test.cpp +++ b/indra/llprimitive/tests/llmediaentry_test.cpp @@ -26,14 +26,9 @@ #include "linden_common.h" #include "lltut.h" -#if LL_WINDOWS -#pragma warning (push) -#pragma warning (disable : 4702) // boost::lexical_cast generates this warning -#endif + #include <boost/lexical_cast.hpp> -#if LL_WINDOWS -#pragma warning (pop) -#endif + #include "llstring.h" #include "llsdutil.h" #include "llsdserialize.h" diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index e6b4118beb..010ab122b6 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -293,15 +293,18 @@ public: enum eTexIndex : U8 { - DIFFUSE_MAP = 0, - ALTERNATE_DIFFUSE_MAP = 1, - NORMAL_MAP = 1, - SPECULAR_MAP = 2, - BASECOLOR_MAP = 3, + // Channels for material textures + DIFFUSE_MAP = 0, + ALTERNATE_DIFFUSE_MAP = 1, + NORMAL_MAP = 1, + SPECULAR_MAP = 2, + // Channels for PBR textures + BASECOLOR_MAP = 3, METALLIC_ROUGHNESS_MAP = 4, - GLTF_NORMAL_MAP = 5, - EMISSIVE_MAP = 6, - NUM_TEXTURE_CHANNELS = 7, + GLTF_NORMAL_MAP = 5, + EMISSIVE_MAP = 6, + // Total number of channels + NUM_TEXTURE_CHANNELS = 7, }; enum eVolumeTexIndex : U8 diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index bc542d325e..512ef340f9 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1409,6 +1409,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("detail_3"); mReservedUniforms.push_back("alpha_ramp"); + mReservedUniforms.push_back("paint_map"); mReservedUniforms.push_back("detail_0_base_color"); mReservedUniforms.push_back("detail_1_base_color"); @@ -1433,6 +1434,8 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("emissiveColors"); mReservedUniforms.push_back("minimum_alphas"); + mReservedUniforms.push_back("region_scale"); + mReservedUniforms.push_back("origin"); mReservedUniforms.push_back("display_gamma"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 921ef20997..2b76ef664b 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -267,6 +267,7 @@ public: TERRAIN_DETAIL3, // "detail_3" TERRAIN_ALPHARAMP, // "alpha_ramp" + TERRAIN_PAINTMAP, // "paint_map" TERRAIN_DETAIL0_BASE_COLOR, // "detail_0_base_color" (GLTF) TERRAIN_DETAIL1_BASE_COLOR, // "detail_1_base_color" (GLTF) @@ -291,6 +292,8 @@ public: TERRAIN_EMISSIVE_COLORS, // "emissiveColors" (GLTF) TERRAIN_MINIMUM_ALPHAS, // "minimum_alphas" (GLTF) + REGION_SCALE, // "region_scale" (GLTF) + SHINY_ORIGIN, // "origin" DISPLAY_GAMMA, // "display_gamma" diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 2eb7c21f77..02afcf12c6 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -794,6 +794,18 @@ void LLVertexBuffer::setLabel(const char* label) { } #endif +void LLVertexBuffer::clone(LLVertexBuffer& target) const +{ + target.mTypeMask = mTypeMask; + target.mIndicesType = mIndicesType; + target.mIndicesStride = mIndicesStride; + if (target.getNumVerts() != getNumVerts() || + target.getNumIndices() != getNumIndices()) + { + target.allocateBuffer(getNumVerts(), getNumIndices()); + } +} + void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const { llassert(validateRange(start, end, count, indices_offset)); diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 49500e28ce..4ada0c335b 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -163,13 +163,13 @@ public: // set for rendering // assumes (and will assert on) the following: - // - this buffer has no pending unampBuffer call + // - this buffer has no pending unmapBuffer call // - a shader is currently bound // - This buffer has sufficient attributes within it to satisfy the needs of the currently bound shader void setBuffer(); // Only call each getVertexPointer, etc, once before calling unmapBuffer() - // call unmapBuffer() after calls to getXXXStrider() before any cals to setBuffer() + // call unmapBuffer() after calls to getXXXStrider() before any calls to setBuffer() // example: // vb->getVertexBuffer(verts); // vb->getNormalStrider(norms); @@ -218,12 +218,12 @@ public: U32 getNumIndices() const { return mNumIndices; } U32 getTypeMask() const { return mTypeMask; } - bool hasDataType(AttributeType type) const { return ((1 << type) & getTypeMask()); } + bool hasDataType(AttributeType type) const { return ((1 << type) & getTypeMask()); } U32 getSize() const { return mSize; } U32 getIndicesSize() const { return mIndicesSize; } U8* getMappedData() const { return mMappedData; } U8* getMappedIndices() const { return mMappedIndexData; } - U32 getOffset(AttributeType type) const { return mOffsets[type]; } + U32 getOffset(AttributeType type) const { return mOffsets[type]; } // these functions assume (and assert on) the current VBO being bound // Detailed error checking can be enabled by setting gDebugGL to true @@ -242,6 +242,7 @@ public: void setLabel(const char* label); #endif + void clone(LLVertexBuffer& target) const; protected: U32 mGLBuffer = 0; // GL VBO handle diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 06f7a20add..495ba2f40f 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -36,12 +36,12 @@ #include "boost/bind.hpp" -static const S32 BORDER_MARGIN = 2; -static const S32 PARENT_BORDER_MARGIN = 5; -static const S32 VERTICAL_MULTIPLE = 16; -static const F32 MIN_AUTO_SCROLL_RATE = 120.f; -static const F32 MAX_AUTO_SCROLL_RATE = 500.f; -static const F32 AUTO_SCROLL_RATE_ACCEL = 120.f; +static constexpr S32 BORDER_MARGIN = 2; +static constexpr S32 PARENT_BORDER_MARGIN = 5; +static constexpr S32 VERTICAL_MULTIPLE = 16; +static constexpr F32 MIN_AUTO_SCROLL_RATE = 120.f; +static constexpr F32 MAX_AUTO_SCROLL_RATE = 500.f; +static constexpr F32 AUTO_SCROLL_RATE_ACCEL = 120.f; // LLAccordionCtrl =================================================================| @@ -49,13 +49,7 @@ static LLDefaultChildRegistry::Register<LLAccordionCtrl> t2("accordion"); LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) , mFitParent(params.fit_parent) - , mAutoScrolling( false ) - , mAutoScrollRate( 0.f ) - , mSelectedTab( NULL ) - , mTabComparator( NULL ) - , mNoVisibleTabsHelpText(NULL) , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString()) - , mSkipScrollToChild(false) { initNoTabsWidget(params.no_matched_tabs_text); @@ -67,10 +61,6 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) } LLAccordionCtrl::LLAccordionCtrl() : LLPanel() - , mAutoScrolling( false ) - , mAutoScrollRate( 0.f ) - , mSelectedTab( NULL ) - , mNoVisibleTabsHelpText(NULL) { initNoTabsWidget(LLTextBox::Params()); @@ -133,11 +123,10 @@ bool LLAccordionCtrl::postBuild() mScrollbar->setFollowsBottom(); //if it was created from xml... - std::vector<LLUICtrl*> accordion_tabs; - for (child_list_const_iter_t it = getChildList()->begin(); - getChildList()->end() != it; ++it) + std::vector<LLAccordionCtrlTab*> accordion_tabs; + for(LLView* viewp : *getChildList()) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*it); + LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(viewp); if (accordion_tab == NULL) continue; if (std::find(mAccordionTabs.begin(), mAccordionTabs.end(), accordion_tab) == mAccordionTabs.end()) @@ -146,7 +135,7 @@ bool LLAccordionCtrl::postBuild() } } - for (std::vector<LLUICtrl*>::reverse_iterator it = accordion_tabs.rbegin(); + for (auto it = accordion_tabs.rbegin(); it < accordion_tabs.rend(); ++it) { addCollapsibleCtrl(*it); @@ -294,11 +283,8 @@ void LLAccordionCtrl::hideScrollbar(S32 width, S32 height) S32 LLAccordionCtrl::calcRecuiredHeight() { S32 rec_height = 0; - - std::vector<LLAccordionCtrlTab*>::iterator panel; - for(panel=mAccordionTabs.begin(); panel!=mAccordionTabs.end(); ++panel) + for(LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*panel); if(accordion_tab && accordion_tab->getVisible()) { rec_height += accordion_tab->getRect().getHeight(); @@ -330,9 +316,8 @@ void LLAccordionCtrl::ctrlShiftVertical(LLView* panel, S32 delta) //--------------------------------------------------------------------------------- -void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) +void LLAccordionCtrl::addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view); if (!accordion_tab) return; if (std::find(beginChild(), endChild(), accordion_tab) == endChild()) @@ -343,9 +328,8 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) arrange(); } -void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view) +void LLAccordionCtrl::removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view); if(!accordion_tab) return; @@ -363,7 +347,7 @@ void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view) } // if removed is selected - reset selection - if (mSelectedTab == view) + if (mSelectedTab == accordion_tab) { mSelectedTab = NULL; } @@ -401,24 +385,20 @@ void LLAccordionCtrl::arrangeSingle() S32 collapsed_height = 0; - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { - collapsed_height+=mAccordionTabs[i]->getRect().getHeight(); + collapsed_height += accordion_tab->getRect().getHeight(); } } S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height; - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) @@ -448,8 +428,8 @@ void LLAccordionCtrl::arrangeSingle() // make sure at least header is shown panel_height = llmax(panel_height, accordion_tab->getHeaderHeight()); - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); - panel_top -= mAccordionTabs[i]->getRect().getHeight(); + ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); + panel_top -= accordion_tab->getRect().getHeight(); } show_hide_scrollbar(getRect().getWidth(), getRect().getHeight()); @@ -463,17 +443,16 @@ void LLAccordionCtrl::arrangeMultiple() S32 panel_width = getRect().getWidth() - 4; //Calculate params - for (size_t i = 0; i < mAccordionTabs.size(); i++ ) + for (size_t i = 0, end = mAccordionTabs.size(); i < end; i++) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - + LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight()); - panel_top -= mAccordionTabs[i]->getRect().getHeight(); + ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight()); + panel_top -= accordion_tab->getRect().getHeight(); } else { @@ -495,13 +474,13 @@ void LLAccordionCtrl::arrangeMultiple() } // minimum tab height is equal to header height - if (mAccordionTabs[i]->getHeaderHeight() > panel_height) + if (accordion_tab->getHeaderHeight() > panel_height) { - panel_height = mAccordionTabs[i]->getHeaderHeight(); + panel_height = accordion_tab->getHeaderHeight(); } } - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); + ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); panel_top -= panel_height; } @@ -528,7 +507,7 @@ void LLAccordionCtrl::arrange() S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel S32 panel_width = getRect().getWidth() - 4; - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[0]); + LLAccordionCtrlTab* accordion_tab = mAccordionTabs[0]; LLRect panel_rect = accordion_tab->getRect(); @@ -638,12 +617,12 @@ void LLAccordionCtrl::updateLayout(S32 width, S32 height) panel_width -= scrollbar_size; // set sizes for first panels and dragbars - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - if (!mAccordionTabs[i]->getVisible()) + if (!accordion_tab->getVisible()) continue; - LLRect panel_rect = mAccordionTabs[i]->getRect(); - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_rect.mLeft, panel_top, panel_width, panel_rect.getHeight()); + LLRect panel_rect = accordion_tab->getRect(); + ctrlSetLeftTopAndSize(accordion_tab, panel_rect.mLeft, panel_top, panel_width, panel_rect.getHeight()); panel_top -= panel_rect.getHeight(); } } @@ -685,9 +664,8 @@ void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl) void LLAccordionCtrl::onOpen(const LLSD& key) { - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); LLPanel* panel = dynamic_cast<LLPanel*>(accordion_tab->getAccordionView()); if (panel != NULL) { @@ -711,7 +689,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) { for (size_t i = 0; i < mAccordionTabs.size(); ++i) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); if (accordion_tab->hasFocus()) { while (++i < mAccordionTabs.size()) @@ -721,7 +699,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } if (i < mAccordionTabs.size()) { - accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); accordion_tab->notify(LLSD().with("action","select_first")); return 1; } @@ -734,7 +712,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) { for (size_t i = 0; i < mAccordionTabs.size(); ++i) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); if (accordion_tab->hasFocus() && i > 0) { bool prev_visible_tab_found = false; @@ -749,7 +727,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) if (prev_visible_tab_found) { - accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); accordion_tab->notify(LLSD().with("action","select_last")); return 1; } @@ -887,15 +865,12 @@ void LLAccordionCtrl::setFilterSubString(const std::string& filter_string) const LLAccordionCtrlTab* LLAccordionCtrl::getExpandedTab() const { - typedef std::vector<LLAccordionCtrlTab*>::const_iterator tabs_const_iterator; - - const LLAccordionCtrlTab* result = 0; - - for (tabs_const_iterator i = mAccordionTabs.begin(); i != mAccordionTabs.end(); ++i) + const LLAccordionCtrlTab* result = nullptr; + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - if ((*i)->isExpanded()) + if (accordion_tab->isExpanded()) { - result = *i; + result = accordion_tab; break; } } @@ -913,11 +888,11 @@ S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 availabl S32 collapsed_tabs_height = 0; S32 num_expanded = 0; - for (size_t n = tab_index; n < mAccordionTabs.size(); ++n) + for (LLAccordionCtrlTab* tab : mAccordionTabs) { - if (!mAccordionTabs[n]->isExpanded()) + if (!tab->isExpanded()) { - collapsed_tabs_height += mAccordionTabs[n]->getHeaderHeight(); + collapsed_tabs_height += tab->getHeaderHeight(); } else { @@ -939,10 +914,8 @@ void LLAccordionCtrl::collapseAllTabs() { if (mAccordionTabs.size() > 0) { - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* tab : mAccordionTabs) { - LLAccordionCtrlTab *tab = mAccordionTabs[i]; - if (tab->getDisplayChildren()) { tab->setDisplayChildren(false); diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 1dfa9100f6..43a33a2b3c 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -57,8 +57,8 @@ public: class LLTabComparator { public: - LLTabComparator() {}; - virtual ~LLTabComparator() {}; + LLTabComparator() = default; + virtual ~LLTabComparator() = default; /** Returns true if tab1 < tab2, false otherwise */ virtual bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const = 0; @@ -103,8 +103,8 @@ public: // Call reshape after changing splitter's size virtual void reshape(S32 width, S32 height, bool called_from_parent = true); - void addCollapsibleCtrl(LLView* view); - void removeCollapsibleCtrl(LLView* view); + void addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab); + void removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab); void arrange(); @@ -180,20 +180,20 @@ private: private: LLRect mInnerRect; - LLScrollbar* mScrollbar; - bool mSingleExpansion; - bool mFitParent; - bool mAutoScrolling; - F32 mAutoScrollRate; - LLTextBox* mNoVisibleTabsHelpText; + LLScrollbar* mScrollbar = nullptr; + bool mSingleExpansion = false; + bool mFitParent = false; + bool mAutoScrolling = false; + F32 mAutoScrollRate = 0.f; + LLTextBox* mNoVisibleTabsHelpText = nullptr; - bool mSkipScrollToChild; + bool mSkipScrollToChild = false; std::string mNoMatchedTabsOrigString; std::string mNoVisibleTabsOrigString; - LLAccordionCtrlTab* mSelectedTab; - const LLTabComparator* mTabComparator; + LLAccordionCtrlTab* mSelectedTab = nullptr; + const LLTabComparator* mTabComparator = nullptr; }; diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index c635d24f51..0d7c98294f 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -73,10 +73,20 @@ bool LLFocusableElement::wantsReturnKey() const // virtual LLFocusableElement::~LLFocusableElement() { - delete mFocusLostCallback; - delete mFocusReceivedCallback; - delete mFocusChangedCallback; - delete mTopLostCallback; + auto free_signal = [&](focus_signal_t*& signal) + { + if (signal) + { + signal->disconnect_all_slots(); + delete signal; + signal = nullptr; + } + }; + + free_signal(mFocusLostCallback); + free_signal(mFocusReceivedCallback); + free_signal(mFocusChangedCallback); + free_signal(mTopLostCallback); } void LLFocusableElement::onFocusReceived() diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 3a3aa7e4df..1c59938f90 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -86,10 +86,6 @@ void LLLayoutPanel::initFromParams(const Params& p) LLLayoutPanel::~LLLayoutPanel() { - // probably not necessary, but... - delete mResizeBar; - mResizeBar = NULL; - gFocusMgr.removeKeyboardFocusWithoutCallback(this); } @@ -242,11 +238,9 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) LLLayoutStack::~LLLayoutStack() { - e_panel_list_t panels = mPanels; // copy list of panel pointers - mPanels.clear(); // clear so that removeChild() calls don't cause trouble - std::for_each(panels.begin(), panels.end(), DeletePointer()); } +// virtual void LLLayoutStack::draw() { updateLayout(); @@ -284,8 +278,14 @@ void LLLayoutStack::draw() } } +// virtual void LLLayoutStack::deleteAllChildren() { + for (LLLayoutPanel* p : mPanels) + { + p->mResizeBar = nullptr; + } + mPanels.clear(); LLView::deleteAllChildren(); @@ -295,29 +295,47 @@ void LLLayoutStack::deleteAllChildren() mNeedsLayout = true; } +// virtual void LLLayoutStack::removeChild(LLView* view) { - LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view)); - - if (embedded_panelp) + if (LLLayoutPanel* embedded_panelp = dynamic_cast<LLLayoutPanel*>(view)) { - mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp)); - LLView::removeChild(view); - updateFractionalSizes(); - mNeedsLayout = true; + auto it = std::find(mPanels.begin(), mPanels.end(), embedded_panelp); + if (it != mPanels.end()) + { + mPanels.erase(it); + } + if (embedded_panelp->mResizeBar) + { + LLView::removeChild(embedded_panelp->mResizeBar); + embedded_panelp->mResizeBar = nullptr; + } } - else + else if (LLResizeBar* resize_bar = dynamic_cast<LLResizeBar*>(view)) { - LLView::removeChild(view); + for (LLLayoutPanel* p : mPanels) + { + if (p->mResizeBar == resize_bar) + { + p->mResizeBar = nullptr; + } + } } + + LLView::removeChild(view); + + updateFractionalSizes(); + mNeedsLayout = true; } +// virtual bool LLLayoutStack::postBuild() { updateLayout(); return true; } +// virtual bool LLLayoutStack::addChild(LLView* child, S32 tab_group) { LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child); @@ -983,6 +1001,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& //normalizeFractionalSizes(); } +// virtual void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent) { mNeedsLayout = true; diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 16ffd352cf..e15616a16b 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -42,19 +42,13 @@ static const std::string DICT_FILE_USER = "user_dictionaries.xml"; LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal; LLSpellChecker::LLSpellChecker() - : mHunspell(NULL) { + // Load initial dictionary information + refreshDictionaryMap(); } LLSpellChecker::~LLSpellChecker() { - delete mHunspell; -} - -void LLSpellChecker::initSingleton() -{ - // Load initial dictionary information - refreshDictionaryMap(); } bool LLSpellChecker::checkSpelling(const std::string& word) const @@ -300,8 +294,7 @@ void LLSpellChecker::initHunspell(const std::string& dict_language) { if (mHunspell) { - delete mHunspell; - mHunspell = NULL; + mHunspell.reset(); mDictLanguage.clear(); mDictFile.clear(); mIgnoreList.clear(); @@ -322,11 +315,11 @@ void LLSpellChecker::initHunspell(const std::string& dict_language) const std::string filename_dic = dict_entry["name"].asString() + ".dic"; if ( (gDirUtilp->fileExists(user_path + filename_aff)) && (gDirUtilp->fileExists(user_path + filename_dic)) ) { - mHunspell = new Hunspell((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str()); + mHunspell = std::make_unique<Hunspell>((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str()); } else if ( (gDirUtilp->fileExists(app_path + filename_aff)) && (gDirUtilp->fileExists(app_path + filename_dic)) ) { - mHunspell = new Hunspell((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str()); + mHunspell = std::make_unique<Hunspell>((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str()); } if (!mHunspell) { diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h index e4d8a12ef1..9df2f94085 100644 --- a/indra/llui/llspellcheck.h +++ b/indra/llui/llspellcheck.h @@ -34,12 +34,12 @@ class Hunspell; -class LLSpellChecker : public LLSingleton<LLSpellChecker> +class LLSpellChecker : public LLSimpleton<LLSpellChecker> { - LLSINGLETON(LLSpellChecker); +public: + LLSpellChecker(); ~LLSpellChecker(); -public: void addToCustomDictionary(const std::string& word); void addToIgnoreList(const std::string& word); bool checkSpelling(const std::string& word) const; @@ -47,7 +47,6 @@ public: protected: void addToDictFile(const std::string& dict_path, const std::string& word); void initHunspell(const std::string& dict_language); - void initSingleton() override; public: typedef std::list<std::string> dict_list_t; @@ -77,7 +76,7 @@ public: static boost::signals2::connection setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb); protected: - Hunspell* mHunspell; + std::unique_ptr<Hunspell> mHunspell; std::string mDictLanguage; std::string mDictFile; dict_list_t mDictSecondary; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 8d46422c09..e36dae3955 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -54,6 +54,7 @@ #include "llmenubutton.h" #include "llloadingindicator.h" #include "llwindow.h" +#include "llspellcheck.h" // for registration #include "llfiltereditor.h" @@ -157,6 +158,7 @@ mRootView(NULL), mHelpImpl(NULL) { LLRender2D::createInstance(image_provider); + LLSpellChecker::createInstance(); if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) || (get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) || @@ -198,6 +200,7 @@ mHelpImpl(NULL) LLUI::~LLUI() { + LLSpellChecker::deleteSingleton(); LLRender2D::deleteSingleton(); } diff --git a/indra/llwebrtc/CMakeLists.txt b/indra/llwebrtc/CMakeLists.txt index fd1788c5d4..30aaec1265 100644 --- a/indra/llwebrtc/CMakeLists.txt +++ b/indra/llwebrtc/CMakeLists.txt @@ -31,7 +31,11 @@ add_library (llwebrtc SHARED ${llwebrtc_SOURCE_FILES}) set_target_properties(llwebrtc PROPERTIES PUBLIC_HEADER llwebrtc.h) if (WINDOWS) - target_link_libraries(llwebrtc PRIVATE ll::webrtc + set_target_properties(llwebrtc + PROPERTIES + LINK_FLAGS "/debug /LARGEADDRESSAWARE" + ) + target_link_libraries(llwebrtc PRIVATE ll::webrtc secur32 winmm dmoguids @@ -39,8 +43,15 @@ if (WINDOWS) msdmo strmiids iphlpapi) + if (USE_BUGSPLAT) + set_target_properties(llwebrtc PROPERTIES PDB_OUTPUT_DIRECTORY "${SYMBOLS_STAGING_DIR}") + endif (USE_BUGSPLAT) elseif (DARWIN) target_link_libraries(llwebrtc PRIVATE ll::webrtc) + if (USE_BUGSPLAT) + set_target_properties(llwebrtc PROPERTIES XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym" + XCODE_ATTRIBUTE_DWARF_DSYM_FOLDER_PATH "${SYMBOLS_STAGING_DIR}/dSYMs") + endif (USE_BUGSPLAT) elseif (LINUX) target_link_libraries(llwebrtc PRIVATE ll::webrtc) endif (WINDOWS) diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index 392a67b5ce..4bc069c5a4 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -441,7 +441,7 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) return mDriverVersion; } -void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPropValue, int outputSize) +void get_wstring(IDxDiagContainer* containerp, const WCHAR* wszPropName, WCHAR* wszPropValue, int outputSize) { HRESULT hr; VARIANT var; @@ -472,7 +472,7 @@ void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPro VariantClear( &var ); } -std::string get_string(IDxDiagContainer *containerp, WCHAR *wszPropName) +std::string get_string(IDxDiagContainer *containerp, const WCHAR *wszPropName) { WCHAR wszPropValue[256]; get_wstring(containerp, wszPropName, wszPropValue, 256); @@ -1059,7 +1059,7 @@ LLSD LLDXHardware::getDisplayInfo() // Dump the string as an int into the structure char *stopstring; - ret["VRAM"] = strtol(ram_str.c_str(), &stopstring, 10); + ret["VRAM"] = LLSD::Integer(strtol(ram_str.c_str(), &stopstring, 10)); std::string device_name = get_string(device_containerp, L"szDescription"); ret["DeviceName"] = device_name; std::string device_driver= get_string(device_containerp, L"szDriverVersion"); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index f4e5e0fd21..7f0e890957 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -794,8 +794,8 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, size_t name_len = strlen(display_device.DeviceName ); size_t desc_len = strlen(display_device.DeviceString); - CHAR *name = name_len ? display_device.DeviceName : "???"; - CHAR *desc = desc_len ? display_device.DeviceString : "???"; + const CHAR *name = name_len ? display_device.DeviceName : "???"; + const CHAR *desc = desc_len ? display_device.DeviceString : "???"; sprintf(text, "Display Device %d: %s, %s", display_index, name, desc); LL_INFOS("Window") << text << LL_ENDL; diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 344352e980..4f54a9d705 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -36,32 +36,8 @@ #include <vector> -// *NOTE: boost::visit_each<> generates warning 4675 on .net 2003 -// Disable the warning for the boost includes. -#if LL_WINDOWS -# if (_MSC_VER >= 1300 && _MSC_VER < 1400) -# pragma warning(push) -# pragma warning( disable : 4675 ) -# endif -#endif - #include <boost/bind.hpp> - -#if LL_WINDOWS - #pragma warning (push) - #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch - #pragma warning (disable : 4264) -#endif #include <boost/signals2.hpp> -#if LL_WINDOWS - #pragma warning (pop) -#endif - -#if LL_WINDOWS -# if (_MSC_VER >= 1300 && _MSC_VER < 1400) -# pragma warning(pop) -# endif -#endif class LLVector3; class LLVector3d; diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt index 2c4ccd46d7..28e5f64132 100644 --- a/indra/media_plugins/cef/CMakeLists.txt +++ b/indra/media_plugins/cef/CMakeLists.txt @@ -85,7 +85,7 @@ if (WINDOWS) set_target_properties( media_plugin_cef PROPERTIES - LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMT /IGNORE:4099" + LINK_FLAGS "/MANIFEST:NO /NODEFAULTLIB:LIBCMT /IGNORE:4099" ) endif (WINDOWS) diff --git a/indra/media_plugins/example/CMakeLists.txt b/indra/media_plugins/example/CMakeLists.txt index 86e982fbb4..71343d5f85 100644 --- a/indra/media_plugins/example/CMakeLists.txt +++ b/indra/media_plugins/example/CMakeLists.txt @@ -28,7 +28,7 @@ if (WINDOWS) set_target_properties( media_plugin_example PROPERTIES - LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /LTCG /NODEFAULTLIB:LIBCMT" + LINK_FLAGS "/MANIFEST:NO /NODEFAULTLIB:LIBCMT" ) endif (WINDOWS) diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt index eaf9dde981..863b4617e9 100644 --- a/indra/media_plugins/libvlc/CMakeLists.txt +++ b/indra/media_plugins/libvlc/CMakeLists.txt @@ -32,7 +32,7 @@ if (WINDOWS) set_target_properties( media_plugin_libvlc PROPERTIES - LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMT" + LINK_FLAGS "/MANIFEST:NO /NODEFAULTLIB:LIBCMT" ) endif (WINDOWS) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 8894bcd3d5..7d2cea8371 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -579,6 +579,7 @@ set(viewer_SOURCE_FILES llsyswellwindow.cpp llteleporthistory.cpp llteleporthistorystorage.cpp + llterrainpaintmap.cpp lltexturecache.cpp lltexturectrl.cpp lltexturefetch.cpp @@ -1237,6 +1238,7 @@ set(viewer_HEADER_FILES lltable.h llteleporthistory.h llteleporthistorystorage.h + llterrainpaintmap.h lltexturecache.h lltexturectrl.h lltexturefetch.h @@ -1748,15 +1750,11 @@ if (WINDOWS) list(APPEND COPY_INPUT_DEPENDENCIES ${SHARED_LIB_STAGING_DIR}/vivoxsdk_x64.dll ${SHARED_LIB_STAGING_DIR}/ortp_x64.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll ) else (ADDRESS_SIZE EQUAL 64) list(APPEND COPY_INPUT_DEPENDENCIES ${SHARED_LIB_STAGING_DIR}/vivoxsdk.dll ${SHARED_LIB_STAGING_DIR}/ortp.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll ) endif (ADDRESS_SIZE EQUAL 64) @@ -1777,6 +1775,7 @@ if (WINDOWS) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" @@ -1837,6 +1836,7 @@ if (WINDOWS) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" @@ -1986,6 +1986,7 @@ if (LINUX) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2013,6 +2014,7 @@ if (LINUX) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2072,8 +2074,6 @@ if (DARWIN) set(VIEWER_APP_BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/${product}.app") set(VIEWER_APP_EXE "${VIEWER_APP_BUNDLE}/Contents/MacOS/${product}") - set(VIEWER_APP_DSYM "${VIEWER_APP_EXE}.dSYM") - set(VIEWER_APP_XCARCHIVE "${VIEWER_APP_BUNDLE}/../${product}.xcarchive.zip") configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/Info-SecondLife.plist" @@ -2090,6 +2090,7 @@ if (DARWIN) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> --bundleid=${MACOSX_BUNDLE_GUI_IDENTIFIER} @@ -2124,6 +2125,7 @@ if (DARWIN) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" @@ -2144,73 +2146,51 @@ if (INSTALL) include(${CMAKE_CURRENT_SOURCE_DIR}/ViewerInstall.cmake) endif (INSTALL) -# Note that the conventional VIEWER_SYMBOL_FILE is set by ../../build.sh if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIEWER_SYMBOL_FILE) if (USE_BUGSPLAT) # BugSplat symbol-file generation if (WINDOWS) - # Just pack up a tarball containing only the .pdb file for the - # executable. Because we intend to use cygwin tar, we must render - # VIEWER_SYMBOL_FILE in cygwin path syntax. - execute_process(COMMAND "cygpath" "-u" "${VIEWER_SYMBOL_FILE}" - OUTPUT_VARIABLE VIEWER_SYMBOL_FILE_CYGWIN - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND "cygpath" "-u" "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" - OUTPUT_VARIABLE PARENT_DIRECTORY_CYGWIN - OUTPUT_STRIP_TRAILING_WHITESPACE) - add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}" - # Use of 'tar ...J' here assumes VIEWER_SYMBOL_FILE endswith .tar.xz; - # testing a string suffix is painful enough in CMake language that - # we'll continue assuming it until forced to generalize. + set(VIEWER_APP_SYMBOLS_ARCHIVE "${SYMBOLS_STAGING_DIR}.sym.tar.xz") + set_target_properties( ${VIEWER_BINARY_NAME} PROPERTIES PDB_OUTPUT_DIRECTORY "${SYMBOLS_STAGING_DIR}") + + # Just pack up a tarball containing only the .pdb files for the + # executables. + add_custom_command(OUTPUT "${VIEWER_APP_SYMBOLS_ARCHIVE}" COMMAND "tar" ARGS "cJf" - "${VIEWER_SYMBOL_FILE_CYGWIN}" - "-C" - "${PARENT_DIRECTORY_CYGWIN}" - "secondlife-bin.pdb" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-bin.pdb" - COMMENT "Packing viewer PDB into ${VIEWER_SYMBOL_FILE_CYGWIN}" + "${VIEWER_CHANNEL}.sym.tar.xz" + "${VIEWER_CHANNEL}" + DEPENDS "${VIEWER_BINARY_NAME}" llwebrtc + WORKING_DIRECTORY "${SYMBOLS_STAGING_DIR}/.." + COMMENT "Packing viewer PDBs into ${VIEWER_APP_SYMBOLS_ARCHIVE}" ) - add_custom_target(generate_symbols DEPENDS "${VIEWER_SYMBOL_FILE}" ${VIEWER_BINARY_NAME}) - add_dependencies(generate_symbols ${VIEWER_BINARY_NAME}) + add_custom_target(generate_symbols DEPENDS "${VIEWER_APP_SYMBOLS_ARCHIVE}") + add_dependencies(generate_symbols ${VIEWER_BINARY_NAME} llwebrtc) + endif (WINDOWS) if (DARWIN) - # Have to run dsymutil first, then pack up the resulting .dSYM directory - add_custom_command(OUTPUT "${VIEWER_APP_DSYM}" - COMMAND "dsymutil" - ARGS - ${VIEWER_APP_EXE} - COMMENT "Generating ${VIEWER_APP_DSYM}" - ) - add_custom_target(dsym_generate DEPENDS "${VIEWER_APP_DSYM}") - add_dependencies(dsym_generate ${VIEWER_BINARY_NAME}) + set(VIEWER_APP_XCARCHIVE "${SYMBOLS_STAGING_DIR}.xcarchive.zip") + + # we only need an xcarchive with dSYMs (including the application) + set_target_properties(${VIEWER_BINARY_NAME} + PROPERTIES + XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym" + XCODE_ATTRIBUTE_DWARF_DSYM_FOLDER_PATH "${SYMBOLS_STAGING_DIR}/dSYMs") + add_custom_command(OUTPUT "${VIEWER_APP_XCARCHIVE}" COMMAND "zip" ARGS "-r" "${VIEWER_APP_XCARCHIVE}" - "." - WORKING_DIRECTORY "${VIEWER_APP_DSYM}/.." - DEPENDS "${VIEWER_APP_DSYM}" - COMMENT "Generating xcarchive.zip for upload to BugSplat" - ) - add_custom_target(dsym_xcarchive DEPENDS "${VIEWER_APP_XCARCHIVE}") - add_dependencies(dsym_xcarchive dsym_generate) - # Have to create a stamp file, and depend on it, to force CMake to run - # the cleanup step. - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dsym.stamp" - COMMAND rm -rf "${VIEWER_APP_DSYM}" - COMMAND touch "${CMAKE_CURRENT_BINARY_DIR}/dsym.stamp" - DEPENDS "${VIEWER_APP_XCARCHIVE}" - COMMENT "Cleaning up dSYM" + "${VIEWER_CHANNEL}" + WORKING_DIRECTORY "${SYMBOLS_STAGING_DIR}/.." + DEPENDS "${VIEWER_BINARY_NAME}" llwebrtc + COMMENT "Generating ${VIEWER_APP_XCARCHIVE} for upload to BugSplat" ) add_custom_target(generate_symbols DEPENDS - "${VIEWER_APP_DSYM}" "${VIEWER_APP_XCARCHIVE}" - "${CMAKE_CURRENT_BINARY_DIR}/dsym.stamp" ) - add_dependencies(generate_symbols dsym_xcarchive) endif (DARWIN) if (LINUX) # TBD diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1cdc1c4fde..1863eaf945 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -621,6 +621,18 @@ <key>Value</key> <string>http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/[GRID_LOWERCASE]/avatars.html</string> </map> + <!--AvatarBakedTextureUploadTimeout is in use by QA--> + <key>AvatarBakedTextureUploadTimeout</key> + <map> + <key>Comment</key> + <string>Specifes the maximum time in seconds to wait before sending your baked textures for avatar appearance. Set to 0 to disable and wait until all baked textures are at highest resolution.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>60</integer> + </map> <key>AvatarPhysics</key> <map> <key>Comment</key> @@ -1874,6 +1886,28 @@ <key>Value</key> <real>64.0</real> </map> + <key>AvatarExtentRefreshPeriodBatch</key> + <map> + <key>Comment</key> + <string>how many frames do we spread over by default when refreshing extents (default is 4)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>4</integer> + </map> + <key>AvatarExtentRefreshMaxPerBatch</key> + <map> + <key>Comment</key> + <string>how many avatars do we want to handle in total per batch (default is 5)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>5</integer> + </map> <key>DebugAvatarAppearanceMessage</key> <map> <key>Comment</key> @@ -14977,6 +15011,39 @@ <key>Value</key> <real>0.0</real> </map> + <key>LocalTerrainPaintEnabled</key> + <map> + <key>Comment</key> + <string>Enables local paintmap if LocalTerrainAsset1, etc are set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>TerrainPaintBitDepth</key> + <map> + <key>Comment</key> + <string>Bit depth for future terrain paint map operations. Min: 1. Max: 8. Takes effect when the paint map is created or modified. Modifications to an existing paintmap of different bit depth will have lower precision.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>5</integer> + </map> + <key>TerrainPaintResolution</key> + <map> + <key>Comment</key> + <string>Resolution of the terrain paint map in pixels. Rounded to a power of two. Min: 16. Max: RenderMaxTextureResolution. Takes effect when the paint map is created.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>2048</integer> + </map> <key>PathfindingRetrieveNeighboringRegion</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl index 6ca35419f2..410c447c64 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl @@ -30,6 +30,9 @@ #define TERRAIN_PBR_DETAIL_NORMAL -2 #define TERRAIN_PBR_DETAIL_METALLIC_ROUGHNESS -3 +#define TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE 0 +#define TERRAIN_PAINT_TYPE_PBR_PAINTMAP 1 + #if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 #define TerrainCoord vec4[3] #elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 @@ -48,6 +51,7 @@ struct TerrainMix }; TerrainMix get_terrain_mix_weights(float alpha1, float alpha2, float alphaFinal); +TerrainMix get_terrain_usage_from_weight3(vec3 weight3); struct PBRMix { @@ -97,7 +101,11 @@ PBRMix mix_pbr(PBRMix mix1, PBRMix mix2, float mix2_weight); out vec4 frag_data[4]; +#if TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE uniform sampler2D alpha_ramp; +#elif TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_PBR_PAINTMAP +uniform sampler2D paint_map; +#endif // https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#additional-textures uniform sampler2D detail_0_base_color; @@ -133,19 +141,25 @@ uniform vec3[4] emissiveColors; #endif uniform vec4 minimum_alphas; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff() -#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 -in vec4[10] vary_coords; -#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 -in vec4[2] vary_coords; -#endif in vec3 vary_position; in vec3 vary_normal; #if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) in vec3 vary_tangents[4]; flat in float vary_signs[4]; #endif + +// vary_texcoord* are used for terrain composition, vary_coords are used for terrain UVs +#if TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE in vec4 vary_texcoord0; in vec4 vary_texcoord1; +#elif TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_PBR_PAINTMAP +in vec2 vary_texcoord; +#endif +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 +in vec4[10] vary_coords; +#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 +in vec4[2] vary_coords; +#endif void mirrorClip(vec3 position); @@ -171,11 +185,16 @@ void main() // Make sure we clip the terrain if we're in a mirror. mirrorClip(vary_position); + TerrainMix tm; +#if TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE float alpha1 = texture(alpha_ramp, vary_texcoord0.zw).a; float alpha2 = texture(alpha_ramp,vary_texcoord1.xy).a; float alphaFinal = texture(alpha_ramp, vary_texcoord1.zw).a; - TerrainMix tm = get_terrain_mix_weights(alpha1, alpha2, alphaFinal); + tm = get_terrain_mix_weights(alpha1, alpha2, alphaFinal); +#elif TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_PBR_PAINTMAP + tm = get_terrain_usage_from_weight3(texture(paint_map, vary_texcoord).xyz); +#endif #if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_OCCLUSION) // RGB = Occlusion, Roughness, Metal diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl index 5098de717e..dc43007dca 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl @@ -51,7 +51,12 @@ #define TERRAIN_PBR_DETAIL_NORMAL -2 #define TERRAIN_PBR_DETAIL_METALLIC_ROUGHNESS -3 +#define TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE 0 +#define TERRAIN_PAINT_TYPE_PBR_PAINTMAP 1 + +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 in vec3 vary_vertex_normal; +#endif vec3 srgb_to_linear(vec3 c); @@ -202,6 +207,45 @@ TerrainMix get_terrain_mix_weights(float alpha1, float alpha2, float alphaFinal) return tm; } +// A paintmap weight applier for 4 swatches. The input saves a channel by not +// storing swatch 1, and assuming the weights of the 4 swatches add to 1. +// The components of weight3 should be between 0 and 1 +// The sum of the components of weight3 should be between 0 and 1 +TerrainMix get_terrain_usage_from_weight3(vec3 weight3) +{ + // These steps ensure the output weights add to between 0 and 1 + weight3.xyz = max(vec3(0.0), weight3.xyz); + weight3.xyz /= max(1.0, weight3.x + weight3.y + weight3.z); + + TerrainMix tm; + + // Extract the first weight from the other weights + tm.weight.x = 1.0 - (weight3.x + weight3.y + weight3.z); + tm.weight.yzw = weight3.xyz; + ivec4 usage = max(ivec4(0), ivec4(ceil(tm.weight))); + + tm.type = (usage.x * MIX_X) | + (usage.y * MIX_Y) | + (usage.z * MIX_Z) | + (usage.w * MIX_W); + return tm; +} + +// Inverse of get_terrain_usage_from_weight3, excluding usage flags +// The components of weight should be between 0 and 1 +// The sum of the components of weight should be 1 +vec3 get_weight3_from_terrain_weight(vec4 weight) +{ + // These steps ensure the input weights add to 1 + weight = max(vec4(0.0), weight); + weight.x += 1.0 - sign(weight.x + weight.y + weight.z + weight.w); + weight /= weight.x + weight.y + weight.z + weight.w; + + // Then return the input weights with the first weight truncated + return weight.yzw; +} + +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 TerrainTriplanar _t_triplanar() { float sharpness = TERRAIN_TRIPLANAR_BLEND_FACTOR; @@ -219,6 +263,8 @@ TerrainTriplanar _t_triplanar() ((usage.z) * SAMPLE_Z); return tw; } +#endif + // Assume weights add to 1 float terrain_mix(TerrainMix tm, vec4 tms4) diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl index c90b2b5926..6791a22a76 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl @@ -28,31 +28,47 @@ #define TERRAIN_PBR_DETAIL_NORMAL -2 #define TERRAIN_PBR_DETAIL_METALLIC_ROUGHNESS -3 +#define TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE 0 +#define TERRAIN_PAINT_TYPE_PBR_PAINTMAP 1 + uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; +#if TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_PBR_PAINTMAP +uniform float region_scale; +#endif in vec3 position; in vec3 normal; in vec4 tangent; in vec4 diffuse_color; +#if TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE in vec2 texcoord1; +#endif -out vec3 vary_vertex_normal; // Used by pbrterrainUtilF.glsl +out vec3 vary_position; out vec3 vary_normal; +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 +out vec3 vary_vertex_normal; // Used by pbrterrainUtilF.glsl +#endif #if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) out vec3 vary_tangents[4]; flat out float vary_signs[4]; #endif + +// vary_texcoord* are used for terrain composition, vary_coords are used for terrain UVs +#if TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE out vec4 vary_texcoord0; out vec4 vary_texcoord1; +#elif TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_PBR_PAINTMAP +out vec2 vary_texcoord; +#endif #if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 out vec4[10] vary_coords; #elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 out vec4[2] vary_coords; #endif -out vec3 vary_position; // *HACK: Each material uses only one texture transform, but the KHR texture // transform spec allows handling texture transforms separately for each @@ -69,7 +85,9 @@ void main() vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz; vec3 n = normal_matrix * normal; +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 vary_vertex_normal = normal; +#endif vec3 t = normal_matrix * tangent.xyz; #if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) @@ -110,9 +128,9 @@ void main() // Transform and pass tex coords { vec4[2] ttt; +#define transform_xy() terrain_texture_transform(position.xy, ttt) #if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 // Don't care about upside-down (transform_xy_flipped()) -#define transform_xy() terrain_texture_transform(position.xy, ttt) #define transform_yz() terrain_texture_transform(position.yz, ttt) #define transform_negx_z() terrain_texture_transform(position.xz * vec2(-1, 1), ttt) #define transform_yz_flipped() terrain_texture_transform(position.yz * vec2(-1, 1), ttt) @@ -157,26 +175,30 @@ void main() ttt[0].xyz = terrain_texture_transforms[0].xyz; ttt[1].x = terrain_texture_transforms[0].w; ttt[1].y = terrain_texture_transforms[1].x; - vary_coords[0].xy = terrain_texture_transform(position.xy, ttt); + vary_coords[0].xy = transform_xy(); // material 2 ttt[0].xyz = terrain_texture_transforms[1].yzw; ttt[1].xy = terrain_texture_transforms[2].xy; - vary_coords[0].zw = terrain_texture_transform(position.xy, ttt); + vary_coords[0].zw = transform_xy(); // material 3 ttt[0].xy = terrain_texture_transforms[2].zw; ttt[0].z = terrain_texture_transforms[3].x; ttt[1].xy = terrain_texture_transforms[3].yz; - vary_coords[1].xy = terrain_texture_transform(position.xy, ttt); + vary_coords[1].xy = transform_xy(); // material 4 ttt[0].x = terrain_texture_transforms[3].w; ttt[0].yz = terrain_texture_transforms[4].xy; ttt[1].xy = terrain_texture_transforms[4].zw; - vary_coords[1].zw = terrain_texture_transform(position.xy, ttt); + vary_coords[1].zw = transform_xy(); #endif } - vec4 tc = vec4(texcoord1,0,1); +#if TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE + vec2 tc = texcoord1.xy; vary_texcoord0.zw = tc.xy; vary_texcoord1.xy = tc.xy-vec2(2.0, 0.0); vary_texcoord1.zw = tc.xy-vec2(1.0, 0.0); +#elif TERRAIN_PAINT_TYPE == TERRAIN_PAINT_TYPE_PBR_PAINTMAP + vary_texcoord = position.xy / region_scale; +#endif } diff --git a/indra/newview/app_settings/shaders/class1/interface/pbrTerrainBakeF.glsl b/indra/newview/app_settings/shaders/class1/interface/pbrTerrainBakeF.glsl new file mode 100644 index 0000000000..cf20653a0f --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/pbrTerrainBakeF.glsl @@ -0,0 +1,62 @@ +/** + * @file terrainBakeF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, 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$ + */ + +/*[EXTRA_CODE_HERE]*/ + +out vec4 frag_color; + +struct TerrainMix +{ + vec4 weight; + int type; +}; + +TerrainMix get_terrain_mix_weights(float alpha1, float alpha2, float alphaFinal); + +uniform sampler2D alpha_ramp; + +// vary_texcoord* are used for terrain composition +in vec4 vary_texcoord0; +in vec4 vary_texcoord1; + +void main() +{ + TerrainMix tm; + float alpha1 = texture(alpha_ramp, vary_texcoord0.zw).a; + float alpha2 = texture(alpha_ramp,vary_texcoord1.xy).a; + float alphaFinal = texture(alpha_ramp, vary_texcoord1.zw).a; + + tm = get_terrain_mix_weights(alpha1, alpha2, alphaFinal); + + // tm.weight.x can be ignored. The paintmap saves a channel by not storing + // swatch 1, and assuming the weights of the 4 swatches add to 1. + // TERRAIN_PAINT_PRECISION emulates loss of precision at lower bit depth + // when a corresponding low-bit image format is not available. Because + // integral values at one depth cannot be precisely represented at another + // bit depth, rounding is required. To maximize numerical stability for + // future conversions, bit depth conversions should round to the nearest + // integer, not floor or ceil. + frag_color = max(vec4(round(tm.weight.yzw * TERRAIN_PAINT_PRECISION) / TERRAIN_PAINT_PRECISION, 1.0), vec4(0)); +} diff --git a/indra/llcommon/llallocator.h b/indra/newview/app_settings/shaders/class1/interface/pbrTerrainBakeV.glsl index aa3eead546..fd150b54ad 100644 --- a/indra/llcommon/llallocator.h +++ b/indra/newview/app_settings/shaders/class1/interface/pbrTerrainBakeV.glsl @@ -1,10 +1,9 @@ /** - * @file llallocator.h - * @brief Declaration of the LLAllocator class. + * @file pbrTerrainBakeV.glsl * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2024, 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 @@ -24,28 +23,20 @@ * $/LicenseInfo$ */ -#ifndef LL_LLALLOCATOR_H -#define LL_LLALLOCATOR_H +uniform mat4 modelview_projection_matrix; -#include <string> +in vec3 position; +in vec2 texcoord1; -#include "llallocator_heap_profile.h" +out vec4 vary_texcoord0; +out vec4 vary_texcoord1; -class LL_COMMON_API LLAllocator { - friend class LLMemoryView; +void main() +{ + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vec2 tc = texcoord1.xy; + vary_texcoord0.zw = tc.xy; + vary_texcoord1.xy = tc.xy-vec2(2.0, 0.0); + vary_texcoord1.zw = tc.xy-vec2(1.0, 0.0); +} -public: - void setProfilingEnabled(bool should_enable); - - static bool isProfiling(); - - LLAllocatorHeapProfile const & getProfile(); - -private: - std::string getRawProfile(); - -private: - LLAllocatorHeapProfile mProf; -}; - -#endif // LL_LLALLOCATOR_H diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 358fc2dfc8..213f0ab845 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -250,7 +250,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 512 RenderHeroProbeDistance 1 8 RenderHeroProbeUpdateRate 1 2 @@ -285,7 +285,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 1024 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 @@ -320,7 +320,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 2048 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 581350d73c..4f361a8dfe 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -282,7 +282,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 2 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 512 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 @@ -317,7 +317,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 1024 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index d1dab94a76..77f24ac6a6 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -32,6 +32,7 @@ SetCompressor /solid lzma # Compress whole installer as one block SetDatablockOptimize off # Only saves us 0.1%, not worth it
XPStyle on # Add an XP manifest to the installer
RequestExecutionLevel admin # For when we write to Program Files
+Unicode true # Enable unicode support
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Project flags
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index a808c196c7..946d674e8b 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -66,11 +66,6 @@ #include "llavatarpropertiesprocessor.h" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - namespace { const S32 BAKE_RETRY_MAX_COUNT = 5; @@ -2133,11 +2128,11 @@ void LLAppearanceMgr::filterWearableItems( items.clear(); for (S32 i=0; i<LLWearableType::WT_COUNT; i++) { - auto size = items_by_type[i].size(); + S32 size = (S32)items_by_type[i].size(); if (size <= 0) continue; - auto start_index = llmax(0,size-max_per_type); - for (size_t j = start_index; j<size; j++) + S32 start_index = llmax(0,size-max_per_type); + for (S32 j = start_index; j<size; j++) { items.push_back(items_by_type[i][j]); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 25b9960225..76b828aebf 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -62,7 +62,6 @@ #include "llfocusmgr.h" #include "llurlfloaterdispatchhandler.h" #include "llviewerjoystick.h" -#include "llallocator.h" #include "llcalc.h" #include "llconversationlog.h" #if LL_WINDOWS @@ -265,10 +264,9 @@ using namespace LL; // define a self-registering event API object #include "llappviewerlistener.h" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif +#if LL_LINUX && LL_GTK +#include "glib.h" +#endif // (LL_LINUX) && LL_GTK static LLAppViewerListener sAppViewerListener(LLAppViewer::instance); @@ -770,8 +768,6 @@ bool LLAppViewer::init() LLError::setFatalFunction([rc](const std::string&){ _exit(rc); }); } - mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling")); - // Initialize the non-LLCurl libcurl library. Should be called // before consumers (LLTextureFetch). mAppCoreHttp.init(); @@ -802,6 +798,20 @@ bool LLAppViewer::init() LLUIImageList::getInstance(), ui_audio_callback, deferred_ui_audio_callback); + + if (gSavedSettings.getBOOL("SpellCheck")) + { + std::list<std::string> dict_list; + std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary"); + boost::split(dict_list, dict_setting, boost::is_any_of(std::string(","))); + if (!dict_list.empty()) + { + LLSpellChecker::setUseSpellCheck(dict_list.front()); + dict_list.pop_front(); + LLSpellChecker::instance().setSecondaryDictionaries(dict_list); + } + } + LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ; // NOW LLUI::getLanguage() should work. gDirUtilp must know the language @@ -1266,6 +1276,7 @@ bool LLAppViewer::init() //LLSimpleton creations LLEnvironment::createInstance(); LLWorld::createInstance(); + LLViewerStatsRecorder::createInstance(); LLSelectMgr::createInstance(); LLViewerCamera::createInstance(); LL::GLTFSceneManager::createInstance(); @@ -1607,7 +1618,7 @@ bool LLAppViewer::doFrame() { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gMeshRepo"); - gMeshRepo.update() ; + gMeshRepo.update() ; } if(!total_work_pending) //pause texture fetching threads if nothing to process. @@ -2148,6 +2159,7 @@ bool LLAppViewer::cleanup() LL::GLTFSceneManager::deleteSingleton(); LLEnvironment::deleteSingleton(); LLSelectMgr::deleteSingleton(); + LLViewerStatsRecorder::deleteSingleton(); LLViewerEventRecorder::deleteSingleton(); LLWorld::deleteSingleton(); LLVoiceClient::deleteSingleton(); @@ -2803,19 +2815,6 @@ bool LLAppViewer::initConfiguration() gSavedSettings.getString("Language")); } - if (gSavedSettings.getBOOL("SpellCheck")) - { - std::list<std::string> dict_list; - std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary"); - boost::split(dict_list, dict_setting, boost::is_any_of(std::string(","))); - if (!dict_list.empty()) - { - LLSpellChecker::setUseSpellCheck(dict_list.front()); - dict_list.pop_front(); - LLSpellChecker::instance().setSecondaryDictionaries(dict_list); - } - } - if (gNonInteractive) { tempSetControl("AllowMultipleViewers", "true"); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index cf5f1ab1e3..9a5dd6dca3 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -44,7 +44,6 @@ #define LL_LLAPPVIEWER_H #include "llapp.h" -#include "llallocator.h" #include "llapr.h" #include "llcontrol.h" #include "llsys.h" // for LLOSInfo @@ -194,8 +193,6 @@ public: // *NOTE:Mani Fix this for login abstraction!! void handleLoginComplete(); - LLAllocator & getAllocator() { return mAlloc; } - // On LoginCompleted callback typedef boost::signals2::signal<void (void)> login_completed_signal_t; login_completed_signal_t mOnLoginCompleted; @@ -338,8 +335,6 @@ private: bool mAgentRegionLastAlive; LLUUID mAgentRegionLastID; - LLAllocator mAlloc; - // llcorehttp library init/shutdown helper LLAppCoreHttp mAppCoreHttp; diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index f301af9511..f21bae9805 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -28,26 +28,12 @@ #include "llcommandlineparser.h" #include "llexception.h" -// *NOTE: The boost::lexical_cast generates -// the warning C4701(local used with out assignment) in VC7.1. -// Disable the warning for the boost includes. -#if _MSC_VER -# pragma warning(push) -# pragma warning( disable : 4701 ) -#else -// NOTE: For the other platforms? -#endif - #include <boost/program_options.hpp> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> #include <boost/tokenizer.hpp> #include <boost/assign/list_of.hpp> -#if _MSC_VER -# pragma warning(pop) -#endif - #include "llsdserialize.h" #include "llerror.h" #include "stringize.h" diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 0596a8fe7d..53da9826ed 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -119,7 +119,7 @@ void LLDebugView::draw() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect debug_rect; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 60e7171004..ae48db24bc 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1600,18 +1600,10 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update) mDrawable->updateDistance(camera, force_update); - LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); - for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); iter++) + for (LLViewerObject* child : mDrawable->getVObj()->getChildren()) { - LLViewerObject* child = *iter; LLDrawable* drawable = child->mDrawable; - if (!drawable) - { - continue; - } - - if (!drawable->isAvatar()) + if (drawable && !drawable->isDead() && !drawable->isAvatar()) { drawable->updateDistance(camera, force_update); } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 7d2912d81f..5e676bc5b3 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -219,7 +219,9 @@ void LLDrawPoolTerrain::renderFullShader() else { // Use materials - sShader = &gDeferredPBRTerrainProgram; + U32 paint_type = use_local_materials ? gLocalTerrainMaterials.getPaintType() : compp->getPaintType(); + paint_type = llclamp(paint_type, 0, TERRAIN_PAINT_TYPE_COUNT); + sShader = &gDeferredPBRTerrainProgram[paint_type]; sShader->bind(); renderFullShaderPBR(use_local_materials); } @@ -326,7 +328,7 @@ void LLDrawPoolTerrain::renderFullShaderTextures() } // *TODO: Investigate use of bindFast for PBR terrain textures -void LLDrawPoolTerrain::renderFullShaderPBR(bool local_materials) +void LLDrawPoolTerrain::renderFullShaderPBR(bool use_local_materials) { // Hack! Get the region that this draw pool is rendering from! LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); @@ -339,7 +341,7 @@ void LLDrawPoolTerrain::renderFullShaderPBR(bool local_materials) llassert(shader_material_count == terrain_material_count); #endif - if (local_materials) + if (use_local_materials) { // Override region terrain with the global local override terrain fetched_materials = &gLocalTerrainMaterials.mDetailRenderMaterials; @@ -351,6 +353,9 @@ void LLDrawPoolTerrain::renderFullShaderPBR(bool local_materials) if (!materials[i]) { materials[i] = &LLGLTFMaterial::sDefault; } } + U32 paint_type = use_local_materials ? gLocalTerrainMaterials.getPaintType() : compp->getPaintType(); + paint_type = llclamp(paint_type, 0, TERRAIN_PAINT_TYPE_COUNT); + S32 detail_basecolor[terrain_material_count]; S32 detail_normal[terrain_material_count]; S32 detail_metalrough[terrain_material_count]; @@ -481,11 +486,31 @@ void LLDrawPoolTerrain::renderFullShaderPBR(bool local_materials) LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); // - // Alpha Ramp + // Alpha Ramp or paint map // - S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); - gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep); - gGL.getTexUnit(alpha_ramp)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + S32 alpha_ramp = -1; + S32 paint_map = -1; + if (paint_type == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE) + { + alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); + gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep); + gGL.getTexUnit(alpha_ramp)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + } + else if (paint_type == TERRAIN_PAINT_TYPE_PBR_PAINTMAP) + { + paint_map = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_PAINTMAP); + LLViewerTexture* tex_paint_map = use_local_materials ? gLocalTerrainMaterials.getPaintMap() : compp->getPaintMap(); + // If no paintmap is available, fall back to rendering just material slot 1 (by binding the appropriate image) + if (!tex_paint_map) { tex_paint_map = LLViewerTexture::sBlackImagep.get(); } + // This is a paint map for four materials, but we save a channel by + // storing the paintmap as the "difference" between slot 1 and the + // other 3 slots. + llassert(tex_paint_map->getComponents() == 3); + gGL.getTexUnit(paint_map)->bind(tex_paint_map); + gGL.getTexUnit(paint_map)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + + shader->uniform1f(LLShaderMgr::REGION_SCALE, regionp->getWidth()); + } // // GLTF uniforms @@ -534,11 +559,22 @@ void LLDrawPoolTerrain::renderFullShaderPBR(bool local_materials) // Disable multitexture - sShader->disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); + if (paint_type == TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE) + { + sShader->disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); - gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(alpha_ramp)->disable(); - gGL.getTexUnit(alpha_ramp)->activate(); + gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(alpha_ramp)->disable(); + gGL.getTexUnit(alpha_ramp)->activate(); + } + else if (paint_type == TERRAIN_PAINT_TYPE_PBR_PAINTMAP) + { + sShader->disableTexture(LLViewerShaderMgr::TERRAIN_PAINTMAP); + + gGL.getTexUnit(paint_map)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(paint_map)->disable(); + gGL.getTexUnit(paint_map)->activate(); + } for (U32 i = 0; i < terrain_material_count; ++i) { diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index a8097fb58b..5380463d01 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -38,7 +38,6 @@ public: VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TANGENT | // Only PBR terrain uses this currently - LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 }; @@ -80,7 +79,7 @@ protected: void renderFull4TU(); void renderFullShader(); void renderFullShaderTextures(); - void renderFullShaderPBR(bool local_materials = false); + void renderFullShaderPBR(bool use_local_materials = false); void drawLoop(); private: diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index c12546f7eb..6e31760e9e 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -54,8 +54,6 @@ #include "llregioninfomodel.h" -#include <boost/make_shared.hpp> - #include "llatmosphere.h" #include "llagent.h" #include "roles_constants.h" @@ -2125,8 +2123,11 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ LLSD environment = result[KEY_ENVIRONMENT]; if (environment.isDefined() && apply) { - EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); - apply(parcel_id, envinfo); + LLAppViewer::instance()->postToMainCoro([=]() + { + EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); + apply(parcel_id, envinfo); + }); } } diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 471bb6d478..c05a7fef44 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -40,8 +40,6 @@ #include "llcorehttputil.h" #include "lleventfilter.h" -#include "boost/make_shared.hpp" - namespace LLEventPolling { namespace Details diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index e45549136e..c3d1f8d270 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -508,7 +508,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) mDrawablep->getSpatialGroup()->rebuildGeom(); mDrawablep->getSpatialGroup()->rebuildMesh(); - if(mVertexBuffer.isNull()) + if (mVertexBuffer.isNull()) { return; } @@ -561,8 +561,20 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) { // cheaters sometimes prosper... // - mVertexBuffer->setBuffer(); - mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); + LLVertexBuffer* vertex_buffer = mVertexBuffer.get(); + // To display selection markers (white squares with the rounded cross at the center) + // on faces with GLTF textures we use a spectal vertex buffer with other transforms + if (const LLTextureEntry* te = getTextureEntry()) + { + if (LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial()) + { + vertex_buffer = mVertexBufferGLTF.get(); + vertex_buffer->unmapBuffer(); + } + } + // Draw the selection marker using the correctly chosen vertex buffer + vertex_buffer->setBuffer(); + vertex_buffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); } gGL.popMatrix(); @@ -1137,7 +1149,8 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, const LLMatrix3& mat_norm_in, U16 index_offset, bool force_rebuild, - bool no_debug_assert) + bool no_debug_assert, + bool rebuild_for_gltf) { LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; llassert(verify()); @@ -1195,6 +1208,58 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, } } + const LLTextureEntry* tep = mVObjp->getTE(face_index); + llassert(tep); + if (!tep) + return false; + + LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial(); + // To display selection markers (white squares with the rounded cross at the center) + // on faces with GLTF textures we use a special vertex buffer with other transforms + if (gltf_mat && !rebuild_for_gltf && tep->isSelected() && mVertexBuffer.notNull()) + { + // Create a temporary vertex buffer to provide transforms for GLTF textures + if (mVertexBufferGLTF.isNull()) + { + mVertexBufferGLTF = new LLVertexBuffer(mVertexBuffer->getTypeMask()); + } + + // Clone the existing vertex buffer into the temporary one + mVertexBuffer->clone(*mVertexBufferGLTF); + + // Recursive call the same function with the argument rebuild_for_gltf set to true + // This call will make geometry in mVertexBuffer but in fact for mVertexBufferGLTF + mVertexBufferGLTF.swap(mVertexBufferGLTF, mVertexBuffer); + getGeometryVolume(volume, face_index, mat_vert_in, mat_norm_in, index_offset, force_rebuild, no_debug_assert, true); + mVertexBufferGLTF.swap(mVertexBufferGLTF, mVertexBuffer); + } + else if (!tep->isSelected() && mVertexBufferGLTF.notNull()) + { + // Free the temporary vertex buffer when it is not needed anymore + mVertexBufferGLTF = nullptr; + } + + LLGLTFMaterial::TextureInfo gltf_info_index = (LLGLTFMaterial::TextureInfo)0; + if (gltf_mat && rebuild_for_gltf) + { + switch (LLPipeline::sRenderHighlightTextureChannel) + { + case LLRender::BASECOLOR_MAP: + gltf_info_index = LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR; + break; + case LLRender::METALLIC_ROUGHNESS_MAP: + gltf_info_index = LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS; + break; + case LLRender::GLTF_NORMAL_MAP: + gltf_info_index = LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL; + break; + case LLRender::EMISSIVE_MAP: + gltf_info_index = LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE; + break; + default:; // just to make clang happy + } + } + LLStrider<LLVector3> vert; LLStrider<LLVector2> tex_coords0; LLStrider<LLVector2> tex_coords1; @@ -1211,7 +1276,7 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, LLVector3 scale; if (global_volume) { - scale.setVec(1,1,1); + scale.setVec(1, 1, 1); } else { @@ -1226,7 +1291,6 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, bool rebuild_tangent = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TANGENT); bool rebuild_weights = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_WEIGHT4); - const LLTextureEntry *tep = mVObjp->getTE(face_index); const U8 bump_code = tep ? tep->getBumpmap() : 0; bool is_static = mDrawablep->isStatic(); @@ -1316,7 +1380,6 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, LLMaterial* mat = tep->getMaterialParams().get(); - LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial(); F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0; @@ -1327,13 +1390,27 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, S32 xforms = XFORM_NONE; // For GLTF, transforms will be applied later - if (rebuild_tcoord && tep && !gltf_mat) + if (rebuild_tcoord && tep && (!gltf_mat || rebuild_for_gltf)) { - r = tep->getRotation(); - os = tep->mOffsetS; - ot = tep->mOffsetT; - ms = tep->mScaleS; - mt = tep->mScaleT; + if (gltf_mat && rebuild_for_gltf) + { + // Apply special transformations for mVertexBufferGLTF + // They are used only to display a face selection marker + // (white square with a rounded cross at the center) + const auto& tt = gltf_mat->mTextureTransform[gltf_info_index]; + r = -tt.mRotation * 2; + ms = tt.mScale[VX]; + mt = tt.mScale[VY]; + os += tt.mOffset[VX] + (ms - 1) / 2; + ot -= tt.mOffset[VY] + (mt - 1) / 2; + } + else + { + r = tep->getRotation(); + tep->getOffset(&os, &ot); + tep->getScale(&ms, &mt); + } + cos_ang = cos(r); sin_ang = sin(r); @@ -1474,12 +1551,9 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, break; } - F32 s_scale = 1.f; - F32 t_scale = 1.f; - if( tep ) - { - tep->getScale( &s_scale, &t_scale ); - } + F32 s_scale = tep->getScaleS(); + F32 t_scale = tep->getScaleT(); + // Use the nudged south when coming from above sun angle, such // that emboss mapping always shows up on the upward faces of cubes when // it's noon (since a lot of builders build with the sun forced to noon). @@ -1501,8 +1575,8 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, bool tex_anim = false; - LLVOVolume* vobj = (LLVOVolume*) (LLViewerObject*) mVObjp; - tex_mode = vobj->mTexAnimMode; + LLVOVolume* vobj = (LLVOVolume*)mVObjp.get(); + tex_mode = vobj->mTexAnimMode; if (vobj->mTextureAnimp) { //texture animation is in play, override specular and normal map tex coords with diffuse texcoords diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 917f3aa0b2..7cf256f731 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -161,7 +161,8 @@ public: const LLMatrix3& mat_normal, U16 index_offset, bool force_rebuild = false, - bool no_debug_assert = false); + bool no_debug_assert = false, + bool rebuild_for_gltf = false); // For avatar U16 getGeometryAvatar( @@ -266,6 +267,7 @@ public: private: LLPointer<LLVertexBuffer> mVertexBuffer; + LLPointer<LLVertexBuffer> mVertexBufferGLTF; U32 mState; LLFacePool* mDrawPoolp; diff --git a/indra/newview/llfloatereditenvironmentbase.cpp b/indra/newview/llfloatereditenvironmentbase.cpp index bd5839ed17..a42c94f049 100644 --- a/indra/newview/llfloatereditenvironmentbase.cpp +++ b/indra/newview/llfloatereditenvironmentbase.cpp @@ -28,8 +28,6 @@ #include "llfloatereditenvironmentbase.h" -#include <boost/make_shared.hpp> - // libs #include "llnotifications.h" #include "llnotificationsutil.h" diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 6829e6b479..e44202312b 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -28,8 +28,6 @@ #include "llfloaterfixedenvironment.h" -#include <boost/make_shared.hpp> - // libs #include "llbutton.h" #include "llnotifications.h" diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index a614299e03..c920a3c898 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -152,7 +152,6 @@ protected: toast_list_t m_toast_pool; bool mStopProcessing; - bool mChannelRect; }; @@ -287,7 +286,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect channel_rect; mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView); @@ -377,7 +376,7 @@ void LLFloaterIMNearbyChatScreenChannel::arrangeToasts() if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (!getParent()) diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 7db3621a4b..68b11ec92b 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -93,8 +93,9 @@ BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, #endif LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) - : LLFloater(data), - mHasDeviceList(false) + : LLFloater(data) + , mHasDeviceList(false) + , mJoystickInitialized(false) { if (!LLViewerJoystick::getInstance()->isJoystickInitialized()) { @@ -108,7 +109,10 @@ void LLFloaterJoystick::draw() { LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); bool joystick_inited = joystick->isJoystickInitialized(); - if (joystick_inited != mHasDeviceList) + if (!mHasDeviceList + || mJoystickInitialized != joystick_inited + || (joystick->isDeviceUUIDSet() && joystick->getDeviceUUID().asUUID() != mCurrentDeviceId) + || (!joystick->isDeviceUUIDSet() && mCurrentDeviceId.notNull())) { refreshListOfDevices(); } @@ -290,15 +294,16 @@ void LLFloaterJoystick::refreshListOfDevices() mHasDeviceList = true; } - bool is_device_id_set = LLViewerJoystick::getInstance()->isDeviceUUIDSet(); + LLViewerJoystick* joystick = LLViewerJoystick::getInstance(); + bool is_device_id_set = joystick->isDeviceUUIDSet(); - if (LLViewerJoystick::getInstance()->isJoystickInitialized() && + if (joystick->isJoystickInitialized() && (!mHasDeviceList || !is_device_id_set)) { #if LL_WINDOWS && !LL_MESA_HEADLESS LL_WARNS() << "NDOF connected to device without using SL provided handle" << LL_ENDL; #endif - std::string desc = LLViewerJoystick::getInstance()->getDescription(); + std::string desc = joystick->getDescription(); if (!desc.empty()) { LLSD value = LLSD::Integer(1); // value for selection @@ -311,11 +316,13 @@ void LLFloaterJoystick::refreshListOfDevices() { if (is_device_id_set) { - LLSD guid = LLViewerJoystick::getInstance()->getDeviceUUID(); + LLSD guid = joystick->getDeviceUUID(); + mCurrentDeviceId = guid.asUUID(); mJoysticksCombo->selectByValue(guid); } else { + mCurrentDeviceId.setNull(); mJoysticksCombo->selectByValue(LLSD::Integer(1)); } } @@ -323,6 +330,18 @@ void LLFloaterJoystick::refreshListOfDevices() { mJoysticksCombo->selectByValue(LLSD::Integer(0)); } + + // Update tracking + if (is_device_id_set) + { + LLSD guid = joystick->getDeviceUUID(); + mCurrentDeviceId = guid.asUUID(); + } + else + { + mCurrentDeviceId.setNull(); + } + mJoystickInitialized = joystick->isJoystickInitialized(); } void LLFloaterJoystick::cancel() diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index b94223a738..c7e727635d 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -95,6 +95,8 @@ private: LLComboBox *mJoysticksCombo; bool mHasDeviceList; + bool mJoystickInitialized; + LLUUID mCurrentDeviceId; // stats view LLStatBar* mAxisStatsBar[6]; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index a1e15da56d..ce1072a968 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -432,6 +432,13 @@ void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bo bool LLFloaterPreference::postBuild() { + mDeleteTranscriptsBtn = getChild<LLButton>("delete_transcripts"); + + mEnabledPopups = getChild<LLScrollListCtrl>("enabled_popups"); + mDisabledPopups = getChild<LLScrollListCtrl>("disabled_popups"); + mEnablePopupBtn = getChild<LLButton>("enable_this_popup"); + mDisablePopupBtn = getChild<LLButton>("disable_this_popup"); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); @@ -521,7 +528,7 @@ bool LLFloaterPreference::postBuild() void LLFloaterPreference::updateDeleteTranscriptsButton() { - getChild<LLButton>("delete_transcripts")->setEnabled(LLLogChat::transcriptFilesExist()); + mDeleteTranscriptsBtn->setEnabled(LLLogChat::transcriptFilesExist()); } void LLFloaterPreference::onDoNotDisturbResponseChanged() @@ -543,11 +550,11 @@ LLFloaterPreference::~LLFloaterPreference() void LLFloaterPreference::draw() { - bool has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); + bool has_first_selected = (mDisabledPopups->getFirstSelected()!=NULL); + mEnablePopupBtn->setEnabled(has_first_selected); - has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); + has_first_selected = (mEnabledPopups->getFirstSelected()!=NULL); + mDisablePopupBtn->setEnabled(has_first_selected); LLFloater::draw(); } @@ -1174,13 +1181,8 @@ void LLFloaterPreference::refreshSkin(void* data) void LLFloaterPreference::buildPopupLists() { - LLScrollListCtrl& disabled_popups = - getChildRef<LLScrollListCtrl>("disabled_popups"); - LLScrollListCtrl& enabled_popups = - getChildRef<LLScrollListCtrl>("enabled_popups"); - - disabled_popups.deleteAllItems(); - enabled_popups.deleteAllItems(); + mDisabledPopups->deleteAllItems(); + mEnabledPopups->deleteAllItems(); for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); iter != LLNotifications::instance().templatesEnd(); @@ -1222,11 +1224,11 @@ void LLFloaterPreference::buildPopupLists() } } } - item = disabled_popups.addElement(row); + item = mDisabledPopups->addElement(row); } else { - item = enabled_popups.addElement(row); + item = mEnabledPopups->addElement(row); } if (item) @@ -1238,11 +1240,6 @@ void LLFloaterPreference::buildPopupLists() void LLFloaterPreference::refreshEnabledState() { - LLCheckBoxCtrl* ctrl_pbr = getChild<LLCheckBoxCtrl>("UsePBRShaders"); - - //PBR - ctrl_pbr->setEnabled(true); - // Cannot have floater active until caps have been received getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() >= STATE_STARTED); @@ -1330,9 +1327,7 @@ void LLFloaterPreference::onClickSetSounds() void LLFloaterPreference::onClickEnablePopup() { - LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups"); - - std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mDisabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1351,9 +1346,7 @@ void LLFloaterPreference::onClickEnablePopup() void LLFloaterPreference::onClickDisablePopup() { - LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups"); - - std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mEnabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1840,11 +1833,9 @@ void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, void LLFloaterPreference::onLogChatHistorySaved() { - LLButton * delete_transcripts_buttonp = getChild<LLButton>("delete_transcripts"); - - if (!delete_transcripts_buttonp->getEnabled()) + if (!mDeleteTranscriptsBtn->getEnabled()) { - delete_transcripts_buttonp->setEnabled(true); + mDeleteTranscriptsBtn->setEnabled(true); } } @@ -2378,7 +2369,6 @@ bool LLPanelPreferenceGraphics::postBuild() void LLPanelPreferenceGraphics::draw() { - setPresetText(); LLPanelPreference::draw(); } @@ -3359,8 +3349,8 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force) void LLFloaterPreference::filterIgnorableNotifications() { - bool visible = getChildRef<LLScrollListCtrl>("enabled_popups").highlightMatchingItems(mFilterEdit->getValue()); - visible |= getChildRef<LLScrollListCtrl>("disabled_popups").highlightMatchingItems(mFilterEdit->getValue()); + bool visible = mEnabledPopups->highlightMatchingItems(mFilterEdit->getValue()); + visible |= mDisabledPopups->highlightMatchingItems(mFilterEdit->getValue()); if (visible) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index c26569f17c..40806c22fc 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -228,7 +228,12 @@ private: std::string mSavedGraphicsPreset; LOG_CLASS(LLFloaterPreference); - LLSearchEditor *mFilterEdit; + LLSearchEditor* mFilterEdit = nullptr; + LLScrollListCtrl* mEnabledPopups = nullptr; + LLScrollListCtrl* mDisabledPopups = nullptr; + LLButton* mDeleteTranscriptsBtn = nullptr; + LLButton* mEnablePopupBtn = nullptr; + LLButton* mDisablePopupBtn = nullptr; std::unique_ptr< ll::prefs::SearchData > mSearchData; bool mSearchDataDirty; diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index f840a6124f..bc8e0723ce 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -153,7 +153,6 @@ void LLFloaterPreferenceGraphicsAdvanced::refresh() updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail", true), getChild<LLTextBox>("TerrainMeshDetailText", true)); updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess", true), getChild<LLTextBox>("PostProcessText", true)); updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail", true), getChild<LLTextBox>("SkyMeshDetailText", true)); - updateSliderText(getChild<LLSliderCtrl>("TerrainDetail", true), getChild<LLTextBox>("TerrainDetailText", true)); LLAvatarComplexityControls::setIndirectControls(); setMaxNonImpostorsText( gSavedSettings.getU32("RenderAvatarMaxNonImpostors"), @@ -268,10 +267,6 @@ void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTe void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() { - LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections"); - LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText"); - LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders"); - LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders"); LLComboBox* ctrl_shadows = getChild<LLComboBox>("ShadowDetail"); LLTextBox* shadows_text = getChild<LLTextBox>("RenderShadowDetailText"); LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO"); @@ -282,9 +277,6 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() // disabled windlight if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) { - ctrl_wind_light->setEnabled(false); - ctrl_wind_light->setValue(false); - sky->setEnabled(false); sky_text->setEnabled(false); @@ -298,9 +290,6 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() ctrl_dof->setEnabled(false); ctrl_dof->setValue(false); - - ctrl_deferred->setEnabled(false); - ctrl_deferred->setValue(false); } // disabled deferred @@ -315,9 +304,6 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() ctrl_dof->setEnabled(false); ctrl_dof->setValue(false); - - ctrl_deferred->setEnabled(false); - ctrl_deferred->setValue(false); } // disabled deferred SSAO @@ -338,51 +324,13 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() { - LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections"); - LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText"); - - // Reflections - bool reflections = LLCubeMap::sUseCubeMaps; - ctrl_reflections->setEnabled(reflections); - reflections_text->setEnabled(reflections); - - // Bump & Shiny - LLCheckBoxCtrl* bumpshiny_ctrl = getChild<LLCheckBoxCtrl>("BumpShiny"); - bool bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); - bumpshiny_ctrl->setEnabled(bumpshiny); - - // Vertex Shaders, Global Shader Enable - // SL-12594 Basic shaders are always enabled. DJH TODO clean up now-orphaned state handling code - LLSliderCtrl* terrain_detail = getChild<LLSliderCtrl>("TerrainDetail"); // can be linked with control var - LLTextBox* terrain_text = getChild<LLTextBox>("TerrainDetailText"); - - terrain_detail->setEnabled(false); - terrain_text->setEnabled(false); - // WindLight - //LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders"); - //ctrl_wind_light->setEnabled(true); LLSliderCtrl* sky = getChild<LLSliderCtrl>("SkyMeshDetail"); LLTextBox* sky_text = getChild<LLTextBox>("SkyMeshDetailText"); sky->setEnabled(true); sky_text->setEnabled(true); bool enabled = true; -#if 0 // deferred always on now - //Deferred/SSAO/Shadows - LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders"); - - enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - bumpshiny_ctrl && bumpshiny_ctrl->get() && - ctrl_wind_light->get(); - - ctrl_deferred->setEnabled(enabled); -#endif - - LLCheckBoxCtrl* ctrl_pbr = getChild<LLCheckBoxCtrl>("UsePBRShaders"); - - //PBR - ctrl_pbr->setEnabled(true); LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF"); @@ -414,11 +362,6 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() getChildView("texture compression")->setEnabled(false); } - // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance - LLUICtrl* gamma_ctrl = getChild<LLUICtrl>("gamma"); - gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")); // now turn off any features that are unavailable diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 525317304d..8cc01f6dc6 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -51,6 +51,18 @@ bool LLFloaterSettingsDebug::postBuild() { enableResizeCtrls(true, false, true); + mValSpinner1 = getChild<LLSpinCtrl>("val_spinner_1"); + mValSpinner2 = getChild<LLSpinCtrl>("val_spinner_2"); + mValSpinner3 = getChild<LLSpinCtrl>("val_spinner_3"); + mValSpinner4 = getChild<LLSpinCtrl>("val_spinner_4"); + mBooleanCombo = getChild<LLUICtrl>("boolean_combo"); + mValText = getChild<LLUICtrl>("val_text"); + + mColorSwatch = getChild<LLColorSwatchCtrl>("val_color_swatch"); + + mDefaultButton = getChild<LLUICtrl>("default_btn"); + mSettingNameText = getChild<LLTextBox>("setting_name_txt"); + mComment = getChild<LLTextEditor>("comment_text"); getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::setSearchFilter, this, _2)); @@ -104,56 +116,56 @@ void LLFloaterSettingsDebug::onCommitSettings() switch(controlp->type()) { case TYPE_U32: - controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue()); + controlp->set(mValSpinner1->getValue()); break; case TYPE_S32: - controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue()); + controlp->set(mValSpinner1->getValue()); break; case TYPE_F32: - controlp->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal())); + controlp->set(LLSD(mValSpinner1->getValue().asReal())); break; case TYPE_BOOLEAN: - controlp->set(getChild<LLUICtrl>("boolean_combo")->getValue()); + controlp->set(mBooleanCombo->getValue()); break; case TYPE_STRING: - controlp->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString())); + controlp->set(LLSD(mValText->getValue().asString())); break; case TYPE_VEC3: - vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + vector.mV[VX] = (F32)mValSpinner1->getValue().asReal(); + vector.mV[VY] = (F32)mValSpinner2->getValue().asReal(); + vector.mV[VZ] = (F32)mValSpinner3->getValue().asReal(); controlp->set(vector.getValue()); break; case TYPE_VEC3D: - vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + vectord.mdV[VX] = mValSpinner1->getValue().asReal(); + vectord.mdV[VY] = mValSpinner2->getValue().asReal(); + vectord.mdV[VZ] = mValSpinner3->getValue().asReal(); controlp->set(vectord.getValue()); break; case TYPE_QUAT: - quat.mQ[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - quat.mQ[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - quat.mQ[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); - quat.mQ[VS] = (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal();; + quat.mQ[VX] = mValSpinner1->getValueF32(); + quat.mQ[VY] = mValSpinner2->getValueF32(); + quat.mQ[VZ] = mValSpinner3->getValueF32(); + quat.mQ[VS] = mValSpinner4->getValueF32(); controlp->set(quat.getValue()); break; case TYPE_RECT: - rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger(); - rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger(); - rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger(); - rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger(); + rect.mLeft = mValSpinner1->getValue().asInteger(); + rect.mRight = mValSpinner2->getValue().asInteger(); + rect.mBottom = mValSpinner3->getValue().asInteger(); + rect.mTop = mValSpinner4->getValue().asInteger(); controlp->set(rect.getValue()); break; case TYPE_COL4: - col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue()); - col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal()); + col3.setValue(mColorSwatch->getValue()); + col4 = LLColor4(col3, (F32)mValSpinner4->getValue().asReal()); controlp->set(col4.getValue()); break; case TYPE_COL3: - controlp->set(getChild<LLUICtrl>("val_color_swatch")->getValue()); - //col3.mV[VRED] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_1")->getValue().asC(); - //col3.mV[VGREEN] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - //col3.mV[VBLUE] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + controlp->set(mColorSwatch->getValue()); + //col3.mV[VRED] = (F32)floaterp->mValSpinner1->getValue().asC(); + //col3.mV[VGREEN] = (F32)floaterp->mValSpinner2->getValue().asReal(); + //col3.mV[VBLUE] = (F32)floaterp->mValSpinner3->getValue().asReal(); //controlp->set(col3.getValue()); break; default: @@ -181,19 +193,6 @@ void LLFloaterSettingsDebug::onClickDefault() // we've switched controls, or doing per-frame update, so update spinners, etc. void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { - LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1"); - LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2"); - LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3"); - LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4"); - LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch"); - - if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) - { - LL_WARNS() << "Could not find all desired controls by name" - << LL_ENDL; - return; - } - hideUIControls(); if (controlp && !isSettingHidden(controlp)) @@ -201,11 +200,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) eControlType type = controlp->type(); //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame - getChildView("boolean_combo")->setVisible( type == TYPE_BOOLEAN); - getChildView("default_btn")->setVisible(true); - getChildView("setting_name_txt")->setVisible(true); - getChild<LLTextBox>("setting_name_txt")->setText(controlp->getName()); - getChild<LLTextBox>("setting_name_txt")->setToolTip(controlp->getName()); + mBooleanCombo->setVisible( type == TYPE_BOOLEAN); + mDefaultButton->setVisible(true); + mSettingNameText->setVisible(true); + mSettingNameText->setText(controlp->getName()); + mSettingNameText->setToolTip(controlp->getName()); mComment->setVisible(true); std::string old_text = mComment->getText(); @@ -218,111 +217,111 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) mComment->setText(controlp->getComment()); } - spinner1->setMaxValue(F32_MAX); - spinner2->setMaxValue(F32_MAX); - spinner3->setMaxValue(F32_MAX); - spinner4->setMaxValue(F32_MAX); - spinner1->setMinValue(-F32_MAX); - spinner2->setMinValue(-F32_MAX); - spinner3->setMinValue(-F32_MAX); - spinner4->setMinValue(-F32_MAX); - if (!spinner1->hasFocus()) + mValSpinner1->setMaxValue(F32_MAX); + mValSpinner2->setMaxValue(F32_MAX); + mValSpinner3->setMaxValue(F32_MAX); + mValSpinner4->setMaxValue(F32_MAX); + mValSpinner1->setMinValue(-F32_MAX); + mValSpinner2->setMinValue(-F32_MAX); + mValSpinner3->setMinValue(-F32_MAX); + mValSpinner4->setMinValue(-F32_MAX); + if (!mValSpinner1->hasFocus()) { - spinner1->setIncrement(0.1f); + mValSpinner1->setIncrement(0.1f); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setIncrement(0.1f); + mValSpinner2->setIncrement(0.1f); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setIncrement(0.1f); + mValSpinner3->setIncrement(0.1f); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setIncrement(0.1f); + mValSpinner4->setIncrement(0.1f); } LLSD sd = controlp->get(); switch(type) { case TYPE_U32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setValue(sd); - spinner1->setMinValue((F32)U32_MIN); - spinner1->setMaxValue((F32)U32_MAX); - spinner1->setIncrement(1.f); - spinner1->setPrecision(0); + mValSpinner1->setValue(sd); + mValSpinner1->setMinValue((F32)U32_MIN); + mValSpinner1->setMaxValue((F32)U32_MAX); + mValSpinner1->setIncrement(1.f); + mValSpinner1->setPrecision(0); } break; case TYPE_S32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setValue(sd); - spinner1->setMinValue((F32)S32_MIN); - spinner1->setMaxValue((F32)S32_MAX); - spinner1->setIncrement(1.f); - spinner1->setPrecision(0); + mValSpinner1->setValue(sd); + mValSpinner1->setMinValue((F32)S32_MIN); + mValSpinner1->setMaxValue((F32)S32_MAX); + mValSpinner1->setIncrement(1.f); + mValSpinner1->setPrecision(0); } break; case TYPE_F32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(sd); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(sd); } break; case TYPE_BOOLEAN: - if (!getChild<LLUICtrl>("boolean_combo")->hasFocus()) + if (!mBooleanCombo->hasFocus()) { if (sd.asBoolean()) { - getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("true")); + mBooleanCombo->setValue(LLSD("true")); } else { - getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("")); + mBooleanCombo->setValue(LLSD("")); } } break; case TYPE_STRING: - getChildView("val_text")->setVisible( true); - if (!getChild<LLUICtrl>("val_text")->hasFocus()) + mValText->setVisible( true); + if (!mValText->hasFocus()) { - getChild<LLUICtrl>("val_text")->setValue(sd); + mValText->setValue(sd); } break; case TYPE_VEC3: { LLVector3 v; v.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(v[VX]); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(v[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(3); - spinner2->setValue(v[VY]); + mValSpinner2->setPrecision(3); + mValSpinner2->setValue(v[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(3); - spinner3->setValue(v[VZ]); + mValSpinner3->setPrecision(3); + mValSpinner3->setValue(v[VZ]); } break; } @@ -330,26 +329,26 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLVector3d v; v.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(v[VX]); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(v[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(3); - spinner2->setValue(v[VY]); + mValSpinner2->setPrecision(3); + mValSpinner2->setValue(v[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(3); - spinner3->setValue(v[VZ]); + mValSpinner3->setPrecision(3); + mValSpinner3->setValue(v[VZ]); } break; } @@ -357,33 +356,33 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLQuaternion q; q.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - spinner4->setVisible(true); - spinner4->setLabel(std::string("S")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("S")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(4); - spinner1->setValue(q.mQ[VX]); + mValSpinner1->setPrecision(4); + mValSpinner1->setValue(q.mQ[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(4); - spinner2->setValue(q.mQ[VY]); + mValSpinner2->setPrecision(4); + mValSpinner2->setValue(q.mQ[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(4); - spinner3->setValue(q.mQ[VZ]); + mValSpinner3->setPrecision(4); + mValSpinner3->setValue(q.mQ[VZ]); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(4); - spinner4->setValue(q.mQ[VS]); + mValSpinner4->setPrecision(4); + mValSpinner4->setValue(q.mQ[VS]); } break; } @@ -391,70 +390,70 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLRect r; r.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("Left")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Right")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Bottom")); - spinner4->setVisible(true); - spinner4->setLabel(std::string("Top")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("Left")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Right")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Bottom")); + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("Top")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(0); - spinner1->setValue(r.mLeft); + mValSpinner1->setPrecision(0); + mValSpinner1->setValue(r.mLeft); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(0); - spinner2->setValue(r.mRight); + mValSpinner2->setPrecision(0); + mValSpinner2->setValue(r.mRight); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(0); - spinner3->setValue(r.mBottom); + mValSpinner3->setPrecision(0); + mValSpinner3->setValue(r.mBottom); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(0); - spinner4->setValue(r.mTop); + mValSpinner4->setPrecision(0); + mValSpinner4->setValue(r.mTop); } - spinner1->setMinValue((F32)S32_MIN); - spinner1->setMaxValue((F32)S32_MAX); - spinner1->setIncrement(1.f); + mValSpinner1->setMinValue((F32)S32_MIN); + mValSpinner1->setMaxValue((F32)S32_MAX); + mValSpinner1->setIncrement(1.f); - spinner2->setMinValue((F32)S32_MIN); - spinner2->setMaxValue((F32)S32_MAX); - spinner2->setIncrement(1.f); + mValSpinner2->setMinValue((F32)S32_MIN); + mValSpinner2->setMaxValue((F32)S32_MAX); + mValSpinner2->setIncrement(1.f); - spinner3->setMinValue((F32)S32_MIN); - spinner3->setMaxValue((F32)S32_MAX); - spinner3->setIncrement(1.f); + mValSpinner3->setMinValue((F32)S32_MIN); + mValSpinner3->setMaxValue((F32)S32_MAX); + mValSpinner3->setIncrement(1.f); - spinner4->setMinValue((F32)S32_MIN); - spinner4->setMaxValue((F32)S32_MAX); - spinner4->setIncrement(1.f); + mValSpinner4->setMinValue((F32)S32_MIN); + mValSpinner4->setMaxValue((F32)S32_MAX); + mValSpinner4->setIncrement(1.f); break; } case TYPE_COL4: { LLColor4 clr; clr.setValue(sd); - color_swatch->setVisible(true); + mColorSwatch->setVisible(true); // only set if changed so color picker doesn't update - if(clr != LLColor4(color_swatch->getValue())) + if(clr != LLColor4(mColorSwatch->getValue())) { - color_swatch->set(LLColor4(sd), true, false); + mColorSwatch->set(LLColor4(sd), true, false); } - spinner4->setVisible(true); - spinner4->setLabel(std::string("Alpha")); - if (!spinner4->hasFocus()) + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("Alpha")); + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(3); - spinner4->setMinValue(0.0); - spinner4->setMaxValue(1.f); - spinner4->setValue(clr.mV[VALPHA]); + mValSpinner4->setPrecision(3); + mValSpinner4->setMinValue(0.0); + mValSpinner4->setMaxValue(1.f); + mValSpinner4->setValue(clr.mV[VALPHA]); } break; } @@ -462,8 +461,8 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLColor3 clr; clr.setValue(sd); - color_swatch->setVisible(true); - color_swatch->setValue(sd); + mColorSwatch->setVisible(true); + mColorSwatch->setValue(sd); break; } default: @@ -624,15 +623,15 @@ void LLFloaterSettingsDebug::updateDefaultColumn(LLControlVariable* control) void LLFloaterSettingsDebug::hideUIControls() { - getChildView("val_spinner_1")->setVisible(false); - getChildView("val_spinner_2")->setVisible(false); - getChildView("val_spinner_3")->setVisible(false); - getChildView("val_spinner_4")->setVisible(false); - getChildView("val_color_swatch")->setVisible(false); - getChildView("val_text")->setVisible(false); - getChildView("default_btn")->setVisible(false); - getChildView("boolean_combo")->setVisible(false); - getChildView("setting_name_txt")->setVisible(false); + mValSpinner1->setVisible(false); + mValSpinner2->setVisible(false); + mValSpinner3->setVisible(false); + mValSpinner4->setVisible(false); + mColorSwatch->setVisible(false); + mValText->setVisible(false); + mDefaultButton->setVisible(false); + mBooleanCombo->setVisible(false); + mSettingNameText->setVisible(false); mComment->setVisible(false); } diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index 4df0dc8dd2..b813cf4a74 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -30,9 +30,12 @@ #include "llcontrol.h" #include "llfloater.h" +class LLColorSwatchCtrl; class LLScrollListCtrl; +class LLSpinCtrl; +class LLTextBox; -class LLFloaterSettingsDebug +class LLFloaterSettingsDebug final : public LLFloater { friend class LLFloaterReg; @@ -67,6 +70,16 @@ private: protected: class LLTextEditor* mComment; + LLSpinCtrl* mValSpinner1 = nullptr; + LLSpinCtrl* mValSpinner2 = nullptr; + LLSpinCtrl* mValSpinner3 = nullptr; + LLSpinCtrl* mValSpinner4 = nullptr; + LLUICtrl* mBooleanCombo = nullptr; + LLUICtrl* mValText = nullptr; + LLUICtrl* mDefaultButton = nullptr; + LLTextBox* mSettingNameText = nullptr; + + LLColorSwatchCtrl* mColorSwatch = nullptr; std::string mSearchFilter; }; diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 6c5d2570f2..78550b6520 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -53,31 +53,39 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); } +bool LLFloaterSidePanelContainer::postBuild() +{ + mMainPanel = getChild<LLPanel>(sMainPanelName); + return true; +} + void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild<LLPanel>(sMainPanelName)->onOpen(key); + mMainPanel->onOpen(key); } void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); - if (panel_outfit_edit) + if(getInstanceName() == "appearance") { - LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); - if (parent == this ) + LLPanelOutfitEdit* panel_outfit_edit = findChild<LLPanelOutfitEdit>("panel_outfit_edit"); + if (panel_outfit_edit) { - LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance")); - if (panel_appearance) + LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); + if (parent == this) { - LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); - if (edit_wearable_ptr) - { - edit_wearable_ptr->onClose(); - } - if (!app_quitting) + LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(mMainPanel); + if (panel_appearance) { - panel_appearance->showOutfitsInventoryPanel(); + LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); + if (edit_wearable_ptr) + { + edit_wearable_ptr->onClose(); + } + if(!app_quitting) + { + panel_appearance->showOutfitsInventoryPanel(); + } } } } @@ -93,10 +101,9 @@ void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) void LLFloaterSidePanelContainer::onClickCloseBtn(bool app_quitting) { - if (!app_quitting) + if (!app_quitting && getInstanceName() == "appearance") { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); + LLPanelOutfitEdit* panel_outfit_edit = findChild<LLPanelOutfitEdit>("panel_outfit_edit"); if (panel_outfit_edit) { LLFloater* parent = gFloaterView->getParentFloater(panel_outfit_edit); @@ -206,10 +213,16 @@ void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std:: LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name); - if (floaterp) { - return floaterp->findChild<LLPanel>(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild<LLPanel>(panel_name, true); + } } return NULL; @@ -218,10 +231,16 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, st LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name); - if (floaterp) { - return floaterp->findChild<LLPanel>(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild<LLPanel>(panel_name, true); + } } return NULL; diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index d7f6c309c4..4b9d0e34a7 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -49,6 +49,8 @@ public: LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams()); ~LLFloaterSidePanelContainer(); + bool postBuild() override; + void onOpen(const LLSD& key) override; void closeFloater(bool app_quitting = false) override; @@ -77,6 +79,11 @@ public: * @returns a pointer to the panel of given type T. */ template <typename T> + static T* findPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName) + { + return dynamic_cast<T*>(findPanel(floater_name, panel_name)); + } + template <typename T> static T* getPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName) { T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name)); @@ -89,6 +96,8 @@ public: protected: void onCloseMsgCallback(const LLSD& notification, const LLSD& response); + + LLPanel* mMainPanel = nullptr; }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index ddd55d0c17..f7c82621fb 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -344,10 +344,22 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater) } floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); - floater->getChild<LLUICtrl>("file_size_label")->setColor( - shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD - && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + + LLUIColor color = LLUIColorTable::instance().getColor( "LabelTextColor" ); + if (shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD + && got_bytes + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE) + { + color = LLUIColor(LLColor4::red); + } + if (shot_type == LLSnapshotModel::SNAPSHOT_WEB + && got_bytes + && previewp->getDataSize() > LLWebProfile::MAX_WEB_DATASIZE) + { + color = LLUIColor(LLColor4::red); + } + + floater->getChild<LLUICtrl>("file_size_label")->setColor(color); // Update the width and height spinners based on the corresponding resolution combos. (?) switch(shot_type) diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index aadc5b9580..f6d8fcab36 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -284,6 +284,15 @@ bool LLFloaterTools::postBuild() // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here getChild<LLUICtrl>("slider force")->setValue(log10(gSavedSettings.getF32("LandBrushForce"))); + mTextBulldozer = getChild<LLTextBox>("Bulldozer:"); + mTextDozerSize = getChild<LLTextBox>("Dozer Size:"); + mTextDozerStrength = getChild<LLTextBox>("Strength:"); + mSliderZoom = getChild<LLSlider>("slider zoom"); + + mTextSelectionCount = getChild<LLTextBox>("selection_count"); + mTextSelectionEmpty = getChild<LLTextBox>("selection_empty"); + mTextSelectionFaces = getChild<LLTextBox>("selection_faces"); + mCostTextBorder = getChild<LLViewBorder>("cost_text_border"); mTab = getChild<LLTabContainer>("Object Info Tabs"); @@ -450,10 +459,10 @@ void LLFloaterTools::refresh() { std::string obj_count_string; LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string); + mTextSelectionCount->setTextArg("[OBJ_COUNT]", obj_count_string); std::string prim_count_string; LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string); + mTextSelectionCount->setTextArg("[PRIM_COUNT]", prim_count_string); // calculate selection rendering cost if (sShowObjectCost) @@ -521,23 +530,18 @@ void LLFloaterTools::refresh() } } } - - childSetTextArg("selection_faces", "[FACES_STRING]", faces_str); + mTextSelectionFaces->setTextArg("[FACES_STRING]", faces_str); } bool show_faces = (object_count == 1) && LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool(); - getChildView("selection_faces")->setVisible(show_faces); + mTextSelectionFaces->setVisible(show_faces); LLStringUtil::format_map_t selection_args; selection_args["OBJ_COUNT"] = llformat("%.1d", link_count); selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost); - std::ostringstream selection_info; - - selection_info << getString("status_selectcount", selection_args); - - getChild<LLTextBox>("selection_count")->setText(selection_info.str()); + mTextSelectionCount->setText(getString("status_selectcount", selection_args)); } @@ -618,8 +622,9 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnFocus ->setToggleState( focus_visible ); mRadioGroupFocus->setVisible( focus_visible ); - getChildView("slider zoom")->setVisible( focus_visible); - getChildView("slider zoom")->setEnabled(gCameraBtnZoom); + + mSliderZoom->setVisible( focus_visible); + mSliderZoom->setEnabled(gCameraBtnZoom); if (!gCameraBtnOrbit && !gCameraBtnPan && @@ -644,7 +649,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // multiply by correction factor because volume sliders go [0, 0.5] - getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); + mSliderZoom->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); // Move buttons bool move_visible = (tool == LLToolGrab::getInstance()); @@ -832,22 +837,22 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } if (mSliderDozerSize) { - mSliderDozerSize ->setVisible( land_visible ); - getChildView("Bulldozer:")->setVisible( land_visible); - getChildView("Dozer Size:")->setVisible( land_visible); + mSliderDozerSize->setVisible( land_visible ); + mTextBulldozer->setVisible( land_visible); + mTextDozerSize->setVisible( land_visible); } if (mSliderDozerForce) { - mSliderDozerForce ->setVisible( land_visible ); - getChildView("Strength:")->setVisible( land_visible); + mSliderDozerForce->setVisible( land_visible ); + mTextDozerStrength->setVisible( land_visible); } bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); - getChildView("selection_count")->setVisible(!land_visible && have_selection); - getChildView("selection_faces")->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() + mTextSelectionCount->setVisible(!land_visible && have_selection); + mTextSelectionFaces->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1); - getChildView("selection_empty")->setVisible(!land_visible && !have_selection); + mTextSelectionEmpty->setVisible(!land_visible && !have_selection); mTab->setVisible(!land_visible); mPanelLandInfo->setVisible(land_visible); diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index f9c3b401bb..0f7a61b733 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -148,6 +148,11 @@ public: LLButton *mBtnDuplicate; LLButton *mBtnDuplicateInPlace; + LLTextBox* mTextSelectionCount = nullptr; + LLTextBox* mTextSelectionEmpty = nullptr; + LLTextBox* mTextSelectionFaces = nullptr; + LLSlider* mSliderZoom = nullptr; + // Create buttons LLCheckBoxCtrl *mCheckSticky; LLCheckBoxCtrl *mCheckCopySelection; @@ -155,9 +160,12 @@ public: LLCheckBoxCtrl *mCheckCopyRotates; // Land buttons - LLRadioGroup* mRadioGroupLand; - LLSlider *mSliderDozerSize; - LLSlider *mSliderDozerForce; + LLRadioGroup* mRadioGroupLand = nullptr; + LLSlider *mSliderDozerSize = nullptr; + LLSlider *mSliderDozerForce = nullptr; + LLTextBox* mTextBulldozer = nullptr; + LLTextBox* mTextDozerSize = nullptr; + LLTextBox* mTextDozerStrength = nullptr; LLButton *mBtnApplyToSelection; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 76d3e3e049..d53b36e59f 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -55,19 +55,8 @@ #include "llcorehttputil.h" #include "lluiusage.h" - -#if LL_MSVC -#pragma warning(push) -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - #include <boost/lexical_cast.hpp> -#if LL_MSVC -#pragma warning(pop) // Restore all warnings to the previous state -#endif - const U32 MAX_CACHED_GROUPS = 20; // diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index 91051f8235..ce419498cf 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -586,7 +586,6 @@ void LLHeroProbeManager::cleanup() { mVertexBuffer = nullptr; mRenderTarget.release(); - mHeroRenderTarget.release(); mMipChain.clear(); @@ -594,10 +593,7 @@ void LLHeroProbeManager::cleanup() mProbes.clear(); - mReflectionMaps.clear(); - mDefaultProbe = nullptr; - mUpdatingProbe = nullptr; } void LLHeroProbeManager::doOcclusion() diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h index 28852770c3..58a94a3de8 100644 --- a/indra/newview/llheroprobemanager.h +++ b/indra/newview/llheroprobemanager.h @@ -104,8 +104,6 @@ private: // used to generate mipmaps without doing a copy-to-texture LLRenderTarget mRenderTarget; - LLRenderTarget mHeroRenderTarget; - std::vector<LLRenderTarget> mMipChain; // storage for reflection probe radiance maps (plus two scratch space cubemaps) @@ -124,11 +122,6 @@ private: // list of active reflection maps std::vector<LLPointer<LLReflectionMap>> mProbes; - // list of maps being used for rendering - std::vector<LLReflectionMap*> mReflectionMaps; - - LLReflectionMap* mUpdatingProbe = nullptr; - LLPointer<LLReflectionMap> mDefaultProbe; // default reflection probe to fall back to for pixels with no probe influences (should always be at cube index 0) // number of reflection probes to use for rendering diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index e24274650d..c1e68e0288 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -58,10 +58,6 @@ #include "llworld.h" #include "boost/lexical_cast.hpp" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif extern void on_new_message(const LLSD& msg); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8471b2cea1..57c0d57190 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -3637,11 +3637,11 @@ void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, con { for (const LLUUID& id : item_deletion_list) { - remove_inventory_item(id, NULL); + gInventory.removeItem(id); } for (const LLUUID& id : cat_deletion_list) { - remove_inventory_category(id, NULL); + gInventory.removeCategory(id); } }); } diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 9e6cf7ac73..46d1e822de 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -147,8 +147,6 @@ const LLInventoryGallery::Params& LLInventoryGallery::getDefaultParams() bool LLInventoryGallery::postBuild() { mScrollPanel = getChild<LLScrollContainer>("gallery_scroll_panel"); - LLPanel::Params params = LLPanel::getDefaultParams(); - mGalleryPanel = LLUICtrlFactory::create<LLPanel>(params); mMessageTextBox = getChild<LLTextBox>("empty_txt"); mInventoryGalleryMenu = new LLInventoryGalleryContextMenu(this); mRootGalleryMenu = new LLInventoryGalleryContextMenu(this); diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 0e2b3cb409..31c9eb8966 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -670,15 +670,16 @@ void LLLocalBitmap::updateGLTFMaterials(LLUUID old_id, LLUUID new_id) if (override_mat) { // do not create a new material, reuse existing pointer - LLFetchedGLTFMaterial* render_mat = (LLFetchedGLTFMaterial*)entry->getGLTFRenderMaterial(); + LLFetchedGLTFMaterial* render_mat = dynamic_cast<LLFetchedGLTFMaterial*>(entry->getGLTFRenderMaterial()); if (render_mat) { - llassert(dynamic_cast<LLFetchedGLTFMaterial*>(entry->getGLTFRenderMaterial()) != nullptr); - { *render_mat = *fetched_mat; - } render_mat->applyOverride(*override_mat); } + else + { + LL_WARNS_ONCE() << "Failed to apply local material override, render material not found" << LL_ENDL; + } } } } diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 329fb881e3..bf49f33049 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -42,19 +42,7 @@ #include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/replace.hpp> #include <boost/regex.hpp> - -#if LL_MSVC -#pragma warning(push) -// disable warning about boost::lexical_cast unreachable code -// when it fails to parse the string -#pragma warning (disable:4702) -#endif - #include <boost/date_time/gregorian/gregorian.hpp> -#if LL_MSVC -#pragma warning(pop) // Restore all warnings to the previous state -#endif - #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/local_time_adjustor.hpp> diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index 0f3e0306af..83a6e66019 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -29,11 +29,6 @@ #include "llmediadataclient.h" #include "llviewercontrol.h" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - #include <algorithm> #include <boost/lexical_cast.hpp> diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 349df11f35..26e2d8f319 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3292,8 +3292,6 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b // only allocate as much space in the cache as is needed for the local cache data_size = llmin(data_size, bytes); - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); if (file.getMaxSize() >= bytes) { @@ -3302,7 +3300,6 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b file.write(data, data_size); - // <FS:Ansariel> Fix asset caching S32 remaining = bytes - file.tell(); if (remaining > 0) { @@ -3314,7 +3311,6 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b delete[] block; } } - // </FS:Ansariel> } } else @@ -3367,8 +3363,6 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body if (result == MESH_OK) { // good fetch from sim, write to cache - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; @@ -3432,8 +3426,6 @@ void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* && gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size)) { // good fetch from sim, write to cache - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; @@ -3483,8 +3475,6 @@ void LLMeshDecompositionHandler::processData(LLCore::BufferArray * /* body */, S && gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size)) { // good fetch from sim, write to cache - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; @@ -3532,8 +3522,6 @@ void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * /* body */, S3 && gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size) == MESH_OK) { // good fetch from sim, write to cache for caching - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index d7df9ceadc..72fb9464d8 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -109,8 +109,6 @@ bool LLOutfitGallery::postBuild() { bool rv = LLOutfitListBase::postBuild(); mScrollPanel = getChild<LLScrollContainer>("gallery_scroll_panel"); - LLPanel::Params params = LLPanel::getDefaultParams(); // Don't parse XML when creating dummy LLPanel - mGalleryPanel = LLUICtrlFactory::create<LLPanel>(params); mMessageTextBox = getChild<LLTextBox>("no_outfits_txt"); mOutfitGalleryMenu = new LLOutfitGalleryContextMenu(this); return rv; diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index e6421d8a41..488bd87272 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -126,29 +126,31 @@ void LLOutputMonitorCtrl::draw() const F32 LEVEL_1 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL * 2.f / 3.f; const F32 LEVEL_2 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL; + LLVoiceClient* vocie_client = LLVoiceClient::getInstance(); + if (getVisible() && mAutoUpdate && !getIsMuted() && mSpeakerId.notNull()) { - setPower(LLVoiceClient::getInstance()->getCurrentPower(mSpeakerId)); + setPower(vocie_client->getCurrentPower(mSpeakerId)); if(mIsAgentControl) { - setIsTalking(LLVoiceClient::getInstance()->getUserPTTState()); + setIsTalking(vocie_client->getUserPTTState()); } else { - setIsTalking(LLVoiceClient::getInstance()->getIsSpeaking(mSpeakerId)); + setIsTalking(vocie_client->getIsSpeaking(mSpeakerId)); } } if ((mPower == 0.f && !mIsTalking) && mShowParticipantsSpeaking) { std::set<LLUUID> participant_uuids; - LLVoiceClient::instance().getParticipantList(participant_uuids); + vocie_client->getParticipantList(participant_uuids); std::set<LLUUID>::const_iterator part_it = participant_uuids.begin(); F32 power = 0; for (; part_it != participant_uuids.end(); ++part_it) { - power = LLVoiceClient::instance().getCurrentPower(*part_it); + power = vocie_client->getCurrentPower(*part_it); if (power) { mPower = power; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7b3834bd60..b07946dd5d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -117,26 +117,23 @@ const S32 PBRTYPE_METALLIC_ROUGHNESS = 2; // PBR Metallic const S32 PBRTYPE_EMISSIVE = 3; // PBR Emissive const S32 PBRTYPE_NORMAL = 4; // PBR Normal -LLGLTFMaterial::TextureInfo texture_info_from_pbrtype(S32 pbr_type) +LLGLTFMaterial::TextureInfo LLPanelFace::getPBRTextureInfo() { - switch (pbr_type) + // Radiogroup [ "Complete material", "Base color", "Metallic/roughness", "Emissive", "Normal" ] + S32 radio_group_index = mRadioPbrType->getSelectedIndex(); + switch (radio_group_index) { case PBRTYPE_BASE_COLOR: return LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR; - break; case PBRTYPE_NORMAL: return LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL; - break; case PBRTYPE_METALLIC_ROUGHNESS: return LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS; - break; case PBRTYPE_EMISSIVE: return LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE; - break; - default: - return LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; - break; } + // The default value is used as a fallback + return LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; } void LLPanelFace::updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func) @@ -195,265 +192,250 @@ std::string USE_TEXTURE; LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() { - LLRender::eTexIndex channel_to_edit = LLRender::DIFFUSE_MAP; - if (mComboMatMedia) + S32 matmedia_selection = mComboMatMedia->getCurrentIndex(); + switch (matmedia_selection) { - U32 matmedia_selection = mComboMatMedia->getCurrentIndex(); - if (matmedia_selection == MATMEDIA_MATERIAL) - { - channel_to_edit = (LLRender::eTexIndex)mRadioMaterialType->getSelectedIndex(); - } - if (matmedia_selection == MATMEDIA_PBR) - { - channel_to_edit = (LLRender::eTexIndex)mRadioPbrType->getSelectedIndex(); - } + case MATMEDIA_MATERIAL: + return getMatTextureChannel(); + case MATMEDIA_PBR: + return getPBRTextureChannel(); } + return (LLRender::eTexIndex)0; +} - channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; - channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; - return channel_to_edit; +LLRender::eTexIndex LLPanelFace::getMatTextureChannel() +{ + // Radiogroup [ "Texture (diffuse)", "Bumpiness (normal)", "Shininess (specular)" ] + S32 radio_group_index = mRadioMaterialType->getSelectedIndex(); + switch (radio_group_index) + { + case MATTYPE_DIFFUSE: // "Texture (diffuse)" + return LLRender::DIFFUSE_MAP; + case MATTYPE_NORMAL: // "Bumpiness (normal)" + if (getCurrentNormalMap().notNull()) + return LLRender::NORMAL_MAP; + break; + case MATTYPE_SPECULAR: // "Shininess (specular)" + if (getCurrentNormalMap().notNull()) + return LLRender::SPECULAR_MAP; + break; + } + // The default value is used as a fallback if no required texture is chosen + return (LLRender::eTexIndex)0; +} + +LLRender::eTexIndex LLPanelFace::getPBRTextureChannel() +{ + // Radiogroup [ "Complete material", "Base color", "Metallic/roughness", "Emissive", "Normal" ] + S32 radio_group_index = mRadioPbrType->getSelectedIndex(); + switch (radio_group_index) + { + case PBRTYPE_RENDER_MATERIAL_ID: // "Complete material" + return LLRender::NUM_TEXTURE_CHANNELS; + case PBRTYPE_BASE_COLOR: // "Base color" + return LLRender::BASECOLOR_MAP; + case PBRTYPE_METALLIC_ROUGHNESS: // "Metallic/roughness" + return LLRender::METALLIC_ROUGHNESS_MAP; + case PBRTYPE_EMISSIVE: // "Emissive" + return LLRender::EMISSIVE_MAP; + case PBRTYPE_NORMAL: // "Normal" + return LLRender::GLTF_NORMAL_MAP; + } + // The default value is used as a fallback + return LLRender::NUM_TEXTURE_CHANNELS; } LLRender::eTexIndex LLPanelFace::getTextureDropChannel() { - if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) { - return LLRender::eTexIndex(mRadioMaterialType->getSelectedIndex()); + return getMatTextureChannel(); } - return LLRender::eTexIndex(MATTYPE_DIFFUSE); + return (LLRender::eTexIndex)0; } LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() { - if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { - return texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); + return getPBRTextureInfo(); } - return texture_info_from_pbrtype(PBRTYPE_BASE_COLOR); + return (LLGLTFMaterial::TextureInfo)0; } // Things the UI provides... // -LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); } -LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->getImageAssetID(); } -U32 LLPanelFace::getCurrentShininess() { return getChild<LLComboBox>("combobox shininess")->getCurrentIndex(); } -U32 LLPanelFace::getCurrentBumpiness() { return getChild<LLComboBox>("combobox bumpiness")->getCurrentIndex(); } -U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)getChild<LLComboBox>("combobox alphamode")->getCurrentIndex(); } -U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)getChild<LLUICtrl>("maskcutoff")->getValue().asInteger(); } -U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)getChild<LLUICtrl>("environment")->getValue().asInteger(); } -U8 LLPanelFace::getCurrentGlossiness() { return (U8)getChild<LLUICtrl>("glossiness")->getValue().asInteger(); } -F32 LLPanelFace::getCurrentBumpyRot() { return (F32)getChild<LLUICtrl>("bumpyRot")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyScaleU() { return (F32)getChild<LLUICtrl>("bumpyScaleU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyScaleV() { return (F32)getChild<LLUICtrl>("bumpyScaleV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyOffsetU() { return (F32)getChild<LLUICtrl>("bumpyOffsetU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyOffsetV() { return (F32)getChild<LLUICtrl>("bumpyOffsetV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyRot() { return (F32)getChild<LLUICtrl>("shinyRot")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyScaleU() { return (F32)getChild<LLUICtrl>("shinyScaleU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyScaleV() { return (F32)getChild<LLUICtrl>("shinyScaleV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyOffsetU() { return (F32)getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyOffsetV() { return (F32)getChild<LLUICtrl>("shinyOffsetV")->getValue().asReal(); } +LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->getImageAssetID(); } +U32 LLPanelFace::getCurrentShininess() { return mComboShininess->getCurrentIndex(); } +U32 LLPanelFace::getCurrentBumpiness() { return mComboBumpiness->getCurrentIndex(); } +U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)mComboAlphaMode->getCurrentIndex(); } +U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)mMaskCutoff->getValue().asInteger(); } +U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)mEnvironment->getValue().asInteger(); } +U8 LLPanelFace::getCurrentGlossiness() { return (U8)mGlossiness->getValue().asInteger(); } +F32 LLPanelFace::getCurrentBumpyRot() { return (F32)mBumpyRotate->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleU() { return (F32)mBumpyScaleU->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleV() { return (F32)mBumpyScaleV->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetU() { return (F32)mBumpyOffsetU->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetV() { return (F32)mBumpyOffsetV->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyRot() { return (F32)mShinyRotate->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleU() { return (F32)mShinyScaleU->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleV() { return (F32)mShinyScaleV->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetU() { return (F32)mShinyOffsetU->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetV() { return (F32)mShinyOffsetV->getValue().asReal(); } // // Methods // -bool LLPanelFace::postBuild() -{ - childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); - childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); - childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this); - childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureScaleX, this); - childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureScaleY, this); - childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureRot, this); - childSetCommitCallback("rptctrl",&LLPanelFace::onCommitRepeatsPerMeter, this); - childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); - childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureOffsetX, this); - childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureOffsetY, this); - - childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterialBumpyScaleX, this); - childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterialBumpyScaleY, this); - childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterialBumpyRot, this); - childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterialBumpyOffsetX, this); - childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterialBumpyOffsetY, this); - childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterialShinyScaleX, this); - childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterialShinyScaleY, this); - childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterialShinyRot, this); - childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterialShinyOffsetX, this); - childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterialShinyOffsetY, this); - childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this); - childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this); - childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this); - childSetCommitCallback("add_media", &LLPanelFace::onClickBtnAddMedia, this); - childSetCommitCallback("delete_media", &LLPanelFace::onClickBtnDeleteMedia, this); - - getChild<LLUICtrl>("gltfTextureScaleU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleU, this, _1), nullptr); - getChild<LLUICtrl>("gltfTextureScaleV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleV, this, _1), nullptr); - getChild<LLUICtrl>("gltfTextureRotation")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFRotation, this, _1), nullptr); - getChild<LLUICtrl>("gltfTextureOffsetU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); - getChild<LLUICtrl>("gltfTextureOffsetV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); +bool LLPanelFace::postBuild() +{ + getChildSetCommitCallback(mComboShininess, "combobox shininess", [&](LLUICtrl*, const LLSD&) { onCommitShiny(); }); + getChildSetCommitCallback(mComboBumpiness, "combobox bumpiness", [&](LLUICtrl*, const LLSD&) { onCommitBump(); }); + getChildSetCommitCallback(mComboAlphaMode, "combobox alphamode", [&](LLUICtrl*, const LLSD&) { onCommitAlphaMode(); }); + getChildSetCommitCallback(mTexScaleU, "TexScaleU", [&](LLUICtrl*, const LLSD&) { onCommitTextureScaleX(); }); + getChildSetCommitCallback(mTexScaleV, "TexScaleV", [&](LLUICtrl*, const LLSD&) { onCommitTextureScaleY(); }); + getChildSetCommitCallback(mTexRotate, "TexRot", [&](LLUICtrl*, const LLSD&) { onCommitTextureRot(); }); + getChildSetCommitCallback(mTexRepeat, "rptctrl", [&](LLUICtrl*, const LLSD&) { onCommitRepeatsPerMeter(); }); + getChildSetCommitCallback(mPlanarAlign, "checkbox planar align", [&](LLUICtrl*, const LLSD&) { onCommitPlanarAlign(); }); + getChildSetCommitCallback(mTexOffsetU, "TexOffsetU", [&](LLUICtrl*, const LLSD&) { onCommitTextureOffsetX(); }); + getChildSetCommitCallback(mTexOffsetV, "TexOffsetV", [&](LLUICtrl*, const LLSD&) { onCommitTextureOffsetY(); }); + + getChildSetCommitCallback(mBumpyScaleU, "bumpyScaleU", [&](LLUICtrl*, const LLSD&) { onCommitMaterialBumpyScaleX(); }); + getChildSetCommitCallback(mBumpyScaleV, "bumpyScaleV", [&](LLUICtrl*, const LLSD&) { onCommitMaterialBumpyScaleY(); }); + getChildSetCommitCallback(mBumpyRotate, "bumpyRot", [&](LLUICtrl*, const LLSD&) { onCommitMaterialBumpyRot(); }); + getChildSetCommitCallback(mBumpyOffsetU, "bumpyOffsetU", [&](LLUICtrl*, const LLSD&) { onCommitMaterialBumpyOffsetX(); }); + getChildSetCommitCallback(mBumpyOffsetV, "bumpyOffsetV", [&](LLUICtrl*, const LLSD&) { onCommitMaterialBumpyOffsetY(); }); + getChildSetCommitCallback(mShinyScaleU, "shinyScaleU", [&](LLUICtrl*, const LLSD&) { onCommitMaterialShinyScaleX(); }); + getChildSetCommitCallback(mShinyScaleV, "shinyScaleV", [&](LLUICtrl*, const LLSD&) { onCommitMaterialShinyScaleY(); }); + getChildSetCommitCallback(mShinyRotate, "shinyRot", [&](LLUICtrl*, const LLSD&) { onCommitMaterialShinyRot(); }); + getChildSetCommitCallback(mShinyOffsetU, "shinyOffsetU", [&](LLUICtrl*, const LLSD&) { onCommitMaterialShinyOffsetX(); }); + getChildSetCommitCallback(mShinyOffsetV, "shinyOffsetV", [&](LLUICtrl*, const LLSD&) { onCommitMaterialShinyOffsetY(); }); + + getChildSetCommitCallback(mGlossiness, "glossiness", [&](LLUICtrl*, const LLSD&) { onCommitMaterialGloss(); }); + getChildSetCommitCallback(mEnvironment, "environment", [&](LLUICtrl*, const LLSD&) { onCommitMaterialEnv(); }); + getChildSetCommitCallback(mMaskCutoff, "maskcutoff", [&](LLUICtrl*, const LLSD&) { onCommitMaterialMaskCutoff(); }); + getChildSetCommitCallback(mAddMedia, "add_media", [&](LLUICtrl*, const LLSD&) { onClickBtnAddMedia(); }); + getChildSetCommitCallback(mDelMedia, "delete_media", [&](LLUICtrl*, const LLSD&) { onClickBtnDeleteMedia(); }); + + getChildSetCommitCallback(mPBRScaleU, "gltfTextureScaleU", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureScaleU(); }); + getChildSetCommitCallback(mPBRScaleV, "gltfTextureScaleV", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureScaleV(); }); + getChildSetCommitCallback(mPBRRotate, "gltfTextureRotation", [&](LLUICtrl*, const LLSD&) { onCommitGLTFRotation(); }); + getChildSetCommitCallback(mPBROffsetU, "gltfTextureOffsetU", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureOffsetU(); }); + getChildSetCommitCallback(mPBROffsetV, "gltfTextureOffsetV", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureOffsetV(); }); LLGLTFMaterialList::addSelectionUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); sMaterialOverrideSelection.connect(); - childSetAction("button align",&LLPanelFace::onClickAutoFix,this); - childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); - childSetAction("pbr_from_inventory", &LLPanelFace::onClickBtnLoadInvPBR, this); - childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this); - childSetAction("save_selected_pbr", &LLPanelFace::onClickBtnSavePBR, this); + getChildSetClickedCallback(mBtnAlign, "button align", [&](LLUICtrl*, const LLSD&) { onClickAutoFix(); }); + getChildSetClickedCallback(mBtnAlignTex, "button align textures", [&](LLUICtrl*, const LLSD&) { onAlignTexture(); }); + getChildSetClickedCallback(mBtnPbrFromInv, "pbr_from_inventory", [&](LLUICtrl*, const LLSD&) { onClickBtnLoadInvPBR(); }); + getChildSetClickedCallback(mBtnEditBbr, "edit_selected_pbr", [&](LLUICtrl*, const LLSD&) { onClickBtnEditPBR(); }); + getChildSetClickedCallback(mBtnSaveBbr, "save_selected_pbr", [&](LLUICtrl*, const LLSD&) { onClickBtnSavePBR(); }); setMouseOpaque(false); mPBRTextureCtrl = getChild<LLTextureCtrl>("pbr_control"); - if (mPBRTextureCtrl) - { - mPBRTextureCtrl->setDefaultImageAssetID(LLUUID::null); - mPBRTextureCtrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); - mPBRTextureCtrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); - mPBRTextureCtrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); - mPBRTextureCtrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); - mPBRTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragPbr, this, _2)); - mPBRTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onPbrSelectionChanged, this, _1)); - mPBRTextureCtrl->setOnCloseCallback(boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2)); - - mPBRTextureCtrl->setFollowsTop(); - mPBRTextureCtrl->setFollowsLeft(); - mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mPBRTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - mPBRTextureCtrl->setBakeTextureEnabled(false); - mPBRTextureCtrl->setInventoryPickType(PICK_MATERIAL); - } + mPBRTextureCtrl->setDefaultImageAssetID(LLUUID::null); + mPBRTextureCtrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); + mPBRTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbr(); }); + mPBRTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelPbr(); }); + mPBRTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectPbr(); }); + mPBRTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragPbr(item); }); + mPBRTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onPbrSelectionChanged(item); }); + mPBRTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mPBRTextureCtrl->setFollowsTop(); + mPBRTextureCtrl->setFollowsLeft(); + mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mPBRTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); + mPBRTextureCtrl->setBakeTextureEnabled(false); + mPBRTextureCtrl->setInventoryPickType(PICK_MATERIAL); mTextureCtrl = getChild<LLTextureCtrl>("texture control"); - if(mTextureCtrl) - { - mTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_TEXTURE); - mTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitTexture, this, _2) ); - mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) ); - mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) ); - mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); - mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); - mTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); - - mTextureCtrl->setFollowsTop(); - mTextureCtrl->setFollowsLeft(); - mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - } + mTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_TEXTURE); + mTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexture(); }); + mTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelTexture(); }); + mTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectTexture(); }); + mTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); + mTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mTextureCtrl->setFollowsTop(); + mTextureCtrl->setFollowsLeft(); + mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); mShinyTextureCtrl = getChild<LLTextureCtrl>("shinytexture control"); - if(mShinyTextureCtrl) - { - mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR); - mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); - mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); - mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); - mShinyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); - - mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); - mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); - mShinyTextureCtrl->setFollowsTop(); - mShinyTextureCtrl->setFollowsLeft(); - mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - } + mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR); + mShinyTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitSpecularTexture(data); }); + mShinyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelSpecularTexture(data); }); + mShinyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectSpecularTexture(data); }); + mShinyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mShinyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); + mShinyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mShinyTextureCtrl->setFollowsTop(); + mShinyTextureCtrl->setFollowsLeft(); + mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); mBumpyTextureCtrl = getChild<LLTextureCtrl>("bumpytexture control"); - if(mBumpyTextureCtrl) - { - mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL); - mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL); - mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); - mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); - mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); - mBumpyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); - - mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); - mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); - mBumpyTextureCtrl->setFollowsTop(); - mBumpyTextureCtrl->setFollowsLeft(); - mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - } + mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL); + mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL); + mBumpyTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitNormalTexture(data); }); + mBumpyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelNormalTexture(data); }); + mBumpyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectNormalTexture(data); }); + mBumpyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mBumpyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); + mBumpyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mBumpyTextureCtrl->setFollowsTop(); + mBumpyTextureCtrl->setFollowsLeft(); + mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); - if(mColorSwatch) - { - mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2)); - mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2)); - mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2)); - mColorSwatch->setFollowsTop(); - mColorSwatch->setFollowsLeft(); - mColorSwatch->setCanApplyImmediately(true); - } + mColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitColor(); }); + mColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelColor(); }); + mColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectColor(); }); + mColorSwatch->setFollowsTop(); + mColorSwatch->setFollowsLeft(); + mColorSwatch->setCanApplyImmediately(true); mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch"); - if(mShinyColorSwatch) - { - mShinyColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitShinyColor, this, _2)); - mShinyColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelShinyColor, this, _2)); - mShinyColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectShinyColor, this, _2)); - mShinyColorSwatch->setFollowsTop(); - mShinyColorSwatch->setFollowsLeft(); - mShinyColorSwatch->setCanApplyImmediately(true); - } + mShinyColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitShinyColor(); }); + mShinyColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelShinyColor(); }); + mShinyColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectShinyColor(); }); + mShinyColorSwatch->setFollowsTop(); + mShinyColorSwatch->setFollowsLeft(); + mShinyColorSwatch->setCanApplyImmediately(true); mLabelColorTransp = getChild<LLTextBox>("color trans"); - if(mLabelColorTransp) - { - mLabelColorTransp->setFollowsTop(); - mLabelColorTransp->setFollowsLeft(); - } + mLabelColorTransp->setFollowsTop(); + mLabelColorTransp->setFollowsLeft(); mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans"); - if(mCtrlColorTransp) - { - mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2)); - mCtrlColorTransp->setPrecision(0); - mCtrlColorTransp->setFollowsTop(); - mCtrlColorTransp->setFollowsLeft(); - } + mCtrlColorTransp->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitAlpha(); }); + mCtrlColorTransp->setPrecision(0); + mCtrlColorTransp->setFollowsTop(); + mCtrlColorTransp->setFollowsLeft(); - mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright"); - if (mCheckFullbright) - { - mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this); - } + getChildSetCommitCallback(mCheckFullbright, "checkbox fullbright", [&](LLUICtrl*, const LLSD&) { onCommitFullbright(); }); - mComboTexGen = getChild<LLComboBox>("combobox texgen"); - if(mComboTexGen) - { - mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this); - mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); - } + mLabelTexGen = getChild<LLTextBox>("tex gen"); + getChildSetCommitCallback(mComboTexGen, "combobox texgen", [&](LLUICtrl*, const LLSD&) { onCommitTexGen(); }); + mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); - mComboMatMedia = getChild<LLComboBox>("combobox matmedia"); - if(mComboMatMedia) - { - mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); - mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); - } + getChildSetCommitCallback(mComboMatMedia, "combobox matmedia", [&](LLUICtrl*, const LLSD&) { onCommitMaterialsMedia(); }); + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); - mRadioMaterialType = getChild<LLRadioGroup>("radio_material_type"); - if(mRadioMaterialType) - { - mRadioMaterialType->setCommitCallback(LLPanelFace::onCommitMaterialType, this); - mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); - } + getChildSetCommitCallback(mRadioMaterialType, "radio_material_type", [&](LLUICtrl*, const LLSD&) { onCommitMaterialType(); }); + mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); - mRadioPbrType = getChild<LLRadioGroup>("radio_pbr_type"); - if (mRadioPbrType) - { - mRadioPbrType->setCommitCallback(LLPanelFace::onCommitPbrType, this); - mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); - } + getChildSetCommitCallback(mRadioPbrType, "radio_pbr_type", [&](LLUICtrl*, const LLSD&) { onCommitPbrType(); }); + mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); - mCtrlGlow = getChild<LLSpinCtrl>("glow"); - if(mCtrlGlow) - { - mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this); - } + mLabelGlow = getChild<LLTextBox>("glow label"); + getChildSetCommitCallback(mCtrlGlow, "glow", [&](LLUICtrl*, const LLSD&) { onCommitGlow(); }); mMenuClipboardColor = getChild<LLMenuButton>("clipboard_color_params_btn"); mMenuClipboardTexture = getChild<LLMenuButton>("clipboard_texture_params_btn"); @@ -461,6 +443,19 @@ bool LLPanelFace::postBuild() mTitleMedia = getChild<LLMediaCtrl>("title_media"); mTitleMediaText = getChild<LLTextBox>("media_info"); + mLabelBumpiness = getChild<LLTextBox>("label bumpiness"); + mLabelShininess = getChild<LLTextBox>("label shininess"); + mLabelAlphaMode = getChild<LLTextBox>("label alphamode"); + mLabelGlossiness = getChild<LLTextBox>("label glossiness"); + mLabelEnvironment = getChild<LLTextBox>("label environment"); + mLabelMaskCutoff = getChild<LLTextBox>("label maskcutoff"); + mLabelShiniColor = getChild<LLTextBox>("label shinycolor"); + mLabelColor = getChild<LLTextBox>("color label"); + + mLabelMatPermLoading = getChild<LLTextBox>("material_permissions_loading_label"); + + mCheckSyncSettings = getChild<LLCheckBoxCtrl>("checkbox_sync_settings"); + clearCtrls(); return true; @@ -513,8 +508,7 @@ void LLPanelFace::draw() void LLPanelFace::sendTexture() { - if(!mTextureCtrl) return; - if( !mTextureCtrl->getTentative() ) + if (!mTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a // permissions check in the selection manager. ARGH! @@ -534,7 +528,7 @@ void LLPanelFace::sendTexture() void LLPanelFace::sendBump(U32 bumpiness) { if (bumpiness < BUMPY_TEXTURE) -{ + { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; mBumpyTextureCtrl->clear(); mBumpyTextureCtrl->setImageAssetID(LLUUID()); @@ -544,12 +538,13 @@ void LLPanelFace::sendBump(U32 bumpiness) LLUUID current_normal_map = mBumpyTextureCtrl->getImageAssetID(); - U8 bump = (U8) bumpiness & TEM_BUMP_MASK; + U8 bump = (U8)bumpiness & TEM_BUMP_MASK; // Clear legacy bump to None when using an actual normal map - // if (!current_normal_map.isNull()) + { bump = 0; + } // Set the normal map or reset it to null as appropriate // @@ -560,14 +555,14 @@ void LLPanelFace::sendBump(U32 bumpiness) void LLPanelFace::sendTexGen() { - U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; - LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen ); + U8 tex_gen = (U8)mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; + LLSelectMgr::getInstance()->selectionSetTexGen(tex_gen); } void LLPanelFace::sendShiny(U32 shininess) { if (shininess < SHINY_TEXTURE) -{ + { mShinyTextureCtrl->clear(); mShinyTextureCtrl->setImageAssetID(LLUUID()); } @@ -576,47 +571,39 @@ void LLPanelFace::sendShiny(U32 shininess) U8 shiny = (U8) shininess & TEM_SHINY_MASK; if (!specmap.isNull()) + { shiny = 0; + } LLSelectedTEMaterial::setSpecularID(this, specmap); - LLSelectMgr::getInstance()->selectionSetShiny( shiny, mShinyTextureCtrl->getImageItemID() ); + LLSelectMgr::getInstance()->selectionSetShiny(shiny, mShinyTextureCtrl->getImageItemID()); updateShinyControls(!specmap.isNull(), true); - } void LLPanelFace::sendFullbright() { - if(!mCheckFullbright)return; U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0; - LLSelectMgr::getInstance()->selectionSetFullbright( fullbright ); + LLSelectMgr::getInstance()->selectionSetFullbright(fullbright); } void LLPanelFace::sendColor() { - if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); - - LLSelectMgr::getInstance()->selectionSetColorOnly( color ); + LLSelectMgr::getInstance()->selectionSetColorOnly(color); } void LLPanelFace::sendAlpha() { - if(!mCtrlColorTransp)return; F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f; - LLSelectMgr::getInstance()->selectionSetAlphaOnly( alpha ); } - void LLPanelFace::sendGlow() { - if (mCtrlGlow) - { - F32 glow = mCtrlGlow->get(); - LLSelectMgr::getInstance()->selectionSetGlow( glow ); - } + F32 glow = mCtrlGlow->get(); + LLSelectMgr::getInstance()->selectionSetGlow(glow); } struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor @@ -624,47 +611,49 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {} virtual bool apply(LLViewerObject* object, S32 te) { - bool valid; - F32 value; - std::string prefix; + LLSpinCtrl *ctrlTexScaleS, *ctrlTexScaleT, *ctrlTexOffsetS, *ctrlTexOffsetT, *ctrlTexRotation; // Effectively the same as MATMEDIA_PBR sans using different radio, // separate for the sake of clarity - LLRadioGroup * radio_mat_type = mPanel->getChild<LLRadioGroup>("radio_material_type"); - switch (radio_mat_type->getSelectedIndex()) + switch (mPanel->mRadioMaterialType->getSelectedIndex()) { case MATTYPE_DIFFUSE: - prefix = "Tex"; + ctrlTexScaleS = mPanel->mTexScaleU; + ctrlTexScaleT = mPanel->mTexScaleV; + ctrlTexOffsetS = mPanel->mTexOffsetU; + ctrlTexOffsetT = mPanel->mTexOffsetV; + ctrlTexRotation = mPanel->mTexRotate; break; case MATTYPE_NORMAL: - prefix = "bumpy"; + ctrlTexScaleS = mPanel->mBumpyScaleU; + ctrlTexScaleT = mPanel->mBumpyScaleV; + ctrlTexOffsetS = mPanel->mBumpyOffsetU; + ctrlTexOffsetT = mPanel->mBumpyOffsetV; + ctrlTexRotation = mPanel->mBumpyRotate; break; case MATTYPE_SPECULAR: - prefix = "shiny"; + ctrlTexScaleS = mPanel->mShinyScaleU; + ctrlTexScaleT = mPanel->mShinyScaleV; + ctrlTexOffsetS = mPanel->mShinyOffsetU; + ctrlTexOffsetT = mPanel->mShinyOffsetV; + ctrlTexRotation = mPanel->mShinyRotate; break; + default: + llassert(false); + return false; } - LLSpinCtrl * ctrlTexScaleS = mPanel->getChild<LLSpinCtrl>(prefix + "ScaleU"); - LLSpinCtrl * ctrlTexScaleT = mPanel->getChild<LLSpinCtrl>(prefix + "ScaleV"); - LLSpinCtrl * ctrlTexOffsetS = mPanel->getChild<LLSpinCtrl>(prefix + "OffsetU"); - LLSpinCtrl * ctrlTexOffsetT = mPanel->getChild<LLSpinCtrl>(prefix + "OffsetV"); - LLSpinCtrl * ctrlTexRotation = mPanel->getChild<LLSpinCtrl>(prefix + "Rot"); + bool align_planar = mPanel->mPlanarAlign->get(); - LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen"); - LLCheckBoxCtrl* cb_planar_align = mPanel->getChild<LLCheckBoxCtrl>("checkbox planar align"); - bool align_planar = (cb_planar_align && cb_planar_align->get()); - - llassert(comboTexGen); llassert(object); if (ctrlTexScaleS) { - valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); + bool valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); if (valid || align_planar) { - value = ctrlTexScaleS->get(); - if (comboTexGen && - comboTexGen->getCurrentIndex() == 1) + F32 value = ctrlTexScaleS->get(); + if (mPanel->mComboTexGen->getCurrentIndex() == 1) { value *= 0.5f; } @@ -680,20 +669,19 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexScaleT) { - valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); + bool valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); if (valid || align_planar) { - value = ctrlTexScaleT->get(); - //if( checkFlipScaleT->get() ) + F32 value = ctrlTexScaleT->get(); + //if (checkFlipScaleT->get()) //{ // value = -value; //} - if (comboTexGen && - comboTexGen->getCurrentIndex() == 1) + if (mPanel->mComboTexGen->getCurrentIndex() == 1) { value *= 0.5f; } - object->setTEScaleT( te, value ); + object->setTEScaleT(te, value); if (align_planar) { @@ -705,11 +693,11 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexOffsetS) { - valid = !ctrlTexOffsetS->getTentative(); + bool valid = !ctrlTexOffsetS->getTentative(); if (valid || align_planar) { - value = ctrlTexOffsetS->get(); - object->setTEOffsetS( te, value ); + F32 value = ctrlTexOffsetS->get(); + object->setTEOffsetS(te, value); if (align_planar) { @@ -721,11 +709,11 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexOffsetT) { - valid = !ctrlTexOffsetT->getTentative(); + bool valid = !ctrlTexOffsetT->getTentative(); if (valid || align_planar) { - value = ctrlTexOffsetT->get(); - object->setTEOffsetT( te, value ); + F32 value = ctrlTexOffsetT->get(); + object->setTEOffsetT(te, value); if (align_planar) { @@ -737,11 +725,11 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexRotation) { - valid = !ctrlTexRotation->getTentative(); + bool valid = !ctrlTexRotation->getTentative(); if (valid || align_planar) { - value = ctrlTexRotation->get() * DEG_TO_RAD; - object->setTERotation( te, value ); + F32 value = ctrlTexRotation->get() * DEG_TO_RAD; + object->setTERotation(te, value); if (align_planar) { @@ -750,6 +738,7 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor } } } + return true; } private: @@ -906,7 +895,7 @@ struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor LLVector2 aligned_st_offset, aligned_st_scale; F32 aligned_st_rot; - if ( facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot) ) + if (facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot)) { const LLTextureEntry* tep = facep->getTextureEntry(); LLVector2 st_offset, st_scale; @@ -947,7 +936,7 @@ struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor void LLPanelFace::sendTextureInfo() { - if ((bool)childGetValue("checkbox planar align").asBoolean()) + if (mPlanarAlign->getValue().asBoolean()) { LLFace* last_face = NULL; bool identical_face =false; @@ -999,7 +988,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) const bool has_material = !has_pbr_material; // only turn on auto-adjust button if there is a media renderer and the media is loaded - childSetEnabled("button align", editable); + mBtnAlign->setEnabled(editable); if (mComboMatMedia->getCurrentIndex() < MATMEDIA_MATERIAL) { @@ -1100,30 +1089,23 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) const bool pbr_selected = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR; const bool texture_info_selected = pbr_selected && mRadioPbrType->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID; - getChildView("checkbox_sync_settings")->setEnabled(editable); - childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); + mCheckSyncSettings->setEnabled(editable); + mCheckSyncSettings->setValue(gSavedSettings.getBOOL("SyncMaterialSettings")); updateVisibility(objectp); // Color swatch - { - getChildView("color label")->setEnabled(editable); - } - + mLabelColor->setEnabled(editable); LLColor4 color = LLColor4::white; bool identical_color = false; - { - LLSelectedTE::getColor(color, identical_color); - LLColor4 prev_color = mColorSwatch->get(); - - mColorSwatch->setOriginal(color); - mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); - - mColorSwatch->setValid(editable && !has_pbr_material); - mColorSwatch->setEnabled( editable && !has_pbr_material); - mColorSwatch->setCanApplyImmediately( editable && !has_pbr_material); - } + LLSelectedTE::getColor(color, identical_color); + LLColor4 prev_color = mColorSwatch->get(); + mColorSwatch->setOriginal(color); + mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); + mColorSwatch->setValid(editable && !has_pbr_material); + mColorSwatch->setEnabled( editable && !has_pbr_material); + mColorSwatch->setCanApplyImmediately( editable && !has_pbr_material); // Color transparency mLabelColorTransp->setEnabled(editable); @@ -1132,65 +1114,51 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mCtrlColorTransp->setValue(editable ? transparency : 0); mCtrlColorTransp->setEnabled(editable && has_material); + // Shiny U8 shiny = 0; - bool identical_shiny = false; + { + bool identical_shiny = false; - // Shiny - LLSelectedTE::getShiny(shiny, identical_shiny); - identical = identical && identical_shiny; + LLSelectedTE::getShiny(shiny, identical_shiny); + identical = identical && identical_shiny; - shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; + shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; - LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); - if (combobox_shininess) - { - combobox_shininess->selectNthItem((S32)shiny); - } + mComboShininess->getSelectionInterface()->selectNthItem((S32)shiny); - getChildView("label shininess")->setEnabled(editable); - getChildView("combobox shininess")->setEnabled(editable); + mLabelShininess->setEnabled(editable); + mComboShininess->setEnabled(editable); - getChildView("label glossiness")->setEnabled(editable); - getChildView("glossiness")->setEnabled(editable); + mLabelGlossiness->setEnabled(editable); + mGlossiness->setEnabled(editable); - getChildView("label environment")->setEnabled(editable); - getChildView("environment")->setEnabled(editable); - getChildView("label shinycolor")->setEnabled(editable); + mLabelEnvironment->setEnabled(editable); + mEnvironment->setEnabled(editable); + mLabelShiniColor->setEnabled(editable); - getChild<LLUICtrl>("combobox shininess")->setTentative(!identical_spec); - getChild<LLUICtrl>("glossiness")->setTentative(!identical_spec); - getChild<LLUICtrl>("environment")->setTentative(!identical_spec); - mShinyColorSwatch->setTentative(!identical_spec); + mComboShininess->setTentative(!identical_spec); + mGlossiness->setTentative(!identical_spec); + mEnvironment->setTentative(!identical_spec); + mShinyColorSwatch->setTentative(!identical_spec); - { mShinyColorSwatch->setValid(editable); - mShinyColorSwatch->setEnabled( editable ); - mShinyColorSwatch->setCanApplyImmediately( editable ); + mShinyColorSwatch->setEnabled(editable); + mShinyColorSwatch->setCanApplyImmediately(editable); } - U8 bumpy = 0; // Bumpy + U8 bumpy = 0; { bool identical_bumpy = false; - LLSelectedTE::getBumpmap(bumpy,identical_bumpy); + LLSelectedTE::getBumpmap(bumpy, identical_bumpy); LLUUID norm_map_id = getCurrentNormalMap(); - LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); - bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE; + mComboBumpiness->getSelectionInterface()->selectNthItem((S32)bumpy); - if (combobox_bumpiness) - { - combobox_bumpiness->selectNthItem((S32)bumpy); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox bumpiness'" << LL_ENDL; - } - - getChildView("combobox bumpiness")->setEnabled(editable); - getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical_bumpy); - getChildView("label bumpiness")->setEnabled(editable); + mComboBumpiness->setEnabled(editable); + mComboBumpiness->setTentative(!identical_bumpy); + mLabelBumpiness->setEnabled(editable); } // Texture @@ -1228,7 +1196,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (LLViewerMedia::getInstance()->textureHasMedia(id)) { - getChildView("button align")->setEnabled(editable); + mBtnAlign->setEnabled(editable); } // Diffuse Alpha Mode @@ -1243,22 +1211,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha); - LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); - if (combobox_alphamode) - { - //it is invalid to have any alpha mode other than blend if transparency is greater than zero ... - // Want masking? Want emissive? Tough! You get BLEND! - alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode; + // it is invalid to have any alpha mode other than blend if transparency is greater than zero ... + // Want masking? Want emissive? Tough! You get BLEND! + alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode; - // ... unless there is no alpha channel in the texture, in which case alpha mode MUST be none - alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + // ... unless there is no alpha channel in the texture, in which case alpha mode MUST be none + alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - combobox_alphamode->selectNthItem(alpha_mode); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; - } + mComboAlphaMode->getSelectionInterface()->selectNthItem(alpha_mode); updateAlphaControls(); @@ -1271,10 +1231,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; - getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(can_change_alpha); - getChildView("maskcutoff")->setEnabled(can_change_alpha); - getChildView("label maskcutoff")->setEnabled(can_change_alpha); + mComboAlphaMode->setEnabled(can_change_alpha && transparency <= 0.f); + mLabelAlphaMode->setEnabled(can_change_alpha); + mMaskCutoff->setEnabled(can_change_alpha); + mLabelMaskCutoff->setEnabled(can_change_alpha); mTextureCtrl->setBakeTextureEnabled(true); } @@ -1284,10 +1244,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mTextureCtrl->setTentative(false); mTextureCtrl->setEnabled(false); mTextureCtrl->setImageAssetID(LLUUID::null); - getChildView("combobox alphamode")->setEnabled(false); - getChildView("label alphamode")->setEnabled(false); - getChildView("maskcutoff")->setEnabled(false); - getChildView("label maskcutoff")->setEnabled(false); + mComboAlphaMode->setEnabled(false); + mLabelAlphaMode->setEnabled(false); + mMaskCutoff->setEnabled(false); + mLabelMaskCutoff->setEnabled(false); mTextureCtrl->setBakeTextureEnabled(false); } @@ -1299,10 +1259,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; - getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(can_change_alpha); - getChildView("maskcutoff")->setEnabled(can_change_alpha); - getChildView("label maskcutoff")->setEnabled(can_change_alpha); + mComboAlphaMode->setEnabled(can_change_alpha && transparency <= 0.f); + mLabelAlphaMode->setEnabled(can_change_alpha); + mMaskCutoff->setEnabled(can_change_alpha); + mLabelMaskCutoff->setEnabled(can_change_alpha); mTextureCtrl->setBakeTextureEnabled(true); } @@ -1322,9 +1282,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (mShinyTextureCtrl) { - mShinyTextureCtrl->setTentative( !identical_spec ); - mShinyTextureCtrl->setEnabled( editable && !has_pbr_material); - mShinyTextureCtrl->setImageAssetID( specmap_id ); + mShinyTextureCtrl->setTentative(!identical_spec); + mShinyTextureCtrl->setEnabled(editable && !has_pbr_material); + mShinyTextureCtrl->setImageAssetID(specmap_id); if (attachment) { @@ -1338,9 +1298,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (mBumpyTextureCtrl) { - mBumpyTextureCtrl->setTentative( !identical_norm ); - mBumpyTextureCtrl->setEnabled( editable && !has_pbr_material); - mBumpyTextureCtrl->setImageAssetID( normmap_id ); + mBumpyTextureCtrl->setTentative(!identical_norm); + mBumpyTextureCtrl->setEnabled(editable && !has_pbr_material); + mBumpyTextureCtrl->setImageAssetID(normmap_id); if (attachment) { @@ -1354,28 +1314,24 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } // planar align - bool align_planar = false; + bool align_planar = mPlanarAlign->get(); bool identical_planar_aligned = false; - { - LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align"); - align_planar = (cb_planar_align && cb_planar_align->get()); - bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected); - childSetValue("checkbox planar align", align_planar && enabled); - childSetVisible("checkbox planar align", enabled); - childSetEnabled("checkbox planar align", enabled); - childSetEnabled("button align textures", enabled && LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); + bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected); + mPlanarAlign->setValue(align_planar && enabled); + mPlanarAlign->setVisible(enabled); + mPlanarAlign->setEnabled(enabled); + mBtnAlignTex->setEnabled(enabled && LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); - if (align_planar && enabled) - { - LLFace* last_face = NULL; - bool identical_face = false; - LLSelectedTE::getFace(last_face, identical_face); + if (align_planar && enabled) + { + LLFace* last_face = NULL; + bool identical_face = false; + LLSelectedTE::getFace(last_face, identical_face); - LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face); - // this will determine if the texture param controls are tentative: - identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func); - } + LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face); + // this will determine if the texture param controls are tentative: + identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func); } // Needs to be public and before tex scale settings below to properly reflect @@ -1386,10 +1342,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool identical_texgen = true; bool identical_planar_texgen = false; - { - LLSelectedTE::getTexGen(selected_texgen, identical_texgen); - identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); - } + LLSelectedTE::getTexGen(selected_texgen, identical_texgen); + identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); // Texture scale { @@ -1416,21 +1370,21 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) spec_scale_s = editable ? spec_scale_s : 1.0f; spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f; - getChild<LLUICtrl>("TexScaleU")->setValue(diff_scale_s); - getChild<LLUICtrl>("shinyScaleU")->setValue(spec_scale_s); - getChild<LLUICtrl>("bumpyScaleU")->setValue(norm_scale_s); + mTexScaleU->setValue(diff_scale_s); + mShinyScaleU->setValue(spec_scale_s); + mBumpyScaleU->setValue(norm_scale_s); - getChildView("TexScaleU")->setEnabled(editable && has_material); - getChildView("shinyScaleU")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyScaleU")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexScaleU->setEnabled(editable && has_material); + mShinyScaleU->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyScaleU->setEnabled(editable && has_material && normmap_id.notNull()); bool diff_scale_tentative = !(identical && identical_diff_scale_s); bool norm_scale_tentative = !(identical && identical_norm_scale_s); bool spec_scale_tentative = !(identical && identical_spec_scale_s); - getChild<LLUICtrl>("TexScaleU")->setTentative( LLSD(diff_scale_tentative)); - getChild<LLUICtrl>("shinyScaleU")->setTentative(LLSD(spec_scale_tentative)); - getChild<LLUICtrl>("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative)); + mTexScaleU->setTentative(LLSD(diff_scale_tentative)); + mShinyScaleU->setTentative(LLSD(spec_scale_tentative)); + mBumpyScaleU->setTentative(LLSD(norm_scale_tentative)); } { @@ -1459,24 +1413,24 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool norm_scale_tentative = !identical_norm_scale_t; bool spec_scale_tentative = !identical_spec_scale_t; - getChildView("TexScaleV")->setEnabled(editable && has_material); - getChildView("shinyScaleV")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyScaleV")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexScaleV->setEnabled(editable && has_material); + mShinyScaleV->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyScaleV->setEnabled(editable && has_material && normmap_id.notNull()); if (force_set_values) { - getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(diff_scale_t); + mTexScaleV->forceSetValue(diff_scale_t); } else { - getChild<LLSpinCtrl>("TexScaleV")->setValue(diff_scale_t); + mTexScaleV->setValue(diff_scale_t); } - getChild<LLUICtrl>("shinyScaleV")->setValue(norm_scale_t); - getChild<LLUICtrl>("bumpyScaleV")->setValue(spec_scale_t); + mShinyScaleV->setValue(spec_scale_t); + mBumpyScaleV->setValue(norm_scale_t); - getChild<LLUICtrl>("TexScaleV")->setTentative(LLSD(diff_scale_tentative)); - getChild<LLUICtrl>("shinyScaleV")->setTentative(LLSD(norm_scale_tentative)); - getChild<LLUICtrl>("bumpyScaleV")->setTentative(LLSD(spec_scale_tentative)); + mTexScaleV->setTentative(LLSD(diff_scale_tentative)); + mShinyScaleV->setTentative(LLSD(spec_scale_tentative)); + mBumpyScaleV->setTentative(LLSD(norm_scale_tentative)); } // Texture offset @@ -1497,17 +1451,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s); bool spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s); - getChild<LLUICtrl>("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f); - getChild<LLUICtrl>("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f); - getChild<LLUICtrl>("shinyOffsetU")->setValue(editable ? spec_offset_s : 0.0f); + mTexOffsetU->setValue(editable ? diff_offset_s : 0.0f); + mBumpyOffsetU->setValue(editable ? norm_offset_s : 0.0f); + mShinyOffsetU->setValue(editable ? spec_offset_s : 0.0f); - getChild<LLUICtrl>("TexOffsetU")->setTentative(LLSD(diff_offset_u_tentative)); - getChild<LLUICtrl>("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative)); - getChild<LLUICtrl>("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative)); + mTexOffsetU->setTentative(LLSD(diff_offset_u_tentative)); + mShinyOffsetU->setTentative(LLSD(spec_offset_u_tentative)); + mBumpyOffsetU->setTentative(LLSD(norm_offset_u_tentative)); - getChildView("TexOffsetU")->setEnabled(editable && has_material); - getChildView("shinyOffsetU")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyOffsetU")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexOffsetU->setEnabled(editable && has_material); + mShinyOffsetU->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyOffsetU->setEnabled(editable && has_material && normmap_id.notNull()); } { @@ -1527,17 +1481,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t); bool spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t); - getChild<LLUICtrl>("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f); - getChild<LLUICtrl>("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f); - getChild<LLUICtrl>("shinyOffsetV")->setValue(editable ? spec_offset_t : 0.0f); + mTexOffsetV->setValue( editable ? diff_offset_t : 0.0f); + mBumpyOffsetV->setValue(editable ? norm_offset_t : 0.0f); + mShinyOffsetV->setValue(editable ? spec_offset_t : 0.0f); - getChild<LLUICtrl>("TexOffsetV")->setTentative(LLSD(diff_offset_v_tentative)); - getChild<LLUICtrl>("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative)); - getChild<LLUICtrl>("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); + mTexOffsetV->setTentative(LLSD(diff_offset_v_tentative)); + mBumpyOffsetV->setTentative(LLSD(norm_offset_v_tentative)); + mShinyOffsetV->setTentative(LLSD(spec_offset_v_tentative)); - getChildView("TexOffsetV")->setEnabled(editable && has_material); - getChildView("shinyOffsetV")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyOffsetV")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexOffsetV->setEnabled(editable && has_material); + mShinyOffsetV->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyOffsetV->setEnabled(editable && has_material && normmap_id.notNull()); } // Texture rotation @@ -1550,9 +1504,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 norm_rotation = 0.f; F32 spec_rotation = 0.f; - LLSelectedTE::getRotation(diff_rotation,identical_diff_rotation); - LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation); - LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation); + LLSelectedTE::getRotation(diff_rotation, identical_diff_rotation); + LLSelectedTEMaterial::getSpecularRotation(spec_rotation, identical_spec_rotation); + LLSelectedTEMaterial::getNormalRotation(norm_rotation, identical_norm_rotation); bool diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation); bool norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation); @@ -1562,27 +1516,27 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - getChildView("TexRot")->setEnabled(editable && has_material); - getChildView("shinyRot")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyRot")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexRotate->setEnabled(editable && has_material); + mShinyRotate->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyRotate->setEnabled(editable && has_material && normmap_id.notNull()); - getChild<LLUICtrl>("TexRot")->setTentative(diff_rot_tentative); - getChild<LLUICtrl>("shinyRot")->setTentative(LLSD(norm_rot_tentative)); - getChild<LLUICtrl>("bumpyRot")->setTentative(LLSD(spec_rot_tentative)); + mTexRotate->setTentative(LLSD(diff_rot_tentative)); + mShinyRotate->setTentative(LLSD(spec_rot_tentative)); + mBumpyRotate->setTentative(LLSD(norm_rot_tentative)); - getChild<LLUICtrl>("TexRot")->setValue( editable ? diff_rot_deg : 0.0f); - getChild<LLUICtrl>("shinyRot")->setValue(editable ? spec_rot_deg : 0.0f); - getChild<LLUICtrl>("bumpyRot")->setValue(editable ? norm_rot_deg : 0.0f); + mTexRotate->setValue(editable ? diff_rot_deg : 0.0f); + mShinyRotate->setValue(editable ? spec_rot_deg : 0.0f); + mBumpyRotate->setValue(editable ? norm_rot_deg : 0.0f); } { F32 glow = 0.f; bool identical_glow = false; - LLSelectedTE::getGlow(glow,identical_glow); + LLSelectedTE::getGlow(glow, identical_glow); mCtrlGlow->setValue(glow); mCtrlGlow->setTentative(!identical_glow); mCtrlGlow->setEnabled(editable); - getChildView("glow label")->setEnabled(editable); + mLabelGlow->setEnabled(editable); } { @@ -1591,14 +1545,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mComboTexGen->setEnabled(editable); mComboTexGen->setTentative(!identical); - getChildView("tex gen")->setEnabled(editable); + mLabelTexGen->setEnabled(editable); } { U8 fullbright_flag = 0; bool identical_fullbright = false; - LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); + LLSelectedTE::getFullbright(fullbright_flag, identical_fullbright); mCheckFullbright->setValue((S32)(fullbright_flag != 0)); mCheckFullbright->setEnabled(editable && !has_pbr_material); @@ -1625,7 +1579,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool enabled = editable && (index != 1); bool identical_repeats = true; S32 material_selection = mComboMatMedia->getCurrentIndex(); - F32 repeats = 1.0f; + F32 repeats = 1.0f; U32 material_type = MATTYPE_DIFFUSE; if (material_selection == MATMEDIA_MATERIAL) @@ -1642,53 +1596,44 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { default: case MATTYPE_DIFFUSE: - { if (material_selection != MATMEDIA_PBR) { enabled = editable && !id.isNull(); } identical_repeats = identical_diff_repeats; repeats = repeats_diff; - } - break; - + break; case MATTYPE_SPECULAR: - { if (material_selection != MATMEDIA_PBR) { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); } identical_repeats = identical_spec_repeats; repeats = repeats_spec; - } - break; - + break; case MATTYPE_NORMAL: - { if (material_selection != MATMEDIA_PBR) { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); } identical_repeats = identical_norm_repeats; repeats = repeats_norm; - } - break; + break; } bool repeats_tentative = !identical_repeats; - LLSpinCtrl* rpt_ctrl = getChild<LLSpinCtrl>("rptctrl"); if (force_set_values) { - //onCommit, previosly edited element updates related ones - rpt_ctrl->forceSetValue(editable ? repeats : 1.0f); + // onCommit, previosly edited element updates related ones + mTexRepeat->forceSetValue(editable ? repeats : 1.0f); } else { - rpt_ctrl->setValue(editable ? repeats : 1.0f); + mTexRepeat->setValue(editable ? repeats : 1.0f); } - rpt_ctrl->setTentative(LLSD(repeats_tentative)); - rpt_ctrl->setEnabled(has_material && !identical_planar_texgen && enabled); + mTexRepeat->setTentative(LLSD(repeats_tentative)); + mTexRepeat->setEnabled(has_material && !identical_planar_texgen && enabled); } } @@ -1702,9 +1647,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL; // Alpha - LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); - if (combobox_alphamode) { U32 alpha_mode = material->getDiffuseAlphaMode(); @@ -1718,13 +1660,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; } - combobox_alphamode->selectNthItem(alpha_mode); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; + mComboAlphaMode->getSelectionInterface()->selectNthItem(alpha_mode); } - getChild<LLUICtrl>("maskcutoff")->setValue(material->getAlphaMaskCutoff()); + + mMaskCutoff->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(); identical_planar_texgen = isIdenticalPlanarTexgen(); @@ -1735,8 +1674,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) { - material->getSpecularOffset(offset_x,offset_y); - material->getSpecularRepeat(repeat_x,repeat_y); + material->getSpecularOffset(offset_x, offset_y); + material->getSpecularRepeat(repeat_x, repeat_y); if (identical_planar_texgen) { @@ -1745,13 +1684,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } rot = material->getSpecularRotation(); - getChild<LLUICtrl>("shinyScaleU")->setValue(repeat_x); - getChild<LLUICtrl>("shinyScaleV")->setValue(repeat_y); - getChild<LLUICtrl>("shinyRot")->setValue(rot*RAD_TO_DEG); - getChild<LLUICtrl>("shinyOffsetU")->setValue(offset_x); - getChild<LLUICtrl>("shinyOffsetV")->setValue(offset_y); - getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent()); - getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity()); + mShinyScaleU->setValue(repeat_x); + mShinyScaleV->setValue(repeat_y); + mShinyRotate->setValue(rot * RAD_TO_DEG); + mShinyOffsetU->setValue(offset_x); + mShinyOffsetV->setValue(offset_y); + mGlossiness->setValue(material->getSpecularLightExponent()); + mEnvironment->setValue(material->getEnvironmentIntensity()); updateShinyControls(!material->getSpecularID().isNull(), true); } @@ -1783,27 +1722,28 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } rot = material->getNormalRotation(); - getChild<LLUICtrl>("bumpyScaleU")->setValue(repeat_x); - getChild<LLUICtrl>("bumpyScaleV")->setValue(repeat_y); - getChild<LLUICtrl>("bumpyRot")->setValue(rot*RAD_TO_DEG); - getChild<LLUICtrl>("bumpyOffsetU")->setValue(offset_x); - getChild<LLUICtrl>("bumpyOffsetV")->setValue(offset_y); + mBumpyScaleU->setValue(repeat_x); + mBumpyScaleV->setValue(repeat_y); + mBumpyRotate->setValue(rot*RAD_TO_DEG); + mBumpyOffsetU->setValue(offset_x); + mBumpyOffsetV->setValue(offset_y); updateBumpyControls(!material->getNormalID().isNull(), true); } } } + S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); bool single_volume = (selected_count == 1); mMenuClipboardColor->setEnabled(editable && single_volume); // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); - calcp->setVar(LLCalc::TEX_U_SCALE, (F32)childGetValue("TexScaleU").asReal()); - calcp->setVar(LLCalc::TEX_V_SCALE, (F32)childGetValue("TexScaleV").asReal()); - calcp->setVar(LLCalc::TEX_U_OFFSET, (F32)childGetValue("TexOffsetU").asReal()); - calcp->setVar(LLCalc::TEX_V_OFFSET, (F32)childGetValue("TexOffsetV").asReal()); - calcp->setVar(LLCalc::TEX_ROTATION, (F32)childGetValue("TexRot").asReal()); + calcp->setVar(LLCalc::TEX_U_SCALE, (F32)mTexScaleU->getValue().asReal()); + calcp->setVar(LLCalc::TEX_V_SCALE, (F32)mTexScaleV->getValue().asReal()); + calcp->setVar(LLCalc::TEX_U_OFFSET, (F32)mTexOffsetU->getValue().asReal()); + calcp->setVar(LLCalc::TEX_V_OFFSET, (F32)mTexOffsetV->getValue().asReal()); + calcp->setVar(LLCalc::TEX_ROTATION, (F32)mTexRotate->getValue().asReal()); calcp->setVar(LLCalc::TEX_TRANSPARENCY, (F32)mCtrlColorTransp->getValue().asReal()); calcp->setVar(LLCalc::TEX_GLOW, (F32)mCtrlGlow->getValue().asReal()); } @@ -1838,14 +1778,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mRadioMaterialType->setSelectedIndex(0); } mLabelColorTransp->setEnabled(false); - getChildView("rptctrl")->setEnabled(false); - getChildView("tex gen")->setEnabled(false); - getChildView("label shininess")->setEnabled(false); - getChildView("label bumpiness")->setEnabled(false); - getChildView("button align")->setEnabled(false); - getChildView("pbr_from_inventory")->setEnabled(false); - getChildView("edit_selected_pbr")->setEnabled(false); - getChildView("save_selected_pbr")->setEnabled(false); + mTexRepeat->setEnabled(false); + mLabelTexGen->setEnabled(false); + mLabelShininess->setEnabled(false); + mLabelBumpiness->setEnabled(false); + mBtnAlign->setEnabled(false); + mBtnPbrFromInv->setEnabled(false); + mBtnEditBbr->setEnabled(false); + mBtnSaveBbr->setEnabled(false); updateVisibility(); @@ -1968,9 +1908,9 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, } } - getChildView("pbr_from_inventory")->setEnabled(settable); - getChildView("edit_selected_pbr")->setEnabled(editable && !has_faces_without_pbr); - getChildView("save_selected_pbr")->setEnabled(saveable && identical_pbr); + mBtnPbrFromInv->setEnabled(settable); + mBtnEditBbr->setEnabled(editable && !has_faces_without_pbr); + mBtnSaveBbr->setEnabled(saveable && identical_pbr); if (objectp->isInventoryPending()) { // Reuse the same listener when possible @@ -2000,17 +1940,11 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { const bool new_state = has_pbr_capabilities && has_pbr_material && !has_faces_without_pbr; - LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU"); - LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); - LLUICtrl* gltfCtrlTextureRotation = getChild<LLUICtrl>("gltfTextureRotation"); - LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU"); - LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV"); - - gltfCtrlTextureScaleU->setEnabled(new_state); - gltfCtrlTextureScaleV->setEnabled(new_state); - gltfCtrlTextureRotation->setEnabled(new_state); - gltfCtrlTextureOffsetU->setEnabled(new_state); - gltfCtrlTextureOffsetV->setEnabled(new_state); + mPBRScaleU->setEnabled(new_state); + mPBRScaleV->setEnabled(new_state); + mPBRRotate->setEnabled(new_state); + mPBROffsetU->setEnabled(new_state); + mPBROffsetV->setEnabled(new_state); // Control values will be set once per frame in // setMaterialOverridesFromSelection @@ -2030,16 +1964,16 @@ void LLPanelFace::updateVisibilityGLTF(LLViewerObject* objectp /*= nullptr */) mPBRTextureCtrl->setVisible(show_pbr_render_material_id); - getChildView("pbr_from_inventory")->setVisible(show_pbr_render_material_id); - getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); - getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); - getChildView("material_permissions_loading_label")->setVisible(show_pbr_render_material_id && inventory_pending); + mBtnPbrFromInv->setVisible(show_pbr_render_material_id); + mBtnEditBbr->setVisible(show_pbr_render_material_id && !inventory_pending); + mBtnSaveBbr->setVisible(show_pbr_render_material_id && !inventory_pending); + mLabelMatPermLoading->setVisible(show_pbr_render_material_id && inventory_pending); - getChildView("gltfTextureScaleU")->setVisible(show_pbr); - getChildView("gltfTextureScaleV")->setVisible(show_pbr); - getChildView("gltfTextureRotation")->setVisible(show_pbr); - getChildView("gltfTextureOffsetU")->setVisible(show_pbr); - getChildView("gltfTextureOffsetV")->setVisible(show_pbr); + mPBRScaleU->setVisible(show_pbr); + mPBRScaleV->setVisible(show_pbr); + mPBRRotate->setVisible(show_pbr); + mPBROffsetU->setVisible(show_pbr); + mPBROffsetV->setVisible(show_pbr); } void LLPanelFace::updateCopyTexButton() @@ -2069,7 +2003,7 @@ void LLPanelFace::refreshMedia() && first_object->permModify() )) { - getChildView("add_media")->setEnabled(false); + mAddMedia->setEnabled(false); mTitleMediaText->clear(); clearMediaSettings(); return; @@ -2080,7 +2014,7 @@ void LLPanelFace::refreshMedia() if (!has_media_capability) { - getChildView("add_media")->setEnabled(false); + mAddMedia->setEnabled(false); LL_WARNS("LLFloaterToolsMedia") << "Media not enabled (no capability) in this region!" << LL_ENDL; clearMediaSettings(); return; @@ -2162,7 +2096,7 @@ void LLPanelFace::refreshMedia() // update UI depending on whether "object" (prim or face) has media // and whether or not you are allowed to edit it. - getChildView("add_media")->setEnabled(editable); + mAddMedia->setEnabled(editable); // IF all the faces have media (or all dont have media) if (LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo) { @@ -2184,7 +2118,7 @@ void LLPanelFace::refreshMedia() media_title = multi_media_info_str; } - getChildView("delete_media")->setEnabled(bool_has_media && editable); + mDelMedia->setEnabled(bool_has_media && editable); // TODO: display a list of all media on the face - use 'identical' flag } else // not all face has media but at least one does. @@ -2206,7 +2140,7 @@ void LLPanelFace::refreshMedia() } } - getChildView("delete_media")->setEnabled(true); + mDelMedia->setEnabled(true); } U32 materials_media = mComboMatMedia->getCurrentIndex(); @@ -2247,7 +2181,7 @@ void LLPanelFace::onMaterialOverrideReceived(const LLUUID& object_id, S32 side) ////////////////////////////////////////////////////////////////////////////// // -void LLPanelFace::navigateToTitleMedia( const std::string url ) +void LLPanelFace::navigateToTitleMedia(const std::string& url) { std::string multi_media_info_str = LLTrans::getString("Multiple Media"); if (url.empty() || multi_media_info_str == url) @@ -2259,9 +2193,9 @@ void LLPanelFace::navigateToTitleMedia( const std::string url ) { LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin(); // check if url changed or if we need a new media source - if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == NULL) + if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == nullptr) { - mTitleMedia->navigateTo( url ); + mTitleMedia->navigateTo(url); LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mTitleMedia->getTextureID()); if (impl) @@ -2814,72 +2748,63 @@ void LLPanelFace::updateMediaTitle() }; } -// -// Static functions -// - // static F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getGlow()); } - -void LLPanelFace::onCommitColor(const LLSD& data) +void LLPanelFace::onCommitColor() { sendColor(); } -void LLPanelFace::onCommitShinyColor(const LLSD& data) +void LLPanelFace::onCommitShinyColor() { LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); } -void LLPanelFace::onCommitAlpha(const LLSD& data) +void LLPanelFace::onCommitAlpha() { sendAlpha(); } -void LLPanelFace::onCancelColor(const LLSD& data) +void LLPanelFace::onCancelColor() { LLSelectMgr::getInstance()->selectionRevertColors(); } -void LLPanelFace::onCancelShinyColor(const LLSD& data) +void LLPanelFace::onCancelShinyColor() { LLSelectMgr::getInstance()->selectionRevertShinyColors(); } -void LLPanelFace::onSelectColor(const LLSD& data) +void LLPanelFace::onSelectColor() { LLSelectMgr::getInstance()->saveSelectedObjectColors(); sendColor(); } -void LLPanelFace::onSelectShinyColor(const LLSD& data) +void LLPanelFace::onSelectShinyColor() { LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); LLSelectMgr::getInstance()->saveSelectedShinyColors(); } -// static -void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialsMedia() { - LLPanelFace* self = (LLPanelFace*) userdata; // Force to default states to side-step problems with menu contents // and generally reflecting old state when switching tabs or objects // - self->updateShinyControls(false,true); - self->updateBumpyControls(false,true); - self->updateUI(); - self->refreshMedia(); + updateShinyControls(false, true); + updateBumpyControls(false, true); + updateUI(); + refreshMedia(); } void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) { - LLComboBox* combo_shininess = findChild<LLComboBox>("combobox shininess"); - LLComboBox* combo_bumpiness = findChild<LLComboBox>("combobox bumpiness"); - if (!mRadioMaterialType || !mRadioPbrType || !mComboMatMedia || !combo_shininess || !combo_bumpiness) + if (!mRadioMaterialType || !mRadioPbrType) { LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; @@ -2892,60 +2817,59 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const LLGLTFMaterial::TextureInfo texture_info = getPBRTextureInfo(); const bool show_pbr_asset = show_pbr && texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; mRadioMaterialType->setVisible(show_material); // Shared material controls - getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); - getChildView("tex gen")->setVisible(show_material || show_media || show_pbr_asset); + mCheckSyncSettings->setVisible(show_material || show_media); + mLabelTexGen->setVisible(show_material || show_media || show_pbr_asset); mComboTexGen->setVisible(show_material || show_media || show_pbr_asset); - getChildView("button align textures")->setVisible(show_material || show_media); + mBtnAlignTex->setVisible(show_material || show_media); // Media controls mTitleMediaText->setVisible(show_media); - getChildView("add_media")->setVisible(show_media); - getChildView("delete_media")->setVisible(show_media); - getChildView("button align")->setVisible(show_media); + mAddMedia->setVisible(show_media); + mDelMedia->setVisible(show_media); + mBtnAlign->setVisible(show_media); // Diffuse texture controls mTextureCtrl->setVisible(show_texture && show_material); - getChildView("label alphamode")->setVisible(show_texture && show_material); - getChildView("combobox alphamode")->setVisible(show_texture && show_material); - getChildView("label maskcutoff")->setVisible(false); - getChildView("maskcutoff")->setVisible(false); + mLabelAlphaMode->setVisible(show_texture && show_material); + mComboAlphaMode->setVisible(show_texture && show_material); + mLabelMaskCutoff->setVisible(false); + mMaskCutoff->setVisible(false); if (show_texture && show_material) { updateAlphaControls(); } // texture scale and position controls - getChildView("TexScaleU")->setVisible(show_texture); - getChildView("TexScaleV")->setVisible(show_texture); - getChildView("TexRot")->setVisible(show_texture); - getChildView("TexOffsetU")->setVisible(show_texture); - getChildView("TexOffsetV")->setVisible(show_texture); + mTexScaleU->setVisible(show_texture); + mTexScaleV->setVisible(show_texture); + mTexRotate->setVisible(show_texture); + mTexOffsetU->setVisible(show_texture); + mTexOffsetV->setVisible(show_texture); // Specular map controls mShinyTextureCtrl->setVisible(show_shininess); - getChildView("combobox shininess")->setVisible(show_shininess); - getChildView("label shininess")->setVisible(show_shininess); - getChildView("label glossiness")->setVisible(false); - getChildView("glossiness")->setVisible(false); - getChildView("label environment")->setVisible(false); - getChildView("environment")->setVisible(false); - getChildView("label shinycolor")->setVisible(false); + mComboShininess->setVisible(show_shininess); + mLabelShininess->setVisible(show_shininess); + mLabelGlossiness->setVisible(false); + mGlossiness->setVisible(false); + mLabelEnvironment->setVisible(false); + mEnvironment->setVisible(false); + mLabelShiniColor->setVisible(false); mShinyColorSwatch->setVisible(false); if (show_shininess) { updateShinyControls(); } - getChildView("shinyScaleU")->setVisible(show_shininess); - getChildView("shinyScaleV")->setVisible(show_shininess); - getChildView("shinyRot")->setVisible(show_shininess); - getChildView("shinyOffsetU")->setVisible(show_shininess); - getChildView("shinyOffsetV")->setVisible(show_shininess); + mShinyScaleU->setVisible(show_shininess); + mShinyScaleV->setVisible(show_shininess); + mShinyRotate->setVisible(show_shininess); + mShinyOffsetU->setVisible(show_shininess); + mShinyOffsetV->setVisible(show_shininess); // Normal map controls if (show_bumpiness) @@ -2953,99 +2877,78 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) updateBumpyControls(); } mBumpyTextureCtrl->setVisible(show_bumpiness); - getChildView("combobox bumpiness")->setVisible(show_bumpiness); - getChildView("label bumpiness")->setVisible(show_bumpiness); - getChildView("bumpyScaleU")->setVisible(show_bumpiness); - getChildView("bumpyScaleV")->setVisible(show_bumpiness); - getChildView("bumpyRot")->setVisible(show_bumpiness); - getChildView("bumpyOffsetU")->setVisible(show_bumpiness); - getChildView("bumpyOffsetV")->setVisible(show_bumpiness); + mComboBumpiness->setVisible(show_bumpiness); + mLabelBumpiness->setVisible(show_bumpiness); + mBumpyScaleU->setVisible(show_bumpiness); + mBumpyScaleV->setVisible(show_bumpiness); + mBumpyRotate->setVisible(show_bumpiness); + mBumpyOffsetU->setVisible(show_bumpiness); + mBumpyOffsetV->setVisible(show_bumpiness); - getChild<LLSpinCtrl>("rptctrl")->setVisible(show_material || show_media); + mTexRepeat->setVisible(show_material || show_media); // PBR controls updateVisibilityGLTF(objectp); } -// static -void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialType() { - LLPanelFace* self = (LLPanelFace*) userdata; // Force to default states to side-step problems with menu contents // and generally reflecting old state when switching tabs or objects // - self->updateShinyControls(false,true); - self->updateBumpyControls(false,true); - self->updateUI(); + updateShinyControls(false, true); + updateBumpyControls(false, true); + updateUI(); } -// static -void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitPbrType() { - LLPanelFace* self = (LLPanelFace*)userdata; // Force to default states to side-step problems with menu contents // and generally reflecting old state when switching tabs or objects // - self->updateUI(); + updateUI(); } -// static -void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitBump() { - LLPanelFace* self = (LLPanelFace*) userdata; - - LLComboBox* mComboBumpiness = self->getChild<LLComboBox>("combobox bumpiness"); - if(!mComboBumpiness) - return; - - U32 bumpiness = mComboBumpiness->getCurrentIndex(); - - self->sendBump(bumpiness); + sendBump(mComboBumpiness->getCurrentIndex()); } -// static -void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitTexGen() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendTexGen(); + sendTexGen(); } -// static void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox) { LLUUID shiny_texture_ID = mShinyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; - LLComboBox* comboShiny = getChild<LLComboBox>("combobox shininess"); - if(mess_with_shiny_combobox) + if (mess_with_shiny_combobox) { - if (!comboShiny) - { - return; - } if (!shiny_texture_ID.isNull() && is_setting_texture) { - if (!comboShiny->itemExists(USE_TEXTURE)) + if (!mComboShininess->itemExists(USE_TEXTURE)) { - comboShiny->add(USE_TEXTURE); + mComboShininess->add(USE_TEXTURE); } - comboShiny->setSimple(USE_TEXTURE); + mComboShininess->setSimple(USE_TEXTURE); } else { - if (comboShiny->itemExists(USE_TEXTURE)) + if (mComboShininess->itemExists(USE_TEXTURE)) { - comboShiny->remove(SHINY_TEXTURE); - comboShiny->selectFirstItem(); + mComboShininess->remove(SHINY_TEXTURE); + mComboShininess->selectFirstItem(); } } } else { - if (shiny_texture_ID.isNull() && comboShiny && comboShiny->itemExists(USE_TEXTURE)) + if (shiny_texture_ID.isNull() && mComboShininess->itemExists(USE_TEXTURE)) { - comboShiny->remove(SHINY_TEXTURE); - comboShiny->selectFirstItem(); + mComboShininess->remove(SHINY_TEXTURE); + mComboShininess->selectFirstItem(); } } @@ -3053,117 +2956,79 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh U32 material_type = mRadioMaterialType->getSelectedIndex(); bool show_material = (materials_media == MATMEDIA_MATERIAL); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); - U32 shiny_value = comboShiny->getCurrentIndex(); + U32 shiny_value = mComboShininess->getCurrentIndex(); bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture - getChildView("label glossiness")->setVisible(show_shinyctrls); - getChildView("glossiness")->setVisible(show_shinyctrls); - getChildView("label environment")->setVisible(show_shinyctrls); - getChildView("environment")->setVisible(show_shinyctrls); - getChildView("label shinycolor")->setVisible(show_shinyctrls); + mLabelGlossiness->setVisible(show_shinyctrls); + mGlossiness->setVisible(show_shinyctrls); + mLabelEnvironment->setVisible(show_shinyctrls); + mEnvironment->setVisible(show_shinyctrls); + mLabelShiniColor->setVisible(show_shinyctrls); mShinyColorSwatch->setVisible(show_shinyctrls); } -// static void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox) { LLUUID bumpy_texture_ID = mBumpyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; - LLComboBox* comboBumpy = getChild<LLComboBox>("combobox bumpiness"); - if (!comboBumpy) - { - return; - } if (mess_with_combobox) { if (!bumpy_texture_ID.isNull() && is_setting_texture) { - if (!comboBumpy->itemExists(USE_TEXTURE)) + if (!mComboBumpiness->itemExists(USE_TEXTURE)) { - comboBumpy->add(USE_TEXTURE); + mComboBumpiness->add(USE_TEXTURE); } - comboBumpy->setSimple(USE_TEXTURE); + mComboBumpiness->setSimple(USE_TEXTURE); } else { - if (comboBumpy->itemExists(USE_TEXTURE)) + if (mComboBumpiness->itemExists(USE_TEXTURE)) { - comboBumpy->remove(BUMPY_TEXTURE); - comboBumpy->selectFirstItem(); + mComboBumpiness->remove(BUMPY_TEXTURE); + mComboBumpiness->selectFirstItem(); } } } } -// static -void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitShiny() { - LLPanelFace* self = (LLPanelFace*) userdata; - - - LLComboBox* mComboShininess = self->getChild<LLComboBox>("combobox shininess"); - if(!mComboShininess) - return; - - U32 shininess = mComboShininess->getCurrentIndex(); - - self->sendShiny(shininess); + sendShiny(mComboShininess->getCurrentIndex()); } -// static void LLPanelFace::updateAlphaControls() { - LLComboBox* comboAlphaMode = getChild<LLComboBox>("combobox alphamode"); - if (!comboAlphaMode) - { - return; - } - U32 alpha_value = comboAlphaMode->getCurrentIndex(); + U32 alpha_value = mComboAlphaMode->getCurrentIndex(); bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking - U32 mat_media = MATMEDIA_MATERIAL; - if (mComboMatMedia) - { - mat_media = mComboMatMedia->getCurrentIndex(); - } - - U32 mat_type = MATTYPE_DIFFUSE; - if(mRadioMaterialType) - { - mat_type = mRadioMaterialType->getSelectedIndex(); - } + U32 mat_media = mComboMatMedia->getCurrentIndex(); + U32 mat_type = mRadioMaterialType->getSelectedIndex(); show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL); show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE); - getChildView("label maskcutoff")->setVisible(show_alphactrls); - getChildView("maskcutoff")->setVisible(show_alphactrls); + mLabelMaskCutoff->setVisible(show_alphactrls); + mMaskCutoff->setVisible(show_alphactrls); } -// static -void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitAlphaMode() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->updateAlphaControls(); - LLSelectedTEMaterial::setDiffuseAlphaMode(self,self->getCurrentDiffuseAlphaMode()); + updateAlphaControls(); + LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } -// static -void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitFullbright() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendFullbright(); + sendFullbright(); } -// static -void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitGlow() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendGlow(); + sendGlow(); } -// static -bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragPbr(LLInventoryItem* item) { bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); @@ -3180,9 +3045,8 @@ bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) return accept; } -void LLPanelFace::onCommitPbr(const LLSD& data) +void LLPanelFace::onCommitPbr() { - if (!mPBRTextureCtrl) return; if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a @@ -3200,16 +3064,15 @@ void LLPanelFace::onCommitPbr(const LLSD& data) } } -void LLPanelFace::onCancelPbr(const LLSD& data) +void LLPanelFace::onCancelPbr() { LLSelectMgr::getInstance()->selectionRevertGLTFMaterials(); } -void LLPanelFace::onSelectPbr(const LLSD& data) +void LLPanelFace::onSelectPbr() { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); - if (!mPBRTextureCtrl) return; if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a @@ -3226,8 +3089,7 @@ void LLPanelFace::onSelectPbr(const LLSD& data) } } -// static -bool LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragTexture(LLInventoryItem* item) { bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); @@ -3244,18 +3106,18 @@ bool LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) return accept; } -void LLPanelFace::onCommitTexture( const LLSD& data ) +void LLPanelFace::onCommitTexture() { add(LLStatViewer::EDIT_TEXTURE, 1); sendTexture(); } -void LLPanelFace::onCancelTexture(const LLSD& data) +void LLPanelFace::onCancelTexture() { LLSelectMgr::getInstance()->selectionRevertTextures(); } -void LLPanelFace::onSelectTexture(const LLSD& data) +void LLPanelFace::onSelectTexture() { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); sendTexture(); @@ -3265,31 +3127,25 @@ void LLPanelFace::onSelectTexture(const LLSD& data) bool missing_asset = false; LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); - LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); - U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - if (combobox_alphamode && !missing_asset) + if (!missing_asset) { switch (image_format) { case GL_RGBA: case GL_ALPHA: - { - alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; - } + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + break; + case GL_RGB: break; - - case GL_RGB: break; default: - { - LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; - } + LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; break; } - combobox_alphamode->selectNthItem(alpha_mode); + mComboAlphaMode->getSelectionInterface()->selectNthItem(alpha_mode); } + LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } @@ -3299,13 +3155,13 @@ void LLPanelFace::onCloseTexturePicker(const LLSD& data) updateUI(); } -void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) +void LLPanelFace::onCommitSpecularTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; sendShiny(SHINY_TEXTURE); } -void LLPanelFace::onCommitNormalTexture( const LLSD& data ) +void LLPanelFace::onCommitNormalTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; LLUUID nmap_id = getCurrentNormalMap(); @@ -3348,34 +3204,32 @@ void LLPanelFace::onSelectNormalTexture(const LLSD& data) ////////////////////////////////////////////////////////////////////////////// // called when a user wants to edit existing media settings on a prim or prim face // TODO: test if there is media on the item and only allow editing if present -void LLPanelFace::onClickBtnEditMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onClickBtnEditMedia() { - LLPanelFace* self = (LLPanelFace*)userdata; - self->refreshMedia(); + refreshMedia(); LLFloaterReg::showInstance("media_settings"); } ////////////////////////////////////////////////////////////////////////////// // called when a user wants to delete media from a prim or prim face -void LLPanelFace::onClickBtnDeleteMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onClickBtnDeleteMedia() { LLNotificationsUtil::add("DeleteMedia", LLSD(), LLSD(), deleteMediaConfirm); } ////////////////////////////////////////////////////////////////////////////// // called when a user wants to add media to a prim or prim face -void LLPanelFace::onClickBtnAddMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onClickBtnAddMedia() { // check if multiple faces are selected if (LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected()) { - LLPanelFace* self = (LLPanelFace*)userdata; - self->refreshMedia(); + refreshMedia(); LLNotificationsUtil::add("MultipleFacesSelected", LLSD(), LLSD(), multipleFacesSelectedConfirm); } else { - onClickBtnEditMedia(ctrl, userdata); + onClickBtnEditMedia(); } } @@ -3416,396 +3270,316 @@ bool LLPanelFace::multipleFacesSelectedConfirm(const LLSD& notification, const L return false; } -//static -void LLPanelFace::syncOffsetX(LLPanelFace* self, F32 offsetU) +void LLPanelFace::syncOffsetX(F32 offsetU) { - LLSelectedTEMaterial::setNormalOffsetX(self,offsetU); - LLSelectedTEMaterial::setSpecularOffsetX(self,offsetU); - self->getChild<LLSpinCtrl>("TexOffsetU")->forceSetValue(offsetU); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalOffsetX(this, offsetU); + LLSelectedTEMaterial::setSpecularOffsetX(this, offsetU); + mTexOffsetU->forceSetValue(LLSD(offsetU)); + sendTextureInfo(); } -//static -void LLPanelFace::syncOffsetY(LLPanelFace* self, F32 offsetV) +void LLPanelFace::syncOffsetY(F32 offsetV) { - LLSelectedTEMaterial::setNormalOffsetY(self,offsetV); - LLSelectedTEMaterial::setSpecularOffsetY(self,offsetV); - self->getChild<LLSpinCtrl>("TexOffsetV")->forceSetValue(offsetV); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalOffsetY(this, offsetV); + LLSelectedTEMaterial::setSpecularOffsetY(this, offsetV); + mTexOffsetV->forceSetValue(LLSD(offsetV)); + sendTextureInfo(); } -//static -void LLPanelFace::onCommitMaterialBumpyOffsetX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyOffsetX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX(self,self->getCurrentBumpyOffsetU()); + syncOffsetX(getCurrentBumpyOffsetU()); } else { - LLSelectedTEMaterial::setNormalOffsetX(self,self->getCurrentBumpyOffsetU()); + LLSelectedTEMaterial::setNormalOffsetX(this, getCurrentBumpyOffsetU()); } - } -//static -void LLPanelFace::onCommitMaterialBumpyOffsetY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyOffsetY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY(self,self->getCurrentBumpyOffsetV()); + syncOffsetY(getCurrentBumpyOffsetV()); } else { - LLSelectedTEMaterial::setNormalOffsetY(self,self->getCurrentBumpyOffsetV()); + LLSelectedTEMaterial::setNormalOffsetY(this, getCurrentBumpyOffsetV()); } } -//static -void LLPanelFace::onCommitMaterialShinyOffsetX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyOffsetX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX(self, self->getCurrentShinyOffsetU()); + syncOffsetX(getCurrentShinyOffsetU()); } else { - LLSelectedTEMaterial::setSpecularOffsetX(self,self->getCurrentShinyOffsetU()); + LLSelectedTEMaterial::setSpecularOffsetX(this, getCurrentShinyOffsetU()); } } -//static -void LLPanelFace::onCommitMaterialShinyOffsetY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyOffsetY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY(self,self->getCurrentShinyOffsetV()); + syncOffsetY(getCurrentShinyOffsetV()); } else { - LLSelectedTEMaterial::setSpecularOffsetY(self,self->getCurrentShinyOffsetV()); + LLSelectedTEMaterial::setSpecularOffsetY(this, getCurrentShinyOffsetV()); } } -//static -void LLPanelFace::syncRepeatX(LLPanelFace* self, F32 scaleU) +void LLPanelFace::syncRepeatX(F32 scaleU) { - LLSelectedTEMaterial::setNormalRepeatX(self,scaleU); - LLSelectedTEMaterial::setSpecularRepeatX(self,scaleU); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalRepeatX(this, scaleU); + LLSelectedTEMaterial::setSpecularRepeatX(this, scaleU); + sendTextureInfo(); } -//static -void LLPanelFace::syncRepeatY(LLPanelFace* self, F32 scaleV) +void LLPanelFace::syncRepeatY(F32 scaleV) { - LLSelectedTEMaterial::setNormalRepeatY(self,scaleV); - LLSelectedTEMaterial::setSpecularRepeatY(self,scaleV); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalRepeatY(this, scaleV); + LLSelectedTEMaterial::setSpecularRepeatY(this, scaleV); + sendTextureInfo(); } -//static -void LLPanelFace::onCommitMaterialBumpyScaleX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyScaleX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 bumpy_scale_u = self->getCurrentBumpyScaleU(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_u = getCurrentBumpyScaleU(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_u *= 0.5f; } if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild<LLSpinCtrl>("TexScaleU")->forceSetValue(self->getCurrentBumpyScaleU()); - syncRepeatX(self, bumpy_scale_u); + mTexScaleU->forceSetValue(LLSD(getCurrentBumpyScaleU())); + syncRepeatX(bumpy_scale_u); } else { - LLSelectedTEMaterial::setNormalRepeatX(self,bumpy_scale_u); + LLSelectedTEMaterial::setNormalRepeatX(this, bumpy_scale_u); } } -//static -void LLPanelFace::onCommitMaterialBumpyScaleY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyScaleY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 bumpy_scale_v = self->getCurrentBumpyScaleV(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_v = getCurrentBumpyScaleV(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_v *= 0.5f; } - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(self->getCurrentBumpyScaleV()); - syncRepeatY(self, bumpy_scale_v); + mTexScaleV->forceSetValue(LLSD(getCurrentBumpyScaleV())); + syncRepeatY(bumpy_scale_v); } else { - LLSelectedTEMaterial::setNormalRepeatY(self,bumpy_scale_v); + LLSelectedTEMaterial::setNormalRepeatY(this, bumpy_scale_v); } } -//static -void LLPanelFace::onCommitMaterialShinyScaleX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyScaleX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 shiny_scale_u = self->getCurrentShinyScaleU(); - if (self->isIdenticalPlanarTexgen()) + F32 shiny_scale_u = getCurrentShinyScaleU(); + if (isIdenticalPlanarTexgen()) { shiny_scale_u *= 0.5f; } if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild<LLSpinCtrl>("TexScaleU")->forceSetValue(self->getCurrentShinyScaleU()); - syncRepeatX(self, shiny_scale_u); + mTexScaleU->forceSetValue(LLSD(getCurrentShinyScaleU())); + syncRepeatX(shiny_scale_u); } else { - LLSelectedTEMaterial::setSpecularRepeatX(self,shiny_scale_u); + LLSelectedTEMaterial::setSpecularRepeatX(this, shiny_scale_u); } } -//static -void LLPanelFace::onCommitMaterialShinyScaleY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyScaleY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 shiny_scale_v = self->getCurrentShinyScaleV(); - if (self->isIdenticalPlanarTexgen()) + F32 shiny_scale_v = getCurrentShinyScaleV(); + if (isIdenticalPlanarTexgen()) { shiny_scale_v *= 0.5f; } if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(self->getCurrentShinyScaleV()); - syncRepeatY(self, shiny_scale_v); + mTexScaleV->forceSetValue(LLSD(getCurrentShinyScaleV())); + syncRepeatY(shiny_scale_v); } else { - LLSelectedTEMaterial::setSpecularRepeatY(self,shiny_scale_v); + LLSelectedTEMaterial::setSpecularRepeatY(this, shiny_scale_v); } } -//static -void LLPanelFace::syncMaterialRot(LLPanelFace* self, F32 rot, int te) +void LLPanelFace::syncMaterialRot(F32 rot, int te) { - LLSelectedTEMaterial::setNormalRotation(self,rot * DEG_TO_RAD, te); - LLSelectedTEMaterial::setSpecularRotation(self,rot * DEG_TO_RAD, te); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalRotation(this, rot * DEG_TO_RAD, te); + LLSelectedTEMaterial::setSpecularRotation(this, rot * DEG_TO_RAD, te); + sendTextureInfo(); } -//static -void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyRot() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild<LLSpinCtrl>("TexRot")->forceSetValue(self->getCurrentBumpyRot()); - syncMaterialRot(self, self->getCurrentBumpyRot()); + mTexRotate->forceSetValue(LLSD(getCurrentBumpyRot())); + syncMaterialRot(getCurrentBumpyRot()); } else { - if ((bool)self->childGetValue("checkbox planar align").asBoolean()) + if (mPlanarAlign->getValue().asBoolean()) { LLFace* last_face = NULL; bool identical_face = false; LLSelectedTE::getFace(last_face, identical_face); - LLPanelFaceSetAlignedTEFunctor setfunc(self, last_face); + LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); } else { - LLSelectedTEMaterial::setNormalRotation(self, self->getCurrentBumpyRot() * DEG_TO_RAD); + LLSelectedTEMaterial::setNormalRotation(this, getCurrentBumpyRot() * DEG_TO_RAD); } } } -//static -void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyRot() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild<LLSpinCtrl>("TexRot")->forceSetValue(self->getCurrentShinyRot()); - syncMaterialRot(self, self->getCurrentShinyRot()); + mTexRotate->forceSetValue(LLSD(getCurrentShinyRot())); + syncMaterialRot(getCurrentShinyRot()); } else { - if ((bool)self->childGetValue("checkbox planar align").asBoolean()) + if (mPlanarAlign->getValue().asBoolean()) { LLFace* last_face = NULL; bool identical_face = false; LLSelectedTE::getFace(last_face, identical_face); - LLPanelFaceSetAlignedTEFunctor setfunc(self, last_face); + LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); } else { - LLSelectedTEMaterial::setSpecularRotation(self, self->getCurrentShinyRot() * DEG_TO_RAD); + LLSelectedTEMaterial::setSpecularRotation(this, getCurrentShinyRot() * DEG_TO_RAD); } } } -//static -void LLPanelFace::onCommitMaterialGloss(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialGloss() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setSpecularLightExponent(self,self->getCurrentGlossiness()); + LLSelectedTEMaterial::setSpecularLightExponent(this, getCurrentGlossiness()); } -//static -void LLPanelFace::onCommitMaterialEnv(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialEnv() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setEnvironmentIntensity(self,self->getCurrentEnvIntensity()); + LLSelectedTEMaterial::setEnvironmentIntensity(this, getCurrentEnvIntensity()); } -//static -void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialMaskCutoff() { - LLPanelFace* self = (LLPanelFace*) userdata; - LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff()); + LLSelectedTEMaterial::setAlphaMaskCutoff(this, getCurrentAlphaMaskCutoff()); } -// static -void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureInfo() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendTextureInfo(); + sendTextureInfo(); // vertical scale and repeats per meter depends on each other, so force set on changes - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureScaleX( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureScaleX() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_u = (F32)self->getChild<LLUICtrl>("TexScaleU")->getValue().asReal(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_u = (F32)mTexScaleU->getValue().asReal(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_u *= 0.5f; } - syncRepeatX(self, bumpy_scale_u); + syncRepeatX(bumpy_scale_u); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureScaleY( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureScaleY() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_v = (F32)self->getChild<LLUICtrl>("TexScaleV")->getValue().asReal(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_v = (F32)mTexScaleV->getValue().asReal(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_v *= 0.5f; } - syncRepeatY(self, bumpy_scale_v); + syncRepeatY(bumpy_scale_v); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureRot( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureRot() { - LLPanelFace* self = (LLPanelFace*) userdata; - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncMaterialRot(self, (F32)self->getChild<LLUICtrl>("TexRot")->getValue().asReal()); + syncMaterialRot((F32)mTexRotate->getValue().asReal()); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureOffsetX( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureOffsetX() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX(self, (F32)self->getChild<LLUICtrl>("TexOffsetU")->getValue().asReal()); + syncOffsetX((F32)mTexOffsetU->getValue().asReal()); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureOffsetY( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureOffsetY() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY(self, (F32)self->getChild<LLUICtrl>("TexOffsetV")->getValue().asReal()); + syncOffsetY((F32)mTexOffsetV->getValue().asReal()); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } // Commit the number of repeats per meter -// static -void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitRepeatsPerMeter() { - LLPanelFace *self = (LLPanelFace *) userdata; - - LLUICtrl *repeats_ctrl = self->getChild<LLUICtrl>("rptctrl"); - - U32 materials_media = self->mComboMatMedia->getCurrentIndex(); - U32 material_type = 0; - if (materials_media == MATMEDIA_PBR) - { - material_type = self->mRadioPbrType->getSelectedIndex(); - } - if (materials_media == MATMEDIA_MATERIAL) - { - material_type = self->mRadioMaterialType->getSelectedIndex(); - } - - F32 repeats_per_meter = (F32) repeats_ctrl->getValue().asReal(); + F32 repeats_per_meter = (F32)mTexRepeat->getValue().asReal(); F32 obj_scale_s = 1.0f; F32 obj_scale_t = 1.0f; @@ -3816,64 +3590,51 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) LLSelectedTE::getObjectScaleS(obj_scale_s, identical_scale_s); LLSelectedTE::getObjectScaleS(obj_scale_t, identical_scale_t); - LLUICtrl *bumpy_scale_u = self->getChild<LLUICtrl>("bumpyScaleU"); - LLUICtrl *bumpy_scale_v = self->getChild<LLUICtrl>("bumpyScaleV"); - LLUICtrl *shiny_scale_u = self->getChild<LLUICtrl>("shinyScaleU"); - LLUICtrl *shiny_scale_v = self->getChild<LLUICtrl>("shinyScaleV"); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); + LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); - bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); - bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); + mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); + mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); - shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); - shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); + mShinyScaleU->setValue(obj_scale_s * repeats_per_meter); + mShinyScaleV->setValue(obj_scale_t * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); } else { + U32 material_type = mRadioMaterialType->getSelectedIndex(); switch (material_type) { - case MATTYPE_DIFFUSE: - { - LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); - } + case MATTYPE_DIFFUSE: + LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); break; + case MATTYPE_NORMAL: + mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); + mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); - case MATTYPE_NORMAL: - { - bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); - bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter); - } + LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); break; + case MATTYPE_SPECULAR: + mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); + mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); - case MATTYPE_SPECULAR: - { - shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); - shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter); - } + LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); + break; + default: + llassert(false); break; - - default: - llassert(false); - break; } } // vertical scale and repeats per meter depends on each other, so force set on changes - self->updateUI(true); + updateUI(true); } struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor @@ -3883,22 +3644,20 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor viewer_media_t pMediaImpl; const LLTextureEntry* tep = object->getTE(te); - const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL; - if ( mep ) + if (const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL) { pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID()); } - if ( pMediaImpl.isNull()) + if (pMediaImpl.isNull()) { // If we didn't find face media for this face, check whether this face is showing parcel media. pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(tep->getID()); } - if ( pMediaImpl.notNull()) + if (pMediaImpl.notNull()) { - LLPluginClassMedia *media = pMediaImpl->getMediaPlugin(); - if(media) + if (LLPluginClassMedia* media = pMediaImpl->getMediaPlugin()) { S32 media_width = media->getWidth(); S32 media_height = media->getHeight(); @@ -3908,17 +3667,17 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor F32 scale_t = (F32)media_height / (F32)texture_height; // set scale and adjust offset - object->setTEScaleS( te, scale_s ); - object->setTEScaleT( te, scale_t ); // don't need to flip Y anymore since QT does this for us now. - object->setTEOffsetS( te, -( 1.0f - scale_s ) / 2.0f ); - object->setTEOffsetT( te, -( 1.0f - scale_t ) / 2.0f ); + object->setTEScaleS(te, scale_s); + object->setTEScaleT(te, scale_t); // don't need to flip Y anymore since QT does this for us now. + object->setTEOffsetS(te, -( 1.0f - scale_s ) / 2.0f); + object->setTEOffsetT(te, -( 1.0f - scale_t ) / 2.0f); } } return true; }; }; -void LLPanelFace::onClickAutoFix(void* userdata) +void LLPanelFace::onClickAutoFix() { LLPanelFaceSetMediaFunctor setfunc; LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); @@ -3927,25 +3686,23 @@ void LLPanelFace::onClickAutoFix(void* userdata) LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } -void LLPanelFace::onAlignTexture(void* userdata) +void LLPanelFace::onAlignTexture() { - LLPanelFace* self = (LLPanelFace*)userdata; - self->alignTextureLayer(); + alignTextureLayer(); } -void LLPanelFace::onClickBtnLoadInvPBR(void* userdata) +void LLPanelFace::onClickBtnLoadInvPBR() { // Shouldn't this be "save to inventory?" - LLPanelFace* self = (LLPanelFace*)userdata; - self->mPBRTextureCtrl->showPicker(true); + mPBRTextureCtrl->showPicker(true); } -void LLPanelFace::onClickBtnEditPBR(void* userdata) +void LLPanelFace::onClickBtnEditPBR() { LLMaterialEditor::loadLive(); } -void LLPanelFace::onClickBtnSavePBR(void* userdata) +void LLPanelFace::onClickBtnSavePBR() { LLMaterialEditor::saveObjectsMaterialAs(); } @@ -4806,44 +4563,39 @@ bool LLPanelFace::menuEnableItem(const LLSD& userdata) return false; } - -// static -void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitPlanarAlign() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->getState(); - self->sendTextureInfo(); + getState(); + sendTextureInfo(); } -void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LLGLTFMaterial::TextureTransform*)> edit) +void LLPanelFace::updateGLTFTextureTransform(std::function<void(LLGLTFMaterial::TextureTransform*)> edit) { - U32 texture_info_start; - U32 texture_info_end; - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const LLGLTFMaterial::TextureInfo texture_info = getPBRTextureInfo(); if (texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) { - texture_info_start = 0; - texture_info_end = LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) + { + for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i) + { + LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[(LLGLTFMaterial::TextureInfo)i]; + edit(&new_transform); + } + }); } else { - texture_info_start = texture_info_from_pbrtype(pbr_type); - texture_info_end = texture_info_start + 1; + updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) + { + LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[texture_info]; + edit(&new_transform); + }); } - updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) - { - for (U32 ti = texture_info_start; ti < texture_info_end; ++ti) - { - LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[(LLGLTFMaterial::TextureInfo)ti]; - edit(&new_transform); - } - }); } void LLPanelFace::setMaterialOverridesFromSelection() { - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const LLGLTFMaterial::TextureInfo texture_info = getPBRTextureInfo(); U32 texture_info_start; U32 texture_info_end; if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) @@ -4916,23 +4668,17 @@ void LLPanelFace::setMaterialOverridesFromSelection() } } - LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU"); - LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); - LLUICtrl* gltfCtrlTextureRotation = getChild<LLUICtrl>("gltfTextureRotation"); - LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU"); - LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV"); + mPBRScaleU->setValue(transform.mScale[VX]); + mPBRScaleV->setValue(transform.mScale[VY]); + mPBRRotate->setValue(transform.mRotation * RAD_TO_DEG); + mPBROffsetU->setValue(transform.mOffset[VX]); + mPBROffsetV->setValue(transform.mOffset[VY]); - gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); - gltfCtrlTextureScaleV->setValue(transform.mScale[VY]); - gltfCtrlTextureRotation->setValue(transform.mRotation * RAD_TO_DEG); - gltfCtrlTextureOffsetU->setValue(transform.mOffset[VX]); - gltfCtrlTextureOffsetV->setValue(transform.mOffset[VY]); - - gltfCtrlTextureScaleU->setTentative(!scale_u_same); - gltfCtrlTextureScaleV->setTentative(!scale_v_same); - gltfCtrlTextureRotation->setTentative(!rotation_same); - gltfCtrlTextureOffsetU->setTentative(!offset_u_same); - gltfCtrlTextureOffsetV->setTentative(!offset_v_same); + mPBRScaleU->setTentative(!scale_u_same); + mPBRScaleV->setTentative(!scale_v_same); + mPBRRotate->setTentative(!rotation_same); + mPBROffsetU->setTentative(!offset_u_same); + mPBROffsetV->setTentative(!offset_v_same); } void LLPanelFace::Selection::connect() @@ -5009,51 +4755,46 @@ bool LLPanelFace::Selection::compareSelection() return selection_changed; } -void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureScaleU() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)mPBRScaleU->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VX] = value; }); } -void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureScaleV() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)mPBRScaleV->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VY] = value; }); } -void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFRotation() { - const float value = (F32)ctrl->getValue().asReal() * DEG_TO_RAD; - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)mPBRRotate->getValue().asReal() * DEG_TO_RAD; + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mRotation = value; }); } -void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureOffsetU() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)mPBROffsetU->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VX] = value; }); } -void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureOffsetV() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)mPBROffsetV->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VY] = value; }); @@ -5063,47 +4804,44 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; + LLTextureCtrl* texture_ctrl; U32 mattype = mRadioMaterialType->getSelectedIndex(); - std::string which_control="texture control"; switch (mattype) { case MATTYPE_SPECULAR: - which_control = "shinytexture control"; + texture_ctrl = mShinyTextureCtrl; break; case MATTYPE_NORMAL: - which_control = "bumpytexture control"; + texture_ctrl = mBumpyTextureCtrl; break; - // no default needed + default: + texture_ctrl = mTextureCtrl; } - LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL; - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(which_control); - if (texture_ctrl) - { - LLUUID obj_owner_id; - std::string obj_owner_name; - LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name); - LLSaleInfo sale_info; - LLSelectMgr::instance().selectGetSaleInfo(sale_info); + LLUUID obj_owner_id; + std::string obj_owner_name; + LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name); - bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? - bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? - bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? - bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale? + LLSaleInfo sale_info; + LLSelectMgr::instance().selectGetSaleInfo(sale_info); - if (can_copy && can_transfer) - { - texture_ctrl->setCanApply(true, true); - return; - } + bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? + bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? + bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? + bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale? - // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale - texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); + if (can_copy && can_transfer) + { + texture_ctrl->setCanApply(true, true); + return; + } - if (gSavedSettings.getBOOL("TextureLivePreview")) - { - LLNotificationsUtil::add("LivePreviewUnavailable"); - } + // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale + texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); + + if (gSavedSettings.getBOOL("TextureLivePreview")) + { + LLNotificationsUtil::add("LivePreviewUnavailable"); } } diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 5468c369cb..4d2ce208b4 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -125,59 +125,62 @@ public: return new_material; } + LLGLTFMaterial::TextureInfo getPBRTextureInfo(); LLRender::eTexIndex getTextureChannelToEdit(); + LLRender::eTexIndex getMatTextureChannel(); + LLRender::eTexIndex getPBRTextureChannel(); LLRender::eTexIndex getTextureDropChannel(); LLGLTFMaterial::TextureInfo getPBRDropChannel(); protected: - void navigateToTitleMedia(const std::string url); - bool selectedMediaEditable(); - void clearMediaSettings(); - void updateMediaSettings(); - void updateMediaTitle(); - - void getState(); - - void sendTexture(); // applies and sends texture - void sendTextureInfo(); // applies and sends texture scale, offset, etc. - void sendColor(); // applies and sends color - void sendAlpha(); // applies and sends transparency - void sendBump(U32 bumpiness); // applies and sends bump map - void sendTexGen(); // applies and sends bump map - void sendShiny(U32 shininess); // applies and sends shininess - void sendFullbright(); // applies and sends full bright - - void sendGlow(); - void alignTextureLayer(); - - void updateCopyTexButton(); - - void onCommitPbr(const LLSD& data); - void onCancelPbr(const LLSD& data); - void onSelectPbr(const LLSD& data); - static bool onDragPbr(LLUICtrl* ctrl, LLInventoryItem* item); - - // this function is to return true if the drag should succeed. - static bool onDragTexture(LLUICtrl* ctrl, LLInventoryItem* item); - - void onCommitTexture(const LLSD& data); - void onCancelTexture(const LLSD& data); - void onSelectTexture(const LLSD& data); - void onCommitSpecularTexture(const LLSD& data); - void onCancelSpecularTexture(const LLSD& data); - void onSelectSpecularTexture(const LLSD& data); - void onCommitNormalTexture(const LLSD& data); - void onCancelNormalTexture(const LLSD& data); - void onSelectNormalTexture(const LLSD& data); - void onCommitColor(const LLSD& data); - void onCommitShinyColor(const LLSD& data); - void onCommitAlpha(const LLSD& data); - void onCancelColor(const LLSD& data); - void onCancelShinyColor(const LLSD& data); - void onSelectColor(const LLSD& data); - void onSelectShinyColor(const LLSD& data); - - void onCloseTexturePicker(const LLSD& data); + void navigateToTitleMedia(const std::string& url); + bool selectedMediaEditable(); + void clearMediaSettings(); + void updateMediaSettings(); + void updateMediaTitle(); + + void getState(); + + void sendTexture(); // applies and sends texture + void sendTextureInfo(); // applies and sends texture scale, offset, etc. + void sendColor(); // applies and sends color + void sendAlpha(); // applies and sends transparency + void sendBump(U32 bumpiness); // applies and sends bump map + void sendTexGen(); // applies and sends bump map + void sendShiny(U32 shininess); // applies and sends shininess + void sendFullbright(); // applies and sends full bright + + void sendGlow(); + void alignTextureLayer(); + + void updateCopyTexButton(); + + void onCommitPbr(); + void onCancelPbr(); + void onSelectPbr(); + + // These functions are to return true if the drag should succeed + bool onDragPbr(LLInventoryItem* item); + bool onDragTexture(LLInventoryItem* item); + + void onCommitTexture(); + void onCancelTexture(); + void onSelectTexture(); + void onCommitSpecularTexture(const LLSD& data); + void onCancelSpecularTexture(const LLSD& data); + void onSelectSpecularTexture(const LLSD& data); + void onCommitNormalTexture(const LLSD& data); + void onCancelNormalTexture(const LLSD& data); + void onSelectNormalTexture(const LLSD& data); + void onCommitColor(); + void onCommitShinyColor(); + void onCommitAlpha(); + void onCancelColor(); + void onCancelShinyColor(); + void onSelectColor(); + void onSelectShinyColor(); + + void onCloseTexturePicker(const LLSD& data); static bool deleteMediaConfirm(const LLSD& notification, const LLSD& response); static bool multipleFacesSelectedConfirm(const LLSD& notification, const LLSD& response); @@ -195,81 +198,78 @@ protected: // Callback funcs for individual controls // - static void onCommitTextureInfo(LLUICtrl* ctrl, void* userdata); - static void onCommitTextureScaleX(LLUICtrl* ctrl, void* userdata); - static void onCommitTextureScaleY(LLUICtrl* ctrl, void* userdata); - static void onCommitTextureRot(LLUICtrl* ctrl, void* userdata); - static void onCommitTextureOffsetX(LLUICtrl* ctrl, void* userdata); - static void onCommitTextureOffsetY(LLUICtrl* ctrl, void* userdata); - - static void onCommitMaterialBumpyScaleX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyScaleY( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyRot( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyOffsetX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyOffsetY( LLUICtrl* ctrl, void* userdata); - - static void syncRepeatX(LLPanelFace* self, F32 scaleU); - static void syncRepeatY(LLPanelFace* self, F32 scaleV); - static void syncOffsetX(LLPanelFace* self, F32 offsetU); - static void syncOffsetY(LLPanelFace* self, F32 offsetV); - static void syncMaterialRot(LLPanelFace* self, F32 rot, int te = -1); - - static void onCommitMaterialShinyScaleX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyScaleY( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyRot( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyOffsetX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyOffsetY( LLUICtrl* ctrl, void* userdata); - - static void onCommitMaterialGloss( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialEnv( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialMaskCutoff( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialID( LLUICtrl* ctrl, void* userdata); - - static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); - static void onCommitPbrType(LLUICtrl* ctrl, void* userdata); - static void onClickBtnEditMedia(LLUICtrl* ctrl, void* userdata); - static void onClickBtnDeleteMedia(LLUICtrl* ctrl, void* userdata); - static void onClickBtnAddMedia(LLUICtrl* ctrl, void* userdata); - static void onCommitBump( LLUICtrl* ctrl, void* userdata); - static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); - static void onCommitShiny( LLUICtrl* ctrl, void* userdata); - static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); - static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); - static void onCommitGlow( LLUICtrl* ctrl, void *userdata); - static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); - static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo); - - void onCommitGLTFTextureScaleU(LLUICtrl* ctrl); - void onCommitGLTFTextureScaleV(LLUICtrl* ctrl); - void onCommitGLTFRotation(LLUICtrl* ctrl); - void onCommitGLTFTextureOffsetU(LLUICtrl* ctrl); - void onCommitGLTFTextureOffsetV(LLUICtrl* ctrl); - - static void onClickAutoFix(void*); - static void onAlignTexture(void*); - static void onClickBtnLoadInvPBR(void* userdata); - static void onClickBtnEditPBR(void* userdata); - static void onClickBtnSavePBR(void* userdata); + void onCommitTextureInfo(); + void onCommitTextureScaleX(); + void onCommitTextureScaleY(); + void onCommitTextureRot(); + void onCommitTextureOffsetX(); + void onCommitTextureOffsetY(); + + void onCommitMaterialBumpyScaleX(); + void onCommitMaterialBumpyScaleY(); + void onCommitMaterialBumpyRot(); + void onCommitMaterialBumpyOffsetX(); + void onCommitMaterialBumpyOffsetY(); + + void syncRepeatX(F32 scaleU); + void syncRepeatY(F32 scaleV); + void syncOffsetX(F32 offsetU); + void syncOffsetY(F32 offsetV); + void syncMaterialRot(F32 rot, int te = -1); + + void onCommitMaterialShinyScaleX(); + void onCommitMaterialShinyScaleY(); + void onCommitMaterialShinyRot(); + void onCommitMaterialShinyOffsetX(); + void onCommitMaterialShinyOffsetY(); + + void onCommitMaterialGloss(); + void onCommitMaterialEnv(); + void onCommitMaterialMaskCutoff(); + + void onCommitMaterialsMedia(); + void onCommitMaterialType(); + void onCommitPbrType(); + void onClickBtnEditMedia(); + void onClickBtnDeleteMedia(); + void onClickBtnAddMedia(); + void onCommitBump(); + void onCommitTexGen(); + void onCommitShiny(); + void onCommitAlphaMode(); + void onCommitFullbright(); + void onCommitGlow(); + void onCommitPlanarAlign(); + void onCommitRepeatsPerMeter(); + + void onCommitGLTFTextureScaleU(); + void onCommitGLTFTextureScaleV(); + void onCommitGLTFRotation(); + void onCommitGLTFTextureOffsetU(); + void onCommitGLTFTextureOffsetV(); + + void onClickAutoFix(); + void onAlignTexture(); + void onClickBtnLoadInvPBR(); + void onClickBtnEditPBR(); + void onClickBtnSavePBR(); public: // needs to be accessible to selection manager - void onCopyColor(); // records all selected faces - void onPasteColor(); // to specific face - void onPasteColor(LLViewerObject* objectp, S32 te); // to specific face - void onCopyTexture(); - void onPasteTexture(); - void onPasteTexture(LLViewerObject* objectp, S32 te); + void onCopyColor(); // records all selected faces + void onPasteColor(); // to specific face + void onPasteColor(LLViewerObject* objectp, S32 te); // to specific face + void onCopyTexture(); + void onPasteTexture(); + void onPasteTexture(LLViewerObject* objectp, S32 te); protected: - void menuDoToSelected(const LLSD& userdata); - bool menuEnableItem(const LLSD& userdata); - - static F32 valueGlow(LLViewerObject* object, S32 face); - + void menuDoToSelected(const LLSD& userdata); + bool menuEnableItem(const LLSD& userdata); + static F32 valueGlow(LLViewerObject* object, S32 face); private: - bool isAlpha() { return mIsAlpha; } + bool isAlpha() const { return mIsAlpha; } // Convenience funcs to keep the visual flack to a minimum // @@ -292,27 +292,77 @@ private: F32 getCurrentShinyOffsetU(); F32 getCurrentShinyOffsetV(); - LLTextureCtrl* mPBRTextureCtrl = nullptr; - LLTextureCtrl* mTextureCtrl = nullptr; - LLTextureCtrl* mShinyTextureCtrl = nullptr; - LLTextureCtrl* mBumpyTextureCtrl = nullptr; - LLColorSwatchCtrl* mColorSwatch = nullptr; - LLColorSwatchCtrl* mShinyColorSwatch = nullptr; - - LLComboBox* mComboTexGen = nullptr; - - LLRadioGroup* mRadioMaterialType = nullptr; - LLRadioGroup* mRadioPbrType = nullptr; - - LLCheckBoxCtrl* mCheckFullbright = nullptr; - - LLTextBox* mLabelColorTransp = nullptr; - LLSpinCtrl* mCtrlColorTransp = nullptr; // transparency = 1 - alpha - - LLSpinCtrl* mCtrlGlow = nullptr; - LLComboBox *mComboMatMedia = nullptr; - LLMediaCtrl *mTitleMedia = nullptr; - LLTextBox *mTitleMediaText = nullptr; + LLTextureCtrl* mPBRTextureCtrl { nullptr }; + LLTextureCtrl* mTextureCtrl { nullptr }; + LLTextureCtrl* mShinyTextureCtrl { nullptr }; + LLTextureCtrl* mBumpyTextureCtrl { nullptr }; + LLTextBox* mLabelColor { nullptr }; + LLColorSwatchCtrl* mColorSwatch { nullptr }; + LLTextBox* mLabelShiniColor { nullptr }; + LLColorSwatchCtrl* mShinyColorSwatch { nullptr }; + + LLTextBox* mLabelTexGen { nullptr }; + LLComboBox* mComboTexGen { nullptr }; + + LLRadioGroup* mRadioMaterialType { nullptr }; + LLRadioGroup* mRadioPbrType { nullptr }; + + LLCheckBoxCtrl* mCheckFullbright { nullptr }; + + LLTextBox* mLabelColorTransp { nullptr }; + LLSpinCtrl* mCtrlColorTransp { nullptr }; // transparency = 1 - alpha + + LLTextBox* mLabelGlow { nullptr }; + LLSpinCtrl* mCtrlGlow { nullptr }; + LLComboBox* mComboMatMedia { nullptr }; + LLMediaCtrl* mTitleMedia { nullptr }; + LLTextBox* mTitleMediaText { nullptr }; + + LLTextBox* mLabelMatPermLoading { nullptr }; + LLCheckBoxCtrl* mCheckSyncSettings { nullptr }; + + LLTextBox* mLabelBumpiness { nullptr }; + LLComboBox* mComboBumpiness { nullptr }; + LLTextBox* mLabelShininess { nullptr }; + LLComboBox* mComboShininess { nullptr }; + LLTextBox* mLabelAlphaMode { nullptr }; + LLComboBox* mComboAlphaMode { nullptr }; + LLSpinCtrl* mTexScaleU { nullptr }; + LLSpinCtrl* mTexScaleV { nullptr }; + LLSpinCtrl* mTexRotate { nullptr }; + LLSpinCtrl* mTexRepeat { nullptr }; + LLSpinCtrl* mTexOffsetU { nullptr }; + LLSpinCtrl* mTexOffsetV { nullptr }; + LLCheckBoxCtrl* mPlanarAlign{ nullptr }; + LLSpinCtrl* mBumpyScaleU { nullptr }; + LLSpinCtrl* mBumpyScaleV { nullptr }; + LLSpinCtrl* mBumpyRotate { nullptr }; + LLSpinCtrl* mBumpyOffsetU { nullptr }; + LLSpinCtrl* mBumpyOffsetV { nullptr }; + LLSpinCtrl* mShinyScaleU { nullptr }; + LLSpinCtrl* mShinyScaleV { nullptr }; + LLSpinCtrl* mShinyRotate { nullptr }; + LLSpinCtrl* mShinyOffsetU { nullptr }; + LLSpinCtrl* mShinyOffsetV { nullptr }; + LLTextBox* mLabelGlossiness { nullptr }; + LLSpinCtrl* mGlossiness { nullptr }; + LLTextBox* mLabelEnvironment { nullptr }; + LLSpinCtrl* mEnvironment { nullptr }; + LLTextBox* mLabelMaskCutoff { nullptr }; + LLSpinCtrl* mMaskCutoff { nullptr }; + LLButton* mAddMedia { nullptr }; + LLButton* mDelMedia { nullptr }; + LLSpinCtrl* mPBRScaleU { nullptr }; + LLSpinCtrl* mPBRScaleV { nullptr }; + LLSpinCtrl* mPBRRotate { nullptr }; + LLSpinCtrl* mPBROffsetU { nullptr }; + LLSpinCtrl* mPBROffsetV { nullptr }; + + LLButton* mBtnAlign { nullptr }; + LLButton* mBtnAlignTex { nullptr }; + LLButton* mBtnPbrFromInv { nullptr }; + LLButton* mBtnEditBbr { nullptr }; + LLButton* mBtnSaveBbr { nullptr }; // Update visibility of controls to match current UI mode // (e.g. materials vs media editing) @@ -324,6 +374,20 @@ private: // Hey look everyone, a type-safe alternative to copy and paste! :) // + template<class T> + void getChildSetCommitCallback(T*& ctrl, std::string_view name, std::function<void(LLUICtrl*, const LLSD&)> cb) + { + ctrl = this->getChild<T>(name); + ctrl->setCommitCallback(cb); + } + + template<class T> + void getChildSetClickedCallback(T*& ctrl, std::string_view name, std::function<void(LLUICtrl*, const LLSD&)> cb) + { + ctrl = this->getChild<T>(name); + ctrl->setClickedCallback(cb); + } + // Update material parameters by applying 'edit_func' to selected TEs // template< @@ -483,7 +547,7 @@ private: void updateVisibilityGLTF(LLViewerObject* objectp = nullptr); void updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func); - void updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LLGLTFMaterial::TextureTransform*)> edit); + void updateGLTFTextureTransform(std::function<void(LLGLTFMaterial::TextureTransform*)> edit); void setMaterialOverridesFromSelection(); @@ -578,41 +642,41 @@ public: static void getMaxNormalRepeats(F32& repeats, bool& identical); static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha); - DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null, false, LLUUID::null) - DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null, false, LLUUID::null) - DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f, true, 0.001f) - - DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f, true, 0.001f) - DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f, true, 0.001f) - - DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode); - DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff); - - DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetX); - DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetY); - DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatX); - DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatY); - DEF_EDIT_MAT_STATE(F32,F32,setNormalRotation); - - DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetX); - DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetY); - DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatX); - DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatY); - DEF_EDIT_MAT_STATE(F32,F32,setSpecularRotation); - - DEF_EDIT_MAT_STATE(U8,U8,setEnvironmentIntensity); - DEF_EDIT_MAT_STATE(U8,U8,setSpecularLightExponent); - - DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setNormalID); - DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setSpecularID); - DEF_EDIT_MAT_STATE(LLColor4U, const LLColor4U&,setSpecularLightColor); + DEF_GET_MAT_STATE(LLUUID, const LLUUID&, getNormalID, LLUUID::null, false, LLUUID::null); + DEF_GET_MAT_STATE(LLUUID, const LLUUID&, getSpecularID, LLUUID::null, false, LLUUID::null); + DEF_GET_MAT_STATE(F32, F32, getSpecularRepeatX, 1.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getSpecularRepeatY, 1.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getSpecularOffsetX, 0.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getSpecularOffsetY, 0.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getSpecularRotation, 0.0f, true, 0.001f); + + DEF_GET_MAT_STATE(F32, F32, getNormalRepeatX, 1.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getNormalRepeatY, 1.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getNormalOffsetX, 0.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getNormalOffsetY, 0.0f, true, 0.001f); + DEF_GET_MAT_STATE(F32, F32, getNormalRotation, 0.0f, true, 0.001f); + + DEF_EDIT_MAT_STATE(U8, U8, setDiffuseAlphaMode); + DEF_EDIT_MAT_STATE(U8, U8, setAlphaMaskCutoff); + + DEF_EDIT_MAT_STATE(F32, F32, setNormalOffsetX); + DEF_EDIT_MAT_STATE(F32, F32, setNormalOffsetY); + DEF_EDIT_MAT_STATE(F32, F32, setNormalRepeatX); + DEF_EDIT_MAT_STATE(F32, F32, setNormalRepeatY); + DEF_EDIT_MAT_STATE(F32, F32, setNormalRotation); + + DEF_EDIT_MAT_STATE(F32, F32, setSpecularOffsetX); + DEF_EDIT_MAT_STATE(F32, F32, setSpecularOffsetY); + DEF_EDIT_MAT_STATE(F32, F32, setSpecularRepeatX); + DEF_EDIT_MAT_STATE(F32, F32, setSpecularRepeatY); + DEF_EDIT_MAT_STATE(F32, F32, setSpecularRotation); + + DEF_EDIT_MAT_STATE(U8, U8, setEnvironmentIntensity); + DEF_EDIT_MAT_STATE(U8, U8, setSpecularLightExponent); + + DEF_EDIT_MAT_STATE(LLUUID, const LLUUID&,setNormalID); + DEF_EDIT_MAT_STATE(LLUUID, const LLUUID&,setSpecularID); + DEF_EDIT_MAT_STATE(LLColor4U, const LLColor4U&, setSpecularLightColor); }; class LLSelectedTE @@ -638,6 +702,8 @@ public: DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT, false, LLTextureEntry::TEX_GEN_DEFAULT) DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white, false, LLColor4::black); }; + + friend struct LLPanelFaceSetTEFunctor; }; #endif diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index fd7085c452..8334da1836 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -239,6 +239,11 @@ bool LLPanelMainInventory::postBuild() } } + mParentSidepanel = getParentSidepanelInventory(); + if (mParentSidepanel) + { + mInboxPanel = mParentSidepanel->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); + } mFilterEditor = getChild<LLFilterEditor>("inventory search editor"); if (mFilterEditor) @@ -303,31 +308,29 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) // for example, LLParamSDParser doesn't know about U64, // so some FilterOps params should be revised. LLSD filterRoot; - LLInventoryPanel* all_items_panel = getChild<LLInventoryPanel>(ALL_ITEMS); - if (all_items_panel) + if (mAllItemsPanel) { LLSD filterState; LLInventoryPanel::InventoryState p; - all_items_panel->getFilter().toParams(p.filter); - all_items_panel->getRootViewModel().getSorter().toParams(p.sort); + mAllItemsPanel->getFilter().toParams(p.filter); + mAllItemsPanel->getRootViewModel().getSorter().toParams(p.sort); if (p.validateBlock(false)) { LLParamSDParser().writeSD(filterState, p); - filterRoot[all_items_panel->getName()] = filterState; + filterRoot[mAllItemsPanel->getName()] = filterState; } } - LLInventoryPanel* panel = findChild<LLInventoryPanel>(RECENT_ITEMS); - if (panel) + if (mRecentPanel) { LLSD filterState; LLInventoryPanel::InventoryState p; - panel->getFilter().toParams(p.filter); - panel->getRootViewModel().getSorter().toParams(p.sort); + mRecentPanel->getFilter().toParams(p.filter); + mRecentPanel->getRootViewModel().getSorter().toParams(p.sort); if (p.validateBlock(false)) { LLParamSDParser().writeSD(filterState, p); - filterRoot[panel->getName()] = filterState; + filterRoot[mRecentPanel->getName()] = filterState; } } @@ -761,14 +764,9 @@ void LLPanelMainInventory::onClearSearch() } mFilterSubString = ""; - LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mInboxPanel) { - LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); - if (inbox_panel) - { - inbox_panel->onClearSearch(); - } + mInboxPanel->onClearSearch(); } } @@ -818,14 +816,9 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) // set new filter string setFilterSubString(mFilterSubString); - LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mInboxPanel) { - LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); - if (inbox_panel) - { - inbox_panel->onFilterEdit(search_string); - } + mInboxPanel->onFilterEdit(search_string); } } @@ -1530,17 +1523,13 @@ void LLPanelMainInventory::onAddButtonClick() void LLPanelMainInventory::setActivePanel() { // Todo: should cover gallery mode in some way - if(mSingleFolderMode && isListViewMode()) - { - mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv"); - } - else if(mSingleFolderMode && isCombinationViewMode()) + if(mSingleFolderMode && (isListViewMode() || isCombinationViewMode())) { - mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv"); + mActivePanel = mCombinationInventoryPanel; } else { - mActivePanel = (LLInventoryPanel*)getChild<LLTabContainer>("inventory filter tabs")->getCurrentPanel(); + mActivePanel = (LLInventoryPanel*)mFilterTabs->getCurrentPanel(); } mViewModeBtn->setEnabled(mSingleFolderMode || (getAllItemsPanel() == getActivePanel())); } @@ -1578,16 +1567,15 @@ void LLPanelMainInventory::toggleViewMode() updateTitle(); onFilterSelected(); - LLSidepanelInventory* sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mParentSidepanel) { if(mSingleFolderMode) { - sidepanel_inventory->hideInbox(); + mParentSidepanel->hideInbox(); } else { - sidepanel_inventory->toggleInbox(); + mParentSidepanel->toggleInbox(); } } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 68ac3410d8..c1c7e9a7ab 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -49,6 +49,8 @@ class LLSidepanelInventory; class LLToggleableMenu; class LLFloater; class LLFloaterSidePanelContainer; +class LLSidepanelInventory; +class LLPanelMarketplaceInbox; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPanelMainInventory @@ -244,6 +246,9 @@ protected: void setUploadCostIfNeeded(); void disableAddIfNeeded(); private: + LLSidepanelInventory* mParentSidepanel = nullptr; + LLPanelMarketplaceInbox* mInboxPanel = nullptr; + LLToggleableMenu* mMenuGearDefault; LLToggleableMenu* mMenuViewDefault; LLToggleableMenu* mMenuVisibility; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 2f0a8f7656..107b1cf6cd 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -727,12 +727,14 @@ bool LLPanelPeople::postBuild() LL_WARNS() << "People->Groups list menu not found" << LL_ENDL; } - LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsAccordion = friends_tab->getChild<LLAccordionCtrl>("friends_accordion"); + + mFriendsAllTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_all"); + mFriendsAllTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList)); - accordion_tab = getChild<LLAccordionCtrlTab>("tab_online"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsOnlineTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_online"); + mFriendsOnlineTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList)); // Must go after setting commit callback and initializing all pointers to children. @@ -1064,8 +1066,8 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) mOnlineFriendList->setNameFilter(filter); mAllFriendList->setNameFilter(filter); - setAccordionCollapsedByUser("tab_online", false); - setAccordionCollapsedByUser("tab_all", false); + setAccordionCollapsedByUser(mFriendsOnlineTab, false); + setAccordionCollapsedByUser(mFriendsAllTab, false); showFriendsAccordionsIfNeeded(); // restore accordion tabs state _after_ all manipulations @@ -1108,7 +1110,6 @@ void LLPanelPeople::onGroupLimitInfo() void LLPanelPeople::onTabSelected(const LLSD& param) { - std::string tab_name = getChild<LLPanel>(param.asString())->getName(); updateButtons(); showFriendsAccordionsIfNeeded(); @@ -1142,9 +1143,9 @@ void LLPanelPeople::onAvatarListCommitted(LLAvatarList* list) uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); mMiniMap->setSelected(selected_uuids); - } else + } // Make sure only one of the friends lists (online/all) has selection. - if (getActiveTabName() == FRIENDS_TAB_NAME) + else if (getActiveTabName() == FRIENDS_TAB_NAME) { if (list == mOnlineFriendList) mAllFriendList->resetSelection(true); @@ -1169,12 +1170,9 @@ void LLPanelPeople::onAddFriendButtonClicked() bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) { const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); - for ( uuid_vec_t::const_iterator - id = uuids.begin(), - id_end = uuids.end(); - id != id_end; ++id ) + for (const LLUUID& uuid : uuids) { - if (av_tracker.isBuddy (*id)) + if (av_tracker.isBuddy(uuid)) { return false; } @@ -1479,15 +1477,8 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) return LLPanel::notifyChildren(info); } -void LLPanelPeople::showAccordion(const std::string name, bool show) +void LLPanelPeople::showAccordion(LLAccordionCtrlTab* tab, bool show) { - if(name.empty()) - { - LL_WARNS() << "No name provided" << LL_ENDL; - return; - } - - LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name); tab->setVisible(show); if(show) { @@ -1505,12 +1496,11 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded() if(FRIENDS_TAB_NAME == getActiveTabName()) { // Expand and show accordions if needed, else - hide them - showAccordion("tab_online", mOnlineFriendList->filterHasMatches()); - showAccordion("tab_all", mAllFriendList->filterHasMatches()); + showAccordion(mFriendsOnlineTab, mOnlineFriendList->filterHasMatches()); + showAccordion(mFriendsAllTab, mAllFriendList->filterHasMatches()); // Rearrange accordions - LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion"); - accordion->arrange(); + mFriendsAccordion->arrange(); // *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368). // this code should be refactored to use it @@ -1523,11 +1513,11 @@ void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param { if(ctrl == mOnlineFriendList) { - showAccordion("tab_online", param.asInteger()); + showAccordion(mFriendsOnlineTab, param.asInteger()); } else if(ctrl == mAllFriendList) { - showAccordion("tab_all", param.asInteger()); + showAccordion(mFriendsAllTab, param.asInteger()); } } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 445bc4c081..aef66db980 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -40,6 +40,8 @@ class LLGroupList; class LLMenuButton; class LLTabContainer; class LLNetMap; +class LLAccordionCtrl; +class LLAccordionCtrlTab; class LLPanelPeople : public LLPanel @@ -120,7 +122,7 @@ private: void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list); - void showAccordion(const std::string name, bool show); + void showAccordion(LLAccordionCtrlTab* tab, bool show); void showFriendsAccordionsIfNeeded(); @@ -139,6 +141,10 @@ private: LLGroupList* mGroupList; LLNetMap* mMiniMap; + LLAccordionCtrl* mFriendsAccordion = nullptr; + LLAccordionCtrlTab* mFriendsAllTab = nullptr; + LLAccordionCtrlTab* mFriendsOnlineTab = nullptr; + LLButton* mNearbyGearBtn = nullptr; LLButton* mFriendsGearBtn = nullptr; LLButton* mRecentGearBtn = nullptr; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 620b7c8b2d..9a991727b2 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -67,8 +67,7 @@ // Default constructor LLPreviewNotecard::LLPreviewNotecard(const LLSD& key) //const LLUUID& item_id, - : LLPreview( key ), - mLiveFile(NULL) + : LLPreview( key ) { const LLInventoryItem *item = getItem(); if (item) @@ -88,24 +87,30 @@ bool LLPreviewNotecard::postBuild() mEditor->setNotecardInfo(mItemUUID, mObjectID, getKey()); mEditor->makePristine(); - childSetAction("Save", onClickSave, this); - getChildView("lock")->setVisible( false); + mSaveBtn = getChild<LLButton>("Save"); + mSaveBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::saveIfNeeded, this, nullptr, true)); - childSetAction("Delete", onClickDelete, this); - getChildView("Delete")->setEnabled(false); + mLockBtn = getChild<LLUICtrl>("lock"); + mLockBtn->setVisible(false); - childSetAction("Edit", onClickEdit, this); + mDeleteBtn = getChild<LLButton>("Delete"); + mDeleteBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::deleteNotecard, this)); + mDeleteBtn->setEnabled(false); + + mEditBtn = getChild<LLButton>("Edit"); + mEditBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::openInExternalEditor, this)); const LLInventoryItem* item = getItem(); - childSetCommitCallback("desc", LLPreview::onText, this); + mDescEditor = getChild<LLLineEditor>("desc"); + mDescEditor->setCommitCallback(boost::bind(&LLPreview::onText, mDescEditor, this)); if (item) { - getChild<LLUICtrl>("desc")->setValue(item->getDescription()); + mDescEditor->setValue(item->getDescription()); bool source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); - getChildView("Delete")->setEnabled(!source_library); + mDeleteBtn->setEnabled(!source_library); } - getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); + mDescEditor->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); return LLPreview::postBuild(); } @@ -118,22 +123,30 @@ bool LLPreviewNotecard::saveItem() void LLPreviewNotecard::setEnabled(bool enabled) { - - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - getChildView("Notecard Editor")->setEnabled(enabled); - getChildView("lock")->setVisible( !enabled); - getChildView("desc")->setEnabled(enabled); - getChildView("Save")->setEnabled(enabled && editor && (!editor->isPristine())); + if (mEditor) + { + mEditor->setEnabled(enabled); + } + if (mLockBtn) + { + mLockBtn->setVisible(!enabled); + } + if (mDescEditor) + { + mDescEditor->setEnabled(enabled); + } + if (mSaveBtn) + { + mSaveBtn->setEnabled(enabled && mEditor && (!mEditor->isPristine())); + } } void LLPreviewNotecard::draw() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - bool changed = !editor->isPristine(); + bool changed = !mEditor->isPristine(); - getChildView("Save")->setEnabled(changed && getEnabled()); + mSaveBtn->setEnabled(changed && getEnabled()); LLPreview::draw(); } @@ -153,9 +166,7 @@ bool LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) // virtual bool LLPreviewNotecard::canClose() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(mForceClose || editor->isPristine()) + if(mForceClose || mEditor->isPristine()) { return true; } @@ -176,28 +187,18 @@ void LLPreviewNotecard::setObjectID(const LLUUID& object_id) { LLPreview::setObjectID(object_id); - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - editor->setNotecardObjectID(mObjectUUID); - editor->makePristine(); + mEditor->setNotecardObjectID(mObjectUUID); + mEditor->makePristine(); } const LLInventoryItem* LLPreviewNotecard::getDragItem() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(editor) - { - return editor->getDragItem(); - } - return NULL; + return mEditor->getDragItem(); } bool LLPreviewNotecard::hasEmbeddedInventory() { - LLViewerTextEditor* editor = NULL; - editor = getChild<LLViewerTextEditor>("Notecard Editor"); - if (!editor) return false; - return editor->hasEmbeddedInventory(); + return mEditor->hasEmbeddedInventory(); } void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id) @@ -215,10 +216,9 @@ void LLPreviewNotecard::updateTitleButtons() { LLPreview::updateTitleButtons(); - LLUICtrl* lock_btn = getChild<LLUICtrl>("lock"); - if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. + if(mLockBtn && mLockBtn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. { - LLRect lock_rc = lock_btn->getRect(); + LLRect lock_rc = mLockBtn->getRect(); LLRect buttons_rect = getDragHandle()->getButtonsRect(); buttons_rect.mLeft = lock_rc.mLeft; getDragHandle()->setButtonsRect(buttons_rect); @@ -229,11 +229,6 @@ void LLPreviewNotecard::loadAsset() { // request the asset. const LLInventoryItem* item = getItem(); - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if (!editor) - return; - bool fail = false; if(item) @@ -249,9 +244,9 @@ void LLPreviewNotecard::loadAsset() mAssetID = item->getAssetUUID(); if(mAssetID.isNull()) { - editor->setText(LLStringUtil::null); - editor->makePristine(); - editor->setEnabled(true); + mEditor->setText(LLStringUtil::null); + mEditor->makePristine(); + mEditor->setEnabled(true); mAssetStatus = PREVIEW_ASSET_LOADED; } else @@ -270,9 +265,9 @@ void LLPreviewNotecard::loadAsset() // The object that we're trying to look at disappeared, bail. LL_WARNS() << "Can't find object " << mObjectUUID << " associated with notecard." << LL_ENDL; mAssetID.setNull(); - editor->setText(getString("no_object")); - editor->makePristine(); - editor->setEnabled(false); + mEditor->setText(getString("no_object")); + mEditor->makePristine(); + mEditor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; return; } @@ -301,22 +296,22 @@ void LLPreviewNotecard::loadAsset() else { mAssetID.setNull(); - editor->setText(getString("not_allowed")); - editor->makePristine(); - editor->setEnabled(false); + mEditor->setText(getString("not_allowed")); + mEditor->makePristine(); + mEditor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; } if(!allow_modify) { - editor->setEnabled(false); - getChildView("lock")->setVisible( true); - getChildView("Edit")->setEnabled(false); + mEditor->setEnabled(false); + mLockBtn->setVisible( true); + mEditBtn->setEnabled(false); } if((allow_modify || is_owner) && !source_library) { - getChildView("Delete")->setEnabled(true); + mDeleteBtn->setEnabled(true); } } else if (mObjectUUID.notNull() && mItemUUID.notNull()) @@ -345,9 +340,9 @@ void LLPreviewNotecard::loadAsset() if (fail) { - editor->setText(LLStringUtil::null); - editor->makePristine(); - editor->setEnabled(true); + mEditor->setText(LLStringUtil::null); + mEditor->makePristine(); + mEditor->setEnabled(true); // Don't set asset status here; we may not have set the item id yet // (e.g. when this gets called initially) //mAssetStatus = PREVIEW_ASSET_LOADED; @@ -377,7 +372,7 @@ void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid, buffer[file_length] = 0; - LLViewerTextEditor* previewEditor = preview->getChild<LLViewerTextEditor>("Notecard Editor"); + LLViewerTextEditor* previewEditor = preview->mEditor; if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { @@ -421,38 +416,6 @@ void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid, delete floater_key; } -// static -void LLPreviewNotecard::onClickSave(void* user_data) -{ - //LL_INFOS() << "LLPreviewNotecard::onBtnSave()" << LL_ENDL; - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if(preview) - { - preview->saveIfNeeded(); - } -} - - -// static -void LLPreviewNotecard::onClickDelete(void* user_data) -{ - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if(preview) - { - preview->deleteNotecard(); - } -} - -// static -void LLPreviewNotecard::onClickEdit(void* user_data) -{ - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if (preview) - { - preview->openInExternalEditor(); - } -} - struct LLSaveNotecardInfo { LLPreviewNotecard* mSelf; @@ -515,23 +478,15 @@ void LLPreviewNotecard::finishTaskUpload(LLUUID itemId, LLUUID newAssetId, LLUUI bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(!editor) - { - LL_WARNS() << "Cannot get handle to the notecard editor." << LL_ENDL; - return false; - } - - if(!editor->isPristine()) + if(!mEditor->isPristine()) { std::string buffer; - if (!editor->exportBuffer(buffer)) + if (!mEditor->exportBuffer(buffer)) { return false; } - editor->makePristine(); + mEditor->makePristine(); const LLInventoryItem* item = getItem(); // save it out to database if (item) @@ -692,11 +647,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data // Perform item copy to inventory if (info->mCopyItem.notNull()) { - LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor"); - if (editor) - { - editor->copyInventory(info->mCopyItem); - } + info->mSelf->mEditor->copyInventory(info->mCopyItem); } // Find our window and close it if requested. @@ -731,7 +682,7 @@ bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const { case 0: // "Yes" mCloseAfterSave = true; - LLPreviewNotecard::onClickSave((void*)this); + saveIfNeeded(); break; case 1: // "No" diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index db677b1cf9..be3c804f9b 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -41,6 +41,7 @@ class LLViewerTextEditor; class LLButton; +class LLLineEditor; class LLPreviewNotecard : public LLPreview, public LLVOInventoryListener { @@ -93,12 +94,6 @@ protected: LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); - static void onClickSave(void* data); - - static void onClickDelete(void* data); - - static void onClickEdit(void* data); - static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); @@ -116,14 +111,18 @@ protected: std::string getTmpFileName(); protected: - LLViewerTextEditor* mEditor; - LLButton* mSaveBtn; + LLViewerTextEditor* mEditor = nullptr; + LLLineEditor* mDescEditor = nullptr; + LLButton* mSaveBtn = nullptr; + LLButton* mEditBtn = nullptr; + LLButton* mDeleteBtn = nullptr; + LLUICtrl* mLockBtn = nullptr; LLUUID mAssetID; LLUUID mObjectID; - LLLiveLSLFile* mLiveFile; + LLLiveLSLFile* mLiveFile = nullptr; }; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index b7c929f0b5..02a4c7fb26 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -435,7 +435,7 @@ void LLLiveLSLEditor::experienceChanged() if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID()) { mScriptEd->enableSave(getIsModifiable()); - //getChildView("Save_btn")->setEnabled(true); + //mSaveBtn->setEnabled(true); mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID()); updateExperiencePanel(); } @@ -481,6 +481,7 @@ void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata ) bool LLScriptEdCore::postBuild() { + mLineCol = getChild<LLTextBox>("line_col"); mErrorList = getChild<LLScrollListCtrl>("lsl errors"); mFunctions = getChild<LLComboBox>("Insert..."); @@ -490,7 +491,8 @@ bool LLScriptEdCore::postBuild() mEditor = getChild<LLScriptEditor>("Script Editor"); childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); - childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,false)); + mSaveBtn = getChild<LLButton>("Save_btn"); + mSaveBtn->setCommitCallback(boost::bind(&LLScriptEdCore::doSave, this, false)); childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this)); initMenu(); @@ -711,7 +713,7 @@ bool LLScriptEdCore::hasChanged() void LLScriptEdCore::draw() { bool script_changed = hasChanged(); - getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved); + mSaveBtn->setEnabled(script_changed && !mScriptRemoved); if( mEditor->hasFocus() ) { @@ -723,11 +725,11 @@ void LLScriptEdCore::draw() args["[LINE]"] = llformat ("%d", line); args["[COLUMN]"] = llformat ("%d", column); cursor_pos = LLTrans::getString("CursorPos", args); - getChild<LLUICtrl>("line_col")->setValue(cursor_pos); + mLineCol->setValue(cursor_pos); } else { - getChild<LLUICtrl>("line_col")->setValue(LLStringUtil::null); + mLineCol->setValue(LLStringUtil::null); } updateDynamicHelp(); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 9a3bc35f12..70ee1a4274 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -195,6 +195,8 @@ private: bool mScriptRemoved; bool mSaveDialogShown; LLUUID mAssetID; + LLTextBox* mLineCol = nullptr; + LLButton* mSaveBtn = nullptr; LLScriptEdContainer* mContainer; // parent view diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 2a5d7f2450..1b657d9ea1 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -129,6 +129,10 @@ void LLPreviewTexture::populateRatioList() // virtual bool LLPreviewTexture::postBuild() { + mButtonsPanel = getChild<LLLayoutPanel>("buttons_panel"); + mDimensionsText = getChild<LLUICtrl>("dimensions"); + mAspectRatioText = getChild<LLUICtrl>("aspect_ratio"); + if (mCopyToInv) { getChild<LLButton>("Keep")->setLabel(getString("Copy")); @@ -346,15 +350,20 @@ void LLPreviewTexture::reshape(S32 width, S32 height, bool called_from_parent) { LLPreview::reshape(width, height, called_from_parent); - LLRect dim_rect(getChildView("dimensions")->getRect()); - S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; // add space for dimensions and aspect ratio - S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD; - if (getChild<LLLayoutPanel>("buttons_panel")->getVisible()) + S32 info_height = CLIENT_RECT_VPAD; + + if (mDimensionsText) + { + LLRect dim_rect(mDimensionsText->getRect()); + info_height += dim_rect.mTop; + } + + if (mButtonsPanel && mButtonsPanel->getVisible()) { - info_height += getChild<LLLayoutPanel>("buttons_panel")->getRect().getHeight(); + info_height += mButtonsPanel->getRect().getHeight(); } LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0); client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); @@ -404,8 +413,8 @@ void LLPreviewTexture::hideCtrlButtons() { getChildView("desc txt")->setVisible(false); getChildView("desc")->setVisible(false); - getChild<LLLayoutStack>("preview_stack")->collapsePanel(getChild<LLLayoutPanel>("buttons_panel"), true); - getChild<LLLayoutPanel>("buttons_panel")->setVisible(false); + getChild<LLLayoutStack>("preview_stack")->collapsePanel(mButtonsPanel, true); + mButtonsPanel->setVisible(false); getChild<LLComboBox>("combo_aspect_ratio")->setCurrentByIndex(0); //unconstrained reshape(getRect().getWidth(), getRect().getHeight()); } @@ -538,8 +547,8 @@ void LLPreviewTexture::updateDimensions() // Update the width/height display every time - getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", img_width)); - getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", img_height)); + mDimensionsText->setTextArg("[WIDTH]", llformat("%d", img_width)); + mDimensionsText->setTextArg("[HEIGHT]", llformat("%d", img_height)); mLastHeight = img_height; mLastWidth = img_width; @@ -554,9 +563,9 @@ void LLPreviewTexture::updateDimensions() gFloaterView->adjustToFitScreen(this, false); - LLRect dim_rect(getChildView("dimensions")->getRect()); - LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect()); - getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); + LLRect dim_rect(mDimensionsText->getRect()); + LLRect aspect_label_rect(mAspectRatioText->getRect()); + mAspectRatioText->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); } } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index e55d61ef10..44f3f07339 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -34,6 +34,7 @@ class LLComboBox; class LLImageRaw; +class LLLayoutPanel; class LLPreviewTexture : public LLPreview { @@ -105,5 +106,9 @@ private: LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; std::vector<std::string> mRatiosList; + + LLLayoutPanel* mButtonsPanel = nullptr; + LLUICtrl* mDimensionsText = nullptr; + LLUICtrl* mAspectRatioText = nullptr; }; #endif // LL_LLPREVIEWTEXTURE_H diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 1efe51c1aa..3526004071 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -1371,13 +1371,21 @@ void LLReflectionMapManager::initReflectionMaps() { U32 count = LL_MAX_REFLECTION_PROBE_COUNT; - if (mTexture.isNull() || mReflectionProbeCount != count || mReset) + static LLCachedControl<U32> ref_probe_res(gSavedSettings, "RenderReflectionProbeResolution", 128U); + U32 probe_resolution = nhpo2(llclamp(ref_probe_res(), (U32)64, (U32)512)); + if (mTexture.isNull() || mReflectionProbeCount != count || mProbeResolution != probe_resolution || mReset) { + if(mProbeResolution != probe_resolution) + { + mRenderTarget.release(); + mMipChain.clear(); + } + gEXRImage = nullptr; mReset = false; mReflectionProbeCount = count; - mProbeResolution = nhpo2(llclamp(gSavedSettings.getU32("RenderReflectionProbeResolution"), (U32)64, (U32)512)); + mProbeResolution = probe_resolution; mMaxProbeLOD = log2f((F32)mProbeResolution) - 1.f; // number of mips - 1 if (mTexture.isNull() || diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index f75e48c728..44c2a8fdaf 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -55,12 +55,12 @@ LLRect LLScreenChannelBase::getChannelRect() if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); } LLRect channel_rect; @@ -103,12 +103,12 @@ bool LLScreenChannelBase::postBuild() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); } return true; diff --git a/indra/newview/llsculptidsize.cpp b/indra/newview/llsculptidsize.cpp index 3bc5ad7616..6be05fb003 100644 --- a/indra/newview/llsculptidsize.cpp +++ b/indra/newview/llsculptidsize.cpp @@ -29,8 +29,6 @@ #include "llvovolume.h" #include "lldrawable.h" #include "llvoavatar.h" -//boost -#include "boost/make_shared.hpp" //........... diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h index 5cc78d09dc..ceea11cc34 100644 --- a/indra/newview/llsecapi.h +++ b/indra/newview/llsecapi.h @@ -35,6 +35,7 @@ #include "llexception.h" #ifdef LL_WINDOWS +#pragma warning (push) #pragma warning(disable:4250) #endif // LL_WINDOWS @@ -549,5 +550,8 @@ void registerSecHandler(const std::string& handler_type, extern LLPointer<LLSecAPIHandler> gSecAPIHandler; +#ifdef LL_WINDOWS +#pragma warning (pop) +#endif // LL_WINDOWS #endif // LL_SECAPI_H diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h index 1484c6d0e1..2dffe84775 100644 --- a/indra/newview/llsechandler_basic.h +++ b/indra/newview/llsechandler_basic.h @@ -28,6 +28,11 @@ #ifndef LLSECHANDLER_BASIC #define LLSECHANDLER_BASIC +#ifdef LL_WINDOWS +#pragma warning (push) +#pragma warning(disable:4250) +#endif // LL_WINDOWS + #include "llsecapi.h" #include <vector> #include <openssl/x509.h> @@ -346,6 +351,10 @@ protected: bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs); +#ifdef LL_WINDOWS +#pragma warning (pop) +#endif // LL_WINDOWS + #endif // LLSECHANDLER_BASIC diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 2764b0179c..f8242675dc 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -49,7 +49,6 @@ #include <deque> #include <boost/iterator/filter_iterator.hpp> #include <boost/signals2.hpp> -#include <boost/make_shared.hpp> // boost::make_shared class LLMessageSystem; class LLViewerTexture; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index fdb73efa14..5152570786 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -33,7 +33,6 @@ #include <algorithm> #include <cstdio> -#include <boost/make_shared.hpp> #include "lltrace.h" #include "llfasttimer.h" #include "v3colorutil.h" diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index ffe5fa394f..b1f80e48af 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1051,7 +1051,8 @@ public: LLSpatialGroup* group = (LLSpatialGroup*)base_group; group->checkOcclusion(); - if (group->getOctreeNode()->getParent() && //never occlusion cull the root node + if (group->getOctreeNode() && + group->getOctreeNode()->getParent() && //never occlusion cull the root node LLPipeline::sUseOcclusion && //ignore occlusion if disabled group->isOcclusionState(LLSpatialGroup::OCCLUDED)) { diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 7480a18d9f..4956c188fb 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -377,16 +377,17 @@ void LLSpeakerMgr::update(bool resort_ok) } // update status of all current speakers - bool voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()); + LLVoiceClient* voice_client = LLVoiceClient::getInstance(); + bool voice_channel_active = (!mVoiceChannel && voice_client->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()); for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); speaker_it++) { LLUUID speaker_id = speaker_it->first; LLSpeaker* speakerp = speaker_it->second; - if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id)) + if (voice_channel_active && voice_client->getVoiceEnabled(speaker_id)) { - speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id); - bool moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id); + speakerp->mSpeechVolume = voice_client->getCurrentPower(speaker_id); + bool moderator_muted_voice = voice_client->getIsModeratorMuted(speaker_id); if (moderator_muted_voice != speakerp->mModeratorMutedVoice) { speakerp->mModeratorMutedVoice = moderator_muted_voice; @@ -394,11 +395,11 @@ void LLSpeakerMgr::update(bool resort_ok) speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp)); } - if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice) + if (voice_client->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice) { speakerp->mStatus = LLSpeaker::STATUS_MUTED; } - else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id)) + else if (voice_client->getIsSpeaking(speaker_id)) { // reset inactivity expiration if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING) @@ -481,17 +482,18 @@ void LLSpeakerMgr::update(bool resort_ok) void LLSpeakerMgr::updateSpeakerList() { // Are we bound to the currently active voice channel? - if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive())) + LLVoiceClient* vocie_client = LLVoiceClient::getInstance(); + if ((!mVoiceChannel && vocie_client->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive())) { std::set<LLUUID> participants; - LLVoiceClient::getInstance()->getParticipantList(participants); + vocie_client->getParticipantList(participants); // If we are, add all voice client participants to our list of known speakers for (std::set<LLUUID>::iterator participant_it = participants.begin(); participant_it != participants.end(); ++participant_it) { setSpeaker(*participant_it, - LLVoiceClient::getInstance()->getDisplayName(*participant_it), + vocie_client->getDisplayName(*participant_it), LLSpeaker::STATUS_VOICE_ACTIVE, - (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL)); + (vocie_client->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL)); } } else if (mVoiceChannel) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b993ba16d5..7cefa21125 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1285,7 +1285,6 @@ bool idle_startup() // // Initialize classes w/graphics stuff. // - LLViewerStatsRecorder::instance(); // Since textures work in threads LLSurface::initClasses(); display_startup(); diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index 68295225b6..10a104730b 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -110,6 +110,7 @@ public: LLSurfacePatch *resolvePatchRegion(const F32 x, const F32 y) const; LLSurfacePatch *resolvePatchRegion(const LLVector3 &position_region) const; LLSurfacePatch *resolvePatchGlobal(const LLVector3d &position_global) const; + LLSurfacePatch *getPatch(const S32 x, const S32 y) const; // Update methods (called during idle, normally) template<bool PBR> @@ -176,8 +177,6 @@ protected: void createPatchData(); // Allocates memory for patches. void destroyPatchData(); // Deallocates memory for patches. - LLSurfacePatch *getPatch(const S32 x, const S32 y) const; - protected: LLVector3d mOriginGlobal; // In absolute frame LLSurfacePatch *mPatchList; // Array of all patches diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index 0550889a9b..4315c4c6b0 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -201,13 +201,13 @@ LLVector2 LLSurfacePatch::getTexCoords(const U32 x, const U32 y) const void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 *vertex, LLVector3 *normal, - LLVector2 *tex0, LLVector2 *tex1) + LLVector2 *tex1) const { if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge() || !mVObjp) { return; // failsafe } - llassert_always(vertex && normal && tex0 && tex1); + llassert_always(vertex && normal && tex1); U32 surface_stride = mSurfacep->getGridsPerEdge(); U32 point_offset = x + y*surface_stride; @@ -220,12 +220,6 @@ void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 pos_agent.mV[VZ] = *(mDataZ + point_offset); *vertex = pos_agent-mVObjp->getRegion()->getOriginAgent(); - LLVector3 rel_pos = pos_agent - mSurfacep->getOriginAgent(); - // *NOTE: Only PBR terrain uses the UVs right now. Texture terrain just ignores it. - // *NOTE: In the future, UVs and horizontal position will no longer have a 1:1 relationship for PBR terrain - LLVector3 tex_pos = rel_pos; - tex0->mV[0] = tex_pos.mV[0]; - tex0->mV[1] = tex_pos.mV[1]; tex1->mV[0] = mSurfacep->getRegion()->getCompositionXY(llfloor(mOriginRegion.mV[0])+x, llfloor(mOriginRegion.mV[1])+y); const F32 xyScale = 4.9215f*7.f; //0.93284f; diff --git a/indra/newview/llsurfacepatch.h b/indra/newview/llsurfacepatch.h index 195250d2c0..f4831487c1 100644 --- a/indra/newview/llsurfacepatch.h +++ b/indra/newview/llsurfacepatch.h @@ -116,7 +116,7 @@ public: void calcNormalFlat(LLVector3& normal_out, const U32 x, const U32 y, const U32 index /* 0 or 1 */); void eval(const U32 x, const U32 y, const U32 stride, - LLVector3 *vertex, LLVector3 *normal, LLVector2 *tex0, LLVector2 *tex1); + LLVector3 *vertex, LLVector3 *normal, LLVector2 *tex1) const; @@ -146,6 +146,8 @@ public: void dirty(); // Mark this surface patch as dirty... void clearDirty() { mDirty = false; } + bool isHeightsGenerated() const { return mHeightsGenerated; } + void clearVObj(); public: diff --git a/indra/newview/llterrainpaintmap.cpp b/indra/newview/llterrainpaintmap.cpp new file mode 100644 index 0000000000..4381d14546 --- /dev/null +++ b/indra/newview/llterrainpaintmap.cpp @@ -0,0 +1,285 @@ +/** + * @file llterrainpaintmap.cpp + * @brief Utilities for managing terrain paint maps + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, 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 "llterrainpaintmap.h" + +#include "llviewerprecompiledheaders.h" + +// library includes +#include "llglslshader.h" +#include "llrendertarget.h" +#include "llvertexbuffer.h" + +// newview includes +#include "llrender.h" +#include "llsurface.h" +#include "llsurfacepatch.h" +#include "llviewercamera.h" +#include "llviewerregion.h" +#include "llviewershadermgr.h" +#include "llviewertexture.h" + +// static +bool LLTerrainPaintMap::bakeHeightNoiseIntoPBRPaintMapRGB(const LLViewerRegion& region, LLViewerTexture& tex) +{ + llassert(tex.getComponents() == 3); + llassert(tex.getWidth() > 0 && tex.getHeight() > 0); + llassert(tex.getWidth() == tex.getHeight()); + llassert(tex.getPrimaryFormat() == GL_RGB); + llassert(tex.getGLTexture()); + + const LLSurface& surface = region.getLand(); + const U32 patch_count = surface.getPatchesPerEdge(); + + // *TODO: mHeightsGenerated isn't guaranteed to be true. Assume terrain is + // loaded for now. Would be nice to fix the loading issue or find a better + // heuristic to determine that the terrain is sufficiently loaded. +#if 0 + // Don't proceed if the region heightmap isn't loaded + for (U32 rj = 0; rj < patch_count; ++rj) + { + for (U32 ri = 0; ri < patch_count; ++ri) + { + const LLSurfacePatch* patch = surface.getPatch(ri, rj); + if (!patch->isHeightsGenerated()) + { + LL_WARNS() << "Region heightmap not fully loaded" << LL_ENDL; + return false; + } + } + } +#endif + + // Bind the debug shader and render terrain to tex + // Use a scratch render target because its dimensions may exceed the standard bake target, and this is a one-off bake + LLRenderTarget scratch_target; + const S32 dim = llmin(tex.getWidth(), tex.getHeight()); + scratch_target.allocate(dim, dim, GL_RGB, false, LLTexUnit::eTextureType::TT_TEXTURE, + LLTexUnit::eTextureMipGeneration::TMG_NONE); + if (!scratch_target.isComplete()) + { + llassert(false); + LL_WARNS() << "Failed to allocate render target" << LL_ENDL; + return false; + } + gGL.getTexUnit(0)->disable(); + stop_glerror(); + + scratch_target.bindTarget(); + glClearColor(0, 0, 0, 0); + scratch_target.clear(); + + // Render terrain heightmap to paint map via shader + + // Set up viewport, camera, and orthographic projection matrix. Position + // the camera such that the camera points straight down, and the region + // completely covers the "screen". Since orthographic projection does not + // distort, we arbitrarily choose the near plane and far plane to cover the + // full span of region heights, plus a small amount of padding to account + // for rounding errors. + const F32 region_width = region.getWidth(); + const F32 region_half_width = region_width / 2.0f; + const F32 region_camera_height = surface.getMaxZ() + DEFAULT_NEAR_PLANE; + LLViewerCamera camera; + const LLVector3 region_center = LLVector3(region_half_width, region_half_width, 0.0) + region.getOriginAgent(); + const LLVector3 camera_origin = LLVector3(0.0f, 0.0f, region_camera_height) + region_center; + camera.lookAt(camera_origin, region_center, LLVector3::y_axis); + camera.setAspect(F32(scratch_target.getHeight()) / F32(scratch_target.getWidth())); + const LLRect texture_rect(0, scratch_target.getHeight(), scratch_target.getWidth(), 0); + glViewport(texture_rect.mLeft, texture_rect.mBottom, texture_rect.getWidth(), texture_rect.getHeight()); + // Manually get modelview matrix from camera orientation. + glh::matrix4f modelview((GLfloat *) OGL_TO_CFR_ROTATION); + GLfloat ogl_matrix[16]; + camera.getOpenGLTransform(ogl_matrix); + modelview *= glh::matrix4f(ogl_matrix); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadMatrix(modelview.m); + // Override the projection matrix from the camera + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); + llassert(camera_origin.mV[VZ] >= surface.getMaxZ()); + const F32 region_high_near = camera_origin.mV[VZ] - surface.getMaxZ(); + constexpr F32 far_plane_delta = 0.25f; + const F32 region_low_far = camera_origin.mV[VZ] - surface.getMinZ() + far_plane_delta; + gGL.ortho(-region_half_width, region_half_width, -region_half_width, region_half_width, region_high_near, region_low_far); + // No need to call camera.setPerspective because we don't need the clip planes. It would be inaccurate due to the perspective rendering anyway. + + // Need to get the full resolution vertices in order to get an accurate + // paintmap. It's not sufficient to iterate over the surface patches, as + // they may be at lower LODs. + // The functionality here is a subset of + // LLVOSurfacePatch::getTerrainGeometry. Unlike said function, we don't + // care about stride length since we're always rendering at full + // resolution. We also don't care about normals/tangents because those + // don't contribute to the paintmap. + // *NOTE: The actual getTerrainGeometry fits the terrain vertices snugly + // under the 16-bit indices limit. For the sake of simplicity, that has not + // been replicated here. + std::vector<LLPointer<LLDrawInfo>> infos; + // Vertex and index counts adapted from LLVOSurfacePatch::getGeomSizesMain, + // with additional vertices added as we are including the north and east + // edges here. + const U32 patch_size = (U32)surface.getGridsPerPatchEdge(); + constexpr U32 stride = 1; + const U32 vert_size = (patch_size / stride) + 1; + const U32 n = vert_size * vert_size; + const U32 ni = 6 * (vert_size - 1) * (vert_size - 1); + const U32 region_vertices = n * patch_count * patch_count; + const U32 region_indices = ni * patch_count * patch_count; + if (LLGLSLShader::sCurBoundShaderPtr == nullptr) + { // make sure a shader is bound to satisfy mVertexBuffer->setBuffer + gDebugProgram.bind(); + } + LLPointer<LLVertexBuffer> buf = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD1); + { + buf->allocateBuffer(region_vertices, region_indices*2); // hack double index count... TODO: find a better way to indicate 32-bit indices will be used + buf->setBuffer(); + U32 vertex_total = 0; + std::vector<U32> index_array(region_indices); + std::vector<LLVector4a> positions(region_vertices); + std::vector<LLVector2> texcoords1(region_vertices); + auto idx = index_array.begin(); + auto pos = positions.begin(); + auto tex1 = texcoords1.begin(); + for (U32 rj = 0; rj < patch_count; ++rj) + { + for (U32 ri = 0; ri < patch_count; ++ri) + { + const U32 index_offset = vertex_total; + for (U32 j = 0; j < (vert_size - 1); ++j) + { + for (U32 i = 0; i < (vert_size - 1); ++i) + { + // y + // 2....3 + // ^ . . + // | 0....1 + // | + // -------> x + // + // triangle 1: 0,1,2 + // triangle 2: 1,3,2 + // 0: vert0 + // 1: vert0 + 1 + // 2: vert0 + vert_size + // 3: vert0 + vert_size + 1 + const U32 vert0 = index_offset + i + (j*vert_size); + *idx++ = vert0; + *idx++ = vert0 + 1; + *idx++ = vert0 + vert_size; + *idx++ = vert0 + 1; + *idx++ = vert0 + vert_size + 1; + *idx++ = vert0 + vert_size; + } + } + + const LLSurfacePatch* patch = surface.getPatch(ri, rj); + for (U32 j = 0; j < vert_size; ++j) + { + for (U32 i = 0; i < vert_size; ++i) + { + LLVector3 scratch3; + LLVector3 pos3; + LLVector2 tex1_temp; + patch->eval(i, j, stride, &pos3, &scratch3, &tex1_temp); + (*pos++).set(pos3.mV[VX], pos3.mV[VY], pos3.mV[VZ]); + *tex1++ = tex1_temp; + vertex_total++; + } + } + } + } + buf->setIndexData(index_array.data(), 0, (U32)index_array.size()); + buf->setPositionData(positions.data(), 0, (U32)positions.size()); + buf->setTexCoord1Data(texcoords1.data(), 0, (U32)texcoords1.size()); + buf->unmapBuffer(); + buf->unbind(); + } + + // Draw the region in agent space at full resolution + { + + LLGLSLShader::unbind(); + // *NOTE: A theoretical non-PBR terrain bake program would be + // *slightly* different, due the texture terrain shader not having an + // alpha ramp threshold (TERRAIN_RAMP_MIX_THRESHOLD) + LLGLSLShader& shader = gPBRTerrainBakeProgram; + shader.bind(); + + LLGLDisable stencil(GL_STENCIL_TEST); + LLGLDisable scissor(GL_SCISSOR_TEST); + LLGLEnable cull_face(GL_CULL_FACE); + LLGLDepthTest depth_test(GL_FALSE, GL_FALSE, GL_ALWAYS); + + S32 alpha_ramp = shader.enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); + LLPointer<LLViewerTexture> alpha_ramp_texture = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD_2D); + gGL.getTexUnit(alpha_ramp)->bind(alpha_ramp_texture); + gGL.getTexUnit(alpha_ramp)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + + buf->setBuffer(); + for (U32 rj = 0; rj < patch_count; ++rj) + { + for (U32 ri = 0; ri < patch_count; ++ri) + { + const U32 patch_index = ri + (rj * patch_count); + const U32 index_offset = ni * patch_index; + const U32 vertex_offset = n * patch_index; + llassert(index_offset + ni <= region_indices); + llassert(vertex_offset + n <= region_vertices); + buf->drawRange(LLRender::TRIANGLES, vertex_offset, vertex_offset + n - 1, ni, index_offset); + } + } + + shader.disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); + + gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(alpha_ramp)->disable(); + gGL.getTexUnit(alpha_ramp)->activate(); + + shader.unbind(); + } + + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + + gGL.flush(); + LLVertexBuffer::unbind(); + // Final step: Copy the output to the terrain paintmap + const bool success = tex.getGLTexture()->setSubImageFromFrameBuffer(0, 0, 0, 0, dim, dim); + if (!success) + { + LL_WARNS() << "Failed to copy framebuffer to paintmap" << LL_ENDL; + } + glGenerateMipmap(GL_TEXTURE_2D); + stop_glerror(); + + scratch_target.flush(); + + LLGLSLShader::unbind(); + + return success; +} diff --git a/indra/llcommon/llallocator.cpp b/indra/newview/llterrainpaintmap.h index abe3779b85..66827862c5 100644 --- a/indra/llcommon/llallocator.cpp +++ b/indra/newview/llterrainpaintmap.h @@ -1,10 +1,10 @@ /** - * @file llallocator.cpp - * @brief Implementation of the LLAllocator class. + * @file llterrainpaintmap.h + * @brief Utilities for managing terrain paint maps * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2024, 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 @@ -24,35 +24,19 @@ * $/LicenseInfo$ */ -#include "linden_common.h" -#include "llallocator.h" +#pragma once -// -// stub implementations for when tcmalloc is disabled -// +class LLViewerRegion; +class LLViewerTexture; -void LLAllocator::setProfilingEnabled(bool should_enable) +class LLTerrainPaintMap { -} +public: -// static -bool LLAllocator::isProfiling() -{ - return false; -} - -std::string LLAllocator::getRawProfile() -{ - return std::string(); -} - -LLAllocatorHeapProfile const & LLAllocator::getProfile() -{ - mProf.mLines.clear(); - - // *TODO - avoid making all these extra copies of things... - std::string prof_text = getRawProfile(); - //std::cout << prof_text << std::endl; - mProf.parse(prof_text); - return mProf; -} + // Convert a region's heightmap and composition into a paint map texture which + // approximates how the terrain would be rendered with the heightmap. + // In effect, this allows converting terrain of type TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE + // to type TERRAIN_PAINT_TYPE_PBR_PAINTMAP. + // Returns true if successful + static bool bakeHeightNoiseIntoPBRPaintMapRGB(const LLViewerRegion& region, LLViewerTexture& tex); +}; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index e5a61b359d..9eaee2e326 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -415,12 +415,14 @@ void LLAvatarTexBar::draw() text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); line_num++; } + const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout"); const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); LLColor4 header_color(1.f, 1.f, 1.f, 0.9f); + const std::string texture_timeout_str = texture_timeout ? llformat("%d", texture_timeout) : "Disabled"; const std::string override_tex_discard_level_str = override_tex_discard_level ? llformat("%d",override_tex_discard_level) : "Disabled"; - std::string header_text = llformat("[ Timeout:60 ] [ LOD_Override('TextureDiscardLevel'):%s ]", override_tex_discard_level_str.c_str()); + std::string header_text = llformat("[ Timeout('AvatarBakedTextureUploadTimeout'):%s ] [ LOD_Override('TextureDiscardLevel'):%s ]", texture_timeout_str.c_str(), override_tex_discard_level_str.c_str()); LLFontGL::getFontMonospace()->renderUTF8(header_text, 0, l_offset, v_offset + line_height*line_num, header_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); line_num++; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index b74b48b9f6..7ef2c8d697 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -984,6 +984,7 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res label = result["label"].asString(); } + LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance(); if (result.has("message")) { reason = result["message"].asString(); @@ -994,6 +995,12 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res { case 404: reason = LLTrans::getString("AssetUploadServerUnreacheble"); + if (floater_snapshot + && floater_snapshot->isWaitingState() + && uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG) + { + label = "CannotUploadSnapshotEmailTooBig"; + } break; case 499: reason = LLTrans::getString("AssetUploadServerDifficulties"); @@ -1030,7 +1037,6 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res // Todo: move these floater specific actions into proper callbacks // Let the Snapshot floater know we have failed uploading. - LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance(); if (floater_snapshot && floater_snapshot->isWaitingState()) { if (uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG) diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 0e1f4c09c7..c1bf31ff9a 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -719,6 +719,8 @@ void handleLocalTerrainChanged(const LLSD& newValue) { gLocalTerrainMaterials.setMaterialOverride(i, mat_override); } + const bool paint_enabled = gSavedSettings.getBOOL("LocalTerrainPaintEnabled"); + gLocalTerrainMaterials.setPaintType(paint_enabled ? TERRAIN_PAINT_TYPE_PBR_PAINTMAP : TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE); } } //////////////////////////////////////////////////////////////////////////// @@ -909,6 +911,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "AutoTuneImpostorByDistEnabled", handleUserImpostorByDistEnabledChanged); setting_setup_signal_listener(gSavedSettings, "TuningFPSStrategy", handleFPSTuningStrategyChanged); { + setting_setup_signal_listener(gSavedSettings, "LocalTerrainPaintEnabled", handleLocalTerrainChanged); const char* transform_suffixes[] = { "ScaleU", "ScaleV", @@ -927,6 +930,7 @@ void settings_setup_listeners() } } } + setting_setup_signal_listener(gSavedSettings, "TerrainPaintBitDepth", handleSetShaderChanged); setting_setup_signal_listener(gSavedPerAccountSettings, "AvatarHoverOffsetZ", handleAvatarHoverOffsetChanged); } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index fbbcf9bd84..8c6a38876a 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1603,7 +1603,7 @@ void render_ui_2d() LLView::sIsRectDirty = false; LLRect t_rect; - gPipeline.mRT->uiScreen.bindTarget(); + gPipeline.mUIScreen.bindTarget(); gGL.setColorMask(true, true); { static const S32 pad = 8; @@ -1635,7 +1635,7 @@ void render_ui_2d() gViewerWindow->draw(); } - gPipeline.mRT->uiScreen.flush(); + gPipeline.mUIScreen.flush(); gGL.setColorMask(true, false); LLView::sDirtyRect = t_rect; @@ -1645,7 +1645,7 @@ void render_ui_2d() LLGLDisable blend(GL_BLEND); S32 width = gViewerWindow->getWindowWidthScaled(); S32 height = gViewerWindow->getWindowHeightScaled(); - gGL.getTexUnit(0)->bind(&gPipeline.mRT->uiScreen); + gGL.getTexUnit(0)->bind(&gPipeline.mUIScreen); gGL.begin(LLRender::TRIANGLE_STRIP); gGL.color4f(1.f,1.f,1.f,1.f); gGL.texCoord2f(0.f, 0.f); gGL.vertex2i(0, 0); diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 787ea02e4c..7543fb3743 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -524,7 +524,7 @@ void LLViewerJoystick::initDevice(LLSD &guid) #endif } -bool LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid) +bool LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, const std::string &name, const LLSD &guid) { #if LIB_NDOF mLastDeviceUUID = guid; diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index b459987c68..c989615653 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -56,7 +56,7 @@ public: void init(bool autoenable); void initDevice(LLSD &guid); bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/); - bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid); + bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, const std::string &name, const LLSD &guid); void terminate(); void updateStatus(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e3b92598f7..97d5781566 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -42,6 +42,7 @@ #include "llnotifications.h" #include "llnotificationsutil.h" #include "llviewereventrecorder.h" +#include "v4coloru.h" // newview includes #include "llagent.h" @@ -105,6 +106,7 @@ #include "llsidepanelappearance.h" #include "llspellcheckmenuhandler.h" #include "llstatusbar.h" +#include "llterrainpaintmap.h" #include "lltextureview.h" #include "lltoolbarview.h" #include "lltoolcomp.h" @@ -122,6 +124,7 @@ #include "llviewerparcelmgr.h" #include "llviewerstats.h" #include "llviewerstatsrecorder.h" +#include "llvlcomposition.h" #include "llvoavatarself.h" #include "llvoicevivox.h" #include "llworld.h" @@ -1385,6 +1388,65 @@ class LLAdvancedResetInterestLists : public view_listener_t }; +///////////// +// TERRAIN // +///////////// + +class LLAdvancedRebuildTerrain : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gPipeline.rebuildTerrain(); + return true; + } +}; + +class LLAdvancedTerrainCreateLocalPaintMap : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + { + LL_WARNS() << "Agent not in a region" << LL_ENDL; + return false; + } + + U16 dim = (U16)gSavedSettings.getU32("TerrainPaintResolution"); + // Ensure a reasonable image size of power two + const U32 max_resolution = gSavedSettings.getU32("RenderMaxTextureResolution"); + dim = llclamp(dim, 16, max_resolution); + dim = 1 << U32(std::ceil(std::log2(dim))); + LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3); + LLPointer<LLViewerTexture> tex = LLViewerTextureManager::getLocalTexture(image_raw.get(), true); + const bool success = LLTerrainPaintMap::bakeHeightNoiseIntoPBRPaintMapRGB(*region, *tex); + // This calls gLocalTerrainMaterials.setPaintType + gSavedSettings.setBOOL("LocalTerrainPaintEnabled", true); + // If baking the paintmap failed, set the paintmap to nullptr. This + // causes LLDrawPoolTerrain to use a blank paintmap instead. + if (!success) { tex = nullptr; } + gLocalTerrainMaterials.setPaintMap(tex); + + return true; + } +}; + +class LLAdvancedTerrainDeleteLocalPaintMap : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + // This calls gLocalTerrainMaterials.setPaintType + gSavedSettings.setBOOL("LocalTerrainPaintEnabled", false); + gLocalTerrainMaterials.setPaintMap(nullptr); + + return true; + } +}; + + +///////////// + + class LLAdvancedBuyCurrencyTest : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -2240,20 +2302,6 @@ class LLAdvancedPurgeShaderCache : public view_listener_t } }; -///////////////////// -// REBUILD TERRAIN // -///////////////////// - - -class LLAdvancedRebuildTerrain : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - gPipeline.rebuildTerrain(); - return true; - } -}; - //////////////////// // EVENT Recorder // /////////////////// @@ -9849,7 +9897,6 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedClickGLTFEdit(), "Advanced.ClickGLTFEdit"); view_listener_t::addMenu(new LLAdvancedClickResizeWindow(), "Advanced.ClickResizeWindow"); view_listener_t::addMenu(new LLAdvancedPurgeShaderCache(), "Advanced.ClearShaderCache"); - view_listener_t::addMenu(new LLAdvancedRebuildTerrain(), "Advanced.RebuildTerrain"); #ifdef TOGGLE_HACKED_GODLIKE_VIEWER view_listener_t::addMenu(new LLAdvancedHandleToggleHackedGodmode(), "Advanced.HandleToggleHackedGodmode"); @@ -9866,6 +9913,11 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedCheckInterestList360Mode(), "Advanced.CheckInterestList360Mode"); view_listener_t::addMenu(new LLAdvancedResetInterestLists(), "Advanced.ResetInterestLists"); + // Develop > Terrain + view_listener_t::addMenu(new LLAdvancedRebuildTerrain(), "Advanced.RebuildTerrain"); + view_listener_t::addMenu(new LLAdvancedTerrainCreateLocalPaintMap(), "Advanced.TerrainCreateLocalPaintMap"); + view_listener_t::addMenu(new LLAdvancedTerrainDeleteLocalPaintMap(), "Advanced.TerrainDeleteLocalPaintMap"); + // Advanced > UI commit.add("Advanced.WebBrowserTest", boost::bind(&handle_web_browser_test, _2)); // sigh! this one opens the MEDIA browser commit.add("Advanced.WebContentTest", boost::bind(&handle_web_content_test, _2)); // this one opens the Web Content floater @@ -10073,7 +10125,6 @@ void initialize_menus() commit.add("Object.Buy", boost::bind(&handle_buy)); commit.add("Object.Edit", boost::bind(&handle_object_edit)); - commit.add("Object.Edit", boost::bind(&handle_object_edit)); commit.add("Object.EditGLTFMaterial", boost::bind(&handle_object_edit_gltf_material)); commit.add("Object.Inspect", boost::bind(&handle_object_inspect)); commit.add("Object.Open", boost::bind(&handle_object_open)); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index c4fecf8dff..83f8e96f9a 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -547,9 +547,11 @@ void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k) if (asset_type == LLAssetType::AT_TEXTURE && allow_2k) { LLPointer<LLImageFormatted> image_frmted = LLImageFormatted::createFromType(codec); - if (gDirUtilp->fileExists(filename) && image_frmted->load(filename)) + if (gDirUtilp->fileExists(filename) && image_frmted && image_frmted->load(filename)) { - expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(image_frmted); + S32 biased_width = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getWidth(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + S32 biased_height = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getHeight(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(biased_width, biased_height); resource_upload = true; } } @@ -643,16 +645,15 @@ bool get_bulk_upload_expected_cost( if (asset_type == LLAssetType::AT_TEXTURE && allow_2k) { LLPointer<LLImageFormatted> image_frmted = LLImageFormatted::createFromType(codec); - if (gDirUtilp->fileExists(filename) && image_frmted->load(filename)) + if (gDirUtilp->fileExists(filename) && image_frmted && image_frmted->load(filename)) { - total_cost += LLAgentBenefitsMgr::current().getTextureUploadCost(image_frmted); - if (image_frmted) + S32 biased_width = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getWidth(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + S32 biased_height = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getHeight(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + total_cost += LLAgentBenefitsMgr::current().getTextureUploadCost(biased_width, biased_height); + S32 area = biased_width * biased_height; + if (area >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) { - S32 area = image_frmted->getHeight() * image_frmted->getWidth(); - if (area >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) - { - textures_2k_count++; - } + textures_2k_count++; } file_count++; } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 4558c156fb..1131ec7239 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5891,7 +5891,8 @@ LLBBox LLViewerObject::getBoundingBoxAgent() const } if (avatar_parent && avatar_parent->isAvatar() && - root_edit && root_edit->mDrawable.notNull() && root_edit->mDrawable->getXform()->getParent()) + root_edit && root_edit->mDrawable.notNull() && !root_edit->mDrawable->isDead() && + root_edit->mDrawable->getXform()->getParent()) { LLXform* parent_xform = root_edit->mDrawable->getXform()->getParent(); position_agent = (getPositionEdit() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition(); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index ae64ee7b92..435bd60917 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -889,6 +889,7 @@ void LLViewerObjectList::update(LLAgent &agent) static std::vector<LLViewerObject*> idle_list; U32 idle_count = 0; + mNumAvatars = 0; { for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); @@ -906,6 +907,10 @@ void LLViewerObjectList::update(LLAgent &agent) idle_list[idle_count] = objectp; } ++idle_count; + if (objectp->isAvatar()) + { + mNumAvatars++; + } } else { // There shouldn't be any NULL pointers in the list, but they have caused diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index ebdfd0d369..7dfa94b99f 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -145,6 +145,7 @@ public: S32 getOrphanParentCount() const { return (S32) mOrphanParents.size(); } S32 getOrphanCount() const { return mNumOrphans; } + S32 getAvatarCount() const { return mNumAvatars; } void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port); void findOrphans(LLViewerObject* objectp, U32 ip, U32 port); @@ -191,6 +192,7 @@ protected: std::vector<U64> mOrphanParents; // LocalID/ip,port of orphaned objects std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects S32 mNumOrphans; + S32 mNumAvatars; typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t; diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 8398cd8a54..7c8067ede3 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -37,11 +37,6 @@ #include "linden_common.h" -// Work around stupid Microsoft STL warning -#ifdef LL_WINDOWS -#pragma warning (disable : 4702) // warning C4702: unreachable code -#endif - #include <algorithm> #include <deque> #include <functional> @@ -55,7 +50,6 @@ // Library headers from llcommon project: #include "indra_constants.h" #include "llinitparam.h" -#include "llallocator.h" #include "llapp.h" #include "llcriticaldamp.h" #include "lldefs.h" diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 96354ea18f..073a1787d5 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -100,6 +100,7 @@ LLGLSLShader gBenchmarkProgram; LLGLSLShader gReflectionProbeDisplayProgram; LLGLSLShader gCopyProgram; LLGLSLShader gCopyDepthProgram; +LLGLSLShader gPBRTerrainBakeProgram; //object shaders LLGLSLShader gObjectPreviewProgram; @@ -226,7 +227,7 @@ LLGLSLShader gDeferredSkinnedPBROpaqueProgram; LLGLSLShader gHUDPBRAlphaProgram; LLGLSLShader gDeferredPBRAlphaProgram; LLGLSLShader gDeferredSkinnedPBRAlphaProgram; -LLGLSLShader gDeferredPBRTerrainProgram; +LLGLSLShader gDeferredPBRTerrainProgram[TERRAIN_PAINT_TYPE_COUNT]; LLGLSLShader gGLTFPBRMetallicRoughnessProgram; @@ -432,7 +433,10 @@ void LLViewerShaderMgr::finalizeShaderList() mShaderList.push_back(&gGLTFPBRMetallicRoughnessProgram); mShaderList.push_back(&gDeferredAvatarProgram); mShaderList.push_back(&gDeferredTerrainProgram); - mShaderList.push_back(&gDeferredPBRTerrainProgram); + for (U32 paint_type = 0; paint_type < TERRAIN_PAINT_TYPE_COUNT; ++paint_type) + { + mShaderList.push_back(&gDeferredPBRTerrainProgram[paint_type]); + } mShaderList.push_back(&gDeferredDiffuseAlphaMaskProgram); mShaderList.push_back(&gDeferredNonIndexedDiffuseAlphaMaskProgram); mShaderList.push_back(&gDeferredTreeProgram); @@ -1129,7 +1133,10 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedPBROpaqueProgram.unload(); gDeferredPBRAlphaProgram.unload(); gDeferredSkinnedPBRAlphaProgram.unload(); - gDeferredPBRTerrainProgram.unload(); + for (U32 paint_type = 0; paint_type < TERRAIN_PAINT_TYPE_COUNT; ++paint_type) + { + gDeferredPBRTerrainProgram[paint_type].unload(); + } return true; } @@ -1443,25 +1450,31 @@ bool LLViewerShaderMgr::loadShadersDeferred() S32 detail = gSavedSettings.getS32("RenderTerrainPBRDetail"); detail = llclamp(detail, TERRAIN_PBR_DETAIL_MIN, TERRAIN_PBR_DETAIL_MAX); const S32 mapping = clamp_terrain_mapping(gSavedSettings.getS32("RenderTerrainPBRPlanarSampleCount")); - gDeferredPBRTerrainProgram.mName = llformat("Deferred PBR Terrain Shader %d %s", - detail, - (mapping == 1 ? "flat" : "triplanar")); - gDeferredPBRTerrainProgram.mFeatures.hasSrgb = true; - gDeferredPBRTerrainProgram.mFeatures.isAlphaLighting = true; - gDeferredPBRTerrainProgram.mFeatures.calculatesAtmospherics = true; - gDeferredPBRTerrainProgram.mFeatures.hasAtmospherics = true; - gDeferredPBRTerrainProgram.mFeatures.hasGamma = true; - gDeferredPBRTerrainProgram.mFeatures.hasTransport = true; - gDeferredPBRTerrainProgram.mFeatures.isPBRTerrain = true; + for (U32 paint_type = 0; paint_type < TERRAIN_PAINT_TYPE_COUNT; ++paint_type) + { + LLGLSLShader* shader = &gDeferredPBRTerrainProgram[paint_type]; + shader->mName = llformat("Deferred PBR Terrain Shader %d %s %s", + detail, + (paint_type == TERRAIN_PAINT_TYPE_PBR_PAINTMAP ? "paintmap" : "heightmap-with-noise"), + (mapping == 1 ? "flat" : "triplanar")); + shader->mFeatures.hasSrgb = true; + shader->mFeatures.isAlphaLighting = true; + shader->mFeatures.calculatesAtmospherics = true; + shader->mFeatures.hasAtmospherics = true; + shader->mFeatures.hasGamma = true; + shader->mFeatures.hasTransport = true; + shader->mFeatures.isPBRTerrain = true; - gDeferredPBRTerrainProgram.mShaderFiles.clear(); - gDeferredPBRTerrainProgram.mShaderFiles.push_back(make_pair("deferred/pbrterrainV.glsl", GL_VERTEX_SHADER)); - gDeferredPBRTerrainProgram.mShaderFiles.push_back(make_pair("deferred/pbrterrainF.glsl", GL_FRAGMENT_SHADER)); - gDeferredPBRTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - gDeferredPBRTerrainProgram.addPermutation("TERRAIN_PBR_DETAIL", llformat("%d", detail)); - gDeferredPBRTerrainProgram.addPermutation("TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT", llformat("%d", mapping)); - success = gDeferredPBRTerrainProgram.createShader(); - llassert(success); + shader->mShaderFiles.clear(); + shader->mShaderFiles.push_back(make_pair("deferred/pbrterrainV.glsl", GL_VERTEX_SHADER)); + shader->mShaderFiles.push_back(make_pair("deferred/pbrterrainF.glsl", GL_FRAGMENT_SHADER)); + shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + shader->addPermutation("TERRAIN_PBR_DETAIL", llformat("%d", detail)); + shader->addPermutation("TERRAIN_PAINT_TYPE", llformat("%d", paint_type)); + shader->addPermutation("TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT", llformat("%d", mapping)); + success = success && shader->createShader(); + llassert(success); + } } if (success) @@ -2959,6 +2972,25 @@ bool LLViewerShaderMgr::loadShadersInterface() if (success) { + LLGLSLShader* shader = &gPBRTerrainBakeProgram; + U32 bit_depth = gSavedSettings.getU32("TerrainPaintBitDepth"); + // LLTerrainPaintMap currently uses an RGB8 texture internally + bit_depth = llclamp(bit_depth, 1, 8); + shader->mName = llformat("Terrain Bake Shader RGB%o", bit_depth); + shader->mFeatures.isPBRTerrain = true; + + shader->mShaderFiles.clear(); + shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeV.glsl", GL_VERTEX_SHADER)); + shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeF.glsl", GL_FRAGMENT_SHADER)); + shader->mShaderLevel = mShaderLevel[SHADER_INTERFACE]; + const U32 value_range = (1 << bit_depth) - 1; + shader->addPermutation("TERRAIN_PAINT_PRECISION", llformat("%d", value_range)); + success = success && shader->createShader(); + llassert(success); + } + + if (success) + { gAlphaMaskProgram.mName = "Alpha Mask Shader"; gAlphaMaskProgram.mShaderFiles.clear(); gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER)); diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 60ce8c430b..af47014a43 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -174,6 +174,7 @@ extern LLGLSLShader gBenchmarkProgram; extern LLGLSLShader gReflectionProbeDisplayProgram; extern LLGLSLShader gCopyProgram; extern LLGLSLShader gCopyDepthProgram; +extern LLGLSLShader gPBRTerrainBakeProgram; //output tex0[tc0] - tex1[tc1] extern LLGLSLShader gTwoTextureCompareProgram; @@ -304,5 +305,13 @@ enum TerrainPBRDetail : S32 TERRAIN_PBR_DETAIL_BASE_COLOR = -4, TERRAIN_PBR_DETAIL_MIN = -4, }; -extern LLGLSLShader gDeferredPBRTerrainProgram; +enum TerrainPaintType : U32 +{ + // Use LLVLComposition::mDatap (heightmap) generated by generateHeights, plus noise from TERRAIN_ALPHARAMP + TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE = 0, + // Use paint map if PBR terrain, otherwise fall back to TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE + TERRAIN_PAINT_TYPE_PBR_PAINTMAP = 1, + TERRAIN_PAINT_TYPE_COUNT = 2, +}; +extern LLGLSLShader gDeferredPBRTerrainProgram[TERRAIN_PAINT_TYPE_COUNT]; #endif diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp index 2e4002479d..3e0e3b28f2 100644 --- a/indra/newview/llviewerstatsrecorder.cpp +++ b/indra/newview/llviewerstatsrecorder.cpp @@ -27,16 +27,13 @@ #include "llviewerprecompiledheaders.h" #include "llviewerstatsrecorder.h" - #include "llcontrol.h" #include "llfile.h" +#include "llviewercontrol.h" #include "llviewerregion.h" #include "llviewerobject.h" #include "llworld.h" -extern LLControlGroup gSavedSettings; - -LLViewerStatsRecorder* LLViewerStatsRecorder::sInstance = NULL; LLViewerStatsRecorder::LLViewerStatsRecorder() : mStatsFile(NULL), mTimer(), @@ -48,11 +45,6 @@ LLViewerStatsRecorder::LLViewerStatsRecorder() : mMaxDuration(300.f), mSkipSaveIfZeros(false) { - if (NULL != sInstance) - { - LL_ERRS() << "Attempted to create multiple instances of LLViewerStatsRecorder!" << LL_ENDL; - } - sInstance = this; clearStats(); } diff --git a/indra/newview/llviewerstatsrecorder.h b/indra/newview/llviewerstatsrecorder.h index ecc321c0a8..2108f49dc3 100644 --- a/indra/newview/llviewerstatsrecorder.h +++ b/indra/newview/llviewerstatsrecorder.h @@ -38,13 +38,12 @@ class LLMutex; class LLViewerObject; -class LLViewerStatsRecorder : public LLSingleton<LLViewerStatsRecorder> +class LLViewerStatsRecorder : public LLSimpleton<LLViewerStatsRecorder> { - LLSINGLETON(LLViewerStatsRecorder); +public: + LLViewerStatsRecorder(); LOG_CLASS(LLViewerStatsRecorder); ~LLViewerStatsRecorder(); - - public: // Enable/disable stats recording. This is broken down into two // flags so we can record stats without writing them to the log // file. This is useful to analyzing updates for scene loading. @@ -140,8 +139,6 @@ private: void closeStatsFile(); void makeStatsFileName(); - static LLViewerStatsRecorder* sInstance; - LLFILE * mStatsFile; // File to write data into std::string mStatsFileName; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 8faa86876f..98da378c0d 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -42,6 +42,7 @@ #include "llstl.h" #include "message.h" #include "lltimer.h" +#include "v4coloru.h" // viewer includes #include "llimagegl.h" diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 865805f9bf..7047ce7d29 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -938,9 +938,9 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag onFace = true; F32 radius; F32 cos_angle_to_view_dir; - bool in_frustum = face->calcPixelArea(cos_angle_to_view_dir, radius); static LLCachedControl<F32> bias_unimportant_threshold(gSavedSettings, "TextureBiasUnimportantFactor", 0.25f); F32 vsize = face->getPixelArea(); + bool in_frustum = face->calcPixelArea(cos_angle_to_view_dir, radius); // Scale desired texture resolution higher or lower depending on texture scale // diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 417cece8eb..8ea8fbf905 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2064,6 +2064,9 @@ void LLViewerWindow::initBase() mPopupView = main_view->getChild<LLPopupView>("popup_holder"); mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle(); mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle(); + mStatusBarContainer = main_view->getChild<LLPanel>("status_bar_container"); + mNavBarContainer = mStatusBarContainer->getChild<LLView>("nav_bar_container"); + mTopInfoContainer = main_view->getChild<LLPanel>("topinfo_bar_container"); // Create the toolbar view // Get a pointer to the toolbar view holder @@ -2079,6 +2082,8 @@ void LLViewerWindow::initBase() // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI()) gToolBarView->setVisible(false); + mFloaterSnapRegion = gToolBarView->getChild<LLView>("floater_snap_region"); + mChicletContainer = gToolBarView->getChild<LLPanel>("chiclet_container"); // Constrain floaters to inside the menu and status bar regions. gFloaterView = main_view->getChild<LLFloaterView>("Floater View"); for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i) @@ -2089,7 +2094,7 @@ void LLViewerWindow::initBase() toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2)); } } - gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle()); + gFloaterView->setFloaterSnapView(mFloaterSnapRegion->getHandle()); gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View"); const F32 CHAT_PERSIST_TIME = 20.f; @@ -2155,12 +2160,11 @@ void LLViewerWindow::initWorldUI() if (!gNonInteractive) { - LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container"); LLChicletBar* chiclet_bar = LLChicletBar::getInstance(); - chiclet_bar->setShape(chiclet_container->getLocalRect()); + chiclet_bar->setShape(mChicletContainer->getLocalRect()); chiclet_bar->setFollowsAll(); - chiclet_container->addChild(chiclet_bar); - chiclet_container->setVisible(true); + mChicletContainer->addChild(chiclet_bar); + mChicletContainer->setVisible(true); } LLRect morph_view_rect = full_window; @@ -2185,30 +2189,25 @@ void LLViewerWindow::initWorldUI() if (!gStatusBar) { // Status bar - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - gStatusBar = new LLStatusBar(status_bar_container->getLocalRect()); + gStatusBar = new LLStatusBar(mStatusBarContainer->getLocalRect()); gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT); - gStatusBar->setShape(status_bar_container->getLocalRect()); + gStatusBar->setShape(mStatusBarContainer->getLocalRect()); // sync bg color with menu bar gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor()); // add InBack so that gStatusBar won't be drawn over menu - status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/); - status_bar_container->setVisible(true); + mStatusBarContainer->addChildInBack(gStatusBar, 2/*tab order, after menu*/); + mStatusBarContainer->setVisible(true); // Navigation bar - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - - navbar->setShape(nav_bar_container->getLocalRect()); + navbar->setShape(mNavBarContainer->getLocalRect()); navbar->setBackgroundColor(gMenuBarView->getBackgroundColor()); - nav_bar_container->addChild(navbar); - nav_bar_container->setVisible(true); + mNavBarContainer->addChild(navbar); + mNavBarContainer->setVisible(true); } else { - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - status_bar_container->setVisible(true); - nav_bar_container->setVisible(true); + mStatusBarContainer->setVisible(true); + mNavBarContainer->setVisible(true); } if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) @@ -2222,13 +2221,11 @@ void LLViewerWindow::initWorldUI() // Top Info bar - LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container"); LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance(); + topinfo_bar->setShape(mTopInfoContainer->getLocalRect()); - topinfo_bar->setShape(topinfo_bar_container->getLocalRect()); - - topinfo_bar_container->addChild(topinfo_bar); - topinfo_bar_container->setVisible(true); + mTopInfoContainer->addChild(topinfo_bar); + mTopInfoContainer->setVisible(true); if (!gSavedSettings.getBOOL("ShowMiniLocationPanel")) { @@ -2248,7 +2245,7 @@ void LLViewerWindow::initWorldUI() getRootView()->sendChildToBack(gHUDView); } - LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container"); + LLPanel* panel_ssf_container = gToolBarView->getChild<LLPanel>("state_management_buttons_container"); LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance(); panel_ssf_container->addChild(panel_stand_stop_flying); @@ -2571,12 +2568,11 @@ void LLViewerWindow::setNormalControlsVisible( bool visible ) gStatusBar->setEnabled( visible ); } - LLNavigationBar* navbarp = LLUI::getInstance()->getRootView()->findChild<LLNavigationBar>("navigation_bar"); - if (navbarp) + if (mNavBarContainer) { // when it's time to show navigation bar we need to ensure that the user wants to see it // i.e. ShowNavbarNavigationPanel option is true - navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); + mNavBarContainer->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); } } @@ -4185,15 +4181,17 @@ void LLViewerWindow::renderSelections( bool for_gl_pick, bool pick_parcel_walls, } } } - if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount()) - { - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.popMatrix(); + } - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); - stop_glerror(); - } + // un-setup HUD render + if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount()) + { + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); + stop_glerror(); } } } @@ -5952,23 +5950,20 @@ LLRect LLViewerWindow::getChatConsoleRect() void LLViewerWindow::reshapeStatusBarContainer() { - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - - S32 new_height = status_bar_container->getRect().getHeight(); - S32 new_width = status_bar_container->getRect().getWidth(); + S32 new_height = mStatusBarContainer->getRect().getHeight(); + S32 new_width = mStatusBarContainer->getRect().getWidth(); if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { // Navigation bar is outside visible area, expand status_bar_container to show it - new_height += nav_bar_container->getRect().getHeight(); + new_height += mNavBarContainer->getRect().getHeight(); } else { // collapse status_bar_container - new_height -= nav_bar_container->getRect().getHeight(); + new_height -= mNavBarContainer->getRect().getHeight(); } - status_bar_container->reshape(new_width, new_height, true); + mStatusBarContainer->reshape(new_width, new_height, true); } void LLViewerWindow::resetStatusBarContainer() @@ -5977,12 +5972,10 @@ void LLViewerWindow::resetStatusBarContainer() if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel") || navbar->getVisible()) { // was previously showing navigation bar - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - S32 new_height = status_bar_container->getRect().getHeight(); - S32 new_width = status_bar_container->getRect().getWidth(); - new_height -= nav_bar_container->getRect().getHeight(); - status_bar_container->reshape(new_width, new_height, true); + S32 new_height = mStatusBarContainer->getRect().getHeight(); + S32 new_width = mStatusBarContainer->getRect().getWidth(); + new_height -= mNavBarContainer->getRect().getHeight(); + mStatusBarContainer->reshape(new_width, new_height, true); } } //---------------------------------------------------------------------------- @@ -6009,7 +6002,7 @@ void LLViewerWindow::setUIVisibility(bool visible) LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : false); LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : false); - mRootView->getChildView("status_bar_container")->setVisible(visible); + mStatusBarContainer->setVisible(visible); } bool LLViewerWindow::getUIVisibility() diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index ba59ce4141..395d8c78da 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -463,6 +463,9 @@ public: static std::string getLastSnapshotDir(); + LLView* getFloaterSnapRegion() { return mFloaterSnapRegion; } + LLPanel* getChicletContainer() { return mChicletContainer; } + private: bool shouldShowToolTipFor(LLMouseHandler *mh); @@ -491,6 +494,11 @@ private: LLRect mWorldViewRectRaw; // area of screen for 3D world LLRect mWorldViewRectScaled; // area of screen for 3D world scaled by UI size LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views + LLView* mFloaterSnapRegion = nullptr; + LLView* mNavBarContainer = nullptr; + LLPanel* mStatusBarContainer = nullptr; + LLPanel* mChicletContainer = nullptr; + LLPanel* mTopInfoContainer = nullptr; LLVector2 mDisplayScale; LLCoordGL mCurrentMousePoint; // last mouse position in GL coords diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index f5f058a080..077e6e6cb1 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -312,6 +312,17 @@ bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict) return one_ready; } +LLViewerTexture* LLTerrainMaterials::getPaintMap() +{ + return mPaintMap.get(); +} + +void LLTerrainMaterials::setPaintMap(LLViewerTexture* paint_map) +{ + llassert(!paint_map || mPaintType == TERRAIN_PAINT_TYPE_PBR_PAINTMAP); + mPaintMap = paint_map; +} + // Boost the texture loading priority // Return true when ready to use (i.e. texture is sufficiently loaded) // static diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h index 2637d77183..f15f9bff6a 100644 --- a/indra/newview/llvlcomposition.h +++ b/indra/newview/llvlcomposition.h @@ -28,6 +28,8 @@ #define LL_LLVLCOMPOSITION_H #include "llviewerlayer.h" +#include "llviewershadermgr.h" +#include "llviewertexture.h" #include "llpointer.h" #include "llimage.h" @@ -44,6 +46,7 @@ public: virtual const LLGLTFMaterial* getMaterialOverride(S32 asset) const = 0; }; +// The subset of the composition used by local terrain debug materials (gLocalTerrainMaterials) class LLTerrainMaterials : public LLModifyRegion { public: @@ -79,6 +82,12 @@ public: // strict = false -> at least one material must be loaded bool makeMaterialsReady(bool boost, bool strict); + // See TerrainPaintType + U32 getPaintType() const { return mPaintType; } + void setPaintType(U32 paint_type) { mPaintType = paint_type; } + LLViewerTexture* getPaintMap(); + void setPaintMap(LLViewerTexture* paint_map); + protected: void unboost(); static bool makeTextureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost); @@ -93,6 +102,9 @@ protected: LLPointer<LLGLTFMaterial> mDetailMaterialOverrides[ASSET_COUNT]; LLPointer<LLFetchedGLTFMaterial> mDetailRenderMaterials[ASSET_COUNT]; bool mMaterialTexturesSet[ASSET_COUNT]; + + U32 mPaintType = TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE; + LLPointer<LLViewerTexture> mPaintMap; }; // Local materials to override all regions diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d5a8ee6cf8..09375a6930 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2631,6 +2631,29 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) } // Update should be happening max once per frame. + static LLCachedControl<S32> refreshPeriod(gSavedSettings, "AvatarExtentRefreshPeriodBatch"); + static LLCachedControl<S32> refreshMaxPerPeriod(gSavedSettings, "AvatarExtentRefreshMaxPerBatch"); + static S32 upd_freq = refreshPeriod; // initialise to a reasonable default of 1 batch + static S32 lastRecalibrationFrame{ 0 }; + + const S32 thisFrame = LLDrawable::getCurrentFrame(); + if (thisFrame - lastRecalibrationFrame >= upd_freq) + { + // Only update at the start of a cycle. . + // update frequency = ((Num_Avatars -1 / NumberPerPeriod) + 1 ) * Periodicity + // Given NumberPerPeriod = 5 and Periodicity = 4 + // | NumAvatars | frequency | + // +-------------+-----------+ + // | 1 | 4 | + // | 2 | 4 | + // | 5 | 4 | + // | 10 | 8 | + // | 25 | 20 | + + upd_freq = (((gObjectList.getAvatarCount() - 1) / refreshMaxPerPeriod) + 1)*refreshPeriod; + lastRecalibrationFrame = thisFrame; + } + if ((mLastAnimExtents[0]==LLVector3())|| (mLastAnimExtents[1])==LLVector3()) { @@ -2638,8 +2661,9 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) } else { - const S32 upd_freq = 4; // force update every upd_freq frames. - mNeedsExtentUpdate = ((LLDrawable::getCurrentFrame()+mID.mData[0])%upd_freq==0); + // Update extent if necessary. + // if the frame counnter + the first byte of the UUID % upd_freq = 0 then update the extent. + mNeedsExtentUpdate = ((thisFrame + mID.mData[0]) % upd_freq == 0); } LLScopedContextString str("avatar_idle_update " + getFullname()); @@ -3057,30 +3081,15 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() } else { - F32 morph_amt = calcMorphAmount(); - LLVisualParam *param; - if (!isSelf()) { + F32 morph_amt = calcMorphAmount(); // animate only top level params for non-self avatars - for (param = getFirstVisualParam(); - param; - param = getNextVisualParam()) - { - if (param->isTweakable()) - { - param->animate(morph_amt); - } - } + animateTweakableVisualParams(morph_amt); } // apply all params - for (param = getFirstVisualParam(); - param; - param = getNextVisualParam()) - { - param->apply(avatar_sex); - } + applyAllVisualParams(avatar_sex); mLastAppearanceBlendTime = appearance_anim_time; } @@ -3088,7 +3097,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() } } -F32 LLVOAvatar::calcMorphAmount() +F32 LLVOAvatar::calcMorphAmount() const { F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32(); F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME); @@ -10625,18 +10634,19 @@ void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32& void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - for ( LLVOAvatar::attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter ) + for (const auto& iter : mAttachmentPoints) { - LLViewerJointAttachment* attachment = iter->second; + LLViewerJointAttachment* attachment = iter.second; LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_end = attachment->mAttachedObjects.end(); - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_iter = attachment->mAttachedObjects.begin(); - attach_iter != attach_end; ++attach_iter) + for (LLViewerObject* attached_object : attachment->mAttachedObjects) { - LLViewerObject* attached_object = attach_iter->get(); - LLVOVolume *volume = dynamic_cast<LLVOVolume*>(attached_object); - if (volume) + if (attached_object->isDead()) + continue; + + if (attached_object->getPCode() == LL_PCODE_VOLUME) { + LLVOVolume* volume = (LLVOVolume*)attached_object; volumes.push_back(volume); if (volume->isAnimatedObject()) { @@ -10646,15 +10656,12 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes) continue; } } - LLViewerObject::const_child_list_t& children = attached_object->getChildren(); - for (LLViewerObject::const_child_list_t::const_iterator it = children.begin(); - it != children.end(); ++it) + + for (LLViewerObject* childp : attached_object->getChildren()) { - LLViewerObject *childp = *it; - LLVOVolume *volume = dynamic_cast<LLVOVolume*>(childp); - if (volume) + if (!childp->isDead() && childp->getPCode() == LL_PCODE_VOLUME) { - volumes.push_back(volume); + volumes.push_back((LLVOVolume*)childp); } } } @@ -10693,42 +10700,40 @@ void LLVOAvatar::updateRiggingInfo() getAssociatedVolumes(volumes); - std::map<LLUUID,S32> curr_rigging_info_key; + std::map<LLUUID, S32> curr_rigging_info_key; + + // Get current rigging info key + for (LLVOVolume* vol : volumes) { - // Get current rigging info key - for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it) + if (vol->isMesh() && vol->getVolume()) { - LLVOVolume *vol = *it; - if (vol->isMesh() && vol->getVolume()) - { - const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID(); - S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD); - curr_rigging_info_key[mesh_id] = max_lod; - } + const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID(); + S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD); + curr_rigging_info_key[mesh_id] = max_lod; } + } - // Check for key change, which indicates some change in volume composition or LOD. - if (curr_rigging_info_key == mLastRiggingInfoKey) - { - return; - } + // Check for key change, which indicates some change in volume composition or LOD. + if (curr_rigging_info_key == mLastRiggingInfoKey) + { + return; } // Something changed. Update. mLastRiggingInfoKey = curr_rigging_info_key; mJointRiggingInfoTab.clear(); - for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it) + for (LLVOVolume* vol : volumes) { - LLVOVolume *vol = *it; vol->updateRiggingInfo(); mJointRiggingInfoTab.merge(vol->mJointRiggingInfoTab); } //LL_INFOS() << "done update rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL; - LL_DEBUGS("RigSpammish") << getFullname() << " after update rig tab:" << LL_ENDL; - S32 joint_count, box_count; - showRigInfoTabExtents(this, mJointRiggingInfoTab, joint_count, box_count); - LL_DEBUGS("RigSpammish") << "uses " << joint_count << " joints " << " nonzero boxes: " << box_count << LL_ENDL; + // Remove debug only stuff on hot path + // LL_DEBUGS("RigSpammish") << getFullname() << " after update rig tab:" << LL_ENDL; + // S32 joint_count, box_count; + // showRigInfoTabExtents(this, mJointRiggingInfoTab, joint_count, box_count); + // LL_DEBUGS("RigSpammish") << "uses " << joint_count << " joints " << " nonzero boxes: " << box_count << LL_ENDL; } // virtual diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2144be1ba5..aa6aee0de5 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -422,7 +422,7 @@ protected: bool updateIsFullyLoaded(); bool processFullyLoadedChange(bool loading); void updateRuthTimer(bool loading); - F32 calcMorphAmount(); + F32 calcMorphAmount() const; private: bool mFirstFullyVisible; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 57f7734fea..00a7325db2 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -24,12 +24,6 @@ * $/LicenseInfo$ */ -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#endif - #include "llviewerprecompiledheaders.h" #include "llvoavatarself.h" @@ -69,11 +63,6 @@ #include "llcorehttputil.h" #include "lluiusage.h" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - #include <boost/lexical_cast.hpp> LLPointer<LLVOAvatarSelf> gAgentAvatarp = NULL; diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index 912b5a330e..5914303e80 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -187,13 +187,13 @@ void LLVoiceChannel::handleError(EStatusType type) setState(STATE_ERROR); } -bool LLVoiceChannel::isActive() +bool LLVoiceChannel::isActive() const { // only considered active when currently bound channel matches what our channel return callStarted() && LLVoiceClient::getInstance()->isCurrentChannel(mChannelInfo); } -bool LLVoiceChannel::callStarted() +bool LLVoiceChannel::callStarted() const { return mState >= STATE_CALL_STARTED; } @@ -662,7 +662,7 @@ LLVoiceChannelProximal::LLVoiceChannelProximal() : { } -bool LLVoiceChannelProximal::isActive() +bool LLVoiceChannelProximal::isActive() const { return callStarted() && LLVoiceClient::getInstance()->inProximalChannel(); } diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index 6af1bd57a3..d50a6f589a 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -74,8 +74,8 @@ public: virtual void activate(); virtual void setChannelInfo(const LLSD &channelInfo); virtual void requestChannelInfo(); - virtual bool isActive(); - virtual bool callStarted(); + virtual bool isActive() const; + virtual bool callStarted() const; // Session name is a UI label used for feedback about which person, // group, or phone number you are talking to @@ -170,7 +170,7 @@ class LLVoiceChannelProximal : public LLVoiceChannel, public LLSingleton<LLVoice void onChange(EStatusType status, const LLSD &channelInfo, bool proximal) override; void handleStatusChange(EStatusType status) override; void handleError(EStatusType status) override; - bool isActive() override; + bool isActive() const override; void activate() override; void deactivate() override; }; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 264e11fe34..21f469abb3 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -281,10 +281,8 @@ void LLVoiceClient::setNonSpatialVoiceModule(const std::string &voice_server_typ void LLVoiceClient::setHidden(bool hidden) { - if (mSpatialVoiceModule) - { - mSpatialVoiceModule->setHidden(hidden); - } + LLWebRTCVoiceClient::getInstance()->setHidden(hidden); + LLVivoxVoiceClient::getInstance()->setHidden(hidden); } void LLVoiceClient::terminate() @@ -408,13 +406,13 @@ const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() //-------------------------------------------------- // participants -void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants) +void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants) const { LLWebRTCVoiceClient::getInstance()->getParticipantList(participants); LLVivoxVoiceClient::getInstance()->getParticipantList(participants); } -bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) +bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) const { return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id); @@ -718,12 +716,12 @@ void LLVoiceClient::toggleUserPTTState(void) //------------------------------------------- // nearby speaker accessors -bool LLVoiceClient::getVoiceEnabled(const LLUUID& id) +bool LLVoiceClient::getVoiceEnabled(const LLUUID& id) const { return isParticipant(id); } -std::string LLVoiceClient::getDisplayName(const LLUUID& id) +std::string LLVoiceClient::getDisplayName(const LLUUID& id) const { std::string result = LLWebRTCVoiceClient::getInstance()->getDisplayName(id); if (result.empty()) diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index ea67500109..2221bc6df4 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -133,7 +133,7 @@ class LLVoiceP2PIncomingCallInterface virtual void declineInvite() = 0; }; -typedef boost::shared_ptr<LLVoiceP2PIncomingCallInterface> LLVoiceP2PIncomingCallInterfacePtr; +typedef std::shared_ptr<LLVoiceP2PIncomingCallInterface> LLVoiceP2PIncomingCallInterfacePtr; ////////////////////////////////// /// @class LLVoiceModuleInterface @@ -452,8 +452,8 @@ public: ///////////////////////////// // Accessors for data related to nearby speakers - bool getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar - std::string getDisplayName(const LLUUID& id); + bool getVoiceEnabled(const LLUUID& id) const; // true if we've received data for this avatar + std::string getDisplayName(const LLUUID& id) const; bool isOnlineSIP(const LLUUID &id); bool isParticipantAvatar(const LLUUID &id); bool getIsSpeaking(const LLUUID& id); @@ -463,8 +463,8 @@ public: F32 getUserVolume(const LLUUID& id); ///////////////////////////// - void getParticipantList(std::set<LLUUID> &participants); - bool isParticipant(const LLUUID& speaker_id); + void getParticipantList(std::set<LLUUID> &participants) const; + bool isParticipant(const LLUUID& speaker_id) const; ////////////////////////// /// @name text chat diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 7b19ec5fd7..ac54445786 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -2152,7 +2152,6 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) mIsInChannel = true; mMuteMicDirty = true; - mSessionTerminateRequested = false; while (!sShuttingDown && mVoiceEnabled @@ -4977,7 +4976,7 @@ void LLVivoxVoiceClient::hangup() { leaveChannel(); } LLVoiceP2PIncomingCallInterfacePtr LLVivoxVoiceClient::getIncomingCallInterface(const LLSD &voice_call_info) { - return boost::make_shared<LLVivoxVoiceP2PIncomingCall>(voice_call_info); + return std::make_shared<LLVivoxVoiceP2PIncomingCall>(voice_call_info); } bool LLVivoxVoiceClient::answerInvite(const std::string &sessionHandle) @@ -5101,7 +5100,9 @@ void LLVivoxVoiceClient::processChannels(bool process) bool LLVivoxVoiceClient::isCurrentChannel(const LLSD &channelInfo) { - if (!mProcessChannels || (channelInfo.has("voice_server_type") && channelInfo["voice_server_type"].asString() != VIVOX_VOICE_SERVER_TYPE)) + if (!mProcessChannels + || (channelInfo.has("voice_server_type") && channelInfo["voice_server_type"].asString() != VIVOX_VOICE_SERVER_TYPE) + || mSessionTerminateRequested) { return false; } @@ -5438,8 +5439,8 @@ void LLVivoxVoiceClient::leaveChannel(void) { LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL; mChannelName.clear(); - sessionTerminate(); } + sessionTerminate(); } void LLVivoxVoiceClient::setMuteMic(bool muted) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index b0ce5df93c..7862e492b2 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -89,6 +89,8 @@ public: // Returns true if vivox has successfully logged in and is not in error state bool isVoiceWorking() const override; + void setHidden(bool hidden) override; // virtual + ///////////////////// /// @name Tuning //@{ @@ -760,7 +762,6 @@ private: LLSD getAudioSessionChannelInfo(); std::string getAudioSessionHandle(); - void setHidden(bool hidden) override; //virtual void sendPositionAndVolumeUpdate(void); void sendCaptureAndRenderDevices(); diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 7a728d9164..e0130a9416 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -457,6 +457,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() // Could help with voice updates making for smoother // voice when we're busy. llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS); + if (sShuttingDown) return; // 'this' migh already be invalid bool voiceEnabled = mVoiceEnabled; if (!isAgentAvatarValid()) @@ -1253,7 +1254,7 @@ void LLWebRTCVoiceClient::sessionState::removeParticipant(const LLWebRTCVoiceCli LLWebRTCVoiceClient::getInstance()->notifyParticipantObservers(); } } - if (mHangupOnLastLeave && (participantID != gAgentID) && (mParticipantsByUUID.size() <= 1)) + if (mHangupOnLastLeave && (participantID != gAgentID) && (mParticipantsByUUID.size() <= 1) && LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); } @@ -1964,8 +1965,8 @@ bool LLWebRTCVoiceClient::estateSessionState::processConnectionStates() for (auto &connection : mWebRTCConnections) { - boost::shared_ptr<LLVoiceWebRTCSpatialConnection> spatialConnection = - boost::static_pointer_cast<LLVoiceWebRTCSpatialConnection>(connection); + std::shared_ptr<LLVoiceWebRTCSpatialConnection> spatialConnection = + std::static_pointer_cast<LLVoiceWebRTCSpatialConnection>(connection); LLUUID regionID = spatialConnection.get()->getRegionID(); @@ -2187,47 +2188,47 @@ void LLVoiceWebRTCConnection::processIceUpdates() { mOutstandingRequests++; LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::processIceUpdatesCoro", - boost::bind(&LLVoiceWebRTCConnection::processIceUpdatesCoro, this)); + boost::bind(&LLVoiceWebRTCConnection::processIceUpdatesCoro, this->shared_from_this())); } // Ice candidates may be streamed in before or after the SDP offer is available (see below) // This function determines whether candidates are available to send to the Secondlife WebRTC // server via the simulator. If so, and there are no more candidates, this code // will make the cap call to the server sending up the ICE candidates. -void LLVoiceWebRTCConnection::processIceUpdatesCoro() +void LLVoiceWebRTCConnection::processIceUpdatesCoro(connectionPtr_t connection) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE; - if (mShutDown || LLWebRTCVoiceClient::isShuttingDown()) + if (connection->mShutDown || LLWebRTCVoiceClient::isShuttingDown()) { - mOutstandingRequests--; + connection->mOutstandingRequests--; return; } bool iceCompleted = false; LLSD body; - if (!mIceCandidates.empty() || mIceCompleted) + if (!connection->mIceCandidates.empty() || connection->mIceCompleted) { - LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID); + LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(connection->mRegionID); if (!regionp || !regionp->capabilitiesReceived()) { LL_DEBUGS("Voice") << "no capabilities for ice gathering; waiting " << LL_ENDL; - mOutstandingRequests--; + connection->mOutstandingRequests--; return; } std::string url = regionp->getCapability("VoiceSignalingRequest"); if (url.empty()) { - mOutstandingRequests--; + connection->mOutstandingRequests--; return; } LL_DEBUGS("Voice") << "region ready to complete voice signaling; url=" << url << LL_ENDL; - if (!mIceCandidates.empty()) + if (!connection->mIceCandidates.empty()) { LLSD candidates = LLSD::emptyArray(); - for (auto &ice_candidate : mIceCandidates) + for (auto &ice_candidate : connection->mIceCandidates) { LLSD body_candidate; body_candidate["sdpMid"] = ice_candidate.mSdpMid; @@ -2236,18 +2237,18 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro() candidates.append(body_candidate); } body["candidates"] = candidates; - mIceCandidates.clear(); + connection->mIceCandidates.clear(); } - else if (mIceCompleted) + else if (connection->mIceCompleted) { LLSD body_candidate; body_candidate["completed"] = true; body["candidate"] = body_candidate; - iceCompleted = mIceCompleted; - mIceCompleted = false; + iceCompleted = connection->mIceCompleted; + connection->mIceCompleted = false; } - body["viewer_session"] = mViewerSession; + body["viewer_session"] = connection->mViewerSession; body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( @@ -2262,7 +2263,7 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro() if (LLWebRTCVoiceClient::isShuttingDown()) { - mOutstandingRequests--; + connection->mOutstandingRequests--; return; } @@ -2272,10 +2273,10 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro() if (!status) { // couldn't trickle the candidates, so restart the session. - setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); + connection->setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); } } - mOutstandingRequests--; + connection->mOutstandingRequests--; } @@ -2421,31 +2422,31 @@ void LLVoiceWebRTCConnection::sendData(const std::string &data) // Tell the simulator that we're shutting down a voice connection. // The simulator will pass this on to the Secondlife WebRTC server. -void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() +void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connection) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE; LL_DEBUGS("Voice") << "Disconnecting voice." << LL_ENDL; - if (mWebRTCDataInterface) + if (connection->mWebRTCDataInterface) { - mWebRTCDataInterface->unsetDataObserver(this); - mWebRTCDataInterface = nullptr; + connection->mWebRTCDataInterface->unsetDataObserver(connection.get()); + connection->mWebRTCDataInterface = nullptr; } - mWebRTCAudioInterface = nullptr; - LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID); + connection->mWebRTCAudioInterface = nullptr; + LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(connection->mRegionID); if (!regionp || !regionp->capabilitiesReceived()) { LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL; - setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); - mOutstandingRequests--; + connection->setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); + connection->mOutstandingRequests--; return; } std::string url = regionp->getCapability("ProvisionVoiceAccountRequest"); if (url.empty()) { - setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); - mOutstandingRequests--; + connection->setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); + connection->mOutstandingRequests--; return; } @@ -2454,7 +2455,7 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() LLVoiceWebRTCStats::getInstance()->provisionAttemptStart(); LLSD body; body["logout"] = true; - body["viewer_session"] = mViewerSession; + body["viewer_session"] = connection->mViewerSession; body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( @@ -2465,15 +2466,15 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() httpOpts->setWantHeaders(true); - mOutstandingRequests++; + connection->mOutstandingRequests++; // tell the server to shut down the connection as a courtesy. // shutdownConnection will drop the WebRTC connection which will // also shut things down. LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); - mOutstandingRequests--; - setVoiceConnectionState(VOICE_STATE_SESSION_EXIT); + connection->mOutstandingRequests--; + connection->setVoiceConnectionState(VOICE_STATE_SESSION_EXIT); } // Tell the simulator to tell the Secondlife WebRTC server that we want a voice @@ -2657,7 +2658,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() // VOICE_STATE_SESSION_ESTABLISHED via a callback on a webrtc thread. setVoiceConnectionState(VOICE_STATE_CONNECTION_WAIT); LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::requestVoiceConnectionCoro", - boost::bind(&LLVoiceWebRTCConnection::requestVoiceConnectionCoro, this)); + boost::bind(&LLVoiceWebRTCConnection::requestVoiceConnectionCoro, this->shared_from_this())); break; case VOICE_STATE_CONNECTION_WAIT: @@ -2737,7 +2738,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() case VOICE_STATE_DISCONNECT: setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT); LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnectionCoro", - boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this)); + boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this->shared_from_this())); break; case VOICE_STATE_WAIT_FOR_EXIT: diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 2b9a113fcc..c8dbb64574 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -55,7 +55,7 @@ class LLWebRTCProtocolParser; class LLAvatarName; class LLVoiceWebRTCConnection; -typedef boost::shared_ptr<LLVoiceWebRTCConnection> connectionPtr_t; +typedef std::shared_ptr<LLVoiceWebRTCConnection> connectionPtr_t; extern const std::string WEBRTC_VOICE_SERVER_TYPE; @@ -88,6 +88,7 @@ public: std::string sipURIFromID(const LLUUID &id) const override; LLSD getP2PChannelInfoTemplate(const LLUUID& id) const override; + void setHidden(bool hidden) override; // virtual /////////////////// /// @name Logging @@ -252,7 +253,7 @@ public: bool mIsModeratorMuted; LLUUID mRegion; }; - typedef boost::shared_ptr<participantState> participantStatePtr_t; + typedef std::shared_ptr<participantState> participantStatePtr_t; participantStatePtr_t findParticipantByID(const std::string &channelID, const LLUUID &id); participantStatePtr_t addParticipantByID(const std::string& channelID, const LLUUID &id, const LLUUID& region); @@ -265,10 +266,10 @@ public: class sessionState { public: - typedef boost::shared_ptr<sessionState> ptr_t; - typedef boost::weak_ptr<sessionState> wptr_t; + typedef std::shared_ptr<sessionState> ptr_t; + typedef std::weak_ptr<sessionState> wptr_t; - typedef boost::function<void(const ptr_t &)> sessionFunc_t; + typedef std::function<void(const ptr_t &)> sessionFunc_t; static void addSession(const std::string &channelID, ptr_t& session); virtual ~sessionState(); @@ -336,7 +337,7 @@ public: sessionFunc_t func); }; - typedef boost::shared_ptr<sessionState> sessionStatePtr_t; + typedef std::shared_ptr<sessionState> sessionStatePtr_t; typedef std::map<std::string, sessionStatePtr_t> sessionMap; class estateSessionState : public sessionState @@ -480,8 +481,6 @@ private: LLSD getAudioSessionChannelInfo(); - void setHidden(bool hidden) override; //virtual - void enforceTether(); void updateNeighboringRegions(); @@ -576,7 +575,8 @@ class LLVoiceWebRTCStats : public LLSingleton<LLVoiceWebRTCStats> class LLVoiceWebRTCConnection : public llwebrtc::LLWebRTCSignalingObserver, - public llwebrtc::LLWebRTCDataObserver + public llwebrtc::LLWebRTCDataObserver, + public std::enable_shared_from_this<LLVoiceWebRTCConnection> { public: LLVoiceWebRTCConnection(const LLUUID ®ionID, const std::string &channelID); @@ -610,7 +610,7 @@ class LLVoiceWebRTCConnection : void processIceUpdates(); - void processIceUpdatesCoro(); + static void processIceUpdatesCoro(connectionPtr_t connection); virtual void setMuteMic(bool muted); virtual void setSpeakerVolume(F32 volume); @@ -677,9 +677,9 @@ class LLVoiceWebRTCConnection : } virtual void requestVoiceConnection() = 0; - void requestVoiceConnectionCoro() { requestVoiceConnection(); } + static void requestVoiceConnectionCoro(connectionPtr_t connection) { connection->requestVoiceConnection(); } - void breakVoiceConnectionCoro(); + static void breakVoiceConnectionCoro(connectionPtr_t connection); LLVoiceClientStatusObserver::EStatusType mCurrentStatus; diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index d7fe17c3ce..fdccf34e6a 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -245,7 +245,6 @@ bool LLVOSurfacePatch::updateLOD() void LLVOSurfacePatch::getTerrainGeometry(LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp) { @@ -260,21 +259,18 @@ void LLVOSurfacePatch::getTerrainGeometry(LLStrider<LLVector3> &verticesp, updateMainGeometry(facep, verticesp, normalsp, - texCoords0p, texCoords1p, indicesp, index_offset); updateNorthGeometry(facep, verticesp, normalsp, - texCoords0p, texCoords1p, indicesp, index_offset); updateEastGeometry(facep, verticesp, normalsp, - texCoords0p, texCoords1p, indicesp, index_offset); @@ -283,7 +279,6 @@ void LLVOSurfacePatch::getTerrainGeometry(LLStrider<LLVector3> &verticesp, void LLVOSurfacePatch::updateMainGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, U32 &index_offset) @@ -322,10 +317,9 @@ void LLVOSurfacePatch::updateMainGeometry(LLFace *facep, { x = i * render_stride; y = j * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } } @@ -387,7 +381,6 @@ void LLVOSurfacePatch::updateMainGeometry(LLFace *facep, void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, U32 &index_offset) @@ -421,10 +414,9 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * render_stride; y = 16 - render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -433,10 +425,9 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, { x = i * render_stride; y = 16; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -469,10 +460,9 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * render_stride; y = 16 - render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -482,10 +472,9 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * render_stride; y = 16; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -525,10 +514,9 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * north_stride; y = 16 - render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -538,10 +526,9 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * north_stride; y = 16; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -577,7 +564,6 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, U32 &index_offset) @@ -606,10 +592,9 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16 - render_stride; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -618,10 +603,9 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, { x = 16; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -654,10 +638,9 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16 - render_stride; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } // Iterate through the east patch's points @@ -666,10 +649,9 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -708,10 +690,9 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16 - render_stride; y = i * east_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } // Iterate through the east patch's points @@ -720,10 +701,9 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16; y = i * east_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords1p.get()); verticesp++; normalsp++; - texCoords0p++; texCoords1p++; } @@ -992,8 +972,8 @@ void gen_terrain_tangents(U32 strider_vertex_count, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, LLStrider<LLVector4a> &tangentsp, - LLStrider<LLVector2> &texCoords0p, - LLStrider<U16> &indicesp) + LLStrider<U16> &indicesp, + F32 region_width) { LL_PROFILE_ZONE_SCOPED; @@ -1010,7 +990,10 @@ void gen_terrain_tangents(U32 strider_vertex_count, F32 *n = normalsp[v].mV; normals[v] = LLVector4a(n[0], n[1], n[2], 1.f); tangents[v] = tangentsp[v]; - texcoords[v] = texCoords0p[v]; + + // Calculate texcoords on-the-fly using the terrain positions + texcoords[v].mV[VX] = verticesp[v].mV[VX] / region_width; + texcoords[v].mV[VY] = verticesp[v].mV[VY] / region_width; } for (U32 i = 0; i < strider_index_count; ++i) { @@ -1039,14 +1022,12 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group) LLStrider<LLVector3> vertices_start; LLStrider<LLVector3> normals_start; LLStrider<LLVector4a> tangents_start; - LLStrider<LLVector2> texcoords_start; LLStrider<LLVector2> texcoords2_start; LLStrider<U16> indices_start; llassert_always(buffer->getVertexStrider(vertices_start)); llassert_always(buffer->getNormalStrider(normals_start)); llassert_always(buffer->getTangentStrider(tangents_start)); - llassert_always(buffer->getTexCoord0Strider(texcoords_start)); llassert_always(buffer->getTexCoord1Strider(texcoords2_start)); llassert_always(buffer->getIndexStrider(indices_start)); @@ -1056,7 +1037,6 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group) { LLStrider<LLVector3> vertices = vertices_start; LLStrider<LLVector3> normals = normals_start; - LLStrider<LLVector2> texcoords = texcoords_start; LLStrider<LLVector2> texcoords2 = texcoords2_start; LLStrider<U16> indices = indices_start; @@ -1069,7 +1049,7 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group) facep->setVertexBuffer(buffer); LLVOSurfacePatch* patchp = (LLVOSurfacePatch*) facep->getViewerObject(); - patchp->getTerrainGeometry(vertices, normals, texcoords, texcoords2, indices); + patchp->getTerrainGeometry(vertices, normals, texcoords2, indices); indices_index += facep->getIndicesCount(); index_offset += facep->getGeomCount(); @@ -1082,10 +1062,20 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group) LLStrider<LLVector3> vertices = vertices_start; LLStrider<LLVector3> normals = normals_start; LLStrider<LLVector4a> tangents = tangents_start; - LLStrider<LLVector2> texcoords = texcoords_start; LLStrider<U16> indices = indices_start; - gen_terrain_tangents(index_offset, indices_index, vertices, normals, tangents, texcoords, indices); + F32 region_width = 256.0f; + if (mFaceList.empty()) + { + llassert(false); + } + else + { + const LLViewerRegion* regionp = mFaceList[0]->getViewerObject()->getRegion(); + llassert(regionp == mFaceList.back()->getViewerObject()->getRegion()); // Assume this spatial group is confined to one region + region_width = regionp->getWidth(); + } + gen_terrain_tangents(index_offset, indices_index, vertices, normals, tangents, indices, region_width); } buffer->unmapBuffer(); diff --git a/indra/newview/llvosurfacepatch.h b/indra/newview/llvosurfacepatch.h index 2780b97a97..af5f05774b 100644 --- a/indra/newview/llvosurfacepatch.h +++ b/indra/newview/llvosurfacepatch.h @@ -41,14 +41,6 @@ class LLVOSurfacePatch : public LLStaticViewerObject public: static F32 sLODFactor; - enum - { - VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) | - (1 << LLVertexBuffer::TYPE_NORMAL) | - (1 << LLVertexBuffer::TYPE_TEXCOORD0) | - (1 << LLVertexBuffer::TYPE_TEXCOORD1) - }; - LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); /*virtual*/ void markDead(); @@ -65,7 +57,6 @@ public: /*virtual*/ void updateFaceSize(S32 idx); void getTerrainGeometry(LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp); @@ -118,21 +109,18 @@ protected: void updateMainGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, U32 &index_offset); void updateNorthGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, U32 &index_offset); void updateEastGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, - LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, U32 &index_offset); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index db8d9af774..813a1d286c 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1250,7 +1250,7 @@ void LLVOVolume::sculpt() if (!raw_image) { raw_image = mSculptTexture->getSavedRawImage(); - S32 discard_level = mSculptTexture->getSavedRawImageLevel(); + discard_level = mSculptTexture->getSavedRawImageLevel(); } if (!raw_image) diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 83e417633a..feb5ecb1fb 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -38,6 +38,7 @@ // newview #include "llavataractions.h" // for getProfileURL() #include "llviewermedia.h" // FIXME: don't use LLViewerMedia internals +#include "llnotificationsutil.h" #include "llcorehttputil.h" @@ -132,6 +133,10 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin if (!status) { + if (image->getDataSize() > MAX_WEB_DATASIZE) + { + LLNotificationsUtil::add("CannotUploadSnapshotWebTooBig"); + } LL_WARNS("Snapshots") << "Failed to get image upload config" << LL_ENDL; LLWebProfile::reportImageUploadStatus(false); return; diff --git a/indra/newview/llwebprofile.h b/indra/newview/llwebprofile.h index 335282bf13..a9cfa102c0 100644 --- a/indra/newview/llwebprofile.h +++ b/indra/newview/llwebprofile.h @@ -57,6 +57,8 @@ public: static void setAuthCookie(const std::string& cookie); static void setImageUploadResultCallback(status_callback_t cb) { mStatusCallback = cb; } + static constexpr S32 MAX_WEB_DATASIZE = 8 * 1024 * 1024; // 8MB + private: static LLCore::HttpHeaders::ptr_t buildDefaultHeaders(); diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h index d2801c86e1..770584c88d 100644 --- a/indra/newview/llwindebug.h +++ b/indra/newview/llwindebug.h @@ -30,10 +30,7 @@ #include "stdtypes.h" #include "llwin32headerslean.h" -#pragma warning (push) -#pragma warning (disable:4091) // a microsoft header has warnings. Very nice. #include <dbghelp.h> -#pragma warning (pop) class LLWinDebug: public LLSingleton<LLWinDebug> diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 2a461ca84b..98fdb68222 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -777,7 +777,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (mRT == &mMainRT) { // hacky -- allocate auxillary buffer - gCubeSnapshot = TRUE; + gCubeSnapshot = true; if (sReflectionProbesEnabled) { @@ -812,17 +812,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) resY /= res_mod; } - //water reflection texture (always needed as scratch space whether or not transparent water is enabled) - mWaterDis.allocate(resX, resY, GL_RGBA16F, true); - - if (RenderUIBuffer) - { - if (!mRT->uiScreen.allocate(resX,resY, GL_RGBA)) - { - return false; - } - } - S32 shadow_detail = RenderShadowDetail; bool ssao = RenderDeferredSSAO; @@ -836,15 +825,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) mRT->deferredScreen.shareDepthBuffer(mRT->screen); - if (samples > 0) - { - if (!mRT->fxaaBuffer.allocate(resX, resY, GL_RGBA)) return false; - } - else - { - mRT->fxaaBuffer.release(); - } - if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0) { //only need mRT->deferredLight for shadows OR ssao OR dof OR fxaa if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false; @@ -856,19 +836,45 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) allocateShadowBuffer(resX, resY); - if (!gCubeSnapshot && RenderScreenSpaceReflections) // hack to not allocate mSceneMap for cube snapshots + if (!gCubeSnapshot) // hack to not re-allocate various targets for cube snapshots { - mSceneMap.allocate(resX, resY, GL_RGB, true); - } + if (RenderUIBuffer) + { + if (!mUIScreen.allocate(resX, resY, GL_RGBA)) + { + return false; + } + } + + if (samples > 0) + { + if (!mFXAAMap.allocate(resX, resY, GL_RGBA)) return false; + } + else + { + mFXAAMap.release(); + } - const bool post_hdr = gSavedSettings.getBOOL("RenderPostProcessingHDR"); - const U32 post_color_fmt = post_hdr ? GL_RGBA16F : GL_RGBA; - mPostMap.allocate(resX, resY, post_color_fmt); + //water reflection texture (always needed as scratch space whether or not transparent water is enabled) + mWaterDis.allocate(resX, resY, GL_RGBA16F, true); - // used to scale down textures - // See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown - mDownResMap.allocate(4, 4, GL_RGBA); + if(RenderScreenSpaceReflections) + { + mSceneMap.allocate(resX, resY, GL_RGB, true); + } + else + { + mSceneMap.release(); + } + + const bool post_hdr = gSavedSettings.getBOOL("RenderPostProcessingHDR"); + const U32 post_color_fmt = post_hdr ? GL_RGBA16F : GL_RGBA; + mPostMap.allocate(resX, resY, post_color_fmt); + // used to scale down textures + // See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown + mDownResMap.allocate(4, 4, GL_RGBA); + } //HACK make screenbuffer allocations start failing after 30 seconds if (gSavedSettings.getBOOL("SimulateFBOFailure")) { @@ -890,7 +896,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY) LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; S32 shadow_detail = RenderShadowDetail; - F32 scale = llmax(0.f, RenderShadowResolutionScale); + F32 scale = gCubeSnapshot ? 1.0f : llmax(0.f, RenderShadowResolutionScale); // Don't scale probe shadow maps U32 sun_shadow_map_width = BlurHappySize(resX, scale); U32 sun_shadow_map_height = BlurHappySize(resY, scale); @@ -1110,6 +1116,10 @@ void LLPipeline::releaseGLBuffers() mPostMap.release(); + mFXAAMap.release(); + + mUIScreen.release(); + mDownResMap.release(); for (U32 i = 0; i < 3; i++) @@ -1117,6 +1127,8 @@ void LLPipeline::releaseGLBuffers() mGlow[i].release(); } + mHeroProbeManager.cleanup(); // release hero probes + releaseScreenBuffers(); gBumpImageList.destroyGL(); @@ -1147,15 +1159,15 @@ void LLPipeline::releaseShadowBuffers() void LLPipeline::releaseScreenBuffers() { - mRT->uiScreen.release(); mRT->screen.release(); - mRT->fxaaBuffer.release(); mRT->deferredScreen.release(); mRT->deferredLight.release(); - mHeroProbeRT.uiScreen.release(); + mAuxillaryRT.screen.release(); + mAuxillaryRT.deferredScreen.release(); + mAuxillaryRT.deferredLight.release(); + mHeroProbeRT.screen.release(); - mHeroProbeRT.fxaaBuffer.release(); mHeroProbeRT.deferredScreen.release(); mHeroProbeRT.deferredLight.release(); } @@ -3580,9 +3592,12 @@ void LLPipeline::postSort(LLCamera &camera) { mSelectedFaces.clear(); + bool tex_index_changed = false; if (!gNonInteractive) { - LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit()); + LLRender::eTexIndex tex_index = sRenderHighlightTextureChannel; + setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit()); + tex_index_changed = sRenderHighlightTextureChannel != tex_index; } // Draw face highlights for selected faces. @@ -3604,6 +3619,24 @@ void LLPipeline::postSort(LLCamera &camera) } } func; LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); + + if (tex_index_changed) + { + // Rebuild geometry for all selected faces with PBR textures + for (const LLFace* face : gPipeline.mSelectedFaces) + { + if (const LLViewerObject* vobj = face->getViewerObject()) + { + if (const LLTextureEntry* tep = vobj->getTE(face->getTEOffset())) + { + if (tep->getGLTFRenderMaterial()) + { + gPipeline.markRebuild(face->getDrawable(), LLDrawable::REBUILD_VOLUME); + } + } + } + } + } } } @@ -3656,28 +3689,31 @@ void render_hud_elements() gUIProgram.unbind(); } -void LLPipeline::renderHighlights() +static inline void bindHighlightProgram(LLGLSLShader& program) { - assertInitialized(); - - // Draw 3D UI elements here (before we clear the Z buffer in POOL_HUD) - // Render highlighted faces. - LLGLSPipelineAlpha gls_pipeline_alpha; - LLColor4 color(1.f, 1.f, 1.f, 0.5f); - disableLights(); - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { - gHighlightProgram.bind(); - gGL.diffuseColor4f(1,1,1,0.5f); + program.bind(); + gGL.diffuseColor4f(1, 1, 1, 0.5f); } +} - if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && !mFaceSelectImagep) - { - mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT); - } +static inline void unbindHighlightProgram(LLGLSLShader& program) +{ + if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0) + { + program.unbind(); + } +} - if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::DIFFUSE_MAP)) +void LLPipeline::renderSelectedFaces(const LLColor4& color) +{ + if (!mFaceSelectImagep) + { + mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT); + } + + if (mFaceSelectImagep) { // Make sure the selection image gets downloaded and decoded mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); @@ -3693,81 +3729,61 @@ void LLPipeline::renderHighlights() facep->renderSelected(mFaceSelectImagep, color); } } +} - if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) - { - // Paint 'em red! - color.setVec(1.f, 0.f, 0.f, 0.5f); - - for (auto facep : mHighlightFaces) - { - facep->renderSelected(LLViewerTexture::sNullImagep, color); - } - } +void LLPipeline::renderHighlights() +{ + assertInitialized(); - // Contains a list of the faces of objects that are physical or - // have touch-handlers. - mHighlightFaces.clear(); + // Draw 3D UI elements here (before we clear the Z buffer in POOL_HUD) + // Render highlighted faces. + LLGLSPipelineAlpha gls_pipeline_alpha; + disableLights(); - if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0) + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) { - gHighlightProgram.unbind(); - } - + bindHighlightProgram(gHighlightProgram); - if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::NORMAL_MAP)) - { - color.setVec(1.0f, 0.5f, 0.5f, 0.5f); - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) + if (sRenderHighlightTextureChannel == LLRender::DIFFUSE_MAP || + sRenderHighlightTextureChannel == LLRender::BASECOLOR_MAP || + sRenderHighlightTextureChannel == LLRender::METALLIC_ROUGHNESS_MAP || + sRenderHighlightTextureChannel == LLRender::GLTF_NORMAL_MAP || + sRenderHighlightTextureChannel == LLRender::EMISSIVE_MAP || + sRenderHighlightTextureChannel == LLRender::NUM_TEXTURE_CHANNELS) { - gHighlightNormalProgram.bind(); - gGL.diffuseColor4f(1,1,1,0.5f); + static const LLColor4 highlight_selected_color(1.f, 1.f, 1.f, 0.5f); + renderSelectedFaces(highlight_selected_color); } - mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - - for (auto facep : mSelectedFaces) + // Paint 'em red! + static const LLColor4 highlight_face_color(1.f, 0.f, 0.f, 0.5f); + for (auto facep : mHighlightFaces) { - if (!facep || facep->getDrawable()->isDead()) - { - LL_ERRS() << "Bad face on selection" << LL_ENDL; - return; - } - - facep->renderSelected(mFaceSelectImagep, color); + facep->renderSelected(LLViewerTexture::sNullImagep, highlight_face_color); } - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) - { - gHighlightNormalProgram.unbind(); - } + unbindHighlightProgram(gHighlightProgram); } - if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::SPECULAR_MAP)) - { - color.setVec(0.0f, 0.3f, 1.0f, 0.8f); - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) - { - gHighlightSpecularProgram.bind(); - gGL.diffuseColor4f(1,1,1,0.5f); - } - - mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); + // Contains a list of the faces of objects that are physical or + // have touch-handlers. + mHighlightFaces.clear(); - for (auto facep : mSelectedFaces) + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) + { + if (sRenderHighlightTextureChannel == LLRender::NORMAL_MAP) { - if (!facep || facep->getDrawable()->isDead()) - { - LL_ERRS() << "Bad face on selection" << LL_ENDL; - return; - } - - facep->renderSelected(mFaceSelectImagep, color); + static const LLColor4 highlight_normal_color(1.0f, 0.5f, 0.5f, 0.5f); + bindHighlightProgram(gHighlightNormalProgram); + renderSelectedFaces(highlight_normal_color); + unbindHighlightProgram(gHighlightNormalProgram); } - - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) + else if (sRenderHighlightTextureChannel == LLRender::SPECULAR_MAP) { - gHighlightSpecularProgram.unbind(); + static const LLColor4 highlight_specular_color(0.0f, 0.3f, 1.0f, 0.8f); + bindHighlightProgram(gHighlightSpecularProgram); + renderSelectedFaces(highlight_specular_color); + unbindHighlightProgram(gHighlightSpecularProgram); } } } @@ -6256,7 +6272,10 @@ bool LLPipeline::getRenderHighlights() // static void LLPipeline::setRenderHighlightTextureChannel(LLRender::eTexIndex channel) { - sRenderHighlightTextureChannel = channel; + if (channel != sRenderHighlightTextureChannel) + { + sRenderHighlightTextureChannel = channel; + } } LLVOPartGroup* LLPipeline::lineSegmentIntersectParticle(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection, @@ -7116,7 +7135,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) { { llassert(!gCubeSnapshot); - bool multisample = RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete(); + bool multisample = RenderFSAASamples > 1 && mFXAAMap.isComplete(); LLGLSLShader* shader = &gGlowCombineProgram; S32 width = dst->getWidth(); @@ -7127,7 +7146,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) { LL_PROFILE_GPU_ZONE("aa"); // bake out texture2D with RGBL for FXAA shader - mRT->fxaaBuffer.bindTarget(); + mFXAAMap.bindTarget(); shader = &gGlowCombineFXAAProgram; shader->bind(); @@ -7147,16 +7166,16 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); shader->unbind(); - mRT->fxaaBuffer.flush(); + mFXAAMap.flush(); dst->bindTarget(); shader = &gFXAAProgram; shader->bind(); - channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mRT->fxaaBuffer.getUsage()); + channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAAMap.getUsage()); if (channel > -1) { - mRT->fxaaBuffer.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR); + mFXAAMap.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR); } gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft; @@ -7166,8 +7185,8 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); - F32 scale_x = (F32)width / mRT->fxaaBuffer.getWidth(); - F32 scale_y = (F32)height / mRT->fxaaBuffer.getHeight(); + F32 scale_x = (F32)width / mFXAAMap.getWidth(); + F32 scale_y = (F32)height / mFXAAMap.getHeight(); shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y); shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y); shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y, @@ -7401,7 +7420,7 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) { // combine result based on alpha dst->bindTarget(); - if (RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete()) + if (RenderFSAASamples > 1 && mFXAAMap.isComplete()) { glViewport(0, 0, dst->getWidth(), dst->getHeight()); } @@ -10661,6 +10680,7 @@ bool LLPipeline::hasAnyRenderType(U32 type, ...) const { if (mRenderTypeEnabled[type]) { + va_end(args); return true; } type = va_arg(args, U32); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 6c79d20149..024303d5f0 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -342,6 +342,7 @@ public: void renderHighlight(const LLViewerObject* obj, F32 fade); void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, bool depth_clamp); + void renderSelectedFaces(const LLColor4& color); void renderHighlights(); void renderDebug(); void renderPhysicsDisplay(); @@ -686,10 +687,7 @@ public: //screen texture LLRenderTarget screen; - LLRenderTarget uiScreen; LLRenderTarget deferredScreen; - LLRenderTarget fxaaBuffer; - LLRenderTarget edgeMap; LLRenderTarget deferredLight; //sun shadow map @@ -725,6 +723,12 @@ public: // tonemapped and gamma corrected render ready for post LLRenderTarget mPostMap; + // FXAA helper target + LLRenderTarget mFXAAMap; + + // render ui to buffer target + LLRenderTarget mUIScreen; + // downres scratch space for GPU downscaling of textures LLRenderTarget mDownResMap; diff --git a/indra/newview/skins/default/xui/en/floater_fast_timers.xml b/indra/newview/skins/default/xui/en/floater_fast_timers.xml index 4dc9876ac8..ae907bcb5f 100644 --- a/indra/newview/skins/default/xui/en/floater_fast_timers.xml +++ b/indra/newview/skins/default/xui/en/floater_fast_timers.xml @@ -73,9 +73,9 @@ name="scroll_vert" orientation="vertical" step_size="16" + doc_pos="0" doc_size="3000" page_size="50" - doc_pos="0" /> </layout_panel> <layout_panel name="timers_panel" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 0dcd4c8c53..563bd82069 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3435,13 +3435,6 @@ function="World.EnvPreset" <menu_item_call.on_click function="Advanced.ClearShaderCache" /> </menu_item_call> - <menu_item_call - enabled="true" - label="Rebuild Terrain" - name="Rebuild Terrain"> - <menu_item_call.on_click - function="Advanced.RebuildTerrain" /> - </menu_item_call> <menu_item_separator /> <menu_item_call enabled="true" @@ -3662,6 +3655,37 @@ function="World.EnvPreset" function="Advanced.ResetInterestLists" /> </menu_item_call> </menu> + <!-- terrain --> + <menu + create_jump_keys="true" + label="Terrain" + name="DevelopTerrain" + tear_off="true"> + <menu_item_call + enabled="true" + label="Rebuild Terrain" + name="Rebuild Terrain"> + <menu_item_call.on_click + function="Advanced.RebuildTerrain" /> + </menu_item_call> + + <menu_item_separator/> + + <menu_item_call + enabled="true" + label="Create Local Paintmap" + name="Create Local Paintmap"> + <menu_item_call.on_click + function="Advanced.TerrainCreateLocalPaintMap" /> + </menu_item_call> + <menu_item_call + enabled="true" + label="Delete Local Paintmap" + name="Delete Local Paintmap"> + <menu_item_call.on_click + function="Advanced.TerrainDeleteLocalPaintMap" /> + </menu_item_call> + </menu> <menu create_jump_keys="true" label="UI" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 2e08f6b3be..e539388735 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2388,6 +2388,26 @@ Unable to upload [FILE] due to the following reason: [REASON] Please try again later. <tag>fail</tag> </notification> + + <notification + icon="alertmodal.tga" + name="CannotUploadSnapshotEmailTooBig" + type="alertmodal"> +Unable to upload snapshot [FILE] due to the following reason: [REASON] + +File might be too big, try reducing resolution, quality or try again later. + <tag>fail</tag> + </notification> + + <notification + icon="alertmodal.tga" + name="CannotUploadSnapshotWebTooBig" + type="alertmodal"> +Unable to upload snapshot. + +File might be too big, try reducing resolution or try again later. + <tag>fail</tag> + </notification> <notification icon="notifytip.tga" @@ -8873,6 +8893,7 @@ New Voice Morphs are available! Voice Morphs are not supported by this viewer. For more information about other voice morph tools, see [[FAQ_URL] this article]. <usetemplate + ignoretext="Warn me about voice morph not being supported" name="okignore" yestext="OK"/> <tag>voice</tag> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml index fb528bf98f..425cbb6f44 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml @@ -69,7 +69,6 @@ sort_ascending="true" width="495" /> <button - enabled_control="FirstSelectedDisabledPopups" follows="top|left" height="23" image_overlay="Arrow_Up" @@ -83,7 +82,6 @@ function="Pref.ClickEnablePopup" /> </button> <button - enabled_control="FirstSelectedEnabledPopups" follows="top|left" height="23" image_overlay="Arrow_Down" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml index 5d93846ce5..44df5354aa 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml @@ -313,7 +313,6 @@ <color_swatch can_apply_immediately="true" color="0 0 0 1" - control_name="NameTagBackground" follows="left|top" height="24" label_height="0" diff --git a/indra/newview/skins/default/xui/en/widgets/slider_bar.xml b/indra/newview/skins/default/xui/en/widgets/slider_bar.xml index 1cfe3d68f9..8c52f06c45 100644 --- a/indra/newview/skins/default/xui/en/widgets/slider_bar.xml +++ b/indra/newview/skins/default/xui/en/widgets/slider_bar.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <!--All horizontal sliders are configured to have no highlighted track. See EXT-5939. --> <slider_bar follows="left|top" - track_color="SliderTrackColor" thumb_outline_color="SliderThumbOutlineColor" thumb_center_color="SliderThumbCenterColor" thumb_image="SliderThumb_Off" diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 24b43192a9..15cec11330 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -582,19 +582,16 @@ class Windows_x86_64_Manifest(ViewerManifest): self.path("vivoxsdk_x64.dll") self.path("ortp_x64.dll") - # OpenSSL - self.path("libcrypto-1_1-x64.dll") - self.path("libssl-1_1-x64.dll") - - # HTTP/2 - self.path("nghttp2.dll") - # BugSplat if self.args.get('bugsplat'): self.path("BsSndRpt64.exe") self.path("BugSplat64.dll") self.path("BugSplatRc64.dll") + if self.args['tracy'] == 'ON': + with self.prefix(src=os.path.join(pkgdir, 'bin')): + self.path("tracy-profiler.exe") + self.path(src="licenses-win32.txt", dst="licenses.txt") self.path("featuretable.txt") self.path("cube.dae") @@ -1009,17 +1006,6 @@ class Darwin_x86_64_Manifest(ViewerManifest): # Need to get the llcommon dll from any of the build directories as well. libfile_parent = self.get_dst_prefix() dylibs=[] - for libfile in ( - "libapr-1.0.dylib", - "libaprutil-1.0.dylib", - "libexpat.1.dylib", - # libnghttp2.dylib is a symlink to - # libnghttp2.major.dylib, which is a symlink to - # libnghttp2.version.dylib. Get all of them. - "libnghttp2.*dylib", - ): - dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile) - # SLVoice executable with self.prefix(src=os.path.join(pkgdir, 'bin', 'release')): self.path("SLVoice") @@ -1454,6 +1440,7 @@ if __name__ == "__main__": dict(name='bugsplat', description="""BugSplat database to which to post crashes, if BugSplat crash reporting is desired""", default=''), dict(name='openal', description="""Indication openal libraries are needed""", default='OFF'), + dict(name='tracy', description="""Indication tracy profiler is enabled""", default='OFF'), ] try: main(extra=extra_arguments) diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 1a31beac31..e0a43b2e08 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -54,15 +54,12 @@ # include "ctype_workaround.h" #endif -#if LL_MSVC -#pragma warning (push) -#pragma warning (disable : 4702) // warning C4702: unreachable code -#endif #include <boost/iostreams/tee.hpp> #include <boost/iostreams/stream.hpp> -#if LL_MSVC -#pragma warning (pop) -#endif +#include <boost/scoped_ptr.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/make_shared.hpp> +#include <boost/foreach.hpp> #include <fstream> diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 48fecb4f22..53bf97a47e 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -28,13 +28,6 @@ #include "llsd.h" #include "llsdutil.h" -/*==========================================================================*| -#ifdef LL_WINDOWS - // non-virtual destructor warning, boost::statechart does this intentionally. - #pragma warning (disable : 4265) -#endif -|*==========================================================================*/ - #include "lllogin.h" #include <boost/bind.hpp> |