Bug data is printed to console when a marker is clicked. This will eventually have a real UI to show more detailed information.

This commit is contained in:
Jamie Greunbaum 2024-05-27 02:52:55 -04:00
parent c571c35908
commit e80fb3dff9
4 changed files with 44 additions and 28 deletions

View File

@ -0,0 +1,5 @@
@tool
class_name BugInfoCollider
extends Area3D
var bug_info : BugbotBugData

View File

@ -17,17 +17,17 @@ const UNRESOLVED_TINT : Color = Color(0.1,0.0,0.0)
const IN_PROGRESS_TINT : Color = Color(0.5,0.5,0.0)
const RESOLVED_TINT : Color = Color(0.0,1.0,0.0)
var bug_data : BugbotBugData
var bug_info : BugbotBugData : set = set_bug_info, get = get_bug_info
var __arrow : MeshInstance3D
var __billboard : MeshInstance3D
var __info_collider : Area3D
var __info_collider : BugInfoCollider
func _enter_tree() -> void:
__arrow = $Arrow as MeshInstance3D
__billboard = $Billboard as MeshInstance3D
__info_collider = $Billboard/Info as Area3D
__info_collider = $Billboard/Info as BugInfoCollider
set_info_enabled(enable_info)
__set_marker_status(marker_status)
@ -38,11 +38,16 @@ func set_rotation_to_normal(_normal:Vector3) -> void:
global_transform.basis.x = global_transform.basis.z.cross(_normal)
global_transform.basis = global_transform.basis.orthonormalized()
func set_info_enabled(_enable:bool):
func set_info_enabled(_enable:bool) -> void:
if __info_collider:
__info_collider.collision_layer = 0xFFFFFFFF if _enable else 0x00000000
enable_info = _enable
func set_bug_info(bug_info:BugbotBugData) -> void:
__info_collider.bug_info = bug_info
func get_bug_info() -> BugbotBugData:
return __info_collider.bug_info
func __set_marker_status(_status:BugStatus) -> void:
match _status:

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://crr6cjploetps"]
[gd_scene load_steps=12 format=3 uid="uid://crr6cjploetps"]
[ext_resource type="Script" path="res://addons/Bugbot/Scenes/bug_marker.gd" id="1_1adfi"]
[ext_resource type="ArrayMesh" uid="uid://dtvea38mlpfla" path="res://addons/Bugbot/Meshes/arrow.res" id="1_65xos"]
@ -6,6 +6,9 @@
[ext_resource type="Resource" uid="uid://dgsi0x8bj0twj" path="res://addons/Bugbot/Materials/BugMarker/bug_marker_unresolved.res" id="3_slhi1"]
[ext_resource type="Resource" uid="uid://qeog5ye8d64o" path="res://addons/Bugbot/Materials/BugMarker/bug_marker_in_progress.res" id="4_jrygt"]
[ext_resource type="Resource" uid="uid://bpog70fji227f" path="res://addons/Bugbot/Materials/BugMarker/bug_marker_resolved.res" id="5_yhhan"]
[ext_resource type="Material" uid="uid://rx6pr3xgpf6r" path="res://addons/Bugbot/Materials/BugMarker/bug_marker_arrow_neutral.material" id="7_r3wy7"]
[ext_resource type="Material" uid="uid://dkaq0ok73o5d4" path="res://addons/Bugbot/Materials/BugMarker/bug_marker_icon_neutral.material" id="8_lbbxq"]
[ext_resource type="Script" path="res://addons/Bugbot/Scenes/bug_info_collider.gd" id="9_b1yii"]
[sub_resource type="QuadMesh" id="QuadMesh_dd1nc"]
custom_aabb = AABB(-0.25, -0.25, -0.25, 0.5, 0.5, 0.5)
@ -24,17 +27,20 @@ marker_material_resolved = ExtResource("5_yhhan")
[node name="Arrow" type="MeshInstance3D" parent="."]
cast_shadow = 0
mesh = ExtResource("1_65xos")
surface_material_override/0 = ExtResource("7_r3wy7")
[node name="Billboard" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0)
cast_shadow = 0
mesh = SubResource("QuadMesh_dd1nc")
surface_material_override/0 = ExtResource("8_lbbxq")
[node name="Info" type="Area3D" parent="Billboard" groups=["BugMarkerInfo"]]
collision_layer = 4294967295
collision_mask = 0
monitoring = false
monitorable = false
script = ExtResource("9_b1yii")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Billboard/Info"]
shape = SubResource("SphereShape3D_t2p88")

View File

@ -247,24 +247,24 @@ static func load_bug_markers(marker_root:Node, bug_list:Array) -> void:
Bugbot.adjust_bug_marker_colours()
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)
for bug_info:BugbotBugData in bug_list:
if not bug_info: continue
var bug_status : BugMarker.BugStatus = BugMarker.BugStatus.NEUTRAL
if bug_info.resolution == BugbotServerGiteaAPI.RESOLVED_TAG:
bug_status = BugMarker.BugStatus.RESOLVED
elif bug_info.resolution == BugbotServerGiteaAPI.IN_PROGRESS_TAG:
bug_status = BugMarker.BugStatus.IN_PROGRESS
elif bug_info.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_info = bug_info
bug_marker.global_position = bug_info.marker_position
bug_marker.set_rotation_to_normal(bug_info.marker_normal)
static func adjust_bug_marker_colours() -> void:
var unresolved_colour : Color = ProjectSettings.get_setting("bugbot/markers/unresolved/tint", BugMarker.UNRESOLVED_TINT)
@ -363,9 +363,9 @@ func __raycast_to_world() -> void:
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)
var collider : BugInfoCollider = __raycast_collision["collider"] as BugInfoCollider
if collider:
__pop_up_marker_info(collider, _position, _normal)
else:
__place_marker(_position, _normal)
@ -373,8 +373,8 @@ func __place_marker(_position:Vector3, _normal:Vector3) -> void:
process_mode = Node.PROCESS_MODE_PAUSABLE
__bugbot_server._prepare_form(__bug_report_form_data_prepared)
func __pop_up_marker_info(_position:Vector3, _normal:Vector3) -> void:
print("Pop up bug marker info here.")
func __pop_up_marker_info(_collider:BugInfoCollider, _position:Vector3, _normal:Vector3) -> void:
print(_collider.bug_info.title)
func __bug_report_form_data_prepared(tag_lists:Array) -> void: