From e2823e92e80d3f8e3f28b8ddddc7e308151d2572 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20=C5=A0toura=C4=8D?= <525032@mail.muni.cz>
Date: Wed, 22 May 2024 10:10:01 +0200
Subject: [PATCH] remove contextual mode I keyboard change

---
 .../rofi/rofiworlds/{loop.json => loop1.json} |   0
 data/rofi/rofiworlds/pick1.json               | 256 ++++++++++++++++++
 data/rofi/rofiworlds/pick2.json               | 234 ++++++++++++++++
 src/edit/src/editor.cpp                       |   8 +-
 src/edit/src/scene.cpp                        |  14 +-
 src/gui/src/ui.cpp                            |   2 +-
 6 files changed, 503 insertions(+), 11 deletions(-)
 rename data/rofi/rofiworlds/{loop.json => loop1.json} (100%)
 create mode 100644 data/rofi/rofiworlds/pick1.json
 create mode 100644 data/rofi/rofiworlds/pick2.json

diff --git a/data/rofi/rofiworlds/loop.json b/data/rofi/rofiworlds/loop1.json
similarity index 100%
rename from data/rofi/rofiworlds/loop.json
rename to data/rofi/rofiworlds/loop1.json
diff --git a/data/rofi/rofiworlds/pick1.json b/data/rofi/rofiworlds/pick1.json
new file mode 100644
index 0000000..c08c808
--- /dev/null
+++ b/data/rofi/rofiworlds/pick1.json
@@ -0,0 +1,256 @@
+{
+        "modules" : [
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : 0,
+                "id" : 0,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 5,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 6,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : -42,
+                "gamma" : -0,
+                "id" : 9,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 90,
+                "gamma" : 0,
+                "id" : 3,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : 90,
+                "id" : 7,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 42,
+                "type" : "universal"
+            },
+            {
+                "alpha" : -90,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 8,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 90,
+                "gamma" : 0,
+                "id" : 10,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : 0,
+                "id" : 2,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : 31,
+                "id" : 1,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 4,
+                "type" : "universal"
+            }
+        ],
+        "spaceJoints" : [
+            {
+                "point" : [
+                    -1.47725,
+                    0.645358,
+                    1.03008
+                ],
+                "joint" : {
+                    "type" : "rigid",
+                    "sourceToDestination" : [
+                        [
+                            1,
+                            -2.71465e-07,
+                            -1.30124e-07,
+                            0
+                        ],
+                        [
+                            -2.82768e-08,
+                            -0.515038,
+                            0.857167,
+                            0
+                        ],
+                        [
+                            -2.9971e-07,
+                            -0.857167,
+                            -0.515038,
+                            0
+                        ],
+                        [
+                            0,
+                            0,
+                            0,
+                            1
+                        ]
+                    ],
+                    "positions" : [
+
+                    ]
+                },
+                "to" : {
+                    "component" : 0,
+                    "id" : 42
+                }
+            }
+        ],
+        "moduleJoints" : [
+            {
+                "from" : {
+                    "id" : 1,
+                    "connector" : "B+X"
+                },
+                "to" : {
+                    "id" : 42,
+                    "connector" : "B-Z"
+                },
+                "orientation" : "North"
+            },
+            {
+                "from" : {
+                    "id" : 2,
+                    "connector" : "B-Z"
+                },
+                "to" : {
+                    "id" : 1,
+                    "connector" : "B-X"
+                },
+                "orientation" : "North"
+            },
+            {
+                "from" : {
+                    "id" : 0,
+                    "connector" : "B+X"
+                },
+                "to" : {
+                    "id" : 42,
+                    "connector" : "A-X"
+                },
+                "orientation" : "North"
+            },
+            {
+                "from" : {
+                    "id" : 4,
+                    "connector" : "B+X"
+                },
+                "to" : {
+                    "id" : 42,
+                    "connector" : "B-X"
+                },
+                "orientation" : "South"
+            },
+            {
+                "from" : {
+                    "id" : 3,
+                    "connector" : "A-Z"
+                },
+                "to" : {
+                    "id" : 1,
+                    "connector" : "A+X"
+                },
+                "orientation" : "South"
+            },
+            {
+                "from" : {
+                    "id" : 5,
+                    "connector" : "A+X"
+                },
+                "to" : {
+                    "id" : 0,
+                    "connector" : "B-Z"
+                },
+                "orientation" : "East"
+            },
+            {
+                "from" : {
+                    "id" : 6,
+                    "connector" : "A-X"
+                },
+                "to" : {
+                    "id" : 7,
+                    "connector" : "B+X"
+                },
+                "orientation" : "West"
+            },
+            {
+                "from" : {
+                    "id" : 2,
+                    "connector" : "B-X"
+                },
+                "to" : {
+                    "id" : 7,
+                    "connector" : "B-Z"
+                },
+                "orientation" : "East"
+            },
+            {
+                "from" : {
+                    "id" : 8,
+                    "connector" : "B-Z"
+                },
+                "to" : {
+                    "id" : 42,
+                    "connector" : "A-Z"
+                },
+                "orientation" : "West"
+            },
+            {
+                "from" : {
+                    "id" : 9,
+                    "connector" : "A-Z"
+                },
+                "to" : {
+                    "id" : 8,
+                    "connector" : "A-Z"
+                },
+                "orientation" : "East"
+            },
+            {
+                "from" : {
+                    "id" : 10,
+                    "connector" : "A+X"
+                },
+                "to" : {
+                    "id" : 8,
+                    "connector" : "B+X"
+                },
+                "orientation" : "West"
+            }
+        ]
+    }
\ No newline at end of file
diff --git a/data/rofi/rofiworlds/pick2.json b/data/rofi/rofiworlds/pick2.json
new file mode 100644
index 0000000..341db1c
--- /dev/null
+++ b/data/rofi/rofiworlds/pick2.json
@@ -0,0 +1,234 @@
+{
+        "modules" : [
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 0,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : -58,
+                "gamma" : -151,
+                "id" : 2,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 41,
+                "beta" : 0,
+                "gamma" : -151,
+                "id" : 3,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 90,
+                "gamma" : 0,
+                "id" : 4,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : 0,
+                "id" : 42,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 8,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : -90,
+                "gamma" : 0,
+                "id" : 1,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : 0,
+                "id" : 6,
+                "type" : "universal"
+            },
+            {
+                "alpha" : 0,
+                "beta" : 0,
+                "gamma" : -0,
+                "id" : 7,
+                "type" : "universal"
+            }
+        ],
+        "spaceJoints" : [
+            {
+                "point" : [
+                    3.51739,
+                    0.0103855,
+                    0
+                ],
+                "joint" : {
+                    "type" : "rigid",
+                    "sourceToDestination" : [
+                        [
+                            -1.19209e-07,
+                            -2.98023e-07,
+                            1,
+                            0
+                        ],
+                        [
+                            5.96046e-08,
+                            1,
+                            3.57628e-07,
+                            0
+                        ],
+                        [
+                            -1,
+                            0,
+                            -1.78814e-07,
+                            0
+                        ],
+                        [
+                            0,
+                            0,
+                            0,
+                            1
+                        ]
+                    ],
+                    "positions" : [
+
+                    ]
+                },
+                "to" : {
+                    "component" : 0,
+                    "id" : 42
+                }
+            },
+            {
+                "point" : [
+                    0.00640446,
+                    0.845423,
+                    7.10543e-15
+                ],
+                "joint" : {
+                    "type" : "rigid",
+                    "sourceToDestination" : [
+                        [
+                            -1,
+                            -1.74846e-07,
+                            8.74228e-08,
+                            0
+                        ],
+                        [
+                            -8.74228e-08,
+                            -2.08432e-14,
+                            -1,
+                            0
+                        ],
+                        [
+                            1.74846e-07,
+                            -1,
+                            5.55774e-15,
+                            0
+                        ],
+                        [
+                            0,
+                            0,
+                            0,
+                            1
+                        ]
+                    ],
+                    "positions" : [
+
+                    ]
+                },
+                "to" : {
+                    "component" : 0,
+                    "id" : 2
+                }
+            }
+        ],
+        "moduleJoints" : [
+            {
+                "from" : {
+                    "id" : 8,
+                    "connector" : "A-Z"
+                },
+                "to" : {
+                    "id" : 1,
+                    "connector" : "A-Z"
+                },
+                "orientation" : "East"
+            },
+            {
+                "from" : {
+                    "id" : 0,
+                    "connector" : "A+X"
+                },
+                "to" : {
+                    "id" : 8,
+                    "connector" : "A-X"
+                },
+                "orientation" : "South"
+            },
+            {
+                "from" : {
+                    "id" : 7,
+                    "connector" : "B-X"
+                },
+                "to" : {
+                    "id" : 0,
+                    "connector" : "B-Z"
+                },
+                "orientation" : "West"
+            },
+            {
+                "from" : {
+                    "id" : 42,
+                    "connector" : "A-Z"
+                },
+                "to" : {
+                    "id" : 1,
+                    "connector" : "A+X"
+                },
+                "orientation" : "West"
+            },
+            {
+                "from" : {
+                    "id" : 2,
+                    "connector" : "A-Z"
+                },
+                "to" : {
+                    "id" : 6,
+                    "connector" : "A-Z"
+                },
+                "orientation" : "South"
+            },
+            {
+                "from" : {
+                    "id" : 4,
+                    "connector" : "A-Z"
+                },
+                "to" : {
+                    "id" : 3,
+                    "connector" : "B-Z"
+                },
+                "orientation" : "South"
+            },
+            {
+                "from" : {
+                    "id" : 3,
+                    "connector" : "A-Z"
+                },
+                "to" : {
+                    "id" : 6,
+                    "connector" : "A+X"
+                },
+                "orientation" : "West"
+            }
+        ]
+    }
\ No newline at end of file
diff --git a/src/edit/src/editor.cpp b/src/edit/src/editor.cpp
index 9329a09..7383819 100644
--- a/src/edit/src/editor.cpp
+++ b/src/edit/src/editor.cpp
@@ -406,10 +406,10 @@ void Editor::changeModeI()
     auto previous_mode = editor_mode_I;
 
     /* Contextual change */
-    if (keyboard.just_pressed().contains("B"))
-        editor_mode_I = editor_mode_I == build ? spectate : build;
-    if (keyboard.just_pressed().contains(";"))
-        editor_mode_I = editor_mode_I == debug ? spectate : debug;
+    // if (keyboard.just_pressed().contains("B"))
+    //     editor_mode_I = editor_mode_I == build ? spectate : build;
+    // if (keyboard.just_pressed().contains(";"))
+    //     editor_mode_I = editor_mode_I == debug ? spectate : debug;
 
     /* Independent change */
     if (keyboard.down().contains("LeftCtrl"))
diff --git a/src/edit/src/scene.cpp b/src/edit/src/scene.cpp
index 68e621d..e8ec652 100644
--- a/src/edit/src/scene.cpp
+++ b/src/edit/src/scene.cpp
@@ -517,13 +517,15 @@ void Scene::manageSelection(node_ptr nearest_node)
 
     if (!nearest_node)
     {
-        manageObjectAxes(nullptr); // REMOVE AFTER SHOWCASE
+        // Uncomment for Debug
+        // manageObjectAxes(nullptr);
         selections[0] = nullptr;
         return;
     }
     selections[0] = nearest_node;
     addSelectionAABB(nearest_node);
-    manageObjectAxes(selections[0]); // REMOVE AFTER SHOWCASE
+    // Uncomment for Debug
+    // manageObjectAxes(selections[0]);
 }
 
 void Scene::manageHighlight(glm::vec3 hit_coord, node_ptr nearest_node)
@@ -632,8 +634,8 @@ void Scene::manageCameraAxes(bool enabled)
     }
     camera_axes_enabled = enabled;
 
-    // TO DO: remove
-    manageCameraAxesDebug(enabled);
+    // Uncomment for Debug
+    // manageCameraAxesDebug(enabled);
 }
 
 void Scene::manageCameraAxesDebug(bool enabled)
@@ -668,8 +670,8 @@ void Scene::updateCameraAxesPosition()
     const auto camera_rotation = active_cameras.front().lock()->getNode()->getRotationMatWorld();
     camera_axes->setRotationQuat(glm::inverse(camera_rotation));
 
-    // TO DO: remove
-    updateCameraAxesDebugPosition();
+    // Uncomment for Debug
+    // updateCameraAxesDebugPosition();
 }
 
 void Scene::updateCameraAxesDebugPosition()
diff --git a/src/gui/src/ui.cpp b/src/gui/src/ui.cpp
index 733b683..892be6c 100644
--- a/src/gui/src/ui.cpp
+++ b/src/gui/src/ui.cpp
@@ -179,7 +179,7 @@ void rofiworld_menu_ui(const osi::Window &window, edit::UIData &data)
         data.save_rofiworld_visible = true;
     }
 
-    if (ImGui::MenuItem("Clear##ClearRofiWorldMenuIteM", NULL, false, data.editor_mode_II == edit::mode_II::build)) 
+    if (ImGui::MenuItem("New##NewRofiWorldMenuIteM", NULL, false, data.editor_mode_II == edit::mode_II::build)) 
     {
         data.start_new_rofiworld_visible = true;
     }
-- 
GitLab