summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.cpp14
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.h3
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp32
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp12
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IComposerSerializer.h6
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h6
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDocumentReader.h7
7 files changed, 51 insertions, 29 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.cpp b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
index e0b6af8c..7a16aa25 100644
--- a/src/Authoring/Client/Code/Core/Doc/Doc.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
@@ -806,12 +806,13 @@ void CDoc::CutObject(qt3dsdm::TInstanceHandleList inInstances)
using namespace Q3DStudio;
if (theContinueCutFlag) {
- CFilePath thePath(GetDocumentReader().CopySceneGraphObjects(inInstances));
+ CFilePath thePath(GetDocumentReader().CopySceneGraphObjects(inInstances, true));
Qt3DSFile theFile(thePath);
CStudioClipboard::CopyObjectToClipboard(
theFile, false, false,
m_StudioSystem->GetClientDataModelBridge()->GetObjectType(inInstances[0]));
SCOPED_DOCUMENT_EDITOR(*this, QObject::tr("Cut Object"))->DeleteInstances(inInstances);
+ m_firstPasteAfterCut = true;
}
}
@@ -822,11 +823,12 @@ void CDoc::CopyObject(qt3dsdm::TInstanceHandleList inInstances)
if (inInstances.empty())
return;
using namespace Q3DStudio;
- CFilePath thePath(GetDocumentReader().CopySceneGraphObjects(inInstances));
+ CFilePath thePath(GetDocumentReader().CopySceneGraphObjects(inInstances, false));
Qt3DSFile theFile(thePath);
CStudioClipboard::CopyObjectToClipboard(
theFile, false, false,
m_StudioSystem->GetClientDataModelBridge()->GetObjectType(inInstances[0]));
+ m_firstPasteAfterCut = false;
}
void CDoc::PasteObject(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
@@ -838,7 +840,9 @@ void CDoc::PasteObject(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
Qt3DSFile theTempAPFile = CStudioClipboard::GetObjectFromClipboard(false, dummy);
SCOPED_DOCUMENT_EDITOR(*this, QObject::tr("Paste Object"))
->PasteSceneGraphObject(theTempAPFile.GetAbsolutePath(), theInstance, true,
- DocumentEditorInsertType::LastChild, CPt());
+ DocumentEditorInsertType::LastChild, CPt(),
+ m_firstPasteAfterCut);
+ m_firstPasteAfterCut = false;
}
}
@@ -851,7 +855,9 @@ void CDoc::PasteObjectMaster(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
Qt3DSFile theTempAPFile = CStudioClipboard::GetObjectFromClipboard(false, dummy);
SCOPED_DOCUMENT_EDITOR(*this, QObject::tr("Paste Object"))
->PasteSceneGraphObjectMaster(theTempAPFile.GetAbsolutePath(), theInstance, true,
- DocumentEditorInsertType::LastChild, CPt());
+ DocumentEditorInsertType::LastChild, CPt(),
+ m_firstPasteAfterCut);
+ m_firstPasteAfterCut = false;
}
}
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.h b/src/Authoring/Client/Code/Core/Doc/Doc.h
index af91c59e..5fedd509 100644
--- a/src/Authoring/Client/Code/Core/Doc/Doc.h
+++ b/src/Authoring/Client/Code/Core/Doc/Doc.h
@@ -505,6 +505,9 @@ protected:
Q3DStudio::CRect m_ClientSize;
Q3DStudio::CRect m_SceneRect; // The dimensions of the active scene view
+ // Indicate that the paste operation is first after cut operation
+ bool m_firstPasteAfterCut = false;
+
private:
bool m_playbackPreviewOn = false;
QString m_presentationId;
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
index f1139d7d..1e60a6be 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
@@ -699,7 +699,7 @@ public:
}
pair<std::shared_ptr<qt3dsdm::IDOMWriter>, CFilePath>
- DoCopySceneGraphObject(const TInstanceHandleList &inInstances)
+ DoCopySceneGraphObject(const TInstanceHandleList &inInstances, bool preserveFileIds)
{
if (inInstances.empty())
return pair<std::shared_ptr<qt3dsdm::IDOMWriter>, CFilePath>();
@@ -707,7 +707,8 @@ public:
std::shared_ptr<IDOMWriter> theWriter(m_Doc.CreateDOMWriter());
TInstanceHandleList theInstances = ToGraphOrdering(inInstances);
m_Doc.CreateSerializer()->SerializeSceneGraphObjects(*theWriter, theInstances,
- GetActiveSlide(inInstances[0]));
+ GetActiveSlide(inInstances[0]),
+ preserveFileIds);
CFilePath theFile = WriteWriterToFile(*theWriter, L"SceneGraph");
return make_pair(theWriter, theFile);
}
@@ -716,7 +717,7 @@ public:
std::shared_ptr<qt3dsdm::IDOMReader>
CopySceneGraphObjectsToMemory(const qt3dsdm::TInstanceHandleList &instanceList)
{
- return DoCopySceneGraphObject(instanceList).first->CreateDOMReader();
+ return DoCopySceneGraphObject(instanceList, false).first->CreateDOMReader();
}
// Exposed through document reader interface
@@ -762,7 +763,7 @@ public:
return theFinalPath;
}
- CFilePath CopySceneGraphObjects(TInstanceHandleList inInstances) override
+ CFilePath CopySceneGraphObjects(TInstanceHandleList inInstances, bool preserveFileIds) override
{
if (inInstances.empty())
return L"";
@@ -773,7 +774,7 @@ public:
if (!shouldCopy)
return L"";
- return DoCopySceneGraphObject(inInstances).second;
+ return DoCopySceneGraphObject(inInstances, preserveFileIds).second;
}
CFilePath CopyAction(Qt3DSDMActionHandle inAction, Qt3DSDMSlideHandle inSlide) override
@@ -3044,11 +3045,13 @@ public:
bool inGenerateUniqueName,
DocumentEditorInsertType::Enum inInsertType,
const CPt &inPosition,
+ bool preserveFileIds,
bool notifyRename = true)
{
std::shared_ptr<IComposerSerializer> theSerializer = m_Doc.CreateSerializer();
TInstanceHandleList retval = theSerializer->SerializeSceneGraphObject(
- *inReader, m_Doc.GetDocumentDirectory(), inNewRoot, GetActiveSlide(inNewRoot));
+ *inReader, m_Doc.GetDocumentDirectory(), inNewRoot, GetActiveSlide(inNewRoot),
+ preserveFileIds);
for (size_t idx = 0, end = retval.size(); idx < end; ++idx) {
qt3dsdm::Qt3DSDMInstanceHandle theInstance(retval[idx]);
if (inInsertType == DocumentEditorInsertType::NextSibling)
@@ -3067,7 +3070,8 @@ public:
TInstanceHandle inNewRoot,
bool inGenerateUniqueName,
DocumentEditorInsertType::Enum inInsertType,
- const CPt &inPosition) override
+ const CPt &inPosition,
+ bool preserveFileIds) override
{
qt3ds::QT3DSI32 theVersion = 0;
std::shared_ptr<IDOMReader> theReader = m_Doc.CreateDOMReader(
@@ -3075,13 +3079,14 @@ public:
if (!theReader)
return TInstanceHandleList();
return DoPasteSceneGraphObject(theReader, inNewRoot, inGenerateUniqueName, inInsertType,
- inPosition, false);
+ inPosition, preserveFileIds, false);
}
virtual TInstanceHandleList
PasteSceneGraphObjectMaster(const CFilePath &inFilePath, TInstanceHandle inNewRoot,
bool inGenerateUniqueName,
- DocumentEditorInsertType::Enum inInsertType, const CPt &inPosition) override
+ DocumentEditorInsertType::Enum inInsertType, const CPt &inPosition,
+ bool preserveFileIds) override
{
qt3ds::QT3DSI32 theVersion = 0;
std::shared_ptr<IDOMReader> theReader = m_Doc.CreateDOMReader(
@@ -3092,7 +3097,8 @@ public:
std::shared_ptr<IComposerSerializer> theSerializer = m_Doc.CreateSerializer();
TInstanceHandleList retval = theSerializer->SerializeSceneGraphObject(
*theReader, m_Doc.GetDocumentDirectory(), inNewRoot,
- m_Doc.GetStudioSystem()->GetSlideSystem()->GetMasterSlide(GetActiveSlide(inNewRoot)));
+ m_Doc.GetStudioSystem()->GetSlideSystem()->GetMasterSlide(GetActiveSlide(inNewRoot)),
+ preserveFileIds);
for (size_t idx = 0, end = retval.size(); idx < end; ++idx) {
qt3dsdm::Qt3DSDMInstanceHandle theInstance(retval[idx]);
if (inInsertType == DocumentEditorInsertType::NextSibling)
@@ -3297,7 +3303,7 @@ public:
// Paste into the master slide of the new component
TInstanceHandleList insertedHandles = theSerializer->SerializeSceneGraphObject(
*theReader,m_Doc.GetDocumentDirectory(), component,
- m_SlideSystem.GetMasterSlide(theComponentSlide));
+ m_SlideSystem.GetMasterSlide(theComponentSlide), true);
// Restore the original time range for all objects.
if (insertedHandles.size()) {
@@ -3380,7 +3386,7 @@ public:
theSerializer->SerializeSceneGraphObject(
*theReader, m_Doc.GetDocumentDirectory(),
targetComponent,
- m_SlideSystem.GetMasterSlide(theComponentSlide));
+ m_SlideSystem.GetMasterSlide(theComponentSlide), true);
if (insertedHandles.size()) {
// Restore the original time range for all objects.
@@ -3425,7 +3431,7 @@ public:
{
qt3dsdm::TInstanceHandleList theInstances(ToGraphOrdering(inInstances));
std::shared_ptr<IDOMReader> theReader(CopySceneGraphObjectsToMemory(theInstances));
- return DoPasteSceneGraphObject(theReader, inDest, true, inInsertType, CPt(), false);
+ return DoPasteSceneGraphObject(theReader, inDest, true, inInsertType, CPt(), false, false);
}
Qt3DSDMActionHandle AddAction(Qt3DSDMSlideHandle inSlide, Qt3DSDMInstanceHandle inOwner,
diff --git a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp
index c62d3fa1..3953f20d 100644
--- a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp
@@ -2870,26 +2870,28 @@ struct SComposerSerializerImpl : public IComposerSerializer
// new root.
virtual qt3dsdm::TInstanceHandleList
SerializeSceneGraphObject(IDOMReader &inReader, const CFilePath &inDocumentDirectory,
- Qt3DSDMInstanceHandle inNewRoot, Qt3DSDMSlideHandle inActiveSlide) override
+ Qt3DSDMInstanceHandle inNewRoot, Qt3DSDMSlideHandle inActiveSlide,
+ bool preserveFileIds) override
{
reset();
m_ActiveSlide = inActiveSlide;
- m_PreserveFileIds = false;
+ m_PreserveFileIds = preserveFileIds;
return DoSerializeScene(inReader, inDocumentDirectory, inNewRoot);
}
// Write this instance and its children (and possibly its slides) to a writer.
// Equivalent to the older partial serialization system
void SerializeSceneGraphObjects(IDOMWriter &inWriter,
- const TInstanceHandleList &inInstances,
- Qt3DSDMSlideHandle inActiveSlide) override
+ const TInstanceHandleList &inInstances,
+ Qt3DSDMSlideHandle inActiveSlide,
+ bool preserveFileIds) override
{
if (inInstances.empty())
return;
reset();
QT3DS_ASSERT(inActiveSlide.Valid());
m_ActiveSlide = inActiveSlide;
- m_PreserveFileIds = false;
+ m_PreserveFileIds = preserveFileIds;
// It is fine if the parent is invalid
m_ActiveSlideParent = m_SlideCore.GetParentSlide(m_ActiveSlide);
DoSerializeScene(inWriter, inInstances.data(), (QT3DSU32)inInstances.size());
diff --git a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.h b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.h
index e2882cb8..8f8fbb1d 100644
--- a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.h
+++ b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.h
@@ -77,13 +77,15 @@ public:
// Equivalent to the older partial serialization system
virtual void SerializeSceneGraphObjects(qt3dsdm::IDOMWriter &inWriter,
const qt3dsdm::TInstanceHandleList &inInstances,
- qt3dsdm::Qt3DSDMSlideHandle inActiveSlide) = 0;
+ qt3dsdm::Qt3DSDMSlideHandle inActiveSlide,
+ bool preserveFileIds) = 0;
// Read a partial serialization into this slide, attaching the instance as the last child of the
// new root.
virtual qt3dsdm::TInstanceHandleList SerializeSceneGraphObject(
qt3dsdm::IDOMReader &inReader, const Q3DStudio::CFilePath &inDocumentDirectory,
- qt3dsdm::Qt3DSDMInstanceHandle inNewRoot, qt3dsdm::Qt3DSDMSlideHandle inActiveSlide) = 0;
+ qt3dsdm::Qt3DSDMInstanceHandle inNewRoot, qt3dsdm::Qt3DSDMSlideHandle inActiveSlide,
+ bool preserveFileIds) = 0;
// Save and load just a single action
virtual void SerializeAction(qt3dsdm::IDOMWriter &inWriter, qt3dsdm::Qt3DSDMSlideHandle inSlide,
diff --git a/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h b/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
index da11238e..14fcd5fb 100644
--- a/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
+++ b/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
@@ -322,11 +322,13 @@ public:
virtual qt3dsdm::TInstanceHandleList
PasteSceneGraphObject(const CFilePath &inFilePath, Qt3DSDMInstanceHandle inNewRoot,
bool inGenerateUniqueName, DocumentEditorInsertType::Enum inInsertType,
- const CPt &inPosition) = 0;
+ const CPt &inPosition,
+ bool preserveFileIds) = 0;
virtual qt3dsdm::TInstanceHandleList PasteSceneGraphObjectMaster(
const CFilePath &inFilePath, Qt3DSDMInstanceHandle inNewRoot, bool inGenerateUniqueName,
- DocumentEditorInsertType::Enum inInsertType, const CPt &inPosition) = 0;
+ DocumentEditorInsertType::Enum inInsertType, const CPt &inPosition,
+ bool preserveFileIds) = 0;
virtual void RearrangeObjects(const qt3dsdm::TInstanceHandleList &inInstances,
TInstanceHandle inDest,
diff --git a/src/Authoring/Client/Code/Core/Doc/IDocumentReader.h b/src/Authoring/Client/Code/Core/Doc/IDocumentReader.h
index c455e802..aec35f50 100644
--- a/src/Authoring/Client/Code/Core/Doc/IDocumentReader.h
+++ b/src/Authoring/Client/Code/Core/Doc/IDocumentReader.h
@@ -215,13 +215,14 @@ public:
// Given the active slide on the document (which we query) and an instance,
// produce a temporary file (Qt3DSFile::GetTemporaryFile) and serialize this object
// to that temporary file.
- virtual CFilePath CopySceneGraphObjects(qt3dsdm::TInstanceHandleList inInstances) = 0;
+ virtual CFilePath CopySceneGraphObjects(qt3dsdm::TInstanceHandleList inInstances,
+ bool preserveFileIds) = 0;
- CFilePath CopySceneGraphObject(Qt3DSDMInstanceHandle inInstance)
+ CFilePath CopySceneGraphObject(Qt3DSDMInstanceHandle inInstance, bool preserveFileIds)
{
qt3dsdm::TInstanceHandleList theInstances;
theInstances.push_back(inInstance);
- return CopySceneGraphObjects(theInstances);
+ return CopySceneGraphObjects(theInstances, preserveFileIds);
}
// Copy the object just to a DOM representation, don't serialize to file.