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