void LLFloaterGesture::onCopyPasteAction(const LLSD& command) { std::string command_name = command.asString(); // since we select this comman inventory item had already arrived . if("copy_gesture" == command_name) { uuid_vec_t ids; getSelectedIds(ids); // make sure that clopboard is empty LLInventoryClipboard::instance().reset(); for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE) { LLInventoryClipboard::instance().add(item->getUUID()); } } } else if ("paste" == command_name) { LLInventoryClipboard& clipbord = LLInventoryClipboard::instance(); LLDynamicArray<LLUUID> ids; clipbord.retrieve(ids); if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID)) return; LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID); llassert(gesture_dir); LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this); for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE) { LLStringUtil::format_map_t string_args; string_args["[COPY_NAME]"] = item->getName(); LL_DEBUGS("Gesture")<< "Copying gesture " << item->getName() << " "<< item->getUUID() << " into " << gesture_dir->getName() << " "<< gesture_dir->getUUID() << LL_ENDL; copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), gesture_dir->getUUID(), getString("copy_name", string_args), cb); } } clipbord.reset(); } else if ("copy_uuid" == command_name) { gClipboard.copyFromString(utf8str_to_wstring(mGestureList->getCurrentID().asString()), mGestureList->getCurrentID()); } }
void LLFloaterGesture::onCopyPasteAction(const LLSD& command) { std::string command_name = command.asString(); // Since we select this command, the inventory items must have already arrived if("copy_gesture" == command_name) { uuid_vec_t ids; getSelectedIds(ids); // Make sure the clipboard is empty LLClipboard::instance().reset(); for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE) { LLClipboard::instance().addToClipboard(item->getUUID(),LLAssetType::AT_GESTURE); } } } else if ("paste" == command_name) { LLDynamicArray<LLUUID> ids; LLClipboard::instance().pasteFromClipboard(ids); if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID)) return; LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID); llassert(gesture_dir); LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(gesture_copied_cb, _1, this)); for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE) { LLStringUtil::format_map_t string_args; string_args["[COPY_NAME]"] = item->getName(); LL_DEBUGS("Gesture")<< "Copying gesture " << item->getName() << " "<< item->getUUID() << " into " << gesture_dir->getName() << " "<< gesture_dir->getUUID() << LL_ENDL; copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), gesture_dir->getUUID(), getString("copy_name", string_args), cb); } } LLClipboard::instance().reset(); } else if ("copy_uuid" == command_name) { LLClipboard::instance().copyToClipboard(mGestureList->getCurrentID(),LLAssetType::AT_GESTURE); } }
//static bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok) { LLSD args; LLInventoryItem *item = gInventory.getItem( ent.mItemID ); if ( item ) { args["NAME"] = item->getName(); } else { if ( uuid_ok || ent.mTimer.getElapsedTimeF32() > MAX_NAME_WAIT_TIME ) { args["NAME"] = ent.mItemID.asString(); } else { return false; } } LLNotificationsUtil::add(ent.mNotifyName, args); return true; }
//static bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok) { LLStringUtil::format_map_t args; LLInventoryItem *item = gInventory.getItem( ent.mItemID ); if ( item ) { args["[NAME]"] = item->getName(); } else { if ( uuid_ok || ent.mTimer.getElapsedTimeF32() > MAX_NAME_WAIT_TIME ) { args["[NAME]"] = std::string( ent.mItemID.asString() ); } else { return false; } } LLNotifyBox::showXml(ent.mNotifyName, args); return true; }
void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const { if( sEntries.empty() ) { return; } for (std::set<llwchar>::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) { llwchar wch = *iter1; item_map_t::iterator iter2 = sEntries.find(wch); if (iter2 == sEntries.end()) { continue; } LLInventoryItem* item = iter2->second.mItem; if (!item) { continue; } LLUIImagePtr image = get_item_icon(item->getType(), item->getInventoryType(), 0, item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS);//LLUI::getUIImage(img_name); font->addEmbeddedChar( wch, image->getImage(), item->getName() ); } }
void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, InventoryObjectList* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. typedef std::multimap<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map; uuid_item_map asset_item_map; InventoryObjectList::const_iterator it = inv->begin(); InventoryObjectList::const_iterator end = inv->end(); for ( ; it != end; ++it) { if((*it)->getType() == LLAssetType::AT_LSL_TEXT) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); // Check permissions before allowing the user to retrieve data. if (item->getPermissions().allowModifyBy(gAgent.getID(), gAgent.getGroupID()) && item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) ) { LLPointer<LLViewerInventoryItem> script = new LLViewerInventoryItem(item); mCurrentScripts.put(script); asset_item_map.insert(std::make_pair(item->getAssetUUID(), item)); } } } if (asset_item_map.empty()) { // There are no scripts in this object. move on. nextObject(); } else { // request all of the assets. uuid_item_map::iterator iter; for(iter = asset_item_map.begin(); iter != asset_item_map.end(); iter++) { LLInventoryItem *itemp = iter->second; LLScriptQueueData* datap = new LLScriptQueueData(getID(), itemp->getName(), viewer_object->getID(), itemp->getUUID()); //llinfos << "ITEM NAME 2: " << names.get(i) << llendl; gAssetStorage->getInvItemAsset(viewer_object->getRegion()->getHost(), gAgent.getID(), gAgent.getSessionID(), itemp->getPermissions().getOwner(), viewer_object->getID(), itemp->getUUID(), itemp->getAssetUUID(), itemp->getType(), LLFloaterCompileQueue::scriptArrived, (void*)datap); } } }
void LLWearable::refreshName() { LLUUID item_id = getItemID(); LLInventoryItem* item = gInventory.getItem(item_id); if( item ) { mName = item->getName(); } }
void LLViewerWearable::refreshNameAndDescription() { LLUUID item_id = getItemID(); LLInventoryItem* item = gInventory.getItem(item_id); if( item ) { mName = item->getName(); mDescription = item->getDescription(); } }
// TODO: Sort the legacy and non-legacy together? void LLPreviewGesture::addAnimations() { LLComboBox* combo = mAnimationCombo; combo->removeall(); std::string none_text = getString("none_text"); combo->add(none_text, LLUUID::null); // Add all the default (legacy) animations S32 i; for (i = 0; i < gUserAnimStatesCount; ++i) { // Use the user-readable name std::string label = LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ); const LLUUID& id = gUserAnimStates[i].mID; combo->add(label, id); } // Get all inventory items that are animations LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION, PERM_ITEM_UNRESTRICTED, gAgent.getID(), gAgent.getGroupID()); gInventory.collectDescendentsIf(gInventory.getRootFolderID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_copyable_animation); // Copy into something we can sort std::vector<LLInventoryItem*> animations; S32 count = items.count(); for(i = 0; i < count; ++i) { animations.push_back( items.get(i) ); } // Do the sort std::sort(animations.begin(), animations.end(), SortItemPtrsByName()); // And load up the combobox std::vector<LLInventoryItem*>::iterator it; for (it = animations.begin(); it != animations.end(); ++it) { LLInventoryItem* item = *it; combo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM); } }
// override void fire(const LLUUID& inv_item) { if(!mTextEditor) { // The parent text editor may have vanished by now. // In that case just quit. return; } LLInventoryItem* item = gInventory.getItem(inv_item); if(!item) { LL_WARNS() << "Item add reported, but not found in inventory!: " << inv_item << LL_ENDL; } else { // [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE)) { RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_NOTECARD); return; } // [/RLVa:KB] // See if we can bring an existing preview to the front if(!LLPreview::show(item->getUUID(), true)) { if (gSavedSettings.getBOOL("ShowNewInventory")) // Singu Note: ShowNewInventory is true, not false, when they want a preview { // There isn't one, so make a new preview S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("NotecardEditorRect"); rect.translate(left - rect.mLeft, top - rect.mTop); LLPreviewNotecard* preview; preview = new LLPreviewNotecard("preview notecard", rect, std::string("Embedded Note: ") + item->getName(), item->getUUID(), LLUUID::null, item->getAssetUUID(), true, (LLViewerInventoryItem*)item); preview->setSourceID(LLUUID::null); preview->setFocus(TRUE); // Force to be entirely onscreen. gFloaterView->adjustToFitScreen(preview, FALSE); } } } }
void LLFloaterWorldMap::buildLandmarkIDLists() { LLCtrlListInterface *list = childGetListInterface("landmark combo"); if (!list) { return; } // Delete all but the "None" entry S32 list_size = list->getItemCount(); if (list_size > 1) { list->selectItemRange(1, -1); list->operateOnSelection(LLCtrlListInterface::OP_DELETE); } mLandmarkItemIDList.reset(); mLandmarkAssetIDList.reset(); // Get all of the current landmarks mLandmarkAssetIDList.put( LLUUID::null ); mLandmarkItemIDList.put( LLUUID::null ); mLandmarkAssetIDList.put( sHomeID ); mLandmarkItemIDList.put( sHomeID ); LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLIsType is_landmark(LLAssetType::AT_LANDMARK); gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_landmark); std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers()); S32 count = items.count(); for(S32 i = 0; i < count; ++i) { LLInventoryItem* item = items.get(i); list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID()); mLandmarkAssetIDList.put( item->getAssetUUID() ); mLandmarkItemIDList.put( item->getUUID() ); } list->sortByColumn(std::string("landmark name"), TRUE); list->selectFirstItem(); }
BOOL LLViewerTextEditor::getEmbeddedItemToolTipAtPos(S32 pos, LLWString &msg) const { if (pos < getLength()) { LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem(getWChar(pos)); if( item ) { msg = utf8str_to_wstring(item->getName()); msg += '\n'; msg += utf8str_to_wstring(item->getDescription()); return TRUE; } } return FALSE; }
// override void fire(const LLUUID& inv_item) { if(!mTextEditor) { // The parent text editor may have vanished by now. // In that case just quit. return; } LLInventoryItem* item = gInventory.getItem(inv_item); if(!item) { llwarns << "Item add reported, but not found in inventory!: " << inv_item << llendl; } else { // See if we can bring an existing preview to the front if(!LLPreview::show(item->getUUID(), true)) { if(!gSavedSettings.getBOOL("ShowNewInventory")) { // There isn't one, so make a new preview S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("NotecardEditorRect"); rect.translate(left - rect.mLeft, top - rect.mTop); LLPreviewNotecard* preview; preview = new LLPreviewNotecard("preview notecard", rect, std::string("Embedded Note: ") + item->getName(), item->getUUID(), LLUUID::null, item->getAssetUUID(), true, (LLViewerInventoryItem*)item); preview->setSourceID(LLUUID::null); preview->setFocus(TRUE); // Force to be entirely onscreen. gFloaterView->adjustToFitScreen(preview, FALSE); } } } }
void LLPreviewGesture::addSounds() { LLComboBox* combo = mSoundCombo; combo->removeall(); std::string none_text = getString("none_text"); combo->add(none_text, LLUUID::null); // Get all inventory items that are sounds LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLIsTypeWithPermissions is_copyable_sound(LLAssetType::AT_SOUND, PERM_ITEM_UNRESTRICTED, gAgent.getID(), gAgent.getGroupID()); gInventory.collectDescendentsIf(gInventory.getRootFolderID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_copyable_sound); // Copy sounds into something we can sort std::vector<LLInventoryItem*> sounds; S32 i; S32 count = items.count(); for(i = 0; i < count; ++i) { sounds.push_back( items.get(i) ); } // Do the sort std::sort(sounds.begin(), sounds.end(), SortItemPtrsByName()); // And load up the combobox std::vector<LLInventoryItem*>::iterator it; for (it = sounds.begin(); it != sounds.end(); ++it) { LLInventoryItem* item = *it; combo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM); } }
void LLFloaterAO::addAnimations() { mAnimListCombo->removeall(); std::string none_text = getString("none_text"); mAnimListCombo->add(none_text, LLUUID::null); // Add all the default (legacy) animations S32 i; // Get all inventory items that are animations LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION, PERM_NONE, gAgent.getID(), gAgent.getGroupID()); gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_copyable_animation); // Copy into something we can sort std::vector<LLInventoryItem*> animations; S32 count = items.count(); for(i = 0; i < count; ++i) { animations.push_back( items.get(i) ); } // Do the sort std::sort(animations.begin(), animations.end(), SortItemPtrsByName()); // And load up the combobox std::vector<LLInventoryItem*>::iterator it; for (it = animations.begin(); it != animations.end(); ++it) { LLInventoryItem* item = *it; mAnimListCombo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM); } }
// static void LLFloaterGesture::onClickEdit(void* data) { LLFloaterGesture* self = (LLFloaterGesture*)data; LLCtrlListInterface *list = self->childGetListInterface("gesture_list"); if (!list) return; const LLUUID& item_id = list->getCurrentID(); LLInventoryItem* item = gInventory.getItem(item_id); if (!item) return; std::string title("Gesture: "); title.append(item->getName()); LLPreviewGesture* previewp = LLPreviewGesture::show(title, item_id, LLUUID::null); if (!previewp->getHost()) { previewp->setRect(gFloaterView->findNeighboringPosition(self, previewp)); } }
void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. LLDynamicArray<const char*> names; InventoryObjectList::const_iterator it = inv->begin(); InventoryObjectList::const_iterator end = inv->end(); for ( ; it != end; ++it) { if((*it)->getType() == LLAssetType::AT_LSL_TEXT) { LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); std::string buffer; buffer = std::string("Not running: ") +item->getName(); // *TODO: Translate list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_SetScriptRunning); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Script); msg->addUUIDFast(_PREHASH_ObjectID, viewer_obj->getID()); msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID()); msg->addBOOLFast(_PREHASH_Running, FALSE); msg->sendReliable(object->getRegion()->getHost()); } } } nextObject(); }
void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv) { LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) { LLAssetType::EType asstype = (*it)->getType(); if( ( asstype == LLAssetType::AT_ANIMATION && gSavedSettings.getBOOL("BulkChangeIncludeAnimations")) || ( asstype == LLAssetType::AT_BODYPART && gSavedSettings.getBOOL("BulkChangeIncludeBodyParts" )) || ( asstype == LLAssetType::AT_CLOTHING && gSavedSettings.getBOOL("BulkChangeIncludeClothing" )) || ( asstype == LLAssetType::AT_GESTURE && gSavedSettings.getBOOL("BulkChangeIncludeGestures" )) || ( asstype == LLAssetType::AT_LANDMARK && gSavedSettings.getBOOL("BulkChangeIncludeLandmarks" )) || ( asstype == LLAssetType::AT_NOTECARD && gSavedSettings.getBOOL("BulkChangeIncludeNotecards" )) || ( asstype == LLAssetType::AT_OBJECT && gSavedSettings.getBOOL("BulkChangeIncludeObjects" )) || ( asstype == LLAssetType::AT_LSL_TEXT && gSavedSettings.getBOOL("BulkChangeIncludeScripts" )) || ( asstype == LLAssetType::AT_SOUND && gSavedSettings.getBOOL("BulkChangeIncludeSounds" )) || ( asstype == LLAssetType::AT_TEXTURE && gSavedSettings.getBOOL("BulkChangeIncludeTextures" ))) { LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)item; LLPermissions perm(new_item->getPermissions()); U32 flags = new_item->getFlags(); U32 desired_next_owner_perms = LLFloaterPerms::getNextOwnerPerms("BulkChange"); U32 desired_everyone_perms = LLFloaterPerms::getEveryonePerms("BulkChange"); U32 desired_group_perms = LLFloaterPerms::getGroupPerms("BulkChange"); // If next owner permissions have changed (and this is an object) // then set the slam permissions flag so that they are applied on rez. if((perm.getMaskNextOwner() != desired_next_owner_perms) && (new_item->getType() == LLAssetType::AT_OBJECT)) { flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM; } // If everyone permissions have changed (and this is an object) // then set the overwrite everyone permissions flag so they // are applied on rez. if ((perm.getMaskEveryone() != desired_everyone_perms) && (new_item->getType() == LLAssetType::AT_OBJECT)) { flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; } // If group permissions have changed (and this is an object) // then set the overwrite group permissions flag so they // are applied on rez. if ((perm.getMaskGroup() != desired_group_perms) && (new_item->getType() == LLAssetType::AT_OBJECT)) { flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } // chomp the inventory name so it fits in the scroll window nicely // and the user can see the [OK] std::string invname; invname=item->getName().substr(0,item->getName().size() < 30 ? item->getName().size() : 30 ); LLUIString status_text = getString("status_text"); status_text.setArg("[NAME]", invname.c_str()); // Check whether we appear to have the appropriate permissions to change permission on this item. // Although the server will disallow any forbidden changes, it is a good idea to guess correctly // so that we can warn the user. The risk of getting this check wrong is therefore the possibility // of incorrectly choosing to not attempt to make a valid change. // // Trouble is this is extremely difficult to do and even when we know the results // it is difficult to design the best messaging. Therefore in this initial implementation // we'll always try to set the requested permissions and consider all cases successful // and perhaps later try to implement a smarter, friendlier solution. -MG if(true //gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) // for group and everyone masks //|| something else // for next owner perms ) { perm.setMaskNext(desired_next_owner_perms); perm.setMaskEveryone(desired_everyone_perms); perm.setMaskGroup(desired_group_perms); new_item->setPermissions(perm); // here's the beef new_item->setFlags(flags); // and the tofu updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE); //status_text.setArg("[STATUS]", getString("status_ok_text")); status_text.setArg("[STATUS]", ""); } else { //status_text.setArg("[STATUS]", getString("status_bad_text")); status_text.setArg("[STATUS]", ""); } list->addSimpleElement(status_text.getString()); //TODO if we are an object inside an object we should check a recuse flag and if set //open the inventory of the object and recurse - Michelle2 Zenovka // if(recurse && ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject)) // { // I think we need to get the UUID of the object inside the inventory // call item->fetchFromServer(); // we need a call back to say item has arrived *sigh* // we then need to do something like // LLUUID* id = new LLUUID(mID); // registerVOInventoryListener(obj,id); // requestVOInventory(); // } } } } nextObject(); }
void LLFloaterWorldMap::buildLandmarkIDLists() { LLCtrlListInterface *list = mListLandmarkCombo; if (!list) return; // Delete all but the "None" entry S32 list_size = list->getItemCount(); if (list_size > 1) { list->selectItemRange(1, -1); list->operateOnSelection(LLCtrlListInterface::OP_DELETE); } mLandmarkItemIDList.reset(); mLandmarkAssetIDList.reset(); // Get all of the current landmarks mLandmarkAssetIDList.put( LLUUID::null ); mLandmarkItemIDList.put( LLUUID::null ); mLandmarkAssetIDList.put( sHomeID ); mLandmarkItemIDList.put( sHomeID ); LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLIsType is_landmark(LLAssetType::AT_LANDMARK); gInventory.collectDescendentsIf(gInventory.getRootFolderID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_landmark); std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers()); std::list<LLInventoryItem*> usedLMs; BOOL filterLandmarks = gSavedSettings.getBOOL("WorldmapFilterDuplicateLandmarks"); S32 count = items.count(); for(S32 i = 0; i < count; ++i) { LLInventoryItem* item = items.get(i); if (filterLandmarks) { bool skip = false; for (std::list<LLInventoryItem*>::iterator it = usedLMs.begin(); it != usedLMs.end(); ++it) { if ((*it)->getAssetUUID() == item->getAssetUUID()) { skip = true; break; } } if (skip) continue; usedLMs.push_front(item); } list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID()); mLandmarkAssetIDList.put( item->getAssetUUID() ); mLandmarkItemIDList.put( item->getUUID() ); } list->selectFirstItem(); }
void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const { if( sEntries.empty() ) { return; } for (std::set<llwchar>::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) { llwchar wch = *iter1; item_map_t::iterator iter2 = sEntries.find(wch); if (iter2 == sEntries.end()) { continue; } LLInventoryItem* item = iter2->second.mItem; if (!item) { continue; } const char* img_name; switch( item->getType() ) { case LLAssetType::AT_TEXTURE: if(item->getInventoryType() == LLInventoryType::IT_SNAPSHOT) { img_name = "inv_item_snapshot.tga"; } else { img_name = "inv_item_texture.tga"; } break; case LLAssetType::AT_SOUND: img_name = "inv_item_sound.tga"; break; case LLAssetType::AT_CALLINGCARD: img_name = "inv_item_callingcard_online.tga"; break; case LLAssetType::AT_LANDMARK: if (item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED) { img_name = "inv_item_landmark_visited.tga"; } else { img_name = "inv_item_landmark.tga"; } break; case LLAssetType::AT_CLOTHING: img_name = "inv_item_clothing.tga"; break; case LLAssetType::AT_OBJECT: if (item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) { img_name = "inv_item_object_multi.tga"; } else { img_name = "inv_item_object.tga"; } break; case LLAssetType::AT_NOTECARD: img_name = "inv_item_notecard.tga"; break; case LLAssetType::AT_LSL_TEXT: img_name = "inv_item_script.tga"; break; case LLAssetType::AT_BODYPART: img_name = "inv_item_skin.tga"; break; case LLAssetType::AT_ANIMATION: img_name = "inv_item_animation.tga";break; case LLAssetType::AT_GESTURE: img_name = "inv_item_gesture.tga"; break; default: llassert(0); continue; } LLUIImagePtr image = LLUI::getUIImage(img_name); font->addEmbeddedChar( wch, image->getImage(), item->getName() ); } }
// Allow calling cards to be dropped onto text fields. Append the name and // a carriage return. // virtual BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { BOOL handled = FALSE; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); if (LLToolDragAndDrop::SOURCE_NOTECARD == source) { // We currently do not handle dragging items from one notecard to another // since items in a notecard must be in Inventory to be verified. See DEV-2891. return FALSE; } if (mTakesNonScrollClicks) { if (getEnabled() && acceptsTextInput()) { switch( cargo_type ) { case DAD_CALLINGCARD: if(acceptsCallingCardNames()) { if (drop) { LLInventoryItem *item = (LLInventoryItem *)cargo_data; std::string name = item->getName(); appendText(name, true, true); } *accept = ACCEPT_YES_COPY_SINGLE; } else { *accept = ACCEPT_NO; } break; case DAD_TEXTURE: case DAD_SOUND: case DAD_LANDMARK: case DAD_SCRIPT: case DAD_CLOTHING: case DAD_OBJECT: case DAD_NOTECARD: case DAD_BODYPART: case DAD_ANIMATION: case DAD_GESTURE: { LLInventoryItem *item = (LLInventoryItem *)cargo_data; if( item && allowsEmbeddedItems() ) { U32 mask_next = item->getPermissions().getMaskNextOwner(); if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) { if( drop ) { deselect(); S32 old_cursor = mCursorPos; setCursorAtLocalPos( x, y, TRUE ); S32 insert_pos = mCursorPos; setCursorPos(old_cursor); BOOL inserted = insertEmbeddedItem( insert_pos, item ); if( inserted && (old_cursor > mCursorPos) ) { setCursorPos(mCursorPos + 1); } updateLineStartList(); } *accept = ACCEPT_YES_COPY_MULTI; } else { *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only items with unrestricted\n" "'next owner' permissions \n" "can be attached to notecards."); } } } else { *accept = ACCEPT_NO; } break; } default: *accept = ACCEPT_NO; break; } } else { // Not enabled *accept = ACCEPT_NO; } handled = TRUE; lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLViewerTextEditor " << getName() << llendl; } return handled; }
void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. llinfos<<"handleInventory"<<llendl; char buffer[MAX_STRING]; /*Flawfinder: ignore*/ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); InventoryObjectList::const_iterator it = inv->begin(); InventoryObjectList::const_iterator end = inv->end(); for ( ; it != end; ++it) { llinfos<<"Doing iterator of inventory"<<llendl; if( ( (*it)->getType() == LLAssetType::AT_LSL_TEXT && processScript) || ( (*it)->getType() == LLAssetType::AT_TEXTURE && processTexture) || ( (*it)->getType() == LLAssetType::AT_SOUND && processSound) || ( (*it)->getType() == LLAssetType::AT_LANDMARK && processLandmark) || ( (*it)->getType() == LLAssetType::AT_CLOTHING && processClothing) || ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject) || ( (*it)->getType() == LLAssetType::AT_NOTECARD && processNotecard) || ( (*it)->getType() == LLAssetType::AT_BODYPART && processBodypart) || ( (*it)->getType() == LLAssetType::AT_ANIMATION && processAnimation) || ( (*it)->getType() == LLAssetType::AT_GESTURE && processGesture)) { LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)item; LLPermissions perm(new_item->getPermissions()); // chomp the inventory name so it fits in the scroll window nicely // and the user can see the [OK] std::string invname; invname=item->getName().substr(0,item->getName().size() < 30 ? item->getName().size() : 30 ); // My attempt at checking valid permissions, CHECK ME // note its not actually bad to try to set permissions that are not allowed as the // server will protect against this, but it will piss the user off if its wrong if( (perm.getCreator()==gAgentID) || (perm.getMaskOwner() & PERM_TRANSFER) && (perm.getMaskOwner() & PERM_MODIFY) || (gAgent.getGroupID()==perm.getGroup() && (perm.getMaskGroup() & PERM_TRANSFER) && (perm.getMaskGroup() & PERM_MODIFY)) ){ llinfos<<"Setting perms"<<llendl; perm.setMaskNext(req_perm_mask); new_item->setPermissions(perm); updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE); snprintf(buffer, sizeof(buffer), "Setting perms on '%s' [OK]", invname.c_str()); /* Flawfinder: ignore */ } else { llinfos<<"NOT setting perms"<<llendl; snprintf(buffer, sizeof(buffer), "Setting perms on '%s' [FAILED]", invname.c_str()); /* Flawfinder: ignore */ } list->addCommentText(buffer); if(recurse && ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject)) { //Add this object back to the queue to be processed as it has inventory snprintf(buffer, sizeof(buffer), "Queueing object '%s' for open", invname.c_str()); llwarns << "Queueing object "<< invname.c_str() << " ID "<< (*it)->getUUID()<<llendl; mObjectIDs.put((*it)->getUUID()); // This will not YET work. as this is not a viewer object the unpack will fail } } } } nextObject(); }
void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gesture,LLCtrlListInterface * list ) { // Note: Can have NULL item if inventory hasn't arrived yet. static std::string item_name = getString("loading"); LLInventoryItem* item = gInventory.getItem(item_id); if (item) { item_name = item->getName(); } static std::string font_style = "NORMAL"; // If gesture is playing, bold it LLSD element; element["id"] = item_id; if (gesture) { if (gesture->mPlaying) { font_style = "BOLD"; } item_name = gesture->mName; element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = gesture->mTrigger; element["columns"][0]["font"]["name"] = "SANSSERIF"; element["columns"][0]["font"]["style"] = font_style; std::string key_string = LLKeyboard::stringFromKey(gesture->mKey); std::string buffer; if (gesture->mKey == KEY_NONE) { buffer = "---"; key_string = "~~~"; // alphabetize to end } else { buffer = LLKeyboard::stringFromAccelerator(gesture->mMask, gesture->mKey); } element["columns"][1]["column"] = "shortcut"; element["columns"][1]["value"] = buffer; element["columns"][1]["font"]["name"] = "SANSSERIF"; element["columns"][1]["font"]["style"] = font_style; // hidden column for sorting element["columns"][2]["column"] = "key"; element["columns"][2]["value"] = key_string; element["columns"][2]["font"]["name"] = "SANSSERIF"; element["columns"][2]["font"]["style"] = font_style; // Only add "playing" if we've got the name, less confusing. JC if (item && gesture->mPlaying) { item_name += " " + getString("playing"); } element["columns"][3]["column"] = "name"; element["columns"][3]["value"] = item_name; element["columns"][3]["font"]["name"] = "SANSSERIF"; element["columns"][3]["font"]["style"] = font_style; } else { element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = ""; element["columns"][0]["font"]["name"] = "SANSSERIF"; element["columns"][0]["font"]["style"] = font_style; element["columns"][1]["column"] = "shortcut"; element["columns"][1]["value"] = "---"; element["columns"][1]["font"]["name"] = "SANSSERIF"; element["columns"][1]["font"]["style"] = font_style; element["columns"][2]["column"] = "key"; element["columns"][2]["value"] = "~~~"; element["columns"][2]["font"]["name"] = "SANSSERIF"; element["columns"][2]["font"]["style"] = font_style; element["columns"][3]["column"] = "name"; element["columns"][3]["value"] = item_name; element["columns"][3]["font"]["name"] = "SANSSERIF"; element["columns"][3]["font"]["style"] = font_style; } LL_DEBUGS("Gesture") << "Added gesture [" << item_name << "]" << LL_ENDL; LLScrollListItem* sl_item(0); if( !updateItem( item_id, element ) ) sl_item = list->addElement(element, ADD_BOTTOM); if(sl_item) { mItems[ item_id ] = sl_item; LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL; // *TODO find out why ["font"]["style"] does not affect font style ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style); } }
// virtual BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, LLString& tooltip_msg) { BOOL handled = TRUE; switch(cargo_type) { case DAD_ANIMATION: case DAD_SOUND: { // TODO: Don't allow this if you can't transfer the sound/animation // make a script step LLInventoryItem* item = (LLInventoryItem*)cargo_data; if (item && gInventory.getItem(item->getUUID())) { LLPermissions perm = item->getPermissions(); if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)) { *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only animations and sounds\n" "with unrestricted permissions\n" "can be added to a gesture."); } break; } else if (drop) { LLScrollListItem* line = NULL; if (cargo_type == DAD_ANIMATION) { line = addStep("Animation"); LLGestureStepAnimation* anim = (LLGestureStepAnimation*)line->getUserdata(); anim->mAnimAssetID = item->getAssetUUID(); anim->mAnimName = item->getName(); } else if (cargo_type == DAD_SOUND) { line = addStep("Sound"); LLGestureStepSound* sound = (LLGestureStepSound*)line->getUserdata(); sound->mSoundAssetID = item->getAssetUUID(); sound->mSoundName = item->getName(); } updateLabel(line); mDirty = TRUE; refresh(); } *accept = ACCEPT_YES_COPY_MULTI; } else { // Not in user's inventory means it was in object inventory *accept = ACCEPT_NO; } break; } default: *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only animations and sounds\n" "can be added to a gesture."); } break; } return handled; }
void LLFloaterClothing::buildClothingList() { //llinfos << "buildClothingList" << llendl; LLScrollListCtrl* list = gUICtrlFactory->getScrollListByName(this, "clothing_list"); if (!list) return; list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLIsClothing is_clothing; gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_clothing); S32 count = items.count(); for(S32 i = 0; i < count; ++i) { LLInventoryItem* item = items.get(i); LLSD row; row["id"] = item->getUUID(); BOOL item_is_multi = FALSE; if ( item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) { item_is_multi = TRUE; } LLUUID image_id = get_item_icon_uuid(item->getType(), item->getInventoryType(), item->getFlags(), item_is_multi); // flags = wearable type row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = image_id; LLString text = item->getName(); LLString style = "NORMAL"; if( gAgent.isWearingItem( item->getUUID() ) ) { text.append(" (worn)"); style = "BOLD"; } row["columns"][1]["column"] = "name"; row["columns"][1]["value"] = text; row["columns"][1]["font"] = "SANSSERIFSMALL"; row["columns"][1]["font-style"] = style; // hidden column for sorting U32 flags = item->getFlags(); // flags = wearable type enum EWearableType wearable_type = (enum EWearableType)flags; const char* wearable_label = LLWearable::typeToTypeLabel(wearable_type); //line->addColumn(wearable_label, FONT, -1); // invisible row["columns"][2]["column"] = "sort"; row["columns"][2]["value"] = wearable_label; list->addElement(row); } if (count > 0) { mAllowSelection = TRUE; } else if (LLInventoryModel::backgroundFetchActive()) { // We're loading list->addCommentText(LOADING_STRING); mAllowSelection = FALSE; } else { // Weird case, we're done loading but have no clothing list->addCommentText("No clothing found."); mAllowSelection = FALSE; } }
void LLFloaterGesture::buildGestureList() { LLCtrlListInterface *list = childGetListInterface("gesture_list"); if (!list) return; list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLGestureManager::item_map_t::iterator it; for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it) { const LLUUID& item_id = (*it).first; LLMultiGesture* gesture = (*it).second; // Note: Can have NULL item if inventory hasn't arrived yet. std::string item_name = "Loading..."; LLInventoryItem* item = gInventory.getItem(item_id); if (item) { item_name = item->getName(); } std::string font_style = "NORMAL"; // If gesture is playing, bold it LLSD element; element["id"] = item_id; if (gesture) { if (gesture->mPlaying) { font_style = "BOLD"; } element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = gesture->mTrigger; element["columns"][0]["font"] = "SANSSERIF"; element["columns"][0]["font-style"] = font_style; std::string key_string = LLKeyboard::stringFromKey(gesture->mKey); std::string buffer; { if (gesture->mKey == KEY_NONE) { buffer = "---"; key_string = "~~~"; // alphabetize to end } else { if (gesture->mMask & MASK_CONTROL) buffer.append("Ctrl-"); if (gesture->mMask & MASK_ALT) buffer.append("Alt-"); if (gesture->mMask & MASK_SHIFT) buffer.append("Shift-"); if ((gesture->mMask & (MASK_CONTROL|MASK_ALT|MASK_SHIFT)) && (key_string[0] == '-' || key_string[0] == '=')) { buffer.append(" "); } buffer.append(key_string); } } element["columns"][1]["column"] = "shortcut"; element["columns"][1]["value"] = buffer; element["columns"][1]["font"] = "SANSSERIF"; element["columns"][1]["font-style"] = font_style; // hidden column for sorting element["columns"][2]["column"] = "key"; element["columns"][2]["value"] = key_string; element["columns"][2]["font"] = "SANSSERIF"; element["columns"][2]["font-style"] = font_style; // Only add "playing" if we've got the name, less confusing. JC if (item && gesture->mPlaying) { item_name += " (Playing)"; } element["columns"][3]["column"] = "name"; element["columns"][3]["value"] = item_name; element["columns"][3]["font"] = "SANSSERIF"; element["columns"][3]["font-style"] = font_style; } else { element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = ""; element["columns"][0]["font"] = "SANSSERIF"; element["columns"][0]["font-style"] = font_style; element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = "---"; element["columns"][0]["font"] = "SANSSERIF"; element["columns"][0]["font-style"] = font_style; element["columns"][2]["column"] = "key"; element["columns"][2]["value"] = "~~~"; element["columns"][2]["font"] = "SANSSERIF"; element["columns"][2]["font-style"] = font_style; element["columns"][3]["column"] = "name"; element["columns"][3]["value"] = item_name; element["columns"][3]["font"] = "SANSSERIF"; element["columns"][3]["font-style"] = font_style; } list->addElement(element, ADD_BOTTOM); } }
BOOL LLFloaterAO::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { BOOL handled = TRUE; switch(cargo_type) { case DAD_NOTECARD: { // Pop off to Lua LLInventoryItem* item = (LLInventoryItem*)cargo_data; if (item && gInventory.getItem(item->getAssetUUID())) { // @hook OnAONotecard(asset_id) LUA_CALL("OnAONotecard") << item->getAssetUUID() << LUA_END; } *accept = ACCEPT_YES_COPY_MULTI; break; } case DAD_ANIMATION: { LLInventoryItem* item = (LLInventoryItem*)cargo_data; if (item && gInventory.getItem(item->getUUID())) { if (drop) { if (cargo_type == DAD_ANIMATION) { std::string anim_name = item->getName(); if (anim_name == "") return true; LLUUID id(LLAO::getAssetIDByName(anim_name)); #ifdef AO_DEBUG llinfos << "Actually adding animation, this should be refreshed. Count:" << LLAO::mAnimationOverrides[mCurrentAnimType].size() << llendl; #endif LLAO::mAnimationOverrides[mCurrentAnimType].append(anim_name); #ifdef AO_DEBUG llinfos << "Added animation. Count:" << LLAO::mAnimationOverrides[mCurrentAnimType].size() << llendl; #endif //LLAO::mTimer->reset(); onCommitAnim(NULL,this); } refresh(); } *accept = ACCEPT_YES_COPY_MULTI; } else { // Not in user's inventory means it was in object inventory *accept = ACCEPT_NO; } break; } default: *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only animations can be added to the AO."); } break; } return handled; }