From b66e0a590fdc59efeaa277a527c2844b66f56ea8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20=C5=A0toura=C4=8D?= <525032@mail.muni.cz>
Date: Sat, 18 May 2024 23:46:15 +0200
Subject: [PATCH] fix connector export of +X, -X on cube (was modified for UM)

---
 src/filein/src/module_loader.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/filein/src/module_loader.cpp b/src/filein/src/module_loader.cpp
index 2e4b926..847cec5 100644
--- a/src/filein/src/module_loader.cpp
+++ b/src/filein/src/module_loader.cpp
@@ -471,10 +471,14 @@ boost::json::array create_STD_matrix(const connector_ptr &connector, bool &is_id
     {
         using enum side;
         case x_pos: // in reality x_neg, switched due to opposite shoe y-axis in the editor
-            rotation = glm::quat(1.0f, glm::vec3(0.0f));
+            rotation = connector->getType(true) == connector_type::rotation 
+                                                   ? glm::quat(1.0f, glm::vec3(0.0f)) 
+                                                   : glm::angleAxis(glm::radians(180.0f), enum_to_vec(y_pos));
             break;
         case x_neg: // in reality x_pos, switched due to opposite shoe y-axis in the editor
-            rotation = glm::angleAxis(glm::radians(180.0f), enum_to_vec(y_pos));
+            rotation = connector->getType(true) == connector_type::rotation 
+                       ? glm::angleAxis(glm::radians(180.0f), enum_to_vec(y_pos)) 
+                       : glm::quat(1.0f, glm::vec3(0.0f));
             break;
         case z_neg:
             rotation = glm::angleAxis(glm::radians(180.0f), enum_to_vec(z_pos)) * glm::angleAxis(glm::radians(90.0f), enum_to_vec(y_neg));
-- 
GitLab