rebuilding roads done, closes #20
This commit is contained in:
@@ -262,7 +262,7 @@ margin_right = 167.0
|
||||
margin_bottom = 20.0
|
||||
focus_mode = 2
|
||||
text = "Line"
|
||||
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, "Place Generated Objects", null, 0, false, false, 31, 0, null, "", false, "Edit Line Metadata", null, 0, false, false, 23, 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, "Place Generated Objects", null, 0, false, false, 31, 0, null, "", false, "Edit Line Metadata", null, 0, false, false, 23, 0, null, "", false, "Rebuild roads", null, 0, false, false, 32, 0, null, "", false, "Remove road meshes", null, 0, false, false, 33, 0, null, "", false ]
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
|
||||
@@ -323,6 +323,12 @@ protected:
|
||||
case 31:
|
||||
editor->place_generated_objects();
|
||||
break;
|
||||
case 32:
|
||||
editor->rebuild_roads();
|
||||
break;
|
||||
case 33:
|
||||
editor->remove_road_meshes();
|
||||
break;
|
||||
case 51:
|
||||
editor->set_point_to_cursor();
|
||||
break;
|
||||
@@ -885,6 +891,16 @@ void RoadLinesEditor::place_generated_objects()
|
||||
{
|
||||
place_zebras();
|
||||
}
|
||||
void RoadLinesEditor::rebuild_roads()
|
||||
{
|
||||
Array args;
|
||||
editor->editor_command("rebuild_roads", args);
|
||||
}
|
||||
void RoadLinesEditor::remove_road_meshes()
|
||||
{
|
||||
Array args;
|
||||
editor->editor_command("remove_road_meshes", args);
|
||||
}
|
||||
void RoadLinesEditor::place_zebras()
|
||||
{
|
||||
editor->remove_buildings_by_prefix("zebra");
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
String get_current_line_metadata() const;
|
||||
void remove_generated_stuff();
|
||||
void place_generated_objects();
|
||||
void rebuild_roads();
|
||||
void remove_road_meshes();
|
||||
|
||||
protected:
|
||||
void activate();
|
||||
|
||||
@@ -56,6 +56,7 @@ struct RoadLinesProcessing {
|
||||
int i;
|
||||
List<String> keys;
|
||||
RoadLinesData *rld = RoadLinesData::get_singleton();
|
||||
edges.clear();
|
||||
rld->get_road_lines_key_list(&keys);
|
||||
List<String>::Element *e = keys.front();
|
||||
while (e) {
|
||||
@@ -184,7 +185,7 @@ struct RoadLinesProcessing {
|
||||
singleton = nullptr;
|
||||
}
|
||||
}
|
||||
void road_setup(Node *base)
|
||||
void road_setup()
|
||||
{
|
||||
RoadLinesData *rld = RoadLinesData::get_singleton();
|
||||
std::vector<Vector3> road_lines_nodes;
|
||||
@@ -195,6 +196,7 @@ struct RoadLinesProcessing {
|
||||
rld->process_lines(road_lines_nodes_hash, road_lines_nodes);
|
||||
create_nodes(road_lines_nodes);
|
||||
create_edges();
|
||||
wedges.clear();
|
||||
build_wedges(wedges);
|
||||
print_line("ROAD SETUP DONE");
|
||||
}
|
||||
@@ -581,13 +583,18 @@ public:
|
||||
new_mesh->surface_set_name(0, "main");
|
||||
return new_mesh;
|
||||
}
|
||||
void clear_road_meshes()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)nodes_mi.size(); i++)
|
||||
nodes_mi[i]->queue_delete();
|
||||
nodes_mi.clear();
|
||||
}
|
||||
void create_road_meshes(Node *base)
|
||||
{
|
||||
int i;
|
||||
RoadLinesProcessing *r = RoadLinesProcessing::get_singleton();
|
||||
for (i = 0; i < (int)nodes_mi.size(); i++)
|
||||
nodes_mi[i]->queue_delete();
|
||||
nodes_mi.clear();
|
||||
clear_road_meshes();
|
||||
for (i = 0; i < (int)r->nodes.size(); i++) {
|
||||
Ref<ArrayMesh> mesh =
|
||||
build_road(r->wedges[i], "common/center",
|
||||
@@ -625,10 +632,15 @@ RoadMeshProcessing *RoadMeshProcessing::singleton;
|
||||
|
||||
void RoadProcessing::road_setup(Node *target)
|
||||
{
|
||||
RoadLinesProcessing::get_singleton()->road_setup(target);
|
||||
RoadLinesProcessing::get_singleton()->road_setup();
|
||||
RoadMeshProcessing::get_singleton()->create_road_meshes(target);
|
||||
}
|
||||
|
||||
void RoadProcessing::remove_road_meshes(Node *target)
|
||||
{
|
||||
RoadMeshProcessing::get_singleton()->clear_road_meshes();
|
||||
}
|
||||
|
||||
void RoadProcessing::load_data()
|
||||
{
|
||||
/* Not needed but still */
|
||||
|
||||
@@ -4,6 +4,7 @@ class Node;
|
||||
class RoadProcessing {
|
||||
public:
|
||||
static void road_setup(Node *target);
|
||||
static void remove_road_meshes(Node *target);
|
||||
static void load_data();
|
||||
static void cleanup();
|
||||
};
|
||||
|
||||
@@ -554,14 +554,12 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
||||
} else if (command == "remove_generated_stuff") {
|
||||
remove_generated_stuff();
|
||||
update_items();
|
||||
} else if (command == "place") {
|
||||
if (args.size() == 0) {
|
||||
print_error("bad command: not enough args: " + command);
|
||||
return;
|
||||
}
|
||||
String what = args[0];
|
||||
if (what == "zebra")
|
||||
place_zebras();
|
||||
} else if (command == "rebuild_roads") {
|
||||
RoadProcessing::road_setup(this);
|
||||
print_line("road_rebuild done");
|
||||
} else if (command == "remove_road_meshes") {
|
||||
RoadProcessing::remove_road_meshes(this);
|
||||
print_line("remove_road_meshes done");
|
||||
} else
|
||||
print_error("No command " + command);
|
||||
}
|
||||
@@ -703,9 +701,6 @@ void StreamWorld::undo()
|
||||
update_view();
|
||||
update_items();
|
||||
}
|
||||
void StreamWorld::place_zebras()
|
||||
{
|
||||
}
|
||||
void StreamWorld::cleanup()
|
||||
{
|
||||
RoadProcessing::cleanup();
|
||||
|
||||
@@ -240,7 +240,14 @@ void WorldEditor::editor_command(const String &command, const Array &args)
|
||||
} else if (command == "select_building") {
|
||||
select_building(args[0], args[1], args[2]);
|
||||
} else if (command == "remove_generated_stuff") {
|
||||
stream_world->run_command(command, args);
|
||||
if (stream_world)
|
||||
stream_world->run_command(command, args);
|
||||
} else if (command == "rebuild_roads") {
|
||||
if (stream_world)
|
||||
stream_world->run_command(command, args);
|
||||
} else if (command == "remove_road_meshes") {
|
||||
if (stream_world)
|
||||
stream_world->run_command(command, args);
|
||||
} else if (road_lines_editor) {
|
||||
road_lines_editor->editor_command(command, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user