-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Undo/Redo gizmo translate/rotate/scale multiple objects
- Loading branch information
Showing
16 changed files
with
248 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
namespace vg::core | ||
{ | ||
class IObject; | ||
class IProperty; | ||
class IDynamicProperty; | ||
|
||
class UndoRedoEntryGroup : public IUndoRedoEntry | ||
{ | ||
public: | ||
UndoRedoEntryGroup(const string & _name); | ||
~UndoRedoEntryGroup(); | ||
|
||
void BeforeChange() override; | ||
void AfterChange() override; | ||
|
||
void Undo() override; | ||
void Redo() override; | ||
|
||
string GetEntryName() const override; | ||
string GetObjectName() const final override; | ||
string GetDescription() const override; | ||
|
||
void AddSubEntry(IUndoRedoEntry * _subEntry) final override; | ||
const vector<IUndoRedoEntry *> * GetSubEntries() const final override; | ||
|
||
private: | ||
string m_name; | ||
core::vector<IUndoRedoEntry *> m_subEntries; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#include "UndoRedoEntryGroup.h" | ||
|
||
namespace vg::core | ||
{ | ||
//-------------------------------------------------------------------------------------- | ||
UndoRedoEntryGroup::UndoRedoEntryGroup(const string & _name) : | ||
m_name(_name) | ||
{ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
UndoRedoEntryGroup::~UndoRedoEntryGroup() | ||
{ | ||
for (auto * entry : m_subEntries) | ||
VG_SAFE_DELETE(entry); | ||
m_subEntries.clear(); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void UndoRedoEntryGroup::BeforeChange() | ||
{ | ||
for (auto * entry : m_subEntries) | ||
entry->BeforeChange(); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void UndoRedoEntryGroup::AfterChange() | ||
{ | ||
for (auto * entry : m_subEntries) | ||
entry->AfterChange(); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void UndoRedoEntryGroup::Undo() | ||
{ | ||
VG_INFO("[Undo/Redo] Begin Undo Group \"%s\" (0x%016X)", GetEntryName().c_str(), this); | ||
|
||
for (auto * entry : m_subEntries) | ||
entry->Undo(); | ||
|
||
VG_INFO("[Undo/Redo] End Undo Group \"%s\" (0x%016X)", GetEntryName().c_str(), this); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void UndoRedoEntryGroup::Redo() | ||
{ | ||
VG_INFO("[Undo/Redo] Begin Redo Group \"%s\" (0x%016X)", GetEntryName().c_str(), this); | ||
|
||
for (auto * entry : m_subEntries) | ||
entry->Redo(); | ||
|
||
VG_INFO("[Undo/Redo] End Redo Group \"%s\" (0x%016X)", GetEntryName().c_str(), this); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
string UndoRedoEntryGroup::GetEntryName() const | ||
{ | ||
return m_name; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
string UndoRedoEntryGroup::GetObjectName() const | ||
{ | ||
return fmt::sprintf("%u Object%s", m_subEntries.size(), m_subEntries.size() > 1 ? "s" : ""); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
string UndoRedoEntryGroup::GetDescription() const | ||
{ | ||
return ""; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void UndoRedoEntryGroup::AddSubEntry(IUndoRedoEntry * _subEntry) | ||
{ | ||
m_subEntries.push_back(_subEntry); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
const vector<IUndoRedoEntry *> * UndoRedoEntryGroup::GetSubEntries() const | ||
{ | ||
return &m_subEntries; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.