Skip to content

Commit

Permalink
Implemented #103, moved settings around
Browse files Browse the repository at this point in the history
  • Loading branch information
ousnius committed Jan 24, 2016
1 parent 06f01bb commit 8f1bda3
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 97 deletions.
60 changes: 34 additions & 26 deletions BodySlideApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ void BodySlideApp::SetDefaultConfig() {

Config.SetDefaultValue("ShapeDataPath", wxGetCwd().ToStdString() + "\\ShapeData");
Config.SetDefaultValue("WarnMissingGamePath", "true");
Config.SetDefaultValue("WarnBatchBuildOverride", "true");
Config.SetDefaultValue("BSATextureScan", "true");
Config.SetDefaultValue("LogLevel", "3");
Config.SetDefaultValue("SelectedPreset", "");
Expand Down Expand Up @@ -1456,31 +1457,33 @@ int BodySlideApp::BuildListBodies(vector<string>& outfitList, map<string, string
datapath = Config["GameDataPath"];
}

for (auto &filePath : outFileCount) {
if (filePath.second.size() > 1) {
wxArrayString selFilePaths;
for (auto &file : filePath.second) {
// Only if it's going to be batch built
if (find(outfitList.begin(), outfitList.end(), file) != outfitList.end())
selFilePaths.Add(file);
}
if (Config.MatchValue("WarnBatchBuildOverride", "true")) {
for (auto &filePath : outFileCount) {
if (filePath.second.size() > 1) {
wxArrayString selFilePaths;
for (auto &file : filePath.second) {
// Only if it's going to be batch built
if (find(outfitList.begin(), outfitList.end(), file) != outfitList.end())
selFilePaths.Add(file);
}

// Same file would not be written more than once
if (selFilePaths.size() <= 1)
continue;
// Same file would not be written more than once
if (selFilePaths.size() <= 1)
continue;

wxSingleChoiceDialog setChoice(sliderView, "The following sets will override the same files.\nPlease decide which one to use and select it in the list below.", "Choose output set", selFilePaths);
if (setChoice.ShowModal() == wxID_CANCEL) {
wxLogMessage("Aborted batch build by not choosing a file override.");
return 1;
}
wxSingleChoiceDialog setChoice(sliderView, "The following sets will override the same files.\nPlease decide which one to use and select it in the list below.", "Choose output set", selFilePaths);
if (setChoice.ShowModal() == wxID_CANCEL) {
wxLogMessage("Aborted batch build by not choosing a file override.");
return 1;
}

// Remove others from the list of outfits to build
selFilePaths.Remove(setChoice.GetStringSelection());
for (auto &file : selFilePaths) {
auto result = find(outfitList.begin(), outfitList.end(), file);
if (result != outfitList.end())
outfitList.erase(result);
// Remove others from the list of outfits to build
selFilePaths.Remove(setChoice.GetStringSelection());
for (auto &file : selFilePaths) {
auto result = find(outfitList.begin(), outfitList.end(), file);
if (result != outfitList.end())
outfitList.erase(result);
}
}
}
}
Expand Down Expand Up @@ -2637,16 +2640,19 @@ void BodySlideFrame::SettingsFillDataFiles(wxCheckListBox* dataFileList, wxStrin
void BodySlideFrame::OnSettings(wxCommandEvent& WXUNUSED(event)) {
wxDialog* settings = wxXmlResource::Get()->LoadDialog(this, "dlgSettings");
if (settings) {
settings->SetSize(wxSize(475, 400));
settings->SetSize(wxSize(525, 533));
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* cbBBOverrideWarn = XRCCTRL(*settings, "cbBBOverrideWarn", wxCheckBox);
cbBBOverrideWarn->SetValue(Config["WarnBatchBuildOverride"] != "false");

wxCheckBox* cbBSATextures = XRCCTRL(*settings, "cbBSATextures", wxCheckBox);
cbBSATextures->SetValue(Config["BSATextureScan"] != "false");

Expand All @@ -2666,7 +2672,7 @@ void BodySlideFrame::OnSettings(wxCommandEvent& WXUNUSED(event)) {

if (settings->ShowModal() == wxID_OK) {
TargetGame targ = (TargetGame)choiceTargetGame->GetSelection();
Config.SetValue("TargetGame",targ);
Config.SetValue("TargetGame", targ);
wxString TargetGames[4] = { "Fallout3", "FalloutNewVegas", "Skyrim", "Fallout4" };
if (!dpGameDataPath->GetPath().IsEmpty()) {
wxFileName gameDataDir = dpGameDataPath->GetDirName();
Expand All @@ -2680,12 +2686,13 @@ void BodySlideFrame::OnSettings(wxCommandEvent& WXUNUSED(event)) {
for (int i = 0; i < dataFileList->GetCount(); i++) {
if (!dataFileList->IsChecked(i)) {
selectedfiles += dataFileList->GetString(i) + "; ";
}
}
}
selectedfiles = selectedfiles.BeforeLast(';');

Config.SetValue("GameDataFiles/" + TargetGames[targ].ToStdString(), selectedfiles.ToStdString());

Config.SetValue("WarnBatchBuildOverride", cbBBOverrideWarn->IsChecked() ? "true" : "false");

Config.SetValue("BSATextureScan", cbBSATextures->IsChecked() ? "true" : "false");
Config.SetValue("Input/LeftMousePan", cbLeftMousePan->IsChecked() ? "true" : "false");
Expand All @@ -2695,6 +2702,7 @@ void BodySlideFrame::OnSettings(wxCommandEvent& WXUNUSED(event)) {

Config.SetValue("Anim/SkeletonRootName", choiceSkeletonRoot->GetStringSelection().ToStdString());
}

delete settings;
}
}
Expand Down
123 changes: 52 additions & 71 deletions res/BodyslideFrame.xrc
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@
</object>
<object class="wxDialog" name="dlgSettings">
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
<size>475,400</size>
<title>Settings</title>
<centered>1</centered>
<object class="wxBoxSizer">
Expand Down Expand Up @@ -825,104 +824,86 @@
<value>,90,90,-1,70,0</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>
<tooltip>Data path to load textures from and build files to.</tooltip>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND</flag>
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="wxStaticBoxSizer">
<orient>wxVERTICAL</orient>
<label>General</label>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>2</border>
<object class="wxStaticBoxSizer">
<minsize>160,-1</minsize>
<orient>wxVERTICAL</orient>
<label>3D View</label>
<flag>wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>2</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALIGN_TOP|wxALL|wxBOTTOM</flag>
<border>5</border>
<object class="wxStaticText" name="lbBSATextures">
<size>100,-1</size>
<label>BSA Textures</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALIGN_TOP|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>
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxCheckBox" name="cbBBOverrideWarn">
<tooltip>Enables/disables the dialog for choosing which set to build during a batch build if overrides happen.</tooltip>
<label>Override Warning</label>
<checked>1</checked>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>2</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="lbLeftMousePan">
<size>100,-1</size>
<label>Left Mouse Pan</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>1</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>
<option>1</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>BSA Textures</label>
<checked>1</checked>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>3</option>
<flag>wxALL|wxEXPAND</flag>
<border>2</border>
<object class="wxStaticBoxSizer">
<orient>wxVERTICAL</orient>
<label>Data Files</label>
<option>0</option>
<flag>wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxCheckListBox" name="DataFileList">
<content />
<object class="wxCheckBox" name="cbLeftMousePan">
<tooltip>Enables/disables panning the camera with the left mouse button in Outfit Studio.</tooltip>
<label>Left Mouse Pan</label>
<checked>0</checked>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<object class="wxStaticBoxSizer">
<minsize>400,125</minsize>
<orient>wxVERTICAL</orient>
<label>Data Files</label>
<object class="sizeritem">
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxCheckListBox" name="DataFileList">
<content />
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
Expand Down

0 comments on commit 8f1bda3

Please sign in to comment.