summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Client/Code/Core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Authoring/Client/Code/Core')
-rw-r--r--src/Authoring/Client/Code/Core/Commands/CmdStack.cpp9
-rw-r--r--src/Authoring/Client/Code/Core/Commands/CmdStack.h4
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.cpp6
3 files changed, 18 insertions, 1 deletions
diff --git a/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp b/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp
index c6aa0882..3530822f 100644
--- a/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp
+++ b/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp
@@ -141,6 +141,7 @@ void CCmdStack::Undo()
return;
}
if (m_UndoList.size() > 0) {
+ m_undoingOrRedoing = true;
CCmd *theLastCommand = m_UndoList.back();
m_UndoList.pop_back();
@@ -162,6 +163,7 @@ void CCmdStack::Undo()
m_Listener->SetCommandModifiedFlag(TRUE);
}
}
+ m_undoingOrRedoing = false;
}
}
@@ -175,6 +177,7 @@ void CCmdStack::Undo()
void CCmdStack::Redo()
{
if (m_RedoList.size() > 0) {
+ m_undoingOrRedoing = true;
CCmd *theLastCommand = m_RedoList.back();
m_RedoList.pop_back();
@@ -191,6 +194,7 @@ void CCmdStack::Redo()
m_Listener->SetCommandModifiedFlag(TRUE);
}
}
+ m_undoingOrRedoing = false;
}
}
@@ -216,6 +220,11 @@ bool CCmdStack::CanRedo()
return m_RedoList.size() > 0;
}
+bool CCmdStack::isUndoingOrRedoing() const
+{
+ return m_undoingOrRedoing;
+}
+
//=============================================================================
/**
* Remove the last command from the undo list
diff --git a/src/Authoring/Client/Code/Core/Commands/CmdStack.h b/src/Authoring/Client/Code/Core/Commands/CmdStack.h
index 4aabd228..7388703d 100644
--- a/src/Authoring/Client/Code/Core/Commands/CmdStack.h
+++ b/src/Authoring/Client/Code/Core/Commands/CmdStack.h
@@ -80,6 +80,8 @@ public:
bool CanUndo();
bool CanRedo();
+ bool isUndoingOrRedoing() const;
+
void RemoveLastUndo();
QString GetUndoDescription();
@@ -105,6 +107,8 @@ protected:
TCmdList m_UndoList;
TCmdList m_RedoList;
+ bool m_undoingOrRedoing = false;
+
unsigned long m_MaxUndoStackSize;
CModificationListener *m_Listener;
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.cpp b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
index b632513d..3457d50a 100644
--- a/src/Authoring/Client/Code/Core/Doc/Doc.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
@@ -1275,7 +1275,11 @@ void CDoc::onPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
qt3dsdm::Qt3DSDMPropertyHandle inProperty)
{
using namespace qt3dsdm;
-
+ // Save the material definition upon undo and redo
+ if (m_Core->GetCmdStack()->isUndoingOrRedoing() &&
+ m_StudioSystem->GetClientDataModelBridge()->isInsideMaterialContainer(inInstance)) {
+ getSceneEditor()->saveIfMaterial(inInstance);
+ }
// check if we changed datainput bindings
if (inProperty == m_StudioSystem->GetPropertySystem()
->GetAggregateInstancePropertyByName(inInstance, L"controlledproperty")) {