fix: Model set becomes active after the first start

This commit is contained in:
tzobler
2026-01-15 21:04:58 +01:00
parent 4bfc444989
commit f48e4887f6
3 changed files with 9 additions and 13 deletions

View File

@@ -1657,7 +1657,10 @@ namespace swift::core
if (modelsCleaned.isEmpty())
{
// error to force popup
CLogMessage(this).error(u"No models for matching ('%1'), swift without a model set will not work!")
// TODO TZ extend commend
CLogMessage(this).error(
u"No models for matching ('%1'), swift without a model set will not work! Note: If you are using "
u"MSFS2024 and starting the GUI for the first time, it may take some time for the model set to load.")
<< simulator.toQString();
}
else if (!duplicateModels.isEmpty())

View File

@@ -241,7 +241,7 @@ namespace swift::core::context
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isSimulatorAvailable()) { return; } // if a plugin is loaded, do ignore this
if (this->isSimulatorAvailable() && !simulator.isMSFS2024()) return; // if a plugin is loaded, do ignore this
m_modelSetSimulator.set(simulator);
const CAircraftModelList models = this->getModelSet(); // cache synced
m_aircraftMatcher.setModelSet(models, simulator, false);

View File

@@ -19,6 +19,7 @@
#include "config/buildconfig.h"
#include "core/application.h"
#include "core/context/contextsimulator.h"
#include "core/modelsetbuilder.h"
#include "core/webdataservices.h"
#include "core/webdataservicesms.h"
@@ -47,6 +48,7 @@
#include "misc/worker.h"
using namespace swift::config;
using namespace swift::core::context;
using namespace swift::misc;
using namespace swift::misc::aviation;
using namespace swift::misc::physical_quantities;
@@ -538,25 +540,16 @@ namespace swift::simplugin::msfs2024common
currentSet = CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModels(simulator);
NewSet = builder.buildModelSet(simulator, newModelList, currentSet, options, distributorList);
CAircraftMatcher matcher;
swift::misc::simulation::CAircraftMatcherSetup mSetup = matcher.getSetup();
NewSet.setSimulatorInfo(simulator);
matcher.setModelSet(NewSet, m_simulatorInfo, true);
const QDateTime latestDbModelsTs =
NewSet.isEmpty() ? sApp->getWebDataServices()->getCacheTimestamp(CEntityFlags::ModelEntity) :
NewSet.latestTimestamp();
if (!latestDbModelsTs.isValid()) { return; }
// for swiftgui it is enough to set the cache here
if (gui_application)
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().setModelsForSimulator(NewSet,
simulator);
CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().setCachedModels(NewSet, simulator);
sGui->getIContextSimulator()->setModelSetLoaderSimulator(simulator);
const CStatusMessage m = CStatusMessage(this, CStatusMessage::SeverityInfo,
u"Loading SimObjects and Liveries from the Simulator completed");