| 1310 | } |
| 1311 | |
| 1312 | GridMapEditor::GridMapEditor() { |
| 1313 | ED_SHORTCUT("grid_map/previous_floor", TTRC("Previous Floor"), Key::KEY_1, true); |
| 1314 | ED_SHORTCUT("grid_map/next_floor", TTRC("Next Floor"), Key::KEY_3, true); |
| 1315 | ED_SHORTCUT("grid_map/edit_x_axis", TTRC("Edit X Axis"), KeyModifierMask::SHIFT + Key::Z, true); |
| 1316 | ED_SHORTCUT("grid_map/edit_y_axis", TTRC("Edit Y Axis"), KeyModifierMask::SHIFT + Key::X, true); |
| 1317 | ED_SHORTCUT("grid_map/edit_z_axis", TTRC("Edit Z Axis"), KeyModifierMask::SHIFT + Key::C, true); |
| 1318 | ED_SHORTCUT("grid_map/keep_selected", TTRC("Keep Selection")); |
| 1319 | ED_SHORTCUT("grid_map/clear_rotation", TTRC("Clear Rotation")); |
| 1320 | |
| 1321 | options = memnew(MenuButton); |
| 1322 | options->set_theme_type_variation(SceneStringName(FlatButton)); |
| 1323 | options->get_popup()->add_separator(); |
| 1324 | options->get_popup()->add_radio_check_shortcut(ED_GET_SHORTCUT("grid_map/edit_x_axis"), MENU_OPTION_X_AXIS); |
| 1325 | options->get_popup()->add_radio_check_shortcut(ED_GET_SHORTCUT("grid_map/edit_y_axis"), MENU_OPTION_Y_AXIS); |
| 1326 | options->get_popup()->add_radio_check_shortcut(ED_GET_SHORTCUT("grid_map/edit_z_axis"), MENU_OPTION_Z_AXIS); |
| 1327 | options->get_popup()->set_item_checked(options->get_popup()->get_item_index(MENU_OPTION_Y_AXIS), true); |
| 1328 | options->get_popup()->add_separator(); |
| 1329 | // TRANSLATORS: This is a toggle to select after pasting the new content. |
| 1330 | options->get_popup()->add_shortcut(ED_GET_SHORTCUT("grid_map/clear_rotation"), MENU_OPTION_CURSOR_CLEAR_ROTATION); |
| 1331 | options->get_popup()->add_check_shortcut(ED_GET_SHORTCUT("grid_map/keep_selected"), MENU_OPTION_PASTE_SELECTS); |
| 1332 | options->get_popup()->set_item_checked(options->get_popup()->get_item_index(MENU_OPTION_PASTE_SELECTS), true); |
| 1333 | options->get_popup()->add_separator(); |
| 1334 | options->get_popup()->add_item(TTR("Settings..."), MENU_OPTION_GRIDMAP_SETTINGS); |
| 1335 | |
| 1336 | settings_dialog = memnew(ConfirmationDialog); |
| 1337 | settings_dialog->set_title(TTR("GridMap Settings")); |
| 1338 | add_child(settings_dialog); |
| 1339 | settings_vbc = memnew(VBoxContainer); |
| 1340 | settings_vbc->set_custom_minimum_size(Size2(200, 0) * EDSCALE); |
| 1341 | settings_dialog->add_child(settings_vbc); |
| 1342 | |
| 1343 | settings_pick_distance = memnew(SpinBox); |
| 1344 | settings_pick_distance->set_max(10000.0f); |
| 1345 | settings_pick_distance->set_min(500.0f); |
| 1346 | settings_pick_distance->set_step(1.0f); |
| 1347 | settings_pick_distance->set_value(EDITOR_GET("editors/grid_map/pick_distance")); |
| 1348 | settings_pick_distance->set_accessibility_name(TTRC("Pick Distance:")); |
| 1349 | settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance); |
| 1350 | |
| 1351 | options->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &GridMapEditor::_menu_option)); |
| 1352 | |
| 1353 | toolbar = memnew(HBoxContainer); |
| 1354 | add_child(toolbar); |
| 1355 | toolbar->set_h_size_flags(SIZE_EXPAND_FILL); |
| 1356 | |
| 1357 | HBoxContainer *mode_buttons = memnew(HBoxContainer); |
| 1358 | toolbar->add_child(mode_buttons); |
| 1359 | mode_buttons_group.instantiate(); |
| 1360 | |
| 1361 | viewport_shortcut_buttons.reserve(12); |
| 1362 | |
| 1363 | transform_mode_button = memnew(Button); |
| 1364 | transform_mode_button->set_theme_type_variation(SceneStringName(FlatButton)); |
| 1365 | transform_mode_button->set_toggle_mode(true); |
| 1366 | transform_mode_button->set_button_group(mode_buttons_group); |
| 1367 | transform_mode_button->set_shortcut(ED_SHORTCUT("grid_map/transform_tool", TTRC("Transform"), Key::T, true)); |
| 1368 | transform_mode_button->set_accessibility_name(TTRC("Transform")); |
| 1369 | transform_mode_button->connect(SceneStringName(toggled), |
nothing calls this directly
no test coverage detected