Skip to content

Commit

Permalink
Added settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
ousnius committed Jul 22, 2015
1 parent 2e42ef9 commit 460afc5
Show file tree
Hide file tree
Showing 4 changed files with 318 additions and 2 deletions.
66 changes: 66 additions & 0 deletions BodySlideApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions BodySlideApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions FSBSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <wx/zstream.h>
#include <wx/mstream.h>

#pragma warning (disable : 4389)

/* Default header data */
#define MW_BSAHEADER_FILEID 0x00000100 //!< Magic for Morrowind BSA
Expand Down
251 changes: 249 additions & 2 deletions res/BodyslideFrame.xrc
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,29 @@
<border>5</border>
<object class="wxButton" name="btnAbout">
<size>26,-1</size>
<tooltip>About</tooltip>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER|wxALL</flag>
<border>5</border>
<object class="wxButton" name="btnSettings">
<size>80,-1</size>
<fg>#000000</fg>
<tooltip>Open settings dialog.</tooltip>
<label>Settings</label>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER|wxALL</flag>
<border>5</border>
<object class="wxButton" name="btnOutfitStudio">
<size>128,-1</size>
<size>100,-1</size>
<fg>#000000</fg>
<tooltip>Open Outfit Studio, a full-featured tool for creating and converting outfits.</tooltip>
<label>Open Outfit Studio...</label>
<label>Outfit Studio</label>
</object>
</object>
</object>
Expand Down Expand Up @@ -706,6 +718,241 @@
</object>
</object>
</object>
<object class="wxDialog" name="dlgSettings">
<style>wxDEFAULT_DIALOG_STYLE</style>
<size>472,390</size>
<title>Settings</title>
<centered>1</centered>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStaticBoxSizer">
<orient>wxVERTICAL</orient>
<label>Game</label>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="lbTargetGame">
<label>Target Game</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>3</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxChoice" name="choiceTargetGame">
<tooltip>Choose the target game you want to use the program for here.</tooltip>
<selection>2</selection>
<content>
<item>Fallout 3</item>
<item>Fallout New Vegas</item>
<item>Skyrim</item>
</content>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="lbGameDataPath">
<label>Game Data Path</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>3</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxDirPickerCtrl" name="dpGameDataPath">
<value></value>
<message>Select the data path of the game...</message>
<style>wxDIRP_DEFAULT_STYLE</style>
<tooltip>Data path to load textures from and build to.</tooltip>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStaticBoxSizer">
<orient>wxVERTICAL</orient>
<label>3D View</label>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="lbBSATextures">
<label>BSA Textures</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>3</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxCheckBox" name="cbBSATextures">
<tooltip>Enables/disables scanning BSAs in the game data folder for textures to load.</tooltip>
<label></label>
<checked>1</checked>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="lbLeftMousePan">
<label>Left Mouse Pan</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>3</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxCheckBox" name="cbLeftMousePan">
<tooltip>Enables/disables panning the camera with the left mouse button.</tooltip>
<label></label>
<checked>0</checked>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStaticBoxSizer">
<orient>wxVERTICAL</orient>
<label>Reference Skeleton</label>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="lbSkeletonFile">
<label>File</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>3</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxFilePickerCtrl" name="fpSkeletonFile">
<value></value>
<message>Select a reference skeleton .nif file...</message>
<wildcard>*.nif</wildcard>
<style>wxFLP_DEFAULT_STYLE</style>
<tooltip>The reference skeleton file for Outfit Studio.</tooltip>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="lbSkeletonRoot">
<label>Root Node</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>3</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxChoice" name="choiceSkeletonRoot">
<tooltip>The root node name of the reference skeleton. Can differ from game to game.</tooltip>
<selection>0</selection>
<content>
<item>NPC</item>
<item>Bip01</item>
</content>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStdDialogButtonSizer">
<object class="button">
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
<border>5</border>
<object class="wxButton" name="wxID_OK">
<label>&amp;OK</label>
</object>
</object>
<object class="button">
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
<border>5</border>
<object class="wxButton" name="wxID_CANCEL">
<label>&amp;Cancel</label>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="wxDialog" name="dlgAbout">
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX</style>
<title>About</title>
Expand Down

0 comments on commit 460afc5

Please sign in to comment.