@@ -26,6 +26,14 @@ PXR_NAMESPACE_OPEN_SCOPE
2626namespace
2727{
2828
29+ // Helper function to sort and uniquie-ify container data source names.
30+ static std::set<TfToken, TfDictionaryLessThan>
31+ Hdui_GetSortedNames (HdContainerDataSourceHandle const & container)
32+ {
33+ const auto names = container->GetNames ();
34+ return std::set<TfToken, TfDictionaryLessThan>(names.begin (), names.end ());
35+ }
36+
2937class Hdui_DataSourceTreeWidgetItem : public QTreeWidgetItem
3038{
3139public:
@@ -128,7 +136,7 @@ class Hdui_DataSourceTreeWidgetItem : public QTreeWidgetItem
128136
129137 // add any new items
130138 for (const TfToken &childName :
131- containerDataSource-> GetNames ( )) {
139+ Hdui_GetSortedNames (containerDataSource )) {
132140 if (usedNames.find (childName) == usedNames.end ()) {
133141
134142 if (HdDataSourceBaseHandle childDs =
@@ -228,7 +236,7 @@ class Hdui_DataSourceTreeWidgetItem : public QTreeWidgetItem
228236 HdContainerDataSource::Cast (_dataSource)) {
229237 TfDenseHashSet<TfToken, TfHash> usedNames;
230238
231- for (const TfToken &childName : container-> GetNames ( )) {
239+ for (const TfToken &childName : Hdui_GetSortedNames (container )) {
232240 if (usedNames.find (childName) != usedNames.end ()) {
233241 continue ;
234242 }
@@ -332,7 +340,7 @@ HduiDataSourceTreeWidget::SetPrimDataSource(const SdfPath &primPath,
332340 HdContainerDataSource::Cast (dataSource)) {
333341 // add all container children as roots
334342 TfDenseHashSet<TfToken, TfHash> usedNames;
335- for (TfToken const & childName: container-> GetNames ( )) {
343+ for (TfToken const & childName: Hdui_GetSortedNames (container )) {
336344 if (usedNames.find (childName) != usedNames.end ()) {
337345 continue ;
338346 }
0 commit comments