diff --git a/etc/message.xml b/etc/message.xml index 330ecee48..42bbef035 100644 --- a/etc/message.xml +++ b/etc/message.xml @@ -50,7 +50,7 @@ OpenCircuit flavor - template + llsd trusted-sender false @@ -370,6 +370,14 @@ + DisplayNameUpdate + + flavor + llsd + trusted-sender + true + + ParcelVoiceInfo flavor @@ -419,6 +427,22 @@ true + SetDisplayNameReply + + flavor + llsd + trusted-sender + true + + + SimConsoleResponse + + flavor + llsd + trusted-sender + true + + DirLandReply flavor @@ -515,8 +539,24 @@ trusted-sender true - - + + NavMeshStatusUpdate + + flavor + llsd + trusted-sender + true + + + AgentStateUpdate + + flavor + llsd + trusted-sender + true + + + ScriptRunningReply flavor @@ -569,26 +609,9 @@ flavor llsd - trusted-sender - true - - - - DisplayNameUpdate - - flavor - llsd - trusted-sender - true - - - SetDisplayNameReply - - flavor - llsd - trusted-sender - true - + trusted-sender + true + capBans diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index 3ec482baf..5f86c3509 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -76,7 +76,6 @@ if (VIEWER) add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger) add_subdirectory(${LIBS_OPEN_PREFIX}llplugin) add_subdirectory(${LIBS_OPEN_PREFIX}llui) - add_subdirectory(${LIBS_OPEN_PREFIX}llxuixml) # viewer plugins directory add_subdirectory(${LIBS_OPEN_PREFIX}plugins) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 9006b2247..5c0d433be 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -190,10 +190,10 @@ if (LINUX) endif (NOT STANDALONE) if (${ARCH} STREQUAL "x86_64") add_definitions(-DLINUX64=1 -pipe) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math") else (${ARCH} STREQUAL "x86_64") if (NOT STANDALONE) set(MARCH_FLAG " -march=pentium4") @@ -327,7 +327,7 @@ else (STANDALONE) glib-2.0 gstreamer-0.10 gtk-2.0 - llfreetype2 + freetype2 pango-1.0 ) endif (STANDALONE) diff --git a/indra/cmake/LLXUIXML.cmake b/indra/cmake/LLXUIXML.cmake deleted file mode 100644 index b8bfe48c7..000000000 --- a/indra/cmake/LLXUIXML.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLXUIXML_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llxuixml - ) - -set(LLXUIXML_LIBRARIES llxuixml) diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake index 269b54de7..011b87f64 100644 --- a/indra/cmake/PNG.cmake +++ b/indra/cmake/PNG.cmake @@ -15,5 +15,5 @@ else (STANDALONE) else(LINUX) set(PNG_LIBRARIES png15) endif() - set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libpng15) + set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/) endif (STANDALONE) diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index c80b71688..77c7fd6d7 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -43,11 +43,11 @@ #include "lluuid.h" #include "llframetimer.h" #include "llassettype.h" +#include "llextendedstatus.h" #include "lllistener.h" const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; -const F32 LL_ROLLOFF_MULTIPLIER_UNDER_WATER = 5.f; // How much sounds are weaker under water const F32 LL_WIND_UNDERWATER_CENTER_FREQ = 20.f; const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f; diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index d57ef7f3a..ba2b6615c 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -72,6 +72,8 @@ bool attemptDelayLoad() FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels); +FMOD::ChannelGroup *LLAudioEngine_FMODEX::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; + LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler) { mInited = false; @@ -130,9 +132,9 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata) LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL; - result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE); - if(Check_FMOD_Error(result, "FMOD::Memory_Initialize")) - return false; + //result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE); + //if(Check_FMOD_Error(result, "FMOD::Memory_Initialize")) + // return false; result = FMOD::System_Create(&mSystem); if(Check_FMOD_Error(result, "FMOD::System_Create")) @@ -159,7 +161,13 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata) U32 fmod_flags = FMOD_INIT_NORMAL; if(mEnableProfiler) + { fmod_flags |= FMOD_INIT_ENABLE_PROFILE; + mSystem->createChannelGroup("None", &mChannelGroups[AUDIO_TYPE_NONE]); + mSystem->createChannelGroup("SFX", &mChannelGroups[AUDIO_TYPE_SFX]); + mSystem->createChannelGroup("UI", &mChannelGroups[AUDIO_TYPE_UI]); + mSystem->createChannelGroup("Ambient", &mChannelGroups[AUDIO_TYPE_AMBIENT]); + } #if LL_LINUX bool audio_ok = false; @@ -604,6 +612,9 @@ void LLAudioChannelFMODEX::play() Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause"); getSource()->setPlayedOnce(true); + + if(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]) + mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]); } diff --git a/indra/llaudio/llaudioengine_fmodex.h b/indra/llaudio/llaudioengine_fmodex.h index f6f920e10..6b780128f 100644 --- a/indra/llaudio/llaudioengine_fmodex.h +++ b/indra/llaudio/llaudioengine_fmodex.h @@ -44,6 +44,7 @@ namespace FMOD { class System; class Channel; + class ChannelGroup; class Sound; class DSP; } @@ -83,6 +84,9 @@ protected: FMOD::DSP *mWindDSP; FMOD::System *mSystem; bool mEnableProfiler; + +public: + static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT]; }; diff --git a/indra/llaudio/lllistener_fmodex.cpp b/indra/llaudio/lllistener_fmodex.cpp index 43749e6b1..e70dc7c60 100644 --- a/indra/llaudio/lllistener_fmodex.cpp +++ b/indra/llaudio/lllistener_fmodex.cpp @@ -106,6 +106,15 @@ void LLListener_FMODEX::commitDeferredChanges() void LLListener_FMODEX::setRolloffFactor(F32 factor) { + //An internal FMODEx optimization skips 3D updates if there have not been changes to the 3D sound environment. + //Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well. + //In short: Changing the position ticks a dirtyflag inside fmodex, which makes it not skip 3D processing next update call. + if(mRolloffFactor != factor) + { + LLVector3 pos = mVelocity - LLVector3(0.f,0.f,.1f); + mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL); + mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mVelocity.mV, NULL, NULL, NULL); + } mRolloffFactor = factor; mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor); } diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp index fa7044e67..d4e52d340 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.cpp +++ b/indra/llaudio/llstreamingaudio_fmodex.cpp @@ -172,7 +172,6 @@ void LLStreamingAudio_FMODEX::update() if(mFMODInternetStreamChannelp) { - //llinfos << "progress = " << progress << llendl; if(!mMetaData) mMetaData = new LLSD; @@ -396,12 +395,12 @@ LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, con { mInternetStreamURL = url; - FMOD_CREATESOUNDEXINFO exinfo; + /*FMOD_CREATESOUNDEXINFO exinfo; memset(&exinfo,0,sizeof(exinfo)); exinfo.cbsize = sizeof(exinfo); - exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_MPEG; //Hint to speed up loading. + exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_OGGVORBIS; //Hint to speed up loading.*/ - FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, &exinfo, &mInternetStream); + FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, 0, &mInternetStream); if (result!= FMOD_OK) { @@ -484,4 +483,4 @@ void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuf settings.cbsize=sizeof(settings); settings.defaultDecodeBufferSize = decodebuffertime;//ms mSystem->setAdvancedSettings(&settings); -} \ No newline at end of file +} diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 85291530c..6818be493 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -38,7 +38,6 @@ #include "llcharacter.h" #include "llstring.h" -#include "llfasttimer.h" #define SKEL_HEADER "Linden Skeleton 1.0" @@ -194,19 +193,14 @@ void LLCharacter::requestStopMotion( LLMotion* motion) //----------------------------------------------------------------------------- // updateMotions() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation"); -static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); - void LLCharacter::updateMotions(e_update_t update_type) { if (update_type == HIDDEN_UPDATE) { - LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION); mMotionController.updateMotionsMinimal(); } else { - LLFastTimer t(FTM_UPDATE_ANIMATION); // unpause if the number of outstanding pause requests has dropped to the initial one if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1) { diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 9d12ee98d..0ee378f3b 100644 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -250,9 +250,9 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) head_rot_local = nlerp(head_slerp_amt, mLastHeadRot, head_rot_local); mLastHeadRot = head_rot_local; - if(mNeckState->getJoint() && mNeckState->getJoint()->getParent()) //Guess this has crashed? Taken from snowglobe -Shyotl + // Set the head rotation. + if(mNeckState->getJoint() && mNeckState->getJoint()->getParent()) { - // Set the head rotation. LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld; head_rot_local = head_rot_local * ~torsoRotLocal; mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) ); diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 3b7dbec33..d040a1a22 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -637,9 +637,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty motionp->fadeIn(); } - // ********************** + //********************** // MOTION INACTIVE - // ********************** + //********************** if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration()) { // this motion has gone on too long, deactivate it @@ -659,9 +659,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty } } - // ********************** + //********************** // MOTION EASE OUT - // ********************** + //********************** else if (motionp->isStopped() && mAnimTime > motionp->getStopTime()) { // is this the first iteration in the ease out phase? @@ -684,9 +684,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); } - // ********************** + //********************** // MOTION ACTIVE - // ********************** + //********************** else if (mAnimTime > motionp->mActivationTimestamp + motionp->getEaseInDuration()) { posep->setWeight(motionp->getFadeWeight()); @@ -707,9 +707,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); } - // ********************** + //********************** // MOTION EASE IN - // ********************** + //********************** else if (mAnimTime >= motionp->mActivationTimestamp) { if (mLastTime < motionp->mActivationTimestamp) @@ -837,6 +837,7 @@ void LLMotionController::updateMotions(bool force_update) } updateLoadingMotions(); + return; } diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index a70efa9dd..694e27f37 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -93,6 +93,7 @@ class LLVisualParam { public: typedef boost::function visual_param_mapper; + LLVisualParam(); virtual ~LLVisualParam(); diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index cf1e564ae..f7c64c146 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -54,6 +54,7 @@ set(llcommon_SOURCE_FILES llformat.cpp llframetimer.cpp llheartbeat.cpp + llinitparam.cpp llinstancetracker.cpp llindraconfigfile.cpp llliveappconfig.cpp @@ -173,6 +174,7 @@ set(llcommon_HEADER_FILES llheartbeat.h llhttpstatuscodes.h llindexedqueue.h + llinitparam.h llinstancetracker.h llindraconfigfile.h llkeythrottle.h @@ -214,6 +216,7 @@ set(llcommon_HEADER_FILES llsingleton.h llskiplist.h llskipmap.h + llsortedvector.h llstack.h llstacktrace.h llstat.h @@ -228,6 +231,7 @@ set(llcommon_HEADER_FILES llthreadsafequeue.h lltimer.h lltreeiterators.h + lltypeinfolookup.h lluri.h lluuid.h lluuidhashmap.h diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h index d486359c7..b6fdef4ca 100644 --- a/indra/llcommon/linden_common.h +++ b/indra/llcommon/linden_common.h @@ -33,6 +33,11 @@ #ifndef LL_LINDEN_COMMON_H #define LL_LINDEN_COMMON_H +// *NOTE: Please keep includes here to a minimum! +// +// Files included here are included in every library .cpp file and +// are not precompiled. + #include "cwdebug.h" #if defined(LL_WINDOWS) && defined(_DEBUG) @@ -55,34 +60,11 @@ #include #include -// Work around Microsoft compiler warnings in STL headers -#ifdef LL_WINDOWS -#pragma warning (disable : 4702) // unreachable code -#pragma warning (disable : 4244) // conversion from time_t to S32 -#endif // LL_WINDOWS - -// *TODO: Eliminate these, most library .cpp files don't need them. -// Add them to llviewerprecompiledheaders.h if necessary. -#include -#include -#include -#include - -#ifdef LL_WINDOWS -// Reenable warnings we disabled above -#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4 -// moved msvc warnings to llpreprocessor.h *TODO - delete this comment after merge conflicts are unlikely -brad -#endif // LL_WINDOWS - // Linden only libs in alpha-order other than stdtypes.h // *NOTE: Please keep includes here to a minimum, see above. #include "stdtypes.h" #include "lldefs.h" #include "llerror.h" -#include "llextendedstatus.h" -// Don't do this, adds 15K lines of header code to every library file. -//#include "llfasttimer.h" #include "llfile.h" -#include "llformat.h" #endif diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 88c64bde1..e0c24fc97 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -148,7 +148,7 @@ const char *LLAssetType::lookup(LLAssetType::EType asset_type) } // static -LLAssetType::EType LLAssetType::lookup( const char* name ) +LLAssetType::EType LLAssetType::lookup(const char* name) { return lookup(ll_safe_string(name)); } @@ -186,7 +186,7 @@ const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type) } // static -LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name ) +LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name) { return lookupHumanReadable(ll_safe_string(name)); } @@ -208,12 +208,9 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_ return AT_NONE; } -//NOTE: LLAssetType::lookupDragAndDropType & LLAssetType::generateDescriptionFor moved to newview/llviewerassettype.h - // static bool LLAssetType::lookupCanLink(EType asset_type) { - //Check that enabling all these other types as linkable doesn't break things. const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); const AssetEntry *entry = dict->lookup(asset_type); if (entry) @@ -221,9 +218,6 @@ bool LLAssetType::lookupCanLink(EType asset_type) return entry->mCanLink; } return false; - - /*return (asset_type == AT_CLOTHING || asset_type == AT_OBJECT || asset_type == AT_CATEGORY || - asset_type == AT_BODYPART || asset_type == AT_GESTURE);*/ } // static @@ -268,4 +262,3 @@ bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type) } return false; } - diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llcommon/llinitparam.cpp similarity index 100% rename from indra/llxuixml/llinitparam.cpp rename to indra/llcommon/llinitparam.cpp diff --git a/indra/llxuixml/llinitparam.h b/indra/llcommon/llinitparam.h similarity index 98% rename from indra/llxuixml/llinitparam.h rename to indra/llcommon/llinitparam.h index 7285d3c48..993f16d04 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -35,6 +35,7 @@ #include #include "llerror.h" +#include "llstl.h" namespace LLInitParam { @@ -205,20 +206,12 @@ namespace LLInitParam mutable std::string mValueName; }; - class Parser + class LL_COMMON_API Parser { LOG_CLASS(Parser); public: - struct CompareTypeID - { - bool operator()(const std::type_info* lhs, const std::type_info* rhs) const - { - return lhs->before(*rhs); - } - }; - typedef std::vector > name_stack_t; typedef std::pair name_stack_range_t; typedef std::vector possible_values_t; @@ -227,9 +220,9 @@ namespace LLInitParam typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); typedef boost::function parser_inspect_func_t; - typedef std::map parser_read_func_map_t; - typedef std::map parser_write_func_map_t; - typedef std::map parser_inspect_func_map_t; + typedef std::map parser_read_func_map_t; + typedef std::map parser_write_func_map_t; + typedef std::map parser_inspect_func_map_t; Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) : mParseSilently(false), @@ -301,7 +294,7 @@ namespace LLInitParam class Param; // various callbacks and constraints associated with an individual param - struct ParamDescriptor + struct LL_COMMON_API ParamDescriptor { struct UserData { @@ -341,7 +334,7 @@ namespace LLInitParam typedef boost::shared_ptr ParamDescriptorPtr; // each derived Block class keeps a static data structure maintaining offsets to various params - class BlockDescriptor + class LL_COMMON_API BlockDescriptor { public: BlockDescriptor(); @@ -369,7 +362,7 @@ namespace LLInitParam class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed }; - class BaseBlock + class LL_COMMON_API BaseBlock { public: //TODO: implement in terms of owned_ptr @@ -566,7 +559,7 @@ namespace LLInitParam static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { return !a.empty() || !b.empty(); } }; - class Param + class LL_COMMON_API Param { public: void setProvided(bool is_provided = true) @@ -1253,15 +1246,16 @@ namespace LLInitParam return mValues.back(); } - void add(const value_t& item) + self_t& add(const value_t& item) { param_value_t param_value; param_value.setValue(item); mValues.push_back(param_value); setProvided(); + return *this; } - void add(const typename name_value_lookup_t::name_t& name) + self_t& add(const typename name_value_lookup_t::name_t& name) { value_t value; @@ -1271,6 +1265,8 @@ namespace LLInitParam add(value); mValues.back().setValueName(name); } + + return *this; } // implicit conversion @@ -1441,13 +1437,14 @@ namespace LLInitParam return mValues.back(); } - void add(const value_t& item) + self_t& add(const value_t& item) { mValues.push_back(item); setProvided(); + return *this; } - void add(const typename name_value_lookup_t::name_t& name) + self_t& add(const typename name_value_lookup_t::name_t& name) { value_t value; @@ -1457,6 +1454,7 @@ namespace LLInitParam add(value); mValues.back().setValueName(name); } + return *this; } // implicit conversion @@ -2057,8 +2055,8 @@ namespace LLInitParam // block param interface - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; + LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); + LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const { //TODO: implement LLSD params as schema type Any diff --git a/indra/llcommon/llkeythrottle.h b/indra/llcommon/llkeythrottle.h index 4ac689163..7544ab1d1 100644 --- a/indra/llcommon/llkeythrottle.h +++ b/indra/llcommon/llkeythrottle.h @@ -174,6 +174,7 @@ public: F64 averageCount = curr.count + prevCount * (1.0 - timeInCurrent); return averageCount; } + // call each time the key wants use State noteAction(const T& id, S32 weight = 1) { diff --git a/indra/llcommon/lllslconstants.h b/indra/llcommon/lllslconstants.h index 06af6dd29..42aaad985 100644 --- a/indra/llcommon/lllslconstants.h +++ b/indra/llcommon/lllslconstants.h @@ -73,6 +73,15 @@ const S32 LSL_PRIM_TEXGEN = 22; const S32 LSL_PRIM_POINT_LIGHT = 23; const S32 LSL_PRIM_CAST_SHADOWS = 24; const S32 LSL_PRIM_GLOW = 25; +const S32 LSL_PRIM_TEXT = 26; +const S32 LSL_PRIM_NAME = 27; +const S32 LSL_PRIM_DESC = 28; +const S32 LSL_PRIM_ROT_LOCAL = 29; +const S32 LSL_PRIM_PHYSICS_SHAPE_TYPE = 30; +const S32 LSL_PRIM_OMEGA = 32; +const S32 LSL_PRIM_POS_LOCAL = 33; +const S32 LSL_PRIM_LINK_TARGET = 34; +const S32 LSL_PRIM_SLICE = 35; const S32 LSL_PRIM_TYPE_BOX = 0; const S32 LSL_PRIM_TYPE_CYLINDER= 1; @@ -132,6 +141,15 @@ const S32 LSL_PRIM_SCULPT_TYPE_MASK = 7; const S32 LSL_PRIM_SCULPT_FLAG_INVERT = 64; const S32 LSL_PRIM_SCULPT_FLAG_MIRROR = 128; +const S32 LSL_PRIM_PHYSICS_SHAPE_PRIM = 0; +const S32 LSL_PRIM_PHYSICS_SHAPE_NONE = 1; +const S32 LSL_PRIM_PHYSICS_SHAPE_CONVEX = 2; + +const S32 LSL_DENSITY = 1; +const S32 LSL_FRICTION = 2; +const S32 LSL_RESTITUTION = 4; +const S32 LSL_GRAVITY_MULTIPLIER = 8; + const S32 LSL_ALL_SIDES = -1; const S32 LSL_LINK_ROOT = 1; const S32 LSL_LINK_FIRST_CHILD = 2; @@ -189,6 +207,13 @@ const S32 OBJECT_RUNNING_SCRIPT_COUNT = 9; const S32 OBJECT_TOTAL_SCRIPT_COUNT = 10; const S32 OBJECT_SCRIPT_MEMORY = 11; const S32 OBJECT_SCRIPT_TIME = 12; +const S32 OBJECT_PRIM_EQUIVALENCE = 13; +const S32 OBJECT_SERVER_COST = 14; +const S32 OBJECT_STREAMING_COST = 15; +const S32 OBJECT_PHYSICS_COST = 16; + +// llTextBox() magic token string - yes it's a hack. +char const* const TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!"; // changed() event flags const U32 CHANGED_NONE = 0x0; @@ -216,4 +241,156 @@ const U32 LSL_STATUS_INTERNAL_ERROR = 1999; // Start per-function errors below, starting at 2000: const U32 LSL_STATUS_WHITELIST_FAILED = 2001; + +// Memory profiling support +const S32 LSL_PROFILE_SCRIPT_NONE = 0; +const S32 LSL_PROFILE_SCRIPT_MEMORY = 1; + +// HTTP responses contents type +const S32 LSL_CONTENT_TYPE_TEXT = 0; +const S32 LSL_CONTENT_TYPE_HTML = 1; + +// Ray casting +const S32 LSL_RCERR_UNKNOWN = -1; +const S32 LSL_RCERR_SIM_PERF_LOW = -2; +const S32 LSL_RCERR_CAST_TIME_EXCEEDED = -3; + +const S32 LSL_RC_REJECT_TYPES = 0; +const S32 LSL_RC_DETECT_PHANTOM = 1; +const S32 LSL_RC_DATA_FLAGS = 2; +const S32 LSL_RC_MAX_HITS = 3; + +const S32 LSL_RC_REJECT_AGENTS = 1; +const S32 LSL_RC_REJECT_PHYSICAL = 2; +const S32 LSL_RC_REJECT_NONPHYSICAL = 4; +const S32 LSL_RC_REJECT_LAND = 8; + +const S32 LSL_RC_GET_NORMAL = 1; +const S32 LSL_RC_GET_ROOT_KEY = 2; +const S32 LSL_RC_GET_LINK_NUM = 4; + +// Estate management +const S32 LSL_ESTATE_ACCESS_ALLOWED_AGENT_ADD = 4; +const S32 LSL_ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 8; +const S32 LSL_ESTATE_ACCESS_ALLOWED_GROUP_ADD = 16; +const S32 LSL_ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 32; +const S32 LSL_ESTATE_ACCESS_BANNED_AGENT_ADD = 64; +const S32 LSL_ESTATE_ACCESS_BANNED_AGENT_REMOVE = 128; + +// Key Frame Motion: +const S32 LSL_KFM_COMMAND = 0; +const S32 LSL_KFM_MODE = 1; +const S32 LSL_KFM_DATA = 2; +const S32 LSL_KFM_FORWARD = 0; +const S32 LSL_KFM_LOOP = 1; +const S32 LSL_KFM_PING_PONG = 2; +const S32 LSL_KFM_REVERSE = 3; +const S32 LSL_KFM_ROTATION = 1; +const S32 LSL_KFM_TRANSLATION = 2; +const S32 LSL_KFM_CMD_PLAY = 0; +const S32 LSL_KFM_CMD_STOP = 1; +const S32 LSL_KFM_CMD_PAUSE = 2; + +// Second Life Server/12 12.04.30.255166 constants for llGetAgentList +const S32 AGENT_LIST_PARCEL = 1; +const S32 AGENT_LIST_PARCEL_OWNER = 2; +const S32 AGENT_LIST_REGION = 4; + + +// --- SL Constants ABOVE this line --- +// --- OpenSim / Aurora-Sim constants Below --- +// OpenSim Constants (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\LSL_Constants.cs) +// Constants for cmWindlight (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\CM_Constants.cs) +const S32 CHANGED_ANIMATION = 16384; +const S32 PARCEL_DETAILS_CLAIMDATE = 10; // used by OpenSim osSetParcelDetails +const S32 STATS_TIME_DILATION = 0; +const S32 STATS_SIM_FPS = 1; +const S32 STATS_PHYSICS_FPS = 2; +const S32 STATS_AGENT_UPDATES = 3; +const S32 STATS_ROOT_AGENTS = 4; +const S32 STATS_CHILD_AGENTS = 5; +const S32 STATS_TOTAL_PRIMS = 6; +const S32 STATS_ACTIVE_PRIMS = 7; +const S32 STATS_FRAME_MS = 8; +const S32 STATS_NET_MS = 9; +const S32 STATS_PHYSICS_MS = 10; +const S32 STATS_IMAGE_MS = 11; +const S32 STATS_OTHER_MS = 12; +const S32 STATS_IN_PACKETS_PER_SECOND = 13; +const S32 STATS_OUT_PACKETS_PER_SECOND = 14; +const S32 STATS_UNACKED_BYTES = 15; +const S32 STATS_AGENT_MS = 16; +const S32 STATS_PENDING_DOWNLOADS = 17; +const S32 STATS_PENDING_UPLOADS = 18; +const S32 STATS_ACTIVE_SCRIPTS = 19; +const S32 STATS_SCRIPT_LPS = 20; +// osNPC +const S32 OS_NPC_FLY = 0; +const S32 OS_NPC_NO_FLY = 1; +const S32 OS_NPC_LAND_AT_TARGET = 2; +const S32 OS_NPC_SIT_NOW = 0; +const U32 OS_NPC_CREATOR_OWNED = 0x1; +const U32 OS_NPC_NOT_OWNED = 0x2; +const U32 OS_NPC_SENSE_AS_AGENT = 0x4; +const U32 OS_NPC_RUNNING = 4; +// Lightshare / Windlight +const S32 WL_WATER_COLOR = 0; +const S32 WL_WATER_FOG_DENSITY_EXPONENT = 1; +const S32 WL_UNDERWATER_FOG_MODIFIER = 2; +const S32 WL_REFLECTION_WAVELET_SCALE = 3; +const S32 WL_FRESNEL_SCALE = 4; +const S32 WL_FRESNEL_OFFSET = 5; +const S32 WL_REFRACT_SCALE_ABOVE = 6; +const S32 WL_REFRACT_SCALE_BELOW = 7; +const S32 WL_BLUR_MULTIPLIER = 8; +const S32 WL_BIG_WAVE_DIRECTION = 9; +const S32 WL_LITTLE_WAVE_DIRECTION = 10; +const S32 WL_NORMAL_MAP_TEXTURE = 11; +const S32 WL_HORIZON = 12; +const S32 WL_HAZE_HORIZON = 13; +const S32 WL_BLUE_DENSITY = 14; +const S32 WL_HAZE_DENSITY = 15; +const S32 WL_DENSITY_MULTIPLIER = 16; +const S32 WL_DISTANCE_MULTIPLIER = 17; +const S32 WL_MAX_ALTITUDE = 18; +const S32 WL_SUN_MOON_COLOR = 19; +const S32 WL_AMBIENT = 20; +const S32 WL_EAST_ANGLE = 21; +const S32 WL_SUN_GLOW_FOCUS = 22; +const S32 WL_SUN_GLOW_SIZE = 23; +const S32 WL_SCENE_GAMMA = 24; +const S32 WL_STAR_BRIGHTNESS = 25; +const S32 WL_CLOUD_COLOR = 26; +const S32 WL_CLOUD_XY_DENSITY = 27; +const S32 WL_CLOUD_COVERAGE = 28; +const S32 WL_CLOUD_SCALE = 29; +const S32 WL_CLOUD_DETAIL_XY_DENSITY = 30; +const S32 WL_CLOUD_SCROLL_X = 31; +const S32 WL_CLOUD_SCROLL_Y = 32; +const S32 WL_CLOUD_SCROLL_Y_LOCK = 33; +const S32 WL_CLOUD_SCROLL_X_LOCK = 34; +const S32 WL_DRAW_CLASSIC_CLOUDS = 35; +const S32 WL_SUN_MOON_POSITION = 36; +// Aurora-Sim Constants (\Aurora\AuroraDotNetEngine\APIs\AA_Constants.cs) --> +const S32 BOT_FOLLOW_FLAG_NONE = 0; +const S32 BOT_FOLLOW_FLAG_INDEFINITELY = 1; +const S32 BOT_FOLLOW_WALK = 0; +const S32 BOT_FOLLOW_RUN = 1; +const S32 BOT_FOLLOW_FLY = 2; +const S32 BOT_FOLLOW_TELEPORT = 3; +const S32 BOT_FOLLOW_WAIT = 4; +const S32 BOT_FOLLOW_TRIGGER_HERE_EVENT = 1; +const S32 BOT_FOLLOW_FLAG_FORCEDIRECTPATH = 4; +// string constants from Aurora-Sim +char const* const ENABLE_GRAVITY = "enable_gravity"; +char const* const GRAVITY_FORCE_X = "gravity_force_x"; +char const* const GRAVITY_FORCE_Y = "gravity_force_y"; +char const* const GRAVITY_FORCE_Z = "gravity_force_z"; +char const* const ADD_GRAVITY_POINT = "add_gravity_point"; +char const* const ADD_GRAVITY_FORCE = "add_gravity_force"; +char const* const START_TIME_REVERSAL_SAVING = "start_time_reversal_saving"; +char const* const STOP_TIME_REVERSAL_SAVING = "stop_time_reversal_saving"; +char const* const START_TIME_REVERSAL = "start_time_reversal"; +char const* const STOP_TIME_REVERSAL = "stop_time_reversal"; + #endif diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index dee0d50e1..9532410b7 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -376,24 +376,24 @@ private: // uses the MSVC compiler intrinsics __cpuid() and __rdtsc(). // Delays for the specified amount of milliseconds -static void _Delay(unsigned int ms) +static void _Delay(unsigned int ms) { - LARGE_INTEGER freq, c1, c2; - __int64 x; + LARGE_INTEGER freq, c1, c2; + __int64 x; - // Get High-Res Timer frequency + // Get High-Res Timer frequency if (!QueryPerformanceFrequency(&freq)) return; - + // Convert ms to High-Res Timer value x = freq.QuadPart/1000*ms; - // Get first snapshot of High-Res Timer value + // Get first snapshot of High-Res Timer value QueryPerformanceCounter(&c1); do { - // Get second snapshot - QueryPerformanceCounter(&c2); + // Get second snapshot + QueryPerformanceCounter(&c2); }while(c2.QuadPart-c1.QuadPart < x); // Loop while (second-first < x) } diff --git a/indra/llcommon/llprocessor.h b/indra/llcommon/llprocessor.h index 00cd5a555..fc2c8dacf 100644 --- a/indra/llcommon/llprocessor.h +++ b/indra/llcommon/llprocessor.h @@ -52,5 +52,4 @@ private: LLProcessorInfoImpl* mImpl; }; - -#endif +#endif // LLPROCESSOR_H diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index dce07410b..61dc62388 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -60,6 +60,9 @@ static const char LEGACY_NON_HEADER[] = ""; 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 */ @@ -2172,3 +2175,80 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) 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 9a45f56a7..09150615c 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -755,6 +755,9 @@ public: LLPointer p = new LLSDXMLParser; return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED); } + // Line oriented parser, 30% faster than fromXML(), but can + // only be used when you know you have the complete XML + // document available in the stream. static S32 fromXMLDocument(LLSD& sd, std::istream& str) { LLPointer p = new LLSDXMLParser(); @@ -791,4 +794,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/llsortedvector.h b/indra/llcommon/llsortedvector.h new file mode 100644 index 000000000..391b82ee4 --- /dev/null +++ b/indra/llcommon/llsortedvector.h @@ -0,0 +1,152 @@ +/** + * @file llsortedvector.h + * @author Nat Goodspeed + * @date 2012-04-08 + * @brief LLSortedVector class wraps a vector that we maintain in sorted + * order so we can perform binary-search lookups. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLSORTEDVECTOR_H) +#define LL_LLSORTEDVECTOR_H + +#include +#include + +/** + * LLSortedVector contains a std::vector that we keep sorted on the + * first of the pair. This makes insertion somewhat more expensive than simple + * std::vector::push_back(), but allows us to use binary search for lookups. + * It's intended for small aggregates where lookup is far more performance- + * critical than insertion; in such cases a binary search on a small, sorted + * std::vector can be more performant than a std::map lookup. + */ +template +class LLSortedVector +{ +public: + typedef LLSortedVector self; + typedef KEY key_type; + typedef VALUE mapped_type; + typedef std::pair value_type; + typedef std::vector PairVector; + typedef typename PairVector::iterator iterator; + typedef typename PairVector::const_iterator const_iterator; + + /// Empty + LLSortedVector() {} + + /// Fixed initial size + LLSortedVector(std::size_t size): + mVector(size) + {} + + /// Bulk load + template + LLSortedVector(ITER begin, ITER end): + mVector(begin, end) + { + // Allow caller to dump in a bunch of (pairs convertible to) + // value_type if desired, but make sure we sort afterwards. + std::sort(mVector.begin(), mVector.end()); + } + + /// insert(key, value) + std::pair insert(const key_type& key, const mapped_type& value) + { + return insert(value_type(key, value)); + } + + /// insert(value_type) + std::pair insert(const value_type& pair) + { + typedef std::pair iterbool; + iterator found = std::lower_bound(mVector.begin(), mVector.end(), pair, + less()); + // have to check for end() before it's even valid to dereference + if (found == mVector.end()) + { + std::size_t index(mVector.size()); + mVector.push_back(pair); + // don't forget that push_back() invalidates 'found' + return iterbool(mVector.begin() + index, true); + } + if (found->first == pair.first) + { + return iterbool(found, false); + } + // remember that insert() invalidates 'found' -- save index + std::size_t index(found - mVector.begin()); + mVector.insert(found, pair); + // okay, convert from index back to iterator + return iterbool(mVector.begin() + index, true); + } + + iterator begin() { return mVector.begin(); } + iterator end() { return mVector.end(); } + const_iterator begin() const { return mVector.begin(); } + const_iterator end() const { return mVector.end(); } + + bool empty() const { return mVector.empty(); } + std::size_t size() const { return mVector.size(); } + + /// find + iterator find(const key_type& key) + { + iterator found = std::lower_bound(mVector.begin(), mVector.end(), + value_type(key, mapped_type()), + less()); + if (found == mVector.end() || found->first != key) + return mVector.end(); + return found; + } + + const_iterator find(const key_type& key) const + { + return const_cast(this)->find(key); + } + +private: + // Define our own 'less' comparator so we can specialize without messing + // with std::less. + template + struct less: public std::less {}; + + // Specialize 'less' for an LLSortedVector::value_type involving + // std::type_info*. This is one of LLSortedVector's foremost use cases. We + // specialize 'less' rather than just defining a specific comparator + // because LLSortedVector should be usable for other key_types as well. + template + struct less< std::pair >: + public std::binary_function, + std::pair, + bool> + { + bool operator()(const std::pair& lhs, + const std::pair& rhs) const + { + return lhs.first->before(*rhs.first); + } + }; + + // Same as above, but with const std::type_info*. + template + struct less< std::pair >: + public std::binary_function, + std::pair, + bool> + { + bool operator()(const std::pair& lhs, + const std::pair& rhs) const + { + return lhs.first->before(*rhs.first); + } + }; + + PairVector mVector; +}; + +#endif /* ! defined(LL_LLSORTEDVECTOR_H) */ diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 18842f276..105b69d34 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -39,7 +39,7 @@ #include #include #include -#include "stdtypes.h" // llcommon/stdtypes.h, needed for S32 and U32. +#include // Use to compare the first element only of a pair // e.g. typedef std::set, compare_pair > some_pair_set_t; @@ -477,4 +477,54 @@ llbind2nd(const _Operation& __oper, const _Tp& __x) return llbinder2nd<_Operation>(__oper, _Arg2_type(__x)); } +/** + * Compare std::type_info* pointers a la std::less. We break this out as a + * separate function for use in two different std::less specializations. + */ +inline +bool before(const std::type_info* lhs, const std::type_info* rhs) +{ +#if LL_LINUX && defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) + // If we're building on Linux with gcc, and it's either gcc 3.x or + // 4.{0,1,2,3}, then we have to use a workaround. Note that we use gcc on + // Mac too, and some people build with gcc on Windows (cygwin or mingw). + // On Linux, different load modules may produce different type_info* + // pointers for the same type. Have to compare name strings to get good + // results. + return strcmp(lhs->name(), rhs->name()) < 0; +#else // not Linux, or gcc 4.4+ + // Just use before(), as we normally would + return lhs->before(*rhs); +#endif +} + +/** + * Specialize std::less to use std::type_info::before(). + * See MAINT-1175. It is NEVER a good idea to directly compare std::type_info* + * because, on Linux, you might get different std::type_info* pointers for the + * same type (from different load modules)! + */ +namespace std +{ + template <> + struct less: + public std::binary_function + { + bool operator()(const std::type_info* lhs, const std::type_info* rhs) const + { + return before(lhs, rhs); + } + }; + + template <> + struct less: + public std::binary_function + { + bool operator()(std::type_info* lhs, std::type_info* rhs) const + { + return before(lhs, rhs); + } + }; +} // std + #endif // LL_LLSTL_H diff --git a/indra/llcommon/llstrider.h b/indra/llcommon/llstrider.h index 7d1b80710..b4f310a51 100644 --- a/indra/llcommon/llstrider.h +++ b/indra/llcommon/llstrider.h @@ -42,10 +42,10 @@ template class LLStrider U8* mBytep; }; U32 mSkip; - //U32 mTypeSize; + public: - LLStrider() { mObjectp = NULL; /*mTypeSize = */mSkip = sizeof(Object); } + LLStrider() { mObjectp = NULL; mSkip = sizeof(Object); } ~LLStrider() { } const LLStrider& operator = (Object *first) { mObjectp = first; return *this;} @@ -60,9 +60,6 @@ public: return ret; } - //void setTypeSize (S32 typeBytes){ mTypeSize = (typeBytes ? typeBytes : sizeof(Object)); } - - //bool isStrided() const { return mTypeSize != mSkip; } void skip(const U32 index) { mBytep += mSkip*index;} U32 getSkip() const { return mSkip; } Object* get() { return mObjectp; } @@ -70,72 +67,9 @@ public: Object& operator *() { return *mObjectp; } Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; } Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; } + Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); } - /*void assignArray(U8* __restrict source, const size_t elem_size, const size_t elem_count) - { - llassert_always(sizeof(Object) <= elem_size); - - U8* __restrict dest = mBytep; //refer to dest instead of mBytep to benefit from __restrict hint - const U32 bytes = elem_size * elem_count; //total bytes to copy from source to dest - - //stride == sizeof(element) implies entire buffer is unstrided and thus memcpy-able, provided source buffer elements match in size. - //Because LLStrider is often passed an LLVector3 even if the reprensentation is LLVector4 in the vertex buffer, mTypeSize is set to - //the TRUE vbo datatype size via VertexBufferStrider::get - if(!isStrided() && mTypeSize == elem_size) - { - if(bytes >= sizeof(LLVector4) * 4) //Should be able to pull at least 3 16byte blocks from this. Smaller isn't really beneficial. - { - U8* __restrict aligned_source = LL_NEXT_ALIGNED_ADDRESS(source); - U8* __restrict aligned_dest = LL_NEXT_ALIGNED_ADDRESS(dest); - const U32 source_offset = aligned_source - source; //Offset to first aligned location in source buffer. - const U32 dest_offset = aligned_dest - dest; //Offset to first aligned location in dest buffer. - llassert_always(source_offset < 16); - llassert_always(dest_offset < 16); - if(source_offset == dest_offset) //delta to aligned location matches between source and destination! _mm_*_ps should be viable. - { - const U32 end_offset = (bytes - source_offset) % sizeof(LLVector4); //buffers may not neatly end on a 16byte alignment boundary. - const U32 aligned_bytes = bytes - source_offset - end_offset; //how many bytes to copy from aligned start to aligned end. - - llassert_always(aligned_bytes > 0); - - if(source_offset) //memcpy up to the aligned location if needed - memcpy(dest,source,source_offset); - LLVector4a::memcpyNonAliased16((F32*) aligned_dest, (F32*) aligned_source, aligned_bytes); - if(end_offset) //memcpy to the very end if needed. - memcpy(aligned_dest+aligned_bytes,aligned_source+aligned_bytes,end_offset); - } - else //buffers non-uniformly offset from aligned location. Using _mm_*u_ps. - { - U32 end = bytes/sizeof(LLVector4); //sizeof(LLVector4) = 16 bytes = 128 bits - - llassert_always(end > 0); - - __m128* dst = (__m128*) dest; - __m128* src = (__m128*) source; - - for (U32 i = 0; i < end; i++) //copy 128bit chunks - { - __m128 res = _mm_loadu_ps((F32*)&src[i]); - _mm_storeu_ps((F32*)&dst[i], res); - } - end*=16;//Convert to real byte offset - if(end < bytes) //just memcopy the rest - memcpy(dest+end,source+end,bytes-end); - } - } - else //Too small. just do a simple memcpy. - memcpy(dest,source,bytes); - } - else - { - for(U32 i=0;i #include -#include -#include #include #include #include "llsd.h" +#include "llfasttimer.h" #if LL_LINUX || LL_SOLARIS #include @@ -47,6 +46,7 @@ #endif #include +#include #if LL_SOLARIS // stricmp and strnicmp do not exist on Solaris: @@ -246,40 +246,77 @@ private: static std::string sLocale; public: - typedef typename std::basic_string::size_type size_type; + typedef std::basic_string string_type; + typedef typename string_type::size_type size_type; public: ///////////////////////////////////////////////////////////////////////////////////////// // Static Utility functions that operate on std::strings - static const std::basic_string null; + static const string_type null; typedef std::map format_map_t; - LL_COMMON_API static void getTokens(const std::basic_string& instr, std::vector >& tokens, const std::basic_string& delims); - LL_COMMON_API static void formatNumber(std::basic_string& numStr, std::basic_string decimals); - LL_COMMON_API static bool formatDatetime(std::basic_string& replacement, std::basic_string token, std::basic_string param, S32 secFromEpoch); - LL_COMMON_API static S32 format(std::basic_string& s, const format_map_t& substitutions); - LL_COMMON_API static S32 format(std::basic_string& s, const LLSD& substitutions); - LL_COMMON_API static bool simpleReplacement(std::basic_string& replacement, std::basic_string token, const format_map_t& substitutions); - LL_COMMON_API static bool simpleReplacement(std::basic_string& replacement, std::basic_string token, const LLSD& substitutions); + /// considers any sequence of delims as a single field separator + LL_COMMON_API static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& delims); + /// like simple scan overload, but returns scanned vector + static std::vector getTokens(const string_type& instr, + const string_type& delims); + /// add support for keep_delims and quotes (either could be empty string) + static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes=string_type()); + /// like keep_delims-and-quotes overload, but returns scanned vector + static std::vector getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes=string_type()); + /// add support for escapes (could be empty string) + static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes); + /// like escapes overload, but returns scanned vector + static std::vector getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes); + + LL_COMMON_API static void formatNumber(string_type& numStr, string_type decimals); + LL_COMMON_API static bool formatDatetime(string_type& replacement, string_type token, string_type param, S32 secFromEpoch); + LL_COMMON_API static S32 format(string_type& s, const format_map_t& substitutions); + LL_COMMON_API static S32 format(string_type& s, const LLSD& substitutions); + LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const format_map_t& substitutions); + LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const LLSD& substitutions); LL_COMMON_API static void setLocale (std::string inLocale); LL_COMMON_API static std::string getLocale (void); - static bool isValidIndex(const std::basic_string& string, size_type i) + static bool isValidIndex(const string_type& string, size_type i) { return !string.empty() && (0 <= i) && (i <= string.size()); } - static void trimHead(std::basic_string& string); - static void trimTail(std::basic_string& string); - static void trim(std::basic_string& string) { trimHead(string); trimTail(string); } - static void truncate(std::basic_string& string, size_type count); + static bool contains(const string_type& string, T c, size_type i=0) + { + return string.find(c, i) != string_type::npos; + } - static void toUpper(std::basic_string& string); - static void toLower(std::basic_string& string); + static void trimHead(string_type& string); + static void trimTail(string_type& string); + static void trim(string_type& string) { trimHead(string); trimTail(string); } + static void truncate(string_type& string, size_type count); + + static void toUpper(string_type& string); + static void toLower(string_type& string); // True if this is the head of s. - static BOOL isHead( const std::basic_string& string, const T* s ); + static BOOL isHead( const string_type& string, const T* s ); /** * @brief Returns true if string starts with substr @@ -287,8 +324,8 @@ public: * If etither string or substr are empty, this method returns false. */ static bool startsWith( - const std::basic_string& string, - const std::basic_string& substr); + const string_type& string, + const string_type& substr); /** * @brief Returns true if string ends in substr @@ -296,19 +333,32 @@ public: * If etither string or substr are empty, this method returns false. */ static bool endsWith( - const std::basic_string& string, - const std::basic_string& substr); + const string_type& string, + const string_type& substr); - static void addCRLF(std::basic_string& string); - static void removeCRLF(std::basic_string& string); + static void addCRLF(string_type& string); + static void removeCRLF(string_type& string); - static void replaceTabsWithSpaces( std::basic_string& string, size_type spaces_per_tab ); - static void replaceNonstandardASCII( std::basic_string& string, T replacement ); - static void replaceChar( std::basic_string& string, T target, T replacement ); - static void replaceString( std::basic_string& string, std::basic_string target, std::basic_string replacement ); + static void replaceTabsWithSpaces( string_type& string, size_type spaces_per_tab ); + static void replaceNonstandardASCII( string_type& string, T replacement ); + static void replaceChar( string_type& string, T target, T replacement ); + static void replaceString( string_type& string, string_type target, string_type replacement ); - static BOOL containsNonprintable(const std::basic_string& string); - static void stripNonprintable(std::basic_string& string); + static BOOL containsNonprintable(const string_type& string); + static void stripNonprintable(string_type& string); + + /** + * Double-quote an argument string if needed, unless it's already + * double-quoted. Decide whether it's needed based on the presence of any + * character in @a triggers (default space or double-quote). If we quote + * it, escape any embedded double-quote with the @a escape string (default + * backslash). + * + * Passing triggers="" means always quote, unless it's already double-quoted. + */ + static string_type quote(const string_type& str, + const string_type& triggers=" \"", + const string_type& escape="\\"); /** * @brief Unsafe way to make ascii characters. You should probably @@ -317,18 +367,18 @@ public: * The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII * should work. */ - static void _makeASCII(std::basic_string& string); + static void _makeASCII(string_type& string); // Conversion to other data types - static BOOL convertToBOOL(const std::basic_string& string, BOOL& value); - static BOOL convertToU8(const std::basic_string& string, U8& value); - static BOOL convertToS8(const std::basic_string& string, S8& value); - static BOOL convertToS16(const std::basic_string& string, S16& value); - static BOOL convertToU16(const std::basic_string& string, U16& value); - static BOOL convertToU32(const std::basic_string& string, U32& value); - static BOOL convertToS32(const std::basic_string& string, S32& value); - static BOOL convertToF32(const std::basic_string& string, F32& value); - static BOOL convertToF64(const std::basic_string& string, F64& value); + static BOOL convertToBOOL(const string_type& string, BOOL& value); + static BOOL convertToU8(const string_type& string, U8& value); + static BOOL convertToS8(const string_type& string, S8& value); + static BOOL convertToS16(const string_type& string, S16& value); + static BOOL convertToU16(const string_type& string, U16& value); + static BOOL convertToU32(const string_type& string, U32& value); + static BOOL convertToS32(const string_type& string, S32& value); + static BOOL convertToF32(const string_type& string, F32& value); + static BOOL convertToF64(const string_type& string, F64& value); ///////////////////////////////////////////////////////////////////////////////////////// // Utility functions for working with char*'s and strings @@ -336,24 +386,24 @@ public: // Like strcmp but also handles empty strings. Uses // current locale. static S32 compareStrings(const T* lhs, const T* rhs); - static S32 compareStrings(const std::basic_string& lhs, const std::basic_string& rhs); + static S32 compareStrings(const string_type& lhs, const string_type& rhs); // case insensitive version of above. Uses current locale on // Win32, and falls back to a non-locale aware comparison on // Linux. static S32 compareInsensitive(const T* lhs, const T* rhs); - static S32 compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs); + static S32 compareInsensitive(const string_type& lhs, const string_type& rhs); // Case sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() - static S32 compareDict(const std::basic_string& a, const std::basic_string& b); + static S32 compareDict(const string_type& a, const string_type& b); // Case *in*sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() - static S32 compareDictInsensitive(const std::basic_string& a, const std::basic_string& b); + static S32 compareDictInsensitive(const string_type& a, const string_type& b); // Puts compareDict() in a form appropriate for LL container classes to use for sorting. - static BOOL precedesDict( const std::basic_string& a, const std::basic_string& b ); + static BOOL precedesDict( const string_type& a, const string_type& b ); // A replacement for strncpy. // If the dst buffer is dst_size bytes long or more, ensures that dst is null terminated and holds @@ -361,7 +411,7 @@ public: static void copy(T* dst, const T* src, size_type dst_size); // Copies src into dst at a given offset. - static void copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset); + static void copyInto(string_type& dst, const string_type& src, size_type offset); static bool isPartOfWord(T c) { return (c == (T)'_') || LLStringOps::isAlnum(c); } @@ -371,7 +421,7 @@ public: #endif private: - LL_COMMON_API static size_type getSubstitution(const std::basic_string& instr, size_type& start, std::vector >& tokens); + LL_COMMON_API static size_type getSubstitution(const string_type& instr, size_type& start, std::vector& tokens); }; template const std::basic_string LLStringUtilBase::null; @@ -649,6 +699,321 @@ namespace LLStringFn //////////////////////////////////////////////////////////// +// static +template +std::vector::string_type> +LLStringUtilBase::getTokens(const string_type& instr, const string_type& delims) +{ + std::vector tokens; + getTokens(instr, tokens, delims); + return tokens; +} + +// static +template +std::vector::string_type> +LLStringUtilBase::getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes) +{ + std::vector tokens; + getTokens(instr, tokens, drop_delims, keep_delims, quotes); + return tokens; +} + +// static +template +std::vector::string_type> +LLStringUtilBase::getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes) +{ + std::vector tokens; + getTokens(instr, tokens, drop_delims, keep_delims, quotes, escapes); + return tokens; +} + +namespace LLStringUtilBaseImpl +{ + +/** + * Input string scanner helper for getTokens(), or really any other + * character-parsing routine that may have to deal with escape characters. + * This implementation defines the concept (also an interface, should you + * choose to implement the concept by subclassing) and provides trivial + * implementations for a string @em without escape processing. + */ +template +struct InString +{ + typedef std::basic_string string_type; + typedef typename string_type::const_iterator const_iterator; + + InString(const_iterator b, const_iterator e): + mIter(b), + mEnd(e) + {} + virtual ~InString() {} + + bool done() const { return mIter == mEnd; } + /// Is the current character (*mIter) escaped? This implementation can + /// answer trivially because it doesn't support escapes. + virtual bool escaped() const { return false; } + /// Obtain the current character and advance @c mIter. + virtual T next() { return *mIter++; } + /// Does the current character match specified character? + virtual bool is(T ch) const { return (! done()) && *mIter == ch; } + /// Is the current character any one of the specified characters? + virtual bool oneof(const string_type& delims) const + { + return (! done()) && LLStringUtilBase::contains(delims, *mIter); + } + + /** + * Scan forward from @from until either @a delim or end. This is primarily + * useful for processing quoted substrings. + * + * If we do see @a delim, append everything from @from until (excluding) + * @a delim to @a into, advance @c mIter to skip @a delim, and return @c + * true. + * + * If we do not see @a delim, do not alter @a into or @c mIter and return + * @c false. Do not pass GO, do not collect $200. + * + * @note The @c false case described above implements normal getTokens() + * treatment of an unmatched open quote: treat the quote character as if + * escaped, that is, simply collect it as part of the current token. Other + * plausible behaviors directly affect the way getTokens() deals with an + * unmatched quote: e.g. throwing an exception to treat it as an error, or + * assuming a close quote beyond end of string (in which case return @c + * true). + */ + virtual bool collect_until(string_type& into, const_iterator from, T delim) + { + const_iterator found = std::find(from, mEnd, delim); + // If we didn't find delim, change nothing, just tell caller. + if (found == mEnd) + return false; + // Found delim! Append everything between from and found. + into.append(from, found); + // advance past delim in input + mIter = found + 1; + return true; + } + + const_iterator mIter, mEnd; +}; + +/// InString subclass that handles escape characters +template +class InEscString: public InString +{ +public: + typedef InString super; + typedef typename super::string_type string_type; + typedef typename super::const_iterator const_iterator; + using super::done; + using super::mIter; + using super::mEnd; + + InEscString(const_iterator b, const_iterator e, const string_type& escapes): + super(b, e), + mEscapes(escapes) + { + // Even though we've already initialized 'mIter' via our base-class + // constructor, set it again to check for initial escape char. + setiter(b); + } + + /// This implementation uses the answer cached by setiter(). + virtual bool escaped() const { return mIsEsc; } + virtual T next() + { + // If we're looking at the escape character of an escape sequence, + // skip that character. This is the one time we can modify 'mIter' + // without using setiter: for this one case we DO NOT CARE if the + // escaped character is itself an escape. + if (mIsEsc) + ++mIter; + // If we were looking at an escape character, this is the escaped + // character; otherwise it's just the next character. + T result(*mIter); + // Advance mIter, checking for escape sequence. + setiter(mIter + 1); + return result; + } + + virtual bool is(T ch) const + { + // Like base-class is(), except that an escaped character matches + // nothing. + return (! done()) && (! mIsEsc) && *mIter == ch; + } + + virtual bool oneof(const string_type& delims) const + { + // Like base-class oneof(), except that an escaped character matches + // nothing. + return (! done()) && (! mIsEsc) && LLStringUtilBase::contains(delims, *mIter); + } + + virtual bool collect_until(string_type& into, const_iterator from, T delim) + { + // Deal with escapes in the characters we collect; that is, an escaped + // character must become just that character without the preceding + // escape. Collect characters in a separate string rather than + // directly appending to 'into' in case we do not find delim, in which + // case we're supposed to leave 'into' unmodified. + string_type collected; + // For scanning purposes, we're going to work directly with 'mIter'. + // Save its current value in case we fail to see delim. + const_iterator save_iter(mIter); + // Okay, set 'mIter', checking for escape. + setiter(from); + while (! done()) + { + // If we see an unescaped delim, stop and report success. + if ((! mIsEsc) && *mIter == delim) + { + // Append collected chars to 'into'. + into.append(collected); + // Don't forget to advance 'mIter' past delim. + setiter(mIter + 1); + return true; + } + // We're not at end, and either we're not looking at delim or it's + // escaped. Collect this character and keep going. + collected.push_back(next()); + } + // Here we hit 'mEnd' without ever seeing delim. Restore mIter and tell + // caller. + setiter(save_iter); + return false; + } + +private: + void setiter(const_iterator i) + { + mIter = i; + + // Every time we change 'mIter', set 'mIsEsc' to be able to repetitively + // answer escaped() without having to rescan 'mEscapes'. mIsEsc caches + // contains(mEscapes, *mIter). + + // We're looking at an escaped char if we're not already at end (that + // is, *mIter is even meaningful); if *mIter is in fact one of the + // specified escape characters; and if there's one more character + // following it. That is, if an escape character is the very last + // character of the input string, it loses its special meaning. + mIsEsc = (! done()) && + LLStringUtilBase::contains(mEscapes, *mIter) && + (mIter+1) != mEnd; + } + + const string_type mEscapes; + bool mIsEsc; +}; + +/// getTokens() implementation based on InString concept +template +void getTokens(INSTRING& instr, std::vector& tokens, + const string_type& drop_delims, const string_type& keep_delims, + const string_type& quotes) +{ + // There are times when we want to match either drop_delims or + // keep_delims. Concatenate them up front to speed things up. + string_type all_delims(drop_delims + keep_delims); + // no tokens yet + tokens.clear(); + + // try for another token + while (! instr.done()) + { + // scan past any drop_delims + while (instr.oneof(drop_delims)) + { + // skip this drop_delim + instr.next(); + // but if that was the end of the string, done + if (instr.done()) + return; + } + // found the start of another token: make a slot for it + tokens.push_back(string_type()); + if (instr.oneof(keep_delims)) + { + // *iter is a keep_delim, a token of exactly 1 character. Append + // that character to the new token and proceed. + tokens.back().push_back(instr.next()); + continue; + } + // Here we have a non-delimiter token, which might consist of a mix of + // quoted and unquoted parts. Use bash rules for quoting: you can + // embed a quoted substring in the midst of an unquoted token (e.g. + // ~/"sub dir"/myfile.txt); you can ram two quoted substrings together + // to make a single token (e.g. 'He said, "'"Don't."'"'). We diverge + // from bash in that bash considers an unmatched quote an error. Our + // param signature doesn't allow for errors, so just pretend it's not + // a quote and embed it. + // At this level, keep scanning until we hit the next delimiter of + // either type (drop_delims or keep_delims). + while (! instr.oneof(all_delims)) + { + // If we're looking at an open quote, search forward for + // a close quote, collecting characters along the way. + if (instr.oneof(quotes) && + instr.collect_until(tokens.back(), instr.mIter+1, *instr.mIter)) + { + // collect_until is cleverly designed to do exactly what we + // need here. No further action needed if it returns true. + } + else + { + // Either *iter isn't a quote, or there's no matching close + // quote: in other words, just an ordinary char. Append it to + // current token. + tokens.back().push_back(instr.next()); + } + // having scanned that segment of this token, if we've reached the + // end of the string, we're done + if (instr.done()) + return; + } + } +} + +} // namespace LLStringUtilBaseImpl + +// static +template +void LLStringUtilBase::getTokens(const string_type& string, std::vector& tokens, + const string_type& drop_delims, const string_type& keep_delims, + const string_type& quotes) +{ + // Because this overload doesn't support escapes, use simple InString to + // manage input range. + LLStringUtilBaseImpl::InString instring(string.begin(), string.end()); + LLStringUtilBaseImpl::getTokens(instring, tokens, drop_delims, keep_delims, quotes); +} + +// static +template +void LLStringUtilBase::getTokens(const string_type& string, std::vector& tokens, + const string_type& drop_delims, const string_type& keep_delims, + const string_type& quotes, const string_type& escapes) +{ + // This overload must deal with escapes. Delegate that to InEscString + // (unless there ARE no escapes). + boost::scoped_ptr< LLStringUtilBaseImpl::InString > instrp; + if (escapes.empty()) + instrp.reset(new LLStringUtilBaseImpl::InString(string.begin(), string.end())); + else + instrp.reset(new LLStringUtilBaseImpl::InEscString(string.begin(), string.end(), escapes)); + LLStringUtilBaseImpl::getTokens(*instrp, tokens, drop_delims, keep_delims, quotes); +} // static template @@ -678,7 +1043,7 @@ S32 LLStringUtilBase::compareStrings(const T* lhs, const T* rhs) //static template -S32 LLStringUtilBase::compareStrings(const std::basic_string& lhs, const std::basic_string& rhs) +S32 LLStringUtilBase::compareStrings(const string_type& lhs, const string_type& rhs) { return LLStringOps::collate(lhs.c_str(), rhs.c_str()); } @@ -704,8 +1069,8 @@ S32 LLStringUtilBase::compareInsensitive(const T* lhs, const T* rhs ) } else { - std::basic_string lhs_string(lhs); - std::basic_string rhs_string(rhs); + string_type lhs_string(lhs); + string_type rhs_string(rhs); LLStringUtilBase::toUpper(lhs_string); LLStringUtilBase::toUpper(rhs_string); result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); @@ -715,10 +1080,10 @@ S32 LLStringUtilBase::compareInsensitive(const T* lhs, const T* rhs ) //static template -S32 LLStringUtilBase::compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs) +S32 LLStringUtilBase::compareInsensitive(const string_type& lhs, const string_type& rhs) { - std::basic_string lhs_string(lhs); - std::basic_string rhs_string(rhs); + string_type lhs_string(lhs); + string_type rhs_string(rhs); LLStringUtilBase::toUpper(lhs_string); LLStringUtilBase::toUpper(rhs_string); return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); @@ -729,7 +1094,7 @@ S32 LLStringUtilBase::compareInsensitive(const std::basic_string& lhs, con //static template -S32 LLStringUtilBase::compareDict(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDict(const string_type& astr, const string_type& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -770,7 +1135,7 @@ S32 LLStringUtilBase::compareDict(const std::basic_string& astr, const std // static template -S32 LLStringUtilBase::compareDictInsensitive(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDictInsensitive(const string_type& astr, const string_type& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -805,7 +1170,7 @@ S32 LLStringUtilBase::compareDictInsensitive(const std::basic_string& astr // Puts compareDict() in a form appropriate for LL container classes to use for sorting. // static template -BOOL LLStringUtilBase::precedesDict( const std::basic_string& a, const std::basic_string& b ) +BOOL LLStringUtilBase::precedesDict( const string_type& a, const string_type& b ) { if( a.size() && b.size() ) { @@ -819,7 +1184,7 @@ BOOL LLStringUtilBase::precedesDict( const std::basic_string& a, const std //static template -void LLStringUtilBase::toUpper(std::basic_string& string) +void LLStringUtilBase::toUpper(string_type& string) { if( !string.empty() ) { @@ -833,7 +1198,7 @@ void LLStringUtilBase::toUpper(std::basic_string& string) //static template -void LLStringUtilBase::toLower(std::basic_string& string) +void LLStringUtilBase::toLower(string_type& string) { if( !string.empty() ) { @@ -847,7 +1212,7 @@ void LLStringUtilBase::toLower(std::basic_string& string) //static template -void LLStringUtilBase::trimHead(std::basic_string& string) +void LLStringUtilBase::trimHead(string_type& string) { if( !string.empty() ) { @@ -862,7 +1227,7 @@ void LLStringUtilBase::trimHead(std::basic_string& string) //static template -void LLStringUtilBase::trimTail(std::basic_string& string) +void LLStringUtilBase::trimTail(string_type& string) { if( string.size() ) { @@ -881,7 +1246,7 @@ void LLStringUtilBase::trimTail(std::basic_string& string) // Replace line feeds with carriage return-line feed pairs. //static template -void LLStringUtilBase::addCRLF(std::basic_string& string) +void LLStringUtilBase::addCRLF(string_type& string) { const T LF = 10; const T CR = 13; @@ -923,7 +1288,7 @@ void LLStringUtilBase::addCRLF(std::basic_string& string) // Remove all carriage returns //static template -void LLStringUtilBase::removeCRLF(std::basic_string& string) +void LLStringUtilBase::removeCRLF(string_type& string) { const T CR = 13; @@ -944,10 +1309,10 @@ void LLStringUtilBase::removeCRLF(std::basic_string& string) //static template -void LLStringUtilBase::replaceChar( std::basic_string& string, T target, T replacement ) +void LLStringUtilBase::replaceChar( string_type& string, T target, T replacement ) { size_type found_pos = 0; - while( (found_pos = string.find(target, found_pos)) != std::basic_string::npos ) + while( (found_pos = string.find(target, found_pos)) != string_type::npos ) { string[found_pos] = replacement; found_pos++; // avoid infinite defeat if target == replacement @@ -956,10 +1321,10 @@ void LLStringUtilBase::replaceChar( std::basic_string& string, T target, T //static template -void LLStringUtilBase::replaceString( std::basic_string& string, std::basic_string target, std::basic_string replacement ) +void LLStringUtilBase::replaceString( string_type& string, string_type target, string_type replacement ) { size_type found_pos = 0; - while( (found_pos = string.find(target, found_pos)) != std::basic_string::npos ) + while( (found_pos = string.find(target, found_pos)) != string_type::npos ) { string.replace( found_pos, target.length(), replacement ); found_pos += replacement.length(); // avoid infinite defeat if replacement contains target @@ -968,7 +1333,7 @@ void LLStringUtilBase::replaceString( std::basic_string& string, std::basi //static template -void LLStringUtilBase::replaceNonstandardASCII( std::basic_string& string, T replacement ) +void LLStringUtilBase::replaceNonstandardASCII( string_type& string, T replacement ) { const char LF = 10; const S8 MIN = 32; @@ -988,12 +1353,12 @@ void LLStringUtilBase::replaceNonstandardASCII( std::basic_string& string, //static template -void LLStringUtilBase::replaceTabsWithSpaces( std::basic_string& str, size_type spaces_per_tab ) +void LLStringUtilBase::replaceTabsWithSpaces( string_type& str, size_type spaces_per_tab ) { const T TAB = '\t'; const T SPACE = ' '; - std::basic_string out_str; + string_type out_str; // Replace tabs with spaces for (size_type i = 0; i < str.length(); i++) { @@ -1012,7 +1377,7 @@ void LLStringUtilBase::replaceTabsWithSpaces( std::basic_string& str, size //static template -BOOL LLStringUtilBase::containsNonprintable(const std::basic_string& string) +BOOL LLStringUtilBase::containsNonprintable(const string_type& string) { const char MIN = 32; BOOL rv = FALSE; @@ -1029,7 +1394,7 @@ BOOL LLStringUtilBase::containsNonprintable(const std::basic_string& strin //static template -void LLStringUtilBase::stripNonprintable(std::basic_string& string) +void LLStringUtilBase::stripNonprintable(string_type& string) { const char MIN = 32; size_type j = 0; @@ -1060,8 +1425,43 @@ void LLStringUtilBase::stripNonprintable(std::basic_string& string) delete []c_string; } +template +std::basic_string LLStringUtilBase::quote(const string_type& str, + const string_type& triggers, + const string_type& escape) +{ + size_type len(str.length()); + // If the string is already quoted, assume user knows what s/he's doing. + if (len >= 2 && str[0] == '"' && str[len-1] == '"') + { + return str; + } + + // Not already quoted: do we need to? triggers.empty() is a special case + // meaning "always quote." + if ((! triggers.empty()) && str.find_first_of(triggers) == string_type::npos) + { + // no trigger characters, don't bother quoting + return str; + } + + // For whatever reason, we must quote this string. + string_type result; + result.push_back('"'); + for (typename string_type::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) + { + if (*ci == '"') + { + result.append(escape); + } + result.push_back(*ci); + } + result.push_back('"'); + return result; +} + template -void LLStringUtilBase::_makeASCII(std::basic_string& string) +void LLStringUtilBase::_makeASCII(string_type& string) { // Replace non-ASCII chars with LL_UNKNOWN_CHAR for (size_type i = 0; i < string.length(); i++) @@ -1091,7 +1491,7 @@ void LLStringUtilBase::copy( T* dst, const T* src, size_type dst_size ) // static template -void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset) +void LLStringUtilBase::copyInto(string_type& dst, const string_type& src, size_type offset) { if ( offset == dst.length() ) { @@ -1101,7 +1501,7 @@ void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_s } else { - std::basic_string tail = dst.substr(offset); + string_type tail = dst.substr(offset); dst = dst.substr(0, offset); dst += src; @@ -1112,7 +1512,7 @@ void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_s // True if this is the head of s. //static template -BOOL LLStringUtilBase::isHead( const std::basic_string& string, const T* s ) +BOOL LLStringUtilBase::isHead( const string_type& string, const T* s ) { if( string.empty() ) { @@ -1128,8 +1528,8 @@ BOOL LLStringUtilBase::isHead( const std::basic_string& string, const T* s // static template bool LLStringUtilBase::startsWith( - const std::basic_string& string, - const std::basic_string& substr) + const string_type& string, + const string_type& substr) { if(string.empty() || (substr.empty())) return false; if(0 == string.find(substr)) return true; @@ -1139,8 +1539,8 @@ bool LLStringUtilBase::startsWith( // static template bool LLStringUtilBase::endsWith( - const std::basic_string& string, - const std::basic_string& substr) + const string_type& string, + const string_type& substr) { if(string.empty() || (substr.empty())) return false; std::string::size_type idx = string.rfind(substr); @@ -1150,14 +1550,14 @@ bool LLStringUtilBase::endsWith( template -BOOL LLStringUtilBase::convertToBOOL(const std::basic_string& string, BOOL& value) +BOOL LLStringUtilBase::convertToBOOL(const string_type& string, BOOL& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); if( (temp == "1") || @@ -1187,7 +1587,7 @@ BOOL LLStringUtilBase::convertToBOOL(const std::basic_string& string, BOOL } template -BOOL LLStringUtilBase::convertToU8(const std::basic_string& string, U8& value) +BOOL LLStringUtilBase::convertToU8(const string_type& string, U8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1200,7 +1600,7 @@ BOOL LLStringUtilBase::convertToU8(const std::basic_string& string, U8& va } template -BOOL LLStringUtilBase::convertToS8(const std::basic_string& string, S8& value) +BOOL LLStringUtilBase::convertToS8(const string_type& string, S8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1213,7 +1613,7 @@ BOOL LLStringUtilBase::convertToS8(const std::basic_string& string, S8& va } template -BOOL LLStringUtilBase::convertToS16(const std::basic_string& string, S16& value) +BOOL LLStringUtilBase::convertToS16(const string_type& string, S16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1226,7 +1626,7 @@ BOOL LLStringUtilBase::convertToS16(const std::basic_string& string, S16& } template -BOOL LLStringUtilBase::convertToU16(const std::basic_string& string, U16& value) +BOOL LLStringUtilBase::convertToU16(const string_type& string, U16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1239,17 +1639,17 @@ BOOL LLStringUtilBase::convertToU16(const std::basic_string& string, U16& } template -BOOL LLStringUtilBase::convertToU32(const std::basic_string& string, U32& value) +BOOL LLStringUtilBase::convertToU32(const string_type& string, U32& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); U32 v; - std::basic_istringstream i_stream((std::basic_string)temp); + std::basic_istringstream i_stream((string_type)temp); if(i_stream >> v) { value = v; @@ -1259,17 +1659,17 @@ BOOL LLStringUtilBase::convertToU32(const std::basic_string& string, U32& } template -BOOL LLStringUtilBase::convertToS32(const std::basic_string& string, S32& value) +BOOL LLStringUtilBase::convertToS32(const string_type& string, S32& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); S32 v; - std::basic_istringstream i_stream((std::basic_string)temp); + std::basic_istringstream i_stream((string_type)temp); if(i_stream >> v) { //TODO: figure out overflow and underflow reporting here @@ -1286,7 +1686,7 @@ BOOL LLStringUtilBase::convertToS32(const std::basic_string& string, S32& } template -BOOL LLStringUtilBase::convertToF32(const std::basic_string& string, F32& value) +BOOL LLStringUtilBase::convertToF32(const string_type& string, F32& value) { F64 value64 = 0.0; BOOL success = convertToF64(string, value64); @@ -1299,17 +1699,17 @@ BOOL LLStringUtilBase::convertToF32(const std::basic_string& string, F32& } template -BOOL LLStringUtilBase::convertToF64(const std::basic_string& string, F64& value) +BOOL LLStringUtilBase::convertToF64(const string_type& string, F64& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); F64 v; - std::basic_istringstream i_stream((std::basic_string)temp); + std::basic_istringstream i_stream((string_type)temp); if(i_stream >> v) { //TODO: figure out overflow and underflow reporting here @@ -1326,7 +1726,7 @@ BOOL LLStringUtilBase::convertToF64(const std::basic_string& string, F64& } template -void LLStringUtilBase::truncate(std::basic_string& string, size_type count) +void LLStringUtilBase::truncate(string_type& string, size_type count) { size_type cur_size = string.size(); string.resize(count < cur_size ? count : cur_size); diff --git a/indra/llcommon/lltypeinfolookup.h b/indra/llcommon/lltypeinfolookup.h new file mode 100644 index 000000000..0b6862444 --- /dev/null +++ b/indra/llcommon/lltypeinfolookup.h @@ -0,0 +1,117 @@ +/** + * @file lltypeinfolookup.h + * @author Nat Goodspeed + * @date 2012-04-08 + * @brief Template data structure like std::map + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLTYPEINFOLOOKUP_H) +#define LL_LLTYPEINFOLOOKUP_H + +#include +#include +#include +#include // std::binary_function +#include + +/** + * The following helper classes are based on the Boost.Unordered documentation: + * http://www.boost.org/doc/libs/1_45_0/doc/html/unordered/hash_equality.html + */ + +/** + * Compute hash for a string passed as const char* + */ +struct const_char_star_hash: public std::unary_function +{ + std::size_t operator()(const char* str) const + { + std::size_t seed = 0; + for ( ; *str; ++str) + { + boost::hash_combine(seed, *str); + } + return seed; + } +}; + +/** + * Compute equality for strings passed as const char* + * + * I (nat) suspect that this is where the default behavior breaks for the + * const char* values returned from std::type_info::name(). If you compare the + * two const char* pointer values, as a naive, unspecialized implementation + * will surely do, they'll compare unequal. + */ +struct const_char_star_equal: public std::binary_function +{ + bool operator()(const char* lhs, const char* rhs) const + { + return strcmp(lhs, rhs) == 0; + } +}; + +/** + * LLTypeInfoLookup is specifically designed for use cases for which you might + * consider std::map. We have several such data + * structures in the viewer. The trouble with them is that at least on Linux, + * you can't rely on always getting the same std::type_info* for a given type: + * different load modules will produce different std::type_info*. + * LLTypeInfoLookup contains a workaround to address this issue. + * + * The API deliberately diverges from std::map in several respects: + * * It avoids iterators, not only begin()/end() but also as return values + * from insert() and find(). This bypasses transform_iterator overhead. + * * Since we literally use compile-time types as keys, the essential insert() + * and find() methods accept the key type as a @em template parameter, + * accepting and returning value_type as a normal runtime value. This is to + * permit future optimization (e.g. compile-time type hashing) without + * changing the API. + */ +template +class LLTypeInfoLookup +{ + // Use this for our underlying implementation: lookup by + // std::type_info::name() string. This is one of the rare cases in which I + // dare use const char* directly, rather than std::string, because I'm + // sure that every value returned by std::type_info::name() is static. + // HOWEVER, specify our own hash + equality functors: naively comparing + // distinct const char* values won't work. + typedef boost::unordered_map impl_map_type; + +public: + typedef VALUE value_type; + + LLTypeInfoLookup() {} + + bool empty() const { return mMap.empty(); } + std::size_t size() const { return mMap.size(); } + + template + bool insert(const value_type& value) + { + // Obtain and store the std::type_info::name() string as the key. + // Return just the bool from std::map::insert()'s return pair. + return mMap.insert(typename impl_map_type::value_type(typeid(KEY).name(), value)).second; + } + + template + boost::optional find() const + { + // Use the std::type_info::name() string as the key. + typename impl_map_type::const_iterator found = mMap.find(typeid(KEY).name()); + if (found == mMap.end()) + return boost::optional(); + return found->second; + } + +private: + impl_map_type mMap; +}; + +#endif /* ! defined(LL_LLTYPEINFOLOOKUP_H) */ diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index bcbae06ec..38084811b 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -33,9 +33,9 @@ // We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes. #if LL_WINDOWS -# undef WIN32_LEAN_AND_MEAN -# include -# include +#undef WIN32_LEAN_AND_MEAN +#include +#include #endif #include "lldefs.h" @@ -452,7 +452,8 @@ static void get_random_bytes(void *buf, int nbytes) return; } -#if LL_WINDOWS +#if LL_WINDOWS + typedef struct _ASTAT_ { ADAPTER_STATUS adapt; @@ -460,58 +461,44 @@ typedef struct _ASTAT_ }ASTAT, * PASTAT; // static -S32 LLUUID::getNodeID(unsigned char * node_id) +S32 LLUUID::getNodeID(unsigned char *node_id) { - ASTAT Adapter; - NCB Ncb; - UCHAR uRetCode; - LANA_ENUM lenum; - int i; - int retval = 0; + ASTAT Adapter; + NCB Ncb; + UCHAR uRetCode; + LANA_ENUM lenum; + int i; + int retval = 0; - memset( &Ncb, 0, sizeof(Ncb) ); - Ncb.ncb_command = NCBENUM; - Ncb.ncb_buffer = (UCHAR *)&lenum; - Ncb.ncb_length = sizeof(lenum); - uRetCode = Netbios( &Ncb ); - // printf( "The NCBENUM return code is: 0x%x \n", uRetCode ); + memset( &Ncb, 0, sizeof(Ncb) ); + Ncb.ncb_command = NCBENUM; + Ncb.ncb_buffer = (UCHAR *)&lenum; + Ncb.ncb_length = sizeof(lenum); + uRetCode = Netbios( &Ncb ); - for(i=0; i < lenum.length ;i++) - { - memset( &Ncb, 0, sizeof(Ncb) ); - Ncb.ncb_command = NCBRESET; - Ncb.ncb_lana_num = lenum.lana[i]; + for(i=0; i < lenum.length ;i++) + { + memset( &Ncb, 0, sizeof(Ncb) ); + Ncb.ncb_command = NCBRESET; + Ncb.ncb_lana_num = lenum.lana[i]; - uRetCode = Netbios( &Ncb ); - // printf( "The NCBRESET on LANA %d return code is: 0x%x \n", - // lenum.lana[i], uRetCode ); + uRetCode = Netbios( &Ncb ); - memset( &Ncb, 0, sizeof (Ncb) ); - Ncb.ncb_command = NCBASTAT; - Ncb.ncb_lana_num = lenum.lana[i]; + memset( &Ncb, 0, sizeof (Ncb) ); + Ncb.ncb_command = NCBASTAT; + Ncb.ncb_lana_num = lenum.lana[i]; - strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */ - Ncb.ncb_buffer = (unsigned char *)&Adapter; - Ncb.ncb_length = sizeof(Adapter); + strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */ + Ncb.ncb_buffer = (unsigned char *)&Adapter; + Ncb.ncb_length = sizeof(Adapter); - uRetCode = Netbios( &Ncb ); -// printf( "The NCBASTAT on LANA %d return code is: 0x%x \n", -// lenum.lana[i], uRetCode ); - if ( uRetCode == 0 ) - { -// printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n", -// lenum.lana[i], -// Adapter.adapt.adapter_address[0], -// Adapter.adapt.adapter_address[1], -// Adapter.adapt.adapter_address[2], -// Adapter.adapt.adapter_address[3], -// Adapter.adapt.adapter_address[4], -// Adapter.adapt.adapter_address[5] ); + uRetCode = Netbios( &Ncb ); + if ( uRetCode == 0 ) + { memcpy(node_id,Adapter.adapt.adapter_address,6); /* Flawfinder: ignore */ retval = 1; - - } - } + } + } return retval; } diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index c54fd6be8..3a0d66e4a 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -34,7 +34,6 @@ #include #include -#include #include "stdtypes.h" #include "llpreprocessor.h" @@ -133,6 +132,7 @@ public: U8 mData[UUID_BYTES]; }; + typedef std::vector uuid_vec_t; // Construct diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 3eaf74b04..3782ff1cf 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -35,8 +35,8 @@ #include "lluuid.h" #include "llstring.h" -#include "llmemtype.h" #include "llthread.h" +#include "llmemtype.h" #include "aithreadsafe.h" const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h index a4c3d80b5..7def0c713 100644 --- a/indra/llimage/llpngwrapper.h +++ b/indra/llimage/llpngwrapper.h @@ -32,7 +32,7 @@ #ifndef LL_LLPNGWRAPPER_H #define LL_LLPNGWRAPPER_H -#include "png.h" +#include "libpng15/png.h" #include "llimage.h" class LLPngWrapper diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index c34b89e37..1f1f4ce38 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1700,6 +1700,6 @@ LLPointer ll_create_category_from_sd(const LLSD& sd_cat) LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString())); rv->setPreferredType( LLFolderType::lookup( - sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); + sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); return rv; } diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index ce62f0de2..a174f08c1 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -148,7 +148,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 46 AT_NONE LLInventoryType::IT_NONE, // 47 AT_NONE LLInventoryType::IT_NONE, // 48 AT_NONE - LLInventoryType::IT_MESH // 49 AT_MESH + LLInventoryType::IT_MESH // 49 AT_MESH }; // static diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 492be170b..e8bb3f182 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -51,7 +51,7 @@ const S32 PARCEL_UNIT_AREA = 16; const F32 PARCEL_HEIGHT = 50.f; //Height above ground which parcel boundries exist for explicitly banned avatars -const F32 BAN_HEIGHT = 768.f; +const F32 BAN_HEIGHT = 5000.f; // Maximum number of entries in an access list const S32 PARCEL_MAX_ACCESS_LIST = 300; @@ -260,7 +260,7 @@ public: void setMediaURLResetTimer(F32 time); virtual void setLocalID(S32 local_id); - // blow away all the extra crap lurking in parcels, including urls, access lists, etc + // blow away all the extra stuff lurking in parcels, including urls, access lists, etc void clearParcel(); // This value is not persisted out to the parcel file, it is only @@ -686,6 +686,7 @@ public: std::map mBanList; std::map mTempBanList; std::map mTempAccessList; + }; diff --git a/indra/llinventory/llpermissionsflags.h b/indra/llinventory/llpermissionsflags.h index afa2adbd9..f810929d6 100644 --- a/indra/llinventory/llpermissionsflags.h +++ b/indra/llinventory/llpermissionsflags.h @@ -32,9 +32,6 @@ #ifndef LL_LLPERMISSIONSFLAGS_H #define LL_LLPERMISSIONSFLAGS_H -// llpermissionsflags.h -// Copyright 2002, Linden Research, Inc. -// // Flags for various permissions bits. // Shared between viewer and simulator. diff --git a/indra/llinventory/lltransactionflags.cpp b/indra/llinventory/lltransactionflags.cpp index 41b3dc84d..fda8cad90 100644 --- a/indra/llinventory/lltransactionflags.cpp +++ b/indra/llinventory/lltransactionflags.cpp @@ -38,7 +38,7 @@ #include "lltransactiontypes.h" #include "../newview/hippogridmanager.h" - + const U8 TRANSACTION_FLAGS_NONE = 0; const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1; const U8 TRANSACTION_FLAG_DEST_GROUP = 2; diff --git a/indra/llinventory/lltransactiontypes.h b/indra/llinventory/lltransactiontypes.h index 7f49c763c..2c699bcb8 100644 --- a/indra/llinventory/lltransactiontypes.h +++ b/indra/llinventory/lltransactiontypes.h @@ -74,6 +74,7 @@ const S32 TRANS_CLASSIFIED_RENEW = 2005; // automatically end up in the list below :-( // So make sure you check the transaction_description table const S32 TRANS_RECURRING_GENERIC = 2100; + // Codes 3000-3999 reserved for inventory transactions const S32 TRANS_GIVE_INVENTORY = 3000; diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index c8a0875f5..cc1482b18 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -37,7 +37,6 @@ #include "v3math.h" #include "llvector4a.h" #include -#include #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG #define OCT_ERRS LL_ERRS("OctreeErrors") @@ -89,11 +88,12 @@ public: typedef LLOctreeTraveler oct_traveler; typedef LLTreeTraveler tree_traveler; - typedef typename std::set > element_list; - typedef typename element_list::iterator element_iter; - typedef typename element_list::const_iterator const_element_iter; + typedef LLPointer* element_list; + typedef LLPointer* element_iter; + typedef const LLPointer* const_element_iter; typedef typename std::vector*>::iterator tree_listener_iter; - typedef typename std::vector* > child_list; + typedef LLOctreeNode** child_list; + typedef LLOctreeNode** child_iter; typedef LLTreeNode BaseType; typedef LLOctreeNode oct_node; typedef LLOctreeListener oct_listener; @@ -115,6 +115,9 @@ public: : mParent((oct_node*)parent), mOctant(octant) { + mData = NULL; + mDataEnd = NULL; + mCenter = center; mSize = size; @@ -133,6 +136,16 @@ public: { BaseType::destroyListeners(); + for (U32 i = 0; i < mElementCount; ++i) + { + mData[i]->setBinIndex(-1); + mData[i] = NULL; + } + + free(mData); + mData = NULL; + mDataEnd = NULL; + for (U32 i = 0; i < getChildCount(); i++) { delete getChild(i); @@ -229,12 +242,17 @@ public: } void accept(oct_traveler* visitor) { visitor->visit(this); } - virtual bool isLeaf() const { return mChild.empty(); } + virtual bool isLeaf() const { return mChildCount == 0; } U32 getElementCount() const { return mElementCount; } + bool isEmpty() const { return mElementCount == 0; } element_list& getData() { return mData; } const element_list& getData() const { return mData; } - + element_iter getDataBegin() { return mData; } + element_iter getDataEnd() { return mDataEnd; } + const_element_iter getDataBegin() const { return mData; } + const_element_iter getDataEnd() const { return mDataEnd; } + U32 getChildCount() const { return mChildCount; } oct_node* getChild(U32 index) { return mChild[index]; } const oct_node* getChild(U32 index) const { return mChild[index]; } @@ -299,7 +317,7 @@ public: virtual bool insert(T* data) { - if (data == NULL) + if (data == NULL || data->getBinIndex() != -1) { OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << llendl; return false; @@ -309,22 +327,19 @@ public: //is it here? if (isInside(data->getPositionGroup())) { - if (((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius())) || + if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) || (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))) { //it belongs here -#if LL_OCTREE_PARANOIA_CHECK - //if this is a redundant insertion, error out (should never happen) - if (mData.find(data) != mData.end()) - { - llwarns << "Redundant octree insertion detected. " << data << llendl; - return false; - } -#endif + mElementCount++; + mData = (element_list) realloc(mData, sizeof(LLPointer)*mElementCount); - mData.insert(data); + //avoid unref on uninitialized memory + memset(mData+mElementCount-1, 0, sizeof(LLPointer)); + + mData[mElementCount-1] = data; + mDataEnd = mData + mElementCount; + data->setBinIndex(mElementCount-1); BaseType::insert(data); - - mElementCount = mData.size(); return true; } else @@ -358,10 +373,16 @@ public: if( lt == 0x7 ) { - mData.insert(data); - BaseType::insert(data); + mElementCount++; + mData = (element_list) realloc(mData, sizeof(LLPointer)*mElementCount); - mElementCount = mData.size(); + //avoid unref on uninitialized memory + memset(mData+mElementCount-1, 0, sizeof(LLPointer)); + + mData[mElementCount-1] = data; + mDataEnd = mData + mElementCount; + data->setBinIndex(mElementCount-1); + BaseType::insert(data); return true; } @@ -410,23 +431,59 @@ public: return false; } + void _remove(T* data, S32 i) + { //precondition -- mElementCount > 0, idx is in range [0, mElementCount) + + mElementCount--; + data->setBinIndex(-1); + + if (mElementCount > 0) + { + if (mElementCount != i) + { + mData[i] = mData[mElementCount]; //might unref data, do not access data after this point + mData[i]->setBinIndex(i); + } + + mData[mElementCount] = NULL; //needed for unref + mData = (element_list) realloc(mData, sizeof(LLPointer)*mElementCount); + mDataEnd = mData+mElementCount; + } + else + { + mData[0] = NULL; //needed for unref + free(mData); + mData = NULL; + mDataEnd = NULL; + } + + this->notifyRemoval(data); + checkAlive(); + } + bool remove(T* data) { - if (mData.find(data) != mData.end()) - { //we have data - mData.erase(data); - mElementCount = mData.size(); - this->notifyRemoval(data); - checkAlive(); - return true; + S32 i = data->getBinIndex(); + + if (i >= 0 && i < (S32)mElementCount) + { + if (mData[i] == data) + { //found it + _remove(data, i); + llassert(data->getBinIndex() == -1); + return true; + } } - else if (isInside(data)) + + if (isInside(data)) { oct_node* dest = getNodeAt(data); if (dest != this) { - return dest->remove(data); + bool ret = dest->remove(data); + llassert(data->getBinIndex() == -1); + return ret; } } @@ -445,19 +502,20 @@ public: //node is now root llwarns << "!!! OCTREE REMOVING FACE BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl; node->removeByAddress(data); + llassert(data->getBinIndex() == -1); return true; } void removeByAddress(T* data) { - if (mData.find(data) != mData.end()) + for (U32 i = 0; i < mElementCount; ++i) { - mData.erase(data); - mElementCount = mData.size(); - this->notifyRemoval(data); - llwarns << "FOUND!" << llendl; - checkAlive(); - return; + if (mData[i] == data) + { //we have data + _remove(data, i); + llwarns << "FOUND!" << llendl; + return; + } } for (U32 i = 0; i < getChildCount(); i++) @@ -469,8 +527,8 @@ public: void clearChildren() { - mChild.clear(); mChildCount = 0; + U32* foo = (U32*) mChildMap; foo[0] = foo[1] = 0xFFFFFFFF; } @@ -532,7 +590,7 @@ public: mChildMap[child->getOctant()] = mChildCount; - mChild.push_back(child); + mChild[mChildCount] = child; ++mChildCount; child->setParent(this); @@ -561,9 +619,12 @@ public: mChild[index]->destroy(); delete mChild[index]; } - mChild.erase(mChild.begin() + index); + --mChildCount; + mChild[index] = mChild[mChildCount]; + + //rebuild child map U32* foo = (U32*) mChildMap; foo[0] = foo[1] = 0xFFFFFFFF; @@ -619,11 +680,12 @@ protected: oct_node* mParent; U8 mOctant; - child_list mChild; + LLOctreeNode* mChild[8]; U8 mChildMap[8]; U32 mChildCount; element_list mData; + element_iter mDataEnd; U32 mElementCount; }; diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 8b47a92ea..54a88a570 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -324,16 +324,16 @@ public: LLVector4a& min = node->mExtents[0]; LLVector4a& max = node->mExtents[1]; - if (!branch->getData().empty()) + if (!branch->isEmpty()) { //node has data, find AABB that binds data set - const LLVolumeTriangle* tri = *(branch->getData().begin()); + const LLVolumeTriangle* tri = *(branch->getDataBegin()); //initialize min/max to first available vertex min = *(tri->mV[0]); max = *(tri->mV[0]); for (LLOctreeNode::const_element_iter iter = - branch->getData().begin(); iter != branch->getData().end(); ++iter) + branch->getDataBegin(); iter != branch->getDataEnd(); ++iter) { //for each triangle in node //stretch by triangles in node @@ -348,7 +348,7 @@ public: max.setMax(max, *tri->mV[2]); } } - else if (!branch->getChildren().empty()) + else if (!branch->isLeaf()) { //no data, but child nodes exist LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(0)->getListener(0); diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index d5bd5a78d..cf9aeece8 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -131,7 +131,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode* node) { for (LLOctreeNode::const_element_iter iter = - node->getData().begin(); iter != node->getData().end(); ++iter) + node->getDataBegin(); iter != node->getDataEnd(); ++iter) { const LLVolumeTriangle* tri = *iter; @@ -236,8 +236,8 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode* branch) } //children fit, check data - for (LLOctreeNode::const_element_iter iter = branch->getData().begin(); - iter != branch->getData().end(); ++iter) + for (LLOctreeNode::const_element_iter iter = branch->getDataBegin(); + iter != branch->getDataEnd(); ++iter) { const LLVolumeTriangle* tri = *iter; diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index 688d91dc4..c25e37f1a 100644 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -39,7 +39,7 @@ class LLVolumeTriangle : public LLRefCount public: LLVolumeTriangle() { - + mBinIndex = -1; } LLVolumeTriangle(const LLVolumeTriangle& rhs) @@ -64,9 +64,14 @@ public: U16 mIndex[3]; F32 mRadius; + mutable S32 mBinIndex; + virtual const LLVector4a& getPositionGroup() const; virtual const F32& getBinRadius() const; + + S32 getBinIndex() const { return mBinIndex; } + void setBinIndex(S32 idx) const { mBinIndex = idx; } }; class LLVolumeOctreeListener : public LLOctreeListener diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp index d83cd6a37..48d3f9108 100644 --- a/indra/llmessage/llares.cpp +++ b/indra/llmessage/llares.cpp @@ -38,7 +38,6 @@ #include "llapr.h" #include "llareslistener.h" -#include "llscopedvolatileaprpool.h" #if defined(LL_WINDOWS) #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally @@ -468,6 +467,7 @@ bool LLAres::process(U64 timeout) ares_socket_t socks[ARES_GETSOCK_MAXNUM]; apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM]; apr_int32_t nsds = 0; + apr_status_t status; int nactive = 0; int bitmask; @@ -478,8 +478,6 @@ bool LLAres::process(U64 timeout) return nsds > 0; } - LLScopedVolatileAPRPool scoped_pool; - for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++) { if (ARES_GETSOCK_READABLE(bitmask, i)) @@ -495,7 +493,7 @@ bool LLAres::process(U64 timeout) apr_socket_t *aprSock = NULL; - apr_status_t status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], scoped_pool); + status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], LLAPRRootPool::get()()); if (status != APR_SUCCESS) { ll_apr_warn_status(status); @@ -504,7 +502,7 @@ bool LLAres::process(U64 timeout) aprFds[nactive].desc.s = aprSock; aprFds[nactive].desc_type = APR_POLL_SOCKET; - aprFds[nactive].p = scoped_pool; + aprFds[nactive].p = LLAPRRootPool::get()(); aprFds[nactive].rtnevents = 0; aprFds[nactive].client_data = &socks[i]; @@ -513,7 +511,7 @@ bool LLAres::process(U64 timeout) if (nactive > 0) { - apr_status_t status = apr_poll(aprFds, nactive, &nsds, timeout); + status = apr_poll(aprFds, nactive, &nsds, timeout); if (status != APR_SUCCESS && status != APR_TIMEUP) { diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp index b604e40ca..58208dbe1 100644 --- a/indra/llmessage/llbuffer.cpp +++ b/indra/llmessage/llbuffer.cpp @@ -28,7 +28,6 @@ #include "linden_common.h" #include "llbuffer.h" -#include #include "llmath.h" #include "llmemtype.h" diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp index 7ac3651a7..b2dc414a6 100644 --- a/indra/llmessage/lldispatcher.cpp +++ b/indra/llmessage/lldispatcher.cpp @@ -29,7 +29,6 @@ #include "lldispatcher.h" #include -#include #include "llstl.h" #include "message.h" diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index dbb8c4e28..e0ca056a5 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -80,7 +80,6 @@ #include "llbuffer.h" #include "llbufferstream.h" -#include "llfasttimer.h" #include "llmemorystream.h" #include "llsd.h" #include "llsdserialize.h" diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index e64667836..9c1a6677e 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -33,7 +33,6 @@ #include "llapr.h" #include "llbuffer.h" #include "llbufferstream.h" -#include "llfasttimer.h" #include "llhttpnode.h" #include "lliopipe.h" #include "lliosocket.h" diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index cfc60f163..0c815c681 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -32,7 +32,6 @@ #include "llapr.h" #include "llbuffer.h" -#include "llfasttimer.h" #include "llhost.h" #include "llmemtype.h" #include "llpumpio.h" diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index 45c098bff..15ee5f2dc 100644 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -37,6 +37,7 @@ * OS poll indicates it will not block. */ +#include "llaprpool.h" #include "lliopipe.h" #include "apr_network_io.h" #include "llchainio.h" diff --git a/indra/llmessage/llioutil.cpp b/indra/llmessage/llioutil.cpp index 63dbf7b07..9fd49d23d 100644 --- a/indra/llmessage/llioutil.cpp +++ b/indra/llmessage/llioutil.cpp @@ -27,8 +27,8 @@ */ #include "linden_common.h" -#include "llfasttimer.h" #include "llioutil.h" +#include "llfasttimer.h" /** * LLIOFlush diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index 8a898ab1b..08b31e9c7 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -50,7 +50,6 @@ #include "llstring.h" #include "lluuid.h" #include "net.h" -#include "llaprpool.h" // // constants @@ -58,7 +57,7 @@ const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096; static bool gMailEnabled = true; -static LLAPRPool gMailPool; +static apr_pool_t* gMailPool; static apr_sockaddr_t* gSockAddr; static apr_socket_t* gMailSocket; @@ -83,7 +82,7 @@ bool connect_smtp() gSockAddr->sa.sin.sin_family, SOCK_STREAM, APR_PROTO_TCP, - gMailPool()); + gMailPool); if(ll_apr_warn_status(status)) return false; status = apr_socket_connect(gMailSocket, gSockAddr); if(ll_apr_warn_status(status)) @@ -140,19 +139,19 @@ BOOL LLMail::send( } // static -void LLMail::init(const std::string& hostname) +void LLMail::init(const std::string& hostname, apr_pool_t* pool) { gMailSocket = NULL; - if (hostname.empty()) + if(hostname.empty() || !pool) { + gMailPool = NULL; gSockAddr = NULL; - gMailPool.destroy(); } else { - gMailPool.create(); + gMailPool = pool; - // Collect all the information into a sockaddr structure. the + // collect all the information into a socaddr sturcture. the // documentation is a bit unclear, but I either have to // specify APR_UNSPEC or not specify any flags. I am not sure // which option is better. @@ -162,7 +161,7 @@ void LLMail::init(const std::string& hostname) APR_UNSPEC, 25, APR_IPV4_ADDR_OK, - gMailPool()); + gMailPool); ll_apr_warn_status(status); } } diff --git a/indra/llmessage/llmail.h b/indra/llmessage/llmail.h index 0a5c53208..379171436 100644 --- a/indra/llmessage/llmail.h +++ b/indra/llmessage/llmail.h @@ -27,13 +27,15 @@ #ifndef LL_LLMAIL_H #define LL_LLMAIL_H +typedef struct apr_pool_t apr_pool_t; + #include "llsd.h" class LLMail { public: // if hostname is NULL, then the host is resolved as 'mail' - static void init(const std::string& hostname); + static void init(const std::string& hostname, apr_pool_t* pool); // Allow all email transmission to be disabled/enabled. static void enable(bool mail_enabled); diff --git a/indra/llmessage/llmime.cpp b/indra/llmessage/llmime.cpp index 943a73492..9d9c4ebd6 100644 --- a/indra/llmessage/llmime.cpp +++ b/indra/llmessage/llmime.cpp @@ -388,7 +388,7 @@ bool LLMimeParser::Impl::parseHeaders( // not to read past limit when we get() the newline. S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1); istr.getline(mBuffer, max_get, '\r'); - mScanCount += istr.gcount(); + mScanCount += (S32)istr.gcount(); int c = istr.get(); if(EOF == c) { @@ -496,7 +496,7 @@ void LLMimeParser::Impl::scanPastSeparator( // past limit when we get() the newline. S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1); istr.getline(mBuffer, max_get, '\r'); - mScanCount += istr.gcount(); + mScanCount += (S32)istr.gcount(); if(istr.gcount() >= LINE_BUFFER_LENGTH - 1) { // that's way too long to be a separator, so ignore it. diff --git a/indra/llmessage/llsdmessage.cpp b/indra/llmessage/llsdmessage.cpp index 95ed03e66..67da908b7 100644 --- a/indra/llmessage/llsdmessage.cpp +++ b/indra/llmessage/llsdmessage.cpp @@ -88,7 +88,7 @@ bool LLSDMessage::httpListener(const LLSD& request) request, url, "POST", reply, error), LLSD(), // headers - timeout); + (F32)timeout); return false; } diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp index 2698a271e..615221e0a 100644 --- a/indra/llmessage/llsdmessagebuilder.cpp +++ b/indra/llmessage/llsdmessagebuilder.cpp @@ -317,7 +317,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) // S64 not supported in LLSD so we just truncate it case MVT_S64: - addS32(varname, *(S64*)mvci.getData()); + addS32(varname, (S32)*(S64*)mvci.getData()); break; case MVT_F32: diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h index 989e8b2ca..f9348eb11 100644 --- a/indra/llmessage/llxfer.h +++ b/indra/llmessage/llxfer.h @@ -29,6 +29,7 @@ #include "message.h" #include "lltimer.h" +#include "llextendedstatus.h" const S32 LL_XFER_LARGE_PAYLOAD = 7680; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 7abfea8ef..1fe40f6bc 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -98,10 +98,8 @@ std::string get_shared_secret(); class LLMessagePollInfo { public: - LLMessagePollInfo(void) : mPool(LLThread::tldata().mRootPool) { } apr_socket_t *mAPRSocketp; apr_pollfd_t mPollFD; - LLAPRPool mPool; }; namespace @@ -291,13 +289,15 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, } // LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl; - mPollInfop = new LLMessagePollInfo; - + // + // Create the data structure that we can poll on + // apr_socket_t *aprSocketp = NULL; - apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, mPollInfop->mPool()); + apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, LLAPRRootPool::get()()); + mPollInfop = new LLMessagePollInfo; mPollInfop->mAPRSocketp = aprSocketp; - mPollInfop->mPollFD.p = mPollInfop->mPool(); + mPollInfop->mPollFD.p = LLAPRRootPool::get()(); mPollInfop->mPollFD.desc_type = APR_POLL_SOCKET; mPollInfop->mPollFD.reqevents = APR_POLLIN; mPollInfop->mPollFD.rtnevents = 0; @@ -3147,7 +3147,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl; } - U32 now = time(NULL); + U32 now = (U32)time(NULL); now /= window; @@ -3167,7 +3167,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons } char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ - U32 now = time(NULL); + U32 now = (U32)time(NULL); now /= window; @@ -3213,7 +3213,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl; } - U32 now = time(NULL); + U32 now = (U32)time(NULL); now /= window; diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 58389f932..fbc663347 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -945,7 +945,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"); @@ -1001,7 +1000,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"); @@ -1050,7 +1048,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 48ad2c743..b4523ea8e 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -945,7 +945,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; @@ -1001,7 +1000,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; @@ -1050,7 +1048,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/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index b58d0c95f..4ad2a3fef 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -239,7 +239,7 @@ public: std::string getHoverText() const { return mHoverText; }; std::string getHoverLink() const { return mHoverLink; }; - std::string getMediaName() const { return mMediaName; }; + const std::string& getMediaName() const { return mMediaName; }; std::string getMediaDescription() const { return mMediaDescription; }; // Crash the plugin. If you use this outside of a testbed, you will be punished. diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index 52171c6bc..8cda46a6b 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -17,6 +17,7 @@ include_directories( set(llprimitive_SOURCE_FILES llmaterialtable.cpp + llmediaentry.cpp llmodel.cpp llprimitive.cpp llprimtexturelist.cpp diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp index 63687c258..280c6d61c 100644 --- a/indra/llprimitive/llmaterialtable.cpp +++ b/indra/llprimitive/llmaterialtable.cpp @@ -137,6 +137,7 @@ void LLMaterialTable::initTableTransNames(std::map nam infop->mName = namemap[name]; } } + void LLMaterialTable::initBasicTable() { // *TODO: Translate diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp new file mode 100644 index 000000000..02aba2bd8 --- /dev/null +++ b/indra/llprimitive/llmediaentry.cpp @@ -0,0 +1,596 @@ +/** + * @file llmediaentry.cpp + * @brief This is a single instance of media data related to the face of a prim + * + * $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 "llmediaentry.h" +#include "lllslconstants.h" + +#include + +// LLSD key defines +// DO NOT REORDER OR REMOVE THESE! + +// Some LLSD keys. Do not change! +#define MEDIA_ALT_IMAGE_ENABLE_KEY_STR "alt_image_enable" +#define MEDIA_CONTROLS_KEY_STR "controls" +#define MEDIA_CURRENT_URL_KEY_STR "current_url" +#define MEDIA_HOME_URL_KEY_STR "home_url" +#define MEDIA_AUTO_LOOP_KEY_STR "auto_loop" +#define MEDIA_AUTO_PLAY_KEY_STR "auto_play" +#define MEDIA_AUTO_SCALE_KEY_STR "auto_scale" +#define MEDIA_AUTO_ZOOM_KEY_STR "auto_zoom" +#define MEDIA_FIRST_CLICK_INTERACT_KEY_STR "first_click_interact" +#define MEDIA_WIDTH_PIXELS_KEY_STR "width_pixels" +#define MEDIA_HEIGHT_PIXELS_KEY_STR "height_pixels" + +// "security" fields +#define MEDIA_WHITELIST_ENABLE_KEY_STR "whitelist_enable" +#define MEDIA_WHITELIST_KEY_STR "whitelist" + +// "permissions" fields +#define MEDIA_PERMS_INTERACT_KEY_STR "perms_interact" +#define MEDIA_PERMS_CONTROL_KEY_STR "perms_control" + +// "general" fields +const char* LLMediaEntry::ALT_IMAGE_ENABLE_KEY = MEDIA_ALT_IMAGE_ENABLE_KEY_STR; +const char* LLMediaEntry::CONTROLS_KEY = MEDIA_CONTROLS_KEY_STR; +const char* LLMediaEntry::CURRENT_URL_KEY = MEDIA_CURRENT_URL_KEY_STR; +const char* LLMediaEntry::HOME_URL_KEY = MEDIA_HOME_URL_KEY_STR; +const char* LLMediaEntry::AUTO_LOOP_KEY = MEDIA_AUTO_LOOP_KEY_STR; +const char* LLMediaEntry::AUTO_PLAY_KEY = MEDIA_AUTO_PLAY_KEY_STR; +const char* LLMediaEntry::AUTO_SCALE_KEY = MEDIA_AUTO_SCALE_KEY_STR; +const char* LLMediaEntry::AUTO_ZOOM_KEY = MEDIA_AUTO_ZOOM_KEY_STR; +const char* LLMediaEntry::FIRST_CLICK_INTERACT_KEY = MEDIA_FIRST_CLICK_INTERACT_KEY_STR; +const char* LLMediaEntry::WIDTH_PIXELS_KEY = MEDIA_WIDTH_PIXELS_KEY_STR; +const char* LLMediaEntry::HEIGHT_PIXELS_KEY = MEDIA_HEIGHT_PIXELS_KEY_STR; + +// "security" fields +const char* LLMediaEntry::WHITELIST_ENABLE_KEY = MEDIA_WHITELIST_ENABLE_KEY_STR; +const char* LLMediaEntry::WHITELIST_KEY = MEDIA_WHITELIST_KEY_STR; + +// "permissions" fields +const char* LLMediaEntry::PERMS_INTERACT_KEY = MEDIA_PERMS_INTERACT_KEY_STR; +const char* LLMediaEntry::PERMS_CONTROL_KEY = MEDIA_PERMS_CONTROL_KEY_STR; + +#define DEFAULT_URL_PREFIX "http://" + +// Constructor(s) +LLMediaEntry::LLMediaEntry() : + mAltImageEnable(false), + mControls(STANDARD), + mCurrentURL(""), + mHomeURL(""), + mAutoLoop(false), + mAutoPlay(false), + mAutoScale(false), + mAutoZoom(false), + mFirstClickInteract(false), + mWidthPixels(0), + mHeightPixels(0), + mWhiteListEnable(false), + // mWhiteList + mPermsInteract(PERM_ALL), + mPermsControl(PERM_ALL), + mMediaIDp(NULL) +{ +} + +LLMediaEntry::LLMediaEntry(const LLMediaEntry &rhs) : + mMediaIDp(NULL) +{ + // "general" fields + mAltImageEnable = rhs.mAltImageEnable; + mControls = rhs.mControls; + mCurrentURL = rhs.mCurrentURL; + mHomeURL = rhs.mHomeURL; + mAutoLoop = rhs.mAutoLoop; + mAutoPlay = rhs.mAutoPlay; + mAutoScale = rhs.mAutoScale; + mAutoZoom = rhs.mAutoZoom; + mFirstClickInteract = rhs.mFirstClickInteract; + mWidthPixels = rhs.mWidthPixels; + mHeightPixels = rhs.mHeightPixels; + + // "security" fields + mWhiteListEnable = rhs.mWhiteListEnable; + mWhiteList = rhs.mWhiteList; + + // "permissions" fields + mPermsInteract = rhs.mPermsInteract; + mPermsControl = rhs.mPermsControl; +} + +LLMediaEntry::~LLMediaEntry() +{ + if (NULL != mMediaIDp) + { + delete mMediaIDp; + } +} + +LLSD LLMediaEntry::asLLSD() const +{ + LLSD sd; + asLLSD(sd); + return sd; +} + +// +// LLSD functions +// +void LLMediaEntry::asLLSD(LLSD& sd) const +{ + // "general" fields + sd[ALT_IMAGE_ENABLE_KEY] = mAltImageEnable; + sd[CONTROLS_KEY] = (LLSD::Integer)mControls; + sd[CURRENT_URL_KEY] = mCurrentURL; + sd[HOME_URL_KEY] = mHomeURL; + sd[AUTO_LOOP_KEY] = mAutoLoop; + sd[AUTO_PLAY_KEY] = mAutoPlay; + sd[AUTO_SCALE_KEY] = mAutoScale; + sd[AUTO_ZOOM_KEY] = mAutoZoom; + sd[FIRST_CLICK_INTERACT_KEY] = mFirstClickInteract; + sd[WIDTH_PIXELS_KEY] = mWidthPixels; + sd[HEIGHT_PIXELS_KEY] = mHeightPixels; + + // "security" fields + sd[WHITELIST_ENABLE_KEY] = mWhiteListEnable; + sd.erase(WHITELIST_KEY); + for (U32 i=0; i &whitelist ) +{ + // *NOTE: This code is VERY similar to the setWhitelist below. + // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! + U32 size = 0; + U32 count = 0; + // First count to make sure the size constraint is not violated + std::vector::const_iterator iter = whitelist.begin(); + std::vector::const_iterator end = whitelist.end(); + for ( ; iter < end; ++iter) + { + const std::string &entry = (*iter); + size += entry.length() + 1; // Include one for \0 + count ++; + if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT) + { + return LSL_STATUS_BOUNDS_ERROR; + } + } + // Next clear the vector + mWhiteList.clear(); + // Then re-iterate and copy entries + iter = whitelist.begin(); + for ( ; iter < end; ++iter) + { + const std::string &entry = (*iter); + mWhiteList.push_back(entry); + } + return LSL_STATUS_OK; +} + +U32 LLMediaEntry::setWhiteList( const LLSD &whitelist ) +{ + // If whitelist is undef, the whitelist is cleared + if (whitelist.isUndefined()) + { + mWhiteList.clear(); + return LSL_STATUS_OK; + } + + // However, if the whitelist is an empty array, erase it. + if (whitelist.isArray()) + { + // *NOTE: This code is VERY similar to the setWhitelist above. + // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! + U32 size = 0; + U32 count = 0; + // First check to make sure the size and count constraints are not violated + LLSD::array_const_iterator iter = whitelist.beginArray(); + LLSD::array_const_iterator end = whitelist.endArray(); + for ( ; iter < end; ++iter) + { + const std::string &entry = (*iter).asString(); + size += entry.length() + 1; // Include one for \0 + count ++; + if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT) + { + return LSL_STATUS_BOUNDS_ERROR; + } + } + // Next clear the vector + mWhiteList.clear(); + // Then re-iterate and copy entries + iter = whitelist.beginArray(); + for ( ; iter < end; ++iter) + { + const std::string &entry = (*iter).asString(); + mWhiteList.push_back(entry); + } + return LSL_STATUS_OK; + } + else + { + return LSL_STATUS_MALFORMED_PARAMS; + } +} + + +static void prefix_with(std::string &str, const char *chars, const char *prefix) +{ + // Given string 'str', prefix all instances of any character in 'chars' + // with 'prefix' + size_t found = str.find_first_of(chars); + size_t prefix_len = strlen(prefix); + while (found != std::string::npos) + { + str.insert(found, prefix, prefix_len); + found = str.find_first_of(chars, found+prefix_len+1); + } +} + +static bool pattern_match(const std::string &candidate_str, const std::string &pattern) +{ + // If the pattern is empty, it matches + if (pattern.empty()) return true; + + // 'pattern' is a glob pattern, we only accept '*' chars + // copy it + std::string expression = pattern; + + // Escape perl's regexp chars with a backslash, except all "*" chars + prefix_with(expression, ".[{()\\+?|^$", "\\"); + prefix_with(expression, "*", "."); + + // case-insensitive matching: + boost::regex regexp(expression, boost::regex::perl|boost::regex::icase); + return boost::regex_match(candidate_str, regexp); +} + +bool LLMediaEntry::checkCandidateUrl(const std::string& url) const +{ + if (getWhiteListEnable()) + { + return checkUrlAgainstWhitelist(url, getWhiteList()); + } + else + { + return true; + } +} + +// static +bool LLMediaEntry::checkUrlAgainstWhitelist(const std::string& url, + const std::vector &whitelist) +{ + bool passes = true; + // *NOTE: no entries? Don't check + if (whitelist.size() > 0) + { + passes = false; + + // Case insensitive: the reason why we toUpper both this and the + // filter + std::string candidate_url = url; + // Use lluri to see if there is a path part in the candidate URL. No path? Assume "/" + LLURI candidate_uri(candidate_url); + std::vector::const_iterator iter = whitelist.begin(); + std::vector::const_iterator end = whitelist.end(); + for ( ; iter < end; ++iter ) + { + std::string filter = *iter; + + LLURI filter_uri(filter); + bool scheme_passes = pattern_match( candidate_uri.scheme(), filter_uri.scheme() ); + if (filter_uri.scheme().empty()) + { + filter_uri = LLURI(DEFAULT_URL_PREFIX + filter); + } + bool authority_passes = pattern_match( candidate_uri.authority(), filter_uri.authority() ); + bool path_passes = pattern_match( candidate_uri.escapedPath(), filter_uri.escapedPath() ); + + if (scheme_passes && authority_passes && path_passes) + { + passes = true; + break; + } + } + } + return passes; +} + +U32 LLMediaEntry::setStringFieldWithLimit( std::string &field, const std::string &value, U32 limit ) +{ + if ( value.length() > limit ) + { + return LSL_STATUS_BOUNDS_ERROR; + } + else + { + field = value; + return LSL_STATUS_OK; + } +} + +U32 LLMediaEntry::setControls(LLMediaEntry::MediaControls controls) +{ + if (controls == STANDARD || + controls == MINI) + { + mControls = controls; + return LSL_STATUS_OK; + } + return LSL_STATUS_BOUNDS_ERROR; +} + +U32 LLMediaEntry::setPermsInteract( U8 val ) +{ + mPermsInteract = val & PERM_MASK; + return LSL_STATUS_OK; +} + +U32 LLMediaEntry::setPermsControl( U8 val ) +{ + mPermsControl = val & PERM_MASK; + return LSL_STATUS_OK; +} + +U32 LLMediaEntry::setCurrentURL(const std::string& current_url) +{ + return setCurrentURLInternal( current_url, true ); +} + +U32 LLMediaEntry::setCurrentURLInternal(const std::string& current_url, bool check_whitelist) +{ + if ( ! check_whitelist || checkCandidateUrl(current_url)) + { + return setStringFieldWithLimit( mCurrentURL, current_url, MAX_URL_LENGTH ); + } + else + { + return LSL_STATUS_WHITELIST_FAILED; + } +} + +U32 LLMediaEntry::setHomeURL(const std::string& home_url) +{ + return setStringFieldWithLimit( mHomeURL, home_url, MAX_URL_LENGTH ); +} + +U32 LLMediaEntry::setWidthPixels(U16 width) +{ + if (width > MAX_WIDTH_PIXELS) return LSL_STATUS_BOUNDS_ERROR; + mWidthPixels = width; + return LSL_STATUS_OK; +} + +U32 LLMediaEntry::setHeightPixels(U16 height) +{ + if (height > MAX_HEIGHT_PIXELS) return LSL_STATUS_BOUNDS_ERROR; + mHeightPixels = height; + return LSL_STATUS_OK; +} + +const LLUUID &LLMediaEntry::getMediaID() const +{ + // Lazily generate media ID + if (NULL == mMediaIDp) + { + mMediaIDp = new LLUUID(); + mMediaIDp->generate(); + } + return *mMediaIDp; +} + diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 6d7b09af7..7d4b34ead 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -83,7 +83,6 @@ LLModel::~LLModel() bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride, domSource* &pos_source, domSource* &tc_source, domSource* &norm_source) { - idx_stride = 0; for (U32 j = 0; j < inputs.getCount(); ++j) @@ -209,7 +208,6 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa n[idx[i+norm_offset]*3+1], n[idx[i+norm_offset]*3+2])); } - BOOL found = FALSE; @@ -276,7 +274,6 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa face = LLVolumeFace(); point_map.clear(); } - } if (!verts.empty()) @@ -509,7 +506,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector& fac { material = std::string(poly->getMaterial()); } - + materials.push_back(material); face_list.push_back(face); face_list.rbegin()->fillFromLegacyData(verts, indices); @@ -539,7 +536,6 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac const domInputLocalOffset_Array& inputs = poly->getInput_array(); - S32 v_offset = -1; S32 n_offset = -1; S32 t_offset = -1; @@ -651,8 +647,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac vert.mTexCoord.setVec(t->get(t_idx), t->get(t_idx+1)); } - - + verts.push_back(vert); } } @@ -1467,7 +1462,6 @@ LLSD LLModel::writeModel( } } - LLVector2 tc_range = max_tc - min_tc; for (U32 j = 0; j < (U32)face.mNumVertices; ++j) @@ -1983,6 +1977,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn //build a map of material slot names to face indexes bool reorder = false; + std::set base_mat; std::set cur_mat; diff --git a/indra/llprimitive/object_flags.h b/indra/llprimitive/object_flags.h index c873f502b..f48b97d58 100644 --- a/indra/llprimitive/object_flags.h +++ b/indra/llprimitive/object_flags.h @@ -2,31 +2,25 @@ * @file object_flags.h * @brief Flags for object creation and transmission * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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$ */ @@ -34,43 +28,47 @@ #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_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_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_AFFECTS_NAVMESH = (1U << 12); +const U32 FLAGS_CHARACTER = (1U << 13); +const U32 FLAGS_VOLUME_DETECT = (1U << 14); +const U32 FLAGS_INCLUDE_IN_SEARCH = (1U << 15); -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_ALLOW_INVENTORY_DROP = (1U << 16); +const U32 FLAGS_OBJECT_TRANSFER = (1U << 17); +const U32 FLAGS_OBJECT_GROUP_OWNED = (1U << 18); +//const U32 FLAGS_UNUSED_000 = (1U << 19); // was FLAGS_OBJECT_YOU_OFFICER -const U32 FLAGS_CAMERA_DECOUPLED = 0x00100000; -const U32 FLAGS_ANIM_SOURCE = 0x00200000; -const U32 FLAGS_CAMERA_SOURCE = 0x00400000; +const U32 FLAGS_CAMERA_DECOUPLED = (1U << 20); +const U32 FLAGS_ANIM_SOURCE = (1U << 21); +const U32 FLAGS_CAMERA_SOURCE = (1U << 22); -const U32 FLAGS_CAST_SHADOWS = 0x00800000; +//const U32 FLAGS_UNUSED_001 = (1U << 23); // was FLAGS_CAST_SHADOWS -const U32 FLAGS_OBJECT_OWNER_MODIFY = 0x10000000; +//const U32 FLAGS_UNUSED_002 = (1U << 24); +//const U32 FLAGS_UNUSED_003 = (1U << 25); +//const U32 FLAGS_UNUSED_004 = (1U << 26); +//const U32 FLAGS_UNUSED_005 = (1U << 27); -const U32 FLAGS_TEMPORARY_ON_REZ = 0x20000000; -const U32 FLAGS_TEMPORARY = 0x40000000; -const U32 FLAGS_ZLIB_COMPRESSED = 0x80000000; +const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28); -const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE; +const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29); +const U32 FLAGS_TEMPORARY = (1U << 30); +//const U32 FLAGS_UNUSED_007 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED + +const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE; typedef enum e_havok_joint_type { diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 6d7054e7e..42139dfec 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -2001,7 +2001,6 @@ BOOL LLImageGL::getMask(const LLVector2 &tc) void LLImageGL::setCategory(S32 category) { -#if 0 //turn this off temporarily because it is not in use now. if(!gAuditTexture) { return ; @@ -2022,7 +2021,6 @@ void LLImageGL::setCategory(S32 category) mCategory = -1 ; } } -#endif } //for debug use @@ -2053,14 +2051,16 @@ S32 LLImageGL::getTextureCounterIndex(U32 val) void LLImageGL::incTextureCounter(U32 val, S32 ncomponents, S32 category) { sTextureLoadedCounter[getTextureCounterIndex(val)]++ ; - sTextureMemByCategory[category] += (S32)val * ncomponents ; + if(category > -1) + sTextureMemByCategory[category] += (S32)val * ncomponents ; } //static void LLImageGL::decTextureCounter(U32 val, S32 ncomponents, S32 category) { sTextureLoadedCounter[getTextureCounterIndex(val)]-- ; - sTextureMemByCategory[category] += (S32)val * ncomponents ; + if(category > -1) + sTextureMemByCategory[category] -= (S32)val * ncomponents ; } void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size) diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 25e775c1e..2cedee327 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -33,34 +33,247 @@ #include "linden_common.h" #include "llpostprocess.h" -#include "llglslshader.h" -#include "llsdserialize.h" -#include "llrender.h" -#include "llvertexbuffer.h" #include "lldir.h" +#include "llgl.h" +#include "llglslshader.h" +#include "llrender.h" +#include "llsdserialize.h" +#include "llsdutil.h" +#include "llsdutil_math.h" +#include "llvertexbuffer.h" +#include "llfasttimer.h" + extern LLGLSLShader gPostColorFilterProgram; extern LLGLSLShader gPostNightVisionProgram; extern LLGLSLShader gPostGaussianBlurProgram; +extern LLGLSLShader gPostPosterizeProgram; static const unsigned int NOISE_SIZE = 512; -/// CALCULATING LUMINANCE (Using NTSC lum weights) -/// http://en.wikipedia.org/wiki/Luma_%28video%29 -static const float LUMINANCE_R = 0.299f; -static const float LUMINANCE_G = 0.587f; -static const float LUMINANCE_B = 0.114f; - static const char * const XML_FILENAME = "postprocesseffects.xml"; -LLPostProcess::LLPostProcess(void) : - mVBO(NULL), - mAllEffects(LLSD::emptyMap()), - mScreenWidth(1), mScreenHeight(1) +template<> LLSD LLPostProcessShader::LLShaderSetting::getDefaultValue() { - mSceneRenderTexture = NULL ; - mNoiseTexture = NULL ; - + return mDefault.getValue(); +} +template<> void LLPostProcessShader::LLShaderSetting::setValue(const LLSD& value) +{ + mValue = ll_vector4_from_sd(value); +} + +LLSD LLPostProcessShader::getDefaults() +{ + LLSD defaults; + for(std::vector::iterator it=mSettings.begin();it!=mSettings.end();++it) + { + defaults[(*it)->mSettingName]=(*it)->getDefaultValue(); + } + return defaults; +} +void LLPostProcessShader::loadSettings(const LLSD& settings) +{ + for(std::vector::iterator it=mSettings.begin();it!=mSettings.end();++it) + { + LLSD value = settings[(*it)->mSettingName]; + (*it)->setValue(value); + } +} + +class LLColorFilterShader : public LLPostProcessShader +{ +private: + LLShaderSetting mEnabled; + LLShaderSetting mGamma, mBrightness, mContrast, mSaturation; + LLShaderSetting mContrastBase; +public: + LLColorFilterShader() : + mEnabled("enable_color_filter",false), + mGamma("gamma",1.f), + mBrightness("brightness",1.f), + mContrast("contrast",1.f), + mSaturation("saturation",1.f), + mContrastBase("contrast_base",LLVector4(1.f,1.f,1.f,0.5f)) + { + mSettings.push_back(&mEnabled); + mSettings.push_back(&mGamma); + mSettings.push_back(&mBrightness); + mSettings.push_back(&mContrast); + mSettings.push_back(&mSaturation); + mSettings.push_back(&mContrastBase); + } + + bool isEnabled() { return mEnabled && gPostColorFilterProgram.mProgramObject; } + S32 getColorChannel() { return 0; } + S32 getDepthChannel() { return -1; } + + QuadType bind() + { + if(!isEnabled()) + return QUAD_NONE; + + /// CALCULATING LUMINANCE (Using NTSC lum weights) + /// http://en.wikipedia.org/wiki/Luma_%28video%29 + static const float LUMINANCE_R = 0.299f; + static const float LUMINANCE_G = 0.587f; + static const float LUMINANCE_B = 0.114f; + + gPostColorFilterProgram.bind(); + + gPostColorFilterProgram.uniform1f("gamma", mGamma); + gPostColorFilterProgram.uniform1f("brightness", mBrightness); + gPostColorFilterProgram.uniform1f("contrast", mContrast); + float baseI = (mContrastBase.mValue[VX] + mContrastBase.mValue[VY] + mContrastBase.mValue[VZ]) / 3.0f; + baseI = mContrastBase.mValue[VW] / ((baseI < 0.001f) ? 0.001f : baseI); + float baseR = mContrastBase.mValue[VX] * baseI; + float baseG = mContrastBase.mValue[VY] * baseI; + float baseB = mContrastBase.mValue[VZ] * baseI; + gPostColorFilterProgram.uniform3fv("contrastBase", 1, LLVector3(baseR, baseG, baseB).mV); + gPostColorFilterProgram.uniform1f("saturation", mSaturation); + gPostColorFilterProgram.uniform3fv("lumWeights", 1, LLVector3(LUMINANCE_R, LUMINANCE_G, LUMINANCE_B).mV); + return QUAD_NORMAL; + } + bool draw(U32 pass) {return pass == 1;} + void unbind() + { + gPostColorFilterProgram.unbind(); + } +}; + +class LLNightVisionShader : public LLPostProcessShader +{ +private: + LLShaderSetting mEnabled; + LLShaderSetting mBrightnessMult, mNoiseStrength; +public: + LLNightVisionShader() : + mEnabled("enable_night_vision",false), + mBrightnessMult("brightness_multiplier",3.f), + mNoiseStrength("noise_strength",.4f) + { + mSettings.push_back(&mEnabled); + mSettings.push_back(&mBrightnessMult); + mSettings.push_back(&mNoiseStrength); + } + bool isEnabled() { return mEnabled && gPostNightVisionProgram.mProgramObject; } + S32 getColorChannel() { return 0; } + S32 getDepthChannel() { return -1; } + QuadType bind() + { + if(!isEnabled()) + return QUAD_NONE; + + gPostNightVisionProgram.bind(); + + LLPostProcess::getInstance()->bindNoise(1); + + gPostNightVisionProgram.uniform1f("brightMult", mBrightnessMult); + gPostNightVisionProgram.uniform1f("noiseStrength", mNoiseStrength); + + return QUAD_NOISE; + + } + bool draw(U32 pass) {return pass == 1;} + void unbind() + { + gPostNightVisionProgram.unbind(); + } +}; + +class LLGaussBlurShader : public LLPostProcessShader +{ +private: + LLShaderSetting mEnabled; + LLShaderSetting mNumPasses; + GLint mPassLoc; +public: + LLGaussBlurShader() : + mEnabled("enable_gauss_blur",false), + mNumPasses("gauss_blur_passes",2), + mPassLoc(0) + { + mSettings.push_back(&mEnabled); + mSettings.push_back(&mNumPasses); + } + bool isEnabled() { return mEnabled && mNumPasses && gPostGaussianBlurProgram.mProgramObject; } + S32 getColorChannel() { return 0; } + S32 getDepthChannel() { return -1; } + QuadType bind() + { + if(!isEnabled()) + return QUAD_NONE; + + gPostGaussianBlurProgram.bind(); + + mPassLoc = gPostGaussianBlurProgram.getUniformLocation("horizontalPass"); + + return QUAD_NORMAL; + } + bool draw(U32 pass) + { + if((S32)pass > mNumPasses*2) + return false; + glUniform1iARB(mPassLoc, (pass-1) % 2); + return true; + } + void unbind() + { + gPostGaussianBlurProgram.unbind(); + } +}; + +class LLPosterizeShader : public LLPostProcessShader +{ +private: + LLShaderSetting mEnabled; + LLShaderSetting mNumLayers; +public: + LLPosterizeShader() : + mEnabled("enable_posterize",false), + mNumLayers("posterize_layers",2) + { + mSettings.push_back(&mEnabled); + mSettings.push_back(&mNumLayers); + } + bool isEnabled() { return mEnabled && gPostPosterizeProgram.mProgramObject; } + S32 getColorChannel() { return 0; } + S32 getDepthChannel() { return -1; } + QuadType bind() + { + if(!isEnabled()) + return QUAD_NONE; + + gPostPosterizeProgram.bind(); + + gPostPosterizeProgram.uniform1i("layerCount", mNumLayers); + + return QUAD_NORMAL; + } + bool draw(U32 pass) + { + return pass == 1; + } + void unbind() + { + gPostPosterizeProgram.unbind(); + } +}; + +LLPostProcess::LLPostProcess(void) : + mVBO(NULL), + mDepthTexture(0), + mNoiseTexture(NULL), + mScreenWidth(0), + mScreenHeight(0), + mNoiseTextureScale(0.f), + mSelectedEffectInfo(LLSD::emptyMap()), + mAllEffectInfo(LLSD::emptyMap()) +{ + mShaders.push_back(new LLColorFilterShader()); + mShaders.push_back(new LLNightVisionShader()); + mShaders.push_back(new LLGaussBlurShader()); + mShaders.push_back(new LLPosterizeShader()); + /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.*/ std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; @@ -71,99 +284,43 @@ LLPostProcess::LLPostProcess(void) : { LLPointer parser = new LLSDXMLParser(); - parser->parse(effectsXML, mAllEffects, LLSDSerialize::SIZE_UNLIMITED); + parser->parse(effectsXML, mAllEffectInfo, LLSDSerialize::SIZE_UNLIMITED); } - if (!mAllEffects.has("default")) + if (!mAllEffectInfo.has("default")) + mAllEffectInfo["default"] = LLSD::emptyMap(); + + LLSD& defaults = mAllEffectInfo["default"]; + + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) { - LLSD & defaultEffect = (mAllEffects["default"] = LLSD::emptyMap()); - - /*defaultEffect["enable_night_vision"] = LLSD::Boolean(false); - defaultEffect["enable_color_filter"] = LLSD::Boolean(false);*/ - - /// NVG Defaults - defaultEffect["brightness_multiplier"] = 3.0; - defaultEffect["noise_size"] = 25.0; - defaultEffect["noise_strength"] = 0.4; - - // TODO BTest potentially add this to tweaks? - mNoiseTextureScale = 1.0f; - - /// Color Filter Defaults - defaultEffect["gamma"] = 1.0; - defaultEffect["brightness"] = 1.0; - defaultEffect["contrast"] = 1.0; - defaultEffect["saturation"] = 1.0; - - LLSD& contrastBase = (defaultEffect["contrast_base"] = LLSD::emptyArray()); - contrastBase.append(1.0); - contrastBase.append(1.0); - contrastBase.append(1.0); - contrastBase.append(0.5); - - defaultEffect["gauss_blur_passes"] = 2; + LLSD shader_defaults = (*it)->getDefaults(); + for (LLSD::map_const_iterator it2 = defaults.beginMap();it2 != defaults.endMap();++it2) + { + if(!defaults.has(it2->first)) + defaults[it2->first]=it2->second; + } + } + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) + { + (*it)->loadSettings(defaults); } - setSelectedEffect("default"); - // */ } LLPostProcess::~LLPostProcess(void) { - invalidate() ; -} - -/*static*/void LLPostProcess::cleanupClass() -{ - if(instanceExists()) - getInstance()->invalidate() ; -} - -void LLPostProcess::setSelectedEffect(std::string const & effectName) -{ - mSelectedEffectName = effectName; - static_cast(tweaks) = mAllEffects[effectName]; -} - -void LLPostProcess::saveEffect(std::string const & effectName) -{ - mAllEffects[effectName] = tweaks; - - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - //llinfos << "Saving PostProcess Effects settings to " << pathName << llendl; - - llofstream effectsXML(pathName); - - LLPointer formatter = new LLSDXMLFormatter(); - - formatter->format(mAllEffects, effectsXML); -} -void LLPostProcess::invalidate() -{ - mSceneRenderTexture = NULL ; - mNoiseTexture = NULL ; - mVBO = NULL ; -} - -void LLPostProcess::apply(unsigned int width, unsigned int height) -{ - if(shadersEnabled()) - { - if (mVBO.isNull() || width != mScreenWidth || height != mScreenHeight) - { - initialize(width, height); - } - doEffects(); - } + destroyGL() ; } void LLPostProcess::initialize(unsigned int width, unsigned int height) { - invalidate(); + destroyGL(); mScreenWidth = width; mScreenHeight = height; - createScreenTexture(); + createScreenTextures(); + createNoiseTexture(); //Setup our VBO. { @@ -185,127 +342,129 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height) mVBO->flush(); } - - checkError(); - createNoiseTexture(); - checkError(); + stop_glerror(); } -inline bool LLPostProcess::shadersEnabled(void) +void LLPostProcess::createScreenTextures() { - return (tweaks.useColorFilter().asBoolean() || - tweaks.useNightVisionShader().asBoolean() || - tweaks.useGaussBlurFilter().asBoolean() ); -} + const LLTexUnit::eTextureType type = LLTexUnit::TT_RECT_TEXTURE; -void LLPostProcess::applyShaders(void) -{ - bool copy_buffer = false; - if (tweaks.useColorFilter()) + mRenderTarget[0].allocate(mScreenWidth,mScreenHeight,GL_RGBA,FALSE,FALSE,type,FALSE); + if(mRenderTarget[0].getFBO())//Only need pingpong between two rendertargets if FBOs are supported. + mRenderTarget[1].allocate(mScreenWidth,mScreenHeight,GL_RGBA,FALSE,FALSE,type,FALSE); + stop_glerror(); + + if(mDepthTexture) + LLImageGL::deleteTextures(type, 0, 0, 1, &mDepthTexture, true); + + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) { - applyColorFilterShader(); - checkError(); - copy_buffer = true; - } - if (tweaks.useGaussBlurFilter()) - { - /// If any of the above shaders have been called update the frame buffer; - if (copy_buffer) - copyFrameBuffer(); - applyGaussBlurShader(); - checkError(); - copy_buffer = true; - } - if (tweaks.useNightVisionShader()) - { - /// If any of the above shaders have been called update the frame buffer; - if (copy_buffer) - copyFrameBuffer(); - applyNightVisionShader(); - checkError(); - copy_buffer = true; - } -} - -void LLPostProcess::applyColorFilterShader(void) -{ - if(gPostColorFilterProgram.mProgramObject == 0) - return; - - gPostColorFilterProgram.bind(); - - gGL.getTexUnit(0)->bind(mSceneRenderTexture); - - gPostColorFilterProgram.uniform1f("gamma", tweaks.getGamma()); - gPostColorFilterProgram.uniform1f("brightness", tweaks.getBrightness()); - gPostColorFilterProgram.uniform1f("contrast", tweaks.getContrast()); - float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f; - baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI); - float baseR = tweaks.getContrastBaseR() * baseI; - float baseG = tweaks.getContrastBaseG() * baseI; - float baseB = tweaks.getContrastBaseB() * baseI; - gPostColorFilterProgram.uniform3fv("contrastBase", 1, LLVector3(baseR, baseG, baseB).mV); - gPostColorFilterProgram.uniform1f("saturation", tweaks.getSaturation()); - gPostColorFilterProgram.uniform3fv("lumWeights", 1, LLVector3(LUMINANCE_R, LUMINANCE_G, LUMINANCE_B).mV); - - /// Draw a screen space quad - drawOrthoQuad(QUAD_NORMAL); - gPostColorFilterProgram.unbind(); -} - -void LLPostProcess::applyNightVisionShader(void) -{ - if(gPostNightVisionProgram.mProgramObject == 0) - return; - - gPostNightVisionProgram.bind(); - - gGL.getTexUnit(0)->bind(mSceneRenderTexture); - gGL.getTexUnit(1)->bind(mNoiseTexture); - - gPostNightVisionProgram.uniform1f("brightMult", tweaks.getBrightMult()); - gPostNightVisionProgram.uniform1f("noiseStrength", tweaks.getNoiseStrength()); - mNoiseTextureScale = 0.001f + ((100.f - tweaks.getNoiseSize()) / 100.f); - mNoiseTextureScale *= (mScreenHeight / NOISE_SIZE); - - /// Draw a screen space quad - drawOrthoQuad(QUAD_NOISE); - gPostNightVisionProgram.unbind(); -} - -void LLPostProcess::applyGaussBlurShader(void) -{ - int pass_count = tweaks.getGaussBlurPasses(); - if(!pass_count || gPostGaussianBlurProgram.mProgramObject == 0) - return; - - gPostGaussianBlurProgram.bind(); - - gGL.getTexUnit(0)->bind(mSceneRenderTexture); - - GLint horiz_pass = gPostGaussianBlurProgram.getUniformLocation("horizontalPass"); - for(int i = 0;igetDepthChannel()>=0) { - if(i || j) - copyFrameBuffer(); - glUniform1iARB(horiz_pass, j); - drawOrthoQuad(QUAD_NORMAL); + LLImageGL::generateTextures(type, GL_DEPTH_COMPONENT24, 1, &mDepthTexture); + gGL.getTexUnit(0)->bindManual(type, mDepthTexture); + LLImageGL::setManualImage(LLTexUnit::getInternalType(type), 0, GL_DEPTH_COMPONENT24, mScreenWidth, mScreenHeight, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); + stop_glerror(); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + stop_glerror(); + break; + } + } +} + +void LLPostProcess::createNoiseTexture() +{ + std::vector buffer(NOISE_SIZE * NOISE_SIZE); + for (unsigned int i = 0; i < NOISE_SIZE; i++){ + for (unsigned int k = 0; k < NOISE_SIZE; k++){ + buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f); + } + } + + mNoiseTexture = new LLImageGL(FALSE) ; + if(mNoiseTexture->createGLTexture()) + { + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture->getTexName()); + LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]); + stop_glerror(); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); + stop_glerror(); + } +} + +void LLPostProcess::destroyGL() +{ + mRenderTarget[0].release(); + mRenderTarget[1].release(); + if(mDepthTexture) + LLImageGL::deleteTextures(LLTexUnit::TT_RECT_TEXTURE, 0, 0, 1, &mDepthTexture, true); + mDepthTexture=0; + mNoiseTexture = NULL ; + mVBO = NULL ; +} + +/*static*/void LLPostProcess::cleanupClass() +{ + if(instanceExists()) + getInstance()->destroyGL() ; +} + +void LLPostProcess::copyFrameBuffer() +{ + mRenderTarget[!!mRenderTarget[0].getFBO()].bindTexture(0,0); + glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight); + + if(mDepthTexture) + { + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) + { + if((*it)->isEnabled() && (*it)->getDepthChannel()>=0) + { + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture); + glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight); + break; + } + } + } + +} + +void LLPostProcess::bindNoise(U32 channel) +{ + gGL.getTexUnit(channel)->bind(mNoiseTexture); +} + +void LLPostProcess::renderEffects(unsigned int width, unsigned int height) +{ + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) + { + if((*it)->isEnabled()) + { + if (mVBO.isNull() || width != mScreenWidth || height != mScreenHeight) + { + initialize(width, height); + } + doEffects(); + return; } } - gPostGaussianBlurProgram.unbind(); } void LLPostProcess::doEffects(void) { LLVertexBuffer::unbind(); + mNoiseTextureScale = 0.001f + ((100.f - mSelectedEffectInfo["noise_size"].asFloat()) / 100.f); + mNoiseTextureScale *= (mScreenHeight / NOISE_SIZE); + /// Copy the screen buffer to the render texture copyFrameBuffer(); + stop_glerror(); //Disable depth. Set blendmode to replace. - LLGLDepthTest depth(GL_FALSE); + LLGLDepthTest depth(GL_FALSE,GL_FALSE); LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_REPLACE); @@ -319,7 +478,6 @@ void LLPostProcess::doEffects(void) gGL.loadIdentity(); applyShaders(); - checkError(); LLGLSLShader::bindNoShader(); @@ -333,13 +491,46 @@ void LLPostProcess::doEffects(void) gGL.setSceneBlendType(LLRender::BT_ALPHA); //Restore blendstate. Alpha is ASSUMED for hud/ui render, etc. gGL.getTexUnit(1)->disable(); - checkError(); } -void LLPostProcess::copyFrameBuffer() +void LLPostProcess::applyShaders(void) { - gGL.getTexUnit(0)->bindManual(mSceneRenderTexture->getTarget(), mSceneRenderTexture->getTexName()); - glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, mScreenWidth, mScreenHeight, 0); + QuadType quad; + bool primary_rendertarget = 1; + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) + { + if((quad = (*it)->bind()) != QUAD_NONE) + { + S32 color_channel = (*it)->getColorChannel(); + S32 depth_channel = (*it)->getDepthChannel(); + + if(depth_channel >= 0) + gGL.getTexUnit(depth_channel)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture); + + U32 pass = 1; + + while((*it)->draw(pass++)) + { + mRenderTarget[!primary_rendertarget].bindTarget(); + + if(color_channel >= 0) + mRenderTarget[mRenderTarget[0].getFBO() ? primary_rendertarget : !primary_rendertarget].bindTexture(0,color_channel); + + drawOrthoQuad(quad); + mRenderTarget[!primary_rendertarget].flush(); + if(mRenderTarget[0].getFBO()) + primary_rendertarget = !primary_rendertarget; + } + (*it)->unbind(); + } + } + //Only need to copy to framebuffer if FBOs are supported, else we've already been drawing to the framebuffer to begin with. + if(mRenderTarget[0].getFBO()) + { + //copyContentsToFramebuffer also binds the main framebuffer. + LLRenderTarget::copyContentsToFramebuffer(mRenderTarget[primary_rendertarget],0,0,mScreenWidth,mScreenHeight,0,0,mScreenWidth,mScreenHeight,GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + stop_glerror(); } void LLPostProcess::drawOrthoQuad(QuadType type) @@ -364,64 +555,59 @@ void LLPostProcess::drawOrthoQuad(QuadType type) mVBO->drawArrays(LLRender::TRIANGLE_STRIP, 0, 4); } -void LLPostProcess::createScreenTexture() +void LLPostProcess::setSelectedEffect(std::string const & effectName) { - std::vector data(mScreenWidth * mScreenHeight * 3, 0) ; - - mSceneRenderTexture = new LLImageGL(FALSE) ; - if(mSceneRenderTexture->createGLTexture()) + mSelectedEffectName = effectName; + mSelectedEffectInfo = mAllEffectInfo[effectName]; + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mSceneRenderTexture->getTexName()); - LLImageGL::setManualImage(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, mScreenWidth, mScreenHeight, GL_RGB, GL_UNSIGNED_BYTE, &data[0]); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + (*it)->loadSettings(mSelectedEffectInfo); } } -void LLPostProcess::createNoiseTexture() -{ - std::vector buffer(NOISE_SIZE * NOISE_SIZE); - for (unsigned int i = 0; i < NOISE_SIZE; i++){ - for (unsigned int k = 0; k < NOISE_SIZE; k++){ - buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f); - } - } - - mNoiseTexture = new LLImageGL(FALSE) ; - if(mNoiseTexture->createGLTexture()) - { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture->getTexName()); - LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); - } -} - -bool LLPostProcess::checkError(void) +void LLPostProcess::setSelectedEffectValue(std::string const & setting, LLSD value) { - GLenum glErr; - bool retCode = false; - - glErr = glGetError(); - while (glErr != GL_NO_ERROR) - { - // shaderErrorLog << (const char *) gluErrorString(glErr) << std::endl; - char const * err_str_raw = (const char *) gluErrorString(glErr); - - if(err_str_raw == NULL) - { - std::ostringstream err_builder; - err_builder << "unknown error number " << glErr; - mShaderErrorString = err_builder.str(); - } - else - { - mShaderErrorString = err_str_raw; - } - - retCode = true; - glErr = glGetError(); - } - return retCode; + char buf[256]; + S32 elem=0; + if(sscanf(setting.c_str(),"%255[^[][%d]", buf, &elem) == 2) + { + mSelectedEffectInfo[static_cast(buf)][elem] = value; + } + else + { + mSelectedEffectInfo[setting] = value; + } + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) + { + (*it)->loadSettings(mSelectedEffectInfo); + } } +void LLPostProcess::resetSelectedEffect() +{ + if(!llsd_equals(mAllEffectInfo[mSelectedEffectName], mSelectedEffectInfo)) + { + mSelectedEffectInfo = mAllEffectInfo[mSelectedEffectName]; + for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) + { + (*it)->loadSettings(mSelectedEffectInfo); + } + } +} + +void LLPostProcess::saveEffectAs(std::string const & effectName) +{ + mAllEffectInfo[effectName] = mSelectedEffectInfo; + + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); + //llinfos << "Saving PostProcess Effects settings to " << pathName << llendl; + + llofstream effectsXML(pathName); + + LLPointer formatter = new LLSDXMLFormatter(); + + formatter->format(mAllEffectInfo, effectsXML); +} + + + diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h index 459fa6851..ec076842d 100644 --- a/indra/llrender/llpostprocess.h +++ b/indra/llrender/llpostprocess.h @@ -34,189 +34,123 @@ #define LL_POSTPROCESS_H #include -#include -#include "llgl.h" -#include "llglheaders.h" +#include "llsd.h" +#include "llrendertarget.h" + +class LLSD; + +typedef enum _QuadType { + QUAD_NONE, + QUAD_NORMAL, + QUAD_NOISE +} QuadType; + +//LLPostProcessShader is an attempt to encapsulate the shaders a little better. +class LLPostProcessShader : public LLRefCount //Abstract. PostProcess shaders derive off of this common base. +{ +protected: + //LLShaderSetting is used to associate key names to member variables to avoid LLSD lookups when drawing. + //It also facilitates automating the assigning of defaults to, as well as parsing from, the effects LLSD list. + //This replaces the entire old PostProcessTweaks structure. More will be done in the future to move into a more + //xml-driven configuration. + struct LLShaderSettingBase + { + LLShaderSettingBase(const char* name) : mSettingName(name) {} + const char* mSettingName; //LLSD key names as found in postprocesseffects.xml. eg 'contrast_base' + virtual LLSD getDefaultValue() = 0; //Converts the member variable as an LLSD. Used to set defaults absent in postprocesseffects.xml + virtual void setValue(const LLSD& value) = 0; //Connects the LLSD element to the member variable. Used when loading effects (such as default) + }; + template + struct LLShaderSetting : public LLShaderSettingBase + { + LLShaderSetting(const char* setting_name, T def) : LLShaderSettingBase(setting_name), mValue(def), mDefault(def) {} + T mValue; //The member variable mentioned above. + T mDefault; //Set via ctor. Value is inserted into the defaults LLSD list if absent from postprocesseffects.xml + LLSD getDefaultValue() { return mDefault; } //See LLShaderSettingBase::getDefaultValue + void setValue(const LLSD& value) { mValue = value; } //See LLShaderSettingBase::setValue + operator T() { return mValue; } //Typecast operator overload so this object can be handled as if it was whatever T represents. + }; + std::vector mSettings; //Contains a list of all the 'settings' this shader uses. Manually add via push_back in ctor. +public: + virtual ~LLPostProcessShader() {}; + virtual bool isEnabled() = 0; //Returning false avoids bind/draw/unbind calls. If no shaders are enabled, framebuffer copying is skipped. + virtual S32 getColorChannel() = 0; //If color buffer is used in this shader returns > -1 to cue LLPostProcess on copying it from the framebuffer. + virtual S32 getDepthChannel() = 0; //If depth buffer is used in this shader returns > -1 to cue LLPostProcess on copying it from the framebuffer. + virtual QuadType bind() = 0; //Bind shader and textures, set up attribs. Returns the 'type' of quad to be drawn. + virtual bool draw(U32 pass) = 0; //returning false means finished. Used to update per-pass attributes and such. LLPostProcess will call + //drawOrthoQuad when this returns true, increment pass, then call this again, and keep repeating this until false is returned. + virtual void unbind() = 0; //Unbind shader and textures. + + LLSD getDefaults(); //Returns a full LLSD kvp list filled with default values. + void loadSettings(const LLSD& settings); //Parses the effects LLSD list and sets the member variables linked to them (via LLShaderSetting::setValue()) +}; + +//LLVector4 does not implicitly convert to and from LLSD, so template specilizations are necessary. +template<> LLSD LLPostProcessShader::LLShaderSetting::getDefaultValue(); +template<> void LLPostProcessShader::LLShaderSetting::setValue(const LLSD& value); class LLPostProcess : public LLSingleton { -public: - - typedef enum _QuadType { - QUAD_NORMAL, - QUAD_NOISE - } QuadType; - - /// GLSL Shader Encapsulation Struct - //typedef std::map glslUniforms; - - struct PostProcessTweaks : public LLSD { - inline PostProcessTweaks() : LLSD(LLSD::emptyMap()) - { - } - - inline LLSD & brightMult() { - return (*this)["brightness_multiplier"]; - } - - inline LLSD & noiseStrength() { - return (*this)["noise_strength"]; - } - - inline LLSD & noiseSize() { - return (*this)["noise_size"]; - } - - inline LLSD & brightness() { - return (*this)["brightness"]; - } - - inline LLSD & contrast() { - return (*this)["contrast"]; - } - - inline LLSD & contrastBaseR() { - return (*this)["contrast_base"][0]; - } - - inline LLSD & contrastBaseG() { - return (*this)["contrast_base"][1]; - } - - inline LLSD & contrastBaseB() { - return (*this)["contrast_base"][2]; - } - - inline LLSD & contrastBaseIntensity() { - return (*this)["contrast_base"][3]; - } - - inline LLSD & saturation() { - return (*this)["saturation"]; - } - - inline LLSD & useNightVisionShader() { - return (*this)["enable_night_vision"]; - } - - inline LLSD & useColorFilter() { - return (*this)["enable_color_filter"]; - } - - inline LLSD & useGaussBlurFilter() { - return (*this)["enable_gauss_blur"]; - } - - inline F32 getBrightMult() const { - return F32((*this)["brightness_multiplier"].asReal()); - } - - inline F32 getNoiseStrength() const { - return F32((*this)["noise_strength"].asReal()); - } - - inline F32 getNoiseSize() const { - return F32((*this)["noise_size"].asReal()); - } - - inline F32 getGamma() const { - return F32((*this)["gamma"].asReal()); - } - - inline F32 getBrightness() const { - return F32((*this)["brightness"].asReal()); - } - - inline F32 getContrast() const { - return F32((*this)["contrast"].asReal()); - } - - inline F32 getContrastBaseR() const { - return F32((*this)["contrast_base"][0].asReal()); - } - - inline F32 getContrastBaseG() const { - return F32((*this)["contrast_base"][1].asReal()); - } - - inline F32 getContrastBaseB() const { - return F32((*this)["contrast_base"][2].asReal()); - } - - inline F32 getContrastBaseIntensity() const { - return F32((*this)["contrast_base"][3].asReal()); - } - - inline F32 getSaturation() const { - return F32((*this)["saturation"].asReal()); - } - - inline LLSD & getGaussBlurPasses() { - return (*this)["gauss_blur_passes"]; - } - }; - - PostProcessTweaks tweaks; - - // the map of all availible effects - LLSD mAllEffects; - private: + std::list > mShaders; //List of all registered LLPostProcessShader instances. + LLPointer mVBO; - LLPointer mSceneRenderTexture ; + U32 mNextDrawTarget; //Need to pingpong between two rendertargets. Cannot sample target texture of currently bound FBO. + // However this is ONLY the case if fbos are actually supported, else swapping isn't needed. + LLRenderTarget mRenderTarget[2]; + U32 mDepthTexture; LLPointer mNoiseTexture ; + + U32 mScreenWidth; + U32 mScreenHeight; + F32 mNoiseTextureScale; + + // The name of currently selected effect in mAllEffectInfo + std::string mSelectedEffectName; + // The map of settings for currently selected effect. + LLSD mSelectedEffectInfo; + // The map of all availible effects + LLSD mAllEffectInfo; public: LLPostProcess(void); - ~LLPostProcess(void); +private: + // OpenGL initialization + void initialize(unsigned int width, unsigned int height); //Sets mScreenWidth and mScreenHeight + // calls createScreenTextures and createNoiseTexture + // creates VBO + void createScreenTextures(); //Creates color texture and depth texture(if needed). + void createNoiseTexture(); //Creates 'random' noise texture. - void apply(unsigned int width, unsigned int height); - void invalidate() ; - - // Cleanup of global data that's only inited once per class. +public: + // Teardown + // Called on destroyGL or cleanupClass. Releases VBOs, rendertargets and textures. + void destroyGL(); + // Cleanup of global data that's only inited once per class. static void cleanupClass(); - void setSelectedEffect(std::string const & effectName); - - inline std::string const & getSelectedEffect(void) const { - return mSelectedEffectName; - } - - void saveEffect(std::string const & effectName); - -private: - /// read in from file - std::string mShaderErrorString; - unsigned int mScreenWidth; - unsigned int mScreenHeight; - - float mNoiseTextureScale; - - // the name of currently selected effect in mAllEffects - // invariant: tweaks == mAllEffects[mSelectedEffectName] - std::string mSelectedEffectName; - - /// General functions - void initialize(unsigned int width, unsigned int height); - void doEffects(void); - void applyShaders(void); - bool shadersEnabled(void); - - /// Night Vision Functions - void applyNightVisionShader(void); - - /// Color Filter Functions - void applyColorFilterShader(void); - - /// Gaussian blur Filter Functions - void applyGaussBlurShader(void); - - /// OpenGL Helper Functions + // Setup for draw. void copyFrameBuffer(); - void createScreenTexture(); - void createNoiseTexture(); - bool checkError(void); - void drawOrthoQuad(QuadType type); + void bindNoise(U32 channel); + + // Draw + void renderEffects(unsigned int width, unsigned int height); //Entry point for newview. +private: + void doEffects(void); //Sets up viewmatrix, blits the framebuffer, then calls applyShaders. + void applyShaders(void); //Iterates over all active post shaders, manages binding, calls drawOrthoQuad for render. + void drawOrthoQuad(QuadType type); //Finally draws fullscreen quad with the shader currently bound. + +public: + // UI interaction + // Getters + inline LLSD const & getAllEffectInfo(void) const { return mAllEffectInfo; } + inline std::string const & getSelectedEffectName(void) const { return mSelectedEffectName; } + inline LLSD const & getSelectedEffectInfo(void) const { return mSelectedEffectInfo; } + // Setters + void setSelectedEffect(std::string const & effectName); + void setSelectedEffectValue(std::string const & setting, LLSD value); + void resetSelectedEffect(); + void saveEffectAs(std::string const & effectName); }; #endif // LL_POSTPROCESS_H diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index d73b17a51..31cc03994 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1480,9 +1480,8 @@ void LLRender::translateUI(F32 x, F32 y, F32 z) llerrs << "Need to push a UI translation frame before offsetting" << llendl; } - mUIOffset.back().mV[0] += x; - mUIOffset.back().mV[1] += y; - mUIOffset.back().mV[2] += z; + LLVector4a add(x,y,x); + mUIOffset.back()->add(add); } void LLRender::scaleUI(F32 x, F32 y, F32 z) @@ -1492,27 +1491,28 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z) llerrs << "Need to push a UI transformation frame before scaling." << llendl; } - mUIScale.back().scaleVec(LLVector3(x,y,z)); + LLVector4a scale(x,y,z); + mUIScale.back()->mul(scale); } void LLRender::pushUIMatrix() { if (mUIOffset.empty()) { - mUIOffset.push_back(LLVector3(0,0,0)); + mUIOffset.push_back(new LLVector4a(0.f)); } else { - mUIOffset.push_back(mUIOffset.back()); + mUIOffset.push_back(new LLVector4a(*mUIOffset.back())); } if (mUIScale.empty()) { - mUIScale.push_back(LLVector3(1,1,1)); + mUIScale.push_back(new LLVector4a(1.f)); } else { - mUIScale.push_back(mUIScale.back()); + mUIScale.push_back(new LLVector4a(*mUIScale.back())); } } @@ -1522,7 +1522,9 @@ void LLRender::popUIMatrix() { llerrs << "UI offset stack blown." << llendl; } + delete mUIOffset.back(); mUIOffset.pop_back(); + delete mUIScale.back(); mUIScale.pop_back(); } @@ -1532,7 +1534,7 @@ LLVector3 LLRender::getUITranslation() { return LLVector3(0,0,0); } - return mUIOffset.back(); + return LLVector3(mUIOffset.back()->getF32ptr()); } LLVector3 LLRender::getUIScale() @@ -1541,7 +1543,7 @@ LLVector3 LLRender::getUIScale() { return LLVector3(1,1,1); } - return mUIScale.back(); + return LLVector3(mUIOffset.back()->getF32ptr()); } @@ -1551,8 +1553,8 @@ void LLRender::loadUIIdentity() { llerrs << "Need to push UI translation frame before clearing offset." << llendl; } - mUIOffset.back().setVec(0,0,0); - mUIScale.back().setVec(1,1,1); + mUIOffset.back()->splat(0.f); + mUIScale.back()->splat(1.f); } void LLRender::setColorMask(bool writeColor, bool writeAlpha) @@ -1913,7 +1915,7 @@ void LLRender::flush() } } -void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) +void LLRender::vertex4a(const LLVector4a& vertex) { //the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] if (mCount > 2048) @@ -1935,12 +1937,13 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) if (mUIOffset.empty()) { - mVerticesp[mCount] = LLVector3(x,y,z); + mVerticesp[mCount]=vertex; } else { - LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back()); - mVerticesp[mCount] = vert; + //LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back()); + mVerticesp[mCount].setAdd(vertex,*mUIOffset.back()); + mVerticesp[mCount].mul(*mUIScale.back()); } if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile) @@ -1968,7 +1971,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; } -void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count) +void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count) { if (mCount + vert_count > 4094) { @@ -2025,7 +2028,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count) mVerticesp[mCount] = mVerticesp[mCount-1]; } -void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count) +void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count) { if (mCount + vert_count > 4094) { @@ -2083,7 +2086,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; } -void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count) +void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count) { if (mCount + vert_count > 4094) { @@ -2143,26 +2146,6 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol mColorsp[mCount] = mColorsp[mCount-1]; } -void LLRender::vertex2i(const GLint& x, const GLint& y) -{ - vertex3f((GLfloat) x, (GLfloat) y, 0); -} - -void LLRender::vertex2f(const GLfloat& x, const GLfloat& y) -{ - vertex3f(x,y,0); -} - -void LLRender::vertex2fv(const GLfloat* v) -{ - vertex3f(v[0], v[1], 0); -} - -void LLRender::vertex3fv(const GLfloat* v) -{ - vertex3f(v[0], v[1], v[2]); -} - void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y) { mTexcoordsp[mCount] = LLVector2(x,y); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 5032c0e08..6e412926d 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -364,12 +364,14 @@ public: void begin(const GLuint& mode); void end(); - void vertex2i(const GLint& x, const GLint& y); - void vertex2f(const GLfloat& x, const GLfloat& y); - void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z); - void vertex2fv(const GLfloat* v); - void vertex3fv(const GLfloat* v); - + + LL_FORCE_INLINE void vertex2i(const GLint& x, const GLint& y) { vertex4a(LLVector4a((GLfloat)x,(GLfloat)y,0.f)); } + LL_FORCE_INLINE void vertex2f(const GLfloat& x, const GLfloat& y) { vertex4a(LLVector4a(x,y,0.f)); } + LL_FORCE_INLINE void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { vertex4a(LLVector4a(x,y,z)); } + LL_FORCE_INLINE void vertex2fv(const GLfloat* v) { vertex4a(LLVector4a(v[0],v[1],0.f)); } + LL_FORCE_INLINE void vertex3fv(const GLfloat* v) { vertex4a(LLVector4a(v[0],v[1],v[2])); } + void vertex4a(const LLVector4a& v); + void texCoord2i(const GLint& x, const GLint& y); void texCoord2f(const GLfloat& x, const GLfloat& y); void texCoord2fv(const GLfloat* tc); @@ -387,9 +389,9 @@ public: void diffuseColor4fv(const F32* c); void diffuseColor4ubv(const U8* c); - void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count); - void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count); - void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count); + void vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count); + void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count); + void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U*, S32 vert_count); void setColorMask(bool writeColor, bool writeAlpha); void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha); @@ -449,7 +451,7 @@ private: F32 mCurrAlphaFuncVal; LLPointer mBuffer; - LLStrider mVerticesp; + LLStrider mVerticesp; LLStrider mTexcoordsp; LLStrider mColorsp; std::vector mTexUnits; @@ -463,8 +465,8 @@ private: F32 mMaxAnisotropy; - std::vector mUIOffset; - std::vector mUIScale; + std::vector mUIOffset; + std::vector mUIScale; }; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 589c0dc0d..f58445414 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -76,6 +76,45 @@ LLRenderTarget::~LLRenderTarget() release(); } +void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt) +{ + //for accounting, get the number of pixels added/subtracted + S32 pix_diff = (resx*resy)-(mResX*mResY); + + mResX = resx; + mResY = resy; + + for (U32 i = 0; i < mTex.size(); ++i) + { //resize color attachments + gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]); + LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); + sBytesAllocated += pix_diff*4; + } + + if (mDepth) + { //resize depth attachment + if (mStencil && mFBO) + { + //use render buffers where stencil buffers are in play + glBindRenderbuffer(GL_RENDERBUFFER, mDepth); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, mResX, mResY); + glBindRenderbuffer(GL_RENDERBUFFER, 0); + } + else + { + gGL.getTexUnit(0)->bindManual(mUsage, mDepth); + U32 internal_type = LLTexUnit::getInternalType(mUsage); + if(!mStencil) + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); + else + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH24_STENCIL8, mResX, mResY, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL, false); + } + + sBytesAllocated += pix_diff*4; + } + if(mSampleBuffer) + mSampleBuffer->resize(resx,resy); +} void LLRenderTarget::setSampleBuffer(LLMultisampleBuffer* buffer) { @@ -95,9 +134,10 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo mUsage = usage; mUseDepth = depth; - if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) { + glGenFramebuffers(1, (GLuint *) &mFBO); + if (depth) { if (!allocateDepth()) @@ -107,8 +147,6 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo } } - glGenFramebuffers(1, (GLuint *) &mFBO); - if (mDepth) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); @@ -126,7 +164,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo } glBindFramebuffer(GL_FRAMEBUFFER, 0); } - + stop_glerror(); } @@ -219,7 +257,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) bool LLRenderTarget::allocateDepth() { - if (mStencil) + if (mStencil && mFBO) { //use render buffers where stencil buffers are in play glGenRenderbuffers(1, (GLuint *) &mDepth); @@ -231,24 +269,30 @@ bool LLRenderTarget::allocateDepth() } else { - LLImageGL::generateTextures(mUsage, GL_DEPTH_COMPONENT24, 1, &mDepth); + if(!mStencil) + LLImageGL::generateTextures(mUsage, GL_DEPTH_COMPONENT24, 1, &mDepth); + else + LLImageGL::generateTextures(mUsage, GL_DEPTH24_STENCIL8, 1, &mDepth); gGL.getTexUnit(0)->bindManual(mUsage, mDepth); U32 internal_type = LLTexUnit::getInternalType(mUsage); stop_glerror(); clear_glerror(); - LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); + if(!mStencil) + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); + else + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH24_STENCIL8, mResX, mResY, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL, false); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - sBytesAllocated += mResX*mResY*4; - if (glGetError() != GL_NO_ERROR) { llwarns << "Unable to allocate depth buffer for render target." << llendl; return false; } + sBytesAllocated += mResX*mResY*4; + return true; } @@ -301,13 +345,19 @@ void LLRenderTarget::release() { if (mDepth) { - if (mStencil) + if (mStencil && mFBO) { glDeleteRenderbuffers(1, (GLuint*) &mDepth); stop_glerror(); } else { + //Release before delete. + if(mFBO) + { + glBindFramebuffer(GL_FRAMEBUFFER, mFBO); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, LLTexUnit::getInternalType(mUsage), 0, 0); + } LLImageGL::deleteTextures(mUsage, 0, 0, 1, &mDepth, true); stop_glerror(); } @@ -339,6 +389,9 @@ void LLRenderTarget::release() if (mTex.size() > 0) { + //Release before delete. + for (U32 i = 0; i < mTex.size(); ++i) + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, LLTexUnit::getInternalType(mUsage), 0, 0); sBytesAllocated -= mResX*mResY*4*mTex.size(); LLImageGL::deleteTextures(mUsage, mInternalFormat[0], 0, mTex.size(), &mTex[0], true); mTex.clear(); @@ -448,6 +501,7 @@ void LLRenderTarget::flush(bool fetch_depth) { gGL.getTexUnit(0)->bind(this); glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, 0, 0, 0, 0, mResX, mResY); + stop_glerror(); if (fetch_depth) { @@ -456,8 +510,10 @@ void LLRenderTarget::flush(bool fetch_depth) allocateDepth(); } - gGL.getTexUnit(0)->bind(this); - glCopyTexImage2D(LLTexUnit::getInternalType(mUsage), 0, GL_DEPTH24_STENCIL8, 0, 0, mResX, mResY, 0); + gGL.getTexUnit(0)->bind(this,true); + glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, 0, 0, 0, 0, mResX, mResY); + stop_glerror(); + //glCopyTexImage2D(LLTexUnit::getInternalType(mUsage), 0, GL_DEPTH24_STENCIL8, 0, 0, mResX, mResY, 0); } gGL.getTexUnit(0)->disable(); @@ -467,7 +523,7 @@ void LLRenderTarget::flush(bool fetch_depth) stop_glerror(); glBindFramebuffer(GL_FRAMEBUFFER, 0); stop_glerror(); - + if (mSampleBuffer) { LLGLEnable multisample(GL_MULTISAMPLE); @@ -477,7 +533,7 @@ void LLRenderTarget::flush(bool fetch_depth) check_framebuffer_status(); glBindFramebuffer(GL_READ_FRAMEBUFFER, mSampleBuffer->mFBO); check_framebuffer_status(); - + stop_glerror(); if(gGLManager.mIsATI) { @@ -490,10 +546,21 @@ void LLRenderTarget::flush(bool fetch_depth) } stop_glerror(); + //Following case never currently evalutes true, but it's still good to have. if (mTex.size() > 1) - { + { for (U32 i = 1; i < mTex.size(); ++i) { + glDrawBuffer(GL_COLOR_ATTACHMENT0 + i); + glReadBuffer(GL_COLOR_ATTACHMENT0 + i); + stop_glerror(); + glBlitFramebuffer(0, 0, mResX, mResY, 0, 0, mResX, mResY, GL_COLOR_BUFFER_BIT, GL_NEAREST); + stop_glerror(); + } + + /*for (U32 i = 1; i < mTex.size(); ++i) + { + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, LLTexUnit::getInternalType(mUsage), mTex[i], 0); stop_glerror(); @@ -510,13 +577,12 @@ void LLRenderTarget::flush(bool fetch_depth) stop_glerror(); glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, GL_RENDERBUFFER, mSampleBuffer->mTex[i]); stop_glerror(); - } + }*/ } glBindFramebuffer(GL_FRAMEBUFFER, 0); } } } - void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1, S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter) { @@ -537,7 +603,7 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, } else { - if (mask == GL_DEPTH_BUFFER_BIT && source.mStencil != mStencil) + if (mask == GL_DEPTH_BUFFER_BIT && !mStencil && source.mStencil != mStencil) { stop_glerror(); @@ -626,7 +692,8 @@ void LLRenderTarget::getViewport(S32* viewport) // LLMultisampleBuffer implementation //================================================== LLMultisampleBuffer::LLMultisampleBuffer() : - mSamples(0) + mSamples(0), + mColorFormat(0) { } @@ -727,6 +794,7 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth mUsage = usage; mUseDepth = depth; mStencil = stencil; + mColorFormat = color_fmt; { @@ -764,6 +832,42 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth return addColorAttachment(color_fmt); } +void LLMultisampleBuffer::resize(U32 resx, U32 resy) +{ + //for accounting, get the number of pixels added/subtracted + S32 pix_diff = (resx*resy)-(mResX*mResY); + + mResX = resx; + mResY = resy; + + for (U32 i = 0; i < mTex.size(); ++i) + { //resize color attachments + glBindRenderbuffer(GL_RENDERBUFFER, mTex[i]); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, mColorFormat, mResX, mResY); + glBindRenderbuffer(GL_RENDERBUFFER, 0); + sBytesAllocated += pix_diff*4; + } + + if (mDepth) + { //resize depth attachment + if (mStencil) + { + //use render buffers where stencil buffers are in play + glBindRenderbuffer(GL_RENDERBUFFER, mDepth); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH24_STENCIL8, mResX, mResY); + glBindRenderbuffer(GL_RENDERBUFFER, 0); + } + else + { + glBindRenderbuffer(GL_RENDERBUFFER, mDepth); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH_COMPONENT24, mResX, mResY); + glBindRenderbuffer(GL_RENDERBUFFER, 0); + + } + sBytesAllocated += pix_diff*4; + } +} + bool LLMultisampleBuffer::addColorAttachment(U32 color_fmt) { if (color_fmt == 0) @@ -813,12 +917,13 @@ bool LLMultisampleBuffer::allocateDepth() clear_glerror(); if (mStencil) { - glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH24_STENCIL8, mResX, mResY); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH24_STENCIL8, mResX, mResY); } else { - glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH_COMPONENT16_ARB, mResX, mResY); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH_COMPONENT24, mResX, mResY); } + if (glGetError() != GL_NO_ERROR) { llwarns << "Unable to allocate depth buffer for multisample render target." << llendl; @@ -829,4 +934,3 @@ bool LLMultisampleBuffer::allocateDepth() return true; } - diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 9ed95770e..d9a529ff0 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -80,6 +80,12 @@ public: //multiple calls will release previously allocated resources bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, bool use_fbo = FALSE); + //resize existing attachments to use new resolution and color format + // CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined + // DO NOT use for screen space buffers or for scratch space for an image that might be uploaded + // DO use for render targets that resize often and aren't likely to ruin someone's day if they break + void resize(U32 resx, U32 resy, U32 color_fmt); + //provide this render target with a multisample resource. void setSampleBuffer(LLMultisampleBuffer* buffer); @@ -145,6 +151,8 @@ public: //one renderable attachment (i.e. color buffer, depth buffer). bool isComplete() const; + U32 getFBO() const {return mFBO;} + static LLRenderTarget* getCurrentBoundTarget() { return sBoundTarget; } protected: @@ -168,6 +176,7 @@ protected: class LLMultisampleBuffer : public LLRenderTarget { U32 mSamples; + U32 mColorFormat; public: LLMultisampleBuffer(); virtual ~LLMultisampleBuffer(); @@ -180,6 +189,7 @@ public: bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, U32 samples); virtual bool addColorAttachment(U32 color_fmt); virtual bool allocateDepth(); + void resize(U32 resx, U32 resy); }; #endif //!LL_MESA_HEADLESS diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index ade7480d2..fcede5363 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -679,7 +679,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade vec4 diffuseLookup(vec2 texcoord) { - switch (vary_texture_index.r)) + switch (vary_texture_index)) { case 0: ret = texture2D(tex0, texcoord); break; case 1: ret = texture2D(tex1, texcoord); break; @@ -703,7 +703,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (texture_index_channels > 1) { - text[count++] = strdup("VARYING_FLAT ivec4 vary_texture_index;\n"); + text[count++] = strdup("VARYING_FLAT int vary_texture_index;\n"); } text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n"); @@ -721,7 +721,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade { //switches are unreliable on some NVIDIA drivers for (S32 i = 0; i < texture_index_channels; ++i) { - std::string if_string = llformat("\t%sif (vary_texture_index.r == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i); + std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i); text[count++] = strdup(if_string.c_str()); } text[count++] = strdup("\treturn vec4(1,0,1,1);\n"); @@ -730,13 +730,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade else { text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n"); - text[count++] = strdup("\tswitch (vary_texture_index.r)\n"); + text[count++] = strdup("\tswitch (vary_texture_index)\n"); text[count++] = strdup("\t{\n"); //switch body for (S32 i = 0; i < texture_index_channels; ++i) { - std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i); + std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i); text[count++] = strdup(case_str.c_str()); } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index bc4c201d9..896560d4d 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1249,7 +1249,7 @@ void LLVertexBuffer::setupVertexArray() 1, //TYPE_WEIGHT, 4, //TYPE_WEIGHT4, 4, //TYPE_CLOTHWEIGHT, - 4, //TYPE_TEXTURE_INDEX + 1, //TYPE_TEXTURE_INDEX }; U32 attrib_type[] = @@ -1266,7 +1266,7 @@ void LLVertexBuffer::setupVertexArray() GL_FLOAT, //TYPE_WEIGHT, GL_FLOAT, //TYPE_WEIGHT4, GL_FLOAT, //TYPE_CLOTHWEIGHT, - GL_UNSIGNED_BYTE, //TYPE_TEXTURE_INDEX + GL_UNSIGNED_INT, //TYPE_TEXTURE_INDEX }; bool attrib_integer[] = @@ -2313,7 +2313,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) #if !LL_DARWIN S32 loc = TYPE_TEXTURE_INDEX; void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12); - glVertexAttribIPointer(loc, 4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); + glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); #endif } if (data_mask & MAP_VERTEX) diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 92a54d021..22651bd5d 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -12,7 +12,6 @@ include(LLRender) include(LLWindow) include(LLVFS) include(LLXML) -include(LLXUIXML) include_directories( ${LLCOMMON_INCLUDE_DIRS} @@ -24,7 +23,6 @@ include_directories( ${LLWINDOW_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} - ${LLXUIXML_INCLUDE_DIRS} ) set(llui_SOURCE_FILES @@ -73,6 +71,7 @@ set(llui_SOURCE_FILES lltextparser.cpp lltrans.cpp llui.cpp + lluicolor.cpp lluictrl.cpp lluictrlfactory.cpp lluiimage.cpp @@ -142,6 +141,7 @@ set(llui_HEADER_FILES lluictrl.h lluifwd.h llui.h + lluicolor.h lluiimage.h lluistring.h lluixmltags.h @@ -165,7 +165,6 @@ target_link_libraries(llui llwindow llimage llvfs # ugh, just for LLDir - llxuixml llxml llcommon # must be after llimage, llwindow, llrender llmath diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index b61a567bb..e710fa6dc 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -217,6 +217,7 @@ public: virtual BOOL canSaveAs() const { return FALSE; } virtual void saveAs() {} + virtual void saveAsType(BOOL type=false) {} // virtual LLUUID getItemID() { return LLUUID::null; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index e4ad47118..ea168a35c 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -666,6 +666,7 @@ LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect, mFgUnselectedColor( LLUI::sColorsGroup->getColor("ScrollUnselectedColor") ), mFgDisabledColor( LLUI::sColorsGroup->getColor("ScrollDisabledColor") ), mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ), + mDefaultListTextColor( LLUI::sColorsGroup->getColor("DefaultListText") ), mBorderThickness( 2 ), mOnDoubleClickCallback( NULL ), mOnMaximumSelectCallback( NULL ), @@ -3543,6 +3544,10 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p { cell->setColor(color); } + else + { + cell->setColor(mDefaultListTextColor); + } new_item->setColumn(index, cell); if (columnp->mHeader && !value.asString().empty()) { diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index ada8032f1..4060c1466 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -697,6 +697,7 @@ private: LLColor4 mFgUnselectedColor; LLColor4 mFgDisabledColor; LLColor4 mHighlightedColor; + LLColor4 mDefaultListTextColor; S32 mBorderThickness; void (*mOnDoubleClickCallback)(void* userdata); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 7d3bb20c4..24ccd848f 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -751,7 +751,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, else { tab_panel_top = getRect().getHeight() - getTopBorderHeight(); - tab_panel_bottom = (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border + tab_panel_bottom = (TABCNTR_TAB_HEIGHT + LLPANEL_BORDER_WIDTH*2 - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border } } else diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index bf5fc316d..c5cf582e5 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -520,7 +520,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex const S32 NUM_VERTICES = 9 * 4; // 9 quads LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; + LLVector4a pos[NUM_VERTICES]; S32 index = 0; @@ -528,157 +528,157 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex { // draw bottom left uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); + pos[index].set(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); index++; // draw bottom middle uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); index++; // draw bottom right uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); + pos[index].set(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); index++; // draw left uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); index++; // draw middle uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); index++; // draw right uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + pos[index].set(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + pos[index].set(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); index++; // draw top left uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); + pos[index].set(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); index++; // draw top middle uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); index++; // draw top right uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + pos[index].set(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); + pos[index].set(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); index++; uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + pos[index].set(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); index++; - + gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); } gGL.end(); @@ -720,7 +720,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre { const S32 NUM_VERTICES = 4; // 9 quads LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; + LLVector4a pos[NUM_VERTICES]; gGL.begin(LLRender::QUADS); { @@ -734,19 +734,19 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre S32 scaled_height = llround(height * ui_scale.mV[VY]); uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); + pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); index++; uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f); + pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f); index++; uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f); + pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY], 0.f); index++; uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f); + pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f); index++; gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); diff --git a/indra/llxuixml/lluicolor.cpp b/indra/llui/lluicolor.cpp similarity index 100% rename from indra/llxuixml/lluicolor.cpp rename to indra/llui/lluicolor.cpp diff --git a/indra/llxuixml/lluicolor.h b/indra/llui/lluicolor.h similarity index 100% rename from indra/llxuixml/lluicolor.h rename to indra/llui/lluicolor.h diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index c476e25d3..b0e95c54a 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -336,6 +336,7 @@ bool LLView::addChild(LLView* child, S32 tab_group) // add to front of child list, as normal mChildList.push_front(child); + mChildHashMap[child->getName()]=child; // add to ctrl list if is LLUICtrl if (child->isCtrl()) @@ -374,6 +375,14 @@ void LLView::removeChild(LLView* child) // if we are removing an item we are currently iterating over, that would be bad llassert(child->mInDraw == false); mChildList.remove( child ); + for(boost::unordered_map::iterator it=mChildHashMap.begin(); it != mChildHashMap.end(); ++it) + { + if(it->second == child) + { + mChildHashMap.erase(it); + break; + } + } child->mParentView = NULL; if (child->isCtrl()) { @@ -607,6 +616,7 @@ void LLView::deleteAllChildren() LLView* viewp = mChildList.front(); delete viewp; // will remove the child from mChildList } + mChildHashMap.clear(); } void LLView::setAllChildrenEnabled(BOOL b) @@ -1506,13 +1516,18 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_ //if(name.empty()) // return NULL; // Look for direct children *first* - BOOST_FOREACH(LLView* childp, mChildList) + /*BOOST_FOREACH(LLView* childp, mChildList) { llassert(childp); if (childp->getName() == name) { return childp; } + }*/ + boost::unordered_map::const_iterator it = mChildHashMap.find(name); + if(it != mChildHashMap.end()) + { + return it->second; } if (recurse) { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 721c82fbb..ee2ad2d3e 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -56,6 +56,7 @@ #include "llcursortypes.h" #include "llinitparam.h" #include "llfocusmgr.h" +#include const U32 FOLLOWS_NONE = 0x00; const U32 FOLLOWS_LEFT = 0x01; @@ -186,6 +187,15 @@ public: void initFromParams(const LLView::Params&); + template + struct CachedUICtrl + { + CachedUICtrl():mPtr(NULL){} + T* connect(LLView* parent,const char* pName){return mPtr = parent->getChild(pName);} + T* operator->(){return mPtr;} + operator T*() const{return mPtr;} + T* mPtr; + }; protected: LLView(const LLView::Params&); //friend class LLUICtrlFactory; @@ -454,6 +464,7 @@ public: const child_list_t* getChildList() const { return &mChildList; } child_list_const_iter_t beginChild() const { return mChildList.begin(); } child_list_const_iter_t endChild() const { return mChildList.end(); } + boost::unordered_map mChildHashMap; // LLMouseHandler functions // Default behavior is to pass events to children @@ -467,13 +478,17 @@ public: /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); // Display mToolTipMsg if no child handles it. - /*virtual*/ const std::string& getName() const; + /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ BOOL hasMouseCapture(); /*virtual*/ BOOL isView(); // Hack to support LLFocusMgr /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; + template T* findChild(const std::string& name) + { + return getChild(name,true,false); + } template T* getChild(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const { LLView* child = getChildView(name, recurse, FALSE); diff --git a/indra/llxuixml/CMakeLists.txt b/indra/llxuixml/CMakeLists.txt deleted file mode 100644 index bc98a43bd..000000000 --- a/indra/llxuixml/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# -*- cmake -*- - -project(llxuixml) - -include(00-Common) -include(LLCommon) -include(LLMath) -include(LLXML) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) - -set(llxuixml_SOURCE_FILES - llinitparam.cpp - lluicolor.cpp - ) - -set(llxuixml_HEADER_FILES - CMakeLists.txt - - llinitparam.h - lluicolor.h - ) - -set_source_files_properties(${llxuixml_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - -list(APPEND llxuixml_SOURCE_FILES ${llxuixml_HEADER_FILES}) - -add_library (llxuixml ${llxuixml_SOURCE_FILES}) -# Libraries on which this library depends, needed for Linux builds -# Sort by high-level to low-level -target_link_libraries(llxuixml - llxml - llcommon - llmath - ) diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index aeb976399..60245757a 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -254,6 +254,10 @@ extern "C" { int yyerror(const char *fmt, ...); } "OBJECT_TOTAL_SCRIPT_COUNT" { count(); yylval.ival = OBJECT_TOTAL_SCRIPT_COUNT; return(INTEGER_CONSTANT); } "OBJECT_SCRIPT_MEMORY" { count(); yylval.ival = OBJECT_SCRIPT_MEMORY; return(INTEGER_CONSTANT); } "OBJECT_SCRIPT_TIME" { count(); yylval.ival = OBJECT_SCRIPT_TIME; return(INTEGER_CONSTANT); } +"OBJECT_PRIM_EQUIVALENCE" { count(); yylval.ival = OBJECT_PRIM_EQUIVALENCE; return(INTEGER_CONSTANT); } +"OBJECT_SERVER_COST" { count(); yylval.ival = OBJECT_SERVER_COST; return(INTEGER_CONSTANT); } +"OBJECT_STREAMING_COST" { count(); yylval.ival = OBJECT_STREAMING_COST; return(INTEGER_CONSTANT); } +"OBJECT_PHYSICS_COST" { count(); yylval.ival = OBJECT_SCRIPT_TIME; return(INTEGER_CONSTANT); } "TYPE_INTEGER" { count(); yylval.ival = LST_INTEGER; return(INTEGER_CONSTANT); } "TYPE_FLOAT" { count(); yylval.ival = LST_FLOATINGPOINT; return(INTEGER_CONSTANT); } @@ -347,7 +351,6 @@ extern "C" { int yyerror(const char *fmt, ...); } "REMOTE_DATA_REQUEST" { count(); yylval.ival = LSL_REMOTE_DATA_REQUEST; return(INTEGER_CONSTANT); } "REMOTE_DATA_REPLY" { count(); yylval.ival = LSL_REMOTE_DATA_REPLY; return(INTEGER_CONSTANT); } - "PSYS_PART_FLAGS" { count(); yylval.ival = LLPS_PART_FLAGS; return(INTEGER_CONSTANT); } "PSYS_PART_START_COLOR" { count(); yylval.ival = LLPS_PART_START_COLOR; return (INTEGER_CONSTANT); } "PSYS_PART_START_ALPHA" { count(); yylval.ival = LLPS_PART_START_ALPHA; return (INTEGER_CONSTANT); } @@ -357,7 +360,6 @@ extern "C" { int yyerror(const char *fmt, ...); } "PSYS_PART_END_SCALE" { count(); yylval.ival = LLPS_PART_END_SCALE; return (INTEGER_CONSTANT); } "PSYS_PART_MAX_AGE" { count(); yylval.ival = LLPS_PART_MAX_AGE; return (INTEGER_CONSTANT); } - "PSYS_PART_WIND_MASK" { count(); yylval.ival = LLPartData::LL_PART_WIND_MASK; return(INTEGER_CONSTANT); } "PSYS_PART_INTERP_COLOR_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_COLOR_MASK; return(INTEGER_CONSTANT); } "PSYS_PART_INTERP_SCALE_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_SCALE_MASK; return(INTEGER_CONSTANT); } @@ -368,7 +370,6 @@ extern "C" { int yyerror(const char *fmt, ...); } "PSYS_PART_EMISSIVE_MASK" { count(); yylval.ival = LLPartData::LL_PART_EMISSIVE_MASK; return(INTEGER_CONSTANT); } "PSYS_PART_TARGET_LINEAR_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_LINEAR_MASK; return(INTEGER_CONSTANT); } - "PSYS_SRC_MAX_AGE" { count(); yylval.ival = LLPS_SRC_MAX_AGE; return(INTEGER_CONSTANT); } "PSYS_SRC_PATTERN" { count(); yylval.ival = LLPS_SRC_PATTERN; return(INTEGER_CONSTANT); } "PSYS_SRC_INNERANGLE" { count(); yylval.ival = LLPS_SRC_INNERANGLE; return(INTEGER_CONSTANT); } @@ -393,7 +394,6 @@ extern "C" { int yyerror(const char *fmt, ...); } "PSYS_SRC_PATTERN_ANGLE_CONE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE; return(INTEGER_CONSTANT); } "PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; return(INTEGER_CONSTANT); } - "VEHICLE_TYPE_NONE" { count(); yylval.ival = VEHICLE_TYPE_NONE; return(INTEGER_CONSTANT); } "VEHICLE_TYPE_SLED" { count(); yylval.ival = VEHICLE_TYPE_SLED; return(INTEGER_CONSTANT); } "VEHICLE_TYPE_CAR" { count(); yylval.ival = VEHICLE_TYPE_CAR; return(INTEGER_CONSTANT); } @@ -408,8 +408,6 @@ extern "C" { int yyerror(const char *fmt, ...); } "VEHICLE_ANGULAR_MOTOR_DIRECTION" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_DIRECTION; return(INTEGER_CONSTANT); } "VEHICLE_LINEAR_MOTOR_OFFSET" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_OFFSET; return(INTEGER_CONSTANT); } - - "VEHICLE_HOVER_HEIGHT" { count(); yylval.ival = VEHICLE_HOVER_HEIGHT; return(INTEGER_CONSTANT); } "VEHICLE_HOVER_EFFICIENCY" { count(); yylval.ival = VEHICLE_HOVER_EFFICIENCY; return(INTEGER_CONSTANT); } "VEHICLE_HOVER_TIMESCALE" { count(); yylval.ival = VEHICLE_HOVER_TIMESCALE; return(INTEGER_CONSTANT); } @@ -444,8 +442,6 @@ extern "C" { int yyerror(const char *fmt, ...); } "VEHICLE_FLAG_MOUSELOOK_BANK" { count(); yylval.ival = VEHICLE_FLAG_MOUSELOOK_BANK; return(INTEGER_CONSTANT); } "VEHICLE_FLAG_CAMERA_DECOUPLED" { count(); yylval.ival = VEHICLE_FLAG_CAMERA_DECOUPLED; return(INTEGER_CONSTANT); } - - "PRIM_TYPE" { count(); yylval.ival = LSL_PRIM_TYPE; return(INTEGER_CONSTANT); } "PRIM_MATERIAL" { count(); yylval.ival = LSL_PRIM_MATERIAL; return(INTEGER_CONSTANT); } "PRIM_PHYSICS" { count(); yylval.ival = LSL_PRIM_PHYSICS; return(INTEGER_CONSTANT); } @@ -463,6 +459,15 @@ extern "C" { int yyerror(const char *fmt, ...); } "PRIM_FULLBRIGHT" { count(); yylval.ival = LSL_PRIM_FULLBRIGHT; return(INTEGER_CONSTANT); } "PRIM_TEXGEN" { count(); yylval.ival = LSL_PRIM_TEXGEN; return(INTEGER_CONSTANT); } "PRIM_GLOW" { count(); yylval.ival = LSL_PRIM_GLOW; return(INTEGER_CONSTANT); } +"PRIM_TEXT" { count(); yylval.ival = LSL_PRIM_TEXT; return(INTEGER_CONSTANT); } +"PRIM_NAME" { count(); yylval.ival = LSL_PRIM_NAME; return(INTEGER_CONSTANT); } +"PRIM_DESC" { count(); yylval.ival = LSL_PRIM_DESC; return(INTEGER_CONSTANT); } +"PRIM_ROT_LOCAL" { count(); yylval.ival = LSL_PRIM_ROT_LOCAL; return(INTEGER_CONSTANT); } +"PRIM_PHYSICS_SHAPE_TYPE" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_TYPE; return(INTEGER_CONSTANT); } +"PRIM_OMEGA" { count(); yylval.ival = LSL_PRIM_OMEGA; return(INTEGER_CONSTANT); } +"PRIM_POS_LOCAL" { count(); yylval.ival = LSL_PRIM_POS_LOCAL; return(INTEGER_CONSTANT); } +"PRIM_LINK_TARGET" { count(); yylval.ival = LSL_PRIM_LINK_TARGET; return(INTEGER_CONSTANT); } +"PRIM_SLICE" { count(); yylval.ival = LSL_PRIM_SLICE; return(INTEGER_CONSTANT); } "PRIM_TYPE_BOX" { count(); yylval.ival = LSL_PRIM_TYPE_BOX; return(INTEGER_CONSTANT); } "PRIM_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_TYPE_CYLINDER; return(INTEGER_CONSTANT); } @@ -522,6 +527,15 @@ extern "C" { int yyerror(const char *fmt, ...); } "PRIM_SCULPT_FLAG_MIRROR" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_MIRROR; return(INTEGER_CONSTANT); } "PRIM_SCULPT_FLAG_INVERT" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_INVERT; return(INTEGER_CONSTANT); } +"PRIM_PHYSICS_SHAPE_PRIM" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_PRIM; return(INTEGER_CONSTANT); } +"PRIM_PHYSICS_SHAPE_NONE" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_NONE; return(INTEGER_CONSTANT); } +"PRIM_PHYSICS_SHAPE_CONVEX" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_CONVEX; return(INTEGER_CONSTANT); } + +"DENSITY" { count(); yylval.ival = LSL_DENSITY; return(INTEGER_CONSTANT); } +"FRICTION" { count(); yylval.ival = LSL_FRICTION; return(INTEGER_CONSTANT); } +"RESTITUTION" { count(); yylval.ival = LSL_RESTITUTION; return(INTEGER_CONSTANT); } +"GRAVITY_MULTIPLIER" { count(); yylval.ival = LSL_GRAVITY_MULTIPLIER; return(INTEGER_CONSTANT); } + "MASK_BASE" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); } "MASK_OWNER" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } "MASK_GROUP" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); } @@ -595,6 +609,7 @@ extern "C" { int yyerror(const char *fmt, ...); } "HTTP_BODY_MAXLENGTH" { count(); yylval.ival = HTTP_BODY_MAXLENGTH; return(INTEGER_CONSTANT); } "HTTP_BODY_TRUNCATED" { count(); yylval.ival = HTTP_BODY_TRUNCATED; return(INTEGER_CONSTANT); } "HTTP_VERIFY_CERT" { count(); yylval.ival = HTTP_VERIFY_CERT; return(INTEGER_CONSTANT); } +"HTTP_VERBOSE_THROTTLE" { count(); yylval.ival = HTTP_VERBOSE_THROTTLE; return(INTEGER_CONSTANT); } "PARCEL_COUNT_TOTAL" { count(); yylval.ival = OC_TOTAL; return(INTEGER_CONSTANT); } "PARCEL_COUNT_OWNER" { count(); yylval.ival = OC_OWNER; return(INTEGER_CONSTANT); } @@ -675,6 +690,54 @@ extern "C" { int yyerror(const char *fmt, ...); } "STATUS_INTERNAL_ERROR" { count(); yylval.ival = LSL_STATUS_INTERNAL_ERROR; return(INTEGER_CONSTANT); } "STATUS_WHITELIST_FAILED" { count(); yylval.ival = LSL_STATUS_WHITELIST_FAILED; return(INTEGER_CONSTANT); } +"PROFILE_SCRIPT_NONE" { count(); yylval.ival = LSL_PROFILE_SCRIPT_NONE; return(INTEGER_CONSTANT); } +"PROFILE_SCRIPT_MEMORY" { count(); yylval.ival = LSL_PROFILE_SCRIPT_MEMORY; return(INTEGER_CONSTANT); } + +"CONTENT_TYPE_TEXT" { count(); yylval.ival = LSL_CONTENT_TYPE_TEXT; return(INTEGER_CONSTANT); } +"CONTENT_TYPE_HTML" { count(); yylval.ival = LSL_CONTENT_TYPE_HTML; return(INTEGER_CONSTANT); } + +"RCERR_UNKNOWN" { count(); yylval.ival = LSL_RCERR_UNKNOWN; return(INTEGER_CONSTANT); } +"RCERR_SIM_PERF_LOW" { count(); yylval.ival = LSL_RCERR_SIM_PERF_LOW; return(INTEGER_CONSTANT); } +"RCERR_CAST_TIME_EXCEEDED" { count(); yylval.ival = LSL_RCERR_CAST_TIME_EXCEEDED; return(INTEGER_CONSTANT); } + +"RC_REJECT_TYPES" { count(); yylval.ival = LSL_RC_REJECT_TYPES; return(INTEGER_CONSTANT); } +"RC_DETECT_PHANTOM" { count(); yylval.ival = LSL_RC_DETECT_PHANTOM; return(INTEGER_CONSTANT); } +"RC_DATA_FLAGS" { count(); yylval.ival = LSL_RC_DATA_FLAGS; return(INTEGER_CONSTANT); } +"RC_MAX_HITS" { count(); yylval.ival = LSL_RC_MAX_HITS; return(INTEGER_CONSTANT); } + +"RC_REJECT_AGENTS" { count(); yylval.ival = LSL_RC_REJECT_AGENTS; return(INTEGER_CONSTANT); } +"RC_REJECT_PHYSICAL" { count(); yylval.ival = LSL_RC_REJECT_PHYSICAL; return(INTEGER_CONSTANT); } +"RC_REJECT_NONPHYSICAL" { count(); yylval.ival = LSL_RC_REJECT_NONPHYSICAL; return(INTEGER_CONSTANT); } +"RC_REJECT_LAND" { count(); yylval.ival = LSL_RC_REJECT_LAND; return(INTEGER_CONSTANT); } + +"RC_GET_NORMAL" { count(); yylval.ival = LSL_RC_GET_NORMAL; return(INTEGER_CONSTANT); } +"RC_GET_ROOT_KEY" { count(); yylval.ival = LSL_RC_GET_ROOT_KEY; return(INTEGER_CONSTANT); } +"RC_GET_LINK_NUM" { count(); yylval.ival = LSL_RC_GET_LINK_NUM; return(INTEGER_CONSTANT); } + +"ESTATE_ACCESS_ALLOWED_AGENT_ADD" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_AGENT_ADD; return(INTEGER_CONSTANT); } +"ESTATE_ACCESS_ALLOWED_AGENT_REMOVE" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_AGENT_REMOVE; return(INTEGER_CONSTANT); } +"ESTATE_ACCESS_ALLOWED_GROUP_ADD" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_GROUP_ADD; return(INTEGER_CONSTANT); } +"ESTATE_ACCESS_ALLOWED_GROUP_REMOVE" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_GROUP_REMOVE; return(INTEGER_CONSTANT); } +"ESTATE_ACCESS_BANNED_AGENT_ADD" { count(); yylval.ival = LSL_ESTATE_ACCESS_BANNED_AGENT_ADD; return(INTEGER_CONSTANT); } +"ESTATE_ACCESS_BANNED_AGENT_REMOVE" { count(); yylval.ival = LSL_ESTATE_ACCESS_BANNED_AGENT_REMOVE; return(INTEGER_CONSTANT); } + +"KFM_COMMAND" { count(); yylval.ival = LSL_KFM_COMMAND; return(INTEGER_CONSTANT); } +"KFM_MODE" { count(); yylval.ival = LSL_KFM_MODE; return(INTEGER_CONSTANT); } +"KFM_DATA" { count(); yylval.ival = LSL_KFM_DATA; return(INTEGER_CONSTANT); } +"KFM_FORWARD" { count(); yylval.ival = LSL_KFM_FORWARD; return(INTEGER_CONSTANT); } +"KFM_LOOP" { count(); yylval.ival = LSL_KFM_LOOP; return(INTEGER_CONSTANT); } +"KFM_PING_PONG" { count(); yylval.ival = LSL_KFM_PING_PONG; return(INTEGER_CONSTANT); } +"KFM_REVERSE" { count(); yylval.ival = LSL_KFM_REVERSE; return(INTEGER_CONSTANT); } +"KFM_ROTATION" { count(); yylval.ival = LSL_KFM_ROTATION; return(INTEGER_CONSTANT); } +"KFM_TRANSLATION" { count(); yylval.ival = LSL_KFM_TRANSLATION; return(INTEGER_CONSTANT); } +"KFM_CMD_PLAY" { count(); yylval.ival = LSL_KFM_CMD_PLAY; return(INTEGER_CONSTANT); } +"KFM_CMD_STOP" { count(); yylval.ival = LSL_KFM_CMD_STOP; return(INTEGER_CONSTANT); } +"KFM_CMD_PAUSE" { count(); yylval.ival = LSL_KFM_CMD_PAUSE; return(INTEGER_CONSTANT); } + +"AGENT_LIST_PARCEL" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } +"AGENT_LIST_PARCEL_OWNER" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); } +"AGENT_LIST_REGION" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); } + {L}({L}|{N})* { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(IDENTIFIER); } {N}+{E} { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } diff --git a/indra/lscript/lscript_http.h b/indra/lscript/lscript_http.h index 86b2d29b9..971ecbae7 100644 --- a/indra/lscript/lscript_http.h +++ b/indra/lscript/lscript_http.h @@ -40,7 +40,8 @@ enum LLScriptHTTPRequestParameterKey HTTP_METHOD, HTTP_MIMETYPE, HTTP_BODY_MAXLENGTH, - HTTP_VERIFY_CERT + HTTP_VERIFY_CERT, + HTTP_VERBOSE_THROTTLE }; enum LLScriptHTTPResponseMetadataKey diff --git a/indra/lscript/lscript_library/lscript_library.cpp b/indra/lscript/lscript_library/lscript_library.cpp index b4a708f87..4599aa135 100644 --- a/indra/lscript/lscript_library/lscript_library.cpp +++ b/indra/lscript/lscript_library/lscript_library.cpp @@ -469,102 +469,109 @@ void LLScriptLibrary::init() addFunction(10.f, 0.f, dummy_func, "llGetEnv", "s", "s"); addFunction(10.f, 0.f, dummy_func, "llRegionSayTo", NULL, "kis"); + + // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only - // Adding missing (more recent) LSL functions. - - addFunction(10.f, 0.f, dummy_func, "llCastRay", "l", "vvl"); - addFunction(10.f, 0.f, dummy_func, "llGetSPMaxMemory", "i", NULL); - addFunction(10.f, 0.f, dummy_func, "llGetUsedMemory", "i", NULL); - addFunction(10.f, 0.f, dummy_func, "llGodLikeRezObject", NULL, "kv"); - addFunction(10.f, 0.f, dummy_func, "llScriptProfiler", NULL, "i"); - addFunction(10.f, 0.f, dummy_func, "llSetInventoryPermMask", NULL, "sii"); - addFunction(10.f, 0.f, dummy_func, "llSetObjectPermMask", NULL, "ii"); - // Even more recent + // Server v11.08.10.238207 new functions: addFunction(10.f, 0.f, dummy_func, "llSetMemoryLimit", "i", "i"); + addFunction(10.f, 0.f, dummy_func, "llGetMemoryLimit", "i", NULL); addFunction(10.f, 0.f, dummy_func, "llSetLinkMedia", "i", "iil"); addFunction(10.f, 0.f, dummy_func, "llGetLinkMedia", "l", "iil"); addFunction(10.f, 0.f, dummy_func, "llClearLinkMedia", "i", "ii"); addFunction(10.f, 0.f, dummy_func, "llSetLinkCamera", NULL, "ivv"); addFunction(10.f, 0.f, dummy_func, "llSetContentType", NULL, "ki"); - addFunction(10.f, 0.f, dummy_func, "llLinkSitTarget", NULL, "ivr"); + addFunction(10.f, 0.f, dummy_func, "llLinkSitTarget", NULL, "ivq"); addFunction(10.f, 0.f, dummy_func, "llAvatarOnLinkSitTarget", "k", "i"); - addFunction(10.f, 0.f, dummy_func, "llGetMassMKS", "f", NULL); - addFunction(10.f, 0.f, dummy_func, "llGetMemoryLimit", "i", NULL); - addFunction(10.f, 0.f, dummy_func, "llGetParcelMusicURL", "s", NULL); - addFunction(10.f, 0.f, dummy_func, "llGetPhysicsMaterial", "l", NULL); - addFunction(10.f, 0.f, dummy_func, "llManageEstateAccess", "i", "ik"); - addFunction(10.f, 0.f, dummy_func, "llSetAngularVelocity", NULL, "vi"); - addFunction(10.f, 0.f, dummy_func, "llSetKeyframedMotion", NULL, "ll"); - addFunction(10.f, 0.f, dummy_func, "llSetPhysicsMaterial", NULL, "iffff"); - addFunction(10.f, 0.f, dummy_func, "llSetRegionPos", "i", "v"); addFunction(10.f, 0.f, dummy_func, "llSetVelocity", NULL, "vi"); + // Server v11.09.09.240509 new functions: + addFunction(10.f, 0.f, dummy_func, "llCastRay", "l", "vvl"); + addFunction(10.f, 0.f, dummy_func, "llGetMassMKS", "f", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetPhysicsMaterial", NULL, "iffff"); + addFunction(10.f, 0.f, dummy_func, "llGetPhysicsMaterial", "l", NULL); + // Server v11.10.18.243270 new functions: + addFunction(10.f, 0.f, dummy_func, "llManageEstateAccess", "i", "ik"); + // Server RC magnum v11.10.31.244254 new function: + addFunction(10.f, 0.f, dummy_func, "llSetKeyframedMotion", NULL, "ll"); + // Server RC Le Tigre v11.10.30.245889 new function: addFunction(10.f, 0.f, dummy_func, "llTransferLindenDollars", "k", "ki"); + // llGenerateKey officially implemented now added + addFunction(10.f, 0.f, dummy_func, "llGenerateKey", "k", NULL); - //Pathfinder functions. Current state: alpha, thus subject to change. - //This and the preceding line are to be removed in future revisions of this file. + // Server new function 2011-12-13: + addFunction(10.f, 0.f, dummy_func, "llGetParcelMusicURL", "s", NULL); + + // Missing script functions as of 2011-12-13 + addFunction(10.f, 0.f, dummy_func, "llScriptProfiler", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llGetSPMaxMemory", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetUsedMemory", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetAngularVelocity", NULL, "vi"); + + // Server 12.01.24.248357 new functions + addFunction(0.f, 0.f, dummy_func, "llSetRegionPos", "i", "v"); + + // Server 12.04.13.253827 new function + addFunction(0.f, 0.f, dummy_func, "llGetAgentList", "l", "il"); + + // Server RC Magnum 12.05.25.258071 new functions: + addFunction(0.f, 0.f, dummy_func, "llAttachToAvatarTemp", NULL, "i"); + addFunction(0.f, 0.f, dummy_func, "llTeleportAgent", NULL, "ksvv"); + addFunction(0.f, 0.f, dummy_func, "llTeleportAgentGlobalCoords", NULL, "kvvv"); + + // Pathfinding functions addFunction(10.f, 0.f, dummy_func, "llCreateCharacter", NULL, "l"); addFunction(10.f, 0.f, dummy_func, "llDeleteCharacter", NULL, NULL); addFunction(10.f, 0.f, dummy_func, "llEvade", NULL, "kl"); addFunction(10.f, 0.f, dummy_func, "llExecCharacterCmd", NULL, "il"); - addFunction(10.f, 0.f, dummy_func, "llGetClosestNavPoint", "l", "vl"); addFunction(10.f, 0.f, dummy_func, "llFleeFrom", NULL, "vfl"); + addFunction(10.f, 0.f, dummy_func, "llGetClosestNavPoint", NULL, "vl"); + addFunction(10.f, 0.f, dummy_func, "llGetStaticPath", NULL, "vvfl"); addFunction(10.f, 0.f, dummy_func, "llNavigateTo", NULL, "vl"); addFunction(10.f, 0.f, dummy_func, "llPatrolPoints", NULL, "ll"); addFunction(10.f, 0.f, dummy_func, "llPursue", NULL, "kl"); addFunction(10.f, 0.f, dummy_func, "llUpdateCharacter", NULL, "l"); - addFunction(10.f, 0.f, dummy_func, "llWanderWithin", NULL, "vfl"); + addFunction(10.f, 0.f, dummy_func, "llWanderWithin", NULL, "vvl"); - - - // REGARDING OSSL FUNCTIONS + // SL-LSL Functions to be added above this line + // --------------------------------------------- + // NOTE bytecode placement no longer applies, viewers do not compile scripts anymore (confirmed with LL, also noted by Phoenix/Firestorm team.) + // REGARDING NON SL-LSL FUNCTIONS (OSSL, aaFunctions, botFunctions) // These additions should be posted underneath the llFunctions // These functions pertain to OpenSimulator and are in no part applicable to SecondLife by Linden Labs // The Current State of these functions are in flux and development is ongoing. Not all the functions are presently - // documented and therefore the description may be incomplete and require further attention. - // OpenSimulator is written in C# and not CPP therefore some values for example "double = float" etc. are different. - - // OSSL corrections and syntax additions added + set in same order as found in OSSL_stub.cs of OpenSim Source (Updated PM October-21-2010 - // based on OpenSimulator Ver. 0.7.x DEV/Master Git # a7acb650d400a280a7b9edabd304376dff9c81af - a7acb65-r/14142 + // fully documented and therefore the description may be incomplete and require further attention. + // OpenSim & Aurora-Sim are written in C# and not CPP therefore some values for example "double = float" etc. are different. + // + // OSSL corrections and syntax additions added + set initially in same order as found in IOSSL_Api.cs of Aurora-Sim & OpenSim Source + // updates added @ end of each subsection for update timeline maint. // Updates by WhiteStar Magic - - // It should be noted though, that the order of OSSL functions is not important for correct functionality. - - addFunction(10.f, 0.f, dummy_func, "osSetRegionWaterHeight", NULL, "f"); - addFunction(10.f, 0.f, dummy_func, "osSetRegionSunSettings", NULL, "iif"); - addFunction(10.f, 0.f, dummy_func, "osSetEstateSunSettings", NULL, "if"); - addFunction(10.f, 0.f, dummy_func, "osGetCurrentSunHour", "f", NULL); - addFunction(10.f, 0.f, dummy_func, "osSunGetParam","f", "s"); // Deprecated. Use osGetSunParam instead - addFunction(10.f, 0.f, dummy_func, "osSunSetParam", "sf", NULL); // Deprecated. Use osSetSunParam instead - addFunction(10.f, 0.f, dummy_func, "osWindActiveModelPluginName", "s", NULL); - addFunction(10.f, 0.f, dummy_func, "osParcelJoin", NULL, "vv"); - addFunction(10.f, 0.f, dummy_func, "osParcelSubdivide", NULL, "vv"); - addFunction(10.f, 0.f, dummy_func, "osParcelSetDetails", NULL, "vv"); // Deprecated. Use osSetParcelDetails instead. - // addFunction(10.f, 0.f, dummy_func, "osWindParamSet", NULL, "ssf"); // This function was renamed before it was implemented. Leaving this in for now. - // addFunction(10.f, 0.f, dummy_func, "osWindParamGet", "f", "ss"); // This function was renamed before it was implemented. Leaving this in for now. - addFunction(10.f, 0.f, dummy_func, "osList2Double", "f", "li"); + // + // OSSL Functions COMMON to OpenSim & Aurora-Sim addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureURL", NULL, "ksssi"); - addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureData", NULL, "ksssi"); addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureURLBlend", NULL, "ksssii"); - addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureDataBlend", NULL, "ksssii"); addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureURLBlendFace", NULL, "ksssfiiii"); + addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureData", NULL, "ksssi"); + addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureDataBlend", NULL, "ksssii"); addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureDataBlendFace", NULL, "ksssfiiii"); - addFunction(10.f, 0.f, dummy_func, "osTerrainGetHeight", "f", "ii"); // Deprecated. Use osGetTerrainHeight instead - addFunction(10.f, 0.f, dummy_func, "osTerrainSetHeight", NULL, "iif"); // Deprecated. Use osSetTerrainHeight instead + addFunction(10.f, 0.f, dummy_func, "osGetTerrainHeight", "f", "ii"); + addFunction(10.f, 0.f, dummy_func, "osSetTerrainHeight", NULL, "iif"); addFunction(10.f, 0.f, dummy_func, "osTerrainFlush", NULL, NULL); addFunction(10.f, 0.f, dummy_func, "osRegionRestart", "i", "f"); addFunction(10.f, 0.f, dummy_func, "osRegionNotice",NULL, "s"); addFunction(10.f, 0.f, dummy_func, "osConsoleCommand", NULL, "s"); addFunction(10.f, 0.f, dummy_func, "osSetParcelMediaURL", NULL, "s"); - addFunction(10.f, 0.f, dummy_func, "osSetParcelSIPAddress", NULL, "s"); addFunction(10.f, 0.f, dummy_func, "osSetPrimFloatOnWater", NULL, "i"); - addFunction(10.f, 0.f, dummy_func, "osTeleportAgent", NULL, "ksvv"); + addFunction(10.f, 0.f, dummy_func, "osSetParcelSIPAddress", NULL, "s"); addFunction(10.f, 0.f, dummy_func, "osGetAgentIP", "s", "k"); addFunction(10.f, 0.f, dummy_func, "osGetAgents", "l", NULL); + addFunction(10.f, 0.f, dummy_func, "osTeleportAgent", NULL, "ksvv"); // Polymorphic + addFunction(10.f, 0.f, dummy_func, "osTeleportOwner", NULL, "svv"); // Polymorphic addFunction(10.f, 0.f, dummy_func, "osAvatarPlayAnimation", NULL, "ks"); addFunction(10.f, 0.f, dummy_func, "osAvatarStopAnimation", NULL, "ks"); + addFunction(10.f, 0.f, dummy_func, "osForceAttachToAvatar", NULL, "i"); // May.03.2012 + addFunction(10.f, 0.f, dummy_func, "osForceDetachFromAvatar", NULL, NULL); // May.03.2012 addFunction(10.f, 0.f, dummy_func, "osMovePen", NULL, "sii"); - addFunction(10.f, 0.f, dummy_func, "osDrawLine", NULL, "siiii"); + addFunction(10.f, 0.f, dummy_func, "osDrawLine", NULL, "siiii"); // Polymorphic addFunction(10.f, 0.f, dummy_func, "osDrawText", NULL, "ss"); addFunction(10.f, 0.f, dummy_func, "osDrawEllipse", NULL, "sii"); addFunction(10.f, 0.f, dummy_func, "osDrawRectangle", NULL, "sii"); @@ -574,14 +581,27 @@ void LLScriptLibrary::init() addFunction(10.f, 0.f, dummy_func, "osSetFontSize", NULL, "si"); addFunction(10.f, 0.f, dummy_func, "osSetFontName", NULL, "ss"); addFunction(10.f, 0.f, dummy_func, "osSetPenSize", NULL, "si"); + addFunction(10.f, 0.f, dummy_func, "osSetPenColor", NULL, "ss"); addFunction(10.f, 0.f, dummy_func, "osSetPenCap", NULL, "sss"); - addFunction(10.f, 0.f, dummy_func, "osSetPenColour", NULL, "ss"); // Deprecated. Use osSetPenColor instead addFunction(10.f, 0.f, dummy_func, "osDrawImage", NULL, "siis"); addFunction(10.f, 0.f, dummy_func, "osGetDrawStringSize", "v", "sssi"); - addFunction(10.f, 0.f, dummy_func, "osSetStateEvents", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "osList2Double", "f", "li"); + addFunction(10.f, 0.f, dummy_func, "osSetRegionWaterHeight", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "osSetRegionSunSettings", NULL, "iif"); + addFunction(10.f, 0.f, dummy_func, "osSetEstateSunSettings", NULL, "if"); + addFunction(10.f, 0.f, dummy_func, "osGetCurrentSunHour", "f", NULL); + addFunction(10.f, 0.f, dummy_func, "osGetSunParam","f", "s"); + addFunction(10.f, 0.f, dummy_func, "osSetSunParam", "sf", NULL); + addFunction(10.f, 0.f, dummy_func, "osWindActiveModelPluginName", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "osSetWindParam", NULL, "ssf"); + addFunction(10.f, 0.f, dummy_func, "osGetWindParam", "f", "ss"); + addFunction(10.f, 0.f, dummy_func, "osParcelJoin", NULL, "vv"); + addFunction(10.f, 0.f, dummy_func, "osParcelSubdivide", NULL, "vv"); + addFunction(10.f, 0.f, dummy_func, "osSetParcelDetails", NULL, "vl"); addFunction(10.f, 0.f, dummy_func, "osGetScriptEngineName", "s", NULL); addFunction(10.f, 0.f, dummy_func, "osGetSimulatorVersion", "s", NULL); addFunction(10.f, 0.f, dummy_func, "osParseJSON", "s", "s"); + addFunction(10.f, 0.f, dummy_func, "osParseJSONNew", "s", "s"); // mar.5.2012 addFunction(10.f, 0.f, dummy_func, "osMessageObject", NULL, "ks"); addFunction(10.f, 0.f, dummy_func, "osMakeNotecard", NULL, "sl"); addFunction(10.f, 0.f, dummy_func, "osGetNotecardLine", "s", "si"); @@ -592,16 +612,16 @@ void LLScriptLibrary::init() addFunction(10.f, 0.f, dummy_func, "osGetGridNick", "s", NULL); addFunction(10.f, 0.f, dummy_func, "osGetGridName", "s", NULL); addFunction(10.f, 0.f, dummy_func, "osGetGridLoginURI", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "osGetGridHomeURI","s",NULL); // mar.5.2012 + addFunction(10.f, 0.f, dummy_func, "osGetGridGatekeeperURI", "s", "NULL"); //mar.11.2012 + addFunction(10.f, 0.f, dummy_func, "osGetGridCustom","s","k"); // mar.5.2012 addFunction(10.f, 0.f, dummy_func, "osFormatString", "s", "sl"); addFunction(10.f, 0.f, dummy_func, "osMatchString", "l", "ssi"); + addFunction(10.f, 0.f, dummy_func, "osReplaceString", "s", "sssi"); // mar.5.2012 addFunction(10.f, 0.f, dummy_func, "osLoadedCreationDate", "s", NULL); addFunction(10.f, 0.f, dummy_func, "osLoadedCreationTime", "s", NULL); addFunction(10.f, 0.f, dummy_func, "osLoadedCreationID", "s", NULL); addFunction(10.f, 0.f, dummy_func, "osGetLinkPrimitiveParams", "l", "il"); - addFunction(10.f, 0.f, dummy_func, "osNpcCreate", "k", "ssvk"); - addFunction(10.f, 0.f, dummy_func, "osNpcMoveTo", NULL, "kv"); - addFunction(10.f, 0.f, dummy_func, "osNpcSay", NULL, "ks"); - addFunction(10.f, 0.f, dummy_func, "osNpcRemove", NULL, "k"); addFunction(10.f, 0.f, dummy_func, "osGetMapTexture", "k", NULL); addFunction(10.f, 0.f, dummy_func, "osGetRegionMapTexture", "k", "s"); addFunction(10.f, 0.f, dummy_func, "osGetRegionStats", "l", NULL); @@ -613,52 +633,105 @@ void LLScriptLibrary::init() addFunction(10.f, 0.f, dummy_func, "osGetPrimitiveParams", "l", "kl"); addFunction(10.f, 0.f, dummy_func, "osSetPrimitiveParams", NULL, "kl"); addFunction(10.f, 0.f, dummy_func, "osSetProjectionParams", NULL, "kikfff"); - addFunction(10.f, 0.f, dummy_func, "osUnixTimeToTimestamp", "s", "i"); - addFunction(10.f, 0.f, dummy_func, "osSetPenColor", NULL, "ss"); - addFunction(10.f, 0.f, dummy_func, "osGetSunParam","f", "s"); - addFunction(10.f, 0.f, dummy_func, "osSetSunParam", NULL, "sf"); - addFunction(10.f, 0.f, dummy_func, "osSetParcelDetails", NULL, "vl"); - addFunction(10.f, 0.f, dummy_func, "osGetTerrainHeight", "f", "ii"); - addFunction(10.f, 0.f, dummy_func, "osSetTerrainHeight", NULL, "iif"); addFunction(10.f, 0.f, dummy_func, "osGetAvatarList", "l", NULL); - addFunction(10.f, 0.f, dummy_func, "osTeleportOwner", NULL, "svv"); - addFunction(10.f, 0.f, dummy_func, "osGetWindParam","f", "ss"); - addFunction(10.f, 0.f, dummy_func, "osSetWindParam", NULL, "ssf"); - + addFunction(10.f, 0.f, dummy_func, "osUnixTimeToTimestamp", "s", "i"); + addFunction(10.f, 0.f, dummy_func, "osGetInventoryDesc", "s", "s"); //mar.17.2012 + addFunction(10.f, 0.f, dummy_func, "osInviteToGroup", "i", "k"); // May.03.2012 + addFunction(10.f, 0.f, dummy_func, "osEjectFromGroup", "i", "k"); // May.03.2012 + addFunction(10.f, 0.f, dummy_func, "osSetTerrainTexture", NULL, "ik"); // May.03.2012 + addFunction(10.f, 0.f, dummy_func, "osSetTerrainTextureHeight", NULL, "iff"); // May.03.2012 - // LightShare functions +// +// OSSL Functions OpenSim Unique + addFunction(10.f, 0.f, dummy_func, "osSetStateEvents", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "osIsNpc","i","k"); // mar.5.2012 + addFunction(10.f, 0.f, dummy_func, "osNpcCreate", "k", "ssvk"); + addFunction(10.f, 0.f, dummy_func, "osNpcSaveAppearance", NULL, "ks"); + addFunction(10.f, 0.f, dummy_func, "osNpcLoadAppearance", NULL, "ks"); + addFunction(10.f, 0.f, dummy_func, "osNpcGetPos","k","k"); + addFunction(10.f, 0.f, dummy_func, "osNpcMoveTo", NULL, "kv"); + addFunction(10.f, 0.f, dummy_func, "osNpcMoveToTarget", NULL, "kvi"); + addFunction(10.f, 0.f, dummy_func, "osNpcGetOwner","k","k"); // mar.5.2012 + addFunction(10.f, 0.f, dummy_func, "osNpcGetRot", "r", "k"); + addFunction(10.f, 0.f, dummy_func, "osNpcSetRot", NULL, "kr"); + addFunction(10.f, 0.f, dummy_func, "osNpcStopMoveToTarget", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "osNpcSay", NULL, "ks"); + addFunction(10.f, 0.f, dummy_func, "osNpcSay", NULL, "kis"); // May.03.2012 + addFunction(10.f, 0.f, dummy_func, "osNpcSit", NULL, "kki"); + addFunction(10.f, 0.f, dummy_func, "osNpcStand", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "osNpcRemove", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "osNpcPlayAnimation",NULL,"ks"); // mar.5.2012 + addFunction(10.f, 0.f, dummy_func, "osNpcStopAnimation",NULL,"ks"); // mar.5.2012 + addFunction(10.f, 0.f, dummy_func, "osOwnerSaveAppearance", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "osAgentSaveAppearance", NULL, "ks"); + addFunction(10.f, 0.f, dummy_func, "osNpcShout", NULL, "kis"); // May.03.2012 + addFunction(10.f, 0.f, dummy_func, "osNpcWhisper", NULL, "kis"); // May.03.2012 +// +// OSSL Functions Aurora-Sim Unique + addFunction(10.f, 0.f, dummy_func, "osReturnObject", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "osReturnObjects", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "osShutDown", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "osAddAgentToGroup", NULL, "kss"); + addFunction(10.f, 0.f, dummy_func, "osRezObject", NULL, "svvriiiii"); +// +// LightShare functions (Careminster Variant) addFunction(10.f, 0.f, dummy_func, "cmSetWindlightScene", "i", "l"); addFunction(10.f, 0.f, dummy_func, "cmSetWindlightSceneTargeted", "i", "lk"); addFunction(10.f, 0.f, dummy_func, "cmGetWindlightScene", "l", "l"); - // LightShare functions - alternate versions - // don't ask me why they renamed 'em, but we need to include both versions -- MC +// LightShare functions - alternate versions (os & aa variant) addFunction(10.f, 0.f, dummy_func, "lsSetWindlightScene", "i", "l"); addFunction(10.f, 0.f, dummy_func, "lsSetWindlightSceneTargeted", "i", "lk"); addFunction(10.f, 0.f, dummy_func, "lsGetWindlightScene", "l", "l"); - - // New OSSL functions 08-10-2011 - addFunction(10.f, 0.f, dummy_func, "osNpcSaveAppearance", "k", "ks"); - addFunction(10.f, 0.f, dummy_func, "osNpcLoadAppearance", NULL, "ks"); - addFunction(10.f, 0.f, dummy_func, "osNpcMoveToTarget", NULL, "kvi"); - addFunction(10.f, 0.f, dummy_func, "osOwnerSaveAppearance", "k", "s"); - - // More new stuffs - addFunction(10.f, 0.f, dummy_func, "osNpcGetRot", "r", "k"); - addFunction(10.f, 0.f, dummy_func, "osNpcSetRot", NULL, "kr"); - addFunction(10.f, 0.f, dummy_func, "osAgentSaveAppearance", "k", "ks"); - addFunction(10.f, 0.f, dummy_func, "osNpcGetPos", "v", "k"); - addFunction(10.f, 0.f, dummy_func, "osNpcStopMoveToTarget", NULL, "k"); - - addFunction(10.f, 0.f, dummy_func, "osIsNpc", "i", "k"); - addFunction(10.f, 0.f, dummy_func, "osNpcGetOwner", "k", "k"); - addFunction(10.f, 0.f, dummy_func, "osGetGridCustom", "s", "s"); - addFunction(10.f, 0.f, dummy_func, "osGetGridHomeURI", "s", NULL); - addFunction(10.f, 0.f, dummy_func, "osNpcPlayAnimation", NULL, "ks"); - addFunction(10.f, 0.f, dummy_func, "osNpcSit", NULL, "kki"); - addFunction(10.f, 0.f, dummy_func, "osNpcStand", NULL, "k"); - addFunction(10.f, 0.f, dummy_func, "osNpcStopAnimation", NULL, "ks"); - addFunction(10.f, 0.f, dummy_func, "osSetRot", NULL, "kq"); - +// +// aaFunctions Aurora-Sim ONLY + addFunction(10.f, 0.f, dummy_func, "aaSetCloudDensity", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "aaUpdateDatabase", NULL, "sss"); + addFunction(10.f, 0.f, dummy_func, "aaQueryDatabase", "l", "ss"); + addFunction(10.f, 0.f, dummy_func, "aaDeserializeXMLValues", "l", "s"); + addFunction(10.f, 0.f, dummy_func, "aaDeserializeXMLKeys","l", "s"); + addFunction(10.f, 0.f, dummy_func, "aaSetConeOfSilence", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "aaSerializeXML", "s", "ll"); + addFunction(10.f, 0.f, dummy_func, "aaGetTeam", "s", "k"); + addFunction(10.f, 0.f, dummy_func, "aaGetHealth", "f", "k"); + addFunction(10.f, 0.f, dummy_func, "aaJoinCombat", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "aaLeaveCombat", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "aaJoinCombatTeam", NULL, "ks"); + addFunction(10.f, 0.f, dummy_func, "aaRequestCombatPermission", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "aaThawAvatar", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "aaFreezeAvatar", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "aaGetTeamMembers", "l", "s"); + addFunction(10.f, 0.f, dummy_func, "aaGetLastOwner", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "aaSayDistance", NULL, "ifs"); + addFunction(10.f, 0.f, dummy_func, "aaSayTo", NULL, "ss"); + addFunction(10.f, 0.f, dummy_func, "aaGetWalkDisabled ", "i", "s"); + addFunction(10.f, 0.f, dummy_func, "aaSetWalkDisabled", NULL, "si"); + addFunction(10.f, 0.f, dummy_func, "aaGetFlyDisabled ", "i", "s"); + addFunction(10.f, 0.f, dummy_func, "aaSetFlyDisabled", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "aaAvatarFullName2Key ", "s", "s"); + addFunction(10.f, 0.f, dummy_func, "aaRaiseError", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "aaGetText ", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "aaGetTextColor ", "r", NULL); + addFunction(10.f, 0.f, dummy_func, "aaSetEnv ", NULL, "sl"); + addFunction(10.f, 0.f, dummy_func, "aaGetIsInfiniteRegion", "i", NULL); +// botFunctions Aurora-Sim ONLY + addFunction(10.f, 0.f, dummy_func, "botGetWaitingTime", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "botSetMap", NULL, "slii"); + addFunction(10.f, 0.f, dummy_func, "botCreateBot", "s", "sssv"); + addFunction(10.f, 0.f, dummy_func, "botRemoveBot", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "botPauseMovement", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "botResumeMovement", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "botFollowAvatar", NULL, "ssff"); + addFunction(10.f, 0.f, dummy_func, "botStopFollowAvatar", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "botSendChatMessage", NULL, "ssii"); + addFunction(10.f, 0.f, dummy_func, "botSendIM",NULL,"sss"); + addFunction(10.f, 0.f, dummy_func, "botSetShouldFly", NULL, "si"); + addFunction(10.f, 0.f, dummy_func, "botSitObject", NULL, "ssv"); + addFunction(10.f, 0.f, dummy_func, "botStandUp", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "botTouchObject", NULL, "ss"); + addFunction(10.f, 0.f, dummy_func, "botAddTag", NULL, "ss"); + addFunction(10.f, 0.f, dummy_func, "botGetBotsWithTag", "l", "s"); + addFunction(10.f, 0.f, dummy_func, "botRemoveBotsWithTag", NULL, "s"); + // energy, sleep, dummy_func, name, return type, parameters } LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index ca9668dec..abda254cf 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -37,7 +37,6 @@ include(LLUI) include(LLVFS) include(LLWindow) include(LLXML) -include(LLXUIXML) include(LScript) include(Linking) include(NDOF) @@ -72,7 +71,6 @@ include_directories( ${LLVFS_INCLUDE_DIRS} ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} - ${LLXUIXML_INCLUDE_DIRS} ${LSCRIPT_INCLUDE_DIRS} ${LSCRIPT_INCLUDE_DIRS}/lscript_compile ) @@ -98,11 +96,7 @@ set(viewer_SOURCE_FILES ascentprefschat.cpp ascentprefssys.cpp ascentprefsvan.cpp - #dhparam.cpp - #dsaparam.cpp emeraldboobutils.cpp - dofloaterhex.cpp - dohexeditor.cpp floatersculptpreview.cpp hbfloatergrouptitles.cpp hgfloatertexteditor.cpp @@ -115,6 +109,7 @@ set(viewer_SOURCE_FILES jcfloaterareasearch.cpp chatbar_as_cmdline.cpp qtoolalign.cpp + NACLantispam.cpp llaccountingcostmanager.cpp llagent.cpp llagentaccess.cpp @@ -223,7 +218,6 @@ set(viewer_SOURCE_FILES llfloatergroupinvite.cpp llfloatergroups.cpp llfloaterhandler.cpp - llfloaterhardwaresettings.cpp llfloaterhtmlcurrency.cpp llfloatermediabrowser.cpp llfloaterhtmlsimple.cpp @@ -251,6 +245,7 @@ set(viewer_SOURCE_FILES llfloaterpostprocess.cpp llfloaterpreference.cpp llfloaterproperties.cpp + llfloaterregiondebugconsole.cpp llfloaterregioninfo.cpp llfloaterreporter.cpp llfloatersearchreplace.cpp @@ -380,6 +375,7 @@ set(viewer_SOURCE_FILES llpanelmsgs.cpp llpanelnetwork.cpp llpanelobject.cpp + llpanelpathfindingrebakenavmesh.cpp llpanelpermissions.cpp llpanelpick.cpp llpanelplace.cpp @@ -388,6 +384,15 @@ set(viewer_SOURCE_FILES llpanelweb.cpp llparcelselection.cpp llpatchvertexarray.cpp + llpathfindingcharacter.cpp + llpathfindingcharacterlist.cpp + llpathfindinglinkset.cpp + llpathfindinglinksetlist.cpp + llpathfindingmanager.cpp + llpathfindingnavmesh.cpp + llpathfindingnavmeshstatus.cpp + llpathfindingobject.cpp + llpathfindingobjectlist.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp llpolymesh.cpp @@ -527,7 +532,6 @@ set(viewer_SOURCE_FILES llvopartgroup.cpp llvosky.cpp llvosurfacepatch.cpp - llvotextbubble.cpp llvotree.cpp llvovolume.cpp llvowater.cpp @@ -575,6 +579,7 @@ set(viewer_HEADER_FILES CMakeLists.txt ViewerInstall.cmake + NACLantispam.h sgmemstat.h sgversion.h llviewerobjectbackup.h @@ -594,8 +599,6 @@ set(viewer_HEADER_FILES ascentprefssys.h ascentprefsvan.h emeraldboobutils.h - dofloaterhex.h - dohexeditor.h floatersculptpreview.h hbfloatergrouptitles.h hgfloatertexteditor.h @@ -719,7 +722,6 @@ set(viewer_HEADER_FILES llfloatergroupinvite.h llfloatergroups.h llfloaterhandler.h - llfloaterhardwaresettings.h llfloaterhtmlcurrency.h llfloatermediabrowser.h llfloaterhtmlsimple.h @@ -747,6 +749,7 @@ set(viewer_HEADER_FILES llfloaterpreference.h llfloaterperms.h llfloaterproperties.h + llfloaterregiondebugconsole.h llfloaterregioninfo.h llfloaterreporter.h llfloatersearchreplace.h @@ -869,7 +872,6 @@ set(viewer_HEADER_FILES llpanellandmedia.h llpanellandobjects.h llpanellandoptions.h - llpanelLCD.h llpanellogin.h llpanelmaininventory.h llpanelmorph.h @@ -877,6 +879,7 @@ set(viewer_HEADER_FILES llpanelmsgs.h llpanelnetwork.h llpanelobject.h + llpanelpathfindingrebakenavmesh.h llpanelpermissions.h llpanelpick.h llpanelplace.h @@ -885,6 +888,15 @@ set(viewer_HEADER_FILES llpanelweb.h llparcelselection.h llpatchvertexarray.h + llpathfindingcharacter.h + llpathfindingcharacterlist.h + llpathfindinglinkset.h + llpathfindinglinksetlist.h + llpathfindingmanager.h + llpathfindingnavmesh.h + llpathfindingnavmeshstatus.h + llpathfindingobject.h + llpathfindingobjectlist.h llphysicsmotion.h llphysicsshapebuilderutil.h llpolymesh.h @@ -1028,7 +1040,6 @@ set(viewer_HEADER_FILES llvopartgroup.h llvosky.h llvosurfacepatch.h - llvotextbubble.h llvotree.h llvotreenew.h llvovolume.h @@ -1550,7 +1561,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLVFS_LIBRARIES} ${LLWINDOW_LIBRARIES} ${LLXML_LIBRARIES} - ${LLXUIXML_LIBRARIES} ${LSCRIPT_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} @@ -1585,6 +1595,14 @@ if (LINUX) set(product ${VIEWER_BRANDING_NAME_CAMELCASE}-${ARCH}-${viewer_VERSION}) + if (FMODEX) + if(MANIFEST_LIBRARIES) + set(MANIFEST_LIBRARIES "${MANIFEST_LIBRARIES}|${FMODEX_LIBRARY}") + else(MANIFEST_LIBRARIES) + set(MANIFEST_LIBRARIES "--extra_libraries=${FMODEX_LIBRARY}") + endif(MANIFEST_LIBRARIES) + endif (FMODEX) + add_custom_command( OUTPUT ${product}.tar.bz2 COMMAND ${PYTHON_EXECUTABLE} @@ -1603,6 +1621,7 @@ if (LINUX) --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched --buildtype=${CMAKE_BUILD_TYPE} + ${MANIFEST_LIBRARIES} DEPENDS secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ) diff --git a/indra/newview/NACLantispam.cpp b/indra/newview/NACLantispam.cpp new file mode 100644 index 000000000..aac555a50 --- /dev/null +++ b/indra/newview/NACLantispam.cpp @@ -0,0 +1,421 @@ +/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * Version 2, December 2004 + * + * Copyright (C) 2004 Sam Hocevar + * + * Everyone is permitted to copy and distribute verbatim or modified + * copies of this license document, and changing it is allowed as long + * as the name is changed. + * + * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + * + * 0. You just DO WHAT THE FUCK YOU WANT TO. + */ + +#include "llviewerprecompiledheaders.h" +#include "NACLantispam.h" +#include "llviewercontrol.h" +#include "llnotificationsutil.h" +#include "llviewerobjectlist.h" +#include "llagent.h" +#include + +U32 NACLAntiSpamRegistry::globalAmount; +U32 NACLAntiSpamRegistry::globalTime; +bool NACLAntiSpamRegistry::bGlobalQueue; +NACLAntiSpamQueue* NACLAntiSpamRegistry::queues[NACLAntiSpamRegistry::QUEUE_MAX] = {0}; +std::tr1::unordered_map NACLAntiSpamRegistry::globalEntries; +std::tr1::unordered_map::iterator NACLAntiSpamRegistry::it2; + +const std::string COLLISION_SOUNDS[] ={"dce5fdd4-afe4-4ea1-822f-dd52cac46b08","51011582-fbca-4580-ae9e-1a5593f094ec","68d62208-e257-4d0c-bbe2-20c9ea9760bb","75872e8c-bc39-451b-9b0b-042d7ba36cba","6a45ba0b-5775-4ea8-8513-26008a17f873","992a6d1b-8c77-40e0-9495-4098ce539694","2de4da5a-faf8-46be-bac6-c4d74f1e5767","6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d","14209133-4961-4acc-9649-53fc38ee1667","bc4a4348-cfcc-4e5e-908e-8a52a8915fe6","9e5c1297-6eed-40c0-825a-d9bcd86e3193","e534761c-1894-4b61-b20c-658a6fb68157","8761f73f-6cf9-4186-8aaa-0948ed002db1","874a26fd-142f-4173-8c5b-890cd846c74d","0e24a717-b97e-4b77-9c94-b59a5a88b2da","75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2","153c8bf7-fb89-4d89-b263-47e58b1b4774","55c3e0ce-275a-46fa-82ff-e0465f5e8703","24babf58-7156-4841-9a3f-761bdbb8e237","aca261d8-e145-4610-9e20-9eff990f2c12","0642fba6-5dcf-4d62-8e7b-94dbb529d117","25a863e8-dc42-4e8a-a357-e76422ace9b5","9538f37c-456e-4047-81be-6435045608d4","8c0f84c3-9afd-4396-b5f5-9bca2c911c20","be582e5d-b123-41a2-a150-454c39e961c8","c70141d4-ba06-41ea-bcbc-35ea81cb8335","7d1826f4-24c4-4aac-8c2e-eff45df37783","063c97d3-033a-4e9b-98d8-05c8074922cb","00000000-0000-0000-0000-000000000120"}; +const int COLLISION_SOUNDS_SIZE=29; + +// NaClAntiSpamQueueEntry + +NACLAntiSpamQueueEntry::NACLAntiSpamQueueEntry() +{ + entryTime=0; + entryAmount=0; + blocked=false; +} +void NACLAntiSpamQueueEntry::clearEntry() +{ + entryTime=0; + entryAmount=0; + blocked=false; +} +U32 NACLAntiSpamQueueEntry::getEntryAmount() +{ + return entryAmount; +} +U32 NACLAntiSpamQueueEntry::getEntryTime() +{ + return entryTime; +} +void NACLAntiSpamQueueEntry::updateEntryAmount() +{ + entryAmount++; +} +void NACLAntiSpamQueueEntry::updateEntryTime() +{ + entryTime=time(0); +} +void NACLAntiSpamQueueEntry::setBlocked() +{ + blocked=true; +} +bool NACLAntiSpamQueueEntry::getBlocked() +{ + return blocked; +} + +// NaClAntiSpamQueue + +NACLAntiSpamQueue::NACLAntiSpamQueue(U32 time, U32 amount) +{ + queueTime=time; + queueAmount=amount; +} +void NACLAntiSpamQueue::setAmount(U32 amount) +{ + queueAmount=amount; +} +void NACLAntiSpamQueue::setTime(U32 time) +{ + queueTime=time; +} +void NACLAntiSpamQueue::clearEntries() +{ + for(it = entries.begin(); it != entries.end(); it++) + { + it->second->clearEntry(); + } +} +void NACLAntiSpamQueue::purgeEntries() +{ + for(it = entries.begin(); it != entries.end(); it++) + { + delete it->second; + } + entries.clear(); +} +void NACLAntiSpamQueue::blockEntry(LLUUID& source) +{ + it=entries.find(source.asString()); + if(it == entries.end()) + { + entries[source.asString()]=new NACLAntiSpamQueueEntry(); + } + entries[source.asString()]->setBlocked(); +} +int NACLAntiSpamQueue::checkEntry(LLUUID& name, U32 multiplier) +{ + it=entries.find(name.asString()); + if(it != entries.end()) + { + if(it->second->getBlocked()) return 2; + U32 eTime=it->second->getEntryTime(); + U32 currentTime=time(0); + if((currentTime-eTime) <= queueTime) + { + it->second->updateEntryAmount(); + U32 eAmount=it->second->getEntryAmount(); + if(eAmount > (queueAmount*multiplier)) + { + it->second->setBlocked(); + return 1; + } + else + return 0; + } + else + { + it->second->clearEntry(); + it->second->updateEntryAmount(); + it->second->updateEntryTime(); + return 0; + } + } + else + { + entries[name.asString()]=new NACLAntiSpamQueueEntry(); + entries[name.asString()]->updateEntryAmount(); + entries[name.asString()]->updateEntryTime(); + return 0; + } +} + +// NaClAntiSpamRegistry + +static const char* QUEUE_NAME[NACLAntiSpamRegistry::QUEUE_MAX] = { +"Chat", +"Inventory", +"Instant Message", +"Calling Card", +"Sound", +"Sound Preload", +"Script Dialog", +"Teleport"}; + +NACLAntiSpamRegistry::NACLAntiSpamRegistry(U32 time, U32 amount) +{ + globalTime=time; + globalAmount=amount; + static LLCachedControl _NACL_AntiSpamGlobalQueue(gSavedSettings,"_NACL_AntiSpamGlobalQueue"); + bGlobalQueue=_NACL_AntiSpamGlobalQueue; + for(int queue = 0; queue < QUEUE_MAX; ++queue) + { + queues[queue] = new NACLAntiSpamQueue(time,amount); + } +} +const char* NACLAntiSpamRegistry::getQueueName(U32 queue_id) +{ + if(queue_id >= QUEUE_MAX) + return "Unknown"; + return QUEUE_NAME[queue_id]; +} +void NACLAntiSpamRegistry::registerQueues(U32 time, U32 amount) +{ + globalTime=time; + globalAmount=amount; + static LLCachedControl _NACL_AntiSpamGlobalQueue(gSavedSettings,"_NACL_AntiSpamGlobalQueue"); + bGlobalQueue=_NACL_AntiSpamGlobalQueue; + for(int queue = 0; queue < QUEUE_MAX; ++queue) + { + queues[queue] = new NACLAntiSpamQueue(time,amount); + } +} +void NACLAntiSpamRegistry::registerQueue(U32 name, U32 time, U32 amount) +{ + /* + it=queues.find(name); + if(it == queues.end()) + { + queues[name]=new NACLAntiSpamQueue(time,amount); + } + */ +} +void NACLAntiSpamRegistry::setRegisteredQueueTime(U32 name, U32 time) +{ + if(name >= QUEUE_MAX || queues[name] == 0) + { + LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl; + return; + } + + queues[name]->setTime(time); +} +void NACLAntiSpamRegistry::setRegisteredQueueAmount(U32 name, U32 amount) +{ + if(name >= QUEUE_MAX || queues[name] == 0) + { + LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl; + return; + } + + queues[name]->setAmount(amount); +} +void NACLAntiSpamRegistry::setAllQueueTimes(U32 time) +{ + globalTime=time; + for(int queue = 0; queue < QUEUE_MAX; ++queue) + queues[queue]->setTime(time); +} +void NACLAntiSpamRegistry::setAllQueueAmounts(U32 amount) +{ + globalAmount=amount; + for(int queue = 0; queue < QUEUE_MAX; ++queue) + { + if(queue == QUEUE_SOUND || queue == QUEUE_SOUND_PRELOAD) + queues[queue]->setAmount(amount*5); + else + queues[queue]->setAmount(amount); + } +} +void NACLAntiSpamRegistry::clearRegisteredQueue(U32 name) +{ + if(name >= QUEUE_MAX || queues[name] == 0) + { + LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl; + return; + } + + queues[name]->clearEntries(); +} +void NACLAntiSpamRegistry::purgeRegisteredQueue(U32 name) +{ + if(name >= QUEUE_MAX || queues[name] == 0) + { + LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl; + return; + } + + queues[name]->purgeEntries(); +} +void NACLAntiSpamRegistry::blockOnQueue(U32 name, LLUUID& source) +{ + if(bGlobalQueue) + { + NACLAntiSpamRegistry::blockGlobalEntry(source); + } + else + { + if(name >= QUEUE_MAX || queues[name] == 0) + { + LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl; + return; + } + queues[name]->blockEntry(source); + } +} +void NACLAntiSpamRegistry::blockGlobalEntry(LLUUID& source) +{ + it2=globalEntries.find(source.asString()); + if(it2 == globalEntries.end()) + { + globalEntries[source.asString()]=new NACLAntiSpamQueueEntry(); + } + globalEntries[source.asString()]->setBlocked(); +} +bool NACLAntiSpamRegistry::checkQueue(U32 name, LLUUID& source, U32 multiplier) +{ + if(source.isNull()) return false; + if(gAgent.getID() == source) return false; + LLViewerObject *obj=gObjectList.findObject(source); + if(obj) + if(obj->permYouOwner()) return false; + + int result; + if(bGlobalQueue) + { + result=NACLAntiSpamRegistry::checkGlobalEntry(source,multiplier); + } + else + { + if(name >= QUEUE_MAX || queues[name] == 0) + { + LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl; + return false; + } + result=queues[name]->checkEntry(source,multiplier); + } + if(result==0) + { + return false; + } + else if(result==2) + { + return true; + } + else + { + if(gSavedSettings.getBOOL("AntiSpamNotify")) + { + LLSD args; + args["MESSAGE"] = std::string(getQueueName(name))+": Blocked object "+source.asString(); + LLNotificationsUtil::add("SystemMessageTip", args); + } + return true; + } +} + +// Global queue stoof +void NACLAntiSpamRegistry::setGlobalQueue(bool value) +{ + NACLAntiSpamRegistry::purgeAllQueues(); + bGlobalQueue=value; +} +void NACLAntiSpamRegistry::setGlobalAmount(U32 amount) +{ + globalAmount=amount; +} +void NACLAntiSpamRegistry::setGlobalTime(U32 time) +{ + globalTime=time; +} +void NACLAntiSpamRegistry::clearAllQueues() +{ + if(bGlobalQueue) + NACLAntiSpamRegistry::clearGlobalEntries(); + else + for(int queue = 0; queue < QUEUE_MAX; ++queue) + { + queues[queue]->clearEntries(); + } +} +void NACLAntiSpamRegistry::purgeAllQueues() +{ + if(bGlobalQueue) + NACLAntiSpamRegistry::purgeGlobalEntries(); + else + for(int queue = 0; queue < QUEUE_MAX; ++queue) + { + queues[queue]->purgeEntries(); + } +} +int NACLAntiSpamRegistry::checkGlobalEntry(LLUUID& name, U32 multiplier) +{ + it2=globalEntries.find(name.asString()); + if(it2 != globalEntries.end()) + { + if(it2->second->getBlocked()) return 2; + U32 eTime=it2->second->getEntryTime(); + U32 currentTime=time(0); + if((currentTime-eTime) <= globalTime) + { + it2->second->updateEntryAmount(); + U32 eAmount=it2->second->getEntryAmount(); + if(eAmount > (globalAmount*multiplier)) + return 1; + else + return 0; + } + else + { + it2->second->clearEntry(); + it2->second->updateEntryAmount(); + it2->second->updateEntryTime(); + return 0; + } + } + else + { + globalEntries[name.asString()]=new NACLAntiSpamQueueEntry(); + globalEntries[name.asString()]->updateEntryAmount(); + globalEntries[name.asString()]->updateEntryTime(); + return 0; + } +} +void NACLAntiSpamRegistry::clearGlobalEntries() +{ + for(it2 = globalEntries.begin(); it2 != globalEntries.end(); it2++) + { + it2->second->clearEntry(); + } +} +void NACLAntiSpamRegistry::purgeGlobalEntries() +{ + for(it2 = globalEntries.begin(); it2 != globalEntries.end(); it2++) + { + delete it2->second; + it2->second = 0; + } + globalEntries.clear(); +} +bool NACLAntiSpamRegistry::handleNaclAntiSpamGlobalQueueChanged(const LLSD& newvalue) +{ + setGlobalQueue(newvalue.asBoolean()); + return true; +} +bool NACLAntiSpamRegistry::handleNaclAntiSpamTimeChanged(const LLSD& newvalue) +{ + setAllQueueTimes(newvalue.asInteger()); + return true; +} +bool NACLAntiSpamRegistry::handleNaclAntiSpamAmountChanged(const LLSD& newvalue) +{ + setAllQueueAmounts(newvalue.asInteger()); + return true; +} + diff --git a/indra/newview/NACLantispam.h b/indra/newview/NACLantispam.h new file mode 100644 index 000000000..6da32f5c1 --- /dev/null +++ b/indra/newview/NACLantispam.h @@ -0,0 +1,107 @@ +/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * Version 2, December 2004 + * + * Copyright (C) 2004 Sam Hocevar + * + * Everyone is permitted to copy and distribute verbatim or modified + * copies of this license document, and changing it is allowed as long + * as the name is changed. + * + * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + * + * 0. You just DO WHAT THE FUCK YOU WANT TO. + */ + +#ifndef NACLANTISPAM_H +#define NACLANTISPAM_H +#include +#include "stdtypes.h" +#include "lluuid.h" +class NACLAntiSpamQueueEntry +{ + friend class NACLAntiSpamQueue; + friend class NACLAntiSpamRegistry; +protected: + NACLAntiSpamQueueEntry(); + void clearEntry(); + U32 getEntryAmount(); + U32 getEntryTime(); + void updateEntryAmount(); + void updateEntryTime(); + bool getBlocked(); + void setBlocked(); +private: + U32 entryAmount; + U32 entryTime; + bool blocked; +}; +class NACLAntiSpamQueue +{ + friend class NACLAntiSpamRegistry; +protected: + NACLAntiSpamQueue(U32 time, U32 amount); + void setAmount(U32 amount); + void setTime(U32 time); + void clearEntries(); + void purgeEntries(); + void blockEntry(LLUUID& source); + int checkEntry(LLUUID& source, U32 multiplier); +private: + std::tr1::unordered_map entries; + std::tr1::unordered_map::iterator it; + U32 queueAmount; + U32 queueTime; +}; +class NACLAntiSpamRegistry +{ +public: + NACLAntiSpamRegistry(U32 time=2, U32 amount=10); + static void registerQueues(U32 time=2, U32 amount=10); + static void registerQueue(U32 name, U32 time, U32 amount); + static void setRegisteredQueueTime(U32 name, U32 time); + static void setRegisteredQueueAmount(U32 name,U32 amount); + static void setAllQueueTimes(U32 amount); + static void setAllQueueAmounts(U32 time); + static bool checkQueue(U32 name, LLUUID& source, U32 multiplier=1); + static bool handleNaclAntiSpamGlobalQueueChanged(const LLSD& newvalue); + static bool handleNaclAntiSpamTimeChanged(const LLSD& newvalue); + static bool handleNaclAntiSpamAmountChanged(const LLSD& newvalue); + static void clearRegisteredQueue(U32 name); + static void purgeRegisteredQueue(U32 name); + static void clearAllQueues(); + static void purgeAllQueues(); + static void setGlobalQueue(bool value); + static void setGlobalAmount(U32 amount); + static void setGlobalTime(U32 time); + static void blockOnQueue(U32 name,LLUUID& owner_id); + enum { + QUEUE_CHAT, + QUEUE_INVENTORY, + QUEUE_IM, + QUEUE_CALLING_CARD, + QUEUE_SOUND, + QUEUE_SOUND_PRELOAD, + QUEUE_SCRIPT_DIALOG, + QUEUE_TELEPORT, + QUEUE_MAX + }; +private: + static const char* getQueueName(U32 queue_id); + static NACLAntiSpamQueue* queues[QUEUE_MAX]; + static std::tr1::unordered_map globalEntries; + static std::tr1::unordered_map::iterator it2; + static U32 globalTime; + static U32 globalAmount; + static bool bGlobalQueue; + + static int checkGlobalEntry(LLUUID& source, U32 multiplier); + static void clearGlobalEntries(); + static void purgeGlobalEntries(); + static void blockGlobalEntry(LLUUID& source); +}; + +extern const std::string COLLISION_SOUNDS[]; +extern const int COLLISION_SOUNDS_SIZE; + +#endif //NACLANTISPAM_H diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini index b264e08e3..dd50567cd 100644 --- a/indra/newview/app_settings/keywords.ini +++ b/indra/newview/app_settings/keywords.ini @@ -14,7 +14,7 @@ key Key type. Use NULL_KEY to test for empty keys vector Vector type of 3 floats. Used to represent 3D motion, Euler angles, and color.:Access components by .x, .y. or .z rotation Rotation type of 4 floats. Used to represent rotation.:Access components by .x, .y., .z, or .w list List of various data types -quaternion Rotation type of 4 floats. Used to represent rotation.:Access components by .x, .y, .z, or .w +quaternion Rotation type of 4 floats. Used to represent rotation.:Access components by .x, .y, .z, or .w # events [word 0, .3, .5] @@ -52,7 +52,7 @@ changed changed( integer change ):Triggered various event change the task:(tes remote_data remote_data(integer event_type, key channel, key message_id, string sender,integer idata, string sdata):Triggered by various XML-RPC calls (event_type will be one of REMOTE_DATA_CHANNEL, REMOTE_DATA_REQUEST, REMOTE_DATA_REPLY) http_response http_response(key request_id, integer status, list metadata, string body):Triggered when task receives a response to one of its llHTTPRequests http_request http_request(key id, string method, string body):Triggered when task receives an http request against a public URL -transaction_result transaction_result(key id, integer success, string data):Triggered when task receives asynchronous data. +transaction_result transaction_result(key id, integer success, string data):Triggered when task receives asynchronous data. path_update path_update(integer type, list reserved):Triggered when the state of a pathfinder character changes. Note; "list reserved" is not currently used # integer constants @@ -70,9 +70,10 @@ STATUS_BLOCK_GRAB_OBJECT This status flag keeps the object from being moved by g STATUS_DIE_AT_EDGE Passed in the llSetStatus library function. If TRUE, objects that reach the edge of the world just die:rather than teleporting back to the owner STATUS_RETURN_AT_EDGE Passed in the llSetStatus library function. If TRUE, script rezzed objects that reach the edge of the world:are returned rather than killed:STATUS_RETURN_AT_EDGE trumps STATUS_DIE_AT_EDGE if both are set STATUS_CAST_SHADOWS Passed in the llSetStatus library function. If TRUE, object casts shadows on other objects + AGENT Passed in llSensor library function to look for other Agents; DEPRECATED: Use AGENT_BY_LEGACY_NAME -AGENT_BY_USERNAME Passed in llSensor library function to look for other Agents by username -AGENT_BY_LEGACY_NAME Passed in llSensor library function to look for other Agents by legacy name +AGENT_BY_LEGACY_NAME Passed in llSensor library function to look for other Agents by legacy name +AGENT_BY_USERNAME Passed in llSensor library function to look for other Agents by username ACTIVE Passed in llSensor library function to look for moving objects PASSIVE Passed in llSensor library function to look for objects that aren't moving SCRIPTED Passed in llSensor library function to look for scripted objects @@ -171,10 +172,10 @@ OBJECT_VELOCITY Used with llGetObjectDetails to get an object's velocity OBJECT_OWNER Used with llGetObjectDetails to get an object's owner's key. Will be NULL_KEY if group owned OBJECT_GROUP Used with llGetObjectDetails to get an object's group's key OBJECT_CREATOR Used with llGetObjectDetails to get an object's creator's key -OBJECT_RUNNING_SCRIPT_COUNT Used with llGetObjectDetails to get an object's velocity. -OBJECT_TOTAL_SCRIPT_COUNT Used with llGetObjectDetails to get an object's owner's key. Will be NULL_KEY if group owned. -OBJECT_SCRIPT_MEMORY Used with llGetObjectDetails to get an object's group's key. -OBJECT_SCRIPT_TIME Used with llGetObjectDetails to get an object's creator's key. +OBJECT_RUNNING_SCRIPT_COUNT Gets the number of running scripts attached to the object or agent +OBJECT_TOTAL_SCRIPT_COUNT Gets the number of scripts, both running and stopped, attached to the object or agent. +OBJECT_SCRIPT_MEMORY Gets the total amount of script memory allocated to the object or agent, in bytes. +OBJECT_SCRIPT_TIME Gets the total amount of average script CPU time used by the object or agent, in seconds. OBJECT_PRIM_EQUIVALENCE Gets the prim equivalence of the object. OBJECT_SERVER_COST Used with llGetObjectDetails to get the server cost. OBJECT_STREAMING_COST Used with llGetObjectDetails to get the streaming (download) cost. @@ -185,8 +186,8 @@ VEHICLE_TYPE_NONE Used with llSetVehicleType to turn off vehicle support VEHICLE_TYPE_SLED Used with llSetVehicleType to make a simple vehicle that bumps along the ground, and likes to move along its local x-axis VEHICLE_TYPE_CAR Used with llSetVehicleType to make a vehicle that bounces along the ground but needs the motors to be driven from external controls or timer events VEHICLE_TYPE_BOAT Used with llSetVehicleType to make a vehicle that hovers over water with lots of friction and some angular deflection -VEHICLE_TYPE_AIRPLANE Used with llSetVehicleType to make a vehicle that uses linear deflection for lift, and banking to turn, but doesn't hover -VEHICLE_TYPE_BALLOON Used with llSetVehicleType to make a vehicle that uses hover, and friction, but doesn't use deflection +VEHICLE_TYPE_AIRPLANE Used with llSetVehicleType to make a vehicle that uses linear deflection for lift, and banking to turn, but doesn't hover +VEHICLE_TYPE_BALLOON Used with llSetVehicleType to make a vehicle that uses hover, and friction, but doesn't use deflection VEHICLE_REFERENCE_FRAME Rotation of vehicle axes relative to local frame @@ -289,14 +290,14 @@ ATTACH_LLLEG Passed to llAttachToAvatar to attach task to left lower leg ATTACH_BELLY Passed to llAttachToAvatar to attach task to belly ATTACH_LEFT_PEC Passed to llAttachToAvatar to attach task to left pectoral ATTACH_RIGHT_PEC Passed to llAttachToAvatar to attach task to right pectoral +ATTACH_HUD_BOTTOM Passed to llAttachToAvatar to attach task to bottom hud area +ATTACH_HUD_BOTTOM_LEFT Passed to llAttachToAvatar to attach task to bottom left hud area +ATTACH_HUD_BOTTOM_RIGHT Passed to llAttachToAvatar to attach task to bottom right hud area +ATTACH_HUD_CENTER_1 Passed to llAttachToAvatar to attach task to center 1 hud area ATTACH_HUD_CENTER_2 Passed to llAttachToAvatar to attach task to center 2 hud area -ATTACH_HUD_TOP_RIGHT Passed to llAttachToAvatar to attach task to top right hud area ATTACH_HUD_TOP_CENTER Passed to llAttachToAvatar to attach task to top center hud area ATTACH_HUD_TOP_LEFT Passed to llAttachToAvatar to attach task to top left hud area -ATTACH_HUD_CENTER_1 Passed to llAttachToAvatar to attach task to center 1 hud area -ATTACH_HUD_BOTTOM_LEFT Passed to llAttachToAvatar to attach task to bottom left hud area -ATTACH_HUD_BOTTOM Passed to llAttachToAvatar to attach task to bottom hud area -ATTACH_HUD_BOTTOM_RIGHT Passed to llAttachToAvatar to attach task to bottom right hud area +ATTACH_HUD_TOP_RIGHT Passed to llAttachToAvatar to attach task to top right hud area ##The following attachment points exist only as numbers thus far, but will be ready when the time comes. #ATTACH_NECK Passed to llAttachToAvatar to attach task to neck #ATTACH_ROOT Passed to llAttachToAvatar to attach task to avatar center/root @@ -369,29 +370,28 @@ REMOTE_DATA_REPLY Value of event_type in remote_event if XML-RPC reply is receiv PRIM_NAME For primitive name (from server v1.40 onwards). Followed by a string. PRIM_DESC For primitive description (from server v1.40 onwards). Followed by a string. PRIM_TYPE Followed by PRIM_TYPE_BOX, PRIM_TYPE_CYLINDER, PRIM_TYPE_PRISM, PRIM_TYPE_SPHERE, PRIM_TYPE_TORUS, PRIM_TYPE_TUBE, or PRIM_TYPE_SCULPT and their arguments -PRIM_SLICE Get and set the 'slice' parameter of all shapes. Takes a vector parameter of the form -PRIM_PHYSICS_SHAPE_TYPE For primitive physics shape type. Followed with either PRIM_PHYSICS_SHAPE_PRIM, PRIM_PHYSICS_SHAPE_NONE or PRIM_PHYSICS_SHAPE_CONVEX. PRIM_MATERIAL Followed by PRIM_MATERIAL_STONE, PRIM_MATERIAL_METAL, PRIM_MATERIAL_GLASS, PRIM_MATERIAL_WOOD, PRIM_MATERIAL_FLESH, PRIM_MATERIAL_PLASTIC, or PRIM_MATERIAL_RUBBER PRIM_PHYSICS Sets physics to TRUE or FALSE PRIM_FLEXIBLE Followed by TRUE or FALSE, integer softness, float gravity, float friction, float wind, float tension, and vector force PRIM_POINT_LIGHT Followed by TRUE or FALSE, vector color, float intensity, float radius, float falloff -PRIM_TEMP_ON_REZ Sets temporay on rez to TRUE or FALSE +PRIM_TEMP_ON_REZ Sets temporary on rez to TRUE or FALSE PRIM_PHANTOM Sets phantom to TRUE or FALSE PRIM_CAST_SHADOWS DEPRECATED. Takes 1 parameter, an integer, but has no effect when set and always returns 0 if used in llGetPrimitiveParams PRIM_POSITION Sets primitive position to a vector position -PRIM_POS_LOCAL Sets the prim's local position PRIM_SIZE Sets primitive size to a vector size PRIM_ROTATION Sets primitive rotation -PRIM_ROT_LOCAL Sets the prim's local rotation +PRIM_TEXT Used to get or set the object's floating text. PRIM_TEXTURE Followed by an integer face, key id, vector repeats, vector offsets,:and float rotation in radians -PRIM_TEXT For primitive hovertext. Followed by a string, a vector color and a float alpha PRIM_COLOR Followed by an integer face, vector color, and float alpha PRIM_BUMP_SHINY Followed by an integer face, one of PRIM_SHINY_NONE, PRIM_SHINY_LOW,:PRIM_SHINY_MEDIUM, or PRIM_SHINY_HIGH,:and one of PRIM_BUMP_NONE, PRIM_BUMP_BRIGHT, PRIM_BUMP_DARK, etc PRIM_FULLBRIGHT Followed by an integer face, and TRUE or FALSE PRIM_TEXGEN Followed by an integer face, and one of PRIM_TEXGEN_DEFAULT or PRIM_TEXGEN_PLANAR PRIM_GLOW Followed by an integer face, and a float from 0.0 to 1.0 specifying glow amount -PRIM_OMEGA Makes the object spin at the specified axis and rate +PRIM_POS_LOCAL Sets the prim's local position +PRIM_ROT_LOCAL Sets the prim's local rotation +PRIM_OMEGA Makes the object spin at the specified axis and rate PRIM_LINK_TARGET Used to get or set multiple links with a single PrimParameters call +PRIM_SLICE Get and set the 'slice' parameter of all shapes. Takes a vector parameter of the form PROFILE_NONE Disables profiling PROFILE_SCRIPT_MEMORY Enables memory profiling @@ -454,9 +454,10 @@ PRIM_SCULPT_TYPE_MASK Mask used to determine stitching type PRIM_SCULPT_FLAG_INVERT Flag to specify that the surface normals should be inverted PRIM_SCULPT_FLAG_MIRROR Flag to specify that the prim should be reflected along X axis +PRIM_PHYSICS_SHAPE_TYPE For primitive physics shape type. Followed with either PRIM_PHYSICS_SHAPE_PRIM, PRIM_PHYSICS_SHAPE_NONE or PRIM_PHYSICS_SHAPE_CONVEX. PRIM_PHYSICS_SHAPE_PRIM Use the normal prim shape for physics (this is the default for all non-mesh objects) -PRIM_PHYSICS_SHAPE_CONVEX Ignore this prim in the physics shape. This cannot be applied to the root prim. PRIM_PHYSICS_SHAPE_NONE Use the convex hull of the prim shape for physics (this is the default for mesh objects) +PRIM_PHYSICS_SHAPE_CONVEX Ignore this prim in the physics shape. This cannot be applied to the root prim. MASK_BASE Base permissions MASK_OWNER Owner permissions @@ -526,19 +527,13 @@ REGION_FLAG_BLOCK_FLY Used with llGetRegionFlags to find if a region blocks f REGION_FLAG_ALLOW_DIRECT_TELEPORT Used with llGetRegionFlags to find if a region allows direct teleports REGION_FLAG_RESTRICT_PUSHOBJECT Used with llGetRegionFlags to find if a region restricts llPushObject() calls -ESTATE_ACCESS_ALLOWED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's allowed residents list. -ESTATE_ACCESS_ALLOWED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's allowed residents list. -ESTATE_ACCESS_ALLOWED_GROUP_ADD Used with llManageEstateAccess to add a group to this estate's allowed groups list. -ESTATE_ACCESS_ALLOWED_GROUP_REMOVE Used with llManageEstateAccess to remove a group from this estate's allowed groups list. -ESTATE_ACCESS_BANNED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's banned residents list. -ESTATE_ACCESS_BANNED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's banned residents list. - HTTP_METHOD Used with llHTTPRequest to specify the method, "GET", "POST", "PUT", or "DELETE" HTTP_MIMETYPE Used with llHTTPRequest to specify the MIME type, defaults to "text/plain" HTTP_BODY_MAXLENGTH Used with llHTTPRequest to specify the maximum response body to return HTTP_VERIFY_CERT Used with llHTTPRequest to specify SSL certificate verification HTTP_BODY_TRUNCATED Used with http_response to indicate truncation point in bytes HTTP_VERBOSE_THROTTLE Used with llHTTPRequest to shout error messages to DEBUG_CHANNEL if the outgoing request rate exceeds the server limit. +HTTP_BODY_MAXLENGTH Used with llHTTPRequest to specify the maximum body size for the date returned from the request. Mono scripts can request from 1byte to 16k, non-mono scripts can request from 1byte to 4k. The default is 2k. PARCEL_COUNT_TOTAL Used with llGetParcelPrimCount to get the total number of prims on the parcel PARCEL_COUNT_OWNER Used with llGetParcelPrimCount to get the number of prims on the parcel owned by the owner @@ -613,7 +608,132 @@ STATUS_NOT_SUPPORTED Feature not supported STATUS_INTERNAL_ERROR An internal error occurred STATUS_WHITELIST_FAILED URL failed to pass whitelist -# windlight constants +RC_DATA_FLAGS Option for llCastRay() followed with a bitwise combination of RC_GET_NORMAL, RC_GET_ROOT_KEY and RC_GET_LINK_NUM. +RC_DETECT_PHANTOM Option for llCastRay() followed with TRUE to detect phantom AND volume detect objects, FASLE otherwise. +RC_GET_LINK_NUM Flag used in the RC_DATA_FLAGS mask to get link numbers in llCastRay() results. +RC_GET_NORMAL Flag used in the RC_DATA_FLAGS mask to get hit normals in llCastRay() results. +RC_GET_ROOT_KEY Flag used in the RC_DATA_FLAGS mask to get root keys in llCastRay() results. +RC_MAX_HITS Option for llCastRay() followed with an integer specifying the maximum number of hits to return (must be <= 256). +RC_REJECT_TYPES Option for llCastRay() used to ignore specific types of objects, followed with a bitwise combination of RC_REJECT_AGENTS, RC_REJECT_PHYSICAL, RC_REJECT_NONPHYSICAL and RC_REJECT_LAND. +RC_REJECT_AGENTS Flag used in the RC_REJECT_TYPES mask to reject agents in llCastRay(). +RC_REJECT_PHYSICAL Flag used in the RC_REJECT_TYPES mask to reject physical objects in llCastRay(). +RC_REJECT_NONPHYSICAL Flag used in the RC_REJECT_TYPES mask to reject non-physical objects in llCastRay(). +RC_REJECT_LAND Flag used in the RC_REJECT_TYPES mask to reject land in llCastRay(). + +RCERR_CAST_TIME_EXCEEDED Returned by llCastRay() when the raycast failed because the parcel or agent has exceeded the maximum time allowed for raycasting. +RCERR_SIM_PERF_LOW Returned by llCastRay() when the raycast failed because simulator performance is low. +RCERR_UNKNOWN Returned by llCastRay() when the raycast failed for an unspecified reason. + +ESTATE_ACCESS_ALLOWED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's allowed residents list. +ESTATE_ACCESS_ALLOWED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's allowed residents list. +ESTATE_ACCESS_ALLOWED_GROUP_ADD Used with llManageEstateAccess to add a group to this estate's allowed groups list. +ESTATE_ACCESS_ALLOWED_GROUP_REMOVE Used with llManageEstateAccess to remove a group from this estate's allowed groups list. +ESTATE_ACCESS_BANNED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's banned residents list. +ESTATE_ACCESS_BANNED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's banned residents list. + +DENSITY For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the density. +FRICTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the friction. +RESTITUTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the restitution. +GRAVITY_MULTIPLIER For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the gravity multiplier. + +KFM_COMMAND Option for llSetKeyframedMotion(), followed by one of KFM_CMD_STOP, KFM_CMD_PLAY, KFM_CMD_PAUSE. Note that KFM_COMMAND must be the only option in the list, and cannot be specified in the same function call that sets the keyframes list. +KFM_CMD_PLAY Option for llSetKeyframedMotion(), used after KFM_COMMAND to play the motion. +KFM_CMD_STOP Option for llSetKeyframedMotion(), used after KFM_COMMAND to stop the motion. +KFM_CMD_PAUSE Option for llSetKeyframedMotion(), used after KFM_COMMAND to pause the motion. +KFM_CMD_SET_MODE TODO: add documentation +KFM_MODE Option for llSetKeyframedMotion(), used to specify the playback mode, followed by one of KFM_FORWARD, KFM_LOOP, KFM_PING_PONG or KFM_REVERSE. +KFM_FORWARD Option for llSetKeyframedMotion(), used after KFM_MODE to specify the forward playback mode. +KFM_LOOP Option for llSetKeyframedMotion(), used after KFM_MODE to specify the loop playback mode. +KFM_PING_PONG Option for llSetKeyframedMotion(), used after KFM_MODE to specify the ping pong playback mode. +KFM_REVERSE Option for llSetKeyframedMotion(), used after KFM_MODE to specify the reverse playback mode. +KFM_DATA Option for llSetKeyframedMotion(), followed by a bitwise combination of KFM_TRANSLATION and KFM_ROTATION. If you specify one or the other, you should only include translations or rotations in your keyframe list. +KFM_ROTATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_TRANSLATION. +KFM_TRANSLATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_ROTATION. + +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 +CHARACTER_DESIRED_TURN_SPEED TODO: add documentation +CHARACTER_MAX_TURN_RADIUS TODO: add documentation +# --- OpenSim and Aurora-Sim constants Below --- +# OpenSim Constants (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\LSL_Constants.cs) +# Constants for cmWindlight (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\CM_Constants.cs) +CHANGED_ANIMATION OpenSim change event animation change detection. +# osGetRegionStats +STATS_TIME_DILATION returned value from osGetRegionStats(), 1st of 21 items in returned list. +STATS_SIM_FPS returned value from osGetRegionStats(), 2nd of 21 items in returned list. +STATS_PHYSICS_FPS returned value from osGetRegionStats(), 3rd of 21 items in returned list. +STATS_AGENT_UPDATES returned value from osGetRegionStats(), 4th of 21 items in returned list. +STATS_ROOT_AGENTS returned value from osGetRegionStats(), 5th of 21 items in returned list. +STATS_CHILD_AGENTS returned value from osGetRegionStats(), 6th of 21 items in returned list. +STATS_TOTAL_PRIMS returned value from osGetRegionStats(), 7th of 21 items in returned list. +STATS_ACTIVE_PRIMS returned value from osGetRegionStats(), 8th of 21 items in returned list. +STATS_FRAME_MS returned value from osGetRegionStats(), 9th of 21 items in returned list. +STATS_NET_MS returned value from osGetRegionStats(), 10th of 21 items in returned list. +STATS_PHYSICS_MS returned value from osGetRegionStats(), 11th of 21 items in returned list. +STATS_IMAGE_MS returned value from osGetRegionStats(), 12th of 21 items in returned list. +STATS_OTHER_MS returned value from osGetRegionStats(), 13th of 21 items in returned list. +STATS_IN_PACKETS_PER_SECOND returned value from osGetRegionStats(), 14th of 21 items in returned list. +STATS_OUT_PACKETS_PER_SECOND returned value from osGetRegionStats(), 15th of 21 items in returned list. +STATS_UNACKED_BYTES returned value from osGetRegionStats(), 16th of 21 items in returned list. +STATS_AGENT_MS returned value from osGetRegionStats(), 17th of 21 items in returned list. +STATS_PENDING_DOWNLOADS returned value from osGetRegionStats(), 18th of 21 items in returned list. +STATS_PENDING_UPLOADS returned value from osGetRegionStats(), 19th of 21 items in returned list. +STATS_ACTIVE_SCRIPTS returned value from osGetRegionStats(), 20th of 21 items in returned list. +STATS_SCRIPT_LPS returned value from osGetRegionStats(), 21st of 21 items in returned list. +# OpenSim NPC +OS_NPC_FLY used by osNPC. +OS_NPC_NO_FLY used by osNPC. +OS_NPC_LAND_AT_TARGET used by osNPC. +OS_NPC_SIT_NOW used by osNPC. +OS_NPC_CREATOR_OWNED used by osNPC. +OS_NPC_NOT_OWNED used by osNPC. +OS_NPC_SENSE_AS_AGENT used by osNPC. +OS_NPC_RUNNING used by osNPC. +# Windlight/Lightshare WL_WATER_COLOR Windlight Water Colour WL_WATER_FOG_DENSITY_EXPONENT Windlight Water Fog Density Exponent WL_UNDERWATER_FOG_MODIFIER Windlight Underwater Fog Modifier @@ -651,112 +771,28 @@ WL_CLOUD_SCROLL_Y Windlight Cloud Scroll Y WL_CLOUD_SCROLL_Y_LOCK Windlight Cloud Scroll Y Lock WL_CLOUD_SCROLL_X_LOCK Windlight Cloud Scroll X Lock WL_DRAW_CLASSIC_CLOUDS Windlight Draw Classic Clouds - -# keyframe constants -KFM_COMMAND Option for llSetKeyframedMotion(), followed by one of KFM_CMD_STOP, KFM_CMD_PLAY, KFM_CMD_PAUSE. Note that KFM_COMMAND must be the only option in the list, and cannot be specified in the same function call that sets the keyframes list. -KFM_MODE Option for llSetKeyframedMotion(), used to specify the playback mode, followed by one of KFM_FORWARD, KFM_LOOP, KFM_PING_PONG or KFM_REVERSE. -KFM_DATA Option for llSetKeyframedMotion(), followed by a bitwise combination of KFM_TRANSLATION and KFM_ROTATION. If you specify one or the other, you should only include translations or rotations in your keyframe list. -KFM_FORWARD Option for llSetKeyframedMotion(), used after KFM_MODE to specify the forward playback mode. -KFM_LOOP Option for llSetKeyframedMotion(), used after KFM_MODE to specify the loop playback mode. -KFM_PING_PONG Option for llSetKeyframedMotion(), used after KFM_MODE to specify the ping pong playback mode. -KFM_REVERSE Option for llSetKeyframedMotion(), used after KFM_MODE to specify the reverse playback mode. -KFM_ROTATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_TRANSLATION. -KFM_TRANSLATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_ROTATION. -KFM_CMD_PLAY Option for llSetKeyframedMotion(), used after KFM_COMMAND to play the motion. -KFM_CMD_STOP Option for llSetKeyframedMotion(), used after KFM_COMMAND to stop the motion. -KFM_CMD_PAUSE Option for llSetKeyframedMotion(), used after KFM_COMMAND to pause the motion. - -# OSSL constants -STATS_TIME_DILATION -STATS_SIM_FPS -STATS_PHYSICS_FPS -STATS_AGENT_UPDATES -STATS_ROOT_AGENTS -STATS_CHILD_AGENTS -STATS_TOTAL_PRIMS -STATS_ACTIVE_PRIMS -STATS_FRAME_MS -STATS_NET_MS -STATS_PHYSICS_MS -STATS_IMAGE_MS -STATS_OTHER_MS -STATS_IN_PACKETS_PER_SECOND -STATS_OUT_PACKETS_PER_SECOND -STATS_UNACKED_BYTES -STATS_AGENT_MS -STATS_PENDING_DOWNLOADS -STATS_PENDING_UPLOADS -STATS_ACTIVE_SCRIPTS -STATS_SCRIPT_LPS - -## Constants for osNpc* functions -NPC -OS_NPC_CREATOR_OWNED -OS_NPC_NOT_OWNED -OS_NPC_SENSE_AS_AGENT -OS_NPC_FLY -OS_NPC_NO_FLY -OS_NPC_LAND_AT_TARGET -OS_NPC_SIT_NOW - -## Missing LSL constants (from http://wiki.secondlife.com/wiki/Category:LSL_Constants) - -# physics constants -DENSITY For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the density. -FRICTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the friction. -RESTITUTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the restitution. -GRAVITY_MULTIPLIER For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the gravity multiplier. - -##Even more missing constants, thanks to Justin Clark Casey for pointing me into the right direction -##Liru: Were these supposed to be LSL? They're undocumented, commenting out for now. -#CAMERA_FOCUS_OFFSET_X -#CAMERA_FOCUS_OFFSET_Y -#CAMERA_FOCUS_OFFSET_Z -#CAMERA_FOCUS_X -#CAMERA_FOCUS_Y -#CAMERA_FOCUS_Z -#CAMERA_POSITION_X -#CAMERA_POSITION_Y -#CAMERA_POSITION_Z -#CHANGED_ANIMATION -#CHANGED_REGION_RESTART -#DATA_SIM_RELEASE -#LIST_STAT_HARMONIC_MEAN -#PARCEL_DETAILS_CLAIMDATE -#VEHICLE_FLAG_LOCK_HOVER_HEIGHT -#VEHICLE_FLAG_LOCK_ROTATION -#VEHICLE_FLAG_NO_X -#VEHICLE_FLAG_NO_Y -#VEHICLE_FLAG_NO_Z -#VEHICLE_RANGE_BLOCK -#VEHICLE_ROLL_FRAME -#LSL_STATUS_BOUNDS_ERROR -#LSL_STATUS_INTERNAL_ERROR -#LSL_STATUS_MALFORMED_PARAMS -#LSL_STATUS_NOT_FOUND -#LSL_STATUS_NOT_SUPPORTED -#LSL_STATUS_OK -#LSL_STATUS_TYPE_MISMATCH -#LSL_STATUS_WHITELIST_FAILED - -# castray constants -RCERR_UNKNOWN Returned by llCastRay() when the raycast failed for an unspecified reason. -RCERR_SIM_PERF_LOW Returned by llCastRay() when the raycast failed because simulator performance is low. -RCERR_CAST_TIME_EXCEEDED Returned by llCastRay() when the raycast failed because the parcel or agent has exceeded the maximum time allowed for raycasting. - -RC_REJECT_TYPES Option for llCastRay() used to ignore specific types of objects, followed with a bitwise combination of RC_REJECT_AGENTS, RC_REJECT_PHYSICAL, RC_REJECT_NONPHYSICAL and RC_REJECT_LAND. -RC_DETECT_PHANTOM Option for llCastRay() followed with TRUE to detect phantom AND volume detect objects, FASLE otherwise. -RC_DATA_FLAGS Option for llCastRay() followed with a bitwise combination of RC_GET_NORMAL, RC_GET_ROOT_KEY and RC_GET_LINK_NUM. -RC_MAX_HITS Option for llCastRay() followed with an integer specifying the maximum number of hits to return (must be <= 256). - -RC_REJECT_AGENTS Flag used in the RC_REJECT_TYPES mask to reject agents in llCastRay(). -RC_REJECT_PHYSICAL Flag used in the RC_REJECT_TYPES mask to reject physical objects in llCastRay(). -RC_REJECT_NONPHYSICAL Flag used in the RC_REJECT_TYPES mask to reject non-physical objects in llCastRay(). -RC_REJECT_LAND Flag used in the RC_REJECT_TYPES mask to reject land in llCastRay(). - -RC_GET_NORMAL Flag used in the RC_DATA_FLAGS mask to get hit normals in llCastRay() results. -RC_GET_ROOT_KEY Flag used in the RC_DATA_FLAGS mask to get root keys in llCastRay() results. -RC_GET_LINK_NUM Flag used in the RC_DATA_FLAGS mask to get link numbers in llCastRay() results. +# Aurora-Sim Constants (\Aurora\AuroraDotNetEngine\APIs\AA_Constants.cs) --> +ENABLE_GRAVITY enable_gravity. +GRAVITY_FORCE_X gravity_force_x. +GRAVITY_FORCE_Y gravity_force_y. +GRAVITY_FORCE_Z gravity_force_z. +ADD_GRAVITY_POINT add_gravity_point. +ADD_GRAVITY_FORCE add_gravity_force. +START_TIME_REVERSAL_SAVING start_time_reversal_saving. +STOP_TIME_REVERSAL_SAVING stop_time_reversal_saving. +START_TIME_REVERSAL start_time_reversal. +STOP_TIME_REVERSAL stop_time_reversal. +# Aurora botFunctions +BOT_FOLLOW_FLAG_NONE value 0. +BOT_FOLLOW_FLAG_INDEFINITELY value 1. +BOT_TAG_FIND_ALL value AllBots. +BOT_FOLLOW_WALK value 0. +BOT_FOLLOW_RUN value 1. +BOT_FOLLOW_FLY value 2. +BOT_FOLLOW_TELEPORT value 3. +BOT_FOLLOW_WAIT value 4. +BOT_FOLLOW_TRIGGER_HERE_EVENT value 1. +BOT_FOLLOW_FLAG_FORCEDIRECTPATH value 4. # string constants [word .1, .3, .5] diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f43dad8a0..20a643877 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8,7 +8,6 @@ settings_sh.xml settings_rlv.xml - SianaRenderDeferredInvisiprim Comment @@ -895,6 +894,171 @@ Value 1 + AntiSpamAlerts + + Comment + When true, dialogs from alerts will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamFriendshipOffers + + Comment + When true, dialogs from friendship requests will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamGroupInvites + + Comment + When true, dialogs from group invites will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamGroupNotices + + Comment + When true, dialogs from group notices will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamItemOffers + + Comment + When true, dialogs from inventory item offers will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamNotify + + Comment + When true, notifications will appear any time a spamtype is blocked. + Persist + 1 + Type + Boolean + Value + 1 + + AntiSpamScripts + + Comment + When true, dialogs from scripts, including script-driven teleports and questions, and other interactive script stuff, will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamTeleports + + Comment + When true, dialogs from teleport requests from other residents will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + _NACL_Antispam + + Comment + When true, all dialogs will be blocked, resets on restart. + Persist + 0 + Type + Boolean + Value + 0 + + _NACL_AntiSpamGlobalQueue + + Comment + Collect spamtypes together, instead of individually counting them + Persist + 1 + Type + Boolean + Value + 0 + + _NACL_AntiSpamTime + + Comment + Time in seconds for spamtype to accumulate the _NACL_AntiSpamAmount and be blocked + Persist + 1 + Type + U32 + Value + 1 + + _NACL_AntiSpamAmount + + Comment + Amount of spamtype to be reached before the blocking will occur. + Persist + 1 + Type + U32 + Value + 30 + + _NACL_AntiSpamSoundMulti + + Comment + + Persist + 1 + Type + U32 + Value + 20 + + _NACL_AntiSpamNewlines + + Comment + How many newlines a message can have before it's considered spam. + Persist + 1 + Type + U32 + Value + 20 + + _NACL_AntiSpamSoundPreloadMulti + + Comment + + Persist + 1 + Type + U32 + Value + 20 + AgentChatColor @@ -1725,6 +1889,17 @@ Value 1.0 + AudioLevelUnderwaterRolloff + + Comment + Controls the distance-based dropoff of audio volume when camera is submerged (fraction or multiple of default audio rolloff) + Persist + 1 + Type + F32 + Value + 4.0 + AudioLevelSFX Comment @@ -1796,7 +1971,7 @@ Comment Enable texture auditting. Persist - 1 + 0 Type Boolean Value @@ -7056,6 +7231,17 @@ Value help/index.html + WebProfileURL + + Comment + URL for Web Profiles + Persist + 0 + Type + String + Value + https://my.secondlife.com/[AGENT_NAME] + HighResSnapshot Comment @@ -13212,7 +13398,7 @@ Type S32 Value - 10 + 5 SystemLanguage @@ -15086,3 +15272,4 @@ + diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index ba157bd6a..b422fae32 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -461,7 +461,7 @@ Type Boolean Value - 0 + 1 LogChatIM @@ -472,7 +472,7 @@ Type Boolean Value - 0 + 1 LogChatTimestamp @@ -483,7 +483,7 @@ Type Boolean Value - 0 + 1 LogInstantMessages diff --git a/indra/newview/app_settings/settings_sh.xml b/indra/newview/app_settings/settings_sh.xml index feae4cb77..81659467c 100644 --- a/indra/newview/app_settings/settings_sh.xml +++ b/indra/newview/app_settings/settings_sh.xml @@ -141,94 +141,6 @@ 1.0 - SGBlockGeneralSpam - - Comment - Enable automatic general spam blocking - Persist - 1 - Type - Boolean - Value - 0 - - SGBlockCardSpam - - Comment - Enable automatic calling card spam blocking - Persist - 1 - Type - Boolean - Value - 1 - - SGBlockChatSpam - - Comment - Enable automatic chat spam blocking - Persist - 1 - Type - Boolean - Value - 0 - - SGBlockDialogSpam - - Comment - Enable automatic dialog spam blocking - Persist - 1 - Type - Boolean - Value - 1 - - SGSpamTime - - Comment - Time of Evalulating spam. (Default: 1.000) - Persist - 1 - Type - F32 - Value - 1.0 - - SGSpamCount - - Comment - Number of items spammed per time period in SGSpamTime. (Default: 4) - Persist - 1 - Type - U32 - Value - 4 - - SGChatSpamTime - - Comment - Time of Evalulating spam. (Default: 1.000) - Persist - 1 - Type - F32 - Value - 1.0 - - SGChatSpamCount - - Comment - Number of items spammed per time set in SGSpamTime. (Default: 10) - Persist - 1 - Type - U32 - Value - 10.0 - ShyotlUseLegacyTextureBatching Comment diff --git a/indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl b/indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl new file mode 100644 index 000000000..1da0cdbad --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl @@ -0,0 +1,23 @@ +/** + * @file colorFilterF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#extension GL_ARB_texture_rectangle : enable + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 gl_FragColor; +#endif + +uniform sampler2DRect tex0; +uniform int layerCount; + +VARYING vec2 vary_texcoord0; + +void main(void) +{ + vec3 color = pow(floor(pow(vec3(texture2D(tex0, vary_texcoord0.st)),vec3(.6)) * layerCount)/layerCount,vec3(1.66666)); + gl_FragColor = vec4(color, 1.0); +} diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl index 7c0699d72..ca29bf314 100644 --- a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl @@ -23,9 +23,9 @@ * $/LicenseInfo$ */ -ATTRIBUTE ivec4 texture_index; +ATTRIBUTE int texture_index; -VARYING_FLAT ivec4 vary_texture_index; +VARYING_FLAT int vary_texture_index; void passTextureIndex() { diff --git a/indra/newview/app_settings/windlight/postprocesseffects.xml b/indra/newview/app_settings/windlight/postprocesseffects.xml index 9261f3287..0914b275a 100644 --- a/indra/newview/app_settings/windlight/postprocesseffects.xml +++ b/indra/newview/app_settings/windlight/postprocesseffects.xml @@ -174,6 +174,8 @@ 0 enable_gauss_blur 0 + enable_posterize + 0 gauss_blur_passes 2 extract_high @@ -186,6 +188,8 @@ 0.40000000000000002 saturation 1 - + posterize_layers + 10 + \ No newline at end of file diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index 0410ce2aa..5960024bd 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -40,7 +40,9 @@ #include "llradiogroup.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" +#include "NACLantispam.h" #include "lgghunspell_wrapper.h" +#include "lltrans.h" #include "llstartup.h" @@ -78,19 +80,24 @@ LLPrefsAscentChat::LLPrefsAscentChat() addChild(mObjectDropTarget); } - if (LLStartUp::getStartupState() == STATE_STARTED) + bool started = LLStartUp::getStartupState() == STATE_STARTED; + if (started) { LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("AscentInstantMessageResponseItemData"); LLViewerInventoryItem* item = gInventory.getItem(itemid); - if (item) childSetValue("im_give_disp_rect_txt","Currently set to: "+item->getName()); - else if (itemid.isNull()) childSetValue("im_give_disp_rect_txt","Currently not set"); - else childSetValue("im_give_disp_rect_txt","Currently set to an item not on this account"); + if (item) childSetValue("im_give_disp_rect_txt", LLTrans::getString("CurrentlySetTo") + LLTrans::getString(":") + " " +item->getName()); + else if (itemid.isNull()) childSetValue("im_give_disp_rect_txt", LLTrans::getString("CurrentlyNotSet")); + else childSetValue("im_give_disp_rect_txt", LLTrans::getString("CurrentlySetTo") + " " + LLTrans::getString("AnItemNotOnThisAccount")); } - else childSetValue("im_give_disp_rect_txt","Not logged in"); + else childSetValue("im_give_disp_rect_txt", LLTrans::getString("NotLoggedIn")); childSetCommitCallback("im_response", onCommitAutoResponse, this); + childSetEnabled("reset_antispam", started); + childSetCommitCallback("reset_antispam", onCommitResetAS, this); + childSetCommitCallback("antispam_checkbox", onCommitDialogBlock, this); + childSetCommitCallback("KeywordsOn", onCommitKeywords, this); childSetCommitCallback("KeywordsList", onCommitKeywords, this); childSetCommitCallback("KeywordsSound", onCommitKeywords, this); @@ -218,7 +225,7 @@ void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl, void* userdata) //static void LLPrefsAscentChat::onCommitAutoResponse(LLUICtrl* ctrl, void* user_data) { - LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data; + LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data; gSavedPerAccountSettings.setBOOL("AscentInstantMessageResponseAnyone", self->childGetValue("AscentInstantMessageResponseAnyone")); gSavedPerAccountSettings.setBOOL("AscentInstantMessageResponseFriends", self->childGetValue("AscentInstantMessageResponseFriends")); @@ -234,7 +241,28 @@ void LLPrefsAscentChat::onCommitAutoResponse(LLUICtrl* ctrl, void* user_data) void LLPrefsAscentChat::SinguIMResponseItemDrop(LLViewerInventoryItem* item) { gSavedPerAccountSettings.setString("AscentInstantMessageResponseItemData", item->getUUID().asString()); - sInst->childSetValue("im_give_disp_rect_txt","Currently set to: "+item->getName()); + sInst->childSetValue("im_give_disp_rect_txt", LLTrans::getString("CurrentlySetTo") + LLTrans::getString(":") + " " +item->getName()); +} + +//static +void LLPrefsAscentChat::onCommitResetAS(LLUICtrl*, void*) +{ + NACLAntiSpamRegistry::purgeAllQueues(); +} + +//static +void LLPrefsAscentChat::onCommitDialogBlock(LLUICtrl* ctrl, void* user_data) +{ + LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data; + bool enabled = ctrl->getValue().asBoolean(); + self->childSetEnabled("Block All Dialogs From", !enabled); + self->childSetEnabled("Alerts", !enabled); + self->childSetEnabled("Friendship Offers", !enabled); + self->childSetEnabled("Group Invites", !enabled); + self->childSetEnabled("Group Notices", !enabled); + self->childSetEnabled("Item Offers", !enabled); + self->childSetEnabled("Scripts", !enabled); + self->childSetEnabled("Teleport Offers", !enabled); } //static @@ -316,13 +344,21 @@ void LLPrefsAscentChat::refreshValues() mIMResponseText = gSavedPerAccountSettings.getString("AscentInstantMessageResponse"); //Spam -------------------------------------------------------------------------------- - mBlockChatSpam = gSavedSettings.getBOOL("SGBlockChatSpam"); - mChatSpamCount = gSavedSettings.getU32("SGChatSpamCount"); - mChatSpamTime = gSavedSettings.getF32("SGChatSpamTime"); - mBlockDialogSpam = gSavedSettings.getBOOL("SGBlockDialogSpam"); - mBlockCardSpam = gSavedSettings.getBOOL("SGBlockCardSpam"); - mSpamCount = gSavedSettings.getU32("SGSpamCount"); - mSpamTime = gSavedSettings.getF32("SGSpamTime"); + mGlobalQueue = gSavedSettings.getBOOL("_NACL_AntiSpamGlobalQueue"); + mChatSpamCount = gSavedSettings.getU32("_NACL_AntiSpamAmount"); + mChatSpamTime = gSavedSettings.getU32("_NACL_AntiSpamTime"); + mBlockDialogSpam = gSavedSettings.getBOOL("_NACL_Antispam"); + mBlockAlertSpam = gSavedSettings.getBOOL("AntiSpamAlerts"); + mBlockFriendSpam = gSavedSettings.getBOOL("AntiSpamFriendshipOffers"); + mBlockGroupInviteSpam = gSavedSettings.getBOOL("AntiSpamGroupInvites"); + mBlockGroupNoticeSpam = gSavedSettings.getBOOL("AntiSpamGroupNotices"); + mBlockItemOfferSpam = gSavedSettings.getBOOL("AntiSpamItemOffers"); + mBlockScriptSpam = gSavedSettings.getBOOL("AntiSpamScripts"); + mBlockTeleportSpam = gSavedSettings.getBOOL("AntiSpamTeleports"); + mNotifyOnSpam = gSavedSettings.getBOOL("AntiSpamNotify"); + mSoundMulti = gSavedSettings.getU32("_NACL_AntiSpamSoundMulti"); + mNewLines = gSavedSettings.getU32("_NACL_AntiSpamNewlines"); + mPreloadMulti = gSavedSettings.getU32("_NACL_AntiSpamSoundPreloadMulti"); //Text Options ------------------------------------------------------------------------ mSpellDisplay = gSavedSettings.getBOOL("SpellDisplay"); @@ -367,6 +403,16 @@ void LLPrefsAscentChat::refresh() LLWStringUtil::replaceChar(auto_response, '%', ' '); childSetText("im_response", wstring_to_utf8str(auto_response)); + //Antispam ------------------------------------------------------------------------ + childSetEnabled("Block All Dialogs From", !mBlockDialogSpam); + childSetEnabled("Alerts", !mBlockDialogSpam); + childSetEnabled("Friendship Offers", !mBlockDialogSpam); + childSetEnabled("Group Invites", !mBlockDialogSpam); + childSetEnabled("Group Notices", !mBlockDialogSpam); + childSetEnabled("Item Offers", !mBlockDialogSpam); + childSetEnabled("Scripts", !mBlockDialogSpam); + childSetEnabled("Teleport Offers", !mBlockDialogSpam); + //Text Options ------------------------------------------------------------------------ combo = getChild("SpellBase"); @@ -503,13 +549,21 @@ void LLPrefsAscentChat::cancel() gSavedPerAccountSettings.setString("AscentInstantMessageResponse", mIMResponseText); //Spam -------------------------------------------------------------------------------- - gSavedSettings.setBOOL("SGBlockChatSpam", mBlockChatSpam); - gSavedSettings.setU32("SGChatSpamCount", mChatSpamCount); - gSavedSettings.setF32("SGChatSpamTime", mChatSpamTime); - gSavedSettings.setBOOL("SGBlockDialogSpam", mBlockDialogSpam); - gSavedSettings.setBOOL("SGBlockCardSpam", mBlockCardSpam); - gSavedSettings.setU32("SGSpamCount", mSpamCount); - gSavedSettings.setF32("SGSpamTime", mSpamTime); + gSavedSettings.setBOOL("_NACL_AntiSpamGlobalQueue", mGlobalQueue); + gSavedSettings.setU32("_NACL_AntiSpamAmount", mChatSpamCount); + gSavedSettings.setU32("_NACL_AntiSpamTime", mChatSpamTime); + gSavedSettings.setBOOL("_NACL_Antispam", mBlockDialogSpam); + gSavedSettings.setBOOL("AntiSpamAlerts", mBlockAlertSpam); + gSavedSettings.setBOOL("AntiSpamFriendshipOffers", mBlockFriendSpam); + gSavedSettings.setBOOL("AntiSpamGroupNotices", mBlockGroupNoticeSpam); + gSavedSettings.setBOOL("AntiSpamGroupInvites", mBlockGroupInviteSpam); + gSavedSettings.setBOOL("AntiSpamItemOffers", mBlockItemOfferSpam); + gSavedSettings.setBOOL("AntiSpamScripts", mBlockScriptSpam); + gSavedSettings.setBOOL("AntiSpamTeleports", mBlockTeleportSpam); + gSavedSettings.setBOOL("AntiSpamNotify", mNotifyOnSpam); + gSavedSettings.setU32("_NACL_AntiSpamSoundMulti", mSoundMulti); + gSavedSettings.setU32("_NACL_AntiSpamNewlines", mNewLines); + gSavedSettings.setU32("_NACL_AntiSpamSoundPreloadMulti", mPreloadMulti); //Text Options ------------------------------------------------------------------------ gSavedSettings.setBOOL("SpellDisplay", mSpellDisplay); diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index 15c7a44be..936646164 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -56,6 +56,8 @@ protected: static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata); static void onCommitTimeDate(LLUICtrl* ctrl, void *userdata); static void onCommitAutoResponse(LLUICtrl* ctrl, void* user_data); + static void onCommitResetAS(LLUICtrl*,void*); + static void onCommitDialogBlock(LLUICtrl*, void*); static void onCommitKeywords(LLUICtrl* ctrl, void* user_data); //Chat/IM ----------------------------------------------------------------------------- @@ -84,13 +86,21 @@ protected: std::string mIMResponseText; //Spam -------------------------------------------------------------------------------- - BOOL mBlockChatSpam; + BOOL mGlobalQueue; U32 mChatSpamCount; - F32 mChatSpamTime; + U32 mChatSpamTime; BOOL mBlockDialogSpam; - BOOL mBlockCardSpam; - U32 mSpamCount; - F32 mSpamTime; + BOOL mBlockAlertSpam; + BOOL mBlockFriendSpam; + BOOL mBlockGroupNoticeSpam; + BOOL mBlockGroupInviteSpam; + BOOL mBlockItemOfferSpam; + BOOL mBlockScriptSpam; + BOOL mBlockTeleportSpam; + BOOL mNotifyOnSpam; + BOOL mSoundMulti; + U32 mNewLines; + U32 mPreloadMulti; //Text Options ------------------------------------------------------------------------ BOOL mSpellDisplay; diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index c9f883c05..684a2fb0a 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -45,6 +45,7 @@ #include "lluictrlfactory.h" #include "llviewercontrol.h" #include "llstartup.h" +#include "lltrans.h" LLDropTarget* mBuildDropTarget; LLPrefsAscentSys* LLPrefsAscentSys::sInst; @@ -102,11 +103,11 @@ LLPrefsAscentSys::LLPrefsAscentSys() LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("EmeraldBuildPrefs_Item"); LLViewerInventoryItem* item = gInventory.getItem(itemid); - if (item) childSetValue("build_item_add_disp_rect_txt", "Currently set to:\n"+item->getName()); - else if (itemid.isNull()) childSetValue("build_item_add_disp_rect_txt", "Currently\nnot set"); - else childSetValue("build_item_add_disp_rect_txt", "Currently set to\nan item not on this account"); + if (item) childSetValue("build_item_add_disp_rect_txt", LLTrans::getString("CurrentlySetTo") + LLTrans::getString(":") + "\n" +item->getName()); + else if (itemid.isNull()) childSetValue("build_item_add_disp_rect_txt", LLTrans::getString("CurrentlyNotSet")); + else childSetValue("build_item_add_disp_rect_txt", LLTrans::getString("CurrentlySetTo") + "\n" + LLTrans::getString("AnItemNotOnThisAccount")); } - else childSetValue("build_item_add_disp_rect_txt", "You are\nnot logged in"); + else childSetValue("build_item_add_disp_rect_txt", LLTrans::getString("NotLoggedIn")); refreshValues(); refresh(); @@ -165,7 +166,7 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, void* user_data) gAudiop->triggerSound(LLUUID("58a38e89-44c6-c52b-deb8-9f1ddc527319"), gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); LLChat chat; chat.mSourceType = CHAT_SOURCE_SYSTEM; - chat.mText = llformat("You are bestowed with powers beyond mortal comprehension.\nUse your newfound abilities wisely.\nUnlocked:\n- Animation Priority up to 7 - Meant for animations that should override anything and everything at all times. DO NOT USE THIS FOR GENERAL ANIMATIONS.\n- Right click > Destroy objects - Permanently deletes an object immediately, when you don't feel like waiting for the server to respond.\n- Right Click > Explode objects - Turns an object physical, temporary, and delinks it."); + chat.mText = LLTrans::getString("PowerUser1") + "\n" + LLTrans::getString("PowerUser2") + "\n" + LLTrans::getString("Unlocked:") + "\n" + LLTrans::getString("PowerUser3") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser4") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser5"); LLFloaterChat::addChat(chat); } } @@ -247,7 +248,7 @@ void LLPrefsAscentSys::onCommitTexturePicker(LLUICtrl* ctrl, void* userdata) void LLPrefsAscentSys::SinguBuildItemDrop(LLViewerInventoryItem* item) { gSavedPerAccountSettings.setString("EmeraldBuildPrefs_Item", item->getUUID().asString()); - sInst->childSetValue("build_item_add_disp_rect_txt","Currently set to:\n"+item->getName()); + sInst->childSetValue("build_item_add_disp_rect_txt", LLTrans::getString("CurrentlySetTo") + LLTrans::getString(":") + "\n" + item->getName()); } void LLPrefsAscentSys::refreshValues() diff --git a/indra/newview/dhparam.cpp b/indra/newview/dhparam.cpp deleted file mode 100644 index 917eb714d..000000000 --- a/indra/newview/dhparam.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* Generated using openssl */ -#include "llviewerprecompiledheaders.h" -#include - -DH *get_dh2048() - { - static unsigned char dh2048_p[]={ - 0xAC,0x31,0xAA,0xFD,0x76,0x1B,0x47,0x24,0x99,0x6D,0xF8,0xD5, - 0x5B,0x4B,0xD1,0x7E,0xF9,0x1A,0x41,0xF6,0x29,0xCC,0xA9,0x02, - 0x6B,0xED,0xFD,0xC9,0x37,0xCE,0xF6,0x11,0x78,0x6F,0x37,0x38, - 0x7D,0x49,0x3F,0x78,0x36,0x83,0x0A,0x6F,0xBA,0x6F,0x74,0xD9, - 0xB1,0xC1,0xC4,0x5A,0x7D,0x84,0x26,0x56,0x8B,0x53,0xF4,0xFE, - 0xD1,0x34,0xF1,0xE0,0x08,0x65,0xA6,0xFD,0xDB,0x5D,0xAC,0x14, - 0xCD,0xC9,0x7E,0x79,0xE9,0x3B,0xAF,0x92,0xC7,0x4D,0x91,0x15, - 0x0B,0x1E,0x2F,0x0A,0x56,0x4E,0x0D,0x3A,0x4D,0x9E,0xB0,0xB5, - 0xFC,0x0D,0xB1,0x55,0x40,0xC6,0x30,0x99,0xCD,0xE8,0x7E,0x72, - 0x08,0x93,0x9C,0x7F,0x55,0x23,0x27,0x09,0xF4,0x50,0xF2,0x96, - 0xB5,0x30,0x35,0x6A,0x99,0x4C,0xD6,0x85,0x72,0x8D,0x9C,0x19, - 0x70,0x9A,0x77,0x52,0xE8,0x33,0x03,0x7A,0x00,0xDA,0xFE,0xD7, - 0x98,0xD0,0x7B,0x26,0xBA,0xD7,0xFF,0xD1,0x49,0x61,0x27,0x3E, - 0xFC,0x12,0x81,0xC9,0xB0,0xAF,0x34,0x14,0x97,0x66,0xFB,0xEF, - 0xD3,0xFE,0xC9,0x01,0x25,0xEC,0xF4,0xE8,0xA8,0xD8,0x21,0x45, - 0x20,0x6F,0xFC,0xA8,0xB3,0xCE,0xCF,0x0D,0xA1,0x14,0xCC,0x38, - 0x81,0x74,0x6A,0x5E,0x36,0x09,0x1D,0xBE,0x4C,0x08,0x52,0x5E, - 0xC2,0x5F,0xA4,0x48,0x3A,0x71,0x85,0xF2,0x97,0x32,0xEC,0x3B, - 0xFB,0x1B,0x9A,0x8A,0x4B,0x20,0x32,0xFE,0x6A,0x94,0x4C,0x02, - 0xB2,0xD7,0xC3,0x1B,0xF8,0x90,0x54,0x76,0x70,0x49,0x81,0x86, - 0x30,0x12,0xD2,0x91,0xF0,0xFD,0x1B,0x53,0x2E,0x60,0x13,0x78, - 0x8B,0x3F,0x1B,0x13, - }; - static unsigned char dh2048_g[]={ - 0x05, - }; - DH *dh; - - if ((dh=DH_new()) == NULL) return(NULL); - dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL); - dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL); - if ((dh->p == NULL) || (dh->g == NULL)) - { DH_free(dh); return(NULL); } - return(dh); - } diff --git a/indra/newview/dofloaterhex.cpp b/indra/newview/dofloaterhex.cpp deleted file mode 100644 index ed700be4c..000000000 --- a/indra/newview/dofloaterhex.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/** - * @file dofloaterhex.h - * @brief Hex Editor Floater made by Day - * @author Day Oh - * - * $LicenseInfo:firstyear=2009&license=WTFPLV2$ - * - */ - -// - -#include "llviewerprecompiledheaders.h" - -#include "dofloaterhex.h" -#include "lluictrlfactory.h" -#include "llinventorybackup.h" // for downloading -#include "llviewercontrol.h" // gSavedSettings -#include "llviewerwindow.h" // alertXML -#include "llagent.h" // gAgent getID -#include "llviewermenufile.h" -#include "llviewerregion.h" // getCapability -#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder -#include "llinventorymodel.h" // gInventory.updateItem -#include "llappviewer.h" // System Folders -#include "llfloaterperms.h" //get default perms -#include "llnotificationsutil.h" - -std::list DOFloaterHex::sInstances; -S32 DOFloaterHex::sUploadAmount = 10; - -DOFloaterHex::DOFloaterHex(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type) -: LLFloater() -{ - sInstances.push_back(this); - - mVFS = vfs; - - //we are editing an asset directly from the VFS - if(vfs) - { - mAssetId = item_id; - mAssetType = asset_type; - - //we are editing an inventory item - } else { - mItem = (LLInventoryItem*)gInventory.getItem(item_id); - mAssetId = mItem->getAssetUUID(); - mAssetType = mItem->getType(); - } - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml"); -} - -//this bit should be rewritten entirely -void DOFloaterHex::show(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type) -{ - if(!vfs) - { - LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id); - if(item) - { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("FloaterHexRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - - DOFloaterHex* floaterp = new DOFloaterHex(item_id); - floaterp->setRect(rect); - - gFloaterView->adjustToFitScreen(floaterp, FALSE); - } - } else if (item_id.notNull() && asset_type != LLAssetType::AT_NONE) { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("FloaterHexRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - DOFloaterHex* floaterp = new DOFloaterHex(item_id, true, asset_type); - floaterp->setRect(rect); - - llinfos << "Asset ID: " << item_id.asString() << llendl; - - gFloaterView->adjustToFitScreen(floaterp, FALSE); - } -} - -DOFloaterHex::~DOFloaterHex() -{ - sInstances.remove(this); -} - -void DOFloaterHex::close(bool app_quitting) -{ - LLFloater::close(app_quitting); -} - -BOOL DOFloaterHex::postBuild(void) -{ - DOHexEditor* editor = getChild("hex"); - mEditor = editor; -#ifndef COLUMN_SPAN - // Set number of columns - U8 columns = U8(gSavedSettings.getU32("HexEditorColumns")); - editor->setColumns(columns); - // Reflect clamped U8ness in settings - gSavedSettings.setU32("HexEditorColumns", U32(columns)); -#endif - handleSizing(); - - childSetEnabled("upload_btn", false); - childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload")); - childSetAction("upload_btn", onClickUpload, this); - childSetEnabled("save_btn", false); - childSetAction("save_btn", onClickSave, this); - - if(!mVFS && mItem) - { - std::string title = "Hex editor: " + mItem->getName(); - const char* asset_type_name = LLAssetType::lookup(mItem->getType()); - if(asset_type_name) - { - title.append(" (" + std::string(asset_type_name) + ")"); - } - setTitle(title); - } - if(!mVFS) - { - // Load the asset - editor->setVisible(FALSE); - childSetText("status_text", std::string("Loading...")); - LLInventoryBackup::download(mItem, this, imageCallback, assetCallback); - } - else if (mVFS) //the asset already exists in the VFS, we don't need to fetch it - //and we don't want to associate it with an item - { - setTitle(mAssetId.asString()); - readVFile(); - } else { - this->close(false); - } - - return TRUE; -} - -// static -void DOFloaterHex::imageCallback(BOOL success, - LLViewerFetchedTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata) -{ - - if(final) - { - LLInventoryBackup::callbackdata* data = static_cast(userdata); - DOFloaterHex* floater = (DOFloaterHex*)(data->floater); - if(!floater) return; - if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash - //LLInventoryItem* item = data->item; - - if(!success) - { - floater->childSetText("status_text", std::string("Unable to download asset.")); - return; - } - - U8* src_data = src->getData(); - S32 size = src->getDataSize(); - std::vector new_data; - for(S32 i = 0; i < size; i++) - new_data.push_back(src_data[i]); - - floater->mEditor->setValue(new_data); - floater->mEditor->setVisible(TRUE); - floater->childSetText("status_text", std::string("Note: Image data shown isn't the actual asset data, yet")); - - floater->childSetEnabled("save_btn", false); - floater->childSetEnabled("upload_btn", true); - floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); - } - else - { - src_vi->setBoostLevel(LLViewerTexture::BOOST_UI); - } -} - -// static -void DOFloaterHex::assetCallback(LLVFS *vfs, - const LLUUID& asset_uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status) -{ - - LLInventoryBackup::callbackdata* data = static_cast(user_data); - DOFloaterHex* floater = (DOFloaterHex*)(data->floater); - if(!floater) return; - if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash - LLInventoryItem* item = data->item; - - if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD) - { - floater->childSetText("status_text", std::string("Unable to download asset.")); - return; - } - - // Todo: this doesn't work for static vfs shit - LLVFile file(vfs, asset_uuid, type, LLVFile::READ); - S32 size = file.getSize(); - - char* buffer = new char[size]; - if (buffer == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - - file.read((U8*)buffer, size); - - std::vector new_data; - for(S32 i = 0; i < size; i++) - new_data.push_back(buffer[i]); - - delete[] buffer; - - floater->mEditor->setValue(new_data); - floater->mEditor->setVisible(TRUE); - floater->childSetText("status_text", std::string("")); - - floater->childSetEnabled("upload_btn", true); - floater->childSetEnabled("save_btn", false); - if(item->getPermissions().allowModifyBy(gAgent.getID())) - { - switch(item->getType()) - { - case LLAssetType::AT_TEXTURE: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_SOUND: - floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); - break; - case LLAssetType::AT_LANDMARK: - case LLAssetType::AT_CALLINGCARD: - floater->childSetEnabled("upload_btn", false); - floater->childSetEnabled("save_btn", false); - break; - default: - floater->childSetEnabled("save_btn", true); - break; - } - } - else - { - switch(item->getType()) - { - case LLAssetType::AT_TEXTURE: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_SOUND: - floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); - break; - default: - break; - } - } - - // Never enable save if it's a pretend item - if(gInventory.isObjectDescendentOf(item->getUUID(), gSystemFolderRoot)) - { - floater->childSetEnabled("save_btn", false); - } -} - -// static -void DOFloaterHex::onClickUpload(void* user_data) -{ - - DOFloaterHex* floater = (DOFloaterHex*)user_data; - LLInventoryItem* item = floater->mItem; - - LLTransactionID transaction_id; - transaction_id.generate(); - LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); - - std::vector value = floater->mEditor->getValue(); - int size = value.size(); - U8* buffer = new U8[size]; - for(int i = 0; i < size; i++) - buffer[i] = value[i]; - value.clear(); - - LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); - file.setMaxSize(size); - if (!file.write(buffer, size)) - { - LLSD args; - args["ERROR_MESSAGE"] = "Couldn't write data to file"; - LLNotificationsUtil::add("ErrorMessage", args); - return; - } - delete[] buffer; - - LLAssetStorage::LLStoreAssetCallback callback = NULL; - void *fake_user_data = NULL; - - if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT - && item->getType() != LLAssetType::AT_NOTECARD) - { - upload_new_resource(transaction_id, - item->getType(), - item->getName(), - item->getDescription(), - 0, - LLFolderType::assetTypeToFolderType(item->getType()), - item->getInventoryType(), - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), - item->getName(), - callback, - sUploadAmount, - fake_user_data); - } - else // gestures and scripts, create an item first - { // AND notecards - //if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true; - create_inventory_item( gAgent.getID(), - gAgent.getSessionID(), - item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()), - LLTransactionID::tnull, - item->getName(), - fake_asset_id.asString(), - item->getType(), - item->getInventoryType(), - (LLWearableType::EType)item->getFlags(), - PERM_ITEM_UNRESTRICTED, - new NewResourceItemCallback); - } -} - -struct LLSaveInfo -{ - LLSaveInfo(DOFloaterHex* floater, LLTransactionID transaction_id) - : mFloater(floater), mTransactionID(transaction_id) - { - } - - DOFloaterHex* mFloater; - LLTransactionID mTransactionID; -}; - -// static -void DOFloaterHex::onClickSave(void* user_data) -{ - DOFloaterHex* floater = (DOFloaterHex*)user_data; - LLInventoryItem* item = floater->mItem; - - LLTransactionID transaction_id; - transaction_id.generate(); - LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); - - std::vector value = floater->mEditor->getValue(); - int size = value.size(); - U8* buffer = new U8[size]; - for(int i = 0; i < size; i++) - buffer[i] = value[i]; - value.clear(); - - LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); - file.setMaxSize(size); - if (!file.write(buffer, size)) - { - LLSD args; - args["ERROR_MESSAGE"] = "Couldn't write data to file"; - LLNotificationsUtil::add("ErrorMessage", args); - return; - } - delete[] buffer; - - - bool caps = false; - std::string url; - LLSD body; - body["item_id"] = item->getUUID(); - - switch(item->getType()) - { - case LLAssetType::AT_GESTURE: - url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory"); - caps = true; - break; - case LLAssetType::AT_LSL_TEXT: - url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); - body["target"] = "mono"; - caps = true; - break; - case LLAssetType::AT_NOTECARD: - url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory"); - caps = true; - break; - default: // wearables & notecards, Oct 12 2009 - // ONLY WEARABLES, Oct 15 2009 - floater->childSetText("status_text", std::string("Saving...")); - LLSaveInfo* info = new LLSaveInfo(floater, transaction_id); - gAssetStorage->storeAssetData(transaction_id, item->getType(), onSaveComplete, info); - caps = false; - break; - } - - if(caps) - { - LLHTTPClient::post(url, body, - new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType())); - } -} - -void DOFloaterHex::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) -{ - LLSaveInfo* info = (LLSaveInfo*)user_data; - DOFloaterHex* floater = info->mFloater; - if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash - LLInventoryItem* item = floater->mItem; - - floater->childSetText("status_text", std::string("")); - - if(item && (status == 0)) - { - LLPointer new_item = new LLViewerInventoryItem(item); - new_item->setDescription(item->getDescription()); - new_item->setTransactionID(info->mTransactionID); - new_item->setAssetUUID(asset_uuid); - new_item->updateServer(FALSE); - gInventory.updateItem(new_item); - gInventory.notifyObservers(); - } - else - { - LLSD args; - args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status); - LLNotificationsUtil::add("ErrorMessage", args); - } -} - -void DOFloaterHex::onCommitColumnCount(LLUICtrl *control, void *user_data) -{ - if(control && user_data) - { - DOFloaterHex *instance = (DOFloaterHex *)user_data; - U8 columns = llclamp((U8)llfloor(control->getValue().asReal()), 0x00, 0xFF); - instance->mEditor->setColumns(columns); - gSavedSettings.setU32("HexEditorColumns", (U32)instance->mEditor->getColumns()); - instance->handleSizing(); - } -} - -void DOFloaterHex::handleSizing() -{ - // Reshape a little based on columns - S32 min_width = S32(mEditor->getSuggestedWidth(MIN_COLS)) + 20; - setResizeLimits(min_width, getMinHeight()); - if(getRect().getWidth() < min_width) - { - //LLRect rect = getRect(); - //rect.setOriginAndSize(rect.mLeft, rect.mBottom, min_width, rect.getHeight()); - //setRect(rect); - - reshape(min_width, getRect().getHeight(), FALSE); - mEditor->reshape(mEditor->getRect().getWidth(), mEditor->getRect().getHeight(), TRUE); - } -} - -void DOFloaterHex::readVFile() -{ - if(!mVFS) return; - // quick cut paste job - // Todo: this doesn't work for static vfs shit - LLVFile file(gVFS, mAssetId, mAssetType, LLVFile::READ); - if(file.getVFSThread()) - { - S32 size = file.getSize(); - - char* buffer = new char[size]; - if (buffer == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - - file.read((U8*)buffer, size); - - std::vector new_data; - for(S32 i = 0; i < size; i++) - new_data.push_back(buffer[i]); - - delete[] buffer; - - mEditor->setValue(new_data); - mEditor->setVisible(TRUE); - - } - - childSetText("status_text", std::string("Editing VFile")); - - childSetEnabled("upload_btn", false); - childSetEnabled("save_btn", false); -} - -// diff --git a/indra/newview/dofloaterhex.h b/indra/newview/dofloaterhex.h deleted file mode 100644 index 62ef709d8..000000000 --- a/indra/newview/dofloaterhex.h +++ /dev/null @@ -1,51 +0,0 @@ -// - - -#ifndef LL_LLFLOATERHEX_H -#define LL_LLFLOATERHEX_H - -#include "llfloater.h" -#include "dohexeditor.h" -#include "llinventory.h" -#include "llviewertexture.h" -#include "llassettype.h" - -class DOFloaterHex -: public LLFloater -{ -public: - DOFloaterHex(LLUUID item_id, BOOL vfs=false, LLAssetType::EType asset_type = LLAssetType::AT_NONE); - static void show(LLUUID item_id, BOOL vfs=false, LLAssetType::EType asset_type = LLAssetType::AT_NONE); - BOOL postBuild(void); - void close(bool app_quitting); - static void imageCallback(BOOL success, - LLViewerFetchedTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata); - static void assetCallback(LLVFS *vfs, - const LLUUID& asset_uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status); - static void onClickSave(void* user_data); - static void onClickUpload(void* user_data); - static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); - static void onCommitColumnCount(LLUICtrl *control, void *user_data); - void handleSizing(); - void readVFile(); - LLInventoryItem* mItem; - LLUUID mAssetId; - LLAssetType::EType mAssetType; - BOOL mVFS; - DOHexEditor* mEditor; - static std::list sInstances; -private: - virtual ~DOFloaterHex(); -protected: - static S32 sUploadAmount; -}; - -#endif -// diff --git a/indra/newview/dohexeditor.cpp b/indra/newview/dohexeditor.cpp deleted file mode 100644 index 046360785..000000000 --- a/indra/newview/dohexeditor.cpp +++ /dev/null @@ -1,1243 +0,0 @@ -/** - * @file dohexeditor.cpp - * @brief DOHexEditor Widget - * @author Day Oh - * - * $LicenseInfo:firstyear=2009&license=WTFPLV2$ - * - */ - -// -#include "llviewerprecompiledheaders.h" - -#include "linden_common.h" -#include "dohexeditor.h" -#include "llfocusmgr.h" -#include "llkeyboard.h" -#include "llclipboard.h" -#include "lllocalcliprect.h" -#include "llwindow.h" // setCursor -#include "lllocalinventory.h" - -static LLRegisterWidget r("hex_editor"); - -DOHexEditor::DOHexEditor(const std::string& name, const LLRect& rect) -: LLUICtrl(name, rect, TRUE, NULL, NULL), - LLEditMenuHandler(), - mColumns(16), - mCursorPos(0), - mSecondNibble(FALSE), - mSelecting(FALSE), - mHasSelection(FALSE), - mInData(FALSE), - mSelectionStart(0), - mSelectionEnd(0) -{ - mGLFont = LLFontGL::getFontMonospace(); - - mTextRect.setOriginAndSize( - 5, // border + padding - 1, // border - getRect().getWidth() - SCROLLBAR_SIZE - 6, - getRect().getHeight() - 5); - - S32 line_height = llround( mGLFont->getLineHeight() ); - S32 page_size = mTextRect.getHeight() / line_height; - - // Init the scrollbar - LLRect scroll_rect; - scroll_rect.setOriginAndSize( - getRect().getWidth() - SCROLLBAR_SIZE, - 1, - SCROLLBAR_SIZE, - getRect().getHeight() - 1); - S32 lines_in_doc = getLineCount(); - mScrollbar = new LLScrollbar( std::string("Scrollbar"), scroll_rect, - LLScrollbar::VERTICAL, - lines_in_doc, - 0, - page_size, - NULL, this ); - mScrollbar->setFollowsRight(); - mScrollbar->setFollowsTop(); - mScrollbar->setFollowsBottom(); - mScrollbar->setEnabled( TRUE ); - mScrollbar->setVisible( TRUE ); - mScrollbar->setOnScrollEndCallback(NULL, NULL); - addChild(mScrollbar); - - mBorder = new LLViewBorder( std::string("text ed border"), - LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), - LLViewBorder::BEVEL_IN, - LLViewBorder::STYLE_LINE, - 1 ); // border width - addChild( mBorder ); - - changedLength(); - - mUndoBuffer = new LLUndoBuffer(DOUndoHex::create, 128); -} - -DOHexEditor::~DOHexEditor() -{ - gFocusMgr.releaseFocusIfNeeded(this); -} - -LLView* DOHexEditor::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory) -{ - std::string name("text_editor"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - DOHexEditor* editor = new DOHexEditor(name, rect); - - editor->initFromXML(node, parent); - - return editor; -} - -void DOHexEditor::setValue(const LLSD& value) -{ - mValue = value.asBinary(); - changedLength(); -} - -LLSD DOHexEditor::getValue() const -{ - return LLSD(mValue); -} - -void DOHexEditor::setColumns(U8 columns) -{ - //mColumns = columns; - mColumns = llclamp(llfloor(columns), 8, 64); //clamp this ffs - changedLength(); -} - -U32 DOHexEditor::getLineCount() -{ - U32 lines = mValue.size(); - lines /= mColumns; - lines++; // incomplete or extra line at bottom - return lines; -} - -void DOHexEditor::getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble) -{ - pos = 0; - - F32 line_height = mGLFont->getLineHeight(); - F32 char_width = mGLFont->getWidthF32("."); - F32 data_column_width = char_width * 3; // " 00"; - F32 text_x = mTextRect.mLeft; - F32 text_x_data = text_x + (char_width * 10.1f); // "00000000 ", dunno why it's a fraction off - F32 text_x_ascii = text_x_data + (data_column_width * mColumns) + (char_width * 2); - F32 text_y = (F32)(mTextRect.mTop - line_height); - U32 first_line = mScrollbar->getDocPos(); - //U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - S32 first_line_y = text_y - line_height; - - S32 ly = -(y - first_line_y); // negative vector from first line to y - ly -= 5; // slight skew - S32 line = ly / line_height; - if(line < 0) line = 0; - line += first_line; - - if(!force_context) - { - in_data = (x < (text_x_ascii - char_width)); // char width for less annoying - } - S32 lx = x; - S32 offset; - if(in_data) - { - lx -= char_width; // subtracting char width because idk - lx -= text_x_data; - offset = lx / data_column_width; - - // Now, which character - S32 rem = S32( (F32)lx - (data_column_width * offset) - (char_width * 0.25) ); - if(rem > 0) - { - if(rem > char_width) - { - offset++; // next byte - second_nibble = FALSE; - } - else second_nibble = TRUE; - } - else second_nibble = FALSE; - } - else - { - second_nibble = FALSE; - lx += char_width; // adding char width because idk - lx -= text_x_ascii; - offset = lx / char_width; - } - if(offset < 0) offset = 0; - if(offset >= mColumns)//offset = mColumns - 1; - { - offset = 0; - line++; - second_nibble = FALSE; - } - - pos = (line * mColumns) + offset; - if(pos < 0) pos = 0; - if(pos > mValue.size()) pos = mValue.size(); - if(pos == mValue.size()) - { - second_nibble = FALSE; - } -} - -void DOHexEditor::changedLength() -{ - S32 line_height = llround( mGLFont->getLineHeight() ); - S32 page_size = mTextRect.getHeight() / line_height; - page_size -= 2; // don't count the spacer and header - - mScrollbar->setDocSize(getLineCount()); - mScrollbar->setPageSize(page_size); - - moveCursor(mCursorPos, mSecondNibble); // cursor was off end after undo of paste -} - -void DOHexEditor::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLView::reshape( width, height, called_from_parent ); - mTextRect.setOriginAndSize( - 5, // border + padding - 1, // border - getRect().getWidth() - SCROLLBAR_SIZE - 6, - getRect().getHeight() - 5); - LLRect scrollrect; - scrollrect.setOriginAndSize( - getRect().getWidth() - SCROLLBAR_SIZE, - 1, - SCROLLBAR_SIZE, - getRect().getHeight() - 1); - mScrollbar->setRect(scrollrect); - mBorder->setRect(LLRect(0, getRect().getHeight(), getRect().getWidth(), 0)); - changedLength(); -} - -void DOHexEditor::setFocus(BOOL b) -{ - if(b) - { - LLEditMenuHandler::gEditMenuHandler = this; - } - else - { - mSelecting = FALSE; - gFocusMgr.releaseFocusIfNeeded(this); - if(gEditMenuHandler == this) - { - gEditMenuHandler = NULL; - } - } - LLUICtrl::setFocus(b); -} - -F32 DOHexEditor::getSuggestedWidth(U8 cols) -{ - cols = cols>1?cols:mColumns; - F32 char_width = mGLFont->getWidthF32("."); - F32 data_column_width = char_width * 3; // " 00"; - F32 text_x = mTextRect.mLeft; - F32 text_x_data = text_x + (char_width * 10.1f); // "00000000 ", dunno why it's a fraction off - F32 text_x_ascii = text_x_data + (data_column_width * cols) + (char_width * 2); - F32 suggested_width = text_x_ascii + (char_width * cols); - suggested_width += mScrollbar->getRect().getWidth(); - suggested_width += 10.0f; - return suggested_width; -} - -U32 DOHexEditor::getProperSelectionStart() -{ - return (mSelectionStart < mSelectionEnd) ? mSelectionStart : mSelectionEnd; -} - -U32 DOHexEditor::getProperSelectionEnd() -{ - return (mSelectionStart < mSelectionEnd) ? mSelectionEnd : mSelectionStart; -} - -BOOL DOHexEditor::handleScrollWheel(S32 x, S32 y, S32 clicks) -{ - mScrollbar->handleScrollWheel( 0, 0, clicks ); - return TRUE; -} - -BOOL DOHexEditor::handleMouseDown(S32 x, S32 y, MASK mask) -{ - BOOL handled = FALSE; - handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; - if(!handled) - { - setFocus(TRUE); - gFocusMgr.setMouseCapture(this); - handled = TRUE; - if(!mSelecting) - { - if(mask & MASK_SHIFT) - { - // extend a selection - getPosAndContext(x, y, FALSE, mCursorPos, mInData, mSecondNibble); - mSelectionEnd = mCursorPos; - mHasSelection = (mSelectionStart != mSelectionEnd); - mSelecting = TRUE; - } - else - { - // start selecting - getPosAndContext(x, y, FALSE, mCursorPos, mInData, mSecondNibble); - mSelectionStart = mCursorPos; - mSelectionEnd = mCursorPos; - mHasSelection = FALSE; - mSelecting = TRUE; - } - } - } - return handled; -} - -BOOL DOHexEditor::handleHover(S32 x, S32 y, MASK mask) -{ - BOOL handled = FALSE; - if(!hasMouseCapture()) - { - handled = childrenHandleHover(x, y, mask) != NULL; - } - if(!handled && mSelecting && hasMouseCapture()) - { - // continuation of selecting - getPosAndContext(x, y, TRUE, mCursorPos, mInData, mSecondNibble); - mSelectionEnd = mCursorPos; - mHasSelection = (mSelectionStart != mSelectionEnd); - handled = TRUE; - } - return handled; -} - -BOOL DOHexEditor::handleMouseUp(S32 x, S32 y, MASK mask) -{ - BOOL handled = FALSE; - handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL; - if(!handled && mSelecting && hasMouseCapture()) - { - gFocusMgr.setMouseCapture(NULL); - mSelecting = FALSE; - } - return handled; -} - -BOOL DOHexEditor::handleKeyHere(KEY key, MASK mask) -{ - return FALSE; -} - -BOOL DOHexEditor::handleKey(KEY key, MASK mask, BOOL called_from_parent) -{ - BOOL handled = FALSE; - - BOOL moved_cursor = FALSE; - U32 old_cursor = mCursorPos; - U32 cursor_line = mCursorPos / mColumns; - U32 doc_first_line = 0; - U32 doc_last_line = mValue.size() / mColumns; - //U32 first_line = mScrollbar->getDocPos(); - //U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - U32 beginning_of_line = mCursorPos - (mCursorPos % mColumns); - U32 end_of_line = beginning_of_line + mColumns - 1; - - handled = TRUE; - switch( key ) - { - - // Movement keys - - case KEY_UP: - if(cursor_line > doc_first_line) - { - moveCursor(mCursorPos - mColumns, mSecondNibble); - moved_cursor = TRUE; - } - break; - case KEY_DOWN: - if(cursor_line < doc_last_line) - { - moveCursor(mCursorPos + mColumns, mSecondNibble); - moved_cursor = TRUE; - } - break; - case KEY_LEFT: - if(mCursorPos) - { - if(!mSecondNibble) moveCursor(mCursorPos - 1, FALSE); - else moveCursor(mCursorPos, FALSE); - moved_cursor = TRUE; - } - break; - case KEY_RIGHT: - moveCursor(mCursorPos + 1, FALSE); - moved_cursor = TRUE; - break; - case KEY_PAGE_UP: - mScrollbar->pageUp(1); - break; - case KEY_PAGE_DOWN: - mScrollbar->pageDown(1); - break; - case KEY_HOME: - if(mask & MASK_CONTROL) - moveCursor(0, FALSE); - else - moveCursor(beginning_of_line, FALSE); - moved_cursor = TRUE; - break; - case KEY_END: - if(mask & MASK_CONTROL) - moveCursor(mValue.size(), FALSE); - else - moveCursor(end_of_line, FALSE); - moved_cursor = TRUE; - break; - - // Special - - case KEY_INSERT: - gKeyboard->toggleInsertMode(); - break; - - case KEY_ESCAPE: - gFocusMgr.releaseFocusIfNeeded(this); - break; - - // Editing - case KEY_BACKSPACE: - if(mHasSelection) - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - del(start, end - 1, TRUE); - moveCursor(start, FALSE); - } - else if(mCursorPos && (!mSecondNibble)) - { - del(mCursorPos - 1, mCursorPos - 1, TRUE); - moveCursor(mCursorPos - 1, FALSE); - } - break; - - case KEY_DELETE: - if(mHasSelection) - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - del(start, end - 1, TRUE); - moveCursor(start, FALSE); - } - else if((mCursorPos != mValue.size()) && (!mSecondNibble)) - { - del(mCursorPos, mCursorPos, TRUE); - } - break; - - default: - handled = FALSE; - break; - } - - if(moved_cursor) - { - // Selecting and deselecting - if(mask & MASK_SHIFT) - { - if(!mHasSelection) mSelectionStart = old_cursor; - mSelectionEnd = mCursorPos; - } - else - { - mSelectionStart = mCursorPos; - mSelectionEnd = mCursorPos; - } - mHasSelection = mSelectionStart != mSelectionEnd; - } - - return handled; -} - -BOOL DOHexEditor::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) -{ - U8 c = uni_char & 0xff; - if(mInData) - { - if(c > 0x39) - { - if(c > 0x46) c -= 0x20; - if(c >= 0x41 && c <= 0x46) c = (c & 0x0f) + 0x09; - else return TRUE; - } - else if(c < 0x30) return TRUE; - else c &= 0x0f; - } - - if(uni_char < 0x20) return FALSE; - - if( (LL_KIM_INSERT == gKeyboard->getInsertMode() && (!mHasSelection)) - || (!mHasSelection && (mCursorPos == mValue.size())) )// last byte? always insert - { - // Todo: this should overwrite if there's a selection - if(!mInData) - { - std::vector new_data; - new_data.push_back(c); - insert(mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - else if(!mSecondNibble) - { - c <<= 4; - std::vector new_data; - new_data.push_back(c); - insert(mCursorPos, new_data, TRUE); - moveCursor(mCursorPos, TRUE); - } - else - { - c |= (mValue[mCursorPos] & 0xF0); - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - } - else // overwrite mode - { - if(mHasSelection) - { - if(mInData) c <<= 4; - std::vector new_data; - new_data.push_back(c); - U8 start = getProperSelectionStart(); - overwrite(start, getProperSelectionEnd() - 1, new_data, TRUE); - if(mInData) moveCursor(start, TRUE); // we only entered a nibble - else moveCursor(start + 1, FALSE); // we only entered a byte - } - else if(!mInData) - { - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - else if(!mSecondNibble) - { - c <<= 4; - c |= (mValue[mCursorPos] & 0x0F); - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos, TRUE); - } - else - { - c |= (mValue[mCursorPos] & 0xF0); - std::vector new_data; - new_data.push_back(c); - overwrite(mCursorPos, mCursorPos, new_data, TRUE); - moveCursor(mCursorPos + 1, FALSE); - } - } - - return TRUE; -} - -BOOL DOHexEditor::handleUnicodeCharHere(llwchar uni_char) -{ - return FALSE; -} - -void DOHexEditor::draw() -{ - S32 left = 0; - S32 top = getRect().getHeight(); - S32 right = getRect().getWidth(); - S32 bottom = 0; - - BOOL has_focus = gFocusMgr.getKeyboardFocus() == this; - - F32 line_height = mGLFont->getLineHeight(); - F32 char_width = mGLFont->getWidthF32("."); - F32 data_column_width = char_width * 3; // " 00"; - F32 text_x = mTextRect.mLeft; - F32 text_x_data = text_x + (char_width * 10.1f); // "00000000 ", dunno why it's a fraction off -#ifdef COLUMN_SPAN - mColumns = (right - char_width * 2 - text_x_data - mScrollbar->getRect().getWidth()) / (char_width * 4); // touch this if you dare... -#endif - F32 text_x_ascii = text_x_data + (data_column_width * mColumns) + (char_width * 2); - F32 text_y = (F32)(mTextRect.mTop - line_height); - - U32 data_length = mValue.size(); - U32 line_count = getLineCount(); - U32 first_line = mScrollbar->getDocPos(); - U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - - LLRect clip(getRect()); - clip.mRight = mScrollbar->getRect().mRight; - clip.mLeft -= 10; - clip.mBottom -= 10; - LLLocalClipRect bgclip(clip); - - // Background - gl_rect_2d(left, top, right, bottom, LLColor4::white); - - // Let's try drawing some helpful guides - LLColor4 guide_color_light = LLColor4(1.0f, 1.0f, 0.9f); - LLColor4 guide_color_dark = LLColor4(1.0f, 1.0f, 0.8f); - for(U32 col = 0; col < mColumns; col += 2) - { - // Behind hex - F32 box_left = text_x_data + (col * data_column_width) + 2; // skew 2 - F32 box_right = box_left + data_column_width; - gl_rect_2d(box_left, top, box_right, bottom, (col & 3) ? guide_color_light : guide_color_dark); - // Behind ASCII - //box_left = text_x_ascii + (col * char_width) - 1; // skew 1 - //box_right = box_left + char_width; - //gl_rect_2d(box_left, top, box_right, bottom, guide_color); - } - - - // Scrollbar & border (drawn twice?) - mBorder->setKeyboardFocusHighlight(has_focus); - LLView::draw(); - - - LLLocalClipRect textrect_clip(mTextRect); - - - // Selection stuff is reused - U32 selection_start = getProperSelectionStart(); - U32 selection_end = getProperSelectionEnd(); - U32 selection_first_line = selection_start / mColumns; - U32 selection_last_line = selection_end / mColumns; - U32 selection_start_column = selection_start % mColumns; - U32 selection_end_column = selection_end % mColumns; - - // Don't pretend a selection there is visible - if(!selection_end_column) - { - selection_last_line--; - selection_end_column = mColumns; - } - - if(mHasSelection) - { - LLColor4 selection_color_context(LLColor4::black); - LLColor4 selection_color_not_context(LLColor4::grey3); - LLColor4 selection_color_data(selection_color_not_context); - LLColor4 selection_color_ascii(selection_color_not_context); - if(mInData) selection_color_data = selection_color_context; - else selection_color_ascii = selection_color_context; - - - // Setup for selection in data - F32 selection_pixel_x_base = text_x_data + char_width - 3; // skew 3 - F32 selection_pixel_x_right_base = selection_pixel_x_base + (data_column_width * mColumns) - char_width + 4; - F32 selection_pixel_x; - F32 selection_pixel_x_right; - F32 selection_pixel_y = (F32)(mTextRect.mTop - line_height) - 3; // skew 3; - selection_pixel_y -= line_height * 2; - selection_pixel_y -= line_height * (S32(selection_first_line) - S32(first_line)); - - // Selection in data, First line - if(selection_first_line >= first_line && selection_first_line <= last_line) - { - selection_pixel_x = selection_pixel_x_base; - selection_pixel_x += (data_column_width * selection_start_column); - if(selection_first_line == selection_last_line) - { - // Select to last character - selection_pixel_x_right = selection_pixel_x_base + (data_column_width * selection_end_column); - selection_pixel_x_right -= (char_width - 4); - } - else - { - // Select to end of line - selection_pixel_x_right = selection_pixel_x_right_base; - } - gl_rect_2d(selection_pixel_x, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_data); - } - - // Selection in data, Middle lines - for(U32 line = selection_first_line + 1; line < selection_last_line; line++) - { - selection_pixel_y -= line_height; - if(line >= first_line && line <= last_line) - { - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right_base, selection_pixel_y, selection_color_data); - } - } - - // Selection in data, Last line - if(selection_first_line != selection_last_line - && selection_last_line >= first_line && selection_last_line <= last_line) - { - selection_pixel_x_right = selection_pixel_x_base + (data_column_width * selection_end_column); - selection_pixel_x_right -= (char_width - 4); - selection_pixel_y -= line_height; - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_data); - } - - selection_pixel_y = (F32)(mTextRect.mTop - line_height) - 3; // skew 3; - selection_pixel_y -= line_height * 2; - selection_pixel_y -= line_height * (S32(selection_first_line) - S32(first_line)); - - // Setup for selection in ASCII - selection_pixel_x_base = text_x_ascii - 1; - selection_pixel_x_right_base = selection_pixel_x_base + (char_width * mColumns); - - // Selection in ASCII, First line - if(selection_first_line >= first_line && selection_first_line <= last_line) - { - selection_pixel_x = selection_pixel_x_base; - selection_pixel_x += (char_width * selection_start_column); - if(selection_first_line == selection_last_line) - { - // Select to last character - selection_pixel_x_right = selection_pixel_x_base + (char_width * selection_end_column); - } - else - { - // Select to end of line - selection_pixel_x_right = selection_pixel_x_right_base; - } - gl_rect_2d(selection_pixel_x, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_ascii); - } - - // Selection in ASCII, Middle lines - for(U32 line = selection_first_line + 1; line < selection_last_line; line++) - { - selection_pixel_y -= line_height; - if(line >= first_line && line <= last_line) - { - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right_base, selection_pixel_y, selection_color_ascii); - } - } - - // Selection in ASCII, Last line - if(selection_first_line != selection_last_line - && selection_last_line >= first_line && selection_last_line <= last_line) - { - selection_pixel_x_right = selection_pixel_x_base + (char_width * selection_end_column); - selection_pixel_y -= line_height; - gl_rect_2d(selection_pixel_x_base, selection_pixel_y + line_height, selection_pixel_x_right, selection_pixel_y, selection_color_ascii); - } - } - - - // Insert/Overwrite - std::string text = (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) ? "OVERWRITE" : "INSERT"; - mGLFont->renderUTF8(text, 0, text_x, text_y, LLColor4::purple); - // Offset on top - text = ""; - for(U32 i = 0; i < mColumns; i++) - { - text.append(llformat(" %02X", i)); - } - mGLFont->renderUTF8(text, 0, text_x_data, text_y, LLColor4::blue); - // Size - { - S32 size = mValue.size(); - std::string size_desc; - if(size < 1000) size_desc = llformat("%d bytes", size); - else - { - if(size < 1000000) - { - size_desc = llformat("%f", F32(size) / 1000.0f); - int i = size_desc.length() - 1; - for(; i && size_desc.substr(i, 1) == "0"; i--); - if(size_desc.substr(i, 1) == ".") i--; - size_desc = size_desc.substr(0, i + 1); - size_desc.append(" KB"); - } - else - { - size_desc = llformat("%f", F32(size) / 1000000.0f); - int i = size_desc.length() - 1; - for(; i && size_desc.substr(i, 1) == "0"; i--); - if(size_desc.substr(i, 1) == ".") i--; - size_desc = size_desc.substr(0, i + 1); - size_desc.append(" MB"); - } - } - F32 x = text_x_ascii; - x += (char_width * (mColumns - size_desc.length())); - mGLFont->renderUTF8(size_desc, 0, x, text_y, LLColor4::purple); - } - // Leave a blank line - text_y -= (line_height * 2); - - // Everything below "header" - for(U32 line = first_line; line <= last_line; line++) - { - if(line >= line_count) break; - - // Offset on left - text = llformat("%08X", line * mColumns); // offset on left - mGLFont->renderUTF8(text, 0, text_x, text_y, LLColor4::blue); - - // Setup for rendering hex and ascii - U32 line_char_offset = mColumns * line; - U32 colstart0 = 0; - U32 colend0 = mColumns; - U32 colstart1 = mColumns; - U32 colend1 = mColumns; - U32 colstart2 = mColumns; - U32 colend2 = mColumns; - if(mHasSelection) - { - if(line == selection_first_line) - { - colend0 = selection_start_column; - colstart1 = selection_start_column; - if(selection_first_line == selection_last_line) - { - colend1 = selection_end_column; - colstart2 = selection_end_column; - colend2 = mColumns; - } - } - else if(line > selection_first_line && line < selection_last_line) - { - colend0 = 0; - colstart1 = 0; - colend1 = mColumns; - } - else if(line == selection_last_line) - { - colend0 = 0; - colstart1 = 0; - colend1 = selection_end_column; - colstart2 = selection_end_column; - colend2 = mColumns; - } - } - - // Data in hex - text = ""; - for(U32 c = colstart0; c < colend0; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) text.append(" "); - else text.append(llformat(" %02X", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_data + (colstart0 * data_column_width), text_y, LLColor4::black); - text = ""; - for(U32 c = colstart1; c < colend1; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) text.append(" "); - else text.append(llformat(" %02X", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_data + (colstart1 * data_column_width), text_y, LLColor4::white); - text = ""; - for(U32 c = colstart2; c < colend2; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) text.append(" "); - else text.append(llformat(" %02X", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_data + (colstart2 * data_column_width), text_y, LLColor4::black); - - // ASCII - text = ""; - for(U32 c = colstart0; c < colend0; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) break; - if((mValue[o] < 0x20) || (mValue[o] >= 0x7F)) text.append("."); - else text.append(llformat("%c", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_ascii + (colstart0 * char_width), text_y, LLColor4::black); - text = ""; - for(U32 c = colstart1; c < colend1; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) break; - if((mValue[o] < 0x20) || (mValue[o] >= 0x7F)) text.append("."); - else text.append(llformat("%c", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_ascii + (colstart1 * char_width), text_y, LLColor4::white); - text = ""; - for(U32 c = colstart2; c < colend2; c++) - { - U32 o = line_char_offset + c; - if(o >= data_length) break; - if((mValue[o] < 0x20) || (mValue[o] >= 0x7F)) text.append("."); - else text.append(llformat("%c", mValue[o])); - } - mGLFont->renderUTF8(text, 0, text_x_ascii + (colstart2 * char_width), text_y, LLColor4::black); - - text_y -= line_height; - } - - - - // Cursor - if(has_focus && !mHasSelection && (U32(LLTimer::getElapsedSeconds() * 2.0f) & 0x1)) - { - U32 cursor_line = mCursorPos / mColumns; - if((cursor_line >= first_line) && (cursor_line <= last_line)) - { - F32 pixel_y = (F32)(mTextRect.mTop - line_height); - pixel_y -= line_height * (2 + (cursor_line - first_line)); - - U32 cursor_offset = mCursorPos % mColumns; // bytes - F32 pixel_x = mInData ? text_x_data : text_x_ascii; - if(mInData) - { - pixel_x += data_column_width * cursor_offset; - pixel_x += char_width; - if(mSecondNibble) pixel_x += char_width; - } - else - { - pixel_x += char_width * cursor_offset; - } - pixel_x -= 2.0f; - pixel_y -= 2.0f; - gl_rect_2d(pixel_x, pixel_y + line_height, pixel_x + 2, pixel_y, LLColor4::black); - } - } -} - -void DOHexEditor::deselect() -{ - mSelectionStart = mCursorPos; - mSelectionEnd = mCursorPos; - mHasSelection = FALSE; - mSelecting = FALSE; -} - -BOOL DOHexEditor::canUndo() const -{ - return mUndoBuffer->canUndo(); -} - -void DOHexEditor::undo() -{ - mUndoBuffer->undoAction(); -} - -BOOL DOHexEditor::canRedo() const -{ - return mUndoBuffer->canRedo(); -} - -void DOHexEditor::redo() -{ - mUndoBuffer->redoAction(); -} - - - - -void DOHexEditor::moveCursor(U32 pos, BOOL second_nibble) -{ - mCursorPos = pos; - - // Clamp and handle second nibble - if(mCursorPos >= mValue.size()) - { - mCursorPos = mValue.size(); - mSecondNibble = FALSE; - } - else - { - mSecondNibble = mInData ? second_nibble : FALSE; - } - - // Change selection - mSelectionEnd = mCursorPos; - if(!mHasSelection) mSelectionStart = mCursorPos; - - // Scroll - U32 line = mCursorPos / mColumns; - U32 first_line = mScrollbar->getDocPos(); - U32 last_line = first_line + mScrollbar->getPageSize(); // don't -2 from scrollbar sizes - if(line < first_line) mScrollbar->setDocPos(line); - if(line > (last_line - 2)) mScrollbar->setDocPos(line - mScrollbar->getPageSize() + 1); -} - -BOOL DOHexEditor::canCut() const -{ - return mHasSelection; -} - -void DOHexEditor::cut() -{ - if(!canCut()) return; - - copy(); - - U32 start = getProperSelectionStart(); - del(start, getProperSelectionEnd() - 1, TRUE); - - moveCursor(start, FALSE); -} - -BOOL DOHexEditor::canCopy() const -{ - return mHasSelection; -} - -void DOHexEditor::copy() -{ - if(!canCopy()) return; - - std::string text; - if(mInData) - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - for(U32 i = start; i < end; i++) - text.append(llformat("%02X", mValue[i])); - } - else - { - U32 start = getProperSelectionStart(); - U32 end = getProperSelectionEnd(); - for(U32 i = start; i < end; i++) - text.append(llformat("%c", mValue[i])); - } - LLWString wtext = utf8str_to_wstring(text); - gClipboard.copyFromSubstring(wtext, 0, wtext.length()); -} - -BOOL DOHexEditor::canPaste() const -{ - return TRUE; -} - -void DOHexEditor::paste() -{ - if(!canPaste()) return; - - std::string clipstr = wstring_to_utf8str(gClipboard.getPasteWString()); - const char* clip = clipstr.c_str(); - - std::vector new_data; - if(mInData) - { - int len = strlen(clip); - for(int i = 0; (i + 1) < len; i += 2) - { - int c = 0; - if(sscanf(&(clip[i]), "%02X", &c) != 1) break; - new_data.push_back(U8(c)); - } - } - else - { - int len = strlen(clip); - for(int i = 0; i < len; i++) - { - U8 c = 0; - if(sscanf(&(clip[i]), "%c", &c) != 1) break; - new_data.push_back(c); - } - } - - U32 start = mCursorPos; - if(!mHasSelection) - insert(start, new_data, TRUE); - else - { - start = getProperSelectionStart(); - overwrite(start, getProperSelectionEnd() - 1, new_data, TRUE); - } - - moveCursor(start + new_data.size(), FALSE); -} - -BOOL DOHexEditor::canDoDelete() const -{ - return mValue.size() > 0; -} - -void DOHexEditor::doDelete() -{ - if(!canDoDelete()) return; - - U32 start = getProperSelectionStart(); - del(start, getProperSelectionEnd(), TRUE); - - moveCursor(start, FALSE); -} - -BOOL DOHexEditor::canSelectAll() const -{ - return mValue.size() > 0; -} - -void DOHexEditor::selectAll() -{ - if(!canSelectAll()) return; - - mSelectionStart = 0; - mSelectionEnd = mValue.size(); - mHasSelection = mSelectionStart != mSelectionEnd; -} - -BOOL DOHexEditor::canDeselect() const -{ - return mHasSelection; -} - -void DOHexEditor::insert(U32 pos, std::vector new_data, BOOL undoable) -{ - if(pos > mValue.size()) - { - llwarns << "pos outside data!" << llendl; - return; - } - - deselect(); - - if(undoable) - { - DOUndoHex* action = (DOUndoHex*)(mUndoBuffer->getNextAction()); - action->set(this, &(DOUndoHex::undoInsert), &(DOUndoHex::redoInsert), pos, pos, std::vector(), new_data); - } - - std::vector::iterator wheres = mValue.begin() + pos; - - mValue.insert(wheres, new_data.begin(), new_data.end()); - - changedLength(); -} - -void DOHexEditor::overwrite(U32 first_pos, U32 last_pos, std::vector new_data, BOOL undoable) -{ - if(first_pos > mValue.size() || last_pos > mValue.size()) - { - llwarns << "pos outside data!" << llendl; - return; - } - - deselect(); - - std::vector::iterator first = mValue.begin() + first_pos; - std::vector::iterator last = mValue.begin() + last_pos; - - std::vector old_data; - if(last_pos > 0) old_data = std::vector(first, last + 1); - - if(undoable) - { - DOUndoHex* action = (DOUndoHex*)(mUndoBuffer->getNextAction()); - action->set(this, &(DOUndoHex::undoOverwrite), &(DOUndoHex::redoOverwrite), first_pos, last_pos, old_data, new_data); - } - - mValue.erase(first, last + 1); - first = mValue.begin() + first_pos; - mValue.insert(first, new_data.begin(), new_data.end()); - - changedLength(); -} - -void DOHexEditor::del(U32 first_pos, U32 last_pos, BOOL undoable) -{ - if(first_pos > mValue.size() || last_pos > mValue.size()) - { - llwarns << "pos outside data!" << llendl; - return; - } - - deselect(); - - std::vector::iterator first = mValue.begin() + first_pos; - std::vector::iterator last = mValue.begin() + last_pos; - - std::vector old_data; - if(last_pos > 0) old_data = std::vector(first, last + 1); - - if(undoable) - { - DOUndoHex* action = (DOUndoHex*)(mUndoBuffer->getNextAction()); - action->set(this, &(DOUndoHex::undoDel), &(DOUndoHex::redoDel), first_pos, last_pos, old_data, std::vector()); - } - - mValue.erase(first, last + 1); - - changedLength(); -} - -void DOUndoHex::set(DOHexEditor* hex_editor, - void (*undo_action)(DOUndoHex*), - void (*redo_action)(DOUndoHex*), - U32 first_pos, - U32 last_pos, - std::vector old_data, - std::vector new_data) -{ - mHexEditor = hex_editor; - mUndoAction = undo_action; - mRedoAction = redo_action; - mFirstPos = first_pos; - mLastPos = last_pos; - mOldData = old_data; - mNewData = new_data; -} - -void DOUndoHex::undo() -{ - mUndoAction(this); -} - -void DOUndoHex::redo() -{ - mRedoAction(this); -} - -void DOUndoHex::undoInsert(DOUndoHex* action) -{ - //action->mHexEditor->del(action->mFirstPos, action->mLastPos, FALSE); - action->mHexEditor->del(action->mFirstPos, action->mFirstPos + action->mNewData.size() - 1, FALSE); -} - -void DOUndoHex::redoInsert(DOUndoHex* action) -{ - action->mHexEditor->insert(action->mFirstPos, action->mNewData, FALSE); -} - -void DOUndoHex::undoOverwrite(DOUndoHex* action) -{ - //action->mHexEditor->overwrite(action->mFirstPos, action->mLastPos, action->mOldData, FALSE); - action->mHexEditor->overwrite(action->mFirstPos, action->mFirstPos + action->mNewData.size() - 1, action->mOldData, FALSE); -} - -void DOUndoHex::redoOverwrite(DOUndoHex* action) -{ - action->mHexEditor->overwrite(action->mFirstPos, action->mLastPos, action->mNewData, FALSE); -} - -void DOUndoHex::undoDel(DOUndoHex* action) -{ - action->mHexEditor->insert(action->mFirstPos, action->mOldData, FALSE); -} - -void DOUndoHex::redoDel(DOUndoHex* action) -{ - action->mHexEditor->del(action->mFirstPos, action->mLastPos, FALSE); -} - - -// diff --git a/indra/newview/dohexeditor.h b/indra/newview/dohexeditor.h deleted file mode 100644 index 8790d7913..000000000 --- a/indra/newview/dohexeditor.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file dohexeditor.h - * @brief DOHexEditor Widget - * @author Day Oh - * - * $LicenseInfo:firstyear=2009&license=WTFPLV2$ - * - */ - -// -#ifndef DO_DOHEXEDITOR_H -#define DO_DOHEXEDITOR_H - -#define MIN_COLS 8 -#define MAX_COLS 48 - -#ifndef COLUMN_SPAN -#define COLUMN_SPAN -#endif - -#include "lluictrl.h" -#include "llscrollbar.h" -#include "llviewborder.h" -#include "llundo.h" -#include "lleditmenuhandler.h" - -class DOHexEditor : public LLUICtrl, public LLEditMenuHandler -{ -public: - DOHexEditor(const std::string& name, const LLRect& rect); - ~DOHexEditor(); - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); - void setValue(const LLSD& value); - LLSD getValue() const; - void setColumns(U8 columns); - U8 getColumns() { return mColumns; }; - U32 getLineCount(); - F32 getSuggestedWidth(U8 cols = -1); - U32 getProperSelectionStart(); - U32 getProperSelectionEnd(); - void reshape(S32 width, S32 height, BOOL called_from_parent); - void setFocus(BOOL b); - - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); - BOOL handleMouseUp(S32 x, S32 y, MASK mask); - - BOOL handleKeyHere(KEY key, MASK mask); - BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - BOOL handleUnicodeCharHere(llwchar uni_char); - - void draw(); - - void moveCursor(U32 pos, BOOL second_nibble); - - void insert(U32 pos, std::vector new_data, BOOL undoable); - void overwrite(U32 first_pos, U32 last_pos, std::vector new_data, BOOL undoable); - void del(U32 first_pos, U32 last_pos, BOOL undoable); - - virtual void cut(); - virtual BOOL canCut() const; - - virtual void copy(); - virtual BOOL canCopy() const; - - virtual void paste(); - virtual BOOL canPaste() const; - - virtual void doDelete(); - virtual BOOL canDoDelete() const; - - virtual void selectAll(); - virtual BOOL canSelectAll() const; - - virtual void deselect(); - virtual BOOL canDeselect() const; - - virtual void undo(); - virtual BOOL canUndo() const; - - virtual void redo(); - virtual BOOL canRedo() const; - -private: - std::vector mValue; - U8 mColumns; - - U32 mCursorPos; - BOOL mSecondNibble; - BOOL mInData; - BOOL mSelecting; - BOOL mHasSelection; - U32 mSelectionStart; - U32 mSelectionEnd; - - LLFontGL* mGLFont; - LLRect mTextRect; - LLScrollbar* mScrollbar; - LLViewBorder* mBorder; - - LLUndoBuffer* mUndoBuffer; - - void changedLength(); - void getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble); -}; - -class DOUndoHex : public LLUndoBuffer::LLUndoAction -{ -protected: - DOUndoHex() { } - DOHexEditor* mHexEditor; - U32 mFirstPos; - U32 mLastPos; - std::vector mOldData; - std::vector mNewData; -public: - static LLUndoAction* create() { return new DOUndoHex(); } - virtual void set(DOHexEditor* hex_editor, - void (*undo_action)(DOUndoHex*), - void (*redo_action)(DOUndoHex*), - U32 first_pos, - U32 last_pos, - std::vector old_data, - std::vector new_data); - void (*mUndoAction)(DOUndoHex*); - void (*mRedoAction)(DOUndoHex*); - virtual void undo(); - virtual void redo(); - - static void undoInsert(DOUndoHex* action); - static void redoInsert(DOUndoHex* action); - static void undoOverwrite(DOUndoHex* action); - static void redoOverwrite(DOUndoHex* action); - static void undoDel(DOUndoHex* action); - static void redoDel(DOUndoHex* action); -}; - -class DOHexInsert : public DOUndoHex -{ - virtual void undo(); - virtual void redo(); -}; - -class DOHexOverwrite : public DOUndoHex -{ - virtual void undo(); - virtual void redo(); -}; - -class DOHexDel : public DOUndoHex -{ - virtual void undo(); - virtual void redo(); -}; - -#endif -// diff --git a/indra/newview/dsaparam.cpp b/indra/newview/dsaparam.cpp deleted file mode 100644 index c7720e61e..000000000 --- a/indra/newview/dsaparam.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Generated using openssl */ -#include "llviewerprecompiledheaders.h" -#include - -static unsigned char dsa2048_p[]={ - 0xD4,0x63,0x93,0xFA,0x69,0x87,0xDB,0x60,0x68,0xFB,0xCC,0x8F, - 0x55,0x85,0x7A,0xAC,0xAD,0x1F,0x8E,0xF0,0x2C,0x62,0x2F,0xE6, - 0xA6,0xA4,0xF3,0x57,0x42,0xDC,0xF0,0xE0,0x0E,0xC6,0x67,0x01, - 0x95,0x22,0x6F,0x03,0x00,0x2A,0xB4,0xBF,0x62,0x6D,0xA1,0xBD, - 0xB7,0x10,0x81,0xB4,0x20,0x1C,0x7D,0x41,0x75,0xCE,0x0F,0xCF, - 0x9D,0x03,0xEC,0xE6,0x7E,0xBC,0x76,0x97,0xBC,0x5C,0x70,0xFE, - 0xD5,0x64,0x15,0x20,0xD8,0xA8,0x25,0x73,0xD4,0xA2,0x77,0x99, - 0xC7,0x3B,0xF7,0x4E,0x20,0x40,0x43,0xD7,0x7C,0xFD,0xBC,0x2F, - 0x75,0xB5,0x18,0xA3,0x8C,0x85,0x79,0x86,0x53,0x62,0x73,0xBA, - 0x66,0x73,0xE2,0x48,0x15,0xAF,0x04,0x65,0xE2,0x4D,0x15,0x47, - 0x74,0x33,0x79,0xAE,0xBF,0x90,0xC0,0xF7,0x2F,0x04,0xFB,0xEE, - 0x29,0xEC,0x42,0xC7,0x36,0x14,0xAC,0xB2,0xBC,0xE1,0x71,0x13, - 0x65,0xBA,0x0D,0x61,0x11,0x89,0x49,0x41,0x5D,0xCC,0xE2,0x72, - 0x7B,0x93,0xF2,0x2E,0xD1,0x23,0x37,0xF9,0xFF,0x55,0x59,0xF6, - 0x41,0x78,0x87,0xC9,0xCD,0x95,0xD2,0xE5,0x1B,0x3A,0x25,0x7A, - 0xD8,0x16,0x2F,0x58,0xFE,0x3B,0xD5,0xB1,0x59,0x63,0x3C,0x90, - 0xA0,0xBF,0xA0,0x21,0x54,0xB0,0xB0,0x3F,0x9D,0xC6,0xB5,0x31, - 0xBA,0x86,0xDC,0x86,0x41,0xB7,0xBA,0xCE,0x58,0x09,0x8B,0xD9, - 0xD4,0xF1,0xD2,0x3B,0x5F,0x87,0xEE,0x66,0xFD,0x77,0x8C,0x2C, - 0x66,0x3E,0xC9,0xDA,0x3E,0x2A,0x38,0x03,0x23,0x71,0xC9,0x04, - 0x3E,0x9D,0x18,0x7F,0xBB,0x82,0x21,0x8E,0x5F,0xF0,0xAF,0xC8, - 0x08,0x2D,0xA6,0x3F, - }; -static unsigned char dsa2048_q[]={ - 0xAE,0xCA,0x67,0x69,0x21,0x7A,0xE1,0x9B,0x64,0x74,0xED,0x58, - 0xF0,0x28,0xE0,0x45,0x2B,0x39,0xBC,0x79, - }; -static unsigned char dsa2048_g[]={ - 0x51,0x1D,0xB0,0xF6,0x4E,0x8B,0xAF,0x1C,0x59,0x71,0x62,0x3C, - 0xC3,0xE2,0x44,0x35,0xCE,0x11,0xB4,0x49,0x04,0x41,0xA1,0x1C, - 0x22,0x59,0x47,0x8C,0x70,0x1D,0xA1,0x0C,0x51,0xFE,0x86,0x43, - 0x7B,0x75,0x5C,0xB7,0x68,0xA5,0xBE,0x81,0x9C,0x6F,0x6D,0x32, - 0x03,0xB0,0x28,0xA4,0x6B,0x5B,0x37,0xC3,0x35,0xCF,0xBD,0x92, - 0xC3,0x66,0x2E,0xAB,0xB4,0x13,0xEC,0x23,0xA3,0xE3,0x09,0x4E, - 0x47,0x7D,0xA5,0x90,0x33,0x80,0x5D,0x68,0xD6,0x39,0x54,0xBE, - 0x35,0xB0,0x61,0x5B,0x96,0x63,0x05,0x67,0xB7,0x3C,0x21,0x17, - 0x37,0x50,0x17,0x78,0xEA,0xC0,0x10,0x73,0xDF,0xE2,0x70,0x19, - 0x17,0xF7,0x11,0x82,0x73,0xDB,0xFF,0x3E,0x8D,0x98,0x2F,0x2F, - 0xA2,0x12,0xC3,0xB4,0x08,0xB2,0x2C,0x5B,0xA3,0x51,0xAA,0x7F, - 0x3D,0xE0,0x74,0x39,0xE5,0xAF,0x81,0x32,0xF8,0x45,0x75,0x11, - 0x35,0xD9,0x90,0xA1,0xA3,0x91,0x1A,0xEE,0xE9,0xAC,0x97,0x30, - 0x4C,0xD5,0x5B,0x38,0x49,0x12,0x3B,0xCC,0x0C,0x84,0xA2,0x59, - 0x78,0xB4,0xFD,0x46,0xAC,0x49,0x43,0x08,0xDB,0xF4,0x23,0xFF, - 0x23,0xF8,0x9A,0xFD,0x15,0xAF,0x6B,0x81,0xCE,0x15,0x22,0xEF, - 0x09,0x64,0x0A,0x1F,0x4D,0x6B,0xF1,0x9F,0x16,0x00,0x3E,0xE8, - 0xFC,0x9A,0x24,0x58,0x1C,0xB4,0x5F,0x56,0x3E,0x83,0x8C,0x0C, - 0x51,0x43,0x72,0x25,0xA8,0x1D,0x08,0x30,0x7E,0x17,0xC8,0xD6, - 0x66,0x57,0x0C,0x59,0x76,0xE4,0xA6,0x0C,0x05,0xA8,0x60,0x1D, - 0xA4,0x8F,0xBC,0xC4,0x67,0x55,0x0E,0x81,0x8F,0x66,0xED,0x1B, - 0x84,0xCD,0x02,0x9F, - }; - -DSA *get_dsa2048() - { - DSA *dsa; - - if ((dsa=DSA_new()) == NULL) return(NULL); - dsa->p=BN_bin2bn(dsa2048_p,sizeof(dsa2048_p),NULL); - dsa->q=BN_bin2bn(dsa2048_q,sizeof(dsa2048_q),NULL); - dsa->g=BN_bin2bn(dsa2048_g,sizeof(dsa2048_g),NULL); - if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL)) - { DSA_free(dsa); return(NULL); } - return(dsa); - } diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 995506eab..fc9a175d9 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -63,8 +63,8 @@ RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 WatchdogDisabled 1 1 -ShyotlRenderUseStreamVBO 1 1 -RenderFSAASamples 1 16 +ShyotlRenderUseStreamVBO 1 0 +RenderFSAASamples 1 4 RenderMaxTextureIndex 1 16 RenderUseFBO 1 0 diff --git a/indra/newview/floaterao.cpp b/indra/newview/floaterao.cpp index afc0fcb75..ec3fac0e5 100644 --- a/indra/newview/floaterao.cpp +++ b/indra/newview/floaterao.cpp @@ -22,6 +22,7 @@ #include "chatbar_as_cmdline.h" //#include "llfloaterchat.h" #include "llfirstuse.h" +#include "lltrans.h" #include "llinventory.h" #include "llinventoryfunctions.h" @@ -330,20 +331,20 @@ BOOL LLFloaterAO::postBuild() LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); if(itemimport) { - childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); + childSetValue("ao_nc_text", LLTrans::getString("CurrentlySetTo") + LLTrans::getString(":") + " " +itemimport->getName()); } else if(itemidimport.isNull()) { - childSetValue("ao_nc_text","Currently not set"); + childSetValue("ao_nc_text", LLTrans::getString("CurrentlyNotSet")); } else { - childSetValue("ao_nc_text","Currently set to a item not on this account"); + childSetValue("ao_nc_text", LLTrans::getString("CurrentlySetTo") + " " + LLTrans::getString("AnItemNotOnThisAccount")); } } else { - childSetValue("ao_nc_text","Not logged in"); + childSetValue("ao_nc_text", LLTrans::getString("NotLoggedIn")); } childSetAction("more_btn", onClickMore, this); childSetAction("less_btn", onClickLess, this); @@ -794,7 +795,7 @@ void LLFloaterAO::setCurrentStandId(const LLUUID& id) void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item) { gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString()); - sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName()); + sInstance->childSetValue("ao_nc_text", LLTrans::getString("CurrentlySetTo") + LLTrans::getString(":") + " " +item->getName()); } LLUUID LLFloaterAO::GetAnimID(const LLUUID& id) diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt index afb812699..ce8e013f0 100644 --- a/indra/newview/gpu_table.txt +++ b/indra/newview/gpu_table.txt @@ -1,96 +1,100 @@ -// +// // Categorizes graphics chips into various classes by name // // The table contains chip names regular expressions to match // against driver strings, a class number, and whether we claim // to support them or not. // +// Format: +// Fields are separated by one or more tab (not space) characters +// +// // Class Numbers: -// 0 - Defaults to low graphics settings. No shaders on by default -// 1 - Defaults to mid graphics settings. Basic shaders on by default -// 2 - Defaults to high graphics settings. Atmospherics on by default. +// 0 - Defaults to low graphics settings. No shaders on by default +// 1 - Defaults to mid graphics settings. Basic shaders on by default +// 2 - Defaults to high graphics settings. Atmospherics on by default. // 3 - Same as class 2 for now. // // Supported Number: // 0 - We claim to not support this card. // 1 - We claim to support this card. // -// Format: -// -// -3Dfx .*3Dfx.* 0 0 -3Dlabs .*3Dlabs.* 0 0 -ATI 3D-Analyze .*ATI.*3D-Analyze.* 0 0 -ATI All-in-Wonder 7500 .*ATI.*All-in-Wonder 75.* 0 1 -ATI All-in-Wonder 8500 .*ATI.*All-in-Wonder 85.* 0 1 -ATI All-in-Wonder 9200 .*ATI.*All-in-Wonder 92.* 0 1 -ATI All-in-Wonder 9xxx .*ATI.*All-in-Wonder 9.* 1 1 -ATI All-in-Wonder HD .*ATI.*All-in-Wonder HD.* 1 1 -ATI All-in-Wonder X600 .*ATI.*All-in-Wonder X6.* 1 1 -ATI All-in-Wonder X800 .*ATI.*All-in-Wonder X8.* 2 1 -ATI All-in-Wonder X1800 .*ATI.*All-in-Wonder X18.* 3 1 -ATI All-in-Wonder X1900 .*ATI.*All-in-Wonder X19.* 3 1 -ATI All-in-Wonder PCI-E .*ATI.*All-in-Wonder.*PCI-E.* 1 1 -ATI All-in-Wonder Radeon .*ATI.*All-in-Wonder Radeon.* 0 1 +3Dfx .*3Dfx.* 0 0 +3Dlabs .*3Dlabs.* 0 0 +ATI 3D-Analyze .*ATI.*3D-Analyze.* 0 0 +ATI All-in-Wonder 7500 .*ATI.*All-in-Wonder 75.* 0 1 +ATI All-in-Wonder 8500 .*ATI.*All-in-Wonder 85.* 0 1 +ATI All-in-Wonder 9200 .*ATI.*All-in-Wonder 92.* 0 1 +ATI All-in-Wonder 9xxx .*ATI.*All-in-Wonder 9.* 1 1 +ATI All-in-Wonder HD .*ATI.*All-in-Wonder HD.* 1 1 +ATI All-in-Wonder X600 .*ATI.*All-in-Wonder X6.* 1 1 +ATI All-in-Wonder X800 .*ATI.*All-in-Wonder X8.* 2 1 +ATI All-in-Wonder X1800 .*ATI.*All-in-Wonder X18.* 3 1 +ATI All-in-Wonder X1900 .*ATI.*All-in-Wonder X19.* 3 1 +ATI All-in-Wonder PCI-E .*ATI.*All-in-Wonder.*PCI-E.* 1 1 +ATI All-in-Wonder Radeon .*ATI.*All-in-Wonder Radeon.* 0 1 ATI ASUS ARES .*ATI.*ASUS.*ARES.* 3 1 -ATI ASUS A9xxx .*ATI.*ASUS.*A9.* 1 1 -ATI ASUS AH24xx .*ATI.*ASUS.*AH24.* 1 1 -ATI ASUS AH26xx .*ATI.*ASUS.*AH26.* 3 1 -ATI ASUS AH34xx .*ATI.*ASUS.*AH34.* 1 1 -ATI ASUS AH36xx .*ATI.*ASUS.*AH36.* 3 1 -ATI ASUS AH46xx .*ATI.*ASUS.*AH46.* 3 1 -ATI ASUS AX3xx .*ATI.*ASUS.*AX3.* 1 1 -ATI ASUS AX5xx .*ATI.*ASUS.*AX5.* 1 1 -ATI ASUS AX8xx .*ATI.*ASUS.*AX8.* 2 1 -ATI ASUS EAH24xx .*ATI.*ASUS.*EAH24.* 2 1 -ATI ASUS EAH26xx .*ATI.*ASUS.*EAH26.* 3 1 +ATI ASUS A9xxx .*ATI.*ASUS.*A9.* 1 1 +ATI ASUS AH24xx .*ATI.*ASUS.*AH24.* 1 1 +ATI ASUS AH26xx .*ATI.*ASUS.*AH26.* 3 1 +ATI ASUS AH34xx .*ATI.*ASUS.*AH34.* 1 1 +ATI ASUS AH36xx .*ATI.*ASUS.*AH36.* 3 1 +ATI ASUS AH46xx .*ATI.*ASUS.*AH46.* 3 1 +ATI ASUS AX3xx .*ATI.*ASUS.*AX3.* 1 1 +ATI ASUS AX5xx .*ATI.*ASUS.*AX5.* 1 1 +ATI ASUS AX8xx .*ATI.*ASUS.*AX8.* 2 1 +ATI ASUS EAH24xx .*ATI.*ASUS.*EAH24.* 2 1 +ATI ASUS EAH26xx .*ATI.*ASUS.*EAH26.* 3 1 ATI ASUS EAH29xx .*ATI.*ASUS.*EAH29.* 3 1 -ATI ASUS EAH34xx .*ATI.*ASUS.*EAH34.* 1 1 -ATI ASUS EAH36xx .*ATI.*ASUS.*EAH36.* 3 1 -ATI ASUS EAH38xx .*ATI.*ASUS.*EAH38.* 3 1 -ATI ASUS EAH43xx .*ATI.*ASUS.*EAH43.* 1 1 -ATI ASUS EAH45xx .*ATI.*ASUS.*EAH45.* 1 1 -ATI ASUS EAH48xx .*ATI.*ASUS.*EAH48.* 3 1 +ATI ASUS EAH34xx .*ATI.*ASUS.*EAH34.* 1 1 +ATI ASUS EAH36xx .*ATI.*ASUS.*EAH36.* 3 1 +ATI ASUS EAH38xx .*ATI.*ASUS.*EAH38.* 3 1 +ATI ASUS EAH43xx .*ATI.*ASUS.*EAH43.* 1 1 +ATI ASUS EAH45xx .*ATI.*ASUS.*EAH45.* 1 1 +ATI ASUS EAH48xx .*ATI.*ASUS.*EAH48.* 3 1 ATI ASUS EAH57xx .*ATI.*ASUS.*EAH57.* 3 1 ATI ASUS EAH58xx .*ATI.*ASUS.*EAH58.* 3 1 ATI ASUS EAH6xxx .*ATI.*ASUS.*EAH6.* 3 1 -ATI ASUS Radeon X1xxx .*ATI.*ASUS.*X1.* 3 1 +ATI ASUS Radeon X1xxx .*ATI.*ASUS.*X1.* 3 1 ATI Radeon X7xx .*ATI.*ASUS.*X7.* 1 1 -ATI Radeon X19xx .*ATI.*X19.* 3 1 -ATI Radeon X18xx .*ATI.*X18.* 3 1 -ATI Radeon X17xx .*ATI.*X17.* 2 1 -ATI Radeon X16xx .*ATI.*X16.* 2 1 -ATI Radeon X15xx .*ATI.*X15.* 2 1 -ATI Radeon X13xx .*ATI.*X13.* 1 1 -ATI Radeon X1xxx .*ATI.*X1.* 1 1 -ATI Radeon X2xxx .*ATI.*X2.* 1 1 -ATI Radeon X500 .*ATI.*X5.* 1 1 -ATI Display Adapter .*ATI.*display adapter.* 0 1 -ATI FireGL 5200 .*ATI.*FireGL V52.* 0 1 -ATI FireGL 5xxx .*ATI.*FireGL V5.* 1 1 +ATI Radeon X19xx .*ATI.*X19.* 3 1 +ATI Radeon X18xx .*ATI.*X18.* 3 1 +ATI Radeon X17xx .*ATI.*X17.* 2 1 +ATI Radeon X16xx .*ATI.*X16.* 2 1 +ATI Radeon X15xx .*ATI.*X15.* 2 1 +ATI Radeon X13xx .*ATI.*X13.* 1 1 +ATI Radeon X1xxx .*ATI.*X1.* 1 1 +ATI Radeon X2xxx .*ATI.*X2.* 1 1 +ATI Radeon X500 .*ATI.*X5.* 1 1 +ATI Display Adapter .*ATI.*display adapter.* 0 1 +ATI FireGL 5200 .*ATI.*FireGL V52.* 0 1 +ATI FireGL 5xxx .*ATI.*FireGL V5.* 1 1 ATI FireGL .*ATI.*Fire.*GL.* 0 1 ATI FirePro M3900 .*ATI.*FirePro.*M39.* 2 1 ATI FirePro M5800 .*ATI.*FirePro.*M58.* 3 1 ATI FirePro M7740 .*ATI.*FirePro.*M77.* 3 1 ATI FirePro M7820 .*ATI.*FirePro.*M78.* 3 1 ATI FireMV .*ATI.*FireMV.* 0 1 -ATI Generic .*ATI.*Generic.* 0 0 -ATI Hercules 9800 .*ATI.*Hercules.*9800.* 1 1 -ATI IGP 340M .*ATI.*IGP.*340M.* 0 0 -ATI M52 .*ATI.*M52.* 1 1 -ATI M54 .*ATI.*M54.* 1 1 -ATI M56 .*ATI.*M56.* 1 1 -ATI M71 .*ATI.*M71.* 1 1 -ATI M72 .*ATI.*M72.* 1 1 +ATI Geforce 9500 GT .*ATI.*Geforce 9500 *GT.* 2 1 +ATI Geforce 9600 GT .*ATI.*Geforce 9600 *GT.* 2 1 +ATI Geforce 9800 GT .*ATI.*Geforce 9800 *GT.* 2 1 +ATI Generic .*ATI.*Generic.* 0 0 +ATI Hercules 9800 .*ATI.*Hercules.*9800.* 1 1 +ATI IGP 340M .*ATI.*IGP.*340M.* 0 0 +ATI M52 .*ATI.*M52.* 1 1 +ATI M54 .*ATI.*M54.* 1 1 +ATI M56 .*ATI.*M56.* 1 1 +ATI M71 .*ATI.*M71.* 1 1 +ATI M72 .*ATI.*M72.* 1 1 ATI M76 .*ATI.*M76.* 3 1 ATI Radeon HD 64xx .*ATI.*AMD Radeon.* HD [67]4..[MG] 3 1 ATI Radeon HD 65xx .*ATI.*AMD Radeon.* HD [67]5..[MG] 3 1 ATI Radeon HD 66xx .*ATI.*AMD Radeon.* HD [67]6..[MG] 3 1 ATI Mobility Radeon 4100 .*ATI.*Mobility.*41.. 1 1 -ATI Mobility Radeon 7xxx .*ATI.*Mobility.*Radeon 7.* 0 1 -ATI Mobility Radeon 8xxx .*ATI.*Mobility.*Radeon 8.* 0 1 -ATI Mobility Radeon 9800 .*ATI.*Mobility.*98.* 1 1 +ATI Mobility Radeon 7xxx .*ATI.*Mobility.*Radeon 7.* 0 1 +ATI Mobility Radeon 8xxx .*ATI.*Mobility.*Radeon 8.* 0 1 +ATI Mobility Radeon 9800 .*ATI.*Mobility.*98.* 1 1 ATI Mobility Radeon 9700 .*ATI.*Mobility.*97.* 1 1 ATI Mobility Radeon 9600 .*ATI.*Mobility.*96.* 0 1 ATI Mobility Radeon HD 530v .*ATI.*Mobility.*HD *530v.* 1 1 @@ -99,8 +103,8 @@ ATI Mobility Radeon HD 545v .*ATI.*Mobility.*HD *545v.* 2 1 ATI Mobility Radeon HD 550v .*ATI.*Mobility.*HD *550v.* 2 1 ATI Mobility Radeon HD 560v .*ATI.*Mobility.*HD *560v.* 2 1 ATI Mobility Radeon HD 565v .*ATI.*Mobility.*HD *565v.* 2 1 -ATI Mobility Radeon HD 2300 .*ATI.*Mobility.*HD *23.* 1 1 -ATI Mobility Radeon HD 2400 .*ATI.*Mobility.*HD *24.* 1 1 +ATI Mobility Radeon HD 2300 .*ATI.*Mobility.*HD *23.* 2 1 +ATI Mobility Radeon HD 2400 .*ATI.*Mobility.*HD *24.* 2 1 ATI Mobility Radeon HD 2600 .*ATI.*Mobility.*HD *26.* 3 1 ATI Mobility Radeon HD 2700 .*ATI.*Mobility.*HD *27.* 3 1 ATI Mobility Radeon HD 3100 .*ATI.*Mobility.*HD *31.* 0 1 @@ -119,7 +123,7 @@ ATI Mobility Radeon HD 5400 .*ATI.*Mobility.*HD *54.* 3 1 ATI Mobility Radeon HD 5500 .*ATI.*Mobility.*HD *55.* 3 1 ATI Mobility Radeon HD 5600 .*ATI.*Mobility.*HD *56.* 3 1 ATI Mobility Radeon HD 5700 .*ATI.*Mobility.*HD *57.* 3 1 -ATI Mobility Radeon HD 5800 .*ATI.*Mobility *HD *58.* 3 1 +ATI Mobility Radeon HD 5800 .*ATI.*Mobility *HD *58.* 3 1 ATI Mobility Radeon HD 6200 .*ATI.*Mobility.*HD *62.* 3 1 ATI Mobility Radeon HD 6300 .*ATI.*Mobility.*HD *63.* 3 1 ATI Mobility Radeon HD 6400M .*ATI.*Mobility.*HD *64.* 3 1 @@ -134,30 +138,30 @@ ATI Mobility Radeon HD 7600M .*ATI.*Mobility.*HD *76.* 3 1 ATI Mobility Radeon HD 7700M .*ATI.*Mobility.*HD *77.* 3 1 ATI Mobility Radeon HD 7800M .*ATI.*Mobility.*HD *78.* 3 1 ATI Mobility Radeon HD 7900M .*ATI.*Mobility.*HD *79.* 3 1 -ATI Mobility Radeon X1xxx .*ATI.*Mobility.*X1.* 0 1 -ATI Mobility Radeon X2xxx .*ATI.*Mobility.*X2.* 0 1 -ATI Mobility Radeon X3xx .*ATI.*Mobility.*X3.* 1 1 -ATI Mobility Radeon X6xx .*ATI.*Mobility.*X6.* 1 1 -ATI Mobility Radeon X7xx .*ATI.*Mobility.*X7.* 1 1 -ATI Mobility Radeon Xxxx .*ATI.*Mobility.*X.* 0 1 -ATI Mobility Radeon .*ATI.*Mobility.* 0 1 -ATI Radeon HD 2300 .*ATI.*Radeon HD *23.. 0 1 -ATI Radeon HD 2400 .*ATI.*Radeon HD *24.. 1 1 +ATI Mobility Radeon X1xxx .*ATI.*Mobility.*X1.* 0 1 +ATI Mobility Radeon X2xxx .*ATI.*Mobility.*X2.* 0 1 +ATI Mobility Radeon X3xx .*ATI.*Mobility.*X3.* 1 1 +ATI Mobility Radeon X6xx .*ATI.*Mobility.*X6.* 1 1 +ATI Mobility Radeon X7xx .*ATI.*Mobility.*X7.* 1 1 +ATI Mobility Radeon Xxxx .*ATI.*Mobility.*X.* 0 1 +ATI Mobility Radeon .*ATI.*Mobility.* 0 1 +ATI Radeon HD 2300 .*ATI.*Radeon HD *23.. 2 1 +ATI Radeon HD 2400 .*ATI.*Radeon HD *24.. 2 1 ATI Radeon HD 2600 .*ATI.*Radeon HD *26.. 2 1 ATI Radeon HD 2900 .*ATI.*Radeon HD *29.. 3 1 ATI Radeon HD 3000 .*ATI.*Radeon HD *30.. 0 1 ATI Radeon HD 3100 .*ATI.*Radeon HD *31.. 1 1 ATI Radeon HD 3200 .*ATI.*Radeon HD *32.. 1 1 -ATI Radeon HD 3300 .*ATI.*Radeon HD *33.. 1 1 -ATI Radeon HD 3400 .*ATI.*Radeon HD *34.. 1 1 -ATI Radeon HD 3500 .*ATI.*Radeon HD *35.. 1 1 +ATI Radeon HD 3300 .*ATI.*Radeon HD *33.. 2 1 +ATI Radeon HD 3400 .*ATI.*Radeon HD *34.. 2 1 +ATI Radeon HD 3500 .*ATI.*Radeon HD *35.. 2 1 ATI Radeon HD 3600 .*ATI.*Radeon HD *36.. 3 1 ATI Radeon HD 3700 .*ATI.*Radeon HD *37.. 3 1 ATI Radeon HD 3800 .*ATI.*Radeon HD *38.. 3 1 ATI Radeon HD 4100 .*ATI.*Radeon HD *41.. 1 1 ATI Radeon HD 4200 .*ATI.*Radeon HD *42.. 1 1 -ATI Radeon HD 4300 .*ATI.*Radeon HD *43.. 1 1 -ATI Radeon HD 4400 .*ATI.*Radeon HD *44.. 1 1 +ATI Radeon HD 4300 .*ATI.*Radeon HD *43.. 2 1 +ATI Radeon HD 4400 .*ATI.*Radeon HD *44.. 2 1 ATI Radeon HD 4500 .*ATI.*Radeon HD *45.. 3 1 ATI Radeon HD 4600 .*ATI.*Radeon HD *46.. 3 1 ATI Radeon HD 4700 .*ATI.*Radeon HD *47.. 3 1 @@ -169,15 +173,16 @@ ATI Radeon HD 5700 .*ATI.*Radeon HD *57.. 3 1 ATI Radeon HD 5800 .*ATI.*Radeon HD *58.. 3 1 ATI Radeon HD 5900 .*ATI.*Radeon HD *59.. 3 1 ATI Radeon HD 6200 .*ATI.*Radeon HD *62.. 3 1 -ATI Radeon HD 6300M .*ATI.*Radeon.*HD.*6300M.* 3 1 +ATI Radeon HD 6300M .*ATI.*Radeon.*HD.*6300M.* 3 1 ATI Radeon HD 6300 .*ATI.*Radeon HD *63.. 3 1 ATI Radeon HD 6400 .*ATI.*Radeon HD *64.. 3 1 -ATI Radeon HD 6500M .*ATI.*Radeon.*HD.*6500M.* 3 1 +ATI Radeon HD 6500M .*ATI.*Radeon.*HD.*6500M.* 3 1 ATI Radeon HD 6500 .*ATI.*Radeon HD *65.. 3 1 ATI Radeon HD 6600 .*ATI.*Radeon HD *66.. 3 1 ATI Radeon HD 6700 .*ATI.*Radeon HD *67.. 3 1 ATI Radeon HD 6800 .*ATI.*Radeon HD *68.. 3 1 ATI Radeon HD 6900 .*ATI.*Radeon HD *69.. 3 1 +ATI Radeon HD 7300 .*ATI.*Radeon HD *73.. 3 1 ATI Radeon HD 7400 .*ATI.*Radeon HD *74.. 3 1 ATI Radeon HD 7500 .*ATI.*Radeon HD *75.. 3 1 ATI Radeon HD 7600 .*ATI.*Radeon HD *76.. 3 1 @@ -198,22 +203,22 @@ ATI Radeon 9500 .*ATI.*Radeon 95.. 0 1 ATI Radeon 9600 .*ATI.*Radeon 96.. 0 1 ATI Radeon 9700 .*ATI.*Radeon 97.. 1 1 ATI Radeon 9800 .*ATI.*Radeon 98.. 1 1 -ATI Radeon RV250 .*ATI.*RV250.* 0 1 -ATI Radeon RV600 .*ATI.*RV6.* 1 1 -ATI Radeon RX700 .*ATI.*RX70.* 1 1 -ATI Radeon RX800 .*ATI.*Radeon *RX80.* 2 1 +ATI Radeon RV250 .*ATI.*RV250.* 0 1 +ATI Radeon RV600 .*ATI.*RV6.* 1 1 +ATI Radeon RX700 .*ATI.*RX70.* 1 1 +ATI Radeon RX800 .*ATI.*Radeon *RX80.* 2 1 ATI RS880M .*ATI.*RS880M 1 1 -ATI Radeon RX9550 .*ATI.*RX9550.* 1 1 -ATI Radeon VE .*ATI.*Radeon.*VE.* 0 0 -ATI Radeon X1000 .*ATI.*Radeon *X10.* 0 1 -ATI Radeon X1200 .*ATI.*Radeon *X12.* 0 1 -ATI Radeon X1300 .*ATI.*Radeon *X13.* 1 1 -ATI Radeon X1400 .*ATI.*Radeon ?X14.* 1 1 -ATI Radeon X1500 .*ATI.*Radeon ?X15.* 1 1 -ATI Radeon X1600 .*ATI.*Radeon *X16.* 1 1 -ATI Radeon X1700 .*ATI.*Radeon ?X17.* 1 1 -ATI Radeon X1800 .*ATI.*Radeon ?X18.* 3 1 -ATI Radeon X1900 .*ATI.*Radeon ?X19.* 3 1 +ATI Radeon RX9550 .*ATI.*RX9550.* 1 1 +ATI Radeon VE .*ATI.*Radeon.*VE.* 0 0 +ATI Radeon X1000 .*ATI.*Radeon *X10.* 0 1 +ATI Radeon X1200 .*ATI.*Radeon *X12.* 0 1 +ATI Radeon X1300 .*ATI.*Radeon *X13.* 1 1 +ATI Radeon X1400 .*ATI.*Radeon ?X14.* 1 1 +ATI Radeon X1500 .*ATI.*Radeon ?X15.* 1 1 +ATI Radeon X1600 .*ATI.*Radeon *X16.* 1 1 +ATI Radeon X1700 .*ATI.*Radeon ?X17.* 1 1 +ATI Radeon X1800 .*ATI.*Radeon ?X18.* 3 1 +ATI Radeon X1900 .*ATI.*Radeon ?X19.* 3 1 ATI Radeon X300 .*ATI.*Radeon *X3.* 0 1 ATI Radeon X400 .*ATI.*Radeon ?X4.* 0 1 ATI Radeon X500 .*ATI.*Radeon ?X5.* 0 1 @@ -297,8 +302,11 @@ Intel Brookdale .*Intel.*Brookdale.* 0 0 Intel Cantiga .*Intel.*Cantiga.* 0 1 Intel Eaglelake .*Intel.*Eaglelake.* 0 1 Intel Graphics Media HD .*Intel.*Graphics Media.*HD.* 0 1 +Intel HD Graphics 2000 .*Intel.*HD Graphics 2000.* 1 1 +Intel HD Graphics 3000 .*Intel.*HD Graphics 3000.* 2 1 +Intel HD Graphics 4000 .*Intel.*HD Graphics 4000.* 2 1 Intel HD Graphics .*Intel.*HD Graphics.* 2 1 -Intel Mobile 4 Series .*Intel.*Mobile *4 Series.* 0 1 +Intel Mobile 4 Series .*Intel.*Mobile.* 4 Series.* 0 1 Intel Media Graphics HD .*Intel.*Media Graphics HD.* 0 1 Intel Montara .*Intel.*Montara.* 0 0 Intel Pineview .*Intel.*Pineview.* 0 1 @@ -314,6 +322,8 @@ NVIDIA 310 .*NVIDIA .*GeForce 310.* 3 1 NVIDIA 315M .*NVIDIA .*GeForce 315M.* 2 1 NVIDIA 315 .*NVIDIA .*GeForce 315.* 3 1 NVIDIA 320M .*NVIDIA .*GeForce 320M.* 2 1 +NVIDIA 605M .*NVIDIA .*GeForce 605M.* 2 1 +NVIDIA 610M .*NVIDIA .*GeForce 610M.* 2 1 NVIDIA G100M .*NVIDIA .*100M.* 0 1 NVIDIA G100 .*NVIDIA .*100.* 0 1 NVIDIA G102M .*NVIDIA .*102M.* 0 1 @@ -359,6 +369,10 @@ NVIDIA GT 530M .*NVIDIA .*GT *530(M)?.* 3 1 NVIDIA GT 540M .*NVIDIA .*GT *54.(M)?.* 3 1 NVIDIA GT 550M .*NVIDIA .*GT *550(M)?.* 3 1 NVIDIA GT 555M .*NVIDIA .*GT *555(M)?.* 3 1 +NVIDIA GT 620M .*NVIDIA .*GT *620(M)?.* 3 1 +NVIDIA GT 630M .*NVIDIA .*GT *630(M)?.* 3 1 +NVIDIA GT 635M .*NVIDIA .*GT *635(M)?.* 3 1 +NVIDIA GT 640M .*NVIDIA .*GT *640(M)?.* 3 1 NVIDIA GTS 160M .*NVIDIA .*GT(S)? *160(M)?.* 2 1 NVIDIA GTS 240 .*NVIDIA .*GTS *24.* 3 1 NVIDIA GTS 250 .*NVIDIA .*GTS *25.* 3 1 @@ -388,12 +402,20 @@ NVIDIA GTX 570 .*NVIDIA .*GTX *57.* 3 1 NVIDIA GTX 580M .*NVIDIA .*GTX *580M.* 3 1 NVIDIA GTX 580 .*NVIDIA .*GTX *58.* 3 1 NVIDIA GTX 590 .*NVIDIA .*GTX *59.* 3 1 +NVIDIA GTX 650 .*NVIDIA .*GTX *65.* 3 1 +NVIDIA GTX 660 .*NVIDIA .*GTX *66.* 3 1 +NVIDIA GTX 670M .*NVIDIA .*GTX *670M.* 3 1 +NVIDIA GTX 675M .*NVIDIA .*GTX *675M.* 3 1 +NVIDIA GTX 670 .*NVIDIA .*GTX *67.* 3 1 +NVIDIA GTX 680M .*NVIDIA .*GTX *680M.* 3 1 +NVIDIA GTX 680 .*NVIDIA .*GTX *68.* 3 1 +NVIDIA GTX 690 .*NVIDIA .*GTX *69.* 3 1 NVIDIA C51 .*NVIDIA .*C51.* 0 1 NVIDIA G72 .*NVIDIA .*G72.* 1 1 -NVIDIA G73 .*NVIDIA.*G73.* 1 1 +NVIDIA G73 .*NVIDIA .*G73.* 1 1 NVIDIA G84 .*NVIDIA .*G84.* 2 1 -NVIDIA G86 .*NVIDIA.*G86.* 3 1 -NVIDIA G92 .*NVIDIA.*G92.* 3 1 +NVIDIA G86 .*NVIDIA .*G86.* 3 1 +NVIDIA G92 .*NVIDIA .*G92.* 3 1 NVIDIA GeForce .*GeForce 256.* 0 0 NVIDIA GeForce 2 .*GeForce ?2 ?.* 0 1 NVIDIA GeForce 3 .*GeForce ?3 ?.* 0 1 @@ -404,80 +426,80 @@ NVIDIA GeForce 4 MX .*NVIDIA .*GeForce ?4 MX.* 0 1 NVIDIA GeForce 4 PCX .*NVIDIA .*GeForce ?4 PCX.* 0 1 NVIDIA GeForce 4 Ti .*NVIDIA .*GeForce ?4 Ti.* 0 1 NVIDIA GeForce 6100 .*NVIDIA .*GeForce 61.* 0 1 -NVIDIA GeForce 6200 .*NVIDIA.*GeForce 62.* 0 1 -NVIDIA GeForce 6500 .*NVIDIA.*GeForce 65.* 0 1 -NVIDIA GeForce 6600 .*NVIDIA.*GeForce 66.* 1 1 -NVIDIA GeForce 6700 .*NVIDIA.*GeForce 67.* 2 1 -NVIDIA GeForce 6800 .*NVIDIA.*GeForce 68.* 2 1 -NVIDIA GeForce 7000M .*NVIDIA.*GeForce 7000M.* 0 1 -NVIDIA GeForce 7100M .*NVIDIA.*GeForce 7100M.* 0 1 -NVIDIA GeForce 7000 .*NVIDIA.*GeForce 70.* 0 1 -NVIDIA GeForce 7100 .*NVIDIA.*GeForce 71.* 0 1 -NVIDIA GeForce 7200 .*NVIDIA.*GeForce 72.* 1 1 -NVIDIA GeForce 7300 .*NVIDIA.*GeForce 73.* 1 1 -NVIDIA GeForce 7500 .*NVIDIA.*GeForce 75.* 1 1 -NVIDIA GeForce 7600 .*NVIDIA.*GeForce 76.* 2 1 -NVIDIA GeForce 7800 .*NVIDIA.*GeForce.*78.* 2 1 -NVIDIA GeForce 7900 .*NVIDIA.*GeForce.*79.* 2 1 -NVIDIA GeForce 8100 .*NVIDIA.*GeForce 81.* 1 1 -NVIDIA GeForce 8200M .*NVIDIA.*GeForce 8200M.* 1 1 -NVIDIA GeForce 8200 .*NVIDIA.*GeForce 82.* 1 1 -NVIDIA GeForce 8300 .*NVIDIA.*GeForce 83.* 1 1 -NVIDIA GeForce 8400M .*NVIDIA.*GeForce 8400M.* 1 1 -NVIDIA GeForce 8400 .*NVIDIA.*GeForce 84.* 1 1 -NVIDIA GeForce 8500 .*GeForce 85.* 3 1 -NVIDIA GeForce 8600M .*NVIDIA.*GeForce.*8600M.* 1 1 -NVIDIA GeForce 8600 .*NVIDIA.*GeForce 86.* 3 1 -NVIDIA GeForce 8700M .*NVIDIA.*GeForce 8700M.* 3 1 -NVIDIA GeForce 8700 .*NVIDIA.*GeForce 87.* 3 1 -NVIDIA GeForce 8800 .*NVIDIA.*GeForce 88.* 3 1 -NVIDIA GeForce 8800M .*NVIDIA.*GeForce 8800M.* 3 1 -NVIDIA GeForce 9100M .*NVIDIA.*GeForce 9100M.* 0 1 -NVIDIA GeForce 9100 .*NVIDIA.*GeForce 91.* 0 1 -NVIDIA GeForce 9200M .*NVIDIA.*GeForce 9200M.* 1 1 -NVIDIA GeForce 9200 .*NVIDIA.*GeForce 92.* 1 1 -NVIDIA GeForce 9300M .*NVIDIA.*GeForce 9300M.* 1 1 -NVIDIA GeForce 9300 .*NVIDIA.*GeForce 93.* 1 1 -NVIDIA GeForce 9400M .*NVIDIA.*GeForce 9400M.* 1 1 -NVIDIA GeForce 9400 .*NVIDIA.*GeForce 94.* 1 1 -NVIDIA GeForce 9500 .*NVIDIA.*GeForce 95.* 2 1 -NVIDIA GeForce 9500M .*NVIDIA.*GeForce 9500M.* 2 1 -NVIDIA GeForce 9600 .*NVIDIA.*GeForce.*96.* 2 1 -NVIDIA GeForce 9600M .*NVIDIA.*GeForce 9600M.* 2 1 -NVIDIA GeForce 9700M .*NVIDIA.*GeForce 9700M.* 2 1 -NVIDIA GeForce 9800M .*NVIDIA.*GeForce 9800M.* 3 1 -NVIDIA GeForce 9800 .*NVIDIA.*GeForce.*98.* 3 1 -NVIDIA GeForce FX 5100 .*NVIDIA.*GeForce FX 51.* 0 1 -NVIDIA GeForce FX 5200 .*NVIDIA.*GeForce FX 52.* 0 1 -NVIDIA GeForce FX 5300 .*NVIDIA.*GeForce FX 53.* 0 1 -NVIDIA GeForce FX 5500 .*NVIDIA.*GeForce FX 55.* 0 1 -NVIDIA GeForce FX 5600 .*NVIDIA.*GeForce FX 56.* 0 1 -NVIDIA GeForce FX 5700 .*NVIDIA.*GeForce FX 57.* 1 1 -NVIDIA GeForce FX 5800 .*NVIDIA.*GeForce FX 58.* 1 1 -NVIDIA GeForce FX 5900 .*NVIDIA.*GeForce FX 59.* 1 1 -NVIDIA GeForce FX Go5100 .*NVIDIA.*GeForce FX Go51.* 0 1 -NVIDIA GeForce FX Go5200 .*NVIDIA.*GeForce FX Go52.* 0 1 -NVIDIA GeForce FX Go5300 .*NVIDIA.*GeForce FX Go53.* 0 1 -NVIDIA GeForce FX Go5500 .*NVIDIA.*GeForce FX Go55.* 0 1 -NVIDIA GeForce FX Go5600 .*NVIDIA.*GeForce FX Go56.* 0 1 -NVIDIA GeForce FX Go5700 .*NVIDIA.*GeForce FX Go57.* 1 1 -NVIDIA GeForce FX Go5800 .*NVIDIA.*GeForce FX Go58.* 1 1 +NVIDIA GeForce 6200 .*NVIDIA .*GeForce 62.* 0 1 +NVIDIA GeForce 6500 .*NVIDIA .*GeForce 65.* 0 1 +NVIDIA GeForce 6600 .*NVIDIA .*GeForce 66.* 1 1 +NVIDIA GeForce 6700 .*NVIDIA .*GeForce 67.* 2 1 +NVIDIA GeForce 6800 .*NVIDIA .*GeForce 68.* 2 1 +NVIDIA GeForce 7000M .*NVIDIA.*GeForce 7000M.* 0 1 +NVIDIA GeForce 7000 .*NVIDIA .*GeForce 70.* 0 1 +NVIDIA GeForce 7100M .*NVIDIA.*GeForce 7100M.* 0 1 +NVIDIA GeForce 7100 .*NVIDIA .*GeForce 71.* 0 1 +NVIDIA GeForce 7200 .*NVIDIA .*GeForce 72.* 1 1 +NVIDIA GeForce 7300 .*NVIDIA .*GeForce 73.* 1 1 +NVIDIA GeForce 7500 .*NVIDIA .*GeForce 75.* 1 1 +NVIDIA GeForce 7600 .*NVIDIA .*GeForce 76.* 2 1 +NVIDIA GeForce 7800 .*NVIDIA .*GeForce 78.* 2 1 +NVIDIA GeForce 7900 .*NVIDIA .*GeForce 79.* 2 1 +NVIDIA GeForce 8100 .*NVIDIA .*GeForce 81.* 1 1 +NVIDIA GeForce 8200M .*NVIDIA .*GeForce 8200M.* 1 1 +NVIDIA GeForce 8200 .*NVIDIA .*GeForce 82.* 1 1 +NVIDIA GeForce 8300 .*NVIDIA .*GeForce 83.* 2 1 +NVIDIA GeForce 8400M .*NVIDIA .*GeForce 8400M.* 2 1 +NVIDIA GeForce 8400 .*NVIDIA .*GeForce 84.* 2 1 +NVIDIA GeForce 8500 .*NVIDIA .*GeForce 85.* 3 1 +NVIDIA GeForce 8600M .*NVIDIA .*GeForce 8600M.* 2 1 +NVIDIA GeForce 8600 .*NVIDIA .*GeForce 86.* 3 1 +NVIDIA GeForce 8700M .*NVIDIA .*GeForce 8700M.* 3 1 +NVIDIA GeForce 8700 .*NVIDIA .*GeForce 87.* 3 1 +NVIDIA GeForce 8800M .*NVIDIA .*GeForce 8800M.* 3 1 +NVIDIA GeForce 8800 .*NVIDIA .*GeForce 88.* 3 1 +NVIDIA GeForce 9100M .*NVIDIA .*GeForce 9100M.* 0 1 +NVIDIA GeForce 9100 .*NVIDIA .*GeForce 91.* 0 1 +NVIDIA GeForce 9200M .*NVIDIA .*GeForce 9200M.* 1 1 +NVIDIA GeForce 9200 .*NVIDIA .*GeForce 92.* 1 1 +NVIDIA GeForce 9300M .*NVIDIA .*GeForce 9300M.* 2 1 +NVIDIA GeForce 9300 .*NVIDIA .*GeForce 93.* 2 1 +NVIDIA GeForce 9400M .*NVIDIA .*GeForce 9400M.* 2 1 +NVIDIA GeForce 9400 .*NVIDIA .*GeForce 94.* 2 1 +NVIDIA GeForce 9500M .*NVIDIA .*GeForce 9500M.* 2 1 +NVIDIA GeForce 9500 .*NVIDIA .*GeForce 95.* 2 1 +NVIDIA GeForce 9600M .*NVIDIA .*GeForce 9600M.* 3 1 +NVIDIA GeForce 9600 .*NVIDIA .*GeForce 96.* 2 1 +NVIDIA GeForce 9700M .*NVIDIA .*GeForce 9700M.* 2 1 +NVIDIA GeForce 9800M .*NVIDIA .*GeForce 9800M.* 3 1 +NVIDIA GeForce 9800 .*NVIDIA .*GeForce 98.* 3 1 +NVIDIA GeForce FX 5100 .*NVIDIA .*GeForce FX 51.* 0 1 +NVIDIA GeForce FX 5200 .*NVIDIA .*GeForce FX 52.* 0 1 +NVIDIA GeForce FX 5300 .*NVIDIA .*GeForce FX 53.* 0 1 +NVIDIA GeForce FX 5500 .*NVIDIA .*GeForce FX 55.* 0 1 +NVIDIA GeForce FX 5600 .*NVIDIA .*GeForce FX 56.* 0 1 +NVIDIA GeForce FX 5700 .*NVIDIA .*GeForce FX 57.* 1 1 +NVIDIA GeForce FX 5800 .*NVIDIA .*GeForce FX 58.* 1 1 +NVIDIA GeForce FX 5900 .*NVIDIA .*GeForce FX 59.* 1 1 +NVIDIA GeForce FX Go5100 .*NVIDIA .*GeForce FX Go51.* 0 1 +NVIDIA GeForce FX Go5200 .*NVIDIA .*GeForce FX Go52.* 0 1 +NVIDIA GeForce FX Go5300 .*NVIDIA .*GeForce FX Go53.* 0 1 +NVIDIA GeForce FX Go5500 .*NVIDIA .*GeForce FX Go55.* 0 1 +NVIDIA GeForce FX Go5600 .*NVIDIA .*GeForce FX Go56.* 0 1 +NVIDIA GeForce FX Go5700 .*NVIDIA .*GeForce FX Go57.* 1 1 +NVIDIA GeForce FX Go5800 .*NVIDIA .*GeForce FX Go58.* 1 1 NVIDIA GeForce FX Go5900 .*NVIDIA .*GeForce FX Go59.* 1 1 NVIDIA GeForce FX Go5xxx .*NVIDIA .*GeForce FX Go.* 0 1 -NVIDIA GeForce Go 6100 .*NVIDIA.*GeForce Go 61.* 0 1 -NVIDIA GeForce Go 6200 .*NVIDIA.*GeForce Go 62.* 0 1 -NVIDIA GeForce Go 6400 .*NVIDIA.*GeForce Go 64.* 1 1 -NVIDIA GeForce Go 6500 .*NVIDIA.*GeForce Go 65.* 1 1 -NVIDIA GeForce Go 6600 .*NVIDIA.*GeForce Go 66.* 1 1 -NVIDIA GeForce Go 6700 .*NVIDIA.*GeForce Go 67.* 1 1 -NVIDIA GeForce Go 6800 .*NVIDIA.*GeForce Go 68.* 1 1 +NVIDIA GeForce Go 6100 .*NVIDIA .*GeForce Go 61.* 0 1 +NVIDIA GeForce Go 6200 .*NVIDIA .*GeForce Go 62.* 0 1 +NVIDIA GeForce Go 6400 .*NVIDIA .*GeForce Go 64.* 1 1 +NVIDIA GeForce Go 6500 .*NVIDIA .*GeForce Go 65.* 1 1 +NVIDIA GeForce Go 6600 .*NVIDIA .*GeForce Go 66.* 1 1 +NVIDIA GeForce Go 6700 .*NVIDIA .*GeForce Go 67.* 1 1 +NVIDIA GeForce Go 6800 .*NVIDIA .*GeForce Go 68.* 1 1 NVIDIA GeForce Go 7200 .*NVIDIA .*GeForce Go 72.* 1 1 NVIDIA GeForce Go 7300 LE .*NVIDIA .*GeForce Go 73.*LE.* 0 1 NVIDIA GeForce Go 7300 .*NVIDIA .*GeForce Go 73.* 1 1 NVIDIA GeForce Go 7400 .*NVIDIA .*GeForce Go 74.* 1 1 NVIDIA GeForce Go 7600 .*NVIDIA .*GeForce Go 76.* 2 1 -NVIDIA GeForce Go 7700 .*NVIDIA.*GeForce Go 77.* 2 1 -NVIDIA GeForce Go 7800 .*NVIDIA.*GeForce Go 78.* 2 1 +NVIDIA GeForce Go 7700 .*NVIDIA .*GeForce Go 77.* 2 1 +NVIDIA GeForce Go 7800 .*NVIDIA .*GeForce Go 78.* 2 1 NVIDIA GeForce Go 7900 .*NVIDIA .*GeForce Go 79.* 2 1 NVIDIA D9M .*NVIDIA .*D9M.* 1 1 NVIDIA G94 .*NVIDIA .*G94.* 3 1 @@ -520,40 +542,43 @@ NVIDIA Quadro 6000 .*Quadro.*6000.* 3 1 NVIDIA Quadro 400 .*Quadro.*400.* 2 1 NVIDIA Quadro 600 .*Quadro.*600.* 2 1 NVIDIA Quadro4 .*Quadro4.* 0 1 -NVIDIA Quadro DCC .*Quadro DCC.* 0 1 +NVIDIA Quadro DCC .*Quadro DCC.* 0 1 NVIDIA Quadro CX .*Quadro.*CX.* 3 1 -NVIDIA Quadro FX 770 .*Quadro.*FX *770(M)?.* 2 1 -NVIDIA Quadro FX 880 .*Quadro.*FX *880(M)?.* 2 1 -NVIDIA Quadro FX 1400 .*Quadro.*FX.*1400(M)?.* 1 1 -NVIDIA Quadro FX 1500 .*Quadro.*FX.*1500(M)?.* 1 1 -NVIDIA Quadro FX 1600 .*Quadro.*FX *1600(M)?.* 2 1 -NVIDIA Quadro FX 1700 .*Quadro.*FX.*1700(M)?.* 2 1 -NVIDIA Quadro FX 1800 .*Quadro.*FX.*1800(M)?.* 2 1 -NVIDIA Quadro FX 3400 .*Quadro.*FX.*3400(M)?.* 1 1 -NVIDIA Quadro FX 3450 .*Quadro.*FX.*3450(M)?.* 1 1 -NVIDIA Quadro FX 3500 .*Quadro.*FX.*3500(M)?.* 1 1 -NVIDIA Quadro FX 3700 .*Quadro.*FX.*3700(M)?.* 2 1 -NVIDIA Quadro FX 3800 .*Quadro.*FX.*3800(M)?.* 2 1 -NVIDIA Quadro FX 370 .*Quadro.*FX.*370(M)?.* 2 1 -NVIDIA Quadro FX 380 .*Quadro.*FX.*380(M)?.* 2 1 -NVIDIA Quadro FX 4000 .*Quadro.*FX.*4000(M)?.* 1 1 -NVIDIA Quadro FX 4500 .*Quadro.*FX.*4500(M)?.* 1 1 -NVIDIA Quadro FX 4600 .*Quadro.*FX.*4600(M)?.* 2 1 -NVIDIA Quadro FX 4700 .*Quadro.*FX.*4700(M)?.* 2 1 -NVIDIA Quadro FX 4800 .*Quadro.*FX.*4800(M)?.* 2 1 -NVIDIA Quadro FX 470 .*Quadro.*FX.*470(M)?.* 3 1 -NVIDIA Quadro FX 5500 .*Quadro.*FX.*5500(M)?.* 1 1 -NVIDIA Quadro FX 5600 .*Quadro.*FX.*5600(M)?.* 2 1 -NVIDIA Quadro FX 5700 .*Quadro.*FX.*5700(M)?.* 2 1 -NVIDIA Quadro FX 5800 .*Quadro.*FX.*5800(M)?.* 2 1 -NVIDIA Quadro FX 540 .*Quadro.*FX.*540(M)?.* 3 1 -NVIDIA Quadro FX 550 .*Quadro.*FX.*550(M)?.* 3 1 -NVIDIA Quadro FX 560 .*Quadro.*FX.*560(M)?.* 3 1 -NVIDIA Quadro FX 570 .*Quadro.*FX.*570(M)?.* 3 1 -NVIDIA Quadro FX 580 .*Quadro.*FX.*580(M)?.* 3 1 -NVIDIA Quadro FX .*Quadro FX.* 1 1 -NVIDIA Quadro NVS 1xxM .*Quadro NVS *1.[05]M.* 0 1 -NVIDIA Quadro VX 200 .*Quadro VX.*200.* 2 1 +NVIDIA Quadro FX 770 .*Quadro.*FX *770(M)?.* 2 1 +NVIDIA Quadro FX 1400 .*Quadro.*FX.*1400(M)?.* 1 1 +NVIDIA Quadro FX 1500 .*Quadro.*FX *1500(M)?.* 1 1 +NVIDIA Quadro FX 1600 .*Quadro.*FX *1600(M)?.* 2 1 +NVIDIA Quadro FX 1700 .*Quadro.*FX.*1700(M)?.* 2 1 +NVIDIA Quadro FX 1800 .*Quadro.*FX.*1800(M)?.* 2 1 +NVIDIA Quadro FX 2500M .*Quadro.*FX *2500M.* 2 1 +NVIDIA Quadro FX 2700M .*Quadro.*FX *2700M.* 3 1 +NVIDIA Quadro FX 2800M .*Quadro.*FX *2800M.* 3 1 +NVIDIA Quadro FX 3400 .*Quadro.*FX.*3400(M)?.* 1 1 +NVIDIA Quadro FX 3450 .*Quadro.*FX.*3450(M)?.* 1 1 +NVIDIA Quadro FX 3500 .*Quadro.*FX *3500.* 2 1 +NVIDIA Quadro FX 3600 .*Quadro.*FX *3600.* 3 1 +NVIDIA Quadro FX 3700 .*Quadro.*FX *3700.* 3 1 +NVIDIA Quadro FX 3800 .*Quadro.*FX *3800.* 3 1 +NVIDIA Quadro FX 370 .*Quadro.*FX.*370(M)?.* 2 1 +NVIDIA Quadro FX 380 .*Quadro.*FX.*380(M)?.* 2 1 +NVIDIA Quadro FX 4000 .*Quadro.*FX.*4000(M)?.* 1 1 +NVIDIA Quadro FX 4500 .*Quadro.*FX *45.* 3 1 +NVIDIA Quadro FX 880 .*Quadro.*FX *880(M)?.* 3 1 +NVIDIA Quadro FX 4600 .*Quadro.*FX.*4600(M)?.* 2 1 +NVIDIA Quadro FX 4700 .*Quadro.*FX.*4700(M)?.* 2 1 +NVIDIA Quadro FX 4800 .*NVIDIA .*Quadro *FX *4800.* 3 1 +NVIDIA Quadro FX 470 .*Quadro.*FX.*470(M)?.* 3 1 +NVIDIA Quadro FX 5500 .*Quadro.*FX.*5500(M)?.* 1 1 +NVIDIA Quadro FX 5600 .*Quadro.*FX.*5600(M)?.* 2 1 +NVIDIA Quadro FX 5700 .*Quadro.*FX.*5700(M)?.* 2 1 +NVIDIA Quadro FX 5800 .*Quadro.*FX.*5800(M)?.* 2 1 +NVIDIA Quadro FX 540 .*Quadro.*FX.*540(M)?.* 3 1 +NVIDIA Quadro FX 550 .*Quadro.*FX.*550(M)?.* 3 1 +NVIDIA Quadro FX 560 .*Quadro.*FX.*560(M)?.* 3 1 +NVIDIA Quadro FX 570 .*Quadro.*FX.*570(M)?.* 3 1 +NVIDIA Quadro FX 580 .*Quadro.*FX.*580(M)?.* 3 1 +NVIDIA Quadro FX .*Quadro FX.* 1 1 +NVIDIA Quadro VX 200 .*Quadro VX.*200.* 2 1 NVIDIA Quadro NVS 1xxM .*Quadro NVS *1.[05]M.* 0 1 NVIDIA Quadro NVS 300M .*NVIDIA .*NVS *300M.* 2 1 NVIDIA Quadro NVS 320M .*NVIDIA .*NVS *320M.* 2 1 @@ -561,21 +586,22 @@ NVIDIA Quadro NVS 2100M .*NVIDIA .*NVS *2100M.* 2 1 NVIDIA Quadro NVS 3100M .*NVIDIA .*NVS *3100M.* 2 1 NVIDIA Quadro NVS 4200M .*NVIDIA .*NVS *4200M.* 2 1 NVIDIA Quadro NVS 5100M .*NVIDIA .*NVS *5100M.* 2 1 -NVIDIA Quadro 2000 .*Quadro.*2000.* 2 1 -NVIDIA Quadro 4000 .*Quadro.*4000.* 2 1 -NVIDIA Quadro 5000 .*Quadro.*5000.* 2 1 -NVIDIA Quadro 6000 .*Quadro.*6000.* 2 1 -NVIDIA Quadro 600 .*Quadro.*600.* 2 1 +NVIDIA Quadro NVS .*NVIDIA .*NVS 0 1 +NVIDIA Quadro 2000 .*Quadro.*2000.* 2 1 +NVIDIA Quadro 4000 .*Quadro.*4000.* 2 1 +NVIDIA Quadro 5000 .*Quadro.*5000.* 2 1 +NVIDIA Quadro 6000 .*Quadro.*6000.* 2 1 +NVIDIA Quadro 600 .*Quadro.*600.* 2 1 NVIDIA Quadro NVS .*(Quadro|NVIDIA) NVS.* 0 1 -NVIDIA RIVA TNT .*RIVA TNT.* 0 0 -NVIDIA PCI .*NVIDIA.*/PCI/SSE2 0 0 -S3 .*S3 Graphics.* 0 0 -SiS SiS.* 0 0 -Trident Trident.* 0 0 -Tungsten Graphics Tungsten.* 0 0 -XGI XGI.* 0 0 -VIA VIA.* 0 0 -Apple Generic Apple.*Generic.* 0 0 -Apple Software Renderer Apple.*Software Renderer.* 0 0 -Microsoft RemoteFX Graphics Device - WDDM Microsoft.*RemoteFX.* 0 0 +NVIDIA RIVA TNT .*RIVA TNT.* 0 0 +NVIDIA PCI .*NVIDIA.*/PCI/SSE2 0 0 +S3 .*S3 Graphics.* 0 0 +SiS SiS.* 0 0 +Trident Trident.* 0 0 +Tungsten Graphics Tungsten.* 0 0 +XGI XGI.* 0 0 +VIA VIA.* 0 0 +Apple Generic Apple.*Generic.* 0 0 +Apple Software Renderer Apple.*Software Renderer.* 0 0 +Microsoft RemoteFX Graphics Device - WDDM Microsoft.*RemoteFX.* 0 0 Humper Humper.* 0 1 diff --git a/indra/newview/importtracker.cpp b/indra/newview/importtracker.cpp index b926d7aac..ce2e6bb1e 100644 --- a/indra/newview/importtracker.cpp +++ b/indra/newview/importtracker.cpp @@ -203,7 +203,7 @@ void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical")); msg->addBOOLFast(_PREHASH_IsTemporary, gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary")); msg->addBOOLFast(_PREHASH_IsPhantom, gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") ); - msg->addBOOL("CastsShadows", true ); + msg->addBOOL("CastsShadows", false ); msg->sendReliable(gAgent.getRegion()->getHost()); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem")) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index d00b1f979..99b0e92f7 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -49,6 +49,7 @@ #include "llmoveview.h" #include "llchatbar.h" #include "llnotificationsutil.h" +#include "llpanelpathfindingrebakenavmesh.h" #include "llparcel.h" #include "llrendersphere.h" #include "llsdmessage.h" @@ -100,6 +101,8 @@ #include "llattachmentsmgr.h" // [/RLVa:KB] +#include "NACLantispam.h" // for NaCl Antispam Registry + using namespace LLVOAvatarDefines; const BOOL ANIMATE = TRUE; @@ -133,9 +136,6 @@ LLVector3 gReSitOffset; BOOL LLAgent::exlPhantom = 0; BOOL LLAgent::mForceTPose = 0; -LLVector3 LLAgent::exlStartMeasurePoint = LLVector3::zero; -LLVector3 LLAgent::exlEndMeasurePoint = LLVector3::zero; - const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; @@ -665,6 +665,10 @@ void LLAgent::setRegion(LLViewerRegion *regionp) << " located at " << ip << llendl; if (mRegionp) { + // NaCl - Antispam Registry + NACLAntiSpamRegistry::purgeAllQueues(); + // NaCl End + // We've changed regions, we're now going to change our agent coordinate frame. mAgentOriginGlobal = regionp->getOriginGlobal(); LLVector3d agent_offset_global = mRegionp->getOriginGlobal(); @@ -1871,6 +1875,8 @@ void LLAgent::endAnimationUpdateUI() gMenuBarView->setVisible(TRUE); gStatusBar->setVisibleForMouselook(true); + LLPanelPathfindingRebakeNavmesh::getInstance()->setVisible(TRUE); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); @@ -1959,6 +1965,7 @@ void LLAgent::endAnimationUpdateUI() // hide menus gMenuBarView->setVisible(FALSE); gStatusBar->setVisibleForMouselook(false); + LLPanelPathfindingRebakeNavmesh::getInstance()->setVisible(FALSE); // clear out camera lag effect gAgentCamera.clearCameraLag(); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index bdb616695..82513766e 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -255,9 +255,6 @@ public: SHLureRequest *mPendingLure; void showLureDestination(const std::string fromname, const int global_x, const int global_y, const int x, const int y, const int z, const std::string maturity); void onFoundLureDestination(LLSimInfo *siminfo = NULL); - - static LLVector3 exlStartMeasurePoint; - static LLVector3 exlEndMeasurePoint; // private: diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f4153efae..2fcf37fdb 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -82,6 +82,7 @@ #include "llvector4a.h" #include "llfont.h" #include "llvocache.h" +#include "llvopartgroup.h" #include "llfloaterteleporthistory.h" #include "llweb.h" @@ -215,11 +216,6 @@ ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor // -#if LL_WINDOWS && LL_LCD_COMPILE - #include "lllcd.h" -#endif - - //---------------------------------------------------------------------------- // viewer.cpp - these are only used in viewer, should be easily moved. @@ -601,6 +597,10 @@ bool LLAppViewer::init() // initialize SSE options LLVector4a::initClass(); + + //initialize particle index pool + LLVOPartGroup::initClass(); + // Need to do this initialization before we do anything else, since anything // that touches files should really go through the lldir API gDirUtilp->initAppDirs("SecondLife"); @@ -806,13 +806,6 @@ bool LLAppViewer::init() // call all self-registered classes LLInitClassList::instance().fireCallbacks(); -#if LL_LCD_COMPILE - // start up an LCD window on a logitech keyboard, if there is one - HINSTANCE hInstance = GetModuleHandle(NULL); - gLcdScreen = new LLLCD(hInstance); - CreateLCDDebugWindows(); -#endif - LLFolderViewItem::initClass(); // SJB: Needs to happen after initWindow(), not sure why but related to fonts gGLManager.getGLInfo(gDebugInfo); @@ -1194,11 +1187,6 @@ bool LLAppViewer::mainLoop() pingMainloopTimeout("Main:Snapshot"); LLFloaterSnapshot::update(); // take snapshots gGLActive = FALSE; -#if LL_LCD_COMPILE - // update LCD Screen - pingMainloopTimeout("Main:LCD"); - gLcdScreen->UpdateDisplay(); -#endif } } @@ -1566,12 +1554,6 @@ bool LLAppViewer::cleanup() // gDXHardware.cleanup(); //#endif // LL_WINDOWS -#if LL_LCD_COMPILE - // shut down the LCD window on a logitech keyboard, if there is one - delete gLcdScreen; - gLcdScreen = NULL; -#endif - LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager(); if (!volume_manager->cleanup()) { @@ -1674,6 +1656,8 @@ bool LLAppViewer::cleanup() writeDebugInfo(); + if(!gDirUtilp->getLindenUserDir(true).empty()) + LLViewerMedia::saveCookieFile(); // Stop the plugin read thread if it's running. LLPluginProcessParent::setUseReadThread(false); diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index c34fee56b..12e26b1c4 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -165,6 +165,9 @@ BOOL LLChatBar::postBuild() mInputEditor->setEnableLineHistory(TRUE); } + mHistoryBtn.connect(this,"History"); + mSayBtn.connect(this,"Say"); + mIsBuilt = TRUE; return TRUE; @@ -228,9 +231,9 @@ void LLChatBar::refresh() gAgent.stopTyping(); } - childSetValue("History", LLFloaterChat::instanceVisible(LLSD())); + mHistoryBtn->setValue(LLFloaterChat::instanceVisible(LLSD())); - childSetEnabled("Say", mInputEditor->getText().size() > 0); + mSayBtn->setEnabled(mInputEditor->getText().size() > 0); //childSetEnabled("Shout", mInputEditor->getText().size() > 0); createDummyWidget Making Dummy -HgB } diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index c4fed67d9..5e0391d08 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -110,6 +110,9 @@ protected: LLComboBox* mGestureCombo; LLChatBarGestureObserver* mObserver; + + CachedUICtrl mHistoryBtn; + CachedUICtrl mSayBtn; }; extern LLChatBar *gChatBar; diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 97831b4b2..5cf8b7fdc 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -61,6 +61,7 @@ #include "llfloaterchat.h" #include "llviewerstats.h" #include "lluictrlfactory.h" +#include "lltrans.h" #include "llselectmgr.h" @@ -68,16 +69,6 @@ /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -// *TODO:Translate -const std::string COMPILE_QUEUE_TITLE("Recompilation Progress"); -const std::string COMPILE_START_STRING("recompile"); -const std::string RESET_QUEUE_TITLE("Reset Progress"); -const std::string RESET_START_STRING("reset"); -const std::string RUN_QUEUE_TITLE("Set Running Progress"); -const std::string RUN_START_STRING("set running"); -const std::string NOT_RUN_QUEUE_TITLE("Set Not Running Progress"); -const std::string NOT_RUN_START_STRING("set not running"); - struct LLScriptQueueData { LLUUID mQueueID; @@ -211,8 +202,11 @@ BOOL LLFloaterScriptQueue::start() n_objects = selectHandle->getRootObjectCount(); } - buffer = llformat("Starting %s of %d items.", mStartString.c_str(), n_objects); // *TODO: Translate - + LLStringUtil::format_map_t args; + args["[START]"] = mStartString; + args["[COUNT]"] = llformat ("%d", mObjectIDs.count()); + buffer = getString ("Starting", args); + LLScrollListCtrl* list = getChild("queue output"); list->addCommentText(buffer); @@ -250,8 +244,7 @@ BOOL LLFloaterScriptQueue::nextObject() LLScrollListCtrl* list = getChild("queue output"); mDone = TRUE; - std::string buffer = "Done."; // *TODO: Translate - list->addCommentText(buffer); + list->addCommentText(getString("Done")); childSetEnabled("close",TRUE); } return successful_start; @@ -346,7 +339,7 @@ LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono) } LLFloaterCompileQueue::LLFloaterCompileQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, COMPILE_QUEUE_TITLE, COMPILE_START_STRING) +: LLFloaterScriptQueue(name, rect, LLTrans::getString("CompileQueueTitle"), LLTrans::getString("CompileQueueStart")) { } LLFloaterCompileQueue::~LLFloaterCompileQueue() @@ -454,7 +447,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, else { // It's now in the file, now compile it. - buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate + buffer = LLTrans::getString("CompileQueueDownloadedCompiling") + (": ") + data->mScriptName; // Write script to local file for compilation. LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ @@ -493,19 +486,21 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { - LLChat chat(std::string("Script not found on server.")); // *TODO: Translate + LLChat chat(LLTrans::getString("CompileQueueScriptNotFound")); LLFloaterChat::addChat(chat); - buffer = std::string("Problem downloading: ") + data->mScriptName; // *TODO: Translate + + buffer = LLTrans::getString("CompileQueueProblemDownloading") + LLTrans::getString(":") + " " + data->mScriptName; } else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) { - LLChat chat(std::string("Insufficient permissions to download a script.")); // *TODO: Translate + LLChat chat(LLTrans::getString("CompileQueueInsufficientPermDownload")); LLFloaterChat::addChat(chat); - buffer = std::string("Insufficient permissions for: ") + data->mScriptName; // *TODO: Translate + + buffer = LLTrans::getString("CompileQueueInsufficientPermFor") + LLTrans::getString(":") + " " + data->mScriptName; } else { - buffer = std::string("Unknown failure to download ") + data->mScriptName; // *TODO: Translate + buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mScriptName; } llwarns << "Problem downloading script asset." << llendl; @@ -671,7 +666,7 @@ LLFloaterResetQueue* LLFloaterResetQueue::create() } LLFloaterResetQueue::LLFloaterResetQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, RESET_QUEUE_TITLE, RESET_START_STRING) +: LLFloaterScriptQueue(name, rect, LLTrans::getString("ResetQueueTitle"), LLTrans::getString("ResetQueueStart")) { } LLFloaterResetQueue::~LLFloaterResetQueue() @@ -698,7 +693,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild("queue output"); std::string buffer; - buffer = std::string("Resetting: ") + item->getName(); // *TODO: Translate + buffer = getString("Resetting") + LLTrans::getString(":") + " " + item->getName(); list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ScriptReset); @@ -733,7 +728,7 @@ LLFloaterRunQueue* LLFloaterRunQueue::create() } LLFloaterRunQueue::LLFloaterRunQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, RUN_QUEUE_TITLE, RUN_START_STRING) +: LLFloaterScriptQueue(name, rect, LLTrans::getString("RunQueueTitle"), LLTrans::getString("RunQueueStart")) { } LLFloaterRunQueue::~LLFloaterRunQueue() @@ -741,7 +736,7 @@ LLFloaterRunQueue::~LLFloaterRunQueue() } void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv) + LLInventoryObject::object_list_t* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. @@ -760,7 +755,7 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild("queue output"); std::string buffer; - buffer = std::string("Running: ") + item->getName(); // *TODO: Translate + buffer = getString("Running") + LLTrans::getString(":") + " " + item->getName(); list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; @@ -797,7 +792,7 @@ LLFloaterNotRunQueue* LLFloaterNotRunQueue::create() } LLFloaterNotRunQueue::LLFloaterNotRunQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, NOT_RUN_QUEUE_TITLE, NOT_RUN_START_STRING) +: LLFloaterScriptQueue(name, rect, LLTrans::getString("NotRunQueueTitle"), LLTrans::getString("NotRunQueueStart")) { } LLFloaterNotRunQueue::~LLFloaterNotRunQueue() @@ -824,7 +819,7 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild("queue output"); std::string buffer; - buffer = std::string("Not running: ") +item->getName(); // *TODO: Translate + buffer = getString("NotRunning") + LLTrans::getString(":") + " " + item->getName(); list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index b9df32f06..97b9764ab 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -113,6 +113,7 @@ void LLDrawable::init() mGeneration = -1; mBinRadius = 1.f; + mBinIndex = -1; mSpatialBridge = NULL; } @@ -790,19 +791,7 @@ void LLDrawable::updateTexture() if (getVOVolume()) { - /*if (isActive()) - { - if (isRoot()) - { - mQuietCount = 0; - } - else - { - getParent()->mQuietCount = 0; - } - }*/ - - getVOVolume()->mFaceMappingChanged = TRUE; + //getVOVolume()->mFaceMappingChanged = TRUE; gPipeline.markRebuild(this, LLDrawable::REBUILD_MATERIAL, TRUE); } } @@ -963,6 +952,12 @@ void LLDrawable::updateUVMinMax() { } +LLSpatialGroup* LLDrawable::getSpatialGroup() const +{ + llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1); + return mSpatialGroupp; +} + void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) { /*if (mSpatialGroupp && (groupp != mSpatialGroupp)) @@ -985,6 +980,8 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) } mSpatialGroupp = groupp; + + llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1); } LLSpatialPartition* LLDrawable::getSpatialPartition() @@ -1107,6 +1104,8 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat mDrawable = root; root->setSpatialBridge(this); + mBinIndex = -1; + mRenderType = mDrawable->mRenderType; mDrawableType = mDrawable->mRenderType; @@ -1500,7 +1499,13 @@ void LLSpatialBridge::cleanupReferences() LLDrawable::cleanupReferences(); if (mDrawable) { - mDrawable->setSpatialGroup(NULL); + LLSpatialGroup* group = mDrawable->getSpatialGroup(); + if (group) + { + group->mOctreeNode->remove(mDrawable); + mDrawable->setSpatialGroup(NULL); + } + if (mDrawable->getVObj()) { LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); @@ -1511,7 +1516,12 @@ void LLSpatialBridge::cleanupReferences() LLDrawable* drawable = child->mDrawable; if (drawable) { - drawable->setSpatialGroup(NULL); + LLSpatialGroup* group = drawable->getSpatialGroup(); + if (group) + { + group->mOctreeNode->remove(drawable); + drawable->setSpatialGroup(NULL); + } } } } diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 6f07c82be..bd2d23c5f 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -115,6 +115,9 @@ public: F32 getIntensity() const { return llmin(mXform.getScale().mV[0], 4.f); } S32 getLOD() const { return mVObjp ? mVObjp->getLOD() : 1; } F32 getBinRadius() const { return mBinRadius; } + S32 getBinIndex() const { return mBinIndex; } + void setBinIndex(S32 index) const { mBinIndex = index; } + void getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); } LLXformMatrix* getXform() { return &mXform; } @@ -200,7 +203,7 @@ public: S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators... void setSpatialGroup(LLSpatialGroup *groupp); - LLSpatialGroup *getSpatialGroup() const { return mSpatialGroupp; } + LLSpatialGroup *getSpatialGroup() const; LLSpatialPartition* getSpatialPartition(); // Statics @@ -321,6 +324,7 @@ private: mutable U32 mVisible; F32 mRadius; F32 mBinRadius; + mutable S32 mBinIndex; S32 mGeneration; LLVector3 mCurrentScale; diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 968ed740a..69a3cf419 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -446,7 +446,7 @@ void LLRenderPass::renderTexture(U32 type, U32 mask) void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) { - for (LLCullResult::drawinfo_list_t::iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) + for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) { LLDrawInfo* pparams = *i; if (pparams) diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 500f8b67a..865e89f89 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -355,7 +355,7 @@ void LLDrawPoolAlpha::render(S32 pass) void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask) { - for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) + for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) { LLSpatialGroup* group = *i; if (group->mSpatialPartition->mRenderByGroup && @@ -392,7 +392,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) BOOL use_shaders = gPipeline.canUseVertexShaders(); - for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) + for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) { LLSpatialGroup* group = *i; llassert(group); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index a37f117c4..3e818faa4 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1203,15 +1203,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) if (pass >= 7 && pass < 9) { - LLGLEnable blend(GL_BLEND); - - gGL.setColorMask(true, true); - gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, - LLRender::BF_ONE_MINUS_SOURCE_ALPHA, - LLRender::BF_ZERO, - LLRender::BF_ONE_MINUS_SOURCE_ALPHA); - - if (pass == 7) { renderRiggedAlpha(avatarp); @@ -1227,20 +1218,8 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) if (pass == 9) { - LLGLEnable blend(GL_BLEND); - LLGLDisable test(GL_ALPHA_TEST); - gGL.flush(); - - LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(-1.0f, -1.0f); - gGL.setSceneBlendType(LLRender::BT_ADD); - - LLGLDepthTest depth(GL_TRUE, GL_FALSE); - gGL.setColorMask(false, true); - renderRiggedGlow(avatarp); - gGL.setColorMask(true, false); - gGL.setSceneBlendType(LLRender::BT_ALPHA); + return; } @@ -1640,17 +1619,56 @@ void LLDrawPoolAvatar::renderRiggedFullbrightShiny(LLVOAvatar* avatar) void LLDrawPoolAvatar::renderRiggedAlpha(LLVOAvatar* avatar) { - renderRigged(avatar, RIGGED_ALPHA); + if (!mRiggedFace[RIGGED_ALPHA].empty()) + { + LLGLEnable blend(GL_BLEND); + + gGL.setColorMask(true, true); + gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, + LLRender::BF_ONE_MINUS_SOURCE_ALPHA, + LLRender::BF_ZERO, + LLRender::BF_ONE_MINUS_SOURCE_ALPHA); + + renderRigged(avatar, RIGGED_ALPHA); + } } void LLDrawPoolAvatar::renderRiggedFullbrightAlpha(LLVOAvatar* avatar) { - renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA); + if (!mRiggedFace[RIGGED_FULLBRIGHT_ALPHA].empty()) + { + LLGLEnable blend(GL_BLEND); + + gGL.setColorMask(true, true); + gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, + LLRender::BF_ONE_MINUS_SOURCE_ALPHA, + LLRender::BF_ZERO, + LLRender::BF_ONE_MINUS_SOURCE_ALPHA); + + renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA); + } } void LLDrawPoolAvatar::renderRiggedGlow(LLVOAvatar* avatar) { - renderRigged(avatar, RIGGED_GLOW, true); + if (!mRiggedFace[RIGGED_GLOW].empty()) + { + LLGLEnable blend(GL_BLEND); + LLGLDisable test(GL_ALPHA_TEST); + gGL.flush(); + + LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(-1.0f, -1.0f); + gGL.setSceneBlendType(LLRender::BT_ADD); + + LLGLDepthTest depth(GL_TRUE, GL_FALSE); + gGL.setColorMask(false, true); + + renderRigged(avatar, RIGGED_GLOW, true); + + gGL.setColorMask(true, false); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + } } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 65ab71abc..60af91ac8 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -848,12 +848,12 @@ void LLDrawPoolBump::renderDeferred(S32 pass) LLFastTimer ftm(FTM_RENDER_BUMP); U32 type = LLRenderPass::PASS_BUMP; - LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); - LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); + LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); + LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; - for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i) + for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { LLDrawInfo& params = **i; @@ -1449,10 +1449,10 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI void LLDrawPoolBump::renderBump(U32 type, U32 mask) { - LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); - LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); + LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); + LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); - for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i) + for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { LLDrawInfo& params = **i; diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 93c437d2d..a1cba861c 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -155,6 +155,7 @@ LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) : mAvatarp(avatarp), mWearablep(NULL) { + mDefaultVec.clear(); } LLDriverParam::LLDriverParam(LLWearable *wearablep) : @@ -162,6 +163,7 @@ LLDriverParam::LLDriverParam(LLWearable *wearablep) : mAvatarp(NULL), mWearablep(wearablep) { + mDefaultVec.clear(); } LLDriverParam::~LLDriverParam() @@ -341,18 +343,19 @@ F32 LLDriverParam::getTotalDistortion() return sum; } -const LLVector3 &LLDriverParam::getAvgDistortion() +const LLVector4a &LLDriverParam::getAvgDistortion() { // It's not actually correct to take the average of averages, but it good enough here. - LLVector3 sum; + LLVector4a sum; + sum.clear(); S32 count = 0; for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) { LLDrivenEntry* driven = &(*iter); - sum += driven->mParam->getAvgDistortion(); + sum.add(driven->mParam->getAvgDistortion()); count++; } - sum /= (F32)count; + sum.mul( 1.f/(F32)count); mDefaultVec = sum; return mDefaultVec; @@ -375,21 +378,22 @@ F32 LLDriverParam::getMaxDistortion() } -LLVector3 LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) +LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { - LLVector3 sum; + LLVector4a sum; + sum.clear(); for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) { LLDrivenEntry* driven = &(*iter); - sum += driven->mParam->getVertexDistortion( index, poly_mesh ); + sum.add(driven->mParam->getVertexDistortion( index, poly_mesh )); } return sum; } -const LLVector3* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { mCurrentDistortionParam = NULL; - const LLVector3* v = NULL; + const LLVector4a* v = NULL; for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) { LLDrivenEntry* driven = &(*iter); @@ -404,7 +408,7 @@ const LLVector3* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly return v; }; -const LLVector3* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { llassert( mCurrentDistortionParam ); if( !mCurrentDistortionParam ) @@ -432,7 +436,7 @@ const LLVector3* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_ } // We're already in the middle of a param's distortions, so get the next one. - const LLVector3* v = driven->mParam->getNextDistortion( index, poly_mesh ); + const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh ); if( (!v) && (iter != mDriven.end()) ) { // This param is finished, so start the next param. It might not have any diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h index fb1b44458..7a4d711d4 100644 --- a/indra/newview/lldriverparam.h +++ b/indra/newview/lldriverparam.h @@ -105,18 +105,18 @@ public: // LLViewerVisualParam Virtual functions /*virtual*/ F32 getTotalDistortion(); - /*virtual*/ const LLVector3& getAvgDistortion(); + /*virtual*/ const LLVector4a& getAvgDistortion(); /*virtual*/ F32 getMaxDistortion(); - /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); - /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); - /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); + /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); protected: F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight); void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake); - LLVector3 mDefaultVec; // temp holder + LLVector4a mDefaultVec; // temp holder typedef std::vector entry_list_t; entry_list_t mDriven; LLViewerVisualParam* mCurrentDistortionParam; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index e52bb5959..ba818ed90 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -169,19 +169,10 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) mGeomCount = 0; mGeomIndex = 0; mIndicesCount = 0; - if (drawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || - drawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES -#if ENABLE_CLASSIC_CLOUDS - || drawablep->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS -#endif - ) - { //indicate to LLParticlePartition that this particle is uninitialized - mIndicesIndex = 0xFFFFFFFF; - } - else - { - mIndicesIndex = 0; - } + + //special value to indicate uninitialized position + mIndicesIndex = 0xFFFFFFFF; + mIndexInTex = 0; mTexture = NULL; mTEOffset = -1; @@ -214,17 +205,10 @@ void LLFace::destroy() mTexture->removeFace(this) ; } - if (mDrawablep.notNull() && - (mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || - mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES -#if ENABLE_CLASSIC_CLOUDS - || mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS -#endif - ) && - mIndicesIndex != 0xFFFFFFFF) + if (isState(LLFace::PARTICLE)) { LLVOPartGroup::freeVBSlot(getGeomIndex()/4); - mIndicesIndex = 0xFFFFFFFF; + clearState(LLFace::PARTICLE); } if (mDrawPoolp) @@ -335,7 +319,20 @@ void LLFace::setTexture(LLViewerTexture* tex) void LLFace::dirtyTexture() { - gPipeline.markTextured(getDrawable()); + LLDrawable* drawablep = getDrawable(); + + if (mVObjp.notNull() && mVObjp->getVolume() && + mTexture.notNull() && mTexture->getComponents() == 4) + { //dirty texture on an alpha object should be treated as an LoD update + LLVOVolume* vobj = drawablep->getVOVolume(); + if (vobj) + { + vobj->mLODChanged = TRUE; + } + gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME, FALSE); + } + + gPipeline.markTextured(drawablep); } void LLFace::switchTexture(LLViewerTexture* new_texture) @@ -1209,19 +1206,25 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices()) { - llwarns << "Index buffer overflow!" << llendl; - llwarns << "Indices Count: " << mIndicesCount - << " VF Num Indices: " << num_indices - << " Indices Index: " << mIndicesIndex - << " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl; - llwarns << " Face Index: " << f - << " Pool Type: " << mPoolType << llendl; + if (gDebugGL) + { + llwarns << "Index buffer overflow!" << llendl; + llwarns << "Indices Count: " << mIndicesCount + << " VF Num Indices: " << num_indices + << " Indices Index: " << mIndicesIndex + << " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl; + llwarns << " Face Index: " << f + << " Pool Type: " << mPoolType << llendl; + } return FALSE; } if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts()) { - llwarns << "Vertex buffer overflow!" << llendl; + if (gDebugGL) + { + llwarns << "Vertex buffer overflow!" << llendl; + } return FALSE; } } @@ -1632,7 +1635,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (!do_xform) { LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM); - LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32)); + S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; + LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, tc_size); } else { @@ -1853,15 +1857,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a texIdx; - U8 index = mTextureIndex < 255 ? mTextureIndex : 0; + S32 index = mTextureIndex < 255 ? mTextureIndex : 0; F32 val = 0.f; - U8* vp = (U8*) &val; - vp[0] = index; - vp[1] = 0; - vp[2] = 0; - vp[3] = 0; - + S32* vp = (S32*) &val; + *vp = index; + llassert(index <= LLGLSLShader::sIndexedTextureChannels-1); LLVector4Logical mask; diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 5513ecd41..4cab49205 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -84,6 +84,7 @@ public: USE_FACE_COLOR = 0x0010, TEXTURE_ANIM = 0x0020, RIGGED = 0x0040, + PARTICLE = 0x0080, }; static void initClass(); diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 11edb6071..8b0fd109f 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -255,50 +255,28 @@ void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, cons { } -//--------------------------------------------------------------------------------- -// This calculates the physics of the flexible object. Note that it has to be 0 -// updated every time step. In the future, perhaps there could be an -// optimization similar to what Havok does for objects that are stationary. -//--------------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_FLEXIBLE_UPDATE("Update Flexies"); -BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) + +void LLVolumeImplFlexible::updateRenderRes() { - if (mVO->mDrawable.isNull()) - { - // Don't do anything until we have a drawable - return FALSE; // (we are not initialized or updated) - } + LLDrawable* drawablep = mVO->mDrawable; - BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE; - - //flexible objects never go static - mVO->mDrawable->mQuietCount = 0; - if (!mVO->mDrawable->isRoot()) - { - LLViewerObject* parent = (LLViewerObject*) mVO->getParent(); - parent->mDrawable->mQuietCount = 0; - } - - LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); - S32 new_res = mAttributes->getSimulateLOD(); - //number of segments only cares about z axis - F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, mVO->mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); +#if 1 //optimal approximation of previous behavior that doesn't rely on atan2 + F32 app_angle = mVO->getScale().mV[2]/drawablep->mDistanceWRTCamera; // Rendering sections increases with visible angle on the screen + mRenderRes = (S32) (12.f*app_angle); +#else //legacy behavior + //number of segments only cares about z axis + F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); + + // Rendering sections increases with visible angle on the screen mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView()); - if (mRenderRes > FLEXIBLE_OBJECT_MAX_SECTIONS) - { - mRenderRes = FLEXIBLE_OBJECT_MAX_SECTIONS; - } - - - // Bottom cap at 1/4 the original number of sections - if (mRenderRes < mAttributes->getSimulateLOD()-1) - { - mRenderRes = mAttributes->getSimulateLOD()-1; - } +#endif + + mRenderRes = llclamp(mRenderRes, new_res-1, (S32) FLEXIBLE_OBJECT_MAX_SECTIONS); + // Throttle back simulation of segments we're not rendering if (mRenderRes < new_res) { @@ -311,43 +289,67 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6 setAttributesOfAllSections(); mInitialized = TRUE; } - if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) - { - return FALSE; // (we are not initialized or updated) - } +} +//--------------------------------------------------------------------------------- +// This calculates the physics of the flexible object. Note that it has to be 0 +// updated every time step. In the future, perhaps there could be an +// optimization similar to what Havok does for objects that are stationary. +//--------------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_FLEXIBLE_UPDATE("Update Flexies"); +void LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) +{ + LLDrawable* drawablep = mVO->mDrawable; - bool visible = mVO->mDrawable->isVisible(); - - if (force_update && visible) + if (drawablep) { - gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE); - } - else if (visible && - !mVO->mDrawable->isState(LLDrawable::IN_REBUILD_Q1) && - mVO->getPixelArea() > 256.f) - { - U32 id; - F32 pixel_area = mVO->getPixelArea(); + //LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); - if (mVO->isRootEdit()) + //flexible objects never go static + drawablep->mQuietCount = 0; + if (!drawablep->isRoot()) { - id = mID; - } - else - { - LLVOVolume* parent = (LLVOVolume*) mVO->getParent(); - id = parent->getVolumeInterfaceID(); + LLViewerObject* parent = (LLViewerObject*) mVO->getParent(); + parent->mDrawable->mQuietCount = 0; } - U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; - - if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) + if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) { - gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE); - } + bool visible = drawablep->isVisible(); + + if ((mSimulateRes == 0) && visible) + { + updateRenderRes(); + gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); + } + else if (visible && + !drawablep->isState(LLDrawable::IN_REBUILD_Q1) && + mVO->getPixelArea() > 256.f) + { + U32 id; + F32 pixel_area = mVO->getPixelArea(); + + if (mVO->isRootEdit()) + { + id = mID; + } + else + { + LLVOVolume* parent = (LLVOVolume*) mVO->getParent(); + id = parent->getVolumeInterfaceID(); + } + + U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; + + if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) + { + updateRenderRes(); + gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); + } + } + } + if(!mInitialized) + updateRenderRes(); } - - return force_update; } inline S32 log2(S32 x) @@ -368,8 +370,11 @@ void LLVolumeImplFlexible::doFlexibleUpdate() LLPath *path = &volume->getPath(); if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible()) { - //mVO->markForUpdate(TRUE); - if (!doIdleUpdate(gAgent, *LLWorld::getInstance(), 0.0)) + BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE; + + doIdleUpdate(gAgent, *LLWorld::getInstance(), 0.0); + + if (!force_update || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) { return; // we did not get updated or initialized, proceeding without can be dangerous } diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h index faed3801b..7d68a67da 100644 --- a/indra/newview/llflexibleobject.h +++ b/indra/newview/llflexibleobject.h @@ -84,7 +84,8 @@ class LLVolumeImplFlexible : public LLVolumeInterface LLVector3 getFramePosition() const; LLQuaternion getFrameRotation() const; LLVolumeInterfaceType getInterfaceType() const { return INTERFACE_FLEXIBLE; } - BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + void updateRenderRes(); + void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); BOOL doUpdateGeometry(LLDrawable *drawable); LLVector3 getPivotPosition() const; void onSetVolume(const LLVolumeParams &volume_params, const S32 detail); diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index 321a825f1..f0f856ef0 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -353,6 +353,13 @@ BOOL LLPanelActiveSpeakers::postBuild() childSetCommitCallback("moderator_allow_text", onModeratorMuteText, this); childSetCommitCallback("moderation_mode", onChangeModerationMode, this); + mVolumeSlider.connect(this,"speaker_volume"); + mModeratorCtrlLbl.connect(this,"moderator_controls_label"); + mModeratorAllowVoiceCheckbox.connect(this,"moderator_allow_voice"); + mModeratorAllowTextCheckbox.connect(this,"moderator_allow_text"); + mModeratorModePanel.connect(this,"moderation_mode_panel"); + mModeratorControlsPanel.connect(this,"moderator_controls"); + // update speaker UI handleSpeakerSelect(); @@ -531,15 +538,18 @@ void LLPanelActiveSpeakers::refreshSpeakers() LLScrollListCell* name_cell = itemp->getColumn(1); if (name_cell) { - //FIXME: remove hard coding of font colors if (speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL) { - // draw inactive speakers in gray - name_cell->setColor(LLColor4::grey4); + // draw inactive speakers in different color + static LLCachedControl sSpeakersInactive(gColors, "SpeakersInactive"); + + name_cell->setColor(sSpeakersInactive); } else { - name_cell->setColor(LLColor4::black); + static LLCachedControl sDefaultListText(gColors, "DefaultListText"); + + name_cell->setColor(sDefaultListText); } // if(!mShowTextChatters && !(speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL) && speakerp->mID != gAgent.getID()) @@ -560,7 +570,11 @@ void LLPanelActiveSpeakers::refreshSpeakers() } } if(!found) - name_cell->setColor(LLColor4::red); + { + static LLCachedControl sSpeakersGhost(gColors, "SpeakersGhost"); + + name_cell->setColor(sSpeakersGhost); + } } // @@ -618,25 +632,21 @@ void LLPanelActiveSpeakers::refreshSpeakers() //&& !LLMuteList::getInstance()->isLinden(selected_speakerp->mDisplayName)); && !LLMuteList::getInstance()->isLinden(selected_speakerp->mLegacyName)); } - childSetValue("speaker_volume", gVoiceClient->getUserVolume(selected_id)); - childSetEnabled("speaker_volume", LLVoiceClient::voiceEnabled() + mVolumeSlider->setValue(gVoiceClient->getUserVolume(selected_id)); + mVolumeSlider->setEnabled(LLVoiceClient::voiceEnabled() && gVoiceClient->getVoiceEnabled(selected_id) && selected_id.notNull() && selected_id != gAgent.getID() && (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL))); - childSetEnabled( - "moderator_controls_label", - selected_id.notNull()); + mModeratorCtrlLbl->setEnabled(selected_id.notNull()); - childSetEnabled( - "moderator_allow_voice", + mModeratorAllowVoiceCheckbox->setEnabled( selected_id.notNull() && mSpeakerMgr->isVoiceActive() && gVoiceClient->getVoiceEnabled(selected_id)); - childSetEnabled( - "moderator_allow_text", + mModeratorAllowTextCheckbox->setEnabled( selected_id.notNull()); if (mProfileBtn) @@ -661,8 +671,8 @@ void LLPanelActiveSpeakers::refreshSpeakers() LLPointer self_speakerp = mSpeakerMgr->findSpeaker(gAgent.getID()); if(self_speakerp) { - childSetVisible("moderation_mode_panel", self_speakerp->mIsModerator && mSpeakerMgr->isVoiceActive()); - childSetVisible("moderator_controls", self_speakerp->mIsModerator); + mModeratorModePanel->setVisible(self_speakerp->mIsModerator && mSpeakerMgr->isVoiceActive()); + mModeratorControlsPanel->setVisible(self_speakerp->mIsModerator); } // keep scroll value stable diff --git a/indra/newview/llfloateractivespeakers.h b/indra/newview/llfloateractivespeakers.h index 97221cb60..b8a9ece01 100644 --- a/indra/newview/llfloateractivespeakers.h +++ b/indra/newview/llfloateractivespeakers.h @@ -46,6 +46,9 @@ class LLButton; class LLPanelActiveSpeakers; class LLSpeakerMgr; class LLVoiceChannel; +class LLSlider; +class LLTextBox; +class LLCheckBoxCtrl; // data for a given participant in a voice channel @@ -296,6 +299,13 @@ protected: LLPointer mSpeakerAddListener; LLPointer mSpeakerRemoveListener; LLPointer mSpeakerClearListener; + + CachedUICtrl mVolumeSlider; + CachedUICtrl mModeratorCtrlLbl; + CachedUICtrl mModeratorAllowVoiceCheckbox; + CachedUICtrl mModeratorAllowTextCheckbox; + CachedUICtrl mModeratorModePanel; + CachedUICtrl mModeratorControlsPanel; }; diff --git a/indra/newview/llfloateravatarinfo.cpp b/indra/newview/llfloateravatarinfo.cpp index d3fc5596d..f60e24623 100644 --- a/indra/newview/llfloateravatarinfo.cpp +++ b/indra/newview/llfloateravatarinfo.cpp @@ -42,6 +42,7 @@ #include "llcommandhandler.h" #include "llpanelavatar.h" #include "lluictrlfactory.h" +#include "llweb.h" // linden library includes #include "llinventory.h" @@ -293,3 +294,13 @@ LLPreview::EAssetStatus LLFloaterAvatarInfo::getAssetStatus() } return mAssetStatus; } + +std::string getProfileURL(const std::string& agent_name) +{ + std::string url = gSavedSettings.getString("WebProfileURL"); + LLSD subs; + subs["AGENT_NAME"] = agent_name; + url = LLWeb::expandURLSubstitutions(url,subs); + LLStringUtil::toLower(url); + return url; +} diff --git a/indra/newview/llfloateravatarinfo.h b/indra/newview/llfloateravatarinfo.h index 9d78e18ec..6e608e9e4 100644 --- a/indra/newview/llfloateravatarinfo.h +++ b/indra/newview/llfloateravatarinfo.h @@ -101,5 +101,6 @@ private: EOnlineStatus mSuggestedOnlineStatus; }; +std::string getProfileURL(const std::string& agent_name); #endif diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index ff2f4247b..6d25b887c 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -35,6 +35,7 @@ #include "llfloaterreporter.h" #include "llagent.h" #include "llagentcamera.h" +#include "llfloaterregioninfo.h" #include "llviewerregion.h" #include "lltracker.h" #include "llviewerstats.h" @@ -74,43 +75,55 @@ extern U32 gFrameCount; typedef enum e_radar_alert_type { - ALERT_TYPE_SIM = 0, - ALERT_TYPE_DRAW = 1, - ALERT_TYPE_SHOUTRANGE = 2, - ALERT_TYPE_CHATRANGE = 3 + ALERT_TYPE_SIM = 1, + ALERT_TYPE_DRAW = 2, + ALERT_TYPE_SHOUTRANGE = 4, + ALERT_TYPE_CHATRANGE = 8, } ERadarAlertType; void chat_avatar_status(std::string name, LLUUID key, ERadarAlertType type, bool entering) { - if (gSavedSettings.getBOOL("RadarChatAlerts")) + static LLCachedControl radar_chat_alerts(gSavedSettings, "RadarChatAlerts"); + static LLCachedControl radar_alert_sim(gSavedSettings, "RadarAlertSim"); + static LLCachedControl radar_alert_draw(gSavedSettings, "RadarAlertDraw"); + static LLCachedControl radar_alert_shout_range(gSavedSettings, "RadarAlertShoutRange"); + static LLCachedControl radar_alert_chat_range(gSavedSettings, "RadarAlertChatRange"); + static LLCachedControl radar_chat_keys(gSavedSettings, "RadarChatKeys"); + + if (radar_chat_alerts) { LLChat chat; + LLFloaterAvatarList* self = LLFloaterAvatarList::getInstance(); + std::string message = name + " " + self->getString(entering ? "has_entered" : "has_left") + " "; switch(type) { - case ALERT_TYPE_SIM: - if (gSavedSettings.getBOOL("RadarAlertSim")) - { - chat.mText = name+" has "+(entering ? "entered" : "left")+" the sim."; - } - break; - case ALERT_TYPE_DRAW: - if (gSavedSettings.getBOOL("RadarAlertDraw")) - { - chat.mText = name+" has "+(entering ? "entered" : "left")+" draw distance."; - } - break; - case ALERT_TYPE_SHOUTRANGE: - if (gSavedSettings.getBOOL("RadarAlertShoutRange")) - { - chat.mText = name+" has "+(entering ? "entered" : "left")+" shout range."; - } - break; - case ALERT_TYPE_CHATRANGE: - if (gSavedSettings.getBOOL("RadarAlertChatRange")) - { - chat.mText = name+" has "+(entering ? "entered" : "left")+" chat range."; - } - break; + case ALERT_TYPE_SIM: + if (radar_alert_sim) + { + chat.mText = message + self->getString("the_sim") + "."; + } + break; + + case ALERT_TYPE_DRAW: + if (radar_alert_draw) + { + chat.mText = message + self->getString("draw_distance") + "."; + } + break; + + case ALERT_TYPE_SHOUTRANGE: + if (radar_alert_shout_range) + { + chat.mText = message + self->getString("shout_range") + "."; + } + break; + + case ALERT_TYPE_CHATRANGE: + if (radar_alert_chat_range) + { + chat.mText = message + self->getString("chat_range") + "."; + } + break; } if (chat.mText != "") { @@ -307,10 +320,6 @@ BOOL LLFloaterAvatarList::postBuild() mTracking = FALSE; mUpdate = TRUE; - // Hide them until some other way is found - // Users may not expect to find a Ban feature on the Eject button - childSetVisible("estate_ban_btn", false); - // Set callbacks childSetAction("profile_btn", onClickProfile, this); childSetAction("im_btn", onClickIM, this); @@ -331,6 +340,7 @@ BOOL LLFloaterAvatarList::postBuild() childSetAction("ar_btn", onClickAR, this); childSetAction("teleport_btn", onClickTeleport, this); childSetAction("estate_eject_btn", onClickEjectFromEstate, this); + childSetAction("estate_ban_btn", onClickBanFromEstate, this); childSetAction("send_keys_btn", onClickSendKeys, this); @@ -471,7 +481,7 @@ void LLFloaterAvatarList::updateAvatarList() LLAvatarName avatar_name; if (LLAvatarNameCache::get(avatarp->getID(), &avatar_name)) { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : name = avatar_name.getLegacyName(); break; @@ -662,7 +672,7 @@ void LLFloaterAvatarList::refreshAvatarList() LLUUID av_id; std::string av_name; - LLAvatarListEntry *entry = &iter->second; + LLAvatarListEntry* entry = &iter->second; // Skip if avatar hasn't been around if (entry->isDead()) @@ -738,9 +748,13 @@ void LLFloaterAvatarList::refreshAvatarList() estate_owner = parent_estate->getOwner(); } - static const LLCachedControl unselected_color(gColors, "ScrollUnselectedColor",LLColor4(LLColor4U(0, 0, 0, 204)) ); + static const LLCachedControl unselected_color(gColors, "ScrollUnselectedColor",LLColor4(0.f, 0.f, 0.f, 0.8f)); - LLColor4 name_color = unselected_color; + static LLCachedControl sDefaultListText(gColors, "DefaultListText"); + static LLCachedControl sRadarTextChatRange(gColors, "RadarTextChatRange"); + static LLCachedControl sRadarTextShoutRange(gColors, "RadarTextShoutRange"); + static LLCachedControl sRadarTextDrawDist(gColors, "RadarTextDrawDist"); + LLColor4 name_color = sDefaultListText; //Lindens are always more Linden than your friend, make that take precedence if(LLMuteList::getInstance()->isLinden(av_name)) @@ -772,7 +786,7 @@ void LLFloaterAvatarList::refreshAvatarList() element["columns"][LIST_AVATAR_NAME]["color"] = name_color.getValue(); char temp[32]; - LLColor4 color = LLColor4::black; + LLColor4 color = sDefaultListText; element["columns"][LIST_DISTANCE]["column"] = "distance"; element["columns"][LIST_DISTANCE]["type"] = "text"; if (UnknownAltitude) @@ -780,28 +794,28 @@ void LLFloaterAvatarList::refreshAvatarList() strcpy(temp, "?"); if (entry->isDrawn()) { - color = LLColor4::green2; + color = sRadarTextDrawDist; } } else { - if (distance < 100.0) + if (distance <= 96.0) { snprintf(temp, sizeof(temp), "%.1f", distance); if (distance > 20.0f) { - color = LLColor4::yellow1; + color = sRadarTextShoutRange; } else { - color = LLColor4::red; + color = sRadarTextChatRange; } } else { if (entry->isDrawn()) { - color = LLColor4::green2; + color = sRadarTextDrawDist; } snprintf(temp, sizeof(temp), "%d", (S32)distance); } @@ -893,9 +907,9 @@ void LLFloaterAvatarList::refreshAvatarList() //element["columns"][LIST_METADATA]["column"] = "metadata"; //element["columns"][LIST_METADATA]["type"] = "text"; - static const LLCachedControl avatar_name_color(gColors, "AvatarNameColor",LLColor4(LLColor4U(251, 175, 93, 255)) ); + static const LLCachedControl avatar_name_color(gColors, "AvatarNameColor",LLColor4(0.98f, 0.69f, 0.36f, 1.f)); LLColor4 client_color(avatar_name_color); - LLVOAvatar *avatarp = gObjectList.findAvatar(av_id); + LLVOAvatar* avatarp = gObjectList.findAvatar(av_id); if(avatarp) { std::string client = SHClientTagMgr::instance().getClientName(avatarp, false); @@ -971,9 +985,9 @@ void LLFloaterAvatarList::onClickIM(void* userdata) } } -void LLFloaterAvatarList::onClickTeleportOffer(void *userdata) +void LLFloaterAvatarList::onClickTeleportOffer(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; LLDynamicArray ids = self->mAvatarList->getSelectedIDs(); if (ids.size() > 0) @@ -982,11 +996,11 @@ void LLFloaterAvatarList::onClickTeleportOffer(void *userdata) } } -void LLFloaterAvatarList::onClickTrack(void *userdata) +void LLFloaterAvatarList::onClickTrack(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; - LLScrollListItem *item = self->mAvatarList->getFirstSelected(); + LLScrollListItem* item = self->mAvatarList->getFirstSelected(); if (!item) return; LLUUID agent_id = item->getUUID(); @@ -1054,15 +1068,15 @@ LLAvatarListEntry * LLFloaterAvatarList::getAvatarEntry(LLUUID avatar) } //static -void LLFloaterAvatarList::onClickMark(void *userdata) +void LLFloaterAvatarList::onClickMark(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; LLDynamicArray ids = self->mAvatarList->getSelectedIDs(); for (LLDynamicArray::iterator itr = ids.begin(); itr != ids.end(); ++itr) { LLUUID avid = *itr; - LLAvatarListEntry *entry = self->getAvatarEntry(avid); + LLAvatarListEntry* entry = self->getAvatarEntry(avid); if (entry != NULL) { entry->toggleMark(); @@ -1070,11 +1084,68 @@ void LLFloaterAvatarList::onClickMark(void *userdata) } } -void LLFloaterAvatarList::onClickFocus(void *userdata) +BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = getInstance(); + LLScrollListItem* item = self->mAvatarList->getFirstSelected(); + if(item) + { + LLUUID agent_id = item->getUUID(); + if (( KEY_RETURN == key ) && (MASK_NONE == mask)) + { + self->mFocusedAvatar = agent_id; + self->focusOnCurrent(); + return TRUE; + } + else if (( KEY_RETURN == key ) && (MASK_CONTROL == mask)) + { + LLAvatarListEntry* entry = self->getAvatarEntry(agent_id); + if (entry) + { +// llinfos << "Trying to teleport to " << entry->getName() << " at " << entry->getPosition() << llendl; + gAgent.teleportViaLocation(entry->getPosition()); + } + return TRUE; + } + } - LLScrollListItem *item = self->mAvatarList->getFirstSelected(); + if (( KEY_RETURN == key ) && (MASK_SHIFT == mask)) + { + LLDynamicArray ids = self->mAvatarList->getSelectedIDs(); + if (ids.size() > 0) + { + if (ids.size() == 1) + { + // Single avatar + LLUUID agent_id = ids[0]; + + // [Ansariel: Display name support] + LLAvatarName avatar_name; + if (LLAvatarNameCache::get(agent_id, &avatar_name)) + { + gIMMgr->setFloaterOpen(TRUE); + gIMMgr->addSession(LLCacheName::cleanFullName(avatar_name.getLegacyName()),IM_NOTHING_SPECIAL,agent_id); + } + // [Ansariel: Display name support] + } + else + { + // Group IM + LLUUID session_id; + session_id.generate(); + gIMMgr->setFloaterOpen(TRUE); + gIMMgr->addSession("Avatars Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); + } + } + } + return LLPanel::handleKeyHere(key, mask); +} + +void LLFloaterAvatarList::onClickFocus(void* userdata) +{ + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; + + LLScrollListItem* item = self->mAvatarList->getFirstSelected(); if (item) { self->mFocusedAvatar = item->getUUID(); @@ -1088,7 +1159,7 @@ void LLFloaterAvatarList::removeFocusFromAll() for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { - LLAvatarListEntry *entry = &iter->second; + LLAvatarListEntry* entry = &iter->second; entry->setFocus(FALSE); } } @@ -1096,7 +1167,7 @@ void LLFloaterAvatarList::removeFocusFromAll() void LLFloaterAvatarList::focusOnCurrent() { std::map::iterator iter; - LLAvatarListEntry *entry; + LLAvatarListEntry* entry; if (mAvatars.size() == 0) { @@ -1123,8 +1194,8 @@ void LLFloaterAvatarList::focusOnCurrent() void LLFloaterAvatarList::focusOnPrev(BOOL marked_only) { std::map::iterator iter; - LLAvatarListEntry *prev = NULL; - LLAvatarListEntry *entry; + LLAvatarListEntry* prev = NULL; + LLAvatarListEntry* entry; if (mAvatars.size() == 0) { @@ -1162,8 +1233,8 @@ void LLFloaterAvatarList::focusOnNext(BOOL marked_only) { std::map::iterator iter; BOOL found = FALSE; - LLAvatarListEntry *next = NULL; - LLAvatarListEntry *entry; + LLAvatarListEntry* next = NULL; + LLAvatarListEntry* entry; if (mAvatars.size() == 0) { @@ -1220,38 +1291,38 @@ void LLFloaterAvatarList::lookAtAvatar(LLUUID &uuid) } //static -void LLFloaterAvatarList::onClickPrevInList(void *userdata) +void LLFloaterAvatarList::onClickPrevInList(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; self->focusOnPrev(FALSE); } //static -void LLFloaterAvatarList::onClickNextInList(void *userdata) +void LLFloaterAvatarList::onClickNextInList(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; self->focusOnNext(FALSE); } //static -void LLFloaterAvatarList::onClickPrevMarked(void *userdata) +void LLFloaterAvatarList::onClickPrevMarked(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; self->focusOnPrev(TRUE); } //static -void LLFloaterAvatarList::onClickNextMarked(void *userdata) +void LLFloaterAvatarList::onClickNextMarked(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; self->focusOnNext(TRUE); } //static void LLFloaterAvatarList::onClickGetKey(void *userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; - LLScrollListItem *item = self->mAvatarList->getFirstSelected(); + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; + LLScrollListItem* item = self->mAvatarList->getFirstSelected(); if (NULL == item) return; @@ -1337,7 +1408,7 @@ void LLFloaterAvatarList::sound_trigger_hook(LLMessageSystem* msg,void **) msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_OwnerID, owner_id); if(owner_id == gAgent.getID() && sound_id == LLUUID("76c78607-93f9-f55a-5238-e19b1a181389")) { - //lets ask if they want to turn it on. + //let's ask if they want to turn it on. if(gSavedSettings.getBOOL("RadarChatKeys")) { LLFloaterAvatarList::getInstance()->sendKeys(); @@ -1412,13 +1483,13 @@ static void send_eject(const LLUUID& avatar_id, bool ban) msg->nextBlock("Data"); msg->addUUID("TargetID", avatar_id); msg->addU32("Flags", flags); - msg->sendReliable( avatarp->getRegion()->getHost()); + msg->sendReliable(avatarp->getRegion()->getHost()); } } static void send_estate_message( const char* request, - const LLUUID &target) + const LLUUID& target) { LLMessageSystem* msg = gMessageSystem; @@ -1449,21 +1520,22 @@ static void send_estate_message( msg->sendReliable(gAgent.getRegion()->getHost()); } -static void cmd_freeze(const LLUUID& avatar, const std::string &name) { send_freeze(avatar, true); } -static void cmd_unfreeze(const LLUUID& avatar, const std::string &name) { send_freeze(avatar, false); } -static void cmd_eject(const LLUUID& avatar, const std::string &name) { send_eject(avatar, false); } -static void cmd_ban(const LLUUID& avatar, const std::string &name) { send_eject(avatar, true); } -static void cmd_profile(const LLUUID& avatar, const std::string &name) { LLFloaterAvatarInfo::showFromDirectory(avatar); } -static void cmd_estate_eject(const LLUUID &avatar, const std::string &name){ send_estate_message("teleporthomeuser", avatar); } +static void cmd_freeze(const LLUUID& avatar, const std::string& name) { send_freeze(avatar, true); } +static void cmd_unfreeze(const LLUUID& avatar, const std::string& name) { send_freeze(avatar, false); } +static void cmd_eject(const LLUUID& avatar, const std::string& name) { send_eject(avatar, false); } +static void cmd_ban(const LLUUID& avatar, const std::string& name) { send_eject(avatar, true); } +static void cmd_profile(const LLUUID& avatar, const std::string& name) { LLFloaterAvatarInfo::showFromDirectory(avatar); } +static void cmd_estate_eject(const LLUUID& avatar, const std::string& name){ send_estate_message("teleporthomeuser", avatar); } +static void cmd_estate_ban(const LLUUID &avatar, const std::string &name) { LLPanelEstateInfo::sendEstateAccessDelta(ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_NO_REPLY, avatar); } -void LLFloaterAvatarList::doCommand(void (*func)(const LLUUID &avatar, const std::string &name)) +void LLFloaterAvatarList::doCommand(void (*func)(const LLUUID& avatar, const std::string& name)) { LLDynamicArray ids = mAvatarList->getSelectedIDs(); for (LLDynamicArray::iterator itr = ids.begin(); itr != ids.end(); ++itr) { LLUUID avid = *itr; - LLAvatarListEntry *entry = getAvatarEntry(avid); + LLAvatarListEntry* entry = getAvatarEntry(avid); if (entry != NULL) { llinfos << "Executing command on " << entry->getName() << llendl; @@ -1480,7 +1552,7 @@ std::string LLFloaterAvatarList::getSelectedNames(const std::string& separator) for (LLDynamicArray::iterator itr = ids.begin(); itr != ids.end(); ++itr) { LLUUID avid = *itr; - LLAvatarListEntry *entry = getAvatarEntry(avid); + LLAvatarListEntry* entry = getAvatarEntry(avid); if (entry != NULL) { if (!ret.empty()) ret += separator; @@ -1494,7 +1566,7 @@ std::string LLFloaterAvatarList::getSelectedNames(const std::string& separator) std::string LLFloaterAvatarList::getSelectedName() { LLUUID id = getSelectedID(); - LLAvatarListEntry *entry = getAvatarEntry(id); + LLAvatarListEntry* entry = getAvatarEntry(id); if (entry) { return entry->getName(); @@ -1504,7 +1576,7 @@ std::string LLFloaterAvatarList::getSelectedName() LLUUID LLFloaterAvatarList::getSelectedID() { - LLScrollListItem *item = mAvatarList->getFirstSelected(); + LLScrollListItem* item = mAvatarList->getFirstSelected(); if (item) return item->getUUID(); return LLUUID::null; } @@ -1516,11 +1588,11 @@ void LLFloaterAvatarList::callbackFreeze(const LLSD& notification, const LLSD& r if (option == 0) { - getInstance()->doCommand( cmd_freeze ); + getInstance()->doCommand(cmd_freeze); } else if (option == 1) { - getInstance()->doCommand( cmd_unfreeze ); + getInstance()->doCommand(cmd_unfreeze); } } @@ -1531,11 +1603,11 @@ void LLFloaterAvatarList::callbackEject(const LLSD& notification, const LLSD& re if (option == 0) { - getInstance()->doCommand( cmd_eject ); + getInstance()->doCommand(cmd_eject); } else if (option == 1) { - getInstance()->doCommand( cmd_ban ); + getInstance()->doCommand(cmd_ban); } } @@ -1546,16 +1618,28 @@ void LLFloaterAvatarList::callbackEjectFromEstate(const LLSD& notification, cons if (option == 0) { - getInstance()->doCommand( cmd_estate_eject ); + getInstance()->doCommand(cmd_estate_eject); } } //static -void LLFloaterAvatarList::callbackIdle(void *userdata) +void LLFloaterAvatarList::callbackBanFromEstate(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + if (option == 0) + { + getInstance()->doCommand(cmd_estate_eject); //Eject first, just in case. + getInstance()->doCommand(cmd_estate_ban); + } +} + +//static +void LLFloaterAvatarList::callbackIdle(void* userdata) { if (instanceExists()) { - // Do not update at every frame: this would be insane ! + // Do not update at every frame: this would be insane! if (gFrameCount % getInstance()->mUpdateRate == 0) { getInstance()->updateAvatarList(); @@ -1563,7 +1647,7 @@ void LLFloaterAvatarList::callbackIdle(void *userdata) } } -void LLFloaterAvatarList::onClickFreeze(void *userdata) +void LLFloaterAvatarList::onClickFreeze(void* userdata) { LLSD args; LLSD payload; @@ -1572,7 +1656,7 @@ void LLFloaterAvatarList::onClickFreeze(void *userdata) } //static -void LLFloaterAvatarList::onClickEject(void *userdata) +void LLFloaterAvatarList::onClickEject(void* userdata) { LLSD args; LLSD payload; @@ -1581,9 +1665,9 @@ void LLFloaterAvatarList::onClickEject(void *userdata) } //static -void LLFloaterAvatarList::onClickMute(void *userdata) +void LLFloaterAvatarList::onClickMute(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; LLDynamicArray ids = self->mAvatarList->getSelectedIDs(); if (ids.size() > 0) @@ -1611,7 +1695,7 @@ void LLFloaterAvatarList::onClickMute(void *userdata) } //static -void LLFloaterAvatarList::onClickEjectFromEstate(void *userdata) +void LLFloaterAvatarList::onClickEjectFromEstate(void* userdata) { LLSD args; LLSD payload; @@ -1620,14 +1704,23 @@ void LLFloaterAvatarList::onClickEjectFromEstate(void *userdata) } //static -void LLFloaterAvatarList::onClickAR(void *userdata) +void LLFloaterAvatarList::onClickBanFromEstate(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; - LLScrollListItem *item = self->mAvatarList->getFirstSelected(); + LLSD args; + LLSD payload; + args["EVIL_USER"] = ((LLFloaterAvatarList*)userdata)->getSelectedNames(); + LLNotificationsUtil::add("EstateBanUser", args, payload, callbackBanFromEstate); +} + +//static +void LLFloaterAvatarList::onClickAR(void* userdata) +{ + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; + LLScrollListItem* item = self->mAvatarList->getFirstSelected(); if (item) { LLUUID agent_id = item->getUUID(); - LLAvatarListEntry *entry = self->getAvatarEntry(agent_id); + LLAvatarListEntry* entry = self->getAvatarEntry(agent_id); if (entry) { LLFloaterReporter::showFromObject(entry->getID()); @@ -1638,19 +1731,19 @@ void LLFloaterAvatarList::onClickAR(void *userdata) // static void LLFloaterAvatarList::onClickProfile(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; self->doCommand(cmd_profile); } //static void LLFloaterAvatarList::onClickTeleport(void* userdata) { - LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; - LLScrollListItem *item = self->mAvatarList->getFirstSelected(); + LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; + LLScrollListItem* item = self->mAvatarList->getFirstSelected(); if (item) { LLUUID agent_id = item->getUUID(); - LLAvatarListEntry *entry = self->getAvatarEntry(agent_id); + LLAvatarListEntry* entry = self->getAvatarEntry(agent_id); if (entry) { // llinfos << "Trying to teleport to " << entry->getName() << " at " << entry->getPosition() << llendl; @@ -1663,11 +1756,11 @@ void LLFloaterAvatarList::onSelectName(LLUICtrl*, void* userdata) { LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; - LLScrollListItem *item = self->mAvatarList->getFirstSelected(); + LLScrollListItem* item = self->mAvatarList->getFirstSelected(); if (item) { LLUUID agent_id = item->getUUID(); - LLAvatarListEntry *entry = self->getAvatarEntry(agent_id); + LLAvatarListEntry* entry = self->getAvatarEntry(agent_id); if (entry) { BOOL enabled = entry->isDrawn(); diff --git a/indra/newview/llfloateravatarlist.h b/indra/newview/llfloateravatarlist.h index 44bc3df84..46bdd1a0f 100644 --- a/indra/newview/llfloateravatarlist.h +++ b/indra/newview/llfloateravatarlist.h @@ -171,6 +171,8 @@ private: public: ~LLFloaterAvatarList(); + virtual BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void onOpen(); /*virtual*/ BOOL postBuild(); @@ -280,11 +282,13 @@ private: static void onClickAR(void *userdata); static void onClickTeleport(void *userdata); static void onClickEjectFromEstate(void *userdata); + static void onClickBanFromEstate(void *userdata); static void callbackFreeze(const LLSD& notification, const LLSD& response); static void callbackEject(const LLSD& notification, const LLSD& response); static void callbackAR(void *userdata); static void callbackEjectFromEstate(const LLSD& notification, const LLSD& response); + static void callbackBanFromEstate(const LLSD& notification, const LLSD& response); static void onSelectName(LLUICtrl*, void *userdata); diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index dec68245d..22281826d 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -135,9 +135,9 @@ void LLFloaterChat::draw() { // enable say and shout only when text available - childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel")); + mToggleActiveSpeakersBtn->setValue(mPanel->getVisible()); - LLChatBar* chat_barp = getChild("chat_panel", TRUE); + LLChatBar* chat_barp = mChatPanel; if (chat_barp) { chat_barp->refresh(); @@ -156,6 +156,9 @@ BOOL LLFloaterChat::postBuild() { chat_barp->setGestureCombo(getChild( "Gesture")); } + + mToggleActiveSpeakersBtn.connect(this,"toggle_active_speakers_btn"); + mChatPanel.connect(this,"chat_panel"); return TRUE; } @@ -316,7 +319,7 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) { // desaturate muted chat LLColor4 muted_color = lerp(color, LLColor4::grey, 0.5f); - add_timestamped_line(history_editor_with_mute, chat, color); + add_timestamped_line(history_editor_with_mute, chat, muted_color); } // add objects as transient speakers that can be muted @@ -452,20 +455,6 @@ void LLFloaterChat::addChat(const LLChat& chat, } // [/RLVa:KB] -#if LL_LCD_COMPILE - // add into LCD displays - if (!invisible_script_debug_chat) - { - if (!from_instant_message) - { - AddNewChatToLCD(chat.mText); - } - else - { - AddNewIMToLCD(chat.mText); - } - } -#endif if (!invisible_script_debug_chat && !chat.mMuted && gConsole diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h index 4f9a03be5..a3ef23fd0 100644 --- a/indra/newview/llfloaterchat.h +++ b/indra/newview/llfloaterchat.h @@ -50,6 +50,7 @@ class LLUUID; class LLCheckBoxCtrl; class LLPanelActiveSpeakers; class LLLogChat; +class LLChatBar; class LLFloaterChat : public LLFloater, public LLUISingleton @@ -95,6 +96,9 @@ public: LLPanelActiveSpeakers* mPanel; BOOL mScrolledToEnd; + + CachedUICtrl mToggleActiveSpeakersBtn; + CachedUICtrl mChatPanel; }; #endif diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 4f6b5fb5a..7028e5016 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -57,7 +57,6 @@ #include "lldaycyclemanager.h" #include "llwlparamset.h" #include "llwlparammanager.h" -#include "llpostprocess.h" #include "llfloaterwindlight.h" diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index d94c7cf8d..2b09b57d4 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -80,8 +80,6 @@ // stuff for Contact groups #include "ascentfloatercontactgroups.h" -//Maximum number of people you can select to do an operation on at once. -#define MAX_FRIEND_SELECT 20 #define DEFAULT_PERIOD 5.0 #define RIGHTS_CHANGE_TIMEOUT 5.0 #define OBSERVER_TIMEOUT 0.5 @@ -368,8 +366,6 @@ void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data) BOOL LLPanelFriends::postBuild() { mFriendsList = getChild("friend_list"); - mFriendsList->setMaxSelectable(MAX_FRIEND_SELECT); - mFriendsList->setMaximumSelectCallback(onMaximumSelect); mFriendsList->setCommitOnSelectionChange(TRUE); childSetCommitCallback("friend_list", onSelectName, this); childSetCommitCallback("buddy_group_combobox", onChangeContactGroup, this); @@ -816,14 +812,6 @@ void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data) } } -//static -void LLPanelFriends::onMaximumSelect(void* user_data) -{ - LLSD args; - args["MAX_SELECT"] = llformat("%d", MAX_FRIEND_SELECT); - LLNotificationsUtil::add("MaxListSelectMessage", args); -}; - // static void LLPanelFriends::onClickProfile(void* user_data) { diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index b930d6627..e97aecc0f 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -135,7 +135,6 @@ private: static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static void onPickAvatar(const std::vector& names, const std::vector& ids, void* user_data); - static void onMaximumSelect(void* user_data); static void onContactSearchEdit(const std::string& search_string, void* user_data); static void onClickIM(void* user_data); static void onClickAssign(void* user_data); diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp deleted file mode 100644 index d1d19e86c..000000000 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/** - * @file llfloaterhardwaresettings.cpp - * @brief Menu of all the different graphics hardware settings - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterhardwaresettings.h" -#include "llfloaterpreference.h" -#include "llviewerwindow.h" -#include "llwindow.h" -#include "llviewercontrol.h" -#include "llviewertexturelist.h" -#include "llfeaturemanager.h" -#include "llstartup.h" - -#include "llradiogroup.h" -#include "lluictrlfactory.h" - -#include "llimagegl.h" -#include "pipeline.h" - -LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL; - -LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater(std::string("Hardware Settings Floater")) -{ - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); - - // load it up - initCallbacks(); -} - -LLFloaterHardwareSettings::~LLFloaterHardwareSettings() -{ -} - -void LLFloaterHardwareSettings::onClickHelp(void* data) -{ - const char* xml_alert = "HardwareSettingsHelpButton"; - LLNotifications::instance().add(xml_alert); -} - -void LLFloaterHardwareSettings::initCallbacks(void) -{ -} - -// menu maintenance functions - -void LLFloaterHardwareSettings::refresh() -{ - LLPanel::refresh(); - - mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable"); - mUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); - mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic"); - mFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); - mGamma = gSavedSettings.getF32("RenderGamma"); - mVideoCardMem = gSavedSettings.getS32("TextureMemory"); - mFogRatio = gSavedSettings.getF32("RenderFogRatio"); - mProbeHardwareOnStartup = gSavedSettings.getBOOL("ProbeHardwareOnStartup"); - - childSetValue("fsaa", (LLSD::Integer) mFSAASamples); - refreshEnabledState(); -} - -void LLFloaterHardwareSettings::refreshEnabledState() -{ - S32 min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); - S32 max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(); - childSetMinValue("GrapicsCardTextureMemory", min_tex_mem); - childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem); - - mLastVBOState = LLVertexBuffer::sEnableVBOs; - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || - !gGLManager.mHasVertexBufferObject) - { - childSetEnabled("vbo", FALSE); - //Streaming VBOs -Shyotl - childSetEnabled("vbo_stream", FALSE); - } - else - { - childSetEnabled("vbo_stream", LLVertexBuffer::sEnableVBOs); - } - - childSetEnabled("fbo",gGLManager.mHasFramebufferObject && !LLPipeline::sRenderDeferred); - - // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance - childSetEnabled("gamma", !gPipeline.canUseWindLightShaders()); - childSetEnabled("(brightness, lower is brighter)", !gPipeline.canUseWindLightShaders()); - childSetEnabled("fog", !gPipeline.canUseWindLightShaders()); - -} - -// static instance of it -LLFloaterHardwareSettings* LLFloaterHardwareSettings::instance() -{ - if (!sHardwareSettings) - { - sHardwareSettings = new LLFloaterHardwareSettings(); - sHardwareSettings->close(); - } - return sHardwareSettings; -} -void LLFloaterHardwareSettings::show() -{ - LLFloaterHardwareSettings* hardSettings = instance(); - hardSettings->refresh(); - hardSettings->center(); - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(hardSettings, "floater_hardware_settings.xml"); - //hardSettings->initCallbacks(); - - hardSettings->open(); -} - -bool LLFloaterHardwareSettings::isOpen() -{ - if (sHardwareSettings != NULL) - { - return true; - } - return false; -} - -// virtual -void LLFloaterHardwareSettings::onClose(bool app_quitting) -{ - if (sHardwareSettings) - { - sHardwareSettings->setVisible(FALSE); - } -} - -// virtual -void LLFloaterHardwareSettings::draw() -{ - if(mLastVBOState == !LLVertexBuffer::sEnableVBOs) - refreshEnabledState(); - LLFloater::draw(); -} - -//============================================================================ - -BOOL LLFloaterHardwareSettings::postBuild() -{ - childSetAction("OK", onBtnOK, this); - - refresh(); - - return TRUE; -} - - -void LLFloaterHardwareSettings::apply() -{ - //Still do a bit of voodoo here. V2 forces restart to change FSAA with FBOs off. - //Let's not do that, and instead do pre-V2 FSAA change handling for that particular case - if(!LLRenderTarget::sUseFBO && (mFSAASamples != (U32)childGetValue("fsaa").asInteger())) - { - BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); - LLWindow* window = gViewerWindow->getWindow(); - LLCoordScreen size; - window->getSize(&size); - gViewerWindow->changeDisplaySettings(window->getFullscreen(), - size, - gSavedSettings.getBOOL("DisableVerticalSync"), - logged_in); - } - - refresh(); -} - - -void LLFloaterHardwareSettings::cancel() -{ - gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO); - gSavedSettings.setBOOL("RenderUseFBO", mUseFBO); - gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso); - gSavedSettings.setU32("RenderFSAASamples", mFSAASamples); - gSavedSettings.setF32("RenderGamma", mGamma); - gSavedSettings.setS32("TextureMemory", mVideoCardMem); - gSavedSettings.setF32("RenderFogRatio", mFogRatio); - gSavedSettings.setBOOL("ProbeHardwareOnStartup", mProbeHardwareOnStartup ); - - close(); -} - -// static -void LLFloaterHardwareSettings::onBtnOK( void* userdata ) -{ - LLFloaterHardwareSettings *fp =(LLFloaterHardwareSettings *)userdata; - fp->apply(); - fp->close(false); -} - diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h deleted file mode 100644 index 0d78d67a2..000000000 --- a/indra/newview/llfloaterhardwaresettings.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @file llfloaterhardwaresettings.h - * @brief Menu of all the different graphics hardware settings - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATER_HARDWARE_SETTINGS_H -#define LL_LLFLOATER_HARDWARE_SETTINGS_H - -#include "llfloater.h" - -class LLSliderCtrl; - -/// Menuing system for all of windlight's functionality -class LLFloaterHardwareSettings : public LLFloater -{ - friend class LLPreferenceCore; - -public: - - LLFloaterHardwareSettings(); - virtual ~LLFloaterHardwareSettings(); - - virtual BOOL postBuild(); - - /// initialize all the callbacks for the menu - void initCallbacks(void); - - /// one and one instance only - static LLFloaterHardwareSettings* instance(); - - /// callback for the menus help button - static void onClickHelp(void* data); - - /// OK button - static void onBtnOK( void* userdata ); - - //// menu management - - /// show off our menu - static void show(); - - /// return if the menu exists or not - static bool isOpen(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); - - /// sync up menu with parameters - void refresh(); - - /// Draw the panel... - void draw(); - - /// Apply the changed values. - void apply(); - - /// don't apply the changed values - void cancel(); - - /// refresh the enabled values - void refreshEnabledState(); - -protected: - LLSliderCtrl* mCtrlVideoCardMem; - - //Retained values for cancel/reset - BOOL mUseVBO; - BOOL mUseFBO; - BOOL mUseAniso; - U32 mFSAASamples; - F32 mGamma; - S32 mVideoCardMem; - F32 mFogRatio; - BOOL mProbeHardwareOnStartup; - - bool mLastVBOState; //track changes to LLVertexBuffer::sEnableVBOs every frame. Bleh. -private: - // one instance on the inside - static LLFloaterHardwareSettings* sHardwareSettings; -}; - -#endif - diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 9f9e2d308..20f60e920 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -80,6 +80,7 @@ #include "llviewercontrol.h" #include "roles_constants.h" #include "llworld.h" +#include "lltrans.h" #include "hippogridmanager.h" @@ -1498,7 +1499,7 @@ void LLPanelLandObjects::onClickRefresh(void* userdata) // ready the list for results self->mOwnerList->deleteAllItems(); - self->mOwnerList->addCommentText(std::string("Searching...")); // *TODO: Translate + self->mOwnerList->addCommentText(LLTrans::getString("Searching")); self->mOwnerList->setEnabled(FALSE); self->mFirstReply = TRUE; @@ -1612,7 +1613,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo // check for no results if (0 == self->mOwnerList->getItemCount()) { - self->mOwnerList->addCommentText(std::string("None found.")); // *TODO: Translate + self->mOwnerList->addCommentText(LLTrans::getString("None_found")); } else { @@ -2446,7 +2447,6 @@ void LLPanelLandAccess::refresh() childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count)); childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - // *TODO: Translate for (access_map_const_iterator cit = parcel->mAccessList.begin(); cit != parcel->mAccessList.end(); ++cit) { @@ -2460,19 +2460,23 @@ void LLPanelLandAccess::refresh() suffix.assign(" ("); if (seconds >= 120) { - std::string buf = llformat("%d minutes", (seconds/60)); + std::string buf = llformat("%d ", (seconds/60)) + getString("minutes"); suffix.append(buf); } else if (seconds >= 60) { - suffix.append("1 minute"); + suffix.append(getString("1_minute")); + } + else if (seconds == 1) + { + suffix.append(getString("1_second")); } else { - std::string buf = llformat("%d seconds", seconds); + std::string buf = llformat("%d ", seconds) + getString("seconds"); suffix.append(buf); } - suffix.append(" remaining)"); + suffix.append(" " + getString("remaining") + ")"); } if (mListAccess) mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); @@ -2499,19 +2503,23 @@ void LLPanelLandAccess::refresh() suffix.assign(" ("); if (seconds >= 120) { - std::string buf = llformat("%d minutes", (seconds/60)); + std::string buf = llformat("%d ", (seconds/60)) + getString("minutes"); suffix.append(buf); } else if (seconds >= 60) { - suffix.append("1 minute"); + suffix.append(getString("1_minute")); + } + else if (seconds == 1) + { + suffix.append(getString("1_second")); } else { - std::string buf = llformat("%d seconds", seconds); + std::string buf = llformat("%d ", seconds) + getString("seconds"); suffix.append(buf); } - suffix.append(" remaining)"); + suffix.append(" " + getString("remaining") + ")"); } mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); } diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp index 40eb5e048..fd42f6d02 100644 --- a/indra/newview/llfloaterpostprocess.cpp +++ b/indra/newview/llfloaterpostprocess.cpp @@ -115,17 +115,8 @@ LLFloaterPostProcess* LLFloaterPostProcess::instance() void LLFloaterPostProcess::onControlChanged(LLUICtrl* ctrl, void* userData) { - char const *VariableName = (char const *)userData; - char buf[256]; - S32 elem=0; - if(sscanf(VariableName,"%255[^[][%d]", buf, &elem) == 2) - { - LLPostProcess::getInstance()->tweaks[(const char*)buf][elem] = ctrl->getValue(); - } - else - { - LLPostProcess::getInstance()->tweaks[VariableName] = ctrl->getValue(); - } + LLSD v = ctrl->getValue(); + LLPostProcess::getInstance()->setSelectedEffectValue((char const *)userData, v); } void LLFloaterPostProcess::onLoadEffect(void* userData) @@ -145,7 +136,7 @@ void LLFloaterPostProcess::onSaveEffect(void* userData) std::string effectName(editBox->getValue().asString()); - if (LLPostProcess::getInstance()->mAllEffects.has(effectName)) + if (LLPostProcess::getInstance()->getAllEffectInfo().has(effectName)) { LLSD payload; payload["effect_name"] = effectName; @@ -153,7 +144,7 @@ void LLFloaterPostProcess::onSaveEffect(void* userData) } else { - LLPostProcess::getInstance()->saveEffect(effectName); + LLPostProcess::getInstance()->saveEffectAs(effectName); sPostProcess->syncMenu(); } } @@ -175,7 +166,7 @@ bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLS // if they choose save, do it. Otherwise, don't do anything if (option == 0) { - LLPostProcess::getInstance()->saveEffect(notification["payload"]["effect_name"].asString()); + LLPostProcess::getInstance()->saveEffectAs(notification["payload"]["effect_name"].asString()); sPostProcess->syncMenu(); } @@ -209,17 +200,17 @@ void LLFloaterPostProcess::syncMenu() comboBox->removeall(); LLSD::map_const_iterator currEffect; - for(currEffect = LLPostProcess::getInstance()->mAllEffects.beginMap(); - currEffect != LLPostProcess::getInstance()->mAllEffects.endMap(); + for(currEffect = LLPostProcess::getInstance()->getAllEffectInfo().beginMap(); + currEffect != LLPostProcess::getInstance()->getAllEffectInfo().endMap(); ++currEffect) { comboBox->add(currEffect->first); } // set the current effect as selected. - comboBox->selectByValue(LLPostProcess::getInstance()->getSelectedEffect()); + comboBox->selectByValue(LLPostProcess::getInstance()->getSelectedEffectName()); - LLSD &tweaks = LLPostProcess::getInstance()->tweaks; + const LLSD &tweaks = LLPostProcess::getInstance()->getSelectedEffectInfo(); //Iterate down all uniforms handled by post-process shaders. Update any linked ui elements. for (LLSD::map_const_iterator it = tweaks.beginMap(); it != tweaks.endMap(); ++it) { diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d5e9702d7..6d839b66d 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -58,7 +58,6 @@ #include "llpanelgeneral.h" #include "llpanelinput.h" #include "llpanellogin.h" -#include "llpanelLCD.h" #include "llpanelmsgs.h" #include "llpanelweb.h" #include "llpanelskins.h" @@ -79,7 +78,6 @@ #include "llviewerwindow.h" #include "llkeyboard.h" #include "llscrollcontainer.h" -#include "llfloaterhardwaresettings.h" #include "hippopanelgrids.h" const S32 PREF_BORDER = 4; @@ -179,20 +177,6 @@ LLPreferenceCore::LLPreferenceCore(LLTabContainer* tab_container, LLButton * def mTabContainer->addTabPanel(mPrefsIM->getPanel(), mPrefsIM->getPanel()->getLabel()); mPrefsIM->getPanel()->setDefaultBtn(default_btn); -#if LL_LCD_COMPILE - - // only add this option if we actually have a logitech keyboard / speaker set - if (gLcdScreen->Enabled()) - { - mLCDPanel = new LLPanelLCD(); - mTabContainer->addTabPanel(mLCDPanel, mLCDPanel->getLabel()); - mLCDPanel->setDefaultBtn(default_btn); - } - -#else - mLCDPanel = NULL; -#endif - mMsgPanel = new LLPanelMsgs(); mTabContainer->addTabPanel(mMsgPanel, mMsgPanel->getLabel()); mMsgPanel->setDefaultBtn(default_btn); @@ -318,18 +302,7 @@ void LLPreferenceCore::apply() mPrefsAscentSys->apply(); mPrefsAscentVan->apply(); - // hardware menu apply - LLFloaterHardwareSettings::instance()->apply(); - mWebPanel->apply(); -#if LL_LCD_COMPILE - // only add this option if we actually have a logitech keyboard / speaker set - if (gLcdScreen->Enabled()) - { - mLCDPanel->apply(); - } -#endif -// mWebPanel->apply(); } @@ -350,18 +323,7 @@ void LLPreferenceCore::cancel() mPrefsAscentSys->cancel(); mPrefsAscentVan->cancel(); - // cancel hardware menu - LLFloaterHardwareSettings::instance()->cancel(); - mWebPanel->cancel(); -#if LL_LCD_COMPILE - // only add this option if we actually have a logitech keyboard / speaker set - if (gLcdScreen->Enabled()) - { - mLCDPanel->cancel(); - } -#endif -// mWebPanel->cancel(); } // static @@ -380,7 +342,6 @@ void LLPreferenceCore::setPersonalInfo(const std::string& visibility, bool im_vi void LLPreferenceCore::refreshEnabledGraphics() { - LLFloaterHardwareSettings::instance()->refreshEnabledState(); mDisplayPanel->refreshEnabledState(); } diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index c9c8e0482..3e279936f 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -197,9 +197,12 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& // owner permissions // Permissions debug text // group permissions - childSetCommitCallback("CheckShareWithGroup",&onCommitPermissions, this); + childSetCommitCallback("CheckGroupCopy",&onCommitPermissions, this); + childSetCommitCallback("CheckGroupMod",&onCommitPermissions, this); + childSetCommitCallback("CheckGroupMove",&onCommitPermissions, this); // everyone permissions childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this); + childSetCommitCallback("CheckEveryoneMove",&onCommitPermissions, this); // next owner permissions childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this); childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this); @@ -261,8 +264,11 @@ void LLFloaterProperties::refresh() "CheckOwnerModify", "CheckOwnerCopy", "CheckOwnerTransfer", - "CheckShareWithGroup", + "CheckGroupCopy", + "CheckGroupMod", + "CheckGroupMove", "CheckEveryoneCopy", + "CheckEveryoneMove", "CheckNextOwnerModify", "CheckNextOwnerCopy", "CheckNextOwnerTransfer", @@ -530,13 +536,23 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) // Check for ability to change values. if (!is_link && is_obj_modify && can_agent_manipulate) { - childSetEnabled("CheckShareWithGroup",TRUE); + childSetEnabled("GroupLabel", true); + childSetEnabled("CheckGroupCopy",owner_mask & PERM_TRANSFER); + childSetEnabled("CheckGroupMod", owner_mask & PERM_MODIFY); + childSetEnabled("CheckGroupMove", true); + childSetEnabled("EveryoneLabel", true); childSetEnabled("CheckEveryoneCopy",(owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER)); + childSetEnabled("CheckEveryoneMove",true); } else { - childSetEnabled("CheckShareWithGroup",FALSE); + childSetEnabled("GroupLabel", false); + childSetEnabled("CheckGroupCopy", false); + childSetEnabled("CheckGroupMod", false); + childSetEnabled("CheckGroupMove", false); + childSetEnabled("EveryoneLabel", false); childSetEnabled("CheckEveryoneCopy",FALSE); + childSetEnabled("CheckEveryoneMove",false); } // Set values. @@ -544,36 +560,12 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE; BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE; - if (is_group_copy && is_group_modify && is_group_move) - { - childSetValue("CheckShareWithGroup",LLSD((BOOL)TRUE)); - - LLCheckBoxCtrl* ctl = getChild("CheckShareWithGroup"); - if(ctl) - { - ctl->setTentative(FALSE); - } - } - else if (!is_group_copy && !is_group_modify && !is_group_move) - { - childSetValue("CheckShareWithGroup",LLSD((BOOL)FALSE)); - LLCheckBoxCtrl* ctl = getChild("CheckShareWithGroup"); - if(ctl) - { - ctl->setTentative(FALSE); - } - } - else - { - LLCheckBoxCtrl* ctl = getChild("CheckShareWithGroup"); - if(ctl) - { - ctl->setTentative(TRUE); - ctl->set(TRUE); - } - } + childSetValue("CheckGroupCopy", is_group_copy); + childSetValue("CheckGroupMod", is_group_modify); + childSetValue("CheckGroupMove", is_group_move); childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY))); + childSetValue("CheckEveryoneMove",LLSD((BOOL)(everyone_mask & PERM_MOVE))); /////////////// // SALE INFO // @@ -762,13 +754,30 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) LLPermissions perm(item->getPermissions()); - LLCheckBoxCtrl* CheckShareWithGroup = self->getChild("CheckShareWithGroup"); - - if(CheckShareWithGroup) + LLCheckBoxCtrl* CheckGroupCopy = self->getChild("CheckGroupCopy"); + if(CheckGroupCopy) { perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), - CheckShareWithGroup->get(), - PERM_MODIFY | PERM_MOVE | PERM_COPY); + CheckGroupCopy->get(), PERM_COPY); + } + LLCheckBoxCtrl* CheckGroupMod = self->getChild("CheckGroupMod"); + if(CheckGroupMod) + { + perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), + CheckGroupMod->get(), PERM_MODIFY); + } + LLCheckBoxCtrl* CheckGroupMove = self->getChild("CheckGroupMove"); + if(CheckGroupMove) + { + perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), + CheckGroupMove->get(), PERM_MOVE); + } + + LLCheckBoxCtrl* CheckEveryoneMove = self->getChild("CheckEveryoneMove"); + if(CheckEveryoneMove) + { + perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), + CheckEveryoneMove->get(), PERM_MOVE); } LLCheckBoxCtrl* CheckEveryoneCopy = self->getChild("CheckEveryoneCopy"); if(CheckEveryoneCopy) diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp new file mode 100644 index 000000000..9312781c4 --- /dev/null +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -0,0 +1,237 @@ +/** + * @file llfloaterregiondebugconsole.h + * @author Brad Kittenbrink + * @brief Quick and dirty console for region debug settings + * + * $LicenseInfo:firstyear=2010&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 "llfloaterregiondebugconsole.h" + +#include "llagent.h" +#include "llhttpclient.h" +#include "llhttpnode.h" +#include "lllineeditor.h" +#include "lltexteditor.h" +#include "llviewerregion.h" +#include "lluictrlfactory.h" + +// Two versions of the sim console API are supported. +// +// SimConsole capability (deprecated): +// This is the initial implementation that is supported by some versions of the +// simulator. It is simple and straight forward, just POST a command and the +// body of the response has the result. This API is deprecated because it +// doesn't allow the sim to use any asynchronous API. +// +// SimConsoleAsync capability: +// This capability replaces the original SimConsole capability. It is similar +// in that the command is POSTed to the SimConsoleAsync cap, but the response +// comes in through the event poll, which gives the simulator more flexibility +// and allows it to perform complex operations without blocking any frames. +// +// We will assume the SimConsoleAsync capability is available, and fall back to +// the SimConsole cap if it is not. The simulator will only support one or the +// other. + +namespace +{ + // Signal used to notify the floater of responses from the asynchronous + // API. + console_reply_signal_t sConsoleReplySignal; + + const std::string PROMPT("\n\n> "); + const std::string UNABLE_TO_SEND_COMMAND( + "ERROR: The last command was not received by the server."); + const std::string CONSOLE_UNAVAILABLE( + "ERROR: No console available for this region/simulator."); + const std::string CONSOLE_NOT_SUPPORTED( + "This region does not support the simulator console."); + + // This responder handles the initial response. Unless error() is called + // we assume that the simulator has received our request. Error will be + // called if this request times out. + class AsyncConsoleResponder : public LLHTTPClient::Responder + { + public: + /* virtual */ + void error(U32 status, const std::string& reason) + { + sConsoleReplySignal(UNABLE_TO_SEND_COMMAND); + } + }; + + class ConsoleResponder : public LLHTTPClient::Responder + { + public: + ConsoleResponder(LLTextEditor *output) : mOutput(output) + { + } + + /*virtual*/ + void error(U32 status, const std::string& reason) + { + if (mOutput) + { + mOutput->appendText( + UNABLE_TO_SEND_COMMAND + PROMPT, + false, false); + } + } + + /*virtual*/ + void result(const LLSD& content) + { + if (mOutput) + { + mOutput->appendText( + content.asString() + PROMPT, false, false); + } + } + + LLTextEditor * mOutput; + }; + + // This handles responses for console commands sent via the asynchronous + // API. + class ConsoleResponseNode : public LLHTTPNode + { + public: + /* virtual */ + void post( + LLHTTPNode::ResponsePtr reponse, + const LLSD& context, + const LLSD& input) const + { + llinfos << "Received response from the debug console: " + << input << llendl; + sConsoleReplySignal(input["body"].asString()); + } + }; +} + +boost::signals2::connection LLFloaterRegionDebugConsole::setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb) +{ + return sConsoleReplySignal.connect(cb); +} + +LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole() +: LLFloater(), mOutput(NULL) +{ + mReplySignalConnection = sConsoleReplySignal.connect( + boost::bind( + &LLFloaterRegionDebugConsole::onReplyReceived, + this, + _1)); + + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_debug_console.xml"); +} + +LLFloaterRegionDebugConsole::~LLFloaterRegionDebugConsole() +{ + mReplySignalConnection.disconnect(); +} + +BOOL LLFloaterRegionDebugConsole::postBuild() +{ + LLLineEditor* input = getChild("region_debug_console_input"); + input->setEnableLineHistory(true); + input->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2)); + input->setFocus(true); + input->setCommitOnFocusLost(false); + + mOutput = getChild("region_debug_console_output"); + + std::string url = gAgent.getRegion()->getCapability("SimConsoleAsync"); + if (url.empty()) + { + // Fall back to see if the old API is supported. + url = gAgent.getRegion()->getCapability("SimConsole"); + if (url.empty()) + { + mOutput->appendText( + CONSOLE_NOT_SUPPORTED + PROMPT, + false, false); + return TRUE; + } + } + + mOutput->appendText("> ", false, false); + return TRUE; +} + +void LLFloaterRegionDebugConsole::onClose(bool app_quitting) +{ + LLFloater::onClose(app_quitting); + + if (!app_quitting) + { + delete this; + } +} + +void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param) +{ + LLLineEditor* input = static_cast(ctrl); + std::string text = input->getText() + "\n"; + + std::string url = gAgent.getRegion()->getCapability("SimConsoleAsync"); + if (url.empty()) + { + // Fall back to the old API + url = gAgent.getRegion()->getCapability("SimConsole"); + if (url.empty()) + { + text += CONSOLE_UNAVAILABLE + PROMPT; + } + else + { + // Using SimConsole (deprecated) + LLHTTPClient::post( + url, + LLSD(input->getText()), + new ConsoleResponder(mOutput)); + } + } + else + { + // Using SimConsoleAsync + LLHTTPClient::post( + url, + LLSD(input->getText()), + new AsyncConsoleResponder); + } + + mOutput->appendText(text, false, false); + input->clear(); +} + +void LLFloaterRegionDebugConsole::onReplyReceived(const std::string& output) +{ + mOutput->appendText(output + PROMPT, false, false); +} + +LLHTTPRegistration + gHTTPRegistrationMessageDebugConsoleResponse( + "/message/SimConsoleResponse"); diff --git a/indra/newview/llfloaterregiondebugconsole.h b/indra/newview/llfloaterregiondebugconsole.h new file mode 100644 index 000000000..bc20ea9c4 --- /dev/null +++ b/indra/newview/llfloaterregiondebugconsole.h @@ -0,0 +1,63 @@ +/** + * @file llfloaterregiondebugconsole.h + * @author Brad Kittenbrink + * @brief Quick and dirty console for region debug settings + * + * $LicenseInfo:firstyear=2010&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_LLFLOATERREGIONDEBUGCONSOLE_H +#define LL_LLFLOATERREGIONDEBUGCONSOLE_H + +#include + +#include "llfloater.h" +#include "llhttpclient.h" + +class LLTextEditor; + +typedef boost::signals2::signal< + void (const std::string& output)> console_reply_signal_t; + +class LLFloaterRegionDebugConsole : public LLFloater, public LLHTTPClient::Responder, public LLSingleton +{ +public: + LLFloaterRegionDebugConsole(); + virtual ~LLFloaterRegionDebugConsole(); + + // virtual + BOOL postBuild(); + void onClose(bool app_quitting); + + void onInput(LLUICtrl* ctrl, const LLSD& param); + + LLTextEditor * mOutput; + + static boost::signals2::connection setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb); + + private: + void onReplyReceived(const std::string& output); + + boost::signals2::connection mReplySignalConnection; +}; + +#endif // LL_LLFLOATERREGIONDEBUGCONSOLE_H diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 07fae3df2..4ef0cfbf3 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -110,9 +110,6 @@ void click_popup_minimize(void*); void click_popup_grab_drag(LLUICtrl *, void*); void click_popup_grab_lift(LLUICtrl *, void*); void click_popup_grab_spin(LLUICtrl *, void*); -void click_popup_rotate_left(void*); -void click_popup_rotate_reset(void*); -void click_popup_rotate_right(void*); void click_popup_dozer_mode(LLUICtrl *, void *user); void commit_slider_dozer_size(LLUICtrl *, void*); void commit_slider_dozer_force(LLUICtrl *, void*); @@ -419,7 +416,6 @@ LLFloaterTools::LLFloaterTools() mPanelFace(NULL), mPanelLandInfo(NULL), - mTabLand(NULL), mDirty(TRUE) { setAutoFocus(FALSE); @@ -947,25 +943,6 @@ void commit_slider_zoom(LLUICtrl *ctrl, void*) 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 click_popup_dozer_mode(LLUICtrl *, void *user) { S32 mode = (S32)(intptr_t) user; diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index 4a8078a44..7e8c5ef54 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -186,8 +186,6 @@ public: LLPanelFace *mPanelFace; LLPanelLandInfo *mPanelLandInfo; - LLTabContainer* mTabLand; - LLParcelSelectionHandle mParcelSelection; LLObjectSelectionHandle mObjectSelection; diff --git a/indra/newview/llfloatervfsexplorer.cpp b/indra/newview/llfloatervfsexplorer.cpp index 99662b9d9..9c4030bee 100644 --- a/indra/newview/llfloatervfsexplorer.cpp +++ b/indra/newview/llfloatervfsexplorer.cpp @@ -9,7 +9,6 @@ #include "lllocalinventory.h" #include "llviewerwindow.h" #include "llassetconverter.h" -#include "dofloaterhex.h" LLFloaterVFSExplorer* LLFloaterVFSExplorer::sInstance; std::map LLFloaterVFSExplorer::sVFSFileMap; @@ -41,7 +40,6 @@ BOOL LLFloaterVFSExplorer::postBuild() childSetAction("remove_btn", onClickRemove, this); childSetAction("reload_all_btn", onClickReload, this); childSetAction("copy_uuid_btn", onClickCopyUUID, this); - childSetAction("edit_data_btn", onClickEditData, this); childSetAction("item_btn", onClickItem, this); refresh(); return TRUE; @@ -175,13 +173,6 @@ void LLFloaterVFSExplorer::onClickReload(void* user_data) floaterp->reloadAll(); } // static -void LLFloaterVFSExplorer::onClickEditData(void* user_data) -{ - LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data; - LLVFSFileSpecifier file = floaterp->getEditEntry(); - DOFloaterHex::show(file.mFileID, true, file.mFileType); -} -// static void LLFloaterVFSExplorer::onClickItem(void* user_data) { LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data; diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index 04ef4e5af..0a72fdadf 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -62,7 +62,6 @@ #include "llwaterparamset.h" #include "llwaterparammanager.h" -#include "llpostprocess.h" #undef max diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 942763ad8..d84eaf2a2 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -62,7 +62,6 @@ #include "llwlparamset.h" #include "llwlparammanager.h" -#include "llpostprocess.h" #undef max diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index f7ba56bf8..1fc54068c 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -959,11 +959,16 @@ void LLFolderView::draw() static LLCachedControl sSearchStatusColor(gColors, "InventorySearchStatusColor", LLColor4::white ); if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration()) { - mStatusText = std::string("Searching..."); // *TODO:translate + mStatusText = LLTrans::getString("Searching"); } else { - mStatusText = std::string("No matching items found in inventory."); // *TODO:translate + // if(getFilter()) + // { + // LLStringUtil::format_map_t args; + // args["[SEARCH_TERM]"] = LLURI::escape(getFilter()->getFilterSubStringOrig()); + mStatusText = LLTrans::getString("InventoryNoMatchingItems"); //, args); + // } } mStatusTextBox->setWrappedText(mStatusText); mStatusTextBox->setVisible( TRUE ); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index ebb0cb1aa..8563b98a4 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -118,20 +118,20 @@ public: virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse); virtual BOOL addFolder( LLFolderViewFolder* folder); - // Finds width and height of this object and it's children. Also - // makes sure that this view and it's children are the right size. + // Find width and height of this object and its children. Also + // makes sure that this view and its children are the right size. virtual S32 arrange( S32* width, S32* height, S32 filter_generation ); void arrangeAll() { mArrangeGeneration++; } S32 getArrangeGeneration() { return mArrangeGeneration; } - // applies filters to control visibility of inventory items + // Apply filters to control visibility of inventory items virtual void filter( LLInventoryFilter& filter); - // get the last selected item + // Get the last selected item virtual LLFolderViewItem* getCurSelectedItem( void ); - // Record the selected item and pass it down the hierachy. + // Record the selected item and pass it down the hierarchy. virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); @@ -141,13 +141,13 @@ public: // Called once a frame to update the selection if mSelectThisID has been set void updateSelection(); - // This method is used to toggle the selection of an item. Walks - // children, and keeps track of selected objects. + // This method is used to toggle the selection of an item. + // Walks children and keeps track of selected objects. virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); virtual std::set getSelectionList() const; - // make sure if ancestor is selected, descendents are not + // Make sure if ancestor is selected, descendents are not void sanitizeSelection(); void clearSelection(); void addToSelectionList(LLFolderViewItem* item); @@ -158,21 +158,21 @@ public: void setDraggingOverItem(LLFolderViewItem* item) { mDraggingOverItem = item; } LLFolderViewItem* getDraggingOverItem() { return mDraggingOverItem; } - // deletion functionality + // Deletion functionality void removeSelectedItems(); - // open the selected item. + // Open the selected item void openSelectedItems( void ); void propertiesSelectedItems( void ); - // change the folder type + // Change the folder type void changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type); void autoOpenItem(LLFolderViewFolder* item); void closeAutoOpenedFolders(); BOOL autoOpenTest(LLFolderViewFolder* item); - // copy & paste + // Copy & paste virtual void copy(); virtual BOOL canCopy() const; @@ -185,7 +185,7 @@ public: virtual void doDelete(); virtual BOOL canDoDelete() const; - // public rename functionality - can only start the process + // Public rename functionality - can only start the process void startRenamingSelectedItem( void ); // These functions were used when there was only one folderview, diff --git a/indra/newview/llgroupnotify.cpp b/indra/newview/llgroupnotify.cpp index 24ff0408e..46f368300 100644 --- a/indra/newview/llgroupnotify.cpp +++ b/indra/newview/llgroupnotify.cpp @@ -48,6 +48,7 @@ #include "llfloatergroupinfo.h" #include "llinventoryicon.h" #include "llinventory.h" +#include "lltrans.h" #include "llglheaders.h" #include "llagent.h" @@ -143,14 +144,14 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, }; // Title - addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),std::string("Group Notice"),LLFontGL::getFontSansSerifHuge())); + addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyGroupNotice"),LLFontGL::getFontSansSerifHuge())); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; - from << "Sent by " << from_name << ", " << group_name; + from << LLTrans::getString("GroupNotifySentBy") << " " + from_name << LLTrans::getString(",") + " " << group_name; addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::getFontSansSerif())); @@ -216,7 +217,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, if (mHasInventory) { - addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),std::string("Attached: "),LLFontGL::getFontSansSerif())); + addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyAttached"),LLFontGL::getFontSansSerif())); LLUIImagePtr item_icon = LLInventoryIcon::getIcon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, @@ -244,7 +245,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, } LLButton* btn; - btn = new LLButton(std::string("next"), + btn = new LLButton(LLTrans::getString("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), @@ -252,7 +253,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, onClickNext, this, LLFontGL::getFontSansSerif()); - btn->setToolTip(std::string("Next")); // *TODO: Translate + btn->setToolTip(LLTrans::getString("next")); btn->setScaleImage(TRUE); addChild(btn); mNextBtn = btn; @@ -267,7 +268,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, btn_width, BTN_HEIGHT); - btn = new LLButton(std::string("OK"), btn_rect, LLStringUtil::null, onClickOk, this); + btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, onClickOk, this); addChild(btn, -1); setDefaultBtn(btn); @@ -279,8 +280,8 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, wide_btn_width, BTN_HEIGHT); - btn = new LLButton(std::string("Group Notices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); - btn->setToolTip(std::string("View past notices or opt-out of receiving these messages here.")); // TODO: Translate + btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); + btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices")); addChild(btn, -1); if (mHasInventory) @@ -295,11 +296,11 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, std::string btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { - btn_lbl = "Open Attachment"; + btn_lbl = LLTrans::getString("GroupNotifyOpenAttachment"); } else { - btn_lbl = "Save Attachment"; + btn_lbl = LLTrans::getString("GroupNotifySaveAttachment"); } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, onClickSaveInventory, this); mSaveInventoryBtn->setVisible(mHasInventory); diff --git a/indra/newview/llhoverview.cpp b/indra/newview/llhoverview.cpp index ce2bb321a..f6cff6f16 100644 --- a/indra/newview/llhoverview.cpp +++ b/indra/newview/llhoverview.cpp @@ -408,7 +408,7 @@ void LLHoverView::updateText() LLViewerObject *parent = (LLViewerObject *)object->getParent(); if (object && - (object->usePhysics() || + (object->flagUsePhysics() || object->flagScripted() || object->flagHandleTouch() || (parent && parent->flagHandleTouch()) || object->flagTakesMoney() || (parent && parent->flagTakesMoney()) || @@ -423,7 +423,7 @@ void LLHoverView::updateText() line.append(LLTrans::getString("TooltipFlagScript") + " "); } - if (object->usePhysics()) + if (object->flagUsePhysics()) { line.append(LLTrans::getString("TooltipFlagPhysics") + " "); } @@ -456,7 +456,7 @@ void LLHoverView::updateText() line.append(LLTrans::getString("TooltipFlagTemporary") + " "); } - if (object->usePhysics() || + if (object->flagUsePhysics() || object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ) { diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index ed2349717..27774273a 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1411,6 +1411,15 @@ BOOL LLFloaterIMPanel::postBuild() } setDefaultBtn("send_btn"); + + mActiveSpeakersPanel.connect(this,"active_speakers_panel"); + mToggleActiveSpeakersBtn.connect(this,"toggle_active_speakers_btn"); + mVolumeSlider.connect(this,"speaker_volume"); + mEndCallBtn.connect(this,"end_call_btn"); + mStartCallBtn.connect(this,"start_call_btn"); + mSendBtn.connect(this,"send_btn"); + mMuteBtn.connect(this,"mute_btn"); + return TRUE; } @@ -1466,10 +1475,10 @@ void LLFloaterIMPanel::draw() && mCallBackEnabled; // hide/show start call and end call buttons - childSetVisible("end_call_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() >= LLVoiceChannel::STATE_CALL_STARTED); - childSetVisible("start_call_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() < LLVoiceChannel::STATE_CALL_STARTED); - childSetEnabled("start_call_btn", enable_connect); - childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty()); + mEndCallBtn->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() >= LLVoiceChannel::STATE_CALL_STARTED); + mStartCallBtn->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() < LLVoiceChannel::STATE_CALL_STARTED); + mStartCallBtn->setEnabled(enable_connect); + mSendBtn->setEnabled(!childGetValue("chat_editor").asString().empty()); LLPointer self_speaker = mSpeakers->findSpeaker(gAgent.getID()); if(!mTextIMPossible) @@ -1497,10 +1506,10 @@ void LLFloaterIMPanel::draw() // show speakers window when voice first connects if (mShowSpeakersOnConnect && mVoiceChannel->isActive()) { - childSetVisible("active_speakers_panel", TRUE); + mActiveSpeakersPanel->setVisible(true); mShowSpeakersOnConnect = FALSE; } - childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel")); + mToggleActiveSpeakersBtn->setValue(mActiveSpeakersPanel->getVisible()); if (mTyping) { @@ -1531,11 +1540,11 @@ void LLFloaterIMPanel::draw() else { // refresh volume and mute checkbox - childSetVisible("speaker_volume", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive()); - childSetValue("speaker_volume", gVoiceClient->getUserVolume(mOtherParticipantUUID)); + mVolumeSlider->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive()); + mVolumeSlider->setValue(gVoiceClient->getUserVolume(mOtherParticipantUUID)); - childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat)); - childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive()); + mMuteBtn->setValue(LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat)); + mMuteBtn->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive()); } LLFloater::draw(); } diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 9daed909f..943bd37c1 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -48,6 +48,8 @@ class LLInventoryItem; class LLInventoryCategory; class LLIMSpeakerMgr; class LLPanelActiveSpeakers; +class LLPanel; +class LLButton; class LLVoiceChannel : public LLVoiceClientStatusObserver { @@ -385,6 +387,13 @@ private: boost::signals2::connection mFocusLostSignal; + CachedUICtrl mActiveSpeakersPanel; + CachedUICtrl mToggleActiveSpeakersBtn; + CachedUICtrl mVolumeSlider; + CachedUICtrl mEndCallBtn; + CachedUICtrl mStartCallBtn; + CachedUICtrl mSendBtn; + CachedUICtrl mMuteBtn; void disableWhileSessionStarting(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1995efd2c..e2f6144fb 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -113,7 +113,6 @@ #include "llfloateranimpreview.h" // for reuploads #include "llfloaterimagepreview.h" // for reuploads //#include "llcheats.h" -#include "dofloaterhex.h" #include "hgfloatertexteditor.h" #include "statemachine/aifilepicker.h" // diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 42a4f5c46..429b68ac0 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -665,133 +665,156 @@ const std::string& LLInventoryFilter::getFilterText() if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION)) { - filtered_types += " Animations,"; + //filtered_types += " Animations,"; + filtered_types += LLTrans::getString("Animations"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Animations,"; + //not_filtered_types += " Animations,"; + not_filtered_types += LLTrans::getString("Animations"); + filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_CALLINGCARD)) { - filtered_types += " Calling Cards,"; + //filtered_types += " Calling Cards,"; + filtered_types += LLTrans::getString("Calling Cards"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Calling Cards,"; + //not_filtered_types += " Calling Cards,"; + not_filtered_types += LLTrans::getString("Calling Cards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_WEARABLE)) { - filtered_types += " Clothing,"; + //filtered_types += " Clothing,"; + filtered_types += LLTrans::getString("Clothing"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Clothing,"; + //not_filtered_types += " Clothing,"; + not_filtered_types += LLTrans::getString("Clothing"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_GESTURE)) { - filtered_types += " Gestures,"; + //filtered_types += " Gestures,"; + filtered_types += LLTrans::getString("Gestures"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Gestures,"; + //not_filtered_types += " Gestures,"; + not_filtered_types += LLTrans::getString("Gestures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LANDMARK)) { - filtered_types += " Landmarks,"; + //filtered_types += " Landmarks,"; + filtered_types += LLTrans::getString("Landmarks"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Landmarks,"; + //not_filtered_types += " Landmarks,"; + not_filtered_types += LLTrans::getString("Landmarks"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD)) { - filtered_types += " Notecards,"; + //filtered_types += " Notecards,"; + filtered_types += LLTrans::getString("Notecards"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Notecards,"; + //not_filtered_types += " Notecards,"; + not_filtered_types += LLTrans::getString("Notecards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_OBJECT) && isFilterObjectTypesWith(LLInventoryType::IT_ATTACHMENT)) { - filtered_types += " Objects,"; + //filtered_types += " Objects,"; + filtered_types += LLTrans::getString("Objects"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Objects,"; + //not_filtered_types += " Objects,"; + not_filtered_types += LLTrans::getString("Objects"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LSL)) { - filtered_types += " Scripts,"; + //filtered_types += " Scripts,"; + filtered_types += LLTrans::getString("Scripts"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Scripts,"; + //not_filtered_types += " Scripts,"; + not_filtered_types += LLTrans::getString("Scripts"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SOUND)) { - filtered_types += " Sounds,"; + //filtered_types += " Sounds,"; + filtered_types += LLTrans::getString("Sounds"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Sounds,"; + //not_filtered_types += " Sounds,"; + not_filtered_types += LLTrans::getString("Sounds"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_TEXTURE)) { - filtered_types += " Textures,"; + //filtered_types += " Textures,"; + filtered_types += LLTrans::getString("Textures"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Textures,"; + //not_filtered_types += " Textures,"; + not_filtered_types += LLTrans::getString("Textures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SNAPSHOT)) { - filtered_types += " Snapshots,"; + //filtered_types += " Snapshots,"; + filtered_types += LLTrans::getString("Snapshots"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Snapshots,"; + //not_filtered_types += " Snapshots,"; + not_filtered_types += LLTrans::getString("Snapshots"); filtered_by_all_types = FALSE; } @@ -806,7 +829,8 @@ const std::string& LLInventoryFilter::getFilterText() } else { - mFilterText += "No "; + //mFilterText += "No "; + mFilterText += LLTrans::getString("No Filters"); mFilterText += not_filtered_types; } // remove the ',' at the end @@ -815,12 +839,14 @@ const std::string& LLInventoryFilter::getFilterText() if (isSinceLogoff()) { - mFilterText += " - Since Logoff"; + //mFilterText += " - Since Logoff"; + mFilterText += LLTrans::getString("Since Logoff"); } if (getFilterWorn()) { - mFilterText += " - Worn"; + //mFilterText += " - Worn"; + mFilterText += LLTrans::getString("Worn"); } return mFilterText; diff --git a/indra/newview/lllocalinventory.cpp b/indra/newview/lllocalinventory.cpp index c6578ed8c..1bb9cf102 100644 --- a/indra/newview/lllocalinventory.cpp +++ b/indra/newview/lllocalinventory.cpp @@ -11,7 +11,6 @@ #include "llpreviewtexture.h" #include "llpreviewgesture.h" #include "llpreviewlandmark.h" -#include "dofloaterhex.h" #include "hgfloatertexteditor.h" #include "llappviewer.h" @@ -151,8 +150,7 @@ void LLLocalInventory::open(LLUUID item_id) } else { - llwarns << "Dunno how to open type " << type << ", falling back to hex editor" << llendl; - DOFloaterHex::show(item_id); + llwarns << "Dunno how to open type " << type << llendl; } } diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 2940b764f..304f00e4b 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -65,6 +65,7 @@ #include "pipeline.h" #include "lldrawable.h" #include "llglheaders.h" +#include "lltrans.h" const F32 RADIUS_PIXELS = 100.f; // size in screen space const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS; @@ -152,6 +153,7 @@ void LLManipRotate::render() gGL.pushMatrix(); { + // are we in the middle of a constrained drag? if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z) { @@ -292,6 +294,7 @@ void LLManipRotate::render() // First pass: centers. Second pass: sides. for( S32 i=0; i<2; i++ ) { + gGL.pushMatrix(); { if (mHighlightedPart == LL_ROT_Z) @@ -350,6 +353,7 @@ void LLManipRotate::render() { mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } + } } @@ -363,6 +367,7 @@ void LLManipRotate::render() gGL.popMatrix(); gGL.popMatrix(); + LLVector3 euler_angles; LLQuaternion object_rot = first_object->getRotationEdit(); object_rot.getEulerAngles(&(euler_angles.mV[VX]), &(euler_angles.mV[VY]), &(euler_angles.mV[VZ])); @@ -479,9 +484,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 +575,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 +632,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 +717,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(); @@ -922,7 +938,6 @@ void LLManipRotate::renderSnapGuides() } gGL.end(); - // *TODO: Translate //RN: text rendering does own shadow pass, so only render once if (pass == 1 && render_text && i % 16 == 0) { @@ -930,32 +945,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Forward" : "Direction_East"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VZ] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Left" : "Direction_North"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Right" : "Direction_South"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Back" : "Direction_West"), LLColor4::white); } else { if (constraint_axis.mV[VZ] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Right" : "Direction_South"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Left" : "Direction_North"), LLColor4::white); } } } @@ -963,32 +978,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Left" : "Direction_North"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VX] > 0.f) { - renderTickText(text_point, std::string("Up"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white); } else { - renderTickText(text_point, std::string("Down"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Right" : "Direction_South"), LLColor4::white); } else { if (constraint_axis.mV[VX] > 0.f) { - renderTickText(text_point, std::string("Down"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white); } else { - renderTickText(text_point, std::string("Up"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white); } } } @@ -996,32 +1011,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, std::string("Up"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VY] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Forward" : "Direction_East"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Back" : "Direction_West"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, std::string("Down"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white); } else { if (constraint_axis.mV[VY] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Back" : "Direction_West"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); + renderTickText(text_point, LLTrans::getString(mObjectSelection->isAttachment() ? "Direction_Forward" : "Direction_East"), LLColor4::white); } } } @@ -1872,7 +1887,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 9d09c30cf..bb282fb4d 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -825,7 +825,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(); @@ -972,7 +975,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; @@ -994,7 +1000,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 ); @@ -1042,7 +1051,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 ); @@ -1250,7 +1262,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 b6feb554a..7c86889a1 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -705,7 +705,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()) @@ -2328,7 +2330,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/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 43fa98fbd..a203559c1 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -170,7 +170,7 @@ BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) if (mMediaSource) { - mMediaSource->mouseMove(x, y); + mMediaSource->mouseMove(x, y, mask); gViewerWindow->setCursor(mLastSetCursor); } @@ -198,7 +198,7 @@ BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) if (mMediaSource) { - mMediaSource->mouseUp(x, y); + mMediaSource->mouseUp(x, y, mask); /*// *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup, // in addition to the onFocusReceived() call below. Undo this. JC @@ -222,7 +222,7 @@ BOOL LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask ) convertInputCoords(x, y); if (mMediaSource) - mMediaSource->mouseDown(x, y); + mMediaSource->mouseDown(x, y, mask); gFocusMgr.setMouseCapture( this ); @@ -265,11 +265,11 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) { if (LLUICtrl::handleRightMouseDown(x, y, mask)) return TRUE; - /*S32 media_x = x, media_y = y; + S32 media_x = x, media_y = y; convertInputCoords(media_x, media_y); if (mMediaSource) - mMediaSource->mouseDown(media_x, media_y); + mMediaSource->mouseDown(media_x, media_y, mask, 1); gFocusMgr.setMouseCapture( this ); @@ -277,7 +277,7 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) { setFocus( TRUE ); } - */ + return TRUE; } @@ -289,7 +289,7 @@ BOOL LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask ) convertInputCoords(x, y); if (mMediaSource) - mMediaSource->mouseLeftDoubleClick( x, y); + mMediaSource->mouseDoubleClick( x, y, mask); gFocusMgr.setMouseCapture( this ); @@ -916,20 +916,16 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) case MEDIA_EVENT_NAVIGATE_BEGIN: { - LL_INFOS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN, url is " << self->getNavigateURI() << LL_ENDL; - if(mMediaSource && mHideLoading) - { - mMediaSource->suspendUpdates(true); - } + LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN, url is " << self->getNavigateURI() << LL_ENDL; }; break; case MEDIA_EVENT_NAVIGATE_COMPLETE: { - LL_INFOS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL; - if(mMediaSource && mHideLoading) + LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL; + if(mHidingInitialLoad) { - mMediaSource->suspendUpdates(false); + mHidingInitialLoad = false; } }; break; diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 602a1f153..ef25ae0e3 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -177,6 +177,7 @@ class LLMediaCtrl : bool mStretchToFill; bool mMaintainAspectRatio; bool mHideLoading; + bool mHidingInitialLoad; bool mDecoupleTextureSize; S32 mTextureWidth; S32 mTextureHeight; diff --git a/indra/newview/llmediaremotectrl.cpp b/indra/newview/llmediaremotectrl.cpp index 68db6b6b3..e8d04ff2b 100644 --- a/indra/newview/llmediaremotectrl.cpp +++ b/indra/newview/llmediaremotectrl.cpp @@ -89,6 +89,16 @@ BOOL LLMediaRemoteCtrl::postBuild() childSetAction("media_pause",LLOverlayBar::toggleMediaPlay,this); childSetAction("music_pause",LLOverlayBar::toggleMusicPlay,this); + mMusicPlayBtn.connect(this,"music_play"); + mMusicStopBtn.connect(this,"music_stop"); + mMusicPauseBtn.connect(this,"music_pause"); + mMediaPlayBtn.connect(this,"media_play"); + mMediaStopBtn.connect(this,"media_stop"); + mMediaPauseBtn.connect(this,"media_pause"); + mMediaIcon.connect(this,"media_icon"); + mMusicIcon.connect(this,"music_icon"); + mExpandBtn.connect(this,"expand"); + childSetAction("expand", onClickExpandBtn, this); LLButton *pause = getChild("music_pause"); @@ -101,7 +111,7 @@ void LLMediaRemoteCtrl::draw() { enableMediaButtons(); - LLButton* expand_button = getChild("expand"); + LLButton* expand_button = mExpandBtn; if (expand_button) { if (expand_button->getToggleState()) @@ -147,8 +157,8 @@ void LLMediaRemoteCtrl::setToolTip(const std::string& msg) std::string tool_tip = LLMIMETypes::findToolTip(mime_type); std::string play_tip = LLMIMETypes::findPlayTip(mime_type); // childSetToolTip("media_stop", mControls->getString("stop_label") + "\n" + tool_tip); - childSetToolTip("media_icon", tool_tip); - childSetToolTip("media_play", play_tip); + mMediaIcon->setToolTip(tool_tip); + mMediaIcon->setToolTip(play_tip); } void LLMediaRemoteCtrl::enableMediaButtons() @@ -227,13 +237,13 @@ void LLMediaRemoteCtrl::enableMediaButtons() // Don't test the mime-type: this is not updated in a consistent basis. The existence of a valid gAudiop is enough guarantee. } const std::string media_icon_name = LLMIMETypes::findIcon(media_type); - LLButton* music_play_btn = getChild("music_play"); - LLButton* music_stop_btn = getChild("music_stop"); - LLButton* music_pause_btn = getChild("music_pause"); - LLButton* media_play_btn = getChild("media_play"); - LLButton* media_stop_btn = getChild("media_stop"); - LLButton* media_pause_btn = getChild("media_pause"); - LLIconCtrl* media_icon = getChild("media_icon"); + LLButton* music_play_btn = mMusicPlayBtn; + LLButton* music_stop_btn = mMusicStopBtn; + LLButton* music_pause_btn = mMusicPauseBtn; + LLButton* media_play_btn = mMediaPlayBtn; + LLButton* media_stop_btn = mMediaPlayBtn; + LLButton* media_pause_btn = mMediaPauseBtn; + LLIconCtrl* media_icon = mMediaIcon; music_play_btn->setEnabled(play_music_enabled); music_stop_btn->setEnabled(stop_music_enabled); @@ -262,7 +272,7 @@ void LLMediaRemoteCtrl::enableMediaButtons() music_pause_btn->setToolTip(mCachedPauseTip); } - childSetColor("music_icon", music_icon_color); + mMusicIcon->setColor(music_icon_color); if(!media_icon_name.empty()) { media_icon->setImage(media_icon_name); @@ -273,7 +283,7 @@ void LLMediaRemoteCtrl::enableMediaButtons() media_pause_btn->setEnabled(media_show_pause); media_pause_btn->setVisible(media_show_pause); media_play_btn->setVisible(! media_show_pause); - childSetColor("media_icon", media_icon_color); + mMediaIcon->setColor(media_icon_color); setToolTip(media_url); } diff --git a/indra/newview/llmediaremotectrl.h b/indra/newview/llmediaremotectrl.h index 9fedfd386..22ff29866 100644 --- a/indra/newview/llmediaremotectrl.h +++ b/indra/newview/llmediaremotectrl.h @@ -36,6 +36,7 @@ #include "llpanel.h" class LLButton; +class LLIconCtrl; //////////////////////////////////////////////////////////////////////////////// // @@ -61,6 +62,16 @@ protected: void build(); std::string mCachedPauseTip; + + CachedUICtrl mMusicPlayBtn; + CachedUICtrl mMusicStopBtn; + CachedUICtrl mMusicPauseBtn; + CachedUICtrl mMediaPlayBtn; + CachedUICtrl mMediaStopBtn; + CachedUICtrl mMediaPauseBtn; + CachedUICtrl mExpandBtn; + CachedUICtrl mMediaIcon; + CachedUICtrl mMusicIcon; }; #endif diff --git a/indra/newview/llnotify.cpp b/indra/newview/llnotify.cpp index c942aee44..8b7f52afd 100644 --- a/indra/newview/llnotify.cpp +++ b/indra/newview/llnotify.cpp @@ -327,7 +327,7 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification, this, sFont); btn->setScaleImage(TRUE); - btn->setToolTip(std::string("Next")); // *TODO: Translate + btn->setToolTip(LLTrans::getString("next")); addChild(btn); mNextBtn = btn; diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index ebbe2d114..5522f27a4 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -79,6 +79,8 @@ #include "rlvhandler.h" // [/RLVa:KB] +#include + // // Globals // @@ -189,7 +191,16 @@ BOOL LLOverlayBar::postBuild() setFocusRoot(TRUE); mBuilt = true; - mOriginalIMLabel = getChild("New IM")->getLabelSelected(); + mChatbarAndButtons.connect(this,"chatbar_and_buttons"); + mNewIM.connect(this,"New IM"); + mNotBusy.connect(this,"Set Not Busy"); + mMouseLook.connect(this,"Mouselook"); + mStandUp.connect(this,"Stand Up"); + mFlyCam.connect(this,"Flycam"); + mChatBar.connect(this,"chat_bar"); + mVoiceRemoteContainer.connect(this,"voice_remote_container"); + + mOriginalIMLabel = mNewIM->getLabelSelected(); layoutButtons(); @@ -203,6 +214,7 @@ BOOL LLOverlayBar::postBuild() childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup); childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); + return TRUE; } @@ -214,6 +226,12 @@ LLOverlayBar::~LLOverlayBar() // virtual void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent) { + S32 delta_width = width - getRect().getWidth(); + S32 delta_height = height - getRect().getHeight(); + + if (!delta_width && !delta_height && !sForceReshape) + return; + LLView::reshape(width, height, called_from_parent); if (mBuilt) @@ -224,53 +242,60 @@ void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent) void LLOverlayBar::layoutButtons() { - LLView* state_buttons_panel = getChildView("state_buttons"); + LLView* state_buttons_panel = getChildView("state_management_buttons_container"); if (state_buttons_panel->getVisible()) { - LLViewQuery query; - LLWidgetTypeFilter widget_filter; - query.addPreFilter(LLEnabledFilter::getInstance()); - query.addPreFilter(&widget_filter); + U32 required_width=0; + const child_list_t& view_list = *(state_buttons_panel->getChildList()); + BOOST_FOREACH(LLView* viewp, view_list) + { + required_width+=viewp->getRect().getWidth(); + } - child_list_t button_list = query(state_buttons_panel); + const S32 MAX_BAR_WIDTH = 800; + //const S32 MAX_BUTTON_WIDTH = 150; - const S32 MAX_BAR_WIDTH = 600; - S32 bar_width = llclamp(state_buttons_panel->getRect().getWidth(), 0, MAX_BAR_WIDTH); - - // calculate button widths - const S32 MAX_BUTTON_WIDTH = 150; - S32 segment_width = llclamp(lltrunc((F32)(bar_width) / (F32)button_list.size()), 0, MAX_BUTTON_WIDTH); - S32 btn_width = segment_width - gSavedSettings.getS32("StatusBarPad"); + static LLCachedControl status_bar_pad("StatusBarPad",10); + S32 usable_bar_width = llclamp(state_buttons_panel->getRect().getWidth(), 0, MAX_BAR_WIDTH) - (view_list.size()-1) * status_bar_pad; + F32 element_scale = (F32)usable_bar_width / (F32)required_width; // Evenly space all buttons, starting from left S32 left = 0; S32 bottom = 1; - for (child_list_reverse_iter_t child_iter = button_list.rbegin(); - child_iter != button_list.rend(); ++child_iter) + BOOST_REVERSE_FOREACH(LLView* viewp, view_list) { - LLView *view = *child_iter; - LLRect r = view->getRect(); - r.setOriginAndSize(left, bottom, btn_width, r.getHeight()); - view->setRect(r); - left += segment_width; + LLRect r = viewp->getRect(); + S32 new_width = r.getWidth() * element_scale; + //if(dynamic_cast(viewp)) + // new_width = llclamp(new_width,0,MAX_BUTTON_WIDTH); + r.setOriginAndSize(left, bottom, new_width, r.getHeight()); + viewp->setShape(r,false); + left += viewp->getRect().getWidth() + status_bar_pad; } } } +LLButton* LLOverlayBar::updateButtonVisiblity(LLButton* button, bool visible) +{ + if (button && (bool)button->getVisible() != visible) + { + button->setVisible(visible); + sendChildToFront(button); + moveChildToBackOfTabGroup(button); + } + return button; +} + // Per-frame updates of visibility void LLOverlayBar::refresh() { - BOOL buttons_changed = FALSE; + bool buttons_changed = FALSE; - BOOL im_received = gIMMgr->getIMReceived(); - int unread_count = gIMMgr->getIMUnreadCount(); - LLButton* button = getChild("New IM"); - - if ((button && button->getVisible() != im_received) || - (button && button->getVisible())) + if(LLButton* button = updateButtonVisiblity(mNewIM,gIMMgr->getIMReceived())) { + int unread_count = gIMMgr->getIMUnreadCount(); if (unread_count > 0) { if (unread_count > 1) @@ -284,86 +309,16 @@ void LLOverlayBar::refresh() button->setLabel("1 " + mOriginalIMLabel); } } - button->setVisible(im_received); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; + buttons_changed = true; } - - BOOL busy = gAgent.getBusy(); - button = getChild("Set Not Busy"); - if (button && button->getVisible() != busy) - { - button->setVisible(busy); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera(); - button = getChild("Flycam"); - if (button && button->getVisible() != flycam) - { - button->setVisible(flycam); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL mouselook_grabbed; - mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX) - || gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX); - button = getChild("Mouselook"); - - if (button && button->getVisible() != mouselook_grabbed) - { - button->setVisible(mouselook_grabbed); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL sitting = FALSE; - if (gAgentAvatarp) - { -// sitting = gAgentAvatarp->isSitting(); + buttons_changed |= updateButtonVisiblity(mNotBusy,gAgent.getBusy()) != NULL; + buttons_changed |= updateButtonVisiblity(mFlyCam,LLViewerJoystick::getInstance()->getOverrideCamera()) != NULL; + buttons_changed |= updateButtonVisiblity(mMouseLook,gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX)||gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX)) != NULL; // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) - sitting = gAgentAvatarp->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); +// buttons_changed |= updateButtonVisiblity("Stand Up", isAgentAvatarValid() && gAgentAvatarp->isSitting()) != NULL; + buttons_changed |= updateButtonVisiblity(mStandUp,isAgentAvatarValid() && gAgentAvatarp->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) != NULL; // [/RLVa:KB] - } - button = getChild("Stand Up"); - - if (button && button->getVisible() != sitting) - { - button->setVisible(sitting); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL teleporting = FALSE; - if ((gAgent.getTeleportState() == LLAgent::TELEPORT_START) || - (gAgent.getTeleportState() == LLAgent::TELEPORT_REQUESTED) || - (gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING) || - (gAgent.getTeleportState() == LLAgent::TELEPORT_START)) - { - teleporting = TRUE; - } - else - { - teleporting = FALSE; - } - - - button = getChild("Cancel TP"); - - if (button && button->getVisible() != teleporting) - { - button->setVisible(teleporting); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } + buttons_changed |= updateButtonVisiblity(mCancelBtn,(gAgent.getTeleportState() >= LLAgent::TELEPORT_START) && (gAgent.getTeleportState() <= LLAgent::TELEPORT_MOVING)) != NULL; moveChildToBackOfTabGroup(mAORemote); moveChildToBackOfTabGroup(mMediaRemote); @@ -384,7 +339,7 @@ void LLOverlayBar::refresh() childSetVisible("AdvSettings_container", FALSE); childSetVisible("AdvSettings_container_exp", FALSE); childSetVisible("ao_remote_container", FALSE); - childSetVisible("state_buttons", FALSE); + childSetVisible("state_management_buttons_container", FALSE); } else { @@ -394,15 +349,15 @@ void LLOverlayBar::refresh() childSetVisible("AdvSettings_container", !sAdvSettingsPopup);//!gSavedSettings.getBOOL("wlfAdvSettingsPopup")); childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup);//gSavedSettings.getBOOL("wlfAdvSettingsPopup")); childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); - childSetVisible("state_buttons", TRUE); + childSetVisible("state_management_buttons_container", TRUE); } } if(!in_mouselook) - childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); + mVoiceRemoteContainer->setVisible(LLVoiceClient::voiceEnabled()); // always let user toggle into and out of chatbar static const LLCachedControl chat_visible("ChatVisible",true); - childSetVisible("chat_bar", chat_visible); + mChatBar->setVisible(chat_visible); if (buttons_changed) { diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h index 8f9c8ed2f..365b2ac41 100644 --- a/indra/newview/lloverlaybar.h +++ b/indra/newview/lloverlaybar.h @@ -52,6 +52,7 @@ class LLSlider; class LLVoiceRemoteCtrl; class wlfPanel_AdvSettings; class AORemoteCtrl; +class LLChatBar; class LLOverlayBar : public LLPanel @@ -64,10 +65,14 @@ public: /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); /*virtual*/ BOOL postBuild(); + LLButton* updateButtonVisiblity(LLButton* button, bool visible); + void layoutButtons(); // helpers for returning desired state BOOL musicPlaying() { return mMusicState == PLAYING; } + + LLView* getChatbarAndButtons() const {return mChatbarAndButtons;} static void onClickIMReceived(void* data); static void onClickSetNotBusy(void* data); @@ -114,7 +119,14 @@ protected: S32 mMusicState; std::string mOriginalIMLabel; - + CachedUICtrl mChatbarAndButtons; + CachedUICtrl mNewIM; + CachedUICtrl mNotBusy; + CachedUICtrl mMouseLook; + CachedUICtrl mStandUp; + CachedUICtrl mFlyCam; + CachedUICtrl mChatBar; + CachedUICtrl mVoiceRemoteContainer; private: diff --git a/indra/newview/llpanelLCD.cpp b/indra/newview/llpanelLCD.cpp deleted file mode 100644 index ba7efba7b..000000000 --- a/indra/newview/llpanelLCD.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @file llpanellcd.cpp - * @brief lcd options panel - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llpanelLCD.h" - -// linden library includes -#include "llerror.h" -#include "llrect.h" -#include "llfontgl.h" -#include "message.h" -#include "lluictrlfactory.h" - -// project includes -#include "llviewerwindow.h" -#include "llcheckboxctrl.h" -#include "llradiogroup.h" -#include "llresmgr.h" -#include "lltextbox.h" -#include "llui.h" -#include "llviewercontrol.h" - -//Ventrella -#include "llagent.h" -//end Ventrella - -// for Logitech LCD keyboards / speakers -#ifndef LL_LCD_H -#include "lllcd.h" -#endif - - -// -// Globals -// - -// -// Static functions -// - - -LLPanelLCD::LLPanelLCD() -{ - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_lcd.xml"); -} - -BOOL LLPanelLCD::postBuild() -{ - requires("LCDDestination"); - requires("DisplayLinden"); - requires("DisplayDebug"); - requires("DisplayDebugConsole"); - requires("DisplayRegion"); - requires("DisplayChat"); - requires("DisplayIM"); - - if (!checkRequirements()) - { - return FALSE; - } - - refresh(); - - return TRUE; -} - - -LLPanelLCD::~LLPanelLCD() -{ - // Children all cleaned up by default view destructor. -} - -void LLPanelLCD::refresh() -{ - mLCDDestination = gSavedSettings.getS32("LCDDestination"); - mDisplayChat = gSavedSettings.getBOOL("DisplayChat"); - mDisplayIM = gSavedSettings.getBOOL("DisplayIM"); - mDisplayRegion = gSavedSettings.getBOOL("DisplayRegion"); - mDisplayDebug = gSavedSettings.getBOOL("DisplayDebug"); - mDisplayDebugConsole = gSavedSettings.getBOOL("DisplayDebugConsole"); - mDisplayLinden = gSavedSettings.getBOOL("DisplayLinden"); - - LLPanel::refresh(); -} - -void LLPanelLCD::apply() -{ - // nothing really to do here. -} - - -void LLPanelLCD::cancel() -{ - // doing this to restore situation when we entered this function - gSavedSettings.setS32("LCDDestination", mLCDDestination); - gSavedSettings.setBOOL("DisplayChat", mDisplayChat); - gSavedSettings.setBOOL("DisplayIM", mDisplayIM); - gSavedSettings.setBOOL("DisplayRegion", mDisplayRegion); - gSavedSettings.setBOOL("DisplayDebug", mDisplayDebug); - gSavedSettings.setBOOL("DisplayDebugConsole", mDisplayDebugConsole); - gSavedSettings.setBOOL("DisplayLinden", mDisplayLinden); -} \ No newline at end of file diff --git a/indra/newview/llpanelLCD.h b/indra/newview/llpanelLCD.h deleted file mode 100644 index 21eec3fc0..000000000 --- a/indra/newview/llpanelLCD.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file llpanelLCD.h - * @brief lcd options panel - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_PANEL_LCD_H -#define LL_PANEL_LCD_H - -#include "llpanel.h" - -class LLCheckBoxCtrl; - - -class LLPanelLCD : public LLPanel -{ -public: - LLPanelLCD(); - virtual ~LLPanelLCD(); - - virtual BOOL postBuild(); - virtual void refresh(); - void apply(); - void cancel(); - -protected: - S32 mLCDDestination; - BOOL mDisplayChat; - BOOL mDisplayRegion; - BOOL mDisplayDebug; - BOOL mDisplayDebugConsole; - BOOL mDisplayLinden; - BOOL mDisplayIM; - -}; - -#endif diff --git a/indra/newview/llpanelaudioprefs.cpp b/indra/newview/llpanelaudioprefs.cpp index 0d78a44ae..d58635c85 100644 --- a/indra/newview/llpanelaudioprefs.cpp +++ b/indra/newview/llpanelaudioprefs.cpp @@ -105,6 +105,7 @@ void LLPanelAudioPrefs::refreshValues() mPreviousMediaVolume = gSavedSettings.getF32("AudioLevelMedia"); mPreviousDoppler = gSavedSettings.getF32("AudioLevelDoppler"); mPreviousRolloff = gSavedSettings.getF32("AudioLevelRolloff"); + mPreviousUnderwaterRolloff = gSavedSettings.getF32("AudioLevelUnderwaterRolloff"); mPreviousMoneyThreshold = gSavedSettings.getF32("UISndMoneyChangeThreshold"); mPreviousHealthThreshold = gSavedSettings.getF32("UISndHealthReductionThreshold"); @@ -126,6 +127,7 @@ void LLPanelAudioPrefs::cancel() gSavedSettings.setF32("AudioLevelMedia", mPreviousMediaVolume); gSavedSettings.setF32("AudioLevelDoppler", mPreviousDoppler ); gSavedSettings.setF32("AudioLevelRolloff", mPreviousRolloff ); + gSavedSettings.setF32("AudioLevelUnderwaterRolloff", mPreviousUnderwaterRolloff ); gSavedSettings.setF32("UISndMoneyChangeThreshold", mPreviousMoneyThreshold ); gSavedSettings.setF32("UISndHealthReductionThreshold", mPreviousHealthThreshold ); diff --git a/indra/newview/llpanelaudioprefs.h b/indra/newview/llpanelaudioprefs.h index 08009c9e6..45b6de83e 100644 --- a/indra/newview/llpanelaudioprefs.h +++ b/indra/newview/llpanelaudioprefs.h @@ -67,6 +67,7 @@ private: F32 mPreviousDoppler; F32 mPreviousDistance; F32 mPreviousRolloff; + F32 mPreviousUnderwaterRolloff; S32 mPreviousBitrate; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 6d21cab60..14709805e 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -320,7 +320,7 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType // } if (0 == pAvatarGroups->group_list.size()) { - group_list->addCommentText(std::string("None")); // *TODO: Translate + group_list->addCommentText(getString("None")); } for(LLAvatarGroups::group_list_t::const_iterator it = pAvatarGroups->group_list.begin(); @@ -571,11 +571,6 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) childSetVisible("online_yes",FALSE); - // These are cruft but may still exist in some xml files - // TODO: remove the following 2 lines once translators grab these changes - childSetVisible("online_unknown",FALSE); - childSetVisible("online_no",FALSE); - childSetAction("Find on Map", LLPanelAvatar::onClickTrack, getPanelAvatar()); childSetAction("Instant Message...", LLPanelAvatar::onClickIM, getPanelAvatar()); childSetAction("GroupInvite_Button", LLPanelAvatar::onClickGroupInvite, getPanelAvatar()); diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index cd03f92c6..c92e7c62d 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -121,7 +121,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) // BUG? Check for all objects being editable? bool editable = gAgent.isGodlike() - || (objectp->permModify() + || (objectp->permModify() && !objectp->isPermanentEnforced() && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488 BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); @@ -150,6 +150,9 @@ void LLPanelContents::getState(LLViewerObject *objectp ) all_volume && ((LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1) || (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1))); + + getChildView("button permissions")->setEnabled(!objectp->isPermanentEnforced()); + mPanelInventory->setEnabled(!objectp->isPermanentEnforced()); } diff --git a/indra/newview/llpaneldirbrowser.cpp b/indra/newview/llpaneldirbrowser.cpp index a306d4730..4680780da 100644 --- a/indra/newview/llpaneldirbrowser.cpp +++ b/indra/newview/llpaneldirbrowser.cpp @@ -212,7 +212,7 @@ void LLPanelDirBrowser::updateResultCount() // add none found response if (list->getItemCount() == 0) { - list->addCommentText(std::string("None found.")); // *TODO: Translate + list->addCommentText(LLTrans::getString("NoneFound")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } } @@ -1222,7 +1222,7 @@ void LLPanelDirBrowser::setupNewSearch() // ready the list for results list->operateOnAll(LLCtrlListInterface::OP_DELETE); - list->addCommentText(std::string("Searching...")); // *TODO: Translate + list->addCommentText(LLTrans::getString("Searching")); childDisable("results"); mResultsReceived = 0; diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index fdb1a0035..1e2eccdca 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -71,7 +71,6 @@ #include "lluictrlfactory.h" #include "llfeaturemanager.h" #include "llviewershadermgr.h" -#include "llfloaterhardwaresettings.h" #include "llboost.h" //RN temporary includes for resolution switching @@ -111,9 +110,6 @@ BOOL LLPanelDisplay::postBuild() // Help button childSetAction("GraphicsPreferencesHelpButton", onOpenHelp, this); - // Hardware settings button - childSetAction("GraphicsHardwareButton", onOpenHardwareSettings, NULL); - //============================================================================ // Resolution @@ -224,6 +220,9 @@ BOOL LLPanelDisplay::postBuild() mGraphicsBorder = getChild("GraphicsBorder"); + // Enable Transparent Water + mCtrlTransparentWater = getChild("TransparentWater"); + //---------------------------------------------------------------------------- // Enable Bump/Shiny mCtrlBumpShiny = getChild("BumpShiny"); @@ -356,6 +355,9 @@ BOOL LLPanelDisplay::postBuild() mShadowDetailText = getChild("ShadowDetailText"); mTerrainScaleText = getChild("TerrainScaleText"); + // Hardware tab + childSetCommitCallback("vbo", &LLPanelDisplay::onRenderVBOEnable, this); + refresh(); return TRUE; @@ -414,6 +416,7 @@ void LLPanelDisplay::refresh() mQualityPerformance = gSavedSettings.getU32("RenderQualityPerformance"); mCustomSettings = gSavedSettings.getBOOL("RenderCustomSettings"); + mTransparentWater = gSavedSettings.getBOOL("RenderTransparentWater"); // shader settings mBumpShiny = gSavedSettings.getBOOL("RenderObjectBump"); mShaderEnable = gSavedSettings.getBOOL("VertexShaderEnable"); @@ -459,6 +462,17 @@ void LLPanelDisplay::refresh() updateSliderText(mCtrlPostProcess, mPostProcessText); updateSliderText(mCtrlSkyFactor, mSkyFactorText); + // Hardware tab + mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable"); + mUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); + mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic"); + mFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); + mGamma = gSavedSettings.getF32("RenderGamma"); + mVideoCardMem = gSavedSettings.getS32("TextureMemory"); + mFogRatio = gSavedSettings.getF32("RenderFogRatio"); + + childSetValue("fsaa", (LLSD::Integer) mFSAASamples); + refreshEnabledState(); } @@ -499,10 +513,6 @@ void LLPanelDisplay::refreshEnabledState() bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); mCtrlBumpShiny->setEnabled(bumpshiny ? TRUE : FALSE); - // Avatar Mode - S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; - mCtrlAvatarVP->setEnabled((max_avatar_shader > 0) ? TRUE : FALSE); - if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) { @@ -513,6 +523,7 @@ void LLPanelDisplay::refreshEnabledState() mCtrlAvatarCloth->setEnabled(true); } + static LLCachedControl wlatmos("WindLightUseAtmosShaders",false); //I actually recommend RenderUseFBO:FALSE for ati users when not using deferred, so RenderUseFBO shouldn't control visibility of the element. // Instead, gGLManager.mHasFramebufferObject seems better as it is determined by hardware and not current user settings. -Shyotl //Enabling deferred will force RenderUseFBO to TRUE. @@ -520,13 +531,14 @@ void LLPanelDisplay::refreshEnabledState() LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && //Ensure it's enabled in the gpu feature table LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP") && //Hardware Skinning. Deferred forces RenderAvatarVP to true LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") && gSavedSettings.getBOOL("VertexShaderEnable") && //Basic Shaders - LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("WindLightUseAtmosShaders"); //Atmospheric Shaders + LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders") && wlatmos; //Atmospheric Shaders mCtrlDeferred->setEnabled(can_defer); - mCtrlShadowDetail->setEnabled(can_defer && gSavedSettings.getBOOL("RenderDeferred")); - mCtrlAmbientOcc->setEnabled(can_defer && gSavedSettings.getBOOL("RenderDeferred")); - mCtrlDeferredDoF->setEnabled(can_defer && gSavedSettings.getBOOL("RenderDeferred")); + static LLCachedControl render_deferred("RenderDeferred",false); + mCtrlShadowDetail->setEnabled(can_defer && render_deferred); + mCtrlAmbientOcc->setEnabled(can_defer && render_deferred); + mCtrlDeferredDoF->setEnabled(can_defer && render_deferred); // Disable max non-impostors slider if avatar impostors are off mCtrlNonImpostors->setEnabled(gSavedSettings.getBOOL("RenderUseImpostors")); @@ -539,15 +551,15 @@ void LLPanelDisplay::refreshEnabledState() mCtrlShaderEnable->setEnabled(fCtrlShaderEnable && (!gRlvHandler.hasBehaviour(RLV_BHVR_SETENV) || !mShaderEnable)); // [/RLVa:KB] - BOOL shaders = mCtrlShaderEnable->get(); + bool shaders = mCtrlShaderEnable->get(); if (shaders) { mRadioTerrainDetail->setValue(1); - mRadioTerrainDetail->setEnabled(FALSE); + mRadioTerrainDetail->setEnabled(false); } else { - mRadioTerrainDetail->setEnabled(TRUE); + mRadioTerrainDetail->setEnabled(true); } // *HACK just checks to see if we can use shaders... @@ -559,9 +571,52 @@ void LLPanelDisplay::refreshEnabledState() mCtrlWindLight->setEnabled(fCtrlWindLightEnable && (!gRlvHandler.hasBehaviour(RLV_BHVR_SETENV) || !mWindLight)); // [/RLVa:KB] - // turn off sky detail if atmostpherics isn't on - mCtrlSkyFactor->setEnabled(gSavedSettings.getBOOL("WindLightUseAtmosShaders")); - mSkyFactorText->setEnabled(gSavedSettings.getBOOL("WindLightUseAtmosShaders")); + // turn off sky detail if atmospherics isn't on + mCtrlSkyFactor->setEnabled(wlatmos); + mSkyFactorText->setEnabled(wlatmos); + + // Avatar Mode and FBO + if (render_deferred && wlatmos && shaders) + { + childSetEnabled("fbo", false); + childSetValue("fbo", true); + mCtrlAvatarVP->setEnabled(false); + gSavedSettings.setBOOL("RenderAvatarVP", true); + } + else if (!shaders) + { + childSetEnabled("fbo", gGLManager.mHasFramebufferObject); + mCtrlAvatarVP->setEnabled(false); + gSavedSettings.setBOOL("RenderAvatarVP", false); + } + else + { + childSetEnabled("fbo", gGLManager.mHasFramebufferObject); + mCtrlAvatarVP->setEnabled(true); + } + + // Hardware tab + S32 min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); + S32 max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(); + childSetMinValue("GrapicsCardTextureMemory", min_tex_mem); + childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem); + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || + !gGLManager.mHasVertexBufferObject) + { + childSetEnabled("vbo", false); + //Streaming VBOs -Shyotl + childSetEnabled("vbo_stream", false); + } + else + { + childSetEnabled("vbo_stream", LLVertexBuffer::sEnableVBOs); + } + + // if no windlight shaders, enable gamma, and fog distance + childSetEnabled("gamma",!wlatmos); + childSetEnabled("fog", !wlatmos); + childSetVisible("note", wlatmos); // now turn off any features that are unavailable disableUnavailableSettings(); @@ -678,6 +733,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) llassert(mSkyFactorText != NULL); llassert(mPostProcessText != NULL); + llassert(mCtrlTransparentWater != NULL); llassert(mCtrlBumpShiny != NULL); llassert(mCtrlWindLight != NULL); llassert(mCtrlAvatarVP != NULL); @@ -730,6 +786,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) mSkyFactorText->setVisible(!isHidden); mPostProcessText->setVisible(!isHidden); + mCtrlTransparentWater->setVisible(!isHidden); mCtrlBumpShiny->setVisible(!isHidden); mCtrlWindLight->setVisible(!isHidden); mCtrlAvatarVP->setVisible(!isHidden); @@ -777,6 +834,7 @@ void LLPanelDisplay::cancel() gSavedSettings.setBOOL("RenderCustomSettings", mCustomSettings); + gSavedSettings.setBOOL("RenderTransparentWater", mTransparentWater); gSavedSettings.setBOOL("RenderObjectBump", mBumpShiny); gSavedSettings.setBOOL("VertexShaderEnable", mShaderEnable); gSavedSettings.setBOOL("WindLightUseAtmosShaders", mWindLight); @@ -805,6 +863,15 @@ void LLPanelDisplay::cancel() gSavedSettings.setU32("WLSkyDetail", mSkyLOD); gSavedSettings.setS32("RenderMaxPartCount", mParticleCount); gSavedSettings.setS32("RenderGlowResolutionPow", mPostProcess); + + // Hardware tab + gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO); + gSavedSettings.setBOOL("RenderUseFBO", mUseFBO); + gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso); + gSavedSettings.setU32("RenderFSAASamples", mFSAASamples); + gSavedSettings.setF32("RenderGamma", mGamma); + gSavedSettings.setS32("TextureMemory", mVideoCardMem); + gSavedSettings.setF32("RenderFogRatio", mFogRatio); } void LLPanelDisplay::apply() @@ -816,6 +883,21 @@ void LLPanelDisplay::apply() { applyWindowSize(); } + + // Hardware tab + //Still do a bit of voodoo here. V2 forces restart to change FSAA with FBOs off. + //Let's not do that, and instead do pre-V2 FSAA change handling for that particular case + if(!LLRenderTarget::sUseFBO && (mFSAASamples != (U32)childGetValue("fsaa").asInteger())) + { + bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); + LLWindow* window = gViewerWindow->getWindow(); + LLCoordScreen size; + window->getSize(&size); + gViewerWindow->changeDisplaySettings(window->getFullscreen(), + size, + gSavedSettings.getBOOL("DisableVerticalSync"), + logged_in); + } } void LLPanelDisplay::onChangeQuality(LLUICtrl *ctrl, void *data) @@ -849,11 +931,6 @@ void LLPanelDisplay::onOpenHelp(void* user_data) LLNotifications::instance().add(parent_floater->contextualNotification(xml_alert)); } -void LLPanelDisplay::onOpenHardwareSettings(void* user_data) -{ - LLFloaterHardwareSettings::show(); -} - void LLPanelDisplay::onApplyResolution(LLUICtrl* src, void* user_data) { ((LLPanelDisplay*) src)->applyResolution(); @@ -1030,6 +1107,15 @@ void LLPanelDisplay::onVertexShaderEnable(LLUICtrl* self, void* data) LLFloaterPreference::refreshEnabledGraphics(); } +//static +void LLPanelDisplay::onRenderVBOEnable(LLUICtrl* self, void* data) +{ + LLPanelDisplay* panel = (LLPanelDisplay*)data; + bool enable = panel->childGetValue("vbo").asBoolean(); + panel->childSetEnabled("vbo_stream", enable); + if(!enable) panel->childSetValue("vbo_stream", false); +} + void LLPanelDisplay::setHardwareDefaults(void* user_data) { LLFeatureManager::getInstance()->applyRecommendedSettings(); @@ -1092,7 +1178,7 @@ void LLPanelDisplay::updateMeterText(LLUICtrl* ctrl, void* user_data) LLTextBox* m1 = panel->getChild("DrawDistanceMeterText1"); LLTextBox* m2 = panel->getChild("DrawDistanceMeterText2"); - // toggle the two text boxes based on whether we have 1 or two digits + // toggle the two text boxes based on whether we have 2 or 3 digits F32 val = slider->getValueF32(); bool two_digits = val < 100; m1->setVisible(two_digits); diff --git a/indra/newview/llpaneldisplay.h b/indra/newview/llpaneldisplay.h index a2cbc3549..185263f9f 100644 --- a/indra/newview/llpaneldisplay.h +++ b/indra/newview/llpaneldisplay.h @@ -107,6 +107,7 @@ protected: LLSliderCtrl *mCtrlPostProcess; // Max Particle LLSliderCtrl *mCtrlNonImpostors; // Max non-impostors + LLCheckBoxCtrl *mCtrlTransparentWater; LLCheckBoxCtrl *mCtrlBumpShiny; LLCheckBoxCtrl *mCtrlWindLight; LLCheckBoxCtrl *mCtrlAvatarVP; @@ -155,6 +156,7 @@ protected: S32 mQualityPerformance; BOOL mCustomSettings; + BOOL mTransparentWater; BOOL mBumpShiny; BOOL mShaderEnable; BOOL mWindLight; @@ -183,6 +185,15 @@ protected: S32 mParticleCount; S32 mPostProcess; + // Hardware tab + BOOL mUseVBO; + BOOL mUseFBO; + BOOL mUseAniso; + U32 mFSAASamples; + F32 mGamma; + S32 mVideoCardMem; + F32 mFogRatio; + static void setGraphicsSettings(LLControlGroup& group); static void createGroup(); @@ -193,7 +204,6 @@ protected: static void onChangeCustom(LLUICtrl *ctrl, void *data); static void onOpenHelp(void *data); - static void onOpenHardwareSettings(void *data); static void onCommitAutoDetectAspect(LLUICtrl *ctrl, void *data); static void onKeystrokeAspectRatio(LLLineEditor* caller, void* user_data); static void onSelectAspectRatio(LLUICtrl*, void*); @@ -208,6 +218,9 @@ protected: // callback for when client turns on shaders static void onVertexShaderEnable(LLUICtrl*, void*); + // callbacks for hardware tab + static void onRenderVBOEnable(LLUICtrl*, void*); + // helper function static void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); }; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 271ea92c4..d19d14a4b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -516,7 +516,7 @@ void LLPanelFace::getState() && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) { - BOOL editable = objectp->permModify(); + BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); // only turn on auto-adjust button if there is a media renderer and the media is loaded @@ -1246,7 +1246,7 @@ void LLPanelFace::onClickPaste(void* userdata) LLPrimitive obj; obj.setNumTEs(U8(textures.size())); - for (int i = 0; i < textures.size(); i++) + for (int i = 0; i < textures.size() && i < objectp->getNumTEs(); i++) { llinfos << "Pasting params on face " << i << "." << llendl; LLSD cur_tex = objectp->getTE(i)->asLLSD(); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index fc78ecae6..4c2d0a38f 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -394,7 +394,6 @@ LLPanelObject::LLPanelObject(const std::string& name) mIsPhysical(FALSE), mIsTemporary(FALSE), mIsPhantom(FALSE), - mCastShadows(TRUE), mSelectedType(MI_BOX) { } @@ -478,10 +477,10 @@ 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_link = objectp->permMove() && ((!objectp->isAttachment() && objectp->permModify()) || !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")); + childSetEnabled("build_math_constants",true); S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) @@ -528,8 +527,8 @@ void LLPanelObject::getState( ) mCtrlPosX->setEnabled(enable_move); mCtrlPosY->setEnabled(enable_move); mCtrlPosZ->setEnabled(enable_move); - mBtnLinkObj->setEnabled((enable_link && !single_volume)); - mBtnUnlinkObj->setEnabled((enable_link && (selected_count > 1))); + mBtnLinkObj->setEnabled((enable_move && !single_volume)); + mBtnUnlinkObj->setEnabled((enable_move && (selected_count > 1))); mBtnCopyPos->setEnabled(enable_move); mBtnPastePos->setEnabled(enable_move); mBtnPastePosClip->setEnabled(enable_move); @@ -624,9 +623,15 @@ void LLPanelObject::getState( ) childSetVisible("select_single", TRUE); childSetEnabled("select_single", TRUE); } + 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 + // Lock checkbox - only modifiable if you own the object. BOOL self_owned = (gAgent.getID() == owner_id); - mCheckLock->setEnabled( roots_selected > 0 && self_owned ); + mCheckLock->setEnabled( roots_selected > 0 && self_owned && !is_permanent_enforced); // More lock and debit checkbox - get the values BOOL valid; @@ -656,29 +661,27 @@ void LLPanelObject::getState( ) } } - BOOL is_flexible = volobjp && volobjp->isFlexible(); - // 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); 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(); + BOOL is_volume_detect = root_objectp->flagVolumeDetect(); + 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 && !is_volume_detect); -#if 0 // 1.9.2 - mCastShadows = root_objectp->flagCastShadows(); - mCheckCastShadows->set( mCastShadows ); - mCheckCastShadows->setEnabled( roots_selected==1 && editable ); -#endif - // Update material part // slightly inefficient - materials are unique per object, not per TE U8 material_code = 0; @@ -731,6 +734,7 @@ void LLPanelObject::getState( ) BOOL hole_enabled = FALSE; F32 scale_x=1.f, scale_y=1.f; BOOL isMesh = FALSE; + if( !objectp || !objectp->getVolume() || !editable || !single_volume) { // Clear out all geometry fields. @@ -759,11 +763,10 @@ void LLPanelObject::getState( ) { // Only allowed to change these parameters for objects // that you have permissions on AND are not attachments. - enabled = root_objectp->permModify(); - - const LLVolumeParams &volume_params = objectp->getVolume()->getParams(); - + enabled = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); + // Volume type + const LLVolumeParams &volume_params = objectp->getVolume()->getParams(); U8 path = volume_params.getPathParams().getCurveType(); U8 profile_and_hole = volume_params.getProfileParams().getCurveType(); U8 profile = profile_and_hole & LL_PCODE_PROFILE_MASK; @@ -1525,22 +1528,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::onCommitMaterial( LLUICtrl* ctrl, void* userdata ) { @@ -2369,10 +2356,6 @@ void LLPanelObject::clearCtrls() mCheckTemporary ->setEnabled( FALSE ); mCheckPhantom ->set(FALSE); mCheckPhantom ->setEnabled( FALSE ); -#if 0 // 1.9.2 - mCheckCastShadows->set(FALSE); - mCheckCastShadows->setEnabled( FALSE ); -#endif mComboMaterial ->setEnabled( FALSE ); mLabelMaterial ->setEnabled( FALSE ); // Disable text labels @@ -2468,14 +2451,6 @@ void LLPanelObject::onCommitPhantom( LLUICtrl* ctrl, void* userdata ) self->sendIsPhantom(); } -// static -void LLPanelObject::onCommitCastShadows( LLUICtrl* ctrl, void* userdata ) -{ - LLPanelObject* self = (LLPanelObject*) userdata; - self->sendCastShadows(); -} - - // static void LLPanelObject::onSelectSculpt(LLUICtrl* ctrl, void* userdata) { diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 504e3d94f..6bcf109ad 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -72,7 +72,6 @@ public: static void onCommitPhysics( 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 onLinkObj( void* user_data); static void onUnlinkObj( void* user_data); @@ -110,7 +109,6 @@ protected: void sendIsPhysical(); void sendIsTemporary(); void sendIsPhantom(); - void sendCastShadows(); void sendSculpt(); void getVolumeParams(LLVolumeParams& volume_params); @@ -207,7 +205,6 @@ protected: LLCheckBoxCtrl *mCheckPhysics; LLCheckBoxCtrl *mCheckTemporary; LLCheckBoxCtrl *mCheckPhantom; - LLCheckBoxCtrl *mCheckCastShadows; LLTextureCtrl *mCtrlSculptTexture; LLTextBox *mLabelSculptType; @@ -222,7 +219,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/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 31cb8bcc8..c78f3ce21 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -707,14 +707,13 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) return; } - // *TODO: Translate if(gAgent.allowOperation(PERM_OWNER, item->getPermissions(), GP_OBJECT_MANIPULATE) && item->getSaleInfo().isForSale()) { items.push_back(std::string("Task Buy")); - std::string label("Buy"); + std::string label= LLTrans::getString("Buy"); // Check the price of the item. S32 price = getPrice(); if (-1 == price) @@ -1072,13 +1071,12 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) std::vector items; std::vector disabled_items; - // *TODO: Translate if(item->getPermissions().getOwner() != gAgent.getID() && item->getSaleInfo().isForSale()) { items.push_back(std::string("Task Buy")); - std::string label("Buy"); + std::string label= LLTrans::getString("Buy"); // Check the price of the item. S32 price = getPrice(); if (-1 == price) @@ -1905,24 +1903,23 @@ void LLPanelObjectInventory::draw() if(mIsInventoryEmpty) { - // *TODO: Translate if((LLUUID::null != mTaskUUID) && (!mHaveInventory)) { - LLFontGL::getFontSansSerif()->renderUTF8(std::string("Loading contents..."), 0, - (S32)(getRect().getWidth() * 0.5f), - 10, - LLColor4( 1, 1, 1, 1 ), - LLFontGL::HCENTER, - LLFontGL::BOTTOM); + LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("LoadingContents"), 0, + (S32)(getRect().getWidth() * 0.5f), + 10, + LLColor4( 1, 1, 1, 1 ), + LLFontGL::HCENTER, + LLFontGL::BOTTOM); } else if(mHaveInventory) { - LLFontGL::getFontSansSerif()->renderUTF8(std::string("No contents"), 0, - (S32)(getRect().getWidth() * 0.5f), - 10, - LLColor4( 1, 1, 1, 1 ), - LLFontGL::HCENTER, - LLFontGL::BOTTOM); + LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("NoContents"), 0, + (S32)(getRect().getWidth() * 0.5f), + 10, + LLColor4( 1, 1, 1, 1 ), + LLFontGL::HCENTER, + LLFontGL::BOTTOM); } } } diff --git a/indra/newview/llpanelpathfindingrebakenavmesh.cpp b/indra/newview/llpanelpathfindingrebakenavmesh.cpp new file mode 100644 index 000000000..ca4bcfb67 --- /dev/null +++ b/indra/newview/llpanelpathfindingrebakenavmesh.cpp @@ -0,0 +1,281 @@ +/** +* @file llpanelpathfindingrebakenavmesh.cpp +* @brief Implementation of llpanelpathfindingrebakenavmesh +* @author Prep@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 "llpanelpathfindingrebakenavmesh.h" + +#include +#include + +#include "llagent.h" +#include "llbutton.h" +#include "llenvmanager.h" +#include "llnotificationsutil.h" +#include "llpanel.h" +#include "llpathfindingmanager.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "lltoolbar.h" +#include "llviewerregion.h" +#include "llviewerwindow.h" +#include "lluictrlfactory.h" + + +LLPanelPathfindingRebakeNavmesh* LLPanelPathfindingRebakeNavmesh::getInstance() +{ + static LLPanelPathfindingRebakeNavmesh* panel = getPanel(); + return panel; +} + +BOOL LLPanelPathfindingRebakeNavmesh::postBuild() +{ + //Rebake button + mNavMeshRebakeButton = getChild("navmesh_btn"); + llassert(mNavMeshRebakeButton != NULL); + mNavMeshRebakeButton->setCommitCallback(boost::bind(&LLPanelPathfindingRebakeNavmesh::onNavMeshRebakeClick, this)); + //LLHints::registerHintTarget("navmesh_btn", mNavMeshRebakeButton->getHandle()); + + //Sending rebake request + mNavMeshSendingButton = findChild("navmesh_btn_sending"); + llassert(mNavMeshSendingButton != NULL); + //LLHints::registerHintTarget("navmesh_btn_sending", mNavMeshSendingButton->getHandle()); + + //rebaking... + mNavMeshBakingButton = findChild("navmesh_btn_baking"); + llassert(mNavMeshBakingButton != NULL); + //LLHints::registerHintTarget("navmesh_btn_baking", mNavMeshBakingButton->getHandle()); + + setMode(kRebakeNavMesh_Default); + + createNavMeshStatusListenerForCurrentRegion(); + + if ( !mRegionCrossingSlot.connected() ) + { + mRegionCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLPanelPathfindingRebakeNavmesh::handleRegionBoundaryCrossed, this)); + } + + if (!mAgentStateSlot.connected()) + { + mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLPanelPathfindingRebakeNavmesh::handleAgentState, this, _1)); + } + LLPathfindingManager::getInstance()->requestGetAgentState(); + + return LLPanel::postBuild(); +} + +void LLPanelPathfindingRebakeNavmesh::draw() +{ + if (doDraw()) + { + updatePosition(); + LLPanel::draw(); + } +} + +BOOL LLPanelPathfindingRebakeNavmesh::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) +{ + gViewerWindow->unblockToolTips(); + + if (mNavMeshRebakeButton->getVisible()) + { + msg=mNavMeshRebakeButton->getToolTip(); + //LLToolTipMgr::instance().show(mNavMeshRebakeButton->getToolTip()); + } + else if (mNavMeshSendingButton->getVisible()) + { + msg=mNavMeshSendingButton->getToolTip(); + //LLToolTipMgr::instance().show(mNavMeshSendingButton->getToolTip()); + } + else if (mNavMeshBakingButton->getVisible()) + { + msg=mNavMeshBakingButton->getToolTip(); + //LLToolTipMgr::instance().show(mNavMeshBakingButton->getToolTip()); + } + + // Convert rect local to screen coordinates + localPointToScreen( + 0, 0, + &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); + localPointToScreen( + getRect().getWidth(), getRect().getHeight(), + &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) ); + return true;//LLPanel::handleToolTip(x, y, mask); +} + +LLPanelPathfindingRebakeNavmesh::LLPanelPathfindingRebakeNavmesh() + : LLPanel(), + mCanRebakeRegion(FALSE), + mRebakeNavMeshMode(kRebakeNavMesh_Default), + mNavMeshRebakeButton(NULL), + mNavMeshSendingButton(NULL), + mNavMeshBakingButton(NULL), + mNavMeshSlot(), + mRegionCrossingSlot(), + mAgentStateSlot() +{ + // make sure we have the only instance of this class + static bool b = true; + llassert_always(b); + b=false; +} + +LLPanelPathfindingRebakeNavmesh::~LLPanelPathfindingRebakeNavmesh() +{ +} + +LLPanelPathfindingRebakeNavmesh* LLPanelPathfindingRebakeNavmesh::getPanel() +{ + LLPanelPathfindingRebakeNavmesh* panel = new LLPanelPathfindingRebakeNavmesh(); + LLUICtrlFactory::getInstance()->buildPanel(panel,"panel_navmesh_rebake.xml"); + return panel; +} + +void LLPanelPathfindingRebakeNavmesh::setMode(ERebakeNavMeshMode pRebakeNavMeshMode) +{ + if (pRebakeNavMeshMode == kRebakeNavMesh_Available) + { + LLNotificationsUtil::add("PathfindingRebakeNavmesh"); + } + mNavMeshRebakeButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_Available); + mNavMeshSendingButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_RequestSent); + mNavMeshBakingButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_InProgress); + mRebakeNavMeshMode = pRebakeNavMeshMode; +} + +LLPanelPathfindingRebakeNavmesh::ERebakeNavMeshMode LLPanelPathfindingRebakeNavmesh::getMode() const +{ + return mRebakeNavMeshMode; +} + +void LLPanelPathfindingRebakeNavmesh::onNavMeshRebakeClick() +{ + setMode(kRebakeNavMesh_RequestSent); + LLPathfindingManager::getInstance()->requestRebakeNavMesh(boost::bind(&LLPanelPathfindingRebakeNavmesh::handleRebakeNavMeshResponse, this, _1)); +} + +void LLPanelPathfindingRebakeNavmesh::handleAgentState(BOOL pCanRebakeRegion) +{ + mCanRebakeRegion = pCanRebakeRegion; +} + +void LLPanelPathfindingRebakeNavmesh::handleRebakeNavMeshResponse(bool pResponseStatus) +{ + if (getMode() == kRebakeNavMesh_RequestSent) + { + setMode(pResponseStatus ? kRebakeNavMesh_InProgress : kRebakeNavMesh_Default); + } + + if (!pResponseStatus) + { + LLNotificationsUtil::add("PathfindingCannotRebakeNavmesh"); + } +} + +void LLPanelPathfindingRebakeNavmesh::handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + ERebakeNavMeshMode rebakeNavMeshMode = kRebakeNavMesh_Default; + if (pNavMeshStatus.isValid()) + { + switch (pNavMeshStatus.getStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + case LLPathfindingNavMeshStatus::kRepending : + rebakeNavMeshMode = kRebakeNavMesh_Available; + break; + case LLPathfindingNavMeshStatus::kBuilding : + rebakeNavMeshMode = kRebakeNavMesh_InProgress; + break; + case LLPathfindingNavMeshStatus::kComplete : + rebakeNavMeshMode = kRebakeNavMesh_NotAvailable; + break; + default : + rebakeNavMeshMode = kRebakeNavMesh_Default; + llassert(0); + break; + } + } + + setMode(rebakeNavMeshMode); +} + +void LLPanelPathfindingRebakeNavmesh::handleRegionBoundaryCrossed() +{ + createNavMeshStatusListenerForCurrentRegion(); + mCanRebakeRegion = FALSE; + LLPathfindingManager::getInstance()->requestGetAgentState(); +} + +void LLPanelPathfindingRebakeNavmesh::createNavMeshStatusListenerForCurrentRegion() +{ + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } + + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLPanelPathfindingRebakeNavmesh::handleNavMeshStatus, this, _2)); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true); + } +} + +bool LLPanelPathfindingRebakeNavmesh::doDraw() const +{ + return (mCanRebakeRegion && (mRebakeNavMeshMode != kRebakeNavMesh_NotAvailable)); +} + +void LLPanelPathfindingRebakeNavmesh::updatePosition() +{ +#if 0 + S32 y_pos = 0; + S32 bottom_tb_center = 0; + + if (LLToolBar* toolbar_bottom = gToolBarView->getChild("toolbar_bottom")) + { + y_pos = toolbar_bottom->getRect().getHeight(); + bottom_tb_center = toolbar_bottom->getRect().getCenterX(); + } + + S32 left_tb_width = 0; + if (LLToolBar* toolbar_left = gToolBarView->getChild("toolbar_left")) + { + left_tb_width = toolbar_left->getRect().getWidth(); + } + + if(LLPanel* panel_ssf_container = getRootView()->getChild("state_management_buttons_container")) + { + panel_ssf_container->setOrigin(0, y_pos); + } + + S32 x_pos = bottom_tb_center-getRect().getWidth()/2 - left_tb_width + 113 /* width of stand/fly button *//* + 10 *//* margin */; + + /*setOrigin( x_pos, 0);*/ +#endif +} diff --git a/indra/newview/llpanelpathfindingrebakenavmesh.h b/indra/newview/llpanelpathfindingrebakenavmesh.h new file mode 100644 index 000000000..5aa1c68d8 --- /dev/null +++ b/indra/newview/llpanelpathfindingrebakenavmesh.h @@ -0,0 +1,96 @@ +/** +* @file llpanelpathfindingrebakenavmesh.h +* @brief Header file for llpanelpathfindingrebakenavmesh +* @author Prep@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_LLPANELPATHFINDINGREBAKENAVMESH_H +#define LL_LLPANELPATHFINDINGREBAKENAVMESH_H + +#include + +#include "llpanel.h" +#include "llpathfindingmanager.h" +#include "llpathfindingnavmesh.h" + +class LLButton; +class LLPathfindingNavMeshStatus; + +class LLPanelPathfindingRebakeNavmesh : public LLPanel +{ + + LOG_CLASS(LLPanelPathfindingRebakeNavmesh); + +public: + static LLPanelPathfindingRebakeNavmesh* getInstance(); + + virtual BOOL postBuild(); + + virtual void draw(); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen); + +protected: + +private: + typedef enum + { + kRebakeNavMesh_Available, + kRebakeNavMesh_RequestSent, + kRebakeNavMesh_InProgress, + kRebakeNavMesh_NotAvailable, + kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable + } ERebakeNavMeshMode; + + LLPanelPathfindingRebakeNavmesh(); + virtual ~LLPanelPathfindingRebakeNavmesh(); + + static LLPanelPathfindingRebakeNavmesh* getPanel(); + + void setMode(ERebakeNavMeshMode pRebakeNavMeshMode); + ERebakeNavMeshMode getMode() const; + + void onNavMeshRebakeClick(); + + void handleAgentState(BOOL pCanRebakeRegion); + void handleRebakeNavMeshResponse(bool pResponseStatus); + void handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleRegionBoundaryCrossed(); + + void createNavMeshStatusListenerForCurrentRegion(); + + bool doDraw() const; + void updatePosition(); + + BOOL mCanRebakeRegion; + ERebakeNavMeshMode mRebakeNavMeshMode; + + LLButton* mNavMeshRebakeButton; + LLButton* mNavMeshSendingButton; + LLButton* mNavMeshBakingButton; + + LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; + boost::signals2::connection mRegionCrossingSlot; + LLPathfindingManager::agent_state_slot_t mAgentStateSlot; +}; + +#endif // LL_LLPANELPATHFINDINGREBAKENAVMESH_H diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 8e42927fd..c501e9de0 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -66,6 +66,7 @@ #include "llviewercontrol.h" #include "lluictrlfactory.h" #include "roles_constants.h" +#include "lltrans.h" #include "hippogridmanager.h" @@ -280,6 +281,10 @@ void LLPanelPermissions::refresh() BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); + BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) + || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); + const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = @@ -287,12 +292,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_enforced) + { + string_index += 4; + } if(!is_one_object) { ++string_index; @@ -300,6 +311,34 @@ void LLPanelPermissions::refresh() childSetEnabled("perm_modify",true); childSetText("perm_modify",MODIFY_INFO_STRINGS[string_index]); + std::string pfAttrName; + + if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding()) + || LLSelectMgr::getInstance()->selectGetNonPathfinding()) + { + pfAttrName = "Pathfinding_Object_Attr_None"; + } + else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsPermanent()) + || LLSelectMgr::getInstance()->selectGetPermanent()) + { + pfAttrName = "Pathfinding_Object_Attr_Permanent"; + } + else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsCharacter()) + || LLSelectMgr::getInstance()->selectGetCharacter()) + { + pfAttrName = "Pathfinding_Object_Attr_Character"; + } + else + { + pfAttrName = "Pathfinding_Object_Attr_MultiSelect"; + } + + getChildView("pathfinding_attributes_value")->setEnabled(TRUE); + getChild("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName)); + childSetEnabled("Permissions:",true); // Update creator text field @@ -394,12 +433,12 @@ void LLPanelPermissions::refresh() } } - childSetEnabled("button set group",owners_identical && (mOwnerID == gAgent.getID())); + childSetEnabled("button set group",owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); childSetEnabled("button open group", group_id.notNull()); // figure out the contents of the name, description, & category BOOL edit_name_desc = FALSE; - if(is_one_object && objectp->permModify()) + if(is_one_object && objectp->permModify() && !objectp->isPermanentEnforced()) { edit_name_desc = TRUE; } @@ -628,15 +667,13 @@ void LLPanelPermissions::refresh() bool has_change_perm_ability = false; bool has_change_sale_ability = false; - if(valid_base_perms - && (self_owned - || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) + if(valid_base_perms && is_nonpermanent_enforced && + (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { has_change_perm_ability = true; } - if(valid_base_perms - && (self_owned - || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) + if(valid_base_perms && is_nonpermanent_enforced && + (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { has_change_sale_ability = true; } @@ -847,8 +884,8 @@ void LLPanelPermissions::refresh() ComboClickAction->setCurrentByIndex((S32)click_action); } } - childSetEnabled("label click action",is_perm_modify && all_volume); - childSetEnabled("clickaction",is_perm_modify && all_volume); + childSetEnabled("label click action",is_perm_modify && is_nonpermanent_enforced && all_volume); + childSetEnabled("clickaction",is_perm_modify && is_nonpermanent_enforced && all_volume); } diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 17f6ff4a9..ac0085757 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -83,13 +83,17 @@ #include "llviewercontrol.h" #include "llmeshrepository.h" +#include "llnotificationsutil.h" + +#include + // "Features" Tab BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { - childSetCommitCallback("Flexible1D Checkbox Ctrl",onCommitIsFlexible,this); + getChild("Flexible1D Checkbox Ctrl")->setCommitCallback(boost::bind(&LLPanelVolume::onCommitIsFlexible, this, _1, _2), NULL); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); getChild("FlexNumSections")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexGravity",onCommitFlexible,this); @@ -246,7 +250,7 @@ void LLPanelVolume::getState( ) owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? - BOOL editable = root_objectp->permModify(); + BOOL editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1; @@ -344,7 +348,7 @@ void LLPanelVolume::getState( ) getChild("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 { @@ -449,7 +453,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; @@ -810,10 +814,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("Flexible1D Checkbox Ctrl")->setValue(FALSE); + } +} diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index abf460dd0..1446c72db 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -68,7 +68,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); @@ -89,6 +89,8 @@ protected: void sendPhysicsFriction(LLUICtrl* ctrl, void* userdata); 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 000000000..00f2ebc4b --- /dev/null +++ b/indra/newview/llpathfindingcharacter.cpp @@ -0,0 +1,99 @@ +/** +* @file llpathfindingcharacter.cpp +* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. +* @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 "llpathfindingcharacter.h" + +#include + +#include "llpathfindingobject.h" +#include "llsd.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), + mIsHorizontal(FALSE), + mLength(0.0f), + mRadius(0.0f) +{ + parseCharacterData(pCharacterData); +} + +LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOther) + : LLPathfindingObject(pOther), + mCPUTime(pOther.mCPUTime), + mIsHorizontal(pOther.mIsHorizontal), + mLength(pOther.mLength), + mRadius(pOther.mRadius) +{ +} + +LLPathfindingCharacter::~LLPathfindingCharacter() +{ +} + +LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCharacter& pOther) +{ + dynamic_cast(*this) = pOther; + + mCPUTime = pOther.mCPUTime; + 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(); + + 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(); +} diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h new file mode 100644 index 000000000..7cf9f401b --- /dev/null +++ b/indra/newview/llpathfindingcharacter.h @@ -0,0 +1,63 @@ +/** +* @file llpathfindingcharacter.h +* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. +* @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_LLPATHFINDINGCHARACTER_H +#define LL_LLPATHFINDINGCHARACTER_H + +#include + +#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;}; + + inline BOOL isHorizontal() const {return mIsHorizontal;}; + inline F32 getLength() const {return mLength;}; + inline F32 getRadius() const {return mRadius;}; + +protected: + +private: + void parseCharacterData(const LLSD &pCharacterData); + + F32 mCPUTime; + + 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 000000000..12340cebf --- /dev/null +++ b/indra/newview/llpathfindingcharacterlist.cpp @@ -0,0 +1,69 @@ +/** +* @file llpathfindingcharacterlist.cpp +* @brief Implementation of llpathfindingcharacterlist +* @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 "llpathfindingcharacterlist.h" + +#include "llpathfindingcharacter.h" +#include "llpathfindingobject.h" +#include "llpathfindingobjectlist.h" +#include "llsd.h" + +//--------------------------------------------------------------------------- +// LLPathfindingCharacterList +//--------------------------------------------------------------------------- + +LLPathfindingCharacterList::LLPathfindingCharacterList() + : LLPathfindingObjectList() +{ +} + +LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterListData) + : LLPathfindingObjectList() +{ + 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(uuid, character)); + } +} diff --git a/indra/newview/llpathfindingcharacterlist.h b/indra/newview/llpathfindingcharacterlist.h new file mode 100644 index 000000000..4ecf70001 --- /dev/null +++ b/indra/newview/llpathfindingcharacterlist.h @@ -0,0 +1,47 @@ +/** +* @file llpathfindingcharacterlist.h +* @brief Header file for llpathfindingcharacterlist +* @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_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 000000000..fe4daabd8 --- /dev/null +++ b/indra/newview/llpathfindinglinkset.cpp @@ -0,0 +1,387 @@ +/** +* @file llpathfindinglinkset.cpp +* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. +* @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 "llpathfindinglinkset.h" + +#include + +#include "llpathfindingobject.h" +#include "llsd.h" + +#define LINKSET_LAND_IMPACT_FIELD "landimpact" +#define LINKSET_MODIFIABLE_FIELD "modifiable" +#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), + 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), + 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), + mIsModifiable(pOther.mIsModifiable), + 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(*this) = pOther; + + mIsTerrain = pOther.mIsTerrain; + mLandImpact = pOther.mLandImpact; + mIsModifiable = pOther.mIsModifiable; + 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(isPhantom(pLinksetUse)); + } + + 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(); + + llassert(pLinksetData.has(LINKSET_MODIFIABLE_FIELD)); + llassert(pLinksetData.get(LINKSET_MODIFIABLE_FIELD).isBoolean()); + mIsModifiable = pLinksetData.get(LINKSET_MODIFIABLE_FIELD).asBoolean(); +} + +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(); + } + + llassert(pLinksetData.has(LINKSET_CATEGORY_FIELD)); + mLinksetUse = getLinksetUse(isPhantom, convertCategoryFromLLSD(pLinksetData.get(LINKSET_CATEGORY_FIELD))); + + 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); +} + +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(LINKSET_CATEGORY_VALUE_IGNORE); + break; + case kNavMeshGenerationInclude : + llsd = static_cast(LINKSET_CATEGORY_VALUE_INCLUDE); + break; + case kNavMeshGenerationExclude : + llsd = static_cast(LINKSET_CATEGORY_VALUE_EXCLUDE); + break; + default : + llsd = static_cast(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 000000000..73b4d6bad --- /dev/null +++ b/indra/newview/llpathfindinglinkset.h @@ -0,0 +1,108 @@ +/** +* @file llpathfindinglinkset.h +* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. +* @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_LLPATHFINDINGLINKSET_H +#define LL_LLPATHFINDINGLINKSET_H + +#include + +#include "llpathfindingobject.h" + +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); + + 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; + 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 000000000..746fa342a --- /dev/null +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -0,0 +1,196 @@ +/** +* @file llpathfindinglinksetlist.cpp +* @brief Implementation of llpathfindinglinksetlist +* @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 "llpathfindinglinksetlist.h" + +#include +#include + +#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(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(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(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(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(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(uuid, linksetPtr)); + } +} diff --git a/indra/newview/llpathfindinglinksetlist.h b/indra/newview/llpathfindinglinksetlist.h new file mode 100644 index 000000000..77c635864 --- /dev/null +++ b/indra/newview/llpathfindinglinksetlist.h @@ -0,0 +1,57 @@ +/** +* @file llpathfindinglinksetlist.h +* @brief Header file for llpathfindinglinksetlist +* @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_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 000000000..48775693a --- /dev/null +++ b/indra/newview/llpathfindingmanager.cpp @@ -0,0 +1,1050 @@ +/** +* @file llpathfindingmanager.cpp +* @brief Implementation of llpathfindingmanager +* @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 "llpathfindingmanager.h" + +#include +#include + +#include +#include +#include +#include + +#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 "llpathinglib.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_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/AgentStateUpdate" +#define SIM_MESSAGE_BODY_FIELD "body" + +#define CAP_SERVICE_AGENT_STATE "AgentState" + +#define AGENT_STATE_CAN_REBAKE_REGION_FIELD "can_modify_navmesh" + +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +class LLNavMeshSimStateChangeNode : public LLHTTPNode +{ +public: + virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; +}; + +LLHTTPRegistration 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 gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE); + +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +class NavMeshStatusResponder : public LLHTTPClient::Responder +{ +public: + NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly); + 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; + bool mIsGetStatusOnly; +}; + +//--------------------------------------------------------------------------- +// 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); + virtual ~AgentStateResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; +}; + + +//--------------------------------------------------------------------------- +// NavMeshRebakeResponder +//--------------------------------------------------------------------------- +class NavMeshRebakeResponder : public LLHTTPClient::Responder +{ +public: + NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback); + virtual ~NavMeshRebakeResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + LLPathfindingManager::rebake_navmesh_callback_t mRebakeNavMeshCallback; +}; + +//--------------------------------------------------------------------------- +// 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 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(), + mNavMeshMap(), + mAgentStateSignal() +{ +} + +LLPathfindingManager::~LLPathfindingManager() +{ + quitSystem(); +} + +void LLPathfindingManager::initSystem() +{ + /*if (LLPathingLib::getInstance() == NULL) + { + LLPathingLib::initSystem(); + }*/ +} + +void LLPathfindingManager::quitSystem() +{ + /*if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::quitSystem(); + }*/ +} + +bool LLPathfindingManager::isPathfindingViewEnabled() const +{ + return false; + //return (LLPathingLib::getInstance() != NULL); +} + +bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const +{ + return isPathfindingEnabledForRegion(getCurrentRegion()); +} + +bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const +{ + std::string retrieveNavMeshURL = getRetrieveNavMeshURLForRegion(pRegion); + return !retrieveNavMeshURL.empty(); +} + +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, bool pIsGetStatusOnly) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); + + if (pRegion == NULL) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else if (!pRegion->capabilitiesReceived()) + { + navMeshPtr->handleNavMeshWaitForRegionLoad(); + pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1, pIsGetStatusOnly)); + } + else if (!isPathfindingEnabledForRegion(pRegion)) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion); + llassert(!navMeshStatusURL.empty()); + navMeshPtr->handleNavMeshCheckVersion(); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion, pIsGetStatusOnly); + LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); + } +} + +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(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); + } + } +} + +LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) +{ + return mAgentStateSignal.connect(pAgentStateCallback); +} + +void LLPathfindingManager::requestGetAgentState() +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if (currentRegion == NULL) + { + mAgentStateSignal(FALSE); + } + else + { + if (!currentRegion->capabilitiesReceived()) + { + currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetAgentStateForRegion, this, _1)); + } + else if (!isPathfindingEnabledForRegion(currentRegion)) + { + mAgentStateSignal(FALSE); + } + else + { + std::string agentStateURL = getAgentStateURLForRegion(currentRegion); + llassert(!agentStateURL.empty()); + LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL); + LLHTTPClient::get(agentStateURL, responder); + } + } +} + +void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback) +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if (currentRegion == NULL) + { + pRebakeNavMeshCallback(false); + } + else if (!isPathfindingEnabledForRegion(currentRegion)) + { + pRebakeNavMeshCallback(false); + } + else + { + std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion(); + llassert(!navMeshStatusURL.empty()); + LLSD postData; + postData["command"] = "rebuild"; + LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder(navMeshStatusURL, pRebakeNavMeshCallback); + LLHTTPClient::post(navMeshStatusURL, postData, responder); + } +} + +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::handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID) +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetAgentState(); + } +} + +void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly) +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetNavMeshForRegion(currentRegion, pIsGetStatusOnly); + } +} + +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, bool pIsGetStatusOnly) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); + + if (!pNavMeshStatus.isValid()) + { + navMeshPtr->handleNavMeshError(); + } + else + { + if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus)) + { + navMeshPtr->handleRefresh(pNavMeshStatus); + } + else if (pIsGetStatusOnly) + { + navMeshPtr->handleNavMeshNewVersion(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); + } +} + +void LLPathfindingManager::handleAgentState(BOOL pCanRebakeRegion) +{ + mAgentStateSignal(pCanRebakeRegion); +} + +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(pRegionUUID, navMeshPtr)); + } + else + { + navMeshPtr = navMeshIter->second; + } + + return navMeshPtr; +} + +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) +{ + LLUUID regionUUID; + if (pRegion != NULL) + { + regionUUID = pRegion->getRegionID(); + } + + return getNavMeshForRegion(regionUUID); +} + +std::string LLPathfindingManager::getNavMeshStatusURLForCurrentRegion() const +{ + return getNavMeshStatusURLForRegion(getCurrentRegion()); +} + +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::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::getAgentStateURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE); +} + +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() : "") << "'" << llendl; + } + + return capabilityURL; +} + +LLViewerRegion *LLPathfindingManager::getCurrentRegion() const +{ + return gAgent.getRegion(); +} + +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const +{ + 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 +{ + llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).has(AGENT_STATE_CAN_REBAKE_REGION_FIELD)); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).isBoolean()); + BOOL canRebakeRegion = pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean(); + + LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion); +} + +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRegion(pRegion), + mRegionUUID(), + mIsGetStatusOnly(pIsGetStatusOnly) +{ + if (mRegion != NULL) + { + mRegionUUID = mRegion->getRegionID(); + } +} + +NavMeshStatusResponder::~NavMeshStatusResponder() +{ +} + +void NavMeshStatusResponder::result(const LLSD &pContent) +{ + LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly); +} + +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, mIsGetStatusOnly); +} + +//--------------------------------------------------------------------------- +// 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) +: LLHTTPClient::Responder() +, mCapabilityURL(pCapabilityURL) +{ +} + +AgentStateResponder::~AgentStateResponder() +{ +} + +void AgentStateResponder::result(const LLSD &pContent) +{ + llassert(pContent.has(AGENT_STATE_CAN_REBAKE_REGION_FIELD)); + llassert(pContent.get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).isBoolean()); + BOOL canRebakeRegion = pContent.get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean(); + LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion); +} + +void AgentStateResponder::error(U32 pStatus, const std::string &pReason) +{ + llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + LLPathfindingManager::getInstance()->handleAgentState(FALSE); +} + + +//--------------------------------------------------------------------------- +// navmesh rebake responder +//--------------------------------------------------------------------------- +NavMeshRebakeResponder::NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRebakeNavMeshCallback(pRebakeNavMeshCallback) +{ +} + +NavMeshRebakeResponder::~NavMeshRebakeResponder() +{ +} + +void NavMeshRebakeResponder::result(const LLSD &pContent) +{ + mRebakeNavMeshCallback(true); +} + +void NavMeshRebakeResponder::error(U32 pStatus, const std::string &pReason) +{ + llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + mRebakeNavMeshCallback(false); +} + +//--------------------------------------------------------------------------- +// 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 000000000..c61ff244f --- /dev/null +++ b/indra/newview/llpathfindingmanager.h @@ -0,0 +1,127 @@ +/** +* @file llpathfindingmanager.h +* @brief Header file for llpathfindingmanager +* @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_LLPATHFINDINGMANAGER_H +#define LL_LLPATHFINDINGMANAGER_H + +#include +#include + +#include +#include + +#include "llpathfindinglinkset.h" +#include "llpathfindingobjectlist.h" +#include "llpathfindingnavmesh.h" +#include "llsingleton.h" + +class LLPathfindingNavMeshStatus; +class LLUUID; +class LLViewerRegion; + +class LLPathfindingManager : public LLSingleton +{ + friend class LLNavMeshSimStateChangeNode; + friend class NavMeshStatusResponder; + friend class LLAgentStateChangeNode; + friend class AgentStateResponder; +public: + typedef enum { + kRequestStarted, + kRequestCompleted, + kRequestNotEnabled, + kRequestError + } ERequestStatus; + + LLPathfindingManager(); + virtual ~LLPathfindingManager(); + + void initSystem(); + void quitSystem(); + + bool isPathfindingViewEnabled() const; + bool isPathfindingEnabledForCurrentRegion() const; + bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; + + bool isAllowViewTerrainProperties() const; + + LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); + void requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly); + + typedef U32 request_id_t; + typedef boost::function 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; + + typedef boost::function agent_state_callback_t; + typedef boost::signals2::signal agent_state_signal_t; + typedef boost::signals2::connection agent_state_slot_t; + + agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); + void requestGetAgentState(); + + typedef boost::function rebake_navmesh_callback_t; + void requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback); + +protected: + +private: + typedef std::map NavMeshMap; + + void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); + + void handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID); + void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly); + 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, bool pIsGetStatusOnly); + void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); + + void handleAgentState(BOOL pCanRebakeRegion); + + LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); + LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); + + std::string getNavMeshStatusURLForCurrentRegion() const; + std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const; + std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const; + std::string getObjectLinksetsURLForCurrentRegion() const; + std::string getTerrainLinksetsURLForCurrentRegion() const; + std::string getCharactersURLForCurrentRegion() const; + std::string getAgentStateURLForRegion(LLViewerRegion *pRegion) 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; +}; + +#endif // LL_LLPATHFINDINGMANAGER_H diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp new file mode 100644 index 000000000..e01dd3a15 --- /dev/null +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -0,0 +1,205 @@ +/** +* @file llpathfindingnavmesh.cpp +* @brief Implementation of llpathfindingnavmesh +* @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 "llpathfindingnavmesh.h" + +#include + +#include "llpathfindingnavmeshstatus.h" +#include "llsd.h" +#include "llsdserialize.h" +#include "lluuid.h" + +#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) +{ + llassert(pContent.has(NAVMESH_VERSION_FIELD)); + 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(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(&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 000000000..7a844f54c --- /dev/null +++ b/indra/newview/llpathfindingnavmesh.h @@ -0,0 +1,91 @@ +/** +* @file llpathfindingnavmesh.h +* @brief Header file for llpathfindingnavmesh +* @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_LLPATHFINDINGNAVMESH_H +#define LL_LLPATHFINDINGNAVMESH_H + +#include + +#include +#include +#include + +#include "llpathfindingnavmeshstatus.h" +#include "llsd.h" + +class LLPathfindingNavMesh; +class LLUUID; + +typedef boost::shared_ptr LLPathfindingNavMeshPtr; + +class LLPathfindingNavMesh +{ +public: + typedef enum { + kNavMeshRequestUnknown, + kNavMeshRequestWaiting, + kNavMeshRequestChecking, + kNavMeshRequestNeedsUpdate, + kNavMeshRequestStarted, + kNavMeshRequestCompleted, + kNavMeshRequestNotEnabled, + kNavMeshRequestError + } ENavMeshRequestStatus; + + typedef boost::function navmesh_callback_t; + typedef boost::signals2::signal navmesh_signal_t; + typedef boost::signals2::connection navmesh_slot_t; + + LLPathfindingNavMesh(const LLUUID &pRegionUUID); + virtual ~LLPathfindingNavMesh(); + + navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback); + + 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 000000000..2eaa6075c --- /dev/null +++ b/indra/newview/llpathfindingnavmeshstatus.cpp @@ -0,0 +1,145 @@ +/** +* @file llpathfindingnavmeshstatus.cpp +* @brief Implementation of llpathfindingnavmeshstatus +* @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 "llpathfindingnavmeshstatus.h" + +#include + +#include "llsd.h" +#include "llstring.h" +#include "lluuid.h" + +#define REGION_FIELD "region_id" +#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(pContent.get(VERSION_FIELD).asInteger()); + + llassert(pContent.has(STATUS_FIELD)); + llassert(pContent.get(STATUS_FIELD).isString()); + std::string status = pContent.get(STATUS_FIELD).asString(); + + 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 000000000..74533fa48 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshstatus.h @@ -0,0 +1,77 @@ +/** +* @file llpathfindingnavmeshstatus.h +* @brief Header file for llpathfindingnavmeshstatus +* @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_LLPATHFINDINGNAVMESHSTATUS_H +#define LL_LLPATHFINDINGNAVMESHSTATUS_H + +#include + +#include "lluuid.h" + +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); + + 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/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp new file mode 100644 index 000000000..916eceb4c --- /dev/null +++ b/indra/newview/llpathfindingobject.cpp @@ -0,0 +1,162 @@ +/** +* @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 + +#include "llavatarname.h" +#include "llavatarnamecache.h" +#include "llsd.h" +#include "lluuid.h" +#include "v3math.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" +#define PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD "owner_is_group" + +//--------------------------------------------------------------------------- +// LLPathfindingObject +//--------------------------------------------------------------------------- + +LLPathfindingObject::LLPathfindingObject() + : mUUID(), + mName(), + mDescription(), + mOwnerUUID(), + mHasOwnerName(false), + mOwnerName(), + mIsGroupOwned(false), + mLocation() +{ +} + +LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData) + : mUUID(pUUID), + mName(), + mDescription(), + mOwnerUUID(), + mHasOwnerName(false), + mOwnerName(), + mIsGroupOwned(false), + mLocation() +{ + parseObjectData(pObjectData); +} + +LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther) + : mUUID(pOther.mUUID), + mName(pOther.mName), + mDescription(pOther.mDescription), + mOwnerUUID(pOther.mOwnerUUID), + mHasOwnerName(false), + mOwnerName(), + mIsGroupOwned(pOther.mIsGroupOwned), + 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(); + mIsGroupOwned = pOther.mIsGroupOwned; + 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(); + + llassert(pObjectData.has(PATHFINDING_OBJECT_OWNER_FIELD)); + llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID()); + mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID(); + fetchOwnerName(); + + if (pObjectData.has(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD)) + { + llassert(pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).isBoolean()); + mIsGroupOwned = pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).asBoolean(); + } + + 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()) + { + mHasOwnerName = LLAvatarNameCache::get(mOwnerUUID, &mOwnerName); + if (!mHasOwnerName) + { + 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 000000000..d45cc554f --- /dev/null +++ b/indra/newview/llpathfindingobject.h @@ -0,0 +1,80 @@ +/** +* @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 + +#include + +#include "llavatarname.h" +#include "lluuid.h" +#include "v3math.h" + +class LLPathfindingObject; +class LLSD; + +typedef boost::shared_ptr 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 BOOL isGroupOwned() const {return mIsGroupOwned;}; + 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; + BOOL mIsGroupOwned; + LLVector3 mLocation; +}; + +#endif // LL_LLPATHFINDINGOBJECT_H diff --git a/indra/newview/llpathfindingobjectlist.cpp b/indra/newview/llpathfindingobjectlist.cpp new file mode 100644 index 000000000..68a7e736e --- /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 +#include + +#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(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 000000000..3ad8e8b09 --- /dev/null +++ b/indra/newview/llpathfindingobjectlist.h @@ -0,0 +1,67 @@ +/** +* @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 +#include + +#include + +#include "llpathfindingobject.h" + +class LLPathfindingObjectList; + +typedef boost::shared_ptr LLPathfindingObjectListPtr; +typedef std::map 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/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index fbcd93912..1df29b37e 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -2,31 +2,25 @@ * @file llphysicsmotion.cpp * @brief Implementation of LLPhysicsMotion class. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2011, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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$ */ @@ -74,6 +68,19 @@ inline F64 llsgn(const F64 a) class LLPhysicsMotion { public: + typedef enum + { + SMOOTHING = 0, + MASS, + GRAVITY, + SPRING, + GAIN, + DAMPING, + DRAG, + MAX_EFFECT, + NUM_PARAMS + } eParamName; + /* param_driver_name: The param that controls the params that are being affected by the physics. joint_name: The joint that the body part is attached to. The joint is @@ -107,8 +114,12 @@ public: mVelocity_local(0) { mJointState = new LLJointState; - } + for (U32 i = 0; i < NUM_PARAMS; ++i) + { + mParamCache[i] = NULL; + } + } void getString(std::ostringstream &oss); BOOL initialize(); @@ -124,19 +135,46 @@ public: void reset(); protected: - F32 getParamValue(const std::string& controller_key) - { - const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key); + + F32 getParamValue(eParamName param) + { + static std::string controller_key[] = + { + "Smoothing", + "Mass", + "Gravity", + "Spring", + "Gain", + "Damping", + "Drag", + "MaxEffect" + }; + + if (!mParamCache[param]) + { + const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key[param]); if (entry == mParamControllers.end()) { - return sDefaultController[controller_key]; + return sDefaultController[controller_key[param]]; } const std::string& param_name = (*entry).second.c_str(); - return mCharacter->getVisualParamWeight(param_name.c_str()); - } + mParamCache[param] = mCharacter->getVisualParam(param_name.c_str()); + } + + if (mParamCache[param]) + { + return mParamCache[param]->getWeight(); + } + else + { + return sDefaultController[controller_key[param]]; + } + } + + void setParamValue(LLViewerVisualParam *param, const F32 new_value_local, - F32 behavior_maxeffect); + F32 behavior_maxeffect); F32 toLocal(const LLVector3 &world); F32 calculateVelocity_local(); @@ -164,6 +202,8 @@ private: F32 mLastTime; + LLVisualParam* mParamCache[NUM_PARAMS]; + static default_controller_map_t sDefaultController; }; @@ -268,7 +308,7 @@ void LLPhysicsMotion::getString(std::ostringstream &oss) oss << " Controllers:" << std::endl; for(controller_map_t::const_iterator it = mParamControllers.begin(); it!= mParamControllers.end(); ++it) { - oss << " mParamControllers[\"" << it->first << "\"] = \"" << it->second << "\" =" << getParamValue(it->first) << std::endl; + oss << " mParamControllers[\"" << it->first << "\"] = \"" << it->second << "\" =" << mCharacter->getVisualParamWeight(it->first.c_str()) << std::endl; } } @@ -574,15 +614,16 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) LLJoint *joint = mJointState->getJoint(); - const F32 behavior_mass = getParamValue("Mass"); - const F32 behavior_gravity = getParamValue("Gravity"); - const F32 behavior_spring = getParamValue("Spring"); - const F32 behavior_gain = getParamValue("Gain"); - const F32 behavior_damping = getParamValue("Damping"); - const F32 behavior_drag = getParamValue("Drag"); - const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts. + const F32 behavior_mass = getParamValue(MASS); + const F32 behavior_gravity = getParamValue(GRAVITY); + const F32 behavior_spring = getParamValue(SPRING); + const F32 behavior_gain = getParamValue(GAIN); + const F32 behavior_damping = getParamValue(DAMPING); + const F32 behavior_drag = getParamValue(DRAG); + F32 behavior_maxeffect = getParamValue(MAX_EFFECT); + + const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts. - F32 behavior_maxeffect = getParamValue("MaxEffect"); if (physics_test) behavior_maxeffect = 1.0f; diff --git a/indra/newview/llphysicsmotion.h b/indra/newview/llphysicsmotion.h index 7e6bddd17..7412c9d88 100644 --- a/indra/newview/llphysicsmotion.h +++ b/indra/newview/llphysicsmotion.h @@ -2,31 +2,25 @@ * @file llphysicsmotion.h * @brief Implementation of LLPhysicsMotion class. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2011, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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$ */ @@ -113,6 +107,7 @@ public: virtual void onDeactivate(); LLCharacter* getCharacter() { return mCharacter; } + protected: void addMotion(LLPhysicsMotion *motion); private: diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index 491cf43f3..d7b342b25 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -229,16 +229,20 @@ U32 LLPolyMeshSharedData::getNumKB() BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices ) { U32 i; - mBaseCoords = new LLVector3[ numVertices ]; - mBaseNormals = new LLVector3[ numVertices ]; - mBaseBinormals = new LLVector3[ numVertices ]; + mBaseCoords = new LLVector4a[ numVertices ]; + mBaseNormals = new LLVector4a[ numVertices ]; + mBaseBinormals = new LLVector4a[ numVertices ]; mTexCoords = new LLVector2[ numVertices ]; mDetailTexCoords = new LLVector2[ numVertices ]; mWeights = new F32[ numVertices ]; for (i = 0; i < numVertices; i++) { + mBaseCoords[i].clear(); + mBaseNormals[i].clear(); + mBaseBinormals[i].clear(); + mTexCoords[i].clear(); mWeights[i] = 0.f; - } + } mNumVertices = numVertices; return TRUE; } @@ -408,40 +412,48 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) allocateVertexData( numVertices ); - //---------------------------------------------------------------- - // Coords - //---------------------------------------------------------------- - numRead = fread(mBaseCoords, 3*sizeof(float), numVertices, fp); - llendianswizzle(mBaseCoords, sizeof(float), 3*numVertices); - if (numRead != numVertices) + for (U16 i = 0; i < numVertices; ++i) { - llerrs << "can't read Coordinates from " << fileName << llendl; - return FALSE; - } + //---------------------------------------------------------------- + // Coords + //---------------------------------------------------------------- + numRead = fread(&mBaseCoords[i], sizeof(float), 3, fp); + llendianswizzle(&mBaseCoords[i], sizeof(float), 3); + if (numRead != 3) + { + llerrs << "can't read Coordinates from " << fileName << llendl; + return FALSE; + } + } - //---------------------------------------------------------------- - // Normals - //---------------------------------------------------------------- - numRead = fread(mBaseNormals, 3*sizeof(float), numVertices, fp); - llendianswizzle(mBaseNormals, sizeof(float), 3*numVertices); - if (numRead != numVertices) - { - llerrs << " can't read Normals from " << fileName << llendl; - return FALSE; - } + for (U16 i = 0; i < numVertices; ++i) + { + //---------------------------------------------------------------- + // Normals + //---------------------------------------------------------------- + numRead = fread(&mBaseNormals[i], sizeof(float), 3, fp); + llendianswizzle(&mBaseNormals[i], sizeof(float), 3); + if (numRead != 3) + { + llerrs << " can't read Normals from " << fileName << llendl; + return FALSE; + } + } - //---------------------------------------------------------------- - // Binormals - //---------------------------------------------------------------- - numRead = fread(mBaseBinormals, 3*sizeof(float), numVertices, fp); - llendianswizzle(mBaseBinormals, sizeof(float), 3*numVertices); - if (numRead != numVertices) - { - llerrs << " can't read Binormals from " << fileName << llendl; - return FALSE; + for (U16 i = 0; i < numVertices; ++i) + { + //---------------------------------------------------------------- + // Binormals + //---------------------------------------------------------------- + numRead = fread(&mBaseBinormals[i], sizeof(float), 3, fp); + llendianswizzle(&mBaseBinormals[i], sizeof(float), 3); + if (numRead != 3) + { + llerrs << " can't read Binormals from " << fileName << llendl; + return FALSE; + } } - //---------------------------------------------------------------- // TexCoords //---------------------------------------------------------------- @@ -767,21 +779,28 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_ { // Allocate memory without initializing every vector // NOTE: This makes asusmptions about the size of LLVector[234] - int nverts = mSharedData->mNumVertices; - int nfloats = nverts * (2*4 + 3*3 + 2 + 4); + S32 nverts = mSharedData->mNumVertices; + //make sure it's an even number of verts for alignment + nverts += nverts%2; + S32 nfloats = nverts * ( + 4 + //coords + 4 + //normals + 4 + //weights + 2 + //coords + 4 + //scaled normals + 4 + //binormals + 4); //scaled binormals + //use 16 byte aligned vertex data to make LLPolyMesh SSE friendly mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4); - int offset = 0; - mCoords = (LLVector4*)(mVertexData + offset); offset += 4*nverts; - mNormals = (LLVector4*)(mVertexData + offset); offset += 4*nverts; - mClothingWeights = (LLVector4*)(mVertexData + offset); offset += 4*nverts; - mTexCoords = (LLVector2*)(mVertexData + offset); offset += 2*nverts; - - // these members don't need to be 16-byte aligned, but the first one might be - // read during an aligned memcpy of mTexCoords - mScaledNormals = (LLVector3*)(mVertexData + offset); offset += 3*nverts; - mBinormals = (LLVector3*)(mVertexData + offset); offset += 3*nverts; - mScaledBinormals = (LLVector3*)(mVertexData + offset); offset += 3*nverts; + S32 offset = 0; + mCoords = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; + mNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; + mClothingWeights = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; + mTexCoords = (LLVector2*)(mVertexData + offset); offset += 2*nverts; + mScaledNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; + mBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; + mScaledBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts; initializeForMorph(); } } @@ -966,38 +985,47 @@ BOOL LLPolyMesh::saveLLM(LLFILE *fp) //---------------------------------------------------------------- // Coords //---------------------------------------------------------------- - LLVector3* coords = mSharedData->mBaseCoords; - - llendianswizzle(coords, sizeof(float), 3*numVertices); - if (fwrite(coords, 3*sizeof(float), numVertices, fp) != numVertices) + for (U16 i = 0; i < numVertices; ++i) { - llwarns << "Short write" << llendl; + LLVector4a& coords = mSharedData->mBaseCoords[i]; + + llendianswizzle(coords.getF32ptr(), sizeof(float), 3); + if (fwrite(coords.getF32ptr(), 3*sizeof(float), 1, fp) != 1) + { + llwarns << "Short write" << llendl; + } + llendianswizzle(coords.getF32ptr(), sizeof(float), 3); } - llendianswizzle(coords, sizeof(float), 3*numVertices); //---------------------------------------------------------------- // Normals //---------------------------------------------------------------- - LLVector3* normals = mSharedData->mBaseNormals; - - llendianswizzle(normals, sizeof(float), 3*numVertices); - if (fwrite(normals, 3*sizeof(float), numVertices, fp) != numVertices) + for (U16 i = 0; i < numVertices; ++i) { - llwarns << "Short write" << llendl; + LLVector4a& normals = mSharedData->mBaseNormals[i]; + + llendianswizzle(normals.getF32ptr(), sizeof(float), 3); + if (fwrite(normals.getF32ptr(), 3*sizeof(float), 1, fp) != 1) + { + llwarns << "Short write" << llendl; + } + llendianswizzle(normals.getF32ptr(), sizeof(float), 3); } - llendianswizzle(normals, sizeof(float), 3*numVertices); //---------------------------------------------------------------- // Binormals //---------------------------------------------------------------- - LLVector3* binormals = mSharedData->mBaseBinormals; - - llendianswizzle(binormals, sizeof(float), 3*numVertices); - if (fwrite(binormals, 3*sizeof(float), numVertices, fp) != numVertices) + for (U16 i = 0; i < numVertices; ++i) { - llwarns << "Short write" << llendl; + LLVector4a& binormals = mSharedData->mBaseBinormals[i]; + + llendianswizzle(binormals.getF32ptr(), sizeof(float), 3); + if (fwrite(binormals.getF32ptr(), 3*sizeof(float), 1, fp) != 1) + { + llwarns << "Short write" << llendl; + } + llendianswizzle(binormals.getF32ptr(), sizeof(float), 3); } - llendianswizzle(binormals, sizeof(float), 3*numVertices); //---------------------------------------------------------------- // TexCoords @@ -1224,24 +1252,24 @@ BOOL LLPolyMesh::saveOBJ(LLFILE *fp) int nfaces = mSharedData->mNumFaces; int i; - LLVector4* coords = getWritableCoords(); + LLVector4a* coords = getWritableCoords(); for ( i=0; imBaseCoords, mCoords, sizeof(LLVector3) * mSharedData->mNumVertices); - memcpy(mSharedData->mBaseNormals, mNormals, sizeof(LLVector3) * mSharedData->mNumVertices); - memcpy(mSharedData->mBaseBinormals, mBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); - memcpy(mSharedData->mTexCoords, mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mSharedData->mBaseCoords, (F32*) mCoords, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mSharedData->mBaseNormals, (F32*) mNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mSharedData->mBaseBinormals, (F32*) mBinormals, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mSharedData->mTexCoords, (F32*) mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2)); // Update all avatars by applying the delta @@ -1479,27 +1496,29 @@ BOOL LLPolyMesh::setSharedFromCurrent() LLPolyMesh* mesh = avatarp->getMesh(mSharedData); if (mesh) { - LLVector4 *mesh_coords = mesh->getWritableCoords(); - LLVector4 *mesh_normals = mesh->getWritableNormals(); - LLVector3 *mesh_binormals = mesh->getWritableBinormals(); - LLVector2 *mesh_tex_coords = mesh->getWritableTexCoords(); - LLVector3 *mesh_scaled_normals = mesh->getScaledNormals(); - LLVector3 *mesh_scaled_binormals = mesh->getScaledBinormals(); + LLVector4a *mesh_coords = mesh->getWritableCoords(); + LLVector4a *mesh_normals = mesh->getWritableNormals(); + LLVector4a *mesh_binormals = mesh->getWritableBinormals(); + LLVector2 *mesh_tex_coords = mesh->getWritableTexCoords(); + LLVector4a *mesh_scaled_normals = mesh->getScaledNormals(); + LLVector4a *mesh_scaled_binormals = mesh->getScaledBinormals(); for( vert_index = 0; vert_index < nverts; vert_index++) { - mesh_coords[vert_index] -= delta_coords[vert_index]; + mesh_coords[vert_index].sub(delta_coords[vert_index]); mesh_tex_coords[vert_index] -= delta_tex_coords[vert_index]; - mesh_scaled_normals[vert_index] -= LLVector3(delta_normals[vert_index]); - LLVector3 normalized_normal = mesh_scaled_normals[vert_index]; - normalized_normal.normVec(); - mesh_normals[vert_index] = LLVector4(normalized_normal); + mesh_scaled_normals[vert_index].sub(delta_normals[vert_index]); + LLVector4a normalized_normal = mesh_scaled_normals[vert_index]; + normalized_normal.normalize3(); + mesh_normals[vert_index] = normalized_normal; - mesh_scaled_binormals[vert_index] -= delta_binormals[vert_index]; - LLVector3 tangent = mesh_scaled_binormals[vert_index] % normalized_normal; - LLVector3 normalized_binormal = normalized_normal % tangent; - normalized_binormal.normVec(); + mesh_scaled_binormals[vert_index].sub(delta_binormals[vert_index]); + LLVector4a tangent; + tangent.setCross3(mesh_scaled_binormals[vert_index], normalized_normal); + LLVector4a normalized_binormal; + normalized_binormal.setCross3(normalized_normal, tangent); + normalized_binormal.normalize3(); mesh_binormals[vert_index] = normalized_binormal; } @@ -1598,7 +1617,7 @@ void LLPolyMesh::dumpDiagInfo(void*) //----------------------------------------------------------------------------- // getWritableCoords() //----------------------------------------------------------------------------- -LLVector4 *LLPolyMesh::getWritableCoords() +LLVector4a *LLPolyMesh::getWritableCoords() { return mCoords; } @@ -1606,7 +1625,7 @@ LLVector4 *LLPolyMesh::getWritableCoords() //----------------------------------------------------------------------------- // getWritableNormals() //----------------------------------------------------------------------------- -LLVector4 *LLPolyMesh::getWritableNormals() +LLVector4a *LLPolyMesh::getWritableNormals() { return mNormals; } @@ -1614,7 +1633,7 @@ LLVector4 *LLPolyMesh::getWritableNormals() //----------------------------------------------------------------------------- // getWritableBinormals() //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getWritableBinormals() +LLVector4a *LLPolyMesh::getWritableBinormals() { return mBinormals; } @@ -1623,7 +1642,7 @@ LLVector3 *LLPolyMesh::getWritableBinormals() //----------------------------------------------------------------------------- // getWritableClothingWeights() //----------------------------------------------------------------------------- -LLVector4 *LLPolyMesh::getWritableClothingWeights() +LLVector4a *LLPolyMesh::getWritableClothingWeights() { return mClothingWeights; } @@ -1639,7 +1658,7 @@ LLVector2 *LLPolyMesh::getWritableTexCoords() //----------------------------------------------------------------------------- // getScaledNormals() //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getScaledNormals() +LLVector4a *LLPolyMesh::getScaledNormals() { return mScaledNormals; } @@ -1647,7 +1666,7 @@ LLVector3 *LLPolyMesh::getScaledNormals() //----------------------------------------------------------------------------- // getScaledBinormals() //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getScaledBinormals() +LLVector4a *LLPolyMesh::getScaledBinormals() { return mScaledBinormals; } @@ -1661,19 +1680,20 @@ void LLPolyMesh::initializeForMorph() if (!mSharedData) return; + LLVector4a::memcpyNonAliased16((F32*) mCoords, (F32*) mSharedData->mBaseCoords, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mScaledNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); + LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2)); + for (U32 i = 0; i < (U32)mSharedData->mNumVertices; ++i) { - mCoords[i] = LLVector4(mSharedData->mBaseCoords[i]); - mNormals[i] = LLVector4(mSharedData->mBaseNormals[i]); + mClothingWeights[i].clear(); } - - memcpy(mScaledNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/ - memcpy(mBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/ - memcpy(mScaledBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/ - memcpy(mTexCoords, mSharedData->mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices); /*Flawfinder: ignore*/ - memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices); } + //----------------------------------------------------------------------------- // getMorphList() //----------------------------------------------------------------------------- @@ -1818,8 +1838,8 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) //----------------------------------------------------------------------------- LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp) { - mAvatar = avatarp; - mDefaultVec.setVec(0.001f, 0.001f, 0.001f); + mAvatar = avatarp; + mDefaultVec.splat(0.001f); } //----------------------------------------------------------------------------- @@ -1947,36 +1967,49 @@ LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data, const LLVector3 &direction, const std::string &name) { - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); - cloned_morph_data->mName = name; - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v] = direction; - cloned_morph_data->mNormals[v] = LLVector3(0,0,0); - cloned_morph_data->mBinormals[v] = LLVector3(0,0,0); - } - return cloned_morph_data; + LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); + cloned_morph_data->mName = name; + LLVector4a dir; + dir.load3(direction.mV); + + for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) + { + cloned_morph_data->mCoords[v] = dir; + cloned_morph_data->mNormals[v].clear(); + cloned_morph_data->mBinormals[v].clear(); + } + return cloned_morph_data; } LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data, F32 scale, const std::string &name) { - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); - cloned_morph_data->mName = name; - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v] = src_data->mCoords[v]*scale; - cloned_morph_data->mNormals[v] = src_data->mNormals[v]*scale; - cloned_morph_data->mBinormals[v] = src_data->mBinormals[v]*scale; - if (cloned_morph_data->mCoords[v][1] < 0) - { - cloned_morph_data->mCoords[v][1] *= -1; - cloned_morph_data->mNormals[v][1] *= -1; - cloned_morph_data->mBinormals[v][1] *= -1; - } - } - return cloned_morph_data; + LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); + cloned_morph_data->mName = name; + + LLVector4a sc; + sc.splat(scale); + + LLVector4a nsc; + nsc.set(scale, -scale, scale, scale); + + for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) + { + if (cloned_morph_data->mCoords[v][1] < 0) + { + cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc); + cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc); + cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc); + } + else + { + cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc); + cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc); + cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc); + } + } + return cloned_morph_data; } // End diff --git a/indra/newview/llpolymesh.h b/indra/newview/llpolymesh.h index 4b7927564..d09909309 100644 --- a/indra/newview/llpolymesh.h +++ b/indra/newview/llpolymesh.h @@ -73,9 +73,9 @@ private: // vertex data S32 mNumVertices; - LLVector3 *mBaseCoords; - LLVector3 *mBaseNormals; - LLVector3 *mBaseBinormals; + LLVector4a *mBaseCoords; + LLVector4a *mBaseNormals; + LLVector4a *mBaseBinormals; LLVector2 *mTexCoords; LLVector2 *mDetailTexCoords; F32 *mWeights; @@ -235,41 +235,41 @@ public: } // Get coords - const LLVector4 *getCoords() const{ + const LLVector4a *getCoords() const{ return mCoords; } // non const version - LLVector4 *getWritableCoords(); + LLVector4a *getWritableCoords(); // Get normals - const LLVector4 *getNormals() const{ + const LLVector4a *getNormals() const{ return mNormals; } // Get normals - const LLVector3 *getBinormals() const{ + const LLVector4a *getBinormals() const{ return mBinormals; } // Get base mesh normals - const LLVector3 *getBaseNormals() const{ + const LLVector4a *getBaseNormals() const{ llassert(mSharedData); return mSharedData->mBaseNormals; } // Get base mesh normals - const LLVector3 *getBaseBinormals() const{ + const LLVector4a *getBaseBinormals() const{ llassert(mSharedData); return mSharedData->mBaseBinormals; } // intermediate morphed normals and output normals - LLVector4 *getWritableNormals(); - LLVector3 *getScaledNormals(); + LLVector4a *getWritableNormals(); + LLVector4a *getScaledNormals(); - LLVector3 *getWritableBinormals(); - LLVector3 *getScaledBinormals(); + LLVector4a *getWritableBinormals(); + LLVector4a *getScaledBinormals(); // Get texCoords const LLVector2 *getTexCoords() const { @@ -293,9 +293,9 @@ public: F32 *getWritableWeights() const; - LLVector4 *getWritableClothingWeights(); + LLVector4a *getWritableClothingWeights(); - const LLVector4 *getClothingWeights() + const LLVector4a *getClothingWeights() { return mClothingWeights; } @@ -363,17 +363,17 @@ protected: // Single array of floats for allocation / deletion F32 *mVertexData; // deformed vertices (resulting from application of morph targets) - LLVector4 *mCoords; + LLVector4a *mCoords; // deformed normals (resulting from application of morph targets) - LLVector3 *mScaledNormals; + LLVector4a *mScaledNormals; // output normals (after normalization) - LLVector4 *mNormals; + LLVector4a *mNormals; // deformed binormals (resulting from application of morph targets) - LLVector3 *mScaledBinormals; + LLVector4a *mScaledBinormals; // output binormals (after normalization) - LLVector3 *mBinormals; + LLVector4a *mBinormals; // weight values that mark verts as clothing/skin - LLVector4 *mClothingWeights; + LLVector4a *mClothingWeights; // output texture coordinates LLVector2 *mTexCoords; @@ -441,17 +441,17 @@ public: // LLViewerVisualParam Virtual functions /*virtual*/ F32 getTotalDistortion() { return 0.1f; } - /*virtual*/ const LLVector3& getAvgDistortion() { return mDefaultVec; } + /*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; } /*virtual*/ F32 getMaxDistortion() { return 0.1f; } - /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector3(0.001f, 0.001f, 0.001f);} - /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; - /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;}; + /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);} + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;}; protected: typedef std::map joint_vec_map_t; joint_vec_map_t mJointScales; joint_vec_map_t mJointOffsets; - LLVector3 mDefaultVec; + LLVector4a mDefaultVec; // Backlink only; don't make this an LLPointer. LLVOAvatar *mAvatar; }; diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp index 73a0b525c..b43837e89 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/newview/llpolymorph.cpp @@ -49,7 +49,7 @@ LLPolyMorphData::LLPolyMorphData(const std::string& morph_name) mNumIndices = 0; mCurrentIndex = 0; mTotalDistortion = 0.f; - mAvgDistortion.zeroVec(); + mAvgDistortion.clear(); mMaxDistortion = 0.f; mVertexIndices = NULL; mCoords = NULL; @@ -74,9 +74,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) : { const S32 numVertices = mNumIndices; - mCoords = new LLVector3[numVertices]; - mNormals = new LLVector3[numVertices]; - mBinormals = new LLVector3[numVertices]; + mCoords = new LLVector4a[numVertices]; + mNormals = new LLVector4a[numVertices]; + mBinormals = new LLVector4a[numVertices]; mTexCoords = new LLVector2[numVertices]; mVertexIndices = new U32[numVertices]; @@ -90,6 +90,7 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) : } } + //----------------------------------------------------------------------------- // ~LLPolyMorphData() //----------------------------------------------------------------------------- @@ -121,16 +122,16 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) //------------------------------------------------------------------------- // allocate vertices //------------------------------------------------------------------------- - mCoords = new LLVector3[numVertices]; - mNormals = new LLVector3[numVertices]; - mBinormals = new LLVector3[numVertices]; + mCoords = new LLVector4a[numVertices]; + mNormals = new LLVector4a[numVertices]; + mBinormals = new LLVector4a[numVertices]; mTexCoords = new LLVector2[numVertices]; // Actually, we are allocating more space than we need for the skiplist mVertexIndices = new U32[numVertices]; mNumIndices = 0; mTotalDistortion = 0.f; mMaxDistortion = 0.f; - mAvgDistortion.zeroVec(); + mAvgDistortion.clear(); mMesh = mesh; //------------------------------------------------------------------------- @@ -152,36 +153,36 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) } - numRead = fread(&mCoords[v].mV, sizeof(F32), 3, fp); - llendianswizzle(&mCoords[v].mV, sizeof(F32), 3); + numRead = fread(&mCoords[v], sizeof(F32), 3, fp); + llendianswizzle(&mCoords[v], sizeof(F32), 3); if (numRead != 3) { llwarns << "Can't read morph target vertex coordinates" << llendl; return FALSE; } - F32 magnitude = mCoords[v].magVec(); + F32 magnitude = mCoords[v].getLength3().getF32(); mTotalDistortion += magnitude; - mAvgDistortion.mV[VX] += fabs(mCoords[v].mV[VX]); - mAvgDistortion.mV[VY] += fabs(mCoords[v].mV[VY]); - mAvgDistortion.mV[VZ] += fabs(mCoords[v].mV[VZ]); + LLVector4a t; + t.setAbs(mCoords[v]); + mAvgDistortion.add(t); if (magnitude > mMaxDistortion) { mMaxDistortion = magnitude; } - numRead = fread(&mNormals[v].mV, sizeof(F32), 3, fp); - llendianswizzle(&mNormals[v].mV, sizeof(F32), 3); + numRead = fread(&mNormals[v], sizeof(F32), 3, fp); + llendianswizzle(&mNormals[v], sizeof(F32), 3); if (numRead != 3) { llwarns << "Can't read morph target normal" << llendl; return FALSE; } - numRead = fread(&mBinormals[v].mV, sizeof(F32), 3, fp); - llendianswizzle(&mBinormals[v].mV, sizeof(F32), 3); + numRead = fread(&mBinormals[v], sizeof(F32), 3, fp); + llendianswizzle(&mBinormals[v], sizeof(F32), 3); if (numRead != 3) { llwarns << "Can't read morph target binormal" << llendl; @@ -200,8 +201,8 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) mNumIndices++; } - mAvgDistortion = mAvgDistortion * (1.f/(F32)mNumIndices); - mAvgDistortion.normVec(); + mAvgDistortion.mul(1.f/(F32)mNumIndices); + mAvgDistortion.normalize3fast(); return TRUE; } @@ -235,26 +236,26 @@ BOOL LLPolyMorphData::saveLLM(LLFILE *fp) } llendianswizzle(&mVertexIndices[v], sizeof(U32), 1); - llendianswizzle(&mCoords[v].mV, sizeof(F32), 3); - if (fwrite(&mCoords[v].mV, sizeof(F32), 3, fp) != 3) + llendianswizzle(mCoords[v].getF32ptr(), sizeof(F32), 3); + if (fwrite(mCoords[v].getF32ptr(), sizeof(F32), 3, fp) != 3) { llwarns << "Short write" << llendl; } - llendianswizzle(&mCoords[v].mV, sizeof(F32), 3); + llendianswizzle(mCoords[v].getF32ptr(), sizeof(F32), 3); - llendianswizzle(&mNormals[v].mV, sizeof(F32), 3); - if (fwrite(&mNormals[v].mV, sizeof(F32), 3, fp) != 3) + llendianswizzle(mNormals[v].getF32ptr(), sizeof(F32), 3); + if (fwrite(mNormals[v].getF32ptr(), sizeof(F32), 3, fp) != 3) { llwarns << "Short write" << llendl; } - llendianswizzle(&mNormals[v].mV, sizeof(F32), 3); + llendianswizzle(mNormals[v].getF32ptr(), sizeof(F32), 3); - llendianswizzle(&mBinormals[v].mV, sizeof(F32), 3); - if (fwrite(&mBinormals[v].mV, sizeof(F32), 3, fp) != 3) + llendianswizzle(mBinormals[v].getF32ptr(), sizeof(F32), 3); + if (fwrite(mBinormals[v].getF32ptr(), sizeof(F32), 3, fp) != 3) { llwarns << "Short write" << llendl; } - llendianswizzle(&mBinormals[v].mV, sizeof(F32), 3); + llendianswizzle(mBinormals[v].getF32ptr(), sizeof(F32), 3); llendianswizzle(&mTexCoords[v].mV, sizeof(F32), 2); if (fwrite(&mTexCoords[v].mV, sizeof(F32), 2, fp) != 2) @@ -277,17 +278,17 @@ BOOL LLPolyMorphData::saveOBJ(LLFILE *fp) LLPolyMesh mesh(mMesh, NULL); - LLVector4 *coords = mesh.getWritableCoords(); - LLVector4 *normals = mesh.getWritableNormals(); + LLVector4a *coords = mesh.getWritableCoords(); + LLVector4a *normals = mesh.getWritableNormals(); LLVector2 *tex_coords = mesh.getWritableTexCoords(); for(U32 vert_index_morph = 0; vert_index_morph < mNumIndices; vert_index_morph++) { S32 vert_index_mesh = mVertexIndices[vert_index_morph]; - coords[vert_index_mesh] += LLVector4(mCoords[vert_index_morph]); - normals[vert_index_mesh] += LLVector4(mNormals[vert_index_morph]); - normals[vert_index_mesh].normVec(); + coords[vert_index_mesh].add(mCoords[vert_index_morph]); + normals[vert_index_mesh].add(mNormals[vert_index_morph]); + normals[vert_index_mesh].normalize3(); tex_coords[vert_index_mesh] += mTexCoords[vert_index_morph]; } @@ -302,9 +303,9 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph) if (!morph) return FALSE; - LLVector4 *morph_coords = morph->getWritableCoords(); - LLVector4 *morph_normals = morph->getWritableNormals(); - LLVector3 *morph_binormals = morph->getWritableBinormals(); + LLVector4a *morph_coords = morph->getWritableCoords(); + LLVector4a *morph_normals = morph->getWritableNormals(); + LLVector4a *morph_binormals = morph->getWritableBinormals(); LLVector2 *morph_tex_coords = morph->getWritableTexCoords(); // We now have the morph loaded as a mesh. We have to subtract the @@ -313,19 +314,19 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph) LLPolyMesh delta(mMesh, NULL); U32 nverts = delta.getNumVertices(); - LLVector4 *delta_coords = delta.getWritableCoords(); - LLVector4 *delta_normals = delta.getWritableNormals(); - LLVector3 *delta_binormals = delta.getWritableBinormals(); + LLVector4a *delta_coords = delta.getWritableCoords(); + LLVector4a *delta_normals = delta.getWritableNormals(); + LLVector4a *delta_binormals = delta.getWritableBinormals(); LLVector2 *delta_tex_coords = delta.getWritableTexCoords(); U32 num_significant = 0; U32 vert_index; for( vert_index = 0; vert_index < nverts; vert_index++) { - delta_coords[vert_index] = morph_coords[vert_index] - delta_coords[vert_index]; - delta_normals[vert_index] = morph_normals[vert_index] - delta_normals[vert_index]; - delta_binormals[vert_index] = morph_binormals[vert_index] - delta_binormals[vert_index]; - delta_tex_coords[vert_index] = morph_tex_coords[vert_index] - delta_tex_coords[vert_index]; + delta_coords[vert_index].setSub( morph_coords[vert_index], delta_coords[vert_index]); + delta_normals[vert_index].setSub( morph_normals[vert_index], delta_normals[vert_index]); + delta_binormals[vert_index].setSub( morph_binormals[vert_index], delta_binormals[vert_index]); + delta_tex_coords[vert_index] = morph_tex_coords[vert_index] - delta_tex_coords[vert_index]; // For the normals and binormals, we really want the deltas // to be perpendicular to the mesh (bi)normals in the plane @@ -333,10 +334,10 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph) // that the morph (bi)normals form the hypotenuses of right // triangles. Right now, we just compute the difference vector. - if (delta_coords[vert_index].length() > SIGNIFICANT_DELTA - || delta_normals[vert_index].length() > SIGNIFICANT_DELTA - || delta_binormals[vert_index].length() > SIGNIFICANT_DELTA - || delta_tex_coords[vert_index].length() > SIGNIFICANT_DELTA) + if (delta_coords[vert_index].getLength3().getF32() > SIGNIFICANT_DELTA + || delta_normals[vert_index].getLength3().getF32() > SIGNIFICANT_DELTA + || delta_binormals[vert_index].getLength3().getF32() > SIGNIFICANT_DELTA + || delta_tex_coords[vert_index].length() > SIGNIFICANT_DELTA) { num_significant++; } @@ -353,39 +354,39 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph) if (num_significant == 0) nindices = 1; - LLVector3* new_coords = new LLVector3[nindices]; - LLVector3* new_normals = new LLVector3[nindices]; - LLVector3* new_binormals = new LLVector3[nindices]; + LLVector4a* new_coords = new LLVector4a[nindices]; + LLVector4a* new_normals = new LLVector4a[nindices]; + LLVector4a* new_binormals = new LLVector4a[nindices]; LLVector2* new_tex_coords = new LLVector2[nindices]; U32* new_vertex_indices = new U32[nindices]; // We'll set the distortion directly mTotalDistortion = 0.f; mMaxDistortion = 0.f; - mAvgDistortion.zeroVec(); + mAvgDistortion.clear(); U32 morph_index = 0; for( vert_index = 0; vert_index < nverts; vert_index++) { - if (delta_coords[vert_index].length() > SIGNIFICANT_DELTA - || delta_normals[vert_index].length() > SIGNIFICANT_DELTA - || delta_binormals[vert_index].length() > SIGNIFICANT_DELTA - || delta_tex_coords[vert_index].length() > SIGNIFICANT_DELTA + if (delta_coords[vert_index].getLength3().getF32() > SIGNIFICANT_DELTA + || delta_normals[vert_index].getLength3().getF32() > SIGNIFICANT_DELTA + || delta_binormals[vert_index].getLength3().getF32() > SIGNIFICANT_DELTA + || delta_tex_coords[vert_index].length() > SIGNIFICANT_DELTA || num_significant == 0) { new_vertex_indices[morph_index] = vert_index; - new_coords[morph_index] = LLVector3(delta_coords[vert_index]); - new_normals[morph_index] = LLVector3(delta_normals[vert_index]); + new_coords[morph_index] = delta_coords[vert_index]; + new_normals[morph_index] = delta_normals[vert_index]; new_binormals[morph_index] = delta_binormals[vert_index]; new_tex_coords[morph_index] = delta_tex_coords[vert_index]; - F32 magnitude = new_coords[morph_index].magVec(); + F32 magnitude = new_coords[morph_index].getLength3().getF32(); mTotalDistortion += magnitude; - mAvgDistortion.mV[VX] += fabs(new_coords[morph_index].mV[VX]); - mAvgDistortion.mV[VY] += fabs(new_coords[morph_index].mV[VY]); - mAvgDistortion.mV[VZ] += fabs(new_coords[morph_index].mV[VZ]); + LLVector4a t; + t.setAbs(new_coords[morph_index]); + mAvgDistortion.add(t); if (magnitude > mMaxDistortion) { @@ -397,8 +398,8 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph) } } - mAvgDistortion = mAvgDistortion * (1.f/(F32)nindices); - mAvgDistortion.normVec(); + mAvgDistortion.mul(1.f/(F32)nindices); + mAvgDistortion.normalize3(); //------------------------------------------------------------------------- // compute the change in the morph @@ -412,9 +413,9 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph) { vert_index = mVertexIndices[morph_index]; - delta_coords[vert_index] -= LLVector4(mCoords[morph_index]); - delta_normals[vert_index] -= LLVector4(mNormals[morph_index]); - delta_binormals[vert_index] -= mBinormals[morph_index]; + delta_coords[vert_index].sub( mCoords[morph_index]); + delta_normals[vert_index].sub( mNormals[morph_index]); + delta_binormals[vert_index].sub(mBinormals[morph_index]); delta_tex_coords[vert_index] -= mTexCoords[morph_index]; } @@ -451,27 +452,35 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph) continue; }*/ - LLVector4 *mesh_coords = mesh->getWritableCoords(); - LLVector4 *mesh_normals = mesh->getWritableNormals(); - LLVector3 *mesh_binormals = mesh->getWritableBinormals(); - LLVector2 *mesh_tex_coords = mesh->getWritableTexCoords(); - LLVector3 *mesh_scaled_normals = mesh->getScaledNormals(); - LLVector3 *mesh_scaled_binormals = mesh->getScaledBinormals(); + LLVector4a *mesh_coords = mesh->getWritableCoords(); + LLVector4a *mesh_normals = mesh->getWritableNormals(); + LLVector4a *mesh_binormals = mesh->getWritableBinormals(); + LLVector2 *mesh_tex_coords = mesh->getWritableTexCoords(); + LLVector4a *mesh_scaled_normals = mesh->getScaledNormals(); + LLVector4a *mesh_scaled_binormals = mesh->getScaledBinormals(); for( vert_index = 0; vert_index < nverts; vert_index++) { - mesh_coords[vert_index] += delta_coords[vert_index] * weight; + delta_coords[vert_index].mul(weight); + mesh_coords[vert_index].add(delta_coords[vert_index]); + mesh_tex_coords[vert_index] += delta_tex_coords[vert_index] * weight; - mesh_scaled_normals[vert_index] += LLVector3(delta_normals[vert_index] * weight * NORMAL_SOFTEN_FACTOR); - LLVector3 normalized_normal = mesh_scaled_normals[vert_index]; - normalized_normal.normVec(); - mesh_normals[vert_index] = LLVector4(normalized_normal); + delta_normals[vert_index].mul(weight * NORMAL_SOFTEN_FACTOR); + mesh_scaled_normals[vert_index].add(delta_normals[vert_index]); + + LLVector4a normalized_normal = mesh_scaled_normals[vert_index]; + normalized_normal.normalize3(); + mesh_normals[vert_index] = normalized_normal; - mesh_scaled_binormals[vert_index] += delta_binormals[vert_index] * weight * NORMAL_SOFTEN_FACTOR; - LLVector3 tangent = mesh_scaled_binormals[vert_index] % normalized_normal; - LLVector3 normalized_binormal = normalized_normal % tangent; - normalized_binormal.normVec(); + delta_binormals[vert_index].mul(weight * NORMAL_SOFTEN_FACTOR); + mesh_scaled_binormals[vert_index].add(delta_binormals[vert_index]); + + LLVector4a tangent; + tangent.setCross3(mesh_scaled_binormals[vert_index], normalized_normal); + LLVector4a normalized_binormal; + normalized_binormal.setCross3(normalized_normal, tangent); + normalized_binormal.normalize3(); mesh_binormals[vert_index] = normalized_binormal; } @@ -658,9 +667,9 @@ BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node) //----------------------------------------------------------------------------- // getVertexDistortion() //----------------------------------------------------------------------------- -LLVector3 LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh) +LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh) { - if (!mMorphData || mMesh != mesh) return LLVector3::zero; + if (!mMorphData || mMesh != mesh) return LLVector4a::getZero(); for(U32 index = 0; index < mMorphData->mNumIndices; index++) { @@ -670,17 +679,17 @@ LLVector3 LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh } } - return LLVector3::zero; + return LLVector4a::getZero(); } //----------------------------------------------------------------------------- // getFirstDistortion() //----------------------------------------------------------------------------- -const LLVector3 *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { - if (!mMorphData) return &LLVector3::zero; + if (!mMorphData) return &LLVector4a::getZero(); - LLVector3* resultVec; + LLVector4a* resultVec; mMorphData->mCurrentIndex = 0; if (mMorphData->mNumIndices) { @@ -702,11 +711,11 @@ const LLVector3 *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh ** //----------------------------------------------------------------------------- // getNextDistortion() //----------------------------------------------------------------------------- -const LLVector3 *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { - if (!mMorphData) return &LLVector3::zero; + if (!mMorphData) return &LLVector4a::getZero(); - LLVector3* resultVec; + LLVector4a* resultVec; mMorphData->mCurrentIndex++; if (mMorphData->mCurrentIndex < mMorphData->mNumIndices) { @@ -742,7 +751,7 @@ F32 LLPolyMorphTarget::getTotalDistortion() //----------------------------------------------------------------------------- // getAvgDistortion() //----------------------------------------------------------------------------- -const LLVector3& LLPolyMorphTarget::getAvgDistortion() +const LLVector4a& LLPolyMorphTarget::getAvgDistortion() { if (mMorphData) { @@ -750,7 +759,7 @@ const LLVector3& LLPolyMorphTarget::getAvgDistortion() } else { - return LLVector3::zero; + return LLVector4a::getZero(); } } @@ -799,15 +808,15 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) if (delta_weight != 0.f) { llassert(!mMesh->isLOD()); - LLVector4 *coords = mMesh->getWritableCoords(); + LLVector4a *coords = mMesh->getWritableCoords(); - LLVector3 *scaled_normals = mMesh->getScaledNormals(); - LLVector4 *normals = mMesh->getWritableNormals(); + LLVector4a *scaled_normals = mMesh->getScaledNormals(); + LLVector4a *normals = mMesh->getWritableNormals(); - LLVector3 *scaled_binormals = mMesh->getScaledBinormals(); - LLVector3 *binormals = mMesh->getWritableBinormals(); + LLVector4a *scaled_binormals = mMesh->getScaledBinormals(); + LLVector4a *binormals = mMesh->getWritableBinormals(); - LLVector4 *clothing_weights = mMesh->getWritableClothingWeights(); + LLVector4a *clothing_weights = mMesh->getWritableClothingWeights(); LLVector2 *tex_coords = mMesh->getWritableTexCoords(); F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL; @@ -822,31 +831,38 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) maskWeight = maskWeightArray[vert_index_morph]; } - coords[vert_index_mesh] += LLVector4(mMorphData->mCoords[vert_index_morph] * delta_weight * maskWeight); + + LLVector4a pos = mMorphData->mCoords[vert_index_morph]; + pos.mul(delta_weight*maskWeight); + coords[vert_index_mesh].add(pos); if (getInfo()->mIsClothingMorph && clothing_weights) { - LLVector3 clothing_offset = mMorphData->mCoords[vert_index_morph] * delta_weight * maskWeight; - LLVector4* clothing_weight = &clothing_weights[vert_index_mesh]; - clothing_weight->mV[VX] += clothing_offset.mV[VX]; - clothing_weight->mV[VY] += clothing_offset.mV[VY]; - clothing_weight->mV[VZ] += clothing_offset.mV[VZ]; - clothing_weight->mV[VW] = maskWeight; + LLVector4a clothing_offset = mMorphData->mCoords[vert_index_morph]; + clothing_offset.mul(delta_weight * maskWeight); + LLVector4a* clothing_weight = &clothing_weights[vert_index_mesh]; + clothing_weight->add(clothing_offset); + clothing_weight->getF32ptr()[VW] = maskWeight; } // calculate new normals based on half angles - scaled_normals[vert_index_mesh] += mMorphData->mNormals[vert_index_morph] * delta_weight * maskWeight * NORMAL_SOFTEN_FACTOR; - LLVector3 normalized_normal = scaled_normals[vert_index_mesh]; - normalized_normal.normVec(); - normals[vert_index_mesh] = LLVector4(normalized_normal); + LLVector4a norm = mMorphData->mNormals[vert_index_morph]; + norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); + scaled_normals[vert_index_mesh].add(norm); + norm = scaled_normals[vert_index_mesh]; + norm.normalize3fast(); + normals[vert_index_mesh] = norm; // calculate new binormals - scaled_binormals[vert_index_mesh] += mMorphData->mBinormals[vert_index_morph] * delta_weight * maskWeight * NORMAL_SOFTEN_FACTOR; - LLVector3 tangent = scaled_binormals[vert_index_mesh] % normalized_normal; - LLVector3 normalized_binormal = normalized_normal % tangent; - normalized_binormal.normVec(); - binormals[vert_index_mesh] = normalized_binormal; - + LLVector4a binorm = mMorphData->mBinormals[vert_index_morph]; + binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); + scaled_binormals[vert_index_mesh].add(binorm); + LLVector4a tangent; + tangent.setCross3(scaled_binormals[vert_index_mesh], norm); + LLVector4a& normalized_binormal = binormals[vert_index_mesh]; + normalized_binormal.setCross3(norm, tangent); + normalized_binormal.normalize3fast(); + tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight; } @@ -873,7 +889,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) //----------------------------------------------------------------------------- void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert) { - LLVector4 *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL; + LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL; if (!mVertMask) { @@ -887,29 +903,47 @@ void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3 if (maskWeights) { - LLVector4 *coords = mMesh->getWritableCoords(); - LLVector3 *scaled_normals = mMesh->getScaledNormals(); - LLVector3 *scaled_binormals = mMesh->getScaledBinormals(); + LLVector4a *coords = mMesh->getWritableCoords(); + LLVector4a *scaled_normals = mMesh->getScaledNormals(); + LLVector4a *scaled_binormals = mMesh->getScaledBinormals(); LLVector2 *tex_coords = mMesh->getWritableTexCoords(); + LLVector4Logical clothing_mask; + clothing_mask.clear(); + clothing_mask.setElement<0>(); + clothing_mask.setElement<1>(); + clothing_mask.setElement<2>(); + + for(U32 vert = 0; vert < mMorphData->mNumIndices; vert++) { F32 lastMaskWeight = mLastWeight * maskWeights[vert]; S32 out_vert = mMorphData->mVertexIndices[vert]; // remove effect of existing masked morph - coords[out_vert] -= LLVector4(mMorphData->mCoords[vert]) * lastMaskWeight; - scaled_normals[out_vert] -= mMorphData->mNormals[vert] * lastMaskWeight * NORMAL_SOFTEN_FACTOR; - scaled_binormals[out_vert] -= mMorphData->mBinormals[vert] * lastMaskWeight * NORMAL_SOFTEN_FACTOR; + LLVector4a t; + t = mMorphData->mCoords[vert]; + t.mul(lastMaskWeight); + coords[out_vert].sub(t); + + t = mMorphData->mNormals[vert]; + t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); + scaled_normals[out_vert].sub(t); + + t = mMorphData->mBinormals[vert]; + t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); + scaled_binormals[out_vert].sub(t); + tex_coords[out_vert] -= mMorphData->mTexCoords[vert] * lastMaskWeight; if (clothing_weights) { - LLVector3 clothing_offset = mMorphData->mCoords[vert] * lastMaskWeight; - LLVector4* clothing_weight = &clothing_weights[out_vert]; - clothing_weight->mV[VX] -= clothing_offset.mV[VX]; - clothing_weight->mV[VY] -= clothing_offset.mV[VY]; - clothing_weight->mV[VZ] -= clothing_offset.mV[VZ]; + LLVector4a clothing_offset = mMorphData->mCoords[vert]; + clothing_offset.mul(lastMaskWeight); + LLVector4a* clothing_weight = &clothing_weights[out_vert]; + LLVector4a t; + t.setSub(*clothing_weight, clothing_offset); + clothing_weight->setSelectWithMask(clothing_mask, t, *clothing_weight); } } } @@ -945,7 +979,7 @@ LLPolyVertexMask::~LLPolyVertexMask() //----------------------------------------------------------------------------- // generateMask() //----------------------------------------------------------------------------- -void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights) +void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights) { // RN debug output that uses Image Debugger (http://www.cs.unc.edu/~baxter/projects/imdebug/) // BOOL debugImg = FALSE; @@ -989,7 +1023,7 @@ void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, if (clothing_weights) { - clothing_weights[vertIndex].mV[VW] = mWeights[index]; + clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index]; } } mWeightsGenerated = TRUE; diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h index be7019fdf..dac698437 100644 --- a/indra/newview/llpolymorph.h +++ b/indra/newview/llpolymorph.h @@ -68,14 +68,14 @@ public: U32 mNumIndices; U32* mVertexIndices; U32 mCurrentIndex; - LLVector3* mCoords; - LLVector3* mNormals; - LLVector3* mBinormals; + LLVector4a* mCoords; + LLVector4a* mNormals; + LLVector4a* mBinormals; LLVector2* mTexCoords; F32 mTotalDistortion; // vertex distortion summed over entire morph F32 mMaxDistortion; // maximum single vertex distortion in a given morph - LLVector3 mAvgDistortion; // average vertex distortion, to infer directionality of the morph + LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph LLPolyMeshSharedData* mMesh; }; @@ -88,7 +88,7 @@ public: LLPolyVertexMask(LLPolyMorphData* morph_data); ~LLPolyVertexMask(); - void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights); + void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights); F32* getMorphMaskWeights(); @@ -167,11 +167,11 @@ public: // LLViewerVisualParam Virtual functions /*virtual*/ F32 getTotalDistortion(); - /*virtual*/ const LLVector3& getAvgDistortion(); + /*virtual*/ const LLVector4a& getAvgDistortion(); /*virtual*/ F32 getMaxDistortion(); - /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); - /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); - /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); + /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert); void addPendingMorphMask() { mNumMorphMasksPending++; } diff --git a/indra/newview/llprefsim.cpp b/indra/newview/llprefsim.cpp index e0eee0c72..ac803a6e7 100644 --- a/indra/newview/llprefsim.cpp +++ b/indra/newview/llprefsim.cpp @@ -53,8 +53,6 @@ #include "rlvhandler.h" // [/RLVa:KB] -class AIDirPicker; - class LLPrefsIMImpl : public LLPanel { public: @@ -269,6 +267,7 @@ void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_e childEnable("log_chat_timestamp"); childEnable("log_chat_IM"); childEnable("log_date_timestamp"); + childEnable("logfile_name_datestamp"); //RN: get wide string so replace char can work (requires fixed-width encoding) LLWString busy_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("BusyModeResponse") ); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index c7850b9c9..baf963d68 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1290,9 +1290,8 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, void LLPreviewLSL::callbackLSLCompileSucceeded() { llinfos << "LSL Bytecode saved" << llendl; - // *TODO: Translate - mScriptEd->mErrorList->addCommentText(std::string("Compile successful!")); - mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); + mScriptEd->mErrorList->addCommentText(LLTrans::getString("CompileSuccessful")); + mScriptEd->mErrorList->addCommentText(LLTrans::getString("SaveComplete")); closeIfNeeded(); } @@ -1890,9 +1889,8 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, bool is_script_running) { lldebugs << "LSL Bytecode saved" << llendl; - // *TODO: Translate - mScriptEd->mErrorList->addCommentText(std::string("Compile successful!")); - mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); + mScriptEd->mErrorList->addCommentText(LLTrans::getString("CompileSuccessful")); + mScriptEd->mErrorList->addCommentText(LLTrans::getString("SaveComplete")); closeIfNeeded(); } @@ -2244,8 +2242,7 @@ void LLLiveLSLEditor::draw() { // HACK: Display this information in the title bar. // Really ought to put in main window. - // *TODO: Translate - setTitle(std::string("Script (object out of range)")); + setTitle(LLTrans::getString("ObjectOutOfRange")); runningCheckbox->setEnabled(FALSE); // object may have fallen out of range. mHaveRunningInfo = FALSE; @@ -2468,8 +2465,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, else { llinfos << "Compile worked!" << llendl; - // *TODO: Translate - mScriptEd->mErrorList->addCommentText(std::string("Compile successful, saving...")); + mScriptEd->mErrorList->addCommentText(LLTrans::getString("CompileSuccessfulSaving")); if(gAssetStorage) { llinfos << "LLLiveLSLEditor::saveAsset " @@ -2543,8 +2539,7 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use if(self) { // Tell the user that the compile worked. - // *TODO: Translate - self->mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); + self->mScriptEd->mErrorList->addCommentText(LLTrans::getString("SaveComplete")); // close the window if this completes both uploads self->getWindow()->decBusyCount(); self->mPendingUploads--; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 8bcf0dd2a..d4b0d7099 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -39,6 +39,7 @@ #include "llcombobox.h" #include "statemachine/aifilepicker.h" #include "llfloaterinventory.h" +#include "llimagepng.h" #include "llimagetga.h" #include "llinventory.h" #include "llnotificationsutil.h" @@ -375,17 +376,27 @@ BOOL LLPreviewTexture::canSaveAs() const return mIsCopyable && !mLoadingFullImage && mImage.notNull() && !mImage->isMissingAsset(); } +static bool sPng(false); // virtual -void LLPreviewTexture::saveAs() +void LLPreviewTexture::saveAsType(BOOL png) { if( mLoadingFullImage ) return; const LLViewerInventoryItem* item = getItem() ; AIFilePicker* filepicker = AIFilePicker::create(); - filepicker->open(item ? LLDir::getScrubbedFileName(item->getName()) + ".tga" : LLStringUtil::null, FFSAVE_TGA, "", "image"); - filepicker->run(boost::bind(&LLPreviewTexture::saveAs_continued, this, item, filepicker)); + sPng = png; + if(png) + { + filepicker->open(item ? LLDir::getScrubbedFileName(item->getName()) + ".png" : LLStringUtil::null, FFSAVE_PNG, "", "image"); + filepicker->run(boost::bind(&LLPreviewTexture::saveAs_continued, this, item, filepicker)); + } + else + { + filepicker->open(item ? LLDir::getScrubbedFileName(item->getName()) + ".tga" : LLStringUtil::null, FFSAVE_TGA, "", "image"); + filepicker->run(boost::bind(&LLPreviewTexture::saveAs_continued, this, item, filepicker)); + } } void LLPreviewTexture::saveAs_continued(LLViewerInventoryItem const* item, AIFilePicker* filepicker) @@ -433,14 +444,16 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, if( self && final && success ) { + //FIXME: There has to be a better way + LLPointer image_png = new LLImagePNG; LLPointer image_tga = new LLImageTGA; - if( !image_tga->encode( src ) ) + if( sPng ? !image_png->encode( src, 0.0 ) : !image_tga->encode( src ) ) { LLSD args; args["FILE"] = self->mSaveFileName; LLNotificationsUtil::add("CannotEncodeFile", args); } - else if( !image_tga->save( self->mSaveFileName ) ) + else if( sPng ? !image_png->save( self->mSaveFileName ) : !image_tga->save( self->mSaveFileName ) ) { LLSD args; args["FILE"] = self->mSaveFileName; diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index ce26d4dd4..bb20af473 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -64,7 +64,8 @@ public: virtual void draw(); virtual BOOL canSaveAs() const; - virtual void saveAs(); + virtual void saveAs(){ saveAsType(false); } + void saveAsType(BOOL png); void saveAs_continued(LLViewerInventoryItem const* item, AIFilePicker* filepicker); virtual LLUUID getItemID(); virtual std::string getItemCreatorName(); diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index 88127e68f..7afcf82c4 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -77,9 +77,8 @@ LLScrollingPanelParam::LLScrollingPanelParam( const std::string& name, mHintMin->setAllowsUpdates( FALSE ); mHintMax->setAllowsUpdates( FALSE ); - // *TODO::translate - std::string min_name = param->getMinDisplayName(); - std::string max_name = param->getMaxDisplayName(); + std::string min_name = LLTrans::getString(param->getMinDisplayName()); + std::string max_name = LLTrans::getString(param->getMaxDisplayName()); childSetValue("min param text", min_name); childSetValue("max param text", max_name); mLess = getChild("less"); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 223b6cf80..a6f6ca8c1 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2,31 +2,25 @@ * @file llselectmgr.cpp * @brief A manager for selected objects and faces. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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$ */ @@ -281,7 +275,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()) { @@ -600,6 +594,12 @@ bool LLSelectMgr::linkObjects() return true; } + if (!LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) + { + LLNotificationsUtil::add("CannotLinkPermanent"); + return true; + } + LLUUID owner_id; std::string owner_name; if (!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) @@ -645,7 +645,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; @@ -668,10 +670,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()); // [RLVa:KB] - Checked: 2011-03-19 (RLVa-1.3.0f) | Modified: RLVa-0.2.0g if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand())) ) { @@ -981,7 +985,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; @@ -2292,50 +2296,6 @@ void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *) gMessageSystem->addString("Parameter", buf); } -//----------------------------------------------------------------------------- -// 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() //----------------------------------------------------------------------------- @@ -2549,6 +2509,341 @@ BOOL LLSelectMgr::selectGetRootsModify() } +//----------------------------------------------------------------------------- +// selectGetNonPermanentEnforced() - return TRUE if all objects are not +// permanent enforced +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetNonPermanentEnforced() +{ + 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; +} + +//----------------------------------------------------------------------------- +// selectGetRootsNonPermanentEnforced() - return TRUE if all root objects are +// not permanent enforced +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsNonPermanentEnforced() +{ + 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; +} + +//----------------------------------------------------------------------------- +// selectGetPermanent() - return TRUE if all objects are permanent +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetPermanent() +{ + 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->flagObjectPermanent()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsPermanent() - return TRUE if all root objects are +// permanent +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsPermanent() +{ + 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->flagObjectPermanent()) + { + return FALSE; + } + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetCharacter() - return TRUE if all objects are character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsCharacter() - return TRUE if all root objects are +// character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetNonPathfinding() - return TRUE if all objects are not pathfinding +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetNonPathfinding() +{ + 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->flagObjectPermanent() || object->flagCharacter()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsNonPathfinding() - return TRUE if all root objects are not +// pathfinding +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsNonPathfinding() +{ + 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->flagObjectPermanent() || object->flagCharacter()) + { + return FALSE; + } + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetNonPermanent() - return TRUE if all objects are not permanent +//----------------------------------------------------------------------------- +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->flagObjectPermanent()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsNonPermanent() - return TRUE if all root objects are not +// permanent +//----------------------------------------------------------------------------- +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->flagObjectPermanent()) + { + return FALSE; + } + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetNonCharacter() - return TRUE if all objects are not character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetNonCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsNonCharacter() - return TRUE if all root objects are not +// character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsNonCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + + return TRUE; +} + + +//----------------------------------------------------------------------------- +// selectGetEditableLinksets() - return TRUE if all objects are editable +// pathfinding linksets +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetEditableLinksets() +{ + 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->flagUsePhysics() || + object->flagTemporaryOnRez() || + object->flagCharacter() || + object->flagVolumeDetect() || + object->flagAnimSource() || + (object->getRegion() != gAgent.getRegion()) || + (!gAgent.isGodlike() && + !gAgent.canManageEstate() && + !object->permYouOwner() && + !object->permMove())) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetViewableCharacters() - return TRUE if all objects are characters +// viewable within the pathfinding characters floater +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetViewableCharacters() +{ + 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->flagCharacter() || + (object->getRegion() != gAgent.getRegion())) + { + return FALSE; + } + } + return TRUE; +} + + //----------------------------------------------------------------------------- // selectGetRootsTransfer() - return TRUE if current agent can transfer all // selected root objects. @@ -4200,13 +4495,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() //---------------------------------------------------------------------- @@ -5624,7 +5912,7 @@ void pushWireframe(LLDrawable* drawable) for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = volume->getVolumeFace(i); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, face.mTexCoords, face.mNumIndices, face.mIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices); } } @@ -6284,7 +6572,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; @@ -6978,7 +7266,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); @@ -7016,9 +7304,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() ) { @@ -7058,7 +7347,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); @@ -7127,7 +7416,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 9961710d5..f3c52dbfe 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -505,7 +505,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 @@ -543,8 +542,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(); @@ -567,6 +564,33 @@ public: BOOL selectGetRootsModify(); BOOL selectGetModify(); + // returns TRUE if is all objects are non-permanent-enforced + BOOL selectGetRootsNonPermanentEnforced(); + BOOL selectGetNonPermanentEnforced(); + + // returns TRUE if is all objects are permanent + BOOL selectGetRootsPermanent(); + BOOL selectGetPermanent(); + + // returns TRUE if is all objects are character + BOOL selectGetRootsCharacter(); + BOOL selectGetCharacter(); + + // returns TRUE if is all objects are not permanent + BOOL selectGetRootsNonPathfinding(); + BOOL selectGetNonPathfinding(); + + // returns TRUE if is all objects are not permanent + BOOL selectGetRootsNonPermanent(); + BOOL selectGetNonPermanent(); + + // returns TRUE if is all objects are not character + BOOL selectGetRootsNonCharacter(); + BOOL selectGetNonCharacter(); + + BOOL selectGetEditableLinksets(); + BOOL selectGetViewableCharacters(); + // returns TRUE if selected objects can be transferred. BOOL selectGetRootsTransfer(); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 5cce8fd34..d081f51de 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -424,7 +424,7 @@ void LLSpatialGroup::validate() validateDrawMap(); - for (element_iter i = getData().begin(); i != getData().end(); ++i) + for (element_iter i = getDataBegin(); i != getDataEnd(); ++i) { LLDrawable* drawable = *i; sg_assert(drawable->getSpatialGroup() == this); @@ -640,7 +640,7 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma { const OctreeNode* node = mOctreeNode; - if (node->getData().empty()) + if (node->isEmpty()) { //don't do anything if there are no objects if (empty && mOctreeNode->getParent()) { //only root is allowed to be empty @@ -657,14 +657,14 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma clearState(OBJECT_DIRTY); //initialize bounding box to first element - OctreeNode::const_element_iter i = node->getData().begin(); + OctreeNode::const_element_iter i = node->getDataBegin(); LLDrawable* drawablep = *i; const LLVector4a* minMax = drawablep->getSpatialExtents(); newMin = minMax[0]; newMax = minMax[1]; - for (++i; i != node->getData().end(); ++i) + for (++i; i != node->getDataEnd(); ++i) { drawablep = *i; minMax = drawablep->getSpatialExtents(); @@ -805,7 +805,7 @@ void LLSpatialGroup::shift(const LLVector4a &offset) mObjectExtents[0].add(offset); mObjectExtents[1].add(offset); - //if (!mSpatialPartition->mRenderByGroup) + if (!mSpatialPartition->mRenderByGroup) { setState(GEOM_DIRTY); gPipeline.markRebuild(this, TRUE); @@ -1124,7 +1124,7 @@ void LLSpatialGroup::updateDistance(LLCamera &camera) llerrs << "Spatial group dirty on distance update." << llendl; } #endif - if (!getData().empty() /*&& !LLSpatialPartition::sFreezeState*/) + if (!isEmpty() /*&& !LLSpatialPartition::sFreezeState*/) { mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() : (F32) mOctreeNode->getSize().getLength3().getF32(); @@ -1276,7 +1276,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node) LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); setState(DEAD); - for (element_iter i = getData().begin(); i != getData().end(); ++i) + for (element_iter i = getDataBegin(); i != getDataEnd(); ++i) { LLDrawable* drawable = *i; if (drawable->getSpatialGroup() == this) @@ -1363,7 +1363,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion) } - for (LLSpatialGroup::element_iter i = getData().begin(); i != getData().end(); ++i) + for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i) { LLDrawable* drawable = *i; for (S32 j = 0; j < drawable->getNumFaces(); j++) @@ -1720,12 +1720,14 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); - drawablep->setSpatialGroup(NULL); - if (!curp->removeObject(drawablep)) { OCT_ERRS << "Failed to remove drawable from octree!" << llendl; } + else + { + drawablep->setSpatialGroup(NULL); + } assert_octree_valid(mOctree); @@ -1996,7 +1998,7 @@ public: virtual void processGroup(LLSpatialGroup* group) { - llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->getData().empty()); + llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->isEmpty()); if (mRes < 2) { @@ -2063,7 +2065,7 @@ public: { LLSpatialGroup::OctreeNode* branch = group->mOctreeNode; - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) + for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { LLDrawable* drawable = *i; @@ -2187,7 +2189,7 @@ public: LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0); group->destroyGL(); - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawable = *i; if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup) @@ -2500,7 +2502,7 @@ void renderOctree(LLSpatialGroup* group) gGL.flush(); glLineWidth(1.f); gGL.flush(); - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawable = *i; if (!group->mSpatialPartition->isBridge()) @@ -2546,7 +2548,7 @@ void renderOctree(LLSpatialGroup* group) } else { - if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty() + if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty() && group->mSpatialPartition->mRenderByGroup) { col.setVec(0.8f, 0.4f, 0.1f, 0.1f); @@ -2614,7 +2616,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && - !group->getData().empty(); + !group->isEmpty(); if (render_objects) { @@ -3356,7 +3358,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) void renderPhysicsShapes(LLSpatialGroup* group) { - for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawable = *i; LLVOVolume* volume = drawable->getVOVolume(); @@ -3601,7 +3603,7 @@ public: LLVector3 center, size; - if (branch->getData().empty()) + if (branch->isEmpty()) { gGL.diffuseColor3f(1.f,0.2f,0.f); center.set(branch->getCenter().getF32ptr()); @@ -3637,8 +3639,8 @@ public: } gGL.begin(LLRender::TRIANGLES); - for (LLOctreeNode::const_element_iter iter = branch->getData().begin(); - iter != branch->getData().end(); + for (LLOctreeNode::const_element_iter iter = branch->getDataBegin(); + iter != branch->getDataEnd(); ++iter) { const LLVolumeTriangle* tri = *iter; @@ -3875,7 +3877,7 @@ public: if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES)) { - if (!group->getData().empty()) + if (!group->isEmpty()) { gGL.diffuseColor3f(0,0,1); drawBoxOutline(group->mObjectBounds[0], @@ -3883,7 +3885,7 @@ public: } } - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) + for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { LLDrawable* drawable = *i; @@ -4068,7 +4070,7 @@ public: return; } - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) + for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { LLDrawable* drawable = *i; @@ -4291,7 +4293,7 @@ public: virtual void visit(const LLSpatialGroup::OctreeNode* branch) { - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) + for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { check(*i); } @@ -4476,29 +4478,64 @@ LLVertexBuffer* LLGeometryManager::createVertexBuffer(U32 type_mask, U32 usage) } LLCullResult::LLCullResult() -{ +{ + mVisibleGroupsAllocated = 0; + mAlphaGroupsAllocated = 0; + mOcclusionGroupsAllocated = 0; + mDrawableGroupsAllocated = 0; + mVisibleListAllocated = 0; + mVisibleBridgeAllocated = 0; + + mVisibleGroups = NULL; + mVisibleGroupsEnd = NULL; + mAlphaGroups = NULL; + mAlphaGroupsEnd = NULL; + mOcclusionGroups = NULL; + mOcclusionGroupsEnd = NULL; + mDrawableGroups = NULL; + mDrawableGroupsEnd = NULL; + mVisibleList = NULL; + mVisibleListEnd = NULL; + mVisibleBridge = NULL; + mVisibleBridgeEnd = NULL; + + for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) + { + mRenderMap[i] = NULL; + mRenderMapEnd[i] = NULL; + mRenderMapAllocated[i] = 0; + } + clear(); } +void LLCullResult::pushBack(void**& head, U32& count, void* val) +{ + count++; + head = (void**) realloc((void*) head, sizeof(void*) * count); + head[count-1] = val; +} + void LLCullResult::clear() { mVisibleGroupsSize = 0; - mVisibleGroupsEnd = mVisibleGroups.begin(); + mVisibleGroupsEnd = mVisibleGroups; mAlphaGroupsSize = 0; - mAlphaGroupsEnd = mAlphaGroups.begin(); + mAlphaGroupsEnd = mAlphaGroups; mOcclusionGroupsSize = 0; - mOcclusionGroupsEnd = mOcclusionGroups.begin(); + mOcclusionGroupsEnd = mOcclusionGroups; mDrawableGroupsSize = 0; - mDrawableGroupsEnd = mDrawableGroups.begin(); + mDrawableGroupsEnd = mDrawableGroups; mVisibleListSize = 0; - mVisibleListEnd = mVisibleList.begin(); + mVisibleListEnd = mVisibleList; mVisibleBridgeSize = 0; - mVisibleBridgeEnd = mVisibleBridge.begin(); + mVisibleBridgeEnd = mVisibleBridge; + for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) { @@ -4507,176 +4544,176 @@ void LLCullResult::clear() mRenderMap[i][j] = 0; } mRenderMapSize[i] = 0; - mRenderMapEnd[i] = mRenderMap[i].begin(); + mRenderMapEnd[i] = mRenderMap[i]; } } -LLCullResult::sg_list_t::iterator LLCullResult::beginVisibleGroups() +LLCullResult::sg_iterator LLCullResult::beginVisibleGroups() { - return mVisibleGroups.begin(); + return mVisibleGroups; } -LLCullResult::sg_list_t::iterator LLCullResult::endVisibleGroups() +LLCullResult::sg_iterator LLCullResult::endVisibleGroups() { return mVisibleGroupsEnd; } -LLCullResult::sg_list_t::iterator LLCullResult::beginAlphaGroups() +LLCullResult::sg_iterator LLCullResult::beginAlphaGroups() { - return mAlphaGroups.begin(); + return mAlphaGroups; } -LLCullResult::sg_list_t::iterator LLCullResult::endAlphaGroups() +LLCullResult::sg_iterator LLCullResult::endAlphaGroups() { return mAlphaGroupsEnd; } -LLCullResult::sg_list_t::iterator LLCullResult::beginOcclusionGroups() +LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups() { - return mOcclusionGroups.begin(); + return mOcclusionGroups; } -LLCullResult::sg_list_t::iterator LLCullResult::endOcclusionGroups() +LLCullResult::sg_iterator LLCullResult::endOcclusionGroups() { return mOcclusionGroupsEnd; } -LLCullResult::sg_list_t::iterator LLCullResult::beginDrawableGroups() +LLCullResult::sg_iterator LLCullResult::beginDrawableGroups() { - return mDrawableGroups.begin(); + return mDrawableGroups; } -LLCullResult::sg_list_t::iterator LLCullResult::endDrawableGroups() +LLCullResult::sg_iterator LLCullResult::endDrawableGroups() { return mDrawableGroupsEnd; } -LLCullResult::drawable_list_t::iterator LLCullResult::beginVisibleList() +LLCullResult::drawable_iterator LLCullResult::beginVisibleList() { - return mVisibleList.begin(); + return mVisibleList; } -LLCullResult::drawable_list_t::iterator LLCullResult::endVisibleList() +LLCullResult::drawable_iterator LLCullResult::endVisibleList() { return mVisibleListEnd; } -LLCullResult::bridge_list_t::iterator LLCullResult::beginVisibleBridge() +LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge() { - return mVisibleBridge.begin(); + return mVisibleBridge; } -LLCullResult::bridge_list_t::iterator LLCullResult::endVisibleBridge() +LLCullResult::bridge_iterator LLCullResult::endVisibleBridge() { return mVisibleBridgeEnd; } -LLCullResult::drawinfo_list_t::iterator LLCullResult::beginRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type) { - return mRenderMap[type].begin(); + return mRenderMap[type]; } -LLCullResult::drawinfo_list_t::iterator LLCullResult::endRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type) { return mRenderMapEnd[type]; } void LLCullResult::pushVisibleGroup(LLSpatialGroup* group) { - if (mVisibleGroupsSize < mVisibleGroups.size()) + if (mVisibleGroupsSize < mVisibleGroupsAllocated) { mVisibleGroups[mVisibleGroupsSize] = group; } else { - mVisibleGroups.push_back(group); + pushBack((void**&) mVisibleGroups, mVisibleGroupsAllocated, (void*) group); } ++mVisibleGroupsSize; - mVisibleGroupsEnd = mVisibleGroups.begin()+mVisibleGroupsSize; + mVisibleGroupsEnd = mVisibleGroups+mVisibleGroupsSize; } void LLCullResult::pushAlphaGroup(LLSpatialGroup* group) { - if (mAlphaGroupsSize < mAlphaGroups.size()) + if (mAlphaGroupsSize < mAlphaGroupsAllocated) { mAlphaGroups[mAlphaGroupsSize] = group; } else { - mAlphaGroups.push_back(group); + pushBack((void**&) mAlphaGroups, mAlphaGroupsAllocated, (void*) group); } ++mAlphaGroupsSize; - mAlphaGroupsEnd = mAlphaGroups.begin()+mAlphaGroupsSize; + mAlphaGroupsEnd = mAlphaGroups+mAlphaGroupsSize; } void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group) { - if (mOcclusionGroupsSize < mOcclusionGroups.size()) + if (mOcclusionGroupsSize < mOcclusionGroupsAllocated) { mOcclusionGroups[mOcclusionGroupsSize] = group; } else { - mOcclusionGroups.push_back(group); + pushBack((void**&) mOcclusionGroups, mOcclusionGroupsAllocated, (void*) group); } ++mOcclusionGroupsSize; - mOcclusionGroupsEnd = mOcclusionGroups.begin()+mOcclusionGroupsSize; + mOcclusionGroupsEnd = mOcclusionGroups+mOcclusionGroupsSize; } void LLCullResult::pushDrawableGroup(LLSpatialGroup* group) { - if (mDrawableGroupsSize < mDrawableGroups.size()) + if (mDrawableGroupsSize < mDrawableGroupsAllocated) { mDrawableGroups[mDrawableGroupsSize] = group; } else { - mDrawableGroups.push_back(group); + pushBack((void**&) mDrawableGroups, mDrawableGroupsAllocated, (void*) group); } ++mDrawableGroupsSize; - mDrawableGroupsEnd = mDrawableGroups.begin()+mDrawableGroupsSize; + mDrawableGroupsEnd = mDrawableGroups+mDrawableGroupsSize; } void LLCullResult::pushDrawable(LLDrawable* drawable) { - if (mVisibleListSize < mVisibleList.size()) + if (mVisibleListSize < mVisibleListAllocated) { mVisibleList[mVisibleListSize] = drawable; } else { - mVisibleList.push_back(drawable); + pushBack((void**&) mVisibleList, mVisibleListAllocated, (void*) drawable); } ++mVisibleListSize; - mVisibleListEnd = mVisibleList.begin()+mVisibleListSize; + mVisibleListEnd = mVisibleList+mVisibleListSize; } void LLCullResult::pushBridge(LLSpatialBridge* bridge) { - if (mVisibleBridgeSize < mVisibleBridge.size()) + if (mVisibleBridgeSize < mVisibleBridgeAllocated) { mVisibleBridge[mVisibleBridgeSize] = bridge; } else { - mVisibleBridge.push_back(bridge); + pushBack((void**&) mVisibleBridge, mVisibleBridgeAllocated, (void*) bridge); } ++mVisibleBridgeSize; - mVisibleBridgeEnd = mVisibleBridge.begin()+mVisibleBridgeSize; + mVisibleBridgeEnd = mVisibleBridge+mVisibleBridgeSize; } void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info) { - if (mRenderMapSize[type] < mRenderMap[type].size()) + if (mRenderMapSize[type] < mRenderMapAllocated[type]) { mRenderMap[type][mRenderMapSize[type]] = draw_info; } else { - mRenderMap[type].push_back(draw_info); + pushBack((void**&) mRenderMap[type], mRenderMapAllocated[type], (void*) draw_info); } ++mRenderMapSize[type]; - mRenderMapEnd[type] = mRenderMap[type].begin() + mRenderMapSize[type]; + mRenderMapEnd[type] = mRenderMap[type] + mRenderMapSize[type]; } diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 95ba1c036..890a52f0d 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -330,8 +330,13 @@ public: void dirtyGeom() { setState(GEOM_DIRTY); } void dirtyMesh() { setState(MESH_DIRTY); } + + //octree wrappers to make code more readable element_list& getData() { return mOctreeNode->getData(); } + element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } + element_iter getDataEnd() { return mOctreeNode->getDataEnd(); } U32 getElementCount() const { return mOctreeNode->getElementCount(); } + bool isEmpty() const { return mOctreeNode->isEmpty(); } void drawObjectBox(LLColor4 col); @@ -522,34 +527,39 @@ class LLCullResult public: LLCullResult(); - typedef std::vector sg_list_t; - typedef std::vector drawable_list_t; - typedef std::vector bridge_list_t; - typedef std::vector drawinfo_list_t; + typedef LLSpatialGroup** sg_list_t; + typedef LLDrawable** drawable_list_t; + typedef LLSpatialBridge** bridge_list_t; + typedef LLDrawInfo** drawinfo_list_t; + + typedef LLSpatialGroup** sg_iterator; + typedef LLSpatialBridge** bridge_iterator; + typedef LLDrawInfo** drawinfo_iterator; + typedef LLDrawable** drawable_iterator; void clear(); - sg_list_t::iterator beginVisibleGroups(); - sg_list_t::iterator endVisibleGroups(); + sg_iterator beginVisibleGroups(); + sg_iterator endVisibleGroups(); - sg_list_t::iterator beginAlphaGroups(); - sg_list_t::iterator endAlphaGroups(); + sg_iterator beginAlphaGroups(); + sg_iterator endAlphaGroups(); bool hasOcclusionGroups() { return mOcclusionGroupsSize > 0; } - sg_list_t::iterator beginOcclusionGroups(); - sg_list_t::iterator endOcclusionGroups(); + sg_iterator beginOcclusionGroups(); + sg_iterator endOcclusionGroups(); - sg_list_t::iterator beginDrawableGroups(); - sg_list_t::iterator endDrawableGroups(); + sg_iterator beginDrawableGroups(); + sg_iterator endDrawableGroups(); - drawable_list_t::iterator beginVisibleList(); - drawable_list_t::iterator endVisibleList(); + drawable_iterator beginVisibleList(); + drawable_iterator endVisibleList(); - bridge_list_t::iterator beginVisibleBridge(); - bridge_list_t::iterator endVisibleBridge(); + bridge_iterator beginVisibleBridge(); + bridge_iterator endVisibleBridge(); - drawinfo_list_t::iterator beginRenderMap(U32 type); - drawinfo_list_t::iterator endRenderMap(U32 type); + drawinfo_iterator beginRenderMap(U32 type); + drawinfo_iterator endRenderMap(U32 type); void pushVisibleGroup(LLSpatialGroup* group); void pushAlphaGroup(LLSpatialGroup* group); @@ -569,28 +579,41 @@ public: void assertDrawMapsEmpty(); private: + + void pushBack(void** &head, U32& count, void* val); + U32 mVisibleGroupsSize; U32 mAlphaGroupsSize; U32 mOcclusionGroupsSize; U32 mDrawableGroupsSize; U32 mVisibleListSize; U32 mVisibleBridgeSize; + + U32 mVisibleGroupsAllocated; + U32 mAlphaGroupsAllocated; + U32 mOcclusionGroupsAllocated; + U32 mDrawableGroupsAllocated; + U32 mVisibleListAllocated; + U32 mVisibleBridgeAllocated; + U32 mRenderMapSize[LLRenderPass::NUM_RENDER_TYPES]; sg_list_t mVisibleGroups; - sg_list_t::iterator mVisibleGroupsEnd; + sg_iterator mVisibleGroupsEnd; sg_list_t mAlphaGroups; - sg_list_t::iterator mAlphaGroupsEnd; + sg_iterator mAlphaGroupsEnd; sg_list_t mOcclusionGroups; - sg_list_t::iterator mOcclusionGroupsEnd; + sg_iterator mOcclusionGroupsEnd; sg_list_t mDrawableGroups; - sg_list_t::iterator mDrawableGroupsEnd; + sg_iterator mDrawableGroupsEnd; drawable_list_t mVisibleList; - drawable_list_t::iterator mVisibleListEnd; + drawable_iterator mVisibleListEnd; bridge_list_t mVisibleBridge; - bridge_list_t::iterator mVisibleBridgeEnd; + bridge_iterator mVisibleBridgeEnd; drawinfo_list_t mRenderMap[LLRenderPass::NUM_RENDER_TYPES]; - drawinfo_list_t::iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES]; + U32 mRenderMapAllocated[LLRenderPass::NUM_RENDER_TYPES]; + drawinfo_iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES]; + }; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 328ccf2dc..d0a5a6364 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -200,7 +200,6 @@ #include "llnamelistctrl.h" #include "llnamebox.h" #include "llnameeditor.h" -#include "llpostprocess.h" #include "llwlparammanager.h" #include "llwaterparammanager.h" #include "llagentlanguage.h" @@ -222,6 +221,8 @@ #include "llpacketring.h" // +#include "llpathfindingmanager.h" + #include "llavatarnamecache.h" #include "lgghunspell_wrapper.h" @@ -234,6 +235,8 @@ #include "lldxhardware.h" #endif +#include "NACLantispam.h" // for NaCl Antispam Registry + // // exported globals // @@ -1060,6 +1063,15 @@ bool idle_startup() LLFile::mkdir(gDirUtilp->getChatLogsDir()); LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); + // NaCl - Antispam + U32 antispam_time = gSavedSettings.getU32("_NACL_AntiSpamTime"); + U32 antispam_amount = gSavedSettings.getU32("_NACL_AntiSpamAmount"); + NACLAntiSpamRegistry::registerQueues(antispam_time, antispam_amount); + gSavedSettings.getControl("_NACL_AntiSpamGlobalQueue")->getSignal()->connect(boost::bind(&NACLAntiSpamRegistry::handleNaclAntiSpamGlobalQueueChanged, _2)); + gSavedSettings.getControl("_NACL_AntiSpamTime")->getSignal()->connect(boost::bind(&NACLAntiSpamRegistry::handleNaclAntiSpamTimeChanged, _2)); + gSavedSettings.getControl("_NACL_AntiSpamAmount")->getSignal()->connect(boost::bind(&NACLAntiSpamRegistry::handleNaclAntiSpamAmountChanged, _2)); + // NaCl End + //good as place as any to create user windlight directories std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", "")); LLFile::mkdir(user_windlight_path_name.c_str()); @@ -1086,12 +1098,14 @@ bool idle_startup() // END TODO LLPanelLogin::close(); } - + //For HTML parsing in text boxes. LLTextEditor::setLinkColor( gSavedSettings.getColor4("HTMLLinkColor") ); // Load URL History File LLURLHistory::loadFile("url_history.xml"); + // Load media plugin cookies + LLViewerMedia::loadCookieFile(); //------------------------------------------------- // Handle startup progress screen @@ -2736,6 +2750,10 @@ bool idle_startup() // reset timers now that we are running "logged in" logic LLFastTimer::reset(); display_startup(); + + llassert(LLPathfindingManager::getInstance() != NULL); + LLPathfindingManager::getInstance()->initSystem(); + return TRUE; } @@ -4304,7 +4322,6 @@ bool process_login_success_response(std::string& password) #endif } - // Override grid info with anything sent in the login response std::string tmp = response["gridname"].asString(); if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setGridName(tmp); @@ -4349,6 +4366,14 @@ bool process_login_success_response(std::string& password) gHippoGridManager->saveFile(); gHippoLimits->setLimits(); + // Start the process of fetching the OpenID session cookie for this user login + std::string openid_url = response["openid_url"]; + if(!openid_url.empty()) + { + std::string openid_token = response["openid_token"]; + LLViewerMedia::openIDSetup(openid_url, openid_token); + } + gIMMgr->loadIgnoreGroup(); bool success = false; @@ -4365,3 +4390,4 @@ bool process_login_success_response(std::string& password) } return success; } + diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 987dbee5c..f9af3a2a9 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -122,6 +122,7 @@ static void onClickFly(void*); static void onClickPush(void*); static void onClickVoice(void*); static void onClickBuild(void*); +static void onClickSeeAV(void*); static void onClickScripts(void*); static void onClickBuyLand(void*); static void onClickScriptDebug(void*); @@ -168,6 +169,7 @@ mSquareMetersCommitted(0) childSetAction("buyland", onClickBuyLand, this ); childSetAction("buycurrency", onClickBuyCurrency, this ); childSetAction("no_build", onClickBuild, this ); + childSetAction("status_SeeAV", onClickSeeAV, this ); childSetAction("no_scripts", onClickScripts, this ); childSetAction("restrictpush", onClickPush, this ); childSetAction("status_no_voice", onClickVoice, this ); @@ -831,6 +833,11 @@ static void onClickBuild(void*) LLNotificationsUtil::add("NoBuild"); } +static void onClickSeeAV(void*) +{ + LLNotificationsUtil::add("SeeAvatars"); +} + static void onClickScripts(void*) { LLViewerRegion* region = gAgent.getRegion(); diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h index 74c22b0cd..2c0da60b4 100644 --- a/indra/newview/lltexlayerparams.h +++ b/indra/newview/lltexlayerparams.h @@ -76,11 +76,11 @@ public: // LLViewerVisualParam Virtual functions /*virtual*/ F32 getTotalDistortion() { return 1.f; } - /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } + /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; } /*virtual*/ F32 getMaxDistortion() { return 3.f; } - /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);} - /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; + /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f);} + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; // New functions BOOL render( S32 x, S32 y, S32 width, S32 height ); @@ -94,7 +94,7 @@ private: LLPointer mStaticImageRaw; BOOL mNeedsCreateTexture; BOOL mStaticImageInvalid; - LLVector3 mAvgDistortionVec; + LLVector4a mAvgDistortionVec; F32 mCachedEffectiveWeight; public: @@ -155,18 +155,18 @@ public: // LLViewerVisualParam Virtual functions /*virtual*/ F32 getTotalDistortion() { return 1.f; } - /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } + /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; } /*virtual*/ F32 getMaxDistortion() { return 3.f; } - /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); } - /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; + /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f); } + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; // New functions LLColor4 getNetColor() const; protected: virtual void onGlobalColorChanged(bool upload_bake) {} private: - LLVector3 mAvgDistortionVec; + LLVector4a mAvgDistortionVec; }; class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index e39f3b7df..990a7228a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1099,7 +1099,7 @@ LLTextureCtrl::LLTextureCtrl( LLRect( 0, image_middle + line_height / 2, getRect().getWidth(), image_middle - line_height / 2 ), - std::string("Multiple"), + LLTrans::getString("multiple_textures"), LLFontGL::getFontSansSerifSmall() ); mTentativeLabel->setHAlign( LLFontGL::HCENTER ); mTentativeLabel->setFollowsAll(); diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 08a1b26ef..f668f5bfc 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -161,6 +161,13 @@ BOOL LLToolBar::postBuild() childSetAction("inventory_btn", onClickInventory, this); childSetControlName("inventory_btn", "ShowInventory"); + mCommunicateBtn.connect(this, "communicate_btn"); + mFlyBtn.connect(this, "fly_btn"); + mBuildBtn.connect(this, "build_btn"); + mMapBtn.connect(this, "map_btn"); + mRadarBtn.connect(this, "radar_btn"); + mInventoryBtn.connect(this, "inventory_button"); + for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { @@ -292,7 +299,9 @@ void LLToolBar::refresh() if(!isAgentAvatarValid()) return; - BOOL show = gSavedSettings.getBOOL("ShowToolBar"); + static LLCachedControl show("ShowToolBar", true); + static LLCachedControl ascent_fly_always_enabled("AscentFlyAlwaysEnabled", true); + static LLCachedControl ascent_build_always_enabled("AscentBuildAlwaysEnabled", true); BOOL mouselook = gAgentCamera.cameraMouselook(); setVisible(show && !mouselook); @@ -302,9 +311,8 @@ void LLToolBar::refresh() sitting = gAgentAvatarp->isSitting(); } - childSetEnabled("fly_btn", (gAgent.canFly() || gAgent.getFlying() || gSavedSettings.getBOOL("AscentFlyAlwaysEnabled")) && !sitting ); - - childSetEnabled("build_btn", (LLViewerParcelMgr::getInstance()->allowAgentBuild() || gSavedSettings.getBOOL("AscentBuildAlwaysEnabled")) ); + mFlyBtn->setEnabled((gAgent.canFly() || gAgent.getFlying() || ascent_fly_always_enabled) && !sitting ); + mBuildBtn->setEnabled((LLViewerParcelMgr::getInstance()->allowAgentBuild() || ascent_build_always_enabled)); // Check to see if we're in build mode BOOL build_mode = LLToolMgr::getInstance()->inEdit(); @@ -323,11 +331,11 @@ void LLToolBar::refresh() { // If we're rez-restricted, we can still edit => allow build floater // If we're edit-restricted, we can still rez => allow build floater - childSetEnabled("build_btn", !(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) ); + mBuildBtn->setEnabled(!(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT))); - childSetEnabled("map_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP) ); - childSetEnabled("radar_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP) ); - childSetEnabled("inventory_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV) ); + mMapBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP)); + mRadarBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP)); + mInventoryBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV)); } // [/RLVa:KB] @@ -339,7 +347,7 @@ void LLToolBar::refresh() void LLToolBar::updateCommunicateList() { - LLFlyoutButton* communicate_button = getChild("communicate_btn"); + LLFlyoutButton* communicate_button = mCommunicateBtn; LLSD selected = communicate_button->getValue(); communicate_button->removeall(); diff --git a/indra/newview/lltoolbar.h b/indra/newview/lltoolbar.h index 197d16dd3..24b05c8ae 100644 --- a/indra/newview/lltoolbar.h +++ b/indra/newview/lltoolbar.h @@ -44,6 +44,8 @@ extern S32 TOOL_BAR_HEIGHT; class LLFakeResizeHandle; #endif // LL_DARWIN +class LLFlyoutButton; + class LLToolBar : public LLPanel { @@ -97,6 +99,13 @@ private: #if LL_DARWIN LLFakeResizeHandle *mResizeHandle; #endif // LL_DARWIN + + CachedUICtrl mCommunicateBtn; + CachedUICtrl mFlyBtn; + CachedUICtrl mBuildBtn; + CachedUICtrl mMapBtn; + CachedUICtrl mRadarBtn; + CachedUICtrl mInventoryBtn; }; extern LLToolBar *gToolBar; diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 32aa96c65..0bde80872 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -214,28 +214,41 @@ 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()) { - // In mouselook, we shouldn't be able to grab non-physical, - // non-touchable objects. If it has a touch handler, we - // do grab it (so llDetectedGrab works), but movement is - // blocked on the server side. JC - if (gAgentCamera.cameraMouselook() && !script_touch) + if (script_touch) { - mMode = GRAB_LOCKED; - gViewerWindow->hideCursor(); - gViewerWindow->moveCursorToCenter(); + mMode = GRAB_NONPHYSICAL; // if it has a script, use the non-physical grab } else { - mMode = GRAB_NONPHYSICAL; + // In mouselook, we shouldn't be able to grab non-physical, + // non-touchable objects. If it has a touch handler, we + // do grab it (so llDetectedGrab works), but movement is + // blocked on the server side. JC + if (gAgentCamera.cameraMouselook()) + { + mMode = GRAB_LOCKED; + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); + } + else if (objectp->permMove() && !objectp->isPermanentEnforced()) + { + mMode = GRAB_ACTIVE_CENTER; + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); + } + else + { + mMode = GRAB_LOCKED; + } + + } - // Don't bail out here, go on and grab so buttons can get - // their "touched" event. } - 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/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 7d9f0a136..0dc00f826 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -40,7 +40,6 @@ #include "llagent.h" #include "llagentcamera.h" -#include "llviewercontrol.h" #include "llfocusmgr.h" #include "llfirstuse.h" #include "llfloateravatarinfo.h" @@ -56,8 +55,10 @@ #include "lltoolgrab.h" #include "lltoolmgr.h" #include "lltoolselect.h" +#include "lltrans.h" #include "llviewercamera.h" #include "llviewerparcelmedia.h" +#include "llviewercontrol.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" #include "llviewerobject.h" @@ -65,8 +66,8 @@ #include "llviewerwindow.h" #include "llwindow.h" #include "llviewermedia.h" -#include "llviewermediafocus.h" #include "llvoavatarself.h" +#include "llviewermediafocus.h" #include "llworld.h" #include "llui.h" #include "llweb.h" @@ -275,7 +276,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // 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) && !always_show) { // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l @@ -401,12 +402,12 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) std::string name = avatar->getFullname(); if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) { - gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate + gMenuHolder->childSetText("Avatar Mute", LLTrans::getString("UnmuteAvatar")); //gMutePieMenu->setLabel("Unmute"); } else { - gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate + gMenuHolder->childSetText("Avatar Mute", LLTrans::getString("MuteAvatar")); //gMutePieMenu->setLabel("Mute"); } @@ -451,12 +452,12 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) } if (LLMuteList::getInstance()->isMuted(object->getID(), name)) { - gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate + gMenuHolder->childSetText("Object Mute", LLTrans::getString("UnmuteObject")); //gMuteObjectPieMenu->setLabel("Unmute"); } else { - gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate + gMenuHolder->childSetText("Object Mute", LLTrans::getString("MuteObject2")); //gMuteObjectPieMenu->setLabel("Mute"); } @@ -703,8 +704,8 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); } // [/RLVa:KB] - else if ((object && !object->isAvatar() && object->usePhysics()) - || (parent && !parent->isAvatar() && parent->usePhysics())) + else if ((object && !object->isAvatar() && object->flagUsePhysics()) + || (parent && !parent->isAvatar() && parent->flagUsePhysics())) { gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLGRAB); } @@ -927,7 +928,7 @@ static bool handle_media_click(const LLPickInfo& pick) } else { - media_impl->mouseDown(pick.mXYCoords.mX, pick.mXYCoords.mY); + media_impl->mouseDown(pick.mXYCoords.mX, pick.mXYCoords.mY, gKeyboard->currentMask(TRUE)); media_impl->mouseCapture(); // the mouse-up will happen when capture is lost } @@ -973,7 +974,7 @@ static bool handle_media_hover(const LLPickInfo& pick) { if(LLViewerMediaFocus::getInstance()->getFocus()) { - media_impl->mouseMove(pick.mXYCoords.mX, pick.mXYCoords.mY); + media_impl->mouseMove(pick.mXYCoords.mX, pick.mXYCoords.mY, gKeyboard->currentMask(TRUE)); } // Set mouse over flag if unset diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp index ab65ead4c..83a5839a9 100644 --- a/indra/newview/llurl.cpp +++ b/indra/newview/llurl.cpp @@ -286,5 +286,11 @@ const char * LLURL::getFullPath() return(sReturnString); } +const char * LLURL::getAuthority() +{ + strncpy(LLURL::sReturnString,mAuthority, LL_MAX_PATH -1); /* Flawfinder: ignore */ + LLURL::sReturnString[LL_MAX_PATH -1] = '\0'; + return(sReturnString); +} char LLURL::sReturnString[LL_MAX_PATH] = ""; diff --git a/indra/newview/llurl.h b/indra/newview/llurl.h index 9a089dd83..e41b83d29 100644 --- a/indra/newview/llurl.h +++ b/indra/newview/llurl.h @@ -79,6 +79,7 @@ public: virtual const char *getFQURL() const; virtual const char *getFullPath(); + virtual const char *getAuthority(); virtual const char *updateRelativePath(const LLURL &url); diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index e46058591..958f4f0e6 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -134,6 +134,7 @@ void audio_update_volume(bool force_update) static const LLCachedControl mute_when_minimized("MuteWhenMinimized",true); static const LLCachedControl audio_level_doppler("AudioLevelDoppler",1.0); static const LLCachedControl audio_level_rolloff("AudioLevelRolloff",1.0); + static const LLCachedControl audio_level_underwater_rolloff("AudioLevelUnderwaterRolloff",3.0); BOOL mute_audio = _mute_audio; if (!gViewerWindow->getActive() && mute_when_minimized) { @@ -147,7 +148,11 @@ void audio_update_volume(bool force_update) gAudiop->setMasterGain ( master_volume ); gAudiop->setDopplerFactor(audio_level_doppler); - gAudiop->setRolloffFactor(audio_level_rolloff); + if(!LLViewerCamera::getInstance()->cameraUnderWater()) + gAudiop->setRolloffFactor( audio_level_rolloff ); + else + gAudiop->setRolloffFactor( audio_level_underwater_rolloff ); + gAudiop->setMuted(mute_audio); if (force_update) @@ -215,32 +220,8 @@ void audio_update_listener() void audio_update_wind(bool force_update) { #ifdef kAUDIO_ENABLE_WIND - // - // Extract height above water to modulate filter by whether above/below water - // - LLViewerRegion* region = gAgent.getRegion(); - if (region) + if(gAgent.getRegion()) { - static F32 last_camera_water_height = -1000.f; - LLVector3 camera_pos = gAgentCamera.getCameraPositionAgent(); - F32 camera_water_height = camera_pos.mV[VZ] - region->getWaterHeight(); - - // - // Don't update rolloff factor unless water surface has been crossed - // - if (force_update || (last_camera_water_height * camera_water_height) < 0.f) - { - static const LLCachedControl audio_level_rolloff("AudioLevelRolloff",1); - if (camera_water_height < 0.f) - { - gAudiop->setRolloffFactor(audio_level_rolloff * LL_ROLLOFF_MULTIPLIER_UNDER_WATER); - } - else - { - gAudiop->setRolloffFactor(audio_level_rolloff); - } - } - // Scale down the contribution of weather-simulation wind to the // ambient wind noise. Wind velocity averages 3.5 m/s, with gusts to 7 m/s // whereas steady-state avatar walk velocity is only 3.2 m/s. @@ -249,9 +230,10 @@ void audio_update_wind(bool force_update) static LLCachedControl wind_level("AudioLevelWind", 0.5f); LLVector3 scaled_wind_vec = gWindVec * wind_level; - // Mix in the avatar's motion, subtract because when you walk north, - // the apparent wind moves south. - LLVector3 final_wind_vec = scaled_wind_vec - gAgent.getVelocity(); + // Mix in the avatar's motion, subtract because when you walk north, + // the apparent wind moves south. + LLVector3 final_wind_vec = scaled_wind_vec - gAgent.getVelocity(); + // rotate the wind vector to be listener (agent) relative gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal(final_wind_vec); @@ -275,7 +257,7 @@ void audio_update_wind(bool force_update) if (gSavedSettings.getBOOL("MuteWind")) { // volume decreases by itself - gAudiop->mMaxWindGain -= gAudiop->mMaxWindGain; + gAudiop->mMaxWindGain = 0.f; } // mute wind when not /*flying*/ in air else if /*(gAgent.getFlying())*/ (gAgentAvatarp && gAgentAvatarp->mInAir) @@ -289,8 +271,7 @@ void audio_update_wind(bool force_update) gAudiop->mMaxWindGain = llmax(gAudiop->mMaxWindGain - volume_delta, 0.f); } - last_camera_water_height = camera_water_height; - gAudiop->updateWind(gRelativeWindVec, camera_water_height); + gAudiop->updateWind(gRelativeWindVec, gAgentCamera.getCameraPositionAgent()[VZ] - gAgent.getRegion()->getWaterHeight()); } #endif } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 755e97e1c..a58bd2c5d 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -83,6 +83,8 @@ #include "lldrawpoolbump.h" #include "emeraldboobutils.h" +#include "NACLantispam.h" // for NaCl Antispam Registry + #ifdef TOGGLE_HACKED_GODLIKE_VIEWER BOOL gHackGodmode = FALSE; #endif @@ -698,6 +700,7 @@ void settings_setup_listeners() gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelUnderwaterRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _2)); gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 8b8c8b703..291d3a3fe 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -440,7 +440,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo case LLAgent::TELEPORT_START_ARRIVAL: // Transition to ARRIVING. Viewer has received avatar update, etc., from destination simulator gTeleportArrivalTimer.reset(); - gViewerWindow->setProgressCancelButtonVisible(FALSE, std::string("Cancel")); //TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel")); gViewerWindow->setProgressPercent(75.f); gAgent.setTeleportState( LLAgent::TELEPORT_ARRIVING ); gAgent.setTeleportMessage( @@ -459,7 +459,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo LLFirstUse::useTeleport(); gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); } - gViewerWindow->setProgressCancelButtonVisible(FALSE, std::string("Cancel")); //TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel")); gViewerWindow->setProgressPercent( arrival_fraction * 25.f + 75.f); gViewerWindow->setProgressString(message); } @@ -1009,7 +1009,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) { gPipeline.mDeferredScreen.flush(); - if(LLRenderTarget::sUseFBO) + if(gPipeline.mDeferredScreen.getFBO()) { LLRenderTarget::copyContentsToFramebuffer(gPipeline.mDeferredScreen, 0, 0, gPipeline.mDeferredScreen.getWidth(), gPipeline.mDeferredScreen.getHeight(), 0, 0, @@ -1021,7 +1021,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo else { gPipeline.mScreen.flush(); - if(LLRenderTarget::sUseFBO) + if(gPipeline.mScreen.getFBO()) { LLRenderTarget::copyContentsToFramebuffer(gPipeline.mScreen, 0, 0, gPipeline.mScreen.getWidth(), gPipeline.mScreen.getHeight(), 0, 0, @@ -1283,14 +1283,12 @@ void render_ui(F32 zoom_factor, int subfield, bool tiling) if (to_texture) { gPipeline.renderBloom(gSnapshot, zoom_factor, subfield, tiling); - gPipeline.mScreen.flush(); //blit, etc. } - /// We copy the frame buffer straight into a texture here, - /// and then display it again with compositor effects. - /// Using render to texture would be faster/better, but I don't have a - /// grasp of their full display stack just yet. + if(gPipeline.canUseVertexShaders()) - LLPostProcess::getInstance()->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); + { + LLPostProcess::getInstance()->renderEffects(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); + } render_hud_elements(); render_hud_attachments(); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 7d83e718d..5b13d747b 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -33,22 +33,31 @@ #include "llviewerprecompiledheaders.h" #include "llviewermedia.h" -#include "llviewermediafocus.h" -#include "llhoverview.h" -#include "llmimetypes.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" -#include "llviewertexturelist.h" -//#include "viewerversion.h" -#include "llpluginclassmedia.h" - -#include "llnotifications.h" +#include "llappviewer.h" +#include "lldir.h" +#include "lldiriterator.h" #include "llevent.h" // LLSimpleListener -#include "llnotificationsutil.h" -#include "lluuid.h" +#include "llhoverview.h" #include "llkeyboard.h" -#include "llhttpclient.h" +#include "llmimetypes.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llpluginclassmedia.h" +#include "llplugincookiestore.h" +#include "llurldispatcher.h" +#include "lluuid.h" +#include "llviewermediafocus.h" +#include "llviewercontrol.h" +#include "llviewertexture.h" +#include "llviewertexturelist.h" +#include "llviewerwindow.h" +#include "llwindow.h" +#include "llvieweraudio.h" +#include "llweb.h" + +#include "llfloateravatarinfo.h" // for getProfileURL() function +//#include "viewerversion.h" // Merov: Temporary definitions while porting the new viewer media code to Snowglobe const int LEFT_BUTTON = 0; @@ -76,11 +85,6 @@ public: completeAny(status, mime_type); } - virtual void error( U32 status, const std::string& reason ) - { - // completeAny(status, "none/none"); - } - void completeAny(U32 status, const std::string& mime_type) { if(!mInitialized && ! mime_type.empty()) @@ -97,8 +101,83 @@ public: viewer_media_t mMediaImpl; bool mInitialized; }; + +class LLViewerMediaOpenIDResponder : public LLHTTPClient::Responder +{ +LOG_CLASS(LLViewerMediaOpenIDResponder); +public: + LLViewerMediaOpenIDResponder( ) + { + } + + ~LLViewerMediaOpenIDResponder() + { + } + + /* virtual */ void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + LL_DEBUGS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL; + LL_DEBUGS("MediaAuth") << content << LL_ENDL; + std::string cookie = content["set-cookie"].asString(); + + LLViewerMedia::openIDCookieResponse(cookie); + } + + /* virtual */ void completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + // This is just here to disable the default behavior (attempting to parse the response as llsd). + // We don't care about the content of the response, only the set-cookie header. + } + +}; + +class LLViewerMediaWebProfileResponder : public LLHTTPClient::Responder +{ +LOG_CLASS(LLViewerMediaWebProfileResponder); +public: + LLViewerMediaWebProfileResponder(std::string host) + { + mHost = host; + } + + ~LLViewerMediaWebProfileResponder() + { + } + + /* virtual */ void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + LL_WARNS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL; + LL_WARNS("MediaAuth") << content << LL_ENDL; + + std::string cookie = content["set-cookie"].asString(); + + LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, mHost); + } + + void completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + // This is just here to disable the default behavior (attempting to parse the response as llsd). + // We don't care about the content of the response, only the set-cookie header. + } + + std::string mHost; +}; + +LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL; +LLURL LLViewerMedia::sOpenIDURL; +std::string LLViewerMedia::sOpenIDCookie; typedef std::list impl_list; static impl_list sViewerMediaImplList; +static std::string sUpdatedCookies; +static const char *PLUGIN_COOKIE_FILE_NAME = "plugin_cookies.txt"; ////////////////////////////////////////////////////////////////////////////////////////// // LLViewerMedia @@ -106,10 +185,12 @@ static impl_list sViewerMediaImplList; ////////////////////////////////////////////////////////////////////////////////////////// // static viewer_media_t LLViewerMedia::newMediaImpl(const std::string& media_url, - const LLUUID& texture_id, - S32 media_width, S32 media_height, U8 media_auto_scale, - U8 media_loop, - std::string mime_type) + const LLUUID& texture_id, + S32 media_width, + S32 media_height, + U8 media_auto_scale, + U8 media_loop, + std::string mime_type) { LLViewerMediaImpl* media_impl = getMediaImplFromTextureID(texture_id); if(media_impl == NULL || texture_id.isNull()) @@ -256,7 +337,8 @@ void LLViewerMedia::setVolume(F32 volume) for(; iter != end; iter++) { LLViewerMediaImpl* pimpl = *iter; - pimpl->setVolume(volume); + LLPluginClassMedia* plugin = pimpl->getMediaPlugin(); + plugin->setVolume(volume); } } @@ -264,6 +346,13 @@ void LLViewerMedia::setVolume(F32 volume) // static void LLViewerMedia::updateMedia() { + sUpdatedCookies = getCookieStore()->getChangedCookies(); + if(!sUpdatedCookies.empty()) + { + lldebugs << "updated cookies will be sent to all loaded plugins: " << llendl; + lldebugs << sUpdatedCookies << llendl; + } + impl_list::iterator iter = sViewerMediaImplList.begin(); impl_list::iterator end = sViewerMediaImplList.end(); @@ -274,6 +363,349 @@ void LLViewerMedia::updateMedia() } } +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::clearAllCookies() +{ + // Clear all cookies for all plugins + impl_list::iterator iter = sViewerMediaImplList.begin(); + impl_list::iterator end = sViewerMediaImplList.end(); + for (; iter != end; iter++) + { + LLViewerMediaImpl* pimpl = *iter; + LLPluginClassMedia* plugin = pimpl->getMediaPlugin(); + if(plugin) + { + plugin->clear_cookies(); + } + } + + // Clear all cookies from the cookie store + getCookieStore()->setAllCookies(""); + + // FIXME: this may not be sufficient, since the on-disk cookie file won't get written until some browser instance exits cleanly. + // It also won't clear cookies for other accounts, or for any account if we're not logged in, and won't do anything at all if there are no webkit plugins loaded. + // Until such time as we can centralize cookie storage, the following hack should cover these cases: + + // HACK: Look for cookie files in all possible places and delete them. + // NOTE: this assumes knowledge of what happens inside the webkit plugin (it's what adds 'browser_profile' to the path and names the cookie file) + + // Places that cookie files can be: + // /browser_profile/cookies + // /first_last/browser_profile/cookies (note that there may be any number of these!) + // /first_last/plugin_cookies.txt (note that there may be any number of these!) + + std::string base_dir = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter(); + std::string target; + std::string filename; + + lldebugs << "base dir = " << base_dir << llendl; + + // The non-logged-in version is easy + target = base_dir; + target += "browser_profile"; + target += gDirUtilp->getDirDelimiter(); + target += "cookies"; + lldebugs << "target = " << target << llendl; + if(LLFile::isfile(target)) + { + LLFile::remove(target); + } + + // the hard part: iterate over all user directories and delete the cookie file from each one + LLDirIterator dir_iter(base_dir, "*_*"); + while (dir_iter.next(filename)) + { + target = base_dir; + target += filename; + target += gDirUtilp->getDirDelimiter(); + target += "browser_profile"; + target += gDirUtilp->getDirDelimiter(); + target += "cookies"; + lldebugs << "target = " << target << llendl; + if(LLFile::isfile(target)) + { + LLFile::remove(target); + } + + // Other accounts may have new-style cookie files too -- delete them as well + target = base_dir; + target += filename; + target += gDirUtilp->getDirDelimiter(); + target += PLUGIN_COOKIE_FILE_NAME; + lldebugs << "target = " << target << llendl; + if(LLFile::isfile(target)) + { + LLFile::remove(target); + } + } + + // If we have an OpenID cookie, re-add it to the cookie store. + setOpenIDCookie(); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::clearAllCaches() +{ + // Clear all plugins' caches + impl_list::iterator iter = sViewerMediaImplList.begin(); + impl_list::iterator end = sViewerMediaImplList.end(); + for (; iter != end; iter++) + { + LLViewerMediaImpl* pimpl = *iter; + pimpl->clearCache(); + } +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::setCookiesEnabled(bool enabled) +{ + // Set the "cookies enabled" flag for all loaded plugins + impl_list::iterator iter = sViewerMediaImplList.begin(); + impl_list::iterator end = sViewerMediaImplList.end(); + for (; iter != end; iter++) + { + LLViewerMediaImpl* pimpl = *iter; + LLPluginClassMedia* plugin = pimpl->getMediaPlugin(); + if(plugin) + { + plugin->enable_cookies(enabled); + } + } +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +///////////////////////////////////////////////////////////////////////////////////////// +// static +LLPluginCookieStore *LLViewerMedia::getCookieStore() +{ + if(sCookieStore == NULL) + { + sCookieStore = new LLPluginCookieStore; + } + + return sCookieStore; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::loadCookieFile() +{ + // build filename for each user + std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME); + + if (resolved_filename.empty()) + { + llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl; + return; + } + + // open the file for reading + llifstream file(resolved_filename); + if (!file.is_open()) + { + llwarns << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << llendl; + return; + } + + getCookieStore()->readAllCookies(file, true); + + file.close(); + + // send the clear_cookies message to all loaded plugins + impl_list::iterator iter = sViewerMediaImplList.begin(); + impl_list::iterator end = sViewerMediaImplList.end(); + for (; iter != end; iter++) + { + LLViewerMediaImpl* pimpl = *iter; + LLPluginClassMedia* plugin = pimpl->getMediaPlugin(); + if(plugin) + { + plugin->clear_cookies(); + } + } + + // If we have an OpenID cookie, re-add it to the cookie store. + setOpenIDCookie(); +} + + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::saveCookieFile() +{ + // build filename for each user + std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME); + + if (resolved_filename.empty()) + { + llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl; + return; + } + + // open a file for writing + llofstream file (resolved_filename); + if (!file.is_open()) + { + llwarns << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << llendl; + return; + } + + getCookieStore()->writePersistentCookies(file); + + file.close(); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path, bool secure) +{ + std::stringstream cookie; + + cookie << name << "=" << LLPluginCookieStore::quoteString(value); + + if(expires.notNull()) + { + cookie << "; expires=" << expires.asRFC1123(); + } + + cookie << "; domain=" << domain; + + cookie << "; path=" << path; + + if(secure) + { + cookie << "; secure"; + } + + getCookieStore()->setCookies(cookie.str()); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path, bool secure) +{ + // A session cookie just has a NULL date. + addCookie(name, value, domain, LLDate(), path, secure); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::removeCookie(const std::string &name, const std::string &domain, const std::string &path ) +{ + // To remove a cookie, add one with the same name, domain, and path that expires in the past. + + addCookie(name, "", domain, LLDate(LLDate::now().secondsSinceEpoch() - 1.0), path); +} + + +LLSD LLViewerMedia::getHeaders() +{ + LLSD headers = LLSD::emptyMap(); + headers["Accept"] = "*/*"; + headers["Content-Type"] = "application/xml"; + headers["Cookie"] = sOpenIDCookie; + headers["User-Agent"] = getCurrentUserAgent(); + + return headers; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::setOpenIDCookie() +{ + if(!sOpenIDCookie.empty()) + { + // The LLURL can give me the 'authority', which is of the form: [username[:password]@]hostname[:port] + // We want just the hostname for the cookie code, but LLURL doesn't seem to have a way to extract that. + // We therefore do it here. + std::string authority = sOpenIDURL.mAuthority; + std::string::size_type host_start = authority.find('@'); + if(host_start == std::string::npos) + { + // no username/password + host_start = 0; + } + else + { + // Hostname starts after the @. + // (If the hostname part is empty, this may put host_start at the end of the string. In that case, it will end up passing through an empty hostname, which is correct.) + ++host_start; + } + std::string::size_type host_end = authority.rfind(':'); + if((host_end == std::string::npos) || (host_end < host_start)) + { + // no port + host_end = authority.size(); + } + + getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(host_start, host_end - host_start)); + + // Do a web profile get so we can store the cookie + LLSD headers = LLSD::emptyMap(); + headers["Accept"] = "*/*"; + headers["Cookie"] = sOpenIDCookie; + headers["User-Agent"] = getCurrentUserAgent(); + + std::string profile_url = getProfileURL(""); + LLURL raw_profile_url( profile_url.c_str() ); + + LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << llendl; + LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << llendl; + LLHTTPClient::get(profile_url, + new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()), + headers); + } +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string &openid_token) +{ + LL_DEBUGS("MediaAuth") << "url = \"" << openid_url << "\", token = \"" << openid_token << "\"" << LL_ENDL; + + // post the token to the url + // the responder will need to extract the cookie(s). + + // Save the OpenID URL for later -- we may need the host when adding the cookie. + sOpenIDURL.init(openid_url.c_str()); + + // We shouldn't ever do this twice, but just in case this code gets repurposed later, clear existing cookies. + sOpenIDCookie.clear(); + + LLSD headers = LLSD::emptyMap(); + // Keep LLHTTPClient from adding an "Accept: application/llsd+xml" header + headers["Accept"] = "*/*"; + // and use the expected content-type for a post, instead of the LLHTTPClient::postRaw() default of "application/octet-stream" + headers["Content-Type"] = "application/x-www-form-urlencoded"; + + // postRaw() takes ownership of the buffer and releases it later, so we need to allocate a new buffer here. + size_t size = openid_token.size(); + U8 *data = new U8[size]; + memcpy(data, openid_token.data(), size); + + LLHTTPClient::postRaw( + openid_url, + data, + size, + new LLViewerMediaOpenIDResponder(), + headers); + +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::openIDCookieResponse(const std::string &cookie) +{ + LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL; + + sOpenIDCookie += cookie; + + setOpenIDCookie(); +} ////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerMedia::cleanupClass() @@ -310,7 +742,10 @@ LLViewerMediaImpl::LLViewerMediaImpl(const std::string& media_url, mTextureUsedWidth(0), mTextureUsedHeight(0), mSuspendUpdates(false), - mVisible(true) + mVisible(true), + mHasFocus(false), + mClearCache(false), + mBackgroundColor(LLColor4::white) { createMediaSource(); } @@ -380,10 +815,10 @@ void LLViewerMediaImpl::setMediaType(const std::string& media_type) LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height) { std::string plugin_basename = LLMIMETypes::implType(media_type); - + if(plugin_basename.empty()) { - LL_WARNS("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL; + LL_WARNS_ONCE("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL; } else { @@ -392,16 +827,29 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ std::string user_data_path = gDirUtilp->getOSUserAppDir(); user_data_path += gDirUtilp->getDirDelimiter(); + // Fix for EXT-5960 - make browser profile specific to user (cache, cookies etc.) + // If the linden username returned is blank, that can only mean we are + // at the login page displaying login Web page or Web browser test via Develop menu. + // In this case we just use whatever gDirUtilp->getOSUserAppDir() gives us (this + // is what we always used before this change) + std::string linden_user_dir = gDirUtilp->getLindenUserDir(true); + if ( ! linden_user_dir.empty() ) + { + // gDirUtilp->getLindenUserDir() is whole path, not just Linden name + user_data_path = linden_user_dir; + user_data_path += gDirUtilp->getDirDelimiter(); + }; + // See if the plugin executable exists llstat s; if(LLFile::stat(launcher_name, &s)) { - LL_WARNS("Media") << "Couldn't find launcher at " << launcher_name << LL_ENDL; + LL_WARNS_ONCE("Media") << "Couldn't find launcher at " << launcher_name << LL_ENDL; llassert(false); // Fail in debugging mode. } else if(LLFile::stat(plugin_name, &s)) { - LL_WARNS("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL; + LL_WARNS_ONCE("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL; llassert(false); // Fail in debugging mode. } else @@ -422,7 +870,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ // collect 'javascript enabled' setting from prefs and send to embedded browser bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" ); media_source->setJavascriptEnabled( javascript_enabled ); - + bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled ); @@ -464,7 +912,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) // and unconditionally set the mime type mMimeType = media_type; - LLPluginClassMedia* media_source = newSourceFromMediaType(media_type, this, mMediaWidth, mMediaHeight); + LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight); if (media_source) { @@ -472,6 +920,8 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) media_source->setLoop(mMediaLoop); media_source->setAutoScale(mMediaAutoScale); media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent()); + media_source->focus(mHasFocus); + media_source->setBackgroundColor(mBackgroundColor); if(gSavedSettings.getBOOL("BrowserIgnoreSSLCertErrors")) { @@ -485,6 +935,23 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) std::string ca_path = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "CA.pem" ); media_source->addCertificateFilePath( ca_path ); + if(mClearCache) + { + mClearCache = false; + media_source->clear_cache(); + } + + // TODO: Only send cookies to plugins that need them + // Ideally, the plugin should tell us whether it handles cookies or not -- either via the init response or through a separate message. + // Due to the ordering of messages, it's possible we wouldn't get that information back in time to send cookies before sending a navigate message, + // which could cause odd race conditions. + std::string all_cookies = LLViewerMedia::getCookieStore()->getAllCookies(); + lldebugs << "setting cookies: " << all_cookies << llendl; + if(!all_cookies.empty()) + { + media_source->set_cookies(all_cookies); + } + mPluginBase = media_source; return true; @@ -586,6 +1053,8 @@ void LLViewerMediaImpl::setVolume(F32 volume) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::focus(bool focus) { + mHasFocus = focus; + LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { @@ -602,20 +1071,27 @@ void LLViewerMediaImpl::focus(bool focus) } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseDown(S32 x, S32 y) +bool LLViewerMediaImpl::hasFocus() const +{ + // FIXME: This might be able to be a bit smarter by hooking into LLViewerMediaFocus, etc. + return mHasFocus; +} + +void LLViewerMediaImpl::clearCache() { LLPluginClassMedia* plugin = getMediaPlugin(); - scaleMouse(&x, &y); - mLastMouseX = x; - mLastMouseY = y; - if (plugin) + if(plugin) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, LEFT_BUTTON, x, y, 0); + plugin->clear_cache(); + } + else + { + mClearCache = true; } } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseUp(S32 x, S32 y) +void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button) { LLPluginClassMedia* plugin = getMediaPlugin(); scaleMouse(&x, &y); @@ -623,12 +1099,12 @@ void LLViewerMediaImpl::mouseUp(S32 x, S32 y) mLastMouseY = y; if (plugin) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, LEFT_BUTTON, x, y, 0); + plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, button, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseMove(S32 x, S32 y) +void LLViewerMediaImpl::mouseUp(S32 x, S32 y, MASK mask, S32 button) { LLPluginClassMedia* plugin = getMediaPlugin(); scaleMouse(&x, &y); @@ -636,12 +1112,12 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y) mLastMouseY = y; if (plugin) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, LEFT_BUTTON, x, y, 0); + plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, button, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseLeftDoubleClick(S32 x, S32 y) +void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask) { LLPluginClassMedia* plugin = getMediaPlugin(); scaleMouse(&x, &y); @@ -649,7 +1125,96 @@ void LLViewerMediaImpl::mouseLeftDoubleClick(S32 x, S32 y) mLastMouseY = y; if (plugin) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, LEFT_BUTTON, x, y, 0); + plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, 0, x, y, mask); + } +} + + +////////////////////////////////////////////////////////////////////////////////////////// +//static +void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y) +{ + LLPluginClassMedia* plugin = getMediaPlugin(); + F32 texture_x = texture_coords.mV[VX]; + F32 texture_y = texture_coords.mV[VY]; + + // Deal with repeating textures by wrapping the coordinates into the range [0, 1.0) + texture_x = fmodf(texture_x, 1.0f); + if(texture_x < 0.0f) + texture_x = 1.0 + texture_x; + + texture_y = fmodf(texture_y, 1.0f); + if(texture_y < 0.0f) + texture_y = 1.0 + texture_y; + + // scale x and y to texel units. + *x = llround(texture_x * plugin->getTextureWidth()); + *y = llround((1.0f - texture_y) * plugin->getTextureHeight()); + + // Adjust for the difference between the actual texture height and the amount of the texture in use. + *y -= (plugin->getTextureHeight() - plugin->getHeight()); +} + +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button) +{ + LLPluginClassMedia* plugin = getMediaPlugin(); + if(plugin) + { + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); + + mouseDown(x, y, mask, button); + } +} + +void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 button) +{ + LLPluginClassMedia* plugin = getMediaPlugin(); + if(plugin) + { + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); + + mouseUp(x, y, mask, button); + } +} + +void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask) +{ + LLPluginClassMedia* plugin = getMediaPlugin(); + if(plugin) + { + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); + + mouseMove(x, y, mask); + } +} + +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button) +{ + LLPluginClassMedia* plugin = getMediaPlugin(); + scaleMouse(&x, &y); + mLastMouseX = x; + mLastMouseY = y; + if (plugin) + { + plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, button, x, y, mask); + } +} + +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::scrollWheel(S32 x, S32 y, MASK mask) +{ + LLPluginClassMedia* plugin = getMediaPlugin(); + scaleMouse(&x, &y); + mLastMouseX = x; + mLastMouseY = y; + if (plugin) + { + plugin->scrollEvent(x, y, mask); } } @@ -659,7 +1224,7 @@ void LLViewerMediaImpl::onMouseCaptureLost() LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, LEFT_BUTTON, mLastMouseX, mLastMouseY, 0); + plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 0, mLastMouseX, mLastMouseY, 0); } } @@ -677,6 +1242,18 @@ BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask) return TRUE; } + +////////////////////////////////////////////////////////////////////////////////////////// +const std::string& LLViewerMediaImpl::getName() const +{ + LLPluginClassMedia* plugin = getMediaPlugin(); + if (plugin) + { + return plugin->getMediaName(); + } + + return LLStringUtil::null; +}; ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::navigateHome() { @@ -788,7 +1365,7 @@ bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask) if(!result) { - LLSD native_key_data = LLSD::emptyMap(); + LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData(); result = plugin->keyEvent(LLPluginClassMedia::KEY_EVENT_DOWN ,key, mask, native_key_data); // Since the viewer internal event dispatching doesn't give us key-up events, simulate one here. @@ -811,7 +1388,7 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) if (uni_char >= 32 // discard 'control' characters && uni_char != 127) // SDL thinks this is 'delete' - yuck. { - LLSD native_key_data = LLSD::emptyMap(); + LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData(); plugin->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data); } @@ -884,6 +1461,17 @@ void LLViewerMediaImpl::updateMovieImage(const LLUUID& uuid, BOOL active) void LLViewerMediaImpl::update() { LLPluginClassMedia* plugin = getMediaPlugin(); + + if(plugin) + { + // If we didn't just create the impl, it may need to get cookie updates. + if(!sUpdatedCookies.empty()) + { + // TODO: Only send cookies to plugins that need them + plugin->set_cookies(sUpdatedCookies); + } + } + if (!plugin) { return; @@ -963,21 +1551,21 @@ void LLViewerMediaImpl::updateImagesMediaStreams() } LLViewerMediaTexture* placeholder_image = (LLViewerMediaTexture*)LLViewerTextureManager::getFetchedTexture( mTextureId ); - LLPluginClassMedia* plugin = getMediaPlugin(); - placeholder_image->getLastReferencedTimer()->reset(); + LLPluginClassMedia* plugin = getMediaPlugin(); + if (mNeedsNewTexture || placeholder_image->getUseMipMaps() - || ! placeholder_image->mIsMediaTexture + || !placeholder_image->mIsMediaTexture || (placeholder_image->getWidth() != plugin->getTextureWidth()) || (placeholder_image->getHeight() != plugin->getTextureHeight()) || (mTextureUsedWidth != plugin->getWidth()) || (mTextureUsedHeight != plugin->getHeight()) ) { - llinfos << "initializing media placeholder" << llendl; - llinfos << "movie image id " << mTextureId << llendl; + LL_DEBUGS("Media") << "initializing media placeholder" << LL_ENDL; + LL_DEBUGS("Media") << "movie image id " << mTextureId << LL_ENDL; int texture_width = plugin->getTextureWidth(); int texture_height = plugin->getTextureHeight(); @@ -991,7 +1579,9 @@ void LLViewerMediaImpl::updateImagesMediaStreams() // MEDIAOPT: seems insane that we actually have to make an imageraw then // immediately discard it LLPointer raw = new LLImageRaw(texture_width, texture_height, texture_depth); - raw->clear(0x0f, 0x0f, 0x0f, 0xff); + // Clear the texture to the background color, ignoring alpha. + // convert background color channels from [0.0, 1.0] to [0, 255]; + raw->clear(int(mBackgroundColor.mV[VX] * 255.0f), int(mBackgroundColor.mV[VY] * 255.0f), int(mBackgroundColor.mV[VZ] * 255.0f), 0xff); int discard_level = 0; // ask media source for correct GL image format constants @@ -1155,6 +1745,12 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* self, LLPluginClass // Just chain the event to observers. emitEvent(self, event); } +//////////////////////////////////////////////////////////////////////////////// +// virtual +void LLViewerMediaImpl::handleCookieSet(LLPluginClassMedia* self, const std::string &cookie) +{ + LLViewerMedia::getCookieStore()->setCookies(cookie); +} //////////////////////////////////////////////////////////////////////////////// // virtual @@ -1222,3 +1818,13 @@ LLViewerMediaImpl::canPaste() const return FALSE; } +void LLViewerMediaImpl::setBackgroundColor(LLColor4 color) +{ + mBackgroundColor = color; + + LLPluginClassMedia* plugin = getMediaPlugin(); + if(plugin) + { + plugin->setBackgroundColor(mBackgroundColor); + } +}; diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index aebfbec76..f33b3f13a 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -33,15 +33,19 @@ #ifndef LLVIEWERMEDIA_H #define LLVIEWERMEDIA_H -#include "llviewermediaeventemitter.h" -#include "llviewerpluginmanager.h" #include "llfocusmgr.h" #include "llpanel.h" +#include "llviewermediaeventemitter.h" +#include "llviewerpluginmanager.h" +#include "llpluginclassmedia.h" +#include "v4color.h" +#include "llurl.h" class LLViewerMediaImpl; class LLUUID; class LLSD; class LLViewerTexture; +class LLPluginCookieStore; typedef LLPointer viewer_media_t; @@ -72,6 +76,33 @@ class LLViewerMedia static void cleanupClass(); + // Clear all cookies for all plugins + static void clearAllCookies(); + + // Clear all plugins' caches + static void clearAllCaches(); + + // Set the "cookies enabled" flag for all loaded plugins + static void setCookiesEnabled(bool enabled); + + static LLPluginCookieStore *getCookieStore(); + static void loadCookieFile(); + static void saveCookieFile(); + static void addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path = std::string("/"), bool secure = false ); + static void addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path = std::string("/"), bool secure = false ); + static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") ); + + static void openIDSetup(const std::string &openid_url, const std::string &openid_token); + static void openIDCookieResponse(const std::string &cookie); + + static LLSD getHeaders(); + +private: + static void setOpenIDCookie(); + + static LLPluginCookieStore *sCookieStore; + static LLURL sOpenIDURL; + static std::string sOpenIDCookie; }; // Implementation functions not exported into header file @@ -81,6 +112,8 @@ class LLViewerMediaImpl LOG_CLASS(LLViewerMediaImpl); public: + friend class LLViewerMedia; + LLViewerMediaImpl(const std::string& media_url, const LLUUID& texture_id, S32 media_width, @@ -98,9 +131,6 @@ public: LLPluginClassMedia* getMediaPlugin() const { return (LLPluginClassMedia*)mPluginBase; } void setSize(int width, int height); - // Inherited from LLViewerPluginManager. - /*virtual*/ void update(); - void play(); void stop(); void pause(); @@ -108,10 +138,16 @@ public: void seek(F32 time); void setVolume(F32 volume); void focus(bool focus); - void mouseDown(S32 x, S32 y); - void mouseUp(S32 x, S32 y); - void mouseMove(S32 x, S32 y); - void mouseLeftDoubleClick(S32 x,S32 y ); + // True if the impl has user focus. + bool hasFocus() const; + void mouseDown(S32 x, S32 y, MASK mask, S32 button = 0); + void mouseUp(S32 x, S32 y, MASK mask, S32 button = 0); + void mouseMove(S32 x, S32 y, MASK mask); + void mouseDown(const LLVector2& texture_coords, MASK mask, S32 button = 0); + void mouseUp(const LLVector2& texture_coords, MASK mask, S32 button = 0); + void mouseMove(const LLVector2& texture_coords, MASK mask); + void mouseDoubleClick(S32 x,S32 y, MASK mask, S32 button = 0); + void scrollWheel(S32 x, S32 y, MASK mask); void mouseCapture(); void navigateHome(); @@ -124,11 +160,14 @@ public: std::string getMediaURL() { return mMediaURL; } std::string getHomeURL() { return mHomeURL; } void setHomeURL(const std::string& home_url) { mHomeURL = home_url; } + void clearCache(); std::string getMimeType() { return mMimeType; } void getTextureSize(S32 *texture_width, S32 *texture_height); void scaleMouse(S32 *mouse_x, S32 *mouse_y); + void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); void updateMovieImage(const LLUUID& image_id, BOOL active); + void update(); void updateImagesMediaStreams(); LLUUID getMediaTextureID(); @@ -166,7 +205,7 @@ public: /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { return FALSE; }; /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return FALSE; }; - /*virtual*/ const std::string& getName() const { return LLStringUtil::null; }; + /*virtual*/ const std::string& getName() const; /*virtual*/ BOOL isView() const { return FALSE; }; /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {}; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {}; @@ -174,6 +213,7 @@ public: // Inherited from LLPluginClassMediaOwner /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent); + /*virtual*/ void handleCookieSet(LLPluginClassMedia* self, const std::string &cookie); // LLEditMenuHandler overrides /*virtual*/ void cut(); @@ -184,8 +224,10 @@ public: /*virtual*/ void paste(); /*virtual*/ BOOL canPaste() const; - -public: + + bool mNeedsNewTexture; + void setBackgroundColor(LLColor4 color); +private: // a single media url with some data and an impl. LLUUID mTextureId; bool mMovieImageHasMips; @@ -198,11 +240,13 @@ public: S32 mMediaHeight; bool mMediaAutoScale; bool mMediaLoop; - bool mNeedsNewTexture; S32 mTextureUsedWidth; S32 mTextureUsedHeight; bool mSuspendUpdates; bool mVisible; + bool mHasFocus; + bool mClearCache; + LLColor4 mBackgroundColor; private: /*LLViewerMediaTexture*/LLViewerTexture *updatePlaceholderImage(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index a30508522..8441b8edf 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -143,6 +143,7 @@ #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" +#include "llfloaterregiondebugconsole.h" #include "llfloaterregioninfo.h" #include "llfloaterreporter.h" #include "llfloaterscriptdebug.h" @@ -245,7 +246,6 @@ #include "lltexlayer.h" // -#include "dofloaterhex.h" #include "hgfloatertexteditor.h" #include "llfloatervfs.h" #include "llfloatervfsexplorer.h" @@ -260,6 +260,7 @@ #include "slfloatermediafilter.h" #include "llviewerobjectbackup.h" #include "llagentui.h" +#include "llpathfindingmanager.h" #include "hippogridmanager.h" @@ -374,7 +375,6 @@ void near_sit_object(); BOOL is_selection_buy_not_take(); S32 selection_price(); BOOL enable_take(); -void handle_take(); bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection_handle); void handle_buy_object(LLSaleInfo sale_info); @@ -419,6 +419,21 @@ void handle_god_mode(void*); // God menu void handle_leave_god_mode(void*); +//Generic handler for singleton-based floaters. +template +BOOL handle_singleton_check(void *) +{ + return T::instanceExists(); +} +template +void handle_singleton_toggle(void *) +{ + if(!T::instanceExists()) + T::getInstance(); + else + T::getInstance()->close(); +} + // void handle_fake_away_status(void*); void handle_area_search(void*); @@ -474,7 +489,6 @@ void handle_force_ground_sit(void*); void handle_phantom_avatar(void*); void handle_hide_typing_notification(void*); void handle_close_all_notifications(void*); -void handle_reopen_with_hex_editor(void*); //void handle_open_message_log(void*); void handle_edit_ao(void*); void handle_local_assets(void*); @@ -549,7 +563,6 @@ BOOL get_visibility(void*); void request_friendship(const LLUUID& agent_id); // Tools menu -void handle_force_unlock(void*); void handle_selected_texture_info(void*); void handle_dump_image_list(void*); @@ -812,7 +825,7 @@ void init_menus() menu->addChild(new LLMenuItemCallGL( "Asset Blacklist", &handle_blacklist, NULL)); menu->addChild(new LLMenuItemCheckGL( "Streaming Audio Display", - &handle_ticker_toggle, &handle_ticker_enabled, &handle_ticker_check, NULL )); + &handle_ticker_toggle, &handle_ticker_enabled, &handle_singleton_check, NULL )); @@ -1283,6 +1296,7 @@ void init_debug_ui_menu(LLMenuGL* menu) (void*)"DoubleClickTeleport")); menu->addSeparator(); // menu->addChild(new LLMenuItemCallGL( "Print Packets Lost", &print_packets_lost, NULL, NULL, 'L', MASK_SHIFT )); + menu->addChild(new LLMenuItemCheckGL("Region Debug", handle_singleton_toggle, NULL, handle_singleton_check,NULL,'`', MASK_CONTROL|MASK_SHIFT)); menu->addChild(new LLMenuItemCheckGL("Debug SelectMgr", menu_toggle_control, NULL, menu_check_control, (void*)"DebugSelectMgr")); menu->addChild(new LLMenuItemToggleGL("Debug Clicks", &gDebugClicks)); menu->addChild(new LLMenuItemToggleGL("Debug Views", &LLView::sDebugRects)); @@ -2686,48 +2700,51 @@ class LLObjectMeasure : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if(object) + static LLVector3 startMeasurePoint = LLVector3::zero; + static bool startpoint_set = false; + + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + if(!object) + return false; + + LLVector3 position = object->getPositionEdit(); + + LLChat chat; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + + if (!startpoint_set) { - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - - if (LLAgent::exlStartMeasurePoint.isExactlyZero()) - { - LLAgent::exlStartMeasurePoint = object->getPosition(); + startMeasurePoint = position; + startpoint_set = true; - chat.mText = llformat("Start point set"); - LLFloaterChat::addChat(chat); - } - else if (LLAgent::exlEndMeasurePoint.isExactlyZero()) - { - LLAgent::exlEndMeasurePoint = object->getPosition(); - - chat.mText = llformat("End point set"); - LLFloaterChat::addChat(chat); - } - else - { - LLAgent::exlStartMeasurePoint = LLVector3::zero; - LLAgent::exlEndMeasurePoint = LLVector3::zero; - return false; - } - - if (!LLAgent::exlStartMeasurePoint.isExactlyZero() && !LLAgent::exlEndMeasurePoint.isExactlyZero()) - { - F32 fdist = dist_vec(LLAgent::exlStartMeasurePoint, LLAgent::exlEndMeasurePoint); - LLAgent::exlStartMeasurePoint = LLVector3::zero; - LLAgent::exlEndMeasurePoint = LLVector3::zero; - - chat.mText = llformat("Distance: %fm", fdist); - LLFloaterChat::addChat(chat); - } + chat.mText = llformat("Start point set"); + LLFloaterChat::addChat(chat); } + else + { + chat.mText = llformat("End point set"); + LLFloaterChat::addChat(chat); + F32 fdist = dist_vec(startMeasurePoint, position); + + chat.mText = llformat("Distance: %fm", fdist); + LLFloaterChat::addChat(chat); + startpoint_set = false; + } return true; } }; +bool enable_object_select_in_pathfinding_linksets() +{ + return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetEditableLinksets(); +} + +bool enable_object_select_in_pathfinding_characters() +{ + return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetViewableCharacters(); +} + class LLAvatarAnims : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -3639,11 +3656,6 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**) // -void handle_reopen_with_hex_editor(void*) -{ - -} - /*void handle_open_message_log(void*) { LLFloaterMessageLog::show(); @@ -4509,8 +4521,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; } @@ -4930,9 +4943,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; } @@ -5176,6 +5190,7 @@ class LLToolsSaveToInventory : public view_listener_t return true; } }; + class LLToolsSaveToObjectInventory : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -5190,6 +5205,22 @@ class LLToolsSaveToObjectInventory : public view_listener_t } }; +class LLToolsEnablePathfinding : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion(); + } +}; + +class LLToolsEnablePathfindingView : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isPathfindingViewEnabled(); + } +}; + // Round the position of all root objects to the grid class LLToolsSnapObjectXY : public view_listener_t { @@ -6321,30 +6352,6 @@ void dump_inventory(void*) gInventory.dumpInventory(); } -// forcibly unlock an object -void handle_force_unlock(void*) -{ - // First, make it public. - LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null, TRUE); - - // Second, lie to the viewer and mark it editable and unowned - - struct f : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* object) - { - object->mFlags |= FLAGS_OBJECT_MOVE; - object->mFlags |= FLAGS_OBJECT_MODIFY; - object->mFlags |= FLAGS_OBJECT_COPY; - - object->mFlags &= ~FLAGS_OBJECT_ANY_OWNER; - object->mFlags &= ~FLAGS_OBJECT_YOU_OWNER; - return true; - } - } func; - LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func); -} - void handle_dump_followcam(void*) { LLFollowCamMgr::dump(); @@ -7305,6 +7312,7 @@ BOOL object_selected_and_point_valid(void *user_data) return (selection->getRootObjectCount() == 1) && (selection->getFirstRootObject()->getPCode() == LL_PCODE_VOLUME) && selection->getFirstRootObject()->permYouOwner() && + !selection->getFirstRootObject()->flagObjectPermanent() && !((LLViewerObject*)selection->getFirstRootObject()->getRoot())->isAvatar() && (selection->getFirstRootObject()->getNVPair("AssetContainer") == NULL); } @@ -7980,8 +7988,8 @@ BOOL enable_save_into_inventory(void*) return TRUE; } } -#endif return FALSE; +#endif } BOOL enable_save_into_task_inventory(void*) @@ -9387,6 +9395,9 @@ void initialize_menus() addMenu(new LLToolsEnableTakeCopy(), "Tools.EnableTakeCopy"); addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.SaveToObjectInventory"); + addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding"); + addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView"); + /*addMenu(new LLToolsVisibleBuyObject(), "Tools.VisibleBuyObject"); addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/ diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 63a9e002a..8f3019121 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -46,6 +46,7 @@ #include "llsdserialize.h" #include "llsdutil.h" #include "llstring.h" +#include "lltrans.h" #include "lltransactiontypes.h" #include "lluictrlfactory.h" #include "lluuid.h" @@ -94,6 +95,7 @@ #include "lllocalinventory.h" // +#include "hippogridmanager.h" #include "importtracker.h" using namespace LLOldEvents; @@ -502,6 +504,19 @@ class LLFileSavePreview : public view_listener_t } }; +class LLFileSavePreviewPNG : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLFloater* top = gFloaterView->getFrontmost(); + if (top) + { + top->saveAsType(true); + } + return true; + } +}; + class LLFileTakeSnapshot : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -855,8 +870,7 @@ void upload_new_resource(const std::string& src_filename, std::string name, else { // Unknown extension - // *TODO: Translate? - error_message = llformat("Unknown file extension .%s\nExpected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh", exten.c_str()); + error_message = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str()); error = TRUE;; } @@ -1021,10 +1035,11 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt if(!(can_afford_transaction(expected_upload_cost))) { - LLFloaterBuyCurrency::buyCurrency( - llformat("Uploading %s costs", - data->mAssetInfo.getName().c_str()), // *TODO: Translate - expected_upload_cost); + LLStringUtil::format_map_t args; + args["[NAME]"] = data->mAssetInfo.getName(); + args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); + args["[AMOUNT]"] = llformat("%d", expected_upload_cost); + LLFloaterBuyCurrency::buyCurrency( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); is_balance_sufficient = FALSE; } else if(region) @@ -1311,6 +1326,7 @@ void init_menu_file() (new LLFileMinimizeAllWindows())->registerListener(gMenuHolder, "File.MinimizeAllWindows"); // (new LLFileSavePreview())->registerListener(gMenuHolder, "File.SavePreview"); + (new LLFileSavePreviewPNG())->registerListener(gMenuHolder, "File.SavePreviewPNG"); (new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot"); (new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk"); (new LLFileQuit())->registerListener(gMenuHolder, "File.Quit"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 00ec70cd1..6b1ffbdfd 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -43,7 +43,7 @@ #include "llavatarnamecache.h" #include "indra_constants.h" #include "lscript_byteformat.h" -#include "mean_collision_data.h" + #include "llfloaterbump.h" #include "llassetstorage.h" #include "llcachename.h" @@ -61,7 +61,10 @@ #include "llteleportflags.h" #include "lltracker.h" #include "lltransactionflags.h" +#include "llvfile.h" +#include "llvfs.h" #include "llxfermanager.h" +#include "mean_collision_data.h" #include "message.h" #include "sound_ids.h" #include "lleventtimer.h" @@ -138,7 +141,6 @@ #include "llviewerwindow.h" #include "llvlmanager.h" #include "llvoavatar.h" -#include "llvotextbubble.h" #include "llweb.h" #include "llworld.h" #include "pipeline.h" @@ -179,6 +181,13 @@ #include "llwindebug.h" // For the invalid message handler #endif +// NaCl - Antispam Registry +#include "NACLantispam.h" +// NaCl - Newline flood protection +#include +static const boost::regex NEWLINES("\\n{1}"); +// NaCl End + // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) #include "llfloateravatarinfo.h" extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp @@ -239,75 +248,6 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = FALSE // ControlYourCamera }; -template -class SH_SpamHandler -{ -public: - SH_SpamHandler(const char *pToggleCtrl, const char *pDurCtrl, const char *pFreqCtrl) : - mDuration(pDurCtrl, 1.f), - mFrequency(pFreqCtrl, 5), - mEnabled(false) - { - gSavedSettings.getControl(pToggleCtrl)->getSignal()->connect(boost::bind(&SH_SpamHandler::CtrlToggle, this, _2)); - CtrlToggle(gSavedSettings.getBOOL(pToggleCtrl)); - } - bool CtrlToggle(const LLSD& newvalue) - { - bool on = newvalue.asBoolean(); - if(on == mEnabled) - return true; - mEnabled = on; - mTimer.stop(); - mActiveList.clear(); - mBlockedList.clear(); - return true; - } - bool isBlocked(const T &owner, const LLUUID &source_id, const char *pNotification, LLSD args=LLSD()) - { - if(!mEnabled || isAgent(owner)) - return false; - if(mBlockedList.find(owner) != mBlockedList.end()) - return true; - if(mTimer.getStarted() && mTimer.getElapsedTimeF32() < mDuration) - { - typename std::map::iterator it = mActiveList.insert(std::pair(owner,0)).first; - if(++(it->second)>=mFrequency) - { - mBlockedList.insert(owner); - if(pNotification) - { - args["OWNER"] = owner; - args["SOURCE"] = source_id; - LLNotifications::getInstance()->add(pNotification,args); - } - return true; - } - } - else - { - mActiveList.clear(); - mTimer.start(); - } - return false; - } -private: - //Owner is either a key, or a name. Do not look up perms since object may be unknown. - static bool isAgent(const T &owner); - bool mEnabled; - LLFrameTimer mTimer; - const LLCachedControl mDuration; - const LLCachedControl mFrequency; - std::map mActiveList; - std::set mBlockedList; -}; -template<> bool SH_SpamHandler::isAgent(const LLUUID &owner) { return gAgent.getID() == owner; } -template<> bool SH_SpamHandler::isAgent(const std::string &owner) -{ - std::string str; - gAgent.getName(str); - return str == owner; -} - bool friendship_offer_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -1470,7 +1410,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID); } - // *TODO:translate std::string from_string; // Used in the pop-up. std::string chatHistory_string; // Used in chat history. if (mFromObject == TRUE) @@ -1480,13 +1419,18 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& std::string group_name; if (gCacheName->getGroupName(mFromID, group_name)) { - from_string = std::string("An object named '") + mFromName + "' owned by the group '" + group_name + "'"; - chatHistory_string = mFromName + " owned by the group '" + group_name + "'"; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + LLTrans::getString("'") + + mFromName + LLTrans::getString("'") + " " + LLTrans::getString("InvOfferOwnedByGroup") + + " " + LLTrans::getString("'") + group_name + LLTrans::getString("'"); + + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup") + + " " + group_name + LLTrans::getString("'") + LLTrans::getString("."); } else { - from_string = std::string("An object named '") + mFromName + "' owned by an unknown group"; - chatHistory_string = mFromName + " owned by an unknown group"; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + LLTrans::getString("'") + + mFromName + LLTrans::getString("'") + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup") + LLTrans::getString("."); } } else @@ -1499,16 +1443,19 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& { full_name = RlvStrings::getAnonym(full_name); } - from_string = std::string("An object named '") + mFromName + "' owned by " + full_name; - chatHistory_string = mFromName + " owned by " + full_name; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + LLTrans::getString("'") + mFromName + + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedBy") + full_name; + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + full_name + LLTrans::getString("."); // [/RLVa:KB] //from_string = std::string("An object named '") + mFromName + "' owned by " + first_name + " " + last_name; //chatHistory_string = mFromName + " owned by " + first_name + " " + last_name; } else { - from_string = std::string("An object named '") + mFromName + "' owned by an unknown user"; - chatHistory_string = mFromName + " owned by an unknown user"; + + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + LLTrans::getString("'") + + mFromName + LLTrans::getString("'") + " " + LLTrans::getString("InvOfferOwnedByUnknownUser"); + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser") + LLTrans::getString("."); } } } @@ -1564,7 +1511,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& //don't spam them if they are getting flooded if (check_offer_throttle(mFromName, true)) { - log_message = chatHistory_string + " gave you " + mDesc + "."; + log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); chat.mText = log_message; LLFloaterChat::addChatHistory(chat); } @@ -1650,7 +1597,10 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& } // [/RLVa:KB] - log_message = "You decline " + mDesc + " from " + mFromName + "."; + LLStringUtil::format_map_t log_message_args; + log_message_args["[DESC]"] = mDesc; + log_message_args["[NAME]"] = mFromName; + log_message = LLTrans::getString("InvOfferDecline", log_message_args); chat.mText = log_message; if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 { @@ -1698,14 +1648,19 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) { - //Until throttling is implmented, busy mode should reject inventory instead of silently + //Until throttling is implemented, busy mode should reject inventory instead of silently //accepting it. SEE SL-39554 if (gAgent.getBusy()) { info->forceResponse(IOR_BUSY); return; } - + + // NaCl - Antispam Registry + static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); + if(antispam || gSavedSettings.getBOOL("AntiSpamItemOffers") || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_INVENTORY,info->mFromID)) + return; + // NaCl End //If muted, don't even go through the messaging stuff. Just curtail the offer here. if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName)) { @@ -1959,6 +1914,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { return; } + static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); LLUUID from_id; BOOL from_group; LLUUID to_id; @@ -1987,6 +1943,27 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) //msg->getData("MessageBlock", "Count", &count); msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name); msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message); + // NaCl - Newline flood protection + LLViewerObject* obj=gObjectList.findObject(from_id); + if(!from_id.isNull() //Not from nothing. + && gAgent.getID() != from_id //Not from self. + && !(obj && obj->permYouOwner())) //Not from own object. + { + static LLCachedControl SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines"); + boost::sregex_iterator iter(message.begin(), message.end(), NEWLINES); + if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines) + { + NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id); + if(gSavedSettings.getBOOL("AntiSpamNotify")) + { + LLSD args; + args["MESSAGE"] = "Message: Blocked newline flood from "+from_id.asString(); + LLNotificationsUtil::add("SystemMessageTip", args); + } + return; + } + } + // NaCl End msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id); msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id); msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position); @@ -1994,6 +1971,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) binary_bucket_size = msg->getSizeFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket); EInstantMessage dialog = (EInstantMessage)d; + // NaCl - Antispam Registry + if((dialog != IM_TYPING_START && dialog != IM_TYPING_STOP) + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id)) + return; + // NaCl End + // make sure that we don't have an empty or all-whitespace name LLStringUtil::trim(name); if (name.empty()) @@ -2023,15 +2006,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { LLSD args; args["NAME"] = name; - static SH_SpamHandler avatar_spam_check("SGBlockGeneralSpam","SGSpamTime","SGSpamCount"); - static SH_SpamHandler object_spam_check("SGBlockGeneralSpam","SGSpamTime","SGSpamCount"); - if(d==IM_FROM_TASK||d==IM_GOTO_URL||d==IM_FROM_TASK_AS_ALERT||d==IM_TASK_INVENTORY_OFFERED||d==IM_TASK_INVENTORY_ACCEPTED||d==IM_TASK_INVENTORY_DECLINED) - { - if(object_spam_check.isBlocked(from_id,session_id,"BlockedGeneralObjects",args)) - return; - } - else if(avatar_spam_check.isBlocked(from_id,from_id,"BlockedGeneralAvatar",args)) - return; } LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. @@ -2071,7 +2045,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) computed_session_id, from_id, name, - llformat("%s has begun an IM session with you.",name.c_str()), + llformat("%s ",name.c_str()) + LLTrans::getString("IM_announce_incoming"), name, IM_NOTHING_SPECIAL, parent_estate_id, @@ -2096,8 +2070,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL ) do_auto_response = true; - if( is_muted && !gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseMuted") ) - do_auto_response = false; + if( is_muted ) + do_auto_response = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseMuted"); if( offline != IM_ONLINE ) do_auto_response = false; @@ -2135,7 +2109,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) computed_session_id, from_id, SYSTEM_FROM, - llformat("Autoresponse sent to %s.",name.c_str()), + LLTrans::getString("IM_autoresponded_to") + llformat(" %s.",name.c_str()), LLStringUtil::null, IM_NOTHING_SPECIAL, parent_estate_id, @@ -2253,7 +2227,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) computed_session_id, from_id, SYSTEM_FROM, - llformat("Sent %s auto-response item \"%s\"",name.c_str(),item->getName().c_str()), + llformat("%s %s \"%s\"",name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str()), LLStringUtil::null, IM_NOTHING_SPECIAL, parent_estate_id, @@ -2404,7 +2378,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) std::string saved; if(offline == IM_OFFLINE) { - saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); + LLStringUtil::format_map_t args; + args["[LONG_TIMESTAMP]"] = formatted_time(timestamp); + saved = LLTrans::getString("Saved_message", args); } buffer = separator_string + saved + message.substr(message_offset); @@ -2465,6 +2441,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_GROUP_NOTICE: case IM_GROUP_NOTICE_REQUESTED: { + // NaCl - Antispam + if(antispam || gSavedSettings.getBOOL("AntiSpamGroupNotices")) + return; + // NaCl End LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL; // Read the binary bucket for more information. struct notice_bucket_header_t @@ -2560,6 +2540,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) break; case IM_GROUP_INVITATION: { + // NaCl - Antispam + if(antispam || gSavedSettings.getBOOL("AntiSpamGroupInvites")) + return; + // NaCl End //if (!is_linden && (is_busy || is_muted)) if ((is_busy || is_muted)) { @@ -2604,6 +2588,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_TASK_INVENTORY_OFFERED: // Someone has offered us some inventory. { + // NaCl - Antispam + if(antispam || gSavedSettings.getBOOL("AntiSpamItemOffers")) + return; + // NaCl End LLOfferInfo* info = new LLOfferInfo; if (IM_INVENTORY_OFFERED == dialog) @@ -2856,6 +2844,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } break; case IM_FROM_TASK_AS_ALERT: + // NaCl - Antispam + if(antispam || (!is_owned_by_me && gSavedSettings.getBOOL("AntiSpamAlerts"))) + return; + // NaCl End if (is_busy && !is_owned_by_me) { return; @@ -2893,6 +2885,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_LURE_USER: { + if(antispam || gSavedSettings.getBOOL("AntiSpamTeleports")) return; //NaCl Antispam // [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c // If the lure sender is a specific @accepttp exception they will override muted and busy status bool fRlvSummon = (rlv_handler_t::isEnabled()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, from_id)); @@ -3057,6 +3050,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_FRIENDSHIP_OFFERED: { + // NaCl - Antispam + if(antispam || gSavedSettings.getBOOL("AntiSpamFriendshipOffers")) + return; + // NaCl End LLSD payload; payload["from_id"] = from_id; payload["session_id"] = session_id;; @@ -3191,11 +3188,22 @@ static LLNotificationFunctorRegistration callingcard_offer_cb_reg("OfferCallingC void process_offer_callingcard(LLMessageSystem* msg, void**) { + // NaCl - Antispam + static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); + if(antispam || gSavedSettings.getBOOL("AntiSpamFriendshipOffers")) + return; + // NaCl End // someone has offered to form a friendship LL_DEBUGS("Messaging") << "callingcard offer" << LL_ENDL; LLUUID source_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id); + + // NaCl - Antispam Registry + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CALLING_CARD,source_id)) + return; + // NaCl End + LLUUID tid; msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_TransactionID, tid); @@ -3228,9 +3236,6 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) } else { - static SH_SpamHandler spam_check("SGBlockCardSpam","SHSpamTime","SGSpamCount"); - if(spam_check.isBlocked(source_id,source_id,"BlockedCards",args)) - return; LLNotificationsUtil::add("OfferCallingCard", args, payload); } } @@ -3385,6 +3390,13 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) msg->getU8("ChatData", "ChatType", type_temp); chat.mChatType = (EChatType)type_temp; + // NaCL - Antispam Registry + if((chat.mChatType != CHAT_TYPE_START && chat.mChatType != CHAT_TYPE_STOP) //Chat type isn't typing + &&((owner_id.isNull() && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,from_id)) //Spam from an object? + ||(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id)))) //Spam from a resident? + return; + // NaCl End + msg->getU8Fast(_PREHASH_ChatData, _PREHASH_Audible, audible_temp); chat.mAudible = (EChatAudible)audible_temp; @@ -3432,12 +3444,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) { LLSD args; args["NAME"] = from_name; - static SH_SpamHandler avatar_spam_check("SGBlockChatSpam","SGChatSpamTime","SGChatSpamCount"); - static SH_SpamHandler object_spam_check("SGBlockChatSpam","SGChatSpamTime","SGChatSpamCount"); - if( (chatter->isAvatar() && avatar_spam_check.isBlocked(from_id,from_id,"BlockedChatterAvatar",args)) || - (!chatter->isAvatar() && object_spam_check.isBlocked(owner_id,from_id,"BlockedChatterObjects",args)) ) - return; - chat.mPosAgent = chatter->getPositionAgent(); // Make swirly things only for talking objects. (not script debug messages, though) @@ -3509,6 +3515,28 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if (is_audible) { msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); + + // NaCl - Newline flood protection + LLViewerObject* obj=gObjectList.findObject(from_id); + if(!(from_id.isNull()) //Not from nothing. + || !(gAgent.getID() != from_id) //Not from self. + || !(obj && obj->permYouOwner())) //Not from own object. + { + static LLCachedControl SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines"); + boost::sregex_iterator iter(mesg.begin(), mesg.end(), NEWLINES); + if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines) + { + NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id); + if(gSavedSettings.getBOOL("AntiSpamNotify")) + { + LLSD args; + args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString(); + LLNotificationsUtil::add("SystemMessageTip", args); + } + return; + } + } + // NaCl End static std::map sChatObjectAuth; @@ -3842,24 +3870,16 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mPosAgent = chatter->getPositionAgent(); } - // truth table: - // LINDEN MUTED BUSY OWNED_BY_YOU TASK DISPLAY STORE IN HISTORY - // F T * * * No No - // F F T F * No Yes - // * F F * * Yes Yes - // * F * T * Yes Yes - // T * * * F Yes Yes - chat.mMuted = is_muted && !is_linden; + bool only_history = visible_in_chat_bubble || (!is_linden && !is_owned_by_me && is_busy); +#if 0 // Google translate doesn't work anymore if (!chat.mMuted) { - bool only_history = visible_in_chat_bubble || (!is_linden && !is_owned_by_me && is_busy); -#if 0 // Google translate doesn't work anymore check_translate_chat(mesg, chat, only_history); -#else - add_floater_chat(chat, only_history); -#endif } +#else + add_floater_chat(chat, only_history); +#endif } } @@ -3886,7 +3906,7 @@ void process_teleport_start(LLMessageSystem *msg, void**) } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); // *TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); } // Freeze the UI and show progress bar @@ -3925,7 +3945,7 @@ void process_teleport_progress(LLMessageSystem* msg, void**) } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); //TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); } std::string buffer; msg->getString("Info", "Message", buffer); @@ -4763,15 +4783,8 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) // Display green bubble on kill if ( gShowObjectUpdates ) { - LLViewerObject* newobject; - newobject = gObjectList.createObjectViewer(LL_PCODE_LEGACY_TEXT_BUBBLE, objectp->getRegion()); - - LLVOTextBubble* bubble = (LLVOTextBubble*) newobject; - - bubble->mColor.setVec(0.f, 1.f, 0.f, 1.f); - bubble->setScale( 2.0f * bubble->getScale() ); - bubble->setPositionGlobal(objectp->getPositionGlobal()); - gPipeline.addObject(bubble); + LLColor4 color(0.f,1.f,0.f,1.f); + gPipeline.addDebugBlip(objectp->getPositionAgent(), color); } // Do the kill @@ -4840,6 +4853,22 @@ void process_sound_trigger(LLMessageSystem *msg, void **) msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_SoundID, sound_id); msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_OwnerID, owner_id); msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id); + + // NaCl - Antispam Registry + static LLCachedControl _NACL_AntiSpamSoundMulti(gSavedSettings,"_NACL_AntiSpamSoundMulti"); + if(owner_id.isNull()) + { + bool bDoSpamCheck=1; + std::string sSound=sound_id.asString(); + for(int i=0;i< COLLISION_SOUNDS_SIZE;i++) + if(COLLISION_SOUNDS[i] == sSound) + bDoSpamCheck=0; + if(bDoSpamCheck) + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id, _NACL_AntiSpamSoundMulti)) return; + } + else if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,owner_id, _NACL_AntiSpamSoundMulti)) return; + // NaCl End + msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ParentID, parent_id); msg->getU64Fast(_PREHASH_SoundData, _PREHASH_Handle, region_handle); msg->getVector3Fast(_PREHASH_SoundData, _PREHASH_Position, pos_local); @@ -4903,6 +4932,14 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id); msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); + // NaCl - Antispam Registry + static LLCachedControl _NACL_AntiSpamSoundPreloadMulti(gSavedSettings,"_NACL_AntiSpamSoundPreloadMulti"); + if((owner_id.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,object_id,_NACL_AntiSpamSoundPreloadMulti)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,owner_id,_NACL_AntiSpamSoundPreloadMulti)) + return; + // NaCl End + LLViewerObject *objectp = gObjectList.findObject(object_id); if (!objectp) return; @@ -4938,6 +4975,14 @@ void process_attached_sound(LLMessageSystem *msg, void **user_data) msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id); msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id); msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); + + // NaCl - Antispam Registry + if((owner_id.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,owner_id)) + return; + // NaCl End + msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain); msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags); @@ -5231,7 +5276,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); @@ -5378,7 +5423,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"); @@ -6030,6 +6075,10 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted) { + // NaCl - Antispam Registry + LLUUID task_id = notification["payload"]["task_id"].asUUID(); + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,task_id)) return; + // NaCl End // only continue if at least some permissions were requested if (orig_questions) { @@ -6196,7 +6245,12 @@ static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestio void process_script_question(LLMessageSystem *msg, void **user_data) { - // *TODO:translate owner name -> [FIRST] [LAST] + // NaCl - Antispam + static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) + return; + // NaCl End + // *TODO: Translate owner name -> [FIRST] [LAST] LLHost sender = msg->getSender(); @@ -6210,6 +6264,14 @@ void process_script_question(LLMessageSystem *msg, void **user_data) msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid ); // itemid -> script asset key of script requesting permissions msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid ); + + // NaCl - Antispam Registry + if((taskid.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,itemid)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,taskid)) + return; + // NaCl End + msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name); msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name); msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); @@ -6347,7 +6409,7 @@ void container_inventory_arrived(LLViewerObject* object, LLUUID cat_id; cat_id = gInventory.createNewCategory(gInventory.getRootFolderID(), LLFolderType::FT_NONE, - std::string("Acquired Items")); //TODO: Translate + LLTrans::getString("AcquiredItems")); LLInventoryObject::object_list_t::const_iterator it = inventory->begin(); LLInventoryObject::object_list_t::const_iterator end = inventory->end(); @@ -6868,17 +6930,32 @@ static LLNotificationFunctorRegistration callback_script_dialog_reg_2("ScriptDia void process_script_dialog(LLMessageSystem* msg, void**) { + // NaCl - Antispam + static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) + return; + // NaCl End S32 i; LLSD payload; LLUUID object_id; msg->getUUID("Data", "ObjectID", object_id); -// For compability with OS grids first check for presence of extended packet before fetching data. + // NaCl - Antispam Registry + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id)) + return; + // NaCl End + + // For compability with OS grids first check for presence of extended packet before fetching data. LLUUID owner_id; if (gMessageSystem->getNumberOfBlocks("OwnerData") > 0) { msg->getUUID("OwnerData", "OwnerID", owner_id); + + // NaCl - Antispam Registry + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id)) + return; + // NaCl End } if (LLMuteList::getInstance()->isMuted(object_id) || LLMuteList::getInstance()->isMuted(owner_id)) @@ -6951,10 +7028,6 @@ void process_script_dialog(LLMessageSystem* msg, void**) { args["NAME"] = LLCacheName::buildFullName(first_name, last_name); - static SH_SpamHandler spam_check("SGBlockDialogSpam","SGSpamTime","SGSpamCount"); - if(spam_check.isBlocked(first_name + " " + last_name,object_id,"BlockedDialogs",args)) - return; - if (is_text_box) { args["DEFAULT"] = default_text; @@ -7038,6 +7111,11 @@ void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool void process_load_url(LLMessageSystem* msg, void**) { + // NaCl - Antispam + static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) + return; + // NaCl End LLUUID object_id; LLUUID owner_id; BOOL owner_is_group; @@ -7048,6 +7126,14 @@ void process_load_url(LLMessageSystem* msg, void**) msg->getString("Data", "ObjectName", 256, object_name); msg->getUUID( "Data", "ObjectID", object_id); msg->getUUID( "Data", "OwnerID", owner_id); + + // NaCl - Antispam Registry + if((owner_id.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id)) + return; + // NaCl End + msg->getBOOL( "Data", "OwnerIsGroup", owner_is_group); msg->getString("Data", "Message", 256, message); msg->getString("Data", "URL", 256, url); @@ -7120,6 +7206,11 @@ void process_initiate_download(LLMessageSystem* msg, void**) void process_script_teleport_request(LLMessageSystem* msg, void**) { + // NaCl - Antispam + static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) + return; + // NaCl End if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return; std::string object_name; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 54ed9ac8d..73392750a 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -88,7 +88,6 @@ #include "llvopartgroup.h" #include "llvosky.h" #include "llvosurfacepatch.h" -#include "llvotextbubble.h" #include "llvotree.h" #include "llvovolume.h" #include "llvowater.h" @@ -173,8 +172,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco // llwarns << "Creating new tree!" << llendl; // res = new LLVOTree(id, pcode, regionp); break; res = NULL; break; - case LL_PCODE_LEGACY_TEXT_BUBBLE: - res = new LLVOTextBubble(id, pcode, regionp); break; #if ENABLE_CLASSIC_CLOUDS case LL_VO_CLOUDS: res = new LLVOClouds(id, pcode, regionp); break; @@ -208,6 +205,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mID(id), mLocalID(0), mTotalCRC(0), + mListIndex(-1), mTEImages(NULL), mGLName(0), mbCanSelect(TRUE), @@ -460,7 +458,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; @@ -2068,6 +2066,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // + // If we're going to skip this message, why are we + // doing all the parenting, etc above? U32 packet_id = mesgsys->getCurrentRecvPacketID(); if (packet_id < mLatestRecvPacketID && mLatestRecvPacketID - packet_id < 65536) @@ -2128,12 +2128,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); } @@ -2145,26 +2144,16 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if ( gShowObjectUpdates ) { - // We want to see updates from our own avatar - //if (!((mPrimitiveCode == LL_PCODE_LEGACY_AVATAR) && (((LLVOAvatar *) this)->mIsSelf)) - // && mRegionp) - if(mRegionp) - // + LLColor4 color; + if (update_type == OUT_TERSE_IMPROVED) { - LLViewerObject* object = gObjectList.createObjectViewer(LL_PCODE_LEGACY_TEXT_BUBBLE, mRegionp); - LLVOTextBubble* bubble = (LLVOTextBubble*) object; - - if (update_type == OUT_TERSE_IMPROVED) - { - bubble->mColor.setVec(0.f, 0.f, 1.f, 1.f); - } - else - { - bubble->mColor.setVec(1.f, 0.f, 0.f, 1.f); - } - object->setPositionGlobal(getPositionGlobal()); - gPipeline.addObject(object); + color.setVec(0.f, 0.f, 1.f, 1.f); } + else + { + color.setVec(1.f, 0.f, 0.f, 1.f); + } + gPipeline.addDebugBlip(getPositionAgent(), color); } if ((0.0f == vel_mag_sq) && @@ -2245,8 +2234,9 @@ BOOL LLViewerObject::isActive() const BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { - static LLFastTimer::DeclareTimer ftm("Viewer Object"); - LLFastTimer t(ftm); + //static LLFastTimer::DeclareTimer ftm("Viewer Object"); + //LLFastTimer t(ftm); + if (mDead) { // It's dead. Don't update it. @@ -4164,38 +4154,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() { @@ -5280,7 +5238,7 @@ BOOL LLViewerObject::permAnyOwner() const { if (isRootEdit()) { - return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0); + return flagObjectAnyOwner(); } else { @@ -5302,7 +5260,7 @@ BOOL LLViewerObject::permYouOwner() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0); + return flagObjectYouOwner(); #endif } else @@ -5316,7 +5274,7 @@ BOOL LLViewerObject::permGroupOwner() const { if (isRootEdit()) { - return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0); + return flagObjectGroupOwned(); } else { @@ -5339,7 +5297,7 @@ BOOL LLViewerObject::permOwnerModify() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0); + return flagObjectOwnerModify(); #endif } else @@ -5363,7 +5321,7 @@ BOOL LLViewerObject::permModify() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_MODIFY) != 0); + return flagObjectModify(); #endif } else @@ -5387,7 +5345,7 @@ BOOL LLViewerObject::permCopy() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_COPY) != 0); + return flagObjectCopy(); #endif } else @@ -5411,7 +5369,7 @@ BOOL LLViewerObject::permMove() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_MOVE) != 0); + return flagObjectMove(); #endif } else @@ -5435,7 +5393,7 @@ BOOL LLViewerObject::permTransfer() const return TRUE; } # endif - return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0); + return flagObjectTransfer(); #endif } else @@ -5481,21 +5439,19 @@ void LLViewerObject::markForUpdate(BOOL priority) } } +bool LLViewerObject::isPermanentEnforced() const +{ + return flagObjectPermanent() && (mRegionp != gAgent.getRegion()) && !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) @@ -5520,8 +5476,8 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp) bool LLViewerObject::specialHoverCursor() const { - return (mFlags & FLAGS_USE_PHYSICS) - || (mFlags & FLAGS_HANDLE_TOUCH) + return flagUsePhysics() + || flagHandleTouch() || (mClickAction != 0); } @@ -5534,10 +5490,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"); @@ -5551,6 +5512,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) @@ -5569,13 +5543,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 403b27490..ac3b6ba28 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -233,6 +233,8 @@ public: const LLUUID &getID() const { return mID; } U32 getLocalID() const { return mLocalID; } U32 getCRC() const { return mTotalCRC; } + S32 getListIndex() const { return mListIndex; } + void setListIndex(S32 idx) { mListIndex = idx; } virtual BOOL isFlexible() const { return FALSE; } virtual BOOL isSculpted() const { return FALSE; } @@ -314,7 +316,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); @@ -483,26 +484,38 @@ 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 ((mFlags & FLAGS_AFFECTS_NAVMESH) != 0); } + inline BOOL flagCharacter() const { return ((mFlags & FLAGS_CHARACTER) != 0); } + inline BOOL flagVolumeDetect() const { return ((mFlags & FLAGS_VOLUME_DETECT) != 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); @@ -519,6 +532,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); @@ -604,15 +618,20 @@ public: // Last total CRC received from sim, used for caching U32 mTotalCRC; + // index into LLViewerObjectList::mActiveObjects or -1 if not in list + S32 mListIndex; + LLPointer *mTEImages; // Selection, picking and rendering variables 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; @@ -690,6 +709,7 @@ protected: F64 mLastInterpUpdateSecs; // Last update for purposes of interpolation F64 mLastMessageUpdateSecs; // Last update from a message from the simulator TPACKETID mLatestRecvPacketID; // Latest time stamp on message from simulator + // extra data sent from the sim...currently only used for tree species info U8* mData; public://Jay: IDGAF @@ -731,7 +751,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/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index 9b0100f6e..138916f79 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -650,9 +650,9 @@ LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool i prim_llsd["scale"] = object->getScale().getValue(); // Flags - prim_llsd["shadows"] = object->flagCastShadows(); + prim_llsd["shadows"] = FALSE; prim_llsd["phantom"] = object->flagPhantom(); - prim_llsd["physical"] = (BOOL)(object->mFlags & FLAGS_USE_PHYSICS); + prim_llsd["physical"] = object->flagUsePhysics(); // Volume params LLVolumeParams params = object->getVolume()->getParams(); @@ -994,9 +994,9 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) object->setScale(prim_llsd["scale"]); - if (prim_llsd.has("shadows")) + /*if (prim_llsd.has("shadows")) if (prim_llsd["shadows"].asInteger() == 1) - object->setFlags(FLAGS_CAST_SHADOWS, true); + object->setFlags(FLAGS_CAST_SHADOWS, true);*/ if (prim_llsd.has("phantom")) if (prim_llsd["phantom"].asInteger() == 1) @@ -1068,7 +1068,6 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) //if (mPrimImportIter != mThisGroup.endMap()) // mPrimImportIter++; - object->sendRotationUpdate(); object->sendTEUpdate(); object->sendShapeUpdate(); LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 758a8c3e9..b1810eeed 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -406,9 +406,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; @@ -417,21 +415,9 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); } - if (flags & FLAGS_ZLIB_COMPRESSED) - { - 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) @@ -932,21 +918,30 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) LLViewerObject *objectp = NULL; // Make a copy of the list in case something in idleUpdate() messes with it - std::vector idle_list; - + static std::vector idle_list; + + U32 idle_count = 0; + static LLFastTimer::DeclareTimer idle_copy("Idle Copy"); { LLFastTimer t(idle_copy); - idle_list.reserve( mActiveObjects.size() ); - - for (std::set >::iterator active_iter = mActiveObjects.begin(); + + for (std::vector >::iterator active_iter = mActiveObjects.begin(); active_iter != mActiveObjects.end(); active_iter++) { objectp = *active_iter; if (objectp) { - idle_list.push_back( objectp ); + if (idle_count >= idle_list.size()) + { + idle_list.push_back( objectp ); + } + else + { + idle_list[idle_count] = objectp; + } + ++idle_count; } else { // There shouldn't be any NULL pointers in the list, but they have caused @@ -956,11 +951,12 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) } } + std::vector::iterator idle_end = idle_list.begin()+idle_count; static const LLCachedControl freeze_time("FreezeTime",0); if (freeze_time) { for (std::vector::iterator iter = idle_list.begin(); - iter != idle_list.end(); iter++) + iter != idle_end; iter++) { objectp = *iter; if ( @@ -976,17 +972,17 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) else { for (std::vector::iterator idle_iter = idle_list.begin(); - idle_iter != idle_list.end(); idle_iter++) + idle_iter != idle_end; idle_iter++) { objectp = *idle_iter; - if (!objectp->idleUpdate(agent, world, frame_time)) + if (objectp->idleUpdate(agent, world, frame_time)) { - // If Idle Update returns false, kill object! - kill_list.push_back(objectp); + num_active_objects++; } else { - num_active_objects++; + // If Idle Update returns false, kill object! + kill_list.push_back(objectp); } } for (std::vector::iterator kill_iter = kill_list.begin(); @@ -1229,7 +1225,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) { //llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << llendl; objectp->setOnActiveList(FALSE); - mActiveObjects.erase(objectp); + removeFromActiveList(objectp); } if (objectp->isOnMap()) @@ -1296,6 +1292,7 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) return TRUE; } + return FALSE; } @@ -1419,6 +1416,26 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) mNumDeadObjects = 0; } +void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) +{ + S32 idx = objectp->getListIndex(); + if (idx != -1) + { //remove by moving last element to this object's position + llassert(mActiveObjects[idx] == objectp); + + objectp->setListIndex(-1); + + S32 last_index = mActiveObjects.size()-1; + + if (idx != last_index) + { + mActiveObjects[idx] = mActiveObjects[last_index]; + mActiveObjects[idx]->setListIndex(idx); + mActiveObjects.pop_back(); + } + } +} + void LLViewerObjectList::updateActive(LLViewerObject *objectp) { LLMemType mt(LLMemType::MTYPE_OBJECT); @@ -1433,13 +1450,29 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) if (active) { //llinfos << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << llendl; - mActiveObjects.insert(objectp); - objectp->setOnActiveList(TRUE); + S32 idx = objectp->getListIndex(); + if (idx <= -1) + { + mActiveObjects.push_back(objectp); + objectp->setListIndex(mActiveObjects.size()-1); + objectp->setOnActiveList(TRUE); + } + else + { + llassert(idx < (S32)mActiveObjects.size()); + llassert(mActiveObjects[idx] == objectp); + + if (idx >= (S32)mActiveObjects.size() || + mActiveObjects[idx] != objectp) + { + llwarns << "Invalid object list index detected!" << llendl; + } + } } else { //llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << llendl; - mActiveObjects.erase(objectp); + removeFromActiveList(objectp); objectp->setOnActiveList(FALSE); } } diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 9266dcf2d..5a48656b7 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -128,7 +128,9 @@ public: void dirtyAllObjectInventory(); + void removeFromActiveList(LLViewerObject* objectp); void updateActive(LLViewerObject *objectp); + void updateAvatarVisibility(); // Selection related stuff @@ -206,7 +208,7 @@ public: typedef std::vector > vobj_list_t; vobj_list_t mObjects; - std::set > mActiveObjects; + std::vector > mActiveObjects; vobj_list_t mMapObjects; diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index e838eaadd..3b8444b54 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -72,6 +72,8 @@ #include "lldeleteutils.h" #include "imageids.h" #include "indra_constants.h" +#include "llinitparam.h" + //#include "linden_common.h" //#include "llpreprocessor.h" #include "llapp.h" @@ -103,7 +105,6 @@ #include "llthread.h" #include "lltimer.h" #include "lluuidhashmap.h" -//#include "llversionviewer.h" //#include "processor.h" #include "stdenums.h" #include "stdtypes.h" @@ -112,27 +113,13 @@ #include "timing.h" #include "u64.h" -// Library includes from llimage -//#include "llblockdata.h" -//#include "llimage.h" -//#include "llimagebmp.h" -//#include "llimagepng.h" -//#include "llimagej2c.h" -//#include "llimagejpeg.h" -//#include "llimagetga.h" -//#include "llmapimagetype.h" - // Library includes from llmath project -//#include "camera.h" -//#include "coordframe.h" #include "llmath.h" #include "llbboxlocal.h" #include "llcamera.h" #include "llcoord.h" #include "llcoordframe.h" #include "llcrc.h" -#include "llinterp.h" -#include "llperlin.h" #include "llplane.h" #include "llquantize.h" #include "llrand.h" @@ -141,7 +128,6 @@ #include "m3math.h" #include "m4math.h" #include "llquaternion.h" -#include "raytrace.h" #include "v2math.h" #include "v3color.h" #include "v3dmath.h" @@ -149,11 +135,9 @@ #include "v4color.h" #include "v4coloru.h" #include "v4math.h" -////#include "vmath.h" #include "xform.h" // Library includes from llmessage project -//#include "llassetstorage.h" #include "llcachename.h" #include "llcircuit.h" #include "lldatapacker.h" @@ -163,16 +147,12 @@ #include "llhost.h" #include "llinstantmessage.h" #include "llinvite.h" -//#include "llloginflags.h" -//#include "llmail.h" #include "llmessagethrottle.h" #include "llnamevalue.h" #include "llpacketack.h" #include "llpacketbuffer.h" //#include "llpacketring.h" #include "llpartdata.h" -//#include "llqueryflags.h" -//#include "llregionflags.h" #include "llregionhandle.h" #include "lltaskname.h" #include "llteleportflags.h" diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6755005a8..11e47bd77 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1562,8 +1562,10 @@ void LLViewerRegion::unpackRegionHandshake() void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) { + capabilityNames.append("AgentState"); //capabilityNames.append("AttachmentResources"); //Script limits (llfloaterscriptlimits.cpp) //capabilityNames.append("AvatarPickerSearch"); //Display name/SLID lookup (llfloateravatarpicker.cpp) + capabilityNames.append("CharacterProperties"); capabilityNames.append("ChatSessionRequest"); capabilityNames.append("CopyInventoryFromNotecard"); capabilityNames.append("CreateInventoryCategory"); @@ -1596,7 +1598,9 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) #if MESH_IMPORT capabilityNames.append("MeshUploadFlag"); #endif //MESH_IMPORT + capabilityNames.append("NavMeshGenerationStatus"); capabilityNames.append("NewFileAgentInventory"); + capabilityNames.append("ObjectNavMeshProperties"); capabilityNames.append("ParcelPropertiesUpdate"); capabilityNames.append("ParcelNavigateMedia"); capabilityNames.append("ParcelVoiceInfoRequest"); @@ -1605,17 +1609,19 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("RemoteParcelRequest"); capabilityNames.append("RequestTextureDownload"); capabilityNames.append("ResourceCostSelected"); //Unreferenced? + capabilityNames.append("RetrieveNavMeshSrc"); capabilityNames.append("SearchStatRequest"); capabilityNames.append("SearchStatTracking"); capabilityNames.append("SendPostcard"); capabilityNames.append("SendUserReport"); capabilityNames.append("SendUserReportWithScreenshot"); capabilityNames.append("ServerReleaseNotes"); - //capabilityNames.append("SimConsole"); + capabilityNames.append("SimConsole"); capabilityNames.append("SimulatorFeatures"); capabilityNames.append("SetDisplayName"); - //capabilityNames.append("SimConsoleAsync"); + capabilityNames.append("SimConsoleAsync"); capabilityNames.append("StartGroupProposal"); + capabilityNames.append("TerrainNavMeshProperties"); capabilityNames.append("TextureStats"); capabilityNames.append("UntrustedSimulatorMessage"); capabilityNames.append("UpdateAgentInformation"); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 6ab2cfd17..2b2de806f 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -170,6 +170,7 @@ LLGLSLShader gGlowExtractProgram(LLViewerShaderMgr::SHADER_EFFECT); //Not in LLGLSLShader gPostColorFilterProgram(LLViewerShaderMgr::SHADER_EFFECT); //Not in mShaderList LLGLSLShader gPostNightVisionProgram(LLViewerShaderMgr::SHADER_EFFECT); //Not in mShaderList LLGLSLShader gPostGaussianBlurProgram(LLViewerShaderMgr::SHADER_EFFECT); //Not in mShaderList +LLGLSLShader gPostPosterizeProgram(LLViewerShaderMgr::SHADER_EFFECT); //Not in mShaderList // Deferred rendering shaders LLGLSLShader gDeferredImpostorProgram(LLViewerShaderMgr::SHADER_DEFERRED); @@ -958,6 +959,23 @@ BOOL LLViewerShaderMgr::loadShadersEffects() gPostGaussianBlurProgram.uniform1i("tex0", 0); } } + + { + vector shaderUniforms; + shaderUniforms.reserve(1); + shaderUniforms.push_back("layerCount"); + + gPostPosterizeProgram.mName = "Posterize Shader (Post)"; + gPostPosterizeProgram.mShaderFiles.clear(); + gPostPosterizeProgram.mShaderFiles.push_back(make_pair("effects/PosterizeF.glsl", GL_FRAGMENT_SHADER_ARB)); + gPostPosterizeProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER_ARB)); + gPostPosterizeProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; + if(gPostPosterizeProgram.createShader(NULL, &shaderUniforms)) + { + gPostPosterizeProgram.bind(); + gPostPosterizeProgram.uniform1i("tex0", 0); + } + } #endif return success; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 4166cc5f2..98962a0fa 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -62,9 +62,6 @@ #include "llviewernetwork.h" #include "llmeshrepository.h" //for LLMeshRepository::sBytesReceived #include "sgmemstat.h" -#if LL_LCD_COMPILE -#include "lllcd.h" -#endif class StatAttributes @@ -201,10 +198,7 @@ const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = // ST_TEX_BAKES StatAttributes("Texture Bakes", FALSE, FALSE), // ST_TEX_REBAKES - StatAttributes("Texture Rebakes", FALSE, FALSE), - - // ST_LOGITECH_KEYBOARD - StatAttributes("Logitech LCD", FALSE, FALSE) + StatAttributes("Texture Rebakes", FALSE, FALSE) }; @@ -699,14 +693,6 @@ void update_statistics(U32 frame_count) mem_stats_timer.reset(); } } - - -#if LL_LCD_COMPILE - bool LCDenabled = gLcdScreen->Enabled(); - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LOGITECH_LCD, LCDenabled); -#else - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LOGITECH_LCD, false); -#endif } class ViewerStatsResponder : public LLHTTPClient::Responder diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index ec91b7efd..93d482da7 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -181,9 +181,8 @@ public: ST_WINDOW_HEIGHT = 55, ST_TEX_BAKES = 56, ST_TEX_REBAKES = 57, - ST_LOGITECH_LCD = 58, - ST_COUNT = 59 + ST_COUNT = 58 }; @@ -282,7 +281,7 @@ public: }; StatsAccumulator mAgentPositionSnaps; - + private: F64 mStats[ST_COUNT]; diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h index 8eaa0af0a..259c0d6ee 100644 --- a/indra/newview/llviewervisualparam.h +++ b/indra/newview/llviewervisualparam.h @@ -84,11 +84,11 @@ public: // New Virtual functions virtual F32 getTotalDistortion() = 0; - virtual const LLVector3& getAvgDistortion() = 0; + virtual const LLVector4a& getAvgDistortion() = 0; virtual F32 getMaxDistortion() = 0; - virtual LLVector3 getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0; - virtual const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0; - virtual const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0; + virtual LLVector4a getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0; + virtual const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0; + virtual const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0; // interface methods F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 833d6412d..9a2626301 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -31,6 +31,8 @@ */ #include "llviewerprecompiledheaders.h" +#include "llviewerwindow.h" + // system library includes #include @@ -42,7 +44,7 @@ #include "llmeshrepository.h" #include "llpanellogin.h" #include "llviewerkeyboard.h" -#include "llviewerwindow.h" + #include "llviewquery.h" #include "llxmltree.h" @@ -75,6 +77,7 @@ #include "lltimer.h" #include "timing.h" #include "llviewermenu.h" +#include "raytrace.h" // newview includes #include "llagent.h" @@ -128,6 +131,7 @@ #include "llmodaldialog.h" #include "llmorphview.h" #include "llmoveview.h" +#include "llpanelpathfindingrebakenavmesh.h" #include "llnotify.h" #include "lloverlaybar.h" #include "llpreviewtexture.h" @@ -1562,6 +1566,7 @@ LLViewerWindow::LLViewerWindow( LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable")); LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ; gGL.init() ; + LLImageGL::initClass(LLViewerTexture::MAX_GL_IMAGE_CATEGORY) ; if (LLFeatureManager::getInstance()->isSafe() || (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion()) @@ -1586,7 +1591,6 @@ LLViewerWindow::LLViewerWindow( // Init the image list. Must happen after GL is initialized and before the images that // LLViewerWindow needs are requested. - LLImageGL::initClass(LLViewerTexture::MAX_GL_IMAGE_CATEGORY) ; gTextureList.init(); LLViewerTextureManager::init() ; gBumpImageList.init(); @@ -1955,6 +1959,10 @@ void LLViewerWindow::initWorldUI() // put behind everything else in the UI mRootView->addChildInBack(gHUDView); } + + LLPanel* panel_ssf_container = getRootView()->getChild("state_management_buttons_container"); + LLPanelPathfindingRebakeNavmesh *panel_rebake_navmesh = LLPanelPathfindingRebakeNavmesh::getInstance(); + panel_ssf_container->addChild(panel_rebake_navmesh); } // initWorldUI that wasn't before logging in. Some of this may require the access the 'LindenUserDir'. @@ -3094,7 +3102,7 @@ void LLViewerWindow::updateUI() } // snap floaters to top of chat bar/button strip - LLView* chatbar_and_buttons = gOverlayBar->getChild("chatbar_and_buttons", TRUE); + LLView* chatbar_and_buttons = gOverlayBar->getChatbarAndButtons(); // find top of chatbar and state buttons, if either are visible if (chatbar_and_buttons && chatbar_and_buttons->getLocalBoundingRect().notEmpty()) { @@ -3425,8 +3433,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; @@ -4839,7 +4850,7 @@ void LLViewerWindow::stopGL(BOOL save_state) if(LLPostProcess::instanceExists()) { - LLPostProcess::getInstance()->invalidate(); + LLPostProcess::getInstance()->destroyGL(); } gTextureList.destroyGL(save_state); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5c4d540ea..63aef9afc 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -40,6 +40,7 @@ #include "llaudioengine.h" #include "noise.h" #include "llsdserialize.h" +#include "raytrace.h" #include "llagent.h" // Get state values from here #include "llagentcamera.h" @@ -1179,6 +1180,7 @@ LLVOAvatar::~LLVOAvatar() lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; mRoot.removeAllChildren(); + mJointMap.clear(); deleteAndClearArray(mSkeleton); deleteAndClearArray(mCollisionVolumes); @@ -2340,6 +2342,7 @@ void LLVOAvatar::buildCharacter() // remove all of mRoot's children //------------------------------------------------------------------------- mRoot.removeAllChildren(); + mJointMap.clear(); mIsBuilt = FALSE; //------------------------------------------------------------------------- @@ -5887,7 +5890,20 @@ const LLUUID& LLVOAvatar::getID() const // RN: avatar joints are multi-rooted to include screen-based attachments LLJoint *LLVOAvatar::getJoint( const std::string &name ) { - LLJoint* jointp = mRoot.findJoint(name); + joint_map_t::iterator iter = mJointMap.find(name); + + LLJoint* jointp = NULL; + + if (iter == mJointMap.end() || iter->second == NULL) + { //search for joint and cache found joint in lookup table + jointp = mRoot.findJoint(name); + mJointMap[name] = jointp; + } + else + { //return cached pointer + jointp = iter->second; + } + return jointp; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index e0d4b3bf5..81529a2f3 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -376,6 +376,10 @@ public: LLVector3 mHeadOffset; // current head position LLViewerJoint mRoot; + + typedef std::map joint_map_t; + joint_map_t mJointMap; + protected: static BOOL parseSkeletonFile(const std::string& filename); void buildCharacter(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index fdfc565e3..fbf0f63ae 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -256,24 +256,23 @@ BOOL LLVOAvatarSelf::buildMenus() //------------------------------------------------------------------------- if(gNoRender) return TRUE; - // *TODO: Translate gAttachBodyPartPieMenus[0] = NULL; - gAttachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); - gAttachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); - gAttachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); + gAttachBodyPartPieMenus[1] = new LLPieMenu(LLTrans::getString("BodyPartsRightArm") + " >"); + gAttachBodyPartPieMenus[2] = new LLPieMenu(LLTrans::getString("BodyPartsHead") + " >"); + gAttachBodyPartPieMenus[3] = new LLPieMenu(LLTrans::getString("BodyPartsLeftArm") + " >"); gAttachBodyPartPieMenus[4] = NULL; - gAttachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); - gAttachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); - gAttachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); + gAttachBodyPartPieMenus[5] = new LLPieMenu(LLTrans::getString("BodyPartsLeftLeg") + " >"); + gAttachBodyPartPieMenus[6] = new LLPieMenu(LLTrans::getString("BodyPartsTorso") + " >"); + gAttachBodyPartPieMenus[7] = new LLPieMenu(LLTrans::getString("BodyPartsRightLeg") + " >"); gDetachBodyPartPieMenus[0] = NULL; - gDetachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); - gDetachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); - gDetachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); + gDetachBodyPartPieMenus[1] = new LLPieMenu(LLTrans::getString("BodyPartsRightArm") + " >"); + gDetachBodyPartPieMenus[2] = new LLPieMenu(LLTrans::getString("BodyPartsHead") + " >"); + gDetachBodyPartPieMenus[3] = new LLPieMenu(LLTrans::getString("BodyPartsLeftArm") + " >"); gDetachBodyPartPieMenus[4] = NULL; - gDetachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); - gDetachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); - gDetachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); + gDetachBodyPartPieMenus[5] = new LLPieMenu(LLTrans::getString("BodyPartsLeftLeg") + " >"); + gDetachBodyPartPieMenus[6] = new LLPieMenu(LLTrans::getString("BodyPartsTorso") + " >"); + gDetachBodyPartPieMenus[7] = new LLPieMenu(LLTrans::getString("BodyPartsRightLeg") + " >"); for (S32 i = 0; i < 8; i++) { @@ -713,7 +712,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); } } @@ -2744,4 +2743,4 @@ void LLVOAvatarSelf::setInvisible(bool invisible) requestLayerSetUploads(); gAgent.sendAgentSetAppearance(); } -} \ No newline at end of file +} diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 5a58ae770..6434dd619 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -645,7 +645,7 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count mFaceList.clear(); LLViewerCamera* camera = LLViewerCamera::getInstance(); - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawablep = *i; diff --git a/indra/newview/llvoiceremotectrl.cpp b/indra/newview/llvoiceremotectrl.cpp index b496f07a7..f8d402a61 100644 --- a/indra/newview/llvoiceremotectrl.cpp +++ b/indra/newview/llvoiceremotectrl.cpp @@ -90,7 +90,12 @@ BOOL LLVoiceRemoteCtrl::postBuild() childSetAction("voice_channel_bg", onClickVoiceChannel, this); - + mEndCallBtn.connect(this,"end_call_btn"); + mVoiceVolIcon.connect(this,"voice_volume"); + mVoiceChanIcon.connect(this,"voice_channel_icon"); + mVoiceChanBgBtn.connect(this,"voice_channel_bg"); + mChanLabelTextBox.connect(this,"channel_label"); + mShowChanBtn.connect(this,"show_channel"); return TRUE; } @@ -106,14 +111,15 @@ void LLVoiceRemoteCtrl::draw() mTalkBtn->setEnabled(voice_active); mTalkLockBtn->setEnabled(voice_active); + static LLCachedControl ptt_currently_enabled("PTTCurrentlyEnabled",false); // propagate ptt state to button display, if (!mTalkBtn->hasMouseCapture()) { // not in push to talk mode, or push to talk is active means I'm talking - mTalkBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled") || gVoiceClient->getUserPTTState()); + mTalkBtn->setToggleState(!ptt_currently_enabled || gVoiceClient->getUserPTTState()); } mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD())); - mTalkLockBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled")); + mTalkLockBtn->setToggleState(!ptt_currently_enabled); std::string talk_blip_image; if (gVoiceClient->getIsSpeaking(gAgent.getID())) @@ -148,7 +154,7 @@ void LLVoiceRemoteCtrl::draw() talk_blip_image = "icn_voice_ptt-off.tga"; } - LLIconCtrl* icon = getChild("voice_volume"); + LLIconCtrl* icon = mVoiceVolIcon; if (icon) { icon->setImage(talk_blip_image); @@ -162,23 +168,23 @@ void LLVoiceRemoteCtrl::draw() } LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel(); - childSetEnabled("end_call_btn", LLVoiceClient::voiceEnabled() + mEndCallBtn->setEnabled(LLVoiceClient::voiceEnabled() && current_channel && current_channel->isActive() && current_channel != LLVoiceChannelProximal::getInstance()); - childSetValue("channel_label", active_channel_name); - childSetToolTip("voice_channel_bg", active_channel_name); + mChanLabelTextBox->setValue(active_channel_name); + mVoiceChanBgBtn->setToolTip(active_channel_name); if (current_channel) { - LLIconCtrl* voice_channel_icon = getChild("voice_channel_icon"); + LLIconCtrl* voice_channel_icon = mVoiceChanIcon; if (voice_channel_icon && voice_floater) { voice_channel_icon->setImage(voice_floater->getString("voice_icon")); } - LLButton* voice_channel_bg = getChild("voice_channel_bg"); + LLButton* voice_channel_bg = mVoiceChanBgBtn; if (voice_channel_bg) { LLColor4 bg_color; @@ -198,7 +204,7 @@ void LLVoiceRemoteCtrl::draw() } } - LLButton* expand_button = getChild("show_channel"); + LLButton* expand_button = mShowChanBtn; if (expand_button) { if (expand_button->getToggleState()) diff --git a/indra/newview/llvoiceremotectrl.h b/indra/newview/llvoiceremotectrl.h index 8522a6f37..86504fe38 100644 --- a/indra/newview/llvoiceremotectrl.h +++ b/indra/newview/llvoiceremotectrl.h @@ -36,6 +36,8 @@ #include "llpanel.h" class LLButton; +class LLIconCtrl; +class LLTextBox; class LLVoiceRemoteCtrl : public LLPanel { @@ -59,6 +61,12 @@ protected: LLButton* mTalkBtn; LLButton* mTalkLockBtn; LLButton* mSpeakersBtn; + CachedUICtrl mEndCallBtn; + CachedUICtrl mVoiceVolIcon; + CachedUICtrl mVoiceChanIcon; + CachedUICtrl mVoiceChanBgBtn; + CachedUICtrl mChanLabelTextBox; + CachedUICtrl mShowChanBtn; }; #endif // LL_LLVOICEREMOTECTRL_H diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 434c8ca64..0a5a76900 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -49,7 +49,6 @@ #include "llviewerregion.h" #include "pipeline.h" #include "llspatialpartition.h" -#include "llviewerobjectlist.h" const F32 MAX_PART_LIFETIME = 120.f; @@ -59,8 +58,7 @@ LLPointer LLVOPartGroup::sVB = NULL; S32 LLVOPartGroup::sVBSlotFree[]; S32* LLVOPartGroup::sVBSlotCursor = NULL; -//static -void LLVOPartGroup::restoreGL() +void LLVOPartGroup::initClass() { for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i) { @@ -68,7 +66,11 @@ void LLVOPartGroup::restoreGL() } sVBSlotCursor = sVBSlotFree; +} +//static +void LLVOPartGroup::restoreGL() +{ sVB = new LLVertexBuffer(VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); U32 count = LL_MAX_PARTICLE_COUNT; sVB->allocateBuffer(count*4, count*6, true); @@ -120,32 +122,6 @@ void LLVOPartGroup::restoreGL() //static void LLVOPartGroup::destroyGL() { - //Just iterate over all particle faces and mark their vbo index as 'uninitialized' since sVBSlotFree & sVBSlotCursor will be clobbered. - for (int i=0; imDrawable) - { - if (obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || - obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES -#if ENABLE_CLASSIC_CLOUDS - || obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS -#endif - ) - { - for (S32 j = 0; j < obj->mDrawable->getNumFaces(); ++j) - { - LLFace* facep = obj->mDrawable->getFace(j); - if(facep) - facep->setIndicesIndex(0xFFFFFFFF); - } - } - } - } - for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i) - { - sVBSlotFree[i] = i; - } sVB = NULL; } @@ -160,7 +136,6 @@ S32 LLVOPartGroup::findAvailableVBSlot() S32 ret = *sVBSlotCursor; sVBSlotCursor++; - return ret; } @@ -582,7 +557,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co mFaceList.clear(); LLViewerCamera* camera = LLViewerCamera::getInstance(); - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawablep = *i; @@ -654,7 +629,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) LLFace* facep = *i; LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject(); - if (facep->getIndicesStart() == 0xFFFFFFFF) + if (!facep->isState(LLFace::PARTICLE)) { //set the indices of this face S32 idx = LLVOPartGroup::findAvailableVBSlot(); if (idx >= 0) @@ -663,6 +638,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) facep->setIndicesIndex(idx*6); facep->setVertexBuffer(LLVOPartGroup::sVB); facep->setPoolType(LLDrawPool::POOL_ALPHA); + facep->setState(LLFace::PARTICLE); } else { diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h index 4c2e073d7..4948ddf55 100644 --- a/indra/newview/llvopartgroup.h +++ b/indra/newview/llvopartgroup.h @@ -51,6 +51,7 @@ public: static S32 sVBSlotFree[LL_MAX_PARTICLE_COUNT]; static S32* sVBSlotCursor; + static void initClass(); static void restoreGL(); static void destroyGL(); static S32 findAvailableVBSlot(); diff --git a/indra/newview/llvotextbubble.cpp b/indra/newview/llvotextbubble.cpp deleted file mode 100644 index 6f73dae11..000000000 --- a/indra/newview/llvotextbubble.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/** - * @file llvotextbubble.cpp - * @brief Viewer-object text bubble. - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llvotextbubble.h" - -#include "imageids.h" -#include "llviewercontrol.h" -#include "llprimitive.h" -#include "llrendersphere.h" - -#include "llagent.h" -#include "llbox.h" -#include "lldrawable.h" -#include "llface.h" -#include "llviewertexturelist.h" -#include "llvolume.h" -#include "pipeline.h" -#include "llvector4a.h" -#include "llviewerregion.h" - -LLVOTextBubble::LLVOTextBubble(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) -: LLAlphaObject(id, pcode, regionp) -{ - setScale(LLVector3(1.5f, 1.5f, 0.25f)); - mbCanSelect = FALSE; - mLOD = MIN_LOD; - mVolumeChanged = TRUE; - setVelocity(LLVector3(0.f, 0.f, 0.75f)); - LLVolumeParams volume_params; - volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE); - volume_params.setBeginAndEndS(0.f, 1.f); - volume_params.setBeginAndEndT(0.f, 1.f); - volume_params.setRatio(0.25f, 0.25f); - volume_params.setShear(0.f, 0.f); - setVolume(volume_params, 0); - mColor = LLColor4(1.0f, 0.0f, 0.0f, 1.f); - S32 i; - for (i = 0; i < getNumTEs(); i++) - { - setTEColor(i, mColor); - setTETexture(i, LLUUID(IMG_DEFAULT)); - } -} - - -LLVOTextBubble::~LLVOTextBubble() -{ -} - - -BOOL LLVOTextBubble::isActive() const -{ - return TRUE; -} - -BOOL LLVOTextBubble::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) -{ - F32 dt = mUpdateTimer.getElapsedTimeF32(); - // Die after a few seconds. - if (dt > 1.5f) - { - return FALSE; - } - - LLViewerObject::idleUpdate(agent, world, time); - - setScale(0.5f * (1.f+dt) * LLVector3(1.5f, 1.5f, 0.5f)); - - F32 alpha = 0.35f*dt; - - LLColor4 color = mColor; - color.mV[VALPHA] -= alpha; - if (color.mV[VALPHA] <= 0.05f) - { - return FALSE; - } - S32 i; - for (i = 0; i < getNumTEs(); i++) - { - setTEColor(i, color); - setTEFullbright(i, TRUE); - } - - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); - return TRUE; -} - - -void LLVOTextBubble::updateTextures() -{ - // Update the image levels of all textures... - - for (U32 i = 0; i < getNumTEs(); i++) - { - const LLTextureEntry *te = getTE(i); - F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); - texel_area_ratio = llclamp(texel_area_ratio, .125f, 16.f); - LLViewerTexture *imagep = getTEImage(i); - if (imagep) - { - imagep->addTextureStats(mPixelArea / texel_area_ratio); - } - } -} - - -LLDrawable *LLVOTextBubble::createDrawable(LLPipeline *pipeline) -{ - pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); - mDrawable->setRenderType(LLPipeline::RENDER_TYPE_VOLUME); - - for (U32 i = 0; i < getNumTEs(); i++) - { - LLViewerTexture *imagep; - const LLTextureEntry *texture_entry = getTE(i); - imagep = LLViewerTextureManager::getFetchedTexture(texture_entry->getID()); - - mDrawable->addFace((LLFacePool*) NULL, imagep); - } - - return mDrawable; -} - -// virtual -BOOL LLVOTextBubble::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume) -{ - if (LLPrimitive::setVolume(volume_params, mLOD)) - { - if (mDrawable) - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); - mVolumeChanged = TRUE; - } - return TRUE; - } - return FALSE; -} - - -BOOL LLVOTextBubble::updateLOD() -{ - return FALSE; -} - -BOOL LLVOTextBubble::updateGeometry(LLDrawable *drawable) -{ - if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_VOLUME))) - return TRUE; - - if (mVolumeChanged) - { - LLVolumeParams volume_params = getVolume()->getParams(); - setVolume(volume_params, 0); - - LLPipeline::sCompiles++; - - drawable->setNumFaces(getVolume()->getNumFaces(), drawable->getFace(0)->getPool(), getTEImage(0)); - } - - LLMatrix4 identity4; - LLMatrix3 identity3; - for (S32 i = 0; i < drawable->getNumFaces(); i++) - { - LLFace *face = drawable->getFace(i); - face->setTEOffset(i); - face->setTexture(LLViewerFetchedTexture::sSmokeImagep); - face->setState(LLFace::FULLBRIGHT); - } - - mVolumeChanged = FALSE; - - mDrawable->movePartition(); - return TRUE; -} - -void LLVOTextBubble::updateFaceSize(S32 idx) -{ - LLFace* face = mDrawable->getFace(idx); - - if (idx == 0 || idx == 2) - { - face->setSize(0,0); - } - else - { - const LLVolumeFace& vol_face = getVolume()->getVolumeFace(idx); - face->setSize(vol_face.mNumVertices, vol_face.mNumIndices); - } -} - -void LLVOTextBubble::getGeometry(S32 idx, - LLStrider& verticesp, - LLStrider& normalsp, - LLStrider& texcoordsp, - LLStrider& colorsp, - LLStrider& indicesp) -{ - if (idx == 0 || idx == 2) - { - return; - } - - const LLVolumeFace& face = getVolume()->getVolumeFace(idx); - - LLVector4a pos; - pos.load3(getPositionAgent().mV); - - LLVector4a scale; - scale.load3(getScale().mV); - - LLColor4U color = LLColor4U(getTE(idx)->getColor()); - U32 offset = mDrawable->getFace(idx)->getGeomIndex(); - - LLVector4a::memcpyNonAliased16((F32*) normalsp.get(), (F32*) face.mNormals, face.mNumVertices*4*sizeof(F32)); - //normalsp.assignArray((U8*)face.mNormals, sizeof(face.mNormals[0]), face.mNumVertices); - LLVector4a::memcpyNonAliased16((F32*) texcoordsp.get(), (F32*) face.mTexCoords, face.mNumVertices*2*sizeof(F32)); - //texcoordsp.assignArray((U8*)face.mTexCoords, sizeof(face.mTexCoords[0]), face.mNumVertices); - - - for (U32 i = 0; i < (U32)face.mNumVertices; i++) - { - (verticesp++)->setMul(face.mPositions[i],scale); - verticesp->add(pos); - *colorsp++ = color; - } - - for (U32 i = 0; i < (U32)face.mNumIndices; i++) - { - *indicesp++ = face.mIndices[i] + offset; - } -} - -U32 LLVOTextBubble::getPartitionType() const -{ - return LLViewerRegion::PARTITION_PARTICLE; -} diff --git a/indra/newview/llvotextbubble.h b/indra/newview/llvotextbubble.h deleted file mode 100644 index 0da5c4e64..000000000 --- a/indra/newview/llvotextbubble.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file llvotextbubble.h - * @brief Description of LLVORock class, which a derivation of LLViewerObject - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLVOTEXTBUBBLE_H -#define LL_LLVOTEXTBUBBLE_H - -#include "llviewerobject.h" -#include "llframetimer.h" - -class LLVOTextBubble : public LLAlphaObject -{ -public: - LLVOTextBubble(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. - /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); - - /*virtual*/ void updateTextures(); - /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - /*virtual*/ BOOL updateLOD(); - /*virtual*/ void updateFaceSize(S32 idx); - - /*virtual*/ void getGeometry(S32 idx, - LLStrider& verticesp, - LLStrider& normalsp, - LLStrider& texcoordsp, - LLStrider& colorsp, - LLStrider& indicesp); - - virtual U32 getPartitionType() const; - - LLColor4 mColor; - S32 mLOD; - BOOL mVolumeChanged; - -protected: - ~LLVOTextBubble(); - BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); - LLFrameTimer mUpdateTimer; -}; - -#endif // LL_VO_TEXT_BUBBLE diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index d8b34bd30..c9e38c270 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -430,8 +430,8 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { LLViewerObject::idleUpdate(agent, world, time); - static LLFastTimer::DeclareTimer ftm("Volume Idle"); - LLFastTimer t(ftm); + //static LLFastTimer::DeclareTimer ftm("Volume Idle"); + //LLFastTimer t(ftm); if (mDead || mDrawable.isNull()) { @@ -2390,7 +2390,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const produces_light = 1; } - for (S32 i = 0; i < num_faces; ++i) + for (S32 i = 0; i < (S32)num_faces; ++i) { const LLFace* face = drawablep->getFace(i); if (!face) continue; @@ -3084,6 +3084,11 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons LLVector4a* weight = vol_face.mWeights; + if(!weight) + { + continue; + } + LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); @@ -3481,7 +3486,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLFastTimer t(FTM_REBUILD_VOLUME_FACE_LIST); //get all the faces into a list - for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) + for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { LLDrawable* drawablep = *drawable_iter; @@ -3887,7 +3892,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (!LLPipeline::sDelayVBUpdate) { //drawables have been rebuilt, clear rebuild status - for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) + for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { LLDrawable* drawablep = *drawable_iter; drawablep->clearState(LLDrawable::REBUILD_ALL); @@ -3927,7 +3932,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) std::set mapped_buffers; - for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) + for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { LLDrawable* drawablep = *drawable_iter; @@ -3951,8 +3956,14 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) if (buff) { llassert(!face->isState(LLFace::RIGGED)); - face->getGeometryVolume(*volume, face->getTEOffset(), - vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex()); + + if (!face->getGeometryVolume(*volume, face->getTEOffset(), + vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex())) + { //something's gone wrong with the vertex buffer accounting, rebuild this group + group->dirtyGeom(); + gPipeline.markRebuild(group, TRUE); + } + if (buff->isLocked()) { @@ -3993,7 +4004,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) llwarns << "Not all mapped vertex buffers are unmapped!" << llendl ; warningsCount = 1; } - for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) + for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { LLDrawable* drawablep = *drawable_iter; for (S32 i = 0; i < drawablep->getNumFaces(); ++i) @@ -4159,11 +4170,16 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: facep->setTextureIndex(cur_tex); texture_list.push_back(tex); - //if (can_batch_texture(facep)) + if (can_batch_texture(facep)) { while (i != faces.end()) { facep = *i; + if (!can_batch_texture(facep)) + { //face is bump mapped or has an animated texture matrix -- can't + //batch more than 1 texture at a time + break; + } if (facep->getTexture() != tex) { if (distance_sort) @@ -4189,12 +4205,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: cur_tex++; } - if (!can_batch_texture(facep)) - { //face is bump mapped or has an animated texture matrix -- can't - //batch more than 1 texture at a time - break; - } - if (cur_tex >= texture_index_channels) { //cut batches when index channels are depleted break; @@ -4216,9 +4226,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: facep->setTextureIndex(cur_tex); } + tex = texture_list[0]; } - - tex = texture_list[0]; } else { @@ -4294,8 +4303,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: llassert(!facep->isState(LLFace::RIGGED)); - facep->getGeometryVolume(*volume, te_idx, - vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true); + if (!facep->getGeometryVolume(*volume, te_idx, + vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true)) + { + llwarns << "Failed to get geometry for face!" << llendl; + } if (drawablep->isState(LLDrawable::ANIMATED_CHILD)) { @@ -4464,7 +4476,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun //for each drawable - for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) + for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { LLDrawable* drawablep = *drawable_iter; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index cc7b5cf10..dbf9800db 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -70,7 +70,7 @@ class LLVolumeInterface public: virtual ~LLVolumeInterface() { } virtual LLVolumeInterfaceType getInterfaceType() const = 0; - virtual BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0; + virtual void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0; virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0; virtual LLVector3 getPivotPosition() const = 0; virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0; @@ -297,6 +297,7 @@ public: U8 mTexAnimMode; private: friend class LLDrawable; + friend class LLFace; BOOL mFaceMappingChanged; LLFrameTimer mTextureUpdateTimer; diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 28bfe034a..4dbcfc578 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -35,11 +35,20 @@ #include "llweb.h" -#include "llviewerwindow.h" -#include "llwindow.h" +// Library includes +#include "llwindow.h" // spawnWebBrowser() -#include "llviewercontrol.h" +#include "llagent.h" +#include "llappviewer.h" #include "llfloatermediabrowser.h" +#include "llparcel.h" +#include "llviewercontrol.h" +#include "llviewernetwork.h" +#include "llviewerparcelmgr.h" +#include "llviewerregion.h" +#include "llviewerwindow.h" + +#include "sgversion.h" // static void LLWeb::initClass() @@ -125,6 +134,64 @@ std::string LLWeb::escapeURL(const std::string& url) return escaped_url; } +//static +std::string LLWeb::expandURLSubstitutions(const std::string &url, + const LLSD &default_subs) +{ + gCurrentVersion = llformat("%s %d.%d.%d.%d", + gVersionChannel, + gVersionMajor, + gVersionMinor, + gVersionPatch, + gVersionBuild ); + + LLSD substitution = default_subs; + substitution["VERSION"] = gCurrentVersion; + substitution["VERSION_MAJOR"] = gVersionMajor; + substitution["VERSION_MINOR"] = gVersionMinor; + substitution["VERSION_PATCH"] = gVersionPatch; + substitution["VERSION_BUILD"] = gVersionBuild; + substitution["CHANNEL"] = gVersionChannel; + substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel(); + substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple(); + substitution["SESSION_ID"] = gAgent.getSessionID(); + substitution["FIRST_LOGIN"] = gAgent.isFirstLogin(); + + // work out the current language + std::string lang = LLUI::getLanguage(); + if (lang == "en-us") + { + // *HACK: the correct fix is to change English.lproj/language.txt, + // but we're late in the release cycle and this is a less risky fix + lang = "en"; + } + substitution["LANGUAGE"] = lang; + + // find the region ID + LLUUID region_id; + LLViewerRegion *region = gAgent.getRegion(); + if (region) + { + region_id = region->getRegionID(); + } + substitution["REGION_ID"] = region_id; + + // find the parcel local ID + S32 parcel_id = 0; + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (parcel) + { + parcel_id = parcel->getLocalID(); + } + substitution["PARCEL_ID"] = llformat("%d", parcel_id); + + // expand all of the substitution strings and escape the url + std::string expanded_url = url; + LLStringUtil::format(expanded_url, substitution); + + return LLWeb::escapeURL(expanded_url); +} + // virtual void LLWeb::URLLoader::load(const std::string& url) { diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index 8dd13ffcb..73f5c7ebe 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -57,6 +57,10 @@ public: // Returns escaped (eg, " " to "%20") url static std::string escapeURL(const std::string& url); + /// Expands various strings like [LANG], [VERSION], etc. in a URL + static std::string expandURLSubstitutions(const std::string &url, + const LLSD &default_subs); + class URLLoader : public LLAlertDialog::URLLoader { virtual void load(const std::string& url); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 27632dcfc..8440b836a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -54,6 +54,7 @@ #include "llglheaders.h" #include "llrender.h" #include "llwindow.h" +#include "llpostprocess.h" // newview includes #include "llagent.h" @@ -453,15 +454,6 @@ void LLPipeline::init() mSpotLightFade[i] = 1.f; } - if (mCubeVB.isNull()) - { - mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB); - } - if(mDeferredVB.isNull()) - { - mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); - mDeferredVB->allocateBuffer(8, 0, true); - } setLightingDetail(-1); gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); @@ -702,9 +694,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) //allocate deferred rendering color buffers - static const LLCachedControl shadow_precision("DeferredHighPrecision",true); - const GLuint format = shadow_precision ? GL_RGBA : GL_RGBA16F_ARB; //TO-DO: Profile 16bit format later - if (!mDeferredScreen.allocate(resX, resY, format, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; + if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; if (!addDeferredAttachments(mDeferredScreen)) return false; @@ -874,6 +864,9 @@ void LLPipeline::releaseGLBuffers() gBumpImageList.destroyGL(); LLVOAvatar::resetImpostors(); + + if(LLPostProcess::instanceExists()) + LLPostProcess::getInstance()->destroyGL(); } void LLPipeline::releaseLUTBuffers() @@ -1174,7 +1167,7 @@ public: { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); - if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->getData().empty()) + if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty()) { for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) { @@ -1781,7 +1774,7 @@ void LLPipeline::clearReferences() void check_references(LLSpatialGroup* group, LLDrawable* drawable) { - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { if (drawable == *i) { @@ -1803,7 +1796,7 @@ void check_references(LLDrawable* drawable, LLFace* face) void check_references(LLSpatialGroup* group, LLFace* face) { - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawable = *i; check_references(drawable, face); @@ -1815,25 +1808,25 @@ void LLPipeline::checkReferences(LLFace* face) #if 0 if (sCull) { - for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, face); } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, face); } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, face); } - for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) + for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) { LLDrawable* drawable = *iter; check_references(drawable, face); @@ -1847,25 +1840,25 @@ void LLPipeline::checkReferences(LLDrawable* drawable) #if 0 if (sCull) { - for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, drawable); } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, drawable); } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, drawable); } - for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) + for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) { if (drawable == *iter) { @@ -1898,19 +1891,19 @@ void LLPipeline::checkReferences(LLDrawInfo* draw_info) #if 0 if (sCull) { - for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, draw_info); } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, draw_info); } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) { LLSpatialGroup* group = *iter; check_references(group, draw_info); @@ -1924,7 +1917,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group) #if 0 if (sCull) { - for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) { if (group == *iter) { @@ -1932,7 +1925,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group) } } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) { if (group == *iter) { @@ -1940,7 +1933,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group) } } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) { if (group == *iter) { @@ -2179,7 +2172,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera) { - if (group->getData().empty()) + if (group->isEmpty()) { return; } @@ -2282,7 +2275,7 @@ void LLPipeline::doOcclusion(LLCamera& camera) } mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX); - for (LLCullResult::sg_list_t::iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter) { LLSpatialGroup* group = *iter; group->doOcclusion(&camera); @@ -2816,7 +2809,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) //LLVertexBuffer::unbind(); grabReferences(result); - for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) { LLSpatialGroup* group = *iter; group->checkOcclusion(); @@ -2827,7 +2820,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) else { group->setVisible(); - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { markVisible(*i, camera); } @@ -2842,9 +2835,9 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) { LLSpatialGroup* last_group = NULL; - for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) + for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) { - LLCullResult::bridge_list_t::iterator cur_iter = i; + LLCullResult::bridge_iterator cur_iter = i; LLSpatialBridge* bridge = *cur_iter; LLSpatialGroup* group = bridge->getSpatialGroup(); @@ -2874,7 +2867,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) } } - for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) + for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) { LLSpatialGroup* group = *iter; group->checkOcclusion(); @@ -2896,7 +2889,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) { LLFastTimer ftm(FTM_STATESORT_DRAWABLE); - for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); + for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) { LLDrawable *drawablep = *iter; @@ -2915,7 +2908,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera) LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT); if (!sSkipUpdate && group->changeLOD()) { - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawablep = *i; stateSort(drawablep, camera); @@ -3045,13 +3038,13 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) } -void forAllDrawables(LLCullResult::sg_list_t::iterator begin, - LLCullResult::sg_list_t::iterator end, +void forAllDrawables(LLCullResult::sg_iterator begin, + LLCullResult::sg_iterator end, void (*func)(LLDrawable*)) { - for (LLCullResult::sg_list_t::iterator i = begin; i != end; ++i) + for (LLCullResult::sg_iterator i = begin; i != end; ++i) { - for (LLSpatialGroup::element_iter j = (*i)->getData().begin(); j != (*i)->getData().end(); ++j) + for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j) { func(*j); } @@ -3132,7 +3125,7 @@ void renderPhysicalBeacons(LLDrawable* drawablep) if (vobj && !vobj->isAvatar() //&& !vobj->getParent() - && vobj->usePhysics()) + && vobj->flagUsePhysics()) { if (gPipeline.sRenderBeacons) { @@ -3219,7 +3212,7 @@ void LLPipeline::postSort(LLCamera& camera) llpushcallstacks ; //rebuild drawable geometry - for (LLCullResult::sg_list_t::iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i) + for (LLCullResult::sg_iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i) { LLSpatialGroup* group = *i; if (!sUseOcclusion || @@ -3237,7 +3230,7 @@ void LLPipeline::postSort(LLCamera& camera) //build render map - for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) + for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) { LLSpatialGroup* group = *i; @@ -4179,7 +4172,7 @@ void LLPipeline::renderPhysicsDisplay() } } - for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) + for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) { LLSpatialBridge* bridge = *i; if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) @@ -4206,9 +4199,6 @@ void LLPipeline::renderDebug() { LLMemType mt(LLMemType::MTYPE_PIPELINE); - if(!mRenderDebugMask) - return; - assertInitialized(); gGL.color4f(1,1,1,1); @@ -4219,6 +4209,52 @@ void LLPipeline::renderDebug() bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); + if (!hud_only && !mDebugBlips.empty()) + { //render debug blips + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + + gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true); + + glPointSize(8.f); + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); + + gGL.begin(LLRender::POINTS); + for (std::list::iterator iter = mDebugBlips.begin(); iter != mDebugBlips.end(); ) + { + DebugBlip& blip = *iter; + + blip.mAge += gFrameIntervalSeconds; + if (blip.mAge > 2.f) + { + mDebugBlips.erase(iter++); + } + else + { + iter++; + } + + blip.mPosition.mV[2] += gFrameIntervalSeconds*2.f; + + gGL.color4fv(blip.mColor.mV); + gGL.vertex3fv(blip.mPosition.mV); + } + gGL.end(); + gGL.flush(); + glPointSize(1.f); + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } + + } + + if(!mRenderDebugMask) + return; + // Debug stuff. for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) @@ -4238,7 +4274,7 @@ void LLPipeline::renderDebug() } } - for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) + for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) { LLSpatialBridge* bridge = *i; if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) @@ -6122,12 +6158,14 @@ void LLPipeline::doResetVertexBuffers() LLVOPartGroup::destroyGL(); + if(LLPostProcess::instanceExists()) + LLPostProcess::getInstance()->destroyGL(); + LLVertexBuffer::cleanupClass(); //delete all name pool caches LLGLNamePool::cleanupPools(); - if (LLVertexBuffer::sGLCount > 0) { llwarns << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << llendl; @@ -6934,7 +6972,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield, b } - if (LLRenderTarget::sUseFBO) + if (mScreen.getFBO()) { //copy depth buffer from mScreen to framebuffer LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(), 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); @@ -9328,7 +9366,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture) { - for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) + for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) { LLSpatialGroup* group = *i; if (!group->isDead() && @@ -9418,81 +9456,86 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) stateSort(*LLViewerCamera::getInstance(), result); - const LLVector4a* ext = avatar->mDrawable->getSpatialExtents(); - LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); - LLCamera camera = *viewer_camera; - - camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis()); - LLVector2 tdim; + U32 resY = 0; + U32 resX = 0; - - LLVector4a half_height; - half_height.setSub(ext[1], ext[0]); - half_height.mul(0.5f); - - LLVector4a left; - left.load3(camera.getLeftAxis().mV); - left.mul(left); - left.normalize3fast(); - - LLVector4a up; - up.load3(camera.getUpAxis().mV); - up.mul(up); - up.normalize3fast(); - - tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); - tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); - - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - - F32 distance = (pos-camera.getOrigin()).length(); - F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; - F32 aspect = tdim.mV[0]/tdim.mV[1]; - glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); - glh_set_current_projection(persp); - gGL.loadMatrix(persp.m); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - glh::matrix4f mat; - camera.getOpenGLTransform(mat.m); - - mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat; - - gGL.loadMatrix(mat.m); - glh_set_current_modelview(mat); - - glClearColor(0.0f,0.0f,0.0f,0.0f); - gGL.setColorMask(true, true); - - // get the number of pixels per angle - F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); - - //get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) - U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); - U32 resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512); - - if (!avatar->mImpostor.isComplete() || resX != avatar->mImpostor.getWidth() || - resY != avatar->mImpostor.getHeight()) { - static const LLCachedControl shadow_precision("DeferredHighPrecision",true); //TO-DO: Profile 16bit format later - avatar->mImpostor.allocate(resX,resY, (!LLPipeline::sRenderDeferred || shadow_precision) ? GL_RGBA : GL_RGBA16F_ARB,TRUE,FALSE); + const LLVector4a* ext = avatar->mDrawable->getSpatialExtents(); + LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); - if (LLPipeline::sRenderDeferred) + camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis()); + + LLVector4a half_height; + half_height.setSub(ext[1], ext[0]); + half_height.mul(0.5f); + + LLVector4a left; + left.load3(camera.getLeftAxis().mV); + left.mul(left); + left.normalize3fast(); + + LLVector4a up; + up.load3(camera.getUpAxis().mV); + up.mul(up); + up.normalize3fast(); + + tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); + tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); + + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + + F32 distance = (pos-camera.getOrigin()).length(); + F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; + F32 aspect = tdim.mV[0]/tdim.mV[1]; + glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); + glh_set_current_projection(persp); + gGL.loadMatrix(persp.m); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + glh::matrix4f mat; + camera.getOpenGLTransform(mat.m); + + mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat; + + gGL.loadMatrix(mat.m); + glh_set_current_modelview(mat); + + glClearColor(0.0f,0.0f,0.0f,0.0f); + gGL.setColorMask(true, true); + + // get the number of pixels per angle + F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); + + //get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) + resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); + resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512); + + if (!avatar->mImpostor.isComplete()) { - addDeferredAttachments(avatar->mImpostor); + avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE); + + if (LLPipeline::sRenderDeferred) + { + addDeferredAttachments(avatar->mImpostor); + } + + gGL.getTexUnit(0)->bind(&avatar->mImpostor); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + } + else if(resX != avatar->mImpostor.getWidth() || + resY != avatar->mImpostor.getHeight()) + { + avatar->mImpostor.resize(resX,resY,GL_RGBA); } - gGL.getTexUnit(0)->bind(&avatar->mImpostor); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + avatar->mImpostor.bindTarget(); } - avatar->mImpostor.bindTarget(); - if (LLPipeline::sRenderDeferred) { avatar->mImpostor.clear(); @@ -9593,22 +9636,22 @@ BOOL LLPipeline::hasRenderBatches(const U32 type) const return sCull->getRenderMapSize(type) > 0; } -LLCullResult::drawinfo_list_t::iterator LLPipeline::beginRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLPipeline::beginRenderMap(U32 type) { return sCull->beginRenderMap(type); } -LLCullResult::drawinfo_list_t::iterator LLPipeline::endRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLPipeline::endRenderMap(U32 type) { return sCull->endRenderMap(type); } -LLCullResult::sg_list_t::iterator LLPipeline::beginAlphaGroups() +LLCullResult::sg_iterator LLPipeline::beginAlphaGroups() { return sCull->beginAlphaGroups(); } -LLCullResult::sg_list_t::iterator LLPipeline::endAlphaGroups() +LLCullResult::sg_iterator LLPipeline::endAlphaGroups() { return sCull->endAlphaGroups(); } @@ -9733,3 +9776,9 @@ void LLPipeline::clearRenderTypeMask(U32 type, ...) } } +void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color) +{ + DebugBlip blip(position, color); + mDebugBlips.push_back(blip); +} + diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 4ad8a5e19..6dd80b5b1 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -296,10 +296,10 @@ public: void setLight(LLDrawable *drawablep, BOOL is_light); BOOL hasRenderBatches(const U32 type) const; - LLCullResult::drawinfo_list_t::iterator beginRenderMap(U32 type); - LLCullResult::drawinfo_list_t::iterator endRenderMap(U32 type); - LLCullResult::sg_list_t::iterator beginAlphaGroups(); - LLCullResult::sg_list_t::iterator endAlphaGroups(); + LLCullResult::drawinfo_iterator beginRenderMap(U32 type); + LLCullResult::drawinfo_iterator endRenderMap(U32 type); + LLCullResult::sg_iterator beginAlphaGroups(); + LLCullResult::sg_iterator endAlphaGroups(); void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES); @@ -366,6 +366,8 @@ public: static void throttleNewMemoryAllocation(BOOL disable); + void addDebugBlip(const LLVector3& position, const LLColor4& color); + private: void unloadShaders(); void addToQuickLookup( LLDrawPool* new_poolp ); @@ -719,6 +721,20 @@ public: protected: std::vector mSelectedFaces; + class DebugBlip + { + public: + LLColor4 mColor; + LLVector3 mPosition; + F32 mAge; + + DebugBlip(const LLVector3& position, const LLColor4& color) + : mColor(color), mPosition(position), mAge(0.f) + { } + }; + + std::list mDebugBlips; + LLPointer mFaceSelectImagep; U32 mLightMask; diff --git a/indra/newview/shfloatermediaticker.cpp b/indra/newview/shfloatermediaticker.cpp index f3e1849af..a2c995153 100644 --- a/indra/newview/shfloatermediaticker.cpp +++ b/indra/newview/shfloatermediaticker.cpp @@ -255,10 +255,6 @@ BOOL handle_ticker_enabled(void *) { return gAudiop && gAudiop->getStreamingAudioImpl() && gAudiop->getStreamingAudioImpl()->supportsMetaData(); } -BOOL handle_ticker_check(void *) -{ - return SHFloaterMediaTicker::instanceExists(); -} void handle_ticker_toggle(void *) { if(!handle_ticker_enabled(NULL)) diff --git a/indra/newview/shfloatermediaticker.h b/indra/newview/shfloatermediaticker.h index 3fa23bdda..4668f33bd 100644 --- a/indra/newview/shfloatermediaticker.h +++ b/indra/newview/shfloatermediaticker.h @@ -54,6 +54,5 @@ private: //Menu callbacks. BOOL handle_ticker_enabled(void *); -BOOL handle_ticker_check(void *); void handle_ticker_toggle(void *); diff --git a/indra/newview/skins/darkgred/colors.xml b/indra/newview/skins/darkgred/colors.xml index d7132d44d..22034c252 100644 --- a/indra/newview/skins/darkgred/colors.xml +++ b/indra/newview/skins/darkgred/colors.xml @@ -70,6 +70,7 @@ + diff --git a/indra/newview/skins/darkorange/colors.xml b/indra/newview/skins/darkorange/colors.xml index f3ff107f0..87e646e51 100644 --- a/indra/newview/skins/darkorange/colors.xml +++ b/indra/newview/skins/darkorange/colors.xml @@ -72,6 +72,7 @@ + diff --git a/indra/newview/skins/default/colors_base.xml b/indra/newview/skins/default/colors_base.xml index eafb95481..eaed66c4d 100644 --- a/indra/newview/skins/default/colors_base.xml +++ b/indra/newview/skins/default/colors_base.xml @@ -73,6 +73,7 @@ + @@ -149,6 +150,13 @@ + + + + + + + diff --git a/indra/newview/skins/default/xui/en-us/floater_about_land.xml b/indra/newview/skins/default/xui/en-us/floater_about_land.xml index 0cdb416c2..f40659986 100644 --- a/indra/newview/skins/default/xui/en-us/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en-us/floater_about_land.xml @@ -1345,6 +1345,11 @@ Select the thumbnail to choose a different texture. One or more of these options is set at the estate level + minutes + 1 minute + 1 second + seconds + remaining - - Filtering: - - Antialiasing: - - Disabled - 2x - 4x - 8x - 16x - - - (brightness, lower is brighter, 0=use default) - Enable VBO: - - - Enable Framebuffer Objects: - - - - - Note: the Gamma and Fog Distance Ratio settings are unavailable - (since useless) when the Atmospheric Shaders are enabled. - -