Esempio n. 1
0
	static void processForeignLandmark(LLLandmark* landmark,
			const LLUUID& object_id, const LLUUID& notecard_inventory_id,
			LLPointer<LLInventoryItem> item_ptr)
	{
		LLVector3d global_pos;
		landmark->getGlobalPos(global_pos);
		LLViewerInventoryItem* agent_landmark =
				LLLandmarkActions::findLandmarkForGlobalPos(global_pos);

		if (agent_landmark)
		{
			showInfo(agent_landmark->getUUID());
		}
		else
		{
			if (item_ptr.isNull())
			{
				// check to prevent a crash. See EXT-8459.
				LL_WARNS() << "Passed handle contains a dead inventory item. Most likely notecard has been closed and embedded item was destroyed." << LL_ENDL;
			}
			else
			{
				LLInventoryItem* item = item_ptr.get();
				LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied();
				copy_inventory_from_notecard(get_folder_by_itemtype(item),
											 object_id,
											 notecard_inventory_id,
											 item,
											 gInventoryCallbacks.registerCB(cb));
			}
		}
	}
Esempio n. 2
0
// static
void LLPreview::onBtnCopyToInv(void* userdata)
{
	LLPreview* self = (LLPreview*) userdata;
	LLInventoryItem *item = self->mAuxItem;

	if(item && item->getUUID().notNull())
	{
		// Copy to inventory
		if (self->mNotecardInventoryID.notNull())
		{
			copy_inventory_from_notecard(self->mObjectID,
				self->mNotecardInventoryID, item);
		}
		else
		{
			LLPointer<LLInventoryCallback> cb = NULL;
			copy_inventory_item(
				gAgent.getID(),
				item->getPermissions().getOwner(),
				item->getUUID(),
				LLUUID::null,
				std::string(),
				cb);
		}
	}
	self->close();
}
void LLViewerTextEditor::copyInventory(const LLInventoryItem* item, U32 callback_id)
{
	copy_inventory_from_notecard(LLUUID::null,  // Don't specify a destination -- let the sim do that
								 mObjectID,
								 mNotecardInventoryID,
								 item,
								 callback_id);
}
// static
void LLPreview::onBtnCopyToInv(void* userdata)
{
	LLPreview* self = (LLPreview*) userdata;
	LLInventoryItem *item = self->mAuxItem;

	if(item && item->getUUID().notNull())
	{
		// Copy to inventory
		if (self->mNotecardInventoryID.notNull())
		{
			copy_inventory_from_notecard(LLUUID::null,
										 self->mNotecardObjectID,
										 self->mNotecardInventoryID,
										 item);
		}
		else if (self->mObjectUUID.notNull())
		{
			// item is in in-world inventory
			LLViewerObject* object = gObjectList.findObject(self->mObjectUUID);
			LLPermissions perm(item->getPermissions());
			if(object
				&&(perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
				&& perm.allowTransferTo(gAgent.getID())))
			{
				// copy to default folder
				set_dad_inventory_item(item, LLUUID::null);
				object->moveInventory(LLUUID::null, item->getUUID());
			}
		}
		else
		{
			LLPointer<LLInventoryCallback> cb = NULL;
			copy_inventory_item(
				gAgent.getID(),
				item->getPermissions().getOwner(),
				item->getUUID(),
				LLUUID::null,
				std::string(),
				cb);
		}
	}
	self->closeFloater();
}
Esempio n. 5
0
// <edit>
// static
void LLPreviewNotecard::onClickGetItems(void* user_data)
{
	LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
	if(preview)
	{
		LLViewerTextEditor* editor = preview->getChild<LLViewerTextEditor>("Notecard Editor");
		if(editor)
		{
			std::vector<LLPointer<LLInventoryItem>> items = editor->getEmbeddedItems();
			if(items.size())
			{
				const BOOL use_caps = FALSE;

				std::vector<LLPointer<LLInventoryItem>>::iterator iter = items.begin();
				std::vector<LLPointer<LLInventoryItem>>::iterator end = items.end();
				for( ; iter != end; ++iter)
				{
					LLInventoryItem* item = static_cast<LLInventoryItem*>(*iter);
					if(use_caps)
					{
						copy_inventory_from_notecard(preview->getObjectID(), preview->getNotecardItemID(), item, 0);
					}
					else
					{
						// Only one item per message actually works
						gMessageSystem->newMessageFast(_PREHASH_CopyInventoryFromNotecard);
						gMessageSystem->nextBlockFast(_PREHASH_AgentData);
						gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
						gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
						gMessageSystem->nextBlockFast(_PREHASH_NotecardData);
						gMessageSystem->addUUIDFast(_PREHASH_NotecardItemID, preview->getNotecardItemID());
						gMessageSystem->addUUIDFast(_PREHASH_ObjectID, preview->getObjectID());
						gMessageSystem->nextBlockFast(_PREHASH_InventoryData);
						gMessageSystem->addUUIDFast(_PREHASH_ItemID, item->getUUID());
						gMessageSystem->addUUIDFast(_PREHASH_FolderID, gInventory.findCategoryUUIDForType(item->getType()));
						gAgent.sendReliableMessage();
					}
				}
			}
		}
	}
}
	static void processForeignLandmark(LLLandmark* landmark,
			const LLUUID& object_id, const LLUUID& notecard_inventory_id,
			LLPointer<LLInventoryItem> item_ptr)
	{
		LLVector3d global_pos;
		landmark->getGlobalPos(global_pos);
		LLViewerInventoryItem* agent_landmark =
				LLLandmarkActions::findLandmarkForGlobalPos(global_pos);

		if (agent_landmark)
		{
			showInfo(agent_landmark->getUUID());
		}
//		else
// [SL:KB] - Patch: UI-Notecards | Checked: 2010-09-05 (Catznip-2.1.2a) | Added: Catznip-2.1.2a
		else if (gSavedSettings.getBOOL("EmbeddedLandmarkCopyToInventory"))
// [/SL:KB]
		{
			if (item_ptr.isNull())
			{
				// check to prevent a crash. See EXT-8459.
				llwarns << "Passed handle contains a dead inventory item. Most likely notecard has been closed and embedded item was destroyed." << llendl;
			}
			else
			{
				LLInventoryItem* item = item_ptr.get();
				LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied();
				copy_inventory_from_notecard(get_folder_by_itemtype(item),
											 object_id,
											 notecard_inventory_id,
											 item,
											 gInventoryCallbacks.registerCB(cb));
			}
		}
// [SL:KB] - Patch: UI-Notecards | Checked: 2010-09-05 (Catznip-2.1.2a) | Added: Catznip-2.1.2a
		else
		{
			showInfo(global_pos);
		}
// [/SL:KB]
	}
void LLViewerTextEditor::copyInventory(const LLInventoryItem* item, U32 callback_id)
{
	copy_inventory_from_notecard(mObjectID,
								 mNotecardInventoryID,
								 item, callback_id);
}