ApplicationState.h (4731B)
1 /*---------------------------------------------------------------------------------------- 2 3 Copyright (c) 2023 AUDIOKINETIC Inc. 4 5 This file is licensed to use under the license available at: 6 https://github.com/audiokinetic/ReaWwise/blob/main/License.txt (the "License"). 7 You may not use this file except in compliance with the License. 8 9 Unless required by applicable law or agreed to in writing, software distributed 10 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 specific language governing permissions and limitations under the License. 13 14 ----------------------------------------------------------------------------------------*/ 15 16 #pragma once 17 18 #include "FeatureSupport.h" 19 #include "Helpers/ImportHelper.h" 20 #include "Model/IDs.h" 21 #include "Model/Import.h" 22 #include "Model/Wwise.h" 23 24 #include <juce_gui_basics/juce_gui_basics.h> 25 26 namespace AK::WwiseTransfer::ApplicationState 27 { 28 inline juce::ValueTree create() 29 { 30 auto applicationState = juce::ValueTree(IDs::application); 31 applicationState.setProperty(IDs::projectPath, "", nullptr); 32 applicationState.setProperty(IDs::projectId, "", nullptr); 33 applicationState.setProperty(IDs::originalsSubfolder, "", nullptr); 34 applicationState.setProperty(IDs::originalsSubfolderValid, true, nullptr); 35 applicationState.setProperty(IDs::originalsSubfolderErrorMessage, "", nullptr); 36 applicationState.setProperty(IDs::originalsFolder, "", nullptr); 37 applicationState.setProperty(IDs::languageSubfolder, "SFX", nullptr); 38 39 applicationState.setProperty(IDs::importDestination, "\\Actor-Mixer Hierarchy\\Default Work Unit", nullptr); 40 applicationState.setProperty(IDs::importDestinationValid, true, nullptr); 41 applicationState.setProperty(IDs::importDestinationErrorMessage, "", nullptr); 42 applicationState.setProperty(IDs::importDestinationType, juce::VariantConverter<Wwise::ObjectType>::toVar(Wwise::ObjectType::WorkUnit), nullptr); 43 44 applicationState.setProperty(IDs::containerNameExists, juce::VariantConverter<Import::ContainerNameExistsOption>::toVar(Import::ContainerNameExistsOption::UseExisting), nullptr); 45 applicationState.setProperty(IDs::audioFileNameExists, juce::VariantConverter<Import::AudioFilenameExistsOption>::toVar(Import::AudioFilenameExistsOption::Replace), nullptr); 46 applicationState.setProperty(IDs::applyTemplate, juce::VariantConverter<Import::ApplyTemplateOption>::toVar(Import::ApplyTemplateOption::NewObjectCreationOnly), nullptr); 47 48 applicationState.setProperty(IDs::wwiseObjectsChanged, false, nullptr); 49 50 auto version = juce::ValueTree(IDs::version); 51 version.setProperty(IDs::year, 0, nullptr); 52 version.setProperty(IDs::major, 0, nullptr); 53 version.setProperty(IDs::minor, 0, nullptr); 54 version.setProperty(IDs::build, 0, nullptr); 55 applicationState.appendChild(version, nullptr); 56 57 auto featureSupport = juce::ValueTree(IDs::featureSupport); 58 59 featureSupport.setProperty(IDs::selectObjectsOnImportCommand, FeatureSupportConstants::FindInProjectExplorerSelectionChannel1, nullptr); 60 featureSupport.setProperty(IDs::applyTemplateFeatureEnabled, false, nullptr); 61 featureSupport.setProperty(IDs::undoGroupFeatureEnabled, false, nullptr); 62 featureSupport.setProperty(IDs::waqlEnabled, false, nullptr); 63 featureSupport.setProperty(IDs::additionalProjectInfoLookupEnabled, false, nullptr); 64 65 applicationState.appendChild(featureSupport, nullptr); 66 67 auto previewItems = juce::ValueTree(IDs::previewItems); 68 applicationState.appendChild(previewItems, nullptr); 69 70 auto virtualFolder = Import::HierarchyMappingNode("$project", Wwise::ObjectType::VirtualFolder); 71 auto soundSfx = Import::HierarchyMappingNode("$region", Wwise::ObjectType::SoundSFX); 72 73 auto hierarchyMapping = juce::ValueTree(IDs::hierarchyMapping); 74 hierarchyMapping.setProperty(IDs::selectedRow, 0, nullptr); 75 hierarchyMapping.appendChild(ImportHelper::hierarchyMappingNodeToValueTree(virtualFolder), nullptr); 76 hierarchyMapping.appendChild(ImportHelper::hierarchyMappingNodeToValueTree(soundSfx), nullptr); 77 78 applicationState.appendChild(hierarchyMapping, nullptr); 79 80 applicationState.setProperty(IDs::previewLoading, false, nullptr); 81 applicationState.setProperty(IDs::transferInProgress, false, nullptr); 82 83 applicationState.setProperty(IDs::sessionName, "", nullptr); 84 85 applicationState.setProperty(IDs::collapsedUI, false, nullptr); 86 87 auto languages = juce::ValueTree(IDs::languages); 88 applicationState.appendChild(languages, nullptr); 89 90 // Returning by value because juce::ValueTree uses value semantics. No internal copies are made when passing the tree around. 91 return applicationState; 92 }; 93 } // namespace AK::WwiseTransfer::ApplicationState