diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-06-26 12:43:13 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-06-28 13:47:01 +0000 |
commit | 4faf224295b1a86081bbb90c323fa6295f8d4e73 (patch) | |
tree | ddb46494629eb6430d7e0eb235355fdf650c9586 /src/dm/systems | |
parent | 90702603c5e525190c94f24c10cb9ff83e7abb19 (diff) |
Fix grouping in "Set datainput controller" menu, runtime part
Properties were grouped according to property type, which was
confusing. Changed the grouping to be by group, which makes more sense,
and results in same ordering of properties as the inspector.
Task-number: QT3DS-3373
Change-Id: I2b0cad93bbfb55efd697322d58d524eb89fed1df
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Diffstat (limited to 'src/dm/systems')
-rw-r--r-- | src/dm/systems/Qt3DSDMDataCore.h | 2 | ||||
-rw-r--r-- | src/dm/systems/StudioPropertySystem.cpp | 20 | ||||
-rw-r--r-- | src/dm/systems/StudioPropertySystem.h | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/dm/systems/Qt3DSDMDataCore.h b/src/dm/systems/Qt3DSDMDataCore.h index 793cddb..0bbdf0c 100644 --- a/src/dm/systems/Qt3DSDMDataCore.h +++ b/src/dm/systems/Qt3DSDMDataCore.h @@ -271,7 +271,7 @@ public: Qt3DSDMPropertyHandle inProperty) const = 0; virtual Qt3DSDMInstanceHandle GetPropertyOwner(Qt3DSDMPropertyHandle inProperty) const = 0; - virtual QVector<Qt3DSDMPropertyHandle> GetControllableProperties( + virtual QVector<QPair<QString, QVector<Qt3DSDMPropertyHandle>>> GetControllableProperties( Qt3DSDMInstanceHandle inInst) const = 0; }; diff --git a/src/dm/systems/StudioPropertySystem.cpp b/src/dm/systems/StudioPropertySystem.cpp index 78fabc6..7346344 100644 --- a/src/dm/systems/StudioPropertySystem.cpp +++ b/src/dm/systems/StudioPropertySystem.cpp @@ -187,24 +187,32 @@ bool CStudioPropertySystem::IsInstanceOrDerivedFrom(Qt3DSDMInstanceHandle inInst return m_DataCore->IsInstanceOrDerivedFrom(inInstance, inParent); } -QVector<Qt3DSDMPropertyHandle> +// Vector of group name and group properties pairs +// Vector used instead of map/hash to preserve the order +QVector<QPair<QString, QVector<Qt3DSDMPropertyHandle>>> CStudioPropertySystem::GetControllableProperties(Qt3DSDMInstanceHandle inInst) const { vector<Qt3DSDMMetaDataPropertyHandle> propList; - QVector<Qt3DSDMPropertyHandle> outList; + QVector<QPair<QString, QVector<Qt3DSDMPropertyHandle>>> outVec; + QHash<QString, int> groupIndexMap; m_MetaData->GetMetaDataProperties(inInst, propList); - for (const auto it : qAsConst(propList)) { + int groupIndex = 0; + for (const auto &it : qAsConst(propList)) { auto metadata = m_MetaData->GetMetaDataPropertyInfo(it).getValue(); - + const QString groupName = QString::fromStdWString(metadata.m_GroupName.wide_str()); if ((metadata.m_Controllable || (metadata.m_Animatable && m_StudioAnimationSystem->IsPropertyAnimatable(inInst, metadata.m_Property))) && !metadata.m_IsHidden) { - outList.append(metadata.m_Property); + if (!groupIndexMap.contains(groupName)) { + groupIndexMap.insert(groupName, groupIndex++); + outVec.append({groupName, {}}); + } + outVec[groupIndexMap[groupName]].second.append(metadata.m_Property); } } - return outList; + return outVec; } Qt3DSDMPropertyHandle CStudioPropertySystem::AddProperty(Qt3DSDMInstanceHandle inInstance, diff --git a/src/dm/systems/StudioPropertySystem.h b/src/dm/systems/StudioPropertySystem.h index 67abcf9..e2fda87 100644 --- a/src/dm/systems/StudioPropertySystem.h +++ b/src/dm/systems/StudioPropertySystem.h @@ -117,7 +117,7 @@ public: bool GetCanonicalInstancePropertyValue(Qt3DSDMInstanceHandle inInstance, Qt3DSDMPropertyHandle inProperty, SValue &outValue) const; - QVector<Qt3DSDMPropertyHandle> GetControllableProperties( + QVector<QPair<QString, QVector<Qt3DSDMPropertyHandle>>> GetControllableProperties( Qt3DSDMInstanceHandle inInst) const override; private: |