2015-08-13 12:03:20 +02:00
|
|
|
#include "mergeoperation.hpp"
|
|
|
|
|
2022-10-19 19:02:00 +02:00
|
|
|
#include <utility>
|
|
|
|
#include <variant>
|
|
|
|
|
|
|
|
#include <apps/opencs/model/doc/operation.hpp>
|
|
|
|
#include <apps/opencs/model/tools/mergestate.hpp>
|
|
|
|
#include <apps/opencs/model/world/cell.hpp>
|
|
|
|
#include <apps/opencs/model/world/data.hpp>
|
|
|
|
#include <apps/opencs/model/world/info.hpp>
|
|
|
|
#include <apps/opencs/model/world/infocollection.hpp>
|
|
|
|
#include <apps/opencs/model/world/pathgrid.hpp>
|
|
|
|
#include <apps/opencs/model/world/record.hpp>
|
|
|
|
#include <apps/opencs/model/world/subcellcollection.hpp>
|
|
|
|
|
|
|
|
#include <components/esm3/debugprofile.hpp>
|
|
|
|
#include <components/esm3/filter.hpp>
|
|
|
|
#include <components/esm3/loadbody.hpp>
|
|
|
|
#include <components/esm3/loadbsgn.hpp>
|
|
|
|
#include <components/esm3/loadclas.hpp>
|
|
|
|
#include <components/esm3/loaddial.hpp>
|
|
|
|
#include <components/esm3/loadench.hpp>
|
|
|
|
#include <components/esm3/loadfact.hpp>
|
|
|
|
#include <components/esm3/loadglob.hpp>
|
|
|
|
#include <components/esm3/loadgmst.hpp>
|
|
|
|
#include <components/esm3/loadmgef.hpp>
|
|
|
|
#include <components/esm3/loadrace.hpp>
|
|
|
|
#include <components/esm3/loadregn.hpp>
|
|
|
|
#include <components/esm3/loadscpt.hpp>
|
|
|
|
#include <components/esm3/loadskil.hpp>
|
|
|
|
#include <components/esm3/loadsndg.hpp>
|
|
|
|
#include <components/esm3/loadsoun.hpp>
|
|
|
|
#include <components/esm3/loadspel.hpp>
|
|
|
|
#include <components/esm3/loadsscr.hpp>
|
|
|
|
|
2015-08-16 15:24:48 +02:00
|
|
|
#include "../doc/document.hpp"
|
2015-08-13 12:03:20 +02:00
|
|
|
#include "../doc/state.hpp"
|
2015-08-16 15:24:48 +02:00
|
|
|
|
|
|
|
#include "mergestages.hpp"
|
2015-08-13 12:03:20 +02:00
|
|
|
|
2015-08-16 18:27:17 +02:00
|
|
|
CSMTools::MergeOperation::MergeOperation(CSMDoc::Document& document, ToUTF8::FromType encoding)
|
2015-08-16 15:24:48 +02:00
|
|
|
: CSMDoc::Operation(CSMDoc::State_Merging, true)
|
|
|
|
, mState(document)
|
2015-08-13 12:03:20 +02:00
|
|
|
{
|
2015-08-30 11:08:56 +02:00
|
|
|
appendStage(new StartMergeStage(mState));
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2015-08-21 14:02:32 +02:00
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Global>(mState, &CSMWorld::Data::getGlobals));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::GameSetting>(mState, &CSMWorld::Data::getGmsts));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Skill>(mState, &CSMWorld::Data::getSkills));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Class>(mState, &CSMWorld::Data::getClasses));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Faction>(mState, &CSMWorld::Data::getFactions));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Race>(mState, &CSMWorld::Data::getRaces));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Sound>(mState, &CSMWorld::Data::getSounds));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Script>(mState, &CSMWorld::Data::getScripts));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Region>(mState, &CSMWorld::Data::getRegions));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::BirthSign>(mState, &CSMWorld::Data::getBirthsigns));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Spell>(mState, &CSMWorld::Data::getSpells));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Dialogue>(mState, &CSMWorld::Data::getTopics));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Dialogue>(mState, &CSMWorld::Data::getJournals));
|
|
|
|
appendStage(new MergeIdCollectionStage<CSMWorld::Cell>(mState, &CSMWorld::Data::getCells));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Filter>(mState, &CSMWorld::Data::getFilters));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::Enchantment>(mState, &CSMWorld::Data::getEnchantments));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::BodyPart>(mState, &CSMWorld::Data::getBodyParts));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::DebugProfile>(mState, &CSMWorld::Data::getDebugProfiles));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::SoundGenerator>(mState, &CSMWorld::Data::getSoundGens));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::MagicEffect>(mState, &CSMWorld::Data::getMagicEffects));
|
|
|
|
appendStage(new MergeIdCollectionStage<ESM::StartScript>(mState, &CSMWorld::Data::getStartScripts));
|
2015-08-23 12:58:49 +02:00
|
|
|
appendStage(new MergeIdCollectionStage<CSMWorld::Pathgrid, CSMWorld::SubCellCollection<CSMWorld::Pathgrid>>(
|
|
|
|
mState, &CSMWorld::Data::getPathgrids));
|
|
|
|
appendStage(
|
|
|
|
new MergeIdCollectionStage<CSMWorld::Info, CSMWorld::InfoCollection>(mState, &CSMWorld::Data::getTopicInfos));
|
|
|
|
appendStage(
|
|
|
|
new MergeIdCollectionStage<CSMWorld::Info, CSMWorld::InfoCollection>(mState, &CSMWorld::Data::getJournalInfos));
|
2015-08-25 11:54:16 +02:00
|
|
|
appendStage(new MergeRefIdsStage(mState));
|
2015-08-30 14:27:22 +02:00
|
|
|
appendStage(new MergeReferencesStage(mState));
|
2015-08-26 17:21:24 +02:00
|
|
|
appendStage(new MergeReferencesStage(mState));
|
2017-10-14 11:32:42 -04:00
|
|
|
appendStage(new PopulateLandTexturesMergeStage(mState));
|
2015-09-03 16:15:00 +02:00
|
|
|
appendStage(new MergeLandStage(mState));
|
2017-10-14 11:32:42 -04:00
|
|
|
appendStage(new FixLandsAndLandTexturesMergeStage(mState));
|
2017-10-14 13:18:31 -04:00
|
|
|
appendStage(new CleanupLandTexturesMergeStage(mState));
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2015-08-30 11:08:56 +02:00
|
|
|
appendStage(new FinishMergedDocumentStage(mState, encoding));
|
2015-08-16 15:24:48 +02:00
|
|
|
}
|
2015-08-13 12:03:20 +02:00
|
|
|
|
2017-04-28 17:30:26 +02:00
|
|
|
void CSMTools::MergeOperation::setTarget(std::unique_ptr<CSMDoc::Document> document)
|
2015-08-16 15:24:48 +02:00
|
|
|
{
|
2017-04-28 17:30:26 +02:00
|
|
|
mState.mTarget = std::move(document);
|
2015-08-13 12:03:20 +02:00
|
|
|
}
|
|
|
|
|
2015-08-16 15:24:48 +02:00
|
|
|
void CSMTools::MergeOperation::operationDone()
|
2015-08-13 12:03:20 +02:00
|
|
|
{
|
2015-08-16 15:24:48 +02:00
|
|
|
CSMDoc::Operation::operationDone();
|
2015-08-13 12:03:20 +02:00
|
|
|
|
2015-08-16 15:24:48 +02:00
|
|
|
if (mState.mCompleted)
|
|
|
|
emit mergeDone(mState.mTarget.release());
|
2015-08-13 12:03:20 +02:00
|
|
|
}
|