From 5538f822f468fb8d421123037ff4762a23344604 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Sat, 1 Aug 2015 07:50:56 +1000 Subject: [PATCH] Initial support for Land and LandTexture tables. Updates Features #936 and #933. --- apps/opencs/model/world/data.cpp | 10 ++++++++++ apps/opencs/model/world/universalid.cpp | 8 ++++++-- apps/opencs/model/world/universalid.hpp | 4 ++++ apps/opencs/view/doc/view.cpp | 18 ++++++++++++++++++ apps/opencs/view/doc/view.hpp | 4 ++++ apps/opencs/view/world/subviews.cpp | 4 +++- 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 648761b11..7b3e1fe4f 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -553,6 +553,14 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc mMetaData.addColumn (new AuthorColumn); mMetaData.addColumn (new FileDescriptionColumn); + mLandTextures.addColumn (new StringIdColumn); + mLandTextures.addColumn (new RecordStateColumn); + mLandTextures.addColumn (new FixedRecordTypeColumn (UniversalId::Type_LandTexture)); + + mLand.addColumn (new StringIdColumn); + mLand.addColumn (new RecordStateColumn); + mLand.addColumn (new FixedRecordTypeColumn (UniversalId::Type_Land)); + addModel (new IdTable (&mGlobals), UniversalId::Type_Global); addModel (new IdTable (&mGmsts), UniversalId::Type_Gmst); addModel (new IdTable (&mSkills), UniversalId::Type_Skill); @@ -594,6 +602,8 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc addModel (new ResourceTable (&mResourcesManager.get (UniversalId::Type_Videos)), UniversalId::Type_Video); addModel (new IdTable (&mMetaData), UniversalId::Type_MetaData); + addModel (new IdTable (&mLand), UniversalId::Type_Land); + addModel (new IdTable (&mLandTextures), UniversalId::Type_LandTexture); // for autocalc updates when gmst/race/class/skils tables change CSMWorld::IdTable *gmsts = diff --git a/apps/opencs/model/world/universalid.cpp b/apps/opencs/model/world/universalid.cpp index 73d893a26..8ad9873fc 100644 --- a/apps/opencs/model/world/universalid.cpp +++ b/apps/opencs/model/world/universalid.cpp @@ -57,6 +57,8 @@ namespace { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Pathgrids, "Pathgrids", 0 }, { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_StartScripts, "Start Scripts", 0 }, { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_MetaDatas, "Meta Data Table", 0 }, + { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_LandTextures, "Land Texture Table", 0 }, + { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Lands, "Land Table", 0 }, { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker }; @@ -122,6 +124,8 @@ namespace { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Pathgrid, "Pathgrid", 0 }, { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_StartScript, "Start Script", 0 }, { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_MetaData, "Meta Data", 0 }, + { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_LandTexture, "Land Texture", 0 }, + { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Land, "Land", 0 }, { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker }; @@ -365,8 +369,8 @@ std::vector CSMWorld::UniversalId::listTypes (int c for (int i=0; sIndexArg[i].mName; ++i) if (sIndexArg[i].mClass & classes) list.push_back (sIndexArg[i].mType); - - return list; + + return list; } CSMWorld::UniversalId::Type CSMWorld::UniversalId::getParentType (Type type) diff --git a/apps/opencs/model/world/universalid.hpp b/apps/opencs/model/world/universalid.hpp index e9104fc22..a05843597 100644 --- a/apps/opencs/model/world/universalid.hpp +++ b/apps/opencs/model/world/universalid.hpp @@ -133,6 +133,10 @@ namespace CSMWorld Type_Search, Type_MetaDatas, Type_MetaData, + Type_LandTextures, + Type_LandTexture, + Type_Lands, + Type_Land, Type_RunLog }; diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 78203666d..173a78e9d 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -169,6 +169,10 @@ void CSVDoc::View::setupWorldMenu() connect (grid, SIGNAL (triggered()), this, SLOT (addPathgridSubView())); world->addAction (grid); + QAction *land = new QAction (tr ("Lands"), this); + connect (land, SIGNAL (triggered()), this, SLOT (addLandSubView())); + world->addAction (land); + world->addSeparator(); // items that don't represent single record lists follow here QAction *regionMap = new QAction (tr ("Region Map"), this); @@ -288,6 +292,10 @@ void CSVDoc::View::setupAssetsMenu() connect (textures, SIGNAL (triggered()), this, SLOT (addTexturesSubView())); assets->addAction (textures); + QAction *land = new QAction (tr ("Land Textures"), this); + connect (land, SIGNAL (triggered()), this, SLOT (addLandTextureSubView())); + assets->addAction (land); + QAction *videos = new QAction (tr ("Videos"), this); connect (videos, SIGNAL (triggered()), this, SLOT (addVideosSubView())); assets->addAction (videos); @@ -838,6 +846,16 @@ void CSVDoc::View::addPathgridSubView() addSubView (CSMWorld::UniversalId::Type_Pathgrids); } +void CSVDoc::View::addLandTextureSubView() +{ + addSubView (CSMWorld::UniversalId::Type_LandTextures); +} + +void CSVDoc::View::addLandSubView() +{ + addSubView (CSMWorld::UniversalId::Type_Lands); +} + void CSVDoc::View::addStartScriptsSubView() { addSubView (CSMWorld::UniversalId::Type_StartScripts); diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index dc8e14fb5..7f465c8f3 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -228,6 +228,10 @@ namespace CSVDoc void addPathgridSubView(); + void addLandTextureSubView(); + + void addLandSubView(); + void addStartScriptsSubView(); void addSearchSubView(); diff --git a/apps/opencs/view/world/subviews.cpp b/apps/opencs/view/world/subviews.cpp index b8a6ba429..73000af13 100644 --- a/apps/opencs/view/world/subviews.cpp +++ b/apps/opencs/view/world/subviews.cpp @@ -43,6 +43,8 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager) CSMWorld::UniversalId::Type_BodyParts, CSMWorld::UniversalId::Type_SoundGens, CSMWorld::UniversalId::Type_Pathgrids, + CSMWorld::UniversalId::Type_LandTextures, + CSMWorld::UniversalId::Type_Lands, CSMWorld::UniversalId::Type_StartScripts, CSMWorld::UniversalId::Type_None // end marker @@ -172,7 +174,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager) manager.add (CSMWorld::UniversalId::Type_MetaData, new CSVDoc::SubViewFactory); - + //preview manager.add (CSMWorld::UniversalId::Type_Preview, new CSVDoc::SubViewFactory); }