summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2018-03-13 15:04:40 +0200
committerJanne Kangas <janne.kangas@qt.io>2018-03-19 07:57:19 +0000
commit2b3819c8e3cde79f5b31b042bcd1fc69e84527a2 (patch)
tree1561ece7c728f0c633ff1c2dd91736ffe75ff8c2 /src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
parent7044430bcfa7ceb161f9f3a15a396a401f9ea2e6 (diff)
Allow Action trigger/target selection outside component
Enables choosing trigger/target objects for Actions from the entire scene graph for the active slide. Also recreate Alias reference selection list when user enters/leaves a component. Change-Id: I3b66bf6a93296b5fef6168f1de8341bdd1284b11 Task-id: QT3DS-1278 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp')
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index 2f3e8f3b..aa6facc7 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -435,9 +435,14 @@ QObject *InspectorControlView::showTextureChooser(int handle, int instance, cons
QObject *InspectorControlView::showObjectReference(int handle, int instance, const QPoint &point)
{
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- if (!m_objectReferenceModel) {
- m_objectReferenceModel
- = new ObjectListModel(g_StudioApp.GetCore(), doc->GetActiveRootInstance(), this);
+ // different base handle than current active root instance means that we have entered/exited
+ // component after the reference model had been created, and we need to recreate it
+ if (!m_objectReferenceModel
+ || (m_objectReferenceModel->baseHandle() != doc->GetActiveRootInstance())) {
+ if (m_objectReferenceModel)
+ delete m_objectReferenceModel;
+ m_objectReferenceModel = new ObjectListModel(g_StudioApp.GetCore(),
+ doc->GetActiveRootInstance(), this, true);
}
if (!m_objectReferenceView)
m_objectReferenceView = new ObjectBrowserView(this);
@@ -469,7 +474,7 @@ QObject *InspectorControlView::showObjectReference(int handle, int instance, con
this, [this, doc, handle, instance] {
auto selectedItem = m_objectReferenceView->selectedHandle();
qt3dsdm::SObjectRefType objRef = doc->GetDataModelObjectReferenceHelper()->GetAssetRefValue(
- selectedItem, handle,
+ selectedItem, instance,
(CRelativePathTools::EPathType)(m_objectReferenceView->pathType()));
Q3DStudio::SCOPED_DOCUMENT_EDITOR(*doc, QObject::tr("Set Property"))
->SetInstancePropertyValue(instance, handle, objRef);