From a69c49376f9c1545d63ef1253464a041f1c00baf Mon Sep 17 00:00:00 2001 From: Kapim Date: Wed, 8 Dec 2021 12:38:27 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Fixed:=20*=20STL=20meshes=20we=20rotated=20?= =?UTF-8?q?by=20180=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs | 4 ++++ arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs | 1 + 2 files changed, 5 insertions(+) diff --git a/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs b/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs index a62ea1494..79249c053 100644 --- a/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs +++ b/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs @@ -65,6 +65,10 @@ private void ImportMesh(string path, string aoId) { // Supports: FBX, OBJ, GLTF2, STL, PLY, 3MF AssetLoaderOptions assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions(); AssetLoader.LoadModelFromFile(path, null, delegate (AssetLoaderContext assetLoaderContext) { + if (Path.GetExtension(path).ToLower() == ".stl") { + assetLoaderContext.RootGameObject.transform.Rotate(0f, 180f, 0f); + } + OnMeshImported?.Invoke(this, new ImportedMeshEventArgs(assetLoaderContext.WrapperGameObject, aoId)); }, null, assetLoaderOptions: assetLoaderOptions, onError: OnModelLoadError, wrapperGameObject: loadedObject); } diff --git a/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs b/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs index 30c616fe1..8c0b3b774 100644 --- a/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs +++ b/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs @@ -234,6 +234,7 @@ public void RemoveOldModels(string robotType) { /// Type of the robot. /// public bool CheckIfNewerRobotModelExists(string robotType, string fileName) { + return false; // HACK - remove once lastModified on project service get working again if (RobotModelsSources.TryGetValue(fileName, out bool downloadInProgress)) { if (downloadInProgress) { From 2e8f71be4294a93193d72224d5e400866c3a6761 Mon Sep 17 00:00:00 2001 From: Kapim Date: Wed, 8 Dec 2021 12:38:27 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Fixed:=20*=20STL=20meshes=20we=20rotated=20?= =?UTF-8?q?by=20180=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs b/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs index a62ea1494..79249c053 100644 --- a/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs +++ b/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs @@ -65,6 +65,10 @@ private void ImportMesh(string path, string aoId) { // Supports: FBX, OBJ, GLTF2, STL, PLY, 3MF AssetLoaderOptions assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions(); AssetLoader.LoadModelFromFile(path, null, delegate (AssetLoaderContext assetLoaderContext) { + if (Path.GetExtension(path).ToLower() == ".stl") { + assetLoaderContext.RootGameObject.transform.Rotate(0f, 180f, 0f); + } + OnMeshImported?.Invoke(this, new ImportedMeshEventArgs(assetLoaderContext.WrapperGameObject, aoId)); }, null, assetLoaderOptions: assetLoaderOptions, onError: OnModelLoadError, wrapperGameObject: loadedObject); } From 1498d5df38a478dc609864a75ea3329b77437b44 Mon Sep 17 00:00:00 2001 From: Kapim Date: Wed, 8 Dec 2021 12:54:20 +0100 Subject: [PATCH 3/3] Fixed: * removed hack --- arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs b/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs index 8c0b3b774..30c616fe1 100644 --- a/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs +++ b/arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs @@ -234,7 +234,6 @@ public void RemoveOldModels(string robotType) { /// Type of the robot. /// public bool CheckIfNewerRobotModelExists(string robotType, string fileName) { - return false; // HACK - remove once lastModified on project service get working again if (RobotModelsSources.TryGetValue(fileName, out bool downloadInProgress)) { if (downloadInProgress) {