summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/Inspector
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2018-11-28 16:50:08 +0200
committerJere Tuliniemi <jere.tuliniemi@qt.io>2018-11-30 10:34:24 +0000
commit1f226b9786aac4e1210b81ac1e67aed9cad9d948 (patch)
treea508661e5646d790b534b43b517900441795ab3f /src/Authoring/Studio/Palettes/Inspector
parent580f0715ee1c292bf3c5104905187ecf11c82659 (diff)
Fix issues with material renaming
Disable basic material renaming by removing the name property from the inspector, disabling rename from the timeline context menu and disabling double clicking of the basic material in the timeline. Refresh the inspector after rename to fix reverting to previous value. Force a reference update after a rename by emitting assetNameChanged. Task-number: QT3DS-2774 Change-Id: I4c1658ee8a4f206db90c46878e75cc0bb690956b Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector')
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index ea6786c7..cfaa17a8 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -835,15 +835,20 @@ InspectorControlBase* InspectorControlModel::createItem(Qt3DSDMInspectable *insp
if (metaProperty.m_IsHidden)
return nullptr;
+ Q3DStudio::CString title;
+ title.Assign(metaProperty.m_FormalName.c_str());
+ if (title.IsEmpty())
+ title.Assign(metaProperty.m_Name.c_str());
+
+ // Hide name for basic materials
+ if (title == "Name" && isBasicMaterial())
+ return nullptr;
+
InspectorControlBase *item = new InspectorControlBase;
item->m_property = metaProperty.m_Property;
item->m_instance = inspectable->GetGroupInstance(groupIndex);
item->m_metaProperty = metaProperty;
- Q3DStudio::CString title;
- title.Assign(metaProperty.m_FormalName.c_str());
- if (title.IsEmpty())
- title.Assign(metaProperty.m_Name.c_str());
item->m_title = title.toQString();
const auto propertySystem = studio->GetPropertySystem();
@@ -1788,7 +1793,7 @@ void InspectorControlModel::setPropertyValue(long instance, int handle, const QV
QVector<qt3dsdm::Qt3DSDMInstanceHandle> refMats;
doc->getSceneReferencedMaterials(doc->GetSceneInstance(), refMats);
- for (auto &refMat : refMats) {
+ for (auto &refMat : qAsConst(refMats)) {
const auto origMat = bridge->getMaterialReference(refMat);
if (origMat.Valid() && (long)origMat == instance) {
sceneEditor->setMaterialSourcePath(
@@ -1811,7 +1816,7 @@ void InspectorControlModel::setPropertyValue(long instance, int handle, const QV
bridge->GetNameProperty());
g_StudioApp.GetCore()->getProjectFile().renameMaterial(
properName.toQString(), newName.toQString());
- refreshTree();
+ refresh();
doc->SetModifiedFlag();
}
break;