Lines saving works
This commit is contained in:
+1043
-851
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,8 @@
|
|||||||
#include <scene/3d/camera.h>
|
#include <scene/3d/camera.h>
|
||||||
#include <core/io/config_file.h>
|
#include <core/io/config_file.h>
|
||||||
#include <core/os/file_access.h>
|
#include <core/os/file_access.h>
|
||||||
|
#include <core/os/dir_access.h>
|
||||||
|
#include <core/os/time.h>
|
||||||
#include <core/io/json.h>
|
#include <core/io/json.h>
|
||||||
#include <modules/regex/regex.h>
|
#include <modules/regex/regex.h>
|
||||||
#include "world_editor.h"
|
#include "world_editor.h"
|
||||||
@@ -454,7 +456,7 @@ bool RoadLinesEditor::line_exists(const String &line_name)
|
|||||||
|
|
||||||
void RoadLinesEditor::line_create_point()
|
void RoadLinesEditor::line_create_point()
|
||||||
{
|
{
|
||||||
/* TODO: Create point in line */
|
/* Create point in line */
|
||||||
print_line("line_create_point");
|
print_line("line_create_point");
|
||||||
Vector3 position = get_cursor_position();
|
Vector3 position = get_cursor_position();
|
||||||
Transform xform(Basis(), position);
|
Transform xform(Basis(), position);
|
||||||
@@ -470,7 +472,7 @@ void RoadLinesEditor::line_create_point()
|
|||||||
|
|
||||||
void RoadLinesEditor::line_delete_point()
|
void RoadLinesEditor::line_delete_point()
|
||||||
{
|
{
|
||||||
/* TODO: Delete point from line */
|
/* Delete point from line */
|
||||||
print_line("line_delete_point");
|
print_line("line_delete_point");
|
||||||
int index = get_line_index();
|
int index = get_line_index();
|
||||||
if (lines[current_line].points.size() < 2)
|
if (lines[current_line].points.size() < 2)
|
||||||
@@ -820,7 +822,6 @@ void RoadLinesEditor::load_data()
|
|||||||
}
|
}
|
||||||
void RoadLinesEditor::save_data()
|
void RoadLinesEditor::save_data()
|
||||||
{
|
{
|
||||||
// TODO: implement
|
|
||||||
int i;
|
int i;
|
||||||
ConfigFile config;
|
ConfigFile config;
|
||||||
Error result = config.load("res://config/stream.conf");
|
Error result = config.load("res://config/stream.conf");
|
||||||
@@ -850,9 +851,19 @@ void RoadLinesEditor::save_data()
|
|||||||
e = e->next();
|
e = e->next();
|
||||||
}
|
}
|
||||||
print_line(JSON::print(output, "\t", false));
|
print_line(JSON::print(output, "\t", false));
|
||||||
Error err;
|
Error err = OK;
|
||||||
FileAccess *fd = FileAccess::open(road_lines_path + ".n",
|
if (FileAccess::exists(road_lines_path)) {
|
||||||
FileAccess::WRITE, &err);
|
DirAccess *dir = DirAccess::open("res:///", &err);
|
||||||
|
assert(dir && err == OK);
|
||||||
|
err = dir->copy(
|
||||||
|
road_lines_path,
|
||||||
|
road_lines_path + "." +
|
||||||
|
String::num(
|
||||||
|
Time::get_singleton()
|
||||||
|
->get_unix_time_from_system()));
|
||||||
|
}
|
||||||
|
FileAccess *fd =
|
||||||
|
FileAccess::open(road_lines_path, FileAccess::WRITE, &err);
|
||||||
if (err == OK) {
|
if (err == OK) {
|
||||||
fd->store_string(JSON::print(output, "\t", false));
|
fd->store_string(JSON::print(output, "\t", false));
|
||||||
fd->close();
|
fd->close();
|
||||||
|
|||||||
Reference in New Issue
Block a user