当前位置: 首页>>代码示例>>C++>>正文


C++ LLTextureEntry::fromLLSD方法代码示例

本文整理汇总了C++中LLTextureEntry::fromLLSD方法的典型用法代码示例。如果您正苦于以下问题:C++ LLTextureEntry::fromLLSD方法的具体用法?C++ LLTextureEntry::fromLLSD怎么用?C++ LLTextureEntry::fromLLSD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLTextureEntry的用法示例。


在下文中一共展示了LLTextureEntry::fromLLSD方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: send_image

void ImportTracker::send_image(LLSD& prim)
{
	LLMessageSystem* msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_ObjectImage);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
	
	msg->nextBlockFast(_PREHASH_ObjectData);
	msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
	msg->addStringFast(_PREHASH_MediaURL, NULL);
	
	LLPrimitive obj;
	LLSD tes = prim["textures"];
	obj.setNumTEs(U8(tes.size()));
	
	for (int i = 0; i < tes.size(); i++)
	{
		LLTextureEntry tex;
		tex.fromLLSD(tes[i]);
		obj.setTE(U8(i), tex);
	}
	
	obj.packTEMessage(gMessageSystem);
	
	msg->sendReliable(gAgent.getRegion()->getHost());
}
开发者ID:IamusNavarathna,项目名称:SingularityViewer,代码行数:27,代码来源:importtracker.cpp

示例2: xmltoprim

// This function takes a pointer to a viewerobject and applys the prim definition that prim_llsd has
void primbackup::xmltoprim(LLSD prim_llsd,LLViewerObject * object)
{
	LLUUID id = object->getID();
	expecting_update = object->getID();
	LLSelectMgr::getInstance()->selectObjectAndFamily(object);

	if(prim_llsd.has("parent"))
	{
		//we are not the root node.
		LLVector3 pos=prim_llsd["position"];
		LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]);
		object->setPositionRegion((pos*root_rot)+(root_pos+group_offset));
		object->setRotation(rot*root_rot);
	}
	else
	{
		object->setPositionRegion(root_pos+group_offset);
		LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]);
		object->setRotation(rot);
	}

	object->setScale(prim_llsd["scale"]);

	if(prim_llsd.has("shadows"))
		if(prim_llsd["shadows"].asInteger()==1)
			object->setFlags(FLAGS_CAST_SHADOWS,true);

	if(prim_llsd.has("phantom"))
		if(prim_llsd["phantom"].asInteger()==1)
			object->setFlags(FLAGS_PHANTOM,true);

	if(prim_llsd.has("physical"))
		if(prim_llsd["physical"].asInteger()==1)
			object->setFlags(FLAGS_USE_PHYSICS,true);

	// Volume params
	LLVolumeParams volume_params = object->getVolume()->getParams();
	volume_params.fromLLSD(prim_llsd["volume"]) ;
	object->updateVolume(volume_params);
	
	if(prim_llsd.has("sculpt"))
	{
		LLSculptParams* sculpt=new LLSculptParams();
		sculpt->fromLLSD(prim_llsd["sculpt"]);
		
		//TODO check if map is valid and only set texture is map is valid and changes

		if(assetmap[sculpt->getSculptTexture()].notNull())
		{
			LLUUID replacment=assetmap[sculpt->getSculptTexture()];
			sculpt->setSculptTexture(replacment);
		}

		object->setParameterEntry(LLNetworkData::PARAMS_SCULPT,(LLNetworkData&)(*sculpt),true);
	}
		
	if(prim_llsd.has("light"))
	{
		LLLightParams * light=new LLLightParams();
		light->fromLLSD(prim_llsd["light"]);
		object->setParameterEntry(LLNetworkData::PARAMS_LIGHT,(LLNetworkData&)(*light),true);
	}

	if(prim_llsd.has("flexible"))
	{
		LLFlexibleObjectData* flex=new LLFlexibleObjectData();
		flex->fromLLSD(prim_llsd["flexible"]);
		object->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE,(LLNetworkData&)(*flex),true);
	}


	// Textures
	LLSD te_llsd;
	llinfos << "Processing textures for prim" << llendl;

	te_llsd=prim_llsd["textures"];
		
	LLSD::array_iterator text_it;
	U8 i=0;
	i=0;

	for(text_it=te_llsd.beginArray(); text_it !=te_llsd.endArray(); text_it++)
	{
	    LLSD the_te;
	    the_te=(*text_it);
	    LLTextureEntry te;
	    te.fromLLSD(the_te);

		if(assetmap[te.getID()].notNull())
		{
			LLUUID replacment=assetmap[te.getID()];
			te.setID(replacment);
		}

	    object->setTE(i,te); //	
	    i++;
	}

	llinfos << "Textures done!" << llendl;
//.........这里部分代码省略.........
开发者ID:kow,项目名称:Meerkat-Viewer,代码行数:101,代码来源:primbackup.cpp

示例3: import_object

void primbackup::import_object(bool upload)
{
	textures.clear();
	assetmap.clear();
	current_asset=LLUUID::null;

	this->m_retexture=upload;

	// Open the file open dialog
	LLFilePicker& file_picker = LLFilePicker::instance();
	if( !file_picker.getOpenFile( LLFilePicker::FFLOAD_XML ) )
	{
		// User canceled save.
		return;
	}
	std::string file_name = file_picker.getFirstFile().c_str();
	folder = gDirUtilp->getDirName(file_name);

	llifstream import_file(file_name);
	LLSDSerialize::fromXML(llsd, import_file);
	import_file.close();

	show();

	//Get the texture map
	
	LLSD::map_const_iterator prim_it;
	LLSD::array_const_iterator prim_arr_it;
		
	this->m_curobject=1;
	this->m_curprim=1;
	this->m_objects=llsd["data"].size();
	this->m_prims=0;
	rezcount=0;

	updateimportnumbers();

	for( prim_arr_it = llsd["data"].beginArray(); prim_arr_it != llsd["data"].endArray(); prim_arr_it++)
	{

		LLSD llsd2;
		llsd2=(*prim_arr_it)["group_body"];

		for( prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++)
		{
			LLSD prim_llsd;
			prim_llsd=llsd2[prim_it->first];
			LLSD::array_iterator text_it;
			std::list<LLUUID>::iterator iter;

			if(prim_llsd.has("sculpt"))
			{
				LLSculptParams* sculpt=new LLSculptParams();
				sculpt->fromLLSD(prim_llsd["sculpt"]);
				LLUUID orig=sculpt->getSculptTexture();
				bool alreadyseen=false;
				for(iter = textures.begin(); iter != textures.end() ; iter++) 
				{
					if( (*iter)==orig)
						alreadyseen=true;
				}
				if(alreadyseen==false)
				{
					llinfos << "Found a new SCULPT texture to upload "<<orig<<llendl;			
					textures.push_back(orig);
				}
			}


			LLSD te_llsd;
			te_llsd=prim_llsd["textures"];

		
			for(text_it=te_llsd.beginArray(); text_it !=te_llsd.endArray(); text_it++)
			{
				LLSD the_te;
				the_te=(*text_it);
				LLTextureEntry te;
				te.fromLLSD(the_te);

				te.getID();
				bool alreadyseen=false;

				for(iter = textures.begin(); iter != textures.end() ; iter++) 
				{
					if( (*iter)==te.getID())
						alreadyseen=true;
				}
				if(alreadyseen==false)
				{
					llinfos << "Found a new texture to upload "<<te.getID()<<llendl;			
					textures.push_back(te.getID());
				}	     
			}

		}
	}

	if(m_retexture==TRUE)
		upload_next_asset();
//.........这里部分代码省略.........
开发者ID:kow,项目名称:Meerkat-Viewer,代码行数:101,代码来源:primbackup.cpp

示例4: importObject_continued

void LLObjectBackup::importObject_continued(AIFilePicker* filepicker)
{
	if (!filepicker->hasFilename())
	{
		// User canceled save.
		return;
	}
	
	std::string file_name = filepicker->getFilename();	
	mFolder = gDirUtilp->getDirName(file_name);
	llifstream import_file(file_name);
	LLSDSerialize::fromXML(mLLSD, import_file);
	import_file.close();
	show(false);

	mAgentPos = gAgent.getPositionAgent();
	mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(), gAgent.getUpAxis());

	// Get the texture map
	
	LLSD::map_const_iterator prim_it;
	LLSD::array_const_iterator prim_arr_it;
		
	mCurObject = 1;
	mCurPrim = 1;
	mObjects = mLLSD["data"].size();
	mPrims = 0;
	mRezCount = 0;
	updateImportNumbers();

	for (prim_arr_it = mLLSD["data"].beginArray(); prim_arr_it != mLLSD["data"].endArray(); prim_arr_it++)
	{
		LLSD llsd2 = (*prim_arr_it)["group_body"];

		for (prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++)
		{
			LLSD prim_llsd = llsd2[prim_it->first];
			LLSD::array_iterator text_it;
			std::list<LLUUID>::iterator iter;

			if (prim_llsd.has("sculpt"))
			{
				LLSculptParams* sculpt = new LLSculptParams();
				sculpt->fromLLSD(prim_llsd["sculpt"]);
				LLUUID orig = sculpt->getSculptTexture();
				bool alreadyseen = false;
				for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
				{
					if ((*iter) == orig)
						alreadyseen = true;
				}
				if (alreadyseen == false)
				{
					LL_INFOS("ObjectBackup") << "Found a new SCULPT texture to upload " << orig << LL_ENDL;			
					mTexturesList.push_back(orig);
				}
			}

			LLSD te_llsd = prim_llsd["textures"];

			for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++)
			{
				LLSD the_te = (*text_it);
				LLTextureEntry te;
				te.fromLLSD(the_te);

				LLUUID id = te.getID();
				if (id != LL_TEXTURE_PLYWOOD && id != LL_TEXTURE_BLANK && id != LL_TEXTURE_INVISIBLE) // Do not upload the default textures
 				{
					bool alreadyseen = false;

					for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
					{
						if ((*iter) == te.getID())
							alreadyseen = true;
					}
					if (alreadyseen == false)
					{
						LL_INFOS("ObjectBackup") << "Found a new texture to upload "<< te.getID() << LL_ENDL;			
						mTexturesList.push_back(te.getID());
					}
				}	     
			}
		}
	}

	if (mRetexture == TRUE)
		uploadNextAsset();
	else
		importFirstObject();
}
开发者ID:Krazy-Bish-Margie,项目名称:SingularityViewer,代码行数:91,代码来源:llviewerobjectbackup.cpp

示例5: xmlToPrim

// This function takes a pointer to a viewerobject and applies the prim
// definition that prim_llsd has
void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object)
{
	LLUUID id = object->getID();
	mExpectingUpdate = object->getID();
	LLSelectMgr::getInstance()->selectObjectAndFamily(object);

	if (prim_llsd.has("name"))
	{
		LLSelectMgr::getInstance()->selectionSetObjectName(prim_llsd["name"]);
	}

	if (prim_llsd.has("description"))
	{
		LLSelectMgr::getInstance()->selectionSetObjectDescription(prim_llsd["description"]);
	}

	if (prim_llsd.has("material"))
	{
		LLSelectMgr::getInstance()->selectionSetMaterial(prim_llsd["material"].asInteger());
	}

	if (prim_llsd.has("clickaction"))
	{
		LLSelectMgr::getInstance()->selectionSetClickAction(prim_llsd["clickaction"].asInteger());
	}

	if (prim_llsd.has("parent"))
	{
		//we are not the root node.
		LLVector3 pos = LLVector3(prim_llsd["position"]);
		LLQuaternion rot = ll_quaternion_from_sd(prim_llsd["rotation"]);
		object->setPositionRegion(pos * mRootRot + mRootPos + mGroupOffset);
		object->setRotation(rot * mRootRot);
	}
	else
	{
		object->setPositionRegion(mRootPos + mGroupOffset);
		LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]);
		object->setRotation(rot);
	}

	object->setScale(LLVector3(prim_llsd["scale"]));

	if (prim_llsd.has("flags"))
	{
		U32 flags = (U32)prim_llsd["flags"].asInteger();
		object->setFlags(flags, true);
	}
	else	// Kept for backward compatibility
	{
		/*if (prim_llsd.has("shadows"))
			if (prim_llsd["shadows"].asInteger() == 1)
				object->setFlags(FLAGS_CAST_SHADOWS, true);*/

		if (prim_llsd.has("phantom") && prim_llsd["phantom"].asInteger() == 1)
		{
				object->setFlags(FLAGS_PHANTOM, true);
		}

		if (prim_llsd.has("physical") &&
			prim_llsd["physical"].asInteger() == 1)
		{
			object->setFlags(FLAGS_USE_PHYSICS, true);
		}
	}

	if (mGotExtraPhysics && prim_llsd.has("ExtraPhysics"))
	{
		const LLSD& physics = prim_llsd["ExtraPhysics"];
		object->setPhysicsShapeType(physics["PhysicsShapeType"].asInteger());
		F32 gravity = physics.has("Gravity") ? physics["Gravity"].asReal()
											 : physics["GravityMultiplier"].asReal();
		object->setPhysicsGravity(gravity);
		object->setPhysicsFriction(physics["Friction"].asReal());
		object->setPhysicsDensity(physics["Density"].asReal());
		object->setPhysicsRestitution(physics["Restitution"].asReal());
		object->updateFlags(true);
	}

	// Volume params
	LLVolumeParams volume_params = object->getVolume()->getParams();
	volume_params.fromLLSD(prim_llsd["volume"]);
	object->updateVolume(volume_params);

	if (prim_llsd.has("sculpt"))
	{
		LLSculptParams sculpt;
		sculpt.fromLLSD(prim_llsd["sculpt"]);

		// TODO: check if map is valid and only set texture if map is valid and
		// changes
		LLUUID t_id = sculpt.getSculptTexture();
		if (mAssetMap.count(t_id))
		{
			sculpt.setSculptTexture(mAssetMap[t_id], sculpt.getSculptType());
		}

		object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt, true);
//.........这里部分代码省略.........
开发者ID:HanHeld,项目名称:SingularityViewerFeb2016,代码行数:101,代码来源:llviewerobjectbackup.cpp

示例6: importObject_continued

void LLObjectBackup::importObject_continued(AIFilePicker* filepicker)
{
	if (!filepicker->hasFilename())
	{
		// User canceled save.
		return;
	}

	std::string file_name = filepicker->getFilename();
	mFolder = gDirUtilp->getDirName(file_name);
	llifstream import_file(file_name);
	LLSDSerialize::fromXML(mLLSD, import_file);
	import_file.close();
	if (!mLLSD.has("data"))
	{
		LLNotificationsUtil::add("ImportFailed");
		destroy();
		return;
	}

	showFloater(false);

	mAgentPos = gAgent.getPositionAgent();
	mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(),
							 gAgent.getUpAxis());

	// Get the texture map

	mCurObject = 1;
	mCurPrim = 1;
	mObjects = mLLSD["data"].size();
	mPrims = 0;
	mRezCount = 0;
	updateImportNumbers();

	for (LLSD::array_const_iterator prim_arr_it = mLLSD["data"].beginArray(),
									prim_arr_end = mLLSD["data"].endArray();
		 prim_arr_it != prim_arr_end; ++prim_arr_it)
	{
		LLSD llsd2 = (*prim_arr_it)["group_body"];

		for (LLSD::map_const_iterator prim_it = llsd2.beginMap(),
									  prim_end = llsd2.endMap();
			 prim_it != prim_end; ++prim_it)
		{
			LLSD prim_llsd = llsd2[prim_it->first];
			if (prim_llsd.has("sculpt"))
			{
				LLSculptParams sculpt;
				sculpt.fromLLSD(prim_llsd["sculpt"]);
				if ((sculpt.getSculptType() & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH)
				{
					LLUUID orig = sculpt.getSculptTexture();
					if (mTexturesList.count(orig) == 0)
					{
						LL_INFOS() << "Found a new SCULPT texture to upload "
								<< orig << LL_ENDL;
						mTexturesList.insert(orig);
					}
				}
			}

			if (prim_llsd.has("light_texture"))
			{
				LLLightImageParams lightimg;
				lightimg.fromLLSD(prim_llsd["light_texture"]);
				LLUUID t_id = lightimg.getLightTexture();
				if (!is_default_texture(t_id) &&
					mTexturesList.count(t_id) == 0)
				{
					LL_INFOS() << "Found a new light texture to upload: " << t_id
							<< LL_ENDL;
					mTexturesList.insert(t_id);
				}
			}

			// Check both for "textures" and "texture" since the second (buggy)
			// case has already been seen in some exported prims XML files...
			LLSD& te_llsd = prim_llsd.has("textures") ? prim_llsd["textures"]
													  : prim_llsd["texture"];
			for (LLSD::array_iterator it = te_llsd.beginArray();
				 it != te_llsd.endArray(); ++it)
			{
				LLSD the_te = *it;
				LLTextureEntry te;
				te.fromLLSD(the_te);

				LLUUID t_id = te.getID();
				if (!is_default_texture(t_id) &&
					mTexturesList.count(t_id) == 0)
				{
					LL_INFOS() << "Found a new texture to upload: " << t_id
							<< LL_ENDL;
						mTexturesList.insert(t_id);
				}
			}

			if (prim_llsd.has("materials"))
			{
				LLSD mat_llsd = prim_llsd["materials"];
//.........这里部分代码省略.........
开发者ID:HanHeld,项目名称:SingularityViewerFeb2016,代码行数:101,代码来源:llviewerobjectbackup.cpp

示例7: importObject

void LLObjectBackup::importObject(bool upload)
{
	mTexturesList.clear();
	mAssetMap.clear();
	mCurrentAsset = LLUUID::null;

	mRetexture = upload;

	// Open the file open dialog
	LLFilePicker& file_picker = LLFilePicker::instance();
	if (!file_picker.getOpenFile(LLFilePicker::FFLOAD_XML))
	{
		// User canceled save.
		return;
	}

	std::string file_name = file_picker.getFirstFile().c_str();
	mFolder = gDirUtilp->getDirName(file_name);
	llifstream import_file(file_name);
	LLSDSerialize::fromXML(mLLSD, import_file);
	import_file.close();

	mAgentPos = gAgent.getPositionAgent();
	mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(), gAgent.getUpAxis());

	// Get the texture map
	
	LLSD::map_const_iterator prim_it;
	LLSD::array_const_iterator prim_arr_it;
		
	mCurObject = 1;
	mCurPrim = 1;
	mObjects = mLLSD["data"].size();
	mPrims = 0;
	mRezCount = 0;

	if (mObjects <= 0) {
		LLSD args;
		args["MESSAGE"] = std::string("Object import failed.\nThe XML file has an incompatble format or does not contain any objects.");
		LLNotifications::instance().add("GenericAlert", args);
		llwarns << "Trying to import illegal XML object file." << llendl;
		return;
	}

	show(false);

	updateImportNumbers();

	for (prim_arr_it = mLLSD["data"].beginArray(); prim_arr_it != mLLSD["data"].endArray(); prim_arr_it++)
	{
		LLSD llsd2 = (*prim_arr_it)["group_body"];

		for (prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++)
		{
			LLSD prim_llsd = llsd2[prim_it->first];
			LLSD::array_iterator text_it;
			std::list<LLUUID>::iterator iter;

			if (prim_llsd.has("sculpt"))
			{
				LLSculptParams* sculpt = new LLSculptParams();
				sculpt->fromLLSD(prim_llsd["sculpt"]);
				LLUUID orig = sculpt->getSculptTexture();
				bool alreadyseen = false;
				for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
				{
					if ((*iter) == orig)
						alreadyseen = true;
				}
				if (alreadyseen == false)
				{
					llinfos << "Found a new SCULPT texture to upload " << orig << llendl;			
					mTexturesList.push_back(orig);
				}
			}

			LLSD te_llsd = prim_llsd["textures"];

			for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++)
			{
				LLSD the_te = (*text_it);
				LLTextureEntry te;
				te.fromLLSD(the_te);

				te.getID();
				bool alreadyseen = false;

				for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
				{
					if ((*iter) == te.getID())
						alreadyseen = true;
				}
				if (alreadyseen == false)
				{
					llinfos << "Found a new texture to upload "<< te.getID() << llendl;			
					mTexturesList.push_back(te.getID());
				}	     
			}
		}
	}
//.........这里部分代码省略.........
开发者ID:Kiera,项目名称:Crow,代码行数:101,代码来源:llviewerobjectbackup.cpp


注:本文中的LLTextureEntry::fromLLSD方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。