Worked on debugging and metadata stuff
This commit is contained in:
@@ -51,7 +51,9 @@ var ignore_events = [
|
||||
"mouse_drag_on",
|
||||
"mouse_drag_off",
|
||||
"line_cursor_motion",
|
||||
"button:create_building"
|
||||
"button:create_building",
|
||||
"lines_select_line",
|
||||
"lines_changed_line"
|
||||
]
|
||||
func editor_event(evname: String, args: Array):
|
||||
print(evname, args)
|
||||
|
||||
@@ -56,18 +56,18 @@ script = ExtResource( 1 )
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -232.0
|
||||
margin_left = -248.0
|
||||
|
||||
[node name="NavPanel" type="NavPanel" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 48.0
|
||||
rect_min_size = Vector2( 48, 48 )
|
||||
focus_mode = 2
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="VBoxContainer"]
|
||||
margin_top = 52.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 82.0
|
||||
rect_min_size = Vector2( 160, 30 )
|
||||
size_flags_horizontal = 3
|
||||
@@ -88,58 +88,58 @@ valign = 1
|
||||
[node name="select_buildings" type="Button" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 86.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 106.0
|
||||
text = "Buildings Mode"
|
||||
|
||||
[node name="select_navigation" type="Button" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 110.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 130.0
|
||||
text = "Navigation Mode"
|
||||
|
||||
[node name="select_poi" type="Button" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 134.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 154.0
|
||||
text = "POI Mode"
|
||||
|
||||
[node name="select_road_lines" type="Button" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 158.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 178.0
|
||||
text = "Road Lines Mode"
|
||||
|
||||
[node name="select_npc" type="Button" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 182.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 202.0
|
||||
text = "NPC Mode"
|
||||
|
||||
[node name="v_buildings" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 206.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 374.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_buildings"]
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 4.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/v_buildings"]
|
||||
margin_top = 8.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 22.0
|
||||
text = "Buildings mode"
|
||||
|
||||
[node name="buildings_edit_mode" type="OptionButton" parent="VBoxContainer/v_buildings"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 26.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 46.0
|
||||
text = "Select"
|
||||
items = [ "Select", null, false, 0, null, "Move", null, false, 1, null, "Rotate", null, false, 2, null, "Create", null, false, 3, null ]
|
||||
@@ -147,102 +147,102 @@ selected = 0
|
||||
|
||||
[node name="Label2" type="Label" parent="VBoxContainer/v_buildings"]
|
||||
margin_top = 50.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 64.0
|
||||
text = "Building type"
|
||||
|
||||
[node name="building_type" type="OptionButton" parent="VBoxContainer/v_buildings"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 68.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 88.0
|
||||
text = "Building Type"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/v_buildings"]
|
||||
margin_top = 92.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 96.0
|
||||
|
||||
[node name="buildings_delete_building" type="Button" parent="VBoxContainer/v_buildings"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 100.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 120.0
|
||||
text = "Delete building"
|
||||
|
||||
[node name="buildings_create_building" type="Button" parent="VBoxContainer/v_buildings"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 124.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 144.0
|
||||
text = "Create building"
|
||||
|
||||
[node name="buildings_save" type="Button" parent="VBoxContainer/v_buildings"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 148.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 168.0
|
||||
text = "Save Buildings"
|
||||
|
||||
[node name="v_navigation" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 378.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 400.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_navigation"]
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 4.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/v_navigation"]
|
||||
margin_top = 8.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 22.0
|
||||
text = "Navigation mode"
|
||||
|
||||
[node name="v_poi" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 404.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 426.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_poi"]
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 4.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/v_poi"]
|
||||
margin_top = 8.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 22.0
|
||||
text = "POI mode"
|
||||
|
||||
[node name="v_road_lines" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 430.0
|
||||
margin_right = 232.0
|
||||
margin_bottom = 1038.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 1080.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_road_lines"]
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 4.0
|
||||
|
||||
[node name="road_lines_base" type="PanelContainer" parent="VBoxContainer/v_road_lines"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 8.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 316.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_base"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 225.0
|
||||
margin_right = 241.0
|
||||
margin_bottom = 301.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="road_lines_menu_block" type="HBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="road_lines_file_menu" type="MenuButton" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_menu_block"]
|
||||
@@ -252,6 +252,7 @@ margin_bottom = 20.0
|
||||
focus_mode = 2
|
||||
text = "File"
|
||||
items = [ "Save Lines", null, 0, false, false, 101, 0, null, "", false ]
|
||||
switch_on_hover = true
|
||||
|
||||
[node name="road_lines_edit_menu" type="MenuButton" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_menu_block"]
|
||||
unique_name_in_owner = true
|
||||
@@ -261,6 +262,7 @@ margin_bottom = 20.0
|
||||
focus_mode = 2
|
||||
text = "Edit"
|
||||
items = [ "Undo", null, 0, false, false, 201, 0, null, "", false ]
|
||||
switch_on_hover = true
|
||||
|
||||
[node name="road_lines_point_menu" type="MenuButton" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_menu_block"]
|
||||
unique_name_in_owner = true
|
||||
@@ -269,6 +271,7 @@ margin_right = 124.0
|
||||
margin_bottom = 20.0
|
||||
text = "Point"
|
||||
items = [ "", null, 0, false, false, 0, 0, null, "", true, "Create", null, 0, false, false, 11, 0, null, "", false, "Remove", null, 0, false, false, 12, 0, null, "", false, "", null, 0, false, false, 3, 0, null, "", true, "Point To Cursor", null, 0, false, false, 51, 0, null, "", false, "Cursor To Point", null, 0, false, false, 52, 0, null, "", false, "Item 6", null, 0, false, false, 6, 0, null, "", false, "Item 7", null, 0, false, false, 7, 0, null, "", false ]
|
||||
switch_on_hover = true
|
||||
|
||||
[node name="road_lines_line_menu" type="MenuButton" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_menu_block"]
|
||||
unique_name_in_owner = true
|
||||
@@ -278,21 +281,31 @@ 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, "Rebuild roads", null, 0, false, false, 32, 0, null, "", false, "Remove road meshes", null, 0, false, false, 33, 0, null, "", false ]
|
||||
switch_on_hover = true
|
||||
|
||||
[node name="road_lines_options_menu" type="MenuButton" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_menu_block"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 171.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 20.0
|
||||
text = "Options"
|
||||
items = [ "Update roads", null, 1, false, false, 201, 0, null, "", false, "", null, 0, false, false, 1, 0, null, "", true, "Debug Road Nodes", null, 1, false, false, 210, 0, null, "", false, "Debug Road Edges", null, 1, false, false, 211, 0, null, "", false, "Debug Road Wedges", null, 1, false, false, 212, 0, null, "", false ]
|
||||
switch_on_hover = true
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 28.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 32.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 46.0
|
||||
text = "Road Lines mode"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 50.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 74.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/HBoxContainer"]
|
||||
@@ -304,14 +317,14 @@ text = "Filter: "
|
||||
[node name="road_lines_filter" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 45.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="lines_list" type="ItemList" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 78.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 158.0
|
||||
rect_min_size = Vector2( 0, 80 )
|
||||
size_flags_horizontal = 3
|
||||
@@ -319,175 +332,191 @@ size_flags_horizontal = 3
|
||||
[node name="line_index" type="SpinBox" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 162.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 186.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 190.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 194.0
|
||||
|
||||
[node name="Label2" type="Label" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 198.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 212.0
|
||||
text = "Cursor position"
|
||||
|
||||
[node name="road_lines_cursor_position" type="VBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 216.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 240.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_cursor_position"]
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="cursor_x" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_cursor_position/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 58.0
|
||||
margin_right = 63.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="cursor_y" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_cursor_position/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 62.0
|
||||
margin_right = 120.0
|
||||
margin_left = 67.0
|
||||
margin_right = 130.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="cursor_z" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_cursor_position/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 124.0
|
||||
margin_right = 182.0
|
||||
margin_left = 134.0
|
||||
margin_right = 197.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="road_lines_set_cursor_position" type="Button" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_cursor_position/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 186.0
|
||||
margin_right = 218.0
|
||||
margin_left = 201.0
|
||||
margin_right = 233.0
|
||||
margin_bottom = 24.0
|
||||
text = "Set"
|
||||
|
||||
[node name="HSeparator4" type="HSeparator" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 244.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 248.0
|
||||
|
||||
[node name="Label3" type="Label" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
margin_top = 252.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 266.0
|
||||
text = "Point position"
|
||||
|
||||
[node name="road_lines_point_position" type="VBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 270.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 294.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_point_position"]
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="point_x" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_point_position/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 58.0
|
||||
margin_right = 63.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="point_y" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_point_position/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 62.0
|
||||
margin_right = 120.0
|
||||
margin_left = 67.0
|
||||
margin_right = 130.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="point_z" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_point_position/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 124.0
|
||||
margin_right = 182.0
|
||||
margin_left = 134.0
|
||||
margin_right = 197.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="road_lines_set_point_position" type="Button" parent="VBoxContainer/v_road_lines/road_lines_base/VBoxContainer/road_lines_point_position/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 186.0
|
||||
margin_right = 218.0
|
||||
margin_left = 201.0
|
||||
margin_right = 233.0
|
||||
margin_bottom = 24.0
|
||||
text = "Set"
|
||||
|
||||
[node name="road_lines_create_new_line_dlg" type="PanelContainer" parent="VBoxContainer/v_road_lines"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 320.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 382.0
|
||||
|
||||
[node name="v" type="VBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_create_new_line_dlg"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 225.0
|
||||
margin_right = 241.0
|
||||
margin_bottom = 55.0
|
||||
|
||||
[node name="road_lines_create_new_line_name" type="LineEdit" parent="VBoxContainer/v_road_lines/road_lines_create_new_line_dlg/v"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="road_lines_create_new_cancel" type="Button" parent="VBoxContainer/v_road_lines/road_lines_create_new_line_dlg/v"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 28.0
|
||||
margin_right = 218.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 48.0
|
||||
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
|
||||
margin_right = 248.0
|
||||
margin_bottom = 650.0
|
||||
|
||||
[node name="v" type="VBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg"]
|
||||
[node name="scroll" type="ScrollContainer" 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
|
||||
margin_right = 241.0
|
||||
margin_bottom = 257.0
|
||||
rect_min_size = Vector2( 0, 250 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
scroll_horizontal_enabled = false
|
||||
|
||||
[node name="road_lines_metadata_edit" type="TextEdit" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/v"]
|
||||
[node name="v" type="VBoxContainer" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/scroll"]
|
||||
margin_right = 222.0
|
||||
margin_bottom = 418.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="road_lines_metadata_edit" type="TextEdit" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/scroll/v"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 218.0
|
||||
margin_right = 222.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"]
|
||||
[node name="road_lines_metadata_update" type="Button" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/scroll/v"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 164.0
|
||||
margin_right = 218.0
|
||||
margin_right = 222.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"]
|
||||
[node name="road_lines_metadata_cancel" type="Button" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/scroll/v"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 188.0
|
||||
margin_right = 218.0
|
||||
margin_right = 222.0
|
||||
margin_bottom = 208.0
|
||||
text = "Cancel"
|
||||
|
||||
[node name="lines_buildings_metadata_edit" type="LineMetadataEditor" parent="VBoxContainer/v_road_lines/road_lines_edit_metadata_dlg/scroll/v"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 212.0
|
||||
margin_right = 222.0
|
||||
margin_bottom = 418.0
|
||||
|
||||
[node name="v_npc" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 1042.0
|
||||
margin_right = 232.0
|
||||
margin_bottom = 1064.0
|
||||
margin_top = 1084.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 1106.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_npc"]
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 4.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/v_npc"]
|
||||
margin_top = 8.0
|
||||
margin_right = 232.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 22.0
|
||||
text = "NPC mode"
|
||||
|
||||
|
||||
91
src/modules/stream/line_metadata_editor.cpp
Normal file
91
src/modules/stream/line_metadata_editor.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <scene/gui/item_list.h>
|
||||
#include <scene/gui/box_container.h>
|
||||
#include <scene/gui/spin_box.h>
|
||||
#include <scene/gui/grid_container.h>
|
||||
#include <scene/gui/label.h>
|
||||
#include "editor_event.h"
|
||||
#include "road_lines_data.h"
|
||||
#include "line_metadata_editor.h"
|
||||
|
||||
static ItemList *line_buildings_list;
|
||||
static ItemList *line_building_types_list;
|
||||
static SpinBox *line_segment_num;
|
||||
LineMetadataEditor::LineMetadataEditor()
|
||||
{
|
||||
}
|
||||
|
||||
LineMetadataEditor::~LineMetadataEditor()
|
||||
{
|
||||
if (line_buildings_list) {
|
||||
line_buildings_list->queue_delete();
|
||||
line_buildings_list = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void LineMetadataEditor::_notification(int which)
|
||||
{
|
||||
switch (which) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
VBoxContainer *box = memnew(VBoxContainer);
|
||||
line_buildings_list = memnew(ItemList);
|
||||
line_buildings_list->set_custom_minimum_size(
|
||||
Vector2(0.0f, 80.0f));
|
||||
box->add_child(line_buildings_list);
|
||||
line_buildings_list->set_owner(this);
|
||||
line_building_types_list = memnew(ItemList);
|
||||
line_building_types_list->set_custom_minimum_size(
|
||||
Vector2(0.0f, 80.0f));
|
||||
box->add_child(line_building_types_list);
|
||||
line_building_types_list->set_owner(this);
|
||||
GridContainer *grid = memnew(GridContainer);
|
||||
grid->set_columns(2);
|
||||
Label *label = memnew(Label);
|
||||
label->set_text("Segment:");
|
||||
grid->add_child(label);
|
||||
line_segment_num = memnew(SpinBox);
|
||||
grid->add_child(line_segment_num);
|
||||
box->add_child(grid);
|
||||
add_child(box);
|
||||
box->set_owner(this);
|
||||
line_buildings_list->set_owner(this);
|
||||
EditorEvent::get_singleton()->event.add_listener(
|
||||
this, &LineMetadataEditor::event_handler);
|
||||
Array args;
|
||||
EditorEvent::get_singleton()->event.emit(
|
||||
"lines_get_current_line", args);
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
EditorEvent::get_singleton()->event.remove_listener(
|
||||
this, &LineMetadataEditor::event_handler);
|
||||
if (line_buildings_list) {
|
||||
line_buildings_list->queue_delete();
|
||||
line_buildings_list = nullptr;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void LineMetadataEditor::_bind_methods()
|
||||
{
|
||||
}
|
||||
|
||||
void LineMetadataEditor::event_handler(const String &event, const Array &args)
|
||||
{
|
||||
if (event == "lines_select_line") {
|
||||
const String ¤t_line = args[0];
|
||||
print_line("line selected: " + current_line);
|
||||
#if 0
|
||||
if (current_line.ends_with("_buildings")) {
|
||||
int i;
|
||||
for (i = 0; i < u_controls.size(); i++)
|
||||
u_controls[i]->queue_delete();
|
||||
ItemList *item_list = memnew(ItemList);
|
||||
add_child RoadLinesData::get_singleton()
|
||||
-> lines[current_line]
|
||||
.metadata;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
15
src/modules/stream/line_metadata_editor.h
Normal file
15
src/modules/stream/line_metadata_editor.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <scene/gui/panel_container.h>
|
||||
#include "editor_event.h"
|
||||
|
||||
class LineMetadataEditor : public PanelContainer {
|
||||
GDCLASS(LineMetadataEditor, PanelContainer)
|
||||
public:
|
||||
LineMetadataEditor();
|
||||
virtual ~LineMetadataEditor();
|
||||
|
||||
private:
|
||||
Vector<Control *> u_controls;
|
||||
void _notification(int which);
|
||||
static void _bind_methods();
|
||||
void event_handler(const String &event, const Array &args);
|
||||
};
|
||||
@@ -36,6 +36,9 @@ void NavPanel::_notification(int which)
|
||||
add_child(h);
|
||||
add_child(v);
|
||||
add_child(r);
|
||||
h->set_focus_mode(Control::FOCUS_CLICK);
|
||||
v->set_focus_mode(Control::FOCUS_CLICK);
|
||||
r->set_focus_mode(Control::FOCUS_CLICK);
|
||||
h->connect("gui_input", this, "gui_input_handler_h");
|
||||
v->connect("gui_input", this, "gui_input_handler_v");
|
||||
r->connect("gui_input", this, "gui_input_handler_r");
|
||||
@@ -114,6 +117,7 @@ void NavPanel::gui_input_handler_h(const Ref<InputEvent> &e)
|
||||
{
|
||||
if (Input::get_singleton()->is_action_just_pressed("mouse1")) {
|
||||
h_active = true;
|
||||
h->grab_focus();
|
||||
Input::get_singleton()->set_mouse_mode(
|
||||
Input::MOUSE_MODE_CAPTURED);
|
||||
} else if (Input::get_singleton()->is_action_just_released("mouse1")) {
|
||||
@@ -140,6 +144,7 @@ void NavPanel::gui_input_handler_v(const Ref<InputEvent> &e)
|
||||
v_active = true;
|
||||
Input::get_singleton()->set_mouse_mode(
|
||||
Input::MOUSE_MODE_CAPTURED);
|
||||
v->grab_focus();
|
||||
} else if (Input::get_singleton()->is_action_just_released("mouse1")) {
|
||||
v_active = false;
|
||||
Input::get_singleton()->set_mouse_mode(
|
||||
@@ -167,6 +172,7 @@ void NavPanel::gui_input_handler_r(const Ref<InputEvent> &e)
|
||||
r_active = true;
|
||||
Input::get_singleton()->set_mouse_mode(
|
||||
Input::MOUSE_MODE_CAPTURED);
|
||||
r->grab_focus();
|
||||
|
||||
} else if (Input::get_singleton()->is_action_just_released("mouse1")) {
|
||||
r_active = false;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "road_debug.h"
|
||||
#include "world_editor.h"
|
||||
#include "nav_panel.h"
|
||||
#include "line_metadata_editor.h"
|
||||
|
||||
void register_stream_types()
|
||||
{
|
||||
@@ -10,6 +11,7 @@ void register_stream_types()
|
||||
ClassDB::register_class<RoadDebug>();
|
||||
ClassDB::register_class<WorldEditor>();
|
||||
ClassDB::register_class<NavPanel>();
|
||||
ClassDB::register_class<LineMetadataEditor>();
|
||||
}
|
||||
|
||||
void unregister_stream_types()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "from_string.h"
|
||||
#include "road_lines_data.h"
|
||||
|
||||
static ImmediateGeometry *debug_im;
|
||||
ImmediateGeometry *RoadLinesData::debug_im = nullptr;
|
||||
static Ref<Material> debug_material;
|
||||
RoadLinesData::RoadLinesData()
|
||||
{
|
||||
@@ -73,10 +73,12 @@ RoadLinesData *RoadLinesData::get_singleton()
|
||||
|
||||
RoadLinesData::~RoadLinesData()
|
||||
{
|
||||
#if 0
|
||||
if (debug_im) {
|
||||
memdelete(debug_im);
|
||||
debug_im = nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RoadLinesData::cleanup()
|
||||
@@ -159,7 +161,6 @@ uint32_t RoadLinesData::road_lines_hash(const Vector3 &v)
|
||||
int z = (int)(v.z / 100);
|
||||
return x ^ (y * 100) ^ (z * 10000);
|
||||
}
|
||||
|
||||
void RoadLinesData::road_lines_curve_index(
|
||||
struct RoadLinesData::road_line &rline,
|
||||
std::unordered_map<uint32_t, std::vector<Vector3> >
|
||||
@@ -454,20 +455,24 @@ void RoadLinesData::dump_road_lines(const std::vector<Vector3> &road_lines_nodes
|
||||
}
|
||||
}
|
||||
|
||||
static inline ImmediateGeometry *get_debug_node()
|
||||
ImmediateGeometry *RoadLinesData::get_debug_node()
|
||||
{
|
||||
debug_im = memnew(ImmediateGeometry);
|
||||
Ref<SpatialMaterial> tmpmat;
|
||||
tmpmat.instance();
|
||||
tmpmat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
tmpmat->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, true);
|
||||
tmpmat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
debug_material = tmpmat;
|
||||
debug_im->set_material_override(debug_material);
|
||||
SceneTree::get_singleton()
|
||||
->get_current_scene()
|
||||
->get_viewport()
|
||||
->add_child(debug_im);
|
||||
if (!debug_im) {
|
||||
debug_im = memnew(ImmediateGeometry);
|
||||
Ref<SpatialMaterial> tmpmat;
|
||||
tmpmat.instance();
|
||||
tmpmat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,
|
||||
true);
|
||||
tmpmat->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST,
|
||||
true);
|
||||
tmpmat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
debug_material = tmpmat;
|
||||
debug_im->set_material_override(debug_material);
|
||||
SceneTree::get_singleton()
|
||||
->get_current_scene()
|
||||
->get_viewport()
|
||||
->call_deferred("add_child", debug_im);
|
||||
}
|
||||
return debug_im;
|
||||
}
|
||||
|
||||
@@ -477,19 +482,35 @@ void RoadLinesData::process_lines(
|
||||
std::vector<Vector3> &road_lines_nodes)
|
||||
{
|
||||
int i;
|
||||
get_debug_node();
|
||||
debug_im->clear();
|
||||
get_debug_node()->clear();
|
||||
index_lines(road_lines_nodes_hash, road_lines_nodes);
|
||||
debug_im->begin(Mesh::PRIMITIVE_LINES);
|
||||
for (i = 0; i < (int)road_lines_nodes.size(); i++) {
|
||||
debug_im->set_color(Color(0.1f, 0.6f, 0.6f, 1.0f));
|
||||
debug_im->add_vertex(road_lines_nodes[i]);
|
||||
debug_im->set_color(Color(0.1f, 0.6f, 0.6f, 1.0f));
|
||||
debug_im->add_vertex(road_lines_nodes[i] +
|
||||
Vector3(0.0f, 200.0f, 0.0f));
|
||||
}
|
||||
debug_im->end();
|
||||
insert_close_points(road_lines_nodes, 160.0f);
|
||||
update_road_lines_nodes(road_lines_nodes);
|
||||
dump_road_lines(road_lines_nodes);
|
||||
if (debug_flags & 1) {
|
||||
get_debug_node()->begin(Mesh::PRIMITIVE_LINES);
|
||||
for (i = 0; i < (int)road_lines_nodes.size(); i++) {
|
||||
print_line("debug_node: " + itos(i) + " " +
|
||||
(road_lines_nodes[i].operator String()));
|
||||
get_debug_node()->set_color(
|
||||
Color(0.1f, 0.6f, 0.6f, 1.0f));
|
||||
get_debug_node()->add_vertex(road_lines_nodes[i]);
|
||||
get_debug_node()->set_color(
|
||||
Color(0.1f, 0.6f, 0.6f, 1.0f));
|
||||
get_debug_node()->add_vertex(
|
||||
road_lines_nodes[i] +
|
||||
Vector3(0.0f, 200.0f, 0.0f));
|
||||
}
|
||||
get_debug_node()->end();
|
||||
}
|
||||
}
|
||||
|
||||
void RoadLinesData::set_debug_flags(int debug_flags)
|
||||
{
|
||||
this->debug_flags = debug_flags;
|
||||
}
|
||||
|
||||
int RoadLinesData::get_debug_flags() const
|
||||
{
|
||||
return debug_flags;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#ifndef ROAD_LINES_DATA_H
|
||||
#define ROAD_LINES_DATA_H
|
||||
#include "callable.h"
|
||||
class ImmediateGeometry;
|
||||
class RoadLinesData {
|
||||
int debug_flags;
|
||||
String road_lines_path;
|
||||
uint32_t road_lines_hash(const Vector3 &v);
|
||||
static ImmediateGeometry *debug_im;
|
||||
static ImmediateGeometry *get_debug_node();
|
||||
|
||||
protected:
|
||||
RoadLinesData();
|
||||
@@ -30,6 +34,8 @@ public:
|
||||
void process_lines(std::unordered_map<uint32_t, std::vector<Vector3> >
|
||||
&road_lines_nodes_hash,
|
||||
std::vector<Vector3> &road_lines_nodes);
|
||||
void set_debug_flags(int debug_flags);
|
||||
int get_debug_flags() const;
|
||||
|
||||
private:
|
||||
void index_lines(std::unordered_map<uint32_t, std::vector<Vector3> >
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <core/os/time.h>
|
||||
#include <core/io/json.h>
|
||||
#include <modules/regex/regex.h>
|
||||
#include "editor_event.h"
|
||||
#include "world_editor.h"
|
||||
#include "from_string.h"
|
||||
#include "road_lines_data.h"
|
||||
@@ -157,6 +158,8 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
static String current_line = "";
|
||||
|
||||
class HandlePointSelection : public Object {
|
||||
GDCLASS(HandlePointSelection, Object)
|
||||
RoadLinesEditor *editor;
|
||||
@@ -286,6 +289,8 @@ public:
|
||||
protected:
|
||||
void update_metadata_editor()
|
||||
{
|
||||
if (current_line == "")
|
||||
return;
|
||||
TextEdit *metadata_edit = editor->get_as_node<TextEdit>(
|
||||
"%road_lines_metadata_edit");
|
||||
String text = editor->get_current_line_metadata();
|
||||
@@ -313,6 +318,10 @@ protected:
|
||||
break;
|
||||
case 23:
|
||||
/* edit line metadata */
|
||||
if (current_line == "") {
|
||||
print_error("No current line set");
|
||||
return;
|
||||
}
|
||||
editor->get_as_node<Control>("%road_lines_base")->hide();
|
||||
editor->get_as_node<Control>(
|
||||
"%road_lines_edit_metadata_dlg")
|
||||
@@ -340,6 +349,58 @@ protected:
|
||||
case 101:
|
||||
editor->save_data();
|
||||
break;
|
||||
case 201:
|
||||
case 210:
|
||||
case 211:
|
||||
case 212: {
|
||||
print_line("selected item 201");
|
||||
int i, j;
|
||||
Node *menu_block = editor->get_as_node<Node>(
|
||||
"%road_lines_menu_block");
|
||||
for (i = 0; i < menu_block->get_child_count(); i++) {
|
||||
Node *menu_button_node =
|
||||
menu_block->get_child(i);
|
||||
MenuButton *menu_button =
|
||||
Object::cast_to<MenuButton>(
|
||||
menu_button_node);
|
||||
if (!menu_button)
|
||||
continue;
|
||||
PopupMenu *popup = menu_button->get_popup();
|
||||
for (j = 0; j < popup->get_item_count(); j++) {
|
||||
int nid = popup->get_item_id(j);
|
||||
if (nid == id) {
|
||||
bool checked =
|
||||
popup->is_item_checked(
|
||||
j);
|
||||
if (checked)
|
||||
print_line("checked");
|
||||
else
|
||||
print_line("unchecked");
|
||||
checked = !checked;
|
||||
popup->set_item_checked(
|
||||
j, checked);
|
||||
switch (id) {
|
||||
case 201:
|
||||
editor->set_update_roads(
|
||||
checked);
|
||||
break;
|
||||
case 210:
|
||||
editor->set_debug_road_nodes(
|
||||
checked);
|
||||
break;
|
||||
case 211:
|
||||
editor->set_debug_road_edges(
|
||||
checked);
|
||||
break;
|
||||
case 212:
|
||||
editor->set_debug_road_wedges(
|
||||
checked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
print_line("menu option pressed: " + itos(id));
|
||||
}
|
||||
@@ -467,6 +528,10 @@ RoadLinesEditor::RoadLinesEditor(WorldEditor *editor)
|
||||
, cursor_enabled(false)
|
||||
, filter_text("")
|
||||
, camera_moved(false)
|
||||
, update_roads(false)
|
||||
, debug_road_nodes(false)
|
||||
, debug_road_edges(false)
|
||||
, debug_road_wedges(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -483,7 +548,6 @@ Node *RoadLinesEditor::scene()
|
||||
return editor->get_tree()->get_current_scene();
|
||||
}
|
||||
|
||||
static String current_line = "";
|
||||
void RoadLinesEditor::update_line_geometry()
|
||||
{
|
||||
RoadLinesData *rld = RoadLinesData::get_singleton();
|
||||
@@ -553,6 +617,9 @@ void RoadLinesEditor::select_line(const String &line_name)
|
||||
set_line_index(0);
|
||||
update_line_geometry();
|
||||
}
|
||||
Array args;
|
||||
args.push_back(current_line);
|
||||
EditorEvent::get_singleton()->event.emit("lines_select_line", args);
|
||||
update_ui();
|
||||
}
|
||||
|
||||
@@ -572,6 +639,9 @@ void RoadLinesEditor::line_create_point()
|
||||
int index = get_line_index();
|
||||
rld->lines[current_line].points.insert(
|
||||
rld->lines[current_line].points.begin() + index + 1, xform);
|
||||
Array args;
|
||||
args.push_back(current_line);
|
||||
EditorEvent::get_singleton()->event.emit("lines_changed_line", args);
|
||||
update_line_geometry();
|
||||
update_line_index_ui();
|
||||
SpinBox *sp_line_index = get_as_node<SpinBox>("%line_index");
|
||||
@@ -589,6 +659,9 @@ void RoadLinesEditor::line_delete_point()
|
||||
return;
|
||||
rld->lines[current_line].points.erase(
|
||||
rld->lines[current_line].points.begin() + index);
|
||||
Array args;
|
||||
args.push_back(current_line);
|
||||
EditorEvent::get_singleton()->event.emit("lines_changed_line", args);
|
||||
update_line_geometry();
|
||||
update_line_index_ui();
|
||||
SpinBox *sp_line_index = get_as_node<SpinBox>("%line_index");
|
||||
@@ -607,6 +680,9 @@ void RoadLinesEditor::set_point_to_cursor()
|
||||
Transform xform = cursor->get_global_transform();
|
||||
int index = get_line_index();
|
||||
rld->lines[current_line].points[index].origin = xform.origin;
|
||||
Array args;
|
||||
args.push_back(current_line);
|
||||
EditorEvent::get_singleton()->event.emit("lines_changed_line", args);
|
||||
update_line_geometry();
|
||||
set_ui_point_position(rld->lines[current_line].points[index].origin);
|
||||
}
|
||||
@@ -798,6 +874,9 @@ void RoadLinesEditor::set_point_position(const Vector3 &position)
|
||||
RoadLinesData *rld = RoadLinesData::get_singleton();
|
||||
int index = get_line_index();
|
||||
rld->lines[current_line].points[index].origin = position;
|
||||
Array args;
|
||||
args.push_back(current_line);
|
||||
EditorEvent::get_singleton()->event.emit("lines_changed_line", args);
|
||||
update_line_geometry();
|
||||
}
|
||||
void RoadLinesEditor::set_ui_cursor_position(const Vector3 &cursor_position)
|
||||
@@ -869,12 +948,16 @@ void RoadLinesEditor::activate()
|
||||
new_line_handler = memnew(HandleCreateNewLine(this));
|
||||
if (!point_selection_handler)
|
||||
point_selection_handler = memnew(HandlePointSelection(this));
|
||||
EditorEvent::get_singleton()->event.add_listener(
|
||||
this, &RoadLinesEditor::event_handler);
|
||||
|
||||
active = true;
|
||||
}
|
||||
|
||||
void RoadLinesEditor::deactivate()
|
||||
{
|
||||
EditorEvent::get_singleton()->event.remove_listener(
|
||||
this, &RoadLinesEditor::event_handler);
|
||||
Node *lines_list_node =
|
||||
editor->get_tree()->get_current_scene()->get_node(
|
||||
NodePath("%lines_list"));
|
||||
@@ -913,6 +996,15 @@ void RoadLinesEditor::place_generated_objects()
|
||||
void RoadLinesEditor::rebuild_roads()
|
||||
{
|
||||
Array args;
|
||||
int debug_flags = 0;
|
||||
if (debug_road_nodes)
|
||||
debug_flags |= (1 << 0);
|
||||
if (debug_road_edges)
|
||||
debug_flags |= (1 << 1);
|
||||
if (debug_road_wedges)
|
||||
debug_flags |= (1 << 2);
|
||||
print_line("rebuild_roads: debug: " + itos(debug_flags));
|
||||
args.push_back(debug_flags);
|
||||
editor->editor_command("rebuild_roads", args);
|
||||
}
|
||||
void RoadLinesEditor::remove_road_meshes()
|
||||
@@ -925,6 +1017,22 @@ void RoadLinesEditor::handle_input()
|
||||
if (editor->get_camera_mode() != 3)
|
||||
return;
|
||||
}
|
||||
void RoadLinesEditor::set_update_roads(bool checked)
|
||||
{
|
||||
update_roads = checked;
|
||||
}
|
||||
void RoadLinesEditor::set_debug_road_nodes(bool checked)
|
||||
{
|
||||
debug_road_nodes = checked;
|
||||
}
|
||||
void RoadLinesEditor::set_debug_road_edges(bool checked)
|
||||
{
|
||||
debug_road_edges = checked;
|
||||
}
|
||||
void RoadLinesEditor::set_debug_road_wedges(bool checked)
|
||||
{
|
||||
debug_road_wedges = checked;
|
||||
}
|
||||
void RoadLinesEditor::place_zebras()
|
||||
{
|
||||
Array args;
|
||||
@@ -1053,3 +1161,21 @@ template <class T> T *RoadLinesEditor::get_as_node(const String &path)
|
||||
assert(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void RoadLinesEditor::event_handler(const String &event, const Array &args)
|
||||
{
|
||||
if (event == "lines_get_current_line" && current_line != "") {
|
||||
Array nargs;
|
||||
nargs.push_back(current_line);
|
||||
EditorEvent::get_singleton()->event.emit("lines_select_line",
|
||||
nargs);
|
||||
}
|
||||
if (event == "lines_changed_line") {
|
||||
if (!update_roads)
|
||||
print_line("road update disabled");
|
||||
if (current_line.ends_with("_road"))
|
||||
print_line("the line is a road");
|
||||
if (current_line.ends_with("_road") && update_roads)
|
||||
rebuild_roads();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@ class RoadLinesEditor {
|
||||
Ref<RegEx> re;
|
||||
bool camera_moved;
|
||||
Vector3 camera_motion;
|
||||
void event_handler(const String &event, const Array &args);
|
||||
bool update_roads; // 201
|
||||
bool debug_road_nodes; // 210
|
||||
bool debug_road_edges; // 211
|
||||
bool debug_road_wedges; // 212
|
||||
|
||||
public:
|
||||
RoadLinesEditor(WorldEditor *editor);
|
||||
@@ -49,6 +54,10 @@ public:
|
||||
void rebuild_roads();
|
||||
void remove_road_meshes();
|
||||
void handle_input();
|
||||
void set_update_roads(bool checked);
|
||||
void set_debug_road_nodes(bool checked);
|
||||
void set_debug_road_edges(bool checked);
|
||||
void set_debug_road_wedges(bool checked);
|
||||
|
||||
protected:
|
||||
void activate();
|
||||
|
||||
@@ -34,6 +34,7 @@ struct RoadLinesProcessing {
|
||||
std::unordered_map<uint32_t, std::vector<struct wedge> > wedges;
|
||||
String road_center_mesh_path, road_mid_mesh_path,
|
||||
road_sidewalk_mesh_path;
|
||||
int debug_flags;
|
||||
static struct RoadLinesProcessing *singleton;
|
||||
static RoadLinesProcessing *get_singleton()
|
||||
{
|
||||
@@ -186,6 +187,14 @@ struct RoadLinesProcessing {
|
||||
singleton = nullptr;
|
||||
}
|
||||
}
|
||||
void set_debug_flags(int debug_flags)
|
||||
{
|
||||
this->debug_flags = debug_flags;
|
||||
}
|
||||
int get_debug_flags() const
|
||||
{
|
||||
return debug_flags;
|
||||
}
|
||||
void road_setup()
|
||||
{
|
||||
RoadLinesData *rld = RoadLinesData::get_singleton();
|
||||
@@ -194,6 +203,7 @@ struct RoadLinesProcessing {
|
||||
road_lines_nodes_hash;
|
||||
road_lines_nodes.clear();
|
||||
road_lines_nodes_hash.clear();
|
||||
rld->set_debug_flags(debug_flags);
|
||||
rld->process_lines(road_lines_nodes_hash, road_lines_nodes);
|
||||
create_nodes(road_lines_nodes);
|
||||
create_edges();
|
||||
@@ -631,8 +641,9 @@ public:
|
||||
};
|
||||
RoadMeshProcessing *RoadMeshProcessing::singleton;
|
||||
|
||||
void RoadProcessing::road_setup(Node *target)
|
||||
void RoadProcessing::road_setup(Node *target, int debug_flags)
|
||||
{
|
||||
RoadLinesProcessing::get_singleton()->set_debug_flags(debug_flags);
|
||||
RoadLinesProcessing::get_singleton()->road_setup();
|
||||
RoadMeshProcessing::get_singleton()->create_road_meshes(target);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class Node;
|
||||
class ImmediateGeometry;
|
||||
class RoadProcessing {
|
||||
public:
|
||||
static void road_setup(Node *target);
|
||||
static void road_setup(Node *target, int debug_flags);
|
||||
static void remove_road_meshes(Node *target);
|
||||
static void load_data();
|
||||
static void cleanup();
|
||||
|
||||
@@ -398,7 +398,10 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
||||
remove_generated_stuff();
|
||||
update_items();
|
||||
} else if (command == "rebuild_roads") {
|
||||
RoadProcessing::road_setup(this);
|
||||
if (args.size() > 0)
|
||||
RoadProcessing::road_setup(this, args[0]);
|
||||
else
|
||||
RoadProcessing::road_setup(this, 0);
|
||||
print_line("road_rebuild done");
|
||||
} else if (command == "remove_road_meshes") {
|
||||
RoadProcessing::remove_road_meshes(this);
|
||||
@@ -426,7 +429,7 @@ void StreamWorld::_notification(int which)
|
||||
current_scene = get_tree()->get_root();
|
||||
}
|
||||
ERR_FAIL_COND_MSG(!current_scene, "No current scene");
|
||||
RoadProcessing::road_setup(this);
|
||||
RoadProcessing::road_setup(this, 0);
|
||||
set_process(true);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user