// Avatar parameter and texture definitions can change over time. // * If parameters or textures have been REMOVED since the wearable was created, // they're just ignored, so we consider the wearable clean even though isOldVersion() // will return true. // * If parameters or textures have been ADDED since the wearable was created, // they are taken to have default values, so we consider the wearable clean // only if those values are the same as the defaults. BOOL LLWearable::isDirty() { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { return FALSE; } for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); param; param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) { if (param->getWearableType() == mType && param->isTweakable()) { F32 weight = get_if_there(mVisualParamMap, param->getID(), param->getDefaultWeight()); weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() ); U8 b = F32_to_U8( weight, param->getMinWeight(), param->getMaxWeight() ); if( a != b ) { return TRUE; } } } for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) { LLViewerImage* avatar_image = avatar->getTEImage( te ); if( !avatar_image ) { llassert( 0 ); continue; } const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); if( avatar_image->getID() != image_id ) { return TRUE; } } } //if( gFloaterCustomize ) //{ // if( mDescription != gFloaterCustomize->getWearableDescription( mType ) ) // { // return TRUE; // } //} return FALSE; }
// Updates asset from the user's avatar void LLWearable::readFromAvatar() { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { return; } mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; mVisualParamMap.clear(); for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) { if (((LLViewerVisualParam*)param)->getWearableType() == mType && param->isTweakable()) { //pretty sure is right if(param->getID() == 507) avatar->setActualBoobGrav(param->getWeight()); if(param->getID() == 151) avatar->setActualButtGrav(param->getWeight()); if(param->getID() == 157) avatar->setActualFatGrav(param->getWeight()); //if(param->getID() == 507) //{ // llwarns << "current = " << avatar->getActualBoobGrav() << llendl; // llwarns << "param weight = " << param->getWeight() << llendl; //} mVisualParamMap[param->getID()] = param->getWeight(); } } mTEMap.clear(); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) { LLViewerImage* image = avatar->getTEImage( te ); if( image ) { mTEMap[te] = image->getID(); } } } //if( gFloaterCustomize ) //{ // mDescription = gFloaterCustomize->getWearableDescription( mType ); //} }
// Updates asset from the user's avatar void LLWearable::readFromAvatar() { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { return; } mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; mVisualParamMap.clear(); for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) { if (((LLViewerVisualParam*)param)->getWearableType() == mType && param->isTweakable()) { mVisualParamMap[param->getID()] = param->getWeight(); } } mTEMap.clear(); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) { LLViewerImage* image = avatar->getTEImage( te ); if( image ) { mTEMap[te] = image->getID(); } } } //if( gFloaterCustomize ) //{ // mDescription = gFloaterCustomize->getWearableDescription( mType ); //} }
// Updates asset from the user's avatar void LLWearable::readFromAvatar() { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { return; } mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; mVisualParamMap.clear(); for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { mVisualParamMap[param->getID()] = param->getWeight(); } } mTEMap.clear(); for( S32 te = 0; te < LLVOAvatar::TEX_NUM_ENTRIES; te++ ) { if( LLVOAvatar::getTEWearableType( te ) == mType ) { LLViewerImage* image = avatar->getTEImage( te ); if( image ) { mTEMap[te] = image->getID(); } } } //if( gFloaterCustomize ) //{ // mDescription = gFloaterCustomize->getWearableDescription( mType ); //} }
// Avatar parameter and texture definitions can change over time. // * If parameters or textures have been REMOVED since the wearable was created, // they're just ignored, so we consider the wearable clean even though isOldVersion() // will return true. // * If parameters or textures have been ADDED since the wearable was created, // they are taken to have default values, so we consider the wearable clean // only if those values are the same as the defaults. BOOL LLWearable::isDirty() { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { return FALSE; } for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); param; param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) { if (param->getWearableType() == mType && param->isTweakable()) { F32 weight = get_if_there(mVisualParamMap, param->getID(), param->getDefaultWeight()); weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() ); if(avatar->getAppearanceFlag() == true) { //boob if(param->getID() == 507) { weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualBoobGrav()); weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); } //butt if(param->getID() == 795) { weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualButtGrav()); weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); } //fat if(param->getID() == 157) { weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualFatGrav()); weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); } } else { //boob if(param->getID() == 507) { a = F32_to_U8( avatar->getActualBoobGrav(), param->getMinWeight(), param->getMaxWeight() ); } //butt if(param->getID() == 795) { a = F32_to_U8( avatar->getActualButtGrav(), param->getMinWeight(), param->getMaxWeight() ); } //fat if(param->getID() == 157) { a = F32_to_U8( avatar->getActualFatGrav(), param->getMinWeight(), param->getMaxWeight() ); } } U8 b = F32_to_U8( weight, param->getMinWeight(), param->getMaxWeight() ); if( a != b ) { llwarns << "param ID " << param->getID() << " was changed." << llendl; return TRUE; } } } for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) { LLViewerImage* avatar_image = avatar->getTEImage( te ); if( !avatar_image ) { llassert( 0 ); continue; } const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); if( avatar_image->getID() != image_id ) { return TRUE; } } } //if( gFloaterCustomize ) //{ // if( mDescription != gFloaterCustomize->getWearableDescription( mType ) ) // { // return TRUE; // } //} return FALSE; }