diff --git a/src/gui/src/ui.cpp b/src/gui/src/ui.cpp index 27b01792cd7ccab3ba6977d93418bed5497252c9..6e1be43960abb71f76c87684f7a13effacaae17f 100644 --- a/src/gui/src/ui.cpp +++ b/src/gui/src/ui.cpp @@ -577,7 +577,7 @@ void module_connection_ui(const osi::Window &window, edit::UIData &data) { ImGui::Text("Source Connector: "); ImGui::SameLine(); - std::string s_con = fst_module->getType() == "universal" + std::string s_con = !fst_module->getConnectorDocks().empty() ? fst_module->getConnectorDock(fst_connector) : std::to_string(fst_module->getComponentID(fst_connector)); ImGui::Text(s_con.c_str()); @@ -589,7 +589,7 @@ void module_connection_ui(const osi::Window &window, edit::UIData &data) { ImGui::Text("Target Connector: "); ImGui::SameLine(); - std::string t_con = snd_module->getType() == "universal" + std::string t_con = !snd_module->getConnectorDocks().empty() ? snd_module->getConnectorDock(snd_connector) : std::to_string(snd_module->getComponentID(snd_connector)); ImGui::Text(t_con.c_str()); diff --git a/src/rofi/src/module.cpp b/src/rofi/src/module.cpp index e3c32298f6e033349f491fc8590e9f03a7cba58f..5d6f4ced9e8a12a1ca9a23b32cd09e675c755863 100644 --- a/src/rofi/src/module.cpp +++ b/src/rofi/src/module.cpp @@ -22,39 +22,38 @@ void Module::setConnectorDocks() // TO DO: change if connector placement gets ch void Module::setConnectorDocksCube() { + using enum side; + std::string dock; - // if (component_ids.empty()) - // setComponentIDs(); - - // auto body_node = parts->getVoxels().front()->getNode(); - // body_node->rotateRotationQuat(glm::angleAxis(glm::radians(90.0f), glm::vec3(0.0f, -1.0f, 0.0f))); - - // using enum side; - // for (const auto &connector : parts->getConnections()) - // { - // const auto roficom_id = component_ids.at(connector); - // auto con_node = connector->getNode(); - // glm::quat rotation; - // switch(roficom_id) - // { - // case 0: - // rotation = (glm::angleAxis(glm::radians(90.0f), enum_to_vec(z_pos))); - // break; - // case 1: - // rotation = (glm::angleAxis(glm::radians(90.0f), enum_to_vec(z_neg))); - // break; - // case 3: - // rotation = (glm::angleAxis(glm::radians(180.0f), enum_to_vec(z_pos))); - // break; - // case 2: - // case 4: - // case 5: - // rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f); - // break; - // } + for (const auto &connector : parts->getConnections()) + { + const auto con_side = connector->getVoxelSide().first; - // con_node->rotateRotationQuat(rotation); - // } + switch(con_side) + { + case x_neg: + dock = "-X"; + break; + case x_pos: + dock = "+X"; + break; + case z_neg: + dock = "-Z"; + break; + case z_pos: + dock = "+Z"; + break; + case y_neg: + dock = "-Y"; + break; + case y_pos: + dock = "+Y"; + break; + default: + ASSUMPTION(false); + } + connector_docks.emplace(connector, dock); + } } void Module::setConnectorDocksUniversal() @@ -68,8 +67,8 @@ void Module::setConnectorDocksUniversal() if (connector->getType(false) == connector_type::shared_rotation) continue; - auto con_side = connector->getVoxelSide().first; - auto voxel_pos = connector->getConnection().first.lock()->getNode()->getPositionLocal(); + const auto con_side = connector->getVoxelSide().first; + const auto voxel_pos = connector->getConnection().first.lock()->getNode()->getPositionLocal(); switch(con_side) { case x_neg: