Remove themes.

This commit is contained in:
Relintai 2020-11-29 00:51:46 +01:00
parent 353f4400f7
commit a68ee39f44
19 changed files with 5 additions and 14963 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,13 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
[resource]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 8, 8 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0

View File

@ -1,14 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
[resource]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 8, 8 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0
modulate_color = Color( 1, 0.537255, 0, 1 )

View File

@ -1,14 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
[resource]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 8, 8 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0
modulate_color = Color( 0, 0, 0, 1 )

View File

@ -1,14 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
[resource]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 8, 8 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0
modulate_color = Color( 1, 0, 0, 1 )

File diff suppressed because one or more lines are too long

View File

@ -432,8 +432,6 @@ func frame_changed(value : int) -> void:
layer.frame_container.get_child(i).pressed = false layer.frame_container.get_child(i).pressed = false
# Select the new frame # Select the new frame
if current_frame < Global.frame_ids.get_child_count():
Global.frame_ids.get_child(current_frame).add_color_override("font_color", Global.control.theme.get_color("Selected Color", "Label"))
if layers and current_frame < layers[current_layer].frame_container.get_child_count(): if layers and current_frame < layers[current_layer].frame_container.get_child_count():
layers[current_layer].frame_container.get_child(current_frame).pressed = true layers[current_layer].frame_container.get_child(current_frame).pressed = true

View File

@ -1,6 +1,5 @@
[gd_scene load_steps=14 format=2] [gd_scene load_steps=13 format=2]
[ext_resource path="res://assets/themes/dark/theme.tres" type="Theme" id=1]
[ext_resource path="res://src/Main.gd" type="Script" id=2] [ext_resource path="res://src/Main.gd" type="Script" id=2]
[ext_resource path="res://src/UI/TopMenuContainer.tscn" type="PackedScene" id=3] [ext_resource path="res://src/UI/TopMenuContainer.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/UI/UI.tscn" type="PackedScene" id=4] [ext_resource path="res://src/UI/UI.tscn" type="PackedScene" id=4]
@ -17,7 +16,6 @@
[node name="Control" type="Control"] [node name="Control" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
theme = ExtResource( 1 )
script = ExtResource( 2 ) script = ExtResource( 2 )
__meta__ = { __meta__ = {
"_edit_horizontal_guides_": [ ], "_edit_horizontal_guides_": [ ],

View File

@ -1,10 +1,6 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/themes/palette_styleboxes/palette_stylebox_pressedr.tres" type="StyleBox" id=1]
[ext_resource path="res://assets/themes/palette_styleboxes/palette_stylebox_hover.tres" type="StyleBox" id=2]
[ext_resource path="res://src/Palette/PaletteButton.gd" type="Script" id=3] [ext_resource path="res://src/Palette/PaletteButton.gd" type="Script" id=3]
[ext_resource path="res://assets/themes/palette_styleboxes/palette_stylebox_focus.tres" type="StyleBox" id=4]
[ext_resource path="res://assets/themes/palette_styleboxes/palette_stylebox_normal.tres" type="StyleBox" id=5]
[ext_resource path="res://assets/graphics/palette/palette_button_fill.png" type="Texture" id=6] [ext_resource path="res://assets/graphics/palette/palette_button_fill.png" type="Texture" id=6]
[sub_resource type="ImageTexture" id=1] [sub_resource type="ImageTexture" id=1]
@ -15,10 +11,6 @@ margin_bottom = 26.0
rect_min_size = Vector2( 26, 26 ) rect_min_size = Vector2( 26, 26 )
hint_tooltip = "Color Name" hint_tooltip = "Color Name"
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
custom_styles/hover = ExtResource( 2 )
custom_styles/pressed = ExtResource( 1 )
custom_styles/focus = ExtResource( 4 )
custom_styles/normal = ExtResource( 5 )
toggle_mode = true toggle_mode = true
action_mode = 0 action_mode = 0
button_mask = 3 button_mask = 3

View File

@ -60,11 +60,6 @@ func _ready() -> void:
else: # If the user doesn't have a language preference, set it to their OS' locale else: # If the user doesn't have a language preference, set it to their OS' locale
TranslationServer.set_locale(OS.get_locale()) TranslationServer.set_locale(OS.get_locale())
if is_cjk(TranslationServer.get_locale()):
Global.control.theme.default_font = preload("res://assets/fonts/CJK/NotoSansCJKtc-Regular.tres")
else:
Global.control.theme.default_font = preload("res://assets/fonts/Roboto-Regular.tres")
for child in get_children(): for child in get_children():
if child is Button: if child is Button:
child.connect("pressed", self, "_on_Language_pressed", [child.get_index()]) child.connect("pressed", self, "_on_Language_pressed", [child.get_index()])

View File

@ -1,131 +0,0 @@
extends Node
onready var themes := [
[preload("res://assets/themes/dark/theme.tres"), "Dark"],
[preload("res://assets/themes/gray/theme.tres"), "Gray"],
[preload("res://assets/themes/blue/theme.tres"), "Blue"],
[preload("res://assets/themes/caramel/theme.tres"), "Caramel"],
[preload("res://assets/themes/light/theme.tres"), "Light"],
[preload("res://assets/themes/purple/theme.tres"), "Purple"],
]
onready var buttons_container : BoxContainer = $ThemeButtons
onready var colors_container : BoxContainer = $ThemeColorsSpacer/ThemeColors
onready var theme_color_preview_scene = preload("res://src/Preferences/ThemeColorPreview.tscn")
func _ready() -> void:
var button_group = ButtonGroup.new()
for theme in themes:
var button := CheckBox.new()
button.name = theme[1]
button.text = theme[1]
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
button.group = button_group
buttons_container.add_child(button)
button.connect("pressed", self, "_on_Theme_pressed", [button.get_index()])
var theme_color_preview : ColorRect = theme_color_preview_scene.instance()
var color1 = theme[0].get_stylebox("panel", "Panel").bg_color
var color2 = theme[0].get_stylebox("panel", "PanelContainer").bg_color
theme_color_preview.get_child(0).color = color1
theme_color_preview.get_child(1).color = color2
colors_container.add_child(theme_color_preview)
if Global.config_cache.has_section_key("preferences", "theme"):
var theme_id = Global.config_cache.get_value("preferences", "theme")
change_theme(theme_id)
buttons_container.get_child(theme_id).pressed = true
else:
change_theme(0)
buttons_container.get_child(0).pressed = true
func _on_Theme_pressed(index : int) -> void:
buttons_container.get_child(index).pressed = true
change_theme(index)
Global.config_cache.set_value("preferences", "theme", index)
Global.config_cache.save("user://cache.ini")
func change_theme(ID : int) -> void:
var font = Global.control.theme.default_font
var main_theme : Theme = themes[ID][0]
if ID == 0 or ID == 1: # Dark or Gray Theme
Global.theme_type = Global.Theme_Types.DARK
elif ID == 2: # Godot's Theme
Global.theme_type = Global.Theme_Types.BLUE
elif ID == 3: # Caramel Theme
Global.theme_type = Global.Theme_Types.CARAMEL
elif ID == 4: # Light Theme
Global.theme_type = Global.Theme_Types.LIGHT
elif ID == 5: # Purple Theme
Global.theme_type = Global.Theme_Types.DARK
Global.control.theme = main_theme
Global.control.theme.default_font = font
Global.default_clear_color = main_theme.get_stylebox("panel", "PanelContainer").bg_color
VisualServer.set_default_clear_color(Color(Global.default_clear_color))
(Global.animation_timeline.get_stylebox("panel", "Panel") as StyleBoxFlat).bg_color = main_theme.get_stylebox("panel", "Panel").bg_color
var fake_vsplit_grabber : TextureRect = Global.find_node_by_name(Global.animation_timeline, "FakeVSplitContainerGrabber")
fake_vsplit_grabber.texture = main_theme.get_icon("grabber", "VSplitContainer")
var layer_button_panel_container : PanelContainer = Global.find_node_by_name(Global.animation_timeline, "LayerButtonPanelContainer")
(layer_button_panel_container.get_stylebox("panel", "PanelContainer") as StyleBoxFlat).bg_color = Global.default_clear_color
var top_menu_style = main_theme.get_stylebox("TopMenu", "Panel")
var ruler_style = main_theme.get_stylebox("Ruler", "Button")
Global.top_menu_container.add_stylebox_override("panel", top_menu_style)
Global.horizontal_ruler.add_stylebox_override("normal", ruler_style)
Global.horizontal_ruler.add_stylebox_override("pressed", ruler_style)
Global.horizontal_ruler.add_stylebox_override("hover", ruler_style)
Global.horizontal_ruler.add_stylebox_override("focus", ruler_style)
Global.vertical_ruler.add_stylebox_override("normal", ruler_style)
Global.vertical_ruler.add_stylebox_override("pressed", ruler_style)
Global.vertical_ruler.add_stylebox_override("hover", ruler_style)
Global.vertical_ruler.add_stylebox_override("focus", ruler_style)
for button in get_tree().get_nodes_in_group("UIButtons"):
if button is TextureButton:
var last_backslash = button.texture_normal.resource_path.get_base_dir().find_last("/")
var button_category = button.texture_normal.resource_path.get_base_dir().right(last_backslash + 1)
var normal_file_name = button.texture_normal.resource_path.get_file()
var theme_type := Global.theme_type
if theme_type == Global.Theme_Types.BLUE:
theme_type = Global.Theme_Types.DARK
var theme_type_string : String = Global.Theme_Types.keys()[theme_type].to_lower()
button.texture_normal = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name])
if button.texture_pressed:
var pressed_file_name = button.texture_pressed.resource_path.get_file()
button.texture_pressed = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, pressed_file_name])
if button.texture_hover:
var hover_file_name = button.texture_hover.resource_path.get_file()
button.texture_hover = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, hover_file_name])
if button.texture_disabled and button.texture_disabled == StreamTexture:
var disabled_file_name = button.texture_disabled.resource_path.get_file()
button.texture_disabled = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, disabled_file_name])
elif button is Button:
var texture : TextureRect
for child in button.get_children():
if child is TextureRect:
texture = child
break
if texture:
var last_backslash = texture.texture.resource_path.get_base_dir().find_last("/")
var button_category = texture.texture.resource_path.get_base_dir().right(last_backslash + 1)
var normal_file_name = texture.texture.resource_path.get_file()
var theme_type := Global.theme_type
if theme_type == Global.Theme_Types.CARAMEL or (theme_type == Global.Theme_Types.BLUE and button_category != "tools"):
theme_type = Global.Theme_Types.DARK
var theme_type_string : String = Global.Theme_Types.keys()[theme_type].to_lower()
texture.texture = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name])
# Make sure the frame text gets updated
Global.current_project.current_frame = Global.current_project.current_frame
Global.preferences_dialog.get_node("Popups/ShortcutSelector").theme = main_theme

View File

@ -149,7 +149,6 @@ func _on_PreferencesDialog_about_to_show(changed_language := false) -> void:
if OS.get_name() != "HTML5": if OS.get_name() != "HTML5":
list.add_item(" " + tr("Startup")) list.add_item(" " + tr("Startup"))
list.add_item(" " + tr("Language")) list.add_item(" " + tr("Language"))
list.add_item(" " + tr("Themes"))
list.add_item(" " + tr("Canvas")) list.add_item(" " + tr("Canvas"))
list.add_item(" " + tr("Image")) list.add_item(" " + tr("Image"))
list.add_item(" " + tr("Shortcuts")) list.add_item(" " + tr("Shortcuts"))
@ -167,7 +166,7 @@ func _on_PreferencesDialog_popup_hide() -> void:
func _on_List_item_selected(index : int) -> void: func _on_List_item_selected(index : int) -> void:
selected_item = index selected_item = index
for child in right_side.get_children(): for child in right_side.get_children():
var content_list = ["Startup", "Languages", "Themes", "Canvas", "Image", "Shortcuts", "Backup", "Indicators"] var content_list = ["Startup", "Languages", "Canvas", "Image", "Shortcuts", "Backup", "Indicators"]
if OS.get_name() == "HTML5": if OS.get_name() == "HTML5":
content_list.erase("Startup") content_list.erase("Startup")
child.visible = child.name == content_list[index] child.visible = child.name == content_list[index]

View File

@ -1,8 +1,7 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://src/Preferences/PreferencesDialog.gd" type="Script" id=1] [ext_resource path="res://src/Preferences/PreferencesDialog.gd" type="Script" id=1]
[ext_resource path="res://src/Preferences/HandleLanguages.gd" type="Script" id=4] [ext_resource path="res://src/Preferences/HandleLanguages.gd" type="Script" id=4]
[ext_resource path="res://src/Preferences/HandleThemes.gd" type="Script" id=5]
[ext_resource path="res://src/Preferences/HandleShortcuts.gd" type="Script" id=6] [ext_resource path="res://src/Preferences/HandleShortcuts.gd" type="Script" id=6]
[sub_resource type="ButtonGroup" id=1] [sub_resource type="ButtonGroup" id=1]
@ -111,26 +110,6 @@ pressed = true
group = SubResource( 1 ) group = SubResource( 1 )
text = "System Language" text = "System Language"
[node name="Themes" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
visible = false
margin_right = 498.0
script = ExtResource( 5 )
[node name="ThemeButtons" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
[node name="ThemeColorsSpacer" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
margin_right = 40.0
margin_bottom = 40.0
[node name="Control" type="Control" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes/ThemeColorsSpacer"]
margin_right = 40.0
margin_bottom = 40.0
[node name="ThemeColors" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes/ThemeColorsSpacer"]
margin_left = 4.0
margin_right = 4.0
custom_constants/separation = 12
[node name="Canvas" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] [node name="Canvas" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
visible = false visible = false
margin_top = 28.0 margin_top = 28.0
@ -909,6 +888,7 @@ valign = 1
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[connection signal="about_to_show" from="." to="." method="_on_PreferencesDialog_about_to_show"] [connection signal="about_to_show" from="." to="." method="_on_PreferencesDialog_about_to_show"]
[connection signal="popup_hide" from="." to="." method="_on_PreferencesDialog_popup_hide"] [connection signal="popup_hide" from="." to="." method="_on_PreferencesDialog_popup_hide"]
[connection signal="item_selected" from="HSplitContainer/List" to="." method="_on_List_item_selected"] [connection signal="item_selected" from="HSplitContainer/List" to="." method="_on_List_item_selected"]