From 460afc567299c3e1870216424c771bdb9212c452 Mon Sep 17 00:00:00 2001 From: ousnius Date: Wed, 22 Jul 2015 14:47:35 +0200 Subject: [PATCH] Added settings dialog --- BodySlideApp.cpp | 66 +++++++++++ BodySlideApp.h | 2 + FSBSA.cpp | 1 + res/BodyslideFrame.xrc | 251 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 318 insertions(+), 2 deletions(-) diff --git a/BodySlideApp.cpp b/BodySlideApp.cpp index 701b544d..5d739010 100644 --- a/BodySlideApp.cpp +++ b/BodySlideApp.cpp @@ -24,6 +24,7 @@ BEGIN_EVENT_TABLE(BodySlideFrame, wxFrame) EVT_BUTTON(XRCID("btnBuildBatch"), BodySlideFrame::OnBatchBuild) EVT_BUTTON(XRCID("btnBuild"), BodySlideFrame::OnBuildBodies) EVT_BUTTON(XRCID("btnOutfitStudio"), BodySlideFrame::OnOutfitStudio) + EVT_BUTTON(XRCID("btnSettings"), BodySlideFrame::OnSettings) EVT_BUTTON(XRCID("btnAbout"), BodySlideFrame::OnAbout) EVT_BUTTON(XRCID("btnPresets"), BodySlideFrame::OnSavePreset) EVT_BUTTON(XRCID("btnGroupManager"), BodySlideFrame::OnGroupManager) @@ -2099,6 +2100,71 @@ void BodySlideFrame::OnOutfitStudio(wxCommandEvent& WXUNUSED(event)) { app->LaunchOutfitStudio(); } +void BodySlideFrame::OnChooseTargetGame(wxCommandEvent& event) { + wxChoice* choiceTargetGame = (wxChoice*)event.GetEventObject(); + wxWindow* parent = choiceTargetGame->GetGrandParent(); + wxChoice* choiceSkeletonRoot = XRCCTRL(*parent, "choiceSkeletonRoot", wxChoice); + switch (choiceTargetGame->GetSelection()) { + case FO3: + case FONV: + choiceSkeletonRoot->SetStringSelection("Bip01"); + break; + case SKYRIM: + default: + choiceSkeletonRoot->SetStringSelection("NPC"); + break; + } +} + +void BodySlideFrame::OnSettings(wxCommandEvent& WXUNUSED(event)) { + wxDialog* settings = wxXmlResource::Get()->LoadDialog(this, "dlgSettings"); + if (settings) { + settings->SetSize(wxSize(475, 390)); + settings->CenterOnParent(); + + wxChoice* choiceTargetGame = XRCCTRL(*settings, "choiceTargetGame", wxChoice); + choiceTargetGame->Select(Config.GetIntValue("TargetGame")); + + wxDirPickerCtrl* dpGameDataPath = XRCCTRL(*settings, "dpGameDataPath", wxDirPickerCtrl); + wxString gameDataPath = Config["GameDataPath"]; + dpGameDataPath->SetPath(gameDataPath); + + wxCheckBox* cbBSATextures = XRCCTRL(*settings, "cbBSATextures", wxCheckBox); + cbBSATextures->SetValue(Config["BSATextureScan"] != "false"); + + wxCheckBox* cbLeftMousePan = XRCCTRL(*settings, "cbLeftMousePan", wxCheckBox); + cbLeftMousePan->SetValue(Config["Input/LeftMousePan"] != "false"); + + wxFilePickerCtrl* fpSkeletonFile = XRCCTRL(*settings, "fpSkeletonFile", wxFilePickerCtrl); + fpSkeletonFile->SetPath(Config["Anim/DefaultSkeletonReference"]); + + wxChoice* choiceSkeletonRoot = XRCCTRL(*settings, "choiceSkeletonRoot", wxChoice); + choiceSkeletonRoot->SetStringSelection(Config["Anim/SkeletonRootName"]); + + settings->Bind(wxEVT_CHOICE, &BodySlideFrame::OnChooseTargetGame, this); + + if (settings->ShowModal() == wxID_OK) { + Config.SetValue("TargetGame", choiceTargetGame->GetSelection()); + + if (!dpGameDataPath->GetPath().IsEmpty()) { + wxFileName gameDataDir = dpGameDataPath->GetDirName(); + gameDataDir.MakeRelativeTo(); + Config.SetValue("GameDataPath", gameDataDir.GetFullPath().ToStdString()); + } + + Config.SetValue("BSATextureScan", cbBSATextures->IsChecked() ? "true" : "false"); + Config.SetValue("Input/LeftMousePan", cbLeftMousePan->IsChecked() ? "true" : "false"); + + wxFileName skeletonFile = fpSkeletonFile->GetFileName(); + skeletonFile.MakeRelativeTo(); + Config.SetValue("Anim/DefaultSkeletonReference", skeletonFile.GetFullPath().ToStdString()); + + Config.SetValue("Anim/SkeletonRootName", choiceSkeletonRoot->GetStringSelection().ToStdString()); + } + delete settings; + } +} + void BodySlideFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxDialog* about = wxXmlResource::Get()->LoadDialog(this, "dlgAbout"); if (about) { diff --git a/BodySlideApp.h b/BodySlideApp.h index 21876357..dc11c67c 100644 --- a/BodySlideApp.h +++ b/BodySlideApp.h @@ -283,6 +283,8 @@ class BodySlideFrame : public wxFrame { void OnBatchBuildContext(wxMouseEvent& event); void OnBatchBuildSelect(wxCommandEvent& event); void OnOutfitStudio(wxCommandEvent& event); + void OnSettings(wxCommandEvent& event); + void OnChooseTargetGame(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); void OnMoveWindow(wxMoveEvent& event); void OnSetSize(wxSizeEvent& event); diff --git a/FSBSA.cpp b/FSBSA.cpp index d02543c0..97b6abc8 100644 --- a/FSBSA.cpp +++ b/FSBSA.cpp @@ -35,6 +35,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#pragma warning (disable : 4389) /* Default header data */ #define MW_BSAHEADER_FILEID 0x00000100 //!< Magic for Morrowind BSA diff --git a/res/BodyslideFrame.xrc b/res/BodyslideFrame.xrc index b105c3e8..6b282383 100644 --- a/res/BodyslideFrame.xrc +++ b/res/BodyslideFrame.xrc @@ -299,6 +299,18 @@ 5 26,-1 + About + + + + + wxALIGN_CENTER|wxALL + 5 + + 80,-1 + #000000 + Open settings dialog. + @@ -306,10 +318,10 @@ wxALIGN_CENTER|wxALL 5 - 128,-1 + 100,-1 #000000 Open Outfit Studio, a full-featured tool for creating and converting outfits. - + @@ -706,6 +718,241 @@ + + + 472,390 + Settings + 1 + + wxVERTICAL + + + wxALL|wxEXPAND + 5 + + wxVERTICAL + + + + wxEXPAND|wxLEFT|wxRIGHT + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + -1 + + + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + Choose the target game you want to use the program for here. + 2 + + Fallout 3 + Fallout New Vegas + Skyrim + + + + + + + + wxEXPAND|wxLEFT|wxRIGHT + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + -1 + + + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + Select the data path of the game... + + Data path to load textures from and build to. + + + + + + + + + wxALL|wxEXPAND + 5 + + wxVERTICAL + + + + wxALL|wxEXPAND + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + -1 + + + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + Enables/disables scanning BSAs in the game data folder for textures to load. + + 1 + + + + + + + wxALL|wxEXPAND + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + -1 + + + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + Enables/disables panning the camera with the left mouse button. + + 0 + + + + + + + + + wxALL|wxEXPAND + 5 + + wxVERTICAL + + + + wxEXPAND|wxLEFT|wxRIGHT + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + -1 + + + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + Select a reference skeleton .nif file... + *.nif + + The reference skeleton file for Outfit Studio. + + + + + + + wxEXPAND|wxLEFT|wxRIGHT + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + -1 + + + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + The root node name of the reference skeleton. Can differ from game to game. + 0 + + NPC + Bip01 + + + + + + + + + + wxALL|wxEXPAND + 5 + 0,0 + + + + wxALL|wxEXPAND + 5 + + + wxALIGN_CENTER_HORIZONTAL|wxALL + 5 + + + + + + wxALIGN_CENTER_HORIZONTAL|wxALL + 5 + + + + + + + + About