Skip to content
Permalink
Browse files

Ensure materials are listed in a nice order

  • Loading branch information
nyalldawson committed Nov 13, 2020
1 parent 2dcbf95 commit c214428433e3648b0fc50fac5edf7d69c4696008
Showing with 10 additions and 1 deletion.
  1. +8 −1 src/3d/materials/qgsmaterialregistry.cpp
  2. +2 −0 src/3d/materials/qgsmaterialregistry.h
@@ -31,6 +31,7 @@ bool QgsMaterialRegistry::addMaterialSettingsType( QgsMaterialSettingsAbstractMe
return false;

mMetadata[metadata->type()] = metadata;
mMaterialsOrder << metadata->type();
return true;
}

@@ -49,5 +50,11 @@ QgsMaterialSettingsAbstractMetadata *QgsMaterialRegistry::materialSettingsMetada

QStringList QgsMaterialRegistry::materialSettingsTypes() const
{
return mMetadata.keys();
QStringList types;
for ( const QString &material : mMaterialsOrder )
{
if ( mMetadata.value( material ) )
types << material;
}
return types;
}
@@ -220,6 +220,8 @@ class _3D_EXPORT QgsMaterialRegistry
#endif

QMap<QString, QgsMaterialSettingsAbstractMetadata *> mMetadata;
//! List of materials, maintained in the order that they have been added
QStringList mMaterialsOrder;
};


0 comments on commit c214428

Please sign in to comment.
You can’t perform that action at this time.