Oops - forgot something in last commit.

Now it works :). Tested with ssb too.
This commit is contained in:
Aleric Inglewood
2013-07-11 00:31:21 +02:00
parent df71d4518e
commit 6a7f7bf4de
3 changed files with 51 additions and 25 deletions

View File

@@ -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 <param id=... value=... /> 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 <param id=... value=... /> 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 <texture te=... uuid=... /> 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);

View File

@@ -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 )

View File

@@ -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);