diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2018-05-11 10:14:54 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-05-11 08:14:25 +0000 |
commit | d328bfd4f821e0319a71009dbbdb9d3fbe9e92b3 (patch) | |
tree | 2f463e59317d48df157c2c506956b0ca438363cd /src/Authoring | |
parent | da2bdeb80b9613087cddaaae53a7fce31943506e (diff) |
Prevent alias duplicating Layers
Task-number: QT3DS-1604
Change-Id: I5c7b5bd888b25e3e6c2a74a0558561c4c383be10
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring')
5 files changed, 30 insertions, 10 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp index b317e346..2793fd85 100644 --- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp +++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp @@ -1339,14 +1339,33 @@ bool CClientDataModelBridge::IsDuplicateable(qt3dsdm::Qt3DSDMInstanceHandle inIn EStudioObjectType theObjectType = GetObjectType(inInstance); if (theObjectType == OBJTYPE_SCENE || theObjectType == OBJTYPE_MATERIAL - || theObjectType == OBJTYPE_IMAGE) + || theObjectType == OBJTYPE_IMAGE) { return false; - // If we are delving inside component and selecting the component itself (the component is root - // in timeline palette) - else if (theObjectType == OBJTYPE_COMPONENT && IsActiveComponent(inInstance)) + } else if (theObjectType == OBJTYPE_COMPONENT && IsActiveComponent(inInstance)) { + // If we are delving inside component and selecting the component itself (the component is + // root in timeline palette) return false; - else + } else { + return !IsLockedAtAll(inInstance); + } +} + +bool CClientDataModelBridge::isAliasable(qt3dsdm::Qt3DSDMInstanceHandle inInstance) +{ + if (!inInstance.Valid()) + return false; + + EStudioObjectType theObjectType = GetObjectType(inInstance); + if (theObjectType == OBJTYPE_SCENE || theObjectType == OBJTYPE_MATERIAL + || theObjectType == OBJTYPE_IMAGE || theObjectType == OBJTYPE_LAYER) { + return false; + } else if (theObjectType == OBJTYPE_COMPONENT && IsActiveComponent(inInstance)) { + // If we are delving inside component and selecting the component itself (the component is + // root in timeline palette) + return false; + } else { return !IsLockedAtAll(inInstance); + } } bool CClientDataModelBridge::IsMultiSelectable(qt3dsdm::Qt3DSDMInstanceHandle inInstance) diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h index d462a9a8..2f95cd84 100644 --- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h +++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h @@ -367,6 +367,7 @@ public: std::set<Q3DStudio::CString> GetDynamicObjectTextureList() const; bool IsLockedAtAll(qt3dsdm::Qt3DSDMInstanceHandle inInstance); bool IsDuplicateable(qt3dsdm::Qt3DSDMInstanceHandle inInstance); + bool isAliasable(qt3dsdm::Qt3DSDMInstanceHandle inInstance); bool IsMultiSelectable(qt3dsdm::Qt3DSDMInstanceHandle inInstance); bool CanDelete(qt3dsdm::Qt3DSDMInstanceHandle inInstance); bool IsMaster(qt3dsdm::Qt3DSDMInstanceHandle inInstance); diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp index 1de23ac5..ca38666f 100644 --- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp +++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp @@ -2386,7 +2386,7 @@ public: { for (int i = 0; i < inInstances.size(); i++) { qt3dsdm::Qt3DSDMInstanceHandle theSelectedInstance = inInstances.at(i); - if (m_Bridge.IsDuplicateable(theSelectedInstance)) { + if (m_Bridge.isAliasable(theSelectedInstance)) { CPt thePoint(0, 0); Qt3DSDMInstanceHandle addedInstance = CreateSceneGraphInstance( ComposerObjectTypes::Alias, theSelectedInstance, theSlide, diff --git a/src/Authoring/Studio/Application/StudioApp.cpp b/src/Authoring/Studio/Application/StudioApp.cpp index a08632dd..c3352606 100644 --- a/src/Authoring/Studio/Application/StudioApp.cpp +++ b/src/Authoring/Studio/Application/StudioApp.cpp @@ -1039,7 +1039,7 @@ void CStudioApp::DeleteSelectedObject() //============================================================================= /** - * Handles the duplicate object command + * Handles the alias duplicate object command */ void CStudioApp::HandleDuplicateCommand() { @@ -1048,7 +1048,7 @@ void CStudioApp::HandleDuplicateCommand() //============================================================================= /** - * return true if the selected object is duplicatable + * return true if the selected object is alias-duplicatable */ bool CStudioApp::CanDuplicateObject() { @@ -1058,7 +1058,7 @@ bool CStudioApp::CanDuplicateObject() return false; // Check if the object can be duplicated - return m_core->GetDoc()->GetStudioSystem()->GetClientDataModelBridge()->IsDuplicateable( + return m_core->GetDoc()->GetStudioSystem()->GetClientDataModelBridge()->isAliasable( theSelectedInstance); } diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp index 76d501ed..dd2989fa 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp @@ -569,7 +569,7 @@ bool Qt3DSDMTimelineItemBinding::IsValidTransaction(EUserTransaction inTransacti case EUserTransaction_Duplicate: if (theInstance.Valid()) - return m_StudioSystem->GetClientDataModelBridge()->IsDuplicateable(theInstance); + return m_StudioSystem->GetClientDataModelBridge()->isAliasable(theInstance); break; case EUserTransaction_Cut: |