From 6a7f7bf4deba12a8f984986df7328092781e9892 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Thu, 11 Jul 2013 00:31:21 +0200 Subject: [PATCH] Oops - forgot something in last commit. Now it works :). Tested with ssb too. --- indra/newview/llfloatercustomize.cpp | 50 +++++++++++++++++++-------- indra/newview/llpaneleditwearable.cpp | 25 ++++++++------ indra/newview/llpaneleditwearable.h | 1 + 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp index 0b8b80963..2f6214e5b 100644 --- a/indra/newview/llfloatercustomize.cpp +++ b/indra/newview/llfloatercustomize.cpp @@ -358,26 +358,46 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) // Parse the XML content. static LLStdStringHandle const id_string = LLXmlTree::addAttributeString("id"); static LLStdStringHandle const value_string = LLXmlTree::addAttributeString("value"); + static LLStdStringHandle const te_string = LLXmlTree::addAttributeString("te"); + static LLStdStringHandle const uuid_string = LLXmlTree::addAttributeString("uuid"); for(LLXmlTreeNode* child = archetype_node->getFirstChild(); child; child = archetype_node->getNextChild()) { - if (!child->hasName("param")) + if (child->hasName("param")) { - continue; + std::string id_s; + U32 id; + std::string value_s; + F32 value; + if (!child->getFastAttributeString(id_string, id_s) || !LLStringUtil::convertToU32(id_s, id) || + !child->getFastAttributeString(value_string, value_s) || !LLStringUtil::convertToF32(value_s, value)) + { + llwarns << "Possible syntax error or corruption for node in " << filename << llendl; + continue; + } + LLVisualParam* visual_param = edit_wearable->getVisualParam(id); + if (visual_param) + { + visual_param->setWeight(value, FALSE); + } } - std::string id_s; - U32 id; - std::string value_s; - F32 value; - if (!child->getFastAttributeString(id_string, id_s) || !LLStringUtil::convertToU32(id_s, id) || - !child->getFastAttributeString(value_string, value_s) || !LLStringUtil::convertToF32(value_s, value)) + else if (child->hasName("texture")) { - llwarns << "Possible syntax error or corruption for node in " << filename << llendl; - continue; - } - LLVisualParam* visual_param = edit_wearable->getVisualParam(id); - if (visual_param) - { - visual_param->setWeight(value, FALSE); + std::string te_s; + S32 te; + std::string uuid_s; + LLUUID uuid; + if (!child->getFastAttributeString(te_string, te_s) || !LLStringUtil::convertToS32(te_s, te) || te < 0 || te >= TEX_NUM_INDICES || + !child->getFastAttributeString(uuid_string, uuid_s) || !uuid.set(uuid_s, TRUE)) + { + llwarns << "Possible syntax error or corruption for node in " << filename << llendl; + continue; + } + ETextureIndex te_index = (ETextureIndex)te; + LLWearableType::EType te_wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(te_index); + if (te_wearable_type == edit_wearable->getType()) + { + panel_edit_wearable->setNewImageID(te_index, uuid); + } } } edit_wearable->writeToAvatar(gAgentAvatarp); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 7719b2dfa..8cd506ce3 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1153,7 +1153,18 @@ void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl) if (entry) { // Set the new version - LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(texture_ctrl->getImageAssetID()); + setNewImageID(entry->mTextureIndex, texture_ctrl->getImageAssetID()); + } + else + { + llwarns << "could not get texture picker dictionary entry for wearable of type: " << type << llendl; + } + } +} + +void LLPanelEditWearable::setNewImageID(ETextureIndex te_index, LLUUID const& uuid) +{ + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid); if( image->getID() == IMG_DEFAULT ) { image = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR); @@ -1161,20 +1172,14 @@ void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl) if (getWearable()) { U32 index = gAgentWearables.getWearableIndex(getWearable()); - gAgentAvatarp->setLocalTexture(entry->mTextureIndex, image, FALSE, index); + gAgentAvatarp->setLocalTexture(te_index, image, FALSE, index); LLVisualParamHint::requestHintUpdates(); - gAgentAvatarp->wearableUpdated(type, FALSE); + gAgentAvatarp->wearableUpdated(mType, FALSE); } if (mType == LLWearableType::WT_ALPHA && image->getID() != IMG_INVISIBLE) { - mPreviousAlphaTexture[entry->mTextureIndex] = image->getID(); + mPreviousAlphaTexture[te_index] = image->getID(); } - } - else - { - llwarns << "could not get texture picker dictionary entry for wearable of type: " << type << llendl; - } - } } void LLPanelEditWearable::onColorSwatchCommit(const LLUICtrl* base_ctrl ) diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index f7e9dbade..a57a4b9d2 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -110,6 +110,7 @@ public: void onColorSwatchCommit(const LLUICtrl*); void onTexturePickerCommit(const LLUICtrl*); + void setNewImageID(ETextureIndex te_index, LLUUID const& uuid); //Singu note: this used to be part of onTexturePickerCommit. //alpha mask checkboxes void configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name);