Skip to content

Commit

Permalink
OSD/TRI import settings dialog (#409)
Browse files Browse the repository at this point in the history
Co-authored-by: ousnius <[email protected]>
  • Loading branch information
daz001 and ousnius authored Jan 27, 2022
1 parent fb27bfc commit cd44a79
Show file tree
Hide file tree
Showing 10 changed files with 478 additions and 61 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ set(OSsources
src/program/OutfitStudio.cpp
src/program/ShapeProperties.cpp
src/program/ConvertBodyReferenceDialog.cpp
src/program/SliderDataImportDialog.cpp
)
set(BSsources
${commonsources}
Expand Down
3 changes: 3 additions & 0 deletions OutfitStudio.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@
<ClInclude Include="src\program\OutfitStudio.h" />
<ClInclude Include="src\program\PresetSaveDialog.h" />
<ClInclude Include="src\program\ShapeProperties.h" />
<ClInclude Include="src\program\SliderDataImportDialog.h" />
<ClInclude Include="src\render\GLExtensions.h" />
<ClInclude Include="src\render\GLMaterial.h" />
<ClInclude Include="src\render\GLOffscreenBuffer.h" />
Expand Down Expand Up @@ -830,6 +831,7 @@
<ClCompile Include="src\program\OutfitStudio.cpp" />
<ClCompile Include="src\program\PresetSaveDialog.cpp" />
<ClCompile Include="src\program\ShapeProperties.cpp" />
<ClCompile Include="src\program\SliderDataImportDialog.cpp" />
<ClCompile Include="src\render\GLExtensions.cpp" />
<ClCompile Include="src\render\GLMaterial.cpp" />
<ClCompile Include="src\render\GLOffscreenBuffer.cpp" />
Expand All @@ -846,6 +848,7 @@
</ItemGroup>
<ItemGroup>
<Xml Include="Config.xml" />
<Xml Include="res\xrc\SliderDataImport.xrc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
9 changes: 9 additions & 0 deletions OutfitStudio.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,9 @@
<ClInclude Include="src\utils\ConfigDialogUtil.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="src\program\SliderDataImportDialog.h">
<Filter>Program</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="lib\TinyXML-2\tinyxml2.cpp">
Expand Down Expand Up @@ -1971,10 +1974,16 @@
<ClCompile Include="src\program\ConvertBodyReferenceDialog.cpp">
<Filter>Program</Filter>
</ClCompile>
<ClCompile Include="src\program\SliderDataImportDialog.cpp">
<Filter>Program</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Xml Include="Config.xml">
<Filter>Resources</Filter>
</Xml>
<Xml Include="res\xrc\SliderDataImport.xrc">
<Filter>Resources</Filter>
</Xml>
</ItemGroup>
</Project>
115 changes: 115 additions & 0 deletions res/xrc/SliderDataImport.xrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
<object class="wxDialog" name="dlgSliderDataImport">
<style>wxCAPTION|wxDEFAULT_DIALOG_STYLE</style>
<size>650,500</size>
<title>Slider Data Import Options...</title>
<centered>1</centered>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxStaticText">
<label>Select the shapes that slider data will be imported for:</label>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<minsize>300,80</minsize>
<object class="wxCheckListBox" name="sliderShapesImportList">
<style>wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_EXTENDED|wxLB_SORT</style>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxStaticText">
<label>Select the sliders to be imported</label>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</flag>
<border>5</border>
<minsize>300,200</minsize>
<object class="wxCheckListBox" name="sliderImportList">
<style>wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_EXTENDED|wxLB_SORT</style>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxCheckBox" name="chkImportMergeSliders">
<label>Merge Sliders</label>
<checked>1</checked>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND|wxALL</flag>
<border>10</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="wxMenu" name="sliderDataContext">
<object class="wxMenuItem" name="sliderDataContextNone">
<label>Select None</label>
</object>
<object class="wxMenuItem" name="sliderDataContextAll">
<label>Select All</label>
</object>
<object class="wxMenuItem" name="sliderDataContextInvert">
<label>Invert Selection</label>
</object>
</object>
</resource>
10 changes: 10 additions & 0 deletions src/components/SliderSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ class SliderSet {
return outDataNames;
}

std::string SliderFromDataName(const std::string& targetName, const std::string& dataName) {
for (auto& s : sliders) {
for (auto& df : s.dataFiles) {
if (df.targetName == targetName && df.dataName == dataName)
return s.name;
}
}
return "";
}

std::string TargetToShape(const std::string& targetName) {
for (auto& s : shapeAttributes)
if (s.second.targetShape == targetName)
Expand Down
8 changes: 8 additions & 0 deletions src/program/OutfitProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,14 @@ const std::string& OutfitProject::ShapeToTarget(const std::string& shapeName) {
return shapeName;
}

const std::string& OutfitProject::TargetToShape(const std::string& targetName) {
for (auto it = activeSet.ShapesBegin(); it != activeSet.ShapesEnd(); ++it)
if (it->second.targetShape == targetName)
return it->first;

return targetName;
}

size_t OutfitProject::GetActiveBoneCount() {
return AnimSkeleton::getInstance().GetActiveBoneCount();
}
Expand Down
1 change: 1 addition & 0 deletions src/program/OutfitProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class OutfitProject {
void ConformShape(nifly::NiShape* shape, const ConformOptions& options = ConformOptions());

const std::string& ShapeToTarget(const std::string& shapeName);
const std::string& TargetToShape(const std::string& targetName);
int GetVertexCount(nifly::NiShape* shape);
void GetLiveVerts(nifly::NiShape* shape, std::vector<nifly::Vector3>& outVerts, std::vector<nifly::Vector2>* outUVs = nullptr);
void GetSliderDiff(nifly::NiShape* shape, const std::string& sliderName, std::vector<nifly::Vector3>& outVerts);
Expand Down
Loading

0 comments on commit cd44a79

Please sign in to comment.