Skip to content

Commit 1da4a31

Browse files
author
Liam Sherwin
committed
Animation and Color updates
1 parent f4eeb85 commit 1da4a31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1534
-341
lines changed

Main.tscn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[gd_scene load_steps=12 format=3 uid="uid://7f5erpa1ts1n"]
22

33
[ext_resource type="Theme" uid="uid://cyua45ur0ijqo" path="res://assets/Main.theme" id="1_lygr6"]
4-
[ext_resource type="Script" path="res://scripts/ui/Main.gd" id="2_2mnc0"]
4+
[ext_resource type="Script" uid="uid://c3blb4c6exhxl" path="res://scripts/ui/Main.gd" id="2_2mnc0"]
55
[ext_resource type="FontFile" uid="uid://crlak6jhg5jy2" path="res://assets/font/RubikMonoOne-Regular.ttf" id="3_7gl8s"]
66
[ext_resource type="Texture2D" uid="uid://bbennjke0ioen" path="res://assets/icons/Add.svg" id="7_4ai6i"]
77
[ext_resource type="Texture2D" uid="uid://rqf8w11gk6ud" path="res://assets/icons/Edit.svg" id="9_l0dk1"]
8-
[ext_resource type="Script" path="res://scripts/ui/Tabs.gd" id="11_g0pp1"]
8+
[ext_resource type="Script" uid="uid://rcg26r86qsdg" path="res://scripts/ui/Tabs.gd" id="11_g0pp1"]
99
[ext_resource type="Texture2D" uid="uid://bhl73t2e0jcwn" path="res://assets/icons/close.svg" id="14_jv1kq"]
1010

1111
[sub_resource type="LabelSettings" id="LabelSettings_8efsq"]

StatusBar.gd

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright (c) 2024 Liam Sherwin, All rights reserved.
2+
# This file is part of the Spectrum Lighting Engine, licensed under the GPL v3.
3+
4+
class_name CoreUIStatusBar extends PanelContainer
5+
## Core UI script for the main status bar
6+
7+
8+
## The VersionLabel
9+
@export var _version_label: Label
10+
11+
## The QuickAccessContainer
12+
@export var _quick_access_container: HBoxContainer
13+
14+
15+
## Config for quick access buttons
16+
var _quick_access_config: Array = [
17+
{
18+
"panel": Interface.panels.Programmer,
19+
"icon": load("res://assets/icons/Programmer.svg"),
20+
"size": Vector2.ZERO
21+
},
22+
{
23+
"panel": Interface.panels.Fixtures,
24+
"icon": load("res://assets/icons/Fixture.svg"),
25+
"size": Vector2(800, 500)
26+
},
27+
{
28+
"panel": Interface.panels.Functions,
29+
"icon": load("res://assets/icons/Functions.svg"),
30+
"size": Vector2(800, 500)
31+
},
32+
{
33+
"panel": Interface.panels.Settings,
34+
"icon": load("res://assets/icons/Settings.svg"),
35+
"size": Vector2.ZERO
36+
},
37+
{
38+
"panel": Interface.panels.SaveLoad,
39+
"icon": load("res://assets/icons/Storage.svg"),
40+
"size": Vector2(1200, 800)
41+
},
42+
]
43+
44+
45+
func _ready() -> void:
46+
_version_label.text = Details.version
47+
_reload_quick_access()
48+
49+
50+
## Reloads the list of quick access buttons
51+
func _reload_quick_access() -> void:
52+
for old_button: Button in _quick_access_container.get_children():
53+
old_button.queue_free()
54+
55+
for config: Dictionary in _quick_access_config:
56+
var new_button: Button = Button.new()
57+
var new_panel: UIPanel = config.panel.instantiate()
58+
59+
new_panel.hide()
60+
get_tree().process_frame.connect(func ():
61+
config.size = config.size if config.size != Vector2.ZERO else new_panel.get_combined_minimum_size()
62+
new_panel.set_anchors_preset(Control.PRESET_CENTER)
63+
new_panel.size = config.size
64+
new_panel.position = (size / 2) - (config.size / 2)
65+
, CONNECT_ONE_SHOT)
66+
67+
new_button.icon = config.icon
68+
new_button.flat = false
69+
new_button.toggle_mode = true
70+
new_button.toggled.connect(func (toggled_on: bool):
71+
if toggled_on:
72+
Interface.show_custom_popup(new_panel)
73+
else:
74+
Interface.hide_custom_popup(new_panel)
75+
)
76+
new_panel.close_request.connect(new_button.set_pressed_no_signal.bind(false))
77+
78+
_quick_access_container.add_child(new_button)
79+
Interface.add_custom_popup(new_panel)

StatusBar.gd.uid

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://5twbcqrk7as1

UIv3.tscn

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[gd_scene load_steps=5 format=3 uid="uid://d00fmrh7nbaua"]
2+
3+
[ext_resource type="PackedScene" uid="uid://bsxgp5g0jmyke" path="res://panels/Desk/Desk.tscn" id="1_mfxly"]
4+
[ext_resource type="Script" uid="uid://5twbcqrk7as1" path="res://StatusBar.gd" id="2_pj23w"]
5+
[ext_resource type="LabelSettings" uid="uid://ci6veq1d2x5c4" path="res://assets/styles/DimText.tres" id="3_pj23w"]
6+
7+
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pj23w"]
8+
content_margin_left = 5.0
9+
content_margin_top = 5.0
10+
content_margin_right = 5.0
11+
content_margin_bottom = 5.0
12+
bg_color = Color(0.140447, 0.140447, 0.140447, 1)
13+
border_color = Color(0.309804, 0.309804, 0.309804, 1)
14+
corner_radius_top_left = 5
15+
corner_radius_top_right = 5
16+
corner_radius_bottom_right = 5
17+
corner_radius_bottom_left = 5
18+
19+
[node name="UIv3" type="PanelContainer"]
20+
anchors_preset = 15
21+
anchor_right = 1.0
22+
anchor_bottom = 1.0
23+
grow_horizontal = 2
24+
grow_vertical = 2
25+
theme_override_styles/panel = SubResource("StyleBoxFlat_pj23w")
26+
27+
[node name="VBoxContainer" type="VBoxContainer" parent="."]
28+
layout_mode = 2
29+
30+
[node name="Desk" parent="VBoxContainer" instance=ExtResource("1_mfxly")]
31+
layout_mode = 2
32+
size_flags_vertical = 3
33+
34+
[node name="StatusBar" type="PanelContainer" parent="VBoxContainer" node_paths=PackedStringArray("_version_label", "_quick_access_container")]
35+
layout_mode = 2
36+
script = ExtResource("2_pj23w")
37+
_version_label = NodePath("HBoxContainer/VersionLabel")
38+
_quick_access_container = NodePath("HBoxContainer/QuickAccessContainer")
39+
40+
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/StatusBar"]
41+
layout_mode = 2
42+
43+
[node name="QuickAccessContainer" type="HBoxContainer" parent="VBoxContainer/StatusBar/HBoxContainer"]
44+
layout_mode = 2
45+
46+
[node name="VersionLabel" type="Label" parent="VBoxContainer/StatusBar/HBoxContainer"]
47+
layout_mode = 2
48+
size_flags_horizontal = 10
49+
text = "dasdasd"
50+
label_settings = ExtResource("3_pj23w")

assets/Main.theme

-4 Bytes
Binary file not shown.

assets/asset_scripts/color_picker.png

26.2 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://2p7ffb5yq0hx"
6+
path="res://.godot/imported/color_picker.png-7629c737c9c675f61ee1738a8a9f93d1.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://assets/asset_scripts/color_picker.png"
14+
dest_files=["res://.godot/imported/color_picker.png-7629c737c9c675f61ee1738a8a9f93d1.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
28.6 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://c6xutedgnlhou"
6+
path="res://.godot/imported/color_picker_rounded.png-013ba22a6935b45032cd35fae6f20be4.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://assets/asset_scripts/color_picker_rounded.png"
14+
dest_files=["res://.godot/imported/color_picker_rounded.png-013ba22a6935b45032cd35fae6f20be4.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
28.8 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://b8tacggahlmrm"
6+
path="res://.godot/imported/color_picker_rounded_aa.png-790d4d4999d9be325db7cbd2e4ece6c3.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://assets/asset_scripts/color_picker_rounded_aa.png"
14+
dest_files=["res://.godot/imported/color_picker_rounded_aa.png-790d4d4999d9be325db7cbd2e4ece6c3.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
from PIL import Image, ImageDraw
2+
import colorsys
3+
4+
def generate_rainbow_gradient(size: int, output_path: str = "color_picker_rounded_aa.png"):
5+
margin = 5
6+
inner_size = size - 2 * margin
7+
radius = 10
8+
9+
# Supersampling factor for anti-aliasing
10+
ss = 4
11+
ss_size = size * ss
12+
ss_radius = radius * ss
13+
ss_margin = margin * ss
14+
ss_inner = ss_size - 2 * ss_margin
15+
16+
# Create high-res mask for AA rounded corners
17+
mask_hr = Image.new("L", (ss_size, ss_size), 0)
18+
draw = ImageDraw.Draw(mask_hr)
19+
draw.rounded_rectangle(
20+
[(0, 0), (ss_size - 1, ss_size - 1)],
21+
radius=ss_radius,
22+
fill=255
23+
)
24+
# Downsample with antialiasing
25+
mask = mask_hr.resize((size, size), Image.LANCZOS)
26+
27+
# Create base image (RGBA)
28+
img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
29+
pixels = img.load()
30+
31+
# Fill center gradient (non-ss, normal resolution)
32+
for x in range(inner_size):
33+
hue = x / inner_size
34+
for y in range(inner_size):
35+
sat = 1.0 - (y / inner_size)
36+
r, g, b = colorsys.hsv_to_rgb(hue, sat, 1.0)
37+
pixels[x + margin, y + margin] = (int(r * 255), int(g * 255), int(b * 255), 255)
38+
39+
# Extend edges into margin
40+
for x in range(margin, size - margin):
41+
for y in range(margin):
42+
pixels[x, y] = pixels[x, margin] # Top
43+
pixels[x, size - 1 - y] = pixels[x, size - 1 - margin] # Bottom
44+
45+
for y in range(size):
46+
for x in range(margin):
47+
pixels[x, y] = pixels[margin, y] # Left
48+
pixels[size - 1 - x, y] = pixels[size - 1 - margin, y] # Right
49+
50+
# Apply anti-aliased mask as alpha channel
51+
img.putalpha(mask)
52+
53+
img.save(output_path)
54+
print(f"Saved with smooth rounded corners: {output_path}")
55+
56+
# Run example
57+
generate_rainbow_gradient(512)
58+

assets/icons/Crosshair.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/icons/Crosshair.svg.import

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://b7q628ocmror7"
6+
path="res://.godot/imported/Crosshair.svg-e1c83855d3b79abd8058f33b1034eaa1.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://assets/icons/Crosshair.svg"
14+
dest_files=["res://.godot/imported/Crosshair.svg-e1c83855d3b79abd8058f33b1034eaa1.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
35+
svg/scale=1.0
36+
editor/scale_with_editor_scale=false
37+
editor/convert_colors_with_editor_theme=false

assets/icons/DataContainer.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/icons/DataContainer.svg.import

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://dfi7uhhle4irm"
6+
path="res://.godot/imported/DataContainer.svg-2b90b2eda55ce9e2e49ca69f4cf33792.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://assets/icons/DataContainer.svg"
14+
dest_files=["res://.godot/imported/DataContainer.svg-2b90b2eda55ce9e2e49ca69f4cf33792.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
35+
svg/scale=1.0
36+
editor/scale_with_editor_scale=false
37+
editor/convert_colors_with_editor_theme=false

0 commit comments

Comments
 (0)