예제 #1
0
// static
void LLWLParamManager::loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status)
{
	LLUUID inventory_id(*((LLUUID*)user_data));
	std::string name = "WindLight Setting.wl";
	LLViewerInventoryItem *item = gInventory.getItem(inventory_id);
	if(item)
	{
		inventory_id = item->getUUID();
		name = item->getName();
	}
	if(LL_ERR_NOERR == status)
	{
		LLVFile file(vfs, asset_id, asset_type, LLVFile::READ);
		S32 file_length = file.getSize();
		std::vector<char> buffer(file_length + 1);
		file.read((U8*)&buffer[0], file_length);
		buffer[file_length] = 0;
		LLNotecard notecard(LLNotecard::MAX_SIZE);
		LLMemoryStream str((U8*)&buffer[0], file_length + 1);
		notecard.importStream(str);
		std::string settings = notecard.getText();
		LLMemoryStream settings_str((U8*)settings.c_str(), settings.length());
		bool is_animator_running = sInstance->mAnimator.mIsRunning;
		bool animator_linden_time = sInstance->mAnimator.mUseLindenTime;
		sInstance->mAnimator.mIsRunning = false;
		sInstance->mAnimator.mUseLindenTime = false;
		bool is_real_setting = sInstance->loadPresetXML(name, settings_str, true, true);
		if(!is_real_setting)
		{
			sInstance->mAnimator.mIsRunning = is_animator_running;
			sInstance->mAnimator.mUseLindenTime = animator_linden_time;
			LLSD subs;
			subs["NAME"] = name;
			LLNotifications::getInstance()->add("KittyInvalidWindlightNotecard", subs);
		}
		else
		{
			// We can do this because we know mCurParams 
			sInstance->mParamList[name].mInventoryID = inventory_id;
		}
	}
}
// static
void LLWLParamManager::loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status)
{
	LLUUID inventory_id(*((LLUUID*)user_data));
	std::string name = "WindLight Setting.wl";
	LLViewerInventoryItem *item = gInventory.getItem(inventory_id);
	if(item)
	{
		inventory_id = item->getUUID();
		name = item->getName();
	}
	if(LL_ERR_NOERR == status)
	{
		LLVFile file(vfs, asset_id, asset_type, LLVFile::READ);
		S32 file_length = file.getSize();
		std::vector<char> buffer(file_length + 1);
		file.read((U8*)&buffer[0], file_length);
		buffer[file_length] = 0;
		LLNotecard notecard(LLNotecard::MAX_SIZE);
		LLMemoryStream str((U8*)&buffer[0], file_length + 1);
		notecard.importStream(str);
		std::string settings = notecard.getText();
		LLMemoryStream settings_str((U8*)settings.c_str(), settings.length());
		
		LLWLParamKey key((" Notecard: " + name), LLEnvKey::SCOPE_LOCAL);
		bool is_real_setting = getInstance()->loadPresetXML(key, settings_str);
		if(!is_real_setting)
		{
			LLSD subs;
			subs["NAME"] = name;
			LLNotifications::getInstance()->add("KittyInvalidWindlightNotecard", subs);
		}
		else
		{
			// We can do this because we know mCurParams
			getInstance()->mParamList[key].mInventoryID = inventory_id;
			LLEnvManagerNew::instance().setUseSkyPreset(key.name);
		}
	}
}