Example #1
0
ModelManager::ModelManager(const std::string & directory, const std::string & extension, const bool hotLoading, CaffApp::Renderer & renderer)
: m_pImpl(new Impl(renderer))
{
	m_pImpl->isHotLoading = hotLoading;
	std::string dirPath = Utilities::GetPathDir() + "Assets/" + directory;
	
	std::vector<std::string> filenames;
	
	Utilities::GetFileNamesOfTypeInDirectory(filenames, extension, dirPath);
	
	// Load all files
	for(auto it = filenames.begin(); it != filenames.end(); ++it)
	{
		CaffApp::ModelLoaderXMLFile modelSettings((*it));
		
		m_pImpl->addModel(modelSettings);
	}
}
Example #2
0
void Creator::SaveSettings()
{
	QString settingspath = QApplication::applicationDirPath() + CSettingFileName;
	QSettings settings(settingspath, QSettings::IniFormat);

	settings.setValue("screen", ui.creatorTabs->currentIndex());
	if (ui.calibrationLabel->text().isEmpty() == false)
	{
		settings.setValue("calibrationInput", ui.calibrationLabel->text());
	}
	settings.setValue("renderMode", ui.renderGroup->checkedId());
	settings.setValue("lockMode", ui.lockGroup->checkedId());
	settings.setValue("lastDir", InputList::_lastDirectory);
	settings.setValue("lastOpened", "last");
	settings.setValue("model", ui.modelName->text());

	QString name = "last";
	if (ui.creatorLabel->text().size())
	{
		name = ui.creatorLabel->text();
	}
	QString model = QApplication::applicationDirPath() + "\\" + name;
	QSettings modelSettings(model, QSettings::IniFormat);
	modelSettings.beginWriteArray("models");
	
	for (int i = 0; i < ui.inputList->count(); i++)
	{
		modelSettings.setArrayIndex(i);
		QVariant str = ui.inputList->item(i)->data(Qt::UserRole);
		modelSettings.setValue("model", str);
	}
	modelSettings.endArray();

	modelSettings.sync();
	settings.sync();
	//InputList * list = ui.inputList;
	//QFile file("settings.cfg");
	//if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
	//{
	//	ui.infobox->Report(MError,"Unable to open setting file");
	//	return;
	//}
	//list->Save(file);
}