void EditorApplication::saveProjectSettings() { if (mProjectSettings == nullptr || !isProjectLoaded()) return; Path absoluteDataPath = getProjectPath(); absoluteDataPath.append(PROJECT_SETTINGS_PATH); FileEncoder fs(absoluteDataPath); fs.encode(mProjectSettings.get()); }
void EditorApplication::saveProject() { if (!isProjectLoaded()) return; Path buildDataPath = getProjectPath(); buildDataPath.append(BUILD_DATA_PATH); BuildManager::instance().save(buildDataPath); saveWidgetLayout(EditorWidgetManager::instance().getLayout()); saveEditorSettings(); saveProjectSettings(); gProjectLibrary().saveLibrary(); }
void EditorApplication::loadProjectSettings() { if (isProjectLoaded()) { Path absoluteDataPath = getProjectPath(); absoluteDataPath.append(PROJECT_SETTINGS_PATH); if (FileSystem::exists(absoluteDataPath)) { FileDecoder fs(absoluteDataPath); mProjectSettings = std::static_pointer_cast<ProjectSettings>(fs.decode()); } } if (mProjectSettings == nullptr) mProjectSettings = bs_shared_ptr_new<ProjectSettings>(); }
void EditorApplication::unloadProject() { if (!isProjectLoaded()) return; saveProject(); mProjectSettings = bs_shared_ptr_new<ProjectSettings>(); BuildManager::instance().clear(); UndoRedo::instance().clear(); EditorWidgetManager::instance().closeAll(); gProjectLibrary().unloadLibrary(); Resources::instance().unloadAllUnused(); gSceneManager().clearScene(); mProjectPath = Path::BLANK; mProjectName = StringUtil::BLANK; mIsProjectLoaded = false; }
void ProjectManager::refreshChoices() { if (!isProjectLoaded()) return; mTextureAssetChoices.Clear(); mTextureAssetChoices.Add("", 0); Vector<const AssetDefinition*> assetDefinitions = Torque::AssetDatabaseLink.getDeclaredAssets(); // Iterate sorted asset definitions. for (Vector<const AssetDefinition*>::iterator assetItr = assetDefinitions.begin(); assetItr != assetDefinitions.end(); ++assetItr) { // Fetch asset definition. const AssetDefinition* pAssetDefinition = *assetItr; // Populate TextureAsset choices menu. if (dStrcmp(pAssetDefinition->mAssetType, "TextureAsset") == 0) mTextureAssetChoices.Add(pAssetDefinition->mAssetId, mTextureAssetChoices.GetCount()); } }