diff options
author | Oz Linden <oz@lindenlab.com> | 2012-06-18 22:23:30 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2012-06-18 22:23:30 -0400 |
commit | d7400ae60c0453e111357abfb09d8308adf8b721 (patch) | |
tree | cfbbc175c4df5d0929ad923c5c52489b8d87fb75 | |
parent | d500379cea865e4a6958eee82b5615ace61036c4 (diff) | |
parent | 9cac312f57391792e9fce380c2c38ae4060ae1d7 (diff) |
merge to pathfinding development branch
125 files changed, 14642 insertions, 2254 deletions
diff --git a/BuildParams b/BuildParams index cff51a286b..3cda904a28 100644 --- a/BuildParams +++ b/BuildParams @@ -112,6 +112,17 @@ viewer-mesh.login_channel = "Project Viewer - Mesh" viewer-mesh.viewer_grid = aditi viewer-mesh.email = shining@lists.lindenlab.com +# ======================================== +# viewer-pathfinding +# ======================================== + +viewer-pathfinding.viewer_channel = "Project Viewer - Pathfinding" +viewer-pathfinding.login_channel = "Project Viewer - Pathfinding" +viewer-pathfinding.viewer_grid = agni +viewer-pathfinding.build_debug_release_separately = true +viewer-pathfinding.build_CYGWIN_Debug = false +viewer-pathfinding.build_viewer_update_version_manager = false + # ================ # oz # ================ diff --git a/autobuild.xml b/autobuild.xml index 0e4b81324a..39c09e9d6d 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1095,14 +1095,14 @@ </map> </map> </map> - <key>llconvexdecomposition</key> + <key>llphysicsextensions</key> <map> <key>license</key> - <string>havok</string> + <string>llphysicsextensions</string> <key>license_file</key> - <string>on_file</string> + <string>LICENSES/llphysicsextensions.txt</string> <key>name</key> - <string>llconvexdecomposition</string> + <string>llphysicsextensions</string> <key>platforms</key> <map> <key>darwin</key> @@ -1110,9 +1110,9 @@ <key>archive</key> <map> <key>hash</key> - <string>362654a472ef7368d4c803ae3fb89d95</string> + <string>18aed5e908b5b7de719f51d1b368b54d</string> <key>url</key> - <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/238959/arch/Darwin/installer/llconvexdecomposition-0.1-darwin-20110819.tar.bz2</string> + <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/259057/arch/Darwin/installer/llphysicsextensions-0.1-darwin-20120607.tar.bz2</string> </map> <key>name</key> <string>darwin</string> @@ -1122,9 +1122,9 @@ <key>archive</key> <map> <key>hash</key> - <string>c7801d899daec5338fbe95053255b7e7</string> + <string>4b56219aad02f01324828a3034ef6b2f</string> <key>url</key> - <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/238959/arch/Linux/installer/llconvexdecomposition-0.1-linux-20110819.tar.bz2</string> + <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/259057/arch/Linux/installer/llphysicsextensions-0.1-linux-20120607.tar.bz2</string> </map> <key>name</key> <string>linux</string> @@ -1134,57 +1134,9 @@ <key>archive</key> <map> <key>hash</key> - <string>6ecf2f85f03c5ae87fe45769566a5660</string> + <string>90a5a1e2fd78eaaa84f36dcafe255963</string> <key>url</key> - <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/238959/arch/CYGWIN/installer/llconvexdecomposition-0.1-windows-20110819.tar.bz2</string> - </map> - <key>name</key> - <string>windows</string> - </map> - </map> - </map> - <key>llconvexdecompositionstub</key> - <map> - <key>license</key> - <string>lgpl</string> - <key>license_file</key> - <string>LICENSES/LLConvexDecompositionStubLicense.txt</string> - <key>name</key> - <string>llconvexdecompositionstub</string> - <key>platforms</key> - <map> - <key>darwin</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>a5f53e09f67271fd50f1131ffdda9d27</string> - <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llconvexdecompositionstub/rev/238958/arch/Darwin/installer/llconvexdecompositionstub-0.3-darwin-20110819.tar.bz2</string> - </map> - <key>name</key> - <string>darwin</string> - </map> - <key>linux</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>0006a964f1497f55a5f181b7042d2d22</string> - <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llconvexdecompositionstub/rev/238958/arch/Linux/installer/llconvexdecompositionstub-0.3-linux-20110819.tar.bz2</string> - </map> - <key>name</key> - <string>linux</string> - </map> - <key>windows</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>b859e7e3bb03ebb467f0309f46422995</string> - <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llconvexdecompositionstub/rev/238958/arch/CYGWIN/installer/llconvexdecompositionstub-0.3-windows-20110819.tar.bz2</string> + <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/259057/arch/CYGWIN/installer/llphysicsextensions-0.1-windows-20120607.tar.bz2</string> </map> <key>name</key> <string>windows</string> diff --git a/etc/message.xml b/etc/message.xml index 3445975545..7dcf99f307 100644 --- a/etc/message.xml +++ b/etc/message.xml @@ -546,8 +546,24 @@ <key>trusted-sender</key> <boolean>true</boolean> </map> - - <!-- UDPDeprecated Messages --> + + <key>NavMeshStatusUpdate</key> + <map> + <key>flavor</key> + <string>llsd</string> + <key>trusted-sender</key> + <boolean>true</boolean> + </map> + + <key>AgentPreferencesUpdate</key> + <map> + <key>flavor</key> + <string>llsd</string> + <key>trusted-sender</key> + <boolean>true</boolean> + </map> + + <!-- UDPDeprecated Messages --> <key>ScriptRunningReply</key> <map> <key>flavor</key> diff --git a/hack-to-rebuild-team-city.txt b/hack-to-rebuild-team-city.txt new file mode 100644 index 0000000000..5c788c060a --- /dev/null +++ b/hack-to-rebuild-team-city.txt @@ -0,0 +1 @@ +Thu Mar 15 08:46:27 PDT 2012 diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 279d577a27..7fccf3327f 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -42,7 +42,6 @@ set(cmake_SOURCE_FILES LLAudio.cmake LLCharacter.cmake LLCommon.cmake - LLConvexDecomposition.cmake LLCrashLogger.cmake LLDatabase.cmake LLImage.cmake @@ -53,6 +52,7 @@ set(cmake_SOURCE_FILES LLMessage.cmake LLPlugin.cmake LLPrimitive.cmake + LLPhysicsExtensions.cmake LLRender.cmake LLScene.cmake LLTestCommand.cmake diff --git a/indra/cmake/LLConvexDecomposition.cmake b/indra/cmake/LLConvexDecomposition.cmake deleted file mode 100644 index 8e44504782..0000000000 --- a/indra/cmake/LLConvexDecomposition.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -set(LLCONVEXDECOMP_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) - -if (INSTALL_PROPRIETARY AND NOT STANDALONE) - use_prebuilt_binary(llconvexdecomposition) - set(LLCONVEXDECOMP_LIBRARY llconvexdecomposition) -else (INSTALL_PROPRIETARY AND NOT STANDALONE) - use_prebuilt_binary(llconvexdecompositionstub) - set(LLCONVEXDECOMP_LIBRARY llconvexdecompositionstub) -endif (INSTALL_PROPRIETARY AND NOT STANDALONE) diff --git a/indra/cmake/LLPhysicsExtensions.cmake b/indra/cmake/LLPhysicsExtensions.cmake new file mode 100644 index 0000000000..73d5dd59cf --- /dev/null +++ b/indra/cmake/LLPhysicsExtensions.cmake @@ -0,0 +1,29 @@ +# -*- cmake -*- +include(Prebuilt) + +if (INSTALL_PROPRIETARY AND NOT STANDALONE) + use_prebuilt_binary(llphysicsextensions) + set(LLPHYSICS_EXTENSIONS_LIB_NAME llphysicsextensions) +else (INSTALL_PROPRIETARY AND NOT STANDALONE) + use_prebuilt_binary(llphysicsextensionsstub) + set(LLPHYSICS_EXTENSIONS_LIB_NAME llphysicsextensionsstub) +endif (INSTALL_PROPRIETARY AND NOT STANDALONE) + +set(LLPHYSICS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/lib/include) + +set(LLPHYSICS_DEBUG_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug) +set(LLPHYSICS_RELEASE_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release) + +find_library(LL_PHYSICS_DEBUG_LIB ${LLPHYSICS_EXTENSIONS_LIB_NAME} PATHS ${LLPHYSICS_DEBUG_LIBRARY_PATH}) +find_library(LL_PHYSICS_RELEASE_LIB ${LLPHYSICS_EXTENSIONS_LIB_NAME} PATHS ${LLPHYSICS_RELEASE_LIBRARY_PATH}) + +set(LLPHYSICS_LIBRARIES + + debug ${LL_PHYSICS_DEBUG_LIB} + optimized ${LL_PHYSICS_RELEASE_LIB} +) + +if (LINUX) + list(INSERT LLPHYSICS_LIBRARIES 0 -Wl,--start-group) + list(APPEND LLPHYSICS_LIBRARIES -Wl,--end-group) +endif (LINUX) diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp index e987c397bd..0367e6e622 100644 --- a/indra/llcommon/llcursortypes.cpp +++ b/indra/llcommon/llcursortypes.cpp @@ -69,6 +69,8 @@ ECursorType getCursorFromString(const std::string& cursor_string) cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT; cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; + cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING; + cursor_string_table["UI_CURSOR_TOOLNO"] = UI_CURSOR_TOOLNO; } std::map<std::string,U32>::const_iterator iter = cursor_string_table.find(cursor_string); diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h index bacb0a80ba..4662e90975 100644 --- a/indra/llcommon/llcursortypes.h +++ b/indra/llcommon/llcursortypes.h @@ -65,6 +65,8 @@ enum ECursorType { UI_CURSOR_TOOLSIT, UI_CURSOR_TOOLBUY, UI_CURSOR_TOOLOPEN, + UI_CURSOR_TOOLPATHFINDING, + UI_CURSOR_TOOLNO, UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) }; diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index b3e604f8e8..a72e9a4892 100644 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -143,9 +143,13 @@ namespace LLError CallSite(ELevel, const char* file, int line, const std::type_info& class_info, const char* function, const char* broadTag, const char* narrowTag, bool printOnce); +#ifdef LL_LIBRARY_INCLUDE + bool shouldLog(); +#else // LL_LIBRARY_INCLUDE bool shouldLog() { return mCached ? mShouldLog : Log::shouldLog(*this); } // this member function needs to be in-line for efficiency +#endif // LL_LIBRARY_INCLUDE void invalidate(); diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index affa040602..88c09c8dca 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -140,6 +140,10 @@ public: } protected: +#ifdef LL_LIBRARY_INCLUDE + void ref(); + void unref(); +#else void ref() { if (mPointer) @@ -162,7 +166,7 @@ protected: } } } - +#endif protected: Type* mPointer; }; diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index b419101b7e..7f4f670ed0 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -55,6 +55,10 @@ static const char LEGACY_NON_HEADER[] = "<llsd>"; const std::string LLSD_BINARY_HEADER("LLSD/Binary"); const std::string LLSD_XML_HEADER("LLSD/XML"); +//used to deflate a gzipped asset (currently used for navmeshes) +#define windowBits 15 +#define ENABLE_ZLIB_GZIP 32 + /** * LLSDSerialize */ @@ -2096,7 +2100,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) strm.next_in = in; S32 ret = inflateInit(&strm); - + do { strm.avail_out = CHUNK; @@ -2159,12 +2163,87 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) llwarns << "Failed to unzip LLSD block" << llendl; free(result); return false; - } + } } free(result); return true; } +//This unzip function will only work with a gzip header and trailer - while the contents +//of the actual compressed data is the same for either format (gzip vs zlib ), the headers +//and trailers are different for the formats. +U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size ) +{ + U8* result = NULL; + U32 cur_size = 0; + z_stream strm; + + const U32 CHUNK = 0x4000; + U8 *in = new U8[size]; + is.read((char*) in, size); + + U8 out[CHUNK]; + + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + strm.avail_in = size; + strm.next_in = in; + + + S32 ret = inflateInit2(&strm, windowBits | ENABLE_ZLIB_GZIP ); + do + { + strm.avail_out = CHUNK; + strm.next_out = out; + ret = inflate(&strm, Z_NO_FLUSH); + if (ret == Z_STREAM_ERROR) + { + inflateEnd(&strm); + free(result); + delete [] in; + valid = false; + } + + switch (ret) + { + case Z_NEED_DICT: + ret = Z_DATA_ERROR; + case Z_DATA_ERROR: + case Z_MEM_ERROR: + inflateEnd(&strm); + free(result); + delete [] in; + valid = false; + break; + } + + U32 have = CHUNK-strm.avail_out; + + result = (U8*) realloc(result, cur_size + have); + memcpy(result+cur_size, out, have); + cur_size += have; + + } while (ret == Z_OK); + + inflateEnd(&strm); + delete [] in; + + if (ret != Z_STREAM_END) + { + free(result); + valid = false; + return NULL; + } + + //result now points to the decompressed LLSD block + { + outsize= cur_size; + valid = true; + } + + return result; +} diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 99a3ea3cd4..86e3fc864c 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -793,5 +793,5 @@ public: //dirty little zip functions -- yell at davep LL_COMMON_API std::string zip_llsd(LLSD& data); LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size); - +LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size); #endif // LL_LLSDSERIALIZE_H diff --git a/indra/llcommon/llstatenums.h b/indra/llcommon/llstatenums.h index 9033d8eb43..81c4085d16 100644 --- a/indra/llcommon/llstatenums.h +++ b/indra/llcommon/llstatenums.h @@ -28,41 +28,48 @@ enum { - LL_SIM_STAT_TIME_DILATION, // 0 - LL_SIM_STAT_FPS, - LL_SIM_STAT_PHYSFPS, - LL_SIM_STAT_AGENTUPS, - LL_SIM_STAT_FRAMEMS, - LL_SIM_STAT_NETMS, // 5 - LL_SIM_STAT_SIMOTHERMS, - LL_SIM_STAT_SIMPHYSICSMS, - LL_SIM_STAT_AGENTMS, - LL_SIM_STAT_IMAGESMS, - LL_SIM_STAT_SCRIPTMS, // 10 - LL_SIM_STAT_NUMTASKS, - LL_SIM_STAT_NUMTASKSACTIVE, - LL_SIM_STAT_NUMAGENTMAIN, - LL_SIM_STAT_NUMAGENTCHILD, - LL_SIM_STAT_NUMSCRIPTSACTIVE, // 15 - LL_SIM_STAT_LSLIPS, - LL_SIM_STAT_INPPS, - LL_SIM_STAT_OUTPPS, - LL_SIM_STAT_PENDING_DOWNLOADS, - LL_SIM_STAT_PENDING_UPLOADS, // 20 - LL_SIM_STAT_VIRTUAL_SIZE_KB, - LL_SIM_STAT_RESIDENT_SIZE_KB, - LL_SIM_STAT_PENDING_LOCAL_UPLOADS, - LL_SIM_STAT_TOTAL_UNACKED_BYTES, - LL_SIM_STAT_PHYSICS_PINNED_TASKS, // 25 - LL_SIM_STAT_PHYSICS_LOD_TASKS, - LL_SIM_STAT_SIMPHYSICSSTEPMS, - LL_SIM_STAT_SIMPHYSICSSHAPEMS, - LL_SIM_STAT_SIMPHYSICSOTHERMS, - LL_SIM_STAT_SIMPHYSICSMEMORY, // 30 - LL_SIM_STAT_SCRIPT_EPS, - LL_SIM_STAT_SIMSPARETIME, - LL_SIM_STAT_SIMSLEEPTIME, - LL_SIM_STAT_IOPUMPTIME, + LL_SIM_STAT_TIME_DILATION = 0, + LL_SIM_STAT_FPS = 1, + LL_SIM_STAT_PHYSFPS = 2, + LL_SIM_STAT_AGENTUPS = 3, + LL_SIM_STAT_FRAMEMS = 4, + LL_SIM_STAT_NETMS = 5, + LL_SIM_STAT_SIMOTHERMS = 6, + LL_SIM_STAT_SIMPHYSICSMS = 7, + LL_SIM_STAT_AGENTMS = 8, + LL_SIM_STAT_IMAGESMS = 9, + LL_SIM_STAT_SCRIPTMS = 10, + LL_SIM_STAT_NUMTASKS = 11, + LL_SIM_STAT_NUMTASKSACTIVE = 12, + LL_SIM_STAT_NUMAGENTMAIN = 13, + LL_SIM_STAT_NUMAGENTCHILD = 14, + LL_SIM_STAT_NUMSCRIPTSACTIVE = 15, + LL_SIM_STAT_LSLIPS = 16, + LL_SIM_STAT_INPPS = 17, + LL_SIM_STAT_OUTPPS = 18, + LL_SIM_STAT_PENDING_DOWNLOADS = 19, + LL_SIM_STAT_PENDING_UPLOADS = 20, + LL_SIM_STAT_VIRTUAL_SIZE_KB = 21, + LL_SIM_STAT_RESIDENT_SIZE_KB = 22, + LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23, + LL_SIM_STAT_TOTAL_UNACKED_BYTES = 24, + LL_SIM_STAT_PHYSICS_PINNED_TASKS = 25, + LL_SIM_STAT_PHYSICS_LOD_TASKS = 26, + LL_SIM_STAT_SIMPHYSICSSTEPMS = 27, + LL_SIM_STAT_SIMPHYSICSSHAPEMS = 28, + LL_SIM_STAT_SIMPHYSICSOTHERMS = 29, + LL_SIM_STAT_SIMPHYSICSMEMORY = 30, + LL_SIM_STAT_SCRIPT_EPS = 31, + LL_SIM_STAT_SIMSPARETIME = 32, + LL_SIM_STAT_SIMSLEEPTIME = 33, + LL_SIM_STAT_IOPUMPTIME = 34, + LL_SIM_STAT_PCTSCRIPTSRUN = 35, + LL_SIM_STAT_REGION_IDLE = 36, // dataserver only + LL_SIM_STAT_REGION_IDLE_POSSIBLE = 37, // dataserver only + LL_SIM_STAT_SIMAISTEPTIMEMS = 38, + LL_SIM_STAT_SKIPPEDAISILSTEPS_PS = 39, + LL_SIM_STAT_PCTSTEPPEDCHARACTERS = 40 + }; #endif diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 5d452ac4e4..db8c9c85ab 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -922,3 +922,174 @@ LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const } return result; } + +// Construct +LLUUID::LLUUID() +{ + setNull(); +} + + +// Faster than copying from memory + void LLUUID::setNull() +{ + U32 *word = (U32 *)mData; + word[0] = 0; + word[1] = 0; + word[2] = 0; + word[3] = 0; +} + + +// Compare + bool LLUUID::operator==(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary & to avoid branching + return + (tmp[0] == rhstmp[0]) & + (tmp[1] == rhstmp[1]) & + (tmp[2] == rhstmp[2]) & + (tmp[3] == rhstmp[3]); +} + + + bool LLUUID::operator!=(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary | to avoid branching + return + (tmp[0] != rhstmp[0]) | + (tmp[1] != rhstmp[1]) | + (tmp[2] != rhstmp[2]) | + (tmp[3] != rhstmp[3]); +} + +/* +// JC: This is dangerous. It allows UUIDs to be cast automatically +// to integers, among other things. Use isNull() or notNull(). + LLUUID::operator bool() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} +*/ + + BOOL LLUUID::notNull() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} + +// Faster than == LLUUID::null because doesn't require +// as much memory access. + BOOL LLUUID::isNull() const +{ + U32 *word = (U32 *)mData; + // If all bits are zero, return !0 == TRUE + return !(word[0] | word[1] | word[2] | word[3]); +} + +// Copy constructor + LLUUID::LLUUID(const LLUUID& rhs) +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; +} + + LLUUID::~LLUUID() +{ +} + +// Assignment + LLUUID& LLUUID::operator=(const LLUUID& rhs) +{ + // No need to check the case where this==&rhs. The branch is slower than the write. + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; + + return *this; +} + + + LLUUID::LLUUID(const char *in_string) +{ + if (!in_string || in_string[0] == 0) + { + setNull(); + return; + } + + set(in_string); +} + + LLUUID::LLUUID(const std::string& in_string) +{ + if (in_string.empty()) + { + setNull(); + return; + } + + set(in_string); +} + +// IW: DON'T "optimize" these w/ U32s or you'll scoogie the sort order +// IW: this will make me very sad + bool LLUUID::operator<(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] < rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] < rhs.mData[UUID_BYTES - 1]); +} + + bool LLUUID::operator>(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] > rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] > rhs.mData[UUID_BYTES - 1]); +} + + U16 LLUUID::getCRC16() const +{ + // A UUID is 16 bytes, or 8 shorts. + U16 *short_data = (U16*)mData; + U16 out = 0; + out += short_data[0]; + out += short_data[1]; + out += short_data[2]; + out += short_data[3]; + out += short_data[4]; + out += short_data[5]; + out += short_data[6]; + out += short_data[7]; + return out; +} + + U32 LLUUID::getCRC32() const +{ + U32 *tmp = (U32*)mData; + return tmp[0] + tmp[1] + tmp[2] + tmp[3]; +} diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 726be4a82d..0b9e7d0cd0 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -129,177 +129,6 @@ public: typedef std::vector<LLUUID> uuid_vec_t; -// Construct -inline LLUUID::LLUUID() -{ - setNull(); -} - - -// Faster than copying from memory -inline void LLUUID::setNull() -{ - U32 *word = (U32 *)mData; - word[0] = 0; - word[1] = 0; - word[2] = 0; - word[3] = 0; -} - - -// Compare -inline bool LLUUID::operator==(const LLUUID& rhs) const -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary & to avoid branching - return - (tmp[0] == rhstmp[0]) & - (tmp[1] == rhstmp[1]) & - (tmp[2] == rhstmp[2]) & - (tmp[3] == rhstmp[3]); -} - - -inline bool LLUUID::operator!=(const LLUUID& rhs) const -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary | to avoid branching - return - (tmp[0] != rhstmp[0]) | - (tmp[1] != rhstmp[1]) | - (tmp[2] != rhstmp[2]) | - (tmp[3] != rhstmp[3]); -} - -/* -// JC: This is dangerous. It allows UUIDs to be cast automatically -// to integers, among other things. Use isNull() or notNull(). -inline LLUUID::operator bool() const -{ - U32 *word = (U32 *)mData; - return (word[0] | word[1] | word[2] | word[3]) > 0; -} -*/ - -inline BOOL LLUUID::notNull() const -{ - U32 *word = (U32 *)mData; - return (word[0] | word[1] | word[2] | word[3]) > 0; -} - -// Faster than == LLUUID::null because doesn't require -// as much memory access. -inline BOOL LLUUID::isNull() const -{ - U32 *word = (U32 *)mData; - // If all bits are zero, return !0 == TRUE - return !(word[0] | word[1] | word[2] | word[3]); -} - -// Copy constructor -inline LLUUID::LLUUID(const LLUUID& rhs) -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; -} - -inline LLUUID::~LLUUID() -{ -} - -// Assignment -inline LLUUID& LLUUID::operator=(const LLUUID& rhs) -{ - // No need to check the case where this==&rhs. The branch is slower than the write. - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; - - return *this; -} - - -inline LLUUID::LLUUID(const char *in_string) -{ - if (!in_string || in_string[0] == 0) - { - setNull(); - return; - } - - set(in_string); -} - -inline LLUUID::LLUUID(const std::string& in_string) -{ - if (in_string.empty()) - { - setNull(); - return; - } - - set(in_string); -} - -// IW: DON'T "optimize" these w/ U32s or you'll scoogie the sort order -// IW: this will make me very sad -inline bool LLUUID::operator<(const LLUUID &rhs) const -{ - U32 i; - for( i = 0; i < (UUID_BYTES - 1); i++ ) - { - if( mData[i] != rhs.mData[i] ) - { - return (mData[i] < rhs.mData[i]); - } - } - return (mData[UUID_BYTES - 1] < rhs.mData[UUID_BYTES - 1]); -} - -inline bool LLUUID::operator>(const LLUUID &rhs) const -{ - U32 i; - for( i = 0; i < (UUID_BYTES - 1); i++ ) - { - if( mData[i] != rhs.mData[i] ) - { - return (mData[i] > rhs.mData[i]); - } - } - return (mData[UUID_BYTES - 1] > rhs.mData[UUID_BYTES - 1]); -} - -inline U16 LLUUID::getCRC16() const -{ - // A UUID is 16 bytes, or 8 shorts. - U16 *short_data = (U16*)mData; - U16 out = 0; - out += short_data[0]; - out += short_data[1]; - out += short_data[2]; - out += short_data[3]; - out += short_data[4]; - out += short_data[5]; - out += short_data[6]; - out += short_data[7]; - return out; -} - -inline U32 LLUUID::getCRC32() const -{ - U32 *tmp = (U32*)mData; - return tmp[0] + tmp[1] + tmp[2] + tmp[3]; -} - // Helper structure for ordering lluuids in stl containers. // eg: std::map<LLUUID, LLWidget*, lluuid_less> widget_map; @@ -329,3 +158,5 @@ public: }; #endif + + diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index e71fb96540..d7658862da 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -943,7 +943,6 @@ char const* const _PREHASH_SysGPU = LLMessageStringTable::getInstance()->getStri char const* const _PREHASH_AvatarInterestsReply = LLMessageStringTable::getInstance()->getString("AvatarInterestsReply"); char const* const _PREHASH_StartLure = LLMessageStringTable::getInstance()->getString("StartLure"); char const* const _PREHASH_SysRAM = LLMessageStringTable::getInstance()->getString("SysRAM"); -char const* const _PREHASH_ObjectPosition = LLMessageStringTable::getInstance()->getString("ObjectPosition"); char const* const _PREHASH_SitPosition = LLMessageStringTable::getInstance()->getString("SitPosition"); char const* const _PREHASH_StartTime = LLMessageStringTable::getInstance()->getString("StartTime"); char const* const _PREHASH_BornOn = LLMessageStringTable::getInstance()->getString("BornOn"); @@ -999,7 +998,6 @@ char const* const _PREHASH_SnapshotID = LLMessageStringTable::getInstance()->get char const* const _PREHASH_Aspect = LLMessageStringTable::getInstance()->getString("Aspect"); char const* const _PREHASH_ParamSize = LLMessageStringTable::getInstance()->getString("ParamSize"); char const* const _PREHASH_VoteCast = LLMessageStringTable::getInstance()->getString("VoteCast"); -char const* const _PREHASH_CastsShadows = LLMessageStringTable::getInstance()->getString("CastsShadows"); char const* const _PREHASH_EveryoneMask = LLMessageStringTable::getInstance()->getString("EveryoneMask"); char const* const _PREHASH_ObjectSpinUpdate = LLMessageStringTable::getInstance()->getString("ObjectSpinUpdate"); char const* const _PREHASH_MaturePublish = LLMessageStringTable::getInstance()->getString("MaturePublish"); @@ -1048,7 +1046,6 @@ char const* const _PREHASH_SimIP = LLMessageStringTable::getInstance()->getStrin char const* const _PREHASH_GodID = LLMessageStringTable::getInstance()->getString("GodID"); char const* const _PREHASH_TeleportMinPrice = LLMessageStringTable::getInstance()->getString("TeleportMinPrice"); char const* const _PREHASH_VoteItem = LLMessageStringTable::getInstance()->getString("VoteItem"); -char const* const _PREHASH_ObjectRotation = LLMessageStringTable::getInstance()->getString("ObjectRotation"); char const* const _PREHASH_SitRotation = LLMessageStringTable::getInstance()->getString("SitRotation"); char const* const _PREHASH_SnapSelection = LLMessageStringTable::getInstance()->getString("SnapSelection"); char const* const _PREHASH_SoundTrigger = LLMessageStringTable::getInstance()->getString("SoundTrigger"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index dd2c2dbd64..da2b613f53 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -943,7 +943,6 @@ extern char const* const _PREHASH_SysGPU; extern char const* const _PREHASH_AvatarInterestsReply; extern char const* const _PREHASH_StartLure; extern char const* const _PREHASH_SysRAM; -extern char const* const _PREHASH_ObjectPosition; extern char const* const _PREHASH_SitPosition; extern char const* const _PREHASH_StartTime; extern char const* const _PREHASH_BornOn; @@ -999,7 +998,6 @@ extern char const* const _PREHASH_SnapshotID; extern char const* const _PREHASH_Aspect; extern char const* const _PREHASH_ParamSize; extern char const* const _PREHASH_VoteCast; -extern char const* const _PREHASH_CastsShadows; extern char const* const _PREHASH_EveryoneMask; extern char const* const _PREHASH_ObjectSpinUpdate; extern char const* const _PREHASH_MaturePublish; @@ -1048,7 +1046,6 @@ extern char const* const _PREHASH_SimIP; extern char const* const _PREHASH_GodID; extern char const* const _PREHASH_TeleportMinPrice; extern char const* const _PREHASH_VoteItem; -extern char const* const _PREHASH_ObjectRotation; extern char const* const _PREHASH_SitRotation; extern char const* const _PREHASH_SnapSelection; extern char const* const _PREHASH_SoundTrigger; diff --git a/indra/llprimitive/object_flags.h b/indra/llprimitive/object_flags.h index 94c559d757..b06a5ad4e3 100644 --- a/indra/llprimitive/object_flags.h +++ b/indra/llprimitive/object_flags.h @@ -28,43 +28,39 @@ #define LL_OBJECT_FLAGS_H // downstream flags from sim->viewer -const U32 FLAGS_USE_PHYSICS = 0x00000001; -const U32 FLAGS_CREATE_SELECTED = 0x00000002; -const U32 FLAGS_OBJECT_MODIFY = 0x00000004; -const U32 FLAGS_OBJECT_COPY = 0x00000008; -const U32 FLAGS_OBJECT_ANY_OWNER = 0x00000010; -const U32 FLAGS_OBJECT_YOU_OWNER = 0x00000020; -const U32 FLAGS_SCRIPTED = 0x00000040; -const U32 FLAGS_HANDLE_TOUCH = 0x00000080; -const U32 FLAGS_OBJECT_MOVE = 0x00000100; -const U32 FLAGS_TAKES_MONEY = 0x00000200; -const U32 FLAGS_PHANTOM = 0x00000400; -const U32 FLAGS_INVENTORY_EMPTY = 0x00000800; - -const U32 FLAGS_JOINT_HINGE = 0x00001000; -const U32 FLAGS_JOINT_P2P = 0x00002000; -const U32 FLAGS_JOINT_LP2P = 0x00004000; -// const U32 FLAGS_JOINT_WHEEL = 0x00008000; -const U32 FLAGS_INCLUDE_IN_SEARCH = 0x00008000; - -const U32 FLAGS_ALLOW_INVENTORY_DROP = 0x00010000; -const U32 FLAGS_OBJECT_TRANSFER = 0x00020000; -const U32 FLAGS_OBJECT_GROUP_OWNED = 0x00040000; -//const U32 FLAGS_OBJECT_YOU_OFFICER = 0x00080000; - -const U32 FLAGS_CAMERA_DECOUPLED = 0x00100000; -const U32 FLAGS_ANIM_SOURCE = 0x00200000; -const U32 FLAGS_CAMERA_SOURCE = 0x00400000; - -const U32 FLAGS_CAST_SHADOWS = 0x00800000; - -const U32 FLAGS_OBJECT_OWNER_MODIFY = 0x10000000; - -const U32 FLAGS_TEMPORARY_ON_REZ = 0x20000000; -const U32 FLAGS_TEMPORARY = 0x40000000; -const U32 FLAGS_ZLIB_COMPRESSED = 0x80000000; - -const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE; +const U32 FLAGS_USE_PHYSICS = (1U << 0); +const U32 FLAGS_CREATE_SELECTED = (1U << 1); +const U32 FLAGS_OBJECT_MODIFY = (1U << 2); +const U32 FLAGS_OBJECT_COPY = (1U << 3); +const U32 FLAGS_OBJECT_ANY_OWNER = (1U << 4); +const U32 FLAGS_OBJECT_YOU_OWNER = (1U << 5); +const U32 FLAGS_SCRIPTED = (1U << 6); +const U32 FLAGS_HANDLE_TOUCH = (1U << 7); +const U32 FLAGS_OBJECT_MOVE = (1U << 8); +const U32 FLAGS_TAKES_MONEY = (1U << 9); +const U32 FLAGS_PHANTOM = (1U << 10); +const U32 FLAGS_INVENTORY_EMPTY = (1U << 11); +const U32 FLAGS_OBJECT_PERMANENT = (1U << 12); +const U32 FLAGS_CHARACTER = (1U << 13); +//const U32 FLAGS_UNUSED_000 = (1U << 14); // was FLAGS_JOINT_LP2P +const U32 FLAGS_INCLUDE_IN_SEARCH = (1U << 15); +const U32 FLAGS_ALLOW_INVENTORY_DROP = (1U << 16); +const U32 FLAGS_OBJECT_TRANSFER = (1U << 17); +const U32 FLAGS_OBJECT_GROUP_OWNED = (1U << 18); +//const U32 FLAGS_UNUSED_001 = (1U << 19); // was FLAGS_OBJECT_YOU_OFFICER +const U32 FLAGS_CAMERA_DECOUPLED = (1U << 20); +const U32 FLAGS_ANIM_SOURCE = (1U << 21); +const U32 FLAGS_CAMERA_SOURCE = (1U << 22); +//const U32 FLAGS_UNUSED_002 = (1U << 23); // was FLAGS_CAST_SHADOWS +//const U32 FLAGS_UNUSED_003 = (1U << 24); +//const U32 FLAGS_UNUSED_004 = (1U << 25); +//const U32 FLAGS_UNUSED_005 = (1U << 26); +//const U32 FLAGS_UNUSED_006 = (1U << 27); +const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28); +const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29); +//const U32 FLAGS_UNUSED_007 = (1U << 30); // was FLAGS_TEMPORARY +//const U32 FLAGS_UNUSED_008 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED +const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE; typedef enum e_havok_joint_type { @@ -77,4 +73,3 @@ typedef enum e_havok_joint_type } EHavokJointType; #endif - diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 5c13df9f81..516af93316 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -36,6 +36,7 @@ set(llrender_SOURCE_FILES llglslshader.cpp llimagegl.cpp llpostprocess.cpp + llrendernavprim.cpp llrendersphere.cpp llshadermgr.cpp lltexture.cpp @@ -59,6 +60,7 @@ set(llrender_HEADER_FILES llimagegl.h llpostprocess.h llrender.h + llrendernavprim.h llrendersphere.h llshadermgr.h lltexture.h diff --git a/indra/llrender/llrendernavprim.cpp b/indra/llrender/llrendernavprim.cpp new file mode 100644 index 0000000000..c24a09028f --- /dev/null +++ b/indra/llrender/llrendernavprim.cpp @@ -0,0 +1,96 @@ +/** + * @file LLRenderNavPrim.cpp + * @brief Renderable primitives used by the pathing library + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "linden_common.h" +#include "llrendernavprim.h" +#include "llerror.h" +#include "llglheaders.h" +#include "llvertexbuffer.h" +#include "llglslshader.h" + +//============================================================================= +LLRenderNavPrim gRenderNav; +//============================================================================= +void LLRenderNavPrim::renderLLSegment( const LLVector3& start, const LLVector3& end, const LLColor4U& color ) const +{ + LLColor4 colorA( color ); + gGL.color3fv( colorA.mV ); + + gGL.begin(LLRender::LINES); + { + gGL.vertex3fv( start.mV ); + gGL.vertex3fv( end.mV ); + } + gGL.end(); +} +//============================================================================= +void LLRenderNavPrim::renderTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, int color ) const +{ + LLColor4 colorA( color ); + colorA*=1.25f; + gGL.color4fv( colorA.mV ); + gGL.begin(LLRender::TRIANGLES); + { + gGL.vertex3fv( a.mV ); + gGL.vertex3fv( b.mV ); + gGL.vertex3fv( c.mV ); + } + gGL.end(); +} +//============================================================================= +void LLRenderNavPrim::renderLLTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, const LLColor4U& color ) const +{ + LLColor4 cV(color); + gGL.color4fv( cV.mV ); + gGL.begin(LLRender::TRIANGLES); + { + gGL.vertex3fv( a.mV ); + gGL.vertex3fv( b.mV ); + gGL.vertex3fv( c.mV ); + } + gGL.end(); +} +//============================================================================= +void LLRenderNavPrim::renderNavMeshVB( U32 mode, LLVertexBuffer* pVBO, int vertCnt ) +{ + pVBO->setBuffer( LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL ); + pVBO->drawArrays( mode, 0, vertCnt ); +} +//============================================================================= +void LLRenderNavPrim::renderStar( const LLVector3& center, const float scale, const LLColor4U& color ) const +{ + for (int k=0; k<3; k++) + { + LLVector3 star, pt1, pt2; + star = LLVector3( 0.0f,0.0f,0.0f); + star[k] = 0.5f; + pt1 = center + star; + pt2 = center - star; + renderLLSegment( pt1, pt2, color ); + } +} +//============================================================================= diff --git a/indra/llrender/llrendernavprim.h b/indra/llrender/llrendernavprim.h new file mode 100644 index 0000000000..eb45e259d2 --- /dev/null +++ b/indra/llrender/llrendernavprim.h @@ -0,0 +1,59 @@ +/** + * @file LLRenderNavPrim.h + * @brief + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_RENDER_NAVPRIM_H +#define LL_RENDER_NAVPRIM_H + +#include "llmath.h" +#include "v3math.h" +#include "v4math.h" +#include "m3math.h" +#include "m4math.h" +#include "v4color.h" +#include "llgl.h" + + +class LLRenderNavPrim +{ +public: + //Draw a line + void renderLLSegment( const LLVector3& start, const LLVector3& end, const LLColor4U& color ) const; + //Draw simple tri + void renderTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, int color ) const; + //Draw simple tri + void renderLLTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, const LLColor4U& color ) const; + //Draw the contents of vertex buffer + void renderNavMeshVB( U32 mode, LLVertexBuffer* pVBO, int vertCnt ); + //Draw a star + void renderStar( const LLVector3& center, const float scale, const LLColor4U& color ) const; + //Flush the device + void flushDevice() { gGL.flush(); } +private: +}; + +extern LLRenderNavPrim gRenderNav; + +#endif diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 8aa548b974..83fa6da863 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1477,6 +1477,10 @@ bool LLNotifications::loadTemplates() { replaceFormText(notification.form_ref.form, "$canceltext", notification.form_ref.form_template.cancel_text); } + if(notification.form_ref.form_template.help_text.isProvided()) + { + replaceFormText(notification.form_ref.form, "$helptext", notification.form_ref.form_template.help_text); + } if(notification.form_ref.form_template.ignore_text.isProvided()) { replaceFormText(notification.form_ref.form, "$ignoretext", notification.form_ref.form_template.ignore_text); diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index fb50c9c123..56b18eb81a 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -121,6 +121,7 @@ struct LLNotificationTemplate Optional<std::string> yes_text, no_text, cancel_text, + help_text, ignore_text; TemplateRef() @@ -128,6 +129,7 @@ struct LLNotificationTemplate yes_text("yestext"), no_text("notext"), cancel_text("canceltext"), + help_text("helptext"), ignore_text("ignoretext") {} }; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index b3e1b63db5..802914e25b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -389,6 +389,22 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const return ret; } +S32 LLScrollListCtrl::getNumSelected() const +{ + S32 numSelected = 0; + + for(item_list::const_iterator iter = mItemList.begin(); iter != mItemList.end(); ++iter) + { + LLScrollListItem* item = *iter; + if (item->getSelected()) + { + ++numSelected; + } + } + + return numSelected; +} + S32 LLScrollListCtrl::getFirstSelectedIndex() const { S32 CurSelectedIndex = 0; diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index ae8aea9245..44d9635838 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -257,6 +257,7 @@ public: LLScrollListItem* getFirstSelected() const; virtual S32 getFirstSelectedIndex() const; std::vector<LLScrollListItem*> getAllSelected() const; + S32 getNumSelected() const; LLScrollListItem* getLastSelectedItem() const { return mLastSelected; } // iterate over all items diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index bc85acbf45..a332bfddc4 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1697,6 +1697,8 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT")); mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY")); mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN")); + mCursor[ UI_CURSOR_TOOLPATHFINDING ] = LoadCursor(module, TEXT("TOOLPATHFINDING")); + mCursor[ UI_CURSOR_TOOLNO ] = LoadCursor(module, TEXT("TOOLNO")); // Color cursors mCursor[ UI_CURSOR_TOOLPLAY ] = loadColorCursor(TEXT("TOOLPLAY")); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 9aaefa9c6a..0be289052c 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -17,12 +17,12 @@ include(JsonCpp) include(LLAudio) include(LLCharacter) include(LLCommon) -include(LLConvexDecomposition) include(LLImage) include(LLImageJ2COJ) include(LLInventory) include(LLMath) include(LLMessage) +include(LLPhysicsExtensions) include(LLPlugin) include(LLPrimitive) include(LLRender) @@ -52,7 +52,7 @@ include_directories( ${LLAUDIO_INCLUDE_DIRS} ${LLCHARACTER_INCLUDE_DIRS} ${LLCOMMON_INCLUDE_DIRS} - ${LLCONVEXDECOMP_INCLUDE_DIRS} + ${LLPHYSICS_INCLUDE_DIRS} ${FMOD_INCLUDE_DIR} ${LLIMAGE_INCLUDE_DIRS} ${LLKDU_INCLUDE_DIRS} @@ -218,6 +218,11 @@ set(viewer_SOURCE_FILES llfloaterobjectweights.cpp llfloateropenobject.cpp llfloateroutbox.cpp + llfloaterpathfindingbasic.cpp + llfloaterpathfindingcharacters.cpp + llfloaterpathfindingconsole.cpp + llfloaterpathfindinglinksets.cpp + llfloaterpathfindingobjects.cpp llfloaterpay.cpp llfloaterperms.cpp llfloaterpostprocess.cpp @@ -413,6 +418,17 @@ set(viewer_SOURCE_FILES llparcelselection.cpp llparticipantlist.cpp llpatchvertexarray.cpp + llpathfindingcharacter.cpp + llpathfindingcharacterlist.cpp + llpathfindinglinkset.cpp + llpathfindinglinksetlist.cpp + llpathfindingmanager.cpp + llpathfindingnavmesh.cpp + llpathfindingnavmeshstatus.cpp + llpathfindingnavmeshzone.cpp + llpathfindingobject.cpp + llpathfindingobjectlist.cpp + llpathfindingpathtool.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp llplacesinventorybridge.cpp @@ -774,6 +790,11 @@ set(viewer_HEADER_FILES llfloaterobjectweights.h llfloateropenobject.h llfloateroutbox.h + llfloaterpathfindingbasic.h + llfloaterpathfindingcharacters.h + llfloaterpathfindingconsole.h + llfloaterpathfindinglinksets.h + llfloaterpathfindingobjects.h llfloaterpay.h llfloaterperms.h llfloaterpostprocess.h @@ -958,6 +979,17 @@ set(viewer_HEADER_FILES llparcelselection.h llparticipantlist.h llpatchvertexarray.h + llpathfindingcharacter.h + llpathfindingcharacterlist.h + llpathfindinglinkset.h + llpathfindinglinksetlist.h + llpathfindingmanager.h + llpathfindingnavmesh.h + llpathfindingnavmeshstatus.h + llpathfindingnavmeshzone.h + llpathfindingobject.h + llpathfindingobjectlist.h + llpathfindingpathtool.h llphysicsmotion.h llphysicsshapebuilderutil.h llplacesinventorybridge.h @@ -1306,6 +1338,7 @@ if (WINDOWS) res/lltoolgrab.cur res/lltoolland.cur res/lltoolpan.cur + res/lltoolpathfinding.cur res/lltoolpipette.cur res/lltoolrotate.cur res/lltoolscale.cur @@ -1515,9 +1548,9 @@ if (WINDOWS) PROPERTIES # *TODO -reenable this once we get server usage sorted out #LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:\"__tcmalloc\"" - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc" + LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc " LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" - LINK_FLAGS_RELEASE "" + LINK_FLAGS_RELEASE "/FORCE:MULTIPLE" ) if(USE_PRECOMPILED_HEADERS) set_target_properties( @@ -1731,6 +1764,7 @@ endif (WINDOWS) # To work around this, higher level modules should be listed before the modules # that they depend upon. -brad target_link_libraries(${VIEWER_BINARY_NAME} + ${LLPATHING_LIBRARIES} ${UPDATER_LIBRARIES} ${GOOGLE_PERFTOOLS_LIBRARIES} ${LLAUDIO_LIBRARIES} @@ -1769,7 +1803,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARIES} ${LLLOGIN_LIBRARIES} - ${LLCONVEXDECOMP_LIBRARY} + ${LLPHYSICS_LIBRARIES} ${TCMALLOC_LIBRARIES} ) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 73df064ab2..ff4d9ceb93 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -157,6 +157,46 @@ is_running_function="Floater.IsOpen" is_running_parameters="people" /> + <command name="pathfinding_basic" + available_in_toybox="false" + icon="Command_PF_Basic_Icon" + label_ref="Command_PF_Basic_Label" + tooltip_ref="Command_PF_Basic_Tooltip" + execute_function="Floater.ToggleOrBringToFront" + execute_parameters="pathfinding_basic" + is_running_function="Floater.IsOpen" + is_running_parameters="pathfinding_basic" + /> + <command name="pathfinding_console" + available_in_toybox="false" + icon="Command_Pathfinding_Icon" + label_ref="Command_Pathfinding_Label" + tooltip_ref="Command_Pathfinding_Tooltip" + execute_function="Floater.ToggleOrBringToFront" + execute_parameters="pathfinding_console" + is_running_function="Floater.IsOpen" + is_running_parameters="pathfinding_console" + /> + <command name="pathfinding_characters" + available_in_toybox="false" + icon="Command_PF_Characters_Icon" + label_ref="Command_PF_Characters_Label" + tooltip_ref="Command_PF_Characters_Tooltip" + execute_function="Floater.ToggleOrBringToFront" + execute_parameters="pathfinding_characters" + is_running_function="Floater.IsOpen" + is_running_parameters="pathfinding_characters" + /> + <command name="pathfinding_linksets" + available_in_toybox="false" + icon="Command_PF_Linksets_Icon" + label_ref="Command_PF_Linksets_Label" + tooltip_ref="Command_PF_Linksets_Tooltip" + execute_function="Floater.ToggleOrBringToFront" + execute_parameters="pathfinding_linksets" + is_running_function="Floater.IsOpen" + is_running_parameters="pathfinding_linksets" + /> <command name="picks" available_in_toybox="true" icon="Command_Picks_Icon" diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini index 318b69438a..6120f22ba4 100644 --- a/indra/newview/app_settings/keywords.ini +++ b/indra/newview/app_settings/keywords.ini @@ -559,6 +559,98 @@ STATUS_NOT_SUPPORTED Feature not supported STATUS_INTERNAL_ERROR An internal error occurred STATUS_WHITELIST_FAILED URL failed to pass whitelist +PROFILE_NONE Disables profiling +PROFILE_SCRIPT_MEMORY Enables memory profiling + +RC_DATA_FLAGS TODO: add documentation +RC_DETECT_PHANTOM TODO: add documentation +RC_GET_LINK_NUM TODO: add documentation +RC_GET_NORMAL TODO: add documentation +RC_GET_ROOT_KEY TODO: add documentation +RC_MAX_HITS TODO: add documentation +RC_REJECT_TYPES Optional parameter set in llCastRay() to reject hit against certain object types. +RC_REJECT_AGENTS Bit mask for RC_REJECT_TYPES, rejects hits against avatars. +RC_REJECT_PHYSICAL Bit mask for RC_REJECT_TYPES, rejects hits against moving objects. +RC_REJECT_NONPHYSICAL Bit mask for RC_REJECT_TYPES, rejects hits against non-moving objects. +RC_REJECT_LAND Bit mask for RC_REJECT_TYPES, rejects hits against the terrian. + +RCERR_CAST_TIME_EXCEEDED TODO: add documentation +RCERR_SIM_PERF_LOW TODO: add documentation +RCERR_UNKNOWN TODO: add documentation + +ESTATE_ACCESS_ALLOWED_AGENT_ADD TODO: add documentation +ESTATE_ACCESS_ALLOWED_AGENT_REMOVE TODO: add documentation +ESTATE_ACCESS_ALLOWED_GROUP_ADD TODO: add documentation +ESTATE_ACCESS_ALLOWED_GROUP_REMOVE TODO: add documentation +ESTATE_ACCESS_BANNED_AGENT_ADD TODO: add documentation +ESTATE_ACCESS_BANNED_AGENT_REMOVE TODO: add documentation + +DENSITY TODO: add documentation +FRICTION TODO: add documentation +RESTITUTION TODO: add documentation +GRAVITY_MULTIPLIER TODO: add documentation + +KFM_COMMAND TODO: add documentation +KFM_CMD_PLAY TODO: add documentation +KFM_CMD_STOP TODO: add documentation +KFM_CMD_PAUSE TODO: add documentation +KFM_CMD_SET_MODE TODO: add documentation +KFM_MODE TODO: add documentation +KFM_FORWARD TODO: add documentation +KFM_LOOP TODO: add documentation +KFM_PING_PONG TODO: add documentation +KFM_REVERSE TODO: add documentation +KFM_DATA TODO: add documentation +KFM_ROTATION TODO: add documentation +KFM_TRANSLATION TODO: add documentation + +CHARACTER_CMD_STOP TODO: add documentation +CHARACTER_CMD_JUMP TODO: add documentation + +CHARACTER_DESIRED_SPEED TODO: add documentation +CHARACTER_RADIUS TODO: add documentation +CHARACTER_LENGTH TODO: add documentation +CHARACTER_ORIENTATION TODO: add documentation +CHARACTER_AVOIDANCE_MODE TODO: add documentation +PURSUIT_OFFSET TODO: add documentation +REQUIRE_LINE_OF_SIGHT TODO: add documentation +PURSUIT_FUZZ_FACTOR TODO: add documentation +PURSUIT_INTERCEPT TODO: add documentation +FORCE_DIRECT_PATH TODO: add documentation +VERTICAL TODO: add documentation +HORIZONTAL TODO: add documentation +AVOID_CHARACTERS TODO: add documentation +AVOID_DYNAMIC_OBSTACLES TODO: add documentation + +PU_EVADE_HIDDEN Triggered when an llEvade character thinks it has hidden from its pursuer. +PU_EVADE_SPOTTED Triggered when an llEvade character switches from hiding to running +PU_FAILURE_INVALID_GOAL Goal is not on the navigation-mesh and cannot be reached. +PU_FAILURE_INVALID_START Character cannot navigate from the current location - e.g., the character is off the navmesh or too high above it. +PU_FAILURE_NO_VALID_DESTINATION There's no good place for the character to go - e.g., it is patrolling and all the patrol points are now unreachable. +PU_FAILURE_OTHER Unknown failure +PU_FAILURE_TARGET_GONE Target (for llPursue or llEvade) can no longer be tracked - e.g., it left the region or is an avatar that is now more than about 30m outside the region. +PU_FAILURE_UNREACHABLE Goal is no longer reachable for some reason - e.g., an obstacle blocks the path. +PU_GOAL_REACHED Character has reached the goal and will stop or choose a new goal (if wandering). +PU_SLOWDOWN_DISTANCE_REACHED Character is near current goal. + +CHARACTER_TYPE TODO: add documentation +CHARACTER_TYPE_A TODO: add documentation +CHARACTER_TYPE_B TODO: add documentation +CHARACTER_TYPE_C TODO: add documentation +CHARACTER_TYPE_D TODO: add documentation +CHARACTER_TYPE_NONE TODO: add documentation + +TRAVERSAL_TYPE TODO: add documentation +TRAVERSAL_TYPE_SLOW TODO: add documentation +TRAVERSAL_TYPE_FAST TODO: add documentation +TRAVERSAL_TYPE_NONE TODO: add documentation + +CHARACTER_MAX_ACCEL TODO: add documentation +CHARACTER_MAX_DECEL TODO: add documentation +CHARACTER_MAX_ANGULAR_SPEED TODO: add documentation +CHARACTER_MAX_ANGULAR_ACCEL TODO: add documentation +CHARACTER_TURN_SPEED_MULTIPLIER TODO: add documentation + # string constants [word .1, .3, .5] NULL_KEY Indicates an empty key diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 05c05b9393..dbadad7056 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13516,5 +13516,336 @@ <key>Value</key> <integer>0</integer> </map> + <key>RetrieveNeighboringRegion</key> + <map> + <key>Comment</key> + <string>Download a neighboring region when visualize a navmesh (default val 99 is for the current region).</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>99</integer> + </map> + <key>PathfindingNavMeshClear</key> + <map> + <key>Comment</key> + <string>Background color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0</real> + <real>0</real> + <real>0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingWalkable</key> + <map> + <key>Comment</key> + <string>Walkable color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0.45490196078431372549019607843137</real> + <real>0.93333333333333333333333333333333</real> + <real>0.38823529411764705882352941176471</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingObstacle</key> + <map> + <key>Comment</key> + <string>Obstacle color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>0.0</real> + <real>0.0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingMaterial</key> + <map> + <key>Comment</key> + <string>Material volume color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0.5</real> + <real>0.0</real> + <real>1.0</real> + <real>0.3</real> + </array> + </map> + <key>PathfindingExclusion</key> + <map> + <key>Comment</key> + <string>Exclusion volume color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>1.0</real> + <real>0.0</real> + <real>0.3</real> + </array> + </map> + <key>PathfindingConnectedEdge</key> + <map> + <key>Comment</key> + <string>Connected edge color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0.86</real> + <real>0.86</real> + <real>0.86</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingBoundaryEdge</key> + <map> + <key>Comment</key> + <string>Boundary edge color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>0.0</real> + <real>0.0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingHeatColorBase</key> + <map> + <key>Comment</key> + <string>Least walkable heat map color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>0.0</real> + <real>0.0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingHeatColorMax</key> + <map> + <key>Comment</key> + <string>Most walkable heat map color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>1.0</real> + <real>1.0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingFaceColor</key> + <map> + <key>Comment</key> + <string>Nav mesh color?</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>1.0</real> + <real>1.0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingStarValidColor</key> + <map> + <key>Comment</key> + <string>yay!</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0.78</real> + <real>0.47</real> + <real>0.0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingStarInvalidColor</key> + <map> + <key>Comment</key> + <string>yay!</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>0.0</real> + <real>1.0</real> + <real>1.0</real> + </array> + </map> + <key>PathfindingTestPathColor</key> + <map> + <key>Comment</key> + <string>yay!</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>0.59</real> + <real>0.0</real> + <real>0.9</real> + </array> + </map> + <key>PathfindingAmbiance</key> + <map> + <key>Comment</key> + <string>Ambiance of lit pathfinding displays.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.5</real> + </map> + + <key>PathfindingXRayTint</key> + <map> + <key>Comment</key> + <string>Amount to darken/lighten x-ray lines in pathfinding display</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.8</real> + </map> + + <key>PathfindingXRayOpacity</key> + <map> + <key>Comment</key> + <string>Opacity of xray lines in pathfinding display.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.25</real> + </map> + + <key>PathfindingXRayWireframe</key> + <map> + <key>Comment</key> + <string>Render pathfinding xray as a wireframe.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + + <key>PathfindingLineWidth</key> + <map> + <key>Comment</key> + <string>Width of volume outlines in pathfinding display.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>2.0</real> + </map> + + <key>PathfindingLineOffset</key> + <map> + <key>Comment</key> + <string>Depth offset of volume outlines in pathfinding display.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>2.3</real> + </map> + + <key>PathfindingDisablePermanentObjects</key> + <map> + <key>Comment</key> + <string>Disables the viewer from seeing the permanent object flag. Useful for testing server-side enforcement of permanent object rules.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>PathfindingDisableCharacterObjects</key> + <map> + <key>Comment</key> + <string>Disables the viewer from seeing the character object flag. Useful for testing server-side enforcement of character object rules.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>PathfindingWaterColor</key> + <map> + <key>Comment</key> + <string>yay!</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0.0</real> + <real>0.0</real> + <real>1.0</real> + <real>1.0</real> + </array> + </map> + + </map> </llsd> diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl new file mode 100644 index 0000000000..40605bee78 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl @@ -0,0 +1,35 @@ +/** + * @file pathfindingF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 gl_FragColor; +#endif + +VARYING vec4 vertex_color; + +void main() +{ + gl_FragColor = vertex_color; +} diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl new file mode 100644 index 0000000000..19fa607307 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl @@ -0,0 +1,42 @@ +/** + * @file pathfindingV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; + +VARYING vec4 vertex_color; + +uniform float tint; +uniform float alpha_scale; + +void main() +{ + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + vertex_color = vec4(diffuse_color.rgb * tint, diffuse_color.a*alpha_scale); +} + diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl new file mode 100644 index 0000000000..91f252cf1e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl @@ -0,0 +1,54 @@ +/** + * @file pathfindingV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; + +VARYING vec4 vertex_color; + +uniform float tint; +uniform float ambiance; +uniform float alpha_scale; + +void main() +{ + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + vec3 l1 = vec3(-0.75, 1, 1.0)*0.5; + vec3 l2 = vec3(0.5, -0.6, 0.4)*0.25; + vec3 l3 = vec3(0.5, -0.8, 0.3)*0.5; + + float lit = max(dot(normal, l1), 0.0); + lit += max(dot(normal, l2), 0.0); + lit += max(dot(normal, l3), 0.0); + + lit = clamp(lit, ambiance, 1.0); + + vertex_color = vec4(diffuse_color.rgb * tint * lit, diffuse_color.a*alpha_scale); +} + diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3870a3be2e..d94e01ee47 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -243,6 +243,7 @@ LLAgent::LLAgent() : mbTeleportKeepsLookAt(false), mAgentAccess(new LLAgentAccess(gSavedSettings)), + mGodLevelChangeSignal(), mCanEditParcel(false), mTeleportSourceSLURL(new LLSLURL), mTeleportState( TELEPORT_NONE ), @@ -2434,6 +2435,12 @@ void LLAgent::setAdminOverride(BOOL b) void LLAgent::setGodLevel(U8 god_level) { mAgentAccess->setGodLevel(god_level); + mGodLevelChangeSignal(god_level); +} + +LLAgent::god_level_change_slot_t LLAgent::registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback) +{ + return mGodLevelChangeSignal.connect(pGodLevelChangeCallback); } void LLAgent::setAOTransition() diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 740770bbdf..72f695d917 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -631,6 +631,16 @@ public: void requestEnterGodMode(); void requestLeaveGodMode(); + typedef boost::function<void (U8)> god_level_change_callback_t; + typedef boost::signals2::signal<void (U8)> god_level_change_signal_t; + typedef boost::signals2::connection god_level_change_slot_t; + + god_level_change_slot_t registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback); + +private: + god_level_change_signal_t mGodLevelChangeSignal; + + //-------------------------------------------------------------------- // Maturity //-------------------------------------------------------------------- diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8e9e3d8ad8..b297ce820a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -106,6 +106,7 @@ #include "llvfsthread.h" #include "llvolumemgr.h" #include "llxfermanager.h" +#include "llphysicsextensions.h" #include "llnotificationmanager.h" #include "llnotifications.h" @@ -1548,6 +1549,9 @@ bool LLAppViewer::cleanup() // shut down mesh streamer gMeshRepo.shutdown(); + // shut down Havok + LLPhysicsExtensions::quitSystem(); + // Must clean up texture references before viewer window is destroyed. if(LLHUDManager::instanceExists()) { diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index b539ac38ed..b539ac38ed 100755..100644 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 35f8a85796..81f4e3d48f 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -116,6 +116,7 @@ LLDrawPool::LLDrawPool(const U32 type) sNumDrawPools++; mId = sNumDrawPools; mVertexShaderLevel = 0; + mSkipRender = false; } LLDrawPool::~LLDrawPool() diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 64774d06df..977acf7aec 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -77,6 +77,9 @@ public: S32 getId() const { return mId; } U32 getType() const { return mType; } + BOOL getSkipRenderFlag() const { return mSkipRender;} + void setSkipRenderFlag( BOOL flag ) { mSkipRender = flag; } + virtual LLViewerTexture *getDebugTexture(); virtual void beginRenderPass( S32 pass ); virtual void endRenderPass( S32 pass ); @@ -113,6 +116,7 @@ protected: S32 mVertexShaderLevel; S32 mId; U32 mType; // Type of draw pool + BOOL mSkipRender; }; class LLRenderPass : public LLDrawPool diff --git a/indra/newview/llfloaterpathfindingbasic.cpp b/indra/newview/llfloaterpathfindingbasic.cpp new file mode 100644 index 0000000000..40752352ea --- /dev/null +++ b/indra/newview/llfloaterpathfindingbasic.cpp @@ -0,0 +1,167 @@ +/** +* @file llfloaterpathfindingbasic.cpp +* @author William Todd Stinson +* @brief "Pathfinding basic" floater, allowing for basic freezing and unfreezing of the pathfinding avatar mode. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingbasic.h" +#include "llsd.h" +#include "lltextbase.h" +#include "llbutton.h" +#include "llpathfindingmanager.h" + +#include <boost/bind.hpp> + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingBasic +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingBasic::postBuild() +{ + mStatusText = findChild<LLTextBase>("status_label"); + llassert(mStatusText != NULL); + + mUnfreezeLabel = findChild<LLTextBase>("unfreeze_label"); + llassert(mUnfreezeLabel != NULL); + + mUnfreezeButton = findChild<LLButton>("enter_unfrozen_mode"); + llassert(mUnfreezeButton != NULL); + mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onUnfreezeClicked, this)); + + mFreezeLabel = findChild<LLTextBase>("freeze_label"); + llassert(mFreezeLabel != NULL); + + mFreezeButton = findChild<LLButton>("enter_frozen_mode"); + llassert(mFreezeButton != NULL); + mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onFreezeClicked, this)); + + return LLFloater::postBuild(); +} + +void LLFloaterPathfindingBasic::onOpen(const LLSD& pKey) +{ + LLFloater::onOpen(pKey); + + if (!mAgentStateSlot.connected()) + { + mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingBasic::onAgentStateCB, this, _1)); + } + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); +} + +void LLFloaterPathfindingBasic::onClose(bool pIsAppQuitting) +{ + if (mAgentStateSlot.connected()) + { + mAgentStateSlot.disconnect(); + } + + LLFloater::onClose(pIsAppQuitting); +} + +LLFloaterPathfindingBasic::LLFloaterPathfindingBasic(const LLSD& pSeed) + : LLFloater(pSeed), + mStatusText(NULL), + mUnfreezeLabel(NULL), + mUnfreezeButton(NULL), + mFreezeLabel(NULL), + mFreezeButton(NULL), + mAgentStateSlot() +{ +} + +LLFloaterPathfindingBasic::~LLFloaterPathfindingBasic() +{ +} + +void LLFloaterPathfindingBasic::onUnfreezeClicked() +{ + mUnfreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); +} + +void LLFloaterPathfindingBasic::onFreezeClicked() +{ + mUnfreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); +} + +void LLFloaterPathfindingBasic::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) +{ + setAgentState(pAgentState); +} + +void LLFloaterPathfindingBasic::setAgentState(LLPathfindingManager::EAgentState pAgentState) +{ + static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + LLStyle::Params styleParams; + + switch (pAgentState) + { + case LLPathfindingManager::kAgentStateUnknown : + mStatusText->setVisible(TRUE); + mStatusText->setText((LLStringExplicit)getString("status_querying_state"), styleParams); + break; + case LLPathfindingManager::kAgentStateNotEnabled : + mStatusText->setVisible(TRUE); + styleParams.color = errorColor; + mStatusText->setText((LLStringExplicit)getString("status_pathfinding_not_enabled"), styleParams); + break; + case LLPathfindingManager::kAgentStateError : + mStatusText->setVisible(TRUE); + styleParams.color = errorColor; + mStatusText->setText((LLStringExplicit)getString("status_unable_to_change_state"), styleParams); + break; + default : + mStatusText->setVisible(FALSE); + break; + } + + switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) + { + case LLPathfindingManager::kAgentStateUnknown : + case LLPathfindingManager::kAgentStateNotEnabled : + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateFrozen : + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateUnfrozen : + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + break; + default : + llassert(0); + break; + } +} diff --git a/indra/newview/llfloaterpathfindingbasic.h b/indra/newview/llfloaterpathfindingbasic.h new file mode 100644 index 0000000000..286985c022 --- /dev/null +++ b/indra/newview/llfloaterpathfindingbasic.h @@ -0,0 +1,71 @@ +/** + * @file llfloaterpathfindingbasic.h + * @author William Todd Stinson + * @brief "Pathfinding basic" floater, allowing for basic freezing and unfreezing of the pathfinding avatar mode. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERPATHFINDINGBASIC_H +#define LL_LLFLOATERPATHFINDINGBASIC_H + +#include "llfloater.h" +#include "llpathfindingmanager.h" + +class LLSD; +class LLTextBase; +class LLButton; + +class LLFloaterPathfindingBasic +: public LLFloater +{ + friend class LLFloaterReg; + +public: + virtual BOOL postBuild(); + virtual void onOpen(const LLSD& pKey); + virtual void onClose(bool pIsAppQuitting); + +protected: + +private: + // Does its own instance management, so clients not allowed + // to allocate or destroy. + LLFloaterPathfindingBasic(const LLSD& pSeed); + virtual ~LLFloaterPathfindingBasic(); + + void onUnfreezeClicked(); + void onFreezeClicked(); + + void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState); + + void setAgentState(LLPathfindingManager::EAgentState pAgentState); + + LLTextBase *mStatusText; + LLTextBase *mUnfreezeLabel; + LLButton *mUnfreezeButton; + LLTextBase *mFreezeLabel; + LLButton *mFreezeButton; + LLPathfindingManager::agent_state_slot_t mAgentStateSlot; +}; + +#endif // LL_LLFLOATERPATHFINDINGBASIC_H diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp new file mode 100644 index 0000000000..b4a1394b06 --- /dev/null +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -0,0 +1,308 @@ +/** + * @file llfloaterpathfindingcharacters.cpp + * @author William Todd Stinson + * @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterpathfindingcharacters.h" + +#include "llcheckboxctrl.h" +#include "llfloaterreg.h" +#include "llfloaterpathfindingobjects.h" +#include "llhandle.h" +#include "llpathfindingcharacter.h" +#include "llpathfindingcharacterlist.h" +#include "llpathfindingmanager.h" +#include "llpathfindingobjectlist.h" +#include "llsd.h" +#include "lluicolortable.h" +#include "llviewerobject.h" +#include "llviewerobjectlist.h" +#include "pipeline.h" + +LLHandle<LLFloaterPathfindingCharacters> LLFloaterPathfindingCharacters::sInstanceHandle; + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingCharacters +//--------------------------------------------------------------------------- + +void LLFloaterPathfindingCharacters::onClose(bool pIsAppQuitting) +{ + // Hide any capsule that might be showing on floater close + hideCapsule(); + LLFloaterPathfindingObjects::onClose( pIsAppQuitting ); +} + +BOOL LLFloaterPathfindingCharacters::isShowPhysicsCapsule() const +{ +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + return mHasCharacterShapeData && mShowPhysicsCapsuleCheckBox->get(); +#else // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + return mShowPhysicsCapsuleCheckBox->get(); +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE +} + +void LLFloaterPathfindingCharacters::setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule) +{ +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mShowPhysicsCapsuleCheckBox->set(mHasCharacterShapeData && pIsShowPhysicsCapsule); +#else // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mShowPhysicsCapsuleCheckBox->set(pIsShowPhysicsCapsule); +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE +} + +BOOL LLFloaterPathfindingCharacters::isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const +{ + id = mSelectedCharacterId; + // Physics capsule is enable if the checkbox is enabled and if we can get the required render + // parameters for any selected object + return (isShowPhysicsCapsule() && getCapsuleRenderData(pos, rot )); +} + +void LLFloaterPathfindingCharacters::openCharactersViewer() +{ + LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_characters"); +} + +LLHandle<LLFloaterPathfindingCharacters> LLFloaterPathfindingCharacters::getInstanceHandle() +{ + if ( sInstanceHandle.isDead() ) + { + LLFloaterPathfindingCharacters *floaterInstance = LLFloaterReg::getTypedInstance<LLFloaterPathfindingCharacters>("pathfinding_characters"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} + +LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed) + : LLFloaterPathfindingObjects(pSeed), + mShowPhysicsCapsuleCheckBox(NULL), +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mHasCharacterShapeData(false), +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mSelectedCharacterId(), + mBeaconColor(), + mSelfHandle() +{ + mSelfHandle.bind(this); +} + +LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters() +{ +} + +BOOL LLFloaterPathfindingCharacters::postBuild() +{ + mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingCharacterBeaconColor"); + + mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule"); + llassert(mShowPhysicsCapsuleCheckBox != NULL); + mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked, this)); + + return LLFloaterPathfindingObjects::postBuild(); +} + +void LLFloaterPathfindingCharacters::requestGetObjects() +{ + LLPathfindingManager::getInstance()->requestGetCharacters(getNewRequestId(), boost::bind(&LLFloaterPathfindingCharacters::handleNewObjectList, this, _1, _2, _3)); +} + +LLSD LLFloaterPathfindingCharacters::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) +{ + llassert(pObjectListPtr != NULL); + llassert(!pObjectListPtr->isEmpty()); + + LLSD scrollListData = LLSD::emptyArray(); + + for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter) + { + const LLPathfindingCharacter *characterPtr = dynamic_cast<const LLPathfindingCharacter *>(objectIter->second.get()); + LLSD element = buildCharacterScrollListData(characterPtr); + scrollListData.append(element); + +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mHasCharacterShapeData = characterPtr->hasShapeData(); +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + + if (characterPtr->hasOwner() && !characterPtr->hasOwnerName()) + { + rebuildScrollListAfterAvatarNameLoads(characterPtr->getUUID()); + } + } + + return scrollListData; +} + +void LLFloaterPathfindingCharacters::updateControls() +{ + LLFloaterPathfindingObjects::updateControls(); + updateOnScrollListChange(); + updateStateOnActionFields(); +} + +S32 LLFloaterPathfindingCharacters::getNameColumnIndex() const +{ + return 0; +} + +const LLColor4 &LLFloaterPathfindingCharacters::getBeaconColor() const +{ + return mBeaconColor; +} + +LLPathfindingObjectListPtr LLFloaterPathfindingCharacters::getEmptyObjectList() const +{ + LLPathfindingObjectListPtr objectListPtr(new LLPathfindingCharacterList()); + return objectListPtr; +} + +void LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked() +{ + if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule()) + { + showCapsule(); + } + else + { + hideCapsule(); + } +} + +LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListData(const LLPathfindingCharacter *pCharacterPtr) const +{ + LLSD columns; + + columns[0]["column"] = "name"; + columns[0]["value"] = pCharacterPtr->getName(); + columns[0]["font"] = "SANSSERIF"; + + columns[1]["column"] = "description"; + columns[1]["value"] = pCharacterPtr->getDescription(); + columns[1]["font"] = "SANSSERIF"; + + columns[2]["column"] = "owner"; + columns[2]["value"] = (pCharacterPtr->hasOwner() ? + (pCharacterPtr->hasOwnerName() ? pCharacterPtr->getOwnerName() : getString("character_owner_loading")) : + getString("character_owner_unknown")); + columns[2]["font"] = "SANSSERIF"; + + S32 cpuTime = llround(pCharacterPtr->getCPUTime()); + std::string cpuTimeString = llformat("%d", cpuTime); + LLStringUtil::format_map_t string_args; + string_args["[CPU_TIME]"] = cpuTimeString; + + columns[3]["column"] = "cpu_time"; + columns[3]["value"] = getString("character_cpu_time", string_args); + columns[3]["font"] = "SANSSERIF"; + + columns[4]["column"] = "altitude"; + columns[4]["value"] = llformat("%1.0f m", pCharacterPtr->getLocation()[2]); + columns[4]["font"] = "SANSSERIF"; + + LLSD element; + element["id"] = pCharacterPtr->getUUID().asString(); + element["column"] = columns; + + return element; +} + +void LLFloaterPathfindingCharacters::updateStateOnActionFields() +{ + int numSelectedItems = getNumSelectedObjects();; +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + bool isEditEnabled = mHasCharacterShapeData && (numSelectedItems == 1); +#else // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + bool isEditEnabled = (numSelectedItems == 1); +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + + mShowPhysicsCapsuleCheckBox->setEnabled(isEditEnabled); + if (!isEditEnabled) + { + setShowPhysicsCapsule(FALSE); + } +} + +void LLFloaterPathfindingCharacters::updateOnScrollListChange() +{ + // Hide any previous capsule + hideCapsule(); + + // Get the only selected object, or set the selected object to null if we do not have exactly + // one object selected + if (getNumSelectedObjects() == 1) + { + LLPathfindingObjectPtr selectedObjectPtr = getFirstSelectedObject(); + mSelectedCharacterId = selectedObjectPtr->getUUID(); + } + else + { + mSelectedCharacterId.setNull(); + } + + // Show any capsule if enabled + showCapsule(); +} + +void LLFloaterPathfindingCharacters::showCapsule() const +{ + if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule()) + { + gPipeline.hideObject(mSelectedCharacterId); + } +} + +void LLFloaterPathfindingCharacters::hideCapsule() const +{ + if (mSelectedCharacterId.notNull()) + { + gPipeline.restoreHiddenObject(mSelectedCharacterId); + } +} + +bool LLFloaterPathfindingCharacters::getCapsuleRenderData(LLVector3& pPosition, LLQuaternion& rot) const +{ + bool result = false; + + // If we have a selected object, find the object on the viewer object list and return its + // position. Else, return false indicating that we either do not have a selected object + // or we cannot find the selected object on the viewer object list + if (mSelectedCharacterId.notNull()) + { + LLViewerObject *viewerObject = gObjectList.findObject(mSelectedCharacterId); + if ( viewerObject != NULL ) + { + rot = viewerObject->getRotation() ; + pPosition = viewerObject->getRenderPosition(); + result = true; + } + } + + return result; +} diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h new file mode 100644 index 0000000000..a86a9700b1 --- /dev/null +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -0,0 +1,97 @@ +/** +* @file llfloaterpathfindingcharacters.h +* @author William Todd Stinson +* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_LLFLOATERPATHFINDINGCHARACTERS_H +#define LL_LLFLOATERPATHFINDINGCHARACTERS_H + +#include "llfloaterpathfindingobjects.h" +#include "llhandle.h" +#include "llpathfindingobjectlist.h" +#include "v4color.h" + +class LLPathfindingCharacter; +class LLSD; + +class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects +{ +public: + virtual void onClose(bool pIsAppQuitting); + + BOOL isShowPhysicsCapsule() const; + void setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule); + + BOOL isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot ) const; + + static void openCharactersViewer(); + static LLHandle<LLFloaterPathfindingCharacters> getInstanceHandle(); + +protected: + friend class LLFloaterReg; + + LLFloaterPathfindingCharacters(const LLSD& pSeed); + virtual ~LLFloaterPathfindingCharacters(); + + virtual BOOL postBuild(); + + virtual void requestGetObjects(); + + virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr); + + virtual void updateControls(); + + virtual S32 getNameColumnIndex() const; + virtual const LLColor4 &getBeaconColor() const; + + virtual LLPathfindingObjectListPtr getEmptyObjectList() const; + +private: + void onShowPhysicsCapsuleClicked(); + + LLSD buildCharacterScrollListData(const LLPathfindingCharacter *pCharacterPtr) const; + + void updateStateOnActionFields(); + void updateOnScrollListChange(); + + void showCapsule() const; + void hideCapsule() const; + + bool getCapsuleRenderData(LLVector3& pPosition, LLQuaternion& rot) const; + + LLCheckBoxCtrl *mShowPhysicsCapsuleCheckBox; + +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + bool mHasCharacterShapeData; +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + LLUUID mSelectedCharacterId; + + LLColor4 mBeaconColor; + + LLRootHandle<LLFloaterPathfindingCharacters> mSelfHandle; + static LLHandle<LLFloaterPathfindingCharacters> sInstanceHandle; +}; + +#endif // LL_LLFLOATERPATHFINDINGCHARACTERS_H diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp new file mode 100644 index 0000000000..54e60ce0f4 --- /dev/null +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -0,0 +1,1393 @@ +/** +* @file llfloaterpathfindingconsole.cpp +* @author William Todd Stinson +* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" +#include "llfloaterpathfindingcharacters.h" + +#include "llsd.h" +#include "llhandle.h" +#include "llcontrol.h" +#include "llpanel.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llsliderctrl.h" +#include "lllineeditor.h" +#include "lltextbase.h" +#include "lltabcontainer.h" +#include "llcombobox.h" +#include "llfloaterreg.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingmanager.h" +#include "llenvmanager.h" +#include "llpathfindingpathtool.h" +#include "lltoolmgr.h" +#include "lltoolfocus.h" +#include "pipeline.h" +#include "llpathinglib.h" +#include "llviewerparcelmgr.h" + +#define XUI_RENDER_HEATMAP_NONE 0 +#define XUI_RENDER_HEATMAP_A 1 +#define XUI_RENDER_HEATMAP_B 2 +#define XUI_RENDER_HEATMAP_C 3 +#define XUI_RENDER_HEATMAP_D 4 + +#define XUI_CHARACTER_TYPE_NONE 0 +#define XUI_CHARACTER_TYPE_A 1 +#define XUI_CHARACTER_TYPE_B 2 +#define XUI_CHARACTER_TYPE_C 3 +#define XUI_CHARACTER_TYPE_D 4 + +#define XUI_EDIT_TAB_INDEX 0 +#define XUI_TEST_TAB_INDEX 1 + +#define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) + +#define CONTROL_NAME_RETRIEVE_NEIGHBOR "RetrieveNeighboringRegion" +#define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable" +#define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle" +#define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial" +#define CONTROL_NAME_EXCLUSION_VOLUMES "PathfindingExclusion" +#define CONTROL_NAME_INTERIOR_EDGE "PathfindingConnectedEdge" +#define CONTROL_NAME_EXTERIOR_EDGE "PathfindingBoundaryEdge" +#define CONTROL_NAME_HEATMAP_MIN "PathfindingHeatColorBase" +#define CONTROL_NAME_HEATMAP_MAX "PathfindingHeatColorMax" +#define CONTROL_NAME_NAVMESH_FACE "PathfindingFaceColor" +#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingStarValidColor" +#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingStarInvalidColor" +#define CONTROL_NAME_TEST_PATH "PathfindingTestPathColor" +#define CONTROL_NAME_WATER "PathfindingWaterColor" + +LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHandle; + +extern LLPipeline gPipeline; + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingConsole +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingConsole::postBuild() +{ + mShowLabel = findChild<LLTextBase>("show_label"); + llassert(mShowLabel != NULL); + + mShowWorldCheckBox = findChild<LLCheckBoxCtrl>("show_world"); + llassert(mShowWorldCheckBox != NULL); + mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this)); + + mShowWorldMovablesOnlyCheckBox = findChild<LLCheckBoxCtrl>("show_world_movables_only"); + llassert(mShowWorldMovablesOnlyCheckBox != NULL); + mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldMovablesOnlySet, this)); + + mShowNavMeshCheckBox = findChild<LLCheckBoxCtrl>("show_navmesh"); + llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshSet, this)); + + mShowNavMeshWalkabilityLabel = findChild<LLTextBase>("show_walkability_label"); + llassert(mShowNavMeshWalkabilityLabel != NULL); + + mShowNavMeshWalkabilityComboBox = findChild<LLComboBox>("show_heatmap_mode"); + llassert(mShowNavMeshWalkabilityComboBox != NULL); + mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this)); + + mShowWalkablesCheckBox = findChild<LLCheckBoxCtrl>("show_walkables"); + llassert(mShowWalkablesCheckBox != NULL); + + mShowStaticObstaclesCheckBox = findChild<LLCheckBoxCtrl>("show_static_obstacles"); + llassert(mShowStaticObstaclesCheckBox != NULL); + + mShowMaterialVolumesCheckBox = findChild<LLCheckBoxCtrl>("show_material_volumes"); + llassert(mShowMaterialVolumesCheckBox != NULL); + + mShowExclusionVolumesCheckBox = findChild<LLCheckBoxCtrl>("show_exclusion_volumes"); + llassert(mShowExclusionVolumesCheckBox != NULL); + + mShowRenderWaterPlaneCheckBox = findChild<LLCheckBoxCtrl>("show_water_plane"); + llassert(mShowRenderWaterPlaneCheckBox != NULL); + + mShowXRayCheckBox = findChild<LLCheckBoxCtrl>("show_xray"); + llassert(mShowXRayCheckBox != NULL); + + mViewCharactersButton = findChild<LLButton>("view_characters_floater"); + llassert(mViewCharactersButton != NULL); + mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); + + mEditTestTabContainer = findChild<LLTabContainer>("edit_test_tab_container"); + llassert(mEditTestTabContainer != NULL); + mEditTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this)); + + mEditTab = findChild<LLPanel>("edit_panel"); + llassert(mEditTab != NULL); + + mTestTab = findChild<LLPanel>("test_panel"); + llassert(mTestTab != NULL); + + mUnfreezeLabel = findChild<LLTextBase>("unfreeze_label"); + llassert(mUnfreezeLabel != NULL); + + mUnfreezeButton = findChild<LLButton>("enter_unfrozen_mode"); + llassert(mUnfreezeButton != NULL); + mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onUnfreezeClicked, this)); + + mLinksetsLabel = findChild<LLTextBase>("edit_linksets_label"); + llassert(mLinksetsLabel != NULL); + + mLinksetsButton = findChild<LLButton>("view_and_edit_linksets"); + llassert(mLinksetsButton != NULL); + mLinksetsButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + + mFreezeLabel = findChild<LLTextBase>("freeze_label"); + llassert(mFreezeLabel != NULL); + + mFreezeButton = findChild<LLButton>("enter_frozen_mode"); + llassert(mFreezeButton != NULL); + mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onFreezeClicked, this)); + + mPathfindingViewerStatus = findChild<LLTextBase>("pathfinding_viewer_status"); + llassert(mPathfindingViewerStatus != NULL); + + mPathfindingSimulatorStatus = findChild<LLTextBase>("pathfinding_simulator_status"); + llassert(mPathfindingSimulatorStatus != NULL); + + mCtrlClickLabel = findChild<LLTextBase>("ctrl_click_label"); + llassert(mCtrlClickLabel != NULL); + + mShiftClickLabel = findChild<LLTextBase>("shift_click_label"); + llassert(mShiftClickLabel != NULL); + + mCharacterWidthLabel = findChild<LLTextBase>("character_width_label"); + llassert(mCharacterWidthLabel != NULL); + + mCharacterWidthSlider = findChild<LLSliderCtrl>("character_width"); + llassert(mCharacterWidthSlider != NULL); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + + mCharacterWidthUnitLabel = findChild<LLTextBase>("character_width_unit_label"); + llassert(mCharacterWidthUnitLabel != NULL); + + mCharacterTypeLabel = findChild<LLTextBase>("character_type_label"); + llassert(mCharacterTypeLabel != NULL); + + mCharacterTypeComboBox = findChild<LLComboBox>("path_character_type"); + llassert(mCharacterTypeComboBox != NULL); + mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + + mPathTestingStatus = findChild<LLTextBase>("path_test_status"); + llassert(mPathTestingStatus != NULL); + + mClearPathButton = findChild<LLButton>("clear_path"); + llassert(mClearPathButton != NULL); + mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + + if (LLPathingLib::getInstance() == NULL) + { + LLPathingLib::initSystem(); + } + + if (LLPathingLib::getInstance() != NULL) + { + mPathfindingToolset = new LLToolset(); + mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); + mPathfindingToolset->addTool(LLToolCamera::getInstance()); + mPathfindingToolset->setShowFloaterTools(false); + } + + updateCharacterWidth(); + updateCharacterType(); + + return LLFloater::postBuild(); +} + +void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) +{ + LLFloater::onOpen(pKey); + //make sure we have a pathing system + if ( LLPathingLib::getInstance() == NULL ) + { + setConsoleState(kConsoleStateLibraryNotImplemented); + llwarns <<"Errror: cannot find pathing library implementation."<<llendl; + } + else + { + if (!mNavMeshZoneSlot.connected()) + { + mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); + } + + mIsNavMeshUpdating = false; + initializeNavMeshZoneForCurrentRegion(); + registerSavedSettingsListeners(); + fillInColorsForNavMeshVisualization(); + } + + if (!mAgentStateSlot.connected()) + { + mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); + } + + if (!mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); + } + + if (!mTeleportFailedSlot.connected()) + { + mTeleportFailedSlot = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); + } + + if (!mPathEventSlot.connected()) + { + mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this)); + } + + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); + setDefaultInputs(); + updatePathTestStatus(); + + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } +} + +void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) +{ + switchOutOfTestPathMode(); + + if (mPathEventSlot.connected()) + { + mPathEventSlot.disconnect(); + } + + if (mTeleportFailedSlot.connected()) + { + mTeleportFailedSlot.disconnect(); + } + + if (mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot.disconnect(); + } + + if (mAgentStateSlot.connected()) + { + mAgentStateSlot.disconnect(); + } + + if (mNavMeshZoneSlot.connected()) + { + mNavMeshZoneSlot.disconnect(); + } + + if (LLPathingLib::getInstance() != NULL) + { + mNavMeshZone.disable(); + } + deregisterSavedSettingsListeners(); + + setDefaultInputs(); + setConsoleState(kConsoleStateUnknown); + cleanupRenderableRestoreItems(); + LLFloater::onClose(pIsAppQuitting); +} + +LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::getInstanceHandle() +{ + if (sInstanceHandle.isDead()) + { + LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::getTypedInstance<LLFloaterPathfindingConsole>("pathfinding_console"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} + +BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const +{ + return mShowNavMeshCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) +{ + mShowNavMeshCheckBox->set(pIsRenderNavMesh); + setNavMeshRenderState(); +} + +BOOL LLFloaterPathfindingConsole::isRenderWalkables() const +{ + return mShowWalkablesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) +{ + mShowWalkablesCheckBox->set(pIsRenderWalkables); +} + +BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const +{ + return mShowStaticObstaclesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) +{ + mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); +} + +BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const +{ + return mShowMaterialVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) +{ + mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const +{ + return mShowExclusionVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) +{ + mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorld() const +{ + return mShowWorldCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) +{ + mShowWorldCheckBox->set(pIsRenderWorld); + setWorldRenderState(); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorldMovablesOnly() const +{ + return (mShowWorldCheckBox->get() && mShowWorldMovablesOnlyCheckBox->get()); +} + +void LLFloaterPathfindingConsole::setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly) +{ + mShowWorldMovablesOnlyCheckBox->set(pIsRenderWorldMovablesOnly); +} + +BOOL LLFloaterPathfindingConsole::isRenderWaterPlane() const +{ + return mShowRenderWaterPlaneCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWaterPlane(BOOL pIsRenderWaterPlane) +{ + mShowRenderWaterPlaneCheckBox->set(pIsRenderWaterPlane); +} + +BOOL LLFloaterPathfindingConsole::isRenderXRay() const +{ + return mShowXRayCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) +{ + mShowXRayCheckBox->set(pIsRenderXRay); +} + +LLPathingLib::LLPLCharacterType LLFloaterPathfindingConsole::getRenderHeatmapType() const +{ + LLPathingLib::LLPLCharacterType renderHeatmapType; + + switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) + { + case XUI_RENDER_HEATMAP_NONE : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + case XUI_RENDER_HEATMAP_A : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_A; + break; + case XUI_RENDER_HEATMAP_B : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_B; + break; + case XUI_RENDER_HEATMAP_C : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_C; + break; + case XUI_RENDER_HEATMAP_D : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_D; + break; + default : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + + return renderHeatmapType; +} + +void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType) +{ + LLSD comboBoxValue; + + switch (pRenderHeatmapType) + { + case LLPathingLib::LLPL_CHARACTER_TYPE_NONE : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_A : + comboBoxValue = XUI_RENDER_HEATMAP_A; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_B : + comboBoxValue = XUI_RENDER_HEATMAP_B; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_C : + comboBoxValue = XUI_RENDER_HEATMAP_C; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_D : + comboBoxValue = XUI_RENDER_HEATMAP_D; + break; + default : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + llassert(0); + break; + } + + mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); +} + +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) + : LLFloater(pSeed), + mSelfHandle(), + mShowLabel(), + mShowWorldCheckBox(NULL), + mShowWorldMovablesOnlyCheckBox(NULL), + mShowNavMeshCheckBox(NULL), + mShowNavMeshWalkabilityLabel(), + mShowNavMeshWalkabilityComboBox(NULL), + mShowWalkablesCheckBox(NULL), + mShowStaticObstaclesCheckBox(NULL), + mShowMaterialVolumesCheckBox(NULL), + mShowExclusionVolumesCheckBox(NULL), + mShowRenderWaterPlaneCheckBox(NULL), + mShowXRayCheckBox(NULL), + mPathfindingViewerStatus(NULL), + mPathfindingSimulatorStatus(NULL), + mViewCharactersButton(NULL), + mEditTestTabContainer(NULL), + mEditTab(NULL), + mTestTab(NULL), + mUnfreezeLabel(NULL), + mUnfreezeButton(NULL), + mLinksetsLabel(NULL), + mLinksetsButton(NULL), + mFreezeLabel(NULL), + mFreezeButton(NULL), + mCtrlClickLabel(), + mShiftClickLabel(), + mCharacterWidthLabel(), + mCharacterWidthUnitLabel(), + mCharacterWidthSlider(NULL), + mCharacterTypeLabel(), + mCharacterTypeComboBox(NULL), + mPathTestingStatus(NULL), + mClearPathButton(NULL), + mNavMeshZoneSlot(), + mNavMeshZone(), + mIsNavMeshUpdating(false), + mAgentStateSlot(), + mRegionBoundarySlot(), + mTeleportFailedSlot(), + mPathEventSlot(), + mPathfindingToolset(NULL), + mSavedToolset(NULL), + mSavedSettingRetrieveNeighborSlot(), + mSavedSettingWalkableSlot(), + mSavedSettingStaticObstacleSlot(), + mSavedSettingMaterialVolumeSlot(), + mSavedSettingExclusionVolumeSlot(), + mSavedSettingInteriorEdgeSlot(), + mSavedSettingExteriorEdgeSlot(), + mSavedSettingHeatmapMinSlot(), + mSavedSettingHeatmapMaxSlot(), + mSavedSettingNavMeshFaceSlot(), + mSavedSettingTestPathValidEndSlot(), + mSavedSettingTestPathInvalidEndSlot(), + mSavedSettingWaterSlot(), + mSavedSettingTestPathSlot(), + mConsoleState(kConsoleStateUnknown) +{ + mSelfHandle.bind(this); +} + +LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() +{ +} + +void LLFloaterPathfindingConsole::onShowWorldSet() +{ + setWorldRenderState(); + updateRenderablesObjects(); +} + +void LLFloaterPathfindingConsole::onShowWorldMovablesOnlySet() +{ + updateRenderablesObjects(); +} + +void LLFloaterPathfindingConsole::onShowNavMeshSet() +{ + setNavMeshRenderState(); +} + +void LLFloaterPathfindingConsole::onShowWalkabilitySet() +{ + LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); +} + +void LLFloaterPathfindingConsole::onViewCharactersClicked() +{ + LLFloaterPathfindingCharacters::openCharactersViewer(); +} + +void LLFloaterPathfindingConsole::onTabSwitch() +{ + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } + else + { + switchOutOfTestPathMode(); + } +} + +void LLFloaterPathfindingConsole::onUnfreezeClicked() +{ + mUnfreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); +} + +void LLFloaterPathfindingConsole::onFreezeClicked() +{ + mFreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); +} + +void LLFloaterPathfindingConsole::onViewEditLinksetClicked() +{ + LLFloaterPathfindingLinksets::openLinksetsEditor(); +} + +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + updateCharacterWidth(); +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + updateCharacterType(); +} + +void LLFloaterPathfindingConsole::onClearPathClicked() +{ + clearPath(); +} + +void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) +{ + switch (pNavMeshZoneRequestStatus) + { + case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : + setConsoleState(kConsoleStateUnknown); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestWaiting : + setConsoleState(kConsoleStateRegionLoading); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : + setConsoleState(kConsoleStateCheckingVersion); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : + mIsNavMeshUpdating = true; + mNavMeshZone.refresh(); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : + setConsoleState(kConsoleStateDownloading); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted : + mIsNavMeshUpdating = false; + setConsoleState(kConsoleStateHasNavMesh); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled : + setConsoleState(kConsoleStateRegionNotEnabled); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestError : + setConsoleState(kConsoleStateError); + break; + default: + setConsoleState(kConsoleStateUnknown); + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) +{ + setAgentState(pAgentState); +} + +void LLFloaterPathfindingConsole::onRegionBoundaryCross() +{ + initializeNavMeshZoneForCurrentRegion(); + setRenderWorld(TRUE); + setRenderWorldMovablesOnly(FALSE); +} + +void LLFloaterPathfindingConsole::onPathEvent() +{ + const LLPathfindingPathTool *pathToolInstance = LLPathfindingPathTool::getInstance(); + + mCharacterWidthSlider->setValue(LLSD(pathToolInstance->getCharacterWidth())); + + LLSD characterType; + switch (pathToolInstance->getCharacterType()) + { + case LLPathfindingPathTool::kCharacterTypeNone : + characterType = XUI_CHARACTER_TYPE_NONE; + break; + case LLPathfindingPathTool::kCharacterTypeA : + characterType = XUI_CHARACTER_TYPE_A; + break; + case LLPathfindingPathTool::kCharacterTypeB : + characterType = XUI_CHARACTER_TYPE_B; + break; + case LLPathfindingPathTool::kCharacterTypeC : + characterType = XUI_CHARACTER_TYPE_C; + break; + case LLPathfindingPathTool::kCharacterTypeD : + characterType = XUI_CHARACTER_TYPE_D; + break; + default : + characterType = XUI_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + mCharacterTypeComboBox->setValue(characterType); + + updatePathTestStatus(); +} + +void LLFloaterPathfindingConsole::setDefaultInputs() +{ + mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX); + setRenderWorld(TRUE); + setRenderNavMesh(FALSE); + setRenderWalkables(FALSE); + setRenderMaterialVolumes(FALSE); + setRenderStaticObstacles(FALSE); + setRenderExclusionVolumes(FALSE); + setRenderWaterPlane(FALSE); + setRenderXRay(FALSE); + setRenderWorldMovablesOnly(FALSE); +} + +void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) +{ + mConsoleState = pConsoleState; + updateControlsOnConsoleState(); + updateStatusOnConsoleState(); +} + +void LLFloaterPathfindingConsole::setWorldRenderState() +{ + BOOL renderWorld = isRenderWorld(); + + mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld); + if (!renderWorld) + { + mShowWorldMovablesOnlyCheckBox->set(FALSE); + } +} + +void LLFloaterPathfindingConsole::setNavMeshRenderState() +{ + BOOL renderNavMesh = isRenderNavMesh(); + + mShowNavMeshWalkabilityLabel->setEnabled(renderNavMesh); + mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh); +} + +void LLFloaterPathfindingConsole::updateRenderablesObjects() +{ + if ( isRenderWorldMovablesOnly() ) + { + gPipeline.hidePermanentObjects( mRenderableRestoreList ); + } + else + { + cleanupRenderableRestoreItems(); + } +} + +void LLFloaterPathfindingConsole::updateControlsOnConsoleState() +{ + switch (mConsoleState) + { + case kConsoleStateUnknown : + case kConsoleStateRegionNotEnabled : + case kConsoleStateRegionLoading : + mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(FALSE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + clearPath(); + break; + case kConsoleStateLibraryNotImplemented : + mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + clearPath(); + break; + case kConsoleStateCheckingVersion : + case kConsoleStateDownloading : + case kConsoleStateError : + mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + clearPath(); + break; + case kConsoleStateHasNavMesh : + mShowLabel->setEnabled(TRUE); + mShowWorldCheckBox->setEnabled(TRUE); + setWorldRenderState(); + mShowNavMeshCheckBox->setEnabled(TRUE); + setNavMeshRenderState(); + mShowWalkablesCheckBox->setEnabled(TRUE); + mShowStaticObstaclesCheckBox->setEnabled(TRUE); + mShowMaterialVolumesCheckBox->setEnabled(TRUE); + mShowExclusionVolumesCheckBox->setEnabled(TRUE); + mShowRenderWaterPlaneCheckBox->setEnabled(TRUE); + mShowXRayCheckBox->setEnabled(TRUE); + mViewCharactersButton->setEnabled(TRUE); + mTestTab->setEnabled(TRUE); + mCtrlClickLabel->setEnabled(TRUE); + mShiftClickLabel->setEnabled(TRUE); + mCharacterWidthLabel->setEnabled(TRUE); + mCharacterWidthUnitLabel->setEnabled(TRUE); + mCharacterWidthSlider->setEnabled(TRUE); + mCharacterTypeLabel->setEnabled(TRUE); + mCharacterTypeComboBox->setEnabled(TRUE); + mClearPathButton->setEnabled(TRUE); + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::updateStatusOnConsoleState() +{ + static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); + + std::string simulatorStatusText(""); + std::string viewerStatusText(""); + LLStyle::Params viewerStyleParams; + + switch (mConsoleState) + { + case kConsoleStateUnknown : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); + viewerStyleParams.color = errorColor; + break; + case kConsoleStateLibraryNotImplemented : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); + viewerStyleParams.color = errorColor; + break; + case kConsoleStateRegionNotEnabled : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); + viewerStyleParams.color = errorColor; + break; + case kConsoleStateRegionLoading : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_loading"); + viewerStyleParams.color = warningColor; + break; + case kConsoleStateCheckingVersion : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_checking_version"); + viewerStyleParams.color = warningColor; + break; + case kConsoleStateDownloading : + simulatorStatusText = getSimulatorStatusText(); + if (mIsNavMeshUpdating) + { + viewerStatusText = getString("navmesh_viewer_status_updating"); + } + else + { + viewerStatusText = getString("navmesh_viewer_status_downloading"); + } + viewerStyleParams.color = warningColor; + break; + case kConsoleStateHasNavMesh : + simulatorStatusText = getSimulatorStatusText(); + viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); + break; + case kConsoleStateError : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_error"); + viewerStyleParams.color = errorColor; + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); + viewerStyleParams.color = errorColor; + llassert(0); + break; + } + + mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); + mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); +} + +std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +{ + std::string simulatorStatusText(""); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) + { + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } + } + else + { + simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + return simulatorStatusText; +} + +void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() +{ + mNavMeshZone.disable(); + mNavMeshZone.initialize(); + mNavMeshZone.enable(); + mNavMeshZone.refresh(); + cleanupRenderableRestoreItems(); +} + +void LLFloaterPathfindingConsole::cleanupRenderableRestoreItems() +{ + if ( !mRenderableRestoreList.empty() ) + { + gPipeline.restorePermanentObjects( mRenderableRestoreList ); + mRenderableRestoreList.clear(); + } + else + { + gPipeline.skipRenderingOfTerrain( false ); + } +} + +void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) +{ + switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) + { + case LLPathfindingManager::kAgentStateUnknown : + case LLPathfindingManager::kAgentStateNotEnabled : + mEditTab->setEnabled(FALSE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateFrozen : + mEditTab->setEnabled(TRUE); + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateUnfrozen : + mEditTab->setEnabled(TRUE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(TRUE); + mLinksetsButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::switchIntoTestPathMode() +{ + if (LLPathingLib::getInstance() != NULL) + { + llassert(mPathfindingToolset != NULL); + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset) + { + mSavedToolset = toolMgrInstance->getCurrentToolset(); + toolMgrInstance->setCurrentToolset(mPathfindingToolset); + } + } +} + +void LLFloaterPathfindingConsole::switchOutOfTestPathMode() +{ + if (LLPathingLib::getInstance() != NULL) + { + llassert(mPathfindingToolset != NULL); + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset) + { + toolMgrInstance->setCurrentToolset(mSavedToolset); + mSavedToolset = NULL; + } + } +} + +void LLFloaterPathfindingConsole::updateCharacterWidth() +{ + LLPathfindingPathTool::getInstance()->setCharacterWidth(mCharacterWidthSlider->getValueF32()); +} + +void LLFloaterPathfindingConsole::updateCharacterType() +{ + LLPathfindingPathTool::ECharacterType characterType; + + switch (mCharacterTypeComboBox->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_NONE : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + break; + case XUI_CHARACTER_TYPE_A : + characterType = LLPathfindingPathTool::kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = LLPathfindingPathTool::kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = LLPathfindingPathTool::kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = LLPathfindingPathTool::kCharacterTypeD; + break; + default : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + llassert(0); + break; + } + + LLPathfindingPathTool::getInstance()->setCharacterType(characterType); +} + +void LLFloaterPathfindingConsole::clearPath() +{ + LLPathfindingPathTool::getInstance()->clearPath(); +} + +void LLFloaterPathfindingConsole::updatePathTestStatus() +{ + static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); + + std::string statusText(""); + LLStyle::Params styleParams; + + switch (LLPathfindingPathTool::getInstance()->getPathStatus()) + { + case LLPathfindingPathTool::kPathStatusUnknown : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints : + statusText = getString("pathing_choose_start_and_end_points"); + styleParams.color = warningColor; + break; + case LLPathfindingPathTool::kPathStatusChooseStartPoint : + statusText = getString("pathing_choose_start_point"); + styleParams.color = warningColor; + break; + case LLPathfindingPathTool::kPathStatusChooseEndPoint : + statusText = getString("pathing_choose_end_point"); + styleParams.color = warningColor; + break; + case LLPathfindingPathTool::kPathStatusHasValidPath : + statusText = getString("pathing_path_valid"); + break; + case LLPathfindingPathTool::kPathStatusHasInvalidPath : + statusText = getString("pathing_path_invalid"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotEnabled : + statusText = getString("pathing_region_not_enabled"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotImplemented : + statusText = getString("pathing_library_not_implemented"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusError : + statusText = getString("pathing_error"); + styleParams.color = errorColor; + break; + default : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; + } + + mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); +} + + +BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const +{ + return (isRenderWalkables() || isRenderStaticObstacles() || + isRenderMaterialVolumes() || isRenderExclusionVolumes()); +} + +U32 LLFloaterPathfindingConsole::getRenderShapeFlags() +{ + U32 shapeRenderFlag = 0U; + + if (isRenderWalkables()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_WalkableObjects); + } + if (isRenderStaticObstacles()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ObstacleObjects); + } + if (isRenderMaterialVolumes()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_MaterialPhantoms); + } + if (isRenderExclusionVolumes()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ExclusionPhantoms); + } + + return shapeRenderFlag; +} + +void LLFloaterPathfindingConsole::registerSavedSettingsListeners() +{ + if (!mSavedSettingRetrieveNeighborSlot.connected()) + { + mSavedSettingRetrieveNeighborSlot = gSavedSettings.getControl(CONTROL_NAME_RETRIEVE_NEIGHBOR)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleRetrieveNeighborChange, this, _1, _2)); + } + if (!mSavedSettingWalkableSlot.connected()) + { + mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingStaticObstacleSlot.connected()) + { + mSavedSettingStaticObstacleSlot = gSavedSettings.getControl(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingMaterialVolumeSlot.connected()) + { + mSavedSettingMaterialVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_MATERIAL_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingExclusionVolumeSlot.connected()) + { + mSavedSettingExclusionVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_EXCLUSION_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingInteriorEdgeSlot.connected()) + { + mSavedSettingInteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_INTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingExteriorEdgeSlot.connected()) + { + mSavedSettingExteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_EXTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingHeatmapMinSlot.connected()) + { + mSavedSettingHeatmapMinSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MIN)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingHeatmapMaxSlot.connected()) + { + mSavedSettingHeatmapMaxSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MAX)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingNavMeshFaceSlot.connected()) + { + mSavedSettingNavMeshFaceSlot = gSavedSettings.getControl(CONTROL_NAME_NAVMESH_FACE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathValidEndSlot.connected()) + { + mSavedSettingTestPathValidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_VALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathInvalidEndSlot.connected()) + { + mSavedSettingTestPathInvalidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_INVALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathSlot.connected()) + { + mSavedSettingTestPathSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingWaterSlot.connected()) + { + mSavedSettingWaterSlot = gSavedSettings.getControl(CONTROL_NAME_WATER)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } +} + +void LLFloaterPathfindingConsole::deregisterSavedSettingsListeners() +{ + if (mSavedSettingRetrieveNeighborSlot.connected()) + { + mSavedSettingRetrieveNeighborSlot.disconnect(); + } + if (mSavedSettingWalkableSlot.connected()) + { + mSavedSettingWalkableSlot.disconnect(); + } + if (mSavedSettingStaticObstacleSlot.connected()) + { + mSavedSettingStaticObstacleSlot.disconnect(); + } + if (mSavedSettingMaterialVolumeSlot.connected()) + { + mSavedSettingMaterialVolumeSlot.disconnect(); + } + if (mSavedSettingExclusionVolumeSlot.connected()) + { + mSavedSettingExclusionVolumeSlot.disconnect(); + } + if (mSavedSettingInteriorEdgeSlot.connected()) + { + mSavedSettingInteriorEdgeSlot.disconnect(); + } + if (mSavedSettingExteriorEdgeSlot.connected()) + { + mSavedSettingExteriorEdgeSlot.disconnect(); + } + if (mSavedSettingHeatmapMinSlot.connected()) + { + mSavedSettingHeatmapMinSlot.disconnect(); + } + if (mSavedSettingHeatmapMaxSlot.connected()) + { + mSavedSettingHeatmapMaxSlot.disconnect(); + } + if (mSavedSettingNavMeshFaceSlot.connected()) + { + mSavedSettingNavMeshFaceSlot.disconnect(); + } + if (mSavedSettingTestPathValidEndSlot.connected()) + { + mSavedSettingTestPathValidEndSlot.disconnect(); + } + if (mSavedSettingTestPathInvalidEndSlot.connected()) + { + mSavedSettingTestPathInvalidEndSlot.disconnect(); + } + if (mSavedSettingTestPathSlot.connected()) + { + mSavedSettingTestPathSlot.disconnect(); + } +} + +void LLFloaterPathfindingConsole::handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue) +{ + initializeNavMeshZoneForCurrentRegion(); +} + +void LLFloaterPathfindingConsole::handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue) +{ + fillInColorsForNavMeshVisualization(); +} + +void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() +{ + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::NavMeshColors navMeshColors; + + LLColor4 in = gSavedSettings.getColor4(CONTROL_NAME_WALKABLE_OBJECTS); + navMeshColors.mWalkable= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS); + navMeshColors.mObstacle= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_MATERIAL_VOLUMES); + navMeshColors.mMaterial= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_EXCLUSION_VOLUMES); + navMeshColors.mExclusion= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_INTERIOR_EDGE); + navMeshColors.mConnectedEdge= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_EXTERIOR_EDGE); + navMeshColors.mBoundaryEdge= LLColor4U(in); + + navMeshColors.mHeatColorBase = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MIN); + + navMeshColors.mHeatColorMax = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MAX); + + in = gSavedSettings.getColor4(CONTROL_NAME_NAVMESH_FACE); + navMeshColors.mFaceColor= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_VALID_END); + navMeshColors.mStarValid= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_INVALID_END); + navMeshColors.mStarInvalid= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH); + navMeshColors.mTestPath= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_WATER); + navMeshColors.mWaterColor= LLColor4U(in); + + LLPathingLib::getInstance()->setNavMeshColors(navMeshColors); + } +} diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h new file mode 100644 index 0000000000..edbeae2012 --- /dev/null +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -0,0 +1,233 @@ +/** + * @file llfloaterpathfindingconsole.h + * @author William Todd Stinson + * @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERPATHFINDINGCONSOLE_H +#define LL_LLFLOATERPATHFINDINGCONSOLE_H + +#include "llfloater.h" +#include "llhandle.h" +#include "llpathinglib.h" +#include "llpathfindingmanager.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingpathtool.h" + +#include <boost/signals2.hpp> + +class LLSD; +class LLPanel; +class LLSliderCtrl; +class LLLineEditor; +class LLTextBase; +class LLCheckBoxCtrl; +class LLTabContainer; +class LLComboBox; +class LLButton; +class LLToolset; +class LLColor4; +class LLControlVariable; + +class LLFloaterPathfindingConsole +: public LLFloater +{ + friend class LLFloaterReg; + +public: + virtual BOOL postBuild(); + virtual void onOpen(const LLSD& pKey); + virtual void onClose(bool pIsAppQuitting); + + static LLHandle<LLFloaterPathfindingConsole> getInstanceHandle(); + + BOOL isRenderNavMesh() const; + void setRenderNavMesh(BOOL pIsRenderNavMesh); + + BOOL isRenderWalkables() const; + void setRenderWalkables(BOOL pIsRenderWalkables); + + BOOL isRenderStaticObstacles() const; + void setRenderStaticObstacles(BOOL pIsRenderStaticObstacles); + + BOOL isRenderMaterialVolumes() const; + void setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes); + + BOOL isRenderExclusionVolumes() const; + void setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes); + + BOOL isRenderWorld() const; + void setRenderWorld(BOOL pIsRenderWorld); + + BOOL isRenderWorldMovablesOnly() const; + void setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly); + + BOOL isRenderWaterPlane() const; + void setRenderWaterPlane(BOOL pIsRenderWaterPlane); + + BOOL isRenderXRay() const; + void setRenderXRay(BOOL pIsRenderXRay); + + BOOL isRenderAnyShapes() const; + U32 getRenderShapeFlags(); + + LLPathingLib::LLPLCharacterType getRenderHeatmapType() const; + void setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType); + +protected: + +private: + typedef enum + { + kConsoleStateUnknown, + kConsoleStateLibraryNotImplemented, + kConsoleStateRegionNotEnabled, + kConsoleStateRegionLoading, + kConsoleStateCheckingVersion, + kConsoleStateDownloading, + kConsoleStateHasNavMesh, + kConsoleStateError + } EConsoleState; + + // Does its own instance management, so clients not allowed + // to allocate or destroy. + LLFloaterPathfindingConsole(const LLSD& pSeed); + virtual ~LLFloaterPathfindingConsole(); + + void onShowWorldSet(); + void onShowWorldMovablesOnlySet(); + void onShowNavMeshSet(); + void onShowWalkabilitySet(); + void onViewCharactersClicked(); + void onTabSwitch(); + void onUnfreezeClicked(); + void onFreezeClicked(); + void onViewEditLinksetClicked(); + void onCharacterWidthSet(); + void onCharacterTypeSwitch(); + void onClearPathClicked(); + + void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus); + void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState); + void onRegionBoundaryCross(); + void onPathEvent(); + + void setDefaultInputs(); + void setConsoleState(EConsoleState pConsoleState); + void setWorldRenderState(); + void setNavMeshRenderState(); + void updateRenderablesObjects(); + + void updateControlsOnConsoleState(); + void updateStatusOnConsoleState(); + std::string getSimulatorStatusText() const; + + void initializeNavMeshZoneForCurrentRegion(); + + void setAgentState(LLPathfindingManager::EAgentState pAgentState); + + void switchIntoTestPathMode(); + void switchOutOfTestPathMode(); + void updateCharacterWidth(); + void updateCharacterType(); + void clearPath(); + void updatePathTestStatus(); + + void registerSavedSettingsListeners(); + void deregisterSavedSettingsListeners(); + void handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue); + void handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue); + void fillInColorsForNavMeshVisualization(); + void cleanupRenderableRestoreItems(); + + LLRootHandle<LLFloaterPathfindingConsole> mSelfHandle; + LLTextBase *mShowLabel; + LLCheckBoxCtrl *mShowWorldCheckBox; + LLCheckBoxCtrl *mShowWorldMovablesOnlyCheckBox; + LLCheckBoxCtrl *mShowNavMeshCheckBox; + LLTextBase *mShowNavMeshWalkabilityLabel; + LLComboBox *mShowNavMeshWalkabilityComboBox; + LLCheckBoxCtrl *mShowWalkablesCheckBox; + LLCheckBoxCtrl *mShowStaticObstaclesCheckBox; + LLCheckBoxCtrl *mShowMaterialVolumesCheckBox; + LLCheckBoxCtrl *mShowExclusionVolumesCheckBox; + LLCheckBoxCtrl *mShowRenderWaterPlaneCheckBox; + LLCheckBoxCtrl *mShowXRayCheckBox; + LLTextBase *mPathfindingViewerStatus; + LLTextBase *mPathfindingSimulatorStatus; + LLButton *mViewCharactersButton; + LLTabContainer *mEditTestTabContainer; + LLPanel *mEditTab; + LLPanel *mTestTab; + LLTextBase *mUnfreezeLabel; + LLButton *mUnfreezeButton; + LLTextBase *mLinksetsLabel; + LLButton *mLinksetsButton; + LLTextBase *mFreezeLabel; + LLButton *mFreezeButton; + LLTextBase *mCtrlClickLabel; + LLTextBase *mShiftClickLabel; + LLTextBase *mCharacterWidthLabel; + LLTextBase *mCharacterWidthUnitLabel; + LLSliderCtrl *mCharacterWidthSlider; + LLTextBase *mCharacterTypeLabel; + LLComboBox *mCharacterTypeComboBox; + LLTextBase *mPathTestingStatus; + LLButton *mClearPathButton; + + LLPathfindingNavMeshZone::navmesh_zone_slot_t mNavMeshZoneSlot; + LLPathfindingNavMeshZone mNavMeshZone; + bool mIsNavMeshUpdating; + + LLPathfindingManager::agent_state_slot_t mAgentStateSlot; + boost::signals2::connection mRegionBoundarySlot; + boost::signals2::connection mTeleportFailedSlot; + LLPathfindingPathTool::path_event_slot_t mPathEventSlot; + + LLToolset *mPathfindingToolset; + LLToolset *mSavedToolset; + + boost::signals2::connection mSavedSettingRetrieveNeighborSlot; + boost::signals2::connection mSavedSettingWalkableSlot; + boost::signals2::connection mSavedSettingStaticObstacleSlot; + boost::signals2::connection mSavedSettingMaterialVolumeSlot; + boost::signals2::connection mSavedSettingExclusionVolumeSlot; + boost::signals2::connection mSavedSettingInteriorEdgeSlot; + boost::signals2::connection mSavedSettingExteriorEdgeSlot; + boost::signals2::connection mSavedSettingHeatmapMinSlot; + boost::signals2::connection mSavedSettingHeatmapMaxSlot; + boost::signals2::connection mSavedSettingNavMeshFaceSlot; + boost::signals2::connection mSavedSettingTestPathValidEndSlot; + boost::signals2::connection mSavedSettingTestPathInvalidEndSlot; + boost::signals2::connection mSavedSettingTestPathSlot; + boost::signals2::connection mSavedSettingWaterSlot; + + EConsoleState mConsoleState; + + std::vector<U32> mRenderableRestoreList; + + static LLHandle<LLFloaterPathfindingConsole> sInstanceHandle; +}; + +#endif // LL_LLFLOATERPATHFINDINGCONSOLE_H diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp new file mode 100644 index 0000000000..1d7f165ad9 --- /dev/null +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -0,0 +1,761 @@ +/** +* @file llfloaterpathfindinglinksets.cpp +* @author William Todd Stinson +* @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterpathfindinglinksets.h" + +#include <boost/bind.hpp> + +#include "llagent.h" +#include "llbutton.h" +#include "llcombobox.h" +#include "llfloaterreg.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" +#include "llpathfindinglinkset.h" +#include "llpathfindinglinksetlist.h" +#include "llpathfindingmanager.h" +#include "llscrolllistitem.h" +#include "llsd.h" +#include "lltextbase.h" +#include "lltextvalidate.h" +#include "lluicolortable.h" +#include "v3math.h" +#include "v4color.h" + +#define XUI_LINKSET_USE_NONE 0 +#define XUI_LINKSET_USE_WALKABLE 1 +#define XUI_LINKSET_USE_STATIC_OBSTACLE 2 +#define XUI_LINKSET_USE_DYNAMIC_OBSTACLE 3 +#define XUI_LINKSET_USE_MATERIAL_VOLUME 4 +#define XUI_LINKSET_USE_EXCLUSION_VOLUME 5 +#define XUI_LINKSET_USE_DYNAMIC_PHANTOM 6 + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingLinksets +//--------------------------------------------------------------------------- + +void LLFloaterPathfindingLinksets::onOpen(const LLSD& pKey) +{ + LLFloaterPathfindingObjects::onOpen(pKey); + + if (!mAgentStateSlot.connected()) + { + mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingLinksets::onAgentStateChange, this, _1)); + } +} + +void LLFloaterPathfindingLinksets::onClose(bool pIsAppQuitting) +{ + if (mAgentStateSlot.connected()) + { + mAgentStateSlot.disconnect(); + } + + LLFloaterPathfindingObjects::onClose(pIsAppQuitting); +} + +void LLFloaterPathfindingLinksets::openLinksetsEditor() +{ + LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_linksets"); +} + +LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) + : LLFloaterPathfindingObjects(pSeed), + mFilterByName(NULL), + mFilterByDescription(NULL), + mFilterByLinksetUse(NULL), + mEditLinksetUse(NULL), + mEditLinksetUseWalkable(NULL), + mEditLinksetUseStaticObstacle(NULL), + mEditLinksetUseDynamicObstacle(NULL), + mEditLinksetUseMaterialVolume(NULL), + mEditLinksetUseExclusionVolume(NULL), + mEditLinksetUseDynamicPhantom(NULL), + mLabelWalkabilityCoefficients(NULL), + mLabelEditA(NULL), + mEditA(NULL), + mLabelEditB(NULL), + mEditB(NULL), + mLabelEditC(NULL), + mEditC(NULL), + mLabelEditD(NULL), + mEditD(NULL), + mApplyEditsButton(NULL), + mBeaconColor(), + mAgentStateSlot() +{ +} + +LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets() +{ +} + +BOOL LLFloaterPathfindingLinksets::postBuild() +{ + mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingLinksetBeaconColor"); + + mFilterByName = findChild<LLLineEditor>("filter_by_name"); + llassert(mFilterByName != NULL); + mFilterByName->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); + mFilterByName->setSelectAllonFocusReceived(true); + mFilterByName->setCommitOnFocusLost(true); + + mFilterByDescription = findChild<LLLineEditor>("filter_by_description"); + llassert(mFilterByDescription != NULL); + mFilterByDescription->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); + mFilterByDescription->setSelectAllonFocusReceived(true); + mFilterByDescription->setCommitOnFocusLost(true); + + mFilterByLinksetUse = findChild<LLComboBox>("filter_by_linkset_use"); + llassert(mFilterByLinksetUse != NULL); + mFilterByLinksetUse->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); + + childSetAction("apply_filters", boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); + childSetAction("clear_filters", boost::bind(&LLFloaterPathfindingLinksets::onClearFiltersClicked, this)); + + mEditLinksetUse = findChild<LLComboBox>("edit_linkset_use"); + llassert(mEditLinksetUse != NULL); + mEditLinksetUse->clearRows(); + + mEditLinksetUseUnset = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getString("linkset_choose_use"), XUI_LINKSET_USE_NONE)); + llassert(mEditLinksetUseUnset != NULL); + + mEditLinksetUseWalkable = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kWalkable), XUI_LINKSET_USE_WALKABLE)); + llassert(mEditLinksetUseWalkable != NULL); + + mEditLinksetUseStaticObstacle = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kStaticObstacle), XUI_LINKSET_USE_STATIC_OBSTACLE)); + llassert(mEditLinksetUseStaticObstacle != NULL); + + mEditLinksetUseDynamicObstacle = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kDynamicObstacle), XUI_LINKSET_USE_DYNAMIC_OBSTACLE)); + llassert(mEditLinksetUseDynamicObstacle != NULL); + + mEditLinksetUseMaterialVolume = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kMaterialVolume), XUI_LINKSET_USE_MATERIAL_VOLUME)); + llassert(mEditLinksetUseMaterialVolume != NULL); + + mEditLinksetUseExclusionVolume = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kExclusionVolume), XUI_LINKSET_USE_EXCLUSION_VOLUME)); + llassert(mEditLinksetUseExclusionVolume != NULL); + + mEditLinksetUseDynamicPhantom = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kDynamicPhantom), XUI_LINKSET_USE_DYNAMIC_PHANTOM)); + llassert(mEditLinksetUseDynamicPhantom != NULL); + + mEditLinksetUse->selectFirstItem(); + + mLabelWalkabilityCoefficients = findChild<LLTextBase>("walkability_coefficients_label"); + llassert(mLabelWalkabilityCoefficients != NULL); + + mLabelEditA = findChild<LLTextBase>("edit_a_label"); + llassert(mLabelEditA != NULL); + + mEditA = findChild<LLLineEditor>("edit_a_value"); + llassert(mEditA != NULL); + mEditA->setPrevalidate(LLTextValidate::validateNonNegativeS32); + mEditA->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + + mLabelEditB = findChild<LLTextBase>("edit_b_label"); + llassert(mLabelEditB != NULL); + + mEditB = findChild<LLLineEditor>("edit_b_value"); + llassert(mEditB != NULL); + mEditB->setPrevalidate(LLTextValidate::validateNonNegativeS32); + mEditB->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + + mLabelEditC = findChild<LLTextBase>("edit_c_label"); + llassert(mLabelEditC != NULL); + + mEditC = findChild<LLLineEditor>("edit_c_value"); + llassert(mEditC != NULL); + mEditC->setPrevalidate(LLTextValidate::validateNonNegativeS32); + mEditC->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + + mLabelEditD = findChild<LLTextBase>("edit_d_label"); + llassert(mLabelEditD != NULL); + + mEditD = findChild<LLLineEditor>("edit_d_value"); + llassert(mEditD != NULL); + mEditD->setPrevalidate(LLTextValidate::validateNonNegativeS32); + mEditD->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + + mApplyEditsButton = findChild<LLButton>("apply_edit_values"); + llassert(mApplyEditsButton != NULL); + mApplyEditsButton->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyChangesClicked, this)); + + return LLFloaterPathfindingObjects::postBuild(); +} + +void LLFloaterPathfindingLinksets::requestGetObjects() +{ + LLPathfindingManager::getInstance()->requestGetLinksets(getNewRequestId(), boost::bind(&LLFloaterPathfindingLinksets::handleNewObjectList, this, _1, _2, _3)); +} + +LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) +{ + llassert(pObjectListPtr != NULL); + llassert(!pObjectListPtr->isEmpty()); + + std::string nameFilter = mFilterByName->getText(); + std::string descriptionFilter = mFilterByDescription->getText(); + LLPathfindingLinkset::ELinksetUse linksetUseFilter = getFilterLinksetUse(); + bool isFilteringName = !nameFilter.empty(); + bool isFilteringDescription = !descriptionFilter.empty(); + bool isFilteringLinksetUse = (linksetUseFilter != LLPathfindingLinkset::kUnknown); + + LLSD scrollListData = LLSD::emptyArray(); + const LLVector3& avatarPosition = gAgent.getPositionAgent(); + + if (isFilteringName || isFilteringDescription || isFilteringLinksetUse) + { + LLStringUtil::toUpper(nameFilter); + LLStringUtil::toUpper(descriptionFilter); + for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter) + { + const LLPathfindingLinkset *linksetPtr = dynamic_cast<const LLPathfindingLinkset *>(objectIter->second.get()); + std::string linksetName = (linksetPtr->isTerrain() ? getString("linkset_terrain_name") : linksetPtr->getName()); + std::string linksetDescription = linksetPtr->getDescription(); + LLStringUtil::toUpper(linksetName); + LLStringUtil::toUpper(linksetDescription); + if ((!isFilteringName || (linksetName.find(nameFilter) != std::string::npos)) && + (!isFilteringDescription || (linksetDescription.find(descriptionFilter) != std::string::npos)) && + (!isFilteringLinksetUse || (linksetPtr->getLinksetUse() == linksetUseFilter))) + { + LLSD element = buildLinksetScrollListData(linksetPtr, avatarPosition); + scrollListData.append(element); + + if (linksetPtr->hasOwner() && !linksetPtr->hasOwnerName()) + { + rebuildScrollListAfterAvatarNameLoads(linksetPtr->getUUID()); + } + } + } + } + else + { + for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter) + { + const LLPathfindingLinkset *linksetPtr = dynamic_cast<const LLPathfindingLinkset *>(objectIter->second.get()); + LLSD element = buildLinksetScrollListData(linksetPtr, avatarPosition); + scrollListData.append(element); + + if (linksetPtr->hasOwner() && !linksetPtr->hasOwnerName()) + { + rebuildScrollListAfterAvatarNameLoads(linksetPtr->getUUID()); + } + } + } + + return scrollListData; +} + +void LLFloaterPathfindingLinksets::updateControls() +{ + LLFloaterPathfindingObjects::updateControls(); + updateEditFieldValues(); + updateStateOnEditFields(); + updateStateOnEditLinksetUse(); +} + +S32 LLFloaterPathfindingLinksets::getNameColumnIndex() const +{ + return 0; +} + +const LLColor4 &LLFloaterPathfindingLinksets::getBeaconColor() const +{ + return mBeaconColor; +} + +LLPathfindingObjectListPtr LLFloaterPathfindingLinksets::getEmptyObjectList() const +{ + LLPathfindingObjectListPtr objectListPtr(new LLPathfindingLinksetList()); + return objectListPtr; +} + +void LLFloaterPathfindingLinksets::requestSetLinksets(LLPathfindingObjectListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) +{ + LLPathfindingManager::getInstance()->requestSetLinksets(getNewRequestId(), pLinksetList, pLinksetUse, pA, pB, pC, pD, boost::bind(&LLFloaterPathfindingLinksets::handleUpdateObjectList, this, _1, _2, _3)); +} + +void LLFloaterPathfindingLinksets::onApplyAllFilters() +{ + applyFilters(); +} + +void LLFloaterPathfindingLinksets::onClearFiltersClicked() +{ + clearFilters(); +} + +void LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl) +{ + LLLineEditor *pLineEditor = static_cast<LLLineEditor *>(pUICtrl); + llassert(pLineEditor != NULL); + + const std::string &valueString = pLineEditor->getText(); + S32 value; + + if (LLStringUtil::convertToS32(valueString, value)) + { + if ((value < LLPathfindingLinkset::MIN_WALKABILITY_VALUE) || (value > LLPathfindingLinkset::MAX_WALKABILITY_VALUE)) + { + value = llclamp(value, LLPathfindingLinkset::MIN_WALKABILITY_VALUE, LLPathfindingLinkset::MAX_WALKABILITY_VALUE); + pLineEditor->setValue(LLSD(value)); + } + } + else + { + pLineEditor->setValue(LLSD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE)); + } +} + +void LLFloaterPathfindingLinksets::onApplyChangesClicked() +{ + applyEdit(); +} + +void LLFloaterPathfindingLinksets::onAgentStateChange(LLPathfindingManager::EAgentState pAgentState) +{ + updateControls(); +} + +void LLFloaterPathfindingLinksets::applyFilters() +{ + rebuildObjectsScrollList(); +} + +void LLFloaterPathfindingLinksets::clearFilters() +{ + mFilterByName->clear(); + mFilterByDescription->clear(); + setFilterLinksetUse(LLPathfindingLinkset::kUnknown); + rebuildObjectsScrollList(); +} + +void LLFloaterPathfindingLinksets::updateEditFieldValues() +{ + int numSelectedObjects = getNumSelectedObjects(); + if (numSelectedObjects <= 0) + { + mEditLinksetUse->selectFirstItem(); + mEditA->clear(); + mEditB->clear(); + mEditC->clear(); + mEditD->clear(); + } + else + { + LLPathfindingObjectPtr firstSelectedObjectPtr = getFirstSelectedObject(); + llassert(firstSelectedObjectPtr != NULL); + + const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(firstSelectedObjectPtr.get()); + + setEditLinksetUse(linkset->getLinksetUse()); + mEditA->setValue(LLSD(linkset->getWalkabilityCoefficientA())); + mEditB->setValue(LLSD(linkset->getWalkabilityCoefficientB())); + mEditC->setValue(LLSD(linkset->getWalkabilityCoefficientC())); + mEditD->setValue(LLSD(linkset->getWalkabilityCoefficientD())); + } +} + +LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListData(const LLPathfindingLinkset *pLinksetPtr, const LLVector3 &pAvatarPosition) const +{ + llassert(pLinksetPtr != NULL); + LLSD columns; + + if (pLinksetPtr->isTerrain()) + { + columns[0]["column"] = "name"; + columns[0]["value"] = getString("linkset_terrain_name"); + columns[0]["font"] = "SANSSERIF"; + + columns[1]["column"] = "description"; + columns[1]["value"] = getString("linkset_terrain_description"); + columns[1]["font"] = "SANSSERIF"; + + columns[2]["column"] = "owner"; + columns[2]["value"] = getString("linkset_terrain_owner"); + columns[2]["font"] = "SANSSERIF"; + + columns[3]["column"] = "land_impact"; + columns[3]["value"] = getString("linkset_terrain_land_impact"); + columns[3]["font"] = "SANSSERIF"; + + columns[4]["column"] = "dist_from_you"; + columns[4]["value"] = getString("linkset_terrain_dist_from_you"); + columns[4]["font"] = "SANSSERIF"; + } + else + { + columns[0]["column"] = "name"; + columns[0]["value"] = pLinksetPtr->getName(); + columns[0]["font"] = "SANSSERIF"; + + columns[1]["column"] = "description"; + columns[1]["value"] = pLinksetPtr->getDescription(); + columns[1]["font"] = "SANSSERIF"; + + columns[2]["column"] = "owner"; + columns[2]["value"] = (pLinksetPtr->hasOwner() ? + (pLinksetPtr->hasOwnerName() ? pLinksetPtr->getOwnerName() : getString("linkset_owner_loading")) : + getString("linkset_owner_unknown")); + columns[2]["font"] = "SANSSERIF"; + + columns[3]["column"] = "land_impact"; + columns[3]["value"] = llformat("%1d", pLinksetPtr->getLandImpact()); + columns[3]["font"] = "SANSSERIF"; + + columns[4]["column"] = "dist_from_you"; + columns[4]["value"] = llformat("%1.0f m", dist_vec(pAvatarPosition, pLinksetPtr->getLocation())); + columns[4]["font"] = "SANSSERIF"; + } + + columns[5]["column"] = "linkset_use"; + std::string linksetUse = getLinksetUseString(pLinksetPtr->getLinksetUse()); + if (pLinksetPtr->isTerrain()) + { + linksetUse += (" " + getString("linkset_is_terrain")); + } + else if (!pLinksetPtr->isModifiable() && pLinksetPtr->canBeVolume()) + { + linksetUse += (" " + getString("linkset_is_restricted_state")); + } + else if (pLinksetPtr->isModifiable() && !pLinksetPtr->canBeVolume()) + { + linksetUse += (" " + getString("linkset_is_non_volume_state")); + } + else if (!pLinksetPtr->isModifiable() && !pLinksetPtr->canBeVolume()) + { + linksetUse += (" " + getString("linkset_is_restricted_non_volume_state")); + } + columns[5]["value"] = linksetUse; + columns[5]["font"] = "SANSSERIF"; + + columns[6]["column"] = "a_percent"; + columns[6]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientA()); + columns[6]["font"] = "SANSSERIF"; + + columns[7]["column"] = "b_percent"; + columns[7]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientB()); + columns[7]["font"] = "SANSSERIF"; + + columns[8]["column"] = "c_percent"; + columns[8]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientC()); + columns[8]["font"] = "SANSSERIF"; + + columns[9]["column"] = "d_percent"; + columns[9]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientD()); + columns[9]["font"] = "SANSSERIF"; + + LLSD element; + element["id"] = pLinksetPtr->getUUID().asString(); + element["column"] = columns; + + return element; +} + +LLSD LLFloaterPathfindingLinksets::buildLinksetUseScrollListData(const std::string &pLabel, S32 pValue) const +{ + LLSD columns; + + columns[0]["column"] = "name"; + columns[0]["relwidth"] = static_cast<LLSD::Real>(100.0f); + columns[0]["value"] = pLabel; + columns[0]["font"] = "SANSSERIF"; + + LLSD element; + element["value"] = pValue; + element["column"] = columns; + + return element; +} + +bool LLFloaterPathfindingLinksets::isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + bool isShowWarning = false; + + if (pLinksetUse != LLPathfindingLinkset::kUnknown) + { + LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); + if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) + { + const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get()); + isShowWarning = linksetList->isShowUnmodifiablePhantomWarning(pLinksetUse); + } + } + + return isShowWarning; +} + +bool LLFloaterPathfindingLinksets::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + bool isShowWarning = false; + + if (pLinksetUse != LLPathfindingLinkset::kUnknown) + { + LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); + if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) + { + const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get()); + isShowWarning = linksetList->isShowCannotBeVolumeWarning(pLinksetUse); + } + } + + return isShowWarning; +} + +void LLFloaterPathfindingLinksets::updateStateOnEditFields() +{ + int numSelectedItems = getNumSelectedObjects(); + bool isEditEnabled = ((numSelectedItems > 0) && LLPathfindingManager::getInstance()->isAllowAlterPermanent()); + + mEditLinksetUse->setEnabled(isEditEnabled); + + mLabelWalkabilityCoefficients->setEnabled(isEditEnabled); + mLabelEditA->setEnabled(isEditEnabled); + mLabelEditB->setEnabled(isEditEnabled); + mLabelEditC->setEnabled(isEditEnabled); + mLabelEditD->setEnabled(isEditEnabled); + mEditA->setEnabled(isEditEnabled); + mEditB->setEnabled(isEditEnabled); + mEditC->setEnabled(isEditEnabled); + mEditD->setEnabled(isEditEnabled); + + mApplyEditsButton->setEnabled(isEditEnabled && (getMessagingState() == kMessagingComplete)); +} + +void LLFloaterPathfindingLinksets::updateStateOnEditLinksetUse() +{ + BOOL useWalkable = FALSE; + BOOL useStaticObstacle = FALSE; + BOOL useDynamicObstacle = FALSE; + BOOL useMaterialVolume = FALSE; + BOOL useExclusionVolume = FALSE; + BOOL useDynamicPhantom = FALSE; + + LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); + if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) + { + const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get()); + linksetList->determinePossibleStates(useWalkable, useStaticObstacle, useDynamicObstacle, useMaterialVolume, useExclusionVolume, useDynamicPhantom); + } + + mEditLinksetUseWalkable->setEnabled(useWalkable); + mEditLinksetUseStaticObstacle->setEnabled(useStaticObstacle); + mEditLinksetUseDynamicObstacle->setEnabled(useDynamicObstacle); + mEditLinksetUseMaterialVolume->setEnabled(useMaterialVolume); + mEditLinksetUseExclusionVolume->setEnabled(useExclusionVolume); + mEditLinksetUseDynamicPhantom->setEnabled(useDynamicPhantom); +} + +void LLFloaterPathfindingLinksets::applyEdit() +{ + LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse(); + + bool showUnmodifiablePhantomWarning = isShowUnmodifiablePhantomWarning(linksetUse); + bool showCannotBeVolumeWarning = isShowCannotBeVolumeWarning(linksetUse); + + if (showUnmodifiablePhantomWarning || showCannotBeVolumeWarning) + { + LLPathfindingLinkset::ELinksetUse restrictedLinksetUse = LLPathfindingLinkset::getLinksetUseWithToggledPhantom(linksetUse); + LLSD substitutions; + substitutions["REQUESTED_TYPE"] = getLinksetUseString(linksetUse); + substitutions["RESTRICTED_TYPE"] = getLinksetUseString(restrictedLinksetUse); + + std::string notificationName; + if (showUnmodifiablePhantomWarning && showCannotBeVolumeWarning) + { + notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnRestrictedAndVolume"; + } + else if (showUnmodifiablePhantomWarning) + { + notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnRestricted"; + } + else + { + notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnVolume"; + } + LLNotificationsUtil::add(notificationName, substitutions, LLSD(), boost::bind(&LLFloaterPathfindingLinksets::handleApplyEdit, this, _1, _2)); + } + else + { + doApplyEdit(); + } +} + +void LLFloaterPathfindingLinksets::handleApplyEdit(const LLSD &pNotification, const LLSD &pResponse) +{ + if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0) + { + doApplyEdit(); + } +} + +void LLFloaterPathfindingLinksets::doApplyEdit() +{ + LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); + if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) + { + LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse(); + const std::string &aString = mEditA->getText(); + const std::string &bString = mEditB->getText(); + const std::string &cString = mEditC->getText(); + const std::string &dString = mEditD->getText(); + S32 aValue = static_cast<S32>(atoi(aString.c_str())); + S32 bValue = static_cast<S32>(atoi(bString.c_str())); + S32 cValue = static_cast<S32>(atoi(cString.c_str())); + S32 dValue = static_cast<S32>(atoi(dString.c_str())); + + + requestSetLinksets(selectedObjects, linksetUse, aValue, bValue, cValue, dValue); + } +} + +std::string LLFloaterPathfindingLinksets::getLinksetUseString(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + std::string linksetUse; + + switch (pLinksetUse) + { + case LLPathfindingLinkset::kWalkable : + linksetUse = getString("linkset_use_walkable"); + break; + case LLPathfindingLinkset::kStaticObstacle : + linksetUse = getString("linkset_use_static_obstacle"); + break; + case LLPathfindingLinkset::kDynamicObstacle : + linksetUse = getString("linkset_use_dynamic_obstacle"); + break; + case LLPathfindingLinkset::kMaterialVolume : + linksetUse = getString("linkset_use_material_volume"); + break; + case LLPathfindingLinkset::kExclusionVolume : + linksetUse = getString("linkset_use_exclusion_volume"); + break; + case LLPathfindingLinkset::kDynamicPhantom : + linksetUse = getString("linkset_use_dynamic_phantom"); + break; + case LLPathfindingLinkset::kUnknown : + default : + linksetUse = getString("linkset_use_dynamic_obstacle"); + llassert(0); + break; + } + + return linksetUse; +} + +LLPathfindingLinkset::ELinksetUse LLFloaterPathfindingLinksets::getFilterLinksetUse() const +{ + return convertToLinksetUse(mFilterByLinksetUse->getValue()); +} + +void LLFloaterPathfindingLinksets::setFilterLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse) +{ + mFilterByLinksetUse->setValue(convertToXuiValue(pLinksetUse)); +} + +LLPathfindingLinkset::ELinksetUse LLFloaterPathfindingLinksets::getEditLinksetUse() const +{ + return convertToLinksetUse(mEditLinksetUse->getValue()); +} + +void LLFloaterPathfindingLinksets::setEditLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse) +{ + mEditLinksetUse->setValue(convertToXuiValue(pLinksetUse)); +} + +LLPathfindingLinkset::ELinksetUse LLFloaterPathfindingLinksets::convertToLinksetUse(LLSD pXuiValue) const +{ + LLPathfindingLinkset::ELinksetUse linkUse; + + switch (pXuiValue.asInteger()) + { + case XUI_LINKSET_USE_NONE : + linkUse = LLPathfindingLinkset::kUnknown; + break; + case XUI_LINKSET_USE_WALKABLE : + linkUse = LLPathfindingLinkset::kWalkable; + break; + case XUI_LINKSET_USE_STATIC_OBSTACLE : + linkUse = LLPathfindingLinkset::kStaticObstacle; + break; + case XUI_LINKSET_USE_DYNAMIC_OBSTACLE : + linkUse = LLPathfindingLinkset::kDynamicObstacle; + break; + case XUI_LINKSET_USE_MATERIAL_VOLUME : + linkUse = LLPathfindingLinkset::kMaterialVolume; + break; + case XUI_LINKSET_USE_EXCLUSION_VOLUME : + linkUse = LLPathfindingLinkset::kExclusionVolume; + break; + case XUI_LINKSET_USE_DYNAMIC_PHANTOM : + linkUse = LLPathfindingLinkset::kDynamicPhantom; + break; + default : + linkUse = LLPathfindingLinkset::kUnknown; + llassert(0); + break; + } + + return linkUse; +} + +LLSD LLFloaterPathfindingLinksets::convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + LLSD xuiValue; + + switch (pLinksetUse) + { + case LLPathfindingLinkset::kUnknown : + xuiValue = XUI_LINKSET_USE_NONE; + break; + case LLPathfindingLinkset::kWalkable : + xuiValue = XUI_LINKSET_USE_WALKABLE; + break; + case LLPathfindingLinkset::kStaticObstacle : + xuiValue = XUI_LINKSET_USE_STATIC_OBSTACLE; + break; + case LLPathfindingLinkset::kDynamicObstacle : + xuiValue = XUI_LINKSET_USE_DYNAMIC_OBSTACLE; + break; + case LLPathfindingLinkset::kMaterialVolume : + xuiValue = XUI_LINKSET_USE_MATERIAL_VOLUME; + break; + case LLPathfindingLinkset::kExclusionVolume : + xuiValue = XUI_LINKSET_USE_EXCLUSION_VOLUME; + break; + case LLPathfindingLinkset::kDynamicPhantom : + xuiValue = XUI_LINKSET_USE_DYNAMIC_PHANTOM; + break; + default : + xuiValue = XUI_LINKSET_USE_NONE; + llassert(0); + break; + } + + return xuiValue; +} diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h new file mode 100644 index 0000000000..4b19f09cda --- /dev/null +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -0,0 +1,138 @@ +/** + * @file llfloaterpathfindinglinksets.h + * @author William Todd Stinson + * @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERPATHFINDINGLINKSETS_H +#define LL_LLFLOATERPATHFINDINGLINKSETS_H + +#include "llfloaterpathfindingobjects.h" +#include "llpathfindinglinkset.h" +#include "llpathfindingmanager.h" +#include "llpathfindingobjectlist.h" +#include "v4color.h" + +class LLButton; +class LLComboBox; +class LLLineEditor; +class LLScrollListItem; +class LLSD; +class LLTextBase; +class LLUICtrl; +class LLVector3; + +class LLFloaterPathfindingLinksets : public LLFloaterPathfindingObjects +{ +public: + + virtual void onOpen(const LLSD& pKey); + virtual void onClose(bool pIsAppQuitting); + + static void openLinksetsEditor(); + +protected: + friend class LLFloaterReg; + + LLFloaterPathfindingLinksets(const LLSD& pSeed); + virtual ~LLFloaterPathfindingLinksets(); + + virtual BOOL postBuild(); + + virtual void requestGetObjects(); + + virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr); + + virtual void updateControls(); + + virtual S32 getNameColumnIndex() const; + virtual const LLColor4 &getBeaconColor() const; + + virtual LLPathfindingObjectListPtr getEmptyObjectList() const; + +private: + void requestSetLinksets(LLPathfindingObjectListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD); + + void onApplyAllFilters(); + void onClearFiltersClicked(); + void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl); + void onApplyChangesClicked(); + void onAgentStateChange(LLPathfindingManager::EAgentState pAgentState); + + void applyFilters(); + void clearFilters(); + + void updateEditFieldValues(); + LLSD buildLinksetScrollListData(const LLPathfindingLinkset *pLinksetPtr, const LLVector3 &pAvatarPosition) const; + LLSD buildLinksetUseScrollListData(const std::string &pLabel, S32 pValue) const; + + bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; + bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; + + void updateStateOnEditFields(); + void updateStateOnEditLinksetUse(); + + void applyEdit(); + void handleApplyEdit(const LLSD &pNotification, const LLSD &pResponse); + void doApplyEdit(); + + std::string getLinksetUseString(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; + + LLPathfindingLinkset::ELinksetUse getFilterLinksetUse() const; + void setFilterLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse); + + LLPathfindingLinkset::ELinksetUse getEditLinksetUse() const; + void setEditLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse); + + LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const; + LLSD convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; + + LLLineEditor *mFilterByName; + LLLineEditor *mFilterByDescription; + LLComboBox *mFilterByLinksetUse; + LLComboBox *mEditLinksetUse; + LLScrollListItem *mEditLinksetUseUnset; + LLScrollListItem *mEditLinksetUseWalkable; + LLScrollListItem *mEditLinksetUseStaticObstacle; + LLScrollListItem *mEditLinksetUseDynamicObstacle; + LLScrollListItem *mEditLinksetUseMaterialVolume; + LLScrollListItem *mEditLinksetUseExclusionVolume; + LLScrollListItem *mEditLinksetUseDynamicPhantom; + LLTextBase *mLabelWalkabilityCoefficients; + LLTextBase *mLabelEditA; + LLLineEditor *mEditA; + LLTextBase *mLabelEditB; + LLLineEditor *mEditB; + LLTextBase *mLabelEditC; + LLLineEditor *mEditC; + LLTextBase *mLabelEditD; + LLLineEditor *mEditD; + LLButton *mApplyEditsButton; + + LLColor4 mBeaconColor; + + LLPathfindingManager::agent_state_slot_t mAgentStateSlot; +}; + +#endif // LL_LLFLOATERPATHFINDINGLINKSETS_H diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp new file mode 100644 index 0000000000..6f183c78b1 --- /dev/null +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -0,0 +1,724 @@ +/** +* @file llfloaterpathfindingobjects.cpp +* @brief Implementation of llfloaterpathfindingobjects +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterpathfindingobjects.h" + +#include <vector> + +#include <boost/bind.hpp> +#include <boost/signals2.hpp> + +#include "llagent.h" +#include "llavatarname.h" +#include "llavatarnamecache.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llenvmanager.h" +#include "llfloater.h" +#include "llpathfindingmanager.h" +#include "llresmgr.h" +#include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llselectmgr.h" +#include "llsd.h" +#include "llstring.h" +#include "llstyle.h" +#include "lltextbase.h" +#include "lluicolortable.h" +#include "llviewermenu.h" +#include "llviewerobject.h" +#include "llviewerobjectlist.h" +#include "llviewerregion.h" +#include "v4color.h" +#include "pipeline.h" +#include "llfloaterreg.h" + +#define DEFAULT_BEACON_WIDTH 6 + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingObjects +//--------------------------------------------------------------------------- + +void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey) +{ + LLFloater::onOpen(pKey); + + selectNoneObjects(); + mObjectsScrollList->setCommitOnSelectionChange(TRUE); + + if (!mSelectionUpdateSlot.connected()) + { + mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterPathfindingObjects::onInWorldSelectionListChanged, this)); + } + + if (!mRegionBoundaryCrossingSlot.connected()) + { + mRegionBoundaryCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this)); + } + + if (!mGodLevelChangeSlot.connected()) + { + mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterPathfindingObjects::onGodLevelChange, this, _1)); + } + + requestGetObjects(); +} + +void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting) +{ + + if (mGodLevelChangeSlot.connected()) + { + mGodLevelChangeSlot.disconnect(); + } + + if (mRegionBoundaryCrossingSlot.connected()) + { + mRegionBoundaryCrossingSlot.disconnect(); + } + + if (mSelectionUpdateSlot.connected()) + { + mSelectionUpdateSlot.disconnect(); + } + + mObjectsScrollList->setCommitOnSelectionChange(FALSE); + selectNoneObjects(); + + if (mObjectsSelection.notNull()) + { + mObjectsSelection.clear(); + } +} + +void LLFloaterPathfindingObjects::draw() +{ + LLFloater::draw(); + + if (isShowBeacons()) + { + std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); + if (!selectedItems.empty()) + { + int numSelectedItems = selectedItems.size(); + S32 nameColumnIndex = getNameColumnIndex(); + const LLColor4 &beaconColor = getBeaconColor(); + const LLColor4 &beaconTextColor = getBeaconTextColor(); + S32 beaconWidth = getBeaconWidth(); + + std::vector<LLViewerObject *> viewerObjects; + viewerObjects.reserve(numSelectedItems); + + for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin(); + selectedItemIter != selectedItems.end(); ++selectedItemIter) + { + const LLScrollListItem *selectedItem = *selectedItemIter; + + LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID()); + if (viewerObject != NULL) + { + const std::string &objectName = selectedItem->getColumn(nameColumnIndex)->getValue().asString(); + gObjectList.addDebugBeacon(viewerObject->getPositionAgent(), objectName, beaconColor, beaconTextColor, beaconWidth); + } + } + } + } +} + +LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) + : LLFloater(pSeed), + mObjectsScrollList(NULL), + mMessagingStatus(NULL), + mRefreshListButton(NULL), + mSelectAllButton(NULL), + mSelectNoneButton(NULL), + mShowBeaconCheckBox(NULL), + mTakeButton(NULL), + mTakeCopyButton(NULL), + mReturnButton(NULL), + mDeleteButton(NULL), + mTeleportButton(NULL), + mLoadingAvatarNames(), + mDefaultBeaconColor(), + mDefaultBeaconTextColor(), + mErrorTextColor(), + mWarningTextColor(), + mMessagingState(kMessagingUnknown), + mMessagingRequestId(0U), + mObjectList(), + mObjectsSelection(), + mSelectionUpdateSlot(), + mRegionBoundaryCrossingSlot() +{ +} + +LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects() +{ +} + +BOOL LLFloaterPathfindingObjects::postBuild() +{ + mDefaultBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconColor"); + mDefaultBeaconTextColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconTextColor"); + mErrorTextColor = LLUIColorTable::getInstance()->getColor("PathfindingErrorColor"); + mWarningTextColor = LLUIColorTable::getInstance()->getColor("PathfindingWarningColor"); + + mObjectsScrollList = findChild<LLScrollListCtrl>("objects_scroll_list"); + llassert(mObjectsScrollList != NULL); + mObjectsScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onScrollListSelectionChanged, this)); + mObjectsScrollList->sortByColumnIndex(static_cast<U32>(getNameColumnIndex()), TRUE); + + mMessagingStatus = findChild<LLTextBase>("messaging_status"); + llassert(mMessagingStatus != NULL); + + mRefreshListButton = findChild<LLButton>("refresh_objects_list"); + llassert(mRefreshListButton != NULL); + mRefreshListButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onRefreshObjectsClicked, this)); + + mSelectAllButton = findChild<LLButton>("select_all_objects"); + llassert(mSelectAllButton != NULL); + mSelectAllButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onSelectAllObjectsClicked, this)); + + mSelectNoneButton = findChild<LLButton>("select_none_objects"); + llassert(mSelectNoneButton != NULL); + mSelectNoneButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onSelectNoneObjectsClicked, this)); + + mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon"); + llassert(mShowBeaconCheckBox != NULL); + + mTakeButton = findChild<LLButton>("take_objects"); + llassert(mTakeButton != NULL); + mTakeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeClicked, this)); + + mTakeCopyButton = findChild<LLButton>("take_copy_objects"); + llassert(mTakeCopyButton != NULL); + mTakeCopyButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeCopyClicked, this)); + + mReturnButton = findChild<LLButton>("return_objects"); + llassert(mReturnButton != NULL); + mReturnButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onReturnClicked, this)); + + mDeleteButton = findChild<LLButton>("delete_objects"); + llassert(mDeleteButton != NULL); + mDeleteButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onDeleteClicked, this)); + + mTeleportButton = findChild<LLButton>("teleport_me_to_object"); + llassert(mTeleportButton != NULL); + mTeleportButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTeleportClicked, this)); + + return LLFloater::postBuild(); +} + +void LLFloaterPathfindingObjects::requestGetObjects() +{ + llassert(0); +} + +LLPathfindingManager::request_id_t LLFloaterPathfindingObjects::getNewRequestId() +{ + return ++mMessagingRequestId; +} + +void LLFloaterPathfindingObjects::handleNewObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList) +{ + llassert(pRequestId <= mMessagingRequestId); + if (pRequestId == mMessagingRequestId) + { + switch (pRequestStatus) + { + case LLPathfindingManager::kRequestStarted : + setMessagingState(kMessagingGetRequestSent); + break; + case LLPathfindingManager::kRequestCompleted : + mObjectList = pObjectList; + rebuildObjectsScrollList(); + setMessagingState(kMessagingComplete); + break; + case LLPathfindingManager::kRequestNotEnabled : + clearAllObjects(); + setMessagingState(kMessagingNotEnabled); + break; + case LLPathfindingManager::kRequestError : + clearAllObjects(); + setMessagingState(kMessagingGetError); + break; + default : + clearAllObjects(); + setMessagingState(kMessagingGetError); + llassert(0); + break; + } + } +} + +void LLFloaterPathfindingObjects::handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList) +{ + llassert(pRequestId <= mMessagingRequestId); + if (pRequestId == mMessagingRequestId) + { + switch (pRequestStatus) + { + case LLPathfindingManager::kRequestStarted : + setMessagingState(kMessagingGetRequestSent); + break; + case LLPathfindingManager::kRequestCompleted : + if (mObjectList == NULL) + { + mObjectList = pObjectList; + } + else + { + mObjectList->update(pObjectList); + } + rebuildObjectsScrollList(); + setMessagingState(kMessagingComplete); + break; + case LLPathfindingManager::kRequestNotEnabled : + clearAllObjects(); + setMessagingState(kMessagingNotEnabled); + break; + case LLPathfindingManager::kRequestError : + clearAllObjects(); + setMessagingState(kMessagingSetError); + break; + default : + clearAllObjects(); + setMessagingState(kMessagingSetError); + llassert(0); + break; + } + } +} + +void LLFloaterPathfindingObjects::rebuildObjectsScrollList() +{ + std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); + int numSelectedItems = selectedItems.size(); + uuid_vec_t selectedUUIDs; + if (numSelectedItems > 0) + { + selectedUUIDs.reserve(selectedItems.size()); + for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin(); + itemIter != selectedItems.end(); ++itemIter) + { + const LLScrollListItem *listItem = *itemIter; + selectedUUIDs.push_back(listItem->getUUID()); + } + } + + S32 origScrollPosition = mObjectsScrollList->getScrollPos(); + mObjectsScrollList->deleteAllItems(); + + if ((mObjectList != NULL) && !mObjectList->isEmpty()) + { + LLSD scrollListData = convertObjectsIntoScrollListData(mObjectList); + llassert(scrollListData.isArray()); + for (LLSD::array_const_iterator elementIter = scrollListData.beginArray(); elementIter != scrollListData.endArray(); ++elementIter) + { + const LLSD &element = *elementIter; + mObjectsScrollList->addElement(element); + } + } + + mObjectsScrollList->selectMultiple(selectedUUIDs); + mObjectsScrollList->setScrollPos(origScrollPosition); + updateControls(); +} + +LLSD LLFloaterPathfindingObjects::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) +{ + llassert(0); + LLSD nullObjs = LLSD::emptyArray(); + return nullObjs; +} + +void LLFloaterPathfindingObjects::rebuildScrollListAfterAvatarNameLoads(const LLUUID &pAvatarId) +{ + std::set<LLUUID>::const_iterator iter = mLoadingAvatarNames.find(pAvatarId); + if (iter == mLoadingAvatarNames.end()) + { + mLoadingAvatarNames.insert(pAvatarId); + LLAvatarNameCache::get(pAvatarId, boost::bind(&LLFloaterPathfindingObjects::handleAvatarNameLoads, this, _1, _2)); + } +} + +void LLFloaterPathfindingObjects::updateControls() +{ + updateMessagingStatus(); + updateStateOnListActionControls(); + updateStateOnEditFields(); +} + +S32 LLFloaterPathfindingObjects::getNameColumnIndex() const +{ + return 0; +} + +const LLColor4 &LLFloaterPathfindingObjects::getBeaconColor() const +{ + return mDefaultBeaconColor; +} + +const LLColor4 &LLFloaterPathfindingObjects::getBeaconTextColor() const +{ + return mDefaultBeaconTextColor; +} + +S32 LLFloaterPathfindingObjects::getBeaconWidth() const +{ + return DEFAULT_BEACON_WIDTH; +} + +BOOL LLFloaterPathfindingObjects::isShowBeacons() const +{ + return mShowBeaconCheckBox->get(); +} + +void LLFloaterPathfindingObjects::clearAllObjects() +{ + selectNoneObjects(); + mObjectsScrollList->deleteAllItems(); + mObjectList.reset(); +} + +void LLFloaterPathfindingObjects::selectAllObjects() +{ + mObjectsScrollList->selectAll(); +} + +void LLFloaterPathfindingObjects::selectNoneObjects() +{ + mObjectsScrollList->deselectAllItems(); +} + +void LLFloaterPathfindingObjects::teleportToSelectedObject() +{ + std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); + llassert(selectedItems.size() == 1); + if (selectedItems.size() == 1) + { + std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front(); + const LLScrollListItem *selectedItem = selectedItemRef; + llassert(mObjectList != NULL); + const LLPathfindingObjectPtr objectPtr = mObjectList->find(selectedItem->getUUID().asString()); + const LLVector3 &objectLocation = objectPtr->getLocation(); + + LLViewerRegion* region = gAgent.getRegion(); + if (region != NULL) + { + gAgent.teleportRequest(region->getHandle(), objectLocation, true); + } + } +} + +LLPathfindingObjectListPtr LLFloaterPathfindingObjects::getEmptyObjectList() const +{ + llassert(0); + LLPathfindingObjectListPtr objectListPtr(new LLPathfindingObjectList()); + return objectListPtr; +} + +int LLFloaterPathfindingObjects::getNumSelectedObjects() const +{ + return mObjectsScrollList->getNumSelected(); +} + +LLPathfindingObjectListPtr LLFloaterPathfindingObjects::getSelectedObjects() const +{ + LLPathfindingObjectListPtr selectedObjects = getEmptyObjectList(); + + std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); + if (!selectedItems.empty()) + { + for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin(); + itemIter != selectedItems.end(); ++itemIter) + { + LLPathfindingObjectPtr objectPtr = findObject(*itemIter); + if (objectPtr != NULL) + { + selectedObjects->update(objectPtr); + } + } + } + + return selectedObjects; +} + +LLPathfindingObjectPtr LLFloaterPathfindingObjects::getFirstSelectedObject() const +{ + LLPathfindingObjectPtr objectPtr; + + std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); + if (!selectedItems.empty()) + { + objectPtr = findObject(selectedItems.front()); + } + + return objectPtr; +} + +LLFloaterPathfindingObjects::EMessagingState LLFloaterPathfindingObjects::getMessagingState() const +{ + return mMessagingState; +} + +void LLFloaterPathfindingObjects::setMessagingState(EMessagingState pMessagingState) +{ + mMessagingState = pMessagingState; + updateControls(); +} + +void LLFloaterPathfindingObjects::onRefreshObjectsClicked() +{ + requestGetObjects(); +} + +void LLFloaterPathfindingObjects::onSelectAllObjectsClicked() +{ + selectAllObjects(); +} + +void LLFloaterPathfindingObjects::onSelectNoneObjectsClicked() +{ + selectNoneObjects(); +} + +void LLFloaterPathfindingObjects::onTakeClicked() +{ + handle_take(); + requestGetObjects(); +} + +void LLFloaterPathfindingObjects::onTakeCopyClicked() +{ + handle_take_copy(); +} + +void LLFloaterPathfindingObjects::onReturnClicked() +{ + handle_object_return(); + requestGetObjects(); +} + +void LLFloaterPathfindingObjects::onDeleteClicked() +{ + handle_object_delete(); + requestGetObjects(); +} + +void LLFloaterPathfindingObjects::onTeleportClicked() +{ + teleportToSelectedObject(); +} + +void LLFloaterPathfindingObjects::onScrollListSelectionChanged() +{ + updateOnScrollListChange(); + updateControls(); +} + +void LLFloaterPathfindingObjects::onInWorldSelectionListChanged() +{ + updateControls(); +} + +void LLFloaterPathfindingObjects::onRegionBoundaryCrossed() +{ + requestGetObjects(); +} + +void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel) +{ + requestGetObjects(); +} + +void LLFloaterPathfindingObjects::handleAvatarNameLoads(const LLUUID &pAvatarId, const LLAvatarName &pAvatarName) +{ + llassert(mLoadingAvatarNames.find(pAvatarId) != mLoadingAvatarNames.end()); + mLoadingAvatarNames.erase(pAvatarId); + if (mLoadingAvatarNames.empty()) + { + rebuildObjectsScrollList(); + } +} + +void LLFloaterPathfindingObjects::updateMessagingStatus() +{ + std::string statusText(""); + LLStyle::Params styleParams; + + switch (getMessagingState()) + { + case kMessagingUnknown: + statusText = getString("messaging_initial"); + styleParams.color = mErrorTextColor; + break; + case kMessagingGetRequestSent : + statusText = getString("messaging_get_inprogress"); + styleParams.color = mWarningTextColor; + break; + case kMessagingGetError : + statusText = getString("messaging_get_error"); + styleParams.color = mErrorTextColor; + break; + case kMessagingSetRequestSent : + statusText = getString("messaging_set_inprogress"); + styleParams.color = mWarningTextColor; + break; + case kMessagingSetError : + statusText = getString("messaging_set_error"); + styleParams.color = mErrorTextColor; + break; + case kMessagingComplete : + if (mObjectsScrollList->isEmpty()) + { + statusText = getString("messaging_complete_none_found"); + } + else + { + S32 numItems = mObjectsScrollList->getItemCount(); + S32 numSelectedItems = mObjectsScrollList->getNumSelected(); + + LLLocale locale(LLStringUtil::getLocale()); + std::string numItemsString; + LLResMgr::getInstance()->getIntegerString(numItemsString, numItems); + + std::string numSelectedItemsString; + LLResMgr::getInstance()->getIntegerString(numSelectedItemsString, numSelectedItems); + + LLStringUtil::format_map_t string_args; + string_args["[NUM_SELECTED]"] = numSelectedItemsString; + string_args["[NUM_TOTAL]"] = numItemsString; + statusText = getString("messaging_complete_available", string_args); + } + break; + case kMessagingNotEnabled : + statusText = getString("messaging_not_enabled"); + styleParams.color = mErrorTextColor; + break; + default: + statusText = getString("messaging_initial"); + styleParams.color = mErrorTextColor; + llassert(0); + break; + } + + mMessagingStatus->setText((LLStringExplicit)statusText, styleParams); +} + +void LLFloaterPathfindingObjects::updateStateOnListActionControls() +{ + switch (getMessagingState()) + { + case kMessagingUnknown: + case kMessagingGetRequestSent : + case kMessagingSetRequestSent : + mRefreshListButton->setEnabled(FALSE); + mSelectAllButton->setEnabled(FALSE); + mSelectNoneButton->setEnabled(FALSE); + break; + case kMessagingGetError : + case kMessagingSetError : + case kMessagingNotEnabled : + mRefreshListButton->setEnabled(TRUE); + mSelectAllButton->setEnabled(FALSE); + mSelectNoneButton->setEnabled(FALSE); + break; + case kMessagingComplete : + { + int numItems = mObjectsScrollList->getItemCount(); + int numSelectedItems = mObjectsScrollList->getNumSelected(); + mRefreshListButton->setEnabled(TRUE); + mSelectAllButton->setEnabled(numSelectedItems < numItems); + mSelectNoneButton->setEnabled(numSelectedItems > 0); + } + break; + default: + llassert(0); + break; + } +} + +void LLFloaterPathfindingObjects::updateStateOnEditFields() +{ + int numSelectedItems = mObjectsScrollList->getNumSelected(); + bool isEditEnabled = (numSelectedItems > 0); + + mShowBeaconCheckBox->setEnabled(isEditEnabled); + mTakeButton->setEnabled(isEditEnabled && visible_take_object()); + mTakeCopyButton->setEnabled(isEditEnabled && enable_object_take_copy()); + mReturnButton->setEnabled(isEditEnabled && enable_object_return()); + mDeleteButton->setEnabled(isEditEnabled && enable_object_delete()); + mTeleportButton->setEnabled(numSelectedItems == 1); +} + +void LLFloaterPathfindingObjects::updateOnScrollListChange() +{ + mObjectsSelection.clear(); + LLSelectMgr::getInstance()->deselectAll(); + + std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); + if (!selectedItems.empty()) + { + int numSelectedItems = selectedItems.size(); + + std::vector<LLViewerObject *>viewerObjects; + viewerObjects.reserve(numSelectedItems); + + for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin(); + selectedItemIter != selectedItems.end(); ++selectedItemIter) + { + const LLScrollListItem *selectedItem = *selectedItemIter; + + LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID()); + if (viewerObject != NULL) + { + viewerObjects.push_back(viewerObject); + } + } + + if (!viewerObjects.empty()) + { + mObjectsSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects); + } + } +} + +LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollListItem *pListItem) const +{ + LLPathfindingObjectPtr objectPtr; + + LLUUID uuid = pListItem->getUUID(); + const std::string &uuidString = uuid.asString(); + llassert(mObjectList != NULL); + objectPtr = mObjectList->find(uuidString); + + return objectPtr; +} + diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h new file mode 100644 index 0000000000..cf418b3b71 --- /dev/null +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -0,0 +1,165 @@ +/** +* @file llfloaterpathfindingobjects.h +* @brief Header file for llfloaterpathfindingobjects +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#ifndef LL_LLFLOATERPATHFINDINGOBJECTS_H +#define LL_LLFLOATERPATHFINDINGOBJECTS_H + +#include <set> +#include <boost/signals2.hpp> + +#include "llagent.h" +#include "llfloater.h" +#include "llpathfindingmanager.h" +#include "llpathfindingobject.h" +#include "llpathfindingobjectlist.h" +#include "llselectmgr.h" +#include "v4color.h" + +class LLAvatarName; +class LLButton; +class LLCheckBoxCtrl; +class LLScrollListCtrl; +class LLScrollListItem; +class LLSD; +class LLTextBase; + +class LLFloaterPathfindingObjects : public LLFloater +{ +public: + virtual void onOpen(const LLSD &pKey); + virtual void onClose(bool pIsAppQuitting); + virtual void draw(); + +protected: + friend class LLFloaterReg; + + typedef enum + { + kMessagingUnknown, + kMessagingGetRequestSent, + kMessagingGetError, + kMessagingSetRequestSent, + kMessagingSetError, + kMessagingComplete, + kMessagingNotEnabled + } EMessagingState; + + LLFloaterPathfindingObjects(const LLSD &pSeed); + virtual ~LLFloaterPathfindingObjects(); + + virtual BOOL postBuild(); + + virtual void requestGetObjects(); + LLPathfindingManager::request_id_t getNewRequestId(); + void handleNewObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList); + void handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList); + + void rebuildObjectsScrollList(); + virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr); + + void rebuildScrollListAfterAvatarNameLoads(const LLUUID &pAvatarId); + + virtual void updateControls(); + + virtual S32 getNameColumnIndex() const; + virtual const LLColor4 &getBeaconColor() const; + virtual const LLColor4 &getBeaconTextColor() const; + virtual S32 getBeaconWidth() const; + + BOOL isShowBeacons() const; + void clearAllObjects(); + void selectAllObjects(); + void selectNoneObjects(); + void teleportToSelectedObject(); + + virtual LLPathfindingObjectListPtr getEmptyObjectList() const; + int getNumSelectedObjects() const; + LLPathfindingObjectListPtr getSelectedObjects() const; + LLPathfindingObjectPtr getFirstSelectedObject() const; + + EMessagingState getMessagingState() const; + +private: + LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther); + + void setMessagingState(EMessagingState pMessagingState); + + void onRefreshObjectsClicked(); + void onSelectAllObjectsClicked(); + void onSelectNoneObjectsClicked(); + void onTakeClicked(); + void onTakeCopyClicked(); + void onReturnClicked(); + void onDeleteClicked(); + void onTeleportClicked(); + + void onScrollListSelectionChanged(); + void onInWorldSelectionListChanged(); + void onRegionBoundaryCrossed(); + void onGodLevelChange(U8 pGodLevel); + + void handleAvatarNameLoads(const LLUUID &pAvatarId, const LLAvatarName &pAvatarName); + + void updateMessagingStatus(); + void updateStateOnListActionControls(); + void updateStateOnEditFields(); + void updateOnScrollListChange(); + + LLPathfindingObjectPtr findObject(const LLScrollListItem *pListItem) const; + + LLScrollListCtrl *mObjectsScrollList; + LLTextBase *mMessagingStatus; + LLButton *mRefreshListButton; + LLButton *mSelectAllButton; + LLButton *mSelectNoneButton; + LLCheckBoxCtrl *mShowBeaconCheckBox; + + LLButton *mTakeButton; + LLButton *mTakeCopyButton; + LLButton *mReturnButton; + LLButton *mDeleteButton; + LLButton *mTeleportButton; + + std::set<LLUUID> mLoadingAvatarNames; + + LLColor4 mDefaultBeaconColor; + LLColor4 mDefaultBeaconTextColor; + LLColor4 mErrorTextColor; + LLColor4 mWarningTextColor; + + EMessagingState mMessagingState; + LLPathfindingManager::request_id_t mMessagingRequestId; + + LLPathfindingObjectListPtr mObjectList; + + LLObjectSelectionHandle mObjectsSelection; + + boost::signals2::connection mSelectionUpdateSlot; + boost::signals2::connection mRegionBoundaryCrossingSlot; + LLAgent::god_level_change_slot_t mGodLevelChangeSlot; +}; + +#endif // LL_LLFLOATERPATHFINDINGOBJECTS_H diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 6978e6a430..c8599df161 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -110,9 +110,6 @@ void click_show_more(void*); void click_popup_info(void*); void click_popup_done(void*); void click_popup_minimize(void*); -void click_popup_rotate_left(void*); -void click_popup_rotate_reset(void*); -void click_popup_rotate_right(void*); void commit_slider_dozer_force(LLUICtrl *); void click_apply_to_selection(void*); void commit_radio_group_focus(LLUICtrl* ctrl); @@ -136,6 +133,7 @@ public: if(tools_floater) { tools_floater->updateLandImpacts(); + tools_floater->dirty(); } } }; @@ -954,24 +952,6 @@ void commit_slider_zoom(LLUICtrl *ctrl) gAgentCamera.setCameraZoomFraction(zoom_level); } -void click_popup_rotate_left(void*) -{ - LLSelectMgr::getInstance()->selectionRotateAroundZ( 45.f ); - dialog_refresh_all(); -} - -void click_popup_rotate_reset(void*) -{ - LLSelectMgr::getInstance()->selectionResetRotation(); - dialog_refresh_all(); -} - -void click_popup_rotate_right(void*) -{ - LLSelectMgr::getInstance()->selectionRotateAroundZ( -45.f ); - dialog_refresh_all(); -} - void commit_slider_dozer_force(LLUICtrl *ctrl) { // the slider is logarithmic, so we exponentiate to get the actual force multiplier diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index a8da94f75e..826e8d560a 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -479,9 +479,12 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) { LLSelectNode* selectNode = *iter; LLViewerObject* object = selectNode->getObject(); + LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit(); // have permission to move and object is root of selection or individually selected - if (object->permMove() && (object->isRootEdit() || selectNode->mIndividualSelection)) + if (object->permMove() && !object->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + (object->isRootEdit() || selectNode->mIndividualSelection)) { object->mUnselectedChildrenPositions.clear() ; } @@ -567,9 +570,12 @@ void LLManipRotate::drag( S32 x, S32 y ) { LLSelectNode* selectNode = *iter; LLViewerObject* object = selectNode->getObject(); + LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit(); // have permission to move and object is root of selection or individually selected - if (object->permMove() && (object->isRootEdit() || selectNode->mIndividualSelection)) + if (object->permMove() && !object->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + (object->isRootEdit() || selectNode->mIndividualSelection)) { if (!object->isRootEdit()) { @@ -621,9 +627,11 @@ void LLManipRotate::drag( S32 x, S32 y ) { LLSelectNode* selectNode = *iter; LLViewerObject* object = selectNode->getObject(); + LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit(); // to avoid cumulative position changes we calculate the objects new position using its saved position - if (object && object->permMove()) + if (object && object->permMove() && !object->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced())) { LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); @@ -704,7 +712,10 @@ void LLManipRotate::drag( S32 x, S32 y ) { LLSelectNode* selectNode = *iter; LLViewerObject*cur = selectNode->getObject(); - if( cur->permModify() && cur->permMove() && !cur->isAvatar()) + LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit(); + if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + !cur->isAvatar()) { selectNode->mLastRotation = cur->getRotation(); selectNode->mLastPositionLocal = cur->getPosition(); @@ -1871,7 +1882,10 @@ BOOL LLManipRotate::canAffectSelection() { virtual bool apply(LLViewerObject* objectp) { - return objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); + LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit(); + return objectp->permMove() && !objectp->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); } } func; can_rotate = mObjectSelection->applyToObjects(&func); diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index f6df4cdfbf..00a0bf8894 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -826,7 +826,10 @@ void LLManipScale::drag( S32 x, S32 y ) { LLSelectNode* selectNode = *iter; LLViewerObject*cur = selectNode->getObject(); - if( cur->permModify() && cur->permMove() && !cur->isAvatar()) + LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit(); + if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + !cur->isAvatar()) { selectNode->mLastScale = cur->getScale(); selectNode->mLastPositionLocal = cur->getPosition(); @@ -973,7 +976,10 @@ void LLManipScale::dragCorner( S32 x, S32 y ) { LLSelectNode* selectNode = *iter; LLViewerObject* cur = selectNode->getObject(); - if( cur->permModify() && cur->permMove() && !cur->isAvatar() ) + LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit(); + if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + !cur->isAvatar() ) { const LLVector3& scale = selectNode->mSavedScale; @@ -995,7 +1001,10 @@ void LLManipScale::dragCorner( S32 x, S32 y ) { LLSelectNode* selectNode = *iter; LLViewerObject* cur = selectNode->getObject(); - if( cur->permModify() && cur->permMove() && !cur->isAvatar() && cur->isRootEdit() ) + LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit(); + if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + !cur->isAvatar() && cur->isRootEdit() ) { const LLVector3& scale = selectNode->mSavedScale; cur->setScale( scale_factor * scale ); @@ -1043,7 +1052,10 @@ void LLManipScale::dragCorner( S32 x, S32 y ) { LLSelectNode* selectNode = *iter; LLViewerObject*cur = selectNode->getObject(); - if( cur->permModify() && cur->permMove() && !cur->isAvatar() && !cur->isRootEdit() ) + LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit(); + if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + !cur->isAvatar() && !cur->isRootEdit() ) { const LLVector3& scale = selectNode->mSavedScale; cur->setScale( scale_factor * scale, FALSE ); @@ -1251,7 +1263,10 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto { LLSelectNode* selectNode = *iter; LLViewerObject*cur = selectNode->getObject(); - if( cur->permModify() && cur->permMove() && !cur->isAvatar() ) + LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit(); + if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + !cur->isAvatar() ) { LLBBox cur_bbox = cur->getBoundingBoxAgent(); LLVector3 start_local = cur_bbox.agentToLocal( drag_start_agent ); @@ -2057,7 +2072,10 @@ BOOL LLManipScale::canAffectSelection() { virtual bool apply(LLViewerObject* objectp) { - return objectp->permModify() && objectp->permMove() && !objectp->isSeat(); + LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit(); + return objectp->permModify() && objectp->permMove() && !objectp->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + !objectp->isSeat(); } } func; can_scale = mObjectSelection->applyToObjects(&func); diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 3a88fbd96d..7a35562f86 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -687,7 +687,9 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } } - if (object->permMove()) + LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit(); + if (object->permMove() && !object->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced())) { // handle attachments in local space if (object->isAttachment() && object->mDrawable.notNull()) @@ -2281,7 +2283,10 @@ BOOL LLManipTranslate::canAffectSelection() { virtual bool apply(LLViewerObject* objectp) { - return objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); + LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit(); + return objectp->permMove() && !objectp->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); } } func; can_move = mObjectSelection->applyToObjects(&func); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 1f77e7a602..0473866ac0 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -66,6 +66,8 @@ #include "llviewercontrol.h" #include "lluictrlfactory.h" //#include "llfirstuse.h" +#include "llfloatertools.h" +#include "llpathfindingmanager.h" #include "lldrawpool.h" @@ -119,6 +121,11 @@ BOOL LLPanelObject::postBuild() mCheckPhantom = getChild<LLCheckBoxCtrl>("Phantom Checkbox Ctrl"); childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this); + // Permanent checkbox + mCheckPermanent = getChild<LLCheckBoxCtrl>("Permanent Checkbox Ctrl"); + + // Character checkbox + mCheckCharacter = getChild<LLCheckBoxCtrl>("Character Checkbox Ctrl"); // Position mLabelPosition = getChild<LLTextBox>("label position"); @@ -271,6 +278,8 @@ BOOL LLPanelObject::postBuild() childSetCommitCallback("sculpt mirror control", onCommitSculptType, this); mCtrlSculptInvert = getChild<LLCheckBoxCtrl>("sculpt invert control"); childSetCommitCallback("sculpt invert control", onCommitSculptType, this); + + LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLPanelObject::handleAgentStateCallback, this)); // Start with everyone disabled clearCtrls(); @@ -283,7 +292,6 @@ LLPanelObject::LLPanelObject() mIsPhysical(FALSE), mIsTemporary(FALSE), mIsPhantom(FALSE), - mCastShadows(TRUE), mSelectedType(MI_BOX), mSculptTextureRevert(LLUUID::null), mSculptTypeRevert(0) @@ -342,9 +350,9 @@ void LLPanelObject::getState( ) } // can move or rotate only linked group with move permissions, or sub-object with move and modify perms - BOOL enable_move = objectp->permMove() && !objectp->isAttachment() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); - BOOL enable_scale = objectp->permMove() && objectp->permModify(); - BOOL enable_rotate = objectp->permMove() && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); + BOOL enable_move = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && !objectp->isAttachment() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); + BOOL enable_scale = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && objectp->permModify(); + BOOL enable_rotate = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) @@ -495,29 +503,37 @@ void LLPanelObject::getState( ) } BOOL is_flexible = volobjp && volobjp->isFlexible(); + BOOL is_permanent = root_objectp->flagObjectPermanent(); + BOOL is_permanent_enforced = root_objectp->isPermanentEnforced(); + BOOL is_character = root_objectp->flagCharacter(); + llassert(!is_permanent || !is_character); // should never have a permanent object that is also a character // Physics checkbox - mIsPhysical = root_objectp->usePhysics(); + mIsPhysical = root_objectp->flagUsePhysics(); + llassert(!is_permanent || !mIsPhysical); // should never have a permanent object that is also physical + mCheckPhysics->set( mIsPhysical ); mCheckPhysics->setEnabled( roots_selected>0 && (editable || gAgent.isGodlike()) - && !is_flexible); + && !is_flexible && !is_permanent && !is_character); mIsTemporary = root_objectp->flagTemporaryOnRez(); + llassert(!is_permanent || !mIsTemporary); // should never has a permanent object that is also temporary + mCheckTemporary->set( mIsTemporary ); - mCheckTemporary->setEnabled( roots_selected>0 && editable ); + mCheckTemporary->setEnabled( roots_selected>0 && editable && !is_permanent); mIsPhantom = root_objectp->flagPhantom(); + llassert(!is_character || !mIsPhantom); // should never have a character that is also a phantom mCheckPhantom->set( mIsPhantom ); - mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible ); + mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible && !is_permanent_enforced && !is_character); + + mCheckPermanent->set(is_permanent); + mCheckPermanent->setEnabled(FALSE); + mCheckCharacter->set(is_character); + mCheckCharacter->setEnabled(FALSE); -#if 0 // 1.9.2 - mCastShadows = root_objectp->flagCastShadows(); - mCheckCastShadows->set( mCastShadows ); - mCheckCastShadows->setEnabled( roots_selected==1 && editable ); -#endif - //---------------------------------------------------------------------------- S32 selected_item = MI_BOX; @@ -555,7 +571,7 @@ void LLPanelObject::getState( ) { // Only allowed to change these parameters for objects // that you have permissions on AND are not attachments. - enabled = root_objectp->permModify(); + enabled = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); // Volume type const LLVolumeParams &volume_params = objectp->getVolume()->getParams(); @@ -1214,22 +1230,6 @@ void LLPanelObject::sendIsPhantom() } } -void LLPanelObject::sendCastShadows() -{ - BOOL value = mCheckCastShadows->get(); - if( mCastShadows != value ) - { - LLSelectMgr::getInstance()->selectionUpdateCastShadows(value); - mCastShadows = value; - - llinfos << "update cast shadows sent" << llendl; - } - else - { - llinfos << "update cast shadows not changed" << llendl; - } -} - // static void LLPanelObject::onCommitParametric( LLUICtrl* ctrl, void* userdata ) { @@ -1885,11 +1885,11 @@ void LLPanelObject::clearCtrls() mCheckTemporary ->setEnabled( FALSE ); mCheckPhantom ->set(FALSE); mCheckPhantom ->setEnabled( FALSE ); + mCheckPermanent ->set(FALSE); + mCheckPermanent ->setEnabled( FALSE ); + mCheckCharacter ->set(FALSE); + mCheckCharacter ->setEnabled( FALSE ); -#if 0 // 1.9.2 - mCheckCastShadows->set(FALSE); - mCheckCastShadows->setEnabled( FALSE ); -#endif // Disable text labels mLabelPosition ->setEnabled( FALSE ); mLabelSize ->setEnabled( FALSE ); @@ -1977,14 +1977,6 @@ void LLPanelObject::onCommitPhantom( LLUICtrl* ctrl, void* userdata ) self->sendIsPhantom(); } -// static -void LLPanelObject::onCommitCastShadows( LLUICtrl* ctrl, void* userdata ) -{ - LLPanelObject* self = (LLPanelObject*) userdata; - self->sendCastShadows(); -} - - void LLPanelObject::onSelectSculpt(const LLSD& data) { LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); @@ -2003,6 +1995,11 @@ void LLPanelObject::onCommitSculpt( const LLSD& data ) sendSculpt(); } +void LLPanelObject::handleAgentStateCallback() const +{ + gFloaterTools->dirty(); +} + BOOL LLPanelObject::onDropSculpt(LLInventoryItem* item) { LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 475dfdaedb..307d63aada 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -64,7 +64,6 @@ public: static void onCommitRotation( LLUICtrl* ctrl, void* userdata); static void onCommitTemporary( LLUICtrl* ctrl, void* userdata); static void onCommitPhantom( LLUICtrl* ctrl, void* userdata); - static void onCommitCastShadows( LLUICtrl* ctrl, void* userdata); static void onCommitPhysics( LLUICtrl* ctrl, void* userdata); static void onCommitParametric(LLUICtrl* ctrl, void* userdata); @@ -75,7 +74,8 @@ public: void onSelectSculpt(const LLSD& data); BOOL onDropSculpt(LLInventoryItem* item); static void onCommitSculptType( LLUICtrl *ctrl, void* userdata); - + + void handleAgentStateCallback() const; protected: void getState(); @@ -87,7 +87,6 @@ protected: void sendIsTemporary(); void sendIsPhantom(); - void sendCastShadows(); void sendSculpt(); void getVolumeParams(LLVolumeParams& volume_params); @@ -153,7 +152,8 @@ protected: LLCheckBoxCtrl *mCheckPhysics; LLCheckBoxCtrl *mCheckTemporary; LLCheckBoxCtrl *mCheckPhantom; - LLCheckBoxCtrl *mCheckCastShadows; + LLCheckBoxCtrl *mCheckPermanent; + LLCheckBoxCtrl *mCheckCharacter; LLTextureCtrl *mCtrlSculptTexture; LLTextBox *mLabelSculptType; @@ -165,7 +165,6 @@ protected: BOOL mIsPhysical; // to avoid sending "physical" when not changed BOOL mIsTemporary; // to avoid sending "temporary" when not changed BOOL mIsPhantom; // to avoid sending "phantom" when not changed - BOOL mCastShadows; // to avoid sending "cast shadows" when not changed S32 mSelectedType; // So we know what selected type we last were LLUUID mSculptTextureRevert; // so we can revert the sculpt texture on cancel diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 59130236f2..f3a16dbbf1 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -299,6 +299,9 @@ void LLPanelPermissions::refresh() BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); + BOOL is_nonpermanent = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsNonPermanent()) + || LLSelectMgr::getInstance()->selectGetNonPermanent(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; @@ -307,12 +310,18 @@ void LLPanelPermissions::refresh() getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), - getString("text modify info 4") + getString("text modify info 4"), + getString("text modify info 5"), + getString("text modify info 6") }; if (!is_perm_modify) { string_index += 2; } + else if (!is_nonpermanent) + { + string_index += 4; + } if (!is_one_object) { ++string_index; diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 12eea7844d..792d852d53 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -68,6 +68,7 @@ #include "llworld.h" #include "pipeline.h" #include "llviewershadermgr.h" +#include "llnotificationsutil.h" #include "lldrawpool.h" #include "lluictrlfactory.h" @@ -77,13 +78,15 @@ #include "llviewercontrol.h" #include "llmeshrepository.h" +#include <boost/bind.hpp> + // "Features" Tab BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { - childSetCommitCallback("Flexible1D Checkbox Ctrl",onCommitIsFlexible,this); + childSetCommitCallback("Flexible1D Checkbox Ctrl", boost::bind(&LLPanelVolume::onCommitIsFlexible, this, _1, _2), NULL); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); getChild<LLUICtrl>("FlexNumSections")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexGravity",onCommitFlexible,this); @@ -351,7 +354,7 @@ void LLPanelVolume::getState( ) getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(is_flexible); if (is_flexible || (volobjp && volobjp->canBeFlexible())) { - getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh()); + getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh() && !objectp->isPermanentEnforced()); } else { @@ -495,7 +498,7 @@ void LLPanelVolume::getState( ) mComboPhysicsShapeType->add(getString("Convex Hull"), LLSD(2)); mComboPhysicsShapeType->setValue(LLSD(objectp->getPhysicsShapeType())); - mComboPhysicsShapeType->setEnabled(editable); + mComboPhysicsShapeType->setEnabled(editable && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced())); mObject = objectp; mRootObject = root_objectp; @@ -873,10 +876,26 @@ void LLPanelVolume::onCommitFlexible( LLUICtrl* ctrl, void* userdata ) self->refresh(); } -// static -void LLPanelVolume::onCommitIsFlexible( LLUICtrl* ctrl, void* userdata ) +void LLPanelVolume::onCommitIsFlexible(LLUICtrl *, void*) { - LLPanelVolume* self = (LLPanelVolume*) userdata; - self->sendIsFlexible(); + if (mObject->flagObjectPermanent()) + { + LLNotificationsUtil::add("PathfindingLinksets_ChangeToFlexiblePath", LLSD(), LLSD(), boost::bind(&LLPanelVolume::handleResponseChangeToFlexible, this, _1, _2)); + } + else + { + sendIsFlexible(); + } } +void LLPanelVolume::handleResponseChangeToFlexible(const LLSD &pNotification, const LLSD &pResponse) +{ + if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0) + { + sendIsFlexible(); + } + else + { + getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(FALSE); + } +} diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index 0ef47db0d9..deb6b6f2a6 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -61,7 +61,7 @@ public: static void onCommitIsLight( LLUICtrl* ctrl, void* userdata); static void onCommitLight( LLUICtrl* ctrl, void* userdata); - static void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata); + void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata); static void onCommitFlexible( LLUICtrl* ctrl, void* userdata); static void onCommitPhysicsParam( LLUICtrl* ctrl, void* userdata); static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); @@ -84,6 +84,8 @@ protected: void sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata); void sendPhysicsDensity(LLUICtrl* ctrl, void* userdata); + void handleResponseChangeToFlexible(const LLSD &pNotification, const LLSD &pResponse); + /* LLTextBox* mLabelSelectSingleMessage; // Light diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp new file mode 100644 index 0000000000..42130d9fde --- /dev/null +++ b/indra/newview/llpathfindingcharacter.cpp @@ -0,0 +1,132 @@ +/** + * @file llpathfindingcharacter.cpp + * @author William Todd Stinson + * @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpathfindingcharacter.h" + +#include "llpathfindingobject.h" +#include "llsd.h" +#include "llpathinglib.h" + +#define CHARACTER_CPU_TIME_FIELD "cpu_time" +#define CHARACTER_HORIZONTAL_FIELD "horizontal" +#define CHARACTER_LENGTH_FIELD "length" +#define CHARACTER_RADIUS_FIELD "radius" + +//--------------------------------------------------------------------------- +// LLPathfindingCharacter +//--------------------------------------------------------------------------- + +LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const LLSD& pCharacterData) + : LLPathfindingObject(pUUID, pCharacterData), + mCPUTime(0U), +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mHasShapeData(false), +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mIsHorizontal(FALSE), + mLength(0.0f), + mRadius(0.0f) +{ + parseCharacterData(pCharacterData); +} + +LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOther) + : LLPathfindingObject(pOther), + mCPUTime(pOther.mCPUTime), +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mHasShapeData(pOther.mHasShapeData), +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mIsHorizontal(pOther.mIsHorizontal), + mLength(pOther.mLength), + mRadius(pOther.mRadius) +{ +} + +LLPathfindingCharacter::~LLPathfindingCharacter() +{ +} + +LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCharacter& pOther) +{ + dynamic_cast<LLPathfindingObject &>(*this) = pOther; + + mCPUTime = pOther.mCPUTime; +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mHasShapeData = pOther.mHasShapeData; +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mIsHorizontal = pOther.mIsHorizontal; + mLength = pOther.mLength; + mRadius = pOther.mRadius; + + return *this; +} + +void LLPathfindingCharacter::parseCharacterData(const LLSD &pCharacterData) +{ + llassert(pCharacterData.has(CHARACTER_CPU_TIME_FIELD)); + llassert(pCharacterData.get(CHARACTER_CPU_TIME_FIELD).isReal()); + mCPUTime = pCharacterData.get(CHARACTER_CPU_TIME_FIELD).asReal(); + +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + mHasShapeData = pCharacterData.has(CHARACTER_HORIZONTAL_FIELD); + if (mHasShapeData) + { + llassert(pCharacterData.has(CHARACTER_HORIZONTAL_FIELD)); + llassert(pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).isBoolean()); + mIsHorizontal = pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).asBoolean(); + + llassert(pCharacterData.has(CHARACTER_LENGTH_FIELD)); + llassert(pCharacterData.get(CHARACTER_LENGTH_FIELD).isReal()); + mLength = pCharacterData.get(CHARACTER_LENGTH_FIELD).asReal(); + + llassert(pCharacterData.has(CHARACTER_RADIUS_FIELD)); + llassert(pCharacterData.get(CHARACTER_RADIUS_FIELD).isReal()); + mRadius = pCharacterData.get(CHARACTER_RADIUS_FIELD).asReal(); + + //Create the rep inside the pathing library + LLVector3 empty(0,0,0); + LLPathingLib::getInstance()->createPhysicsCapsuleRep( mLength, mRadius, mIsHorizontal, empty, getUUID() ); + } +#else // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + llassert(pCharacterData.has(CHARACTER_HORIZONTAL_FIELD)); + llassert(pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).isBoolean()); + mIsHorizontal = pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).asBoolean(); + + llassert(pCharacterData.has(CHARACTER_LENGTH_FIELD)); + llassert(pCharacterData.get(CHARACTER_LENGTH_FIELD).isReal()); + mLength = pCharacterData.get(CHARACTER_LENGTH_FIELD).asReal(); + + llassert(pCharacterData.has(CHARACTER_RADIUS_FIELD)); + llassert(pCharacterData.get(CHARACTER_RADIUS_FIELD).isReal()); + mRadius = pCharacterData.get(CHARACTER_RADIUS_FIELD).asReal(); + + //Create the rep inside the pathing library + LLVector3 empty(0,0,0); + LLPathingLib::getInstance()->createPhysicsCapsuleRep( mLength, mRadius, mIsHorizontal, empty, getUUID() ); +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE +} diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h new file mode 100644 index 0000000000..772b68c533 --- /dev/null +++ b/indra/newview/llpathfindingcharacter.h @@ -0,0 +1,70 @@ +/** + * @file llpathfindingcharacter.h + * @author William Todd Stinson + * @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGCHARACTER_H +#define LL_LLPATHFINDINGCHARACTER_H + +#include "llpathfindingobject.h" + +class LLSD; + +class LLPathfindingCharacter : public LLPathfindingObject +{ +public: + LLPathfindingCharacter(const std::string &pUUID, const LLSD &pCharacterData); + LLPathfindingCharacter(const LLPathfindingCharacter& pOther); + virtual ~LLPathfindingCharacter(); + + LLPathfindingCharacter& operator =(const LLPathfindingCharacter& pOther); + + inline F32 getCPUTime() const {return mCPUTime;}; + +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + inline bool hasShapeData() const {return mHasShapeData;}; +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + inline BOOL isHorizontal() const {return mIsHorizontal;}; + inline F32 getLength() const {return mLength;}; + inline F32 getRadius() const {return mRadius;}; + +protected: + +public: + +private: + void parseCharacterData(const LLSD &pCharacterData); + + F32 mCPUTime; + +#ifndef SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + bool mHasShapeData; +#endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + BOOL mIsHorizontal; + F32 mLength; + F32 mRadius; +}; + +#endif // LL_LLPATHFINDINGCHARACTER_H diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp new file mode 100644 index 0000000000..15eaac771f --- /dev/null +++ b/indra/newview/llpathfindingcharacterlist.cpp @@ -0,0 +1,76 @@ +/** + * @file llpathfindingcharacterlist.cpp + * @author William Todd Stinson + * @brief Class to implement the list of a set of pathfinding characters + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpathfindingcharacterlist.h" + +#include "llpathfindingcharacter.h" +#include "llpathfindingobject.h" +#include "llpathfindingobjectlist.h" +#include "llsd.h" +#include "llpathinglib.h" + +//--------------------------------------------------------------------------- +// LLPathfindingCharacterList +//--------------------------------------------------------------------------- + +LLPathfindingCharacterList::LLPathfindingCharacterList() + : LLPathfindingObjectList() +{ +} + +LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterListData) + : LLPathfindingObjectList() +{ + if ( LLPathingLib::getInstance() == NULL ) + { + LLPathingLib::initSystem(); + } + + LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals( ); + + parseCharacterListData(pCharacterListData); +} + +LLPathfindingCharacterList::~LLPathfindingCharacterList() +{ +} + +void LLPathfindingCharacterList::parseCharacterListData(const LLSD& pCharacterListData) +{ + LLPathfindingObjectMap &objectMap = getObjectMap(); + + for (LLSD::map_const_iterator characterDataIter = pCharacterListData.beginMap(); + characterDataIter != pCharacterListData.endMap(); ++characterDataIter) + { + const std::string& uuid(characterDataIter->first); + const LLSD& characterData = characterDataIter->second; + LLPathfindingObjectPtr character(new LLPathfindingCharacter(uuid, characterData)); + objectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(uuid, character)); + } +} diff --git a/indra/newview/llpathfindingcharacterlist.h b/indra/newview/llpathfindingcharacterlist.h new file mode 100644 index 0000000000..734cfcafa1 --- /dev/null +++ b/indra/newview/llpathfindingcharacterlist.h @@ -0,0 +1,48 @@ +/** + * @file llpathfindingcharacterlist.h + * @author William Todd Stinson + * @brief Class to implement the list of a set of pathfinding characters + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGCHARACTERLIST_H +#define LL_LLPATHFINDINGCHARACTERLIST_H + +#include "llpathfindingobjectlist.h" + +class LLSD; + +class LLPathfindingCharacterList : public LLPathfindingObjectList +{ +public: + LLPathfindingCharacterList(); + LLPathfindingCharacterList(const LLSD& pCharacterListData); + virtual ~LLPathfindingCharacterList(); + +protected: + +private: + void parseCharacterListData(const LLSD& pCharacterListData); +}; + +#endif // LL_LLPATHFINDINGCHARACTERLIST_H diff --git a/indra/newview/llpathfindinglinkset.cpp b/indra/newview/llpathfindinglinkset.cpp new file mode 100644 index 0000000000..5b321b4408 --- /dev/null +++ b/indra/newview/llpathfindinglinkset.cpp @@ -0,0 +1,501 @@ +/** + * @file llpathfindinglinksets.cpp + * @author William Todd Stinson + * @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpathfindinglinkset.h" + +#include <string> + +#include "llpathfindingobject.h" +#include "llsd.h" + +#define LINKSET_LAND_IMPACT_FIELD "landimpact" +#define LINKSET_MODIFIABLE_FIELD "modifiable" +#ifdef DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS +#define DEPRECATED_LINKSET_PERMANENT_FIELD "permanent" +#define DEPRECATED_LINKSET_WALKABLE_FIELD "walkable" +#endif // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS +#define LINKSET_CATEGORY_FIELD "navmesh_category" +#define LINKSET_CAN_BE_VOLUME "can_be_volume" +#define LINKSET_PHANTOM_FIELD "phantom" +#define LINKSET_WALKABILITY_A_FIELD "A" +#define LINKSET_WALKABILITY_B_FIELD "B" +#define LINKSET_WALKABILITY_C_FIELD "C" +#define LINKSET_WALKABILITY_D_FIELD "D" + +#define LINKSET_CATEGORY_VALUE_INCLUDE 0 +#define LINKSET_CATEGORY_VALUE_EXCLUDE 1 +#define LINKSET_CATEGORY_VALUE_IGNORE 2 + +//--------------------------------------------------------------------------- +// LLPathfindingLinkset +//--------------------------------------------------------------------------- + +const S32 LLPathfindingLinkset::MIN_WALKABILITY_VALUE(0); +const S32 LLPathfindingLinkset::MAX_WALKABILITY_VALUE(100); + +LLPathfindingLinkset::LLPathfindingLinkset(const LLSD& pTerrainData) + : LLPathfindingObject(), + mIsTerrain(true), + mLandImpact(0U), +#ifdef MISSING_MODIFIABLE_FIELD_WAR + mHasModifiable(true), +#endif // MISSING_MODIFIABLE_FIELD_WAR + mIsModifiable(FALSE), + mCanBeVolume(FALSE), + mLinksetUse(kUnknown), + mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE), + mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE), + mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE), + mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE) +{ + parsePathfindingData(pTerrainData); +} + +LLPathfindingLinkset::LLPathfindingLinkset(const std::string &pUUID, const LLSD& pLinksetData) + : LLPathfindingObject(pUUID, pLinksetData), + mIsTerrain(false), + mLandImpact(0U), +#ifdef MISSING_MODIFIABLE_FIELD_WAR + mHasModifiable(false), +#endif // MISSING_MODIFIABLE_FIELD_WAR + mIsModifiable(TRUE), + mCanBeVolume(TRUE), + mLinksetUse(kUnknown), + mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE), + mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE), + mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE), + mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE) +{ + parseLinksetData(pLinksetData); + parsePathfindingData(pLinksetData); +} + +LLPathfindingLinkset::LLPathfindingLinkset(const LLPathfindingLinkset& pOther) + : LLPathfindingObject(pOther), + mIsTerrain(pOther.mIsTerrain), + mLandImpact(pOther.mLandImpact), +#ifdef MISSING_MODIFIABLE_FIELD_WAR + mHasModifiable(pOther.mHasModifiable), + mIsModifiable(pOther.mHasModifiable ? pOther.mIsModifiable : TRUE), +#else // MISSING_MODIFIABLE_FIELD_WAR + mIsModifiable(pOther.mIsModifiable), +#endif // MISSING_MODIFIABLE_FIELD_WAR + mCanBeVolume(pOther.mCanBeVolume), + mLinksetUse(pOther.mLinksetUse), + mWalkabilityCoefficientA(pOther.mWalkabilityCoefficientA), + mWalkabilityCoefficientB(pOther.mWalkabilityCoefficientB), + mWalkabilityCoefficientC(pOther.mWalkabilityCoefficientC), + mWalkabilityCoefficientD(pOther.mWalkabilityCoefficientD) +{ +} + +LLPathfindingLinkset::~LLPathfindingLinkset() +{ +} + +LLPathfindingLinkset& LLPathfindingLinkset::operator =(const LLPathfindingLinkset& pOther) +{ + dynamic_cast<LLPathfindingObject &>(*this) = pOther; + + mIsTerrain = pOther.mIsTerrain; + mLandImpact = pOther.mLandImpact; +#ifdef MISSING_MODIFIABLE_FIELD_WAR + if (pOther.mHasModifiable) + { + mHasModifiable = pOther.mHasModifiable; + mIsModifiable = pOther.mIsModifiable; + } +#else // MISSING_MODIFIABLE_FIELD_WAR + mIsModifiable = pOther.mIsModifiable; +#endif // MISSING_MODIFIABLE_FIELD_WAR + mCanBeVolume = pOther.mCanBeVolume; + mLinksetUse = pOther.mLinksetUse; + mWalkabilityCoefficientA = pOther.mWalkabilityCoefficientA; + mWalkabilityCoefficientB = pOther.mWalkabilityCoefficientB; + mWalkabilityCoefficientC = pOther.mWalkabilityCoefficientC; + mWalkabilityCoefficientD = pOther.mWalkabilityCoefficientD; + + return *this; +} + +BOOL LLPathfindingLinkset::isPhantom() const +{ + return isPhantom(getLinksetUse()); +} + +LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse) +{ + BOOL isPhantom = LLPathfindingLinkset::isPhantom(pLinksetUse); + ENavMeshGenerationCategory navMeshGenerationCategory = getNavMeshGenerationCategory(pLinksetUse); + + return getLinksetUse(!isPhantom, navMeshGenerationCategory); +} + +bool LLPathfindingLinkset::isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const +{ + return (!isModifiable() && (isPhantom() != isPhantom(pLinksetUse))); +} + +bool LLPathfindingLinkset::isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const +{ + return (!canBeVolume() && ((pLinksetUse == kMaterialVolume) || (pLinksetUse == kExclusionVolume))); +} + +LLSD LLPathfindingLinkset::encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +{ + LLSD itemData; + + if (!isTerrain() && (pLinksetUse != kUnknown) && (getLinksetUse() != pLinksetUse) && + (canBeVolume() || ((pLinksetUse != kMaterialVolume) && (pLinksetUse != kExclusionVolume)))) + { + if (isModifiable()) + { + itemData[LINKSET_PHANTOM_FIELD] = static_cast<bool>(isPhantom(pLinksetUse)); + } + +#ifdef DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + itemData[DEPRECATED_LINKSET_PERMANENT_FIELD] = static_cast<bool>(isPermanent(pLinksetUse)); + itemData[DEPRECATED_LINKSET_WALKABLE_FIELD] = static_cast<bool>(isWalkable(pLinksetUse)); +#endif // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + itemData[LINKSET_CATEGORY_FIELD] = convertCategoryToLLSD(getNavMeshGenerationCategory(pLinksetUse)); + } + + if (mWalkabilityCoefficientA != pA) + { + itemData[LINKSET_WALKABILITY_A_FIELD] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + } + + if (mWalkabilityCoefficientB != pB) + { + itemData[LINKSET_WALKABILITY_B_FIELD] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + } + + if (mWalkabilityCoefficientC != pC) + { + itemData[LINKSET_WALKABILITY_C_FIELD] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + } + + if (mWalkabilityCoefficientD != pD) + { + itemData[LINKSET_WALKABILITY_D_FIELD] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + } + + return itemData; +} + +void LLPathfindingLinkset::parseLinksetData(const LLSD &pLinksetData) +{ + llassert(pLinksetData.has(LINKSET_LAND_IMPACT_FIELD)); + llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).isInteger()); + llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger() >= 0); + mLandImpact = pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger(); + +#ifdef MISSING_MODIFIABLE_FIELD_WAR + mHasModifiable = pLinksetData.has(LINKSET_MODIFIABLE_FIELD); + if (mHasModifiable) + { + llassert(pLinksetData.get(LINKSET_MODIFIABLE_FIELD).isBoolean()); + mIsModifiable = pLinksetData.get(LINKSET_MODIFIABLE_FIELD).asBoolean(); + } +#else // MISSING_MODIFIABLE_FIELD_WAR + llassert(pLinksetData.has(LINKSET_MODIFIABLE_FIELD)); + llassert(pLinksetData.get(LINKSET_MODIFIABLE_FIELD).isBoolean()); + mIsModifiable = pLinksetData.get(LINKSET_MODIFIABLE_FIELD).asBoolean(); +#endif // MISSING_MODIFIABLE_FIELD_WAR +} + +void LLPathfindingLinkset::parsePathfindingData(const LLSD &pLinksetData) +{ + bool isPhantom = false; + if (pLinksetData.has(LINKSET_PHANTOM_FIELD)) + { + llassert(pLinksetData.get(LINKSET_PHANTOM_FIELD).isBoolean()); + isPhantom = pLinksetData.get(LINKSET_PHANTOM_FIELD).asBoolean(); + } + +#ifdef DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + if (pLinksetData.has(LINKSET_CATEGORY_FIELD)) + { + mLinksetUse = getLinksetUse(isPhantom, convertCategoryFromLLSD(pLinksetData.get(LINKSET_CATEGORY_FIELD))); + } + else + { + llassert(pLinksetData.has(DEPRECATED_LINKSET_PERMANENT_FIELD)); + llassert(pLinksetData.get(DEPRECATED_LINKSET_PERMANENT_FIELD).isBoolean()); + bool isPermanent = pLinksetData.get(DEPRECATED_LINKSET_PERMANENT_FIELD).asBoolean(); + + llassert(pLinksetData.has(DEPRECATED_LINKSET_WALKABLE_FIELD)); + llassert(pLinksetData.get(DEPRECATED_LINKSET_WALKABLE_FIELD).isBoolean()); + bool isWalkable = pLinksetData.get(DEPRECATED_LINKSET_WALKABLE_FIELD).asBoolean(); + + mLinksetUse = getLinksetUse(isPhantom, isPermanent, isWalkable); + } +#else // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + llassert(pLinksetData.has(LINKSET_CATEGORY_FIELD)); + mLinksetUse = getLinksetUse(isPhantom, convertCategoryFromLLSD(pLinksetData.get(LINKSET_CATEGORY_FIELD))); +#endif // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + + if (pLinksetData.has(LINKSET_CAN_BE_VOLUME)) + { + llassert(pLinksetData.get(LINKSET_CAN_BE_VOLUME).isBoolean()); + mCanBeVolume = pLinksetData.get(LINKSET_CAN_BE_VOLUME).asBoolean(); + } + + llassert(pLinksetData.has(LINKSET_WALKABILITY_A_FIELD)); + llassert(pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).isInteger()); + mWalkabilityCoefficientA = pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).asInteger(); + llassert(mWalkabilityCoefficientA >= MIN_WALKABILITY_VALUE); + llassert(mWalkabilityCoefficientA <= MAX_WALKABILITY_VALUE); + + llassert(pLinksetData.has(LINKSET_WALKABILITY_B_FIELD)); + llassert(pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).isInteger()); + mWalkabilityCoefficientB = pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).asInteger(); + llassert(mWalkabilityCoefficientB >= MIN_WALKABILITY_VALUE); + llassert(mWalkabilityCoefficientB <= MAX_WALKABILITY_VALUE); + + llassert(pLinksetData.has(LINKSET_WALKABILITY_C_FIELD)); + llassert(pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).isInteger()); + mWalkabilityCoefficientC = pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).asInteger(); + llassert(mWalkabilityCoefficientC >= MIN_WALKABILITY_VALUE); + llassert(mWalkabilityCoefficientC <= MAX_WALKABILITY_VALUE); + + llassert(pLinksetData.has(LINKSET_WALKABILITY_D_FIELD)); + llassert(pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).isInteger()); + mWalkabilityCoefficientD = pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).asInteger(); + llassert(mWalkabilityCoefficientD >= MIN_WALKABILITY_VALUE); + llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE); +} + +#ifdef DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS +LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUse(bool pIsPhantom, bool pIsPermanent, bool pIsWalkable) +{ + return (pIsPhantom ? (pIsPermanent ? (pIsWalkable ? kMaterialVolume : kExclusionVolume) : kDynamicPhantom) : + (pIsPermanent ? (pIsWalkable ? kWalkable : kStaticObstacle) : kDynamicObstacle)); +} + +BOOL LLPathfindingLinkset::isPermanent(ELinksetUse pLinksetUse) +{ + BOOL retVal; + + switch (pLinksetUse) + { + case kWalkable : + case kStaticObstacle : + case kMaterialVolume : + case kExclusionVolume : + retVal = true; + break; + case kDynamicObstacle : + case kDynamicPhantom : + retVal = false; + break; + case kUnknown : + default : + retVal = false; + llassert(0); + break; + } + + return retVal; +} + +BOOL LLPathfindingLinkset::isWalkable(ELinksetUse pLinksetUse) +{ + BOOL retVal; + + switch (pLinksetUse) + { + case kWalkable : + case kMaterialVolume : + retVal = true; + break; + case kStaticObstacle : + case kDynamicObstacle : + case kExclusionVolume : + case kDynamicPhantom : + retVal = false; + break; + case kUnknown : + default : + retVal = false; + llassert(0); + break; + } + + return retVal; +} +#endif // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + +BOOL LLPathfindingLinkset::isPhantom(ELinksetUse pLinksetUse) +{ + BOOL retVal; + + switch (pLinksetUse) + { + case kWalkable : + case kStaticObstacle : + case kDynamicObstacle : + retVal = false; + break; + case kMaterialVolume : + case kExclusionVolume : + case kDynamicPhantom : + retVal = true; + break; + case kUnknown : + default : + retVal = false; + llassert(0); + break; + } + + return retVal; +} + +LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory) +{ + ELinksetUse linksetUse = kUnknown; + + if (pIsPhantom) + { + switch (pNavMeshGenerationCategory) + { + case kNavMeshGenerationIgnore : + linksetUse = kDynamicPhantom; + break; + case kNavMeshGenerationInclude : + linksetUse = kMaterialVolume; + break; + case kNavMeshGenerationExclude : + linksetUse = kExclusionVolume; + break; + default : + linksetUse = kUnknown; + llassert(0); + break; + } + } + else + { + switch (pNavMeshGenerationCategory) + { + case kNavMeshGenerationIgnore : + linksetUse = kDynamicObstacle; + break; + case kNavMeshGenerationInclude : + linksetUse = kWalkable; + break; + case kNavMeshGenerationExclude : + linksetUse = kStaticObstacle; + break; + default : + linksetUse = kUnknown; + llassert(0); + break; + } + } + + return linksetUse; +} + +LLPathfindingLinkset::ENavMeshGenerationCategory LLPathfindingLinkset::getNavMeshGenerationCategory(ELinksetUse pLinksetUse) +{ + ENavMeshGenerationCategory navMeshGenerationCategory; + switch (pLinksetUse) + { + case kWalkable : + case kMaterialVolume : + navMeshGenerationCategory = kNavMeshGenerationInclude; + break; + case kStaticObstacle : + case kExclusionVolume : + navMeshGenerationCategory = kNavMeshGenerationExclude; + break; + case kDynamicObstacle : + case kDynamicPhantom : + navMeshGenerationCategory = kNavMeshGenerationIgnore; + break; + case kUnknown : + default : + navMeshGenerationCategory = kNavMeshGenerationIgnore; + llassert(0); + break; + } + + return navMeshGenerationCategory; +} + +LLSD LLPathfindingLinkset::convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory) +{ + LLSD llsd; + + switch (pNavMeshGenerationCategory) + { + case kNavMeshGenerationIgnore : + llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE); + break; + case kNavMeshGenerationInclude : + llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_INCLUDE); + break; + case kNavMeshGenerationExclude : + llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_EXCLUDE); + break; + default : + llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE); + llassert(0); + break; + } + + return llsd; +} + +LLPathfindingLinkset::ENavMeshGenerationCategory LLPathfindingLinkset::convertCategoryFromLLSD(const LLSD &llsd) +{ + ENavMeshGenerationCategory navMeshGenerationCategory; + + llassert(llsd.isInteger()); + switch (llsd.asInteger()) + { + case LINKSET_CATEGORY_VALUE_IGNORE : + navMeshGenerationCategory = kNavMeshGenerationIgnore; + break; + case LINKSET_CATEGORY_VALUE_INCLUDE : + navMeshGenerationCategory = kNavMeshGenerationInclude; + break; + case LINKSET_CATEGORY_VALUE_EXCLUDE : + navMeshGenerationCategory = kNavMeshGenerationExclude; + break; + default : + navMeshGenerationCategory = kNavMeshGenerationIgnore; + llassert(0); + break; + } + + return navMeshGenerationCategory; +} diff --git a/indra/newview/llpathfindinglinkset.h b/indra/newview/llpathfindinglinkset.h new file mode 100644 index 0000000000..a598452ea5 --- /dev/null +++ b/indra/newview/llpathfindinglinkset.h @@ -0,0 +1,120 @@ +/** + * @file llpathfindinglinkset.h + * @author William Todd Stinson + * @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGLINKSET_H +#define LL_LLPATHFINDINGLINKSET_H + +#include <string> + +#include "llpathfindingobject.h" + +#define DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS +#define MISSING_MODIFIABLE_FIELD_WAR + +class LLSD; + +class LLPathfindingLinkset : public LLPathfindingObject +{ +public: + typedef enum + { + kUnknown, + kWalkable, + kStaticObstacle, + kDynamicObstacle, + kMaterialVolume, + kExclusionVolume, + kDynamicPhantom + } ELinksetUse; + + LLPathfindingLinkset(const LLSD &pTerrainData); + LLPathfindingLinkset(const std::string &pUUID, const LLSD &pLinksetData); + LLPathfindingLinkset(const LLPathfindingLinkset& pOther); + virtual ~LLPathfindingLinkset(); + + LLPathfindingLinkset& operator = (const LLPathfindingLinkset& pOther); + + inline bool isTerrain() const {return mIsTerrain;}; + inline U32 getLandImpact() const {return mLandImpact;}; + BOOL isModifiable() const {return mIsModifiable;}; + BOOL isPhantom() const; + BOOL canBeVolume() const {return mCanBeVolume;}; + static ELinksetUse getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse); + + inline ELinksetUse getLinksetUse() const {return mLinksetUse;}; + + inline S32 getWalkabilityCoefficientA() const {return mWalkabilityCoefficientA;}; + inline S32 getWalkabilityCoefficientB() const {return mWalkabilityCoefficientB;}; + inline S32 getWalkabilityCoefficientC() const {return mWalkabilityCoefficientC;}; + inline S32 getWalkabilityCoefficientD() const {return mWalkabilityCoefficientD;}; + + bool isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const; + bool isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const; + LLSD encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const; + + static const S32 MIN_WALKABILITY_VALUE; + static const S32 MAX_WALKABILITY_VALUE; + +protected: + +private: + typedef enum + { + kNavMeshGenerationIgnore, + kNavMeshGenerationInclude, + kNavMeshGenerationExclude + } ENavMeshGenerationCategory; + + void parseLinksetData(const LLSD &pLinksetData); + void parsePathfindingData(const LLSD &pLinksetData); + +#ifdef DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + static ELinksetUse getLinksetUse(bool pIsPhantom, bool pIsPermanent, bool pIsWalkable); + static BOOL isPermanent(ELinksetUse pLinksetUse); + static BOOL isWalkable(ELinksetUse pLinksetUse); +#endif // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS + static BOOL isPhantom(ELinksetUse pLinksetUse); + static ELinksetUse getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory); + static ENavMeshGenerationCategory getNavMeshGenerationCategory(ELinksetUse pLinksetUse); + static LLSD convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory); + static ENavMeshGenerationCategory convertCategoryFromLLSD(const LLSD &llsd); + + bool mIsTerrain; + U32 mLandImpact; +#ifdef MISSING_MODIFIABLE_FIELD_WAR + bool mHasModifiable; +#endif // MISSING_MODIFIABLE_FIELD_WAR + BOOL mIsModifiable; + BOOL mCanBeVolume; + ELinksetUse mLinksetUse; + S32 mWalkabilityCoefficientA; + S32 mWalkabilityCoefficientB; + S32 mWalkabilityCoefficientC; + S32 mWalkabilityCoefficientD; +}; + +#endif // LL_LLPATHFINDINGLINKSET_H diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp new file mode 100644 index 0000000000..5323635438 --- /dev/null +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -0,0 +1,195 @@ +/** + * @file llpathfindinglinksetlist.cpp + * @author William Todd Stinson + * @brief Class to implement the list of a set of pathfinding linksets + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpathfindinglinksetlist.h" + +#include <string> +#include <map> + +#include "llpathfindinglinkset.h" +#include "llpathfindingobject.h" +#include "llpathfindingobjectlist.h" +#include "llsd.h" + +//--------------------------------------------------------------------------- +// LLPathfindingLinksetList +//--------------------------------------------------------------------------- + +LLPathfindingLinksetList::LLPathfindingLinksetList() + : LLPathfindingObjectList() +{ +} + +LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetListData) + : LLPathfindingObjectList() +{ + parseLinksetListData(pLinksetListData); +} + +LLPathfindingLinksetList::~LLPathfindingLinksetList() +{ +} + +LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +{ + LLSD listData; + + for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + { + const LLPathfindingObjectPtr objectPtr = linksetIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get()); + + if (!linkset->isTerrain()) + { + LLSD linksetData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + if (!linksetData.isUndefined()) + { + const std::string& uuid(linksetIter->first); + listData[uuid] = linksetData; + } + } + } + + return listData; +} + +LLSD LLPathfindingLinksetList::encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const +{ + LLSD terrainData; + + for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter) + { + const LLPathfindingObjectPtr objectPtr = linksetIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get()); + + if (linkset->isTerrain()) + { + terrainData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD); + break; + } + } + + return terrainData; +} + +bool LLPathfindingLinksetList::isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + bool isShowWarning = false; + + for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter) + { + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get()); + isShowWarning = linkset->isShowUnmodifiablePhantomWarning(pLinksetUse); + } + + return isShowWarning; +} + +bool LLPathfindingLinksetList::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + bool isShowWarning = false; + + for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter) + { + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get()); + isShowWarning = linkset->isShowCannotBeVolumeWarning(pLinksetUse); + } + + return isShowWarning; +} + +void LLPathfindingLinksetList::determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle, + BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const +{ + pCanBeWalkable = FALSE; + pCanBeStaticObstacle = FALSE; + pCanBeDynamicObstacle = FALSE; + pCanBeMaterialVolume = FALSE; + pCanBeExclusionVolume = FALSE; + pCanBeDynamicPhantom = FALSE; + + for (const_iterator objectIter = begin(); + !(pCanBeWalkable && pCanBeStaticObstacle && pCanBeDynamicObstacle && pCanBeMaterialVolume && pCanBeExclusionVolume && pCanBeDynamicPhantom) && (objectIter != end()); + ++objectIter) + { + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get()); + + if (linkset->isTerrain()) + { + pCanBeWalkable = TRUE; + } + else + { + if (linkset->isModifiable()) + { + pCanBeWalkable = TRUE; + pCanBeStaticObstacle = TRUE; + pCanBeDynamicObstacle = TRUE; + pCanBeDynamicPhantom = TRUE; + if (linkset->canBeVolume()) + { + pCanBeMaterialVolume = TRUE; + pCanBeExclusionVolume = TRUE; + } + } + else if (linkset->isPhantom()) + { + pCanBeDynamicPhantom = TRUE; + if (linkset->canBeVolume()) + { + pCanBeMaterialVolume = TRUE; + pCanBeExclusionVolume = TRUE; + } + } + else + { + pCanBeWalkable = TRUE; + pCanBeStaticObstacle = TRUE; + pCanBeDynamicObstacle = TRUE; + } + } + } +} + +void LLPathfindingLinksetList::parseLinksetListData(const LLSD& pLinksetListData) +{ + LLPathfindingObjectMap &objectMap = getObjectMap(); + + for (LLSD::map_const_iterator linksetDataIter = pLinksetListData.beginMap(); + linksetDataIter != pLinksetListData.endMap(); ++linksetDataIter) + { + const std::string& uuid(linksetDataIter->first); + const LLSD& linksetData = linksetDataIter->second; + LLPathfindingObjectPtr linksetPtr(new LLPathfindingLinkset(uuid, linksetData)); + objectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(uuid, linksetPtr)); + } +} diff --git a/indra/newview/llpathfindinglinksetlist.h b/indra/newview/llpathfindinglinksetlist.h new file mode 100644 index 0000000000..50a8e069d0 --- /dev/null +++ b/indra/newview/llpathfindinglinksetlist.h @@ -0,0 +1,58 @@ +/** + * @file llpathfindinglinksetlist.h + * @author William Todd Stinson + * @brief Class to implement the list of a set of pathfinding linksets + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGLINKSETLIST_H +#define LL_LLPATHFINDINGLINKSETLIST_H + +#include "llpathfindinglinkset.h" +#include "llpathfindingobjectlist.h" + +class LLSD; + +class LLPathfindingLinksetList : public LLPathfindingObjectList +{ +public: + LLPathfindingLinksetList(); + LLPathfindingLinksetList(const LLSD& pLinksetListData); + virtual ~LLPathfindingLinksetList(); + + LLSD encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const; + LLSD encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const; + + bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; + bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; + + void determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle, + BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const; + +protected: + +private: + void parseLinksetListData(const LLSD& pLinksetListData); +}; + +#endif // LL_LLPATHFINDINGLINKSETLIST_H diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp new file mode 100644 index 0000000000..e282a3e2f4 --- /dev/null +++ b/indra/newview/llpathfindingmanager.cpp @@ -0,0 +1,1065 @@ +/** + * @file llpathfindingmanager.cpp + * @author William Todd Stinson + * @brief A state manager for the various pathfinding states. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpathfindingmanager.h" + +#include <string> +#include <map> + +#include <boost/function.hpp> +#include <boost/signals2.hpp> + +#include "llagent.h" +#include "llhttpclient.h" +#include "llhttpnode.h" +#include "llnotificationsutil.h" +#include "llpathfindingcharacterlist.h" +#include "llpathfindinglinkset.h" +#include "llpathfindinglinksetlist.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "llpathfindingobject.h" +#include "llsingleton.h" +#include "llsd.h" +#include "lltrans.h" +#include "lluuid.h" +#include "llviewerregion.h" +#include "llweb.h" + +#define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" + +#define CAP_SERVICE_NAVMESH_STATUS "NavMeshGenerationStatus" + +#define CAP_SERVICE_AGENT_STATE "AgentPreferences" +#define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_objects" +#define DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD "alter_permanent_objects" + +#define CAP_SERVICE_OBJECT_LINKSETS "ObjectNavMeshProperties" +#define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties" + +#define CAP_SERVICE_CHARACTERS "CharacterProperties" + +#define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavMeshStatusUpdate" +#define SIM_MESSAGE_AGENT_STATE_UPDATE "/message/AgentPreferencesUpdate" +#define SIM_MESSAGE_BODY_FIELD "body" + +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +class LLNavMeshSimStateChangeNode : public LLHTTPNode +{ +public: + virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; +}; + +LLHTTPRegistration<LLNavMeshSimStateChangeNode> gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE); + +//--------------------------------------------------------------------------- +// LLAgentStateChangeNode +//--------------------------------------------------------------------------- + +class LLAgentStateChangeNode : public LLHTTPNode +{ +public: + virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; +}; + +LLHTTPRegistration<LLAgentStateChangeNode> gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE); + +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +class NavMeshStatusResponder : public LLHTTPClient::Responder +{ +public: + NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion); + virtual ~NavMeshStatusResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + LLViewerRegion *mRegion; + LLUUID mRegionUUID; +}; + +//--------------------------------------------------------------------------- +// NavMeshResponder +//--------------------------------------------------------------------------- + +class NavMeshResponder : public LLHTTPClient::Responder +{ +public: + NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr); + virtual ~NavMeshResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + U32 mNavMeshVersion; + LLPathfindingNavMeshPtr mNavMeshPtr; +}; + +//--------------------------------------------------------------------------- +// AgentStateResponder +//--------------------------------------------------------------------------- + +class AgentStateResponder : public LLHTTPClient::Responder +{ +public: + AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState = LLPathfindingManager::kAgentStateUnknown); + virtual ~AgentStateResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + LLPathfindingManager::EAgentState mRequestedAgentState; +}; + +//--------------------------------------------------------------------------- +// LinksetsResponder +//--------------------------------------------------------------------------- + +class LinksetsResponder +{ +public: + LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested); + virtual ~LinksetsResponder(); + + void handleObjectLinksetsResult(const LLSD &pContent); + void handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); + void handleTerrainLinksetsResult(const LLSD &pContent); + void handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); + +protected: + +private: + void sendCallback(); + + typedef enum + { + kNotRequested, + kWaiting, + kReceivedGood, + kReceivedError + } EMessagingState; + + LLPathfindingManager::request_id_t mRequestId; + LLPathfindingManager::object_request_callback_t mLinksetsCallback; + + EMessagingState mObjectMessagingState; + EMessagingState mTerrainMessagingState; + + LLPathfindingObjectListPtr mObjectLinksetListPtr; + LLPathfindingObjectPtr mTerrainLinksetPtr; +}; + +typedef boost::shared_ptr<LinksetsResponder> LinksetsResponderPtr; + +//--------------------------------------------------------------------------- +// ObjectLinksetsResponder +//--------------------------------------------------------------------------- + +class ObjectLinksetsResponder : public LLHTTPClient::Responder +{ +public: + ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); + virtual ~ObjectLinksetsResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string &pReason); + +protected: + +private: + std::string mCapabilityURL; + LinksetsResponderPtr mLinksetsResponsderPtr; +}; + +//--------------------------------------------------------------------------- +// TerrainLinksetsResponder +//--------------------------------------------------------------------------- + +class TerrainLinksetsResponder : public LLHTTPClient::Responder +{ +public: + TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); + virtual ~TerrainLinksetsResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string &pReason); + +protected: + +private: + std::string mCapabilityURL; + LinksetsResponderPtr mLinksetsResponsderPtr; +}; + +//--------------------------------------------------------------------------- +// CharactersResponder +//--------------------------------------------------------------------------- + +class CharactersResponder : public LLHTTPClient::Responder +{ +public: + CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pCharactersCallback); + virtual ~CharactersResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string &pReason); + +protected: + +private: + std::string mCapabilityURL; + LLPathfindingManager::request_id_t mRequestId; + LLPathfindingManager::object_request_callback_t mCharactersCallback; +}; + +//--------------------------------------------------------------------------- +// LLPathfindingManager +//--------------------------------------------------------------------------- + +LLPathfindingManager::LLPathfindingManager() + : LLSingleton<LLPathfindingManager>(), + mNavMeshMap(), + mAgentStateSignal(), + mAgentState(kAgentStateUnknown), + mLastKnownNonErrorAgentState(kAgentStateUnknown) +{ +} + +LLPathfindingManager::~LLPathfindingManager() +{ +} + +bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const +{ + return isPathfindingEnabledForRegion(getCurrentRegion()); +} + +bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const +{ + std::string retrieveNavMeshURL = getRetrieveNavMeshURLForRegion(pRegion); + return !retrieveNavMeshURL.empty(); +} + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH +bool LLPathfindingManager::isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const +{ + std::string navMeshStatusURL = getNavMeshStatusURLForRegion(getCurrentRegion()); + return !navMeshStatusURL.empty(); +} +#endif // DEPRECATED_UNVERSIONED_NAVMESH + +bool LLPathfindingManager::isAllowAlterPermanent() +{ + return (!isPathfindingEnabledForCurrentRegion() || (getAgentState() == kAgentStateUnfrozen)); +} + +bool LLPathfindingManager::isAllowViewTerrainProperties() const +{ + LLViewerRegion* region = getCurrentRegion(); + return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate())); +} + +LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); + return navMeshPtr->registerNavMeshListener(pNavMeshCallback); +} + +void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); + + if (pRegion == NULL) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else if (!pRegion->capabilitiesReceived()) + { + navMeshPtr->handleNavMeshWaitForRegionLoad(); + pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1)); + } + else if (!isPathfindingEnabledForRegion(pRegion)) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion); +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (navMeshStatusURL.empty()) + { + LLPathfindingNavMeshStatus navMeshStatus = navMeshPtr->getNavMeshStatusXXX(); + navMeshStatus.incrementNavMeshVersionXXX(); + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, navMeshStatus); + } + else + { + navMeshPtr->handleNavMeshCheckVersion(); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); + LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + llassert(!navMeshStatusURL.empty()); + navMeshPtr->handleNavMeshCheckVersion(); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); + LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); +#endif // DEPRECATED_UNVERSIONED_NAVMESH + } +} + +LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) +{ + return mAgentStateSignal.connect(pAgentStateCallback); +} + +LLPathfindingManager::EAgentState LLPathfindingManager::getAgentState() +{ + if (!isPathfindingEnabledForCurrentRegion()) + { + setAgentState(kAgentStateNotEnabled); + } + else + { + if (!isValidAgentState(mAgentState)) + { + requestGetAgentState(); + } + } + + return mAgentState; +} + +LLPathfindingManager::EAgentState LLPathfindingManager::getLastKnownNonErrorAgentState() const +{ + return mLastKnownNonErrorAgentState; +} + +void LLPathfindingManager::requestSetAgentState(EAgentState pRequestedAgentState) +{ + llassert(isValidAgentState(pRequestedAgentState)); + std::string agentStateURL = getAgentStateURLForCurrentRegion(); + + if (agentStateURL.empty()) + { + setAgentState(kAgentStateNotEnabled); + } + else + { + LLSD request; + request[ALTER_NAVMESH_OBJECTS_FIELD] = static_cast<LLSD::Boolean>(pRequestedAgentState == kAgentStateUnfrozen); +#ifdef DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + request[DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD] = static_cast<LLSD::Boolean>(pRequestedAgentState == kAgentStateUnfrozen); +#endif // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + + LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL, pRequestedAgentState); + LLHTTPClient::post(agentStateURL, request, responder); + } +} + +void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const +{ + LLPathfindingObjectListPtr emptyLinksetListPtr; + LLViewerRegion *currentRegion = getCurrentRegion(); + + if (currentRegion == NULL) + { + pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr); + } + else if (!currentRegion->capabilitiesReceived()) + { + pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr); + currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetLinksetsForRegion, this, _1, pRequestId, pLinksetsCallback)); + } + else + { + std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); + std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); + if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) + { + pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr); + } + else + { + pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr); + + bool doRequestTerrain = isAllowViewTerrainProperties(); + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); + + LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); + LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); + + if (doRequestTerrain) + { + LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); + LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); + } + } + } +} + +void LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, const LLPathfindingObjectListPtr &pLinksetListPtr, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, object_request_callback_t pLinksetsCallback) const +{ + LLPathfindingObjectListPtr emptyLinksetListPtr; + + std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); + std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); + if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) + { + pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr); + } + else if ((pLinksetListPtr == NULL) || pLinksetListPtr->isEmpty()) + { + pLinksetsCallback(pRequestId, kRequestCompleted, emptyLinksetListPtr); + } + else + { + const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(pLinksetListPtr.get()); + + LLSD objectPostData = linksetList->encodeObjectFields(pLinksetUse, pA, pB, pC, pD); + LLSD terrainPostData; + if (isAllowViewTerrainProperties()) + { + terrainPostData = linksetList->encodeTerrainFields(pLinksetUse, pA, pB, pC, pD); + } + + if (objectPostData.isUndefined() && terrainPostData.isUndefined()) + { + pLinksetsCallback(pRequestId, kRequestCompleted, emptyLinksetListPtr); + } + else + { + pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr); + + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined())); + + if (!objectPostData.isUndefined()) + { + LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); + LLHTTPClient::put(objectLinksetsURL, objectPostData, objectLinksetsResponder); + } + + if (!terrainPostData.isUndefined()) + { + LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); + LLHTTPClient::put(terrainLinksetsURL, terrainPostData, terrainLinksetsResponder); + } + } + } +} + +void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const +{ + LLPathfindingObjectListPtr emptyCharacterListPtr; + + LLViewerRegion *currentRegion = getCurrentRegion(); + + if (currentRegion == NULL) + { + pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr); + } + else if (!currentRegion->capabilitiesReceived()) + { + pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr); + currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetCharactersForRegion, this, _1, pRequestId, pCharactersCallback)); + } + else + { + std::string charactersURL = getCharactersURLForCurrentRegion(); + if (charactersURL.empty()) + { + pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr); + } + else + { + pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr); + + LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); + LLHTTPClient::get(charactersURL, charactersResponder); + } + } +} + +void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + if ((pRegion == NULL) || !pRegion->isAlive()) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion); + + if (navMeshURL.empty()) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + navMeshPtr->handleNavMeshStart(pNavMeshStatus); + LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshStatus.getVersion(), navMeshPtr); + + LLSD postData; + LLHTTPClient::post(navMeshURL, postData, responder); + } + } +} + +void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID) +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetNavMeshForRegion(currentRegion); + } +} + +void LLPathfindingManager::handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetLinksets(pRequestId, pLinksetsCallback); + } +} + +void LLPathfindingManager::handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetCharacters(pRequestId, pCharactersCallback); + } +} + +void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); + + if (!pNavMeshStatus.isValid()) + { + navMeshPtr->handleNavMeshError(); + } + else + { + if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus)) + { + navMeshPtr->handleRefresh(pNavMeshStatus); + } + else + { + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus); + } + } +} + +void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); + + if (!pNavMeshStatus.isValid()) + { + navMeshPtr->handleNavMeshError(); + } + else + { + navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus); + } +} + +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(const LLUUID &pRegionUUID) +{ + LLPathfindingNavMeshPtr navMeshPtr; + NavMeshMap::iterator navMeshIter = mNavMeshMap.find(pRegionUUID); + if (navMeshIter == mNavMeshMap.end()) + { + navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(pRegionUUID)); + mNavMeshMap.insert(std::pair<LLUUID, LLPathfindingNavMeshPtr>(pRegionUUID, navMeshPtr)); + } + else + { + navMeshPtr = navMeshIter->second; + } + + return navMeshPtr; +} + +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) +{ + LLUUID regionUUID; + if (pRegion != NULL) + { + regionUUID = pRegion->getRegionID(); + } + + return getNavMeshForRegion(regionUUID); +} + +bool LLPathfindingManager::isValidAgentState(EAgentState pAgentState) +{ + return ((pAgentState == kAgentStateFrozen) || (pAgentState == kAgentStateUnfrozen)); +} + +void LLPathfindingManager::requestGetAgentState() +{ + std::string agentStateURL = getAgentStateURLForCurrentRegion(); + + if (agentStateURL.empty()) + { + setAgentState(kAgentStateNotEnabled); + } + else + { + LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL); + LLHTTPClient::get(agentStateURL, responder); + } +} + +void LLPathfindingManager::setAgentState(EAgentState pAgentState) +{ + mAgentState = pAgentState; + + if (mAgentState != kAgentStateError) + { + mLastKnownNonErrorAgentState = mAgentState; + } + + mAgentStateSignal(mAgentState); +} + +void LLPathfindingManager::handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState) +{ +#ifndef DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + llassert(pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)); + llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + EAgentState agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); +#else // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + EAgentState agentState = kAgentStateUnknown; + if (pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)) + { + llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); + } + else + { + llassert(pContent.has(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD)); + llassert(pContent.get(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + agentState = (pContent.get(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); + } +#endif // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + + if (isValidAgentState(pRequestedAgentState) && (agentState != pRequestedAgentState)) + { + agentState = kAgentStateError; + llassert(0); + } + + setAgentState(agentState); +} + +void LLPathfindingManager::handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL) +{ + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + setAgentState(kAgentStateError); +} + +void LLPathfindingManager::handleAgentStateUpdate(const LLSD &pContent) +{ + llassert(pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)); + llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + EAgentState agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); + + setAgentState(agentState); + + LLSD substitutions, payload; + LLNotificationsUtil::add("AutomaticAgentStateUnfreeze", substitutions, payload, boost::bind(&LLPathfindingManager::handleAgentStateUserNotification, this, _1, _2)); +} + +void LLPathfindingManager::handleAgentStateUserNotification(const LLSD &pNotification, const LLSD &pResponse) +{ + if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 1) + { + LLWeb::loadURL(LLTrans::getString("Pathfinding_Wiki_URL")); + } +} + +std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_NAVMESH_STATUS); +} + +std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH); +} + +std::string LLPathfindingManager::getAgentStateURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_AGENT_STATE); +} + +std::string LLPathfindingManager::getObjectLinksetsURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_OBJECT_LINKSETS); +} + +std::string LLPathfindingManager::getTerrainLinksetsURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_TERRAIN_LINKSETS); +} + +std::string LLPathfindingManager::getCharactersURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS); +} + +std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const +{ + return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); +} + +std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const +{ + std::string capabilityURL(""); + + if (pRegion != NULL) + { + capabilityURL = pRegion->getCapability(pCapabilityName); + } + + if (capabilityURL.empty()) + { + llwarns << "cannot find capability '" << pCapabilityName << "' for current region '" + << ((pRegion != NULL) ? pRegion->getName() : "<null>") << "'" << llendl; + } + + return capabilityURL; +} + +LLViewerRegion *LLPathfindingManager::getCurrentRegion() const +{ + return gAgent.getRegion(); +} + +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const +{ +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Received NavMeshStatusUpdate: " << pInput << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); + LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD)); + LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus); +} + +//--------------------------------------------------------------------------- +// LLAgentStateChangeNode +//--------------------------------------------------------------------------- + +void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const +{ +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Received AgentPreferencesUpdate: " << pInput << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); + LLPathfindingManager::getInstance()->handleAgentStateUpdate(pInput.get(SIM_MESSAGE_BODY_FIELD)); +} + +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRegion(pRegion), + mRegionUUID() +{ + if (mRegion != NULL) + { + mRegionUUID = mRegion->getRegionID(); + } +} + +NavMeshStatusResponder::~NavMeshStatusResponder() +{ +} + +void NavMeshStatusResponder::result(const LLSD &pContent) +{ +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Received requested NavMeshStatus: " << pContent << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); +} + +void NavMeshStatusResponder::error(U32 pStatus, const std::string& pReason) +{ + llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); +} + +//--------------------------------------------------------------------------- +// NavMeshResponder +//--------------------------------------------------------------------------- + +NavMeshResponder::NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mNavMeshVersion(pNavMeshVersion), + mNavMeshPtr(pNavMeshPtr) +{ +} + +NavMeshResponder::~NavMeshResponder() +{ +} + +void NavMeshResponder::result(const LLSD &pContent) +{ + mNavMeshPtr->handleNavMeshResult(pContent, mNavMeshVersion); +} + +void NavMeshResponder::error(U32 pStatus, const std::string& pReason) +{ + mNavMeshPtr->handleNavMeshError(pStatus, pReason, mCapabilityURL, mNavMeshVersion); +} + +//--------------------------------------------------------------------------- +// AgentStateResponder +//--------------------------------------------------------------------------- + +AgentStateResponder::AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRequestedAgentState(pRequestedAgentState) +{ +} + +AgentStateResponder::~AgentStateResponder() +{ +} + +void AgentStateResponder::result(const LLSD &pContent) +{ + LLPathfindingManager::getInstance()->handleAgentStateResult(pContent, mRequestedAgentState); +} + +void AgentStateResponder::error(U32 pStatus, const std::string &pReason) +{ + LLPathfindingManager::getInstance()->handleAgentStateError(pStatus, pReason, mCapabilityURL); +} + +//--------------------------------------------------------------------------- +// LinksetsResponder +//--------------------------------------------------------------------------- + +LinksetsResponder::LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested) + : mRequestId(pRequestId), + mLinksetsCallback(pLinksetsCallback), + mObjectMessagingState(pIsObjectRequested ? kWaiting : kNotRequested), + mTerrainMessagingState(pIsTerrainRequested ? kWaiting : kNotRequested), + mObjectLinksetListPtr(), + mTerrainLinksetPtr() +{ +} + +LinksetsResponder::~LinksetsResponder() +{ +} + +void LinksetsResponder::handleObjectLinksetsResult(const LLSD &pContent) +{ + mObjectLinksetListPtr = LLPathfindingObjectListPtr(new LLPathfindingLinksetList(pContent)); + + mObjectMessagingState = kReceivedGood; + if (mTerrainMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) +{ + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + mObjectMessagingState = kReceivedError; + if (mTerrainMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::handleTerrainLinksetsResult(const LLSD &pContent) +{ + mTerrainLinksetPtr = LLPathfindingObjectPtr(new LLPathfindingLinkset(pContent)); + + mTerrainMessagingState = kReceivedGood; + if (mObjectMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) +{ + mTerrainMessagingState = kReceivedError; + if (mObjectMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::sendCallback() +{ + llassert(mObjectMessagingState != kWaiting); + llassert(mTerrainMessagingState != kWaiting); + LLPathfindingManager::ERequestStatus requestStatus = + ((((mObjectMessagingState == kReceivedGood) || (mObjectMessagingState == kNotRequested)) && + ((mTerrainMessagingState == kReceivedGood) || (mTerrainMessagingState == kNotRequested))) ? + LLPathfindingManager::kRequestCompleted : LLPathfindingManager::kRequestError); + + if (mObjectMessagingState != kReceivedGood) + { + mObjectLinksetListPtr = LLPathfindingObjectListPtr(new LLPathfindingLinksetList()); + } + + if (mTerrainMessagingState == kReceivedGood) + { + mObjectLinksetListPtr->update(mTerrainLinksetPtr); + } + + mLinksetsCallback(mRequestId, requestStatus, mObjectLinksetListPtr); +} + +//--------------------------------------------------------------------------- +// ObjectLinksetsResponder +//--------------------------------------------------------------------------- + +ObjectLinksetsResponder::ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mLinksetsResponsderPtr(pLinksetsResponsderPtr) +{ +} + +ObjectLinksetsResponder::~ObjectLinksetsResponder() +{ +} + +void ObjectLinksetsResponder::result(const LLSD &pContent) +{ + mLinksetsResponsderPtr->handleObjectLinksetsResult(pContent); +} + +void ObjectLinksetsResponder::error(U32 pStatus, const std::string &pReason) +{ + mLinksetsResponsderPtr->handleObjectLinksetsError(pStatus, pReason, mCapabilityURL); +} + +//--------------------------------------------------------------------------- +// TerrainLinksetsResponder +//--------------------------------------------------------------------------- + +TerrainLinksetsResponder::TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mLinksetsResponsderPtr(pLinksetsResponsderPtr) +{ +} + +TerrainLinksetsResponder::~TerrainLinksetsResponder() +{ +} + +void TerrainLinksetsResponder::result(const LLSD &pContent) +{ + mLinksetsResponsderPtr->handleTerrainLinksetsResult(pContent); +} + +void TerrainLinksetsResponder::error(U32 pStatus, const std::string &pReason) +{ + mLinksetsResponsderPtr->handleTerrainLinksetsError(pStatus, pReason, mCapabilityURL); +} + +//--------------------------------------------------------------------------- +// CharactersResponder +//--------------------------------------------------------------------------- + +CharactersResponder::CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pCharactersCallback) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRequestId(pRequestId), + mCharactersCallback(pCharactersCallback) +{ +} + +CharactersResponder::~CharactersResponder() +{ +} + +void CharactersResponder::result(const LLSD &pContent) +{ + LLPathfindingObjectListPtr characterListPtr = LLPathfindingObjectListPtr(new LLPathfindingCharacterList(pContent)); + mCharactersCallback(mRequestId, LLPathfindingManager::kRequestCompleted, characterListPtr); +} + +void CharactersResponder::error(U32 pStatus, const std::string &pReason) +{ + llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + + LLPathfindingObjectListPtr characterListPtr = LLPathfindingObjectListPtr(new LLPathfindingCharacterList()); + mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); +} diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h new file mode 100644 index 0000000000..3c9af91e7b --- /dev/null +++ b/indra/newview/llpathfindingmanager.h @@ -0,0 +1,144 @@ +/** + * @file llpathfindingmanager.h + * @author William Todd Stinson + * @brief A state manager for the various pathfinding states. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGMANAGER_H +#define LL_LLPATHFINDINGMANAGER_H + +#include <string> +#include <map> + +#include <boost/function.hpp> +#include <boost/signals2.hpp> + +#include "llpathfindinglinkset.h" +#include "llpathfindingobjectlist.h" +#include "llpathfindingnavmesh.h" +#include "llsingleton.h" +#include "lluuid.h" + +class LLViewerRegion; +class LLPathfindingNavMeshStatus; + +class LLPathfindingManager : public LLSingleton<LLPathfindingManager> +{ + friend class LLNavMeshSimStateChangeNode; + friend class LLAgentStateChangeNode; + friend class NavMeshStatusResponder; + friend class AgentStateResponder; +public: + typedef std::map<LLUUID, LLPathfindingNavMeshPtr> NavMeshMap; + + typedef enum { + kAgentStateUnknown, + kAgentStateFrozen, + kAgentStateUnfrozen, + kAgentStateNotEnabled, + kAgentStateError + } EAgentState; + + typedef boost::function<void (EAgentState)> agent_state_callback_t; + typedef boost::signals2::signal<void (EAgentState)> agent_state_signal_t; + typedef boost::signals2::connection agent_state_slot_t; + + typedef enum { + kRequestStarted, + kRequestCompleted, + kRequestNotEnabled, + kRequestError + } ERequestStatus; + + LLPathfindingManager(); + virtual ~LLPathfindingManager(); + + bool isPathfindingEnabledForCurrentRegion() const; + bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + bool isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const; +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + bool isAllowAlterPermanent(); + bool isAllowViewTerrainProperties() const; + + LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); + void requestGetNavMeshForRegion(LLViewerRegion *pRegion); + + agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); + EAgentState getAgentState(); + EAgentState getLastKnownNonErrorAgentState() const; + void requestSetAgentState(EAgentState pAgentState); + + typedef U32 request_id_t; + typedef boost::function<void (request_id_t, ERequestStatus, LLPathfindingObjectListPtr)> object_request_callback_t; + + void requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const; + void requestSetLinksets(request_id_t pRequestId, const LLPathfindingObjectListPtr &pLinksetListPtr, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, object_request_callback_t pLinksetsCallback) const; + + void requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const; + +protected: + +private: + void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); + + void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID); + void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const; + void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const; + + void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion); + void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); + + LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); + LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); + + static bool isValidAgentState(EAgentState pAgentState); + + void requestGetAgentState(); + void setAgentState(EAgentState pAgentState); + void handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState); + void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL); + void handleAgentStateUpdate(const LLSD &pContent); + void handleAgentStateUserNotification(const LLSD &pNotification, const LLSD &pResponse); + + std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const; + std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const; + std::string getAgentStateURLForCurrentRegion() const; + std::string getObjectLinksetsURLForCurrentRegion() const; + std::string getTerrainLinksetsURLForCurrentRegion() const; + std::string getCharactersURLForCurrentRegion() const; + + std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const; + std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const; + LLViewerRegion *getCurrentRegion() const; + + NavMeshMap mNavMeshMap; + + agent_state_signal_t mAgentStateSignal; + EAgentState mAgentState; + EAgentState mLastKnownNonErrorAgentState; +}; + +#endif // LL_LLPATHFINDINGMANAGER_H diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp new file mode 100644 index 0000000000..4e4e9fceef --- /dev/null +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -0,0 +1,201 @@ +/** + * @file llpathfindingnavmesh.cpp + * @author William Todd Stinson + * @brief A class for representing the navmesh of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "lluuid.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "llsdserialize.h" + +#include <string> + +#define NAVMESH_VERSION_FIELD "navmesh_version" +#define NAVMESH_DATA_FIELD "navmesh_data" + +//--------------------------------------------------------------------------- +// LLPathfindingNavMesh +//--------------------------------------------------------------------------- + +LLPathfindingNavMesh::LLPathfindingNavMesh(const LLUUID &pRegionUUID) + : mNavMeshStatus(pRegionUUID), + mNavMeshRequestStatus(kNavMeshRequestUnknown), + mNavMeshSignal(), + mNavMeshData() + +{ +} + +LLPathfindingNavMesh::~LLPathfindingNavMesh() +{ +} + +LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListener(navmesh_callback_t pNavMeshCallback) +{ + return mNavMeshSignal.connect(pNavMeshCallback); +} + +bool LLPathfindingNavMesh::hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const +{ + return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) && + ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) || + ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty()))); +} + +void LLPathfindingNavMesh::handleNavMeshWaitForRegionLoad() +{ + setRequestStatus(kNavMeshRequestWaiting); +} + +void LLPathfindingNavMesh::handleNavMeshCheckVersion() +{ + setRequestStatus(kNavMeshRequestChecking); +} + +void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()); + mNavMeshStatus = pNavMeshStatus; + if (mNavMeshRequestStatus == kNavMeshRequestChecking) + { + llassert(!mNavMeshData.empty()); + setRequestStatus(kNavMeshRequestCompleted); + } + else + { + sendStatus(); + } +} + +void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) + { + mNavMeshStatus = pNavMeshStatus; + sendStatus(); + } + else + { + mNavMeshData.clear(); + mNavMeshStatus = pNavMeshStatus; + setRequestStatus(kNavMeshRequestNeedsUpdate); + } +} + +void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + mNavMeshStatus = pNavMeshStatus; + setRequestStatus(kNavMeshRequestStarted); +} + +void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion) +{ + if (pContent.has(NAVMESH_VERSION_FIELD)) + { + llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger()); + llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0); + U32 embeddedNavMeshVersion = static_cast<U32>(pContent.get(NAVMESH_VERSION_FIELD).asInteger()); + llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur? + if (embeddedNavMeshVersion != pNavMeshVersion) + { + llwarns << "Mismatch between expected and embedded navmesh versions occurred" << llendl; + pNavMeshVersion = embeddedNavMeshVersion; + } + } + + if (mNavMeshStatus.getVersion() == pNavMeshVersion) + { + ENavMeshRequestStatus status; + if ( pContent.has(NAVMESH_DATA_FIELD) ) + { + const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); + unsigned int binSize = value.size(); + std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize); + std::istringstream streamdecomp( newStr ); + unsigned int decompBinSize = 0; + bool valid = false; + U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; + if ( !valid ) + { + llwarns << "Unable to decompress the navmesh llsd." << llendl; + status = kNavMeshRequestError; + } + else + { + llassert(pUncompressedNavMeshContainer); + mNavMeshData.resize( decompBinSize ); + memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize ); + status = kNavMeshRequestCompleted; + } + if ( pUncompressedNavMeshContainer ) + { + free( pUncompressedNavMeshContainer ); + } + } + else + { + llwarns << "No mesh data received" << llendl; + status = kNavMeshRequestError; + } + setRequestStatus(status); + } +} + +void LLPathfindingNavMesh::handleNavMeshNotEnabled() +{ + mNavMeshData.clear(); + setRequestStatus(kNavMeshRequestNotEnabled); +} + +void LLPathfindingNavMesh::handleNavMeshError() +{ + mNavMeshData.clear(); + setRequestStatus(kNavMeshRequestError); +} + +void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion) +{ + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + if (mNavMeshStatus.getVersion() == pNavMeshVersion) + { + handleNavMeshError(); + } +} + +void LLPathfindingNavMesh::setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus) +{ + mNavMeshRequestStatus = pNavMeshRequestStatus; + sendStatus(); +} + +void LLPathfindingNavMesh::sendStatus() +{ + mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData); +} + diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h new file mode 100644 index 0000000000..55fdd9aaa7 --- /dev/null +++ b/indra/newview/llpathfindingnavmesh.h @@ -0,0 +1,98 @@ +/** + * @file llpathfindingnavmesh.h + * @author William Todd Stinson + * @brief A class for representing the navmesh of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGNAVMESH_H +#define LL_LLPATHFINDINGNAVMESH_H + +#include "llsd.h" + +#include <string> + +#include <boost/shared_ptr.hpp> +#include <boost/function.hpp> +#include <boost/signals2.hpp> + +#include "llpathfindingnavmeshstatus.h" + +class LLUUID; +class LLPathfindingNavMesh; + +typedef boost::shared_ptr<LLPathfindingNavMesh> LLPathfindingNavMeshPtr; + +class LLPathfindingNavMesh +{ +public: + typedef enum { + kNavMeshRequestUnknown, + kNavMeshRequestWaiting, + kNavMeshRequestChecking, + kNavMeshRequestNeedsUpdate, + kNavMeshRequestStarted, + kNavMeshRequestCompleted, + kNavMeshRequestNotEnabled, + kNavMeshRequestError + } ENavMeshRequestStatus; + + typedef boost::function<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_callback_t; + typedef boost::signals2::signal<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_signal_t; + typedef boost::signals2::connection navmesh_slot_t; + + LLPathfindingNavMesh(const LLUUID &pRegionUUID); + virtual ~LLPathfindingNavMesh(); + + navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + const LLPathfindingNavMeshStatus &getNavMeshStatusXXX() const {return mNavMeshStatus;}; +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + bool hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const; + + void handleNavMeshWaitForRegionLoad(); + void handleNavMeshCheckVersion(); + void handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); + void handleNavMeshNotEnabled(); + void handleNavMeshError(); + void handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion); + +protected: + +private: + void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus); + void sendStatus(); + + LLPathfindingNavMeshStatus mNavMeshStatus; + ENavMeshRequestStatus mNavMeshRequestStatus; + navmesh_signal_t mNavMeshSignal; + LLSD::Binary mNavMeshData; +}; + +#endif // LL_LLPATHFINDINGNAVMESH_H + diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp new file mode 100644 index 0000000000..31ff85c1a1 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshstatus.cpp @@ -0,0 +1,159 @@ +/** + * @file llpathfindingnavmeshstatus.cpp + * @author William Todd Stinson + * @brief A class for representing the navmesh status of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsd.h" +#include "lluuid.h" +#include "llstring.h" +#include "llpathfindingnavmeshstatus.h" + +#include <string> + +#define REGION_FIELD "region_id" +#define DEPRECATED_STATE_FIELD "state" +#define STATUS_FIELD "status" +#define VERSION_FIELD "version" + +const std::string LLPathfindingNavMeshStatus::sStatusPending("pending"); +const std::string LLPathfindingNavMeshStatus::sStatusBuilding("building"); +const std::string LLPathfindingNavMeshStatus::sStatusComplete("complete"); +const std::string LLPathfindingNavMeshStatus::sStatusRepending("repending"); + + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshStatus +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus() + : mIsValid(false), + mRegionUUID(), + mVersion(0U), + mStatus(kComplete) +{ +} + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID) + : mIsValid(false), + mRegionUUID(pRegionUUID), + mVersion(0U), + mStatus(kComplete) +{ +} + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent) + : mIsValid(true), + mRegionUUID(pRegionUUID), + mVersion(0U), + mStatus(kComplete) +{ + parseStatus(pContent); +} + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLSD &pContent) + : mIsValid(true), + mRegionUUID(), + mVersion(0U), + mStatus(kComplete) +{ + llassert(pContent.has(REGION_FIELD)); + llassert(pContent.get(REGION_FIELD).isUUID()); + mRegionUUID = pContent.get(REGION_FIELD).asUUID(); + + parseStatus(pContent); +} + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther) + : mIsValid(pOther.mIsValid), + mRegionUUID(pOther.mRegionUUID), + mVersion(pOther.mVersion), + mStatus(pOther.mStatus) +{ +} + +LLPathfindingNavMeshStatus::~LLPathfindingNavMeshStatus() +{ +} + +LLPathfindingNavMeshStatus &LLPathfindingNavMeshStatus::operator =(const LLPathfindingNavMeshStatus &pOther) +{ + mIsValid = pOther.mIsValid; + mRegionUUID = pOther.mRegionUUID; + mVersion = pOther.mVersion; + mStatus = pOther.mStatus; + + return *this; +} + +void LLPathfindingNavMeshStatus::parseStatus(const LLSD &pContent) +{ + llassert(pContent.has(VERSION_FIELD)); + llassert(pContent.get(VERSION_FIELD).isInteger()); + llassert(pContent.get(VERSION_FIELD).asInteger() >= 0); + mVersion = static_cast<U32>(pContent.get(VERSION_FIELD).asInteger()); + +#ifdef DEPRECATED_STATE_FIELD + std::string status; + if (pContent.has(DEPRECATED_STATE_FIELD)) + { + llassert(pContent.has(DEPRECATED_STATE_FIELD)); + llassert(pContent.get(DEPRECATED_STATE_FIELD).isString()); + status = pContent.get(DEPRECATED_STATE_FIELD).asString(); + } + else + { + llassert(pContent.has(STATUS_FIELD)); + llassert(pContent.get(STATUS_FIELD).isString()); + status = pContent.get(STATUS_FIELD).asString(); + } +#else // DEPRECATED_STATE_FIELD + llassert(pContent.has(STATUS_FIELD)); + llassert(pContent.get(STATUS_FIELD).isString()); + std::string status = pContent.get(STATUS_FIELD).asString(); +#endif // DEPRECATED_STATE_FIELD + + if (LLStringUtil::compareStrings(status, sStatusPending) == 0) + { + mStatus = kPending; + } + else if (LLStringUtil::compareStrings(status, sStatusBuilding) == 0) + { + mStatus = kBuilding; + } + else if (LLStringUtil::compareStrings(status, sStatusComplete) == 0) + { + mStatus = kComplete; + } + else if (LLStringUtil::compareStrings(status, sStatusRepending) == 0) + { + mStatus = kRepending; + } + else + { + mStatus = kComplete; + llassert(0); + } +} diff --git a/indra/newview/llpathfindingnavmeshstatus.h b/indra/newview/llpathfindingnavmeshstatus.h new file mode 100644 index 0000000000..6428a31c24 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshstatus.h @@ -0,0 +1,85 @@ +/** + * @file llpathfindingnavmeshstatus.h + * @author William Todd Stinson + * @brief A class for representing the navmesh status of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H +#define LL_LLPATHFINDINGNAVMESHSTATUS_H + +#include "lluuid.h" + +#include <string> + +// XXX stinson 03/12/2012 : This definition is in place to support an older version of the pathfinding simulator that does not have versioned information +#define DEPRECATED_UNVERSIONED_NAVMESH + +class LLSD; + +class LLPathfindingNavMeshStatus +{ +public: + typedef enum + { + kPending, + kBuilding, + kComplete, + kRepending + } ENavMeshStatus; + + LLPathfindingNavMeshStatus(); + LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID); + LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent); + LLPathfindingNavMeshStatus(const LLSD &pContent); + LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther); + virtual ~LLPathfindingNavMeshStatus(); + + LLPathfindingNavMeshStatus &operator =(const LLPathfindingNavMeshStatus &pOther); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + void incrementNavMeshVersionXXX() {++mVersion;}; +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + bool isValid() const {return mIsValid;}; + const LLUUID &getRegionUUID() const {return mRegionUUID;}; + U32 getVersion() const {return mVersion;}; + ENavMeshStatus getStatus() const {return mStatus;}; + +protected: + +private: + void parseStatus(const LLSD &pContent); + + bool mIsValid; + LLUUID mRegionUUID; + U32 mVersion; + ENavMeshStatus mStatus; + + static const std::string sStatusPending; + static const std::string sStatusBuilding; + static const std::string sStatusComplete; + static const std::string sStatusRepending; +}; + +#endif // LL_LLPATHFINDINGNAVMESHSTATUS_H diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp new file mode 100644 index 0000000000..816c94e25e --- /dev/null +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -0,0 +1,476 @@ +/** + * @file llpathfindingnavmeshzone.cpp + * @author William Todd Stinson + * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsd.h" +#include "lluuid.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingmanager.h" +#include "llviewercontrol.h" + +#include "llpathinglib.h" + +#include <string> +#include <vector> + +#include <boost/bind.hpp> + +#define CENTER_REGION 99 + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() + : mNavMeshLocationPtrs(), + mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), + mNavMeshZoneSignal() +{ +} + +LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() +{ +} + +LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) +{ + return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); +} + +void LLPathfindingNavMeshZone::initialize() +{ + mNavMeshLocationPtrs.clear(); + +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; + std::vector<S32> availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + std::vector<LLViewerRegion*> neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + for (std::vector<S32>::const_iterator statusIter = availableRegions.begin(); + statusIter != availableRegions.end(); ++statusIter) + { + LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; + llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; + } + } + +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(centerNavMeshPtr); + + U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion"); + if (neighborRegionDir != CENTER_REGION) + { + NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(neighborNavMeshPtr); + } +} + +void LLPathfindingNavMeshZone::enable() +{ + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->enable(); + } +} + +void LLPathfindingNavMeshZone::disable() +{ + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->disable(); + } +} + +void LLPathfindingNavMeshZone::refresh() +{ + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->cleanupResidual(); + } + + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->refresh(); + } +} + +LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const +{ + bool hasPending = false; + bool hasBuilding = false; + bool hasComplete = false; + bool hasRepending = false; + + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + + switch (navMeshLocationPtr->getNavMeshStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + hasPending = true; + break; + case LLPathfindingNavMeshStatus::kBuilding : + hasBuilding = true; + break; + case LLPathfindingNavMeshStatus::kComplete : + hasComplete = true; + break; + case LLPathfindingNavMeshStatus::kRepending : + hasRepending = true; + break; + default : + hasPending = true; + llassert(0); + break; + } + } + + ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; + if (hasRepending || (hasPending && hasBuilding)) + { + zoneStatus = kNavMeshZonePendingAndBuilding; + } + else if (hasComplete) + { + if (hasPending) + { + zoneStatus = kNavMeshZoneSomePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneSomeBuilding; + } + else + { + zoneStatus = kNavMeshZoneComplete; + } + } + else if (hasPending) + { + zoneStatus = kNavMeshZonePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneBuilding; + } + + return zoneStatus; +} + +void LLPathfindingNavMeshZone::handleNavMeshLocation() +{ + updateStatus(); +} + +void LLPathfindingNavMeshZone::updateStatus() +{ + bool hasRequestUnknown = false; + bool hasRequestWaiting = false; + bool hasRequestChecking = false; + bool hasRequestNeedsUpdate = false; + bool hasRequestStarted = false; + bool hasRequestCompleted = false; + bool hasRequestNotEnabled = false; + bool hasRequestError = false; + +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + switch (navMeshLocationPtr->getRequestStatus()) + { + case LLPathfindingNavMesh::kNavMeshRequestUnknown : + hasRequestUnknown = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestWaiting : + hasRequestWaiting = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestChecking : + hasRequestChecking = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : + hasRequestNeedsUpdate = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestStarted : + hasRequestStarted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestCompleted : + hasRequestCompleted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : + hasRequestNotEnabled = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestError : + hasRequestError = true; + break; + default : + hasRequestError = true; + llassert(0); + break; + } + } + + ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; + if (hasRequestWaiting) + { + zoneRequestStatus = kNavMeshZoneRequestWaiting; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is WAITING" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestNeedsUpdate) + { + zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestChecking) + { + zoneRequestStatus = kNavMeshZoneRequestChecking; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestStarted) + { + zoneRequestStatus = kNavMeshZoneRequestStarted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestError) + { + zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestCompleted) + { + zoneRequestStatus = kNavMeshZoneRequestCompleted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else + { + zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(0); + } + + if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && + (zoneRequestStatus == kNavMeshZoneRequestCompleted)) + { +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->processNavMeshData(); + } +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + + mNavMeshZoneRequestStatus = zoneRequestStatus; + mNavMeshZoneSignal(mNavMeshZoneRequestStatus); +} + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone::NavMeshLocation +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) + : mDirection(pDirection), + mRegionUUID(), + mHasNavMesh(false), + mNavMeshVersion(0U), + mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), + mLocationCallback(pLocationCallback), + mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), + mNavMeshSlot() +{ +} + +LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() +{ +} + +void LLPathfindingNavMeshZone::NavMeshLocation::enable() +{ + clear(); + + LLViewerRegion *region = getRegion(); + if (region == NULL) + { + mRegionUUID.setNull(); + } + else + { + mRegionUUID = region->getRegionID(); + mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3)); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::refresh() +{ + LLViewerRegion *region = getRegion(); + + if (region == NULL) + { + llassert(mRegionUUID.isNull()); + LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); + LLSD::Binary nullData; + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); + } + else + { + llassert(mRegionUUID == region->getRegionID()); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::disable() +{ + clear(); +} + +LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +{ + return mRequestStatus; +} + +LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const +{ + return mNavMeshStatus; +} + +void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) +{ + llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); + + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && + (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) + { + llassert(!pNavMeshData.empty()); + mHasNavMesh = true; + mNavMeshVersion = pNavMeshStatus.getVersion(); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } + } + + mRequestStatus = pNavMeshRequestStatus; + mNavMeshStatus = pNavMeshStatus.getStatus(); + mLocationCallback(); +} + +void LLPathfindingNavMeshZone::NavMeshLocation::clear() +{ + mHasNavMesh = false; + mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } +} + +LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const +{ + LLViewerRegion *region = NULL; + + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + if (mDirection == CENTER_REGION) + { + region = currentRegion; + } + else + { + //User wants to pull in a neighboring region + std::vector<S32> availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector<S32>::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); + if ( foundElem != availableRegions.end() ) + { + std::vector<LLViewerRegion*> neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; + } + } + } + + return region; +} diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h new file mode 100644 index 0000000000..8c330559a9 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -0,0 +1,136 @@ +/** + * @file llpathfindingnavmeshzone.h + * @author William Todd Stinson + * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGNAVMESHZONE_H +#define LL_LLPATHFINDINGNAVMESHZONE_H + +#include "llsd.h" +#include "lluuid.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" + +#include <vector> + +#include <boost/shared_ptr.hpp> +#include <boost/function.hpp> +#include <boost/signals2.hpp> + +class LLPathfindingNavMeshStatus; + +//#define XXX_STINSON_DEBUG_NAVMESH_ZONE + +class LLPathfindingNavMeshZone +{ +public: + typedef enum { + kNavMeshZoneRequestUnknown, + kNavMeshZoneRequestWaiting, + kNavMeshZoneRequestChecking, + kNavMeshZoneRequestNeedsUpdate, + kNavMeshZoneRequestStarted, + kNavMeshZoneRequestCompleted, + kNavMeshZoneRequestNotEnabled, + kNavMeshZoneRequestError + } ENavMeshZoneRequestStatus; + + typedef enum { + kNavMeshZonePending, + kNavMeshZoneBuilding, + kNavMeshZoneSomePending, + kNavMeshZoneSomeBuilding, + kNavMeshZonePendingAndBuilding, + kNavMeshZoneComplete + } ENavMeshZoneStatus; + + typedef boost::function<void (ENavMeshZoneRequestStatus)> navmesh_zone_callback_t; + typedef boost::signals2::signal<void (ENavMeshZoneRequestStatus)> navmesh_zone_signal_t; + typedef boost::signals2::connection navmesh_zone_slot_t; + + LLPathfindingNavMeshZone(); + virtual ~LLPathfindingNavMeshZone(); + + navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback); + void initialize(); + + void enable(); + void disable(); + void refresh(); + + ENavMeshZoneStatus getNavMeshZoneStatus() const; + +protected: + +private: + typedef boost::function<void (void)> navmesh_location_callback_t; + class NavMeshLocation + { + public: + NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback); + virtual ~NavMeshLocation(); + + void enable(); + void refresh(); + void disable(); + + LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; + LLPathfindingNavMeshStatus::ENavMeshStatus getNavMeshStatus() const; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + const LLUUID &getRegionUUID() const {return mRegionUUID;}; + S32 getDirection() const {return mDirection;}; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + + protected: + + private: + void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData); + + void clear(); + LLViewerRegion *getRegion() const; + + S32 mDirection; + LLUUID mRegionUUID; + bool mHasNavMesh; + U32 mNavMeshVersion; + LLPathfindingNavMeshStatus::ENavMeshStatus mNavMeshStatus; + navmesh_location_callback_t mLocationCallback; + LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus; + LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; + }; + + typedef boost::shared_ptr<NavMeshLocation> NavMeshLocationPtr; + typedef std::vector<NavMeshLocationPtr> NavMeshLocationPtrs; + + void handleNavMeshLocation(); + void updateStatus(); + + NavMeshLocationPtrs mNavMeshLocationPtrs; + ENavMeshZoneRequestStatus mNavMeshZoneRequestStatus; + navmesh_zone_signal_t mNavMeshZoneSignal; +}; + +#endif // LL_LLPATHFINDINGNAVMESHZONE_H + diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp new file mode 100644 index 0000000000..65fcedf2f5 --- /dev/null +++ b/indra/newview/llpathfindingobject.cpp @@ -0,0 +1,156 @@ +/** +* @file llpathfindingobject.cpp +* @brief Implementation of llpathfindingobject +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + + +#include "llviewerprecompiledheaders.h" + +#include "llpathfindingobject.h" + +#include <string> + +#include "v3math.h" +#include "llavatarname.h" +#include "llavatarnamecache.h" +#include "llsd.h" +#include "lluuid.h" + +#define PATHFINDING_OBJECT_NAME_FIELD "name" +#define PATHFINDING_OBJECT_DESCRIPTION_FIELD "description" +#define PATHFINDING_OBJECT_OWNER_FIELD "owner" +#define PATHFINDING_OBJECT_POSITION_FIELD "position" + +//--------------------------------------------------------------------------- +// LLPathfindingObject +//--------------------------------------------------------------------------- + +LLPathfindingObject::LLPathfindingObject() + : mUUID(), + mName(), + mDescription(), + mOwnerUUID(), + mHasOwnerName(false), + mOwnerName(), + mLocation() +{ +} + +LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData) + : mUUID(pUUID), + mName(), + mDescription(), + mOwnerUUID(), + mHasOwnerName(false), + mOwnerName(), + mLocation() +{ + parseObjectData(pObjectData); +} + +LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther) + : mUUID(pOther.mUUID), + mName(pOther.mName), + mDescription(pOther.mDescription), + mOwnerUUID(pOther.mOwnerUUID), + mHasOwnerName(false), + mOwnerName(), + mLocation(pOther.mLocation) +{ + fetchOwnerName(); +} + +LLPathfindingObject::~LLPathfindingObject() +{ +} + +LLPathfindingObject &LLPathfindingObject::operator =(const LLPathfindingObject& pOther) +{ + mUUID = pOther.mUUID; + mName = pOther.mName; + mDescription = pOther.mDescription; + mOwnerUUID = pOther.mOwnerUUID; + fetchOwnerName(); + mLocation = pOther.mLocation; + + return *this; +} + +std::string LLPathfindingObject::getOwnerName() const +{ + std::string ownerName; + + if (hasOwner()) + { + ownerName = mOwnerName.getCompleteName(); + } + + return ownerName; +} + +void LLPathfindingObject::parseObjectData(const LLSD &pObjectData) +{ + llassert(pObjectData.has(PATHFINDING_OBJECT_NAME_FIELD)); + llassert(pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).isString()); + mName = pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).asString(); + + llassert(pObjectData.has(PATHFINDING_OBJECT_DESCRIPTION_FIELD)); + llassert(pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).isString()); + mDescription = pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).asString(); + +#ifdef SERVER_SIDE_OWNER_ROLLOUT_COMPLETE + llassert(pObjectData.has(PATHFINDING_OBJECT_OWNER_FIELD)); + llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID()); + mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID(); + LLAvatarNameCache::get(mOwnerUUID, &mOwnerName); +#else // SERVER_SIDE_OWNER_ROLLOUT_COMPLETE + if (pObjectData.has(PATHFINDING_OBJECT_OWNER_FIELD)) + { + llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID()); + mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID(); + fetchOwnerName(); + } +#endif // SERVER_SIDE_OWNER_ROLLOUT_COMPLETE + + llassert(pObjectData.has(PATHFINDING_OBJECT_POSITION_FIELD)); + llassert(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD).isArray()); + mLocation.setValue(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD)); +} + +void LLPathfindingObject::fetchOwnerName() +{ + mHasOwnerName = false; + if (hasOwner()) + { + LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2)); + } +} + +void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName) +{ + llassert(mOwnerUUID == pOwnerUUID); + mOwnerName = pAvatarName; + mHasOwnerName = true; +} diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h new file mode 100644 index 0000000000..924ea3f298 --- /dev/null +++ b/indra/newview/llpathfindingobject.h @@ -0,0 +1,78 @@ +/** +* @file llpathfindingobject.h +* @brief Header file for llpathfindingobject +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#ifndef LL_LLPATHFINDINGOBJECT_H +#define LL_LLPATHFINDINGOBJECT_H + +#include "llavatarname.h" +#include "lluuid.h" +#include "v3math.h" + +#include <string> + +#include <boost/shared_ptr.hpp> + +class LLPathfindingObject; +class LLSD; + +typedef boost::shared_ptr<LLPathfindingObject> LLPathfindingObjectPtr; + +class LLPathfindingObject +{ +public: + LLPathfindingObject(); + LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData); + LLPathfindingObject(const LLPathfindingObject& pOther); + virtual ~LLPathfindingObject(); + + LLPathfindingObject& operator =(const LLPathfindingObject& pOther); + + inline const LLUUID& getUUID() const {return mUUID;}; + inline const std::string& getName() const {return mName;}; + inline const std::string& getDescription() const {return mDescription;}; + inline BOOL hasOwner() const {return mOwnerUUID.notNull();}; + inline bool hasOwnerName() const {return mHasOwnerName;}; + std::string getOwnerName() const; + inline const LLVector3& getLocation() const {return mLocation;}; + +protected: + +private: + void parseObjectData(const LLSD &pObjectData); + + void fetchOwnerName(); + void handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName); + + LLUUID mUUID; + std::string mName; + std::string mDescription; + LLUUID mOwnerUUID; + bool mHasOwnerName; + LLAvatarName mOwnerName; + LLVector3 mLocation; +}; + +#endif // LL_LLPATHFINDINGOBJECT_H diff --git a/indra/newview/llpathfindingobjectlist.cpp b/indra/newview/llpathfindingobjectlist.cpp new file mode 100644 index 0000000000..68a7e736e6 --- /dev/null +++ b/indra/newview/llpathfindingobjectlist.cpp @@ -0,0 +1,112 @@ +/** +* @file llpathfindingobjectlist.cpp +* @brief Implementation of llpathfindingobjectlist +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llpathfindingobjectlist.h" + +#include <string> +#include <map> + +#include "llpathfindingobject.h" + +//--------------------------------------------------------------------------- +// LLPathfindingObjectList +//--------------------------------------------------------------------------- + +LLPathfindingObjectList::LLPathfindingObjectList() + : mObjectMap() +{ +} + +LLPathfindingObjectList::~LLPathfindingObjectList() +{ +} + +bool LLPathfindingObjectList::isEmpty() const +{ + return mObjectMap.empty(); +} + +void LLPathfindingObjectList::update(LLPathfindingObjectPtr pUpdateObjectPtr) +{ + if (pUpdateObjectPtr != NULL) + { + std::string updateObjectId = pUpdateObjectPtr->getUUID().asString(); + + LLPathfindingObjectMap::iterator foundObjectIter = mObjectMap.find(updateObjectId); + if (foundObjectIter == mObjectMap.end()) + { + mObjectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(updateObjectId, pUpdateObjectPtr)); + } + else + { + foundObjectIter->second = pUpdateObjectPtr; + } + } +} + +void LLPathfindingObjectList::update(LLPathfindingObjectListPtr pUpdateObjectListPtr) +{ + if ((pUpdateObjectListPtr != NULL) && !pUpdateObjectListPtr->isEmpty()) + { + for (LLPathfindingObjectMap::const_iterator updateObjectIter = pUpdateObjectListPtr->begin(); + updateObjectIter != pUpdateObjectListPtr->end(); ++updateObjectIter) + { + const LLPathfindingObjectPtr updateObjectPtr = updateObjectIter->second; + update(updateObjectPtr); + } + } +} + +LLPathfindingObjectPtr LLPathfindingObjectList::find(const std::string &pObjectId) const +{ + LLPathfindingObjectPtr objectPtr; + + LLPathfindingObjectMap::const_iterator objectIter = mObjectMap.find(pObjectId); + if (objectIter != mObjectMap.end()) + { + objectPtr = objectIter->second; + } + + return objectPtr; +} + +LLPathfindingObjectList::const_iterator LLPathfindingObjectList::begin() const +{ + return mObjectMap.begin(); +} + +LLPathfindingObjectList::const_iterator LLPathfindingObjectList::end() const +{ + return mObjectMap.end(); +} + +LLPathfindingObjectMap &LLPathfindingObjectList::getObjectMap() +{ + return mObjectMap; +} diff --git a/indra/newview/llpathfindingobjectlist.h b/indra/newview/llpathfindingobjectlist.h new file mode 100644 index 0000000000..94c53f3aba --- /dev/null +++ b/indra/newview/llpathfindingobjectlist.h @@ -0,0 +1,68 @@ +/** +* @file llpathfindingobjectlist.h +* @brief Header file for llpathfindingobjectlist +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#ifndef LL_LLPATHFINDINGOBJECTLIST_H +#define LL_LLPATHFINDINGOBJECTLIST_H + +#include <string> +#include <map> + +#include <boost/shared_ptr.hpp> + +#include "llpathfindingobject.h" + +class LLSD; +class LLPathfindingObjectList; + +typedef boost::shared_ptr<LLPathfindingObjectList> LLPathfindingObjectListPtr; +typedef std::map<std::string, LLPathfindingObjectPtr> LLPathfindingObjectMap; + +class LLPathfindingObjectList +{ +public: + LLPathfindingObjectList(); + virtual ~LLPathfindingObjectList(); + + bool isEmpty() const; + + void update(LLPathfindingObjectPtr pUpdateObjectPtr); + void update(LLPathfindingObjectListPtr pUpdateObjectListPtr); + + LLPathfindingObjectPtr find(const std::string &pObjectId) const; + + typedef LLPathfindingObjectMap::const_iterator const_iterator; + const_iterator begin() const; + const_iterator end() const; + + +protected: + LLPathfindingObjectMap &getObjectMap(); + +private: + LLPathfindingObjectMap mObjectMap; +}; + +#endif // LL_LLPATHFINDINGOBJECTLIST_H diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp new file mode 100644 index 0000000000..bc5a265111 --- /dev/null +++ b/indra/newview/llpathfindingpathtool.cpp @@ -0,0 +1,445 @@ +/** + * @file llpathfindingpathtool.cpp + * @author William Todd Stinson + * @brief XXX + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llpathfindingpathtool.h" + +#include "llagent.h" +#include "llsingleton.h" +#include "lltool.h" +#include "llviewercamera.h" +#include "llviewerregion.h" +#include "llviewerwindow.h" +#include "llpathfindingmanager.h" +#include "llpathinglib.h" + +#include <boost/function.hpp> +#include <boost/signals2.hpp> + +#define PATH_TOOL_NAME "PathfindingPathTool" + +LLPathfindingPathTool::LLPathfindingPathTool() + : LLTool(PATH_TOOL_NAME), + LLSingleton<LLPathfindingPathTool>(), + mFinalPathData(), + mTempPathData(), + mPathResult(LLPathingLib::LLPL_NO_PATH), + mCharacterType(kCharacterTypeNone), + mPathEventSignal(), + mIsLeftMouseButtonHeld(false), + mIsMiddleMouseButtonHeld(false), + mIsRightMouseButtonHeld(false) +{ + if (!LLPathingLib::getInstance()) + { + LLPathingLib::initSystem(); + } + + setCharacterWidth(1.0f); + setCharacterType(mCharacterType); +} + +LLPathfindingPathTool::~LLPathfindingPathTool() +{ +} + +BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) +{ + BOOL returnVal = FALSE; + + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) + { + computeFinalPoints(pX, pY, pMask); + mIsLeftMouseButtonHeld = true; + setMouseCapture(TRUE); + returnVal = TRUE; + } + mIsLeftMouseButtonHeld = true; + + return returnVal; +} + +BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask) +{ + BOOL returnVal = FALSE; + + if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) + { + computeFinalPoints(pX, pY, pMask); + setMouseCapture(FALSE); + returnVal = TRUE; + } + mIsLeftMouseButtonHeld = false; + + return returnVal; +} + +BOOL LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) +{ + setMouseCapture(TRUE); + mIsMiddleMouseButtonHeld = true; + gViewerWindow->setCursor(UI_CURSOR_TOOLNO); + + return TRUE; +} + +BOOL LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) +{ + if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) + { + setMouseCapture(FALSE); + } + mIsMiddleMouseButtonHeld = false; + + return TRUE; +} + +BOOL LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask) +{ + setMouseCapture(TRUE); + mIsRightMouseButtonHeld = true; + gViewerWindow->setCursor(UI_CURSOR_TOOLNO); + + return TRUE; +} + +BOOL LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask) +{ + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld) + { + setMouseCapture(FALSE); + } + mIsRightMouseButtonHeld = false; + + return TRUE; +} + +BOOL LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask) +{ + return TRUE; +} + +BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) +{ + BOOL returnVal = FALSE; + + if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING); + computeTempPoints(pX, pY, pMask); + returnVal = TRUE; + } + else + { + clearTemp(); + computeFinalPath(); + } + + return returnVal; +} + +BOOL LLPathfindingPathTool::handleKey(KEY pKey, MASK pMask) +{ + // Eat the escape key or else the camera tool will pick up and reset to default view. This, + // in turn, will cause some other methods to get called. And one of those methods will reset + // the current toolset back to the basic toolset. This means that the pathfinding path toolset + // will no longer be active, but typically with pathfinding path elements on screen. + return (pKey == KEY_ESCAPE); +} + +LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const +{ + EPathStatus status = kPathStatusUnknown; + + if (LLPathingLib::getInstance() == NULL) + { + status = kPathStatusNotImplemented; + } + else if ((gAgent.getRegion() != NULL) && !gAgent.getRegion()->capabilitiesReceived()) + { + status = kPathStatusUnknown; + } + else if (!LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion()) + { + status = kPathStatusNotEnabled; + } + else if (!hasFinalA() && !hasFinalB()) + { + status = kPathStatusChooseStartAndEndPoints; + } + else if (!hasFinalA()) + { + status = kPathStatusChooseStartPoint; + } + else if (!hasFinalB()) + { + status = kPathStatusChooseEndPoint; + } + else if (mPathResult == LLPathingLib::LLPL_PATH_GENERATED_OK) + { + status = kPathStatusHasValidPath; + } + else if (mPathResult == LLPathingLib::LLPL_NO_PATH) + { + status = kPathStatusHasInvalidPath; + } + else + { + status = kPathStatusError; + } + + return status; +} + +F32 LLPathfindingPathTool::getCharacterWidth() const +{ + return mFinalPathData.mCharacterWidth; +} + +void LLPathfindingPathTool::setCharacterWidth(F32 pCharacterWidth) +{ + mFinalPathData.mCharacterWidth = pCharacterWidth; + mTempPathData.mCharacterWidth = pCharacterWidth; + computeFinalPath(); +} + +LLPathfindingPathTool::ECharacterType LLPathfindingPathTool::getCharacterType() const +{ + return mCharacterType; +} + +void LLPathfindingPathTool::setCharacterType(ECharacterType pCharacterType) +{ + mCharacterType = pCharacterType; + + LLPathingLib::LLPLCharacterType characterType; + switch (pCharacterType) + { + case kCharacterTypeNone : + characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + case kCharacterTypeA : + characterType = LLPathingLib::LLPL_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + characterType = LLPathingLib::LLPL_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + characterType = LLPathingLib::LLPL_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + characterType = LLPathingLib::LLPL_CHARACTER_TYPE_D; + break; + default : + characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + mFinalPathData.mCharacterType = characterType; + mTempPathData.mCharacterType = characterType; + computeFinalPath(); +} + +bool LLPathfindingPathTool::isRenderPath() const +{ + return (hasFinalA() || hasFinalB() || hasTempA() || hasTempB()); +} + +void LLPathfindingPathTool::clearPath() +{ + clearFinal(); + clearTemp(); + computeFinalPath(); +} + +LLPathfindingPathTool::path_event_slot_t LLPathfindingPathTool::registerPathEventListener(path_event_callback_t pPathEventCallback) +{ + return mPathEventSignal.connect(pPathEventCallback); +} + +bool LLPathfindingPathTool::isAnyPathToolModKeys(MASK pMask) const +{ + return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0); +} + +bool LLPathfindingPathTool::isPointAModKeys(MASK pMask) const +{ + return ((pMask & MASK_CONTROL) != 0); +} + +bool LLPathfindingPathTool::isPointBModKeys(MASK pMask) const +{ + return ((pMask & MASK_SHIFT) != 0); +} + +void LLPathfindingPathTool::getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const +{ + LLVector3 dv = gViewerWindow->mouseDirectionGlobal(pX, pY); + LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); + pRayStart = mousePos; + pRayEnd = mousePos + dv * 150; +} + +void LLPathfindingPathTool::computeFinalPoints(S32 pX, S32 pY, MASK pMask) +{ + LLVector3 rayStart, rayEnd; + getRayPoints(pX, pY, rayStart, rayEnd); + + if (isPointAModKeys(pMask)) + { + setFinalA(rayStart, rayEnd); + } + else if (isPointBModKeys(pMask)) + { + setFinalB(rayStart, rayEnd); + } + computeFinalPath(); +} + +void LLPathfindingPathTool::computeTempPoints(S32 pX, S32 pY, MASK pMask) +{ + LLVector3 rayStart, rayEnd; + getRayPoints(pX, pY, rayStart, rayEnd); + + if (isPointAModKeys(pMask)) + { + setTempA(rayStart, rayEnd); + if (hasFinalB()) + { + setTempB(getFinalBStart(), getFinalBEnd()); + } + } + else if (isPointBModKeys(pMask)) + { + if (hasFinalA()) + { + setTempA(getFinalAStart(), getFinalAEnd()); + } + setTempB(rayStart, rayEnd); + } + computeTempPath(); +} + +void LLPathfindingPathTool::setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mFinalPathData.mStartPointA = pStartPoint; + mFinalPathData.mEndPointA = pEndPoint; + mFinalPathData.mHasPointA = true; +} + +bool LLPathfindingPathTool::hasFinalA() const +{ + return mFinalPathData.mHasPointA; +} + +const LLVector3 &LLPathfindingPathTool::getFinalAStart() const +{ + return mFinalPathData.mStartPointA; +} + +const LLVector3 &LLPathfindingPathTool::getFinalAEnd() const +{ + return mFinalPathData.mEndPointA; +} + +void LLPathfindingPathTool::setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mTempPathData.mStartPointA = pStartPoint; + mTempPathData.mEndPointA = pEndPoint; + mTempPathData.mHasPointA = true; +} + +bool LLPathfindingPathTool::hasTempA() const +{ + return mTempPathData.mHasPointA; +} + +void LLPathfindingPathTool::setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mFinalPathData.mStartPointB = pStartPoint; + mFinalPathData.mEndPointB = pEndPoint; + mFinalPathData.mHasPointB = true; +} + +bool LLPathfindingPathTool::hasFinalB() const +{ + return mFinalPathData.mHasPointB; +} + +const LLVector3 &LLPathfindingPathTool::getFinalBStart() const +{ + return mFinalPathData.mStartPointB; +} + +const LLVector3 &LLPathfindingPathTool::getFinalBEnd() const +{ + return mFinalPathData.mEndPointB; +} + +void LLPathfindingPathTool::setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mTempPathData.mStartPointB = pStartPoint; + mTempPathData.mEndPointB = pEndPoint; + mTempPathData.mHasPointB = true; +} + +bool LLPathfindingPathTool::hasTempB() const +{ + return mTempPathData.mHasPointB; +} + +void LLPathfindingPathTool::clearFinal() +{ + mFinalPathData.mHasPointA = false; + mFinalPathData.mHasPointB = false; +} + +void LLPathfindingPathTool::clearTemp() +{ + mTempPathData.mHasPointA = false; + mTempPathData.mHasPointB = false; +} + +void LLPathfindingPathTool::computeFinalPath() +{ + mPathResult = LLPathingLib::LLPL_NO_PATH; + if (LLPathingLib::getInstance() != NULL) + { + mPathResult = LLPathingLib::getInstance()->generatePath(mFinalPathData); + } + mPathEventSignal(); +} + +void LLPathfindingPathTool::computeTempPath() +{ + mPathResult = LLPathingLib::LLPL_NO_PATH; + if (LLPathingLib::getInstance() != NULL) + { + mPathResult = LLPathingLib::getInstance()->generatePath(mTempPathData); + } + mPathEventSignal(); +} diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h new file mode 100644 index 0000000000..671f5bef95 --- /dev/null +++ b/indra/newview/llpathfindingpathtool.h @@ -0,0 +1,138 @@ +/** + * @file llpathfindingpathtool.h + * @author William Todd Stinson + * @brief XXX + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGPATHTOOL_H +#define LL_LLPATHFINDINGPATHTOOL_H + +#include "llsingleton.h" +#include "lltool.h" +#include "llpathinglib.h" + +#include <boost/function.hpp> +#include <boost/signals2.hpp> + +class LLPathfindingPathTool : public LLTool, public LLSingleton<LLPathfindingPathTool> +{ +public: + typedef enum + { + kPathStatusUnknown, + kPathStatusChooseStartAndEndPoints, + kPathStatusChooseStartPoint, + kPathStatusChooseEndPoint, + kPathStatusHasValidPath, + kPathStatusHasInvalidPath, + kPathStatusNotEnabled, + kPathStatusNotImplemented, + kPathStatusError + } EPathStatus; + + typedef enum + { + kCharacterTypeNone, + kCharacterTypeA, + kCharacterTypeB, + kCharacterTypeC, + kCharacterTypeD + } ECharacterType; + + LLPathfindingPathTool(); + virtual ~LLPathfindingPathTool(); + + typedef boost::function<void (void)> path_event_callback_t; + typedef boost::signals2::signal<void (void)> path_event_signal_t; + typedef boost::signals2::connection path_event_slot_t; + + virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + + virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask); + + virtual BOOL handleKey(KEY pKey, MASK pMask); + + EPathStatus getPathStatus() const; + + F32 getCharacterWidth() const; + void setCharacterWidth(F32 pCharacterWidth); + + ECharacterType getCharacterType() const; + void setCharacterType(ECharacterType pCharacterType); + + bool isRenderPath() const; + void clearPath(); + + path_event_slot_t registerPathEventListener(path_event_callback_t pPathEventCallback); + +protected: + +private: + bool isAnyPathToolModKeys(MASK pMask) const; + bool isPointAModKeys(MASK pMask) const; + bool isPointBModKeys(MASK pMask) const; + + void getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const; + void computeFinalPoints(S32 pX, S32 pY, MASK pMask); + void computeTempPoints(S32 pX, S32 pY, MASK pMask); + + void setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasFinalA() const; + const LLVector3 &getFinalAStart() const; + const LLVector3 &getFinalAEnd() const; + + void setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasTempA() const; + + void setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasFinalB() const; + const LLVector3 &getFinalBStart() const; + const LLVector3 &getFinalBEnd() const; + + void setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasTempB() const; + + void clearFinal(); + void clearTemp(); + + void computeFinalPath(); + void computeTempPath(); + + LLPathingLib::PathingPacket mFinalPathData; + LLPathingLib::PathingPacket mTempPathData; + LLPathingLib::LLPLResult mPathResult; + ECharacterType mCharacterType; + path_event_signal_t mPathEventSignal; + bool mIsLeftMouseButtonHeld; + bool mIsMiddleMouseButtonHeld; + bool mIsRightMouseButtonHeld; +}; + +#endif // LL_LLPATHFINDINGPATHTOOL_H diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 6111255a66..49c568039c 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -276,7 +276,7 @@ void LLSelectMgr::overrideObjectUpdates() virtual bool apply(LLSelectNode* selectNode) { LLViewerObject* object = selectNode->getObject(); - if (object && object->permMove()) + if (object && object->permMove() && !object->isPermanentEnforced()) { if (!selectNode->mLastPositionLocal.isExactlyZero()) { @@ -593,6 +593,12 @@ bool LLSelectMgr::linkObjects() return true; } + if (!LLSelectMgr::getInstance()->selectGetRootsNonPermanent()) + { + LLNotificationsUtil::add("CannotLinkPermanent"); + return true; + } + LLUUID owner_id; std::string owner_name; if (!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) @@ -638,7 +644,9 @@ bool LLSelectMgr::enableLinkObjects() { virtual bool apply(LLViewerObject* object) { - return object->permModify(); + LLViewerObject *root_object = (object == NULL) ? NULL : object->getRootEdit(); + return object->permModify() && !object->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()); } } func; const bool firstonly = true; @@ -651,10 +659,12 @@ bool LLSelectMgr::enableLinkObjects() bool LLSelectMgr::enableUnlinkObjects() { LLViewerObject* first_editable_object = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject(); + LLViewerObject *root_object = (first_editable_object == NULL) ? NULL : first_editable_object->getRootEdit(); bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() && first_editable_object && - !first_editable_object->isAttachment(); + !first_editable_object->isAttachment() && !first_editable_object->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()); return new_value; } @@ -955,7 +965,7 @@ void LLSelectMgr::highlightObjectOnly(LLViewerObject* objectp) } if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !objectp->permYouOwner()) - || (gSavedSettings.getBOOL("SelectMovableOnly") && !objectp->permMove())) + || (gSavedSettings.getBOOL("SelectMovableOnly") && (!objectp->permMove() || objectp->isPermanentEnforced()))) { // only select my own objects return; @@ -2286,50 +2296,6 @@ void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *) } //----------------------------------------------------------------------------- -// Rotation options -//----------------------------------------------------------------------------- -void LLSelectMgr::selectionResetRotation() -{ - struct f : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* object) - { - LLQuaternion identity(0.f, 0.f, 0.f, 1.f); - object->setRotation(identity); - if (object->mDrawable.notNull()) - { - gPipeline.markMoved(object->mDrawable, TRUE); - } - object->sendRotationUpdate(); - return true; - } - } func; - getSelection()->applyToRootObjects(&func); -} - -void LLSelectMgr::selectionRotateAroundZ(F32 degrees) -{ - LLQuaternion rot( degrees * DEG_TO_RAD, LLVector3(0,0,1) ); - struct f : public LLSelectedObjectFunctor - { - LLQuaternion mRot; - f(const LLQuaternion& rot) : mRot(rot) {} - virtual bool apply(LLViewerObject* object) - { - object->setRotation( object->getRotationEdit() * mRot ); - if (object->mDrawable.notNull()) - { - gPipeline.markMoved(object->mDrawable, TRUE); - } - object->sendRotationUpdate(); - return true; - } - } func(rot); - getSelection()->applyToRootObjects(&func); -} - - -//----------------------------------------------------------------------------- // selectionTexScaleAutofit() //----------------------------------------------------------------------------- void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter) @@ -2543,6 +2509,54 @@ BOOL LLSelectMgr::selectGetRootsModify() //----------------------------------------------------------------------------- +// selectGetPermanent() - return TRUE if current agent can modify all +// selected objects. +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetNonPermanent() +{ + for (LLObjectSelection::iterator iter = getSelection()->begin(); + iter != getSelection()->end(); iter++ ) + { + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + if( !object || !node->mValid ) + { + return FALSE; + } + if( object->isPermanentEnforced()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsModify() - return TRUE if current agent can modify all +// selected root objects. +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsNonPermanent() +{ + for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); + iter != getSelection()->root_end(); iter++ ) + { + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + if( !node->mValid ) + { + return FALSE; + } + if( object->isPermanentEnforced()) + { + return FALSE; + } + } + + return TRUE; +} + + +//----------------------------------------------------------------------------- // selectGetRootsTransfer() - return TRUE if current agent can transfer all // selected root objects. //----------------------------------------------------------------------------- @@ -4144,12 +4158,6 @@ void LLSelectMgr::selectionUpdatePhantom(BOOL is_phantom) getSelection()->applyToObjects(&func); } -void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows) -{ - LLSelectMgrApplyFlags func( FLAGS_CAST_SHADOWS, cast_shadows); - getSelection()->applyToObjects(&func); -} - //---------------------------------------------------------------------- // Helpful packing functions for sendObjectMessage() //---------------------------------------------------------------------- @@ -6242,7 +6250,7 @@ BOOL LLSelectMgr::canSelectObject(LLViewerObject* object) } if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) || - (gSavedSettings.getBOOL("SelectMovableOnly") && !object->permMove())) + (gSavedSettings.getBOOL("SelectMovableOnly") && (!object->permMove() || object->isPermanentEnforced()))) { // only select my own objects return FALSE; @@ -6934,7 +6942,7 @@ LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root_first) bool apply(LLSelectNode* node) { LLViewerObject* obj = node->getObject(); - return obj && obj->permMove(); + return obj && obj->permMove() && !obj->isPermanentEnforced(); } } func; LLSelectNode* res = get_root_first ? getFirstRootNode(&func, TRUE) : getFirstNode(&func); @@ -6972,9 +6980,10 @@ LLViewerObject* LLObjectSelection::getFirstDeleteableObject() LLViewerObject* obj = node->getObject(); // you can delete an object if you are the owner // or you have permission to modify it. - if( obj && ( (obj->permModify()) || - (obj->permYouOwner()) || - (!obj->permAnyOwner()) )) // public + if( obj && !obj->isPermanentEnforced() && + ( (obj->permModify()) || + (obj->permYouOwner()) || + (!obj->permAnyOwner()) )) // public { if( !obj->isAttachment() ) { @@ -7014,7 +7023,7 @@ LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent) bool apply(LLSelectNode* node) { LLViewerObject* obj = node->getObject(); - return obj && obj->permMove(); + return obj && obj->permMove() && !obj->isPermanentEnforced(); } } func; return getFirstSelectedObject(&func, get_parent); @@ -7083,7 +7092,7 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ, { obj = (*it)->getObject(); bool enable_pos = false, enable_rot = false; - bool perm_move = obj->permMove(); + bool perm_move = obj->permMove() && !obj->isPermanentEnforced(); bool perm_mod = obj->permModify(); LLVector3d sel_center(getSelectionCenterGlobal()); diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 87ada5ac6b..07eb62a8fa 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -501,7 +501,6 @@ public: void selectionUpdatePhysics(BOOL use_physics); void selectionUpdateTemporary(BOOL is_temporary); void selectionUpdatePhantom(BOOL is_ghost); - void selectionUpdateCastShadows(BOOL cast_shadows); void selectionDump(); BOOL selectionAllPCode(LLPCode code); // all objects have this PCode @@ -539,8 +538,6 @@ public: void selectionTexScaleAutofit(F32 repeats_per_meter); void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch); - void selectionResetRotation(); // sets rotation quat to identity - void selectionRotateAroundZ(F32 degrees); bool selectionMove(const LLVector3& displ, F32 rx, F32 ry, F32 rz, U32 update_type); void sendSelectionMove(); @@ -563,6 +560,10 @@ public: BOOL selectGetRootsModify(); BOOL selectGetModify(); + // returns TRUE if is all objects are non-permanent + BOOL selectGetRootsNonPermanent(); + BOOL selectGetNonPermanent(); + // returns TRUE if selected objects can be transferred. BOOL selectGetRootsTransfer(); diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 24cb559fd0..4b49ae9f43 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -301,6 +301,8 @@ void LLSidepanelTaskInfo::refresh() // BUG: fails if a root and non-root are both single-selected. const BOOL is_perm_modify = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); + const BOOL is_nonpermanent = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanent()) || + LLSelectMgr::getInstance()->selectGetNonPermanent(); S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = @@ -308,12 +310,18 @@ void LLSidepanelTaskInfo::refresh() getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), - getString("text modify info 4") + getString("text modify info 4"), + getString("text modify info 5"), + getString("text modify info 6") }; if (!is_perm_modify) { string_index += 2; } + else if (!is_nonpermanent) + { + string_index += 4; + } if (!is_one_object) { ++string_index; diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 66df7dae3e..65393cc168 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -346,6 +346,19 @@ void LLSurface::getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegio } } + +void LLSurface::getNeighboringRegionsStatus( std::vector<S32>& regions ) +{ + S32 i; + for (i = 0; i < 8; i++) + { + if ( mNeighbors[i] != NULL ) + { + regions.push_back( i ); + } + } +} + void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) { S32 i; diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index a4ef4fe2de..8052fb0d18 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -142,6 +142,7 @@ public: friend std::ostream& operator<<(std::ostream &s, const LLSurface &S); void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector<S32>& regions ); public: // Number of grid points on one side of a region, including +1 buffer for diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index aba43a9715..a963ef2ea6 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -52,6 +52,7 @@ #include "llworld.h" #include "llappviewer.h" #include "llparcel.h" +#include "llpathfindingmanager.h" #include "llglheaders.h" @@ -246,6 +247,12 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() } } + if (!gAgent.isGodlike() && !gSavedSettings.getBOOL("PathfindingDisablePermanentObjects") && !LLPathfindingManager::getInstance()->isAllowAlterPermanent()) + { + alertNoTerraformWhileFrozen(); + return; + } + for(region_list_t::iterator iter = mLastAffectedRegions.begin(); iter != mLastAffectedRegions.end(); ++iter) { @@ -382,6 +389,12 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) return TRUE; } + if (!gAgent.isGodlike() && !gSavedSettings.getBOOL("PathfindingDisablePermanentObjects") && !LLPathfindingManager::getInstance()->isAllowAlterPermanent()) + { + alertNoTerraformWhileFrozen(); + return TRUE; + } + LLVector3 pos_region = region_position.getPositionRegion(); U32 grids = regionp->getLand().mGridsPerEdge; S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids ); @@ -671,6 +684,12 @@ void LLToolBrushLand::alertNoTerraform(LLViewerRegion* regionp) } +// static +void LLToolBrushLand::alertNoTerraformWhileFrozen() +{ + LLNotificationsUtil::add("RegionNoTerraformingWhileFrozen"); +} + ///============================================================================ /// Local function definitions ///============================================================================ diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h index 1c7f198900..416cdf429c 100644 --- a/indra/newview/lltoolbrush.h +++ b/indra/newview/lltoolbrush.h @@ -86,6 +86,9 @@ protected: // Modal dialog that you can't terraform the region void alertNoTerraform(LLViewerRegion* regionp); + // Modal dialog that you can't terraform in frozen mode + void alertNoTerraformWhileFrozen(); + protected: F32 mStartingZ; S32 mMouseX; diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 319e2508e0..9907da0f0e 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -205,9 +205,9 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info) // Clicks on scripted or physical objects are temporary grabs, so // not "Build mode" - mHideBuildHighlight = script_touch || objectp->usePhysics(); + mHideBuildHighlight = script_touch || objectp->flagUsePhysics(); - if (!objectp->usePhysics()) + if (!objectp->flagUsePhysics()) { if (script_touch) { @@ -222,18 +222,24 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info) if (gAgentCamera.cameraMouselook()) { mMode = GRAB_LOCKED; + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); } - else + else if (objectp->permMove() && !objectp->isPermanentEnforced()) { mMode = GRAB_ACTIVE_CENTER; + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); + } + else + { + mMode = GRAB_LOCKED; } - gViewerWindow->hideCursor(); - gViewerWindow->moveCursorToCenter(); } } - else if( !objectp->permMove() ) + else if( objectp->flagCharacter() || !objectp->permMove() || objectp->isPermanentEnforced()) { // if mouse is over a physical object without move permission, show feedback if user tries to move it. mMode = GRAB_LOCKED; diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index ac01316462..a135ba70f5 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -91,6 +91,8 @@ LLToolMgr::LLToolMgr() // gLandToolset = new LLToolset(); gMouselookToolset = new LLToolset(); gFaceEditToolset = new LLToolset(); + gMouselookToolset->setShowFloaterTools(false); + gFaceEditToolset->setShowFloaterTools(false); } void LLToolMgr::initTools() diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index 12649cfba2..e7d1c56c83 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -89,7 +89,7 @@ protected: class LLToolset { public: - LLToolset() : mSelectedTool(NULL) {} + LLToolset() : mSelectedTool(NULL), mIsShowFloaterTools(true) {} LLTool* getSelectedTool() { return mSelectedTool; } @@ -105,10 +105,14 @@ public: BOOL isToolSelected( S32 index ); + void setShowFloaterTools(bool pShowFloaterTools) {mIsShowFloaterTools = pShowFloaterTools;}; + bool isShowFloaterTools() const {return mIsShowFloaterTools;}; + protected: LLTool* mSelectedTool; typedef std::vector<LLTool*> tool_list_t; tool_list_t mToolList; + bool mIsShowFloaterTools; }; // Globals diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index b0d9bd5d70..3cd761b73b 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -312,7 +312,7 @@ BOOL LLToolPie::handleLeftClickPick() // Switch to grab tool if physical or triggerable if (object && !object->isAvatar() && - ((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable) + ((object->flagUsePhysics() || (parent && !parent->isAvatar() && parent->flagUsePhysics())) || touchable) ) { gGrabTransientTool = this; @@ -596,8 +596,8 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; } - else if ((object && !object->isAvatar() && object->usePhysics()) - || (parent && !parent->isAvatar() && parent->usePhysics())) + else if ((object && !object->isAvatar() && object->flagUsePhysics()) + || (parent && !parent->isAvatar() && parent->flagUsePhysics())) { show_highlight = true; gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 7fdaac68c8..12f802b29a 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -84,6 +84,10 @@ #include "llfloaterobjectweights.h" #include "llfloateropenobject.h" #include "llfloateroutbox.h" +#include "llfloaterpathfindingbasic.h" +#include "llfloaterpathfindingcharacters.h" +#include "llfloaterpathfindinglinksets.h" +#include "llfloaterpathfindingconsole.h" #include "llfloaterpay.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" @@ -243,6 +247,10 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>); LLFloaterPayUtil::registerFloater(); + LLFloaterReg::add("pathfinding_basic", "floater_pathfinding_basic.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingBasic>); + LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingCharacters>); + LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingLinksets>); + LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingConsole>); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 7481414b5c..6944ae1a9b 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -115,6 +115,7 @@ #include "lleconomy.h" #include "lltoolgrab.h" #include "llwindow.h" +#include "llpathfindingmanager.h" #include "boost/unordered_map.hpp" using namespace LLVOAvatarDefines; @@ -202,7 +203,6 @@ void near_sit_object(); BOOL is_selection_buy_not_take(); S32 selection_price(); BOOL enable_take(); -void handle_take(); void handle_object_show_inspector(); void handle_avatar_show_inspector(); bool confirm_take(const LLSD& notification, const LLSD& response); @@ -3256,7 +3256,7 @@ void append_aggregate(std::string& string, const LLAggregatePermissions& ag_perm bool enable_buy_object() { // In order to buy, there must only be 1 purchaseable object in - // the selection manger. + // the selection manager. if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != 1) return false; LLViewerObject* obj = NULL; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); @@ -4134,8 +4134,9 @@ static bool get_derezzable_objects( { case DRD_TAKE_INTO_AGENT_INVENTORY: case DRD_TRASH: - if( (node->mPermissions->allowTransferTo(gAgent.getID()) && object->permModify()) - || (node->allowOperationOnNode(PERM_OWNER, GP_OBJECT_MANIPULATE)) ) + if (!object->isPermanentEnforced() && + ((node->mPermissions->allowTransferTo(gAgent.getID()) && object->permModify()) + || (node->allowOperationOnNode(PERM_OWNER, GP_OBJECT_MANIPULATE)))) { can_derez_current = TRUE; } @@ -4542,9 +4543,10 @@ BOOL enable_take() return TRUE; } # endif - if((node->mPermissions->allowTransferTo(gAgent.getID()) + if(!object->isPermanentEnforced() && + ((node->mPermissions->allowTransferTo(gAgent.getID()) && object->permModify()) - || (node->mPermissions->getOwner() == gAgent.getID())) + || (node->mPermissions->getOwner() == gAgent.getID()))) { return TRUE; } @@ -4796,6 +4798,22 @@ class LLToolsSaveToObjectInventory : public view_listener_t } }; +class LLToolsEnablePathfinding : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion(); + } +}; + +class LLToolsEnablePathfindingLinksets : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isAllowAlterPermanent(); + } +}; + // Round the position of all root objects to the grid class LLToolsSnapObjectXY : public view_listener_t { @@ -5054,6 +5072,12 @@ class LLEditDelete : public view_listener_t } }; +bool enable_object_return() +{ + return (!LLSelectMgr::getInstance()->getSelection()->isEmpty() && + (gAgent.isGodlike() || can_derez(DRD_RETURN_TO_OWNER))); +} + bool enable_object_delete() { bool new_value = @@ -5069,6 +5093,49 @@ bool enable_object_delete() return new_value; } +class LLObjectsReturnPackage +{ +public: + LLObjectsReturnPackage() : mObjectSelection(), mReturnableObjects(), mError(), mFirstRegion(NULL) {}; + ~LLObjectsReturnPackage() + { + mObjectSelection.clear(); + mReturnableObjects.clear(); + mError.clear(); + mFirstRegion = NULL; + }; + + LLObjectSelectionHandle mObjectSelection; + LLDynamicArray<LLViewerObjectPtr> mReturnableObjects; + std::string mError; + LLViewerRegion *mFirstRegion; +}; + +static void return_objects(LLObjectsReturnPackage *objectsReturnPackage, const LLSD& notification, const LLSD& response) +{ + if (LLNotificationsUtil::getSelectedOption(notification, response) == 0) + { + // Ignore category ID for this derez destination. + derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, objectsReturnPackage->mFirstRegion, objectsReturnPackage->mError, &objectsReturnPackage->mReturnableObjects); + } + + delete objectsReturnPackage; +} + +void handle_object_return() +{ + if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + LLObjectsReturnPackage *objectsReturnPackage = new LLObjectsReturnPackage(); + objectsReturnPackage->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); + + // Save selected objects, so that we still know what to return after the confirmation dialog resets selection. + get_derezzable_objects(DRD_RETURN_TO_OWNER, objectsReturnPackage->mError, objectsReturnPackage->mFirstRegion, &objectsReturnPackage->mReturnableObjects); + + LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&return_objects, objectsReturnPackage, _1, _2)); + } +} + void handle_object_delete() { @@ -6422,6 +6489,7 @@ BOOL object_selected_and_point_valid() (selection->getFirstRootObject()->getPCode() == LL_PCODE_VOLUME) && selection->getFirstRootObject()->permYouOwner() && selection->getFirstRootObject()->flagObjectMove() && + !selection->getFirstRootObject()->flagObjectPermanent() && !((LLViewerObject*)selection->getFirstRootObject()->getRoot())->isAvatar() && (selection->getFirstRootObject()->getNVPair("AssetContainer") == NULL); } @@ -8140,6 +8208,9 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsEnableSaveToInventory(), "Tools.EnableSaveToInventory"); view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory"); + view_listener_t::addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding"); + view_listener_t::addMenu(new LLToolsEnablePathfindingLinksets(), "Tools.EnablePathfindingLinksets"); + // Help menu // most items use the ShowFloater method view_listener_t::addMenu(new LLToggleHowTo(), "Help.ToggleHowTo"); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 87cb4efbc4..f10891737f 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -93,11 +93,20 @@ void handle_object_touch(); bool enable_object_open(); void handle_object_open(); +bool visible_take_object(); +bool tools_visible_take_object(); +bool enable_object_take_copy(); +bool enable_object_return(); +bool enable_object_delete(); + // Buy either contents or object itself void handle_buy(); +void handle_take(); void handle_take_copy(); void handle_look_at_selection(const LLSD& param); void handle_zoom_to_object(LLUUID object_id); +void handle_object_return(); +void handle_object_delete(); void handle_buy_land(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 854e2bea52..1006abb91a 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4630,6 +4630,18 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) case LL_SIM_STAT_IOPUMPTIME: LLViewerStats::getInstance()->mSimPumpIOMsec.addValue(stat_value); break; + case LL_SIM_STAT_PCTSCRIPTSRUN: + LLViewerStats::getInstance()->mSimPctScriptsRun.addValue(stat_value); + break; + case LL_SIM_STAT_SIMAISTEPTIMEMS: + LLViewerStats::getInstance()->mSimSimAIStepMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SKIPPEDAISILSTEPS_PS: + LLViewerStats::getInstance()->mSimSimSkippedSilhouetteSteps.addValue(stat_value); + break; + case LL_SIM_STAT_PCTSTEPPEDCHARACTERS: + LLViewerStats::getInstance()->mSimSimPctSteppedCharacters.addValue(stat_value); + break; default: // Used to be a commented out warning. LL_DEBUGS("Messaging") << "Unknown stat id" << stat_id << LL_ENDL; @@ -4739,7 +4751,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) LLViewerObject* object = gObjectList.findObject(object_id); if (object) { - object->mFlags |= FLAGS_ANIM_SOURCE; + object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, TRUE); BOOL anim_found = FALSE; LLVOAvatar::AnimSourceIterator anim_it = avatarp->mAnimationSources.find(object_id); @@ -4886,7 +4898,7 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat LLViewerObject* objectp = gObjectList.findObject(source_id); if (objectp) { - objectp->mFlags |= FLAGS_CAMERA_SOURCE; + objectp->setFlagsWithoutUpdate(FLAGS_CAMERA_SOURCE, TRUE); } S32 num_objects = mesgsys->getNumberOfBlocks("CameraProperty"); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index cd300accb7..bfde167f18 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -100,6 +100,7 @@ #include "lltrans.h" #include "llsdutil.h" #include "llmediaentry.h" +#include "llpathfindingmanager.h" //#define DEBUG_UPDATE_TYPE @@ -446,7 +447,7 @@ void LLViewerObject::dump() const /* llinfos << "Velocity: " << getVelocity() << llendl; llinfos << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << llendl; - llinfos << "UsePhysics: " << usePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << llendl; + llinfos << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << llendl; llinfos << "AppAngle: " << mAppAngle << llendl; llinfos << "PixelArea: " << mPixelArea << llendl; @@ -2065,12 +2066,11 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } } - if (new_rot != mLastRot + if (new_rot != getRotation() || new_angv != old_angv) { - if (new_rot != mLastRot) + if (new_rot != getRotation()) { - mLastRot = new_rot; setRotation(new_rot); } @@ -4038,38 +4038,6 @@ void LLViewerObject::sendMaterialUpdate() const } -// formerly send_object_rotation -void LLViewerObject::sendRotationUpdate() const -{ - LLViewerRegion* regionp = getRegion(); - if(!regionp) return; - gMessageSystem->newMessageFast(_PREHASH_ObjectRotation); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID); - gMessageSystem->addQuatFast(_PREHASH_Rotation, getRotationEdit()); - //llinfos << "Sent rotation " << getRotationEdit() << llendl; - gMessageSystem->sendReliable( regionp->getHost() ); -} - -/* Obsolete, we use MultipleObjectUpdate instead -//// formerly send_object_position_global -//void LLViewerObject::sendPositionUpdate() const -//{ -// gMessageSystem->newMessageFast(_PREHASH_ObjectPosition); -// gMessageSystem->nextBlockFast(_PREHASH_AgentData); -// gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); -// gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); -// gMessageSystem->nextBlockFast(_PREHASH_ObjectData); -// gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID ); -// gMessageSystem->addVector3Fast(_PREHASH_Position, getPositionRegion()); -// LLViewerRegion* regionp = getRegion(); -// gMessageSystem->sendReliable(regionp->getHost()); -//} -*/ - //formerly send_object_shape(LLViewerObject *object) void LLViewerObject::sendShapeUpdate() { @@ -5136,7 +5104,7 @@ BOOL LLViewerObject::permAnyOwner() const { if (isRootEdit()) { - return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0); + return flagObjectAnyOwner(); } else { @@ -5158,7 +5126,7 @@ BOOL LLViewerObject::permYouOwner() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0); + return flagObjectYouOwner(); #endif } else @@ -5172,7 +5140,7 @@ BOOL LLViewerObject::permGroupOwner() const { if (isRootEdit()) { - return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0); + return flagObjectGroupOwned(); } else { @@ -5195,7 +5163,7 @@ BOOL LLViewerObject::permOwnerModify() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0); + return flagObjectOwnerModify(); #endif } else @@ -5219,7 +5187,7 @@ BOOL LLViewerObject::permModify() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_MODIFY) != 0); + return flagObjectModify(); #endif } else @@ -5243,7 +5211,7 @@ BOOL LLViewerObject::permCopy() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_COPY) != 0); + return flagObjectCopy(); #endif } else @@ -5267,7 +5235,7 @@ BOOL LLViewerObject::permMove() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_MOVE) != 0); + return flagObjectMove(); #endif } else @@ -5291,7 +5259,7 @@ BOOL LLViewerObject::permTransfer() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0); + return flagObjectTransfer(); #endif } else @@ -5334,21 +5302,19 @@ void LLViewerObject::markForUpdate(BOOL priority) } } +bool LLViewerObject::isPermanentEnforced() const +{ + return flagObjectPermanent() && !LLPathfindingManager::getInstance()->isAllowAlterPermanent() && !gAgent.isGodlike(); +} + bool LLViewerObject::getIncludeInSearch() const { - return ((mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0); + return flagIncludeInSearch(); } void LLViewerObject::setIncludeInSearch(bool include_in_search) { - if (include_in_search) - { - mFlags |= FLAGS_INCLUDE_IN_SEARCH; - } - else - { - mFlags &= ~FLAGS_INCLUDE_IN_SEARCH; - } + setFlags(FLAGS_INCLUDE_IN_SEARCH, include_in_search); } void LLViewerObject::setRegion(LLViewerRegion *regionp) @@ -5387,8 +5353,8 @@ void LLViewerObject::updateRegion(LLViewerRegion *regionp) bool LLViewerObject::specialHoverCursor() const { - return (mFlags & FLAGS_USE_PHYSICS) - || (mFlags & FLAGS_HANDLE_TOUCH) + return flagUsePhysics() + || flagHandleTouch() || (mClickAction != 0); } @@ -5401,10 +5367,15 @@ void LLViewerObject::updateFlags(BOOL physics_changed) gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, getLocalID() ); - gMessageSystem->addBOOLFast(_PREHASH_UsePhysics, usePhysics() ); + gMessageSystem->addBOOLFast(_PREHASH_UsePhysics, flagUsePhysics() ); gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() ); gMessageSystem->addBOOL("IsPhantom", flagPhantom() ); - gMessageSystem->addBOOL("CastsShadows", flagCastShadows() ); + + // stinson 02/28/2012 : This CastsShadows BOOL is no longer used in either the viewer or the simulator + // The simulator code does not even unpack this value when the message is received. + // This could be potentially hijacked in the future for another use should the urgent need arise. + gMessageSystem->addBOOL("CastsShadows", FALSE ); + if (physics_changed) { gMessageSystem->nextBlock("ExtraPhysics"); @@ -5419,6 +5390,19 @@ void LLViewerObject::updateFlags(BOOL physics_changed) BOOL LLViewerObject::setFlags(U32 flags, BOOL state) { + BOOL setit = setFlagsWithoutUpdate(flags, state); + + // BUG: Sometimes viewer physics and simulator physics get + // out of sync. To fix this, always send update to simulator. +// if (setit) + { + updateFlags(); + } + return setit; +} + +BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state) +{ BOOL setit = FALSE; if (state) { @@ -5436,13 +5420,6 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state) setit = TRUE; } } - - // BUG: Sometimes viewer physics and simulator physics get - // out of sync. To fix this, always send update to simulator. -// if (setit) - { - updateFlags(); - } return setit; } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index c8152e1539..4a33c3a674 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -45,6 +45,7 @@ #include "llvertexbuffer.h" #include "llbbox.h" #include "llbbox.h" +#include "llviewercontrol.h" class LLAgent; // TODO: Get rid of this. class LLAudioSource; @@ -308,7 +309,6 @@ public: inline void setRotation(const F32 x, const F32 y, const F32 z, BOOL damped = FALSE); inline void setRotation(const LLQuaternion& quat, BOOL damped = FALSE); - void sendRotationUpdate() const; /*virtual*/ void setNumTEs(const U8 num_tes); /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry); @@ -468,26 +468,36 @@ public: BOOL permCopy() const; BOOL permMove() const; BOOL permTransfer() const; - inline BOOL usePhysics() const { return ((mFlags & FLAGS_USE_PHYSICS) != 0); } + inline BOOL flagUsePhysics() const { return ((mFlags & FLAGS_USE_PHYSICS) != 0); } + inline BOOL flagObjectAnyOwner() const { return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0); } + inline BOOL flagObjectYouOwner() const { return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0); } + inline BOOL flagObjectGroupOwned() const { return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0); } + inline BOOL flagObjectOwnerModify() const { return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0); } + inline BOOL flagObjectModify() const { return ((mFlags & FLAGS_OBJECT_MODIFY) != 0); } + inline BOOL flagObjectCopy() const { return ((mFlags & FLAGS_OBJECT_COPY) != 0); } + inline BOOL flagObjectMove() const { return ((mFlags & FLAGS_OBJECT_MOVE) != 0); } + inline BOOL flagObjectTransfer() const { return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0); } + inline BOOL flagObjectPermanent() const { return gSavedSettings.getBOOL("PathfindingDisablePermanentObjects") ? FALSE : ((mFlags & FLAGS_OBJECT_PERMANENT) != 0); } + inline BOOL flagCharacter() const { return gSavedSettings.getBOOL("PathfindingDisableCharacterObjects") ? FALSE : ((mFlags & FLAGS_CHARACTER) != 0); } + inline BOOL flagIncludeInSearch() const { return ((mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0); } inline BOOL flagScripted() const { return ((mFlags & FLAGS_SCRIPTED) != 0); } inline BOOL flagHandleTouch() const { return ((mFlags & FLAGS_HANDLE_TOUCH) != 0); } inline BOOL flagTakesMoney() const { return ((mFlags & FLAGS_TAKES_MONEY) != 0); } inline BOOL flagPhantom() const { return ((mFlags & FLAGS_PHANTOM) != 0); } inline BOOL flagInventoryEmpty() const { return ((mFlags & FLAGS_INVENTORY_EMPTY) != 0); } - inline BOOL flagCastShadows() const { return ((mFlags & FLAGS_CAST_SHADOWS) != 0); } inline BOOL flagAllowInventoryAdd() const { return ((mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0); } - inline BOOL flagTemporary() const { return ((mFlags & FLAGS_TEMPORARY) != 0); } inline BOOL flagTemporaryOnRez() const { return ((mFlags & FLAGS_TEMPORARY_ON_REZ) != 0); } inline BOOL flagAnimSource() const { return ((mFlags & FLAGS_ANIM_SOURCE) != 0); } inline BOOL flagCameraSource() const { return ((mFlags & FLAGS_CAMERA_SOURCE) != 0); } inline BOOL flagCameraDecoupled() const { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); } - inline BOOL flagObjectMove() const { return ((mFlags & FLAGS_OBJECT_MOVE) != 0); } U8 getPhysicsShapeType() const; inline F32 getPhysicsGravity() const { return mPhysicsGravity; } inline F32 getPhysicsFriction() const { return mPhysicsFriction; } inline F32 getPhysicsDensity() const { return mPhysicsDensity; } inline F32 getPhysicsRestitution() const { return mPhysicsRestitution; } + + bool isPermanentEnforced() const; bool getIncludeInSearch() const; void setIncludeInSearch(bool include_in_search); @@ -504,6 +514,7 @@ public: void updateFlags(BOOL physics_changed = FALSE); BOOL setFlags(U32 flag, BOOL state); + BOOL setFlagsWithoutUpdate(U32 flag, BOOL state); void setPhysicsShapeType(U8 type); void setPhysicsGravity(F32 gravity); void setPhysicsFriction(F32 friction); @@ -595,9 +606,11 @@ public: U32 mGLName; // GL "name" used by selection code BOOL mbCanSelect; // true if user can select this object by clicking +private: // Grabbed from UPDATE_FLAGS U32 mFlags; +public: // Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties U8 mPhysicsShapeType; F32 mPhysicsGravity; @@ -710,7 +723,6 @@ protected: F32 mTimeDilation; // Time dilation sent with the object. F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega) - LLQuaternion mLastRot; // last rotation received from the simulator LLVOJointInfo* mJointInfo; U8 mState; // legacy diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 6912faa9ec..6dedf0a2fe 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -385,9 +385,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, } else if (compressed) { - U8 compbuffer[2048]; S32 uncompressed_length = 2048; - S32 compressed_length; compressed_dp.reset(); U32 flags = 0; @@ -396,24 +394,9 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); } - // I don't think we ever use this flag from the server. DK 2010/12/09 - if (flags & FLAGS_ZLIB_COMPRESSED) - { - //llinfos << "TEST: flags & FLAGS_ZLIB_COMPRESSED" << llendl; - compressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); - mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compbuffer, 0, i); - uncompressed_length = 2048; - uncompress(compressed_dpbuffer, (unsigned long *)&uncompressed_length, - compbuffer, compressed_length); - compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); - } - else - { - uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); - mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i); - compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); - } - + uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); + mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i); + compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e3cb985ddb..243231c65a 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1489,8 +1489,10 @@ void LLViewerRegion::unpackRegionHandshake() void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) { + capabilityNames.append("AgentPreferences"); capabilityNames.append("AttachmentResources"); capabilityNames.append("AvatarPickerSearch"); + capabilityNames.append("CharacterProperties"); capabilityNames.append("ChatSessionRequest"); capabilityNames.append("CopyInventoryFromNotecard"); capabilityNames.append("CreateInventoryCategory"); @@ -1519,8 +1521,10 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("LandResources"); capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); - capabilityNames.append("MeshUploadFlag"); + capabilityNames.append("MeshUploadFlag"); + capabilityNames.append("NavMeshGenerationStatus"); capabilityNames.append("NewFileAgentInventory"); + capabilityNames.append("ObjectNavMeshProperties"); capabilityNames.append("ParcelPropertiesUpdate"); capabilityNames.append("ParcelMediaURLFilterList"); capabilityNames.append("ParcelNavigateMedia"); @@ -1530,6 +1534,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("RemoteParcelRequest"); capabilityNames.append("RequestTextureDownload"); capabilityNames.append("ResourceCostSelected"); + capabilityNames.append("RetrieveNavMeshSrc"); capabilityNames.append("SearchStatRequest"); capabilityNames.append("SearchStatTracking"); capabilityNames.append("SendPostcard"); @@ -1541,6 +1546,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("SetDisplayName"); capabilityNames.append("SimConsoleAsync"); capabilityNames.append("StartGroupProposal"); + capabilityNames.append("TerrainNavMeshProperties"); capabilityNames.append("TextureStats"); capabilityNames.append("UntrustedSimulatorMessage"); capabilityNames.append("UpdateAgentInformation"); @@ -1555,7 +1561,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("ViewerMetrics"); capabilityNames.append("ViewerStartAuction"); capabilityNames.append("ViewerStats"); - + // Please add new capabilities alphabetically to reduce // merge conflicts. } @@ -1794,7 +1800,10 @@ void LLViewerRegion::getNeighboringRegions( std::vector<LLViewerRegion*>& unique { mImpl->mLandp->getNeighboringRegions( uniqueRegions ); } - +void LLViewerRegion::getNeighboringRegionsStatus( std::vector<S32>& regions ) +{ + mImpl->mLandp->getNeighboringRegionsStatus( regions ); +} void LLViewerRegion::showReleaseNotes() { std::string url = this->getCapability("ServerReleaseNotes"); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index c483c6ef52..6004165b0e 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -325,6 +325,7 @@ public: bool objectsCrossParcel(const std::vector<LLBBox>& boxes) const; void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector<S32>& regions ); public: struct CompareDistance diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 10c61c01d5..b2ffb068ff 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -134,6 +134,8 @@ LLGLSLShader gUnderWaterProgram; //interface shaders LLGLSLShader gHighlightProgram; +LLGLSLShader gPathfindingProgram; +LLGLSLShader gPathfindingNoNormalsProgram; //avatar shader handles LLGLSLShader gAvatarProgram; @@ -603,6 +605,8 @@ void LLViewerShaderMgr::unloadShaders() gDebugProgram.unload(); gAlphaMaskProgram.unload(); gUIProgram.unload(); + gPathfindingProgram.unload(); + gPathfindingNoNormalsProgram.unload(); gCustomAlphaProgram.unload(); gGlowCombineProgram.unload(); gSplatTextureRectProgram.unload(); @@ -2529,6 +2533,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { + gPathfindingProgram.mName = "Pathfinding Shader"; + gPathfindingProgram.mShaderFiles.clear(); + gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingV.glsl", GL_VERTEX_SHADER_ARB)); + gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER_ARB)); + gPathfindingProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gPathfindingProgram.createShader(NULL, NULL); + } + + if (success) + { + gPathfindingNoNormalsProgram.mName = "PathfindingNoNormals Shader"; + gPathfindingNoNormalsProgram.mShaderFiles.clear(); + gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingNoNormalV.glsl", GL_VERTEX_SHADER_ARB)); + gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER_ARB)); + gPathfindingNoNormalsProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gPathfindingNoNormalsProgram.createShader(NULL, NULL); + } + + if (success) + { gCustomAlphaProgram.mName = "Custom Alpha Shader"; gCustomAlphaProgram.mShaderFiles.clear(); gCustomAlphaProgram.mShaderFiles.push_back(make_pair("interface/customalphaV.glsl", GL_VERTEX_SHADER_ARB)); diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 95eb551bf1..ceb14870d4 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -288,6 +288,8 @@ extern LLGLSLShader gGlowExtractProgram; //interface shaders extern LLGLSLShader gHighlightProgram; +extern LLGLSLShader gPathfindingProgram; +extern LLGLSLShader gPathfindingNoNormalsProgram; // avatar shader handles extern LLGLSLShader gAvatarProgram; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index c88122f22c..6a68555b20 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -233,6 +233,9 @@ LLViewerStats::LLViewerStats() : mSimSimPhysicsStepMsec("simsimphysicsstepmsec"), mSimSimPhysicsShapeUpdateMsec("simsimphysicsshapeupdatemsec"), mSimSimPhysicsOtherMsec("simsimphysicsothermsec"), + mSimSimAIStepMsec("simsimaistepmsec"), + mSimSimSkippedSilhouetteSteps("simsimskippedsilhouettesteps"), + mSimSimPctSteppedCharacters("simsimpctsteppedcharacters"), mSimAgentMsec("simagentmsec"), mSimImagesMsec("simimagesmsec"), mSimScriptMsec("simscriptmsec"), @@ -244,6 +247,7 @@ LLViewerStats::LLViewerStats() : mSimObjects("simobjects"), mSimActiveObjects("simactiveobjects"), mSimActiveScripts("simactivescripts"), + mSimPctScriptsRun("simpctscriptsrun"), mSimInPPS("siminpps"), mSimOutPPS("simoutpps"), mSimPendingDownloads("simpendingdownloads"), diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index f91a1241fe..37812f1079 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -71,6 +71,10 @@ public: LLStat mSimSimPhysicsShapeUpdateMsec; LLStat mSimSimPhysicsOtherMsec; + LLStat mSimSimAIStepMsec; + LLStat mSimSimSkippedSilhouetteSteps; + LLStat mSimSimPctSteppedCharacters; + LLStat mSimAgentMsec; LLStat mSimImagesMsec; LLStat mSimScriptMsec; @@ -83,6 +87,7 @@ public: LLStat mSimObjects; LLStat mSimActiveObjects; LLStat mSimActiveScripts; + LLStat mSimPctScriptsRun; LLStat mSimInPPS; LLStat mSimOutPPS; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ecd76f5495..ee2171fb07 100755..100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3164,8 +3164,7 @@ void LLViewerWindow::updateLayout() || (tool != LLToolPie::getInstance() // not default tool && tool != LLToolCompGun::getInstance() // not coming out of mouselook && !suppress_toolbox // not override in third person - && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode - && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset + && LLToolMgr::getInstance()->getCurrentToolset()->isShowFloaterTools() && (!captor || dynamic_cast<LLView*>(captor) != NULL))) // not dragging { // Force floater tools to be visible (unless minimized) @@ -3519,8 +3518,11 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, { LLSelectNode* nodep = *iter; LLViewerObject* object = nodep->getObject(); + LLViewerObject *root_object = (object == NULL) ? NULL : object->getRootEdit(); BOOL this_object_movable = FALSE; - if (object->permMove() && (object->permModify() || selecting_linked_set)) + if (object->permMove() && !object->isPermanentEnforced() && + ((root_object == NULL) || !root_object->isPermanentEnforced()) && + (object->permModify() || selecting_linked_set)) { moveable_object_selected = TRUE; this_object_movable = TRUE; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index f063653cc5..c4233dbe8d 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -758,7 +758,7 @@ void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id) LLViewerObject* object = gObjectList.findObject(source_id); if (object) { - object->mFlags &= ~FLAGS_ANIM_SOURCE; + object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, FALSE); } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ab994c71cb..708bb20bc2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -104,7 +104,10 @@ #include "lltoolpie.h" #include "llcurl.h" #include "llnotifications.h" - +#include "llpathinglib.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindingcharacters.h" +#include "llpathfindingpathtool.h" #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 @@ -2646,6 +2649,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) { const LLDrawable* root = ((LLSpatialBridge*) drawablep)->mDrawable; llassert(root); // trying to catch a bad assumption + if (root && // // this test may not be needed, see above root->getVObj()->isAttachment()) { @@ -2668,6 +2672,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) } else { + sCull->pushDrawable(drawablep); } @@ -3222,7 +3227,7 @@ void renderPhysicalBeacons(LLDrawable* drawablep) if (vobj && !vobj->isAvatar() //&& !vobj->getParent() - && vobj->usePhysics()) + && vobj->flagUsePhysics()) { if (gPipeline.sRenderBeacons) { @@ -3811,6 +3816,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep); LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP); + ////////////////////////////////////////////// // // Actually render all of the geometry @@ -3883,7 +3889,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) break; } - p->render(i); + if ( !p->getSkipRenderFlag() ) { p->render(i); } } poolp->endRenderPass(i); LLVertexBuffer::unbind(); @@ -4057,7 +4063,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) break; } - p->renderDeferred(i); + if ( !p->getSkipRenderFlag() ) { p->renderDeferred(i); } } poolp->endDeferredPass(i); LLVertexBuffer::unbind(); @@ -4345,6 +4351,335 @@ void LLPipeline::renderDebug() LLMemType mt(LLMemType::MTYPE_PIPELINE); assertInitialized(); + + bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); + + if (!hud_only ) + { + //Render any navmesh geometry + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if ( llPathingLibInstance != NULL ) + { + //character floater renderables + + LLHandle<LLFloaterPathfindingCharacters> pathfindingCharacterHandle = LLFloaterPathfindingCharacters::getInstanceHandle(); + if ( !pathfindingCharacterHandle.isDead() ) + { + LLFloaterPathfindingCharacters *pathfindingCharacter = pathfindingCharacterHandle.get(); + + if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() ) + { + if (LLGLSLShader::sNoFixedFunction) + { + gPathfindingProgram.bind(); + gPathfindingProgram.uniform1f("tint", 1.f); + gPathfindingProgram.uniform1f("ambiance", 1.f); + gPathfindingProgram.uniform1f("alpha_scale", 1.f); + } + + //Requried character physics capsule render parameters + LLUUID id; + LLVector3 pos; + LLQuaternion rot; + + if ( pathfindingCharacter->isPhysicsCapsuleEnabled( id, pos, rot ) ) + { + if (LLGLSLShader::sNoFixedFunction) + { + //remove blending artifacts + gGL.setColorMask(false, false); + llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot ); + gGL.setColorMask(true, false); + LLGLEnable blend(GL_BLEND); + gPathfindingProgram.uniform1f("alpha_scale", 0.90f); + llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot ); + gPathfindingProgram.bind(); + } + else + { + llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot ); + } + } + } + } + + + //pathing console renderables + LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); + if (!pathfindingConsoleHandle.isDead()) + { + LLFloaterPathfindingConsole *pathfindingConsole = pathfindingConsoleHandle.get(); + + if ( pathfindingConsole->getVisible() || gAgentCamera.cameraMouselook() ) + { + F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance"); + + if (LLGLSLShader::sNoFixedFunction) + { + gPathfindingProgram.bind(); + + gPathfindingProgram.uniform1f("tint", 1.f); + gPathfindingProgram.uniform1f("ambiance", ambiance); + gPathfindingProgram.uniform1f("alpha_scale", 1.f); + } + + if ( !pathfindingConsole->isRenderWorld() ) + { + const LLColor4 clearColor = gSavedSettings.getColor4("PathfindingNavMeshClear"); + gGL.setColorMask(true, true); + glClearColor(clearColor.mV[0],clearColor.mV[1],clearColor.mV[2],0); + glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + gGL.setColorMask(true, false); + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + } + + //NavMesh + if ( pathfindingConsole->isRenderNavMesh() ) + { + gGL.flush(); + glLineWidth(2.0f); + LLGLEnable cull(GL_CULL_FACE); + LLGLDisable blend(GL_BLEND); + + if ( pathfindingConsole->isRenderWorld() ) + { + LLGLEnable blend(GL_BLEND); + gPathfindingProgram.uniform1f("alpha_scale", 0.66f); + llPathingLibInstance->renderNavMesh(); + } + else + { + llPathingLibInstance->renderNavMesh(); + } + + //render edges + if (LLGLSLShader::sNoFixedFunction) + { + gPathfindingNoNormalsProgram.bind(); + gPathfindingNoNormalsProgram.uniform1f("tint", 1.f); + gPathfindingNoNormalsProgram.uniform1f("alpha_scale", 1.f); + llPathingLibInstance->renderNavMeshEdges(); + gPathfindingProgram.bind(); + } + else + { + llPathingLibInstance->renderNavMeshEdges(); + } + + gGL.flush(); + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + glLineWidth(1.0f); + gGL.flush(); + } + //User designated path + if ( LLPathfindingPathTool::getInstance()->isRenderPath() ) + { + //The path + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); + llPathingLibInstance->renderPath(); + gPathfindingProgram.bind(); + } + else + { + llPathingLibInstance->renderPath(); + } + //The bookends + if (LLGLSLShader::sNoFixedFunction) + { + //remove blending artifacts + gGL.setColorMask(false, false); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START ); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END ); + + gGL.setColorMask(true, false); + //render the bookends + LLGLEnable blend(GL_BLEND); + gPathfindingProgram.uniform1f("alpha_scale", 0.90f); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START ); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END ); + gPathfindingProgram.bind(); + } + else + { + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START ); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END ); + } + + } + + if ( pathfindingConsole->isRenderWaterPlane() ) + { + if (LLGLSLShader::sNoFixedFunction) + { + LLGLEnable blend(GL_BLEND); + gPathfindingProgram.uniform1f("alpha_scale", 0.90f); + llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() ); + } + else + { + llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() ); + } + } + //physics/exclusion shapes + if ( pathfindingConsole->isRenderAnyShapes() ) + { + U32 render_order[] = { + 1 << LLPathingLib::LLST_ObstacleObjects, + 1 << LLPathingLib::LLST_WalkableObjects, + 1 << LLPathingLib::LLST_ExclusionPhantoms, + 1 << LLPathingLib::LLST_MaterialPhantoms, + }; + + U32 flags = pathfindingConsole->getRenderShapeFlags(); + + for (U32 i = 0; i < 4; i++) + { + if (!(flags & render_order[i])) + { + continue; + } + + //turn off backface culling for volumes so they are visible when camera is inside volume + LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0); + + gGL.flush(); + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + + //get rid of some z-fighting + LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(1.0f, 1.0f); + + //render to depth first to avoid blending artifacts + gGL.setColorMask(false, false); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + gGL.setColorMask(true, false); + + //get rid of some z-fighting + glPolygonOffset(0.f, 0.f); + + LLGLEnable blend(GL_BLEND); + + { + gPathfindingProgram.uniform1f("ambiance", ambiance); + + { //draw solid overlay + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + gGL.flush(); + } + + LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE); + glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); + + F32 offset = gSavedSettings.getF32("PathfindingLineOffset"); + + if (pathfindingConsole->isRenderXRay()) + { + gPathfindingProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint")); + gPathfindingProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity")); + LLGLEnable blend(GL_BLEND); + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); + + glPolygonOffset(offset, -offset); + + if (gSavedSettings.getBOOL("PathfindingXRayWireframe")) + { //draw hidden wireframe as darker and less opaque + gPathfindingProgram.uniform1f("ambiance", 1.f); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + } + else + { + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + gPathfindingProgram.uniform1f("ambiance", ambiance); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } + } + + { //draw visible wireframe as brighter, thicker and more opaque + glPolygonOffset(offset, offset); + gPathfindingProgram.uniform1f("ambiance", 1.f); + gPathfindingProgram.uniform1f("tint", 1.f); + gPathfindingProgram.uniform1f("alpha_scale", 1.f); + + glLineWidth(gSavedSettings.getF32("PathfindingLineWidth")); + LLGLDisable blendOut(GL_BLEND); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + gGL.flush(); + glLineWidth(1.f); + } + + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + } + } + } + + glPolygonOffset(0.f, 0.f); + + if ( pathfindingConsole->isRenderNavMesh() && pathfindingConsole->isRenderXRay() ) + { //render navmesh xray + F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance"); + + LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE); + LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); + + F32 offset = gSavedSettings.getF32("PathfindingLineOffset"); + glPolygonOffset(offset, -offset); + + LLGLEnable blend(GL_BLEND); + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); + gGL.flush(); + glLineWidth(2.0f); + LLGLEnable cull(GL_CULL_FACE); + + gPathfindingProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint")); + gPathfindingProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity")); + + if (gSavedSettings.getBOOL("PathfindingXRayWireframe")) + { //draw hidden wireframe as darker and less opaque + glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); + gPathfindingProgram.uniform1f("ambiance", 1.f); + llPathingLibInstance->renderNavMesh(); + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + } + else + { + gPathfindingProgram.uniform1f("ambiance", ambiance); + llPathingLibInstance->renderNavMesh(); + } + + //render edges + if (LLGLSLShader::sNoFixedFunction) + { + gPathfindingNoNormalsProgram.bind(); + gPathfindingNoNormalsProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint")); + gPathfindingNoNormalsProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity")); + llPathingLibInstance->renderNavMeshEdges(); + gPathfindingProgram.bind(); + } + else + { + llPathingLibInstance->renderNavMeshEdges(); + } + + gGL.flush(); + glLineWidth(1.0f); + } + + glPolygonOffset(0.f, 0.f); + + gGL.flush(); + if (LLGLSLShader::sNoFixedFunction) + { + gPathfindingProgram.unbind(); + } + } + } + } + } gGL.color4f(1,1,1,1); @@ -4352,9 +4687,7 @@ void LLPipeline::renderDebug() gGL.loadMatrix(gGLModelView); gGL.setColorMask(true, false); - bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); - if (!hud_only && !mDebugBlips.empty()) { //render debug blips if (LLGLSLShader::sNoFixedFunction) @@ -6248,6 +6581,10 @@ void LLPipeline::doResetVertexBuffers() gSky.resetVertexBuffers(); + if ( LLPathingLib::getInstance() ) + { + LLPathingLib::getInstance()->cleanupVBOManager(); + } LLVertexBuffer::cleanupClass(); //delete all name pool caches @@ -6693,7 +7030,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); - + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -6839,7 +7176,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) mFXAABuffer.bindTexture(0, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } - + gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft; gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom; gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth(); @@ -7491,7 +7828,7 @@ void LLPipeline::renderDeferredLighting() F32 s = volume->getLightRadius()*1.5f; LLColor3 col = volume->getLightColor(); - + if (col.magVecSquared() < 0.001f) { continue; @@ -7604,7 +7941,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredSpotLightProgram, drawablep); LLColor3 col = volume->getLightColor(); - + //vertex positions are encoded so the 3 bits of their vertex index //correspond to their axis facing, with bit position 3,2,1 matching //axis facing x,y,z, bit set meaning positive facing, bit clear @@ -7713,7 +8050,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); LLColor3 col = volume->getLightColor(); - + gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v); gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s); gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); @@ -8189,6 +8526,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gGL.setColorMask(true, false); renderGeom(camera); + } LLPipeline::sUnderWaterRender = FALSE; @@ -8850,7 +9188,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) da = powf(da, split_exp.mV[2]); F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da; - + for (U32 i = 0; i < 4; ++i) { F32 x = (F32)(i+1)/4.f; @@ -9837,3 +10175,143 @@ void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color) mDebugBlips.push_back(blip); } +void LLPipeline::hidePermanentObjects( std::vector<U32>& restoreList ) +{ + //This method is used to hide any vo's from the object list that may have + //the permanent flag set. + + U32 objCnt = gObjectList.getNumObjects(); + for (U32 i = 0; i < objCnt; ++i) + { + LLViewerObject* pObject = gObjectList.getObject(i); + if ( pObject && pObject->flagObjectPermanent() ) + { + LLDrawable *pDrawable = pObject->mDrawable; + + if ( pDrawable ) + { + restoreList.push_back( i ); + hideDrawable( pDrawable ); + } + } + } + + skipRenderingOfTerrain( true ); +} + +void LLPipeline::restorePermanentObjects( const std::vector<U32>& restoreList ) +{ + //This method is used to restore(unhide) any vo's from the object list that may have + //been hidden because their permanency flag was set. + + std::vector<U32>::const_iterator itCurrent = restoreList.begin(); + std::vector<U32>::const_iterator itEnd = restoreList.end(); + + U32 objCnt = gObjectList.getNumObjects(); + + while ( itCurrent != itEnd ) + { + U32 index = *itCurrent; + LLViewerObject* pObject = NULL; + if ( index < objCnt ) + { + pObject = gObjectList.getObject( index ); + } + if ( pObject ) + { + LLDrawable *pDrawable = pObject->mDrawable; + if ( pDrawable ) + { + pDrawable->clearState( LLDrawable::FORCE_INVISIBLE ); + unhideDrawable( pDrawable ); + } + } + ++itCurrent; + } + + skipRenderingOfTerrain( false ); +} + +void LLPipeline::skipRenderingOfTerrain( BOOL flag ) +{ + pool_set_t::iterator iter = mPools.begin(); + while ( iter != mPools.end() ) + { + LLDrawPool* pPool = *iter; + U32 poolType = pPool->getType(); + if ( hasRenderType( pPool->getType() ) && poolType == LLDrawPool::POOL_TERRAIN ) + { + pPool->setSkipRenderFlag( flag ); + } + ++iter; + } +} + +void LLPipeline::hideObject( const LLUUID& id ) +{ + LLViewerObject *pVO = gObjectList.findObject( id ); + + if ( pVO ) + { + LLDrawable *pDrawable = pVO->mDrawable; + + if ( pDrawable ) + { + hideDrawable( pDrawable ); + } + } +} + +void LLPipeline::hideDrawable( LLDrawable *pDrawable ) +{ + pDrawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //hide the children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++ ) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if ( drawable ) + { + drawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } +} +void LLPipeline::unhideDrawable( LLDrawable *pDrawable ) +{ + pDrawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //restore children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if ( drawable ) + { + drawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } +} +void LLPipeline::restoreHiddenObject( const LLUUID& id ) +{ + LLViewerObject *pVO = gObjectList.findObject( id ); + + if ( pVO ) + { + LLDrawable *pDrawable = pVO->mDrawable; + if ( pDrawable ) + { + unhideDrawable( pDrawable ); + } + } +} + + + + diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index b8b4f164fe..117b18be80 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -368,6 +368,12 @@ public: void addDebugBlip(const LLVector3& position, const LLColor4& color); + void hidePermanentObjects( std::vector<U32>& restoreList ); + void restorePermanentObjects( const std::vector<U32>& restoreList ); + void skipRenderingOfTerrain( BOOL flag ); + void hideObject( const LLUUID& id ); + void restoreHiddenObject( const LLUUID& id ); + private: void unloadShaders(); void addToQuickLookup( LLDrawPool* new_poolp ); @@ -375,7 +381,8 @@ private: BOOL updateDrawableGeom(LLDrawable* drawable, BOOL priority); void assertInitializedDoError(); bool assertInitialized() { const bool is_init = isInit(); if (!is_init) assertInitializedDoError(); return is_init; }; - + void hideDrawable( LLDrawable *pDrawable ); + void unhideDrawable( LLDrawable *pDrawable ); public: enum {GPU_CLASS_MAX = 3 }; diff --git a/indra/newview/res/lltoolpathfinding.cur b/indra/newview/res/lltoolpathfinding.cur Binary files differnew file mode 100644 index 0000000000..2df80de0a6 --- /dev/null +++ b/indra/newview/res/lltoolpathfinding.cur diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index a53dece422..686de0e7d5 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -122,6 +122,8 @@ TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" TOOLBUY CURSOR "toolbuy.cur" TOOLOPEN CURSOR "toolopen.cur" TOOLSIT CURSOR "toolsit.cur" +TOOLPATHFINDING CURSOR "lltoolpathfinding.cur" +TOOLNO CURSOR "llno.cur" ///////////////////////////////////////////////////////////////////////////// // diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index b616e2327b..9bf2922033 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -1,825 +1,861 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <colors> - <!-- Named Colors --> - <color - name="EmphasisColor" - value="0.38 0.694 0.573 1" /> - <color - name="EmphasisColor_13" - value="0.38 0.694 0.573 0.13" /> - <color - name="EmphasisColor_35" - value="0.38 0.694 0.573 0.35" /> - <color - name="White" - value="1 1 1 1" /> - <color - name="White_05" - value="1 1 1 0.05" /> - <color - name="White_10" - value="1 1 1 0.1" /> - <color - name="White_25" - value="1 1 1 0.25" /> - <color - name="White_50" - value="1 1 1 0.5" /> - <color - name="LtGray" - value="0.75 0.75 0.75 1" /> - <color - name="LtGray_35" - value="0.75 0.75 0.75 0.35" /> - <color - name="LtGray_50" - value="0.75 0.75 0.75 0.50" /> - <color - name="Gray" - value="0.5 0.5 0.5 1" /> - <color - name="DkGray" - value="0.125 0.125 0.125 1" /> - <color - name="DkGray_66" - value="0.125 0.125 0.125 .66" /> - <color - name="DkGray2" - value="0.169 0.169 0.169 1" /> - <color - name="MouseGray" - value="0.191 0.191 0.191 1" /> - <color - name="Black" - value="0 0 0 1" /> - <colork - name="Black_10" - value="0 0 0 0.1" /> - <color - name="Black_25" - value="0 0 0 0.25" /> - <color - name="Black_50" - value="0 0 0 0.5" /> - <color - name="FrogGreen" - value="0.26 0.345 0.263 1" /> - <color - name="Red" - value="1 0 0 1" /> - <color - name="Blue" - value="0 0 1 1" /> - <color - name="Yellow" - value="1 1 0 1" /> - <color - name="Green" - value="0 1 0 1" /> - <color - name="Transparent" - value="0 0 0 0" /> - <color - name="Purple" - value="1 0 1 1" /> - <color - name="Lime" - value=".8 1 .73 1" /> - <color - name="LtYellow" - value="1 1 .79 1" /> - <color - name="DrYellow" - value="1 0.86 0 1" /> - <color - name="LtOrange" - value="1 .85 .73 1" /> - <color - name="MdBlue" - value=".07 .38 .51 1" /> + <!-- Named Colors --> + <color + name="EmphasisColor" + value="0.38 0.694 0.573 1" /> + <color + name="EmphasisColor_13" + value="0.38 0.694 0.573 0.13" /> + <color + name="EmphasisColor_35" + value="0.38 0.694 0.573 0.35" /> + <color + name="White" + value="1 1 1 1" /> + <color + name="White_05" + value="1 1 1 0.05" /> + <color + name="White_10" + value="1 1 1 0.1" /> + <color + name="White_25" + value="1 1 1 0.25" /> + <color + name="White_50" + value="1 1 1 0.5" /> + <color + name="LtGray" + value="0.75 0.75 0.75 1" /> + <color + name="LtGray_35" + value="0.75 0.75 0.75 0.35" /> + <color + name="LtGray_50" + value="0.75 0.75 0.75 0.50" /> + <color + name="Gray" + value="0.5 0.5 0.5 1" /> + <color + name="DkGray" + value="0.125 0.125 0.125 1" /> + <color + name="DkGray_66" + value="0.125 0.125 0.125 .66" /> + <color + name="DkGray2" + value="0.169 0.169 0.169 1" /> + <color + name="MouseGray" + value="0.191 0.191 0.191 1" /> + <color + name="Black" + value="0 0 0 1" /> + <colork + name="Black_10" + value="0 0 0 0.1" /> + <color + name="Black_25" + value="0 0 0 0.25" /> + <color + name="Black_50" + value="0 0 0 0.5" /> + <color + name="FrogGreen" + value="0.26 0.345 0.263 1" /> + <color + name="Red" + value="1 0 0 1" /> + <color + name="Blue" + value="0 0 1 1" /> + <color + name="Yellow" + value="1 1 0 1" /> + <color + name="Green" + value="0 1 0 1" /> + <color + name="Transparent" + value="0 0 0 0" /> + <color + name="Purple" + value="1 0 1 1" /> + <color + name="Lime" + value=".8 1 .73 1" /> + <color + name="LtYellow" + value="1 1 .79 1" /> + <color + name="DrYellow" + value="1 0.86 0 1" /> + <color + name="LtOrange" + value="1 .85 .73 1" /> + <color + name="MdBlue" + value=".07 .38 .51 1" /> + <color + name="LtRed" + value="1 0.2 0.2 1" /> + <color + name="LtGreen" + value="0.2 1 0.2 1" /> + <color + name="Red_80" + value="1 0 0 0.8" /> + <color + name="Green_80" + value="0 1 0 0.8" /> + <color + name="Blue_80" + value="0 0 1 0.8" /> <!-- This color name makes potentially unused colors show up bright purple. - Leave this here until all Unused? are removed below, otherwise - the viewer generates many warnings on startup. --> + Leave this here until all Unused? are removed below, otherwise + the viewer generates many warnings on startup. --> <color - name="Unused?" - value=".831 1 0 1" /> + name="Unused?" + value=".831 1 0 1" /> <!-- UI Definitions --> - <color - name="AccordionHeaderTextColor" - reference="LtGray" /> - <color - name="AgentChatColor" - reference="White" /> - <color - name="AlertBoxColor" - value="0.24 0.24 0.24 1" /> - <color - name="AlertCautionBoxColor" - value="1 0.82 0.46 1" /> - <color - name="AlertCautionTextColor" - reference="LtYellow" /> - <color - name="AvatarListItemIconDefaultColor" - reference="White" /> - <color - name="AvatarListItemIconOnlineColor" - reference="White" /> - <color - name="AvatarListItemIconOfflineColor" - value="0.5 0.5 0.5 0.5" /> - <color - name="AvatarListItemIconVoiceInvitedColor" - reference="AvatarListItemIconOfflineColor" /> - <color - name="AvatarListItemIconVoiceJoinedColor" - reference="AvatarListItemIconOnlineColor" /> - <color - name="AvatarListItemIconVoiceLeftColor" - reference="AvatarListItemIconOfflineColor" /> - <color - name="BadgeImageColor" - value="1.0 0.40 0.0 1.0" /> - <color - name="BadgeBorderColor" - value="0.9 0.9 0.9 1.0" /> - <color - name="BadgeLabelColor" - reference="White" /> - <color - name="ButtonBorderColor" - reference="Unused?" /> - <color - name="ButtonCautionImageColor" - reference="Unused?" /> - <color - name="ButtonColor" - reference="Unused?" /> - <color - name="ButtonFlashBgColor" - reference="Unused?" /> - <color - name="ButtonImageColor" - reference="White" /> - <color - name="ButtonLabelColor" - reference="LtGray" /> - <color - name="ButtonLabelDisabledColor" - reference="White_25" /> - <color - name="ButtonLabelSelectedColor" - reference="White" /> - <color - name="ButtonLabelSelectedDisabledColor" - reference="White_25" /> - <color - name="ButtonSelectedBgColor" - reference="Unused?" /> - <color - name="ButtonSelectedColor" - reference="Unused?" /> - <color - name="ButtonUnselectedBgColor" - reference="Unused?" /> - <color - name="ButtonUnselectedFgColor" - reference="Unused?" /> - <color - name="ChatHistoryBgColor" - reference="Transparent" /> - <color - name="ChatHistoryTextColor" - reference="LtGray" /> - <color - name="ChicletFlashColor" - value="0.114 0.65 0.1" /> - <color - name="ColorDropShadow" - reference="Black_50" /> - <color - name="ColorPaletteEntry01" - reference="Black" /> - <color - name="ColorPaletteEntry02" - reference="Gray" /> - <color - name="ColorPaletteEntry03" - value="0.5 0 0 1" /> - <color - name="ColorPaletteEntry04" - value="0.5 0.5 0 1" /> - <color - name="ColorPaletteEntry05" - value="0 0.5 0 1" /> - <color - name="ColorPaletteEntry06" - value="0 0.5 0.5 1" /> - <color - name="ColorPaletteEntry07" - value="0 0 0.5 1" /> - <color - name="ColorPaletteEntry08" - value="0.5 0 0.5 1" /> - <color - name="ColorPaletteEntry09" - value="0.5 0.5 0 1" /> - <color - name="ColorPaletteEntry10" - value="0 0.25 0.25 1" /> - <color - name="ColorPaletteEntry11" - value="0 0.5 1 1" /> - <color - name="ColorPaletteEntry12" - value="0 0.25 0.5 1" /> - <color - name="ColorPaletteEntry13" - value="0.5 0 1 1" /> - <color - name="ColorPaletteEntry14" - value="0.5 0.25 0 1" /> - <color - name="ColorPaletteEntry15" - reference="White" /> - <color - name="ColorPaletteEntry16" - reference="LtYellow" /> - <color - name="ColorPaletteEntry17" - reference="White" /> - <color - name="ColorPaletteEntry18" - reference="LtGray" /> - <color - name="ColorPaletteEntry19" - reference="Red" /> - <color - name="ColorPaletteEntry20" - reference="Yellow" /> - <color - name="ColorPaletteEntry21" - reference="Green" /> - <color - name="ColorPaletteEntry22" - value="0 1 1 1" /> - <color - name="ColorPaletteEntry23" - reference="Blue" /> - <color - name="ColorPaletteEntry24" - reference="Purple" /> - <color - name="ColorPaletteEntry25" - value="1 1 0.5 1" /> - <color - name="ColorPaletteEntry26" - value="0 1 0.5 1" /> - <color - name="ColorPaletteEntry27" - value="0.5 1 1 1" /> - <color - name="ColorPaletteEntry28" - value="0.5 0.5 1 1" /> - <color - name="ColorPaletteEntry29" - value="1 0 0.5 1" /> - <color - name="ColorPaletteEntry30" - value="1 0.5 0 1" /> - <color - name="ColorPaletteEntry31" - reference="White" /> - <color - name="ColorPaletteEntry32" - reference="White" /> - <color - name="ComboListBgColor" - reference="DkGray" /> - <color - name="ConsoleBackground" - reference="Black" /> - <color - name="ContextSilhouetteColor" - reference="EmphasisColor" /> - <color - name="DefaultHighlightDark" - reference="White_10" /> - <color - name="DefaultHighlightLight" - reference="White_25" /> - <color - name="DefaultShadowDark" - reference="Black_50" /> - <color - name="DefaultShadowLight" - reference="Black_50" /> - <color - name="EffectColor" - reference="White" /> - <color - name="FilterBackgroundColor" - reference="Black" /> - <color - name="FilterTextColor" - value="0.38 0.69 0.57 1" /> - <color - name="FloaterButtonImageColor" - reference="LtGray" /> - <color - name="FloaterDefaultBackgroundColor" - reference="DkGray_66" /> - <color - name="FloaterFocusBackgroundColor" - reference="DkGray2" /> - <color - name="FloaterFocusBorderColor" - reference="Black_50" /> - <color - name="FloaterUnfocusBorderColor" - reference="Black_50" /> - <color - name="FocusColor" - reference="EmphasisColor" /> - <color - name="FolderViewLoadingMessageTextColor" - value="0.3344 0.5456 0.5159 1" /> - <color - name="GridFocusPointColor" - reference="White_50" /> - <color - name="GridlineBGColor" - value="0.92 0.92 1 0.78" /> - <color - name="GridlineColor" - reference="White" /> - <color - name="GridlineShadowColor" - value="0 0 0 0.31" /> - <color - name="GroupNotifyBoxColor" - value="0.3344 0.5456 0.5159 1" /> - <color - name="GroupNotifyTextColor" - reference="White"/> - <color - name="GroupNotifyDimmedTextColor" - reference="LtGray" /> - <color - name="GroupOverTierColor" - value="0.43 0.06 0.06 1" /> - <color - name="HTMLLinkColor" - reference="EmphasisColor" /> - <color - name="HealthTextColor" - reference="White" /> - <color - name="HelpBgColor" - reference="Unused?" /> - <color - name="HelpFgColor" - reference="Unused?" /> - <color - name="HelpScrollHighlightColor" - reference="Unused?" /> - <color - name="HelpScrollShadowColor" - reference="Unused?" /> - <color - name="HelpScrollThumbColor" - reference="Unused?" /> - <color - name="HelpScrollTrackColor" - reference="Unused?" /> - <color - name="HighlightChildColor" - reference="Yellow" /> - <color - name="HighlightInspectColor" - value="1 0 1 1" /> - <color - name="HighlightParentColor" - value="0.67 0.83 0.96 1" /> - <color - name="IMHistoryBgColor" - reference="Unused?" /> - <color - name="IMHistoryTextColor" - reference="Unused?" /> - <color - name="IconDisabledColor" - reference="White_25" /> - <color - name="IconEnabledColor" - reference="White" /> - <color - name="InventoryBackgroundColor" - reference="DkGray2" /> - <color - name="InventoryFocusOutlineColor" - reference="White_25" /> - <color - name="InventoryItemSuffixColor" - reference="White_25" /> - <color - name="InventoryItemLibraryColor" - reference="EmphasisColor" /> - <color - name="InventoryItemLinkColor" - reference="LtGray_50" /> - <color - name="InventoryMouseOverColor" - reference="LtGray_35" /> - <color - name="InventorySearchStatusColor" - reference="EmphasisColor" /> - <color - name="LabelDisabledColor" - reference="White_25" /> - <color - name="LabelSelectedColor" - reference="White" /> - <color - name="LabelSelectedDisabledColor" - reference="White_25" /> - <color - name="LabelTextColor" - reference="LtGray" /> - <color - name="LoginProgressBarBgColor" - reference="Unused?" /> - <color - name="LoginProgressBarFgColor" - reference="Unused?" /> - <color - name="LoginProgressBoxBorderColor" - value="0 0.12 0.24 0" /> - <color - name="LoginProgressBoxCenterColor" - value="0 0 0 0.78" /> - <color - name="LoginProgressBoxShadowColor" - value="0 0 0 0.78" /> - <color - name="LoginProgressBoxTextColor" - reference="White" /> - <color - name="MapAvatarColor" - reference="Green" /> - <color - name="MapAvatarFriendColor" - reference="Yellow" /> - <color - name="MapAvatarSelfColor" - value="0.53125 0 0.498047 1" /> - <color - name="MapFrustumColor" - reference="White_10" /> - <color - name="MapFrustumRotatingColor" - value="1 1 1 0.2" /> - <color - name="MapTrackColor" - reference="Red" /> - <color - name="MapTrackDisabledColor" - value="0.5 0 0 1" /> - <color - name="MenuBarBgColor" - reference="DkGray" /> - <color - name="MenuBarGodBgColor" - reference="FrogGreen" /> - <color - name="MenuDefaultBgColor" - reference="DkGray2" /> - <color - name="MenuItemDisabledColor" - reference="LtGray_50" /> - <color - name="MenuItemEnabledColor" - reference="LtGray" /> - <color - name="MenuItemHighlightBgColor" - reference="EmphasisColor_35" /> - <color - name="MenuItemHighlightFgColor" - reference="White" /> - <color - name="MenuNonProductionBgColor" - reference="Black" /> - <color - name="MenuNonProductionGodBgColor" - value="0.263 0.325 0.345 1" /> - <color - name="MenuPopupBgColor" - reference="DkGray2" /> - <color - name="ModelUploaderLabels" - value="1 0.6 0 1" /> - <color - name="MultiSliderDisabledThumbColor" - reference="Black" /> - <color - name="MultiSliderThumbCenterColor" - reference="White" /> - <color - name="MultiSliderThumbCenterSelectedColor" - reference="Green" /> - <color - name="MultiSliderThumbOutlineColor" - reference="Unused?" /> - <color - name="MultiSliderTrackColor" - reference="LtGray" /> - <color - name="MultiSliderTriangleColor" - reference="Yellow" /> + <color + name="AccordionHeaderTextColor" + reference="LtGray" /> + <color + name="AgentChatColor" + reference="White" /> + <color + name="AlertBoxColor" + value="0.24 0.24 0.24 1" /> + <color + name="AlertCautionBoxColor" + value="1 0.82 0.46 1" /> + <color + name="AlertCautionTextColor" + reference="LtYellow" /> + <color + name="AvatarListItemIconDefaultColor" + reference="White" /> + <color + name="AvatarListItemIconOnlineColor" + reference="White" /> + <color + name="AvatarListItemIconOfflineColor" + value="0.5 0.5 0.5 0.5" /> + <color + name="AvatarListItemIconVoiceInvitedColor" + reference="AvatarListItemIconOfflineColor" /> + <color + name="AvatarListItemIconVoiceJoinedColor" + reference="AvatarListItemIconOnlineColor" /> + <color + name="AvatarListItemIconVoiceLeftColor" + reference="AvatarListItemIconOfflineColor" /> + <color + name="BadgeImageColor" + value="1.0 0.40 0.0 1.0" /> + <color + name="BadgeBorderColor" + value="0.9 0.9 0.9 1.0" /> + <color + name="BadgeLabelColor" + reference="White" /> + <color + name="ButtonBorderColor" + reference="Unused?" /> + <color + name="ButtonCautionImageColor" + reference="Unused?" /> + <color + name="ButtonColor" + reference="Unused?" /> + <color + name="ButtonFlashBgColor" + reference="Unused?" /> + <color + name="ButtonImageColor" + reference="White" /> + <color + name="ButtonLabelColor" + reference="LtGray" /> + <color + name="ButtonLabelDisabledColor" + reference="White_25" /> + <color + name="ButtonLabelSelectedColor" + reference="White" /> + <color + name="ButtonLabelSelectedDisabledColor" + reference="White_25" /> + <color + name="ButtonSelectedBgColor" + reference="Unused?" /> + <color + name="ButtonSelectedColor" + reference="Unused?" /> + <color + name="ButtonUnselectedBgColor" + reference="Unused?" /> + <color + name="ButtonUnselectedFgColor" + reference="Unused?" /> + <color + name="ChatHistoryBgColor" + reference="Transparent" /> + <color + name="ChatHistoryTextColor" + reference="LtGray" /> + <color + name="ChicletFlashColor" + value="0.114 0.65 0.1" /> + <color + name="ColorDropShadow" + reference="Black_50" /> + <color + name="ColorPaletteEntry01" + reference="Black" /> + <color + name="ColorPaletteEntry02" + reference="Gray" /> + <color + name="ColorPaletteEntry03" + value="0.5 0 0 1" /> + <color + name="ColorPaletteEntry04" + value="0.5 0.5 0 1" /> + <color + name="ColorPaletteEntry05" + value="0 0.5 0 1" /> + <color + name="ColorPaletteEntry06" + value="0 0.5 0.5 1" /> + <color + name="ColorPaletteEntry07" + value="0 0 0.5 1" /> + <color + name="ColorPaletteEntry08" + value="0.5 0 0.5 1" /> + <color + name="ColorPaletteEntry09" + value="0.5 0.5 0 1" /> + <color + name="ColorPaletteEntry10" + value="0 0.25 0.25 1" /> + <color + name="ColorPaletteEntry11" + value="0 0.5 1 1" /> + <color + name="ColorPaletteEntry12" + value="0 0.25 0.5 1" /> + <color + name="ColorPaletteEntry13" + value="0.5 0 1 1" /> + <color + name="ColorPaletteEntry14" + value="0.5 0.25 0 1" /> + <color + name="ColorPaletteEntry15" + reference="White" /> + <color + name="ColorPaletteEntry16" + reference="LtYellow" /> + <color + name="ColorPaletteEntry17" + reference="White" /> + <color + name="ColorPaletteEntry18" + reference="LtGray" /> + <color + name="ColorPaletteEntry19" + reference="Red" /> + <color + name="ColorPaletteEntry20" + reference="Yellow" /> + <color + name="ColorPaletteEntry21" + reference="Green" /> + <color + name="ColorPaletteEntry22" + value="0 1 1 1" /> + <color + name="ColorPaletteEntry23" + reference="Blue" /> + <color + name="ColorPaletteEntry24" + reference="Purple" /> + <color + name="ColorPaletteEntry25" + value="1 1 0.5 1" /> + <color + name="ColorPaletteEntry26" + value="0 1 0.5 1" /> + <color + name="ColorPaletteEntry27" + value="0.5 1 1 1" /> + <color + name="ColorPaletteEntry28" + value="0.5 0.5 1 1" /> + <color + name="ColorPaletteEntry29" + value="1 0 0.5 1" /> + <color + name="ColorPaletteEntry30" + value="1 0.5 0 1" /> + <color + name="ColorPaletteEntry31" + reference="White" /> + <color + name="ColorPaletteEntry32" + reference="White" /> + <color + name="ComboListBgColor" + reference="DkGray" /> + <color + name="ConsoleBackground" + reference="Black" /> + <color + name="ContextSilhouetteColor" + reference="EmphasisColor" /> + <color + name="DefaultHighlightDark" + reference="White_10" /> + <color + name="DefaultHighlightLight" + reference="White_25" /> + <color + name="DefaultShadowDark" + reference="Black_50" /> + <color + name="DefaultShadowLight" + reference="Black_50" /> + <color + name="EffectColor" + reference="White" /> + <color + name="FilterBackgroundColor" + reference="Black" /> + <color + name="FilterTextColor" + value="0.38 0.69 0.57 1" /> + <color + name="FloaterButtonImageColor" + reference="LtGray" /> + <color + name="FloaterDefaultBackgroundColor" + reference="DkGray_66" /> + <color + name="FloaterFocusBackgroundColor" + reference="DkGray2" /> + <color + name="FloaterFocusBorderColor" + reference="Black_50" /> + <color + name="FloaterUnfocusBorderColor" + reference="Black_50" /> + <color + name="FocusColor" + reference="EmphasisColor" /> + <color + name="FolderViewLoadingMessageTextColor" + value="0.3344 0.5456 0.5159 1" /> + <color + name="GridFocusPointColor" + reference="White_50" /> + <color + name="GridlineBGColor" + value="0.92 0.92 1 0.78" /> + <color + name="GridlineColor" + reference="White" /> + <color + name="GridlineShadowColor" + value="0 0 0 0.31" /> + <color + name="GroupNotifyBoxColor" + value="0.3344 0.5456 0.5159 1" /> + <color + name="GroupNotifyTextColor" + reference="White"/> + <color + name="GroupNotifyDimmedTextColor" + reference="LtGray" /> + <color + name="GroupOverTierColor" + value="0.43 0.06 0.06 1" /> + <color + name="HTMLLinkColor" + reference="EmphasisColor" /> + <color + name="HealthTextColor" + reference="White" /> + <color + name="HelpBgColor" + reference="Unused?" /> + <color + name="HelpFgColor" + reference="Unused?" /> + <color + name="HelpScrollHighlightColor" + reference="Unused?" /> + <color + name="HelpScrollShadowColor" + reference="Unused?" /> + <color + name="HelpScrollThumbColor" + reference="Unused?" /> + <color + name="HelpScrollTrackColor" + reference="Unused?" /> + <color + name="HighlightChildColor" + reference="Yellow" /> + <color + name="HighlightInspectColor" + value="1 0 1 1" /> + <color + name="HighlightParentColor" + value="0.67 0.83 0.96 1" /> + <color + name="IMHistoryBgColor" + reference="Unused?" /> + <color + name="IMHistoryTextColor" + reference="Unused?" /> + <color + name="IconDisabledColor" + reference="White_25" /> + <color + name="IconEnabledColor" + reference="White" /> + <color + name="InventoryBackgroundColor" + reference="DkGray2" /> + <color + name="InventoryFocusOutlineColor" + reference="White_25" /> + <color + name="InventoryItemSuffixColor" + reference="White_25" /> + <color + name="InventoryItemLibraryColor" + reference="EmphasisColor" /> + <color + name="InventoryItemLinkColor" + reference="LtGray_50" /> + <color + name="InventoryMouseOverColor" + reference="LtGray_35" /> + <color + name="InventorySearchStatusColor" + reference="EmphasisColor" /> + <color + name="LabelDisabledColor" + reference="White_25" /> + <color + name="LabelSelectedColor" + reference="White" /> + <color + name="LabelSelectedDisabledColor" + reference="White_25" /> + <color + name="LabelTextColor" + reference="LtGray" /> + <color + name="LoginProgressBarBgColor" + reference="Unused?" /> + <color + name="LoginProgressBarFgColor" + reference="Unused?" /> + <color + name="LoginProgressBoxBorderColor" + value="0 0.12 0.24 0" /> + <color + name="LoginProgressBoxCenterColor" + value="0 0 0 0.78" /> + <color + name="LoginProgressBoxShadowColor" + value="0 0 0 0.78" /> + <color + name="LoginProgressBoxTextColor" + reference="White" /> + <color + name="MapAvatarColor" + reference="Green" /> + <color + name="MapAvatarFriendColor" + reference="Yellow" /> + <color + name="MapAvatarSelfColor" + value="0.53125 0 0.498047 1" /> + <color + name="MapFrustumColor" + reference="White_10" /> + <color + name="MapFrustumRotatingColor" + value="1 1 1 0.2" /> + <color + name="MapTrackColor" + reference="Red" /> + <color + name="MapTrackDisabledColor" + value="0.5 0 0 1" /> + <color + name="MenuBarBgColor" + reference="DkGray" /> + <color + name="MenuBarGodBgColor" + reference="FrogGreen" /> + <color + name="MenuDefaultBgColor" + reference="DkGray2" /> + <color + name="MenuItemDisabledColor" + reference="LtGray_50" /> + <color + name="MenuItemEnabledColor" + reference="LtGray" /> + <color + name="MenuItemHighlightBgColor" + reference="EmphasisColor_35" /> + <color + name="MenuItemHighlightFgColor" + reference="White" /> + <color + name="MenuNonProductionBgColor" + reference="Black" /> + <color + name="MenuNonProductionGodBgColor" + value="0.263 0.325 0.345 1" /> + <color + name="MenuPopupBgColor" + reference="DkGray2" /> + <color + name="ModelUploaderLabels" + value="1 0.6 0 1" /> + <color + name="MultiSliderDisabledThumbColor" + reference="Black" /> + <color + name="MultiSliderThumbCenterColor" + reference="White" /> + <color + name="MultiSliderThumbCenterSelectedColor" + reference="Green" /> + <color + name="MultiSliderThumbOutlineColor" + reference="Unused?" /> + <color + name="MultiSliderTrackColor" + reference="LtGray" /> + <color + name="MultiSliderTriangleColor" + reference="Yellow" /> <!-- - <color + <color name="NameTagBackground" value="0.85 0.85 0.85 0.80" /> - --> - <color + --> + <color name="NameTagBackground" value="0 0 0 1" /> - <color - name="NameTagChat" - reference="White" /> - <color - name="NameTagFriend" - value="0.447 0.784 0.663 1" /> - <color - name="NameTagLegacy" - reference="White" /> - <color - name="NameTagMatch" - reference="White" /> - <color - name="NameTagMismatch" - reference="White" /> - <color - name="NetMapBackgroundColor" - value="0 0 0 1" /> - <color - name="NetMapGroupOwnAboveWater" - reference="Purple" /> - <color - name="NetMapGroupOwnBelowWater" - value="0.78 0 0.78 1" /> - <color - name="NetMapOtherOwnAboveWater" - value="0.24 0.24 0.24 1" /> - <color - name="NetMapOtherOwnBelowWater" - value="0.12 0.12 0.12 1" /> - <color - name="NetMapYouOwnAboveWater" - value="0 1 1 1" /> - <color - name="NetMapYouOwnBelowWater" - value="0 0.78 0.78 1" /> - <color - name="NotifyBoxColor" - value="LtGray" /> - <color - name="NotifyCautionBoxColor" - value="1 0.82 0.46 1" /> - <color - name="NotifyCautionWarnColor" - reference="White" /> - <color - name="NotifyTextColor" - reference="White" /> - <color - name="ObjectBubbleColor" - reference="DkGray_66" /> - <color - name="ObjectChatColor" - reference="EmphasisColor" /> - <color - name="OverdrivenColor" - reference="Red" /> - <color - name="PanelDefaultBackgroundColor" - reference="DkGray" /> - <color - name="PanelDefaultHighlightLight" - reference="White_50" /> - <color - name="PanelFocusBackgroundColor" - reference="DkGray2" /> - <color - name="PanelNotificationBackground" - value="1 0.3 0.3 0" /> - <color - name="ParcelHoverColor" - reference="White" /> - <color - name="PieMenuBgColor" - value="0.24 0.24 0.24 0.59" /> - <color - name="PieMenuLineColor" - value="0 0 0 0.5" /> - <color - name="PieMenuSelectedColor" - value="0.72 0.72 0.74 0.3" /> - <color - name="PropertyColorAuction" - value="0.5 0 1 0.4" /> - <color - name="PropertyColorAvail" - reference="Transparent" /> - <color - name="PropertyColorForSale" - value="1 0.5 0 0.4" /> - <color - name="PropertyColorGroup" - value="0 0.72 0.72 0.4" /> - <color - name="PropertyColorOther" - value="1 0 0 0.4" /> - <color - name="PropertyColorSelf" - value="0 1 0 0.4" /> - <color - name="ScriptBgReadOnlyColor" - value="0.39 0.39 0.39 1" /> - <color - name="ScriptErrorColor" - reference="Red" /> - <color - name="ScrollBGStripeColor" - reference="Transparent" /> - <color - name="ScrollBgReadOnlyColor" + <color + name="NameTagChat" + reference="White" /> + <color + name="NameTagFriend" + value="0.447 0.784 0.663 1" /> + <color + name="NameTagLegacy" + reference="White" /> + <color + name="NameTagMatch" + reference="White" /> + <color + name="NameTagMismatch" + reference="White" /> + <color + name="NetMapBackgroundColor" + value="0 0 0 1" /> + <color + name="NetMapGroupOwnAboveWater" + reference="Purple" /> + <color + name="NetMapGroupOwnBelowWater" + value="0.78 0 0.78 1" /> + <color + name="NetMapOtherOwnAboveWater" + value="0.24 0.24 0.24 1" /> + <color + name="NetMapOtherOwnBelowWater" + value="0.12 0.12 0.12 1" /> + <color + name="NetMapYouOwnAboveWater" + value="0 1 1 1" /> + <color + name="NetMapYouOwnBelowWater" + value="0 0.78 0.78 1" /> + <color + name="NotifyBoxColor" + value="LtGray" /> + <color + name="NotifyCautionBoxColor" + value="1 0.82 0.46 1" /> + <color + name="NotifyCautionWarnColor" + reference="White" /> + <color + name="NotifyTextColor" + reference="White" /> + <color + name="ObjectBubbleColor" + reference="DkGray_66" /> + <color + name="ObjectChatColor" + reference="EmphasisColor" /> + <color + name="OverdrivenColor" + reference="Red" /> + <color + name="PanelDefaultBackgroundColor" + reference="DkGray" /> + <color + name="PanelDefaultHighlightLight" + reference="White_50" /> + <color + name="PanelFocusBackgroundColor" + reference="DkGray2" /> + <color + name="PanelNotificationBackground" + value="1 0.3 0.3 0" /> + <color + name="ParcelHoverColor" + reference="White" /> + <color + name="PathfindingErrorColor" + reference="LtRed" /> + <color + name="PathfindingWarningColor" + reference="DrYellow" /> + <color + name="PathfindingGoodColor" + reference="LtGreen" /> + <color + name="PathfindingDefaultBeaconColor" + reference="Red_80" /> + <color + name="PathfindingDefaultBeaconTextColor" + reference="White" /> + <color + name="PathfindingLinksetBeaconColor" + reference="Blue_80" /> + <color + name="PathfindingCharacterBeaconColor" + reference="Red_80" /> + <color + name="PieMenuBgColor" + value="0.24 0.24 0.24 0.59" /> + <color + name="PieMenuLineColor" + value="0 0 0 0.5" /> + <color + name="PieMenuSelectedColor" + value="0.72 0.72 0.74 0.3" /> + <color + name="PropertyColorAuction" + value="0.5 0 1 0.4" /> + <color + name="PropertyColorAvail" reference="Transparent" /> - <color - name="ScrollBgWriteableColor" - reference="White_05" /> - <color - name="ScrollDisabledColor" - reference="White_25" /> - <color - name="ScrollHighlightedColor" - reference="Unused?" /> - <color - name="ScrollHoveredColor" - reference="EmphasisColor_13" /> - <color - name="ScrollSelectedBGColor" - reference="EmphasisColor_35" /> - <color - name="ScrollSelectedFGColor" - reference="White" /> - <color - name="ScrollUnselectedColor" - reference="LtGray" /> - <color - name="ScrollbarThumbColor" - reference="White" /> - <color - name="ScrollbarTrackColor" - reference="Black" /> - <color - name="SelectedOutfitTextColor" - reference="EmphasisColor" /> - <color - name="SilhouetteChildColor" - value="0.13 0.42 0.77 1" /> - <color - name="SilhouetteParentColor" - reference="Yellow" /> - <color - name="SliderDisabledThumbColor" - reference="White_25" /> - <color - name="SliderThumbCenterColor" - reference="White" /> - <color - name="SliderThumbOutlineColor" - reference="White" /> - <color - name="SliderTrackColor" - reference="Unused?" /> - <color - name="SpeakingColor" - reference="FrogGreen" /> - <color - name="SystemChatColor" - reference="LtGray" /> - <color - name="TextBgFocusColor" - reference="White" /> - <color - name="TextBgReadOnlyColor" - reference="White_05" /> - <color - name="TextBgWriteableColor" - reference="LtGray" /> - <color - name="TextCursorColor" - reference="Black" /> - <color - name="TextDefaultColor" - reference="Black" /> - <color - name="TextEmbeddedItemColor" - value="0 0 0.5 1" /> - <color - name="TextEmbeddedItemReadOnlyColor" - reference="Unused?" /> - <color - name="TextFgColor" - value="0.102 0.102 0.102 1" /> - <color - name="TextFgReadOnlyColor" - reference="LtGray" /> - <color - name="TextFgTentativeColor" - value="0.4 0.4 0.4 1" /> - <color - name="TimeTextColor" - reference="LtGray" /> - <color - name="TitleBarFocusColor" - reference="White_10" /> - <color - name="ToastBackground" - value="0.3 0.3 0.3 0" /> - <color - name="ToolTipBgColor" - value="0.937 0.89 0.655 1" /> - <color - name="ToolTipBorderColor" - value="0.812 0.753 0.451 1" /> - <color - name="ToolTipTextColor" - reference="DkGray2" /> - <color - name="InspectorTipTextColor" - reference="LtGray" /> - <color - name="UserChatColor" - reference="White" /> - <color - name="llOwnerSayChatColor" - reference="LtYellow" /> + <color + name="PropertyColorForSale" + value="1 0.5 0 0.4" /> + <color + name="PropertyColorGroup" + value="0 0.72 0.72 0.4" /> + <color + name="PropertyColorOther" + value="1 0 0 0.4" /> + <color + name="PropertyColorSelf" + value="0 1 0 0.4" /> + <color + name="ScriptBgReadOnlyColor" + value="0.39 0.39 0.39 1" /> + <color + name="ScriptErrorColor" + reference="Red" /> + <color + name="ScrollBGStripeColor" + reference="Transparent" /> + <color + name="ScrollBgReadOnlyColor" + reference="Transparent" /> + <color + name="ScrollBgWriteableColor" + reference="White_05" /> + <color + name="ScrollDisabledColor" + reference="White_25" /> + <color + name="ScrollHighlightedColor" + reference="Unused?" /> + <color + name="ScrollHoveredColor" + reference="EmphasisColor_13" /> + <color + name="ScrollSelectedBGColor" + reference="EmphasisColor_35" /> + <color + name="ScrollSelectedFGColor" + reference="White" /> + <color + name="ScrollUnselectedColor" + reference="LtGray" /> + <color + name="ScrollbarThumbColor" + reference="White" /> + <color + name="ScrollbarTrackColor" + reference="Black" /> + <color + name="SelectedOutfitTextColor" + reference="EmphasisColor" /> + <color + name="SilhouetteChildColor" + value="0.13 0.42 0.77 1" /> + <color + name="SilhouetteParentColor" + reference="Yellow" /> + <color + name="SliderDisabledThumbColor" + reference="White_25" /> + <color + name="SliderThumbCenterColor" + reference="White" /> + <color + name="SliderThumbOutlineColor" + reference="White" /> + <color + name="SliderTrackColor" + reference="Unused?" /> + <color + name="SpeakingColor" + reference="FrogGreen" /> + <color + name="SystemChatColor" + reference="LtGray" /> + <color + name="TextBgFocusColor" + reference="White" /> + <color + name="TextBgReadOnlyColor" + reference="White_05" /> + <color + name="TextBgWriteableColor" + reference="LtGray" /> + <color + name="TextCursorColor" + reference="Black" /> + <color + name="TextDefaultColor" + reference="Black" /> + <color + name="TextEmbeddedItemColor" + value="0 0 0.5 1" /> + <color + name="TextEmbeddedItemReadOnlyColor" + reference="Unused?" /> + <color + name="TextFgColor" + value="0.102 0.102 0.102 1" /> + <color + name="TextFgReadOnlyColor" + reference="LtGray" /> + <color + name="TextFgTentativeColor" + value="0.4 0.4 0.4 1" /> + <color + name="TimeTextColor" + reference="LtGray" /> + <color + name="TitleBarFocusColor" + reference="White_10" /> + <color + name="ToastBackground" + value="0.3 0.3 0.3 0" /> + <color + name="ToolTipBgColor" + value="0.937 0.89 0.655 1" /> + <color + name="ToolTipBorderColor" + value="0.812 0.753 0.451 1" /> + <color + name="ToolTipTextColor" + reference="DkGray2" /> + <color + name="InspectorTipTextColor" + reference="LtGray" /> + <color + name="UserChatColor" + reference="White" /> + <color + name="llOwnerSayChatColor" + reference="LtYellow" /> - <!-- New Colors --> - <color - name="OutputMonitorMutedColor" - reference="DkGray2" /> - <color - name="SysWellItemUnselected" - value="0 0 0 0" /> - <color - name="SysWellItemSelected" - value="0.3 0.3 0.3 1.0" /> - <color - name="ColorSwatchBorderColor" - value="0.45098 0.517647 0.607843 1"/> - <color - name="ChatTimestampColor" - reference="White" /> - <color - name="MenuBarProjectBgColor" - reference="MdBlue" /> + <!-- New Colors --> + <color + name="OutputMonitorMutedColor" + reference="DkGray2" /> + <color + name="SysWellItemUnselected" + value="0 0 0 0" /> + <color + name="SysWellItemSelected" + value="0.3 0.3 0.3 1.0" /> + <color + name="ColorSwatchBorderColor" + value="0.45098 0.517647 0.607843 1"/> + <color + name="ChatTimestampColor" + reference="White" /> + <color + name="MenuBarProjectBgColor" + reference="MdBlue" /> - <color + <color name="MeshImportTableNormalColor" value="1 1 1 1"/> - <color + <color name="MeshImportTableHighlightColor" value="0.2 0.8 1 1"/> - <color - name="DirectChatColor" - reference="LtOrange" /> + <color + name="DirectChatColor" + reference="LtOrange" /> - <color + <color name="ToolbarDropZoneColor" value=".48 .69 1 .5" /> - <!-- Generic color names (legacy) --> + <!-- Generic color names (legacy) --> <color - name="white" - value="1 1 1 1"/> + name="white" + value="1 1 1 1"/> <color - name="black" - value="0 0 0 1"/> + name="black" + value="0 0 0 1"/> <color - name="red" - value="1 0 0 1"/> + name="red" + value="1 0 0 1"/> <color - name="green" - value="0 1 0 1"/> + name="green" + value="0 1 0 1"/> <color - name="blue" - value="0 0 1 1"/> + name="blue" + value="0 0 1 1"/> </colors> diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index eabcc68916..d5d58235a4 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -140,7 +140,11 @@ with the same filename but different name <texture name="Command_MiniMap_Icon" file_name="toolbar_icons/mini_map.png" preload="true" /> <texture name="Command_Move_Icon" file_name="toolbar_icons/move.png" preload="true" /> <texture name="Command_Outbox_Icon" file_name="toolbar_icons/outbox.png" preload="true" /> + <texture name="Command_Pathfinding_Icon" file_name="toolbar_icons/land.png" preload="true" /> <texture name="Command_People_Icon" file_name="toolbar_icons/people.png" preload="true" /> + <texture name="Command_PF_Basic_Icon" file_name="toolbar_icons/land.png" preload="true" /> + <texture name="Command_PF_Characters_Icon" file_name="toolbar_icons/land.png" preload="true" /> + <texture name="Command_PF_Linksets_Icon" file_name="toolbar_icons/land.png" preload="true" /> <texture name="Command_Picks_Icon" file_name="toolbar_icons/picks.png" preload="true" /> <texture name="Command_Places_Icon" file_name="toolbar_icons/places.png" preload="true" /> <texture name="Command_Preferences_Icon" file_name="toolbar_icons/preferences.png" preload="true" /> diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml new file mode 100644 index 0000000000..7af40bbff6 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + open_positioning="cascading" + can_tear_off="false" + height="213" + layout="topleft" + name="floater_pathfinding_basic" + help_topic="floater_pathfinding_basic" + reuse_instance="false" + save_rect="false" + single_instance="true" + title="Basic pathfinding setup" + width="312"> + <floater.string name="status_pathfinding_not_enabled">This region is not enabled for pathfinding.</floater.string> + <floater.string name="status_unable_to_change_state">Unable to change modes successfully.</floater.string> + <floater.string name="status_querying_state">Checking status ...</floater.string> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left="15" + name="status_label" + top="8" + width="289"> + </text> + <text + height="13" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + follows="left|top" + layout="topleft" + left="15" + name="unfreeze_label" + top_pad="4" + width="289"> + Allow object / terrain changes: + </text> + <button + follows="left|top" + height="22" + label="Unfreeze" + layout="topleft" + name="enter_unfrozen_mode" + width="116"/> + <text + height="82" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + follows="left|top" + layout="topleft" + line_spacing.multiple="1.5" + left="15" + name="freeze_label" + top_pad="23" + width="289"> + In unfrozen mode, you can move and make changes to objects and terrain. When you are finished, click the Freeze button. It may require a few minutes to process your changes. + </text> + <button + follows="left|top" + height="22" + label="Freeze" + layout="topleft" + name="enter_frozen_mode" + top_pad="0" + width="116"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml new file mode 100644 index 0000000000..a267902b94 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + open_positioning="cascading" + can_resize="true" + can_tear_off="false" + height="273" + width="635" + min_height="273" + min_width="635" + layout="topleft" + name="floater_pathfinding_characters" + help_topic="floater_pathfinding_characters" + reuse_instance="true" + save_rect="false" + single_instance="true" + title="Pathfinding characters"> + <floater.string name="messaging_initial"></floater.string> + <floater.string name="messaging_get_inprogress">Querying for pathfinding characters ...</floater.string> + <floater.string name="messaging_get_error">Error detected while querying for pathfinding characters.</floater.string> + <floater.string name="messaging_set_inprogress"></floater.string> + <floater.string name="messaging_set_error"></floater.string> + <floater.string name="messaging_complete_none_found">No pathfinding characters.</floater.string> + <floater.string name="messaging_complete_available">[NUM_SELECTED] characters selected out of [NUM_TOTAL].</floater.string> + <floater.string name="messaging_not_enabled">This region is not enabled for pathfinding.</floater.string> + <floater.string name="character_cpu_time">[CPU_TIME] µs</floater.string> + <floater.string name="character_owner_loading">[Loading]</floater.string> + <floater.string name="character_owner_unknown">Unknown</floater.string> + <panel + border="false" + bevel_style="none" + follows="left|top|right|bottom" + layout="topleft" + height="191" + width="635"> + <scroll_list + column_padding="0" + draw_heading="true" + follows="all" + height="135" + layout="topleft" + left="18" + top_pad="10" + tab_stop="false" + multi_select="true" + name="objects_scroll_list" + width="600"> + <scroll_list.columns + label="Name" + name="name" + dynamic_width="true" /> + <scroll_list.columns + label="Description" + name="description" + width="172" /> + <scroll_list.columns + label="Owner" + name="owner" + width="141" /> + <scroll_list.columns + label="CPU" + name="cpu_time" + width="60" /> + <scroll_list.columns + label="Altitude" + name="altitude" + width="64" /> + </scroll_list> + <text + height="26" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|bottom|right" + layout="topleft" + name="messaging_status" + top_pad="17" + width="238"> + Characters: + </text> + <button + follows="right|bottom" + height="21" + label="Refresh list" + layout="topleft" + name="refresh_objects_list" + top_pad="-29" + left_pad="0" + width="115"/> + <button + follows="right|bottom" + height="21" + label="Select all" + layout="topleft" + name="select_all_objects" + top_pad="-21" + left_pad="8" + width="115"/> + <button + follows="right|bottom" + height="21" + label="Select none" + layout="topleft" + name="select_none_objects" + top_pad="-21" + left_pad="8" + width="115"/> + </panel> + <view_border + bevel_style="none" + follows="left|right|bottom" + height="0" + layout="topleft" + name="horiz_separator" + top_pad="0" + left="18" + width="600"/> + <panel + border="false" + bevel_style="none" + follows="left|right|bottom" + layout="topleft" + left="0" + height="67" + width="635"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + follows="left|bottom|right" + layout="topleft" + name="actions_label" + left="18" + top_pad="8" + width="242"> + Actions on selected characters: + </text> + <check_box + height="19" + follows="left|bottom" + label="Show beacon" + layout="topleft" + name="show_beacon" + top_pad="-16" + left_pad="0" + width="150" /> + <check_box + height="19" + follows="left|bottom" + label="Show physics capsule" + layout="topleft" + name="show_physics_capsule" + top_pad="-19" + left_pad="0" + width="150" /> + <button + follows="left|bottom" + height="22" + label="Take" + layout="topleft" + name="take_objects" + top_pad="9" + left="18" + width="94"/> + <button + follows="left|bottom" + height="22" + label="Take copy" + layout="topleft" + name="take_copy_objects" + top_pad="-22" + left_pad="6" + width="94"/> + <button + follows="left|bottom" + height="22" + label="Return" + layout="topleft" + name="return_objects" + top_pad="-22" + left_pad="6" + width="94"/> + <button + follows="left|bottom" + height="22" + label="Delete" + layout="topleft" + name="delete_objects" + top_pad="-22" + left_pad="6" + width="94"/> + <button + follows="left|bottom" + height="22" + label="Teleport me to it" + layout="topleft" + name="teleport_me_to_object" + tool_tip="Enabled only when one character is selected." + top_pad="-22" + left_pad="6" + width="159"/> + </panel> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml new file mode 100644 index 0000000000..54d44be015 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -0,0 +1,555 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + open_positioning="cascading" + can_tear_off="false" + height="446" + layout="topleft" + name="floater_pathfinding_console" + help_topic="floater_pathfinding_console" + reuse_instance="true" + save_rect="true" + single_instance="true" + title="Pathfinding edit / test" + width="456"> + <floater.string name="navmesh_viewer_status_unknown"></floater.string> + <floater.string name="navmesh_viewer_status_library_not_implemented">Cannot find pathing library implementation.</floater.string> + <floater.string name="navmesh_viewer_status_region_not_enabled">This region is not enabled for pathfinding.</floater.string> + <floater.string name="navmesh_viewer_status_region_loading">Waiting for the region to finish loading.</floater.string> + <floater.string name="navmesh_viewer_status_checking_version">Checking the status of the navmesh.</floater.string> + <floater.string name="navmesh_viewer_status_downloading">Downloading the navmesh.</floater.string> + <floater.string name="navmesh_viewer_status_updating">The navmesh has changed on the server. Downloading the latest navmesh.</floater.string> + <floater.string name="navmesh_viewer_status_has_navmesh">Latest navmesh has been downloaded.</floater.string> + <floater.string name="navmesh_viewer_status_error">Unable to download navmesh successfully.</floater.string> + <floater.string name="navmesh_simulator_status_unknown"></floater.string> + <floater.string name="navmesh_simulator_status_region_not_enabled">This region does not expose the navmesh status.</floater.string> + <floater.string name="navmesh_simulator_status_pending">Navmesh has pending changes.</floater.string> + <floater.string name="navmesh_simulator_status_building">Navmesh is building.</floater.string> + <floater.string name="navmesh_simulator_status_some_pending">Some navmesh regions have pending changes.</floater.string> + <floater.string name="navmesh_simulator_status_some_building">Some navmesh regions are building.</floater.string> + <floater.string name="navmesh_simulator_status_pending_and_building">Some navmesh regions have pending changes and others are building.</floater.string> + <floater.string name="navmesh_simulator_status_complete">Navmesh is up-to-date.</floater.string> + <floater.string name="pathing_unknown"></floater.string> + <floater.string name="pathing_library_not_implemented">Cannot find pathing library implementation.</floater.string> + <floater.string name="pathing_region_not_enabled">This region is not enabled for pathfinding.</floater.string> + <floater.string name="pathing_choose_start_and_end_points">Please choose start and end points.</floater.string> + <floater.string name="pathing_choose_start_point">Please choose start point.</floater.string> + <floater.string name="pathing_choose_end_point">Please choose end point.</floater.string> + <floater.string name="pathing_path_valid">Path is shown in orange.</floater.string> + <floater.string name="pathing_path_invalid">A path between the chosen points cannot be found.</floater.string> + <floater.string name="pathing_error">An error occurred during path generation.</floater.string> + <panel + border="false" + bevel_style="none" + follows="left|top" + layout="topleft" + left="14" + top_pad="15" + height="68" + width="200"> + <text + height="13" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + layout="topleft" + left="0" + top_pad="0" + width="200"> + Viewer status + </text> + <text + height="40" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="PathfindingGoodColor" + length="1" + follows="left|top" + layout="topleft" + left="0" + name="pathfinding_viewer_status" + top_pad="8" + width="200"> + </text> + </panel> + <view_border + bevel_style="none" + follows="top|left" + layout="topleft" + left="14" + height="0" + width="200" + top_pad="0" + visible="true" /> + <panel + border="false" + bevel_style="none" + follows="left|top" + layout="topleft" + height="297" + width="200"> + <text + height="13" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="show_label" + length="1" + follows="left|top" + layout="topleft" + top_pad="9" + width="200"> + Show: + </text> + <check_box + height="19" + label="World" + layout="topleft" + name="show_world" + top_pad="4" + width="90" /> + <check_box + height="19" + label="Movables only" + layout="topleft" + left="20" + name="show_world_movables_only" + top_pad="4" + width="90" /> + <check_box + height="19" + label="Navmesh" + left="0" + layout="topleft" + name="show_navmesh" + top_pad="7" + width="90" /> + <text + height="13" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="show_walkability_label" + length="1" + follows="left|top" + layout="topleft" + left="20" + width="180"> + Show walkability map: + </text> + <combo_box + height="19" + layout="topleft" + left="20" + name="show_heatmap_mode" + top_pad="8" + width="156"> + <combo_box.item + label="Do not show" + name="show_heatmap_mode_none" + value="0" /> + <combo_box.item + label="Character type A" + name="show_heatmap_mode_a" + value="1" /> + <combo_box.item + label="Character type B" + name="show_heatmap_mode_b" + value="2" /> + <combo_box.item + label="Character type C" + name="show_heatmap_mode_c" + value="3" /> + <combo_box.item + label="Character type D" + name="show_heatmap_mode_d" + value="4" /> + </combo_box> + <check_box + height="19" + label="Walkables" + layout="topleft" + left="0" + name="show_walkables" + top_pad="10" + width="90" /> + <check_box + height="19" + label="Material volumes" + layout="topleft" + name="show_material_volumes" + top_pad="4" + width="90" /> + <check_box + height="19" + label="Static obstacles" + layout="topleft" + name="show_static_obstacles" + top_pad="4" + width="90" /> + <check_box + height="19" + label="Exclusion volumes" + layout="topleft" + name="show_exclusion_volumes" + top_pad="4" + width="90" /> + <check_box + height="19" + label="Water plane" + layout="topleft" + name="show_water_plane" + top_pad="4" + width="90" /> + <check_box + height="19" + label="With X-ray vision" + layout="topleft" + name="show_xray" + top_pad="4" + width="90" /> + </panel> + <view_border + bevel_style="none" + follows="top|left" + layout="topleft" + left="230" + top="35" + height="247" + width="214" + visible="true" /> + <tab_container + follows="left|top" + layout="topleft" + tab_position="top" + name="edit_test_tab_container" + left="227" + top="14" + height="268" + width="218"> + <panel + border="false" + bevel_style="none" + follows="left|top" + layout="topleft" + name="edit_panel" + left="1" + label="Edit"> + <text + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + follows="left|top" + layout="topleft" + name="unfreeze_label" + left="16" + top_pad="16" + height="13" + width="190"> + Allow object / terrain changes: + </text> + <button + follows="left|top" + height="22" + left="16" + enabled="false" + label="Unfreeze" + layout="topleft" + name="enter_unfrozen_mode" + top_pad="5" + width="116"/> + <text + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + follows="left|top" + layout="topleft" + left="16" + name="edit_linksets_label" + top_pad="23" + height="13" + width="190"> + Edit linkset attributes: + </text> + <button + follows="left|top" + height="22" + left="16" + label="Linksets..." + layout="topleft" + name="view_and_edit_linksets" + top_pad="5" + width="116"/> + <text + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + follows="left|top" + layout="topleft" + left="16" + line_spacing.multiple="1.5" + name="freeze_label" + top_pad="23" + height="32" + width="190"> + Prevent object / terrain changes and update the navmesh: + </text> + <button + follows="left|top" + height="22" + left="16" + enabled="false" + label="Freeze" + layout="topleft" + name="enter_frozen_mode" + top_pad="3" + width="116"/> + </panel> + <panel + border="false" + bevel_style="none" + follows="left|top" + layout="topleft" + left="1" + name="test_panel" + label="Test"> + <text + height="14" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="ctrl_click_label" + length="1" + left="16" + follows="left|top" + layout="topleft" + top_pad="12" + width="190"> + Ctrl-click to select start point. + </text> + <text + height="14" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="shift_click_label" + length="1" + follows="left|top" + layout="topleft" + top_pad="5" + width="190"> + Shift-click to select end point. + </text> + <view_border + bevel_style="none" + follows="top|left" + layout="topleft" + height="0" + width="185" + top_pad="13" + visible="true" /> + <text + height="14" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="character_width_label" + length="1" + follows="left|top" + layout="topleft" + top_pad="14" + width="190"> + Character width + </text> + <slider + decimal_digits="1" + height="14" + increment="0.1" + layout="topleft" + follows="left|top" + max_val="2" + min_val="0.2" + name="character_width" + top_pad="5" + value="1" + width="145" /> + <text + height="14" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="character_width_unit_label" + length="1" + follows="left|top" + layout="topleft" + top_pad="-14" + left_pad="0" + width="20"> + m + </text> + <text + height="14" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="character_type_label" + length="1" + follows="left|top" + layout="topleft" + left_pad="-165" + top_pad="13" + width="190"> + Character type + </text> + <combo_box + follows="top|left" + layout="topleft" + height="19" + width="156" + top_pad="5" + name="path_character_type"> + <combo_box.item + label="None" + name="path_character_type_none" + value="0" /> + <combo_box.item + label="A" + name="path_character_type_a" + value="1" /> + <combo_box.item + label="B" + name="path_character_type_b" + value="2" /> + <combo_box.item + label="C" + name="path_character_type_c" + value="3" /> + <combo_box.item + label="D" + name="path_character_type_d" + value="4" /> + </combo_box> + <text + height="14" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="PathfindingGoodColor" + length="1" + follows="left|top" + layout="topleft" + name="path_test_status" + top_pad="11" + width="190"> + </text> + <button + follows="left|top" + height="22" + label="Clear path" + layout="topleft" + name="clear_path" + top_pad="27" + width="96"/> + </panel> + </tab_container> + <panel + border="false" + bevel_style="none" + follows="left|top" + layout="topleft" + left="246" + height="73" + width="200"> + <text + height="13" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + layout="topleft" + left="0" + top_pad="5" + width="200"> + Simulator status + </text> + <text + height="40" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left="0" + name="pathfinding_simulator_status" + top_pad="8" + width="200"> + </text> + </panel> + <view_border + bevel_style="none" + follows="top|left" + layout="topleft" + height="0" + left="14" + width="430" + top_pad="25" + visible="true" /> + <panel + border="false" + bevel_style="none" + follows="left|top" + layout="topleft" + height="40" + top_pad="0" + width="400"> + <text + height="13" + word_wrap="true" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + layout="topleft" + top_pad="18" + width="250"> + Lost characters? Bad performance? + </text> + <button + follows="left|top" + height="21" + label="Characters..." + layout="topleft" + name="view_characters_floater" + left_pad="0" + top_pad="-17" + width="96"/> + </panel> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml new file mode 100644 index 0000000000..3e718743dc --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -0,0 +1,523 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + open_positioning="cascading" + can_resize="true" + can_tear_off="false" + height="382" + width="1015" + min_height="382" + min_width="1015" + layout="topleft" + name="floater_pathfinding_linksets" + help_topic="floater_pathfinding_linksets" + reuse_instance="true" + save_rect="false" + single_instance="true" + title="Pathfinding linksets"> + <floater.string name="messaging_initial"></floater.string> + <floater.string name="messaging_get_inprogress">Querying for pathfinding linksets ...</floater.string> + <floater.string name="messaging_get_error">Error detected while querying for pathfinding linksets.</floater.string> + <floater.string name="messaging_set_inprogress">Modifying selected pathfinding linksets ...</floater.string> + <floater.string name="messaging_set_error">Error detected while modifying selected pathfinding linksets.</floater.string> + <floater.string name="messaging_complete_none_found">No pathfinding linksets.</floater.string> + <floater.string name="messaging_complete_available">[NUM_SELECTED] linksets selected out of [NUM_TOTAL].</floater.string> + <floater.string name="messaging_not_enabled">This region is not enabled for pathfinding.</floater.string> + <floater.string name="linkset_terrain_name">[Terrain]</floater.string> + <floater.string name="linkset_terrain_description">--</floater.string> + <floater.string name="linkset_terrain_owner">--</floater.string> + <floater.string name="linkset_terrain_land_impact">--</floater.string> + <floater.string name="linkset_terrain_dist_from_you">--</floater.string> + <floater.string name="linkset_owner_loading">[Loading]</floater.string> + <floater.string name="linkset_owner_unknown">Unknown</floater.string> + <floater.string name="linkset_use_walkable">Walkable</floater.string> + <floater.string name="linkset_use_static_obstacle">Static obstacle</floater.string> + <floater.string name="linkset_use_dynamic_obstacle">Movable obstacle</floater.string> + <floater.string name="linkset_use_material_volume">Material volume</floater.string> + <floater.string name="linkset_use_exclusion_volume">Exclusion volume</floater.string> + <floater.string name="linkset_use_dynamic_phantom">Movable phantom</floater.string> + <floater.string name="linkset_is_terrain">[unmodifiable]</floater.string> + <floater.string name="linkset_is_restricted_state">[restricted]</floater.string> + <floater.string name="linkset_is_non_volume_state">[concave]</floater.string> + <floater.string name="linkset_is_restricted_non_volume_state">[restricted,concave]</floater.string> + <floater.string name="linkset_choose_use">Choose linkset use...</floater.string> + <panel + border="false" + bevel_style="none" + follows="left|top|right|bottom" + layout="topleft" + height="226" + width="999"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left="20" + top_pad="14" + width="67"> + Filter by: + </text> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="0" + width="62"> + Name + </text> + <line_editor + border_style="line" + border_thickness="1" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="filter_by_name" + width="161" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="22" + top_pad="-15" + width="88"> + Description + </text> + <line_editor + border_style="line" + border_thickness="1" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-17" + max_length_chars="255" + name="filter_by_description" + width="162" /> + <combo_box + height="20" + layout="topleft" + follows="left|top" + name="filter_by_linkset_use" + left_pad="32" + top_pad="-20" + width="199"> + <combo_box.item + label="Filter by linkset use..." + name="filter_by_linkset_use_none" + value="0" /> + <combo_box.item + label="Walkable" + name="filter_by_linkset_use_walkable" + value="1" /> + <combo_box.item + label="Static obstacle" + name="filter_by_linkset_use_static_obstacle" + value="2" /> + <combo_box.item + label="Movable obstacle" + name="filter_by_linkset_use_dynamic_obstacle" + value="3" /> + <combo_box.item + label="Material volume" + name="filter_by_linkset_use_material_volume" + value="4" /> + <combo_box.item + label="Exclusion volume" + name="filter_by_linkset_use_exclusion_volume" + value="5" /> + <combo_box.item + label="Movable phantom" + name="filter_by_linkset_use_dynamic_phantom" + value="6" /> + </combo_box> + <button + follows="right|top" + height="21" + label="Apply" + layout="topleft" + name="apply_filters" + top_pad="-21" + left_pad="31" + width="73"/> + <button + follows="right|top" + height="21" + label="Clear" + layout="topleft" + name="clear_filters" + top_pad="-21" + left_pad="8" + width="73"/> + <scroll_list + column_padding="0" + draw_heading="true" + follows="all" + height="135" + layout="topleft" + left="18" + top_pad="15" + tab_stop="false" + multi_select="true" + name="objects_scroll_list" + width="980"> + <scroll_list.columns + label="Name (root prim)" + name="name" + dynamic_width="true" /> + <scroll_list.columns + label="Description (root prim)" + name="description" + dynamic_width="true" /> + <scroll_list.columns + label="Owner" + name="owner" + width="141" /> + <scroll_list.columns + label="Impact" + name="land_impact" + width="55" /> + <scroll_list.columns + label="Distance" + name="dist_from_you" + width="65" /> + <scroll_list.columns + label="Linkset use" + name="linkset_use" + width="236" /> + <scroll_list.columns + label="A %" + name="a_percent" + width="41" /> + <scroll_list.columns + label="B %" + name="b_percent" + width="41" /> + <scroll_list.columns + label="C %" + name="c_percent" + width="41" /> + <scroll_list.columns + label="D %" + name="d_percent" + width="41" /> + </scroll_list> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|bottom|right" + layout="topleft" + name="messaging_status" + top_pad="17" + width="619"> + Linksets: + </text> + <button + follows="right|bottom" + height="21" + label="Refresh list" + layout="topleft" + name="refresh_objects_list" + top_pad="-16" + left_pad="0" + width="115"/> + <button + follows="right|bottom" + height="21" + label="Select all" + layout="topleft" + name="select_all_objects" + top_pad="-21" + left_pad="8" + width="115"/> + <button + follows="right|bottom" + height="21" + label="Select none" + layout="topleft" + name="select_none_objects" + top_pad="-21" + left_pad="8" + width="115"/> + </panel> + <view_border + bevel_style="none" + follows="left|bottom|right" + height="0" + layout="topleft" + name="horiz_separator" + top_pad="0" + left="18" + width="979"/> + <panel + border="false" + bevel_style="none" + follows="left|right|bottom" + layout="topleft" + left="0" + height="67" + width="950"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + left="18" + follows="left|bottom|right" + layout="topleft" + top_pad="8" + width="580"> + Actions on selected linksets (If a linkset is removed from the world, its attributes may be lost): + </text> + <check_box + height="19" + follows="left|bottom" + label="Show beacon" + layout="topleft" + name="show_beacon" + left_pad="0" + top_pad="-16" + width="90" /> + <button + follows="left|bottom" + height="21" + label="Take" + layout="topleft" + name="take_objects" + top_pad="9" + left="18" + width="95"/> + <button + follows="left|bottom" + height="21" + label="Take copy" + layout="topleft" + name="take_copy_objects" + top_pad="-21" + left_pad="6" + width="95"/> + <button + follows="left|bottom" + height="21" + label="Return" + layout="topleft" + name="return_objects" + top_pad="-21" + left_pad="6" + width="95"/> + <button + follows="left|bottom" + height="21" + label="Delete" + layout="topleft" + name="delete_objects" + top_pad="-21" + left_pad="6" + width="95"/> + <button + follows="left|bottom" + height="21" + label="Teleport me to it" + layout="topleft" + name="teleport_me_to_object" + top_pad="-21" + left_pad="6" + width="160"/> + </panel> + <view_border + bevel_style="none" + follows="left|bottom|right" + height="0" + layout="topleft" + name="horiz_separator" + top_pad="0" + left="18" + width="979"/> + <panel + border="false" + bevel_style="none" + follows="left|right|bottom" + layout="topleft" + left="0" + height="75" + width="950"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|bottom" + layout="topleft" + left="18" + top_pad="8" + width="912"> + Edit attributes of selected linksets and press the button to apply changes + </text> + <combo_box + height="20" + layout="topleft" + follows="left|top" + name="edit_linkset_use" + left="18" + top_pad="17" + width="199"> + </combo_box> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="walkability_coefficients_label" + length="1" + follows="left|bottom" + layout="topleft" + left_pad="36" + top_pad="-17" + width="110"> + Walkability: + </text> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_a_label" + length="1" + follows="left|bottom" + layout="topleft" + left_pad="0" + width="18"> + A + </text> + <line_editor + border_style="line" + border_thickness="1" + follows="left|bottom" + height="21" + layout="topleft" + left_pad="0" + top_pad="-19" + max_length_chars="3" + name="edit_a_value" + width="45" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_b_label" + length="1" + follows="left|bottom" + layout="topleft" + left_pad="44" + top_pad="-15" + width="18"> + B + </text> + <line_editor + border_style="line" + border_thickness="1" + follows="left|bottom" + height="21" + layout="topleft" + left_pad="0" + top_pad="-19" + max_length_chars="3" + name="edit_b_value" + width="45" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_c_label" + length="1" + follows="left|bottom" + layout="topleft" + left_pad="44" + top_pad="-15" + width="18"> + C + </text> + <line_editor + border_style="line" + border_thickness="1" + follows="left|bottom" + height="21" + layout="topleft" + left_pad="0" + top_pad="-19" + max_length_chars="3" + name="edit_c_value" + width="45" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_d_label" + length="1" + follows="left|bottom" + layout="topleft" + left_pad="44" + top_pad="-15" + width="18"> + D + </text> + <line_editor + border_style="line" + border_thickness="1" + follows="left|bottom" + height="21" + layout="topleft" + left_pad="0" + top_pad="-19" + max_length_chars="3" + name="edit_d_value" + width="45" /> + <button + follows="right|bottom" + height="21" + label="Apply changes" + layout="topleft" + name="apply_edit_values" + top_pad="-21" + left_pad="40" + width="140"/> + </panel> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index 2fd932786b..464f7fcfe9 100644 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -1,827 +1,888 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater - legacy_header_height="18" - can_resize="true" - height="400" - layout="topleft" - name="Statistics" - help_topic="statistics" - save_rect="true" - save_visibility="true" - title="STATISTICS" - width="260"> - <scroll_container - follows="top|left|bottom|right" - height="380" - layout="topleft" - left="0" - name="statistics_scroll" - reserve_scroll_corner="true" - top="20" - width="260"> - <container_view - follows="top|left|bottom|right" - height="378" - layout="topleft" - left="2" - name="statistics_view" - top="20" - width="245" > - <!--Basic Section--> - <stat_view - name="basic" - label="Basic" - show_label="true" - setting="OpenDebugStatBasic"> - <stat_bar - name="fps" - label="FPS" - unit_label="fps" - stat="fpsstat" - bar_min="0" - bar_max="60" - tick_spacing="6" - label_spacing="12" - precision="1" - show_bar="true" - show_history="true"> - </stat_bar> - <stat_bar - name="bandwidth" - label="Bandwidth" - unit_label="kbps" - stat="kbitstat" - bar_min="0" - bar_max="5000" - tick_spacing="500" - label_spacing="1000" - precision="0" - show_bar="true" - show_history="false"> - </stat_bar> - <stat_bar - name="packet_loss" - label="Packet Loss" - unit_label=" %" - stat="packetslostpercentstat" - bar_min="0" - bar_max="5" - tick_spacing="0.5" - label_spacing="1" - precision="3" - show_per_sec="false" - show_bar="false" - show_mean="true"> - </stat_bar> - <stat_bar - name="ping" - label="Ping Sim" - unit_label="msec" - stat="simpingstat" - bar_min="0" - bar_max="5000" - tick_spacing="500" - label_spacing="1000" - precision="0" - show_bar="false" - show_per_sec="false" - show_mean="false"> - </stat_bar> - </stat_view> - <!--Advanced Section--> + legacy_header_height="18" + can_resize="true" + height="400" + layout="topleft" + name="Statistics" + help_topic="statistics" + save_rect="true" + save_visibility="true" + title="STATISTICS" + width="260"> + <scroll_container + follows="top|left|bottom|right" + height="380" + layout="topleft" + left="0" + name="statistics_scroll" + reserve_scroll_corner="true" + top="20" + width="260"> + <container_view + follows="top|left|bottom|right" + height="378" + layout="topleft" + left="2" + name="statistics_view" + top="20" + width="245" > + <!--Basic Section--> <stat_view - name="advanced" - label="Advanced" - show_label="true" - setting="OpenDebugStatAdvanced"> - <stat_view - name="render" - label="Render" - show_label="true" - setting="OpenDebugStatRender"> - <stat_bar - name="ktrisframe" - label="KTris Drawn per Frame" - unit_label="/fr" - stat="trianglesdrawnstat" - bar_min="0" - bar_max="10000" - tick_spacing="1000" - label_spacing="2000" - precision="0" - show_per_sec="false" - show_bar="false"> + name="basic" + label="Basic" + show_label="true" + setting="OpenDebugStatBasic"> + <stat_bar + name="fps" + label="FPS" + unit_label="fps" + stat="fpsstat" + bar_min="0" + bar_max="60" + tick_spacing="6" + label_spacing="12" + precision="1" + show_bar="true" + show_history="true"> + </stat_bar> + <stat_bar + name="bandwidth" + label="Bandwidth" + unit_label="kbps" + stat="kbitstat" + bar_min="0" + bar_max="5000" + tick_spacing="500" + label_spacing="1000" + precision="0" + show_bar="true" + show_history="false"> </stat_bar> - <stat_bar - name="ktrissec" - label="KTris Drawn per Sec" - unit_label="/sec" - stat="trianglesdrawnstat" - bar_min="0" - bar_max="200000" - tick_spacing="25000" - label_spacing="50000" - precision="0" - show_bar="false"> + <stat_bar + name="packet_loss" + label="Packet Loss" + unit_label=" %" + stat="packetslostpercentstat" + bar_min="0" + bar_max="5" + tick_spacing="0.5" + label_spacing="1" + precision="3" + show_per_sec="false" + show_bar="false" + show_mean="true"> </stat_bar> - <stat_bar - name="objs" - label="Total Objects" - unit_label="" - stat="numobjectsstat" - bar_min="0" - bar_max="50000" - tick_spacing="5000" - label_spacing="10000" - precision="0" - show_per_sec="false" - show_bar="false"> - </stat_bar> - <stat_bar - name="newobjs" - label="New Objects" - unit_label="/sec" - stat="numnewobjectsstat" - bar_min="0" - bar_max="2000" - tick_spacing="200" - label_spacing="400" - show_per_sec="true" - show_bar="false"> - </stat_bar> - </stat_view> + <stat_bar + name="ping" + label="Ping Sim" + unit_label="msec" + stat="simpingstat" + bar_min="0" + bar_max="5000" + tick_spacing="500" + label_spacing="1000" + precision="0" + show_bar="false" + show_per_sec="false" + show_mean="false"> + </stat_bar> + </stat_view> + <!--Advanced Section--> + <stat_view + name="advanced" + label="Advanced" + show_label="true" + setting="OpenDebugStatAdvanced"> + <stat_view + name="render" + label="Render" + show_label="true" + setting="OpenDebugStatRender"> + <stat_bar + name="ktrisframe" + label="KTris Drawn per Frame" + unit_label="/fr" + stat="trianglesdrawnstat" + bar_min="0" + bar_max="10000" + tick_spacing="1000" + label_spacing="2000" + precision="0" + show_per_sec="false" + show_bar="false"> + </stat_bar> + <stat_bar + name="ktrissec" + label="KTris Drawn per Sec" + unit_label="/sec" + stat="trianglesdrawnstat" + bar_min="0" + bar_max="200000" + tick_spacing="25000" + label_spacing="50000" + precision="0" + show_bar="false"> + </stat_bar> + <stat_bar + name="objs" + label="Total Objects" + unit_label="" + stat="numobjectsstat" + bar_min="0" + bar_max="50000" + tick_spacing="5000" + label_spacing="10000" + precision="0" + show_per_sec="false" + show_bar="false"> + </stat_bar> + <stat_bar + name="newobjs" + label="New Objects" + unit_label="/sec" + stat="numnewobjectsstat" + bar_min="0" + bar_max="2000" + tick_spacing="200" + label_spacing="400" + show_per_sec="true" + show_bar="false"> + </stat_bar> + </stat_view> <!--Texture Stats--> - <stat_view - name="texture" - label="Texture" - show_label="true"> - <stat_bar - name="numimagesstat" - label="Count" - stat="numimagesstat" - bar_min="0.f" - bar_max="8000.f" - tick_spacing="2000.f" - label_spacing="4000.f" - show_per_sec="false" - show_bar="false"> - </stat_bar> - - <stat_bar - name="numrawimagesstat" - label="Raw Count" - stat="numrawimagesstat" - bar_min="0.f" - bar_max="8000.f" - tick_spacing="2000.f" - label_spacing="4000.f" - show_per_sec="false" - show_bar="false"> - </stat_bar> - - <stat_bar - name="gltexmemstat" - label="GL Mem" - stat="gltexmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> + <stat_view + name="texture" + label="Texture" + show_label="true"> + <stat_bar + name="numimagesstat" + label="Count" + stat="numimagesstat" + bar_min="0.f" + bar_max="8000.f" + tick_spacing="2000.f" + label_spacing="4000.f" + show_per_sec="false" + show_bar="false"> + </stat_bar> + + <stat_bar + name="numrawimagesstat" + label="Raw Count" + stat="numrawimagesstat" + bar_min="0.f" + bar_max="8000.f" + tick_spacing="2000.f" + label_spacing="4000.f" + show_per_sec="false" + show_bar="false"> + </stat_bar> + + <stat_bar + name="gltexmemstat" + label="GL Mem" + stat="gltexmemstat" + bar_min="0.f" + bar_max="400.f" + tick_spacing="100.f" + label_spacing="200.f" + precision="1" + show_per_sec="false" + show_bar="false"> + </stat_bar> + + <stat_bar + name="formattedmemstat" + label="Formatted Mem" + stat="formattedmemstat" + bar_min="0.f" + bar_max="400.f" + tick_spacing="100.f" + label_spacing="200.f" + precision="1" + show_per_sec="false" + show_bar="false"> + </stat_bar> + + <stat_bar + name="rawmemstat" + label="Raw Mem" + stat="rawmemstat" + bar_min="0.f" + bar_max="400.f" + tick_spacing="100.f" + label_spacing="200.f" + precision="1" + show_per_sec="false" + show_bar="false"> + </stat_bar> + + <stat_bar + name="glboundmemstat" + label="Bound Mem" + stat="glboundmemstat" + bar_min="0.f" + bar_max="400.f" + tick_spacing="100.f" + label_spacing="200.f" + precision="1" + show_per_sec="false" + show_bar="false"> + </stat_bar> + </stat_view> + <!--Network Stats--> + <stat_view + name="network" + label="Network" + show_label="true" + setting="OpenDebugStatNet"> + <stat_bar + name="packetsinstat" + label="Packets In" + stat="packetsinstat" + unit_label="/sec" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"> + </stat_bar> + + <stat_bar + name="packetsoutstat" + label="Packets Out" + stat="packetsoutstat" + unit_label="/sec" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" > + </stat_bar> + + <stat_bar + name="objectkbitstat" + label="Objects" + stat="objectkbitstat" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" > + </stat_bar> + + <stat_bar + name="texturekbitstat" + label="Texture" + stat="texturekbitstat" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" > + </stat_bar> + + <stat_bar + name="assetkbitstat" + label="Asset" + stat="assetkbitstat" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" > + </stat_bar> + + <stat_bar + name="layerskbitstat" + label="Layers" + stat="layerskbitstat" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" > + </stat_bar> + + <stat_bar + name="actualinkbitstat" + label="Actual In" + stat="actualinkbitstat" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" + show_history="false" > + </stat_bar> + + <stat_bar + name="actualoutkbitstat" + label="Actual Out" + stat="actualoutkbitstat" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" + show_history="false"> + </stat_bar> + + <stat_bar + name="vfspendingoperations" + label="VFS Pending Operations" + stat="vfspendingoperations" + unit_label=" Ops." + show_per_sec="false" + show_bar="false" > + </stat_bar> + </stat_view> + </stat_view> + <!--Sim Stats--> + <stat_view + name="sim" + label="Simulator" + show_label="true" + setting="OpenDebugStatSim"> + <stat_bar + name="simtimedilation" + label="Time Dilation" + stat="simtimedilation" + precision="3" + bar_min="0.f" + bar_max="1.f" + tick_spacing="0.16666f" + label_spacing="0.33333f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> - <stat_bar - name="formattedmemstat" - label="Formatted Mem" - stat="formattedmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> + <stat_bar + name="simfps" + label="Sim FPS" + stat="simfps" + precision="1" + bar_min="0.f" + bar_max="45.f" + tick_spacing="7.5f" + label_spacing="15.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> - <stat_bar - name="rawmemstat" - label="Raw Mem" - stat="rawmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> + <stat_bar + name="simphysicsfps" + label="Physics FPS" + stat="simphysicsfps" + precision="1" + bar_min="0.f" + bar_max="45.f" + tick_spacing="7.5.f" + label_spacing="15.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> - <stat_bar - name="glboundmemstat" - label="Bound Mem" - stat="glboundmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> + <stat_view + name="physicsdetail" + label="Physics Details" + show_label="true"> + <stat_bar + name="physicspinnedtasks" + label="Pinned Objects" + stat="physicspinnedtasks" + precision="0" + bar_min="0.f" + bar_max="500.f" + tick_spacing="50.f" + label_spacing="100.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="physicslodtasks" + label="Low LOD Objects" + stat="physicslodtasks" + precision="0" + bar_min="0.f" + bar_max="500.f" + tick_spacing="50.f" + label_spacing="100.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="physicsmemoryallocated" + label="Memory Allocated" + stat="physicsmemoryallocated" + unit_label="MB" + precision="1" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + </stat_view> + + <stat_bar + name="simagentups" + label="Agent Updates/Sec" + stat="simagentups" + precision="1" + bar_min="0.f" + bar_max="100.f" + tick_spacing="25.f" + label_spacing="50.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simmainagents" + label="Main Agents" + stat="simmainagents" + precision="0" + bar_min="0.f" + bar_max="80.f" + tick_spacing="10.f" + label_spacing="40.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simchildagents" + label="Child Agents" + stat="simchildagents" + precision="0" + bar_min="0.f" + bar_max="40.f" + tick_spacing="5.f" + label_spacing="10.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simobjects" + label="Objects" + stat="simobjects" + precision="0" + bar_min="0.f" + bar_max="30000.f" + tick_spacing="5000.f" + label_spacing="10000.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> - </stat_view> - <!--Network Stats--> - <stat_view - name="network" - label="Network" - show_label="true" - setting="OpenDebugStatNet"> - <stat_bar - name="packetsinstat" - label="Packets In" - stat="packetsinstat" - unit_label="/sec" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false"> - </stat_bar> - - <stat_bar - name="packetsoutstat" - label="Packets Out" - stat="packetsoutstat" - unit_label="/sec" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="objectkbitstat" - label="Objects" - stat="objectkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="texturekbitstat" - label="Texture" - stat="texturekbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="assetkbitstat" - label="Asset" - stat="assetkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="layerskbitstat" - label="Layers" - stat="layerskbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="actualinkbitstat" - label="Actual In" - stat="actualinkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" - show_history="false" > - </stat_bar> - - <stat_bar - name="actualoutkbitstat" - label="Actual Out" - stat="actualoutkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" - show_history="false"> - </stat_bar> - - <stat_bar - name="vfspendingoperations" - label="VFS Pending Operations" - stat="vfspendingoperations" - unit_label=" Ops." - show_per_sec="false" - show_bar="false" > - </stat_bar> - </stat_view> - </stat_view> - <!--Sim Stats--> - <stat_view - name="sim" - label="Simulator" - show_label="true" - setting="OpenDebugStatSim"> - <stat_bar - name="simtimedilation" - label="Time Dilation" - stat="simtimedilation" - precision="3" - bar_min="0.f" - bar_max="1.f" - tick_spacing="0.16666f" - label_spacing="0.33333f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simfps" - label="Sim FPS" - stat="simfps" - precision="1" - bar_min="0.f" - bar_max="45.f" - tick_spacing="7.5f" - label_spacing="15.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simphysicsfps" - label="Physics FPS" - stat="simphysicsfps" - precision="1" - bar_min="0.f" - bar_max="45.f" - tick_spacing="7.5.f" - label_spacing="15.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_view - name="physicsdetail" - label="Physics Details" - show_label="true"> - <stat_bar - name="physicspinnedtasks" - label="Pinned Objects" - stat="physicspinnedtasks" - precision="0" - bar_min="0.f" - bar_max="500.f" - tick_spacing="50.f" - label_spacing="100.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="physicslodtasks" - label="Low LOD Objects" - stat="physicslodtasks" - precision="0" - bar_min="0.f" - bar_max="500.f" - tick_spacing="50.f" - label_spacing="100.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="physicsmemoryallocated" - label="Memory Allocated" - stat="physicsmemoryallocated" - unit_label="MB" - precision="1" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - </stat_view> - - <stat_bar - name="simagentups" - label="Agent Updates/Sec" - stat="simagentups" - precision="1" - bar_min="0.f" - bar_max="100.f" - tick_spacing="25.f" - label_spacing="50.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simmainagents" - label="Main Agents" - stat="simmainagents" - precision="0" - bar_min="0.f" - bar_max="80.f" - tick_spacing="10.f" - label_spacing="40.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simchildagents" - label="Child Agents" - stat="simchildagents" - precision="0" - bar_min="0.f" - bar_max="40.f" - tick_spacing="5.f" - label_spacing="10.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simobjects" - label="Objects" - stat="simobjects" - precision="0" - bar_min="0.f" - bar_max="30000.f" - tick_spacing="5000.f" - label_spacing="10000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simactiveobjects" - label="Active Objects" - stat="simactiveobjects" - precision="0" - bar_min="0.f" - bar_max="5000.f" - tick_spacing="750.f" - label_spacing="1250.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simactivescripts" - label="Active Scripts" - stat="simactivescripts" - precision="0" - bar_min="0.f" - bar_max="15000.f" - tick_spacing="1875.f" - label_spacing="3750.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simscripteps" - label="Script Events" - stat="simscripteps" - unit_label="eps" - precision="0" - bar_min="0.f" - bar_max="5000.f" - tick_spacing="750.f" - label_spacing="1250.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="siminpps" - label="Packets In" - stat="siminpps" - unit_label="pps" - precision="0" - bar_min="0.f" - bar_max="2000.f" - tick_spacing="250.f" - label_spacing="1000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simoutpps" - label="Packets Out" - stat="simoutpps" - unit_label="pps" - precision="0" - bar_min="0.f" - bar_max="2000.f" - tick_spacing="250.f" - label_spacing="1000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simpendingdownloads" - label="Pending Downloads" - stat="simpendingdownloads" - precision="0" - bar_min="0.f" - bar_max="800.f" - tick_spacing="100.f" - label_spacing="200.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simpendinguploads" - label="Pending Uploads" - stat="simpendinguploads" - precision="0" - bar_min="0.f" - bar_max="100.f" - tick_spacing="25.f" - label_spacing="50.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simtotalunackedbytes" - label="Total Unacked Bytes" - stat="simtotalunackedbytes" - unit_label="kb" - precision="1" - bar_min="0.f" - bar_max="100000.f" - tick_spacing="25000.f" - label_spacing="50000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_view - name="simperf" - label="Time (ms)" - show_label="true"> - <stat_bar - name="simframemsec" - label="Total Frame Time" - stat="simframemsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simnetmsec" - label="Net Time" - stat="simnetmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simsimphysicsmsec" - label="Physics Time" - stat="simsimphysicsmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simsimothermsec" - label="Simulation Time" - stat="simsimothermsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simagentmsec" - label="Agent Time" - stat="simagentmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simimagesmsec" - label="Images Time" - stat="simimagesmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simscriptmsec" - label="Script Time" - stat="simscriptmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> <stat_bar - name="simsparemsec" - label="Spare Time" - stat="simsparemsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > + name="simactiveobjects" + label="Active Objects" + stat="simactiveobjects" + precision="0" + bar_min="0.f" + bar_max="5000.f" + tick_spacing="750.f" + label_spacing="1250.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> - <!--2nd level time blocks under 'Details' second--> + + <stat_bar + name="simactivescripts" + label="Active Scripts" + stat="simactivescripts" + precision="0" + bar_min="0.f" + bar_max="15000.f" + tick_spacing="1875.f" + label_spacing="3750.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + <stat_bar + name="simpctscriptsrun" + label="Scripts Run" + unit_label=" %" + stat="simpctscriptsrun" + bar_min="0" + bar_max="100" + tick_spacing="10" + label_spacing="20" + precision="3" + show_per_sec="false" + show_bar="false" + show_mean="true"> + </stat_bar> + + <stat_bar + name="simscripteps" + label="Script Events" + stat="simscripteps" + unit_label="eps" + precision="0" + bar_min="0.f" + bar_max="5000.f" + tick_spacing="750.f" + label_spacing="1250.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_view + name="simpathfinding" + label="Pathfinding" + show_label="true"> + <stat_bar + name="simsimaistepmsec" + label=" AI Step Time" + stat="simsimaistepmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + <stat_bar + name="simsimskippedsilhouettesteps" + label=" Skipped Silhouette Steps" + stat="simsimskippedsilhouettesteps" + unit_label="/sec" + precision="0" + bar_min="0" + bar_max="45" + tick_spacing="4" + label_spacing="8" + show_per_sec="false" + show_bar="false"> + </stat_bar> + <stat_bar + name="simsimpctsteppedcharacters" + label=" Characters Updated" + unit_label=" %" + stat="simsimpctsteppedcharacters" + bar_min="0" + bar_max="100" + tick_spacing="10" + label_spacing="20" + precision="1" + show_per_sec="false" + show_bar="false" + show_mean="true"> + </stat_bar> + </stat_view> + + <stat_bar + name="siminpps" + label="Packets In" + stat="siminpps" + unit_label="pps" + precision="0" + bar_min="0.f" + bar_max="2000.f" + tick_spacing="250.f" + label_spacing="1000.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simoutpps" + label="Packets Out" + stat="simoutpps" + unit_label="pps" + precision="0" + bar_min="0.f" + bar_max="2000.f" + tick_spacing="250.f" + label_spacing="1000.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simpendingdownloads" + label="Pending Downloads" + stat="simpendingdownloads" + precision="0" + bar_min="0.f" + bar_max="800.f" + tick_spacing="100.f" + label_spacing="200.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simpendinguploads" + label="Pending Uploads" + stat="simpendinguploads" + precision="0" + bar_min="0.f" + bar_max="100.f" + tick_spacing="25.f" + label_spacing="50.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simtotalunackedbytes" + label="Total Unacked Bytes" + stat="simtotalunackedbytes" + unit_label="kb" + precision="1" + bar_min="0.f" + bar_max="100000.f" + tick_spacing="25000.f" + label_spacing="50000.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_view + name="simperf" + label="Time (ms)" + show_label="true"> + <stat_bar + name="simframemsec" + label="Total Frame Time" + stat="simframemsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simnetmsec" + label="Net Time" + stat="simnetmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simsimphysicsmsec" + label="Physics Time" + stat="simsimphysicsmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simsimothermsec" + label="Simulation Time" + stat="simsimothermsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simagentmsec" + label="Agent Time" + stat="simagentmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simimagesmsec" + label="Images Time" + stat="simimagesmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simscriptmsec" + label="Script Time" + stat="simscriptmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + + <stat_bar + name="simsparemsec" + label="Spare Time" + stat="simsparemsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > + </stat_bar> + <!--2nd level time blocks under 'Details' second--> <stat_view - name="timedetails" - label="Time Details (ms)" - show_label="true"> + name="timedetails" + label="Time Details (ms)" + show_label="true"> <stat_bar - name="simsimphysicsstepmsec" - label=" Physics Step" - stat="simsimphysicsstepmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > + name="simsimphysicsstepmsec" + label=" Physics Step" + stat="simsimphysicsstepmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> <stat_bar - name="simsimphysicsshapeupdatemsec" - label=" Update Phys Shapes" - stat="simsimphysicsshapeupdatemsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > + name="simsimphysicsshapeupdatemsec" + label=" Update Phys Shapes" + stat="simsimphysicsshapeupdatemsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> <stat_bar - name="simsimphysicsothermsec" - label=" Physics Other" - stat="simsimphysicsothermsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > + name="simsimphysicsothermsec" + label=" Physics Other" + stat="simsimphysicsothermsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> <stat_bar - name="simsleepmsec" - label=" Sleep Time" - stat="simsleepmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > + name="simsleepmsec" + label=" Sleep Time" + stat="simsleepmsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> <stat_bar - name="simpumpiomsec" - label=" Pump IO" - stat="simpumpiomsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > + name="simpumpiomsec" + label=" Pump IO" + stat="simpumpiomsec" + unit_label="ms" + precision="3" + bar_min="0.f" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_per_sec="false" + show_bar="false" + show_mean="false" > </stat_bar> - </stat_view> - </stat_view> - </stat_view> - </container_view> - </scroll_container> + </stat_view> + </stat_view> + </stat_view> + </container_view> + </scroll_container> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index e37740d20c..263e10aa1f 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -877,6 +877,14 @@ You can't modify these objects </panel.string> <panel.string + name="text modify info 5"> + You can't modify this object in frozen mode + </panel.string> + <panel.string + name="text modify info 6"> + You can't modify these objects in frozen mode + </panel.string> + <panel.string name="text modify warning"> You must select entire object to set permissions </panel.string> @@ -1355,15 +1363,31 @@ even though the user gets a free copy. tool_tip="Causes object to not collide with other objects or avatars" top_pad="0" width="123" /> + <check_box + height="19" + enabled="false" + label="Permanent" + layout="topleft" + name="Permanent Checkbox Ctrl" + top_pad="0" + width="123" /> + <check_box + height="19" + enabled="false" + label="Character" + layout="topleft" + name="Character Checkbox Ctrl" + top_pad="0" + width="123" /> - <text + <text type="string" length="1" follows="left|top" height="10" layout="topleft" name="label position" - top_pad="10" + top_pad="5" width="121"> Position (meters) </text> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 5ba566b175..ad02beff7a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -937,7 +937,51 @@ </menu_item_call> </menu> - <menu_item_separator/> + <menu + create_jump_keys="true" + label="Pathfinding" + name="Pathfinding" + tear_off="false"> + <menu_item_call + label="Basic setup..." + name="pathfinding_basic_menu_item"> + <menu_item_call.on_click + function="Floater.ToggleOrBringToFront" + parameter="pathfinding_basic" /> + <menu_item_call.on_enable + function="Tools.EnablePathfinding" /> + </menu_item_call> + <menu_item_call + label="Edit / test..." + name="pathfinding_console_menu_item"> + <menu_item_call.on_click + function="Floater.ToggleOrBringToFront" + parameter="pathfinding_console" /> + <menu_item_call.on_enable + function="Tools.EnablePathfinding" /> + </menu_item_call> + <menu_item_call + label="Linksets..." + name="pathfinding_linksets_menu_item"> + <menu_item_call.on_click + function="Floater.ToggleOrBringToFront" + parameter="pathfinding_linksets" /> + <menu_item_call.on_enable + function="Tools.EnablePathfindingLinksets" /> + </menu_item_call> + <menu_item_call + label="Characters..." + name="pathfinding_characters_menu_item"> + <menu_item_call.on_click + function="Floater.ToggleOrBringToFront" + parameter="pathfinding_characters" /> + <menu_item_call.on_enable + function="Tools.EnablePathfinding" /> + </menu_item_call> + </menu> + + + <menu_item_separator/> <menu create_jump_keys="true" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 590707fceb..38e041fa20 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -77,6 +77,21 @@ </form> </template> + <template name="okhelpignore"> + <form> + <button + default="true" + index="0" + name="OK_okhelpignore" + text="$yestext"/> + <button + index="1" + name="Help_okhelpignore" + text="$helptext"/> + <ignore text="$ignoretext"/> + </form> + </template> + <template name="yesnocancelbuttons"> <form> <button @@ -1285,6 +1300,33 @@ The region [REGION] does not allow terraforming. <notification icon="alertmodal.tga" + name="RegionNoTerraformingWhileFrozen" + type="alertmodal"> + You cannot terraform land while in Frozen mode. Please switch to Unfrozen mode from the menu option Build->Pathfinding->Basic Setup. + <tag>fail</tag> + </notification> + + <notification + icon="alertmodal.tga" + name="AutomaticAgentStateUnfreeze" + type="alertmodal"> +You have automatically switched into Unfrozen mode because of one of the following reasons: + +- You rezzed an object marked as permanent +- You returned an object marked as permanent + +After you finish modifying your permanent objects, please remember to switch back to Frozen mode from the menu option Build->Pathfinding->Basic Setup. + <tag>confirm</tag> + <usetemplate + name="okhelpignore" + yestext="OK" + helptext="More Info" + ignoretext="Launch browser to view pathfinding help" + /> + </notification> + + <notification + icon="alertmodal.tga" name="CannotCopyWarning" type="alertmodal"> You do not have permission to copy the following items: @@ -1489,6 +1531,16 @@ Please make sure none are locked, and that you own all of them. <notification icon="alertmodal.tga" + name="CannotLinkPermanent" + type="alertmodal"> +Unable to link permanent objects in frozen mode. + +Please switch to unfrozen mode from the menu option Build->Pathfinding->Basic Setup. + <tag>fail</tag> + </notification> + + <notification + icon="alertmodal.tga" name="CannotLinkDifferentOwners" type="alertmodal"> Unable to link because not all of the objects have the same owner. @@ -7670,7 +7722,60 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' notext="Cancel" ignoretext="Confirm before hiding UI"/> </notification> - + + <notification + icon="alertmodal.tga" + name="PathfindingLinksets_SetLinksetUseMismatchOnRestricted" + type="alertmodal"> + Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead. + <tag>confirm</tag> + <usetemplate + ignoretext="Do you wish to proceed?" + name="okcancelignore" + notext="Cancel" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="PathfindingLinksets_SetLinksetUseMismatchOnVolume" + type="alertmodal"> + Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of the shape is non-convex. + <tag>confirm</tag> + <usetemplate + ignoretext="Do you wish to proceed?" + name="okcancelignore" + notext="Cancel" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="PathfindingLinksets_SetLinksetUseMismatchOnRestrictedAndVolume" + type="alertmodal"> + Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead. + Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of the shape is non-convex. These linksets use types will not change. + <tag>confirm</tag> + <usetemplate + ignoretext="Do you wish to proceed?" + name="okcancelignore" + notext="Cancel" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="PathfindingLinksets_ChangeToFlexiblePath" + type="alertmodal"> + The selected object is marked as permanent and is included in the navmesh. Setting the object to be a Flexible Path will unset the permanent value and remove the object from the navmesh. Do you wish to proceed? + <tag>confirm</tag> + <usetemplate + ignoretext="Do you wish to proceed?" + name="okcancelignore" + notext="Cancel" + yestext="OK"/> + </notification> + <global name="UnsupportedGLRequirements"> You do not appear to have the proper hardware requirements for [APP_NAME]. [APP_NAME] requires an OpenGL graphics card that has multitexture support. If this is the case, you may want to make sure that you have the latest drivers for your graphics card, and service packs and patches for your operating system. diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml index 6600339ad7..8a823e8278 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml @@ -31,6 +31,14 @@ You can't modify these objects </panel.string> <panel.string + name="text modify info 5"> + You can't modify this object in frozen mode + </panel.string> + <panel.string + name="text modify info 6"> + You can't modify these objects in frozen mode + </panel.string> + <panel.string name="text modify warning"> This object has linked parts </panel.string> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 4ccec4838a..84532c4c2b 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -670,7 +670,7 @@ Sets the texture u & v scales for the chosen face or ALL_SIDES </string> <string name="LSLTipText_llOffsetTexture" translate="false"> llOffsetTexture(float u, float v, integer face) -Sets the texture u & v offsets for the chosen face or ALL_SIDES +Sets the texture u & v offsets for the chosen face or ALL_SIDES </string> <string name="LSLTipText_llRotateTexture" translate="false"> llRotateTexture(float rotation, integer face) @@ -788,9 +788,9 @@ Sets the script timer to zero float llGetAndResetTime() Returns the script time in seconds and then resets the script timer to zero </string> - <string name="LSLTipText_llSoplayund" translate="false"> + <string name="LSLTipText_llSound" translate="false"> llSound(string sound, float volume, integer queue, integer loop) -Plays sound at volume and whether it should loop or not +Plays sound at volume and whether it should loop or not. </string> <string name="LSLTipText_llPlaySound" translate="false"> llPlaySound(string sound, float volume) @@ -1666,7 +1666,7 @@ Returns a list containing results of the sent query </string> <string name="LSLTipText_llModPow" translate="false"> integer llModPow(integer a, integer b, integer c) -Returns a raised to the b power, mod c. ( (a**b)%c ) +Returns a raised to the b power, mod c. ( (a**b)%c ) b is capped at 0xFFFF (16 bits). </string> <string name="LSLTipText_llGetInventoryType" translate="false"> @@ -1779,10 +1779,10 @@ integer llGetParcelMaxPrims(vector pos, integer sim_wide) Returns the maximum number of prims allowed on the parcel at pos </string> <string name="LSLTipText_llGetParcelDetails" translate="false"> - list llGetParcelDetails(vector pos, list params) - Returns the parcel details specified in params for the parcel at pos. - Params is one or more of: PARCEL_DETAILS_NAME, _DESC, _OWNER, _GROUP, _AREA, _ID, _SEE_AVATARS - </string> +list llGetParcelDetails(vector pos, list params) +Returns the parcel details specified in params for the parcel at pos. +Params is one or more of: PARCEL_DETAILS_NAME, _DESC, _OWNER, _GROUP, _AREA, _ID, _SEE_AVATARS + </string> <string name="LSLTipText_llSetLinkPrimitiveParams" translate="false"> llSetLinkPrimitiveParams(integer linknumber, list rules) Sets primitive parameters for linknumber based on rules @@ -1871,71 +1871,202 @@ Releases the specified URL, it will no longer be usable <string name="LSLTipText_llHTTPResponse" translate="false"> llHTTPResponse(key request_id, integer status, string body) Responds to request_id with status and body - </string> + </string> <string name="LSLTipText_llGetHTTPHeader" translate="false"> string llGetHTTPHeader(key request_id, string header) Returns the value for header for request_id </string> - <string name="LSLTipText_llSetPrimMediaParams" translate="false"> + <string name="LSLTipText_llSetPrimMediaParams" translate="false"> llSetPrimMediaParams(integer face, list params) Sets the media params for a particular face on an object. If media is not already on this object, add it. List is a set of name/value pairs in no particular order. Params not specified are unchanged, or if new media is added then set to the default specified. The possible names are below, along with the types of values and what they mean. - </string> - <string name="LSLTipText_llGetPrimMediaParams" translate="false"> + </string> + <string name="LSLTipText_llGetPrimMediaParams" translate="false"> list llGetPrimMediaParams(integer face, list params) Returns the media params for a particular face on an object, given the desired list of names, in the order requested. (Returns an empty list if no media exists on the face.) - </string> - <string name="LSLTipText_llClearPrimMedia" translate="false"> + </string> + <string name="LSLTipText_llClearPrimMedia" translate="false"> llClearPrimMedia(integer face) Clears (deletes) the media and all params from the given face. - </string> -<string name="LSLTipText_llSetLinkPrimitiveParamsFast" translate="false"> + </string> + <string name="LSLTipText_llSetLinkPrimitiveParamsFast" translate="false"> llSetLinkPrimitiveParamsFast(integer linknumber,list rules) Set primitive parameters for linknumber based on rules. -</string> -<string name="LSLTipText_llGetLinkPrimitiveParams" translate="false"> + </string> + <string name="LSLTipText_llGetLinkPrimitiveParams" translate="false"> llGetLinkPrimitiveParams(integer linknumber,list rules) Get primitive parameters for linknumber based on rules. -</string> -<string name="LSLTipText_llLinkParticleSystem" translate="false"> + </string> + <string name="LSLTipText_llLinkParticleSystem" translate="false"> llLinkParticleSystem(integer linknumber,list rules) Creates a particle system based on rules. Empty list removes particle system from object. List format is [ rule1, data1, rule2, data2 . . . rulen, datan ]. -</string> -<string name="LSLTipText_llSetLinkTextureAnim" translate="false"> + </string> + <string name="LSLTipText_llSetLinkTextureAnim" translate="false"> llSetLinkTextureAnim(integer link, integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate) -Animate the texture on the specified prim's face/faces. -</string> -<string name="LSLTipText_llGetLinkNumberOfSides" translate="false"> +Animate the texture on the specified prim's face/faces. + </string> + <string name="LSLTipText_llGetLinkNumberOfSides" translate="false"> integer llGetLinkNumberOfSides(integer link) Returns the number of sides of the specified linked prim. -</string> -<string name="LSLTipText_llGetUsername" translate="false"> + </string> + <string name="LSLTipText_llGetUsername" translate="false"> string llGetUsername(key id) Returns the single-word username of an avatar, iff the avatar is in the current region, otherwise the empty string. -</string> -<string name="LSLTipText_llRequestUsername" translate="false"> + </string> + <string name="LSLTipText_llRequestUsername" translate="false"> key llRequestUsername(key id) Requests single-word username of an avatar. When data is available the dataserver event will be raised. -</string> -<string name="LSLTipText_llGetDisplayName" translate="false"> - string llGetDisplayName(key id) - Returns the name of an avatar, iff the avatar is in the current simulator, and the name has been cached, otherwise the same as llGetUsername. Use llRequestDisplayName if you absolutely must have the display name. -</string> -<string name="LSLTipText_llRequestDisplayName" translate="false"> + </string> + <string name="LSLTipText_llGetDisplayName" translate="false"> +string llGetDisplayName(key id) +Returns the name of an avatar, iff the avatar is in the current simulator, and the name has been cached, otherwise the same as llGetUsername. Use llRequestDisplayName if you absolutely must have the display name. + </string> + <string name="LSLTipText_llRequestDisplayName" translate="false"> key llRequestDisplayName(key id) Requests name of an avatar. When data is available the dataserver event will be raised. -</string> -<string name="LSLTipText_llRegionSayTo" translate="false"> -llRegionSayTo(key target, integer channel, string msg) -Sends msg on channel (not DEBUG_CHANNEL) directly to prim or avatar target anywhere within the region -</string> -<string name="LSLTipText_llGetEnv" translate="false"> + </string> + <string name="LSLTipText_llGetEnv" translate="false"> llGetEnv(string name) Returns a string with the requested data about the region -</string> + </string> + <string name="LSLTipText_llCastRay" translate="false"> +llCastRay(vector start, vector end, list params) +Casts a ray into the physics world from 'start' to 'end' and returns data according to details in params. + </string> + <string name="LSLTipText_llRegionSayTo" translate="false"> +llRegionSayTo(key target, integer channel, string msg) +Sends msg on channel (not DEBUG_CHANNEL) directly to prim or avatar target anywhere within the region. + </string> + <string name="LSLTipText_llGetSPMaxMemory" translate="false"> +integer llGetSPMaxMemory() +Returns the maximum used memory for the current script. Only valid after using PROFILE_SCRIPT_MEMORY. Non-mono scripts always use 16k. + </string> + <string name="LSLTipText_llGetUsedMemory" translate="false"> +integer llGetUsedMemory() +Returns the current used memory for the current script. Non-mono scripts always use 16k. + </string> + <string name="LSLTipText_llScriptProfiler" translate="false"> +llScriptProfiler(integer flags) +Enabled or disables script profiling options. Currently only supports PROFILE_SCRIPT_MEMORY (mono only) and PROFILE_NONE. +MAY SIGNIFICANTLY REDUCE SCRIPT PERFORMANCE! + </string> + <string name="LSLTipText_llSetMemoryLimit" translate="false"> +integer llSetMemoryLimit(integer mem) + </string> + <string name="LSLTipText_llGetMemoryLimit" translate="false"> +integer llGetMemoryLimit() + </string> + <string name="LSLTipText_llSetLinkMedia" translate="false"> +llSetLinkMedia(integer link, integer face, list params) +Set the media params for a particular face on linked prim. List is a set of name/value pairs (in no particular order). The possible names are below, along with the types of values and what they mean. If media is not already on this object, add it. Params not specified are unchanged, or if new media is added set to the default specified. + </string> + <string name="LSLTipText_llGetLinkMedia" translate="false"> +list llGetLinkMedia(integer link, integer face, list params) +Get the media params for a particular face on linked prim, given the desired list of names. Returns a list of values in the order requested. Returns an empty list if no media exists on the face. + </string> + <string name="LSLTipText_llClearLinkMedia" translate="false"> +llClearLinkMedia(integer link, integer face) +Clears (deletes) the media and all params from the given face on linked prim. + </string> + <string name="LSLTipText_llSetContentType" translate="false"> +llSetContentType(key id, integer content_type) + </string> + <string name="LSLTipText_llLinkSitTarget" translate="false"> +llLinkSitTarget(integer link, vector offset, rotation rot) +Set the sit location for this object (if offset == <0,0,0> clear it) + </string> + <string name="LSLTipText_llAvatarOnLinkSitTarget" translate="false"> +key llAvatarOnLinkSitTarget(integer link) +If an avatar is sitting on the sit target, return the avatar's key, NULL_KEY otherwise + </string> + <string name="LSLTipText_llSetLinkCamera" translate="false"> +llSetLinkCamera(integer link, vector eye, vector at) + </string> + <string name="LSLTipText_llSetVelocity" translate="false"> +llSetVelocity(vector velocity, integer local) +Sets an objects velocity, in local coords if local == TRUE (if the script is physical) + </string> + <string name="LSLTipText_llSetAngularVelocity" translate="false"> +llSetAngularVelocity(vector angular_velocity, integer local) +Sets an objects angular velocity, in local coords if local == TRUE (if the script is physical) + </string> + <string name="LSLTipText_llSetPhysicsMaterial" translate="false"> +llSetPhysicsMaterial(integer flags, float gravity_multiplier, float restitution, float friction, float density ) +Sets the requested attributes of the root object's physics material. + </string> + <string name="LSLTipText_llGetPhysicsMaterial" translate="false"> +llGetPhysicsMaterial() returns the gravity multiplier, restitution, friction, and density of the linkset as a list in that order. + </string> + <string name="LSLTipText_llGetMassMKS" translate="false"> +llGetMassMKS() returns the mass of the linkset in kilograms. + </string> + <string name="LSLTipText_llGenerateKey" translate="false"> +llGenerateKey() +Retun a unique generated key + </string> + <string name="LSLTipText_llSetKeyframedMotion" translate="false"> +llSetKeyframedMotion(list keyframes, list options) +Requests that a nonphysical object be keyframed according to keyframe list. + </string> + <string name="LSLTipText_llTransferLindenDollars" translate="false"> +key llTransferLindenDollars(key destination, integer amount) +Transfer amount of linden dollars (L$) from script owner to destination. Returns a key to a corresponding transaction_result event for the success of the transfer. + </string> + <string name="LSLTipText_llGetParcelMusicURL" translate="false"> +string llGetParcelMusicURL() +Gets the streaming audio URL for the parcel of land on which the object is located. + </string> + <string name="LSLTipText_llSetRegionPos" translate="false"> +integer llSetRegionPos(vector pos) +Sets the position anywhere within the region (if the object isn't physical) + </string> + <string name="LSLTipText_llNavigateTo" translate="false"> +llNavigateTo(vector point, list options) +For AI Character: Navigate to destination. + </string> + <string name="LSLTipText_llCreateCharacter" translate="false"> +llCreateCharacter(list options) +Convert linkset to AI Character which can navigate the world. + </string> + <string name="LSLTipText_llPursue" translate="false"> +llPursue(key target, list options) +For AI Character: Chase after a target. + </string> + <string name="LSLTipText_llWanderWithin" translate="false"> +llWanderWithin(vector center, float radius, list options) +For AI Character: Wander within a specified volume. + </string> + <string name="LSLTipText_llFleeFrom" translate="false"> +llFleeFrom(vector source, float radius, list options) +For AI Character: Flee from a point. + </string> + <string name="LSLTipText_llPatrolPoints" translate="false"> +llPatrolPoints(list points, list options) +For AI Character: Patrol a list of points. + </string> + <string name="LSLTipText_llExecCharacterCmd" translate="false"> +llExecCharacterCmd(integer cmd, list options) +For AI Character: Execute a character command. + </string> + <string name="LSLTipText_llDeleteCharacter" translate="false"> +llDeleteCharacter() +Convert linkset from AI Character to Physics object. + </string> + <string name="LSLTipText_llUpdateCharacter" translate="false"> +llUpdateCharacter(list options) +Change the AI Character's settings. + </string> + <string name="LSLTipText_llEvade" translate="false"> +llEvade(key target, list options) +For AI Character: Evade a specified target. + </string> + <string name="LSLTipText_llGetClosestNavPoint" translate="false"> +list llGetClosestNavPoint(vector point, list options) +For AI Character: Get the closest navigable point to the point provided. + </string> <!-- Avatar busy/away mode --> @@ -3699,7 +3830,11 @@ Try enclosing path to the editor with double quotes. <string name="Command_MiniMap_Label">Mini-map</string> <string name="Command_Move_Label">Walk / run / fly</string> <string name="Command_Outbox_Label">Merchant outbox</string> + <string name="Command_Pathfinding_Label">Pathfinding</string> <string name="Command_People_Label">People</string> + <string name="Command_PF_Basic_Label">Pathfinding Basic</string> + <string name="Command_PF_Characters_Label">Pathfinding Characters</string> + <string name="Command_PF_Linksets_Label">Pathfinding Linksets</string> <string name="Command_Picks_Label">Picks</string> <string name="Command_Places_Label">Places</string> <string name="Command_Preferences_Label">Preferences</string> @@ -3725,7 +3860,11 @@ Try enclosing path to the editor with double quotes. <string name="Command_MiniMap_Tooltip">Show nearby people</string> <string name="Command_Move_Tooltip">Moving your avatar</string> <string name="Command_Outbox_Tooltip">Transfer items to your marketplace for sale</string> + <string name="Command_Pathfinding_Tooltip">Information about pathfinding</string> <string name="Command_People_Tooltip">Friends, groups, and nearby people</string> + <string name="Command_PF_Basic_Tooltip">Manipulation of pathfinding frozen/unfrozen state</string> + <string name="Command_PF_Characters_Tooltip">Manipulation of pathfinding characters</string> + <string name="Command_PF_Linksets_Tooltip">Manipulation of pathfinding linksets</string> <string name="Command_Picks_Tooltip">Places to show as favorites in your profile</string> <string name="Command_Places_Tooltip">Places you've saved</string> <string name="Command_Preferences_Tooltip">Preferences</string> @@ -3750,6 +3889,9 @@ Try enclosing path to the editor with double quotes. <string name="Preview">Preview</string> <string name="Normal">Normal</string> + <!-- Pathfinding --> + <string name="Pathfinding_Wiki_URL">http://wiki.secondlife.com/wiki/Pathfinding_Tools_in_the_Second_Life_Viewer</string> + <!-- Snapshot image quality levels --> <string name="snapshot_quality_very_low">Very Low</string> <string name="snapshot_quality_low">Low</string> diff --git a/package_physicsextensions.sh b/package_physicsextensions.sh new file mode 100755 index 0000000000..5b4c23ecc9 --- /dev/null +++ b/package_physicsextensions.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +# turn on verbose debugging output for parabuild logs. +set -x +# make errors fatal +set -e + +if [ -z "$AUTOBUILD" ] ; then + fail +fi + +if [ "$OSTYPE" = "cygwin" ] ; then + export AUTOBUILD="$(cygpath -u $AUTOBUILD)" +fi + +# load autbuild provided shell functions and variables +eval "$("$AUTOBUILD" source_environment)" + +projectDir="$(pwd)" + +#directories we need the headers from +projects="llcommon llimage llmath llrender" + +source="$projectDir/indra" + +stage="$projectDir/stage/include" +mkdir -p $stage + +for project in $projects +do + dstIncludeDir="$stage/$project" + mkdir -p $dstIncludeDir + headers="$source/$project/*.h" + cp $headers "$dstIncludeDir" + headers="$source/$project/*.inl" + # not all projects have .inl files + files=$(ls $headers 2> /dev/null | wc -l) + if [ "$files" != "0" ] ; then + cp $headers "$dstIncludeDir" + fi +done + +# Copy the license files into place for packaging +srcLicenseDir="$projectDir/doc" +dstLicenseDir="$projectDir/stage/LICENSES" + +mkdir -p "$dstLicenseDir" +cp "$srcLicenseDir/LGPL-licence.txt" "$dstLicenseDir/LGPL-licence.txt" + +pass diff --git a/package_physicsextensions.xml b/package_physicsextensions.xml new file mode 100644 index 0000000000..0bde6ad770 --- /dev/null +++ b/package_physicsextensions.xml @@ -0,0 +1,292 @@ +<?xml version="1.0" ?> +<llsd> +<map> + <key>package_description</key> + <map> + <key>description</key> + <string>include files referenced in the llphysicsextensions</string> + <key>license</key> + <string>LGPL</string> + <key>license_file</key> + <string>LICENSES/LGPL-licence.txt</string> + <key>name</key> + <string>pathfinding_includes</string> + <key>platforms</key> + <map> + <key>common</key> + <map> + <key>build_directory</key> + <string>stage</string> + <key>configurations</key> + <map> + <key>Debug</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>True</string> + <key>name</key> + <string>Debug</string> + </map> + <key>Release</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>True</string> + <key>name</key> + <string>Release</string> + </map> + <key>RelWithDebInfo</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>True</string> + <key>name</key> + <string>RelWithDebInfo</string> + </map> + </map> + <key>name</key> + <string>common</string> + </map> + <key>darwin</key> + <map> + <key>build_directory</key> + <string>stage</string> + <key>configurations</key> + <map> + <key>Debug</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>manifest</key> + <array> + <string>include/</string> + <string>LICENSES</string> + </array> + <key>name</key> + <string>Debug</string> + </map> + <key>Release</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>manifest</key> + <array> + <string>include/</string> + <string>LICENSES</string> + </array> + <key>name</key> + <string>Release</string> + </map> + <key>RelWithDebInfo</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>manifest</key> + <array> + <string>include/</string> + <string>LICENSES</string> + </array> + <key>name</key> + <string>RelWithDebInfo</string> + </map> + </map> + <key>name</key> + <string>darwin</string> + </map> + <key>linux</key> + <map> + <key>build_directory</key> + <string>stage</string> + <key>configurations</key> + <map> + <key>Debug</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>name</key> + <string>Debug</string> + </map> + <key>Release</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>name</key> + <string>Release</string> + </map> + <key>RelWithDebInfo</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>name</key> + <string>RelWithDebInfo</string> + </map> + </map> + <key>manifest</key> + <array> + <string>include</string> + <string>LICENSES</string> + </array> + <key>name</key> + <string>linux</string> + </map> + <key>windows</key> + <map> + <key>build_directory</key> + <string>stage</string> + <key>configurations</key> + <map> + <key>Debug</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>manifest</key> + <array> + <string>include/</string> + <string>LICENSES</string> + </array> + <key>name</key> + <string>Debug</string> + </map> + <key>Release</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>manifest</key> + <array> + <string>include/</string> + <string>LICENSES</string> + </array> + <key>name</key> + <string>Release</string> + </map> + <key>RelWithDebInfo</key> + <map> + <key>build</key> + <map> + <key>command</key> + <string>bash</string> + <key>options</key> + <array> + <string>-c ../package_physicsextensions.sh</string> + </array> + </map> + <key>default</key> + <string>true</string> + <key>manifest</key> + <array> + <string>include/</string> + <string>LICENSES</string> + </array> + <key>name</key> + <string>RelWithDebInfo</string> + </map> + </map> + <key>name</key> + <string>windows</string> + </map> + </map> + <key>version</key> + <string>1.0</string> + </map> + <key>type</key> + <string>autobuild</string> + <key>version</key> + <string>1.2</string> + </map> +</llsd> |