Skip to content

Commit

Permalink
Renamed and split undo classes from TweakBrush (#243)
Browse files Browse the repository at this point in the history
I renamed the following classes:
TweakVertexWeight -> UndoStateVertexWeight
TweakBoneWeights -> UndoStateBoneWeights
TweakState -> UndoStateShape
TweakStateHolder -> UndoStateProject
TweakUndo -> UndoHistory

UndoHistory was moved into UndoHistory.h and UndoHistory.cpp.  The rest
were moved into UndoState.h.

I also renamed all of the functions in UndoHistory and most instances
of variables of any of these types.

Keeping track of TweakStroke objects was moved from TweakUndo into
wxGLPanel.  Now there is only ever one TweakStroke object.  I left
the constant re-allocation of this object in place; perhaps it should
just be re-initialized instead of re-allocated.

The state-applying functionality of TweakStateHolder::RestoreStartState,
TweakStateHolder::RestoreEndState, TweakUndo::backStroke,
TweakUndo::forwardStroke, wxGLPanel::UndoStroke, and wxGLPanel::RedoStroke
was consolidated into one function, wxGLPanel::ApplyUndoState.  I tried
not to change what this code does in any way, but the process was fairly
messy, so I could easily have made a mistake.  Hopefully the result is
much simpler and more maintainable.  Plus, it may be convenient to call
ApplyUndoState from other places in the future.

Co-authored-by: ousnius <ousnius@users.noreply.github.com>
  • Loading branch information
sts1skj and ousnius authored Feb 2, 2020
1 parent 301d70a commit e881214
Show file tree
Hide file tree
Showing 10 changed files with 399 additions and 428 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ set(OSsources
${commonsources}
src/components/RefTemplates.cpp
src/components/TweakBrush.cpp
src/components/UndoHistory.cpp
src/files/FBXWrangler.cpp
src/program/EditUV.cpp
src/program/FBXImportDialog.cpp
Expand Down
3 changes: 3 additions & 0 deletions OutfitStudio.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@
<ClInclude Include="src\components\SliderPresets.h" />
<ClInclude Include="src\components\SliderSet.h" />
<ClInclude Include="src\components\TweakBrush.h" />
<ClInclude Include="src\components\UndoState.h" />
<ClInclude Include="src\components\UndoHistory.h" />
<ClInclude Include="src\files\FBXWrangler.h" />
<ClInclude Include="src\files\MaterialFile.h" />
<ClInclude Include="src\files\ObjFile.h" />
Expand Down Expand Up @@ -817,6 +819,7 @@
<ClCompile Include="src\components\SliderPresets.cpp" />
<ClCompile Include="src\components\SliderSet.cpp" />
<ClCompile Include="src\components\TweakBrush.cpp" />
<ClCompile Include="src\components\UndoHistory.cpp" />
<ClCompile Include="src\files\FBXWrangler.cpp" />
<ClCompile Include="src\files\MaterialFile.cpp" />
<ClCompile Include="src\files\ObjFile.cpp" />
Expand Down
9 changes: 9 additions & 0 deletions OutfitStudio.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,12 @@
<ClInclude Include="src\components\TweakBrush.h">
<Filter>Components</Filter>
</ClInclude>
<ClInclude Include="src\components\UndoState.h">
<Filter>Components</Filter>
</ClInclude>
<ClInclude Include="src\components\UndoHistory.h">
<Filter>Components</Filter>
</ClInclude>
<ClInclude Include="src\components\Automorph.h">
<Filter>Components</Filter>
</ClInclude>
Expand Down Expand Up @@ -1827,6 +1833,9 @@
<ClCompile Include="src\components\TweakBrush.cpp">
<Filter>Components</Filter>
</ClCompile>
<ClCompile Include="src\components\UndoHistory.cpp">
<Filter>Components</Filter>
</ClCompile>
<ClCompile Include="src\components\Automorph.cpp">
<Filter>Components</Filter>
</ClCompile>
Expand Down
Loading

0 comments on commit e881214

Please sign in to comment.