WIP: audio clip controls and UI
This commit is contained in:
@@ -34,6 +34,10 @@ func format_time_ms_minutes(ms: float) -> String:
|
||||
var milliseconds = fmod(ms, 1000.0)
|
||||
return "%02d:%02d.%03d" % [minutes, seconds, milliseconds]
|
||||
|
||||
|
||||
func get_pixels_per_unit() -> float:
|
||||
return 50.0 * zoom
|
||||
|
||||
func _draw():
|
||||
var primary_color = get_theme_color("line_primary_color", "Timeline")
|
||||
var secondary_color = get_theme_color("line_secondary_color", "Timeline")
|
||||
@@ -70,8 +74,21 @@ func _draw():
|
||||
draw_string(font, Vector2(x - time_label_offset_x, time_label_offset_y), format_time_ms_minutes(time), HORIZONTAL_ALIGNMENT_CENTER, -1, font_size, primary_color)
|
||||
else:
|
||||
draw_line(Vector2(x, 28.0), Vector2(x, timeline_y), secondary_color, 1)
|
||||
|
||||
queue_sort()
|
||||
pass
|
||||
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_SORT_CHILDREN:
|
||||
for c in get_children():
|
||||
if c is not AudioClip: continue
|
||||
var pixels_per_unit := 50.0 * zoom
|
||||
var start = ((c.start_time / time_interval) * pixels_per_unit) - time_offset
|
||||
var width = (c.end_time - c.start_time) / time_interval * pixels_per_unit
|
||||
|
||||
c.position = Vector2(start, 0.0)
|
||||
c.size = Vector2(width, c.size.y)
|
||||
|
||||
func _gui_input(event):
|
||||
var zoom_factor = 1.1
|
||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
|
||||
Reference in New Issue
Block a user