@@ -510,6 +510,28 @@ namespace ROS2::Utils
510
510
511
511
bool CreateSceneManifest (const AZ::IO::Path& sourceAssetPath, const AZ::IO::Path& assetInfoFile, const bool collider, const bool visual)
512
512
{
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
+
513
535
AZ_Printf (" CreateSceneManifest" , " Creating manifest for asset %s at : %s " , sourceAssetPath.c_str (), assetInfoFile.c_str ());
514
536
AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene> scene;
515
537
AZ::SceneAPI::Events::SceneSerializationBus::BroadcastResult (
0 commit comments