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 de6b22d..e1fa61f 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}
@@ -3633,6 +3624,35 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3633 3624
3634 if (mNameText.notNull() && firstname && lastname) 3625 if (mNameText.notNull() && firstname && lastname)
3635 { 3626 {
3627 std::string complete_name = firstname->getString();
3628 if (sRenderGroupTitles)
3629 {
3630 complete_name += " ";
3631 }
3632 else
3633 {
3634 // If all group titles are turned off, stack first name
3635 // on a line above last name
3636 complete_name += "\n";
3637 }
3638 complete_name += lastname->getString();
3639
3640 if (LLAvatarNameCache::useDisplayNames())
3641 {
3642 LLAvatarName avatar_name;
3643 if (LLAvatarNameCache::get(getID(), &avatar_name))
3644 {
3645 if (LLAvatarNameCache::useDisplayNames() == 1)
3646 {
3647 complete_name = avatar_name.mDisplayName;
3648 }
3649 else
3650 {
3651 complete_name = avatar_name.getNames(true);
3652 }
3653 }
3654 }
3655
3636 BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); 3656 BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end();
3637 BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); 3657 BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end();
3638 BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); 3658 BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end();
@@ -3647,7 +3667,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3647 } 3667 }
3648 3668
3649 if (mNameString.empty() || 3669 if (mNameString.empty() ||
3650 new_name || 3670 new_name || complete_name != mCompleteName ||
3651 (!title && !mTitle.empty()) || 3671 (!title && !mTitle.empty()) ||
3652 (title && mTitle != title->getString()) || 3672 (title && mTitle != title->getString()) ||
3653 (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) 3673 (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute)
@@ -3663,20 +3683,19 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3663 line += title->getString(); 3683 line += title->getString();
3664 //LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); IMP-136 -- McCabe 3684 //LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); IMP-136 -- McCabe
3665 line += "\n"; 3685 line += "\n";
3666 line += firstname->getString(); 3686 line += complete_name;
3667 } 3687 }
3668 else 3688 else
3669 { 3689 {
3670 line += firstname->getString(); 3690 line += complete_name;
3671 } 3691 }
3672 3692
3673 line += " "; 3693
3674 line += lastname->getString();
3675// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b 3694// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b
3676 } 3695 }
3677 else 3696 else
3678 { 3697 {
3679 line = RlvStrings::getAnonym(line.assign(firstname->getString()).append(" ").append(lastname->getString())); 3698 line = RlvStrings::getAnonym(complete_name);
3680 } 3699 }
3681// [/RLVa:KB] 3700// [/RLVa:KB]
3682 3701
@@ -3686,7 +3705,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3686 bool show_client = client.length() != 0 && (*sShowClientNameTag); 3705 bool show_client = client.length() != 0 && (*sShowClientNameTag);
3687 if (is_away || is_muted || is_busy || show_client) 3706 if (is_away || is_muted || is_busy || show_client)
3688 { 3707 {
3689 line += " ("; 3708 line += "\n(";
3690 if (is_away) 3709 if (is_away)
3691 { 3710 {
3692 line += "Away"; 3711 line += "Away";
@@ -3731,6 +3750,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3731 mNameMute = is_muted; 3750 mNameMute = is_muted;
3732 mNameAppearance = is_appearance; 3751 mNameAppearance = is_appearance;
3733 mTitle = title ? title->getString() : ""; 3752 mTitle = title ? title->getString() : "";
3753 mCompleteName = complete_name;
3734 //LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); IMP-136 -- McCabe 3754 //LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); IMP-136 -- McCabe
3735 mNameString = utf8str_to_wstring(line); 3755 mNameString = utf8str_to_wstring(line);
3736 new_name = TRUE; 3756 new_name = TRUE;
@@ -3847,6 +3867,41 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3847 } 3867 }
3848} 3868}
3849 3869
3870void LLVOAvatar::clearNameTag()
3871{
3872 mNameString.clear();
3873 if (mNameText)
3874 {
3875 mNameText->setLabel("");
3876 mNameText->setString(mNameString);
3877 }
3878}
3879
3880//static
3881void LLVOAvatar::invalidateNameTag(const LLUUID& agent_id)
3882{
3883 LLViewerObject* obj = gObjectList.findObject(agent_id);
3884 if (!obj) return;
3885
3886 LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(obj);
3887 if (!avatar) return;
3888
3889 avatar->clearNameTag();
3890}
3891
3892//static
3893void LLVOAvatar::invalidateNameTags()
3894{
3895 std::vector<LLCharacter*>::iterator it;
3896 for (it = LLCharacter::sInstances.begin(); it != LLCharacter::sInstances.end(); ++it)
3897 {
3898 LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*it);
3899 if (!avatar) continue;
3900 if (avatar->isDead()) continue;
3901
3902 avatar->clearNameTag();
3903 }
3904}
3850 3905
3851void LLVOAvatar::idleUpdateTractorBeam() 3906void LLVOAvatar::idleUpdateTractorBeam()
3852{ 3907{
@@ -4833,6 +4888,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4833 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked 4888 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
4834 && !LLDrawPoolAvatar::sSkipTransparent; 4889 && !LLDrawPoolAvatar::sSkipTransparent;
4835 4890
4891
4836 LLGLState test(GL_ALPHA_TEST, should_alpha_mask); 4892 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4837 4893
4838 if (should_alpha_mask) 4894 if (should_alpha_mask)
@@ -4948,7 +5004,6 @@ U32 LLVOAvatar::renderRigid()
4948 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked 5004 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
4949 && !LLDrawPoolAvatar::sSkipTransparent; 5005 && !LLDrawPoolAvatar::sSkipTransparent;
4950 5006
4951
4952 LLGLState test(GL_ALPHA_TEST, should_alpha_mask); 5007 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4953 5008
4954 if (should_alpha_mask) 5009 if (should_alpha_mask)
@@ -5931,6 +5986,7 @@ BOOL LLVOAvatar::loadAvatar()
5931 if (sAvatarXmlInfo->mLayerInfoList.empty()) 5986 if (sAvatarXmlInfo->mLayerInfoList.empty())
5932 { 5987 {
5933 llwarns << "avatar file: missing <layer_set> node" << llendl; 5988 llwarns << "avatar file: missing <layer_set> node" << llendl;
5989 return FALSE;
5934 } 5990 }
5935 else 5991 else
5936 { 5992 {
@@ -5971,23 +6027,22 @@ BOOL LLVOAvatar::loadAvatar()
5971 } 6027 }
5972 6028
5973 // avatar_lad.xml : <driver_parameters> 6029 // avatar_lad.xml : <driver_parameters>
6030 LLVOAvatarXmlInfo::driver_info_list_t::iterator iter;
6031 for (iter = sAvatarXmlInfo->mDriverInfoList.begin();
6032 iter != sAvatarXmlInfo->mDriverInfoList.end(); iter++)
5974 { 6033 {
5975 LLVOAvatarXmlInfo::driver_info_list_t::iterator iter; 6034 LLDriverParamInfo *info = *iter;
5976 for (iter = sAvatarXmlInfo->mDriverInfoList.begin(); 6035 LLDriverParam* driver_param = new LLDriverParam( this );
5977 iter != sAvatarXmlInfo->mDriverInfoList.end(); iter++) 6036 if (driver_param->setInfo(info))
5978 { 6037 {
5979 LLDriverParamInfo *info = *iter; 6038 addVisualParam( driver_param );
5980 LLDriverParam* driver_param = new LLDriverParam( this ); 6039 }
5981 if (driver_param->setInfo(info)) 6040 else
5982 { 6041 {
5983 addVisualParam( driver_param ); 6042 delete driver_param;
5984 } 6043 llwarns << "avatar file: driver_param->parseData() failed" << llendl;
5985 else 6044 return FALSE;
5986 { 6045
5987 delete driver_param;
5988 llwarns << "avatar file: driver_param->parseData() failed" << llendl;
5989 return FALSE;
5990 }
5991 } 6046 }
5992 } 6047 }
5993 6048
@@ -8160,6 +8215,14 @@ BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] )
8160 param_name[2] = "skirt_blue"; 8215 param_name[2] = "skirt_blue";
8161 break; 8216 break;
8162 8217
8218 case TEX_HEAD_TATTOO:
8219 case TEX_LOWER_TATTOO:
8220 case TEX_UPPER_TATTOO:
8221 param_name[0] = "tattoo_red";
8222 param_name[1] = "tattoo_green";
8223 param_name[2] = "tattoo_blue";
8224 break;
8225
8163 default: 8226 default:
8164 llassert(0); 8227 llassert(0);
8165 return FALSE; 8228 return FALSE;
@@ -8619,7 +8682,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8619 { 8682 {
8620 for( S32 i = 0; i < num_blocks; i++ ) 8683 for( S32 i = 0; i < num_blocks; i++ )
8621 { 8684 {
8622 while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) 8685 while( param && (!param->isTweakable()) )
8623 { 8686 {
8624 param = getNextVisualParam(); 8687 param = getNextVisualParam();
8625 } 8688 }
@@ -8627,7 +8690,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8627 if( !param ) 8690 if( !param )
8628 { 8691 {
8629 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl; 8692 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl;
8630 return; 8693 break;
8631 } 8694 }
8632 8695
8633 U8 value; 8696 U8 value;
@@ -8668,14 +8731,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8668 } 8731 }
8669 } 8732 }
8670 8733
8671 while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) 8734 S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
8735 if (num_blocks != expected_tweakable_count)
8672 { 8736 {
8673 param = getNextVisualParam(); 8737 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;
8674 }
8675 if( param )
8676 {
8677 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl;
8678 return;
8679 } 8738 }
8680 8739
8681 if (params_changed) 8740 if (params_changed)
@@ -8946,8 +9005,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
8946 for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) 9005 for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
8947 { 9006 {
8948 LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; 9007 LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
8949 if( (viewer_param->getWearableType() == type) && 9008 if (viewer_param->getWearableType() == type && viewer_param->isTweakable())
8950 (viewer_param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) )
8951 { 9009 {
8952 apr_file_printf( file, "\t\t<param id=\"%d\" name=\"%s\" value=\"%.3f\"/>\n", 9010 apr_file_printf( file, "\t\t<param id=\"%d\" name=\"%s\" value=\"%.3f\"/>\n",
8953 viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight() ); 9011 viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight() );