forked from teamnwah/openmw-tes3coop
Editor: Add PathgridCreator to find duplicate IDs
This commit is contained in:
parent
c9ada852aa
commit
b129ff9672
4 changed files with 63 additions and 3 deletions
|
@ -67,7 +67,7 @@ opencs_hdrs_noqt (view/doc
|
||||||
|
|
||||||
opencs_units (view/world
|
opencs_units (view/world
|
||||||
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
||||||
cellcreator referenceablecreator startscriptcreator referencecreator scenesubview
|
cellcreator pathgridcreator referenceablecreator startscriptcreator referencecreator scenesubview
|
||||||
infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable
|
infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable
|
||||||
dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator
|
dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator
|
||||||
)
|
)
|
||||||
|
|
29
apps/opencs/view/world/pathgridcreator.cpp
Normal file
29
apps/opencs/view/world/pathgridcreator.cpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#include "pathgridcreator.hpp"
|
||||||
|
|
||||||
|
#include "../../model/world/data.hpp"
|
||||||
|
|
||||||
|
CSVWorld::PathgridCreator::PathgridCreator(
|
||||||
|
CSMWorld::Data& data,
|
||||||
|
QUndoStack& undoStack,
|
||||||
|
const CSMWorld::UniversalId& id,
|
||||||
|
bool relaxedIdRules
|
||||||
|
) : GenericCreator(data, undoStack, id, relaxedIdRules)
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string CSVWorld::PathgridCreator::getErrors() const
|
||||||
|
{
|
||||||
|
std::string pathgridId = getId();
|
||||||
|
|
||||||
|
// Check user input for any errors.
|
||||||
|
std::string errors;
|
||||||
|
if (pathgridId.empty())
|
||||||
|
{
|
||||||
|
errors = "No Pathgrid ID entered";
|
||||||
|
}
|
||||||
|
else if (getData().getPathgrids().searchId(pathgridId) > -1)
|
||||||
|
{
|
||||||
|
errors = "Pathgrid with this ID already exists";
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
26
apps/opencs/view/world/pathgridcreator.hpp
Normal file
26
apps/opencs/view/world/pathgridcreator.hpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef PATHGRIDCREATOR_HPP
|
||||||
|
#define PATHGRIDCREATOR_HPP
|
||||||
|
|
||||||
|
#include "genericcreator.hpp"
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
/// \brief Record creator for pathgrids.
|
||||||
|
class PathgridCreator : public GenericCreator
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
PathgridCreator(
|
||||||
|
CSMWorld::Data& data,
|
||||||
|
QUndoStack& undoStack,
|
||||||
|
const CSMWorld::UniversalId& id,
|
||||||
|
bool relaxedIdRules = false);
|
||||||
|
|
||||||
|
/// \return Error description for current user input.
|
||||||
|
virtual std::string getErrors() const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // PATHGRIDCREATOR_HPP
|
|
@ -14,6 +14,7 @@
|
||||||
#include "scenesubview.hpp"
|
#include "scenesubview.hpp"
|
||||||
#include "dialoguecreator.hpp"
|
#include "dialoguecreator.hpp"
|
||||||
#include "infocreator.hpp"
|
#include "infocreator.hpp"
|
||||||
|
#include "pathgridcreator.hpp"
|
||||||
#include "previewsubview.hpp"
|
#include "previewsubview.hpp"
|
||||||
|
|
||||||
void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
|
@ -42,7 +43,6 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
CSMWorld::UniversalId::Type_Enchantments,
|
CSMWorld::UniversalId::Type_Enchantments,
|
||||||
CSMWorld::UniversalId::Type_BodyParts,
|
CSMWorld::UniversalId::Type_BodyParts,
|
||||||
CSMWorld::UniversalId::Type_SoundGens,
|
CSMWorld::UniversalId::Type_SoundGens,
|
||||||
CSMWorld::UniversalId::Type_Pathgrids,
|
|
||||||
|
|
||||||
CSMWorld::UniversalId::Type_None // end marker
|
CSMWorld::UniversalId::Type_None // end marker
|
||||||
};
|
};
|
||||||
|
@ -75,6 +75,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
manager.add (CSMWorld::UniversalId::Type_JournalInfos,
|
manager.add (CSMWorld::UniversalId::Type_JournalInfos,
|
||||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, InfoCreatorFactory>);
|
new CSVDoc::SubViewFactoryWithCreator<TableSubView, InfoCreatorFactory>);
|
||||||
|
|
||||||
|
manager.add (CSMWorld::UniversalId::Type_Pathgrids,
|
||||||
|
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<PathgridCreator> >);
|
||||||
|
|
||||||
// Subviews for resources tables
|
// Subviews for resources tables
|
||||||
manager.add (CSMWorld::UniversalId::Type_Meshes,
|
manager.add (CSMWorld::UniversalId::Type_Meshes,
|
||||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
|
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
|
||||||
|
@ -125,7 +128,6 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
CSMWorld::UniversalId::Type_Enchantment,
|
CSMWorld::UniversalId::Type_Enchantment,
|
||||||
CSMWorld::UniversalId::Type_BodyPart,
|
CSMWorld::UniversalId::Type_BodyPart,
|
||||||
CSMWorld::UniversalId::Type_SoundGen,
|
CSMWorld::UniversalId::Type_SoundGen,
|
||||||
CSMWorld::UniversalId::Type_Pathgrid,
|
|
||||||
|
|
||||||
CSMWorld::UniversalId::Type_None // end marker
|
CSMWorld::UniversalId::Type_None // end marker
|
||||||
};
|
};
|
||||||
|
@ -168,6 +170,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
manager.add (CSMWorld::UniversalId::Type_Journal,
|
manager.add (CSMWorld::UniversalId::Type_Journal,
|
||||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, JournalCreatorFactory> (false));
|
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, JournalCreatorFactory> (false));
|
||||||
|
|
||||||
|
manager.add (CSMWorld::UniversalId::Type_Pathgrid,
|
||||||
|
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<PathgridCreator> > (false));
|
||||||
|
|
||||||
manager.add (CSMWorld::UniversalId::Type_DebugProfile,
|
manager.add (CSMWorld::UniversalId::Type_DebugProfile,
|
||||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<GenericCreator, CSMWorld::Scope_Project | CSMWorld::Scope_Session> > (false));
|
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<GenericCreator, CSMWorld::Scope_Project | CSMWorld::Scope_Session> > (false));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue