From 1f2d8406c26ba06fc3d9341a512d022364c1c94e Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 24 Dec 2019 04:37:17 +0200 Subject: [PATCH] Text under frames and TimelineSeconds color change on different themes --- Main.tscn | 6 +++--- Scripts/Global.gd | 5 ++++- Scripts/PreferencesDialog.gd | 3 +++ Scripts/{ => Rulers}/HorizontalRuler.gd | 0 Scripts/{ => Rulers}/TimelineSeconds.gd | 11 +++++++---- Scripts/{ => Rulers}/VerticalRuler.gd | 0 6 files changed, 17 insertions(+), 8 deletions(-) rename Scripts/{ => Rulers}/HorizontalRuler.gd (100%) rename Scripts/{ => Rulers}/TimelineSeconds.gd (86%) rename Scripts/{ => Rulers}/VerticalRuler.gd (100%) diff --git a/Main.tscn b/Main.tscn index 656a83506..3542267db 100644 --- a/Main.tscn +++ b/Main.tscn @@ -13,8 +13,8 @@ [ext_resource path="res://Assets/Graphics/Dark Themes/Misc/Color defaults.png" type="Texture" id=11] [ext_resource path="res://Assets/Graphics/Brush_button.png" type="Texture" id=12] [ext_resource path="res://Themes & Styles/Dark Theme/DarkRulerStyle.tres" type="StyleBox" id=13] -[ext_resource path="res://Scripts/HorizontalRuler.gd" type="Script" id=14] -[ext_resource path="res://Scripts/VerticalRuler.gd" type="Script" id=15] +[ext_resource path="res://Scripts/Rulers/HorizontalRuler.gd" type="Script" id=14] +[ext_resource path="res://Scripts/Rulers/VerticalRuler.gd" type="Script" id=15] [ext_resource path="res://Prefabs/Canvas.tscn" type="PackedScene" id=16] [ext_resource path="res://Scripts/CameraMovement.gd" type="Script" id=17] [ext_resource path="res://Scripts/SelectionRectangle.gd" type="Script" id=18] @@ -33,7 +33,7 @@ [ext_resource path="res://Assets/Graphics/Dark Themes/Timeline/Go_To_Last_Frame.png" type="Texture" id=31] [ext_resource path="res://Assets/Graphics/Dark Themes/Timeline/Go_To_Last_Frame_Hover.png" type="Texture" id=32] [ext_resource path="res://Assets/Graphics/Dark Themes/Timeline/Loop_None.png" type="Texture" id=33] -[ext_resource path="res://Scripts/TimelineSeconds.gd" type="Script" id=34] +[ext_resource path="res://Scripts/Rulers/TimelineSeconds.gd" type="Script" id=34] [ext_resource path="res://Assets/Graphics/Dark Themes/Timeline/New_Frame.png" type="Texture" id=35] [ext_resource path="res://Assets/Graphics/Dark Themes/Timeline/New_Frame_Hover.png" type="Texture" id=36] [ext_resource path="res://Assets/Graphics/Dark Themes/Palette/Add_Palette.png" type="Texture" id=37] diff --git a/Scripts/Global.gd b/Scripts/Global.gd index bfae59464..7a766e82d 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -410,8 +410,11 @@ func frame_changed(value : int) -> void: canvas.generate_layer_panels() #Make all frame buttons unpressed for c in canvases: + var text_color := Color.white + if theme_type == "Gold" || theme_type == "Light": + text_color = Color.black c.frame_button.get_node("FrameButton").pressed = false - c.frame_button.get_node("FrameID").add_color_override("font_color", Color.white) + c.frame_button.get_node("FrameID").add_color_override("font_color", text_color) #Make only the current frame button pressed canvas.frame_button.get_node("FrameButton").pressed = true canvas.frame_button.get_node("FrameID").add_color_override("font_color", Color("#3c5d75")) diff --git a/Scripts/PreferencesDialog.gd b/Scripts/PreferencesDialog.gd index 150e0134f..88f844476 100644 --- a/Scripts/PreferencesDialog.gd +++ b/Scripts/PreferencesDialog.gd @@ -93,6 +93,9 @@ func change_theme(ID : int) -> void: var disabled_file_name = button.texture_disabled.resource_path.get_file() button.texture_disabled = load("res://Assets/Graphics/%s Themes/%s/%s" % [Global.theme_type, button_category, disabled_file_name]) + # Make sure the frame text gets updated + Global.current_frame = Global.current_frame + func _on_GridWidthValue_value_changed(value : float) -> void: Global.grid_width = value diff --git a/Scripts/HorizontalRuler.gd b/Scripts/Rulers/HorizontalRuler.gd similarity index 100% rename from Scripts/HorizontalRuler.gd rename to Scripts/Rulers/HorizontalRuler.gd diff --git a/Scripts/TimelineSeconds.gd b/Scripts/Rulers/TimelineSeconds.gd similarity index 86% rename from Scripts/TimelineSeconds.gd rename to Scripts/Rulers/TimelineSeconds.gd index b4880e72e..911e1d741 100644 --- a/Scripts/TimelineSeconds.gd +++ b/Scripts/Rulers/TimelineSeconds.gd @@ -15,6 +15,9 @@ func _process(delta : float) -> void: #Code taken and modified from Godot's source code func _draw() -> void: + var color := Color.white + if Global.theme_type == "Gold" || Global.theme_type == "Light": + color = Color.black var transform := Transform2D() var ruler_transform := Transform2D() var major_subdivide := Transform2D() @@ -43,12 +46,12 @@ func _draw() -> void: for i in range(ceil(first.x), last.x): var position : Vector2 = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)) if i % (major_subdivision * minor_subdivision) == 0: - draw_line(Vector2(position.x + RULER_WIDTH, 0), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) + draw_line(Vector2(position.x + RULER_WIDTH, 0), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), color) var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)).x / 100 val = stepify(val, 0.01) - draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 6), "%ss" % str(val)) + draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 6), "%ss" % str(val), color) else: if i % minor_subdivision == 0: - draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.33), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) + draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.33), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), color) else: - draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.66), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) \ No newline at end of file + draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.66), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), color) \ No newline at end of file diff --git a/Scripts/VerticalRuler.gd b/Scripts/Rulers/VerticalRuler.gd similarity index 100% rename from Scripts/VerticalRuler.gd rename to Scripts/Rulers/VerticalRuler.gd