summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaj Grönholm <kaj.gronholm@qt.io>2018-05-29 13:42:23 +0300
committerKaj Grönholm <kaj.gronholm@qt.io>2018-05-29 10:52:06 +0000
commit8175869f2787e2059a1e61cc8c8fedf313d41274 (patch)
tree4945d2c33d5651dc32014f766a59cc32baf11c29
parent2220d525ba1a07d6c1d4e6b5f6c7f363be9c21c7 (diff)
Make hide/unhide to work with multiselection
Task-number: QT3DS-1818 Change-Id: I6416f9d4214a67623e60627f115dc4030901bf51 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/Application/StudioApp.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/Authoring/Studio/Application/StudioApp.cpp b/src/Authoring/Studio/Application/StudioApp.cpp
index cff12964..fcaf66fa 100644
--- a/src/Authoring/Studio/Application/StudioApp.cpp
+++ b/src/Authoring/Studio/Application/StudioApp.cpp
@@ -1794,16 +1794,31 @@ void CStudioApp::OnUndefinedDatainputsFail(
void CStudioApp::toggleEyeball()
{
CDoc *theDoc = m_core->GetDoc();
- qt3dsdm::Qt3DSDMInstanceHandle handle = theDoc->GetSelectedInstance();
- if (handle.Valid()) {
- qt3dsdm::Qt3DSDMPropertyHandle property
- = theDoc->GetStudioSystem()->GetClientDataModelBridge()->GetSceneAsset().m_Eyeball;
+ qt3dsdm::IPropertySystem *propertySystem = theDoc->GetStudioSystem()->GetPropertySystem();
+ qt3dsdm::TInstanceHandleList selectedInstances
+ = theDoc->GetSelectedValue().GetSelectedInstances();
+
+ if (selectedInstances.size() > 0) {
+ Q3DStudio::ScopedDocumentEditor editor(*theDoc,
+ L"Visibility Toggle",
+ __FILE__, __LINE__);
+ bool boolValue = false;
SValue value;
- theDoc->GetStudioSystem()->GetPropertySystem()->GetInstancePropertyValue(handle, property,
- value);
- bool boolValue = !qt3dsdm::get<bool>(value);
- Q3DStudio::SCOPED_DOCUMENT_EDITOR(*theDoc, QObject::tr("Visibility Toggle"))
- ->SetInstancePropertyValue(handle, property, boolValue);
+ for (size_t idx = 0, end = selectedInstances.size(); idx < end; ++idx) {
+ qt3dsdm::Qt3DSDMInstanceHandle handle(selectedInstances[idx]);
+
+ if (handle.Valid()) {
+ qt3dsdm::Qt3DSDMPropertyHandle property
+ = theDoc->GetStudioSystem()->GetClientDataModelBridge()
+ ->GetSceneAsset().m_Eyeball;
+ if (value.empty()) {
+ // First valid handle selects if all are hidden/unhidden
+ propertySystem->GetInstancePropertyValue(handle, property, value);
+ boolValue = !qt3dsdm::get<bool>(value);
+ }
+ editor->SetInstancePropertyValue(handle, property, boolValue);
+ }
+ }
}
}