示例#1
0
void LuaDumpVisualParams()
{
	LLViewerInventoryItem* item;
	item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem(WT_SHAPE);
	if(!HasPermissions(item))
	{
		LuaError("LuaDumpVisualParams():  You do not have permission to edit this shape.");
		return;
	}

	LLVOAvatar *av=gAgent.getAvatarObject();
	std::string  param_msg("Params for avatar ");
	param_msg.append(av->getFullname().c_str());
	param_msg.append(": ");
	LuaSendChat(param_msg.c_str());
	param_msg.clear();
	for (LLVisualParam *param = av->getFirstVisualParam(); 
		param;
		param = av->getNextVisualParam())
	{
		param_msg.assign(param->getName().c_str());
		param_msg.append(" (");
		param_msg.append(toLuaString(param->getDefaultWeight()));
		param_msg.append("): ");
		param_msg.append(toLuaString(param->getCurrentWeight()));
		LuaSendChat(param_msg.c_str());
	}

	std::map<LLUUID,LLWearable *>::const_iterator i;
	for(i = gWearableList.mList.begin();i!=gWearableList.mList.end();++i)
	{
		LLWearable *wear=(LLWearable *)i->second;
		LLFILE *file = LLFile::fopen(gDirUtilp->getExpandedFilename(FL_PATH_MACROS,"data"+gDirUtilp->getDirDelimiter()+"wearables",wear->getID().asString()).c_str(),"wb");
		if(file && wear->exportFile(file))
			delete file;

		std::stringstream s;
		s << "Wearable ID: ";
		s << wear->getID().asString();
		LuaSendChat(s.str().c_str());
	}
}
示例#2
0
std::map<std::string,double> LuaDumpVisualParams()
{
	std::map<std::string,double> VisParams;
	VisParams.clear();
	LLViewerInventoryItem* item;
	item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem(WT_SHAPE);
	if(!HasPermissions(item))
	{
		LuaError("LuaDumpVisualParams():  You do not have permission to edit this shape.");
		return VisParams;
	}

	LLVOAvatar *av=gAgent.getAvatarObject();
	for (LLVisualParam *param = av->getFirstVisualParam(); 
		param;
		param = av->getNextVisualParam())
	{
		VisParams.insert(std::pair<std::string,double>(param->getName(),(double)param->getCurrentWeight()));
	}
	return VisParams;
}
示例#3
0
std::string  LuaDumpVisualParamsToLuaCode()
{
	LLVOAvatar *av=gAgent.getAvatarObject();
	//LuaError("DumpVisualParamsToLuaCode() DEBUG: Dumping vis params. (Checking perms)");
	LLViewerInventoryItem* item;
	item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem(WT_SHAPE);
	if(!item)
	{	
		LuaError(llformat("DumpVisualParamsToLuaCode() (%s:%d): item is null!  Cannot check perms; Aborting!\nPlease file a bug report at http://bugs.nexisonline.net/",__FILE__,__LINE__).c_str());
		return "";
	}
	if(!HasPermissions(item))
	{
		LuaError("LuaDumpVisualParamsToLuaCode():  You do not have permission to edit this shape.");
		return std::string();
	}
	std::string  param_msg("");
	param_msg.assign("--[[ Autogenerated by FlexLife Viewer (Rev. $Rev$)]]--\n\n");
	param_msg.append("-- setParamOnSelf(\"name\",weight) -- default, min, max\n");
	for (LLVisualParam *param = av->getFirstVisualParam(); 
		param;
		param = av->getNextVisualParam())
	{
		param_msg.append(
			llformat(
			"setParamOnSelf(\"%s\",%f)\t-- %f\t%f\t%f\n",
			param->getName().c_str(),
			param->getCurrentWeight(),
			param->getDefaultWeight(),
			param->getMinWeight(),
			param->getMaxWeight()
			)
		);
	}

	param_msg.append("\n\n--[[Wearables]]--\nRemoveAllWearables()\n");
	
	std::map<LLUUID,LLWearable *>::const_iterator i;
	for(i = gWearableList.mList.begin();i!=gWearableList.mList.end();++i)
	{
		LLWearable *wear=(LLWearable *)i->second;
		if(!LuaSaveWearable(wear)) break;

		std::stringstream s;
		s << "wear(\"" << wear->getID().asString() << "\")\n";
		param_msg.append(s.str());
	}
/*
	for( S32 i = 0; i < BAKED_NUM_INDICES; i++ )
	{
		S32 tex_index=LLmBakedTextureData[i].mTextureIndex
		//S32 tex_index = LLVOAvatar::sBakedTextureIndices[i];
		std::stringstream s;
		s << "setTEImage(" << tex_index <<",\""<< av->getTEImage(tex_index)->getID() << "\")\n";
		param_msg.append(s.str());
	}
*/
	param_msg.append("UpdateAppearance()\n");
	//LuaError("DumpVisualParamsToLuaCode() DEBUG: Done.");
	return param_msg;
}