Skip to content

Commit 9a692fd

Browse files
authored
Merge pull request o3de#581 from aws-lumberyard-dev/cgalvan/gitflow_231008_o3de-extras
Merged `stabilization/2310` to `development`
2 parents a00f7c4 + 30a91fb commit 9a692fd

File tree

7 files changed

+43
-70
lines changed

7 files changed

+43
-70
lines changed

Gems/ROS2/Code/Source/RobotImporter/Pages/CheckAssetPage.cpp

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ namespace ROS2
102102
const AZStd::optional<AZ::Crc32>& crc32,
103103
const AZStd::optional<AZStd::string>& resolvedSdfPath)
104104
{
105-
int i = m_table->rowCount();
106-
m_table->setRowCount(i + 1);
105+
int rowId = m_table->rowCount();
106+
m_table->setRowCount(rowId + 1);
107107

108108
// The Asset ID GUID must not be null(all zeros) and the asset source path must not be empty
109109
bool isOk = (assetSourcePath.has_value() && !assetSourcePath->empty() && assetSourcePath != "not found")
@@ -123,45 +123,43 @@ namespace ROS2
123123
{
124124
p->setToolTip(tr("CRC for file : ") + QString::fromUtf8(crcStr.data(), crcStr.size()));
125125
}
126-
m_table->setItem(i, Columns::SdfMeshPath, p);
126+
m_table->setItem(rowId, Columns::SdfMeshPath, p);
127127

128128
if (resolvedSdfPath)
129129
{
130130
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())));
132132
}
133133
else
134134
{
135-
m_table->setItem(i, Columns::ResolvedMeshPath, createCell(false, tr("Not found")));
135+
m_table->setItem(rowId, Columns::ResolvedMeshPath, createCell(false, tr("Not found")));
136136
}
137137

138-
m_table->setItem(i, Columns::Type, createCell(isOk, type));
138+
m_table->setItem(rowId, Columns::Type, createCell(isOk, type));
139139

140140
if (assetSourcePath && !assetSourcePath->empty())
141141
{
142142
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;
144145
}
145146
else
146147
{
147-
m_table->setItem(i, Columns::SourceAsset, createCell(false, tr("Not found")));
148+
m_table->setItem(rowId, Columns::SourceAsset, createCell(false, tr("Not found")));
148149
}
149150

150151
if (isOk)
151152
{
152-
m_table->item(i, Columns::ResolvedMeshPath)->setIcon(m_okIcon);
153+
m_table->item(rowId, Columns::ResolvedMeshPath)->setIcon(m_okIcon);
153154
}
154155
else
155156
{
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()));
158159
}
159-
160-
// Don't add an empty asset path to the list of resolved assets
161160
if (isOk)
162161
{
163-
m_assetsPaths.push_back(AZStd::move(*assetSourcePath));
164-
m_assetsUuids.push_back(assetUuid);
162+
m_assetsUuidsToColumnIndex[assetUuid] = rowId;
165163
}
166164
}
167165

@@ -184,7 +182,7 @@ namespace ROS2
184182

185183
void CheckAssetPage::ClearAssetsList()
186184
{
187-
m_assetsUuids.clear();
185+
m_assetsUuidsToColumnIndex.clear();
188186
m_assetsUuidsFinished.clear();
189187
m_assetsPaths.clear();
190188
m_table->setRowCount(0);
@@ -195,27 +193,30 @@ namespace ROS2
195193

196194
bool CheckAssetPage::IsEmpty() const
197195
{
198-
return m_assetsUuids.empty();
196+
return m_assetsUuidsToColumnIndex.empty();
199197
}
200198

201199
void CheckAssetPage::DoubleClickRow(int row, [[maybe_unused]] int col)
202200
{
203-
AZ_Printf("CheckAssetPage", "Clicked on row", row);
204-
if (row < m_assetsPaths.size())
201+
for (const auto& [assetUuid, columnId] : m_assetsUuidsToColumnIndex)
205202
{
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+
208209
}
209210
}
210211

211212
void CheckAssetPage::RefreshTimerElapsed()
212213
{
213-
for (int i = 0; i < m_assetsUuids.size(); i++)
214+
for (const auto& [assetUuid, rowId] : m_assetsUuidsToColumnIndex)
214215
{
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))
218217
{
218+
// Execute for all found source assets that are not finished yet.
219+
const AZStd::string& sourceAssetFullPath = m_assetsPaths[assetUuid];
219220
using namespace AzToolsFramework;
220221
using namespace AzToolsFramework::AssetSystem;
221222

@@ -225,7 +226,7 @@ namespace ROS2
225226
if (result)
226227
{
227228
bool allFinished = true;
228-
bool failed = false;
229+
bool productAssetFailed = false;
229230
JobInfoContainer& allJobs = result.GetValue();
230231
for (const JobInfo& job : allJobs)
231232
{
@@ -235,34 +236,35 @@ namespace ROS2
235236
}
236237
if (job.m_status == JobStatus::Failed)
237238
{
238-
failed = true;
239-
m_failedCount++;
239+
productAssetFailed = true;
240240
}
241241
}
242242
if (allFinished)
243243
{
244-
if (!failed)
244+
if (!productAssetFailed)
245245
{
246246
const AZStd::vector<AZStd::string> productPaths = Utils::GetProductAssets(assetUuid);
247247
QString text;
248248
for (const auto& productPath : productPaths)
249249
{
250250
text += QString::fromUtf8(productPath.data(), productPath.size()) + " ";
251251
}
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);
254254
}
255255
else
256256
{
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++;
259260
}
260261
m_assetsUuidsFinished.insert(assetUuid);
261262
}
262263
}
263264
}
264265
}
265-
if (m_assetsUuidsFinished.size() == m_assetsUuids.size())
266+
267+
if (m_assetsUuidsFinished.size() == m_assetsUuidsToColumnIndex.size())
266268
{
267269
m_refreshTimer->stop();
268270
if (m_failedCount == 0 && m_missingCount == 0)

Gems/ROS2/Code/Source/RobotImporter/Pages/CheckAssetPage.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ namespace ROS2
5353
unsigned int m_missingCount{ 0 };
5454
unsigned int m_failedCount{ 0 };
5555
void SetTitle();
56-
AZStd::vector<AZ::Uuid> m_assetsUuids;
57-
AZStd::vector<AZStd::string> m_assetsPaths;
58-
AZStd::unordered_set<AZ::Uuid> m_assetsUuidsFinished;
56+
AZStd::unordered_map<AZ::Uuid, int> m_assetsUuidsToColumnIndex; //!< Map of asset UUIDs to column index in the table.
57+
AZStd::unordered_map<AZ::Uuid, AZStd::string> m_assetsPaths; //! Map of asset UUIDs to asset source paths.
58+
AZStd::unordered_set<AZ::Uuid> m_assetsUuidsFinished; //!< Set of asset UUIDs that have been processed by asset processor.
5959
void DoubleClickRow(int row, int col);
6060
void RefreshTimerElapsed();
6161
QIcon m_failureIcon;

Gems/ROS2/Code/Source/RobotImporter/Utils/SourceAssetsStorage.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -510,28 +510,6 @@ namespace ROS2::Utils
510510

511511
bool CreateSceneManifest(const AZ::IO::Path& sourceAssetPath, const AZ::IO::Path& assetInfoFile, const bool collider, const bool visual)
512512
{
513-
// Start with a default set of import settings.
514-
AZ::SceneAPI::SceneImportSettings importSettings;
515-
516-
// OBJ files used for robotics might be authored with hundreds or thousands of tiny groups of meshes. By default,
517-
// AssImp splits each object or group in an OBJ into a separate submesh, creating an extremely non-optimal result.
518-
// By turning on the AssImp options to optimize the scene and the meshes, all of these submeshes will get recombined
519-
// back into just a few submeshes.
520-
if (sourceAssetPath.Extension() == ".obj")
521-
{
522-
importSettings.m_optimizeScene = true;
523-
importSettings.m_optimizeMeshes = true;
524-
}
525-
526-
// Set the import settings into the settings registry.
527-
// This needs to happen before calling LoadScene so that the AssImp import settings are applied to the scene being
528-
// read into memory. These settings affect the list of scene nodes referenced by the MeshGroup and PhysXGroup settings,
529-
// so it's important to apply them here to get the proper node lists.
530-
if (AZ::SettingsRegistryInterface* settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry)
531-
{
532-
settingsRegistry->SetObject(AZ::SceneAPI::DataTypes::IImportGroup::SceneImportSettingsRegistryKey, importSettings);
533-
}
534-
535513
AZ_Printf("CreateSceneManifest", "Creating manifest for asset %s at : %s ", sourceAssetPath.c_str(), assetInfoFile.c_str());
536514
AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene> scene;
537515
AZ::SceneAPI::Events::SceneSerializationBus::BroadcastResult(

Gems/ROS2/gem.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"PhysX",
3333
"PrimitiveAssets",
3434
"StartingPointInput"
35+
3536
],
3637
"restricted": "ROS2",
3738
"repo_uri": "https://raw.githubusercontent.com/o3de/o3de-extras/development",

Templates/Ros2RoboticManipulationTemplate/Template/Examples/panda_moveit_config_demo.launch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def generate_launch_description():
2525
def launch_setup(context, *args, **kwargs):
2626

2727
current_file_path = Path(__file__).resolve()
28-
current_directory = current_file_path.parent
28+
current_directory = str(current_file_path.parent)
2929

3030
use_sim_time = { "use_sim_time": True}
3131
moveit_config = (

Templates/Ros2RoboticManipulationTemplate/Template/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"engine_version": "2.1.0",
2222
"gem_names": [
2323
"WarehouseAssets",
24+
"WarehouseAutomation",
2425
"ROS2"
2526
]
2627
}

repo.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,8 @@
151151
"o3de-sdk>=2.1.0",
152152
"o3de>=2.1.0"
153153
],
154-
"dependencies": [
155-
"Atom_RPI",
156-
"Atom_Feature_Common",
157-
"Atom_Component_DebugCamera",
158-
"CommonFeaturesAtom",
159-
"PhysX",
160-
"PrimitiveAssets",
161-
"StartingPointInput"
162-
],
163154
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/ros2-2.0.0-gem.zip",
164-
"sha256": "8910f69ffb7598a6c0880f44fb6785edfa90e7de47becdff4358c978be848fd4"
155+
"sha256": "93a51bebd7d5b931996025d6622bb09a6c20d6071da625d57eddf80f285444af"
165156
}
166157
]
167158
},

0 commit comments

Comments
 (0)