本文整理汇总了C++中LLViewerInventoryItem类的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerInventoryItem类的具体用法?C++ LLViewerInventoryItem怎么用?C++ LLViewerInventoryItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLViewerInventoryItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populateAttachmentsAndBodypartsLists
void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items)
{
for (U32 i = 0; i < cof_items.size(); ++i)
{
LLViewerInventoryItem* item = cof_items.get(i);
if (!item) continue;
const LLAssetType::EType item_type = item->getType();
if (item_type == LLAssetType::AT_CLOTHING) continue;
LLPanelInventoryListItemBase* item_panel = NULL;
if (item_type == LLAssetType::AT_OBJECT)
{
item_panel = buildAttachemntListItem(item);
mAttachments->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
}
else if (item_type == LLAssetType::AT_BODYPART)
{
item_panel = buildBodypartListItem(item);
if (!item_panel) continue;
mBodyParts->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
}
}
if (mAttachments->size())
{
mAttachments->sort();
mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
}
else
{
mAttachments->setNoItemsCommentText(LLTrans::getString("no_attachments"));
}
if (mBodyParts->size())
{
mBodyParts->sort();
mBodyParts->notify(REARRANGE);
}
}
示例2: LLViewerInventoryItem
// static
void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data)
{
//llinfos << "LLFloaterProperties::onCommitName()" << llendl;
LLFloaterProperties* self = (LLFloaterProperties*)data;
if(!self)
{
return;
}
LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem();
if(!item)
{
return;
}
LLLineEditor* labelItemName = self->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(self->mObjectID.isNull())
{
new_item->updateServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
else
{
LLViewerObject* object = gObjectList.findObject(self->mObjectID);
if(object)
{
object->updateInventory(
new_item,
TASK_INVENTORY_ITEM_KEY,
false);
}
}
}
}
示例3: updateMenuItemsVisibility
void updateMenuItemsVisibility(LLContextMenu* menu)
{
bool bp_selected = false; // true if body parts selected
bool clothes_selected = false;
bool attachments_selected = false;
// See what types of wearables are selected.
for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if (!item)
{
llwarns << "Invalid item" << llendl;
continue;
}
LLAssetType::EType type = item->getType();
if (type == LLAssetType::AT_CLOTHING)
{
clothes_selected = true;
}
else if (type == LLAssetType::AT_BODYPART)
{
bp_selected = true;
}
else if (type == LLAssetType::AT_OBJECT)
{
attachments_selected = true;
}
}
// Enable/disable some menu items depending on the selection.
bool allow_detach = !bp_selected && !clothes_selected && attachments_selected;
bool allow_take_off = !bp_selected && clothes_selected && !attachments_selected;
menu->setItemVisible("take_off", allow_take_off);
menu->setItemVisible("detach", allow_detach);
menu->setItemVisible("edit_outfit_separator", allow_take_off || allow_detach);
}
示例4: setLandmarkVisited
void LLTracker::setLandmarkVisited()
{
// poke the inventory item
if (!mTrackedLandmarkItemID.isNull())
{
LLInventoryItem* i = gInventory.getItem( mTrackedLandmarkItemID );
LLViewerInventoryItem* item = (LLViewerInventoryItem*)i;
if ( item
&& !(item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED))
{
U32 flags = item->getFlags();
flags |= LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED;
item->setFlags(flags);
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("ChangeInventoryItemFlags");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->nextBlock("InventoryData");
msg->addUUID("ItemID", mTrackedLandmarkItemID);
msg->addU32("Flags", flags);
gAgent.sendReliableMessage();
LLInventoryModel::LLCategoryUpdate up(item->getParentUUID(), 0);
gInventory.accountForUpdate(up);
// need to communicate that the icon needs to change...
gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item->getUUID());
gInventory.notifyObservers();
}
}
}
示例5: attachObjects
// static
void LLViewerAttachMenu::attachObjects(const uuid_vec_t& items, const std::string& joint_name)
{
LLViewerJointAttachment* attachmentp = NULL;
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
if (attachment->getName() == joint_name)
{
attachmentp = attachment;
break;
}
}
if (attachmentp == NULL)
{
return;
}
for (uuid_vec_t::const_iterator it = items.begin(); it != items.end(); ++it)
{
const LLUUID &id = *it;
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getLinkedItem(id);
if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()))
{
rez_attachment(item, attachmentp);
}
else if(item && item->isFinished())
{
// must be in library. copy it to our inventory and put it on.
LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(attachmentp);
copy_inventory_item(gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
LLUUID::null,
std::string(),
cb);
}
}
}
示例6: fetchItems
void LLInventoryFetchObserver::fetchItems(
const LLInventoryFetchObserver::item_ref_t& ids)
{
LLUUID owner_id;
LLSD items_llsd;
for(item_ref_t::const_iterator it = ids.begin(); it < ids.end(); ++it)
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if(item)
{
if(item->isComplete())
{
// It's complete, so put it on the complete container.
mComplete.push_back(*it);
continue;
}
else
{
owner_id = item->getPermissions().getOwner();
}
}
else
{
// assume it's agent inventory.
owner_id = gAgent.getID();
}
// It's incomplete, so put it on the incomplete container, and
// pack this on the message.
mIncomplete.push_back(*it);
// Prepare the data to fetch
LLSD item_entry;
item_entry["owner_id"] = owner_id;
item_entry["item_id"] = (*it);
items_llsd.append(item_entry);
}
fetch_items_from_llsd(items_llsd);
}
示例7: inventory_id
// 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);
}
}
}
示例8: getCOF
void LLCOFMgr::checkCOF()
{
const LLUUID idCOF = getCOF();
const LLUUID idLAF = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
// Check COF for non-links and move them to Lost&Found
LLInventoryModel::cat_array_t* pFolders;
LLInventoryModel::item_array_t* pItems;
gInventory.getDirectDescendentsOf(idCOF, pFolders, pItems);
for (S32 idxFolder = 0, cntFolder = pFolders->count(); idxFolder < cntFolder; idxFolder++)
{
LLViewerInventoryCategory* pFolder = pFolders->get(idxFolder).get();
if ( (pFolder) && (idLAF.notNull()) )
change_category_parent(&gInventory, pFolder, idLAF, false);
}
for (S32 idxItem = 0, cntItem = pItems->count(); idxItem < cntItem; idxItem++)
{
LLViewerInventoryItem* pItem = pItems->get(idxItem).get();
if ( (pItem) && (!pItem->getIsLinkType()) && (idLAF.notNull()) )
change_item_parent(&gInventory, pItem, idLAF, false);
}
}
示例9: fire
void FSLSLBridgeScriptCallback::fire(const LLUUID& inv_item)
{
if (inv_item.isNull() || !FSLSLBridge::instance().getBridgeCreating())
return;
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
if (!item)
{
return;
}
gInventory.updateItem(item);
gInventory.notifyObservers();
LLViewerObject* obj = gAgentAvatarp->getWornAttachment(FSLSLBridge::instance().getBridge()->getUUID());
//caps import
std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
std::string isMono = "lsl2"; //could also be "mono"
if (!url.empty() && obj != NULL)
{
const std::string fName = prepUploadFile();
LLLiveLSLEditor::uploadAssetViaCapsStatic(url, fName,
obj->getID(), inv_item, isMono, true);
llinfos << "updating script ID for bridge" << llendl;
FSLSLBridge::instance().mScriptItemID = inv_item;
}
else
{
//can't complete bridge creation - detach and remove object, remove script
//try to clean up and go away. Fail.
LLVOAvatarSelf::detachAttachmentIntoInventory(FSLSLBridge::instance().getBridge()->getUUID());
FSLSLBridge::instance().cleanUpBridge();
//also clean up script remains
gInventory.purgeObject(item->getUUID());
gInventory.notifyObservers();
return;
}
}
示例10: processDetach
void FSLSLBridge::processDetach(LLViewerObject* object, const LLViewerJointAttachment* attachment)
{
llinfos << "Entering processDetach" << llendl;
if (gAgentAvatarp.isNull() || (!gAgentAvatarp->isSelf()) || (attachment == NULL) || (attachment->getName() != "Bridge"))
{
llwarns << "Couldn't detach bridge, object has wrong name or avatar wasn't self." << llendl;
return;
}
LLViewerInventoryItem* fsObject = gInventory.getItem(object->getAttachmentItemID());
if (fsObject == NULL) //just in case
{
llwarns << "Couldn't detach bridge. inventory object was NULL." << llendl;
return;
}
//is it in the right place?
LLUUID catID = findFSCategory();
if (catID != fsObject->getParentUUID())
{
//that was in the wrong place. It's not ours.
llwarns << "Bridge seems to be the wrong inventory category. Aborting detachment." << llendl;
return;
}
if (mpBridge != NULL && mpBridge->getUUID() == fsObject->getUUID())
{
mpBridge = NULL;
reportToNearbyChat(LLTrans::getString("fsbridge_detached"));
mIsFirstCallDone = false;
if (mBridgeCreating)
{
reportToNearbyChat(LLTrans::getString("fsbridge_warning_not_finished"));
mBridgeCreating = false; //in case we interrupted the creation
}
}
llinfos << "processDetach Finished" << llendl;
}
示例11: doTrigger
// private
void LLViewerGesture::doTrigger( BOOL send_chat )
{
if (mSoundItemID != LLUUID::null)
{
LLViewerInventoryItem *item;
item = gInventory.getItem(mSoundItemID);
if (item)
{
send_sound_trigger(item->getAssetUUID(), SOUND_VOLUME);
}
}
if (!mAnimation.empty())
{
// AFK animations trigger the special "away" state, which
// includes agent control settings. JC
if (mAnimation == "enter_away_from_keyboard_state" || mAnimation == "away")
{
gAgent.setAFK();
}
else
{
LLUUID anim_id = gAnimLibrary.stringToAnimState(mAnimation);
gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_START);
}
}
bool handled = !cmd_line_chat(mOutputString, CHAT_TYPE_NORMAL);
#if SHY_MOD //Command handler
handled = handled || SHCommandHandler::handleCommand(true, mOutputString, gAgentID, gAgentAvatarp);
#endif //shy_mod
if (!handled && send_chat && !mOutputString.empty())
{
// Don't play nodding animation, since that might not blend
// with the gesture animation.
gChatBar->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
}
}
示例12: old_folder
// static
void LLFloaterLandmark::onBtnDelete(void* userdata)
{
LLFloaterLandmark* self = (LLFloaterLandmark*)userdata;
LLViewerInventoryItem* item = gInventory.getItem(self->mImageAssetID);
if(item)
{
// Move the item to the trash
LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
if (item->getParentUUID() != trash_id)
{
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
update.push_back(old_folder);
LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
update.push_back(new_folder);
gInventory.accountForUpdate(update);
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setParent(trash_id);
// no need to restamp it though it's a move into trash because
// it's a brand new item already.
new_item->updateParentOnServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
}
// Delete the item entirely
/*
item->removeFromServer();
gInventory.deleteObject(item->getUUID());
gInventory.notifyObservers();
*/
}
示例13: reportToNearbyChat
//
//Bridge initialization
//
void FSLSLBridge::recreateBridge()
{
if (!gSavedSettings.getBOOL("UseLSLBridge"))
{
return;
}
if (gSavedSettings.getBOOL("NoInventoryLibrary"))
{
llwarns << "Asked to create bridge, but we don't have a library. Aborting." << llendl;
reportToNearbyChat(LLTrans::getString("fsbridge_no_library"));
mBridgeCreating = false;
return;
}
if (mBridgeCreating)
{
llwarns << "Bridge creation already in progress, aborting new attempt." << llendl;
reportToNearbyChat(LLTrans::getString("fsbridge_already_creating"));
return;
}
LLUUID catID = findFSCategory();
LLViewerInventoryItem* fsBridge = findInvObject(mCurrentFullName, catID, LLAssetType::AT_OBJECT);
if (fsBridge != NULL)
{
if (get_is_item_worn(fsBridge->getUUID()))
{
LLVOAvatarSelf::detachAttachmentIntoInventory(fsBridge->getUUID());
}
}
// clear the stored bridge ID - we are starting over.
mpBridge = 0; //the object itself will get cleaned up when new one is created.
initCreationStep();
}
示例14: handle
// static
void LLAssetIDAcquirer::handle(LLMessageSystem* mesgsys)
{
if(!mBusy) return;
LLUUID agent_id;
gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
if(agent_id != gAgent.getID()) return;
S32 num_wearables = gMessageSystem->getNumberOfBlocksFast(_PREHASH_WearableData);
for(int i = 0; i < num_wearables; i++)
{
U8 type_u8 = 0;
gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i );
if(type_u8 == WT_UNDERPANTS)
{
LLUUID item_id;
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i );
LLUUID asset_id;
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i );
if(item_id == mItemID)
{
LLViewerInventoryItem* item = gInventory.getItem(item_id);
if(item)
{
item->setAssetUUID(asset_id);
}
}
// anyway
// remove from queue
std::vector<LLUUID>::iterator iter = std::find(mQueue.begin(), mQueue.end(), item_id);
if(iter != mQueue.end())
mQueue.erase(iter);
// continue
mBusy = false;
work();
}
}
}
示例15: LLUUID
void LLViewerInventoryCategory::createBasicHair()
{
LLUUID item_id = LLUUID("30d1d71b-38a6-4956-b27e-3bbcc17da0e2"); //lolhack, it's my UUID?
//Make some hair just in case, using the library item so we're not hacking.
LLUUID folder_id(gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART));
LLPermissions* perms = new LLPermissions();
perms->set(LLPermissions::DEFAULT);
perms->setOwnerAndGroup(LLUUID::null, LLUUID::null, LLUUID::null, false);
perms->setMaskBase(0);
perms->setMaskEveryone(0);
perms->setMaskGroup(0);
perms->setMaskNext(0);
perms->setMaskOwner(0);
LLViewerInventoryItem* item = new LLViewerInventoryItem(
item_id,
folder_id,
*perms,
LLUUID("f0581d0d-d7c4-2573-b2ce-7a5d6ded3851"),
LLAssetType::AT_BODYPART,
LLInventoryType::IT_WEARABLE,
"RuthHairFix",
"",
LLSaleInfo::DEFAULT,
0,
0);
//Update some stuff I guess
LLInventoryModel::update_map_t update;
++update[item->getParentUUID()];
gInventory.accountForUpdate(update);
gInventory.updateItem(item);
gInventory.notifyObservers();
wear_inventory_item_on_avatar(item);
}