summaryrefslogtreecommitdiff
path: root/modules/gridmap/grid_map_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gridmap/grid_map_editor_plugin.cpp')
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp104
1 files changed, 0 insertions, 104 deletions
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index fc545430f5..e8f7d09bb2 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -40,13 +40,11 @@
#include "scene/main/window.h"
void GridMapEditor::_node_removed(Node *p_node) {
-
if (p_node == node)
node = nullptr;
}
void GridMapEditor::_configure() {
-
if (!node)
return;
@@ -54,9 +52,7 @@ void GridMapEditor::_configure() {
}
void GridMapEditor::_menu_option(int p_option) {
-
switch (p_option) {
-
case MENU_OPTION_PREV_LEVEL: {
floor->set_value(floor->get_value() - 1);
} break;
@@ -66,7 +62,6 @@ void GridMapEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_LOCK_VIEW: {
-
int index = options->get_popup()->get_item_index(MENU_OPTION_LOCK_VIEW);
lock_view = !options->get_popup()->is_item_checked(index);
@@ -75,10 +70,8 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CLIP_DISABLED:
case MENU_OPTION_CLIP_ABOVE:
case MENU_OPTION_CLIP_BELOW: {
-
clip_mode = ClipMode(p_option - MENU_OPTION_CLIP_DISABLED);
for (int i = 0; i < 3; i++) {
-
int index = options->get_popup()->get_item_index(MENU_OPTION_CLIP_DISABLED + i);
options->get_popup()->set_item_checked(index, i == clip_mode);
}
@@ -88,7 +81,6 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_X_AXIS:
case MENU_OPTION_Y_AXIS:
case MENU_OPTION_Z_AXIS: {
-
int new_axis = p_option - MENU_OPTION_X_AXIS;
for (int i = 0; i < 3; i++) {
int idx = options->get_popup()->get_item_index(MENU_OPTION_X_AXIS + i);
@@ -114,10 +106,8 @@ void GridMapEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CURSOR_ROTATE_Y: {
-
Basis r;
if (input_action == INPUT_PASTE) {
-
r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 1, 0), -Math_PI / 2.0);
paste_indicator.orientation = r.get_orthogonal_index();
@@ -131,10 +121,8 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_X: {
-
Basis r;
if (input_action == INPUT_PASTE) {
-
r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(1, 0, 0), -Math_PI / 2.0);
paste_indicator.orientation = r.get_orthogonal_index();
@@ -148,10 +136,8 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_Z: {
-
Basis r;
if (input_action == INPUT_PASTE) {
-
r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 0, 1), -Math_PI / 2.0);
paste_indicator.orientation = r.get_orthogonal_index();
@@ -165,10 +151,8 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
-
Basis r;
if (input_action == INPUT_PASTE) {
-
r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 1, 0), Math_PI / 2.0);
paste_indicator.orientation = r.get_orthogonal_index();
@@ -182,10 +166,8 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
-
Basis r;
if (input_action == INPUT_PASTE) {
-
r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(1, 0, 0), Math_PI / 2.0);
paste_indicator.orientation = r.get_orthogonal_index();
@@ -199,10 +181,8 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
-
Basis r;
if (input_action == INPUT_PASTE) {
-
r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 0, 1), Math_PI / 2.0);
paste_indicator.orientation = r.get_orthogonal_index();
@@ -216,9 +196,7 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_CLEAR_ROTATION: {
-
if (input_action == INPUT_PASTE) {
-
paste_indicator.orientation = 0;
_update_paste_indicator();
break;
@@ -273,7 +251,6 @@ void GridMapEditor::_menu_option(int p_option) {
}
void GridMapEditor::_update_cursor_transform() {
-
cursor_transform = Transform();
cursor_transform.origin = cursor_origin;
cursor_transform.basis.set_orthogonal_index(cursor_rot);
@@ -291,7 +268,6 @@ void GridMapEditor::_update_selection_transform() {
xf_zero.basis.set_zero();
if (!selection.active) {
-
RenderingServer::get_singleton()->instance_set_transform(selection_instance, xf_zero);
for (int i = 0; i < 3; i++) {
RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero);
@@ -309,7 +285,6 @@ void GridMapEditor::_update_selection_transform() {
if (i != edit_axis || (edit_floor[edit_axis] < selection.begin[edit_axis]) || (edit_floor[edit_axis] > selection.end[edit_axis] + 1)) {
RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero);
} else {
-
Vector3 scale = (selection.end - selection.begin + Vector3(1, 1, 1));
scale[edit_axis] = 1.0;
Vector3 pos = selection.begin;
@@ -328,7 +303,6 @@ void GridMapEditor::_update_selection_transform() {
}
void GridMapEditor::_validate_selection() {
-
if (!selection.active)
return;
selection.begin = selection.click;
@@ -345,7 +319,6 @@ void GridMapEditor::_validate_selection() {
}
void GridMapEditor::_set_selection(bool p_active, const Vector3 &p_begin, const Vector3 &p_end) {
-
selection.active = p_active;
selection.begin = p_begin;
selection.end = p_end;
@@ -363,7 +336,6 @@ void GridMapEditor::_set_selection(bool p_active, const Vector3 &p_begin, const
}
bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, bool p_click) {
-
if (!spatial_editor)
return false;
@@ -394,7 +366,6 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
// Make sure the intersection is inside the frustum planes, to avoid
// Painting on invisible regions.
for (int i = 0; i < planes.size(); i++) {
-
Plane fp = local_xform.xform(planes[i]);
if (fp.is_point_over(inters))
return false;
@@ -404,11 +375,9 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
float cell_size[3] = { node->get_cell_size().x, node->get_cell_size().y, node->get_cell_size().z };
for (int i = 0; i < 3; i++) {
-
if (i == edit_axis)
cell[i] = edit_floor[i];
else {
-
cell[i] = inters[i] / node->get_cell_size()[i];
if (inters[i] < 0)
cell[i] -= 1; // Compensate negative.
@@ -419,7 +388,6 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
RS::get_singleton()->instance_set_transform(grid_instance[edit_axis], node->get_global_transform() * edit_grid_xform);
if (cursor_instance.is_valid()) {
-
cursor_origin = (Vector3(cell[0], cell[1], cell[2]) + Vector3(0.5 * node->get_center_x(), 0.5 * node->get_center_y(), 0.5 * node->get_center_z())) * node->get_cell_size();
cursor_visible = true;
@@ -431,12 +399,10 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
}
if (input_action == INPUT_PASTE) {
-
paste_indicator.current = Vector3(cell[0], cell[1], cell[2]);
_update_paste_indicator();
} else if (input_action == INPUT_SELECT) {
-
selection.current = Vector3(cell[0], cell[1], cell[2]);
if (p_click)
selection.click = selection.current;
@@ -445,7 +411,6 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
return true;
} else if (input_action == INPUT_PICK) {
-
int item = node->get_cell_item(cell[0], cell[1], cell[2]);
if (item >= 0) {
selected_palette = item;
@@ -481,17 +446,13 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
}
void GridMapEditor::_delete_selection() {
-
if (!selection.active)
return;
undo_redo->create_action(TTR("GridMap Delete Selection"));
for (int i = selection.begin.x; i <= selection.end.x; i++) {
-
for (int j = selection.begin.y; j <= selection.end.y; j++) {
-
for (int k = selection.begin.z; k <= selection.end.z; k++) {
-
undo_redo->add_do_method(node, "set_cell_item", i, j, k, GridMap::INVALID_CELL_ITEM);
undo_redo->add_undo_method(node, "set_cell_item", i, j, k, node->get_cell_item(i, j, k), node->get_cell_item_orientation(i, j, k));
}
@@ -503,17 +464,13 @@ void GridMapEditor::_delete_selection() {
}
void GridMapEditor::_fill_selection() {
-
if (!selection.active)
return;
undo_redo->create_action(TTR("GridMap Fill Selection"));
for (int i = selection.begin.x; i <= selection.end.x; i++) {
-
for (int j = selection.begin.y; j <= selection.end.y; j++) {
-
for (int k = selection.begin.z; k <= selection.end.z; k++) {
-
undo_redo->add_do_method(node, "set_cell_item", i, j, k, selected_palette, cursor_rot);
undo_redo->add_undo_method(node, "set_cell_item", i, j, k, node->get_cell_item(i, j, k), node->get_cell_item_orientation(i, j, k));
}
@@ -525,9 +482,7 @@ void GridMapEditor::_fill_selection() {
}
void GridMapEditor::_clear_clipboard_data() {
-
for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
-
RenderingServer::get_singleton()->free(E->get().instance);
}
@@ -535,17 +490,13 @@ void GridMapEditor::_clear_clipboard_data() {
}
void GridMapEditor::_set_clipboard_data() {
-
_clear_clipboard_data();
Ref<MeshLibrary> meshLibrary = node->get_mesh_library();
for (int i = selection.begin.x; i <= selection.end.x; i++) {
-
for (int j = selection.begin.y; j <= selection.end.y; j++) {
-
for (int k = selection.begin.z; k <= selection.end.z; k++) {
-
int itm = node->get_cell_item(i, j, k);
if (itm == GridMap::INVALID_CELL_ITEM)
continue;
@@ -565,9 +516,7 @@ void GridMapEditor::_set_clipboard_data() {
}
void GridMapEditor::_update_paste_indicator() {
-
if (input_action != INPUT_PASTE) {
-
Transform xf;
xf.basis.set_zero();
RenderingServer::get_singleton()->instance_set_transform(paste_instance, xf);
@@ -587,7 +536,6 @@ void GridMapEditor::_update_paste_indicator() {
RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
-
ClipboardItem &item = E->get();
xf = Transform();
@@ -604,7 +552,6 @@ void GridMapEditor::_update_paste_indicator() {
}
void GridMapEditor::_do_paste() {
-
int idx = options->get_popup()->get_item_index(MENU_OPTION_PASTE_SELECTS);
bool reselect = options->get_popup()->is_item_checked(idx);
@@ -615,7 +562,6 @@ void GridMapEditor::_do_paste() {
undo_redo->create_action(TTR("GridMap Paste Selection"));
for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
-
ClipboardItem &item = E->get();
Vector3 pos = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
@@ -629,7 +575,6 @@ void GridMapEditor::_do_paste() {
}
if (reselect) {
-
undo_redo->add_do_method(this, "_set_selection", true, paste_indicator.begin + ofs, paste_indicator.end + ofs);
undo_redo->add_undo_method(this, "_set_selection", selection.active, selection.begin, selection.end);
}
@@ -647,7 +592,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
-
if (mb->get_button_index() == BUTTON_WHEEL_UP && (mb->get_command() || mb->get_shift())) {
if (mb->is_pressed())
floor->set_value(floor->get_value() + mb->get_factor());
@@ -664,7 +608,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->get_alt()) {
input_action = INPUT_NONE;
} else if (mb->get_button_index() == BUTTON_LEFT) {
-
bool can_edit = (node && node->get_mesh_library().is_valid());
if (input_action == INPUT_PASTE) {
_do_paste();
@@ -698,18 +641,14 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true);
} else {
-
if ((mb->get_button_index() == BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_PAINT)) {
-
if (set_items.size()) {
undo_redo->create_action(TTR("GridMap Paint"));
for (List<SetItem>::Element *E = set_items.front(); E; E = E->next()) {
-
const SetItem &si = E->get();
undo_redo->add_do_method(node, "set_cell_item", si.pos.x, si.pos.y, si.pos.z, si.new_value, si.new_orientation);
}
for (List<SetItem>::Element *E = set_items.back(); E; E = E->prev()) {
-
const SetItem &si = E->get();
undo_redo->add_undo_method(node, "set_cell_item", si.pos.x, si.pos.y, si.pos.z, si.old_value, si.old_orientation);
}
@@ -722,7 +661,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
}
if (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_SELECT) {
-
undo_redo->create_action("GridMap Selection");
undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
@@ -730,7 +668,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
}
if (mb->get_button_index() == BUTTON_LEFT && input_action != INPUT_NONE) {
-
set_items.clear();
input_action = INPUT_NONE;
return true;
@@ -745,7 +682,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) {
-
return do_input_action(p_camera, mm->get_position(), false);
}
@@ -754,7 +690,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
if (k.is_valid()) {
if (k->is_pressed()) {
if (k->get_keycode() == KEY_ESCAPE) {
-
if (input_action == INPUT_PASTE) {
_clear_clipboard_data();
input_action = INPUT_NONE;
@@ -773,7 +708,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
}
if (k->get_shift() && selection.active && input_action != INPUT_PASTE) {
-
if (k->get_keycode() == options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_PREV_LEVEL))) {
selection.click[edit_axis]--;
_validate_selection();
@@ -790,7 +724,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
Ref<InputEventPanGesture> pan_gesture = p_event;
if (pan_gesture.is_valid()) {
-
if (pan_gesture->get_alt() && (pan_gesture->get_command() || pan_gesture->get_shift())) {
const real_t delta = pan_gesture->get_delta().y * 0.5;
accumulated_floor_delta += delta;
@@ -811,7 +744,6 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
}
struct _CGMEItemSort {
-
String name;
int id;
_FORCE_INLINE_ bool operator<(const _CGMEItemSort &r_it) const { return name < r_it.name; }
@@ -840,11 +772,9 @@ void GridMapEditor::_text_changed(const String &p_text) {
}
void GridMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
-
const Ref<InputEventKey> k = p_ie;
if (k.is_valid() && (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_PAGEUP || k->get_keycode() == KEY_PAGEDOWN)) {
-
// Forward the key input to the ItemList so it can be scrolled
mesh_library_palette->call("_gui_input", k);
search_box->accept_event();
@@ -852,12 +782,10 @@ void GridMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
}
void GridMapEditor::_mesh_library_palette_input(const Ref<InputEvent> &p_ie) {
-
const Ref<InputEventMouseButton> mb = p_ie;
// Zoom in/out using Ctrl + mouse wheel
if (mb.is_valid() && mb->is_pressed() && mb->get_command()) {
-
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) {
size_slider->set_value(size_slider->get_value() + 0.2);
}
@@ -911,7 +839,6 @@ void GridMapEditor::update_palette() {
List<_CGMEItemSort> il;
for (int i = 0; i < ids.size(); i++) {
-
_CGMEItemSort is;
is.id = ids[i];
is.name = mesh_library->get_item_name(ids[i]);
@@ -993,7 +920,6 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
}
void GridMapEditor::_update_clip() {
-
node->set_meta("_editor_clip_", clip_mode);
if (clip_mode == CLIP_DISABLED)
node->set_clip(false);
@@ -1002,7 +928,6 @@ void GridMapEditor::_update_clip() {
}
void GridMapEditor::update_grid() {
-
grid_xform.origin.x -= 1; // Force update in hackish way.
grid_ofs[edit_axis] = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
@@ -1031,7 +956,6 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) {
Vector<Color> grid_colors[3];
for (int i = 0; i < 3; i++) {
-
Vector3 axis;
axis[i] = 1;
Vector3 axis_n1;
@@ -1040,9 +964,7 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) {
axis_n2[(i + 2) % 3] = cell_size[(i + 2) % 3];
for (int j = -GRID_CURSOR_SIZE; j <= GRID_CURSOR_SIZE; j++) {
-
for (int k = -GRID_CURSOR_SIZE; k <= GRID_CURSOR_SIZE; k++) {
-
Vector3 p = axis_n1 * j + axis_n2 * k;
float trans = Math::pow(MAX(0, 1.0 - (Vector2(j, k).length() / GRID_CURSOR_SIZE)), 2);
@@ -1074,14 +996,11 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) {
}
void GridMapEditor::_notification(int p_what) {
-
switch (p_what) {
-
case NOTIFICATION_ENTER_TREE: {
get_tree()->connect("node_removed", callable_mp(this, &GridMapEditor::_node_removed));
mesh_library_palette->connect("item_selected", callable_mp(this, &GridMapEditor::_item_selected_cbk));
for (int i = 0; i < 3; i++) {
-
grid[i] = RS::get_singleton()->mesh_create();
grid_instance[i] = RS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world_3d()->get_scenario());
selection_level_instance[i] = RenderingServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world_3d()->get_scenario());
@@ -1099,7 +1018,6 @@ void GridMapEditor::_notification(int p_what) {
_clear_clipboard_data();
for (int i = 0; i < 3; i++) {
-
RS::get_singleton()->free(grid_instance[i]);
RS::get_singleton()->free(grid[i]);
grid_instance[i] = RID();
@@ -1122,7 +1040,6 @@ void GridMapEditor::_notification(int p_what) {
if (xf != grid_xform) {
for (int i = 0; i < 3; i++) {
-
RS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform);
}
grid_xform = xf;
@@ -1132,7 +1049,6 @@ void GridMapEditor::_notification(int p_what) {
update_palette();
if (lock_view) {
-
EditorNode *editor = Object::cast_to<EditorNode>(get_tree()->get_root()->get_child(0));
Plane p;
@@ -1163,11 +1079,9 @@ void GridMapEditor::_update_cursor_instance() {
cursor_instance = RID();
if (selected_palette >= 0) {
-
if (node && !node->get_mesh_library().is_null()) {
Ref<Mesh> mesh = node->get_mesh_library()->get_item_mesh(selected_palette);
if (!mesh.is_null() && mesh->get_rid().is_valid()) {
-
cursor_instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world_3d()->get_scenario());
RenderingServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform);
}
@@ -1182,7 +1096,6 @@ void GridMapEditor::_item_selected_cbk(int idx) {
}
void GridMapEditor::_floor_changed(float p_value) {
-
if (updating)
return;
@@ -1198,13 +1111,11 @@ void GridMapEditor::_floor_mouse_exited() {
}
void GridMapEditor::_bind_methods() {
-
ClassDB::bind_method("_configure", &GridMapEditor::_configure);
ClassDB::bind_method("_set_selection", &GridMapEditor::_set_selection);
}
GridMapEditor::GridMapEditor(EditorNode *p_editor) {
-
input_action = INPUT_NONE;
editor = p_editor;
undo_redo = p_editor->get_undo_redo();
@@ -1364,18 +1275,15 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
Vector<Vector3> square[3];
for (int i = 0; i < 6; i++) {
-
Vector3 face_points[4];
for (int j = 0; j < 4; j++) {
-
float v[3];
v[0] = 1.0;
v[1] = 1 - 2 * ((j >> 1) & 1);
v[2] = v[1] * (1 - 2 * (j & 1));
for (int k = 0; k < 3; k++) {
-
if (i < 3)
face_points[j][(i + k) % 3] = v[k];
else
@@ -1393,7 +1301,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
}
for (int i = 0; i < 12; i++) {
-
AABB base(Vector3(0, 0, 0), Vector3(1, 1, 1));
Vector3 a, b;
base.get_edge(i, a, b);
@@ -1404,7 +1311,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
for (int i = 0; i < 3; i++) {
Vector3 points[4];
for (int j = 0; j < 4; j++) {
-
static const bool orderx[4] = { false, true, true, false };
static const bool ordery[4] = { false, false, true, true };
@@ -1420,7 +1326,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
}
for (int j = 0; j < 4; j++) {
-
Vector3 ofs;
ofs[i] += 0.01;
square[i].push_back(points[j] - ofs);
@@ -1487,11 +1392,9 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
}
GridMapEditor::~GridMapEditor() {
-
_clear_clipboard_data();
for (int i = 0; i < 3; i++) {
-
if (grid[i].is_valid())
RenderingServer::get_singleton()->free(grid[i]);
if (grid_instance[i].is_valid())
@@ -1514,9 +1417,7 @@ GridMapEditor::~GridMapEditor() {
}
void GridMapEditorPlugin::_notification(int p_what) {
-
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
-
switch ((int)EditorSettings::get_singleton()->get("editors/grid_map/editor_side")) {
case 0: { // Left.
Node3DEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 0);
@@ -1529,23 +1430,19 @@ void GridMapEditorPlugin::_notification(int p_what) {
}
void GridMapEditorPlugin::edit(Object *p_object) {
-
grid_map_editor->edit(Object::cast_to<GridMap>(p_object));
}
bool GridMapEditorPlugin::handles(Object *p_object) const {
-
return p_object->is_class("GridMap");
}
void GridMapEditorPlugin::make_visible(bool p_visible) {
-
if (p_visible) {
grid_map_editor->show();
grid_map_editor->spatial_editor_hb->show();
grid_map_editor->set_process(true);
} else {
-
grid_map_editor->spatial_editor_hb->hide();
grid_map_editor->hide();
grid_map_editor->edit(nullptr);
@@ -1554,7 +1451,6 @@ void GridMapEditorPlugin::make_visible(bool p_visible) {
}
GridMapEditorPlugin::GridMapEditorPlugin(EditorNode *p_node) {
-
editor = p_node;
EDITOR_DEF("editors/grid_map/editor_side", 1);