Bugs are now only placed in the scene if the bug report form was submitted.

This commit is contained in:
Jamie Greunbaum 2024-05-27 00:01:03 -04:00
parent 209d83cfea
commit a31a2f63af
2 changed files with 20 additions and 17 deletions

View File

@ -321,7 +321,7 @@ func __calculate_button_presses() -> void:
func __on_exit_placement_timer_timeout() -> void:
queue_free()
func __raycast_to_world():
func __raycast_to_world() -> void:
var space : PhysicsDirectSpaceState3D = get_world_3d().direct_space_state
var query : PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create(global_position, global_position - global_transform.basis.z * ray_length)
query.collide_with_areas = true
@ -338,40 +338,43 @@ func __raycast_to_world():
__laser_beam.visible = false
func __select_at_location(_position:Vector3, _normal:Vector3):
func __select_at_location(_position:Vector3, _normal:Vector3) -> void:
var collider : Area3D = __raycast_collision["collider"] as Area3D
if collider and collider.is_in_group("BugMarkerInfo"):
__pop_up_marker_info(_position, _normal)
else:
__place_marker(_position, _normal)
func __place_marker(_position:Vector3, _normal:Vector3):
func __place_marker(_position:Vector3, _normal:Vector3) -> void:
process_mode = Node.PROCESS_MODE_PAUSABLE
var marker : BugMarker = (load(bug_marker) as PackedScene).instantiate() as BugMarker
get_tree().get_root().add_child(marker)
marker.global_position = _position
marker.set_rotation_to_normal(_normal)
marker.marker_status = BugMarker.BugStatus.UNRESOLVED
__bugbot_server._prepare_form(__bug_report_form_data_prepared)
func __pop_up_marker_info(_position:Vector3, _normal:Vector3):
func __pop_up_marker_info(_position:Vector3, _normal:Vector3) -> void:
print("Pop up bug marker info here.")
func __bug_report_form_data_prepared(tag_lists:Array):
func __bug_report_form_data_prepared(tag_lists:Array) -> void:
__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.submitted.connect(__form_submitted)
__bug_report_form.cancelled.connect(__form_cancelled)
func __form_submitted(map_name:String, bug_position:Vector3, bug_normal:Vector3) -> void:
var marker : BugMarker = (load(bug_marker) as PackedScene).instantiate() as BugMarker
get_tree().get_root().add_child(marker)
marker.global_position = bug_position
marker.set_rotation_to_normal(bug_normal)
marker.marker_status = BugMarker.BugStatus.UNRESOLVED
__form_cancelled()
func __form_cancelled() -> void:
__bug_report_form.queue_free()
process_mode = Node.PROCESS_MODE_ALWAYS
func __place_dummy_marker():
func __place_dummy_marker() -> void:
if __raycast_collision:
__bug_marker_dummy.set_rotation_to_normal(__raycast_collision["normal"])
__bug_marker_dummy.visible = true

View File

@ -1,7 +1,8 @@
class_name BugReportForm
extends ColorRect
signal closed
signal submitted(map_name:String, bug_location:Vector3, bug_rotation:Vector3)
signal cancelled
@onready var __version_button : MenuButton = $Form/VBoxContainerLeft/GridContainer/VersionButton
@onready var __hardware_button : MenuButton = $Form/VBoxContainerLeft/GridContainer/HardwareButton
@ -100,10 +101,9 @@ func __get_label_ids_for_submission_data(label_array:Array, label_group_id:int):
break
func __submission_response(response:Variant):
print(response)
submitted.emit(map_name, bug_location, bug_rotation)
queue_free()
closed.emit()
func _on_cancel_button_pressed() -> void:
cancelled.emit()
queue_free()
closed.emit()