MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _menu_option

Method _menu_option

modules/gridmap/editor/grid_map_editor_plugin.cpp:67–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void GridMapEditor::_menu_option(int p_option) {
68 switch (p_option) {
69 case MENU_OPTION_PREV_LEVEL: {
70 floor->set_value(floor->get_value() - 1);
71 if (selection.active && input_action == INPUT_SELECT) {
72 selection.current[edit_axis]--;
73 _validate_selection();
74 }
75 } break;
76
77 case MENU_OPTION_NEXT_LEVEL: {
78 floor->set_value(floor->get_value() + 1);
79 if (selection.active && input_action == INPUT_SELECT) {
80 selection.current[edit_axis]++;
81 _validate_selection();
82 }
83 } break;
84
85 case MENU_OPTION_X_AXIS:
86 case MENU_OPTION_Y_AXIS:
87 case MENU_OPTION_Z_AXIS: {
88 int new_axis = p_option - MENU_OPTION_X_AXIS;
89 for (int i = 0; i < 3; i++) {
90 int idx = options->get_popup()->get_item_index(MENU_OPTION_X_AXIS + i);
91 options->get_popup()->set_item_checked(idx, i == new_axis);
92 }
93
94 if (edit_axis != new_axis) {
95 if (edit_axis == Vector3::AXIS_Y) {
96 floor->set_tooltip_text("Change Grid Plane");
97 } else if (new_axis == Vector3::AXIS_Y) {
98 floor->set_tooltip_text("Change Grid Floor");
99 }
100 }
101 edit_axis = Vector3::Axis(new_axis);
102 update_grid();
103
104 } break;
105
106 case MENU_OPTION_CURSOR_ROTATE_X:
107 case MENU_OPTION_CURSOR_ROTATE_Y:
108 case MENU_OPTION_CURSOR_ROTATE_Z:
109 case MENU_OPTION_CURSOR_BACK_ROTATE_X:
110 case MENU_OPTION_CURSOR_BACK_ROTATE_Y:
111 case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
112 Vector3 rotation_axis;
113 float rotation_angle = -Math::PI / 2.0;
114 if (p_option == MENU_OPTION_CURSOR_ROTATE_X || p_option == MENU_OPTION_CURSOR_BACK_ROTATE_X) {
115 rotation_axis.x = (p_option == MENU_OPTION_CURSOR_ROTATE_X) ? 1 : -1;
116 } else if (p_option == MENU_OPTION_CURSOR_ROTATE_Y || p_option == MENU_OPTION_CURSOR_BACK_ROTATE_Y) {
117 rotation_axis.y = (p_option == MENU_OPTION_CURSOR_ROTATE_Y) ? 1 : -1;
118 } else if (p_option == MENU_OPTION_CURSOR_ROTATE_Z || p_option == MENU_OPTION_CURSOR_BACK_ROTATE_Z) {
119 rotation_axis.z = (p_option == MENU_OPTION_CURSOR_ROTATE_Z) ? 1 : -1;
120 }
121
122 Basis r;
123 if (input_action == INPUT_PASTE) {
124 r = node->get_basis_with_orthogonal_index(paste_indicator.orientation);

Callers

nothing calls this directly

Calls 15

set_cell_itemMethod · 0.80
get_cell_itemMethod · 0.80
popup_centeredMethod · 0.80
sizeMethod · 0.65
AxisEnum · 0.50
set_valueMethod · 0.45
get_valueMethod · 0.45
get_item_indexMethod · 0.45

Tested by

no test coverage detected