Skip to content

Commit cd44a79

Browse files
daz001ousnius
andauthored
OSD/TRI import settings dialog (#409)
Co-authored-by: ousnius <ousnius@users.noreply.github.com>
1 parent fb27bfc commit cd44a79

File tree

10 files changed

+478
-61
lines changed

10 files changed

+478
-61
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ set(OSsources
8282
src/program/OutfitStudio.cpp
8383
src/program/ShapeProperties.cpp
8484
src/program/ConvertBodyReferenceDialog.cpp
85+
src/program/SliderDataImportDialog.cpp
8586
)
8687
set(BSsources
8788
${commonsources}

OutfitStudio.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@
758758
<ClInclude Include="src\program\OutfitStudio.h" />
759759
<ClInclude Include="src\program\PresetSaveDialog.h" />
760760
<ClInclude Include="src\program\ShapeProperties.h" />
761+
<ClInclude Include="src\program\SliderDataImportDialog.h" />
761762
<ClInclude Include="src\render\GLExtensions.h" />
762763
<ClInclude Include="src\render\GLMaterial.h" />
763764
<ClInclude Include="src\render\GLOffscreenBuffer.h" />
@@ -830,6 +831,7 @@
830831
<ClCompile Include="src\program\OutfitStudio.cpp" />
831832
<ClCompile Include="src\program\PresetSaveDialog.cpp" />
832833
<ClCompile Include="src\program\ShapeProperties.cpp" />
834+
<ClCompile Include="src\program\SliderDataImportDialog.cpp" />
833835
<ClCompile Include="src\render\GLExtensions.cpp" />
834836
<ClCompile Include="src\render\GLMaterial.cpp" />
835837
<ClCompile Include="src\render\GLOffscreenBuffer.cpp" />
@@ -846,6 +848,7 @@
846848
</ItemGroup>
847849
<ItemGroup>
848850
<Xml Include="Config.xml" />
851+
<Xml Include="res\xrc\SliderDataImport.xrc" />
849852
</ItemGroup>
850853
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
851854
<ImportGroup Label="ExtensionTargets">

OutfitStudio.vcxproj.filters

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,9 @@
17621762
<ClInclude Include="src\utils\ConfigDialogUtil.h">
17631763
<Filter>Utilities</Filter>
17641764
</ClInclude>
1765+
<ClInclude Include="src\program\SliderDataImportDialog.h">
1766+
<Filter>Program</Filter>
1767+
</ClInclude>
17651768
</ItemGroup>
17661769
<ItemGroup>
17671770
<ClCompile Include="lib\TinyXML-2\tinyxml2.cpp">
@@ -1971,10 +1974,16 @@
19711974
<ClCompile Include="src\program\ConvertBodyReferenceDialog.cpp">
19721975
<Filter>Program</Filter>
19731976
</ClCompile>
1977+
<ClCompile Include="src\program\SliderDataImportDialog.cpp">
1978+
<Filter>Program</Filter>
1979+
</ClCompile>
19741980
</ItemGroup>
19751981
<ItemGroup>
19761982
<Xml Include="Config.xml">
19771983
<Filter>Resources</Filter>
19781984
</Xml>
1985+
<Xml Include="res\xrc\SliderDataImport.xrc">
1986+
<Filter>Resources</Filter>
1987+
</Xml>
19791988
</ItemGroup>
19801989
</Project>

res/xrc/SliderDataImport.xrc

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
3+
<object class="wxDialog" name="dlgSliderDataImport">
4+
<style>wxCAPTION|wxDEFAULT_DIALOG_STYLE</style>
5+
<size>650,500</size>
6+
<title>Slider Data Import Options...</title>
7+
<centered>1</centered>
8+
<object class="wxBoxSizer">
9+
<orient>wxVERTICAL</orient>
10+
<object class="sizeritem">
11+
<option>0</option>
12+
<flag>wxEXPAND</flag>
13+
<border>5</border>
14+
<object class="wxBoxSizer">
15+
<orient>wxHORIZONTAL</orient>
16+
<object class="sizeritem">
17+
<option>0</option>
18+
<flag>wxALL</flag>
19+
<border>5</border>
20+
<object class="wxStaticText">
21+
<label>Select the shapes that slider data will be imported for:</label>
22+
</object>
23+
</object>
24+
<object class="spacer">
25+
<option>1</option>
26+
<flag>wxEXPAND</flag>
27+
<border>5</border>
28+
<size>0,0</size>
29+
</object>
30+
</object>
31+
</object>
32+
<object class="sizeritem">
33+
<option>0</option>
34+
<flag>wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</flag>
35+
<border>5</border>
36+
<minsize>300,80</minsize>
37+
<object class="wxCheckListBox" name="sliderShapesImportList">
38+
<style>wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_EXTENDED|wxLB_SORT</style>
39+
</object>
40+
</object>
41+
<object class="sizeritem">
42+
<option>0</option>
43+
<flag>wxEXPAND</flag>
44+
<border>5</border>
45+
<object class="wxBoxSizer">
46+
<orient>wxHORIZONTAL</orient>
47+
<object class="sizeritem">
48+
<option>0</option>
49+
<flag>wxALL</flag>
50+
<border>5</border>
51+
<object class="wxStaticText">
52+
<label>Select the sliders to be imported</label>
53+
</object>
54+
</object>
55+
<object class="spacer">
56+
<option>1</option>
57+
<flag>wxEXPAND</flag>
58+
<border>5</border>
59+
<size>0,0</size>
60+
</object>
61+
</object>
62+
</object>
63+
<object class="sizeritem">
64+
<option>0</option>
65+
<flag>wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</flag>
66+
<border>5</border>
67+
<minsize>300,200</minsize>
68+
<object class="wxCheckListBox" name="sliderImportList">
69+
<style>wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_EXTENDED|wxLB_SORT</style>
70+
</object>
71+
</object>
72+
<object class="sizeritem">
73+
<option>0</option>
74+
<flag>wxALL|wxEXPAND</flag>
75+
<border>5</border>
76+
<object class="wxCheckBox" name="chkImportMergeSliders">
77+
<label>Merge Sliders</label>
78+
<checked>1</checked>
79+
</object>
80+
</object>
81+
<object class="sizeritem">
82+
<option>0</option>
83+
<flag>wxEXPAND|wxALL</flag>
84+
<border>10</border>
85+
<object class="wxStdDialogButtonSizer">
86+
<object class="button">
87+
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
88+
<border>5</border>
89+
<object class="wxButton" name="wxID_OK">
90+
<label>&amp;OK</label>
91+
</object>
92+
</object>
93+
<object class="button">
94+
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
95+
<border>5</border>
96+
<object class="wxButton" name="wxID_CANCEL">
97+
<label>&amp;Cancel</label>
98+
</object>
99+
</object>
100+
</object>
101+
</object>
102+
</object>
103+
</object>
104+
<object class="wxMenu" name="sliderDataContext">
105+
<object class="wxMenuItem" name="sliderDataContextNone">
106+
<label>Select None</label>
107+
</object>
108+
<object class="wxMenuItem" name="sliderDataContextAll">
109+
<label>Select All</label>
110+
</object>
111+
<object class="wxMenuItem" name="sliderDataContextInvert">
112+
<label>Invert Selection</label>
113+
</object>
114+
</object>
115+
</resource>

src/components/SliderSet.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ class SliderSet {
145145
return outDataNames;
146146
}
147147

148+
std::string SliderFromDataName(const std::string& targetName, const std::string& dataName) {
149+
for (auto& s : sliders) {
150+
for (auto& df : s.dataFiles) {
151+
if (df.targetName == targetName && df.dataName == dataName)
152+
return s.name;
153+
}
154+
}
155+
return "";
156+
}
157+
148158
std::string TargetToShape(const std::string& targetName) {
149159
for (auto& s : shapeAttributes)
150160
if (s.second.targetShape == targetName)

src/program/OutfitProject.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,14 @@ const std::string& OutfitProject::ShapeToTarget(const std::string& shapeName) {
12351235
return shapeName;
12361236
}
12371237

1238+
const std::string& OutfitProject::TargetToShape(const std::string& targetName) {
1239+
for (auto it = activeSet.ShapesBegin(); it != activeSet.ShapesEnd(); ++it)
1240+
if (it->second.targetShape == targetName)
1241+
return it->first;
1242+
1243+
return targetName;
1244+
}
1245+
12381246
size_t OutfitProject::GetActiveBoneCount() {
12391247
return AnimSkeleton::getInstance().GetActiveBoneCount();
12401248
}

src/program/OutfitProject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class OutfitProject {
160160
void ConformShape(nifly::NiShape* shape, const ConformOptions& options = ConformOptions());
161161

162162
const std::string& ShapeToTarget(const std::string& shapeName);
163+
const std::string& TargetToShape(const std::string& targetName);
163164
int GetVertexCount(nifly::NiShape* shape);
164165
void GetLiveVerts(nifly::NiShape* shape, std::vector<nifly::Vector3>& outVerts, std::vector<nifly::Vector2>* outUVs = nullptr);
165166
void GetSliderDiff(nifly::NiShape* shape, const std::string& sliderName, std::vector<nifly::Vector3>& outVerts);

0 commit comments

Comments
 (0)