diff --git a/src/edit/include/edit/editor.hpp b/src/edit/include/edit/editor.hpp index 7d84ebcdae11151cd521dbbe8e19206a5aec474e..82b58d42003950fd4856bf850c7f0a05d3e11d62 100644 --- a/src/edit/include/edit/editor.hpp +++ b/src/edit/include/edit/editor.hpp @@ -359,6 +359,8 @@ public: bool checkModuleExport(const voxel_graph_ptr &voxel_graph, const build_mode_I build_mode); + void resetBuildModeIIVariables(); + state &getControlState() { return control_state; } bool isObjectMoving() const { return object_moving; } diff --git a/src/edit/src/editor.cpp b/src/edit/src/editor.cpp index 6f14a98f2924beac4c94e7539766d811657c8908..b339c03641b5eb7fd282e9e9123775b5aaad9ec1 100644 --- a/src/edit/src/editor.cpp +++ b/src/edit/src/editor.cpp @@ -179,6 +179,7 @@ void Editor::manageUIImportRofiWorld() ui.import_file_error = false; ui.name_buffer[0] = '\0'; + resetBuildModeIIVariables(); } else { @@ -210,6 +211,25 @@ bool Editor::checkModuleExport(const voxel_graph_ptr &voxel_graph, const build_m return false; } +void Editor::resetBuildModeIIVariables() +{ + selected_module = nullptr; + selected_add_module = nullptr; + prev_selected_add_module = nullptr; + prev_rebuild_node = nullptr; + can_rotate_component = true; + rotation_locked_module = nullptr; + collided_modules = {}; + selected_connectors = {nullptr, nullptr}; + first_connector_highlights = {glm::vec3(0.0f), nullptr}; + second_connector_highlights = {glm::vec3(0.0f), nullptr}; + selected_modules_connect = { nullptr, nullptr }; + can_connect_modules = true; + selected_space_joints = {}; + + scene->manageSelection(nullptr); +} + void Editor::update() { // WARNING: Not tested when placed here, before the rest of the methods