aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r--linden/indra/newview/llvoavatar.cpp186
1 files changed, 122 insertions, 64 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 6904bb2..27a848f 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -38,6 +38,7 @@
38#include <ctype.h> 38#include <ctype.h>
39 39
40#include "llaudioengine.h" 40#include "llaudioengine.h"
41#include "llavatarnamecache.h"
41#include "noise.h" 42#include "noise.h"
42 43
43#include "llagent.h" // Get state values from here 44#include "llagent.h" // Get state values from here
@@ -748,6 +749,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
748 mAppearanceAnimating(FALSE), 749 mAppearanceAnimating(FALSE),
749 mNameString(), 750 mNameString(),
750 mTitle(), 751 mTitle(),
752 mCompleteName(),
751 mNameAway(FALSE), 753 mNameAway(FALSE),
752 mNameBusy(FALSE), 754 mNameBusy(FALSE),
753 mNameMute(FALSE), 755 mNameMute(FALSE),
@@ -1474,6 +1476,7 @@ void LLVOAvatar::initClass()
1474 { 1476 {
1475 loadClientTags(); 1477 loadClientTags();
1476 } 1478 }
1479 initCloud();
1477} 1480}
1478 1481
1479 1482
@@ -1489,6 +1492,21 @@ void LLVOAvatar::cleanupClass()
1489 sXMLTree.cleanup(); 1492 sXMLTree.cleanup();
1490} 1493}
1491 1494
1495LLPartSysData LLVOAvatar::sCloud;
1496void LLVOAvatar::initCloud()
1497{
1498 // fancy particle cloud designed by Brent
1499
1500 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "cloud.xml");
1501 LLSD cloud;
1502 llifstream in_file(filename);
1503 LLSDSerialize::fromXMLDocument(cloud, in_file);
1504 sCloud.fromLLSD(cloud);
1505 LLViewerImage* cloud_image = gImageList.getImageFromFile("cloud-particle.j2c");
1506 sCloud.mPartImageID = cloud_image->getID();
1507
1508}
1509
1492const LLVector3 LLVOAvatar::getRenderPosition() const 1510const LLVector3 LLVOAvatar::getRenderPosition() const
1493{ 1511{
1494 if (mDrawable.isNull() || mDrawable->getGeneration() < 0) 1512 if (mDrawable.isNull() || mDrawable->getGeneration() < 0)
@@ -2872,7 +2890,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
2872 param; 2890 param;
2873 param = getNextVisualParam()) 2891 param = getNextVisualParam())
2874 { 2892 {
2875 if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) 2893 if (param->isTweakable())
2876 { 2894 {
2877 param->stopAnimating(mAppearanceAnimSetByUser); 2895 param->stopAnimating(mAppearanceAnimSetByUser);
2878 } 2896 }
@@ -2904,7 +2922,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
2904 param; 2922 param;
2905 param = getNextVisualParam()) 2923 param = getNextVisualParam())
2906 { 2924 {
2907 if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) 2925 if (param->isTweakable())
2908 { 2926 {
2909 // so boobs don't go spastic when a shape's changed, but still seems buggy 2927 // so boobs don't go spastic when a shape's changed, but still seems buggy
2910 //if(param->getID() != 507) 2928 //if(param->getID() != 507)
@@ -3070,34 +3088,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
3070 } 3088 }
3071 else 3089 else
3072 { 3090 {
3073 LLPartSysData particle_parameters; 3091 setParticleSource(sCloud, getID());
3074
3075 // fancy particle cloud designed by Brent
3076 particle_parameters.mPartData.mMaxAge = 4.f;
3077 particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
3078 particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
3079 particle_parameters.mPartData.mStartScale.mV[VY] = 1.0f;
3080 particle_parameters.mPartData.mEndScale.mV[VX] = 0.02f;
3081 particle_parameters.mPartData.mEndScale.mV[VY] = 0.02f;
3082 particle_parameters.mPartData.mStartColor = LLColor4(1, 1, 1, 0.5f);
3083 particle_parameters.mPartData.mEndColor = LLColor4(1, 1, 1, 0.0f);
3084 particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
3085 LLViewerImage* cloud = gImageList.getImageFromFile("cloud-particle.j2c");
3086 particle_parameters.mPartImageID = cloud->getID();
3087 particle_parameters.mMaxAge = 0.f;
3088 particle_parameters.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE;
3089 particle_parameters.mInnerAngle = 3.14159f;
3090 particle_parameters.mOuterAngle = 0.f;
3091 particle_parameters.mBurstRate = 0.02f;
3092 particle_parameters.mBurstRadius = 0.0f;
3093 particle_parameters.mBurstPartCount = 1;
3094 particle_parameters.mBurstSpeedMin = 0.1f;
3095 particle_parameters.mBurstSpeedMax = 1.f;
3096 particle_parameters.mPartData.mFlags = ( LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK |
3097 LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK |
3098 LLPartData::LL_PART_TARGET_POS_MASK );
3099
3100 setParticleSource(particle_parameters, getID());
3101 } 3092 }
3102 } 3093 }
3103} 3094}
@@ -3620,6 +3611,35 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3620 3611
3621 if (mNameText.notNull() && firstname && lastname) 3612 if (mNameText.notNull() && firstname && lastname)
3622 { 3613 {
3614 std::string complete_name = firstname->getString();
3615 if (sRenderGroupTitles)
3616 {
3617 complete_name += " ";
3618 }
3619 else
3620 {
3621 // If all group titles are turned off, stack first name
3622 // on a line above last name
3623 complete_name += "\n";
3624 }
3625 complete_name += lastname->getString();
3626
3627 if (LLAvatarNameCache::useDisplayNames())
3628 {
3629 LLAvatarName avatar_name;
3630 if (LLAvatarNameCache::get(getID(), &avatar_name))
3631 {
3632 if (LLAvatarNameCache::useDisplayNames() == 1)
3633 {
3634 complete_name = avatar_name.mDisplayName;
3635 }
3636 else
3637 {
3638 complete_name = avatar_name.getNames(true);
3639 }
3640 }
3641 }
3642
3623 BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); 3643 BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end();
3624 BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); 3644 BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end();
3625 BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); 3645 BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end();
@@ -3634,7 +3654,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3634 } 3654 }
3635 3655
3636 if (mNameString.empty() || 3656 if (mNameString.empty() ||
3637 new_name || 3657 new_name || complete_name != mCompleteName ||
3638 (!title && !mTitle.empty()) || 3658 (!title && !mTitle.empty()) ||
3639 (title && mTitle != title->getString()) || 3659 (title && mTitle != title->getString()) ||
3640 (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) 3660 (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute)
@@ -3650,20 +3670,19 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3650 line += title->getString(); 3670 line += title->getString();
3651 //LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); IMP-136 -- McCabe 3671 //LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); IMP-136 -- McCabe
3652 line += "\n"; 3672 line += "\n";
3653 line += firstname->getString(); 3673 line += complete_name;
3654 } 3674 }
3655 else 3675 else
3656 { 3676 {
3657 line += firstname->getString(); 3677 line += complete_name;
3658 } 3678 }
3659 3679
3660 line += " "; 3680
3661 line += lastname->getString();
3662// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b 3681// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b
3663 } 3682 }
3664 else 3683 else
3665 { 3684 {
3666 line = RlvStrings::getAnonym(line.assign(firstname->getString()).append(" ").append(lastname->getString())); 3685 line = RlvStrings::getAnonym(complete_name);
3667 } 3686 }
3668// [/RLVa:KB] 3687// [/RLVa:KB]
3669 3688
@@ -3673,7 +3692,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3673 bool show_client = client.length() != 0 && (*sShowClientNameTag); 3692 bool show_client = client.length() != 0 && (*sShowClientNameTag);
3674 if (is_away || is_muted || is_busy || show_client) 3693 if (is_away || is_muted || is_busy || show_client)
3675 { 3694 {
3676 line += " ("; 3695 line += "\n(";
3677 if (is_away) 3696 if (is_away)
3678 { 3697 {
3679 line += "Away"; 3698 line += "Away";
@@ -3718,6 +3737,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3718 mNameMute = is_muted; 3737 mNameMute = is_muted;
3719 mNameAppearance = is_appearance; 3738 mNameAppearance = is_appearance;
3720 mTitle = title ? title->getString() : ""; 3739 mTitle = title ? title->getString() : "";
3740 mCompleteName = complete_name;
3721 //LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); IMP-136 -- McCabe 3741 //LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); IMP-136 -- McCabe
3722 mNameString = utf8str_to_wstring(line); 3742 mNameString = utf8str_to_wstring(line);
3723 new_name = TRUE; 3743 new_name = TRUE;
@@ -3834,6 +3854,41 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3834 } 3854 }
3835} 3855}
3836 3856
3857void LLVOAvatar::clearNameTag()
3858{
3859 mNameString.clear();
3860 if (mNameText)
3861 {
3862 mNameText->setLabel("");
3863 mNameText->setString(mNameString);
3864 }
3865}
3866
3867//static
3868void LLVOAvatar::invalidateNameTag(const LLUUID& agent_id)
3869{
3870 LLViewerObject* obj = gObjectList.findObject(agent_id);
3871 if (!obj) return;
3872
3873 LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(obj);
3874 if (!avatar) return;
3875
3876 avatar->clearNameTag();
3877}
3878
3879//static
3880void LLVOAvatar::invalidateNameTags()
3881{
3882 std::vector<LLCharacter*>::iterator it;
3883 for (it = LLCharacter::sInstances.begin(); it != LLCharacter::sInstances.end(); ++it)
3884 {
3885 LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*it);
3886 if (!avatar) continue;
3887 if (avatar->isDead()) continue;
3888
3889 avatar->clearNameTag();
3890 }
3891}
3837 3892
3838void LLVOAvatar::idleUpdateTractorBeam() 3893void LLVOAvatar::idleUpdateTractorBeam()
3839{ 3894{
@@ -4820,6 +4875,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4820 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked 4875 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
4821 && !LLDrawPoolAvatar::sSkipTransparent; 4876 && !LLDrawPoolAvatar::sSkipTransparent;
4822 4877
4878
4823 LLGLState test(GL_ALPHA_TEST, should_alpha_mask); 4879 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4824 4880
4825 if (should_alpha_mask) 4881 if (should_alpha_mask)
@@ -4935,7 +4991,6 @@ U32 LLVOAvatar::renderRigid()
4935 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked 4991 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
4936 && !LLDrawPoolAvatar::sSkipTransparent; 4992 && !LLDrawPoolAvatar::sSkipTransparent;
4937 4993
4938
4939 LLGLState test(GL_ALPHA_TEST, should_alpha_mask); 4994 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4940 4995
4941 if (should_alpha_mask) 4996 if (should_alpha_mask)
@@ -5918,6 +5973,7 @@ BOOL LLVOAvatar::loadAvatar()
5918 if (sAvatarXmlInfo->mLayerInfoList.empty()) 5973 if (sAvatarXmlInfo->mLayerInfoList.empty())
5919 { 5974 {
5920 llwarns << "avatar file: missing <layer_set> node" << llendl; 5975 llwarns << "avatar file: missing <layer_set> node" << llendl;
5976 return FALSE;
5921 } 5977 }
5922 else 5978 else
5923 { 5979 {
@@ -5958,23 +6014,22 @@ BOOL LLVOAvatar::loadAvatar()
5958 } 6014 }
5959 6015
5960 // avatar_lad.xml : <driver_parameters> 6016 // avatar_lad.xml : <driver_parameters>
6017 LLVOAvatarXmlInfo::driver_info_list_t::iterator iter;
6018 for (iter = sAvatarXmlInfo->mDriverInfoList.begin();
6019 iter != sAvatarXmlInfo->mDriverInfoList.end(); iter++)
5961 { 6020 {
5962 LLVOAvatarXmlInfo::driver_info_list_t::iterator iter; 6021 LLDriverParamInfo *info = *iter;
5963 for (iter = sAvatarXmlInfo->mDriverInfoList.begin(); 6022 LLDriverParam* driver_param = new LLDriverParam( this );
5964 iter != sAvatarXmlInfo->mDriverInfoList.end(); iter++) 6023 if (driver_param->setInfo(info))
5965 { 6024 {
5966 LLDriverParamInfo *info = *iter; 6025 addVisualParam( driver_param );
5967 LLDriverParam* driver_param = new LLDriverParam( this ); 6026 }
5968 if (driver_param->setInfo(info)) 6027 else
5969 { 6028 {
5970 addVisualParam( driver_param ); 6029 delete driver_param;
5971 } 6030 llwarns << "avatar file: driver_param->parseData() failed" << llendl;
5972 else 6031 return FALSE;
5973 { 6032
5974 delete driver_param;
5975 llwarns << "avatar file: driver_param->parseData() failed" << llendl;
5976 return FALSE;
5977 }
5978 } 6033 }
5979 } 6034 }
5980 6035
@@ -8147,6 +8202,14 @@ BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] )
8147 param_name[2] = "skirt_blue"; 8202 param_name[2] = "skirt_blue";
8148 break; 8203 break;
8149 8204
8205 case TEX_HEAD_TATTOO:
8206 case TEX_LOWER_TATTOO:
8207 case TEX_UPPER_TATTOO:
8208 param_name[0] = "tattoo_red";
8209 param_name[1] = "tattoo_green";
8210 param_name[2] = "tattoo_blue";
8211 break;
8212
8150 default: 8213 default:
8151 llassert(0); 8214 llassert(0);
8152 return FALSE; 8215 return FALSE;
@@ -8606,7 +8669,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8606 { 8669 {
8607 for( S32 i = 0; i < num_blocks; i++ ) 8670 for( S32 i = 0; i < num_blocks; i++ )
8608 { 8671 {
8609 while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) 8672 while( param && (!param->isTweakable()) )
8610 { 8673 {
8611 param = getNextVisualParam(); 8674 param = getNextVisualParam();
8612 } 8675 }
@@ -8614,7 +8677,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8614 if( !param ) 8677 if( !param )
8615 { 8678 {
8616 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl; 8679 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl;
8617 return; 8680 break;
8618 } 8681 }
8619 8682
8620 U8 value; 8683 U8 value;
@@ -8655,14 +8718,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8655 } 8718 }
8656 } 8719 }
8657 8720
8658 while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) 8721 S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
8722 if (num_blocks != expected_tweakable_count)
8659 { 8723 {
8660 param = getNextVisualParam(); 8724 llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. Object: " << getID() << llendl;
8661 }
8662 if( param )
8663 {
8664 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl;
8665 return;
8666 } 8725 }
8667 8726
8668 if (params_changed) 8727 if (params_changed)
@@ -8933,8 +8992,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
8933 for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) 8992 for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
8934 { 8993 {
8935 LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; 8994 LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
8936 if( (viewer_param->getWearableType() == type) && 8995 if (viewer_param->getWearableType() == type && viewer_param->isTweakable())
8937 (viewer_param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) )
8938 { 8996 {
8939 apr_file_printf( file, "\t\t<param id=\"%d\" name=\"%s\" value=\"%.3f\"/>\n", 8997 apr_file_printf( file, "\t\t<param id=\"%d\" name=\"%s\" value=\"%.3f\"/>\n",
8940 viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight() ); 8998 viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight() );