本文整理汇总了C++中LLTextureEntry::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ LLTextureEntry::getID方法的具体用法?C++ LLTextureEntry::getID怎么用?C++ LLTextureEntry::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLTextureEntry
的用法示例。
在下文中一共展示了LLTextureEntry::getID方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTextureSelect
//static
void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *data )
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)data;
//<edit>
//LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE);
//if (self && inventory_item_id.notNull())
if(self)
//</edit>
{
LLToolPipette::getInstance()->setResult(TRUE, "");
self->setImageID(te.getID());
self->mNoCopyTextureSelected = FALSE;
//<edit>
self->childSetValue("texture_uuid", te.getID().asString());
/*
LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
// no copy texture
self->mNoCopyTextureSelected = TRUE;
}
*/
//</edit>
self->commitIfImmediateSet();
}
else
{
LLToolPipette::getInstance()->setResult(FALSE, "You do not have a copy this \nof texture in your inventory");
}
}
示例2: get
LLUUID get(LLViewerObject* object, S32 te_index)
{
LLUUID id;
LLViewerTexture* image = object->getTEImage(te_index);
if (image) id = image->getID();
if (!id.isNull() && LLViewerMedia::textureHasMedia(id))
{
LLTextureEntry *te = object->getTE(te_index);
if (te)
{
LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL ;
if(!tex)
{
tex = LLViewerFetchedTexture::sDefaultImagep;
}
if (tex)
{
id = tex->getID();
}
}
}
return id;
}
示例3: onTextureSelect
void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
{
LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
if (inventory_item_id.notNull())
{
LLToolPipette::getInstance()->setResult(TRUE, "");
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
setCanApply(true, true);
// </FS:Ansariel>
setImageID(te.getID());
mNoCopyTextureSelected = FALSE;
LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
// no copy texture
mNoCopyTextureSelected = TRUE;
}
else
{
childSetValue("texture_uuid", inventory_item_id.asString());
}
commitIfImmediateSet();
}
else
{
LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture"));
}
}
示例4: onTextureSelect
void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
{
//<edit>
//LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
//if (inventory_item_id.notNull())
//{
LLToolPipette::getInstance()->setResult(TRUE, "");
setImageID(te.getID());
mNoCopyTextureSelected = FALSE;
getChild<LLUICtrl>("texture_uuid")->setValue(te.getID().asString());
/*
LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
// no copy texture
mNoCopyTextureSelected = TRUE;
}
*/
commitIfImmediateSet();
// }
// else
// {
// LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture"));
// }
//</edit>
}
示例5: xmltoprim
// This function takes a pointer to a viewerobject and applys the prim definition that prim_llsd has
void primbackup::xmltoprim(LLSD prim_llsd,LLViewerObject * object)
{
LLUUID id = object->getID();
expecting_update = object->getID();
LLSelectMgr::getInstance()->selectObjectAndFamily(object);
if(prim_llsd.has("parent"))
{
//we are not the root node.
LLVector3 pos=prim_llsd["position"];
LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]);
object->setPositionRegion((pos*root_rot)+(root_pos+group_offset));
object->setRotation(rot*root_rot);
}
else
{
object->setPositionRegion(root_pos+group_offset);
LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]);
object->setRotation(rot);
}
object->setScale(prim_llsd["scale"]);
if(prim_llsd.has("shadows"))
if(prim_llsd["shadows"].asInteger()==1)
object->setFlags(FLAGS_CAST_SHADOWS,true);
if(prim_llsd.has("phantom"))
if(prim_llsd["phantom"].asInteger()==1)
object->setFlags(FLAGS_PHANTOM,true);
if(prim_llsd.has("physical"))
if(prim_llsd["physical"].asInteger()==1)
object->setFlags(FLAGS_USE_PHYSICS,true);
// Volume params
LLVolumeParams volume_params = object->getVolume()->getParams();
volume_params.fromLLSD(prim_llsd["volume"]) ;
object->updateVolume(volume_params);
if(prim_llsd.has("sculpt"))
{
LLSculptParams* sculpt=new LLSculptParams();
sculpt->fromLLSD(prim_llsd["sculpt"]);
//TODO check if map is valid and only set texture is map is valid and changes
if(assetmap[sculpt->getSculptTexture()].notNull())
{
LLUUID replacment=assetmap[sculpt->getSculptTexture()];
sculpt->setSculptTexture(replacment);
}
object->setParameterEntry(LLNetworkData::PARAMS_SCULPT,(LLNetworkData&)(*sculpt),true);
}
if(prim_llsd.has("light"))
{
LLLightParams * light=new LLLightParams();
light->fromLLSD(prim_llsd["light"]);
object->setParameterEntry(LLNetworkData::PARAMS_LIGHT,(LLNetworkData&)(*light),true);
}
if(prim_llsd.has("flexible"))
{
LLFlexibleObjectData* flex=new LLFlexibleObjectData();
flex->fromLLSD(prim_llsd["flexible"]);
object->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE,(LLNetworkData&)(*flex),true);
}
// Textures
LLSD te_llsd;
llinfos << "Processing textures for prim" << llendl;
te_llsd=prim_llsd["textures"];
LLSD::array_iterator text_it;
U8 i=0;
i=0;
for(text_it=te_llsd.beginArray(); text_it !=te_llsd.endArray(); text_it++)
{
LLSD the_te;
the_te=(*text_it);
LLTextureEntry te;
te.fromLLSD(the_te);
if(assetmap[te.getID()].notNull())
{
LLUUID replacment=assetmap[te.getID()];
te.setID(replacment);
}
object->setTE(i,te); //
i++;
}
llinfos << "Textures done!" << llendl;
//.........这里部分代码省略.........
示例6: import_object
void primbackup::import_object(bool upload)
{
textures.clear();
assetmap.clear();
current_asset=LLUUID::null;
this->m_retexture=upload;
// Open the file open dialog
LLFilePicker& file_picker = LLFilePicker::instance();
if( !file_picker.getOpenFile( LLFilePicker::FFLOAD_XML ) )
{
// User canceled save.
return;
}
std::string file_name = file_picker.getFirstFile().c_str();
folder = gDirUtilp->getDirName(file_name);
llifstream import_file(file_name);
LLSDSerialize::fromXML(llsd, import_file);
import_file.close();
show();
//Get the texture map
LLSD::map_const_iterator prim_it;
LLSD::array_const_iterator prim_arr_it;
this->m_curobject=1;
this->m_curprim=1;
this->m_objects=llsd["data"].size();
this->m_prims=0;
rezcount=0;
updateimportnumbers();
for( prim_arr_it = llsd["data"].beginArray(); prim_arr_it != llsd["data"].endArray(); prim_arr_it++)
{
LLSD llsd2;
llsd2=(*prim_arr_it)["group_body"];
for( prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++)
{
LLSD prim_llsd;
prim_llsd=llsd2[prim_it->first];
LLSD::array_iterator text_it;
std::list<LLUUID>::iterator iter;
if(prim_llsd.has("sculpt"))
{
LLSculptParams* sculpt=new LLSculptParams();
sculpt->fromLLSD(prim_llsd["sculpt"]);
LLUUID orig=sculpt->getSculptTexture();
bool alreadyseen=false;
for(iter = textures.begin(); iter != textures.end() ; iter++)
{
if( (*iter)==orig)
alreadyseen=true;
}
if(alreadyseen==false)
{
llinfos << "Found a new SCULPT texture to upload "<<orig<<llendl;
textures.push_back(orig);
}
}
LLSD te_llsd;
te_llsd=prim_llsd["textures"];
for(text_it=te_llsd.beginArray(); text_it !=te_llsd.endArray(); text_it++)
{
LLSD the_te;
the_te=(*text_it);
LLTextureEntry te;
te.fromLLSD(the_te);
te.getID();
bool alreadyseen=false;
for(iter = textures.begin(); iter != textures.end() ; iter++)
{
if( (*iter)==te.getID())
alreadyseen=true;
}
if(alreadyseen==false)
{
llinfos << "Found a new texture to upload "<<te.getID()<<llendl;
textures.push_back(te.getID());
}
}
}
}
if(m_retexture==TRUE)
upload_next_asset();
//.........这里部分代码省略.........
示例7: importObject_continued
void LLObjectBackup::importObject_continued(AIFilePicker* filepicker)
{
if (!filepicker->hasFilename())
{
// User canceled save.
return;
}
std::string file_name = filepicker->getFilename();
mFolder = gDirUtilp->getDirName(file_name);
llifstream import_file(file_name);
LLSDSerialize::fromXML(mLLSD, import_file);
import_file.close();
show(false);
mAgentPos = gAgent.getPositionAgent();
mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(), gAgent.getUpAxis());
// Get the texture map
LLSD::map_const_iterator prim_it;
LLSD::array_const_iterator prim_arr_it;
mCurObject = 1;
mCurPrim = 1;
mObjects = mLLSD["data"].size();
mPrims = 0;
mRezCount = 0;
updateImportNumbers();
for (prim_arr_it = mLLSD["data"].beginArray(); prim_arr_it != mLLSD["data"].endArray(); prim_arr_it++)
{
LLSD llsd2 = (*prim_arr_it)["group_body"];
for (prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++)
{
LLSD prim_llsd = llsd2[prim_it->first];
LLSD::array_iterator text_it;
std::list<LLUUID>::iterator iter;
if (prim_llsd.has("sculpt"))
{
LLSculptParams* sculpt = new LLSculptParams();
sculpt->fromLLSD(prim_llsd["sculpt"]);
LLUUID orig = sculpt->getSculptTexture();
bool alreadyseen = false;
for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
{
if ((*iter) == orig)
alreadyseen = true;
}
if (alreadyseen == false)
{
LL_INFOS("ObjectBackup") << "Found a new SCULPT texture to upload " << orig << LL_ENDL;
mTexturesList.push_back(orig);
}
}
LLSD te_llsd = prim_llsd["textures"];
for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++)
{
LLSD the_te = (*text_it);
LLTextureEntry te;
te.fromLLSD(the_te);
LLUUID id = te.getID();
if (id != LL_TEXTURE_PLYWOOD && id != LL_TEXTURE_BLANK && id != LL_TEXTURE_INVISIBLE) // Do not upload the default textures
{
bool alreadyseen = false;
for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
{
if ((*iter) == te.getID())
alreadyseen = true;
}
if (alreadyseen == false)
{
LL_INFOS("ObjectBackup") << "Found a new texture to upload "<< te.getID() << LL_ENDL;
mTexturesList.push_back(te.getID());
}
}
}
}
}
if (mRetexture == TRUE)
uploadNextAsset();
else
importFirstObject();
}
示例8: addPrim
void FSFloaterObjectExport::addPrim(LLViewerObject* object, bool root)
{
LLSD prim;
LLUUID object_id = object->getID();
bool default_prim = true;
struct f : public LLSelectedNodeFunctor
{
LLUUID mID;
f(const LLUUID& id) : mID(id) {}
virtual bool apply(LLSelectNode* node)
{
return (node->getObject() && node->getObject()->mID == mID);
}
} func(object_id);
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
default_prim = (!FSExportPermsCheck::canExportNode(node, false));
if (root)
{
if (object->isAttachment())
{
prim["attachment_point"] = ATTACHMENT_ID_FROM_STATE(object->getState());
}
}
else
{
LLViewerObject* parent_object = (LLViewerObject*)object->getParent();
prim["parent"] = parent_object->getID();
}
prim["position"] = object->getPosition().getValue();
prim["scale"] = object->getScale().getValue();
prim["rotation"] = ll_sd_from_quaternion(object->getRotation());
if (default_prim)
{
LL_DEBUGS("export") << object_id.asString() << " failed export check. Using default prim" << LL_ENDL;
prim["flags"] = ll_sd_from_U32((U32)0);
prim["volume"]["path"] = LLPathParams().asLLSD();
prim["volume"]["profile"] = LLProfileParams().asLLSD();
prim["material"] = (S32)LL_MCODE_WOOD;
}
else
{
mExported = true;
prim["flags"] = ll_sd_from_U32(object->getFlags());
prim["volume"]["path"] = object->getVolume()->getParams().getPathParams().asLLSD();
prim["volume"]["profile"] = object->getVolume()->getParams().getProfileParams().asLLSD();
prim["material"] = (S32)object->getMaterial();
if (object->getClickAction() != 0)
{
prim["clickaction"] = (S32)object->getClickAction();
}
LLVOVolume *volobjp = NULL;
if (object->getPCode() == LL_PCODE_VOLUME)
{
volobjp = (LLVOVolume *)object;
}
if(volobjp)
{
if(volobjp->isSculpted())
{
const LLSculptParams *sculpt_params = (const LLSculptParams *)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
if (sculpt_params)
{
if(volobjp->isMesh())
{
if (!mAborted)
{
mAborted = true;
}
return;
}
else
{
if (exportTexture(sculpt_params->getSculptTexture()))
{
prim["sculpt"] = sculpt_params->asLLSD();
}
else
{
LLSculptParams default_sculpt;
prim["sculpt"] = default_sculpt.asLLSD();
}
}
}
}
if(volobjp->isFlexible())
{
const LLFlexibleObjectData *flexible_param_block = (const LLFlexibleObjectData *)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
if (flexible_param_block)
{
prim["flexible"] = flexible_param_block->asLLSD();
}
}
if (volobjp->getIsLight())
//.........这里部分代码省略.........
示例9: primsToLLSD
LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list,
bool is_attachment)
{
LLViewerObject* object;
LLSD llsd;
char localid[16];
LLUUID t_id;
for (LLViewerObject::child_list_t::iterator i = child_list.begin();
i != child_list.end(); ++i)
{
object = (*i);
LLUUID id = object->getID();
LL_INFOS() << "Exporting prim " << object->getID().asString() << LL_ENDL;
// Create an LLSD object that represents this prim. It will be injected
// in to the overall LLSD tree structure
LLSD prim_llsd;
if (!object->isRoot())
{
// Parent id
snprintf(localid, sizeof(localid), "%u",
object->getSubParent()->getLocalID());
prim_llsd["parent"] = localid;
}
// Name and description
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->findNode(object);
if (node)
{
prim_llsd["name"] = node->mName;
prim_llsd["description"] = node->mDescription;
}
// Transforms
if (is_attachment)
{
prim_llsd["position"] = object->getPositionEdit().getValue();
prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotationEdit());
}
else
{
prim_llsd["position"] = object->getPosition().getValue();
prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation());
}
prim_llsd["scale"] = object->getScale().getValue();
// Flags
prim_llsd["phantom"] = object->flagPhantom(); // legacy
prim_llsd["physical"] = object->flagUsePhysics(); // legacy
prim_llsd["flags"] = (S32)object->getFlags(); // new way
// Extra physics flags
if (mGotExtraPhysics)
{
LLSD& physics = prim_llsd["ExtraPhysics"];
physics["PhysicsShapeType"] = object->getPhysicsShapeType();
physics["Gravity"] = object->getPhysicsGravity();
physics["Friction"] = object->getPhysicsFriction();
physics["Density"] = object->getPhysicsDensity();
physics["Restitution"] = object->getPhysicsRestitution();
}
// Click action
if (S32 action = object->getClickAction()) // Non-zero
prim_llsd["clickaction"] = action;
// Prim material
prim_llsd["material"] = object->getMaterial();
// Volume params
LLVolumeParams params = object->getVolume()->getParams();
prim_llsd["volume"] = params.asLLSD();
// Extra paramsb6fab961-af18-77f8-cf08-f021377a7244
if (object->isFlexible())
{
// Flexible
LLFlexibleObjectData* flex;
flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
prim_llsd["flexible"] = flex->asLLSD();
}
if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT))
{
// Light
LLLightParams* light;
light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT);
prim_llsd["light"] = light->asLLSD();
}
if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
{
// Light image
LLLightImageParams* light_param;
light_param = (LLLightImageParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
t_id = validateTextureID(light_param->getLightTexture());
if (mTexturesList.count(t_id) == 0)
//.........这里部分代码省略.........
示例10: xmlToPrim
// This function takes a pointer to a viewerobject and applies the prim
// definition that prim_llsd has
void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object)
{
LLUUID id = object->getID();
mExpectingUpdate = object->getID();
LLSelectMgr::getInstance()->selectObjectAndFamily(object);
if (prim_llsd.has("name"))
{
LLSelectMgr::getInstance()->selectionSetObjectName(prim_llsd["name"]);
}
if (prim_llsd.has("description"))
{
LLSelectMgr::getInstance()->selectionSetObjectDescription(prim_llsd["description"]);
}
if (prim_llsd.has("material"))
{
LLSelectMgr::getInstance()->selectionSetMaterial(prim_llsd["material"].asInteger());
}
if (prim_llsd.has("clickaction"))
{
LLSelectMgr::getInstance()->selectionSetClickAction(prim_llsd["clickaction"].asInteger());
}
if (prim_llsd.has("parent"))
{
//we are not the root node.
LLVector3 pos = LLVector3(prim_llsd["position"]);
LLQuaternion rot = ll_quaternion_from_sd(prim_llsd["rotation"]);
object->setPositionRegion(pos * mRootRot + mRootPos + mGroupOffset);
object->setRotation(rot * mRootRot);
}
else
{
object->setPositionRegion(mRootPos + mGroupOffset);
LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]);
object->setRotation(rot);
}
object->setScale(LLVector3(prim_llsd["scale"]));
if (prim_llsd.has("flags"))
{
U32 flags = (U32)prim_llsd["flags"].asInteger();
object->setFlags(flags, true);
}
else // Kept for backward compatibility
{
/*if (prim_llsd.has("shadows"))
if (prim_llsd["shadows"].asInteger() == 1)
object->setFlags(FLAGS_CAST_SHADOWS, true);*/
if (prim_llsd.has("phantom") && prim_llsd["phantom"].asInteger() == 1)
{
object->setFlags(FLAGS_PHANTOM, true);
}
if (prim_llsd.has("physical") &&
prim_llsd["physical"].asInteger() == 1)
{
object->setFlags(FLAGS_USE_PHYSICS, true);
}
}
if (mGotExtraPhysics && prim_llsd.has("ExtraPhysics"))
{
const LLSD& physics = prim_llsd["ExtraPhysics"];
object->setPhysicsShapeType(physics["PhysicsShapeType"].asInteger());
F32 gravity = physics.has("Gravity") ? physics["Gravity"].asReal()
: physics["GravityMultiplier"].asReal();
object->setPhysicsGravity(gravity);
object->setPhysicsFriction(physics["Friction"].asReal());
object->setPhysicsDensity(physics["Density"].asReal());
object->setPhysicsRestitution(physics["Restitution"].asReal());
object->updateFlags(true);
}
// Volume params
LLVolumeParams volume_params = object->getVolume()->getParams();
volume_params.fromLLSD(prim_llsd["volume"]);
object->updateVolume(volume_params);
if (prim_llsd.has("sculpt"))
{
LLSculptParams sculpt;
sculpt.fromLLSD(prim_llsd["sculpt"]);
// TODO: check if map is valid and only set texture if map is valid and
// changes
LLUUID t_id = sculpt.getSculptTexture();
if (mAssetMap.count(t_id))
{
sculpt.setSculptTexture(mAssetMap[t_id], sculpt.getSculptType());
}
object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt, true);
//.........这里部分代码省略.........
示例11: importObject_continued
void LLObjectBackup::importObject_continued(AIFilePicker* filepicker)
{
if (!filepicker->hasFilename())
{
// User canceled save.
return;
}
std::string file_name = filepicker->getFilename();
mFolder = gDirUtilp->getDirName(file_name);
llifstream import_file(file_name);
LLSDSerialize::fromXML(mLLSD, import_file);
import_file.close();
if (!mLLSD.has("data"))
{
LLNotificationsUtil::add("ImportFailed");
destroy();
return;
}
showFloater(false);
mAgentPos = gAgent.getPositionAgent();
mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(),
gAgent.getUpAxis());
// Get the texture map
mCurObject = 1;
mCurPrim = 1;
mObjects = mLLSD["data"].size();
mPrims = 0;
mRezCount = 0;
updateImportNumbers();
for (LLSD::array_const_iterator prim_arr_it = mLLSD["data"].beginArray(),
prim_arr_end = mLLSD["data"].endArray();
prim_arr_it != prim_arr_end; ++prim_arr_it)
{
LLSD llsd2 = (*prim_arr_it)["group_body"];
for (LLSD::map_const_iterator prim_it = llsd2.beginMap(),
prim_end = llsd2.endMap();
prim_it != prim_end; ++prim_it)
{
LLSD prim_llsd = llsd2[prim_it->first];
if (prim_llsd.has("sculpt"))
{
LLSculptParams sculpt;
sculpt.fromLLSD(prim_llsd["sculpt"]);
if ((sculpt.getSculptType() & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH)
{
LLUUID orig = sculpt.getSculptTexture();
if (mTexturesList.count(orig) == 0)
{
LL_INFOS() << "Found a new SCULPT texture to upload "
<< orig << LL_ENDL;
mTexturesList.insert(orig);
}
}
}
if (prim_llsd.has("light_texture"))
{
LLLightImageParams lightimg;
lightimg.fromLLSD(prim_llsd["light_texture"]);
LLUUID t_id = lightimg.getLightTexture();
if (!is_default_texture(t_id) &&
mTexturesList.count(t_id) == 0)
{
LL_INFOS() << "Found a new light texture to upload: " << t_id
<< LL_ENDL;
mTexturesList.insert(t_id);
}
}
// Check both for "textures" and "texture" since the second (buggy)
// case has already been seen in some exported prims XML files...
LLSD& te_llsd = prim_llsd.has("textures") ? prim_llsd["textures"]
: prim_llsd["texture"];
for (LLSD::array_iterator it = te_llsd.beginArray();
it != te_llsd.endArray(); ++it)
{
LLSD the_te = *it;
LLTextureEntry te;
te.fromLLSD(the_te);
LLUUID t_id = te.getID();
if (!is_default_texture(t_id) &&
mTexturesList.count(t_id) == 0)
{
LL_INFOS() << "Found a new texture to upload: " << t_id
<< LL_ENDL;
mTexturesList.insert(t_id);
}
}
if (prim_llsd.has("materials"))
{
LLSD mat_llsd = prim_llsd["materials"];
//.........这里部分代码省略.........
示例12: importObject
void LLObjectBackup::importObject(bool upload)
{
mTexturesList.clear();
mAssetMap.clear();
mCurrentAsset = LLUUID::null;
mRetexture = upload;
// Open the file open dialog
LLFilePicker& file_picker = LLFilePicker::instance();
if (!file_picker.getOpenFile(LLFilePicker::FFLOAD_XML))
{
// User canceled save.
return;
}
std::string file_name = file_picker.getFirstFile().c_str();
mFolder = gDirUtilp->getDirName(file_name);
llifstream import_file(file_name);
LLSDSerialize::fromXML(mLLSD, import_file);
import_file.close();
mAgentPos = gAgent.getPositionAgent();
mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(), gAgent.getUpAxis());
// Get the texture map
LLSD::map_const_iterator prim_it;
LLSD::array_const_iterator prim_arr_it;
mCurObject = 1;
mCurPrim = 1;
mObjects = mLLSD["data"].size();
mPrims = 0;
mRezCount = 0;
if (mObjects <= 0) {
LLSD args;
args["MESSAGE"] = std::string("Object import failed.\nThe XML file has an incompatble format or does not contain any objects.");
LLNotifications::instance().add("GenericAlert", args);
llwarns << "Trying to import illegal XML object file." << llendl;
return;
}
show(false);
updateImportNumbers();
for (prim_arr_it = mLLSD["data"].beginArray(); prim_arr_it != mLLSD["data"].endArray(); prim_arr_it++)
{
LLSD llsd2 = (*prim_arr_it)["group_body"];
for (prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++)
{
LLSD prim_llsd = llsd2[prim_it->first];
LLSD::array_iterator text_it;
std::list<LLUUID>::iterator iter;
if (prim_llsd.has("sculpt"))
{
LLSculptParams* sculpt = new LLSculptParams();
sculpt->fromLLSD(prim_llsd["sculpt"]);
LLUUID orig = sculpt->getSculptTexture();
bool alreadyseen = false;
for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
{
if ((*iter) == orig)
alreadyseen = true;
}
if (alreadyseen == false)
{
llinfos << "Found a new SCULPT texture to upload " << orig << llendl;
mTexturesList.push_back(orig);
}
}
LLSD te_llsd = prim_llsd["textures"];
for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++)
{
LLSD the_te = (*text_it);
LLTextureEntry te;
te.fromLLSD(the_te);
te.getID();
bool alreadyseen = false;
for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
{
if ((*iter) == te.getID())
alreadyseen = true;
}
if (alreadyseen == false)
{
llinfos << "Found a new texture to upload "<< te.getID() << llendl;
mTexturesList.push_back(te.getID());
}
}
}
}
//.........这里部分代码省略.........