Fix model uploading for the case that haven't uploaded model before

This commit is contained in:
David Rowe 2014-10-13 08:35:52 -07:00
parent 324ddb2a2f
commit c6bf09f509
3 changed files with 6 additions and 2 deletions

View file

@ -1312,7 +1312,6 @@ var toolBar = (function () {
if (clickedOverlay === loadFileMenuItem) { if (clickedOverlay === loadFileMenuItem) {
toggleNewModelButton(false); toggleNewModelButton(false);
// TODO BUG: this is bug, if the user has never uploaded a model, this will throw an JS exception
file = Window.browse("Select your model file ...", file = Window.browse("Select your model file ...",
Settings.getValue("LastModelUploadLocation").path(), Settings.getValue("LastModelUploadLocation").path(),
"Model files (*.fst *.fbx)"); "Model files (*.fst *.fbx)");

View file

@ -238,7 +238,6 @@ var toolBar = (function () {
if (clickedOverlay === loadFileMenuItem) { if (clickedOverlay === loadFileMenuItem) {
toggleNewModelButton(false); toggleNewModelButton(false);
// TODO BUG: this is bug, if the user has never uploaded a model, this will throw an JS exception
file = Window.browse("Select your model file ...", file = Window.browse("Select your model file ...",
Settings.getValue("LastModelUploadLocation").path(), Settings.getValue("LastModelUploadLocation").path(),
"Model files (*.fst *.fbx)"); "Model files (*.fst *.fbx)");

View file

@ -22,6 +22,9 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting) {
QSettings* settings = Application::getInstance()->lockSettings(); QSettings* settings = Application::getInstance()->lockSettings();
QVariant value = settings->value(setting); QVariant value = settings->value(setting);
Application::getInstance()->unlockSettings(); Application::getInstance()->unlockSettings();
if (!value.isValid()) {
value = "";
}
return value; return value;
} }
@ -29,6 +32,9 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVar
QSettings* settings = Application::getInstance()->lockSettings(); QSettings* settings = Application::getInstance()->lockSettings();
QVariant value = settings->value(setting, defaultValue); QVariant value = settings->value(setting, defaultValue);
Application::getInstance()->unlockSettings(); Application::getInstance()->unlockSettings();
if (!value.isValid()) {
value = "";
}
return value; return value;
} }