Skip to content

Commit

Permalink
Text under frames and TimelineSeconds color change on different themes
Browse files Browse the repository at this point in the history
  • Loading branch information
OverloadedOrama committed Dec 24, 2019
1 parent bfd64a6 commit 1f2d840
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Main.tscn
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
5 changes: 4 additions & 1 deletion Scripts/Global.gd
Expand Up @@ -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"))
Expand Down
3 changes: 3 additions & 0 deletions Scripts/PreferencesDialog.gd
Expand Up @@ -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

Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions Scripts/TimelineSeconds.gd → Scripts/Rulers/TimelineSeconds.gd
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.66), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), color)
File renamed without changes.

0 comments on commit 1f2d840

Please sign in to comment.