Skip to content

Commit

Permalink
Implemented #97 as toggles
Browse files Browse the repository at this point in the history
- zaps can now toggle multiple other zaps from their current state
- must be set up through the slider properties
- cleaned up slider properties dialog a bit
  • Loading branch information
ousnius committed Sep 10, 2016
1 parent 2f4a699 commit bc7bd64
Show file tree
Hide file tree
Showing 16 changed files with 215 additions and 82 deletions.
7 changes: 5 additions & 2 deletions lang/BodySlide.pot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.8\n"
"X-Generator: Poedit 1.8.9\n"
"Language: en\n"
"X-Poedit-KeywordsList: _\n"

Expand Down Expand Up @@ -1318,10 +1318,13 @@ msgstr ""
msgid "Invert U"
msgstr ""

# XRC STRINGS END HERE
msgid "Invert V"
msgstr ""

# XRC STRINGS END HERE
msgid "Toggle Zaps:"
msgstr ""

#: Anim.cpp:359
msgid "Bone information incomplete. Exported data will not contain correct bone entries! Be sure to load a reference NIF prior to export."
msgstr ""
Expand Down
Binary file modified lang/de/BodySlide.mo
Binary file not shown.
7 changes: 5 additions & 2 deletions lang/de/BodySlide.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.8\n"
"X-Generator: Poedit 1.8.9\n"
"X-Poedit-KeywordsList: _\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

Expand Down Expand Up @@ -1511,10 +1511,13 @@ msgstr "FBX Import Optionen..."
msgid "Invert U"
msgstr "U invertieren"

# XRC STRINGS END HERE
msgid "Invert V"
msgstr "V invertieren"

# XRC STRINGS END HERE
msgid "Toggle Zaps:"
msgstr "Zaps umschalten:"

#: Anim.cpp:359
msgid ""
"Bone information incomplete. Exported data will not contain correct bone "
Expand Down
Binary file modified lang/zh/BodySlide.mo
Binary file not shown.
7 changes: 5 additions & 2 deletions lang/zh/BodySlide.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.8\n"
"X-Generator: Poedit 1.8.9\n"
"X-Poedit-KeywordsList: _\n"
"Plural-Forms: nplurals=1; plural=0;\n"

Expand Down Expand Up @@ -1427,10 +1427,13 @@ msgstr "FBX Import Options..."
msgid "Invert U"
msgstr "Invert U"

# XRC STRINGS END HERE
msgid "Invert V"
msgstr "Invert V"

# XRC STRINGS END HERE
msgid "Toggle Zaps:"
msgstr "Toggle Zaps:"

#: Anim.cpp:359
msgid ""
"Bone information incomplete. Exported data will not contain correct bone "
Expand Down
96 changes: 57 additions & 39 deletions res/xrc/Slider.xrc
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@
</object>
</object>
<object class="wxDialog" name="dlgSliderProp">
<style>wxDEFAULT_DIALOG_STYLE</style>
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
<size>287,210</size>
<title>Slider Properties</title>
<centered>1</centered>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStaticBoxSizer">
<orient>wxHORIZONTAL</orient>
Expand All @@ -100,14 +100,14 @@
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStaticBoxSizer">
<orient>wxHORIZONTAL</orient>
<label>Default Values</label>
<object class="sizeritem">
<option>0</option>
<flag>wxALL</flag>
<flag>wxALL|wxALIGN_CENTER</flag>
<border>5</border>
<object class="wxStaticText" name="lbValLo">
<label>Low</label>
Expand All @@ -122,15 +122,9 @@
<value>0</value>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL</flag>
<flag>wxALL|wxALIGN_CENTER</flag>
<border>5</border>
<object class="wxStaticText" name="lbValHi">
<label>High</label>
Expand All @@ -148,61 +142,85 @@
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStaticBoxSizer">
<orient>wxHORIZONTAL</orient>
<orient>wxVERTICAL</orient>
<label>Options</label>
<object class="sizeritem">
<option>1</option>
<option>0</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxCheckBox" name="chkInvert">
<label>Invert Slider</label>
<checked>0</checked>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxCheckBox" name="chkInvert">
<label>Invert Slider</label>
<checked>0</checked>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxCheckBox" name="chkHidden">
<label>Hidden</label>
<checked>0</checked>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxCheckBox" name="chkZap">
<label>Zap</label>
<checked>0</checked>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxALL</flag>
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxCheckBox" name="chkHidden">
<label>Hidden</label>
<checked>0</checked>
<object class="wxStaticText" name="zapToggleLabel">
<label>Toggle Zaps:</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxALL</flag>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxCheckBox" name="chkZap">
<label>Zap</label>
<checked>0</checked>
<minsize>-1,72</minsize>
<object class="wxCheckListBox" name="zapToggleList">
<style>wxLB_HSCROLL|wxLB_NEEDED_SB</style>
<enabled>0</enabled>
</object>
</object>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND|wxALL</flag>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStdDialogButtonSizer">
<object class="button">
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>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>
<object class="sizeritem">
<option>1</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxButton" name="wxID_CANCEL">
<label>&amp;Cancel</label>
Expand Down
7 changes: 7 additions & 0 deletions src/components/SliderData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ See the included LICENSE file
#include "SliderData.h"

#include <wx/dir.h>
#include <wx/tokenzr.h>

SliderData::SliderData(const string& inName) {
name = inName;
Expand Down Expand Up @@ -74,6 +75,12 @@ int SliderData::LoadSliderData(XMLElement* element, bool genWeights) {
else
bClamp = false;

if (bZap) {
wxStringTokenizer tokenizer(element->Attribute("zaptoggles"), ";");
while (tokenizer.HasMoreTokens())
zapToggles.push_back(tokenizer.GetNextToken().ToStdString());
}

DiffInfo tmpDataFile;
XMLElement* datafile = element->FirstChildElement(dataFileStr.c_str());
while (datafile) {
Expand Down
1 change: 1 addition & 0 deletions src/components/SliderData.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class SliderData {
bool bUV; // UV Sliders!? Wat!
float defSmallValue;
float defBigValue;
vector<string> zapToggles;

// Outfit Studio values
float curValue; // Current slider value.
Expand Down
13 changes: 11 additions & 2 deletions src/components/SliderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void SliderManager::AddSlidersInSet(SliderSet& inSet, bool hideAll) {
}
else {
if (inSet[i].bZap)
AddZapSlider(inSet[i].name);
AddZapSlider(inSet[i].name, inSet[i].zapToggles);
else if (inSet[i].bUV)
AddUVSlider(inSet[i].name, inSet[i].bInvert);
else
Expand Down Expand Up @@ -77,7 +77,7 @@ void SliderManager::AddUVSlider(const string& name, bool invert, const string& d
mSliderCount++;
}

void SliderManager::AddZapSlider(const string& name, const string& dataSetName) {
void SliderManager::AddZapSlider(const string& name, const vector<string>& zapToggles, const string& dataSetName) {
Slider s;
s.name = name;
if (dataSetName.length() > 0)
Expand All @@ -89,6 +89,7 @@ void SliderManager::AddZapSlider(const string& name, const string& dataSetName)
s.zap = true;
s.clamp = false;
s.uv = false;
s.zapToggles = zapToggles;
s.changed = false;

slidersSmall.push_back(s);
Expand Down Expand Up @@ -158,6 +159,14 @@ float SliderManager::GetSlider(const string& slider, bool isSmall) {
return 0.0f;
}

vector<string> SliderManager::GetSliderZapToggles(const string& slider) {
for (int i = 0; i < slidersBig.size(); i++)
if (slidersBig[i].name == slider)
return slidersBig[i].zapToggles;

return vector<string>();
}

void SliderManager::SetSlider(const string& slider, bool isSmall, float val) {
if (!isSmall) {
for (int i = 0; i < slidersBig.size(); i++) {
Expand Down
4 changes: 3 additions & 1 deletion src/components/SliderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Slider {
bool changed;
float defValue;
float value;
vector<string> zapToggles;
vector<string> linkedDataSets;
};

Expand Down Expand Up @@ -85,13 +86,14 @@ class SliderManager {

void AddSlider(const string& name, bool invert = false, const string& dataSetName = "");
void AddHiddenSlider(const string& name, bool invert = false, bool isZap = false, bool isUV = false, const string& dataSetName = "");
void AddZapSlider(const string& name, const string& dataSetName = "");
void AddZapSlider(const string& name, const vector<string>& zapToggles, const string& dataSetName = "");
void AddUVSlider(const string& name, bool invert = false, const string& dataSetName = "");
void SetSliderDefaults(const string& slider, float bigVal, float smallVal);
void SetClampSlider(const string& slider);
void AddSliderLink(const string& slider, const string& dataSetName);

float GetSlider(const string& slider, bool isSmall);
vector<string> GetSliderZapToggles(const string& slider);
void SetSlider(const string& slider, bool isSmall, float val);
void SetChanged(const string& slider, bool isSmall);

Expand Down
21 changes: 17 additions & 4 deletions src/components/SliderSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int SliderSet::CopySlider(SliderData* other) {
ms->bZap = other->bZap;
ms->defBigValue = other->defBigValue;
ms->defSmallValue = other->defSmallValue;
ms->zapToggles = other->zapToggles;
ms->dataFiles = other->dataFiles;
return sliders.size() - 1;
}
Expand Down Expand Up @@ -91,12 +92,11 @@ int SliderSet::LoadSliderSet(XMLElement* element) {
shapeName = shapeName->NextSiblingElement(shapeStr.c_str());
}

SliderData tmpSlider;
XMLElement* sliderEntry = element->FirstChildElement("Slider");
while (sliderEntry) {
tmpSlider.Clear();
SliderData tmpSlider;
if (tmpSlider.LoadSliderData(sliderEntry, genWeights) == 0)
sliders.push_back(tmpSlider);
sliders.push_back(move(tmpSlider));

sliderEntry = sliderEntry->NextSiblingElement("Slider");
}
Expand Down Expand Up @@ -199,10 +199,23 @@ void SliderSet::WriteSliderSet(XMLElement* sliderSetElement) {
sliderElement->SetAttribute("hidden", "true");
if (slider.bClamp)
sliderElement->SetAttribute("clamp", "true");
if (slider.bZap)

if (slider.bZap) {
sliderElement->SetAttribute("zap", "true");

string zapToggles;
for (auto &toggle : slider.zapToggles) {
zapToggles.append(toggle);
zapToggles.append(";");
}

if (!zapToggles.empty())
sliderElement->SetAttribute("zaptoggles", zapToggles.c_str());
}

if (slider.bUV)
sliderElement->SetAttribute("uv", "true");

for (auto &df : slider.dataFiles) {
newElement = sliderSetElement->GetDocument()->NewElement("Data");
dataFileElement = sliderElement->InsertEndChild(newElement)->ToElement();
Expand Down
Loading

0 comments on commit bc7bd64

Please sign in to comment.