diff options
| -rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 125 | ||||
| -rw-r--r-- | indra/newview/llinventoryfunctions.h | 30 | ||||
| -rw-r--r-- | indra/newview/llinventorymodel.cpp | 334 | ||||
| -rw-r--r-- | indra/newview/llinventorymodel.h | 620 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.h | 19 | ||||
| -rw-r--r-- | indra/newview/llvoavatarself.h | 5 | 
6 files changed, 444 insertions, 689 deletions
| diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index f1520d34df..2b4d9fb25c 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -87,6 +87,79 @@  BOOL LLInventoryState::sWearNewClothing = FALSE;  LLUUID LLInventoryState::sWearNewClothingTransactionID; +// Generates a string containing the path to the item specified by +// item_id. +void append_path(const LLUUID& id, std::string& path) +{ +	std::string temp; +	const LLInventoryObject* obj = gInventory.getObject(id); +	LLUUID parent_id; +	if(obj) parent_id = obj->getParentUUID(); +	std::string forward_slash("/"); +	while(obj) +	{ +		obj = gInventory.getCategory(parent_id); +		if(obj) +		{ +			temp.assign(forward_slash + obj->getName() + temp); +			parent_id = obj->getParentUUID(); +		} +	} +	path.append(temp); +} + +void change_item_parent(LLInventoryModel* model, +						LLViewerInventoryItem* item, +						const LLUUID& new_parent_id, +						BOOL restamp) +{ +	if (item->getParentUUID() != new_parent_id) +	{ +		LLInventoryModel::update_list_t update; +		LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); +		update.push_back(old_folder); +		LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1); +		update.push_back(new_folder); +		gInventory.accountForUpdate(update); + +		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); +		new_item->setParent(new_parent_id); +		new_item->updateParentOnServer(restamp); +		model->updateItem(new_item); +		model->notifyObservers(); +	} +} + + +BOOL get_is_item_worn(const LLUUID& id) +{ +	const LLViewerInventoryItem* item = gInventory.getItem(id); +	if (!item) +		return FALSE; +	 +	switch(item->getType()) +	{ +		case LLAssetType::AT_OBJECT: +		{ +			if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) +				return TRUE; +			break; +		} +		case LLAssetType::AT_BODYPART: +		case LLAssetType::AT_CLOTHING: +			if(gAgentWearables.isWearingItem(item->getLinkedUUID())) +				return TRUE; +			break; +		case LLAssetType::AT_GESTURE: +			if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID())) +				return TRUE; +			break; +		default: +			break; +	} +	return FALSE; +} +  ///----------------------------------------------------------------------------  /// LLInventoryCollectFunctor implementations  ///---------------------------------------------------------------------------- @@ -396,55 +469,3 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)  		folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);  	}  } - -void change_item_parent(LLInventoryModel* model, -									 LLViewerInventoryItem* item, -									 const LLUUID& new_parent_id, -									 BOOL restamp) -{ -	if (item->getParentUUID() != new_parent_id) -	{ -		LLInventoryModel::update_list_t update; -		LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); -		update.push_back(old_folder); -		LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1); -		update.push_back(new_folder); -		gInventory.accountForUpdate(update); - -		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); -		new_item->setParent(new_parent_id); -		new_item->updateParentOnServer(restamp); -		model->updateItem(new_item); -		model->notifyObservers(); -	} -} - - -BOOL get_is_item_worn(const LLUUID& id) -{ -	const LLViewerInventoryItem* item = gInventory.getItem(id); -	if (!item) -		return FALSE; -	 -	switch(item->getType()) -	{ -		case LLAssetType::AT_OBJECT: -		{ -			if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) -				return TRUE; -			break; -		} -		case LLAssetType::AT_BODYPART: -		case LLAssetType::AT_CLOTHING: -			if(gAgentWearables.isWearingItem(item->getLinkedUUID())) -				return TRUE; -			break; -		case LLAssetType::AT_GESTURE: -			if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID())) -				return TRUE; -			break; -		default: -			break; -	} -	return FALSE; -} diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 02a5fc9224..79b9b4a9cc 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -40,6 +40,27 @@  /********************************************************************************   **                                                                            ** + **                    MISCELLANEOUS GLOBAL FUNCTIONS + **/ + +// Is this item or its baseitem is worn, attached, etc... +BOOL get_is_item_worn(const LLUUID& id); + + +void change_item_parent(LLInventoryModel* model, +									 LLViewerInventoryItem* item, +									 const LLUUID& new_parent_id, +									 BOOL restamp); + +// Generates a string containing the path to the item specified by item_id. +void append_path(const LLUUID& id, std::string& path); + +/**                    Miscellaneous global functions + **                                                                            ** + *******************************************************************************/ + +/******************************************************************************** + **                                                                            **   **                    INVENTORY COLLECTOR FUNCTIONS   **/ @@ -297,15 +318,6 @@ public:  	virtual void doItem(LLFolderViewItem* item);  }; -// Is this item or its baseitem is worn, attached, etc... -BOOL get_is_item_worn(const LLUUID& id); - - -void change_item_parent(LLInventoryModel* model, -									 LLViewerInventoryItem* item, -									 const LLUUID& new_parent_id, -									 BOOL restamp); -  #endif // LL_LLINVENTORYFUNCTIONS_H diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index e63da1ebb9..a527694d25 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -319,30 +319,18 @@ void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id)  // specifies 'type' as what it defaults to containing. The category is  // not necessarily only for that type. *NOTE: This will create a new  // inventory category on the fly if one does not exist. -const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType t, bool create_folder, bool find_in_library) -{ -	const LLUUID &rv = findCatUUID(t, find_in_library); -	if(rv.isNull() && isInventoryUsable() && (create_folder && !find_in_library)) -	{ -		const LLUUID &root_id = gInventory.getRootFolderID(); -		if(root_id.notNull()) -		{ -			return createNewCategory(root_id, t, LLStringUtil::null); -		} -	} -	return rv; -} - -// Internal method which looks for a category with the specified -// preferred type. Returns LLUUID::null if not found. -const LLUUID &LLInventoryModel::findCatUUID(LLFolderType::EType preferred_type, bool find_in_library) const +const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type,  +													   bool create_folder,  +													   bool find_in_library)  { +	LLUUID rv = LLUUID::null; +	  	const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID();  	if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)  	{ -		return root_id; +		rv = root_id;  	} -	if(root_id.notNull()) +	else if (root_id.notNull())  	{  		cat_array_t* cats = NULL;  		cats = get_ptr_in_map(mParentChildCategoryTree, root_id); @@ -353,12 +341,21 @@ const LLUUID &LLInventoryModel::findCatUUID(LLFolderType::EType preferred_type,  			{  				if(cats->get(i)->getPreferredType() == preferred_type)  				{ -					return cats->get(i)->getUUID(); +					rv = cats->get(i)->getUUID(); +					break;  				}  			}  		}  	} -	return LLUUID::null; +	 +	if(rv.isNull() && isInventoryUsable() && (create_folder && !find_in_library)) +	{ +		if(root_id.notNull()) +		{ +			return createNewCategory(root_id, preferred_type, LLStringUtil::null); +		} +	} +	return rv;  }  // Convenience function to create a new category. You could call @@ -583,27 +580,6 @@ LLInventoryModel::item_array_t LLInventoryModel::collectLinkedItems(const LLUUID  	return items;  } -// Generates a string containing the path to the item specified by -// item_id. -void LLInventoryModel::appendPath(const LLUUID& id, std::string& path) const -{ -	std::string temp; -	const LLInventoryObject* obj = getObject(id); -	LLUUID parent_id; -	if(obj) parent_id = obj->getParentUUID(); -	std::string forward_slash("/"); -	while(obj) -	{ -		obj = getCategory(parent_id); -		if(obj) -		{ -			temp.assign(forward_slash + obj->getName() + temp); -			parent_id = obj->getParentUUID(); -		} -	} -	path.append(temp); -} -  bool LLInventoryModel::isInventoryUsable() const  {  	bool result = false; @@ -1024,98 +1000,6 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)  	}  } -void LLInventoryModel::deleteFromServer(LLDynamicArray<LLUUID>& category_ids, -										LLDynamicArray<LLUUID>& item_ids) -{ -	// Store off tre UUIDS of parents which are being deleted (thus no -	// need to increment) and the parents which are being modified. We -	// have to increment the version of the parent with each message -	// sent upstream since the dataserver will increment each unique -	// parent per update message. -	std::set<LLUUID> ignore_parents; -	update_map_t inc_parents; - -	S32 i; -	S32 count = category_ids.count(); -	BOOL start_new_message = TRUE; -	LLMessageSystem* msg = gMessageSystem; -	LLPointer<LLViewerInventoryCategory> cat; -	for(i = 0; i < count; i++) -	{ -		if(start_new_message) -		{ -			start_new_message = FALSE; -			msg->newMessageFast(_PREHASH_RemoveInventoryObjects); -			msg->nextBlockFast(_PREHASH_AgentData); -			msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); -			msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); -		} -		LLUUID cat_id = category_ids.get(i); - -		msg->nextBlockFast(_PREHASH_FolderData); -		msg->addUUIDFast(_PREHASH_FolderID, cat_id); -		cat = getCategory(cat_id); -		ignore_parents.insert(cat_id); -		addChangedMask(LLInventoryObserver::REMOVE | LLInventoryObserver::STRUCTURE, cat_id); -		if(cat.notNull() && (ignore_parents.find(cat->getParentUUID())==ignore_parents.end())) -		{ -			--inc_parents[cat->getParentUUID()]; -		} -		if(msg->isSendFullFast(_PREHASH_FolderData)) -		{ -			start_new_message = TRUE; -			msg->nextBlockFast(_PREHASH_ItemData); -			msg->addUUIDFast(_PREHASH_ItemID, LLUUID::null); -			gAgent.sendReliableMessage(); -			accountForUpdate(inc_parents); -			inc_parents.clear(); -		} -	} - -	count = item_ids.count(); -	std::set<LLUUID>::iterator not_ignored = ignore_parents.end(); -	LLPointer<LLViewerInventoryItem> item; -	if((0 == count) && (!start_new_message)) -	{ -		msg->nextBlockFast(_PREHASH_ItemData); -		msg->addUUIDFast(_PREHASH_ItemID, LLUUID::null); -	} -	for(i = 0; i < count; i++) -	{ -		if(start_new_message) -		{ -			start_new_message = FALSE; -			msg->newMessageFast(_PREHASH_RemoveInventoryObjects); -			msg->nextBlockFast(_PREHASH_AgentData); -			msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); -			msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); -			msg->nextBlockFast(_PREHASH_FolderData); -			msg->addUUIDFast(_PREHASH_FolderID, LLUUID::null); -		} -		LLUUID item_id = item_ids.get(i); -		msg->nextBlockFast(_PREHASH_ItemData); -		msg->addUUIDFast(_PREHASH_ItemID, item_id); -		item = getItem(item_id); -		addChangedMask(LLInventoryObserver::REMOVE | LLInventoryObserver::STRUCTURE, item_id); -		if(item.notNull() && (ignore_parents.find(item->getParentUUID()) == not_ignored)) -		{ -			--inc_parents[item->getParentUUID()]; -		} -		if(msg->isSendFullFast(_PREHASH_ItemData)) -		{ -			start_new_message = TRUE; -			gAgent.sendReliableMessage(); -			accountForUpdate(inc_parents); -			inc_parents.clear(); -		} -	} -	if(!start_new_message) -	{ -		gAgent.sendReliableMessage(); -		accountForUpdate(inc_parents); -	} -} -  // Add/remove an observer. If the observer is destroyed, be sure to  // remove it.  void LLInventoryModel::addObserver(LLInventoryObserver* observer) @@ -1206,29 +1090,7 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)  	}  } -// This method to prepares a set of mock inventory which provides -// minimal functionality before the actual arrival of inventory. -/* -void LLInventoryModel::mock(const LLUUID& root_id) -{ -	llinfos << "LLInventoryModel::mock() " << root_id << llendl; -	if(root_id.isNull()) -	{ -		llwarns << "Not a valid root id" << llendl; -		return; -	} -	LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory( -		root_id, -		LLUUID::null, -		LLAssetType::AT_CATEGORY, -		LLFolderType::lookupNewCategoryName(LLFolderType::FT_ROOT_INVENTORY), -		gAgent.getID()); -	addCategory(cat); -	gInventory.buildParentChildMap(); -} -*/ - -//If we get back a normal response, handle it here +// If we get back a normal response, handle it here  void  LLInventoryModel::fetchInventoryResponder::result(const LLSD& content)  {	  	start_new_inventory_observer(); @@ -1301,7 +1163,7 @@ void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::str  	gInventory.notifyObservers("fetchinventory");  } -bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) +bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const  {  	if(folder_id.isNull())   	{ @@ -1836,88 +1698,6 @@ bool LLInventoryModel::loadSkeleton(  	return rv;  } -bool LLInventoryModel::loadMeat(const LLSD& options, const LLUUID& owner_id) -{ -	llinfos << "importing inventory for " << owner_id << llendl; -	bool rv = true; -	for(LLSD::array_const_iterator it = options.beginArray(), -		end = options.endArray(); it != end; ++it) -	{ -		LLSD name = (*it)["name"]; -		LLSD item_id = (*it)["item_id"]; -		LLSD parent_id = (*it)["parent_id"]; -		LLSD asset_type = (*it)["type"]; -		LLSD data_id = (*it)["data_id"]; -		if(name.isDefined()  -			&& item_id.isDefined() -			&& parent_id.isDefined() -			&& asset_type.isDefined() -			&& data_id.isDefined()) -		{ -			LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem; -			item->rename(name.asString()); -			item->setUUID(item_id.asUUID()); -			item->setParent(parent_id.asUUID()); -			LLAssetType::EType type = (LLAssetType::EType)asset_type.asInteger(); -            item->setType(type); - -			LLSD llsd_inv_type = (*it)["inv_type"]; -			if(llsd_inv_type.isDefined()) -            { -				LLInventoryType::EType inv_type = (LLInventoryType::EType)llsd_inv_type.asInteger(); -                item->setInventoryType(inv_type); -            } - -            if(LLAssetType::AT_CALLINGCARD == type) -            { -                LLPermissions perm; -				perm.init(data_id.asUUID(), owner_id, LLUUID::null, LLUUID::null); -                item->setPermissions(perm); -            } -            else -            { -				LLPermissions default_perm; -				default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null); -				LLSD llsd_perm_mask = (*it)["perm_mask"]; -				if(llsd_perm_mask.isDefined()) -                { -					PermissionMask perm_mask = llsd_perm_mask.asInteger(); -					default_perm.initMasks( -						perm_mask, perm_mask, perm_mask, perm_mask, perm_mask); -				} -				else -				{ -					default_perm.initMasks( -						PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE); -				} -				item->setPermissions(default_perm); -				item->setAssetUUID(data_id.asUUID()); -            } - -			LLSD flags = (*it)["flags"]; -			if(flags.isDefined()) -            { -				// Not sure how well LLSD.asInteger() maps to  -				// unsigned long - using strtoul() -				item->setFlags(strtoul(flags.asString().c_str(), NULL, 0)); -            } - -			LLSD time = (*it)["time"]; -			if(time.isDefined()) -            { -				item->setCreationDate(time.asInteger()); -            } -            addItem(item); -		} -		else -		{ -			llwarns << "Unable to import near " << name.asString() << llendl; -            rv = false; -		} -	} -	return rv; -} -  // This is a brute force method to rebuild the entire parent-child  // relations. The overall operation has O(NlogN) performance, which  // should be sufficient for our needs.  @@ -2185,73 +1965,6 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const  	return (mID > rhs.mID);  } -// Given the current state of the inventory items, figure out the -// clone information. *FIX: This is sub-optimal, since we can insert -// this information snurgically, but this makes sure the implementation -// works before we worry about optimization. -//void LLInventoryModel::recalculateCloneInformation() -//{ -//	//dumpInventory(); -// -//	// This implements a 'multi-map' like structure to keep track of -//	// how many clones we find. -//	typedef LLDynamicArray<LLViewerInventoryItem*> viewer_item_array_t; -//	typedef std::map<LLUUIDAndName, viewer_item_array_t*> clone_map_t; -//	clone_map_t clone_map; -//	LLUUIDAndName id_and_name; -//	viewer_item_array_t* clones = NULL; -//	LLViewerInventoryItem* item = NULL; -//	for(item = (LLViewerInventoryItem*)mItemMap.getFirstData(); -//		item != NULL; -//		item = (LLViewerInventoryItem*)mItemMap.getNextData()) -//	{ -//		if(item->getType() == LLAssetType::AT_CALLINGCARD) -//		{ -//			// if it's a calling card, we key off of the creator id, not -//			// the asset id. -//			id_and_name.mID = item->getCreatorUUID(); -//		} -//		else -//		{ -//			// if it's not a calling card, we key clones from the -//			// asset id. -//			id_and_name.mID = item->getAssetUUID(); -//		} -//		if(id_and_name.mID == LLUUID::null) -//		{ -//			continue; -//		} -//		id_and_name.mName = item->getName(); -//		if(clone_map.checkData(id_and_name)) -//		{ -//			clones = clone_map.getData(id_and_name); -//		} -//		else -//		{ -//			clones = new viewer_item_array_t; -//			clone_map.addData(id_and_name, clones); -//		} -//		clones->put(item); -//	} -// -//	S32 count = 0; -//	for(clones = clone_map.getFirstData(); -//		clones != NULL; -//		clones = clone_map.getNextData()) -//	{ -//		count = clones->count(); -//		for(S32 i = 0; i < count; i++) -//		{ -//			item = clones->get(i); -//			item->setCloneCount(count - 1); -//			//clones[i] = NULL; -//		} -//		delete clones; -//	} -//	clone_map.removeAllData(); -//	//dumpInventory(); -//} -  // static  bool LLInventoryModel::loadFromFile(const std::string& filename,  									LLInventoryModel::cat_array_t& categories, @@ -3097,6 +2810,10 @@ static LLInventoryModel::item_array_t::iterator find_item_iter_by_uuid(LLInvento  }  // static +// * @param[in, out] items - vector with items to be updated. It should be sorted in a right way +// * before calling this method. +// * @param src_item_id - LLUUID of inventory item to be moved in new position +// * @param dest_item_id - LLUUID of inventory item before which source item should be placed.  void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id)  {  	LLInventoryModel::item_array_t::iterator it_src = find_item_iter_by_uuid(items, src_item_id); @@ -3112,6 +2829,7 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c  	items.insert(it_dest, src_item);  } +//* @param[in] items vector of items in order to be saved.  void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items)  {  	int sortField = 0; @@ -3155,6 +2873,8 @@ static void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& i  	std::sort(items.begin(), items.end(), sort_functor);  } +// * @param source_item_id - LLUUID of the source item to be moved into new position +// * @param target_item_id - LLUUID of the target item before which source item should be placed.  void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id)  {  	LLInventoryModel::cat_array_t cats; diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index b7c1b57397..5f5d4d6118 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -58,17 +58,15 @@ class LLMessageSystem;  class LLInventoryCollectFunctor; -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryModel +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// LLInventoryModel  // -// This class represents a collection of inventory, and provides -// efficient ways to access that information. This class could in -// theory be used for any place where you need inventory, though it -// optimizes for time efficiency - not space efficiency, probably -// making it inappropriate for use on tasks. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - +// Represents a collection of inventory, and provides efficient ways to access  +// that information. +//   NOTE: This class could in theory be used for any place where you need  +//   inventory, though it optimizes for time efficiency - not space efficiency,  +//   probably making it inappropriate for use on tasks. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  class LLInventoryModel  {  public: @@ -84,79 +82,129 @@ public:  	typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;  	typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;  	typedef std::set<LLUUID> changed_items_t; -	 -	// construction & destruction -	LLInventoryModel(); -	~LLInventoryModel(); -	 -	void cleanupInventory(); -	 +  	class fetchInventoryResponder : public LLHTTPClient::Responder  	{  	public:  		fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};  		void result(const LLSD& content);			 -		  		void error(U32 status, const std::string& reason); - -	public: -		typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;  	protected:  		LLSD mRequestSD;  	}; -	// -	// Accessors -	// +/******************************************************************************** + **                                                                            ** + **                    INITIALIZATION/SETUP + **/ -	// Check if one object has a parent chain up to the category specified by UUID. -	BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const; +	//-------------------------------------------------------------------- +	// Constructors / Destructors +	//-------------------------------------------------------------------- +public: +	LLInventoryModel(); +	~LLInventoryModel(); +	void cleanupInventory(); +protected: +	void empty(); // empty the entire contents -	// Get whatever special folder this object is a child of, if any. -	const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const; +	//-------------------------------------------------------------------- +	// Initialization +	//-------------------------------------------------------------------- +public: +	// The inventory model usage is sensitive to the initial construction of the model +	bool isInventoryUsable() const; +private: +	bool mIsAgentInvUsable; // used to handle an invalid inventory state -	// Get the object by id. Returns NULL if not found. -	// * WARNING: use the pointer returned for read operations - do -	// not modify the object values in place or you will break stuff. -	LLInventoryObject* getObject(const LLUUID& id) const; +	//-------------------------------------------------------------------- +	// Root Folders +	//-------------------------------------------------------------------- +public: +	// The following are set during login with data from the server +	void setRootFolderID(const LLUUID& id); +	void setLibraryOwnerID(const LLUUID& id); +	void setLibraryRootFolderID(const LLUUID& id); -	// Get the item by id. Returns NULL if not found. -	// * WARNING: use the pointer for read operations - use the -	// updateItem() method to actually modify values. -	LLViewerInventoryItem* getItem(const LLUUID& id) const; +	const LLUUID &getRootFolderID() const; +	const LLUUID &getLibraryOwnerID() const; +	const LLUUID &getLibraryRootFolderID() const; +private: +	LLUUID mRootFolderID; +	LLUUID mLibraryRootFolderID; +	LLUUID mLibraryOwnerID;	 +	 +	//-------------------------------------------------------------------- +	// Structure +	//-------------------------------------------------------------------- +public: +	// Methods to load up inventory skeleton & meat. These are used +	// during authentication. Returns true if everything parsed. +	bool loadSkeleton(const LLSD& options, const LLUUID& owner_id); +	void buildParentChildMap(); // brute force method to rebuild the entire parent-child relations +	// Call on logout to save a terse representation. +	void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id); +private: +	// Information for tracking the actual inventory. We index this +	// information in a lot of different ways so we can access +	// the inventory using several different identifiers. +	// mInventory member data is the 'master' list of inventory, and +	// mCategoryMap and mItemMap store uuid->object mappings.  +	typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t; +	typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t; +	cat_map_t mCategoryMap; +	item_map_t mItemMap; +	// This last set of indices is used to map parents to children. +	typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t; +	typedef std::map<LLUUID, item_array_t*> parent_item_map_t; +	parent_cat_map_t mParentChildCategoryTree; +	parent_item_map_t mParentChildItemTree; -	// Get the category by id. Returns NULL if not found. -	// * WARNING: use the pointer for read operations - use the -	// updateCategory() method to actually modify values. -	LLViewerInventoryCategory* getCategory(const LLUUID& id) const; +	//-------------------------------------------------------------------- +	// Login +	//-------------------------------------------------------------------- +public: +	static BOOL getIsFirstTimeInViewer2(); +private: +	static BOOL sFirstTimeInViewer2; +	const static S32 sCurrentInvCacheVersion; // expected inventory cache version -	// Return the number of items or categories -	S32 getItemCount() const; -	S32 getCategoryCount() const; +/**                    Initialization/Setup + **                                                                            ** + *******************************************************************************/ + +/******************************************************************************** + **                                                                            ** + **                    ACCESSORS + **/ + +	//-------------------------------------------------------------------- +	// Descendents +	//-------------------------------------------------------------------- +public: +	// Make sure we have the descendents in the structure.  Returns true +	// if a fetch was performed. +	bool fetchDescendentsOf(const LLUUID& folder_id) const;  	// Return the direct descendents of the id provided.Set passed  	// in values to NULL if the call fails. -	// *WARNING: The array provided points straight into the guts of -	// this object, and should only be used for read operations, since -	// modifications may invalidate the internal state of the -	// inventory. +	//    NOTE: The array provided points straight into the guts of +	//    this object, and should only be used for read operations, since +	//    modifications may invalidate the internal state of the inventory.  	void getDirectDescendentsOf(const LLUUID& cat_id,  								cat_array_t*& categories,  								item_array_t*& items) const; -	// SJB: Added version to lock the arrays to catch potential logic bugs -	void lockDirectDescendentArrays(const LLUUID& cat_id, -									cat_array_t*& categories, -									item_array_t*& items); -	void unlockDirectDescendentArrays(const LLUUID& cat_id); -	  	// Starting with the object specified, add its descendents to the  	// array provided, but do not add the inventory object specified -	// by id. There is no guaranteed order. Neither array will be -	// erased before adding objects to it. Do not store a copy of the -	// pointers collected - use them, and collect them again later if -	// you need to reference the same objects. -	enum { EXCLUDE_TRASH = FALSE, INCLUDE_TRASH = TRUE }; +	// by id. There is no guaranteed order.  +	//    NOTE: Neither array will be erased before adding objects to it.  +	//    Do not store a copy of the pointers collected - use them, and  +	//    collect them again later if you need to reference the same objects. +	enum {  +		EXCLUDE_TRASH = FALSE,  +		INCLUDE_TRASH = TRUE  +	};  	void collectDescendents(const LLUUID& id,  							cat_array_t& categories,  							item_array_t& items, @@ -172,156 +220,162 @@ public:  	// Assumes item_id is itself not a linked item.  	item_array_t collectLinkedItems(const LLUUID& item_id,  									const LLUUID& start_folder_id = LLUUID::null); +	 -	// Get the inventoryID that this item points to, else just return item_id +	// Check if one object has a parent chain up to the category specified by UUID. +	BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const; + +	//-------------------------------------------------------------------- +	// Find +	//-------------------------------------------------------------------- +public: +	// Returns the uuid of the category that specifies 'type' as what it  +	// defaults to containing. The category is not necessarily only for that type.  +	//    NOTE: If create_folder is true, this will create a new inventory category  +	//    on the fly if one does not exist. *NOTE: if find_in_library is true it  +	//    will search in the user's library folder instead of "My Inventory" +	const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type,  +										 bool create_folder = true,  +										 bool find_in_library = false); +	 +	// Get whatever special folder this object is a child of, if any. +	const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const; + +	// Get the object by id. Returns NULL if not found. +	//   NOTE: Use the pointer returned for read operations - do +	//   not modify the object values in place or you will break stuff. +	LLInventoryObject* getObject(const LLUUID& id) const; + +	// Get the item by id. Returns NULL if not found. +	//    NOTE: Use the pointer for read operations - use the +	//    updateItem() method to actually modify values. +	LLViewerInventoryItem* getItem(const LLUUID& id) const; + +	// Get the category by id. Returns NULL if not found. +	//    NOTE: Use the pointer for read operations - use the +	//    updateCategory() method to actually modify values. +	LLViewerInventoryCategory* getCategory(const LLUUID& id) const; + +	// Get the inventoryID that this item points to, else just return item_id.  	const LLUUID& getLinkedItemID(const LLUUID& object_id) const; +private: +	mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups	 -	// The inventory model usage is sensitive to the initial construction of the  -	// model.  -	bool isInventoryUsable() const; +	//-------------------------------------------------------------------- +	// Count +	//-------------------------------------------------------------------- +public: +	// Return the number of items or categories +	S32 getItemCount() const; +	S32 getCategoryCount() const; + +/**                    Accessors + **                                                                            ** + *******************************************************************************/ -	// -	// Mutators -	// +/******************************************************************************** + **                                                                            ** + **                    MUTATORS + **/ -	// Calling this method with an inventory item will either change -	// an existing item with a matching item_id, or will add the item +public: +	// Change an existing item with a matching item_id or add the item  	// to the current inventory. Returns the change mask generated by  	// the update. No notification will be sent to observers. This  	// method will only generate network traffic if the item had to be  	// reparented. -	// *NOTE: In usage, you will want to perform cache accounting -	// operations in LLInventoryModel::accountForUpdate() or -	// LLViewerInventoryItem::updateServer() before calling this -	// method. +	//    NOTE: In usage, you will want to perform cache accounting +	//    operations in LLInventoryModel::accountForUpdate() or +	//    LLViewerInventoryItem::updateServer() before calling this method.  	U32 updateItem(const LLViewerInventoryItem* item); -	// Calling this method with an inventory category will either -	// change an existing item with the matching id, or it will add +	// Change an existing item with the matching id or add  	// the category. No notifcation will be sent to observers. This  	// method will only generate network traffic if the item had to be  	// reparented. -	// *NOTE: In usage, you will want to perform cache accounting -	// operations in LLInventoryModel::accountForUpdate() or -	// LLViewerInventoryCategory::updateServer() before calling this -	// method. +	//    NOTE: In usage, you will want to perform cache accounting +	//    operations in accountForUpdate() or LLViewerInventoryCategory:: +	//    updateServer() before calling this method.  	void updateCategory(const LLViewerInventoryCategory* cat); -	// This method will move the specified object id to the specified -	// category, update the internal structures. No cache accounting, +	// Move the specified object id to the specified category and +	// update the internal structures. No cache accounting,  	// observer notification, or server update is performed.  	void moveObject(const LLUUID& object_id, const LLUUID& cat_id); -	// delete a particular inventory object by ID. This will purge one -	// object from the internal data structures maintaining a +	//-------------------------------------------------------------------- +	// Delete +	//-------------------------------------------------------------------- +public: +	// Delete a particular inventory object by ID. Will purge one +	// object from the internal data structures, maintaining a  	// consistent internal state. No cache accounting, observer -	// notification, or server update is performed.  Purges linked items. +	// notification, or server update is performed.  	void deleteObject(const LLUUID& id); +	void removeItem(const LLUUID& item_id); -	// delete a particular inventory object by ID, and delete it from -	// the server.  Also updates linked items. +	// Delete a particular inventory object by ID, and delete it from +	// the server. Also updates linked items.  	void purgeObject(const LLUUID& id); -	void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id); -	// This is a method which collects the descendants of the id +	// Collects and purges the descendants of the id  	// provided. If the category is not found, no action is  	// taken. This method goes through the long winded process of  	// removing server representation of folders and items while doing  	// cache accounting in a fairly efficient manner. This method does  	// not notify observers (though maybe it should...)  	void purgeDescendentsOf(const LLUUID& id); +protected: +	void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id); +	 +	//-------------------------------------------------------------------- +	// Reorder +	//-------------------------------------------------------------------- +public: +	// Changes items order by insertion of the item identified by src_item_id +	// before the item identified by dest_item_id. Both items must exist in items array. +	// Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id. +	static void updateItemsOrder(LLInventoryModel::item_array_t& items,  +								 const LLUUID& src_item_id,  +								 const LLUUID& dest_item_id); + +	// Saves current order of the passed items using inventory item sort field. +	// Resets 'items' sort fields and saves them on server. +	// Is used to save order for Favorites folder. +	void saveItemsOrder(const LLInventoryModel::item_array_t& items); -	// This method optimally removes the referenced categories and -	// items from the current agent's inventory in the database. It -	// performs all of the during deletion. The local representation -	// is not removed. -	void deleteFromServer(LLDynamicArray<LLUUID>& category_ids, -						  LLDynamicArray<LLUUID>& item_ids); - -	// Add/remove an observer. If the observer is destroyed, be sure -	// to remove it. -	void addObserver(LLInventoryObserver* observer); -	void removeObserver(LLInventoryObserver* observer); -	BOOL containsObserver(LLInventoryObserver* observer) const; - -	// -	// Misc Methods  -	// - -	// findCategoryUUIDForType() returns the uuid of the category that -	// specifies 'type' as what it defaults to containing. The -	// category is not necessarily only for that type. *NOTE: If create_folder is true, this -	// will create a new inventory category on the fly if one does not exist. *NOTE: if find_in_library is -	// true it will search in the user's library folder instead of "My Inventory" -	// SDK: Added flag to specify whether the folder should be created if not found.  This fixes the horrible -	// multiple trash can bug. -	const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder = true, bool find_in_library = false); - -	// This gets called by the idle loop.  It only updates if new -	// state is detected.  Call notifyObservers() manually to update -	// regardless of whether state change has been indicated. -	void idleNotifyObservers(); - -	// Call this method to explicitly update everyone on a new state. -	// The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328] -	void notifyObservers(const std::string service_name=""); - -	// This allows outsiders to tell the inventory if something has -	// been changed 'under the hood', but outside the control of the -	// inventory. For example, if we grant someone modify permissions, -	// then that changes the data structures for LLAvatarTracker, but -	// potentially affects inventory observers. This API makes sure -	// that the next notify will include that notification. -	void addChangedMask(U32 mask, const LLUUID& referent); - -	const changed_items_t& getChangedIDs() const { return mChangedItemIDs; } - -	// This method to prepares a set of mock inventory which provides -	// minimal functionality before the actual arrival of inventory. -	//void mock(const LLUUID& root_id); - -	// Make sure we have the descendents in the structure.  Returns true -	// if a fetch was performed. -	bool fetchDescendentsOf(const LLUUID& folder_id); - -	// call this method to request the inventory. -	//void requestFromServer(const LLUUID& agent_id); - -	// call this method on logout to save a terse representation -	void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id); - -	// Generates a string containing the path to the item specified by -	// item_id. -	void appendPath(const LLUUID& id, std::string& path) const; - -	// message handling functionality -	static void registerCallbacks(LLMessageSystem* msg); +	// Rearranges Landmarks inside Favorites folder. +	// Moves source landmark before target one. +	void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id); -	// Convenience function to create a new category. You could call -	// updateCatgory() with a newly generated UUID category, but this -	// version will take care of details like what the name should be -	// based on preferred type. Returns the UUID of the new -	// category. If you want to use the default name based on type, -	// pass in a NULL to the 'name parameter. +	//-------------------------------------------------------------------- +	// Creation +	//-------------------------------------------------------------------- +public: +	// Returns the UUID of the new category. If you want to use the default  +	// name based on type, pass in a NULL to the 'name' parameter.  	LLUUID createNewCategory(const LLUUID& parent_id,  							 LLFolderType::EType preferred_type,  							 const std::string& name); +protected: +	// Internal methods that add inventory and make sure that all of +	// the internal data structures are consistent. These methods +	// should be passed pointers of newly created objects, and the +	// instance will take over the memory management from there. +	void addCategory(LLViewerInventoryCategory* category); +	void addItem(LLViewerInventoryItem* item); +	 +/**                    Mutators + **                                                                            ** + *******************************************************************************/ -	// methods to load up inventory skeleton & meat. These are used -	// during authentication. return true if everything parsed. -	bool loadSkeleton(const LLSD& options, const LLUUID& owner_id); -	bool loadMeat(const LLSD& options, const LLUUID& owner_id); - -	// This is a brute force method to rebuild the entire parent-child -	// relations. -	void buildParentChildMap(); - -	// -	// Category accounting. -	// +/******************************************************************************** + **                                                                            ** + **                    CATEGORY ACCOUNTING + **/ -	// This structure represents the number of items added or removed -	// from a category. +public: +	// Represents the number of items added or removed from a category.  	struct LLCategoryUpdate  	{  		LLCategoryUpdate() : mDescendentDelta(0) {} @@ -333,8 +387,7 @@ public:  	};  	typedef std::vector<LLCategoryUpdate> update_list_t; -	// This structure eixts to make it easier to account for deltas in -	// a map. +	// This exists to make it easier to account for deltas in a map.  	struct LLInitializedS32  	{  		LLInitializedS32() : mValue(0) {} @@ -345,102 +398,89 @@ public:  	};  	typedef std::map<LLUUID, LLInitializedS32> update_map_t; -	// Call these methods when there are category updates, but call -	// them *before* the actual update so the method can do descendent -	// accounting correctly. +	// Call when there are category updates.  Call them *before* the  +	// actual update so the method can do descendent accounting correctly.  	void accountForUpdate(const LLCategoryUpdate& update) const;  	void accountForUpdate(const update_list_t& updates);  	void accountForUpdate(const update_map_t& updates); -	// Return child status of category children. yes/no/maybe +	// Return (yes/no/maybe) child status of category children.  	EHasChildren categoryHasChildren(const LLUUID& cat_id) const; -	// returns true iff category version is known and theoretical +	// Returns true iff category version is known and theoretical  	// descendents == actual descendents.  	bool isCategoryComplete(const LLUUID& cat_id) const; -	// callbacks -	// Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed -	void emptyFolderType(const std::string notification, LLFolderType::EType folder_type); -	bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type); - -	// Utility Functions -	void removeItem(const LLUUID& item_id); -	 -	// Data about the agent's root folder and root library folder -	// are stored here, rather than in LLAgent where it used to be, because -	// gInventory is a singleton and represents the agent's inventory. -	// The "library" is actually the inventory of a special agent, -	// usually Alexandria Linden. -	const LLUUID &getRootFolderID() const; -	const LLUUID &getLibraryOwnerID() const; -	const LLUUID &getLibraryRootFolderID() const; - -	// These are set during login with data from the server -	void setRootFolderID(const LLUUID& id); -	void setLibraryOwnerID(const LLUUID& id); -	void setLibraryRootFolderID(const LLUUID& id); +/**                    Category Accounting + **                                                                            ** + *******************************************************************************/ +/******************************************************************************** + **                                                                            ** + **                    NOTIFICATIONS + **/ -	/** -	 * Changes items order by insertion of the item identified by src_item_id -	 * BEFORE the item identified by dest_item_id. Both items must exist in items array. -	 * -	 * Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id. -	 * -	 * @param[in, out] items - vector with items to be updated. It should be sorted in a right way -	 * before calling this method. -	 * @param src_item_id - LLUUID of inventory item to be moved in new position -	 * @param dest_item_id - LLUUID of inventory item before which source item should be placed. -	 */ -	static void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id); - -	/** -	 * Saves current order of the passed items using inventory item sort field. -	 * -	 * It reset items' sort fields and saves them on server. -	 * Is used to save order for Favorites folder. -	 * -	 * @param[in] items vector of items in order to be saved. -	 */ -	void saveItemsOrder(const LLInventoryModel::item_array_t& items); +public: +	// Called by the idle loop.  Only updates if new state is detected.  Call  +	// notifyObservers() manually to update regardless of whether state change  +	// has been indicated. +	void idleNotifyObservers(); -	/** -	 * Rearranges Landmarks inside Favorites folder. -	 * Moves source landmark before target one. -	 * -	 * @param source_item_id - LLUUID of the source item to be moved into new position -	 * @param target_item_id - LLUUID of the target item before which source item should be placed. -	 */ -	void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id); +	// Call to explicitly update everyone on a new state.  The optional argument +	// 'service_name' is used by Agent Inventory Service [DEV-20328] +	void notifyObservers(const std::string service_name=""); +	// Allows outsiders to tell the inventory if something has +	// been changed 'under the hood', but outside the control of the +	// inventory. The next notify will include that notification. +	void addChangedMask(U32 mask, const LLUUID& referent); +	const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }  protected: +	// Updates all linked items pointing to this id. +	void addChangedMaskForLinks(const LLUUID& object_id, U32 mask); +private: +	// Flag set when notifyObservers is being called, to look for bugs +	// where it's called recursively. +	BOOL mIsNotifyObservers; +	// Variables used to track what has changed since the last notify. +	U32 mModifyMask; +	changed_items_t mChangedItemIDs; +	 +	//-------------------------------------------------------------------- +	// Observers +	//-------------------------------------------------------------------- +public: +	// If the observer is destroyed, be sure to remove it. +	void addObserver(LLInventoryObserver* observer); +	void removeObserver(LLInventoryObserver* observer); +	BOOL containsObserver(LLInventoryObserver* observer) const; +private: +	typedef std::set<LLInventoryObserver*> observer_list_t; +	observer_list_t mObservers; +	 +/**                    Notifications + **                                                                            ** + *******************************************************************************/ -	// Internal methods which add inventory and make sure that all of -	// the internal data structures are consistent. These methods -	// should be passed pointers of newly created objects, and the -	// instance will take over the memory management from there. -	void addCategory(LLViewerInventoryCategory* category); -	void addItem(LLViewerInventoryItem* item); - -	// ! DEPRECRATE ! Remove this and add it into findCategoryUUIDForType, -	// since that's the only function that uses this.  It's too confusing  -	// having both methods. -	//  -	// Internal method which looks for a category with the specified -	// preferred type. Returns LLUUID::null if not found - 	const LLUUID &findCatUUID(LLFolderType::EType preferred_type, bool find_in_library = false) const; -	// Empty the entire contents -	void empty(); +/******************************************************************************** + **                                                                            ** + **                    MISCELLANEOUS + **/ -	// Given the current state of the inventory items, figure out the -	// clone information. *FIX: This is sub-optimal, since we can -	// insert this information snurgically, but this makes sure the -	// implementation works before we worry about optimization. -	//void recalculateCloneInformation(); +	//-------------------------------------------------------------------- +	// Callbacks +	//-------------------------------------------------------------------- +public: +	// Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed +	void emptyFolderType(const std::string notification, LLFolderType::EType folder_type); +	bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type); +	static void registerCallbacks(LLMessageSystem* msg); -	// file import/export. +	//-------------------------------------------------------------------- +	// File I/O +	//-------------------------------------------------------------------- +protected:  	static bool loadFromFile(const std::string& filename,  							 cat_array_t& categories,  							 item_array_t& items, @@ -449,86 +489,46 @@ protected:  						   const cat_array_t& categories,  						   const item_array_t& items);  -	// message handling functionality -	//static void processUseCachedInventory(LLMessageSystem* msg, void**); +	//-------------------------------------------------------------------- +	// Message handling functionality +	//-------------------------------------------------------------------- +public:  	static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**);  	static void processRemoveInventoryItem(LLMessageSystem* msg, void**);  	static void processUpdateInventoryFolder(LLMessageSystem* msg, void**);  	static void processRemoveInventoryFolder(LLMessageSystem* msg, void**); -	//static void processExchangeCallingcard(LLMessageSystem* msg, void**); -	//static void processAddCallingcard(LLMessageSystem* msg, void**); -	//static void processDeclineCallingcard(LLMessageSystem* msg, void**);  	static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**);  	static void processBulkUpdateInventory(LLMessageSystem* msg, void**);  	static void processInventoryDescendents(LLMessageSystem* msg, void**);  	static void processMoveInventoryItem(LLMessageSystem* msg, void**);  	static void processFetchInventoryReply(LLMessageSystem* msg, void**); -	 +protected:  	bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting); -	// Updates all linked items pointing to this id. -	void addChangedMaskForLinks(const LLUUID& object_id, U32 mask); - +	//-------------------------------------------------------------------- +	// Locks +	//-------------------------------------------------------------------- +public: +	void lockDirectDescendentArrays(const LLUUID& cat_id, +									cat_array_t*& categories, +									item_array_t*& items); +	void unlockDirectDescendentArrays(const LLUUID& cat_id);  protected:  	cat_array_t* getUnlockedCatArray(const LLUUID& id);  	item_array_t* getUnlockedItemArray(const LLUUID& id); -	  private: -	// Variables used to track what has changed since the last notify. -	U32 mModifyMask; -	changed_items_t mChangedItemIDs; -  	std::map<LLUUID, bool> mCategoryLock;  	std::map<LLUUID, bool> mItemLock; -	// cache recent lookups -	mutable LLPointer<LLViewerInventoryItem> mLastItem; - -	// This last set of indices is used to map parents to children. -	typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t; -	typedef std::map<LLUUID, item_array_t*> parent_item_map_t; -	parent_cat_map_t mParentChildCategoryTree; -	parent_item_map_t mParentChildItemTree; - -	typedef std::set<LLInventoryObserver*> observer_list_t; -	observer_list_t mObservers; - -	// Agent inventory folder information. -	LLUUID mRootFolderID; -	LLUUID mLibraryRootFolderID; -	LLUUID mLibraryOwnerID; - -	// Expected inventory cache version -	const static S32 sCurrentInvCacheVersion; -	 -	// This flag is used to handle an invalid inventory state. -	bool mIsAgentInvUsable; - -private: -	// Information for tracking the actual inventory. We index this -	// information in a lot of different ways so we can access -	// the inventory using several different identifiers. -	// mInventory member data is the 'master' list of inventory, and -	// mCategoryMap and mItemMap store uuid->object mappings.  -	typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t; -	typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t; -	//inv_map_t mInventory; -	cat_map_t mCategoryMap; -	item_map_t mItemMap; - -	// Flag set when notifyObservers is being called, to look for bugs -	// where it's called recursively. -	BOOL mIsNotifyObservers; +	//-------------------------------------------------------------------- +	// Debugging +	//--------------------------------------------------------------------  public: -	// *NOTE: DEBUG functionality  	void dumpInventory() const; -	//////////////////////////////////////////////////////////////////////////////// -	// Login status -public: -	static BOOL getIsFirstTimeInViewer2(); -private: -	static BOOL sFirstTimeInViewer2; +/**                    Miscellaneous + **                                                                            ** + *******************************************************************************/  };  // a special inventory model for the agent diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 9533d820eb..24bd2739f7 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -71,9 +71,10 @@ class LLTexGlobalColor;  class LLVOAvatarBoneInfo;  class LLVOAvatarSkeletonInfo; -//------------------------------------------------------------------------ +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  // LLVOAvatar -//------------------------------------------------------------------------ +//  +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  class LLVOAvatar :  	public LLViewerObject,  	public LLCharacter @@ -138,13 +139,13 @@ public:  	virtual void   	 	 	updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax);  	virtual void   	 	 	getSpatialExtents(LLVector3& newMin, LLVector3& newMax);  	virtual BOOL   	 	 	lineSegmentIntersect(const LLVector3& start, const LLVector3& end, -													 S32 face = -1,                    // which face to check, -1 = ALL_SIDES -													 BOOL pick_transparent = FALSE, -													 S32* face_hit = NULL,             // which face was hit -													 LLVector3* intersection = NULL,   // return the intersection point -													 LLVector2* tex_coord = NULL,      // return the texture coordinates of the intersection point -													 LLVector3* normal = NULL,         // return the surface normal at the intersection point -													 LLVector3* bi_normal = NULL);     // return the surface bi-normal at the intersection point +												 S32 face = -1,                    // which face to check, -1 = ALL_SIDES +												 BOOL pick_transparent = FALSE, +												 S32* face_hit = NULL,             // which face was hit +												 LLVector3* intersection = NULL,   // return the intersection point +												 LLVector2* tex_coord = NULL,      // return the texture coordinates of the intersection point +												 LLVector3* normal = NULL,         // return the surface normal at the intersection point +												 LLVector3* bi_normal = NULL);     // return the surface bi-normal at the intersection point  	//--------------------------------------------------------------------  	// LLCharacter interface and related diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index e5949ae941..460291a929 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -39,9 +39,10 @@  struct LocalTextureData; -//------------------------------------------------------------------------ +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  // LLVOAvatarSelf -//------------------------------------------------------------------------ +// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  class LLVOAvatarSelf :  	public LLVOAvatar  { | 
