From e9a2f055f044fa2817b41bbc6ddd23a20f58c830 Mon Sep 17 00:00:00 2001 From: Balint-H Date: Mon, 25 Nov 2024 06:37:52 -0800 Subject: [PATCH] Copybara import of the project: -- 9d63ebca419496e36f94fbfec6f97f0227846cf5 by Balint-H : Throw exception if OBJ file is referenced in MJCF when loading in Unity -- a50486c19a3483cd914e7957d7d4a5efaab9d977 by Balint-H : Adjust line length COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/2248 from Balint-H:fix/unity-obj-warning a50486c19a3483cd914e7957d7d4a5efaab9d977 PiperOrigin-RevId: 699962619 Change-Id: I2edff691fd5cedf79e2564f2ac5f2115393a4bf6 --- unity/Editor/Importer/MjImporterWithAssets.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unity/Editor/Importer/MjImporterWithAssets.cs b/unity/Editor/Importer/MjImporterWithAssets.cs index 4713a9f8..a9a93184 100644 --- a/unity/Editor/Importer/MjImporterWithAssets.cs +++ b/unity/Editor/Importer/MjImporterWithAssets.cs @@ -152,6 +152,13 @@ public class MjImporterWithAssets : MjcfImporter { parentNode.GetStringAttribute("name", defaultValue: string.Empty); var assetReferenceName = MjEngineTool.Sanitize(unsanitizedAssetReferenceName); var sourceFilePath = Path.Combine(_sourceMeshesDir, fileName); + + if (Path.GetExtension(sourceFilePath) == ".obj") { + throw new NotImplementedException("OBJ mesh file loading is not yet implemented. " + + "Please convert to binary STL. " + + $"Attempted to load: {sourceFilePath}"); + } + var targetFilePath = Path.Combine(_targetMeshesDir, assetReferenceName + ".stl"); if (File.Exists(targetFilePath)) { File.Delete(targetFilePath);