diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-04-30 16:22:59 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-05-02 07:08:20 +0000 |
commit | 437593e677cd1ed85ef846a3488dc3212fdde54a (patch) | |
tree | 1ca738966a17bcf441169004889f6352c965a016 | |
parent | 5ae4c87e41dbdeb1e7745756bbe22045127d6977 (diff) |
Fix Ctrl-deselect a single object
Task-number: QT3DS-3372
Change-Id: I572d57fe0cb0589d090c18123e8309bbd2d3344a
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
3 files changed, 24 insertions, 27 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp index b91511e2..f22ed07d 100644 --- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp +++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp @@ -1535,19 +1535,14 @@ bool CClientDataModelBridge::IsMultiSelectable(qt3dsdm::Qt3DSDMInstanceHandle in { if (!m_DataCore->IsInstance(inInstance)) return false; - EStudioObjectType theObjectType = GetObjectType(inInstance); - bool isPotentiallySelectable = theObjectType == OBJTYPE_LIGHT || theObjectType == OBJTYPE_CAMERA - || theObjectType == OBJTYPE_MODEL || theObjectType == OBJTYPE_GROUP - || theObjectType == OBJTYPE_COMPONENT || theObjectType == OBJTYPE_TEXT - || theObjectType == OBJTYPE_ALIAS || theObjectType == OBJTYPE_PATH; + EStudioObjectType objType = GetObjectType(inInstance); - if (!isPotentiallySelectable) + if (objType & OBJTYPE_IS_SINGULAR) return false; - // If we are delving inside component and selecting the component itself (the component is root - // in timeline palette) - if (theObjectType == OBJTYPE_COMPONENT && IsActiveComponent(inInstance)) + // active root components are not multi-selectable + if (objType == OBJTYPE_COMPONENT && IsActiveComponent(inInstance)) return false; return !IsLockedAtAll(inInstance); diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.cpp b/src/Authoring/Client/Code/Core/Doc/Doc.cpp index d8dabd0b..5d8bc44e 100644 --- a/src/Authoring/Client/Code/Core/Doc/Doc.cpp +++ b/src/Authoring/Client/Code/Core/Doc/Doc.cpp @@ -1391,11 +1391,11 @@ void CDoc::ToggleDataModelObjectToSelection(qt3dsdm::Qt3DSDMInstanceHandle inIns theCurrentlySelectedInstance)) theNewHandles.push_back(theCurrentlySelectedInstance); } - } else + } else { theNewHandles = m_SelectedValue.getData<qt3dsdm::TInstanceHandleList>(); + } - qt3dsdm::TInstanceHandleList::iterator iter = - std::find(theNewHandles.begin(), theNewHandles.end(), inInstance); + auto iter = std::find(theNewHandles.begin(), theNewHandles.end(), inInstance); if (iter == theNewHandles.end()) theNewHandles.push_back(inInstance); else diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp index 8ea1ffe5..ad980d36 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp @@ -425,21 +425,23 @@ CInspectableBase *InspectorControlView::createInspectableFromSelectable( CDoc *doc = g_StudioApp.GetCore()->GetDoc(); // Note: Inspector doesn't support multiple selection qt3dsdm::TInstanceHandleList selectedsInstances = selectable.GetSelectedInstances(); - Qt3DSDMInstanceHandle selectedInstance = selectedsInstances[0]; - if (selectedsInstances.size() == 1 - && doc->GetDocumentReader().IsInstance(selectedInstance)) { - CClientDataModelBridge *bridge = doc->GetStudioSystem()->GetClientDataModelBridge(); - qt3dsdm::Qt3DSDMSlideHandle activeSlide = doc->GetActiveSlide(); - - // Scene or Component (when being edited) - if (selectedInstance == bridge->GetOwningComponentInstance(activeSlide)) { - Qt3DSDMInstanceHandle activeSlideInstance = doc->GetStudioSystem() - ->GetSlideSystem()->GetSlideInstance(activeSlide); - inspectableBase = new Qt3DSDMInspectable(selectedInstance, activeSlideInstance); - } else if (bridge->IsMaterialBaseInstance(selectedInstance)) { - inspectableBase = new Qt3DSDMMaterialInspectable(selectedInstance); - } else { - inspectableBase = new Qt3DSDMInspectable(selectedInstance); + if (selectedsInstances.size() == 1) { + Qt3DSDMInstanceHandle selectedInstance = selectedsInstances[0]; + if (doc->GetDocumentReader().IsInstance(selectedInstance)) { + auto *bridge = doc->GetStudioSystem()->GetClientDataModelBridge(); + qt3dsdm::Qt3DSDMSlideHandle activeSlide = doc->GetActiveSlide(); + + // Scene or Component (when being edited) + if (selectedInstance == bridge->GetOwningComponentInstance(activeSlide)) { + Qt3DSDMInstanceHandle activeSlideInstance = doc->GetStudioSystem() + ->GetSlideSystem()->GetSlideInstance(activeSlide); + inspectableBase = new Qt3DSDMInspectable(selectedInstance, + activeSlideInstance); + } else if (bridge->IsMaterialBaseInstance(selectedInstance)) { + inspectableBase = new Qt3DSDMMaterialInspectable(selectedInstance); + } else { + inspectableBase = new Qt3DSDMInspectable(selectedInstance); + } } } } break; |