diff options
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 262 |
1 files changed, 259 insertions, 3 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index 7e1c6ca..5f63443 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -83,6 +83,8 @@ | |||
83 | #include "llvoiceclient.h" | 83 | #include "llvoiceclient.h" |
84 | #include "llvoicevisualizer.h" // Ventrella | 84 | #include "llvoicevisualizer.h" // Ventrella |
85 | 85 | ||
86 | #include "llsdserialize.h" // client resolver | ||
87 | |||
86 | #if LL_WINDOWS | 88 | #if LL_WINDOWS |
87 | // Disable warning for unreachable code in boost/lexical_cast.hpp for Boost 1.36 -- McCabe | 89 | // Disable warning for unreachable code in boost/lexical_cast.hpp for Boost 1.36 -- McCabe |
88 | #pragma warning(disable : 4702) | 90 | #pragma warning(disable : 4702) |
@@ -678,6 +680,7 @@ S32 LLVOAvatar::sScratchTexBytes = 0; | |||
678 | F32 LLVOAvatar::sRenderDistance = 256.f; | 680 | F32 LLVOAvatar::sRenderDistance = 256.f; |
679 | S32 LLVOAvatar::sNumVisibleAvatars = 0; | 681 | S32 LLVOAvatar::sNumVisibleAvatars = 0; |
680 | S32 LLVOAvatar::sNumLODChangesThisFrame = 0; | 682 | S32 LLVOAvatar::sNumLODChangesThisFrame = 0; |
683 | LLSD LLVOAvatar::sClientResolutionList; | ||
681 | 684 | ||
682 | const LLUUID LLVOAvatar::sStepSoundOnLand = LLUUID("e8af4a28-aa83-4310-a7c4-c047e15ea0df"); | 685 | const LLUUID LLVOAvatar::sStepSoundOnLand = LLUUID("e8af4a28-aa83-4310-a7c4-c047e15ea0df"); |
683 | const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] = | 686 | const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] = |
@@ -1402,6 +1405,9 @@ void LLVOAvatar::initClass() | |||
1402 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; | 1405 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; |
1403 | } | 1406 | } |
1404 | 1407 | ||
1408 | { | ||
1409 | loadClientTags(); | ||
1410 | } | ||
1405 | } | 1411 | } |
1406 | 1412 | ||
1407 | 1413 | ||
@@ -2971,6 +2977,239 @@ void LLVOAvatar::idleUpdateWindEffect() | |||
2971 | } | 2977 | } |
2972 | } | 2978 | } |
2973 | } | 2979 | } |
2980 | bool LLVOAvatar::updateClientTags() | ||
2981 | { | ||
2982 | std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_list.xml"); | ||
2983 | //Imprudence FIXME: provide own ressource | ||
2984 | LLSD response = LLHTTPClient::blockingGet("http://www.modularsystems.sl/app/client_tags/client_list.xml"); | ||
2985 | if(response.has("body")) | ||
2986 | { | ||
2987 | const LLSD &client_list = response["body"]; | ||
2988 | |||
2989 | if(client_list.has("isComplete")) | ||
2990 | { | ||
2991 | llofstream export_file; | ||
2992 | export_file.open(client_list_filename); | ||
2993 | LLSDSerialize::toPrettyXML(client_list, export_file); | ||
2994 | export_file.close(); | ||
2995 | return true; | ||
2996 | } | ||
2997 | } | ||
2998 | return false; | ||
2999 | } | ||
3000 | |||
3001 | bool LLVOAvatar::loadClientTags() | ||
3002 | { | ||
3003 | std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_list.xml"); | ||
3004 | |||
3005 | if(!LLFile::isfile(client_list_filename)) | ||
3006 | { | ||
3007 | client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "client_list.xml"); | ||
3008 | } | ||
3009 | |||
3010 | if(LLFile::isfile(client_list_filename)) | ||
3011 | { | ||
3012 | LLSD client_list; | ||
3013 | |||
3014 | llifstream importer(client_list_filename); | ||
3015 | LLSDSerialize::fromXMLDocument(client_list, importer); | ||
3016 | if(client_list.has("isComplete")) | ||
3017 | { | ||
3018 | sClientResolutionList = client_list; | ||
3019 | }else | ||
3020 | { | ||
3021 | return false; | ||
3022 | } | ||
3023 | }else | ||
3024 | { | ||
3025 | return false; | ||
3026 | } | ||
3027 | |||
3028 | for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); | ||
3029 | iter != LLCharacter::sInstances.end(); ++iter) | ||
3030 | { | ||
3031 | LLVOAvatar* avatarp = (LLVOAvatar*) *iter; | ||
3032 | if(avatarp) | ||
3033 | { | ||
3034 | LLVector3 root_pos_last = avatarp->mRoot.getWorldPosition(); | ||
3035 | avatarp->idleUpdateNameTag(root_pos_last); | ||
3036 | } | ||
3037 | } | ||
3038 | return true; | ||
3039 | } | ||
3040 | |||
3041 | void LLVOAvatar::resolveClient(LLColor4& avatar_name_color, std::string& client, LLVOAvatar* avatar) | ||
3042 | { | ||
3043 | LLUUID idx = avatar->getTE(0)->getID(); | ||
3044 | if(LLVOAvatar::sClientResolutionList.has("isComplete") | ||
3045 | && LLVOAvatar::sClientResolutionList.has(idx.asString())) | ||
3046 | { | ||
3047 | LLSD cllsd = LLVOAvatar::sClientResolutionList[idx.asString()]; | ||
3048 | client = cllsd["name"].asString(); | ||
3049 | LLColor4 colour; | ||
3050 | colour.setValue(cllsd["color"]); | ||
3051 | avatar_name_color += colour; | ||
3052 | avatar_name_color *= 1.0/(cllsd["multiple"].asReal()+1.0f); | ||
3053 | } | ||
3054 | else | ||
3055 | { | ||
3056 | /* | ||
3057 | //Imprudence FIXME: we need a inworld UUID for that | ||
3058 | //and it needs also to be at llprimitive/llprimitive.cpp (find "Imprudence FIXME" there) | ||
3059 | |||
3060 | if(idx == LLUUID("")) | ||
3061 | { | ||
3062 | avatar_name_color += LLColor4(0.6f,0.8f,1.0f);//Imprudence | ||
3063 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3064 | client = "Imprudence"; | ||
3065 | |||
3066 | } else | ||
3067 | */ | ||
3068 | if(idx == LLUUID("2a9a406c-f448-68f2-4e38-878f8c46c190")) | ||
3069 | { | ||
3070 | avatar_name_color += LLColor4(1.0f,0.9f,0.7f);//Meerkat | ||
3071 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3072 | client = "Meerkat"; | ||
3073 | }else if(idx == LLUUID("ccda2b3b-e72c-a112-e126-fee238b67218")) | ||
3074 | { | ||
3075 | avatar_name_color += LLColor4::green;//emerald | ||
3076 | avatar_name_color += LLColor4::green; | ||
3077 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3078 | client = "Emerald"; | ||
3079 | }else if(idx == LLUUID("c252d89d-6f7c-7d90-f430-d140d2e3fbbe")) | ||
3080 | { | ||
3081 | avatar_name_color += LLColor4::red;//vlife jcool410 | ||
3082 | avatar_name_color = avatar_name_color * 0.5; | ||
3083 | client = "VLife"; | ||
3084 | }else if(idx == LLUUID("adcbe893-7643-fd12-f61c-0b39717e2e32")) | ||
3085 | { | ||
3086 | avatar_name_color += LLColor4::pink;//tyk3n | ||
3087 | avatar_name_color = avatar_name_color * 0.5; | ||
3088 | client = "tyk3n"; | ||
3089 | }else if(idx == LLUUID("f3fd74a6-fee7-4b2f-93ae-ddcb5991da04") || idx == LLUUID("77662f23-c77a-9b4d-5558-26b757b2144c")) | ||
3090 | { | ||
3091 | avatar_name_color += (LLColor4::purple);//psl | ||
3092 | avatar_name_color = avatar_name_color * 0.5; | ||
3093 | client = "PSL"; | ||
3094 | }else if(idx == LLUUID("5aa5c70d-d787-571b-0495-4fc1bdef1500")) | ||
3095 | { | ||
3096 | avatar_name_color += LLColor4::red;//lordgreg | ||
3097 | avatar_name_color += LLColor4::red; | ||
3098 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3099 | client = "LGG proxy"; | ||
3100 | }else if(idx == LLUUID("8183e823-c443-2142-6eb6-2ab763d4f81c")) | ||
3101 | { | ||
3102 | avatar_name_color += LLColor4::blue;//day oh | ||
3103 | avatar_name_color = avatar_name_color * 0.5; | ||
3104 | client = "Day Oh proxy"; | ||
3105 | }else if(idx == LLUUID("e52d21f7-3c8b-819f-a3db-65c432295dac") || idx == LLUUID("0f6723d2-5b23-6b58-08ab-308112b33786")) | ||
3106 | { | ||
3107 | avatar_name_color += LLColor4::cyan;//cryolife | ||
3108 | avatar_name_color += LLColor4::cyan; | ||
3109 | avatar_name_color = avatar_name_color * 0.5; | ||
3110 | client = "CryoLife"; | ||
3111 | }else if(idx == LLUUID("0bcd5f5d-a4ce-9ea4-f9e8-15132653b3d8")) | ||
3112 | { | ||
3113 | avatar_name_color += LLColor4::pink;//moy | ||
3114 | avatar_name_color += LLColor4::pink;//moy | ||
3115 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3116 | client = "MoyMix"; | ||
3117 | }else if(idx == LLUUID("f5a48821-9a98-d09e-8d6a-50cc08ba9a47")) | ||
3118 | { | ||
3119 | avatar_name_color += LLColor4::yellow;//neil | ||
3120 | avatar_name_color += LLColor4::yellow;//neil | ||
3121 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3122 | client = "NeilLife"; | ||
3123 | }else if(idx == LLUUID("2c9c1e0b-e5d1-263e-16b1-7fc6d169f3d6")) | ||
3124 | { | ||
3125 | avatar_name_color += LLColor4(0.0f,1.0f,1.0f); | ||
3126 | avatar_name_color = avatar_name_color * 0.5;//phox | ||
3127 | client = "PhoxSL"; | ||
3128 | }else if(idx == LLUUID("c5b570ca-bb7e-3c81-afd1-f62646b20014") || idx == LLUUID("7c4d47a3-0c51-04d1-fa47-e4f3ac12f59b")) | ||
3129 | { | ||
3130 | avatar_name_color += LLColor4::white; | ||
3131 | avatar_name_color += LLColor4::white; | ||
3132 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3133 | client = "Kung Fu"; | ||
3134 | }else if(idx == LLUUID("9422e9d7-7b11-83e4-6262-4a8db4716a3b")) | ||
3135 | { | ||
3136 | avatar_name_color += LLColor4::magenta; | ||
3137 | avatar_name_color += LLColor4::magenta; | ||
3138 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3139 | client = "BetaLife"; | ||
3140 | }else if(idx == LLUUID("872c0005-3095-0967-866d-11cd71115c22")) | ||
3141 | { | ||
3142 | avatar_name_color += LLColor4::green;//SimFed Poland | ||
3143 | avatar_name_color += LLColor4::blue;//SimFed Poland | ||
3144 | avatar_name_color += LLColor4::blue;//SimFed Poland | ||
3145 | avatar_name_color = avatar_name_color * 0.5; | ||
3146 | client = "<-- Fag"; | ||
3147 | |||
3148 | //Imprudence FIXME: Cigarette? Homophobic? My lack of humor? | ||
3149 | |||
3150 | }else if(idx == LLUUID("3ab7e2fa-9572-ef36-1a30-d855dbea4f92") || //wat | ||
3151 | idx == LLUUID("11ad2452-ce54-8d65-7c23-05589b59f516") ||//wat. | ||
3152 | idx == LLUUID("e734563e-1c31-2a35-3ed5-8552c807439f") ||//wat. | ||
3153 | idx == LLUUID("58a8b7ec-1455-7162-5d96-d3c3ead2ed71") ||//wat | ||
3154 | idx == LLUUID("841ef25b-3b90-caf9-ea3d-5649e755db65")//wat -.- | ||
3155 | ) | ||
3156 | { | ||
3157 | avatar_name_color += LLColor4(0.0f,0.5f,1.0f); | ||
3158 | avatar_name_color = avatar_name_color * 0.5; | ||
3159 | client = "VerticalLife"; | ||
3160 | |||
3161 | |||
3162 | }else if(idx == LLUUID("4e8dcf80-336b-b1d8-ef3e-08dacf015a0f")) | ||
3163 | { | ||
3164 | avatar_name_color += LLColor4::blue; //Sapphire | ||
3165 | avatar_name_color += LLColor4::blue; //Sapphire | ||
3166 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3167 | client = "Sapphire"; | ||
3168 | }else if(idx == LLUUID("ffce04ff-5303-4909-a044-d37af7ab0b0e")) | ||
3169 | { | ||
3170 | avatar_name_color += LLColor4::orange; //corgiVision | ||
3171 | avatar_name_color = avatar_name_color * (F32)0.75; | ||
3172 | client = "Corgi"; | ||
3173 | }else if(idx == LLUUID("ccb509cf-cc69-e569-38f1-5086c687afd1")) | ||
3174 | { | ||
3175 | avatar_name_color += LLColor4::red; //Ruby | ||
3176 | avatar_name_color += LLColor4::purple; //Ruby | ||
3177 | avatar_name_color = avatar_name_color * (F32)0.333333333333; | ||
3178 | client = "Ruby"; | ||
3179 | }else if(idx == LLUUID("1c29480c-c608-df87-28bb-964fb64c5366")) | ||
3180 | { | ||
3181 | avatar_name_color += LLColor4::yellow9; | ||
3182 | avatar_name_color += LLColor4::yellow9; | ||
3183 | avatar_name_color *= (F32)0.333333333333; | ||
3184 | client = "Gemini"; | ||
3185 | } | ||
3186 | } | ||
3187 | if(client.empty()) | ||
3188 | { | ||
3189 | LLPointer<LLViewerImage> image_point = gImageList.getImage(idx, MIPMAP_YES, IMMEDIATE_NO); | ||
3190 | if(image_point.notNull() && image_point->isMissingAsset()) | ||
3191 | { | ||
3192 | avatar_name_color += LLColor4::grey;//anomalous | ||
3193 | avatar_name_color = avatar_name_color * 0.5; | ||
3194 | client = "Invalid"; | ||
3195 | } | ||
3196 | } | ||
3197 | if(avatar->getTE(5)->getID() != avatar->getTE(6)->getID() && !client.empty()) | ||
3198 | { | ||
3199 | client = "Failure"; | ||
3200 | avatar_name_color = LLColor4::grey; | ||
3201 | } | ||
3202 | if(client.empty() && LLVOAvatar::sClientResolutionList.has("default")) | ||
3203 | { | ||
3204 | LLSD cllsd = LLVOAvatar::sClientResolutionList["default"]; | ||
3205 | client = cllsd["name"].asString(); | ||
3206 | LLColor4 colour; | ||
3207 | colour.setValue(cllsd["color"]); | ||
3208 | avatar_name_color += colour; | ||
3209 | avatar_name_color *= 1.0/(cllsd["multiple"].asReal()+1.0f); | ||
3210 | } | ||
3211 | |||
3212 | } | ||
2974 | 3213 | ||
2975 | void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | 3214 | void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) |
2976 | { | 3215 | { |
@@ -3032,7 +3271,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3032 | mRenderGroupTitles = sRenderGroupTitles; | 3271 | mRenderGroupTitles = sRenderGroupTitles; |
3033 | new_name = TRUE; | 3272 | new_name = TRUE; |
3034 | } | 3273 | } |
3035 | 3274 | std::string client; | |
3036 | // First Calculate Alpha | 3275 | // First Calculate Alpha |
3037 | // If alpha > 0, create mNameText if necessary, otherwise delete it | 3276 | // If alpha > 0, create mNameText if necessary, otherwise delete it |
3038 | { | 3277 | { |
@@ -3073,6 +3312,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3073 | } | 3312 | } |
3074 | 3313 | ||
3075 | LLColor4 avatar_name_color = gColors.getColor( "AvatarNameColor" ); | 3314 | LLColor4 avatar_name_color = gColors.getColor( "AvatarNameColor" ); |
3315 | if(!mIsSelf) //don't know your own client ? | ||
3316 | { | ||
3317 | new_name = TRUE; //lol or see the last client used | ||
3318 | resolveClient(avatar_name_color,client, this); | ||
3319 | } | ||
3076 | avatar_name_color.setAlpha(alpha); | 3320 | avatar_name_color.setAlpha(alpha); |
3077 | mNameText->setColor(avatar_name_color); | 3321 | mNameText->setColor(avatar_name_color); |
3078 | 3322 | ||
@@ -3129,7 +3373,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3129 | (!title && !mTitle.empty()) || | 3373 | (!title && !mTitle.empty()) || |
3130 | (title && mTitle != title->getString()) || | 3374 | (title && mTitle != title->getString()) || |
3131 | (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) | 3375 | (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) |
3132 | || is_appearance != mNameAppearance) | 3376 | || is_appearance != mNameAppearance || client.length() != 0) |
3133 | { | 3377 | { |
3134 | std::string line; | 3378 | std::string line; |
3135 | 3379 | ||
@@ -3158,7 +3402,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3158 | 3402 | ||
3159 | BOOL need_comma = FALSE; | 3403 | BOOL need_comma = FALSE; |
3160 | 3404 | ||
3161 | if (is_away || is_muted || is_busy) | 3405 | bool show_client = client.length() != 0 && gSavedSettings.getBOOL("ShowClientNameTag"); |
3406 | if (is_away || is_muted || is_busy || show_client) | ||
3162 | { | 3407 | { |
3163 | line += " ("; | 3408 | line += " ("; |
3164 | if (is_away) | 3409 | if (is_away) |
@@ -3184,6 +3429,15 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3184 | line += "Muted"; | 3429 | line += "Muted"; |
3185 | need_comma = TRUE; | 3430 | need_comma = TRUE; |
3186 | } | 3431 | } |
3432 | if (show_client) | ||
3433 | { | ||
3434 | if (need_comma) | ||
3435 | { | ||
3436 | line += ", "; | ||
3437 | } | ||
3438 | line += client; | ||
3439 | need_comma = TRUE; | ||
3440 | } | ||
3187 | line += ")"; | 3441 | line += ")"; |
3188 | } | 3442 | } |
3189 | if (is_appearance) | 3443 | if (is_appearance) |
@@ -7438,6 +7692,8 @@ void LLVOAvatar::releaseUnnecessaryTextures() | |||
7438 | { | 7692 | { |
7439 | const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); | 7693 | const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); |
7440 | // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID | 7694 | // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID |
7695 | if(baked_index == BAKED_HEAD)//for client detection | ||
7696 | continue; | ||
7441 | if (!isTextureDefined(bakedDicEntry->mTextureIndex) | 7697 | if (!isTextureDefined(bakedDicEntry->mTextureIndex) |
7442 | && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) )) | 7698 | && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) )) |
7443 | { | 7699 | { |