Fixed reactivation problems

This commit is contained in:
2024-08-28 16:41:02 +03:00
parent 7486334c04
commit bbb13546b1
9 changed files with 310 additions and 15 deletions

View File

@@ -8,6 +8,7 @@
#include <scene/main/viewport.h>
#include <scene/3d/camera.h>
#include <scene/scene_string_names.h>
#include "road_lines_editor.h"
#include "world_editor.h"
WorldEditor::WorldEditor()
@@ -20,6 +21,7 @@ WorldEditor::WorldEditor()
, old_mouse_pos(Vector2(-1, -1))
, dragging(false)
, drag_delay(0.2f)
, road_lines_editor(memnew(RoadLinesEditor(this)))
{
if (!InputMap::get_singleton()->has_action("left"))
InputMap::get_singleton()->add_action("left");
@@ -45,6 +47,7 @@ WorldEditor::WorldEditor()
WorldEditor::~WorldEditor()
{
memdelete(road_lines_editor);
}
void WorldEditor::set_camera_mode(int mode)
@@ -158,6 +161,11 @@ void WorldEditor::tools_button(const String &button)
change[0] = current_mode;
change[1] = modes[button];
emit_signal("editor_event", "mode_change_pre", change);
switch (current_mode) {
case MODE_ROAD_LINES:
road_lines_editor->exit();
break;
}
switch (modes[button]) {
case MODE_BUILDINGS:
mode_buildings();
@@ -195,11 +203,11 @@ void WorldEditor::editor_command(const String &command, const Array &args)
if (stream_world) {
stream_world->run_command(command, args);
}
} else if (command == "buildings_checkpoint") {
} else if (command == "checkpoint") {
if (stream_world) {
stream_world->run_command(command, args);
}
} else if (command == "buildings_undo") {
} else if (command == "undo") {
if (stream_world) {
stream_world->run_command(command, args);
}
@@ -215,6 +223,8 @@ void WorldEditor::editor_command(const String &command, const Array &args)
if (stream_world) {
stream_world->run_command(command, args);
}
} else if (road_lines_editor) {
road_lines_editor->editor_command(command, args);
}
}
@@ -333,6 +343,12 @@ void WorldEditor::_notification(int which)
}
if (!dragging && drag_delay >= 0.0f)
drag_delay -= delta;
switch (current_mode) {
case MODE_ROAD_LINES:
print_line("current_mode: " + itos(current_mode));
road_lines_editor->update(delta);
break;
}
} break;
}
}