// 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->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { 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 < LLVOAvatar::TEX_NUM_ENTRIES; te++ ) { if( LLVOAvatar::getTEWearableType( 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( te ) ); if( avatar_image->getID() != image_id ) { return TRUE; } } } //if( gFloaterCustomize ) //{ // if( mDescription != gFloaterCustomize->getWearableDescription( mType ) ) // { // return TRUE; // } //} return FALSE; }
// static BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) { std::string instring(str); size_t length = instring.size(); if (length < 1) { return FALSE; } if (length == 1) { char ch = toupper(instring[0]); if (('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'Z') || ('!' <= ch && ch <= '/') || // !"#$%&'()*+,-./ (':' <= ch && ch <= '@') || // :;<=>?@ ('[' <= ch && ch <= '`') || // [\]^_` ('{' <= ch && ch <= '~')) // {|}~ { *key = ch; return TRUE; } } LLStringUtil::toUpper(instring); KEY res = get_if_there(sNamesToKeys, instring, (KEY)0); if (res != 0) { *key = res; return TRUE; } LL_WARNS() << "keyFromString failed: " << str << LL_ENDL; return FALSE; }
// Get data packer for this object, if we have cached data // AND the CRC matches. JC LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc) { llassert(mCacheLoaded); LLVOCacheEntry* entry = get_if_there(mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordHit(); return entry->getDP(crc); } else { // llinfos << "CRC miss for " << local_id << llendl; mCacheMissCRC.put(local_id); } } else { // llinfos << "Cache miss for " << local_id << llendl; mCacheMissFull.put(local_id); } return NULL; }
// static void LLFloaterGroupInfo::showNotice(const std::string& subject, const std::string& message, const LLUUID& group_id, const bool& has_inventory, const std::string& inventory_name, LLOfferInfo* inventory_offer) { llinfos << "LLFloaterGroupInfo::showNotice : " << subject << llendl; if (group_id.isNull()) { // We need to clean up that inventory offer. if (inventory_offer) { inventory_offer->forceResponse(IOR_DECLINE); } return; } // If we don't have a floater for this group, drop this packet on the floor. LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); if (!fgi) { // We need to clean up that inventory offer. if (inventory_offer) { inventory_offer->forceResponse(IOR_DECLINE); } return; } fgi->mPanelGroupp->showNotice(subject,message,has_inventory,inventory_name,inventory_offer); }
// Get data packer for this object, if we have cached data // AND the CRC matches. JC LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type) { //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18 LLVOCacheEntry* entry = get_if_there(mImpl->mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; return entry->getDP(crc); } else { // llinfos << "CRC miss for " << local_id << llendl; cache_miss_type = CACHE_MISS_TYPE_CRC; mCacheMissCRC.put(local_id); } } else { // llinfos << "Cache miss for " << local_id << llendl; cache_miss_type = CACHE_MISS_TYPE_FULL; mCacheMissFull.put(local_id); } return NULL; }
void LLPanelGroupLandMoney::update(LLGroupChange gc) { if (gc != GC_ALL) return; //Don't update if it's the wrong panel! LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container"); if ( tabp ) { LLPanel* panelp; LLGroupMoneyTabEventHandler* eh; panelp = tabp->getCurrentPanel(); //now pull the event handler associated with that L$ tab if ( panelp ) { eh = get_if_there(LLGroupMoneyTabEventHandler::sTabsToHandlers, panelp, (LLGroupMoneyTabEventHandler*)NULL); if ( eh ) eh->onClickTab(); } } mImplementationp->requestGroupLandInfo(); mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution()); }
// static void LLFloaterGroupInfo::showFromUUID(const LLUUID& group_id, const std::string& tab_name) { // If we don't have a floater for this group, create one. LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); if (!fgi) { fgi = new LLFloaterGroupInfo("groupinfo", FGI_RECT, FLOATER_TITLE, group_id, tab_name); sInstances[group_id] = fgi; if (group_id.notNull()) { // Look up the group name. // The callback will insert it into the title. const BOOL is_group = TRUE; gCacheName->get(group_id, is_group, callbackLoadGroupName, NULL); } } fgi->selectTabByName(tab_name); fgi->center(); fgi->open(); /*Flawfinder: ignore*/ }
// static void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, std::vector<LLUUID> *agent_ids) { // Make sure group_id isn't null if (group_id.isNull()) { llwarns << "LLFloaterGroupInvite::showForGroup with null group_id!" << llendl; return; } // If we don't have a floater for this group, create one. LLFloaterGroupInvite *fgi = get_if_there(impl::sInstances, group_id, (LLFloaterGroupInvite*)NULL); if (!fgi) { fgi = new LLFloaterGroupInvite("groupinfo", FGI_RECT, FLOATER_TITLE, group_id); impl::sInstances[group_id] = fgi; fgi->mImpl->mInvitePanelp->clear(); } if (agent_ids != NULL) { fgi->mImpl->mInvitePanelp->addUsers(*agent_ids); } fgi->center(); fgi->open(); /*Flawfinder: ignore*/ fgi->mImpl->mInvitePanelp->update(); }
F32 LLFont::getXKerning(const llwchar char_left, const llwchar char_right) const { if (mFTFace == NULL) return 0.0; llassert(!mIsFallback); LLFontGlyphInfo* left_glyph_info = get_if_there(mCharGlyphInfoMap, char_left, (LLFontGlyphInfo*)NULL); U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0; // Kern this puppy. LLFontGlyphInfo* right_glyph_info = get_if_there(mCharGlyphInfoMap, char_right, (LLFontGlyphInfo*)NULL); U32 right_glyph = right_glyph_info ? right_glyph_info->mGlyphIndex : 0; FT_Vector delta; llverify(!FT_Get_Kerning(mFTFace, left_glyph, right_glyph, ft_kerning_unfitted, &delta)); return delta.x*(1.f/64.f); }
LLAssetType::EType LLCOFWearables::getSelectedAccordionAssetType() { if (mAccordionCtrl != NULL) { const LLAccordionCtrlTab* selected_tab = mAccordionCtrl->getSelectedTab(); return get_if_there(mTab2AssetType, selected_tab, LLAssetType::AT_NONE); } return LLAssetType::AT_NONE; }
// static void LLFloaterGroupInfo::refreshGroup(const LLUUID& group_id) { LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); if (fgi) { if (fgi->mPanelGroupp) { fgi->mPanelGroupp->refreshData(); } } }
// static std::string LLKeyboard::stringFromKey(KEY key) { std::string res = get_if_there(sKeysToNames, key, std::string()); if (res.empty()) { char buffer[2]; /* Flawfinder: ignore */ buffer[0] = key; buffer[1] = '\0'; res = std::string(buffer); } return res; }
// static void LLFloaterGroupInfo::callbackLoadGroupName(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data) { LLFloaterGroupInfo *fgi = get_if_there(sInstances, id, (LLFloaterGroupInfo*)NULL); if (fgi) { // Build a new title including the group name. std::ostringstream title; title << first << " - " << FLOATER_TITLE; fgi->setTitle(title.str()); } }
// Does not copy mAssetID. // Definition version is current: removes obsolete enties and creates default values for new ones. void LLWearable::copyDataFrom( LLWearable* src ) { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { return; } mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; mName = src->mName; mDescription = src->mDescription; mPermissions = src->mPermissions; mSaleInfo = src->mSaleInfo; mType = src->mType; // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); param; param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) { if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { S32 id = param->getID(); F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() ); mVisualParamMap[id] = weight; } } // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) for( S32 te = 0; te < LLVOAvatar::TEX_NUM_ENTRIES; te++ ) { if( LLVOAvatar::getTEWearableType( te ) == mType ) { const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatar::getDefaultTEImageID( te ) ); mTEMap[te] = image_id; } } }
// Checked: 2010-07-28 (RLVa-1.1.3b) | Added: RLVa-1.2.0i void RlvAttachmentLockWatchdog::detach(S32 idxAttachPt, const LLViewerObject* pAttachObjExcept /*=NULL*/) { const LLViewerJointAttachment* pAttachPt = (gAgent.getAvatarObject()) ? get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, (S32)idxAttachPt, (LLViewerJointAttachment*)NULL) : NULL; if (!pAttachPt) return; c_llvo_vec_t attachObjs; for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin(); itAttachObj != pAttachPt->mAttachedObjects.end(); ++itAttachObj) { const LLViewerObject* pAttachObj = *itAttachObj; if (pAttachObj != pAttachObjExcept) attachObjs.push_back(pAttachObj); } if (!attachObjs.empty()) { gMessageSystem->newMessage("ObjectDetach"); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); for (c_llvo_vec_t::const_iterator itAttachObj = attachObjs.begin(); itAttachObj != attachObjs.end(); ++itAttachObj) { const LLViewerObject* pAttachObj = *itAttachObj; gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, pAttachObj->getLocalID()); if (std::find(m_PendingDetach.begin(), m_PendingDetach.end(), pAttachObj->getAttachmentItemID()) == m_PendingDetach.end()) m_PendingDetach.push_back(pAttachObj->getAttachmentItemID()); } gMessageSystem->sendReliable(gAgent.getRegionHost()); // HACK-RLVa: force the region to send out an ObjectUpdate for the old attachment so obsolete viewers will remember it exists if ( (!pAttachPt->getIsHUDAttachment()) && (pAttachPt->mAttachedObjects.size() > attachObjs.size()) ) { for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin(); itAttachObj != pAttachPt->mAttachedObjects.end(); ++itAttachObj) { if (std::find(attachObjs.begin(), attachObjs.end(), *itAttachObj) == attachObjs.end()) { LLSelectMgr::instance().deselectAll(); LLSelectMgr::instance().selectObjectAndFamily(*itAttachObj); LLSelectMgr::instance().deselectAll(); break; } } } } }
// Checked: 2010-03-11 (RLVa-1.1.3b) | Modified: RLVa-1.2.0g std::string rlvGetItemNameFromObjID(const LLUUID& idObj, bool fIncludeAttachPt = true) { const LLViewerObject* pObj = gObjectList.findObject(idObj); const LLViewerObject* pObjRoot = (pObj) ? pObj->getRootEdit() : NULL; const LLViewerInventoryItem* pItem = ((pObjRoot) && (pObjRoot->isAttachment())) ? gInventory.getItem(pObjRoot->getAttachmentItemID()) : NULL; std::string strItemName = (pItem) ? pItem->getName() : idObj.asString(); if ( (!fIncludeAttachPt) || (!pObj) || (!pObj->isAttachment()) || (!gAgentAvatarp) ) return strItemName; const LLViewerJointAttachment* pAttachPt = get_if_there(gAgentAvatarp->mAttachmentPoints, RlvAttachPtLookup::getAttachPointIndex(pObjRoot), (LLViewerJointAttachment*)NULL); std::string strAttachPtName = (pAttachPt) ? pAttachPt->getName() : std::string("Unknown"); return llformat("%s (%s, %s)", strItemName.c_str(), strAttachPtName.c_str(), (pObj == pObjRoot) ? "root" : "child"); }
LLAssetType::EType LLCOFWearables::getExpandedAccordionAssetType() { typedef std::map<std::string, LLAssetType::EType> type_map_t; static type_map_t type_map; if (mAccordionCtrl != NULL) { const LLAccordionCtrlTab* expanded_tab = mAccordionCtrl->getExpandedTab(); return get_if_there(mTab2AssetType, expanded_tab, LLAssetType::AT_NONE); } return LLAssetType::AT_NONE; }
//----------------------------------------------------------------------------- // createMotion() //----------------------------------------------------------------------------- LLMotion* LLMotionRegistry::createMotion(LLUUID const& id, LLMotionController* controller) { LLMotionConstructor constructor = get_if_there(mMotionTable, id, LLMotionConstructor(NULL)); LLMotion* motion = NULL; if ( constructor == NULL ) { // *FIX: need to replace with a better default scheme. RN motion = LLKeyframeMotion::create(id, controller); } else { motion = constructor(id, controller); } return motion; }
void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata) { llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) ); LLWearable* instance = get_if_there(mList, assetID, (LLWearable*)NULL ); if( instance ) { asset_arrived_callback( instance, userdata ); } else { gAssetStorage->getAssetData(assetID, asset_type, LLWearableList::processGetAssetReply, (void*)new LLWearableArrivedData( asset_type, wearable_name, asset_arrived_callback, userdata ), TRUE); } }
void LLViewerObjectList::getUUIDFromLocal(LLUUID &id, const U32 local_id, const U32 ip, const U32 port) { U64 ipport = (((U64)ip) << 32) | (U64)port; U32 index = sIPAndPortToIndex[ipport]; if (!index) { index = sSimulatorMachineIndex++; sIPAndPortToIndex[ipport] = index; } U64 indexid = (((U64)index) << 32) | (U64)local_id; id = get_if_there(sIndexAndLocalIDToUUID, indexid, LLUUID::null); }
// Checked: 2010-09-23 (RLVa-1.1.3b) | Added: RLVa-1.2.1d void RlvAttachmentLockWatchdog::RlvWearInfo::dumpInstance() const { const LLViewerInventoryItem* pItem = gInventory.getItem(idItem); std::string strItemId = idItem.asString(); std::string strTemp = llformat("Wear %s '%s' (%s)", (RLV_WEAR_ADD == eWearAction) ? "add" : "replace", (pItem) ? pItem->getName().c_str() : "missing", strItemId.c_str()); RLV_INFOS << strTemp.c_str() << RLV_ENDL; if (!attachPts.empty()) { std::string strEmptyAttachPt; for (std::map<S32, uuid_vec_t>::const_iterator itAttachPt = attachPts.begin(); itAttachPt != attachPts.end(); ++itAttachPt) { const LLViewerJointAttachment* pAttachPt = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, itAttachPt->first, (LLViewerJointAttachment*)NULL); if (!itAttachPt->second.empty()) { for (uuid_vec_t::const_iterator itAttach = itAttachPt->second.begin(); itAttach != itAttachPt->second.end(); ++itAttach) { pItem = gInventory.getItem(*itAttach); strItemId = (*itAttach).asString(); strTemp = llformat(" -> %s : %s (%s)", pAttachPt->getName().c_str(), (pItem) ? pItem->getName().c_str() : "missing", strItemId.c_str()); RLV_INFOS << strTemp.c_str() << RLV_ENDL; } } else { if (!strEmptyAttachPt.empty()) strEmptyAttachPt += ", "; strEmptyAttachPt += pAttachPt->getName(); } } if (!strEmptyAttachPt.empty()) RLV_INFOS << " -> " << strEmptyAttachPt << " : empty" << RLV_ENDL; } else { RLV_INFOS << " -> no attachment point information" << RLV_ENDL; } }
// static std::string LLKeyboard::stringFromKey(KEY key) { std::string res = get_if_there(sKeysToNames, key, std::string()); if (res.empty()) { char buffer[2]; /* Flawfinder: ignore */ buffer[0] = key; buffer[1] = '\0'; res = std::string(buffer); } LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; if (trans != NULL) { res = trans(res.c_str()); } return res; }
LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) { U32 local_id = objectp->getLocalID(); U32 crc = objectp->getCRC(); LLVOCacheEntry* entry = get_if_there(mImpl->mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordDupe(); return CACHE_UPDATE_DUPE; } // Update the cache entry mImpl->mCacheMap.erase(local_id); delete entry; entry = new LLVOCacheEntry(local_id, crc, dp); mImpl->mCacheMap[local_id] = entry; return CACHE_UPDATE_CHANGED; } // we haven't seen this object before // Create new entry and add to map eCacheUpdateResult result = CACHE_UPDATE_ADDED; if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) { delete mImpl->mCacheMap.begin()->second ; mImpl->mCacheMap.erase(mImpl->mCacheMap.begin()); result = CACHE_UPDATE_REPLACED; } entry = new LLVOCacheEntry(local_id, crc, dp); mImpl->mCacheMap[local_id] = entry; return result; }
void LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) { U32 local_id = objectp->getLocalID(); U32 crc = objectp->getCRC(); LLVOCacheEntry* entry = get_if_there(mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordDupe(); } else { // Update the cache entry mCacheMap.erase(local_id); delete entry; entry = new LLVOCacheEntry(local_id, crc, dp); mCacheMap[local_id] = entry; } } else { // we haven't seen this object before // Create new entry and add to map if (mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) { mCacheMap.erase(mCacheMap.begin()); } entry = new LLVOCacheEntry(local_id, crc, dp); mCacheMap[local_id] = entry; } return ; }
F32 LLFontFreetype::getXAdvance(llwchar wch) const { if (mFTFace == NULL) return 0.0; // Return existing info only if it is current LLFontGlyphInfo* gi = getGlyphInfo(wch); if (gi) { return gi->mXAdvance; } else { gi = get_if_there(mCharGlyphInfoMap, (llwchar)0, (LLFontGlyphInfo*)NULL); if (gi) { return gi->mXAdvance; } } // Last ditch fallback - no glyphs defined at all. return (F32)mFontBitmapCachep->getMaxCharWidth(); }
//----------------------------------------------------------------------------- // LLPolyMesh::getMesh() //----------------------------------------------------------------------------- LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_mesh) { //------------------------------------------------------------------------- // search for an existing mesh by this name //------------------------------------------------------------------------- LLPolyMeshSharedData* meshSharedData = get_if_there(sGlobalSharedMeshList, name, (LLPolyMeshSharedData*)NULL); if (meshSharedData) { // LL_INFOS() << "Polymesh " << name << " found in global mesh table." << LL_ENDL; LLPolyMesh *poly_mesh = new LLPolyMesh(meshSharedData, reference_mesh); return poly_mesh; } //------------------------------------------------------------------------- // if not found, create a new one, add it to the list //------------------------------------------------------------------------- std::string full_path; full_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name); LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData(); if (reference_mesh) { mesh_data->setupLOD(reference_mesh->getSharedData()); } if ( ! mesh_data->loadMesh( full_path ) ) { delete mesh_data; return NULL; } LLPolyMesh *poly_mesh = new LLPolyMesh(mesh_data, reference_mesh); // LL_INFOS() << "Polymesh " << name << " added to global mesh table." << LL_ENDL; sGlobalSharedMeshList[name] = poly_mesh->mSharedData; return poly_mesh; }
// static void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID& uuid, void* userdata, S32 status, LLExtStat ext_status ) { BOOL isNewWearable = FALSE; LLWearableArrivedData* data = (LLWearableArrivedData*) userdata; // LLWearable* wearable = NULL; // NULL indicates failure // [SL:KB] - Patch: Appearance-Misc | Checked: 2010-08-13 (Catznip-3.0.0a) | Added: Catznip-2.1.1d LLWearable* wearable = get_if_there(LLWearableList::instance().mList, uuid, (LLWearable*)NULL); if (wearable) { if(data->mCallback) data->mCallback(wearable, data->mUserdata); delete data; return; } // [/SL:KB] if( !filename ) { LL_WARNS("Wearable") << "Bad Wearable Asset: missing file." << LL_ENDL; } else if (status >= 0) { // read the file LLFILE* fp = LLFile::fopen(std::string(filename), "rb"); /*Flawfinder: ignore*/ if( !fp ) { LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL; } else { wearable = new LLWearable(uuid); bool res = wearable->importFile( fp ); if (!res) { if (wearable->getType() == LLWearableType::WT_COUNT) { isNewWearable = TRUE; } delete wearable; wearable = NULL; } fclose( fp ); if(filename) { LLFile::remove(std::string(filename)); } } } else { if(filename) { LLFile::remove(std::string(filename)); } LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); LL_WARNS("Wearable") << "Wearable download failed: " << LLAssetStorage::getErrorString( status ) << " " << uuid << LL_ENDL; switch( status ) { case LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE: { // Fail break; } default: { static const S32 MAX_RETRIES = 3; if (data->mRetries < MAX_RETRIES) { // Try again data->mRetries++; gAssetStorage->getAssetData(uuid, data->mAssetType, LLWearableList::processGetAssetReply, userdata); // re-use instead of deleting. return; } else { // Fail break; } } } } if (wearable) // success { LLWearableList::instance().mList[ uuid ] = wearable; LL_DEBUGS("Wearable") << "processGetAssetReply()" << LL_ENDL; LL_DEBUGS("Wearable") << wearable << LL_ENDL; } else { LLSD args; args["TYPE"] =LLTrans::getString(LLAssetType::lookupHumanReadable(data->mAssetType)); if (isNewWearable) { LLNotificationsUtil::add("InvalidWearable"); } else if (data->mName.empty()) { LLNotificationsUtil::add("FailedToFindWearableUnnamed", args); } else { args["DESC"] = data->mName; LLNotificationsUtil::add("FailedToFindWearable", args); } } // Always call callback; wearable will be NULL if we failed { if( data->mCallback ) { data->mCallback( wearable, data->mUserdata ); } } delete data; }
F32 LLFont::getXAdvance(const llwchar wch) const { if (mFTFace == NULL) return 0.0; llassert(!mIsFallback); U32 glyph_index; // Return existing info only if it is current LLFontGlyphInfo* gi = getGlyphInfo(wch); if (gi && gi->mMetricsValid) { return gi->mXAdvance; } const LLFont* fontp = this; // Initialize char to glyph map glyph_index = FT_Get_Char_Index(mFTFace, wch); if (glyph_index == 0 && mFallbackFontp) { LLFontList::iterator iter; for(iter = mFallbackFontp->begin(); (iter != mFallbackFontp->end()) && (glyph_index == 0); iter++) { glyph_index = FT_Get_Char_Index((*iter)->mFTFace, wch); if(glyph_index) { fontp = *iter; } } } if (glyph_index) { // This font has this glyph fontp->renderGlyph(glyph_index); // Create the entry if it's not there char_glyph_info_map_t::iterator iter2 = mCharGlyphInfoMap.find(wch); if (iter2 == mCharGlyphInfoMap.end()) { gi = new LLFontGlyphInfo(glyph_index); insertGlyphInfo(wch, gi); } else { gi = iter2->second; } gi->mWidth = fontp->mFTFace->glyph->bitmap.width; gi->mHeight = fontp->mFTFace->glyph->bitmap.rows; // Convert these from 26.6 units to float pixels. gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f; gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f; gi->mMetricsValid = TRUE; return gi->mXAdvance; } else { gi = get_if_there(mCharGlyphInfoMap, (llwchar)0, (LLFontGlyphInfo*)NULL); if (gi) { return gi->mXAdvance; } } // Last ditch fallback - no glyphs defined at all. return (F32)mFontBitmapCachep->getMaxCharWidth(); }
//----------------------------------------------------------------------------- // getAnimationData() //----------------------------------------------------------------------------- void* LLCharacter::getAnimationData(std::string name) { return get_if_there(mAnimationData, name, (void*)NULL); }
void RlvFloaterBehaviour::refreshAll() { LLVOAvatar* pAvatar = gAgent.getAvatarObject(); LLCtrlListInterface* pList = childGetListInterface("behaviour_list"); const rlv_object_map_t* pRlvObjects = gRlvHandler.getObjectMap(); if ( (!pAvatar) || (!pList) || (!pRlvObjects) ) return; pList->operateOnAll(LLCtrlListInterface::OP_DELETE); for (rlv_object_map_t::const_iterator itObj = pRlvObjects->begin(), endObj = pRlvObjects->end(); itObj != endObj; ++itObj) { std::string strName = itObj->first.asString(); LLViewerInventoryItem* pItem = NULL; LLViewerObject* pObj = gObjectList.findObject(itObj->first); if (pObj) { LLViewerJointAttachment* pAttachPt = get_if_there(pAvatar->mAttachmentPoints, gRlvHandler.getAttachPointIndex(pObj), (LLViewerJointAttachment*)NULL); if (pAttachPt) { pItem = gInventory.getItem(pAttachPt->getItemID()); } } if (pItem) strName = pItem->getName(); const rlv_command_list_t* pCommands = itObj->second.getCommandList(); for (rlv_command_list_t::const_iterator itCmd = pCommands->begin(), endCmd = pCommands->end(); itCmd != endCmd; ++itCmd) { std::string strBhvr = itCmd->asString(); LLUUID uuid(itCmd->getOption()); if (uuid.notNull()) { std::string strLookup; if ( (gCacheName->getFullName(uuid, strLookup)) || (gCacheName->getGroupName(uuid, strLookup)) ) { if (strLookup.find("???") == std::string::npos) strBhvr.assign(itCmd->getBehaviour()).append(":").append(strLookup); } else if (m_PendingLookup.end() == std::find(m_PendingLookup.begin(), m_PendingLookup.end(), uuid)) { gCacheName->get(uuid, FALSE, onAvatarNameLookup, this); m_PendingLookup.push_back(uuid); } } LLSD element; // Restriction column element["columns"][0]["column"] = "behaviour"; element["columns"][0]["value"] = strBhvr; element["columns"][0]["font"] = "SANSSERIF"; element["columns"][0]["font-style"] = "NORMAL"; // Object Name column element["columns"][1]["column"] = "name"; element["columns"][1]["value"] = strName; element["columns"][1]["font"] = "SANSSERIF"; element["columns"][1]["font-style"] = "NORMAL"; pList->addElement(element, ADD_BOTTOM); } } }