Godot update, camera nav widget, closes #35

This commit is contained in:
2024-09-17 02:27:31 +03:00
parent 49e7b9f970
commit 43bc11b6e8
6 changed files with 220 additions and 24 deletions

View File

@@ -14,6 +14,19 @@ onready var vmode = {
# var item = $"%building_type".get_item_text(index)
# $WorldEditor.editor_command("change_building_type", [selected_building, item])
#var nav_active = false
#func nav_gui_input(event: InputEvent):
# if Input.is_action_just_pressed("mouse1"):
# Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
# nav_active = true
# elif Input.is_action_just_released("mouse1"):
# Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
# nav_active = false
# if nav_active && Input.is_action_pressed("mouse1"):
# if event is InputEventMouseMotion:
# get_viewport().get_camera().global_transform.origin.x += event.relative.x
# get_viewport().get_camera().global_transform.origin.z -= event.relative.y
func _ready():
for b in [
$"%select_buildings",
@@ -30,7 +43,7 @@ func _ready():
$"%building_cursor".hide()
$"%line_cursor".hide()
# $"%building_type".connect("item_selected", self, "change_building_type")
# $"%NavPanel".connect("gui_input", self, "nav_gui_input")
var ignore_events = [
"result:get_closest_building",
"mouse_drag",

View File

@@ -58,9 +58,17 @@ anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -232.0
[node name="ColorRect" type="ColorRect" parent="VBoxContainer"]
[node name="NavPanel" type="NavPanel" parent="VBoxContainer"]
unique_name_in_owner = true
margin_right = 232.0
margin_bottom = 30.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_bottom = 82.0
rect_min_size = Vector2( 160, 30 )
size_flags_horizontal = 3
size_flags_vertical = 5
@@ -79,44 +87,44 @@ valign = 1
[node name="select_buildings" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 34.0
margin_top = 86.0
margin_right = 232.0
margin_bottom = 54.0
margin_bottom = 106.0
text = "Buildings Mode"
[node name="select_navigation" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 58.0
margin_top = 110.0
margin_right = 232.0
margin_bottom = 78.0
margin_bottom = 130.0
text = "Navigation Mode"
[node name="select_poi" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 82.0
margin_top = 134.0
margin_right = 232.0
margin_bottom = 102.0
margin_bottom = 154.0
text = "POI Mode"
[node name="select_road_lines" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 106.0
margin_top = 158.0
margin_right = 232.0
margin_bottom = 126.0
margin_bottom = 178.0
text = "Road Lines Mode"
[node name="select_npc" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 130.0
margin_top = 182.0
margin_right = 232.0
margin_bottom = 150.0
margin_bottom = 202.0
text = "NPC Mode"
[node name="v_buildings" type="VBoxContainer" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 154.0
margin_top = 206.0
margin_right = 232.0
margin_bottom = 322.0
margin_bottom = 374.0
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_buildings"]
margin_right = 232.0
@@ -178,9 +186,9 @@ text = "Save Buildings"
[node name="v_navigation" type="VBoxContainer" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 326.0
margin_top = 378.0
margin_right = 232.0
margin_bottom = 348.0
margin_bottom = 400.0
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_navigation"]
margin_right = 232.0
@@ -194,9 +202,9 @@ text = "Navigation mode"
[node name="v_poi" type="VBoxContainer" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 352.0
margin_top = 404.0
margin_right = 232.0
margin_bottom = 374.0
margin_bottom = 426.0
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_poi"]
margin_right = 232.0
@@ -210,9 +218,9 @@ text = "POI mode"
[node name="v_road_lines" type="VBoxContainer" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 378.0
margin_top = 430.0
margin_right = 232.0
margin_bottom = 986.0
margin_bottom = 1038.0
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_road_lines"]
margin_right = 232.0
@@ -469,9 +477,9 @@ text = "Cancel"
[node name="v_npc" type="VBoxContainer" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 990.0
margin_top = 1042.0
margin_right = 232.0
margin_bottom = 1012.0
margin_bottom = 1064.0
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/v_npc"]
margin_right = 232.0