@@ -1240,6 +1240,94 @@ void LabUi::show_object_options() const
12401240 }
12411241 }
12421242
1243+ const ship* dockee_shipp = &Ships[Objects[getLabManager ()->CurrentObject ].instance ];
1244+ auto dockee_dock_map = get_docking_point_map (Ship_info[dockee_shipp->ship_info_index ].model_num );
1245+
1246+ if (!dockee_dock_map.empty ()) {
1247+
1248+ if (ImGui::BeginCombo (" Docker Ship Class" , Ship_info[getLabManager ()->DockerClass ].name )) {
1249+ for (size_t i = 0 ; i < Ship_info.size (); ++i) {
1250+ bool is_selected = (static_cast <int >(i) == getLabManager ()->DockerClass );
1251+ if (ImGui::Selectable (Ship_info[i].name , is_selected)) {
1252+ getLabManager ()->DockerClass = static_cast <int >(i);
1253+ // Load model if needed
1254+ auto & dsip = Ship_info[getLabManager ()->DockerClass ];
1255+ if (dsip.model_num < 0 ) {
1256+ dsip.model_num = model_load (dsip.pof_file , &dsip);
1257+ }
1258+ auto new_dock_map = get_docking_point_map (dsip.model_num );
1259+
1260+ // Auto-select first available dockpoint (or clear if none)
1261+ if (!new_dock_map.empty ()) {
1262+ getLabManager ()->DockerDockPoint = new_dock_map.begin ()->second ;
1263+ } else {
1264+ getLabManager ()->DockerDockPoint .clear ();
1265+ }
1266+ }
1267+ if (is_selected)
1268+ ImGui::SetItemDefaultFocus ();
1269+ }
1270+ ImGui::EndCombo ();
1271+ }
1272+
1273+ auto & dsip = Ship_info[getLabManager ()->DockerClass ];
1274+ if (dsip.model_num < 0 ) {
1275+ dsip.model_num = model_load (dsip.pof_file , &dsip);
1276+ }
1277+ auto dock_map = get_docking_point_map (dsip.model_num );
1278+
1279+ // Ensure DockerDockPoint is initialized once based on the current DockerClass
1280+ if (getLabManager ()->DockerDockPoint .empty ()) {
1281+ if (!dock_map.empty ()) {
1282+ getLabManager ()->DockerDockPoint = dock_map.begin ()->second ;
1283+ }
1284+ }
1285+
1286+ const char * docker_label = getLabManager ()->DockerDockPoint .c_str ();
1287+
1288+ if (ImGui::BeginCombo (" Docker Dockpoint" , docker_label)) {
1289+ if (!dock_map.empty ()) {
1290+ for (const auto & [index, name] : dock_map) {
1291+ bool is_selected = (name == getLabManager ()->DockerDockPoint );
1292+ if (ImGui::Selectable (name.c_str (), is_selected)) {
1293+ getLabManager ()->DockerDockPoint = name;
1294+ }
1295+ if (is_selected)
1296+ ImGui::SetItemDefaultFocus ();
1297+ }
1298+ }
1299+ ImGui::EndCombo ();
1300+ }
1301+
1302+ // Auto-select first dockpoint if none currently selected
1303+ if (getLabManager ()->DockeeDockPoint .empty ()) {
1304+ getLabManager ()->DockeeDockPoint = dockee_dock_map.begin ()->second ;
1305+ }
1306+
1307+ const char * dockee_label = getLabManager ()->DockeeDockPoint .c_str ();
1308+
1309+ if (ImGui::BeginCombo (" Dockee Dockpoint" , dockee_label)) {
1310+ for (const auto & [index, name] : dockee_dock_map) {
1311+ bool is_selected = (name == getLabManager ()->DockeeDockPoint );
1312+ if (ImGui::Selectable (name.c_str (), is_selected)) {
1313+ getLabManager ()->DockeeDockPoint = name;
1314+ }
1315+ if (is_selected)
1316+ ImGui::SetItemDefaultFocus ();
1317+ }
1318+ ImGui::EndCombo ();
1319+ }
1320+
1321+ if (Button (" Begin Docking Test" )) {
1322+ getLabManager ()->beginDockingTest ();
1323+ }
1324+
1325+ if (Button (" Begin Undocking Test" )) {
1326+ getLabManager ()->beginUndockingTest ();
1327+ }
1328+ }
1329+
1330+
12431331 build_animation_options (shipp, sip);
12441332 }
12451333 }
0 commit comments