diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llprimitive/llmaterialid.cpp | 7 | ||||
| -rw-r--r-- | indra/llprimitive/llmaterialid.h | 2 | ||||
| -rw-r--r-- | indra/newview/llmaterialmgr.cpp | 69 | 
3 files changed, 53 insertions, 25 deletions
| diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp index 590f5cd91f..820f62c43c 100644 --- a/indra/llprimitive/llmaterialid.cpp +++ b/indra/llprimitive/llmaterialid.cpp @@ -150,6 +150,13 @@ std::string LLMaterialID::asString() const  	return materialIDString;  } +std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id) +{ +	s << material_id.asString(); +	return s; +} + +  void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID)  {  	llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8))); diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index 9db4065302..0a95204085 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -60,6 +60,8 @@ public:  	LLSD          asLLSD() const;  	std::string   asString() const; +	friend std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id); +  	static const LLMaterialID null;  private: diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 3138bfd4e1..aa98748dbe 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -2,9 +2,9 @@   * @file llmaterialmgr.cpp   * @brief Material manager   * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * $LicenseInfo:firstyear=2013&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2013, Linden Research, Inc.   *    * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public @@ -96,10 +96,10 @@ void LLMaterialsResponder::result(const LLSD& pContent)  void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason)  { -	LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; -	LL_WARNS("debugMaterials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME +	LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL; +	LL_WARNS("Materials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME  		<< "' with url '" << mCapabilityURL	<< "' because " << pReason << LL_ENDL; -	LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; +	LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL;  	LLSD emptyResult;  	mCallback(false, emptyResult); @@ -128,23 +128,31 @@ bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& ma  const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id)  { +	LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; +	LLMaterialPtr material;  	material_map_t::const_iterator itMaterial = mMaterials.find(material_id);  	if (mMaterials.end() != itMaterial)  	{ -		return itMaterial->second; +		material = itMaterial->second; +		LL_DEBUGS("Materials") << " found material " << LL_ENDL;  	} - -	if (!isGetPending(region_id, material_id)) +	else  	{ -		get_queue_t::iterator itQueue = mGetQueue.find(region_id); -		if (mGetQueue.end() == itQueue) +		if (!isGetPending(region_id, material_id))  		{ -			std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t())); -			itQueue = ret.first; +			LL_DEBUGS("Materials") << " material pending " << material_id << LL_ENDL; +			get_queue_t::iterator itQueue = mGetQueue.find(region_id); +			if (mGetQueue.end() == itQueue) +			{ +				std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t())); +				itQueue = ret.first; +			} +			itQueue->second.insert(material_id);  		} -		itQueue->second.insert(material_id); +		LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL; +		material = LLMaterialPtr();  	} -	return LLMaterialPtr(); +	return material;  }  boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb) @@ -188,8 +196,13 @@ void LLMaterialMgr::getAll(const LLUUID& region_id)  {  	if (!isGetAllPending(region_id))  	{ +		LL_DEBUGS("Materials") << "queuing for region " << region_id << LL_ENDL;  		mGetAllQueue.insert(region_id);  	} +	else +	{ +		LL_DEBUGS("Materials") << "already pending for region " << region_id << LL_ENDL; +	}  }  boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMaterialMgr::getall_callback_t::slot_type cb) @@ -210,6 +223,7 @@ boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMat  void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material)  { +	LL_DEBUGS("Materials") << "object " << object_id << LL_ENDL;  	put_queue_t::iterator itQueue = mPutQueue.find(object_id);  	if (mPutQueue.end() == itQueue)  	{ @@ -230,9 +244,11 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial&  const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data)  { +	LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;  	material_map_t::const_iterator itMaterial = mMaterials.find(material_id);  	if (mMaterials.end() == itMaterial)  	{ +		LL_DEBUGS("Materials") << "new material" << LL_ENDL;  		LLMaterialPtr newMaterial(new LLMaterial(material_data));  		std::pair<material_map_t::const_iterator, bool> ret = mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, newMaterial));  		itMaterial = ret.first; @@ -257,6 +273,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI  	if (!success)  	{  		// *TODO: is there any kind of error handling we can do here? +		LL_WARNS("Materials")<< "failed"<<LL_ENDL;  		return;  	} @@ -271,7 +288,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI  	LLSD response_data;  	if (!unzip_llsd(response_data, content_stream, content_binary.size()))  	{ -		LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; +		LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;  		return;  	} @@ -297,6 +314,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL  	if (!success)  	{  		// *TODO: is there any kind of error handling we can do here? +		LL_WARNS("Materials")<< "failed"<<LL_ENDL;  		return;  	} @@ -311,7 +329,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL  	LLSD response_data;  	if (!unzip_llsd(response_data, content_stream, content_binary.size()))  	{ -		LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; +		LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;  		return;  	} @@ -361,6 +379,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)  	if (!success)  	{  		// *TODO: is there any kind of error handling we can do here? +		LL_WARNS("Materials")<< "failed"<<LL_ENDL;  		return;  	} @@ -375,7 +394,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)  	LLSD response_data;  	if (!unzip_llsd(response_data, content_stream, content_binary.size()))  	{ -		LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; +		LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;  		return;  	}  	else @@ -446,7 +465,7 @@ void LLMaterialMgr::processGetQueue()  		const LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id);  		if (!regionp)  		{ -			LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; +			LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL;  			mGetQueue.erase(itRegionQueue);  			continue;  		} @@ -463,7 +482,7 @@ void LLMaterialMgr::processGetQueue()  		const std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);  		if (capURL.empty())  		{ -			LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME +			LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME  				<< "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL;  			mGetQueue.erase(itRegionQueue);  			continue; @@ -486,7 +505,7 @@ void LLMaterialMgr::processGetQueue()  		S32 materialSize = materialString.size();  		if (materialSize <= 0)  		{ -			LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; +			LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL;  			return;  		} @@ -513,7 +532,7 @@ void LLMaterialMgr::processGetAllQueue()  		LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id);  		if (regionp == NULL)  		{ -			LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; +			LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL;  			mGetAllQueue.erase(itRegion);  			continue;  		} @@ -525,7 +544,7 @@ void LLMaterialMgr::processGetAllQueue()  		std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);  		if (capURL.empty())  		{ -			LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME +			LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME  				<< "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL;  			mGetAllQueue.erase(itRegion);  			continue; @@ -549,7 +568,7 @@ void LLMaterialMgr::processPutQueue()  		const LLViewerObject* objectp = gObjectList.findObject(object_id);  		if ( (!objectp) || (!objectp->getRegion()) )  		{ -			LL_WARNS("debugMaterials") << "Object or object region is NULL" << LL_ENDL; +			LL_WARNS("Materials") << "Object or object region is NULL" << LL_ENDL;  			mPutQueue.erase(itQueue);  			continue; @@ -564,7 +583,7 @@ void LLMaterialMgr::processPutQueue()  		std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);  		if (capURL.empty())  		{ -			LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME +			LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME  				<< "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL;  			mPutQueue.erase(itQueue); @@ -592,7 +611,7 @@ void LLMaterialMgr::processPutQueue()  		S32 materialSize = materialString.size();  		if (materialSize <= 0)  		{ -			LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; +			LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL;  			mPutQueue.erase(itQueue);  			continue; | 
