Implemented metadata editor. closes #19
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -48,3 +48,13 @@ road_lines_path = "res://astream/road_lines.json"
|
|||||||
center_mesh = "res://astream/road/road-lanes_road-lane-center.mesh"
|
center_mesh = "res://astream/road/road-lanes_road-lane-center.mesh"
|
||||||
mid_mesh = "res://astream/road/road-lanes_road-lane-mid.mesh"
|
mid_mesh = "res://astream/road/road-lanes_road-lane-mid.mesh"
|
||||||
sidewalk_mesh = "res://astream/road/road-lanes_road-sidewalk.mesh"
|
sidewalk_mesh = "res://astream/road/road-lanes_road-sidewalk.mesh"
|
||||||
|
[lines]
|
||||||
|
road_lines_path = "res://astream/road_lines.json"
|
||||||
|
gen_prefixes = ["empty", "foundation30", "foundation60", "sideroad-start",
|
||||||
|
"terrain-parking", "residental-house",
|
||||||
|
"terrain-navigation", "power-pole", "zebra",
|
||||||
|
"terrain-road-segment",
|
||||||
|
"terrain-road-segment-long",
|
||||||
|
"business-store",
|
||||||
|
"business-bar", "business-cafe", "empty", "bus-stop"
|
||||||
|
]
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ text = "NPC Mode"
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_top = 154.0
|
margin_top = 154.0
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
margin_bottom = 274.0
|
margin_bottom = 298.0
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_buildings"]
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_buildings"]
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
@@ -155,18 +155,25 @@ margin_top = 92.0
|
|||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
margin_bottom = 96.0
|
margin_bottom = 96.0
|
||||||
|
|
||||||
[node name="buildings_save" type="Button" parent="VBoxContainer/v_buildings"]
|
[node name="buildings_delete_building" type="Button" parent="VBoxContainer/v_buildings"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_top = 100.0
|
margin_top = 100.0
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
margin_bottom = 120.0
|
margin_bottom = 120.0
|
||||||
|
text = "Delete building"
|
||||||
|
|
||||||
|
[node name="buildings_save" type="Button" parent="VBoxContainer/v_buildings"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_top = 124.0
|
||||||
|
margin_right = 232.0
|
||||||
|
margin_bottom = 144.0
|
||||||
text = "Save Buildings"
|
text = "Save Buildings"
|
||||||
|
|
||||||
[node name="v_navigation" type="VBoxContainer" parent="VBoxContainer"]
|
[node name="v_navigation" type="VBoxContainer" parent="VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_top = 278.0
|
margin_top = 302.0
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
margin_bottom = 300.0
|
margin_bottom = 324.0
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_navigation"]
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_navigation"]
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
@@ -180,9 +187,9 @@ text = "Navigation mode"
|
|||||||
|
|
||||||
[node name="v_poi" type="VBoxContainer" parent="VBoxContainer"]
|
[node name="v_poi" type="VBoxContainer" parent="VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_top = 304.0
|
margin_top = 328.0
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
margin_bottom = 326.0
|
margin_bottom = 350.0
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_poi"]
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_poi"]
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
@@ -196,9 +203,9 @@ text = "POI mode"
|
|||||||
|
|
||||||
[node name="v_road_lines" type="VBoxContainer" parent="VBoxContainer"]
|
[node name="v_road_lines" type="VBoxContainer" parent="VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_top = 330.0
|
margin_top = 354.0
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
margin_bottom = 712.0
|
margin_bottom = 962.0
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_road_lines"]
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_road_lines"]
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
@@ -255,7 +262,7 @@ margin_right = 167.0
|
|||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
text = "Line"
|
text = "Line"
|
||||||
items = [ "Create", null, 0, false, false, 21, 0, null, "", false, "Delete", null, 0, false, false, 22, 0, null, "", false ]
|
items = [ "Create", null, 0, false, false, 21, 0, null, "", false, "Delete", null, 0, false, false, 22, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Remove Generated", null, 0, false, false, 30, 0, null, "", false, "Edit Line Metadata", null, 0, false, false, 23, 0, null, "", false ]
|
||||||
|
|
||||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||||
margin_top = 24.0
|
margin_top = 24.0
|
||||||
@@ -420,11 +427,44 @@ margin_right = 218.0
|
|||||||
margin_bottom = 48.0
|
margin_bottom = 48.0
|
||||||
text = "Cancel"
|
text = "Cancel"
|
||||||
|
|
||||||
|
[node name="road_lines_edit_metadata_dlg" type="PanelContainer" parent="VBoxContainer/v_road_lines"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_top = 386.0
|
||||||
|
margin_right = 232.0
|
||||||
|
margin_bottom = 608.0
|
||||||
|
|
||||||
|
[node name="v" type="VBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg"]
|
||||||
|
margin_left = 7.0
|
||||||
|
margin_top = 7.0
|
||||||
|
margin_right = 225.0
|
||||||
|
margin_bottom = 215.0
|
||||||
|
|
||||||
|
[node name="road_lines_metadata_edit" type="TextEdit" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/v"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_right = 218.0
|
||||||
|
margin_bottom = 160.0
|
||||||
|
rect_min_size = Vector2( 0, 160 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="road_lines_metadata_update" type="Button" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/v"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_top = 164.0
|
||||||
|
margin_right = 218.0
|
||||||
|
margin_bottom = 184.0
|
||||||
|
text = "Update"
|
||||||
|
|
||||||
|
[node name="road_lines_metadata_cancel" type="Button" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/v"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_top = 188.0
|
||||||
|
margin_right = 218.0
|
||||||
|
margin_bottom = 208.0
|
||||||
|
text = "Cancel"
|
||||||
|
|
||||||
[node name="v_npc" type="VBoxContainer" parent="VBoxContainer"]
|
[node name="v_npc" type="VBoxContainer" parent="VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_top = 716.0
|
margin_top = 966.0
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
margin_bottom = 738.0
|
margin_bottom = 988.0
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_npc"]
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_npc"]
|
||||||
margin_right = 232.0
|
margin_right = 232.0
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <scene/gui/item_list.h>
|
#include <scene/gui/item_list.h>
|
||||||
#include <scene/gui/button.h>
|
#include <scene/gui/button.h>
|
||||||
#include <scene/gui/line_edit.h>
|
#include <scene/gui/line_edit.h>
|
||||||
|
#include <scene/gui/text_edit.h>
|
||||||
#include <scene/gui/spin_box.h>
|
#include <scene/gui/spin_box.h>
|
||||||
#include <scene/gui/menu_button.h>
|
#include <scene/gui/menu_button.h>
|
||||||
#include <scene/3d/immediate_geometry.h>
|
#include <scene/3d/immediate_geometry.h>
|
||||||
@@ -236,17 +237,41 @@ public:
|
|||||||
"%road_lines_create_new_cancel");
|
"%road_lines_create_new_cancel");
|
||||||
LineEdit *line_name = editor->get_as_node<LineEdit>(
|
LineEdit *line_name = editor->get_as_node<LineEdit>(
|
||||||
"%road_lines_create_new_line_name");
|
"%road_lines_create_new_line_name");
|
||||||
|
Button *cancel_metadata_button = editor->get_as_node<Button>(
|
||||||
|
"%road_lines_metadata_cancel");
|
||||||
|
Button *update_metadata_button = editor->get_as_node<Button>(
|
||||||
|
"%road_lines_metadata_update");
|
||||||
|
TextEdit *metadata_edit = editor->get_as_node<TextEdit>(
|
||||||
|
"%road_lines_metadata_edit");
|
||||||
cancel_button->connect("pressed", this, "cancel_handler");
|
cancel_button->connect("pressed", this, "cancel_handler");
|
||||||
line_name->connect("text_entered", this, "entered_handler");
|
line_name->connect("text_entered", this, "entered_handler");
|
||||||
line_name->connect("text_changed", this, "changed_handler");
|
line_name->connect("text_changed", this, "changed_handler");
|
||||||
|
cancel_metadata_button->connect("pressed", this,
|
||||||
|
"cancel_metadata_handler");
|
||||||
|
update_metadata_button->connect("pressed", this,
|
||||||
|
"update_metadata_handler");
|
||||||
|
metadata_edit->connect("text_changed", this,
|
||||||
|
"metadata_changed_handler");
|
||||||
}
|
}
|
||||||
virtual ~HandleCreateNewLine()
|
virtual ~HandleCreateNewLine()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
TextEdit *metadata_edit = editor->get_as_node<TextEdit>(
|
||||||
|
"%road_lines_metadata_edit");
|
||||||
|
Button *update_metadata_button = editor->get_as_node<Button>(
|
||||||
|
"%road_lines_metadata_update");
|
||||||
|
Button *cancel_metadata_button = editor->get_as_node<Button>(
|
||||||
|
"%road_lines_metadata_cancel");
|
||||||
Button *cancel_button = editor->get_as_node<Button>(
|
Button *cancel_button = editor->get_as_node<Button>(
|
||||||
"%road_lines_create_new_cancel");
|
"%road_lines_create_new_cancel");
|
||||||
LineEdit *line_name = editor->get_as_node<LineEdit>(
|
LineEdit *line_name = editor->get_as_node<LineEdit>(
|
||||||
"%road_lines_create_new_line_name");
|
"%road_lines_create_new_line_name");
|
||||||
|
metadata_edit->disconnect("text_changed", this,
|
||||||
|
"metadata_changed_handler");
|
||||||
|
update_metadata_button->disconnect("pressed", this,
|
||||||
|
"update_metadata_handler");
|
||||||
|
cancel_metadata_button->disconnect("pressed", this,
|
||||||
|
"cancel_metadata_handler");
|
||||||
line_name->disconnect("text_changed", this, "changed_handler");
|
line_name->disconnect("text_changed", this, "changed_handler");
|
||||||
line_name->disconnect("text_entered", this, "entered_handler");
|
line_name->disconnect("text_entered", this, "entered_handler");
|
||||||
cancel_button->disconnect("pressed", this, "cancel_handler");
|
cancel_button->disconnect("pressed", this, "cancel_handler");
|
||||||
@@ -264,6 +289,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void update_metadata_editor()
|
||||||
|
{
|
||||||
|
TextEdit *metadata_edit = editor->get_as_node<TextEdit>(
|
||||||
|
"%road_lines_metadata_edit");
|
||||||
|
String text = editor->get_current_line_metadata();
|
||||||
|
metadata_edit->set_text(text);
|
||||||
|
}
|
||||||
void main_handler(int id)
|
void main_handler(int id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
@@ -284,6 +316,14 @@ protected:
|
|||||||
/* delete line */
|
/* delete line */
|
||||||
editor->delete_current_line();
|
editor->delete_current_line();
|
||||||
break;
|
break;
|
||||||
|
case 23:
|
||||||
|
/* edit line metadata */
|
||||||
|
editor->get_as_node<Control>("%road_lines_base")->hide();
|
||||||
|
editor->get_as_node<Control>(
|
||||||
|
"%road_lines_edit_metadata_dlg")
|
||||||
|
->show();
|
||||||
|
update_metadata_editor();
|
||||||
|
break;
|
||||||
case 51:
|
case 51:
|
||||||
editor->set_point_to_cursor();
|
editor->set_point_to_cursor();
|
||||||
break;
|
break;
|
||||||
@@ -344,6 +384,50 @@ protected:
|
|||||||
} else
|
} else
|
||||||
line_name->remove_color_override("font_color");
|
line_name->remove_color_override("font_color");
|
||||||
}
|
}
|
||||||
|
void cancel_metadata_handler()
|
||||||
|
{
|
||||||
|
TextEdit *metadata_text = editor->get_as_node<TextEdit>(
|
||||||
|
"%road_lines_metadata_edit");
|
||||||
|
editor->get_as_node<Control>("%road_lines_base")->show();
|
||||||
|
editor->get_as_node<Control>("%road_lines_edit_metadata_dlg")
|
||||||
|
->hide();
|
||||||
|
metadata_text->set_text("");
|
||||||
|
}
|
||||||
|
void update_metadata_handler()
|
||||||
|
{
|
||||||
|
TextEdit *metadata_text = editor->get_as_node<TextEdit>(
|
||||||
|
"%road_lines_metadata_edit");
|
||||||
|
editor->get_as_node<Control>("%road_lines_base")->show();
|
||||||
|
editor->get_as_node<Control>("%road_lines_edit_metadata_dlg")
|
||||||
|
->hide();
|
||||||
|
editor->update_current_line_metadata(metadata_text->get_text());
|
||||||
|
metadata_text->set_text("");
|
||||||
|
}
|
||||||
|
bool check_metadata(const String &text)
|
||||||
|
{
|
||||||
|
if (!text.begins_with("{"))
|
||||||
|
return false;
|
||||||
|
Variant p;
|
||||||
|
String err_s;
|
||||||
|
int line;
|
||||||
|
// TODO: create status string for errors
|
||||||
|
Error err = JSON::parse(text, p, err_s, line);
|
||||||
|
return (err == OK);
|
||||||
|
}
|
||||||
|
/* Unlike LineEdit, no arguments */
|
||||||
|
void metadata_changed_handler()
|
||||||
|
{
|
||||||
|
TextEdit *metadata_text = editor->get_as_node<TextEdit>(
|
||||||
|
"%road_lines_metadata_edit");
|
||||||
|
String new_text = metadata_text->get_text();
|
||||||
|
String text = new_text.strip_edges();
|
||||||
|
if (!check_metadata(text)) {
|
||||||
|
metadata_text->add_color_override(
|
||||||
|
"font_color", Color(1.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
metadata_text->remove_color_override("font_color");
|
||||||
|
}
|
||||||
static void _bind_methods()
|
static void _bind_methods()
|
||||||
{
|
{
|
||||||
ClassDB::bind_method(D_METHOD("main_handler", "id"),
|
ClassDB::bind_method(D_METHOD("main_handler", "id"),
|
||||||
@@ -354,6 +438,15 @@ protected:
|
|||||||
&HandleCreateNewLine::entered_handler);
|
&HandleCreateNewLine::entered_handler);
|
||||||
ClassDB::bind_method(D_METHOD("changed_handler", "new_text"),
|
ClassDB::bind_method(D_METHOD("changed_handler", "new_text"),
|
||||||
&HandleCreateNewLine::changed_handler);
|
&HandleCreateNewLine::changed_handler);
|
||||||
|
ClassDB::bind_method(
|
||||||
|
D_METHOD("cancel_metadata_handler"),
|
||||||
|
&HandleCreateNewLine::cancel_metadata_handler);
|
||||||
|
ClassDB::bind_method(
|
||||||
|
D_METHOD("update_metadata_handler"),
|
||||||
|
&HandleCreateNewLine::update_metadata_handler);
|
||||||
|
ClassDB::bind_method(
|
||||||
|
D_METHOD("metadata_changed_handler"),
|
||||||
|
&HandleCreateNewLine::metadata_changed_handler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -588,6 +681,7 @@ void RoadLinesEditor::update_ui()
|
|||||||
{
|
{
|
||||||
get_as_node<Control>("%road_lines_base")->show();
|
get_as_node<Control>("%road_lines_base")->show();
|
||||||
get_as_node<Control>("%road_lines_create_new_line_dlg")->hide();
|
get_as_node<Control>("%road_lines_create_new_line_dlg")->hide();
|
||||||
|
get_as_node<Control>("%road_lines_edit_metadata_dlg")->hide();
|
||||||
ItemList *lines_list = get_as_node<ItemList>("%lines_list");
|
ItemList *lines_list = get_as_node<ItemList>("%lines_list");
|
||||||
List<String> line_keys;
|
List<String> line_keys;
|
||||||
lines.get_key_list(&line_keys);
|
lines.get_key_list(&line_keys);
|
||||||
@@ -780,7 +874,7 @@ void RoadLinesEditor::load_data()
|
|||||||
ConfigFile config;
|
ConfigFile config;
|
||||||
Error result = config.load("res://config/stream.conf");
|
Error result = config.load("res://config/stream.conf");
|
||||||
ERR_FAIL_COND_MSG(result != OK, "Failed to load config");
|
ERR_FAIL_COND_MSG(result != OK, "Failed to load config");
|
||||||
String road_lines_path = config.get_value("road", "road_lines_path");
|
String road_lines_path = config.get_value("lines", "road_lines_path");
|
||||||
String road_lines_json =
|
String road_lines_json =
|
||||||
FileAccess::get_file_as_string(road_lines_path);
|
FileAccess::get_file_as_string(road_lines_path);
|
||||||
Variant json_v;
|
Variant json_v;
|
||||||
@@ -843,14 +937,14 @@ void RoadLinesEditor::save_data()
|
|||||||
for (i = 0; i < (int)lines[e->get()].indices.size(); i++)
|
for (i = 0; i < (int)lines[e->get()].indices.size(); i++)
|
||||||
indices[i] = lines[e->get()].indices[i];
|
indices[i] = lines[e->get()].indices[i];
|
||||||
pvalues["points"] = points;
|
pvalues["points"] = points;
|
||||||
pvalues["indices"] = indices;
|
// pvalues["indices"] = indices;
|
||||||
pvalues["metadata"] = lines[e->get()].metadata;
|
pvalues["metadata"] = lines[e->get()].metadata;
|
||||||
pvalues["lanes"] = lines[e->get()].lanes;
|
pvalues["lanes"] = lines[e->get()].lanes;
|
||||||
pvalues["pattern"] = lines[e->get()].pattern;
|
pvalues["pattern"] = lines[e->get()].pattern;
|
||||||
output[e->get()] = pvalues;
|
output[e->get()] = pvalues;
|
||||||
e = e->next();
|
e = e->next();
|
||||||
}
|
}
|
||||||
print_line(JSON::print(output, "\t", false));
|
print_verbose(JSON::print(output, "\t", false));
|
||||||
Error err = OK;
|
Error err = OK;
|
||||||
if (FileAccess::exists(road_lines_path)) {
|
if (FileAccess::exists(road_lines_path)) {
|
||||||
DirAccess *dir = DirAccess::open("res:///", &err);
|
DirAccess *dir = DirAccess::open("res:///", &err);
|
||||||
@@ -869,6 +963,31 @@ void RoadLinesEditor::save_data()
|
|||||||
fd->close();
|
fd->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void RoadLinesEditor::update_current_line_metadata(const String &text)
|
||||||
|
{
|
||||||
|
assert(lines.has(current_line));
|
||||||
|
if (!text.begins_with("{"))
|
||||||
|
return;
|
||||||
|
String err_s;
|
||||||
|
int err_line;
|
||||||
|
Variant v;
|
||||||
|
Error err = JSON::parse(text, v, err_s, err_line);
|
||||||
|
if (err != OK) {
|
||||||
|
print_line("metadata parse error " + err_s + " at line " +
|
||||||
|
itos(err_line));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (v.get_type() != Variant::DICTIONARY) {
|
||||||
|
print_line("Invalid metadata type, should be Dictionary");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lines[current_line].metadata = v;
|
||||||
|
}
|
||||||
|
String RoadLinesEditor::get_current_line_metadata() const
|
||||||
|
{
|
||||||
|
assert(lines.has(current_line));
|
||||||
|
return JSON::print(lines[current_line].metadata, "\t", true);
|
||||||
|
}
|
||||||
template <class T> T *RoadLinesEditor::get_as_node(const String &path)
|
template <class T> T *RoadLinesEditor::get_as_node(const String &path)
|
||||||
{
|
{
|
||||||
Node *node = scene()->get_node(NodePath(path));
|
Node *node = scene()->get_node(NodePath(path));
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public:
|
|||||||
void line_list_filter_changed(const String &text);
|
void line_list_filter_changed(const String &text);
|
||||||
template <class T> T *get_as_node(const String &path);
|
template <class T> T *get_as_node(const String &path);
|
||||||
void save_data();
|
void save_data();
|
||||||
|
void update_current_line_metadata(const String &text);
|
||||||
|
String get_current_line_metadata() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void activate();
|
void activate();
|
||||||
|
|||||||
@@ -981,7 +981,7 @@ void RoadProcessing::load_data()
|
|||||||
ConfigFile config;
|
ConfigFile config;
|
||||||
Error result = config.load("res://config/stream.conf");
|
Error result = config.load("res://config/stream.conf");
|
||||||
ERR_FAIL_COND_MSG(result != OK, "Failed to load config");
|
ERR_FAIL_COND_MSG(result != OK, "Failed to load config");
|
||||||
String road_lines_path = config.get_value("road", "road_lines_path");
|
String road_lines_path = config.get_value("lines", "road_lines_path");
|
||||||
RoadLinesProcessing::get_singleton()->read_road_lines_json(
|
RoadLinesProcessing::get_singleton()->read_road_lines_json(
|
||||||
road_lines_path);
|
road_lines_path);
|
||||||
RoadMeshProcessing::get_singleton()->load_road_mesh(
|
RoadMeshProcessing::get_singleton()->load_road_mesh(
|
||||||
|
|||||||
@@ -378,6 +378,20 @@ void StreamWorld::update_items()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StreamWorld::remove_generated_stuff()
|
||||||
|
{
|
||||||
|
ConfigFile config;
|
||||||
|
Error result = config.load("res://config/stream.conf");
|
||||||
|
ERR_FAIL_COND_MSG(result != OK, "Failed to load config");
|
||||||
|
Array gen_prefixes = config.get_value("lines", "gen_prefixes");
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
void StreamWorld::remove_building(int index)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
void StreamWorld::run_command(const String &command, const Array &args)
|
void StreamWorld::run_command(const String &command, const Array &args)
|
||||||
{
|
{
|
||||||
if (command == "get_closest_building") {
|
if (command == "get_closest_building") {
|
||||||
@@ -477,6 +491,11 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
|||||||
update_items();
|
update_items();
|
||||||
print_line("changed building: " + itos(id) +
|
print_line("changed building: " + itos(id) +
|
||||||
" from: " + old_type + " to: " + new_type);
|
" from: " + old_type + " to: " + new_type);
|
||||||
|
} else if (command == "remove_building") {
|
||||||
|
/* TODO: implement */
|
||||||
|
} else if (command == "remove_generated_stuff") {
|
||||||
|
remove_generated_stuff();
|
||||||
|
update_items();
|
||||||
} else
|
} else
|
||||||
print_error("No command " + command);
|
print_error("No command " + command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ private:
|
|||||||
void unload_building(int id);
|
void unload_building(int id);
|
||||||
void request_item(int type, int item);
|
void request_item(int type, int item);
|
||||||
void update_items();
|
void update_items();
|
||||||
|
void remove_generated_stuff();
|
||||||
|
void remove_building(int index);
|
||||||
void checkpoint();
|
void checkpoint();
|
||||||
void undo();
|
void undo();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user