This commit is contained in:
algodoogle
2026-07-27 13:47:54 +01:00
17 changed files with 706 additions and 204 deletions
+32
View File
@@ -0,0 +1,32 @@
[gd_scene format=3 uid="uid://bxbocxdaayvwx"]
[ext_resource type="Script" uid="uid://bv7oracwmgre8" path="res://UI/progress_bar_3d.gd" id="1_ng8tm"]
[sub_resource type="ViewportTexture" id="ViewportTexture_copv3"]
viewport_path = NodePath("Sprite3D/SubViewport")
[node name="ProgressBar3D" type="Node3D" unique_id=654673176]
script = ExtResource("1_ng8tm")
[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1484008334]
pixel_size = 0.002
texture = SubResource("ViewportTexture_copv3")
[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=35936518]
transparent_bg = true
size = Vector2i(320, 80)
[node name="ProgressBar" type="ProgressBar" parent="Sprite3D/SubViewport" unique_id=727723524]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -150.0
offset_top = -13.5
offset_right = 150.0
offset_bottom = 36.5
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
+33
View File
@@ -0,0 +1,33 @@
extends Node3D
class_name ProgressBar3D
@export var y_billboard: bool = false
@onready var progress_bar: ProgressBar = $Sprite3D/SubViewport/ProgressBar
@onready var sprite_3d: Sprite3D = $Sprite3D
func _ready() -> void:
if not progress_bar:
push_error("Progressbar3D missing reference to ProgressBar")
if y_billboard:
$Sprite3D.billboard = BaseMaterial3D.BillboardMode.BILLBOARD_FIXED_Y
func set_progress(value: float) -> void:
print("ProgressBar set_progress: ", value)
progress_bar.value = clamp(value, 0.0, 1.0) * 100
func get_progress() -> float:
return progress_bar.value
func set_bar_visible(value: bool) -> void:
progress_bar.visible = value
func override_fill_color(color: Color) -> void:
var style_box := StyleBoxFlat.new()
style_box.bg_color = color
# Override the 'fill' StyleBox on the ProgressBar
progress_bar.add_theme_stylebox_override("fill", style_box)
+1
View File
@@ -0,0 +1 @@
uid://bv7oracwmgre8