Bugs are now filed with their position information, and loaded into Godot with their proper positions intact.

This commit is contained in:
Jamie Greunbaum
2024-05-26 02:32:55 -04:00
parent 5b4dc53a62
commit ded09a8fa8
6 changed files with 109 additions and 67 deletions
+30 -4
View File
@@ -68,6 +68,7 @@ extends CharacterBody3D
#region Private Properties
var __bugbot_server : BugbotServerAPI
var __bug_report_form : BugReportForm
var __movement_speed : float = 5.0
@@ -239,6 +240,27 @@ func _physics_process(_delta:float) -> void:
static func instantiate(tree:SceneTree) -> void:
tree.root.add_child(load("res://addons/Bugbot/Scenes/bugbot_player.tscn").instantiate() as CharacterBody3D)
static func load_bug_markers(marker_root:Node3D, bug_list:Array):
var bug_marker_preload : PackedScene = preload("res://addons/Bugbot/Scenes/bug_marker.tscn")
for bugbot_data:Resource in bug_list:
if bugbot_data is BugbotBugData:
var bug_status : BugMarker.BugStatus = BugMarker.BugStatus.NEUTRAL
var bug_data : BugbotBugData = bugbot_data as BugbotBugData
if bug_data.resolution == BugbotServerGiteaAPI.RESOLVED_TAG:
bug_status = BugMarker.BugStatus.RESOLVED
elif bug_data.resolution == BugbotServerGiteaAPI.IN_PROGRESS_TAG:
bug_status = BugMarker.BugStatus.IN_PROGRESS
elif bug_data.resolution == BugbotServerGiteaAPI.UNRESOLVED_TAG:
bug_status = BugMarker.BugStatus.UNRESOLVED
var bug_marker : BugMarker = bug_marker_preload.instantiate() as BugMarker
marker_root.add_child(bug_marker)
bug_marker.marker_status = bug_status
bug_marker.bug_data = bugbot_data
bug_marker.global_position = bugbot_data.marker_position
bug_marker.set_rotation_to_normal(bugbot_data.marker_normal)
func __calculate_movement_speed() -> void:
if Input.is_action_pressed(&"bugbot_movement_speed_down") or Input.is_action_just_pressed(&"bugbot_movement_speed_down"):
@@ -317,11 +339,15 @@ func __pop_up_marker_info(_position:Vector3, _normal:Vector3):
func __bug_report_form_data_prepared(tag_lists:Array):
var bug_report_form : Control = preload("res://addons/Bugbot/UI/bug_report_form.tscn").instantiate()
add_child(bug_report_form)
bug_report_form.fill_tags(tag_lists)
bug_report_form.closed.connect(__form_closed)
__bug_report_form = preload("res://addons/Bugbot/UI/bug_report_form.tscn").instantiate()
add_child(__bug_report_form)
__bug_report_form.map_name = get_tree().current_scene.scene_file_path
__bug_report_form.bug_location = __raycast_collision["position"]
__bug_report_form.bug_rotation = __raycast_collision["normal"]
__bug_report_form.fill_tags(tag_lists)
__bug_report_form.closed.connect(__form_closed)
func __form_closed():
__bug_report_form.queue_free()
process_mode = Node.PROCESS_MODE_ALWAYS