@@ -102,8 +102,8 @@ namespace ROS2
102
102
const AZStd::optional<AZ::Crc32>& crc32,
103
103
const AZStd::optional<AZStd::string>& resolvedSdfPath)
104
104
{
105
- int i = m_table->rowCount ();
106
- m_table->setRowCount (i + 1 );
105
+ int rowId = m_table->rowCount ();
106
+ m_table->setRowCount (rowId + 1 );
107
107
108
108
// The Asset ID GUID must not be null(all zeros) and the asset source path must not be empty
109
109
bool isOk = (assetSourcePath.has_value () && !assetSourcePath->empty () && assetSourcePath != " not found" )
@@ -123,45 +123,43 @@ namespace ROS2
123
123
{
124
124
p->setToolTip (tr (" CRC for file : " ) + QString::fromUtf8 (crcStr.data (), crcStr.size ()));
125
125
}
126
- m_table->setItem (i , Columns::SdfMeshPath, p);
126
+ m_table->setItem (rowId , Columns::SdfMeshPath, p);
127
127
128
128
if (resolvedSdfPath)
129
129
{
130
130
m_table->setItem (
131
- i , Columns::ResolvedMeshPath, createCell (true , QString::fromUtf8 (resolvedSdfPath->data (), resolvedSdfPath->size ())));
131
+ rowId , Columns::ResolvedMeshPath, createCell (true , QString::fromUtf8 (resolvedSdfPath->data (), resolvedSdfPath->size ())));
132
132
}
133
133
else
134
134
{
135
- m_table->setItem (i , Columns::ResolvedMeshPath, createCell (false , tr (" Not found" )));
135
+ m_table->setItem (rowId , Columns::ResolvedMeshPath, createCell (false , tr (" Not found" )));
136
136
}
137
137
138
- m_table->setItem (i , Columns::Type, createCell (isOk, type));
138
+ m_table->setItem (rowId , Columns::Type, createCell (isOk, type));
139
139
140
140
if (assetSourcePath && !assetSourcePath->empty ())
141
141
{
142
142
m_table->setItem (
143
- i, Columns::SourceAsset, createCell (true , QString::fromUtf8 (assetSourcePath->data (), assetSourcePath->size ())));
143
+ rowId, Columns::SourceAsset, createCell (true , QString::fromUtf8 (assetSourcePath->data (), assetSourcePath->size ())));
144
+ m_assetsPaths[assetUuid] = *assetSourcePath;
144
145
}
145
146
else
146
147
{
147
- m_table->setItem (i , Columns::SourceAsset, createCell (false , tr (" Not found" )));
148
+ m_table->setItem (rowId , Columns::SourceAsset, createCell (false , tr (" Not found" )));
148
149
}
149
150
150
151
if (isOk)
151
152
{
152
- m_table->item (i , Columns::ResolvedMeshPath)->setIcon (m_okIcon);
153
+ m_table->item (rowId , Columns::ResolvedMeshPath)->setIcon (m_okIcon);
153
154
}
154
155
else
155
156
{
156
- m_table->item (i , Columns::ResolvedMeshPath)->setIcon (m_failureIcon);
157
- m_table->setItem (i , Columns::ProductAsset, createCell (false , QString ()));
157
+ m_table->item (rowId , Columns::ResolvedMeshPath)->setIcon (m_failureIcon);
158
+ m_table->setItem (rowId , Columns::ProductAsset, createCell (false , QString ()));
158
159
}
159
-
160
- // Don't add an empty asset path to the list of resolved assets
161
160
if (isOk)
162
161
{
163
- m_assetsPaths.push_back (AZStd::move (*assetSourcePath));
164
- m_assetsUuids.push_back (assetUuid);
162
+ m_assetsUuidsToColumnIndex[assetUuid] = rowId;
165
163
}
166
164
}
167
165
@@ -184,7 +182,7 @@ namespace ROS2
184
182
185
183
void CheckAssetPage::ClearAssetsList ()
186
184
{
187
- m_assetsUuids .clear ();
185
+ m_assetsUuidsToColumnIndex .clear ();
188
186
m_assetsUuidsFinished.clear ();
189
187
m_assetsPaths.clear ();
190
188
m_table->setRowCount (0 );
@@ -195,27 +193,30 @@ namespace ROS2
195
193
196
194
bool CheckAssetPage::IsEmpty () const
197
195
{
198
- return m_assetsUuids .empty ();
196
+ return m_assetsUuidsToColumnIndex .empty ();
199
197
}
200
198
201
199
void CheckAssetPage::DoubleClickRow (int row, [[maybe_unused]] int col)
202
200
{
203
- AZ_Printf (" CheckAssetPage" , " Clicked on row" , row);
204
- if (row < m_assetsPaths.size ())
201
+ for (const auto & [assetUuid, columnId] : m_assetsUuidsToColumnIndex)
205
202
{
206
- AzFramework::AssetSystemRequestBus::Broadcast (
207
- &AzFramework::AssetSystem::AssetSystemRequests::ShowInAssetProcessor, m_assetsPaths[row]);
203
+ if (columnId == row && m_assetsPaths.contains (assetUuid))
204
+ {
205
+ AzFramework::AssetSystemRequestBus::Broadcast (
206
+ &AzFramework::AssetSystem::AssetSystemRequests::ShowInAssetProcessor, m_assetsPaths[assetUuid]);
207
+ }
208
+
208
209
}
209
210
}
210
211
211
212
void CheckAssetPage::RefreshTimerElapsed ()
212
213
{
213
- for (int i = 0 ; i < m_assetsUuids. size (); i++ )
214
+ for (const auto & [assetUuid, rowId] : m_assetsUuidsToColumnIndex )
214
215
{
215
- const AZ::Uuid& assetUuid = m_assetsUuids[i];
216
- const AZStd::string& sourceAssetFullPath = m_assetsPaths[i];
217
- if (!m_assetsUuidsFinished.contains (assetUuid))
216
+ if (m_assetsPaths.contains (assetUuid) && !m_assetsUuidsFinished.contains (assetUuid))
218
217
{
218
+ // Execute for all found source assets that are not finished yet.
219
+ const AZStd::string& sourceAssetFullPath = m_assetsPaths[assetUuid];
219
220
using namespace AzToolsFramework ;
220
221
using namespace AzToolsFramework ::AssetSystem;
221
222
@@ -225,7 +226,7 @@ namespace ROS2
225
226
if (result)
226
227
{
227
228
bool allFinished = true ;
228
- bool failed = false ;
229
+ bool productAssetFailed = false ;
229
230
JobInfoContainer& allJobs = result.GetValue ();
230
231
for (const JobInfo& job : allJobs)
231
232
{
@@ -235,34 +236,35 @@ namespace ROS2
235
236
}
236
237
if (job.m_status == JobStatus::Failed)
237
238
{
238
- failed = true ;
239
- m_failedCount++;
239
+ productAssetFailed = true ;
240
240
}
241
241
}
242
242
if (allFinished)
243
243
{
244
- if (!failed )
244
+ if (!productAssetFailed )
245
245
{
246
246
const AZStd::vector<AZStd::string> productPaths = Utils::GetProductAssets (assetUuid);
247
247
QString text;
248
248
for (const auto & productPath : productPaths)
249
249
{
250
250
text += QString::fromUtf8 (productPath.data (), productPath.size ()) + " " ;
251
251
}
252
- m_table->setItem (i , Columns::ProductAsset, createCell (true , text));
253
- m_table->item (i , Columns::ProductAsset)->setIcon (m_okIcon);
252
+ m_table->setItem (rowId , Columns::ProductAsset, createCell (true , text));
253
+ m_table->item (rowId , Columns::ProductAsset)->setIcon (m_okIcon);
254
254
}
255
255
else
256
256
{
257
- m_table->setItem (i, Columns::ProductAsset, createCell (false , tr (" Failed" )));
258
- m_table->item (i, Columns::ProductAsset)->setIcon (m_failureIcon);
257
+ m_table->setItem (rowId, Columns::ProductAsset, createCell (false , tr (" Failed" )));
258
+ m_table->item (rowId, Columns::ProductAsset)->setIcon (m_failureIcon);
259
+ m_failedCount++;
259
260
}
260
261
m_assetsUuidsFinished.insert (assetUuid);
261
262
}
262
263
}
263
264
}
264
265
}
265
- if (m_assetsUuidsFinished.size () == m_assetsUuids.size ())
266
+
267
+ if (m_assetsUuidsFinished.size () == m_assetsUuidsToColumnIndex.size ())
266
268
{
267
269
m_refreshTimer->stop ();
268
270
if (m_failedCount == 0 && m_missingCount == 0 )
0 commit comments