bool FSFloaterObjectExport::exportSelection()
{
	if (!mObjectSelection)
	{
		LL_WARNS("export") << "Nothing selected; Bailing!" << LL_ENDL;
		return false;
	}
	LLObjectSelection::valid_root_iterator iter = mObjectSelection->valid_root_begin();
	LLSelectNode* node = *iter;
	if (!node)
	{
		LL_WARNS("export") << "No node selected; Bailing!" << LL_ENDL;
		return false;
	}
	mFilePath = gDirUtilp->getDirName(mFilename);
	
	mManifest.clear();
	mRequestedTexture.clear();

	mExported = false;
	mAborted = false;
	mInventoryRequests.clear();
	mAssetRequests.clear();
	mTextureChecked.clear();
	
	std::string author = "Unknown";
	if (gCacheName)
		gCacheName->getFullName(gAgentID, author);
	time_t rawtime;
	time(&rawtime);
	struct tm* utc_time = gmtime(&rawtime);
	std::string date = llformat("%04d-%02d-%02d", utc_time->tm_year + 1900, utc_time->tm_mon + 1, utc_time->tm_mday);
	mManifest["format_version"] = OXP_FORMAT_VERSION;
	mManifest["client"] = LLVersionInfo::getChannelAndVersion();
	mManifest["creation_date"] = date;
	mManifest["author"] = author;
	mManifest["grid"] = LLGridManager::getInstance()->getGridLabel();
	
	for ( ; iter != mObjectSelection->valid_root_end(); ++iter)
	{
		mManifest["linkset"].append(getLinkSet((*iter)));
	}

	if (mExported && !mAborted)
	{
		mWaitTimer.start();
		mLastRequest = mInventoryRequests.size();
		mExportState = INVENTORY_DOWNLOAD;
		gIdleCallbacks.addFunction(onIdle, this);
	}
	else
	{
		LL_WARNS("export") << "Nothing was exported. File not created." << LL_ENDL;
		return false;
	}
	return true;
}
Exemplo n.º 2
0
void FSExport::exportSelection()
{
	LLObjectSelectionHandle selection = LLSelectMgr::instance().getSelection();
	LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin();
	LLSelectNode* node = *iter;

	LLFilePicker& file_picker = LLFilePicker::instance();
	if(!file_picker.getSaveFile(LLFilePicker::FFSAVE_EXPORT, LLDir::getScrubbedFileName(node->mName + ".oxp")))
	{
		return;
	}
	mFileName = file_picker.getFirstFile();
	mFilePath = gDirUtilp->getDirName(mFileName);
	
	mFile.clear();
	mRequestedTexture.clear();

	mExported = false;
	mAborted = false;
	mInventoryRequests.clear();
	mAssetRequests.clear();
	mTextureChecked.clear();

	mFile["format_version"] = 1;
	mFile["client"] = LLAppViewer::instance()->getSecondLifeTitle() + LLVersionInfo::getChannel();
	mFile["client_version"] = LLVersionInfo::getVersion();
	mFile["grid"] = LLGridManager::getInstance()->getGridLabel();

	for ( ; iter != selection->valid_root_end(); ++iter)
	{
		mFile["linkset"].append(getLinkSet((*iter)));
	}

	if (mExported && !mAborted)
	{
		mWaitTimer.start();
		mLastRequest = mInventoryRequests.size();
		mExportState = INVENTORY_DOWNLOAD;
		gIdleCallbacks.addFunction(onIdle, this);
	}
	else
	{
		LL_WARNS("export") << "Nothing was exported. File not created." << LL_ENDL;
	}
}