// static void LLFloaterProperties::onCommitName() { //llinfos << "LLFloaterProperties::onCommitName()" << llendl; LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) { return; } LLLineEditor* labelItemName = getChild<LLLineEditor>("LabelItemName"); if(labelItemName&& (item->getName() != labelItemName->getText()) && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) ) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->rename(labelItemName->getText()); if(mObjectID.isNull()) { new_item->updateServer(FALSE); gInventory.updateItem(new_item); gInventory.notifyObservers(); } else { LLViewerObject* object = gObjectList.findObject(mObjectID); if(object) { object->updateInventory( new_item, TASK_INVENTORY_ITEM_KEY, false); } } } }
void LLGestureMgr::changed(U32 mask) { LLInventoryFetchItemsObserver::changed(mask); if (mask & LLInventoryObserver::GESTURE) { // If there was a gesture label changed, update all the names in the // active gestures and then notify observers if (mask & LLInventoryObserver::LABEL) { for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it) { if(it->second) { LLViewerInventoryItem* item = gInventory.getItem(it->first); if(item) { it->second->mName = item->getName(); } } } notifyObservers(); } // If there was a gesture added or removed notify observers // STRUCTURE denotes that the inventory item has been moved // In the case of deleting gesture, it is moved to the trash else if(mask & LLInventoryObserver::ADD || mask & LLInventoryObserver::REMOVE || mask & LLInventoryObserver::STRUCTURE) { notifyObservers(); } } }
virtual void done() { gInventory.removeObserver(this); // Link to all fetched items in COF. LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; for (uuid_vec_t::iterator it = mIDs.begin(); it != mIDs.end(); ++it) { LLUUID id = *it; LLViewerInventoryItem *item = gInventory.getItem(*it); if (!item) { llwarns << "fetch failed!" << llendl; continue; } link_inventory_item(gAgent.getID(), item->getLinkedUUID(), LLAppearanceMgr::instance().getCOF(), item->getName(), item->getDescription(), LLAssetType::AT_LINK, link_waiter); } }
LLPrefsAscentChat::LLPrefsAscentChat() { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_ascent_chat.xml"); childSetCommitCallback("SpellBase", onSpellBaseComboBoxCommit, this); childSetAction("EmSpell_EditCustom", onSpellEditCustom, this); childSetAction("EmSpell_GetMore", onSpellGetMore, this); childSetAction("EmSpell_Add", onSpellAdd, this); childSetAction("EmSpell_Remove", onSpellRemove, this); childSetCommitCallback("time_format_combobox", onCommitTimeDate, this); childSetCommitCallback("date_format_combobox", onCommitTimeDate, this); childSetCommitCallback("AscentInstantMessageResponseAnyone", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageResponseFriends", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageResponseMuted", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageShowOnTyping", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageShowResponded", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageResponseRepeat", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageResponseItem", onCommitAutoResponse, this); if(sInst)delete sInst; sInst = this; LLView* target_view = getChild<LLView>("im_give_drop_target_rect"); if (target_view) { const std::string drop="drop target"; if (mObjectDropTarget) delete mObjectDropTarget; mObjectDropTarget = new LLDropTarget(drop, target_view->getRect(), SinguIMResponseItemDrop);//, mAvatarID); addChild(mObjectDropTarget); } bool started = LLStartUp::getStartupState() == STATE_STARTED; if (started) { LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("AscentInstantMessageResponseItemData"); LLViewerInventoryItem* item = gInventory.getItem(itemid); if (item) childSetValue("im_give_disp_rect_txt","Currently set to: "+item->getName()); else if (itemid.isNull()) childSetValue("im_give_disp_rect_txt","Currently not set"); else childSetValue("im_give_disp_rect_txt","Currently set to an item not on this account"); } else childSetValue("im_give_disp_rect_txt","Not logged in"); childSetCommitCallback("im_response", onCommitAutoResponse, this); childSetEnabled("reset_antispam", started); childSetCommitCallback("reset_antispam", onCommitResetAS, this); childSetCommitCallback("KeywordsOn", onCommitKeywords, this); childSetCommitCallback("KeywordsList", onCommitKeywords, this); childSetCommitCallback("KeywordsSound", onCommitKeywords, this); childSetCommitCallback("KeywordsInChat", onCommitKeywords, this); childSetCommitCallback("KeywordsInIM", onCommitKeywords, this); childSetCommitCallback("KeywordsChangeColor", onCommitKeywords, this); childSetCommitCallback("KeywordsColor", onCommitKeywords, this); childSetCommitCallback("KeywordsPlaySound", onCommitKeywords, this); refreshValues(); refresh(); }
void LLFloaterAO::updateLayout2(LLFloaterAO* floater) { if(floater) { if(LLStartUp::getStartupState() == STATE_STARTED) { LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("PhoenixAOConfigNotecardID"); LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); if(itemimport) { floater->childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); } else if(itemidimport.isNull()) { floater->childSetValue("ao_nc_text","Currently not set"); } else { floater->childSetValue("ao_nc_text","Currently set to a item not on this account"); } } else { floater->childSetValue("ao_nc_text","Not logged in"); } LLFloaterAO::init(); } else { sInstance = new LLFloaterAO(); updateLayout2(sInstance); } }
void LLFloaterLandmark::onBtnEdit() { // There isn't one, so make a new preview LLViewerInventoryItem* itemp = gInventory.getItem(mImageAssetID); if(itemp) { open_landmark(itemp, itemp->getName(), TRUE); } }
// static void LLFloaterLandmark::onBtnEdit(void* userdata) { LLFloaterLandmark* self = (LLFloaterLandmark*) userdata; // There isn't one, so make a new preview LLViewerInventoryItem* itemp = gInventory.getItem(self->mImageAssetID); if(itemp) { open_landmark(itemp, itemp->getName(), TRUE); } }
void LLPanelWearing::copyToClipboard() { std::string text; std::vector<LLSD> data; mCOFItemsList->getValues(data); for(std::vector<LLSD>::const_iterator iter = data.begin(); iter != data.end();) { LLSD uuid = (*iter); LLViewerInventoryItem* item = gInventory.getItem(uuid); iter++; if (item != NULL) { // Append a newline to all but the last line text += iter != data.end() ? item->getName() + "\n" : item->getName(); } } LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); }
void giveInventoryItem_Event(LLUUID &to_agent, LLUUID &item_id, LLUUID &im_session_id) { LLViewerInventoryItem *item = gInventory.getItem(item_id); if(!item) { std::string dongs = llformat("Could not find item %s.",item_id.asString()); LuaError(dongs.c_str()); return; } std::string name; gAgent.buildFullname(name); LLUUID transaction_id; transaction_id.generate(); const S32 BUCKET_SIZE = sizeof(U8) + UUID_BYTES; U8 bucket[BUCKET_SIZE]; bucket[0] = (U8)item->getType(); memcpy(&bucket[1], &(item->getUUID().mData), UUID_BYTES); /* Flawfinder: ignore */ pack_instant_message( gMessageSystem, gAgent.getID(), FALSE, gAgent.getSessionID(), to_agent, name, item->getName(), IM_ONLINE, IM_INVENTORY_OFFERED, transaction_id, 0, LLUUID::null, gAgent.getPositionAgent(), NO_TIMESTAMP, bucket, BUCKET_SIZE); gAgent.sendReliableMessage(); // No VEffects. gFloaterTools->dirty(); LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY); // If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat. if (im_session_id != LLUUID::null) { LLSD args; gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args); } }
void CreateGestureCallback::fire(const LLUUID& inv_item) { if (inv_item.isNull()) return; gGestureManager.activateGesture(inv_item); LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) return; gInventory.updateItem(item); gInventory.notifyObservers(); if(!LLPreview::show(inv_item,FALSE)) { LLPreviewGesture* preview = LLPreviewGesture::show(std::string("Gesture: ") + item->getName(), inv_item, LLUUID::null); // Force to be entirely onscreen. gFloaterView->adjustToFitScreen(preview, FALSE); } }
// static void LLWLParamManager::loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status) { LLUUID inventory_id(*((LLUUID*)user_data)); std::string name = "WindLight Setting.wl"; LLViewerInventoryItem *item = gInventory.getItem(inventory_id); if(item) { inventory_id = item->getUUID(); name = item->getName(); } if(LL_ERR_NOERR == status) { LLVFile file(vfs, asset_id, asset_type, LLVFile::READ); S32 file_length = file.getSize(); std::vector<char> buffer(file_length + 1); file.read((U8*)&buffer[0], file_length); buffer[file_length] = 0; LLNotecard notecard(LLNotecard::MAX_SIZE); LLMemoryStream str((U8*)&buffer[0], file_length + 1); notecard.importStream(str); std::string settings = notecard.getText(); LLMemoryStream settings_str((U8*)settings.c_str(), settings.length()); bool is_animator_running = sInstance->mAnimator.mIsRunning; bool animator_linden_time = sInstance->mAnimator.mUseLindenTime; sInstance->mAnimator.mIsRunning = false; sInstance->mAnimator.mUseLindenTime = false; bool is_real_setting = sInstance->loadPresetXML(name, settings_str, true, true); if(!is_real_setting) { sInstance->mAnimator.mIsRunning = is_animator_running; sInstance->mAnimator.mUseLindenTime = animator_linden_time; LLSD subs; subs["NAME"] = name; LLNotifications::getInstance()->add("KittyInvalidWindlightNotecard", subs); } else { // We can do this because we know mCurParams sInstance->mParamList[name].mInventoryID = inventory_id; } } }
void LLGestureMgr::done() { bool notify = false; for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it) { if(it->second && it->second->mName.empty()) { LLViewerInventoryItem* item = gInventory.getItem(it->first); if(item) { it->second->mName = item->getName(); notify = true; } } } if(notify) { notifyObservers(); } }
// static void LLWLParamManager::loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status) { LLUUID inventory_id(*((LLUUID*)user_data)); std::string name = "WindLight Setting.wl"; LLViewerInventoryItem *item = gInventory.getItem(inventory_id); if(item) { inventory_id = item->getUUID(); name = item->getName(); } if(LL_ERR_NOERR == status) { LLVFile file(vfs, asset_id, asset_type, LLVFile::READ); S32 file_length = file.getSize(); std::vector<char> buffer(file_length + 1); file.read((U8*)&buffer[0], file_length); buffer[file_length] = 0; LLNotecard notecard(LLNotecard::MAX_SIZE); LLMemoryStream str((U8*)&buffer[0], file_length + 1); notecard.importStream(str); std::string settings = notecard.getText(); LLMemoryStream settings_str((U8*)settings.c_str(), settings.length()); LLWLParamKey key((" Notecard: " + name), LLEnvKey::SCOPE_LOCAL); bool is_real_setting = getInstance()->loadPresetXML(key, settings_str); if(!is_real_setting) { LLSD subs; subs["NAME"] = name; LLNotifications::getInstance()->add("KittyInvalidWindlightNotecard", subs); } else { // We can do this because we know mCurParams getInstance()->mParamList[key].mInventoryID = inventory_id; LLEnvManagerNew::instance().setUseSkyPreset(key.name); } } }
BOOL LLPanelEmerald::postBuild() { refresh(); LLComboBox* tagcombo = getChild<LLComboBox>("TagCombo"); tagcombo->setCommitCallback(onTagComboBoxCommit); for(LLSD::map_iterator itr = ModularSystemsLink::emerald_tags.beginMap(); itr != ModularSystemsLink::emerald_tags.endMap(); ++itr) { tagcombo->add(itr->first,itr->second, ADD_BOTTOM, TRUE); } tagcombo->setSimple(gSavedSettings.getString("EmeraldTagColor")); getChild<LLComboBox>("material")->setSimple(gSavedSettings.getString("EmeraldBuildPrefs_Material")); getChild<LLComboBox>("combobox shininess")->setSimple(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")); LLSliderCtrl* mShapeScaleSlider = getChild<LLSliderCtrl>("EmeraldBeamShapeScale",TRUE,FALSE); mShapeScaleSlider->setCommitCallback(&LLPanelEmerald::beamUpdateCall); mShapeScaleSlider->setCallbackUserData(this); LLSliderCtrl* mBeamsPerSecondSlider = getChild<LLSliderCtrl>("EmeraldMaxBeamsPerSecond",TRUE,FALSE); mBeamsPerSecondSlider->setCommitCallback(&LLPanelEmerald::beamUpdateCall); mBeamsPerSecondSlider->setCallbackUserData(this); getChild<LLComboBox>("material")->setCommitCallback(onComboBoxCommit); getChild<LLComboBox>("combobox shininess")->setCommitCallback(onComboBoxCommit); getChild<LLComboBox>("EmeraldBeamShape_combo")->setCommitCallback(onComboBoxCommit); getChild<LLComboBox>("BeamColor_combo")->setCommitCallback(onComboBoxCommit); getChild<LLTextureCtrl>("texture control")->setDefaultImageAssetID(LLUUID("89556747-24cb-43ed-920b-47caed15465f")); getChild<LLTextureCtrl>("texture control")->setCommitCallback(onTexturePickerCommit); getChild<LLComboBox>("EmeraldSpellBase")->setCommitCallback(onSpellBaseComboBoxCommit); //childSetCommitCallback("material",onComboBoxCommit); //childSetCommitCallback("combobox shininess",onComboBoxCommit); getChild<LLButton>("keyword_allert")->setClickedCallback(onKeywordAllertButton,this); getChild<LLButton>("ac_button")->setClickedCallback(onAutoCorrectButton,this); getChild<LLButton>("EmSpell_EditCustom")->setClickedCallback(onSpellEditCustom, this); getChild<LLButton>("EmSpell_GetMore")->setClickedCallback(onSpellGetMore, this); getChild<LLButton>("EmSpell_Add")->setClickedCallback(onSpellAdd, this); getChild<LLButton>("EmSpell_Remove")->setClickedCallback(onSpellRemove, this); getChild<LLButton>("BeamColor_new")->setClickedCallback(onCustomBeamColor, this); getChild<LLButton>("BeamColor_refresh")->setClickedCallback(onRefresh,this); getChild<LLButton>("BeamColor_delete")->setClickedCallback(onBeamColorDelete,this); getChild<LLButton>("custom_beam_btn")->setClickedCallback(onCustomBeam, this); getChild<LLButton>("refresh_beams")->setClickedCallback(onRefresh,this); getChild<LLButton>("delete_beam")->setClickedCallback(onBeamDelete,this); getChild<LLButton>("revert_production_voice_btn")->setClickedCallback(onClickVoiceRevertProd, this); getChild<LLButton>("revert_debug_voice_btn")->setClickedCallback(onClickVoiceRevertDebug, this); getChild<LLButton>("EmeraldBreastReset")->setClickedCallback(onClickBoobReset, this); childSetCommitCallback("production_voice_field", onCommitApplyControl);//onCommitVoiceProductionServerName); childSetCommitCallback("debug_voice_field", onCommitApplyControl);//onCommitVoiceDebugServerName); childSetCommitCallback("EmeraldCmdLinePos", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineGround", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineHeight", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineTeleportHome", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineRezPlatform", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineMapTo", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineCalc", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineDrawDistance", onCommitApplyControl); childSetCommitCallback("EmeraldCmdTeleportToCam", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineKeyToName", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineOfferTp", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineTP2", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineAO", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineClearChat", onCommitApplyControl); childSetCommitCallback("X Modifier", onCommitAvatarModifier); childSetCommitCallback("Y Modifier", onCommitAvatarModifier); childSetCommitCallback("Z Modifier", onCommitAvatarModifier); if(gAgent.getID() != LLUUID::null) { getChild<LLSpinCtrl>("X Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarXModifier")); getChild<LLSpinCtrl>("Y Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarYModifier")); getChild<LLSpinCtrl>("Z Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarZModifier")); }else { getChild<LLSpinCtrl>("X Modifier")->setEnabled(FALSE); getChild<LLSpinCtrl>("Y Modifier")->setEnabled(FALSE); getChild<LLSpinCtrl>("Z Modifier")->setEnabled(FALSE); } childSetValue("EmeraldUseOTR", LLSD((S32)gSavedSettings.getU32("EmeraldUseOTR"))); // [$PLOTR$] getChild<LLButton>("otr_help_btn")->setClickedCallback(onClickOtrHelp, this); // [/$PLOTR$] initHelpBtn("EmeraldHelp_TeleportLogin", "EmeraldHelp_TeleportLogin"); initHelpBtn("EmeraldHelp_Voice", "EmeraldHelp_Voice"); initHelpBtn("EmeraldHelp_Shields", "EmeraldHelp_Shields"); initHelpBtn("EmeraldHelp_IM", "EmeraldHelp_IM"); initHelpBtn("EmeraldHelp_Chat", "EmeraldHelp_Chat"); initHelpBtn("EmeraldHelp_Misc", "EmeraldHelp_Misc"); initHelpBtn("EmeraldHelp_CmdLine", "EmeraldHelp_CmdLine"); initHelpBtn("EmeraldHelp_Avatar", "EmeraldHelp_Avatar"); initHelpBtn("EmeraldHelp_Build", "EmeraldHelp_Build"); initHelpBtn("EmeraldHelp_IRC", "EmeraldHelp_IRC"); initHelpBtn("EmeraldHelp_UtilityStream", "EmeraldHelp_UtilityStream"); initHelpBtn("EmeraldHelp_Inventory", "EmeraldHelp_Inventory"); initHelpBtn("EmeraldHelp_Effects", "EmeraldHelp_Effects"); initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); LLView *target_view = getChild<LLView>("im_give_drop_target_rect"); if(target_view) { if (mObjectDropTarget)//shouldn't happen { delete mObjectDropTarget; } mObjectDropTarget = new JCInvDropTarget("drop target", target_view->getRect(), IMAutoResponseItemDrop);//, mAvatarID); addChild(mObjectDropTarget); } target_view = getChild<LLView>("build_item_add_disp_rect"); if(target_view) { if (mBuildObjectDropTarget) delete mBuildObjectDropTarget; mBuildObjectDropTarget = new JCInvDropTarget("build drop target", target_view->getRect(),BuildAutoResponseItemDrop); addChild(mBuildObjectDropTarget); } if(LLStartUp::getStartupState() == STATE_STARTED) { LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("EmeraldInstantMessageResponseItemData"); LLViewerInventoryItem* item = gInventory.getItem(itemid); if(item) { childSetValue("im_give_disp_rect_txt","Currently set to: "+item->getName()); }else if(itemid.isNull()) { childSetValue("im_give_disp_rect_txt","Currently not set"); }else { childSetValue("im_give_disp_rect_txt","Currently set to a item not on this account"); } itemid = (LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item"); item = gInventory.getItem(itemid); if(item) { childSetValue("build_item_add_disp_rect_txt","Currently set to: "+item->getName()); }else if(itemid.isNull()) { childSetValue("build_item_add_disp_rect_txt","Currently not set"); }else { childSetValue("build_item_add_disp_rect_txt","Currently set to a item not on this account"); } }else { childSetValue("im_give_disp_rect_txt","Not logged in"); childSetValue("build_item_add_disp_rect_txt","Not logged in"); } LLWString auto_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("EmeraldInstantMessageResponse") ); LLWStringUtil::replaceChar(auto_response, '^', '\n'); LLWStringUtil::replaceChar(auto_response, '%', ' '); childSetText("im_response", wstring_to_utf8str(auto_response)); childSetValue("EmeraldInstantMessageResponseFriends", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseFriends")); childSetValue("EmeraldInstantMessageResponseMuted", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseMuted")); childSetValue("EmeraldInstantMessageResponseAnyone", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseAnyone")); childSetValue("EmeraldInstantMessageShowResponded", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageShowResponded")); childSetValue("EmeraldInstantMessageShowOnTyping", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageShowOnTyping")); childSetValue("EmeraldInstantMessageResponseRepeat", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseRepeat" )); childSetValue("EmeraldInstantMessageResponseItem", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseItem")); childSetValue("EmeraldInstantMessageAnnounceIncoming", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageAnnounceIncoming")); childSetValue("EmeraldInstantMessageAnnounceStealFocus", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageAnnounceStealFocus")); childSetValue("EmeraldShadowsON", gSavedSettings.getBOOL("EmeraldShadowsToggle")); childSetAction("set_mirror", onClickSetMirror, this); childSetCommitCallback("mirror_location", onCommitApplyControl); childSetAction("set_includeHDD", onClickSetHDDInclude, this); childSetCommitCallback("include_location", onCommitApplyControl); //EmeraldLSLExternalEditor childSetAction("set_xed", onClickSetXed, this); childSetCommitCallback("xed_location", onCommitApplyControl); childSetValue("xed_location", gSavedSettings.getString("EmeraldLSLExternalEditor")); getChild<LLCheckBoxCtrl>("telerequest_toggle")->setCommitCallback(onConditionalPreferencesChanged); getChild<LLCheckBoxCtrl>("mldct_toggle")->setCommitCallback(onConditionalPreferencesChanged); refresh(); return TRUE; }
//virtual void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content) { llinfos << "LLUpdateAgentInventoryResponder::result from capabilities" << llendl; LLUUID item_id = mPostData["item_id"]; LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(item_id); if(!item) { llwarns << "Inventory item for " << mVFileID << " is no longer in agent inventory." << llendl; return; } // Update viewer inventory item LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setAssetUUID(content["new_asset"].asUUID()); gInventory.updateItem(new_item); gInventory.notifyObservers(); llinfos << "Inventory item " << item->getName() << " saved into " << content["new_asset"].asString() << llendl; LLInventoryType::EType inventory_type = new_item->getInventoryType(); switch(inventory_type) { case LLInventoryType::IT_NOTECARD: { // Update the UI with the new asset. LLPreviewNotecard* nc; nc = (LLPreviewNotecard*)LLPreview::find(new_item->getUUID()); if(nc) { // *HACK: we have to delete the asset in the VFS so // that the viewer will redownload it. This is only // really necessary if the asset had to be modified by // the uploader, so this can be optimized away in some // cases. A better design is to have a new uuid if the // script actually changed the asset. if(nc->hasEmbeddedInventory()) { gVFS->removeFile( content["new_asset"].asUUID(), LLAssetType::AT_NOTECARD); } nc->refreshFromInventory(); } } break; case LLInventoryType::IT_LSL: { // Find our window and close it if requested. LLPreviewLSL* preview = (LLPreviewLSL*)LLPreview::find(item_id); if (preview) { // Bytecode save completed if (content["compiled"]) { preview->callbackLSLCompileSucceeded(); } else { preview->callbackLSLCompileFailed(content["errors"]); } } } break; case LLInventoryType::IT_GESTURE: { // If this gesture is active, then we need to update the in-memory // active map with the new pointer. if (gGestureManager.isGestureActive(item_id)) { LLUUID asset_id = new_item->getAssetUUID(); gGestureManager.replaceGesture(item_id, asset_id); gInventory.notifyObservers(); } //gesture will have a new asset_id LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id); if(previewp) { previewp->onUpdateSucceeded(); } } break; case LLInventoryType::IT_WEARABLE: default: break; } }
BOOL JCLSLBridge::tick() { if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) { switch(sBridgeStatus) { case UNINITIALIZED: { /* We're going to just completely disable this in code, it's shit - CW if(!gSavedSettings.getBOOL("Meta7BuildBridge")) { */ sBridgeStatus = FAILED; break; //} //cmdline_printchat("initializing");//<< llendl; LLUUID item_id = findInventoryByName(vBridgeName); if(gInventory.isEverythingFetched())// || (item_id.notNull() && isworn(item_id))) { //cmdline_printchat("inv is fetched");//<< llendl; if(item_id.notNull()) { //cmdline_printchat("id="+item_id.asString()); LLViewerInventoryItem* bridge = gInventory.getItem(item_id); if(bridge) { //cmdline_printchat("bridge is ready to attach");//<< llendl; if(isworn(bridge->getUUID())) { //cmdline_printchat("bridge is already worn");//<< llendl; sBridgeStatus = RECHAN; }else if(bridge->isComplete()) { //cmdline_printchat("bridge is complete, attaching");//<< llendl; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addUUIDFast(_PREHASH_ItemID, bridge->getUUID()); msg->addUUIDFast(_PREHASH_OwnerID, bridge->getPermissions().getOwner()); msg->addU8Fast(_PREHASH_AttachmentPt, 128); pack_permissions_slam(msg, bridge->getFlags(), bridge->getPermissions()); msg->addStringFast(_PREHASH_Name, bridge->getName()); msg->addStringFast(_PREHASH_Description, bridge->getDescription()); msg->sendReliable(gAgent.getRegionHost()); sBridgeStatus = RECHAN; } } }else { //cmdline_printchat("no bridge");//<< llendl; //sBridgeStatus = BUILDING; std::string directory = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"bridge.xml"); if(!LLFile::isfile(directory.c_str())) { //cmdline_printchat("file not there o.o");//<< llendl; sBridgeStatus = FAILED; }else { //cmdline_printchat("bridge.xml located. importing..");//<< llendl; gImportTracker.importer(directory,&setBridgeObject); sBridgeStatus = BUILDING; } } } } break; case RENAMING: { ////cmdline_printchat("renaming"); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectAttach); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU8Fast(_PREHASH_AttachmentPoint, vCatType); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, sBridgeObject->getLocalID()); msg->addQuatFast(_PREHASH_Rotation, LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f)); msg->sendReliable(gAgent.getRegion()->getHost()); sBridgeStatus = FOLDERING; } break; case FOLDERING: { ////cmdline_printchat("foldering"); LLUUID vcatid; vcatid = gInventory.findCategoryByName(vBridgeOpCat); if(vcatid.isNull()) { ////cmdline_printchat("creating folder"); vcatid = gInventory.createNewCategory(gAgent.getInventoryRootID(), LLAssetType::AT_NONE, vBridgeOpCat); } LLUUID bridge_id = findInventoryByName(vBridgeName); //cmdline_printchat("id="+bridge_id.asString()); LLViewerInventoryItem* bridge = gInventory.getItem(bridge_id); if(bridge) { move_inventory_item(gAgent.getID(),gAgent.getSessionID(),bridge->getUUID(),vcatid,vBridgeName, NULL); sBridgeStatus = RECHAN; ////cmdline_printchat("moving to folder"); } } break; case RECHAN: { { //if(l2c == 0) is this really needed ._. //{ send_chat_from_viewer("-1|l2c", CHAT_TYPE_WHISPER, JCLSLBridge::bridge_channel(gAgent.getID())); sBridgeStatus = ACTIVE; //} } } case ACTIVE: { LLUUID bridge = findInventoryByName(vBridgeName); //if(bridge) //LLVOAvatar* avatar = gAgent.getAvatarObject(); if(bridge.isNull() || !isworn(bridge)) { l2c = 0; l2c_inuse = false; ////cmdline_printchat("reattaching"); sBridgeStatus = UNINITIALIZED; } } } } return FALSE; }
void LLAttachmentsMgr::onIdle() { S32 obj_count = mPendingAttachments.size(); if (obj_count == 0) { return; } // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; const S32 OBJECTS_PER_PACKET = 4; const S32 MAX_OBJECTS_TO_SEND = MAX_PACKETS_TO_SEND * OBJECTS_PER_PACKET; if( obj_count > MAX_OBJECTS_TO_SEND ) { obj_count = MAX_OBJECTS_TO_SEND; } LLUUID compound_msg_id; compound_msg_id.generate(); LLMessageSystem* msg = gMessageSystem; S32 i = 0; for (attachments_vec_t::const_iterator iter = mPendingAttachments.begin(); iter != mPendingAttachments.end(); ++iter) { if( 0 == (i % OBJECTS_PER_PACKET) ) { // Start a new message chunk msg->newMessageFast(_PREHASH_RezMultipleAttachmentsFromInv); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id ); msg->addU8Fast(_PREHASH_TotalObjects, obj_count ); msg->addBOOLFast(_PREHASH_FirstDetachAll, false ); } const AttachmentsInfo &attachment = (*iter); LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID); if (!item) { llinfos << "Attempted to add non-existant item ID:" << attachment.mItemID << llendl; continue; } S32 attachment_pt = attachment.mAttachmentPt; if (attachment.mAdd) attachment_pt |= ATTACHMENT_ADD; msg->nextBlockFast(_PREHASH_ObjectData ); msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt); pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); msg->addStringFast(_PREHASH_Name, item->getName()); msg->addStringFast(_PREHASH_Description, item->getDescription()); if( (i+1 == obj_count) || ((OBJECTS_PER_PACKET-1) == (i % OBJECTS_PER_PACKET)) ) { // End of message chunk msg->sendReliable( gAgent.getRegion()->getHost() ); } i++; } mPendingAttachments.clear(); }
// Checked: 2010-09-18 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a void RlvForceWear::done() { // Sanity check - don't go through all the motions below only to find out there's nothing to actually do if ( (m_remWearables.empty()) && (m_remAttachments.empty()) && (m_remGestures.empty()) && (m_addWearables.empty()) && (m_addAttachments.empty()) && (m_addGestures.empty()) ) { return; } // // Process removals // // Wearables if (m_remWearables.size()) { for (std::list<const LLWearable*>::const_iterator itWearable = m_remWearables.begin(); itWearable != m_remWearables.end(); ++itWearable) gAgent.removeWearable((*itWearable)->getType()); m_remWearables.clear(); } // Gestures if (m_remGestures.size()) { for (S32 idxGesture = 0, cntGesture = m_remGestures.count(); idxGesture < cntGesture; idxGesture++) { LLViewerInventoryItem* pItem = m_remGestures.get(idxGesture); gGestureManager.deactivateGesture(pItem->getUUID()); gInventory.updateItem(pItem); gInventory.notifyObservers(); } m_remGestures.clear(); } // Attachments if (m_remAttachments.size()) { // Don't bother with COF if all we're doing is detaching some attachments (keeps people from rebaking on every @remattach=force) gMessageSystem->newMessage("ObjectDetach"); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); for (std::list<const LLViewerObject*>::const_iterator itAttachObj = m_remAttachments.begin(); itAttachObj != m_remAttachments.end(); ++itAttachObj) { gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, (*itAttachObj)->getLocalID()); } gMessageSystem->sendReliable(gAgent.getRegionHost()); m_remAttachments.clear(); } // // Process additions // // Process wearables if (m_addWearables.size()) { // [See wear_inventory_category_on_avatar_step2()] LLWearableHoldingPattern* pWearData = new LLWearableHoldingPattern(TRUE); // We need to populate 'pWearData->mFoundList' before doing anything else because (some of) the assets might already be available for (addwearables_map_t::const_iterator itAddWearables = m_addWearables.begin(); itAddWearables != m_addWearables.end(); ++itAddWearables) { const LLInventoryModel::item_array_t& wearItems = itAddWearables->second; RLV_VERIFY(1 == wearItems.count()); if (wearItems.count() > 0) { LLViewerInventoryItem* pItem = wearItems.get(0); if ( (pItem) && ((LLAssetType::AT_BODYPART == pItem->getType()) || (LLAssetType::AT_CLOTHING == pItem->getType())) ) { LLFoundData* pFound = new LLFoundData(pItem->getUUID(), pItem->getAssetUUID(), pItem->getName(), pItem->getType()); pWearData->mFoundList.push_front(pFound); } } } if (!pWearData->mFoundList.size()) { delete pWearData; return; } // If all the assets are available locally then "pWearData" will be freed *before* the last "gWearableList.getAsset()" call returns bool fContinue = true; LLWearableHoldingPattern::found_list_t::const_iterator itWearable = pWearData->mFoundList.begin(); while ( (fContinue) && (itWearable != pWearData->mFoundList.end()) ) { const LLFoundData* pFound = *itWearable; ++itWearable; fContinue = (itWearable != pWearData->mFoundList.end()); gWearableList.getAsset(pFound->mAssetID, pFound->mName, pFound->mAssetType, wear_inventory_category_on_avatar_loop, (void*)pWearData); } m_addWearables.clear(); } // Until LL provides a way for updateCOF to selectively attach add/replace we have to deal with attachments ourselves for (addattachments_map_t::const_iterator itAddAttachments = m_addAttachments.begin(); itAddAttachments != m_addAttachments.end(); ++itAddAttachments) { const LLInventoryModel::item_array_t& wearItems = itAddAttachments->second; for (S32 idxItem = 0, cntItem = wearItems.count(); idxItem < cntItem; idxItem++) { const LLUUID& idItem = wearItems.get(idxItem)->getLinkedUUID(); // if (gAgentAvatarp->attachmentWasRequested(idItem)) // continue; // gAgentAvatarp->addAttachmentRequest(idItem); LLAttachmentsMgr::instance().addAttachment(idItem, itAddAttachments->first & ~ATTACHMENT_ADD, itAddAttachments->first & ATTACHMENT_ADD); } } m_addAttachments.clear(); // Process gestures if (m_addGestures.size()) { gGestureManager.activateGestures(m_addGestures); for (S32 idxGesture = 0, cntGesture = m_addGestures.count(); idxGesture < cntGesture; idxGesture++) gInventory.updateItem(m_addGestures.get(idxGesture)); gInventory.notifyObservers(); m_addGestures.clear(); } // Since RlvForceWear is a singleton now we want to be sure there aren't any leftovers RLV_ASSERT( (m_remWearables.empty()) && (m_remAttachments.empty()) && (m_remGestures.empty()) ); RLV_ASSERT( (m_addWearables.empty()) && (m_addAttachments.empty()) && (m_addGestures.empty()) ); }
// Checked: 2010-03-14 (RLVa-1.1.3a) | Added: RLVa-1.2.0a void RlvRenameOnWearObserver::doneIdle() { const LLViewerInventoryCategory* pRlvRoot = NULL; LLVOAvatar* pAvatar = gAgentAvatarp; if ( (RlvSettings::getEnableSharedWear()) || (!RlvSettings::getSharedInvAutoRename()) || (LLStartUp::getStartupState() < STATE_STARTED) || (!pAvatar) || ((pRlvRoot = RlvInventory::instance().getSharedRoot()) == NULL) ) { delete this; return; } const LLViewerJointAttachment* pAttachPt = NULL; S32 idxAttachPt = 0; // RLV_ASSERT(mComplete.size() > 0); // Catch instances where we forgot to call startFetch() for (uuid_vec_t::const_iterator itItem = mComplete.begin(); itItem != mComplete.end(); ++itItem) { const LLUUID& idAttachItem = *itItem; // If the item resides under #RLV we'll rename it directly; otherwise settle for "renaming" all of its links residing under #RLV LLInventoryModel::item_array_t items; if (gInventory.isObjectDescendentOf(idAttachItem, pRlvRoot->getUUID())) items.push_back(gInventory.getItem(idAttachItem)); else items = gInventory.collectLinkedItems(idAttachItem, pRlvRoot->getUUID()); if (items.empty()) continue; if ( ((pAttachPt = pAvatar->getWornAttachmentPoint(idAttachItem)) == NULL) || ((idxAttachPt = RlvAttachPtLookup::getAttachPointIndex(pAttachPt)) == 0) ) { // RLV_ASSERT(false); continue; } static const std::string &new_category_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_NONE); for (S32 idxItem = 0, cntItem = items.count(); idxItem < cntItem; idxItem++) { LLViewerInventoryItem* pItem = items.get(idxItem); if (!pItem) continue; S32 idxAttachPtItem = RlvAttachPtLookup::getAttachPointIndex(pItem); if ( (idxAttachPt == idxAttachPtItem) || (idxAttachPtItem) ) continue; std::string strAttachPt = pAttachPt->getName(); LLStringUtil::toLower(strAttachPt); // If we can modify the item then we rename it directly, otherwise we create a new folder and move it if (pItem->getPermissions().allowModifyBy(gAgent.getID())) { std::string strName = pItem->getName(); LLStringUtil::truncate(strName, DB_INV_ITEM_NAME_STR_LEN - strAttachPt.length() - 3); strName += " (" + strAttachPt + ")"; pItem->rename(strName); pItem->updateServer(FALSE); gInventory.addChangedMask(LLInventoryObserver::LABEL, pItem->getUUID()); } else { // Don't do anything if the item is a direct descendant of the shared root, or a folded folder LLViewerInventoryCategory* pFolder = gInventory.getCategory(pItem->getParentUUID()); if ( (pFolder) && (pFolder->getUUID() != pRlvRoot->getUUID()) && (!RlvInventory::isFoldedFolder(pFolder, false)) ) { std::string strFolderName = ".(" + strAttachPt + ")"; // Rename the item's parent folder if it's called "New Folder", isn't directly under #RLV and contains exactly 1 object if ( (new_category_name == pFolder->getName()) && (pFolder->getParentUUID() != pRlvRoot->getUUID()) && (1 == RlvInventory::getDirectDescendentsCount(pFolder, LLAssetType::AT_OBJECT)) ) { pFolder->rename(strFolderName); pFolder->updateServer(FALSE); gInventory.addChangedMask(LLInventoryObserver::LABEL, pFolder->getUUID()); } else { // "No modify" item with a non-renameable parent: create a new folder named and move the item into it LLUUID idAttachFolder = gInventory.createNewCategory(pFolder->getUUID(), LLFolderType::FT_NONE, strFolderName); move_inventory_item(gAgent.getID(), gAgent.getSessionID(), pItem->getUUID(), idAttachFolder, std::string(), NULL); } } } } } gInventory.notifyObservers(); delete this; }
//LLScrollListCtrl::getSelectedIDs(); void JCFloaterAnimList::refresh() { LLDynamicArray<LLUUID> selected = mAnimList->getSelectedIDs(); S32 scrollpos = mAnimList->getScrollPos(); mAnimList->deleteAllItems(); LLVOAvatar* avatarp = gAgent.getAvatarObject(); if (avatarp) { LLVOAvatar::AnimSourceIterator ai; for(ai = avatarp->mAnimationSources.begin(); ai != avatarp->mAnimationSources.end(); ++ai) { LLSD element; const LLUUID &aifirst = ai->first; LLViewerInventoryItem* item = gInventory.getItem(findItemID(ai->second,0)); // *NOTE: conceal id to prevent bugs, use // item->getColumn(LIST_ANIMATION_UUID)->getValue().asUUID() // instead element["id"] = LLUUID::null.combine(ai->second); element["columns"][LIST_ANIMATION_NAME]["column"] = "Anim Name"; element["columns"][LIST_ANIMATION_NAME]["type"] = "text"; element["columns"][LIST_ANIMATION_NAME]["color"] = gColors.getColor("DefaultListText").getValue(); if(item) { element["columns"][LIST_ANIMATION_NAME]["value"] = item->getName();//ai->second//"avatar_icon"; }else { element["columns"][LIST_ANIMATION_NAME]["value"] = "Not in Inventory"; } element["columns"][LIST_ANIMATION_UUID]["column"] = "Animation UUID"; element["columns"][LIST_ANIMATION_UUID]["type"] = "text"; element["columns"][LIST_ANIMATION_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); element["columns"][LIST_ANIMATION_UUID]["value"] = ai->second; element["columns"][LIST_OBJECT_UUID]["column"] = "Source Object UUID"; element["columns"][LIST_OBJECT_UUID]["type"] = "text"; element["columns"][LIST_OBJECT_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); element["columns"][LIST_OBJECT_UUID]["value"] = aifirst; element["columns"][LIST_OBJECT_OWNER]["column"] = "Source Owner"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; element["columns"][LIST_OBJECT_OWNER]["color"] = gColors.getColor("DefaultListText").getValue(); std::string name("?"); LLViewerObject *object = gObjectList.findObject(aifirst); bool is_first = ( mObjectOwners.count( aifirst ) == 0 ); bool just_shown = false; LLUUID owner_id(LLUUID::null); if( !is_first ) { name = mObjectOwners[aifirst].owner_name; owner_id = mObjectOwners[aifirst].owner_id; } if( object ) { if( object->permYouOwner() ) { owner_id = gAgent.getID(); gAgent.getName(name); } else { object = (LLViewerObject *) object->getRoot(); if( object->isAvatar() ) { owner_id = object->getID(); name = ((LLVOAvatar *)object)->getFullname(); } } } { AObjectData &data = mObjectOwners[aifirst]; if( object ) { if( !data.in_object_list ) { just_shown = true; data.in_object_list = true; } data.root_id = ( (LLViewerObject*)object->getRoot() )->getID(); } data.owner_name = name; data.owner_id = owner_id; } if( is_first || just_shown ) { if( name == "?" && !aifirst.isNull()) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_RequestFlags, 0 ); if( object ) { LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " ) on object( " << object->getID().asString() << " )" << LL_ENDL; msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); } else { LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " )" << LL_ENDL; msg->addUUIDFast(_PREHASH_ObjectID, aifirst); } gAgent.sendReliableMessage(); } } element["columns"][LIST_OBJECT_OWNER]["value"] = name; mAnimList->addElement(element, ADD_BOTTOM); //LLViewerObject* objectp = gObjectList.findObject(ai->first); //if(objectp) //{ // //objectp-> //} //object_ids.insert(ai->first); //animation_ids.insert(ai->second); } } mAnimList->sortItems(); mAnimList->selectMultiple(selected); mAnimList->setScrollPos(scrollpos); }
void FSLSLBridge::processAttach(LLViewerObject* object, const LLViewerJointAttachment* attachment) { llinfos << "Entering processAttach, checking the bridge container - gInventory.isInventoryUsable=" << gInventory.isInventoryUsable()<< llendl; if ((!gAgentAvatarp->isSelf()) || (attachment->getName() != "Bridge")) { llwarns << "Bridge not created. Our bridge container attachment isn't named correctly." << llendl; if (mBridgeCreating) { reportToNearbyChat(LLTrans::getString("fsbridge_failure_creation_bad_name")); mBridgeCreating = false; //in case we interrupted the creation } return; } LLViewerInventoryItem* fsObject = gInventory.getItem(object->getAttachmentItemID()); if (fsObject == NULL) //just in case { llwarns << "Bridge container is still NULL in inventory. Aborting." << llendl; if (mBridgeCreating) { reportToNearbyChat(LLTrans::getString("fsbridge_failure_creation_null")); mBridgeCreating = false; //in case we interrupted the creation } return; } if (mpBridge == NULL) //user is attaching an existing bridge? { //is it the right version? if (fsObject->getName() != mCurrentFullName) { LLVOAvatarSelf::detachAttachmentIntoInventory(fsObject->getUUID()); llwarns << "Attempt to attach to bridge point an object other than current bridge" << llendl; reportToNearbyChat(LLTrans::getString("fsbridge_failure_attach_wrong_object")); if (mBridgeCreating) { mBridgeCreating = false; //in case we interrupted the creation } return; } //is it in the right place? LLUUID catID = findFSCategory(); if (catID != fsObject->getParentUUID()) { //the object is not where we think it is. Kick it off. LLVOAvatarSelf::detachAttachmentIntoInventory(fsObject->getUUID()); llwarns << "Bridge container isn't in the correct inventory location. Detaching it and aborting." << llendl; if (mBridgeCreating) { reportToNearbyChat(LLTrans::getString("fs_bridge_failure_attach_wrong_location")); mBridgeCreating = false; //in case we interrupted the creation } return; } mpBridge = fsObject; } lldebugs << "Bridge container is attached, mpBridge not NULL, avatar is self, point is bridge, all is good." << llendl; if (fsObject->getUUID() != mpBridge->getUUID()) { //something odd just got attached to bridge? llwarns << "Something unknown just got attached to bridge point, detaching and aborting." << llendl; if (mBridgeCreating) { reportToNearbyChat(LLTrans::getString("fsbridge_failure_attach_point_in_use")); mBridgeCreating = false; //in case we interrupted the creation } LLVOAvatarSelf::detachAttachmentIntoInventory(mpBridge->getUUID()); return; } lldebugs << "Bridge container found is the same bridge we saved, id matched." << llendl; if (!mBridgeCreating) //just an attach. See what it is { // AH: We need to request objects inventory first before we can // do anything with it! llinfos << "Requesting bridge inventory contents..." << llendl; object->registerInventoryListener(this, NULL); object->requestInventory(); } else { configureBridgePrim(object); } }
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); } } }
void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id) { const LLUUID& base_in_item_id = get_linked_uuid(in_item_id); uuid_vec_t gest_item_ids; // Deactivate all gestures that match item_map_t::iterator it; for (it = mActive.begin(); it != mActive.end(); ) { const LLUUID& item_id = (*it).first; LLMultiGesture* gest = (*it).second; // Don't deactivate the gesture we are looking for duplicates of // (for replaceGesture) if (!gest || item_id == base_in_item_id) { // legal, can have null pointers in list ++it; } else if ((!gest->mTrigger.empty() && gest->mTrigger == in->mTrigger) || (gest->mKey != KEY_NONE && gest->mKey == in->mKey && gest->mMask == in->mMask)) { gest_item_ids.push_back(item_id); stopGesture(gest); delete gest; gest = NULL; mActive.erase(it++); gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); } else { ++it; } } // Inform database of the change LLMessageSystem* msg = gMessageSystem; BOOL start_message = TRUE; uuid_vec_t::const_iterator vit = gest_item_ids.begin(); while (vit != gest_item_ids.end()) { if (start_message) { msg->newMessage("DeactivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); start_message = FALSE; } msg->nextBlock("Data"); msg->addUUID("ItemID", *vit); msg->addU32("GestureFlags", 0x0); if (msg->getCurrentSendTotal() > MTUBYTES) { gAgent.sendReliableMessage(); start_message = TRUE; } ++vit; } if (!start_message) { gAgent.sendReliableMessage(); } // Add to the list of names for the user. for (vit = gest_item_ids.begin(); vit != gest_item_ids.end(); ++vit) { LLViewerInventoryItem* item = gInventory.getItem(*vit); if (!item) continue; mDeactivateSimilarNames.append(item->getName()); mDeactivateSimilarNames.append("\n"); } notifyObservers(); }
// static void LLGestureMgr::onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { LLLoadInfo* info = (LLLoadInfo*)user_data; LLUUID item_id = info->mItemID; BOOL inform_server = info->mInformServer; BOOL deactivate_similar = info->mDeactivateSimilar; delete info; info = NULL; LLGestureMgr& self = LLGestureMgr::instance(); self.mLoadingCount--; if (0 == status) { LLVFile file(vfs, asset_uuid, type, LLVFile::READ); S32 size = file.getSize(); char* buffer = new char[size+1]; if (buffer == NULL) { LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } file.read((U8*)buffer, size); /* Flawfinder: ignore */ // ensure there's a trailing NULL so strlen will work. buffer[size] = '\0'; LLMultiGesture* gesture = new LLMultiGesture(); LLDataPackerAsciiBuffer dp(buffer, size+1); BOOL ok = gesture->deserialize(dp); if (ok) { if (deactivate_similar) { self.deactivateSimilarGestures(gesture, item_id); // Display deactivation message if this was the last of the bunch. if (self.mLoadingCount == 0 && self.mDeactivateSimilarNames.length() > 0) { // we're done with this set of deactivations LLSD args; args["NAMES"] = self.mDeactivateSimilarNames; LLNotificationsUtil::add("DeactivatedGesturesTrigger", args); } } LLViewerInventoryItem* item = gInventory.getItem(item_id); if(item) { gesture->mName = item->getName(); } else { // Watch this item and set gesture name when item exists in inventory self.setFetchID(item_id); self.startFetch(); } self.mActive[item_id] = gesture; // Everything has been successful. Add to the active list. gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); if (inform_server) { // Inform the database of this change LLMessageSystem* msg = gMessageSystem; msg->newMessage("ActivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); msg->nextBlock("Data"); msg->addUUID("ItemID", item_id); msg->addUUID("AssetID", asset_uuid); msg->addU32("GestureFlags", 0x0); gAgent.sendReliableMessage(); } callback_map_t::iterator i_cb = self.mCallbackMap.find(item_id); if(i_cb != self.mCallbackMap.end()) { i_cb->second(gesture); self.mCallbackMap.erase(i_cb); } self.notifyObservers(); } else { LL_WARNS() << "Unable to load gesture" << LL_ENDL; self.mActive.erase(item_id); delete gesture; gesture = NULL; } delete [] buffer; buffer = NULL; } else { LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { LLDelayedGestureError::gestureMissing( item_id ); } else { LLDelayedGestureError::gestureFailedToLoad( item_id ); } LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL; LLGestureMgr::instance().mActive.erase(item_id); } }