summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-03-20 14:23:50 +0200
committerMahmoud Badri <mahmoud.badri@qt.io>2019-03-20 13:20:30 +0000
commita7a0ffa97db530ea572cc38d2ee573f131f48791 (patch)
treebeae84ac9f9d95e0124af757f0e610c1d592388b /src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
parent7887d152278c97a597674231a3ab79d2e8dca394 (diff)
Improve timeline playback/scrubbing performance
Inspector model was being refreshed on every time change. Removed this unnecessary model refresh and corrected an issue so that inspector is updated on every property change. This greatly improved playback performance. Also removed few other unneeded code and some cleanups along the way. Task-number: QT3DS-3184 Change-Id: I77606b52239c8bfbcf235ebfd1189ba45acc2abb Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp')
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp53
1 files changed, 20 insertions, 33 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index 6ba75709..ddcec94c 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -143,10 +143,8 @@ void InspectorControlView::OnNewPresentation()
g_StudioApp.GetCore()->getProjectFile().getProjectPath(),
std::bind(&InspectorControlView::onFilesChanged, this, std::placeholders::_1)));
m_connections.push_back(sp->ConnectInstancePropertyValue(
- std::bind(&InspectorControlView::onInstancePropertyValueChanged, this,
+ std::bind(&InspectorControlView::onPropertyChanged, this, std::placeholders::_1,
std::placeholders::_2)));
- m_connections.push_back(sp->ConnectComponentSeconds(
- std::bind(&InspectorControlView::OnTimeChanged, this)));
m_connections.push_back(assetGraph->ConnectChildAdded(
std::bind(&InspectorControlView::onChildAdded, this, std::placeholders::_2)));
m_connections.push_back(assetGraph->ConnectChildRemoved(
@@ -163,11 +161,6 @@ void InspectorControlView::OnClosingPresentation()
m_connections.clear();
}
-void InspectorControlView::OnTimeChanged()
-{
- m_inspectorControlModel->refresh();
-}
-
void InspectorControlView::onFilesChanged(
const Q3DStudio::TFileModificationList &inFileModificationList)
{
@@ -295,14 +288,14 @@ bool InspectorControlView::canLinkProperty(int instance, int handle) const
{
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
+
if (bridge->isInsideMaterialContainer(instance))
return false;
- EStudioObjectType type = bridge->GetObjectType(instance);
- if (!qt3dsdm::Qt3DSDMPropertyHandle(handle).Valid()
- && (type & (OBJTYPE_CUSTOMMATERIAL | OBJTYPE_MATERIAL | OBJTYPE_REFERENCEDMATERIAL))) {
+
+ if (bridge->IsMaterialBaseInstance(instance)) // all material types are unlinkable
return false;
- }
- if (doc->GetStudioSystem()->GetPropertySystem()->GetName(handle) == L"eyeball")
+
+ if (handle == bridge->GetSceneAsset().m_Eyeball.m_Property) // eyeball is unlinkable
return false;
return doc->GetDocumentReader().CanPropertyBeLinked(instance, handle);
@@ -331,15 +324,17 @@ void InspectorControlView::openInInspector()
doc->SelectDataModelObject(instance);
}
-void InspectorControlView::onInstancePropertyValueChanged(
- qt3dsdm::Qt3DSDMPropertyHandle propertyHandle)
+void InspectorControlView::onPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ qt3dsdm::Qt3DSDMPropertyHandle inProperty)
{
+ m_inspectorControlModel->notifyPropertyChanged(inInstance, inProperty);
+
auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetClientDataModelBridge();
// titleChanged implies icon change too, but that will only occur if inspectable type changes,
// which will invalidate the inspectable anyway, so in reality we are only interested in name
// property here
- if (propertyHandle == bridge->GetNameProperty()
- && m_inspectableBase && m_inspectableBase->IsValid()) {
+ if (inProperty == bridge->GetNameProperty() && m_inspectableBase
+ && m_inspectableBase->IsValid()) {
Q_EMIT titleChanged();
}
}
@@ -435,28 +430,20 @@ void InspectorControlView::showContextMenu(int x, int y, int handle, int instanc
auto doc = g_StudioApp.GetCore()->GetDoc();
if (canOpenInInspector(instance, handle)) {
- auto action = theContextMenu.addAction(QObject::tr("Open in Inspector"));
+ auto action = theContextMenu.addAction(tr("Open in Inspector"));
connect(action, &QAction::triggered, this, &InspectorControlView::openInInspector);
}
- bool canBeLinkedFlag = canLinkProperty(instance, handle);
- if (canBeLinkedFlag) {
- const bool isLinkedFlag = doc->GetDocumentReader().IsPropertyLinked(instance, handle);
-
- if (isLinkedFlag) {
- auto action = theContextMenu.addAction(QObject::tr("Unlink Property from Master Slide"));
- action->setEnabled(canBeLinkedFlag);
- connect(action, &QAction::triggered, this, &InspectorControlView::toggleMasterLink);
- } else {
- auto action = theContextMenu.addAction(QObject::tr("Link Property from Master Slide"));
- action->setEnabled(canBeLinkedFlag);
- connect(action, &QAction::triggered, this, &InspectorControlView::toggleMasterLink);
- }
-
+ if (canLinkProperty(instance, handle)) {
+ bool isLinked = doc->GetDocumentReader().IsPropertyLinked(instance, handle);
+ auto action = theContextMenu.addAction(isLinked ? tr("Unlink Property from Master Slide")
+ : tr("Link Property from Master Slide"));
+ connect(action, &QAction::triggered, this, &InspectorControlView::toggleMasterLink);
} else {
- auto action = theContextMenu.addAction(QObject::tr("Unable to link from Master Slide"));
+ auto action = theContextMenu.addAction(tr("Unable to link from Master Slide"));
action->setEnabled(false);
}
+
theContextMenu.exec(mapToGlobal({x, y}));
m_instance = 0;
m_handle = 0;