Added a special resource to contain unique instances of BugMarker materials.
This commit is contained in:
parent
d279bef2b1
commit
8062cd3641
BIN
Materials/BugMarker/bug_marker_arrow.material.depren
Normal file
BIN
Materials/BugMarker/bug_marker_arrow.material.depren
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_arrow_in_progress.material
Normal file
BIN
Materials/BugMarker/bug_marker_arrow_in_progress.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_arrow_neutral.material
Normal file
BIN
Materials/BugMarker/bug_marker_arrow_neutral.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_arrow_resolved.material
Normal file
BIN
Materials/BugMarker/bug_marker_arrow_resolved.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_arrow_unresolved.material
Normal file
BIN
Materials/BugMarker/bug_marker_arrow_unresolved.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_icon.material.depren
Normal file
BIN
Materials/BugMarker/bug_marker_icon.material.depren
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_icon_in_progress.material
Normal file
BIN
Materials/BugMarker/bug_marker_icon_in_progress.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_icon_neutral.material
Normal file
BIN
Materials/BugMarker/bug_marker_icon_neutral.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_icon_resolved.material
Normal file
BIN
Materials/BugMarker/bug_marker_icon_resolved.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_icon_unresolved.material
Normal file
BIN
Materials/BugMarker/bug_marker_icon_unresolved.material
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_in_progress.res
Normal file
BIN
Materials/BugMarker/bug_marker_in_progress.res
Normal file
Binary file not shown.
5
Materials/BugMarker/bug_marker_material_pack.gd
Normal file
5
Materials/BugMarker/bug_marker_material_pack.gd
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class_name BugMarkerMaterialPack
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
@export var arrow : ShaderMaterial
|
||||||
|
@export var icon : ShaderMaterial
|
||||||
BIN
Materials/BugMarker/bug_marker_neutral.res
Normal file
BIN
Materials/BugMarker/bug_marker_neutral.res
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_resolved.res
Normal file
BIN
Materials/BugMarker/bug_marker_resolved.res
Normal file
Binary file not shown.
BIN
Materials/BugMarker/bug_marker_unresolved.res
Normal file
BIN
Materials/BugMarker/bug_marker_unresolved.res
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Meshes/arrow.res
BIN
Meshes/arrow.res
Binary file not shown.
Binary file not shown.
@ -1,25 +1,23 @@
|
|||||||
class_name BugMarker
|
class_name BugMarker
|
||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
|
@export_group("Marker", "marker_")
|
||||||
enum BugStatus { NEUTRAL, UNRESOLVED, IN_PROGRESS, RESOLVED }
|
enum BugStatus { NEUTRAL, UNRESOLVED, IN_PROGRESS, RESOLVED }
|
||||||
@export var marker_status : BugStatus = BugStatus.NEUTRAL : set = __set_marker_status
|
@export var marker_status : BugStatus = BugStatus.NEUTRAL : set = __set_marker_status
|
||||||
const NEUTRAL_COLOUR = Color.CORNFLOWER_BLUE
|
@export var marker_material_neutral : BugMarkerMaterialPack
|
||||||
const UNRESOLVED_COLOUR = Color(0.1, 0.0, 0.0)
|
@export var marker_material_unresolved : BugMarkerMaterialPack
|
||||||
const IN_PROGRESS_COLOUR = Color(0.5, 0.5, 0.0)
|
@export var marker_material_in_progress : BugMarkerMaterialPack
|
||||||
const RESOLVED_COLOUR = Color(0.0, 1.0, 0.0)
|
@export var marker_material_resolved : BugMarkerMaterialPack
|
||||||
|
|
||||||
|
@export_group("")
|
||||||
@export var enable_info : bool = true : set = set_info_enabled
|
@export var enable_info : bool = true : set = set_info_enabled
|
||||||
|
|
||||||
@onready var __arrow : MeshInstance3D = $Arrow as MeshInstance3D
|
@onready var __arrow : MeshInstance3D = $Arrow as MeshInstance3D
|
||||||
@onready var __billboard : MeshInstance3D = $Billboard as MeshInstance3D
|
@onready var __billboard : MeshInstance3D = $Billboard as MeshInstance3D
|
||||||
@onready var __info_collider : Area3D = $Billboard/Info as Area3D
|
@onready var __info_collider : Area3D = $Billboard/Info as Area3D
|
||||||
var __arrow_material : ShaderMaterial
|
|
||||||
var __billboard_material : ShaderMaterial
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
__arrow_material = __arrow.mesh.surface_get_material(0) as ShaderMaterial
|
|
||||||
__billboard_material = __billboard.mesh.surface_get_material(0) as ShaderMaterial
|
|
||||||
set_info_enabled(enable_info)
|
set_info_enabled(enable_info)
|
||||||
__set_marker_status(marker_status)
|
__set_marker_status(marker_status)
|
||||||
|
|
||||||
@ -35,19 +33,18 @@ func set_info_enabled(_enable:bool):
|
|||||||
|
|
||||||
|
|
||||||
func __set_marker_status(_status:BugStatus) -> void:
|
func __set_marker_status(_status:BugStatus) -> void:
|
||||||
if __arrow_material and __billboard_material:
|
match _status:
|
||||||
match _status:
|
BugStatus.NEUTRAL:
|
||||||
BugStatus.NEUTRAL:
|
__arrow.set_surface_override_material(0, marker_material_neutral.arrow)
|
||||||
__arrow_material.set_shader_parameter("colour", NEUTRAL_COLOUR)
|
__billboard.set_surface_override_material(0, marker_material_neutral.icon)
|
||||||
__billboard_material.set_shader_parameter("colour", NEUTRAL_COLOUR)
|
BugStatus.UNRESOLVED:
|
||||||
BugStatus.UNRESOLVED:
|
__arrow.set_surface_override_material(0, marker_material_unresolved.arrow)
|
||||||
__arrow_material.set_shader_parameter("colour", UNRESOLVED_COLOUR)
|
__billboard.set_surface_override_material(0, marker_material_unresolved.icon)
|
||||||
__billboard_material.set_shader_parameter("colour", UNRESOLVED_COLOUR)
|
BugStatus.IN_PROGRESS:
|
||||||
BugStatus.IN_PROGRESS:
|
__arrow.set_surface_override_material(0, marker_material_in_progress.arrow)
|
||||||
__arrow_material.set_shader_parameter("colour", IN_PROGRESS_COLOUR)
|
__billboard.set_surface_override_material(0, marker_material_in_progress.icon)
|
||||||
__billboard_material.set_shader_parameter("colour", IN_PROGRESS_COLOUR)
|
BugStatus.RESOLVED:
|
||||||
BugStatus.RESOLVED:
|
__arrow.set_surface_override_material(0, marker_material_resolved.arrow)
|
||||||
__arrow_material.set_shader_parameter("colour", RESOLVED_COLOUR)
|
__billboard.set_surface_override_material(0, marker_material_resolved.icon)
|
||||||
__billboard_material.set_shader_parameter("colour", RESOLVED_COLOUR)
|
|
||||||
|
|
||||||
marker_status = _status
|
marker_status = _status
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://crr6cjploetps"]
|
[gd_scene load_steps=9 format=3 uid="uid://crr6cjploetps"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://addons/Bugbot/Scenes/bug_marker.gd" id="1_1adfi"]
|
[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"]
|
[ext_resource type="ArrayMesh" uid="uid://dtvea38mlpfla" path="res://addons/Bugbot/Meshes/arrow.res" id="1_65xos"]
|
||||||
[ext_resource type="Material" uid="uid://dkaq0ok73o5d4" path="res://addons/Bugbot/Materials/bug_marker_icon.material" id="3_px2dp"]
|
[ext_resource type="Resource" uid="uid://br7bd80u7vyid" path="res://addons/Bugbot/Materials/BugMarker/bug_marker_neutral.res" id="2_uwubq"]
|
||||||
|
[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"]
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_dd1nc"]
|
[sub_resource type="QuadMesh" id="QuadMesh_dd1nc"]
|
||||||
material = ExtResource("3_px2dp")
|
|
||||||
custom_aabb = AABB(-0.25, -0.25, -0.25, 0.5, 0.5, 0.5)
|
custom_aabb = AABB(-0.25, -0.25, -0.25, 0.5, 0.5, 0.5)
|
||||||
size = Vector2(0.25, 0.25)
|
size = Vector2(0.25, 0.25)
|
||||||
|
|
||||||
@ -14,6 +16,10 @@ radius = 0.125398
|
|||||||
|
|
||||||
[node name="BugMarker" type="Node3D"]
|
[node name="BugMarker" type="Node3D"]
|
||||||
script = ExtResource("1_1adfi")
|
script = ExtResource("1_1adfi")
|
||||||
|
marker_material_neutral = ExtResource("2_uwubq")
|
||||||
|
marker_material_unresolved = ExtResource("3_slhi1")
|
||||||
|
marker_material_in_progress = ExtResource("4_jrygt")
|
||||||
|
marker_material_resolved = ExtResource("5_yhhan")
|
||||||
|
|
||||||
[node name="Arrow" type="MeshInstance3D" parent="."]
|
[node name="Arrow" type="MeshInstance3D" parent="."]
|
||||||
cast_shadow = 0
|
cast_shadow = 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user