summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2019-05-14 11:02:30 +0300
committerJanne Kangas <janne.kangas@qt.io>2019-06-12 13:17:36 +0300
commita5ebc2f9e8b0db7afac2cd97b725c9ca88b54dfd (patch)
tree54298def81da88338b4d74ffa7ecadfe3a4bdf4d
parentf92d2eee30fc2be870b375604321141fbd6059b3 (diff)
Make referenced and animatable material properties able to be unlinked
Allow unlinking for properties other than ones referring to image instances. Unlinking image references is not trivial as slide ownership seems to mix up references, so disallow it for now. Also, fix QML property binding being broken at property link/unlink. Change-Id: I2d975511d19ca3a0330396a886b1151db1d4e090 Task-id: QT3DS-3339 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp10
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp
index e4e0379f..c642d1e8 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp
@@ -289,16 +289,22 @@ QString InspectorControlView::noneString() const
bool InspectorControlView::canLinkProperty(int instance, int handle) const
{
+ if (!instance || !handle)
+ return false;
+
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
if (bridge->isInsideMaterialContainer(instance))
return false;
- if (bridge->IsMaterialBaseInstance(instance)) // all material types are unlinkable
+ if (handle == bridge->GetSceneAsset().m_Eyeball.m_Property) // eyeball is unlinkable
return false;
- if (handle == bridge->GetSceneAsset().m_Eyeball.m_Property) // eyeball is unlinkable
+ // Disallow linking of properties that refer to images as unlinking them is not trivial at all.
+ qt3dsdm::AdditionalMetaDataType::Value thePropertyMetaData =
+ doc->GetStudioSystem()->GetPropertySystem()->GetAdditionalMetaDataType(instance, handle);
+ if (thePropertyMetaData == qt3dsdm::AdditionalMetaDataType::Image)
return false;
return doc->GetDocumentReader().CanPropertyBeLinked(instance, handle);
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml
index c291de7b..9446d5a6 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml
@@ -280,9 +280,6 @@ Rectangle {
coords.x, coords.y,
model.modelData.handle,
model.modelData.instance);
- // Refresh text; title color is wrong after this
- propertyRow.color = _parentView.titleColor(
- modelData.instance, modelData.handle);
}
ColumnLayout { // Property row and datainput control
@@ -372,7 +369,6 @@ Rectangle {
+ ctrldPropButton.width,
ctrldPropButton.y
+ ctrldPropButton.height));
-
}
}