From ac0b877fd0d0a048d901fcce6f4961b79661f172 Mon Sep 17 00:00:00 2001
From: Fabian S <49322676+pattlebass@users.noreply.github.com>
Date: Sun, 30 Oct 2022 13:46:17 +0200
Subject: [PATCH 01/18] Update image
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c51a9f1..13710c5 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,8 @@
This is a recreation of the app with the same name found on Sony Ericsson devices of the 2000s.
-![MusicDJ image](https://i.imgur.com/aUPec4l.png)
+![MusicDJ image](https://user-images.githubusercontent.com/49322676/198876697-d3a7e75d-c21b-44d5-90d2-3104591055af.jpg)
+
## Features
* Create songs using the original samples
From 9fbc5fef0a88d82b99a681e05dece9267752f540 Mon Sep 17 00:00:00 2001
From: Fabian S <49322676+pattlebass@users.noreply.github.com>
Date: Mon, 7 Nov 2022 13:57:38 +0200
Subject: [PATCH 02/18] Tweak README
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 13710c5..6df5db6 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,6 @@ This is a recreation of the app with the same name found on Sony Ericsson device
* Create songs using the original samples
* Open original MusicDJ MIDI files
* Export the songs to the .wav format
-* Save the project you're working on for later
* Both a Dark and a White theme are available, more in the future
## To be added
@@ -24,7 +23,7 @@ This is a recreation of the app with the same name found on Sony Ericsson device
* [Linux](https://github.com/pattlebass/Music-Dj/releases/latest/download/MusicDJ.Linux.zip) (You may have to give it executable permissions)
* [HTML5 (Browser)](https://pattlebass.itch.io/musicdj) (Can be buggy on mobile devices)
-You might get warnings about this app not being safe. Like [this](https://i.stack.imgur.com/LlLiX.png) and [this](https://i.imgur.com/VlnKgTB.png). That's because I'm not a verified publisher and there is nothing I can do at the moment.
+You might get warnings about this app not being safe. That's because I'm not a verified publisher and there is nothing I can do at the moment.
On Android, you'll need to allow apps from unknown sources. If you don't know how to do that, search a tutorial for your specific Android version.
From 2206f9287911f05816dc3ac2aab5a10cfc774dfd Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Sun, 11 Dec 2022 13:02:38 +0200
Subject: [PATCH 03/18] Change project format
* Add `Song` class
* Remove `BoomBox.column_index`
---
demo.mdj | 2 +-
project.godot | 6 ++
scenes/BoomBox.gd | 72 ++++++--------
scenes/Column.gd | 4 +-
scenes/FloatButton.gd | 2 +-
scenes/Song.gd | 58 +++++++++++
scenes/dialogs/ColumnDialog.gd | 35 ++++---
scenes/dialogs/ColumnDialog.tscn | 6 +-
scenes/dialogs/SoundDialog.gd | 10 +-
scenes/dialogs/load_dialog/LoadDialog.gd | 7 +-
scenes/main.gd | 118 ++++++++++++-----------
11 files changed, 187 insertions(+), 133 deletions(-)
create mode 100644 scenes/Song.gd
diff --git a/demo.mdj b/demo.mdj
index 373a16f..3aa7259 100644
--- a/demo.mdj
+++ b/demo.mdj
@@ -1 +1 @@
-[[4,11,11,11,11,11,11,19,20,27,28,0,0,0,0],[0,0,0,11,12,11,12,19,20,27,28,0,0,0,0],[0,0,0,0,0,11,12,19,20,27,28,0,0,0,0],[0,3,0,3,0,0,0,19,20,27,28,0,0,0,0]]
\ No newline at end of file
+{"data":[[4,11,11,11,11,11,11,19,20,27,28,0,0,0,0],[0,0,0,11,12,11,12,19,20,27,28,0,0,0,0],[0,0,0,0,0,11,12,19,20,27,28,0,0,0,0],[0,3,0,3,0,0,0,19,20,27,28,0,0,0,0]],"format":1,"bpm":80}
\ No newline at end of file
diff --git a/project.godot b/project.godot
index a3ada3d..d1da751 100644
--- a/project.godot
+++ b/project.godot
@@ -24,6 +24,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scenes/MidiFile.gd"
}, {
+"base": "Reference",
+"class": "Song",
+"language": "GDScript",
+"path": "res://scenes/Song.gd"
+}, {
"base": "Object",
"class": "TypeFormattingLogic",
"language": "GDScript",
@@ -33,6 +38,7 @@ _global_script_class_icons={
"Column": "",
"CustomDialog": "",
"MidiFile": "",
+"Song": "",
"TypeFormattingLogic": ""
}
diff --git a/scenes/BoomBox.gd b/scenes/BoomBox.gd
index 83594be..842b5f8 100644
--- a/scenes/BoomBox.gd
+++ b/scenes/BoomBox.gd
@@ -1,9 +1,7 @@
# The audio and song manager
extends Node
-var song := [[], [], [], []]
-var used_columns := [-1]
-var column_index := 15
+var song := Song.new()
var is_playing := false
var time_delay: float # in seconds
@@ -53,7 +51,7 @@ func _process(delta) -> void:
current_column += 1
time -= bar_length
- if current_column - 1 >= used_columns[-1] or single:
+ if current_column - 1 >= song.used_columns[-1] or single:
is_playing = false
yield(get_tree().create_timer(bar_length), "timeout")
emit_signal("play_ended")
@@ -91,51 +89,43 @@ func _play_column(_column_no) -> void:
# Play sounds
for instrument in 4:
- if song[instrument][_column_no] == 0:
+ if song.data[instrument][_column_no] == 0:
continue
var audio_player = audio_players.get_child(instrument)
- var sound = song[instrument][_column_no]
+ var sound = song.data[instrument][_column_no]
audio_player.stream = sounds[instrument][sound]
audio_player.play()
-func set_tile(instrument: int, column_no:int, sample_index: int) -> void:
- BoomBox.song[instrument][column_no] = sample_index
-
- if sample_index == 0:
- # If all buttons in a column are clear remove that column from the play list
- var uses = 0
- for i in 4:
- if BoomBox.song[i][column_no]:
- uses += 1
- break
- if uses == 0:
- BoomBox.used_columns.erase(column_no)
- else:
- if not BoomBox.used_columns.has(column_no):
- BoomBox.used_columns.append(column_no)
-
-
-func add_column() -> void:
- for i in song:
- i.append(0)
-
-
-func remove_column(column_no: int) -> void:
- column_index -= 1
- for i in 4:
- song[i].pop_back()
- used_columns.erase(column_no)
-
-
-func clear_column(column_no: int) -> void:
- used_columns.erase(column_no)
- for i in 4:
- song[i][column_no] = 0
-
-
func _on_play_ended() -> void:
for i in column_container.get_children():
if i is Column:
i.end_play()
+
+
+func convert_project(old_project: String) -> Song:
+ # DEPRECATED v1.0-stable: Convert projects
+ var file := File.new()
+ file.open(old_project, File.READ)
+ var song := Song.new()
+
+ var json_result = JSON.parse(file.get_as_text())
+
+ if json_result.error:
+ song.data = file.get_var()
+ return song
+
+ file.close()
+
+ if json_result.result is Array:
+ song.data = json_result.result
+ return song
+
+ if json_result.result is Dictionary:
+ if json_result.result.format == 1:
+ song.format = json_result.result.format
+ song.bpm = json_result.result.bpm
+ song.data = json_result.result.data
+
+ return song
diff --git a/scenes/Column.gd b/scenes/Column.gd
index 6c0928b..69a119f 100644
--- a/scenes/Column.gd
+++ b/scenes/Column.gd
@@ -125,10 +125,10 @@ func context_menu_pressed(id: int, instrument: int, sample_index: int) -> void:
Variables.clipboard = {"instrument": instrument, "sample": sample_index}
1: # Paste
if Variables.clipboard:
- BoomBox.set_tile(Variables.clipboard.instrument, column_no, Variables.clipboard.sample)
+ BoomBox.song.set_tile(Variables.clipboard.instrument, column_no, Variables.clipboard.sample)
set_tile(Variables.clipboard.instrument, Variables.clipboard.sample)
2: # Clear
- BoomBox.set_tile(instrument, column_no, 0)
+ BoomBox.song.set_tile(instrument, column_no, 0)
clear_tile(instrument)
diff --git a/scenes/FloatButton.gd b/scenes/FloatButton.gd
index 23e9af7..b7287be 100644
--- a/scenes/FloatButton.gd
+++ b/scenes/FloatButton.gd
@@ -18,7 +18,7 @@ func _input(event: InputEvent) -> void:
queue_free()
return
collided_column.set_tile(instrument, sample)
- BoomBox.set_tile(instrument, collided_column.column_no, sample)
+ BoomBox.song.set_tile(instrument, collided_column.column_no, sample)
emit_signal("released")
queue_free()
diff --git a/scenes/Song.gd b/scenes/Song.gd
new file mode 100644
index 0000000..5a578d8
--- /dev/null
+++ b/scenes/Song.gd
@@ -0,0 +1,58 @@
+class_name Song
+
+var format := 1
+var bpm := 80
+var data := [[], [], [], []]
+var used_columns := [-1]
+
+
+func convert_to_json() -> String:
+ return to_json(
+ {
+ "format": format,
+ "bpm": bpm,
+ "data": data
+ }
+ )
+
+
+func from(song: Dictionary):
+ format = song.format
+ bpm = song.bpm
+ data = song.data
+
+ return self
+
+
+func set_tile(instrument: int, column_no:int, sample_index: int) -> void:
+ data[instrument][column_no] = sample_index
+
+ if sample_index == 0:
+ # If all buttons in a column are clear remove that column from the play list
+ var uses = 0
+ for i in 4:
+ if data[i][column_no]:
+ uses += 1
+ break
+ if uses == 0:
+ used_columns.erase(column_no)
+ else:
+ if not used_columns.has(column_no):
+ used_columns.append(column_no)
+
+
+func add_column() -> void:
+ for i in data:
+ i.append(0)
+
+
+func remove_column(column_no: int) -> void:
+ for i in 4:
+ data[i].pop_back()
+ used_columns.erase(column_no)
+
+
+func clear_column(column_no: int) -> void:
+ used_columns.erase(column_no)
+ for i in 4:
+ data[i][column_no] = 0
diff --git a/scenes/dialogs/ColumnDialog.gd b/scenes/dialogs/ColumnDialog.gd
index f221a9f..13e923a 100644
--- a/scenes/dialogs/ColumnDialog.gd
+++ b/scenes/dialogs/ColumnDialog.gd
@@ -1,5 +1,9 @@
extends CustomDialog
+onready var play_button: Button = $"%PlayButton"
+onready var clear_button: Button = $"%ClearButton"
+onready var remove_button: Button = $"%RemoveButton"
+
var column
var column_no
@@ -10,36 +14,31 @@ func _ready() -> void:
func on_theme_changed(new_theme):
var path = "res://assets/themes/%s/" % new_theme
- $Sprite.texture = load(path.plus_file("column_tear.png"))
+ $Tear.texture = load(path.plus_file("column_tear.png"))
func on_Column_Button_pressed(_column_no, _column):
column = _column
column_no = _column_no
-# var sprite = get_node("Sprite")
-# var sprite_pos_x = _column.column_button.rect_global_position.x + \
+# var tear = get_node("Tear")
+# var tear_pos_x = _column.column_button.rect_global_position.x + \
# _column.column_button.rect_size.x/2
-# sprite.global_position.x = sprite_pos_x
+# tear.global_position.x = tear_pos_x
popup()
func about_to_show():
- # Make buttons visible
- if column_no != BoomBox.column_index - 1 or BoomBox.column_index == 15:
- $VBoxContainer/HBoxContainer/RemoveButton.disabled = true
- else:
- $VBoxContainer/HBoxContainer/RemoveButton.disabled = false
-
-
var has_tiles_set := false
for i in 4:
- if BoomBox.song[i][column.column_no]:
+ if BoomBox.song.data[i][column.column_no]:
has_tiles_set = true
break
- $VBoxContainer/HBoxContainer/PlayButton.disabled = !has_tiles_set || BoomBox.is_playing
- $VBoxContainer/HBoxContainer/ClearButton.disabled = !has_tiles_set
+
+ remove_button.disabled = column_no != main.available_columns - 1 or main.available_columns == 15
+ play_button.disabled = !has_tiles_set || BoomBox.is_playing
+ clear_button.disabled = !has_tiles_set
set_as_minsize()
@@ -56,18 +55,18 @@ func about_to_show():
rect_global_position = pos
- var sprite_pos_x = column.column_button.rect_global_position.x + \
+ var tear_pos_x = column.column_button.rect_global_position.x + \
column.column_button.rect_size.x/2
- $Sprite.global_position.x = sprite_pos_x
+ $Tear.global_position.x = tear_pos_x
.about_to_show()
- rect_pivot_offset = Vector2(sprite_pos_x - pos.x, 0)
+ rect_pivot_offset = Vector2(tear_pos_x - pos.x, 0)
func _on_ClearButton_pressed():
column.clear()
- BoomBox.clear_column(column.column_no)
+ BoomBox.song.remove_column(column.column_no)
hide()
diff --git a/scenes/dialogs/ColumnDialog.tscn b/scenes/dialogs/ColumnDialog.tscn
index 56efc51..7078f3a 100644
--- a/scenes/dialogs/ColumnDialog.tscn
+++ b/scenes/dialogs/ColumnDialog.tscn
@@ -4,7 +4,6 @@
[ext_resource path="res://assets/themes/white/column_tear.png" type="Texture" id=2]
[node name="ColumnDialog" type="PopupDialog"]
-visible = true
anchor_top = -0.001
anchor_bottom = -0.001
margin_top = 0.6
@@ -30,6 +29,7 @@ custom_constants/separation = 10
alignment = 1
[node name="PlayButton" type="Button" parent="VBoxContainer/HBoxContainer"]
+unique_name_in_owner = true
margin_right = 130.0
margin_bottom = 50.0
rect_min_size = Vector2( 80, 50 )
@@ -37,6 +37,7 @@ disabled = true
text = "BTN_PLAY"
[node name="ClearButton" type="Button" parent="VBoxContainer/HBoxContainer"]
+unique_name_in_owner = true
margin_left = 140.0
margin_right = 285.0
margin_bottom = 50.0
@@ -45,6 +46,7 @@ disabled = true
text = "BTN_CLEAR"
[node name="RemoveButton" type="Button" parent="VBoxContainer/HBoxContainer"]
+unique_name_in_owner = true
margin_left = 295.0
margin_right = 466.0
margin_bottom = 50.0
@@ -52,7 +54,7 @@ rect_min_size = Vector2( 80, 50 )
disabled = true
text = "BTN_REMOVE"
-[node name="Sprite" type="Sprite" parent="."]
+[node name="Tear" type="Sprite" parent="."]
position = Vector2( 25, -16.3455 )
texture = ExtResource( 2 )
diff --git a/scenes/dialogs/SoundDialog.gd b/scenes/dialogs/SoundDialog.gd
index 8dfd928..c648fa8 100644
--- a/scenes/dialogs/SoundDialog.gd
+++ b/scenes/dialogs/SoundDialog.gd
@@ -110,9 +110,9 @@ func about_to_show():
if button_group.get_pressed_button():
button_group.get_pressed_button().pressed = false
- if BoomBox.song[instrument][column.column_no]:
+ if BoomBox.song.data[instrument][column.column_no]:
var selected_button = button_container.get_node(
- str(BoomBox.song[instrument][column.column_no] - 1)
+ str(BoomBox.song.data[instrument][column.column_no] - 1)
)
selected_button.pressed = true
clear_button.disabled = false
@@ -150,11 +150,11 @@ func on_Button_focused(sample_index):
func _on_OkButton_pressed():
- if BoomBox.song[instrument][column.column_no] - 1 == pressed_button_index:
+ if BoomBox.song.data[instrument][column.column_no] - 1 == pressed_button_index:
hide()
return
- BoomBox.set_tile(instrument, column.column_no, pressed_button_index + 1)
+ BoomBox.song.set_tile(instrument, column.column_no, pressed_button_index + 1)
column.set_tile(
instrument,
pressed_button_index+1
@@ -165,7 +165,7 @@ func _on_OkButton_pressed():
func _on_ClearButton_pressed():
column.clear_tile(instrument)
- BoomBox.set_tile(instrument, column.column_no, 0)
+ BoomBox.song.set_tile(instrument, column.column_no, 0)
hide()
diff --git a/scenes/dialogs/load_dialog/LoadDialog.gd b/scenes/dialogs/load_dialog/LoadDialog.gd
index 83c9537..fcb09f1 100644
--- a/scenes/dialogs/load_dialog/LoadDialog.gd
+++ b/scenes/dialogs/load_dialog/LoadDialog.gd
@@ -64,15 +64,12 @@ func about_to_show():
var projects = Variables.list_files_in_directory(
"user://saves/Projects/",
- ["mdj", "mdjt"]
+ ["mdj"]
)
var theme_path = "res://assets/themes/%s/" % Variables.options.theme
- if projects.empty():
- $"%NoProjectsLabel".show()
- else:
- $"%NoProjectsLabel".hide()
+ $"%NoProjectsLabel".visible = projects.empty()
var btn_group = ButtonGroup.new()
diff --git a/scenes/main.gd b/scenes/main.gd
index dae38df..b676ab5 100644
--- a/scenes/main.gd
+++ b/scenes/main.gd
@@ -12,6 +12,7 @@ onready var progress_dialog = $ProgressDialog
onready var animation = $AnimationPlayer
onready var column_container = $HBoxContainer/ScrollContainer/HBoxContainer
onready var scroll_container = $HBoxContainer/ScrollContainer
+var available_columns := 0
# Notes:
@@ -46,8 +47,27 @@ func _ready() -> void:
OS.min_window_size.x = ProjectSettings.get("display/window/size/width") * 0.75
OS.min_window_size.y = ProjectSettings.get("display/window/size/height") * 0.75
- for i in BoomBox.column_index:
+ for i in 15:
add_column(i)
+
+ # DEPRECATED v1.0-stable: Convert projects
+ for project in Variables.list_files_in_directory(Variables.projects_dir, ["mdj", "mdjt"]):
+ var converted_project = BoomBox.convert_project(Variables.projects_dir.plus_file(project)).convert_to_json()
+
+ var file = File.new()
+ var file_name = Variables.projects_dir.plus_file(project.get_basename() + ".mdj")
+ var err = file.open(file_name, File.WRITE)
+
+ if err:
+ printerr(err)
+ return
+
+ if project.get_extension() == "mdjt":
+ var dir = Directory.new()
+ dir.remove(Variables.projects_dir.plus_file(project))
+
+ file.store_string(converted_project)
+ file.close()
func on_theme_changed(new_theme) -> void:
@@ -56,9 +76,9 @@ func on_theme_changed(new_theme) -> void:
func _process(_delta) -> void:
- export_button.disabled = BoomBox.is_playing or BoomBox.used_columns.max() == -1
- play_button.disabled = BoomBox.used_columns.max() == -1
- save_button.disabled = BoomBox.used_columns.max() == -1
+ export_button.disabled = BoomBox.is_playing or BoomBox.song.used_columns.max() == -1
+ play_button.disabled = BoomBox.song.used_columns.max() == -1
+ save_button.disabled = BoomBox.song.used_columns.max() == -1
func _on_Play_toggled(button_pressed) -> void:
@@ -112,7 +132,7 @@ func on_Tile_held(_column_no, _instrument, _button) -> void:
float_button.rect_size = rect_size * 1.5
float_button.set("custom_colors/font_color", Color.black)
float_button_parent.instrument = _instrument
- float_button_parent.sample = BoomBox.song[_instrument][_column_no]
+ float_button_parent.sample = BoomBox.song.data[_instrument][_column_no]
float_button_parent.global_position = get_global_mouse_position()
add_child(float_button_parent)
@@ -138,35 +158,36 @@ func _on_OpenProject_pressed() -> void:
func _on_AddButton_pressed() -> void:
- BoomBox.column_index += 1
- add_column(BoomBox.column_index-1).fade_in()
+ add_column().fade_in()
yield(get_tree(), "idle_frame")
scroll_container.ensure_control_visible(add_button)
-func add_column(_column_no: int, add_to_song: bool = true) -> Node2D:
+func add_column(_column_no: int = 1, add_to_song: bool = true) -> Node2D:
var column = load(Column.scene).instance()
column_container.add_child(column)
column_container.move_child(column, column_container.get_child_count()-2)
- column.add(_column_no)
-
+ column.add(available_columns)
# Signals
for b in 4:
var button = column.get_node("Button"+str(b+1))
button.connect("pressed", self, "on_Tile_pressed", [column, b])
- button.connect("button_down", self, "on_Tile_held", [_column_no, b, column.get_node("Button"+str(b+1))])
- column.column_button.connect("pressed", $ColumnDialog, "on_Column_Button_pressed", [_column_no, column])
+ button.connect("button_down", self, "on_Tile_held", [available_columns, b, column.get_node("Button"+str(b+1))])
+ column.column_button.connect("pressed", $ColumnDialog, "on_Column_Button_pressed", [available_columns, column])
# Add to song
if add_to_song:
- BoomBox.add_column()
+ BoomBox.song.add_column()
+
+ available_columns += 1
return column
func remove_column(column_no) -> void:
- BoomBox.remove_column(column_no)
+ available_columns -= 1
+ BoomBox.song.remove_column(column_no)
add_button.call_deferred("grab_focus")
@@ -176,7 +197,7 @@ func save_project(file_name: String) -> void:
var path = Variables.projects_dir.plus_file("%s.mdj" % file_name)
var file = File.new()
var err = file.open(path, File.WRITE)
- file.store_string(to_json(BoomBox.song))
+ file.store_string(BoomBox.song.convert_to_json())
file.close()
# ProgressDialog
@@ -212,7 +233,7 @@ func export_song(file_name: String) -> void:
progress_dialog.path = path
progress_dialog.after_saving = "stay"
progress_dialog.type_of_save = "export"
- progress_dialog.progress_bar.max_value = 3*(BoomBox.used_columns.max()+1) + 0.5
+ progress_dialog.progress_bar.max_value = 3*(BoomBox.song.used_columns.max()+1) + 0.5
progress_dialog.popup_centered()
# Export
@@ -266,62 +287,43 @@ func load_song(path, song = null):
else:
var file = File.new()
file.open(path, File.READ)
- if path.ends_with(".mdj"):
- var json_result = JSON.parse(file.get_as_text())
- if json_result.error: # DEPRECATED v1.0-stable: Godot dictionary
- BoomBox.song = file.get_var()
- else: # JSON format
- BoomBox.song = json_result.result
- file.close()
- elif path.ends_with(".mdjt"): # DEPRECATED v1.0-stable: mdjt
- BoomBox.song = str2var(file.get_as_text())
- file.close()
- dir.remove(path)
- path.erase(path.length()-1, 1)
- file.open(path, File.WRITE)
- file.store_var(BoomBox.song)
- file.close()
+ var json_result = JSON.parse(file.get_as_text())
+ file.close()
+ if json_result.error:
+ pass
+ else:
+ BoomBox.song = Song.new().from(json_result.result)
Variables.opened_file = path.get_file().get_basename()
-
- # Add remaining columns
- var song_column_index = BoomBox.song[0].size()
- if BoomBox.column_index < song_column_index:
- for i in song_column_index - BoomBox.column_index:
- add_column(BoomBox.column_index, false)
- BoomBox.column_index += 1
+ for column in column_container.get_children():
+ if column is Column:
+ column.clear()
- elif BoomBox.column_index > song_column_index:
- for i in BoomBox.column_index - song_column_index:
- column_container.get_child(BoomBox.column_index-1).queue_free()
- BoomBox.column_index -= 1
-
-
- BoomBox.used_columns = [-1]
-
- scroll_container.scroll_horizontal = 0
- play_button.pressed = false
-
- # TODO: Cleanup
-
- for instrument in BoomBox.song.size():
- for column_no in BoomBox.song[instrument].size():
+ BoomBox.song.used_columns = [-1]
+ for instrument in BoomBox.song.data.size():
+ for column_no in BoomBox.song.data[instrument].size():
+ if column_no >= available_columns:
+ add_column(column_no, false)
+
var column = column_container.get_child(column_no)
- var value = BoomBox.song[instrument][column_no]
+ var value = BoomBox.song.data[instrument][column_no]
if value != 0: # If not empty
- if not BoomBox.used_columns.has(column_no):
- BoomBox.used_columns.append(column_no)
+ if not BoomBox.song.used_columns.has(column_no):
+ BoomBox.song.used_columns.append(column_no)
column.set_tile(instrument, value)
+
+ scroll_container.scroll_horizontal = 0
+ play_button.pressed = false
func new_song() -> void:
- var empty_song = [[], [], [], []]
+ var empty_song := Song.new()
for i in 4:
for j in 15:
- empty_song[i].append(0)
+ empty_song.data[i].append(0)
load_song(null, empty_song)
Variables.opened_file = ""
From 0476dea7c8c24cf36f9275fd76bd78a9b73eaee2 Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Tue, 13 Dec 2022 15:11:04 +0200
Subject: [PATCH 04/18] HTML5: Get project from query params
---
scenes/Song.gd | 9 ++++++---
scenes/main.gd | 25 +++++++++++++++++++++++++
scenes/main.tscn | 1 -
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/scenes/Song.gd b/scenes/Song.gd
index 5a578d8..83364ee 100644
--- a/scenes/Song.gd
+++ b/scenes/Song.gd
@@ -17,9 +17,12 @@ func convert_to_json() -> String:
func from(song: Dictionary):
- format = song.format
- bpm = song.bpm
- data = song.data
+ if song.has("format"):
+ format = song.format
+ if song.has("bpm"):
+ bpm = song.bpm
+ if song.has("data"):
+ data = song.data
return self
diff --git a/scenes/main.gd b/scenes/main.gd
index b676ab5..371d10f 100644
--- a/scenes/main.gd
+++ b/scenes/main.gd
@@ -68,6 +68,31 @@ func _ready() -> void:
file.store_string(converted_project)
file.close()
+
+ # HTML5: Get project from URL and remove query parameters
+ var url_song_json = JavaScript.eval(\
+ """
+ (function getParams() {
+ const urlString = (window.location != window.parent.location)
+ ? document.referrer
+ : document.location.href;
+ const url = new URL(urlString);
+ const song = url.searchParams.get("song");
+
+ url.search = "";
+ history.replaceState(null, "", url.toString())
+
+ return song;
+ }())
+ """
+ )
+ if url_song_json:
+ var json_result = JSON.parse(url_song_json)
+ if json_result.error:
+ pass
+ else:
+ var url_song = Song.new().from(json_result.result)
+ load_song(null, url_song)
func on_theme_changed(new_theme) -> void:
diff --git a/scenes/main.tscn b/scenes/main.tscn
index 40d874c..e3683c4 100644
--- a/scenes/main.tscn
+++ b/scenes/main.tscn
@@ -320,7 +320,6 @@ theme_type_variation = "ShadowPanel"
[node name="SaveDialog" parent="." instance=ExtResource( 9 )]
[node name="ColumnDialog" parent="." instance=ExtResource( 8 )]
-visible = false
[node name="ProgressDialog" parent="." instance=ExtResource( 10 )]
From bd5721b668a7bcbb1df522f6effd2fc9ead37a9e Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Tue, 13 Dec 2022 15:11:35 +0200
Subject: [PATCH 05/18] Add Android-like Toast
---
assets/themes/dark/dark.tres | 14 +++++++++++-
assets/themes/white/white.tres | 19 ++++++++++++++--
project.godot | 6 +++++
scenes/Toast.gd | 28 +++++++++++++++++++++++
scenes/Toast.tscn | 41 ++++++++++++++++++++++++++++++++++
scenes/Variables.gd | 14 ++++++++++--
scenes/main.gd | 10 +++++----
7 files changed, 123 insertions(+), 9 deletions(-)
create mode 100644 scenes/Toast.gd
create mode 100644 scenes/Toast.tscn
diff --git a/assets/themes/dark/dark.tres b/assets/themes/dark/dark.tres
index 0e086f6..c45fd2f 100644
--- a/assets/themes/dark/dark.tres
+++ b/assets/themes/dark/dark.tres
@@ -1,4 +1,4 @@
-[gd_resource type="Theme" load_steps=48 format=2]
+[gd_resource type="Theme" load_steps=49 format=2]
[ext_resource path="res://assets/themes/dark/radio_check.svg" type="Texture" id=1]
[ext_resource path="res://assets/themes/dark/radio_uncheck.svg" type="Texture" id=2]
@@ -230,6 +230,17 @@ corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
+[sub_resource type="StyleBoxFlat" id=49]
+content_margin_left = 8.0
+content_margin_right = 8.0
+content_margin_top = 8.0
+content_margin_bottom = 8.0
+bg_color = Color( 0.0745098, 0.0784314, 0.0588235, 1 )
+corner_radius_top_left = 90
+corner_radius_top_right = 90
+corner_radius_bottom_right = 90
+corner_radius_bottom_left = 90
+
[sub_resource type="StyleBoxLine" id=24]
color = Color( 1, 1, 1, 0.270588 )
thickness = 5
@@ -395,6 +406,7 @@ Tile/styles/Chorus = SubResource( 34 )
Tile/styles/Introduction = SubResource( 35 )
Tile/styles/Solo = SubResource( 36 )
Tile/styles/Verse = SubResource( 37 )
+Toast/styles/panel = SubResource( 49 )
VScrollBar/icons/decrement = null
VScrollBar/icons/decrement_highlight = null
VScrollBar/icons/increment = null
diff --git a/assets/themes/white/white.tres b/assets/themes/white/white.tres
index e4ad6ca..70f9e0f 100644
--- a/assets/themes/white/white.tres
+++ b/assets/themes/white/white.tres
@@ -1,4 +1,4 @@
-[gd_resource type="Theme" load_steps=52 format=2]
+[gd_resource type="Theme" load_steps=53 format=2]
[ext_resource path="res://assets/fonts/GidoleFont/Gidole-Regular.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://assets/themes/white/radio_check.svg" type="Texture" id=2]
@@ -198,7 +198,7 @@ corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
-shadow_color = Color( 0, 0, 0, 0.16 )
+shadow_color = Color( 0, 0, 0, 0.160784 )
shadow_size = 8
shadow_offset = Vector2( 0, 4 )
@@ -255,6 +255,20 @@ corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
+[sub_resource type="StyleBoxFlat" id=49]
+content_margin_left = 8.0
+content_margin_right = 8.0
+content_margin_top = 8.0
+content_margin_bottom = 8.0
+bg_color = Color( 1, 1, 1, 1 )
+corner_radius_top_left = 90
+corner_radius_top_right = 90
+corner_radius_bottom_right = 90
+corner_radius_bottom_left = 90
+shadow_color = Color( 0, 0, 0, 0.160784 )
+shadow_size = 8
+shadow_offset = Vector2( 0, 4 )
+
[sub_resource type="StyleBoxLine" id=27]
color = Color( 0, 0, 0, 0.25098 )
thickness = 5
@@ -429,6 +443,7 @@ Tile/styles/Chorus = SubResource( 38 )
Tile/styles/Introduction = SubResource( 39 )
Tile/styles/Solo = SubResource( 40 )
Tile/styles/Verse = SubResource( 46 )
+Toast/styles/panel = SubResource( 49 )
VScrollBar/icons/decrement = null
VScrollBar/icons/decrement_highlight = null
VScrollBar/icons/increment = null
diff --git a/project.godot b/project.godot
index d1da751..2d21fa9 100644
--- a/project.godot
+++ b/project.godot
@@ -29,6 +29,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scenes/Song.gd"
}, {
+"base": "Popup",
+"class": "Toast",
+"language": "GDScript",
+"path": "res://scenes/Toast.gd"
+}, {
"base": "Object",
"class": "TypeFormattingLogic",
"language": "GDScript",
@@ -39,6 +44,7 @@ _global_script_class_icons={
"CustomDialog": "",
"MidiFile": "",
"Song": "",
+"Toast": "",
"TypeFormattingLogic": ""
}
diff --git a/scenes/Toast.gd b/scenes/Toast.gd
new file mode 100644
index 0000000..684b84d
--- /dev/null
+++ b/scenes/Toast.gd
@@ -0,0 +1,28 @@
+extends Popup
+
+class_name Toast
+
+enum {
+ LENGTH_SHORT,
+ LENGTH_LONG
+}
+const scene_path := "res://scenes/Toast.tscn"
+var duration: int
+var text: String
+
+
+func popup(bounds := Rect2(0, 0, 0, 0)) -> void:
+ $"%Label".text = text
+ .popup(bounds)
+
+ modulate.a = 0
+ create_tween().tween_property(self, "modulate:a", 1.0, 0.1)
+
+ match duration:
+ LENGTH_SHORT:
+ yield(get_tree().create_timer(2), "timeout")
+ LENGTH_LONG:
+ yield(get_tree().create_timer(4), "timeout")
+
+ yield(create_tween().tween_property(self, "modulate:a", 0.0, 0.1), "finished")
+ queue_free()
diff --git a/scenes/Toast.tscn b/scenes/Toast.tscn
new file mode 100644
index 0000000..884ab6c
--- /dev/null
+++ b/scenes/Toast.tscn
@@ -0,0 +1,41 @@
+[gd_scene load_steps=2 format=2]
+
+[ext_resource path="res://scenes/Toast.gd" type="Script" id=1]
+
+[node name="Toast" type="Popup"]
+anchor_left = 0.5
+anchor_top = 1.0
+anchor_right = 0.5
+anchor_bottom = 1.0
+margin_left = -512.0
+margin_top = -120.0
+margin_right = 512.0
+margin_bottom = -49.0
+theme_type_variation = "Toast"
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_group_": true
+}
+
+[node name="HBoxContainer" type="HBoxContainer" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+alignment = 1
+
+[node name="Panel" type="PanelContainer" parent="HBoxContainer"]
+margin_left = 458.0
+margin_right = 566.0
+margin_bottom = 40.0
+size_flags_vertical = 0
+theme_type_variation = "Toast"
+
+[node name="Label" type="Label" parent="HBoxContainer/Panel"]
+unique_name_in_owner = true
+margin_left = 8.0
+margin_top = 8.0
+margin_right = 100.0
+margin_bottom = 32.0
+theme_type_variation = "Text"
+text = "Lorem ipsum"
+align = 1
+valign = 1
diff --git a/scenes/Variables.gd b/scenes/Variables.gd
index 7347e9c..ef5cdd6 100644
--- a/scenes/Variables.gd
+++ b/scenes/Variables.gd
@@ -39,7 +39,8 @@ func _ready() -> void:
get_tree().connect("node_added", self, "_node_added")
get_tree().connect("node_removed", self, "_node_removed")
- traverse(main)
+ if main:
+ traverse(main)
# Singletons
if Engine.has_singleton("GodotFileSharing"):
@@ -75,7 +76,7 @@ func _ready() -> void:
file.close()
if json_result.error:
- printerr("Json parse error: ", json_result.error_string)
+ printerr("options.json parse error: ", json_result.error_string)
save_options(0)
return
@@ -154,6 +155,15 @@ func share_file(path: String, title: String, subject: String, text: String, mime
share_service.shareFile(ProjectSettings.globalize_path(path), title, subject, text, mimeType)
+func toast(p_text: String, p_duration: int = Toast.LENGTH_LONG) -> void:
+ var toast = load(Toast.scene_path).instance()
+ toast.text = p_text
+ toast.duration = p_duration
+
+ main.add_child(toast)
+ toast.popup()
+
+
func list_files_in_directory(path: String, extensions := [""]) -> Array:
var files = []
var dir = Directory.new()
diff --git a/scenes/main.gd b/scenes/main.gd
index 371d10f..5a9652c 100644
--- a/scenes/main.gd
+++ b/scenes/main.gd
@@ -88,8 +88,8 @@ func _ready() -> void:
)
if url_song_json:
var json_result = JSON.parse(url_song_json)
- if json_result.error:
- pass
+ if json_result.error:
+ Variables.toast("Error parsing project from URL (code: %s)" % json_result.error)
else:
var url_song = Song.new().from(json_result.result)
load_song(null, url_song)
@@ -314,8 +314,10 @@ func load_song(path, song = null):
file.open(path, File.READ)
var json_result = JSON.parse(file.get_as_text())
file.close()
- if json_result.error:
- pass
+ if json_result.error:
+ var err = "Error opening project (code: %s)" % json_result.error
+ Variables.toast(err)
+ printerr(err)
else:
BoomBox.song = Song.new().from(json_result.result)
Variables.opened_file = path.get_file().get_basename()
From b7f975abed4422e42e80446284ab587b4c2851d8 Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Tue, 13 Dec 2022 16:09:49 +0200
Subject: [PATCH 06/18] LoadDialog: Add button to copy link
---
assets/themes/dark/link.svg | 1 +
assets/themes/dark/link.svg.import | 35 +++++++++++++
assets/themes/white/link.svg | 1 +
assets/themes/white/link.svg.import | 35 +++++++++++++
languages/text.csv | 1 +
scenes/dialogs/load_dialog/LoadDialog.gd | 12 +++++
scenes/dialogs/load_dialog/LoadItem.gd | 5 +-
scenes/dialogs/load_dialog/LoadItem.tscn | 62 +++++++++++++++++++-----
8 files changed, 138 insertions(+), 14 deletions(-)
create mode 100644 assets/themes/dark/link.svg
create mode 100644 assets/themes/dark/link.svg.import
create mode 100644 assets/themes/white/link.svg
create mode 100644 assets/themes/white/link.svg.import
diff --git a/assets/themes/dark/link.svg b/assets/themes/dark/link.svg
new file mode 100644
index 0000000..de90dec
--- /dev/null
+++ b/assets/themes/dark/link.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/themes/dark/link.svg.import b/assets/themes/dark/link.svg.import
new file mode 100644
index 0000000..694b3d1
--- /dev/null
+++ b/assets/themes/dark/link.svg.import
@@ -0,0 +1,35 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/link.svg-d0c43a62c520a87ff01fb342a9973d7e.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/themes/dark/link.svg"
+dest_files=[ "res://.import/link.svg-d0c43a62c520a87ff01fb342a9973d7e.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0
diff --git a/assets/themes/white/link.svg b/assets/themes/white/link.svg
new file mode 100644
index 0000000..54273c5
--- /dev/null
+++ b/assets/themes/white/link.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/themes/white/link.svg.import b/assets/themes/white/link.svg.import
new file mode 100644
index 0000000..d8519fd
--- /dev/null
+++ b/assets/themes/white/link.svg.import
@@ -0,0 +1,35 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/link.svg-e2637457e77a051dd300b9c5cc0b57ec.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/themes/white/link.svg"
+dest_files=[ "res://.import/link.svg-e2637457e77a051dd300b9c5cc0b57ec.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0
diff --git a/languages/text.csv b/languages/text.csv
index ac6843f..4dd79a7 100644
--- a/languages/text.csv
+++ b/languages/text.csv
@@ -32,6 +32,7 @@ DIALOG_LOAD_TITLE,Open project,Deschideți,Buka proyek
DIALOG_LOAD_BTN_OPEN,Open,Deschideți,Buka
DIALOG_LOAD_BTN_DOWNLOAD,Download,Descărcați,Unduh
DIALOG_LOAD_BTN_SHARE,Share,Distribuiți,Bagikan
+DIALOG_LOAD_BTN_LINK,Copy link,Copiați link-ul,
DIALOG_LOAD_BTN_DELETE,Delete,Ștergeți,Hapus
DIALOG_LOAD_NO_PROJECTS,No saved projects,Niciun proiect salvat,Tidak ada proyek yang disimpan
DIALOG_ABOUT_TITLE,About,Despre,Tentang
diff --git a/scenes/dialogs/load_dialog/LoadDialog.gd b/scenes/dialogs/load_dialog/LoadDialog.gd
index fcb09f1..75345ff 100644
--- a/scenes/dialogs/load_dialog/LoadDialog.gd
+++ b/scenes/dialogs/load_dialog/LoadDialog.gd
@@ -84,6 +84,7 @@ func about_to_show():
item.delete_button.connect("pressed", self, "_on_Delete_pressed", [item, project_path])
item.download_button.connect("pressed", self, "_on_Download_pressed", [project_path])
item.share_button.connect("pressed", self, "_on_Share_pressed", [project_path])
+ item.link_button.connect("pressed", self, "_on_Link_pressed", [project_path])
connect("popup_hide", item, "queue_free")
item.download_button.visible = OS.get_name() == "HTML5" or OS.get_name() == "Android"
item.share_button.visible = share_service != null
@@ -176,6 +177,17 @@ func _on_Share_pressed(file_name) -> void:
)
+func _on_Link_pressed(file_name) -> void:
+ var file = File.new()
+ file.open("user://saves/Projects/".plus_file(file_name), File.READ)
+ var project_string = file.get_as_text()
+ file.close()
+
+ var url = "https://pattlebass.itch.io/musicdj?song=" + project_string.percent_encode()
+ OS.clipboard = url
+ Variables.toast("Copied link to clipboard", Toast.LENGTH_SHORT)
+
+
func _on_Download_pressed(file_name):
Variables.download_file(
Variables.saves_dir.plus_file("Projects/%s" % file_name),
diff --git a/scenes/dialogs/load_dialog/LoadItem.gd b/scenes/dialogs/load_dialog/LoadItem.gd
index 7dc30b2..429796a 100644
--- a/scenes/dialogs/load_dialog/LoadItem.gd
+++ b/scenes/dialogs/load_dialog/LoadItem.gd
@@ -5,6 +5,7 @@ onready var button = $Button
onready var open_button = $ActionsContainer/OpenButton
onready var download_button = $ActionsContainer/DownloadButton
onready var share_button = $ActionsContainer/ShareButton
+onready var link_button = $ActionsContainer/LinkButton
onready var delete_button = $ActionsContainer/DeleteButton
signal expanded
@@ -16,8 +17,10 @@ func _ready() -> void:
open_button.get_node("VBox/Icon").texture = load(theme_path + "open_file.svg")
download_button.get_node("VBox/Icon").texture = load(theme_path + "download.svg")
share_button.get_node("VBox/Icon").texture = load(theme_path + "share.svg")
+ link_button.get_node("VBox/Icon").texture = load(theme_path + "link.svg")
delete_button.get_node("VBox/Icon").texture = load(theme_path + "delete.svg")
-
+
+ $ActionsContainer.hide()
func _on_Button_toggled(button_pressed: bool) -> void:
if button_pressed:
diff --git a/scenes/dialogs/load_dialog/LoadItem.tscn b/scenes/dialogs/load_dialog/LoadItem.tscn
index a5dfdae..86bd2d8 100644
--- a/scenes/dialogs/load_dialog/LoadItem.tscn
+++ b/scenes/dialogs/load_dialog/LoadItem.tscn
@@ -1,10 +1,11 @@
-[gd_scene load_steps=6 format=2]
+[gd_scene load_steps=7 format=2]
[ext_resource path="res://scenes/dialogs/load_dialog/LoadItem.gd" type="Script" id=1]
[ext_resource path="res://assets/themes/dark/open_file.svg" type="Texture" id=2]
[ext_resource path="res://assets/themes/dark/delete.svg" type="Texture" id=3]
[ext_resource path="res://assets/themes/dark/share.svg" type="Texture" id=4]
[ext_resource path="res://assets/themes/dark/download.svg" type="Texture" id=5]
+[ext_resource path="res://assets/themes/dark/link.svg" type="Texture" id=6]
[node name="LoadItem" type="VBoxContainer"]
margin_right = 821.0
@@ -30,7 +31,7 @@ rect_min_size = Vector2( 0, 60 )
size_flags_vertical = 3
[node name="OpenButton" type="Button" parent="ActionsContainer"]
-margin_right = 202.0
+margin_right = 161.0
margin_bottom = 60.0
mouse_filter = 1
size_flags_horizontal = 3
@@ -45,7 +46,7 @@ custom_constants/separation = 0
alignment = 1
[node name="Icon" type="TextureRect" parent="ActionsContainer/OpenButton/VBox"]
-margin_right = 203.0
+margin_right = 176.0
margin_bottom = 36.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -55,7 +56,7 @@ stretch_mode = 4
[node name="Label" type="Label" parent="ActionsContainer/OpenButton/VBox"]
margin_top = 36.0
-margin_right = 203.0
+margin_right = 176.0
margin_bottom = 60.0
mouse_filter = 1
theme_type_variation = "Text"
@@ -64,8 +65,8 @@ align = 1
valign = 2
[node name="DownloadButton" type="Button" parent="ActionsContainer"]
-margin_left = 206.0
-margin_right = 408.0
+margin_left = 165.0
+margin_right = 326.0
margin_bottom = 60.0
mouse_filter = 1
size_flags_horizontal = 3
@@ -99,8 +100,8 @@ align = 1
valign = 2
[node name="ShareButton" type="Button" parent="ActionsContainer"]
-margin_left = 412.0
-margin_right = 614.0
+margin_left = 330.0
+margin_right = 491.0
margin_bottom = 60.0
mouse_filter = 1
size_flags_horizontal = 3
@@ -115,7 +116,7 @@ custom_constants/separation = 0
alignment = 1
[node name="Icon" type="TextureRect" parent="ActionsContainer/ShareButton/VBox"]
-margin_right = 203.0
+margin_right = 184.0
margin_bottom = 36.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -125,7 +126,7 @@ stretch_mode = 4
[node name="Label" type="Label" parent="ActionsContainer/ShareButton/VBox"]
margin_top = 36.0
-margin_right = 203.0
+margin_right = 184.0
margin_bottom = 60.0
mouse_filter = 1
theme_type_variation = "Text"
@@ -133,8 +134,43 @@ text = "DIALOG_LOAD_BTN_SHARE"
align = 1
valign = 2
+[node name="LinkButton" type="Button" parent="ActionsContainer"]
+margin_left = 495.0
+margin_right = 656.0
+margin_bottom = 60.0
+mouse_filter = 1
+size_flags_horizontal = 3
+theme_type_variation = "ListItem"
+icon_align = 1
+
+[node name="VBox" type="VBoxContainer" parent="ActionsContainer/LinkButton"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_right = 1.0
+custom_constants/separation = 0
+alignment = 1
+
+[node name="Icon" type="TextureRect" parent="ActionsContainer/LinkButton/VBox"]
+margin_right = 169.0
+margin_bottom = 36.0
+size_flags_horizontal = 3
+size_flags_vertical = 3
+texture = ExtResource( 6 )
+expand = true
+stretch_mode = 4
+
+[node name="Label" type="Label" parent="ActionsContainer/LinkButton/VBox"]
+margin_top = 36.0
+margin_right = 169.0
+margin_bottom = 60.0
+mouse_filter = 1
+theme_type_variation = "Text"
+text = "DIALOG_LOAD_BTN_LINK"
+align = 1
+valign = 2
+
[node name="DeleteButton" type="Button" parent="ActionsContainer"]
-margin_left = 618.0
+margin_left = 660.0
margin_right = 821.0
margin_bottom = 60.0
mouse_filter = 1
@@ -150,7 +186,7 @@ custom_constants/separation = 0
alignment = 1
[node name="Icon" type="TextureRect" parent="ActionsContainer/DeleteButton/VBox"]
-margin_right = 204.0
+margin_right = 190.0
margin_bottom = 36.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -160,7 +196,7 @@ stretch_mode = 4
[node name="Label" type="Label" parent="ActionsContainer/DeleteButton/VBox"]
margin_top = 36.0
-margin_right = 204.0
+margin_right = 190.0
margin_bottom = 60.0
mouse_filter = 1
theme_type_variation = "Text"
From 09617841c71fdfb1bb246cf841c4a84ef647a41e Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Fri, 16 Dec 2022 15:13:53 +0200
Subject: [PATCH 07/18] Allow changing the BPM
---
assets/themes/dark/dark.tres | 12 ++++--
assets/themes/white/white.tres | 11 +++--
default_bus_layout.tres | 7 +++-
scenes/BoomBox.gd | 27 +++++++++----
scenes/dialogs/SoundDialog.gd | 4 ++
scenes/main.gd | 18 +++++++--
scenes/main.tscn | 74 +++++++++++++++++++++-------------
7 files changed, 109 insertions(+), 44 deletions(-)
diff --git a/assets/themes/dark/dark.tres b/assets/themes/dark/dark.tres
index c45fd2f..c7fbd38 100644
--- a/assets/themes/dark/dark.tres
+++ b/assets/themes/dark/dark.tres
@@ -1,4 +1,4 @@
-[gd_resource type="Theme" load_steps=49 format=2]
+[gd_resource type="Theme" load_steps=50 format=2]
[ext_resource path="res://assets/themes/dark/radio_check.svg" type="Texture" id=1]
[ext_resource path="res://assets/themes/dark/radio_uncheck.svg" type="Texture" id=2]
@@ -97,6 +97,7 @@ font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=15]
size = 32
+extra_spacing_char = -2
font_data = ExtResource( 4 )
[sub_resource type="StyleBoxEmpty" id=16]
@@ -106,6 +107,11 @@ draw_center = false
border_width_bottom = 2
border_color = Color( 0.305882, 0.8, 0.639216, 1 )
+[sub_resource type="StyleBoxFlat" id=50]
+draw_center = false
+border_width_bottom = 2
+border_color = Color( 1, 1, 1, 0.701961 )
+
[sub_resource type="DynamicFont" id=27]
size = 40
extra_spacing_char = -2
@@ -333,14 +339,14 @@ LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 )
LineEdit/colors/cursor_color = Color( 0.94, 0.94, 0.94, 1 )
LineEdit/colors/font_color = Color( 0.88, 0.88, 0.88, 1 )
LineEdit/colors/font_color_selected = Color( 0, 0, 0, 1 )
-LineEdit/colors/font_color_uneditable = Color( 0.88, 0.88, 0.88, 0.5 )
+LineEdit/colors/font_color_uneditable = Color( 1, 1, 1, 0.5 )
LineEdit/colors/selection_color = Color( 0.49, 0.49, 0.49, 1 )
LineEdit/constants/minimum_spaces = 12
LineEdit/fonts/font = SubResource( 15 )
LineEdit/icons/clear = null
LineEdit/styles/focus = SubResource( 16 )
LineEdit/styles/normal = SubResource( 17 )
-LineEdit/styles/read_only = null
+LineEdit/styles/read_only = SubResource( 50 )
ListItem/base_type = "Button"
ListItem/fonts/font = SubResource( 27 )
ListItem/styles/focus = SubResource( 48 )
diff --git a/assets/themes/white/white.tres b/assets/themes/white/white.tres
index 70f9e0f..bf71d5e 100644
--- a/assets/themes/white/white.tres
+++ b/assets/themes/white/white.tres
@@ -1,4 +1,4 @@
-[gd_resource type="Theme" load_steps=53 format=2]
+[gd_resource type="Theme" load_steps=54 format=2]
[ext_resource path="res://assets/fonts/GidoleFont/Gidole-Regular.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://assets/themes/white/radio_check.svg" type="Texture" id=2]
@@ -115,6 +115,11 @@ draw_center = false
border_width_bottom = 2
border_color = Color( 0.305882, 0.8, 0.639216, 1 )
+[sub_resource type="StyleBoxFlat" id=50]
+draw_center = false
+border_width_bottom = 2
+border_color = Color( 0, 0, 0, 0.42 )
+
[sub_resource type="DynamicFont" id=36]
size = 40
extra_spacing_char = -2
@@ -362,14 +367,14 @@ LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 )
LineEdit/colors/cursor_color = Color( 0.94, 0.94, 0.94, 1 )
LineEdit/colors/font_color = Color( 0, 0, 0, 1 )
LineEdit/colors/font_color_selected = Color( 0, 0, 0, 1 )
-LineEdit/colors/font_color_uneditable = Color( 0.88, 0.88, 0.88, 0.5 )
+LineEdit/colors/font_color_uneditable = Color( 0, 0, 0, 0.380392 )
LineEdit/colors/selection_color = Color( 0.49, 0.49, 0.49, 1 )
LineEdit/constants/minimum_spaces = 12
LineEdit/fonts/font = SubResource( 17 )
LineEdit/icons/clear = null
LineEdit/styles/focus = SubResource( 18 )
LineEdit/styles/normal = SubResource( 19 )
-LineEdit/styles/read_only = null
+LineEdit/styles/read_only = SubResource( 50 )
ListItem/base_type = "Button"
ListItem/colors/font_color = Color( 0, 0, 0, 0.6 )
ListItem/colors/font_color_disabled = Color( 0.901961, 0.901961, 0.901961, 0.2 )
diff --git a/default_bus_layout.tres b/default_bus_layout.tres
index 5a3b405..1e0982c 100644
--- a/default_bus_layout.tres
+++ b/default_bus_layout.tres
@@ -1,8 +1,13 @@
-[gd_resource type="AudioBusLayout" load_steps=2 format=2]
+[gd_resource type="AudioBusLayout" load_steps=3 format=2]
[sub_resource type="AudioEffectRecord" id=1]
resource_name = "Record"
+[sub_resource type="AudioEffectPitchShift" id=2]
+resource_name = "PitchShift"
+
[resource]
bus/0/effect/0/effect = SubResource( 1 )
bus/0/effect/0/enabled = true
+bus/0/effect/1/effect = SubResource( 2 )
+bus/0/effect/1/enabled = true
diff --git a/scenes/BoomBox.gd b/scenes/BoomBox.gd
index 842b5f8..37067ef 100644
--- a/scenes/BoomBox.gd
+++ b/scenes/BoomBox.gd
@@ -6,7 +6,7 @@ var is_playing := false
var time_delay: float # in seconds
-var bar_length := 3
+var bar_length: float = 3.0
var sounds := [[0], [0], [0], [0]]
onready var column_container = get_node("/root/main/HBoxContainer/ScrollContainer/HBoxContainer")
@@ -38,11 +38,11 @@ func _process(delta) -> void:
return
time += delta
- print(time)
+# print(time)
if time - time_delay > bar_length:
# Bar
- print("Current column: ", current_column)
+# print("Current column: ", current_column)
if current_column > 0:
column_container.get_child(current_column - 1).end_play()
@@ -58,6 +58,7 @@ func _process(delta) -> void:
func play_song() -> void:
+ update_pitch()
time = bar_length
current_column = 0
is_playing = true
@@ -74,6 +75,7 @@ func stop() -> void:
func play_column(p_column_no) -> void:
+ update_pitch()
time = bar_length
current_column = p_column_no
single = true
@@ -81,19 +83,20 @@ func play_column(p_column_no) -> void:
emit_signal("play_started")
-func _play_column(_column_no) -> void:
+func _play_column(p_column_no) -> void:
# Visuals
- var column = column_container.get_child(_column_no)
+ var column = column_container.get_child(p_column_no)
column.start_play()
emit_signal("column_play_started", column)
# Play sounds
for instrument in 4:
- if song.data[instrument][_column_no] == 0:
+ if song.data[instrument][p_column_no] == 0:
continue
var audio_player = audio_players.get_child(instrument)
- var sound = song.data[instrument][_column_no]
+ var sound = song.data[instrument][p_column_no]
+ audio_player.pitch_scale = song.bpm / 80.0
audio_player.stream = sounds[instrument][sound]
audio_player.play()
@@ -104,6 +107,16 @@ func _on_play_ended() -> void:
i.end_play()
+func update_pitch() -> void:
+ bar_length = (60.0/song.bpm) * 4
+
+ var pitch = song.bpm / 80.0
+ var shift = AudioServer.get_bus_effect(0, 1)
+ shift.pitch_scale = 1.0 / pitch
+
+ AudioServer.set_bus_effect_enabled(0, 1, shift.pitch_scale != 1)
+
+
func convert_project(old_project: String) -> Song:
# DEPRECATED v1.0-stable: Convert projects
var file := File.new()
diff --git a/scenes/dialogs/SoundDialog.gd b/scenes/dialogs/SoundDialog.gd
index c648fa8..b4a76ff 100644
--- a/scenes/dialogs/SoundDialog.gd
+++ b/scenes/dialogs/SoundDialog.gd
@@ -171,3 +171,7 @@ func _on_ClearButton_pressed():
func _on_CancelButton_pressed():
hide()
+
+
+func _on_BPMSpinBox_value_changed(value: int) -> void:
+ audio_player.pitch_scale = value / 80.0
diff --git a/scenes/main.gd b/scenes/main.gd
index 5a9652c..f1fe693 100644
--- a/scenes/main.gd
+++ b/scenes/main.gd
@@ -1,10 +1,11 @@
extends Control
onready var play_button = $HBoxToolBar/Play
-onready var export_button = $HBoxToolBar/HBoxContainer/Export
-onready var save_button = $HBoxToolBar/HBoxContainer/SaveProject
-onready var more_button = $HBoxToolBar/HBoxContainer/More
+onready var export_button = $HBoxToolBar/Export
+onready var save_button = $HBoxToolBar/SaveProject
+onready var more_button = $HBoxToolBar/More
onready var add_button = $HBoxContainer/ScrollContainer/HBoxContainer/VBoxContainer/AddButton
+onready var bpm_spinbox = $HBoxToolBar/BPMHbox/BPMSpinBox
onready var save_dialog = $SaveDialog
onready var load_dialog = $LoadDialog
onready var sound_dialog = $SoundDialog
@@ -98,12 +99,17 @@ func _ready() -> void:
func on_theme_changed(new_theme) -> void:
theme = load("res://assets/themes/%s/%s.tres" % [new_theme, new_theme])
more_button.icon = load("res://assets/themes/%s/more.svg" % new_theme)
+
+ # HACK: I know it's horrible, but the theme doesn't properly update
+ bpm_spinbox.value += 1
+ bpm_spinbox.value -= 1
func _process(_delta) -> void:
export_button.disabled = BoomBox.is_playing or BoomBox.song.used_columns.max() == -1
play_button.disabled = BoomBox.song.used_columns.max() == -1
save_button.disabled = BoomBox.song.used_columns.max() == -1
+ bpm_spinbox.editable = not BoomBox.is_playing
func _on_Play_toggled(button_pressed) -> void:
@@ -341,6 +347,7 @@ func load_song(path, song = null):
column.set_tile(instrument, value)
+ bpm_spinbox.value = BoomBox.song.bpm
scroll_container.scroll_horizontal = 0
play_button.pressed = false
@@ -356,6 +363,11 @@ func new_song() -> void:
Variables.opened_file = ""
+func _on_BPMSpinBox_value_changed(value: int) -> void:
+ BoomBox.song.bpm = value
+ BoomBox.update_pitch()
+
+
func _on_Settings_pressed() -> void:
$SettingsDialog.popup_centered()
diff --git a/scenes/main.tscn b/scenes/main.tscn
index e3683c4..027a5ca 100644
--- a/scenes/main.tscn
+++ b/scenes/main.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=20 format=2]
+[gd_scene load_steps=21 format=2]
[ext_resource path="res://scenes/main.gd" type="Script" id=1]
[ext_resource path="res://assets/trumpet.png" type="Texture" id=2]
@@ -102,6 +102,9 @@ tracks/1/keys = {
"values": [ true, false ]
}
+[sub_resource type="Theme" id=16]
+LineEdit/constants/minimum_spaces = 7
+
[node name="main" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
@@ -143,37 +146,52 @@ custom_constants/separation = 30
margin_right = 130.0
margin_bottom = 60.0
rect_min_size = Vector2( 100, 60 )
-focus_neighbour_left = NodePath("../HBoxContainer/More")
-focus_neighbour_right = NodePath("../HBoxContainer/Export")
+focus_neighbour_left = NodePath("../More")
+focus_neighbour_right = NodePath("../Export")
toggle_mode = true
text = "BTN_PLAY"
-[node name="Control" type="Control" parent="HBoxToolBar"]
+[node name="BPMHbox" type="HBoxContainer" parent="HBoxToolBar"]
margin_left = 160.0
-margin_right = 160.0
+margin_right = 298.0
margin_bottom = 60.0
-size_flags_horizontal = 3
-[node name="HBoxContainer" type="HBoxContainer" parent="HBoxToolBar"]
-margin_left = 190.0
-margin_right = 1007.0
+[node name="Label" type="Label" parent="HBoxToolBar/BPMHbox"]
+margin_top = 11.0
+margin_right = 55.0
+margin_bottom = 49.0
+theme_type_variation = "LabelSubtitle"
+text = "BPM"
+
+[node name="BPMSpinBox" type="SpinBox" parent="HBoxToolBar/BPMHbox"]
+margin_left = 59.0
+margin_right = 138.0
+margin_bottom = 60.0
+theme = SubResource( 16 )
+min_value = 50.0
+max_value = 150.0
+value = 80.0
+align = 1
+
+[node name="Control" type="Control" parent="HBoxToolBar"]
+margin_left = 328.0
+margin_right = 328.0
margin_bottom = 60.0
size_flags_horizontal = 3
-size_flags_vertical = 3
-custom_constants/separation = 30
-[node name="Export" type="Button" parent="HBoxToolBar/HBoxContainer"]
-margin_right = 163.0
+[node name="Export" type="Button" parent="HBoxToolBar"]
+margin_left = 358.0
+margin_right = 521.0
margin_bottom = 60.0
rect_min_size = Vector2( 100, 0 )
-focus_neighbour_left = NodePath("../../Play")
+focus_neighbour_left = NodePath("../Play")
focus_neighbour_right = NodePath("../SaveProject")
mouse_filter = 1
text = "BTN_EXPORT"
-[node name="SaveProject" type="Button" parent="HBoxToolBar/HBoxContainer"]
-margin_left = 193.0
-margin_right = 443.0
+[node name="SaveProject" type="Button" parent="HBoxToolBar"]
+margin_left = 551.0
+margin_right = 801.0
margin_bottom = 60.0
rect_min_size = Vector2( 150, 0 )
focus_neighbour_left = NodePath("../Export")
@@ -181,9 +199,9 @@ focus_neighbour_right = NodePath("../OpenProject")
mouse_filter = 1
text = "BTN_SAVE_PROJECT"
-[node name="OpenProject" type="Button" parent="HBoxToolBar/HBoxContainer"]
-margin_left = 473.0
-margin_right = 727.0
+[node name="OpenProject" type="Button" parent="HBoxToolBar"]
+margin_left = 831.0
+margin_right = 1085.0
margin_bottom = 60.0
rect_min_size = Vector2( 150, 0 )
focus_neighbour_left = NodePath("../SaveProject")
@@ -191,13 +209,13 @@ focus_neighbour_right = NodePath("../More")
mouse_filter = 1
text = "BTN_OPEN_PROJECT"
-[node name="More" type="MenuButton" parent="HBoxToolBar/HBoxContainer"]
-margin_left = 757.0
-margin_right = 817.0
+[node name="More" type="MenuButton" parent="HBoxToolBar"]
+margin_left = 1115.0
+margin_right = 1175.0
margin_bottom = 60.0
rect_min_size = Vector2( 60, 60 )
focus_neighbour_left = NodePath("../OpenProject")
-focus_neighbour_right = NodePath("../../Play")
+focus_neighbour_right = NodePath("../Play")
focus_mode = 2
mouse_filter = 1
theme_type_variation = "MenuButtonIcon"
@@ -335,9 +353,11 @@ visible = false
[node name="AboutDialog" parent="." instance=ExtResource( 16 )]
[connection signal="toggled" from="HBoxToolBar/Play" to="." method="_on_Play_toggled"]
-[connection signal="pressed" from="HBoxToolBar/HBoxContainer/Export" to="." method="_on_Export_pressed"]
-[connection signal="pressed" from="HBoxToolBar/HBoxContainer/SaveProject" to="." method="_on_SaveProject_pressed"]
-[connection signal="pressed" from="HBoxToolBar/HBoxContainer/OpenProject" to="." method="_on_OpenProject_pressed"]
+[connection signal="value_changed" from="HBoxToolBar/BPMHbox/BPMSpinBox" to="." method="_on_BPMSpinBox_value_changed"]
+[connection signal="value_changed" from="HBoxToolBar/BPMHbox/BPMSpinBox" to="SoundDialog" method="_on_BPMSpinBox_value_changed"]
+[connection signal="pressed" from="HBoxToolBar/Export" to="." method="_on_Export_pressed"]
+[connection signal="pressed" from="HBoxToolBar/SaveProject" to="." method="_on_SaveProject_pressed"]
+[connection signal="pressed" from="HBoxToolBar/OpenProject" to="." method="_on_OpenProject_pressed"]
[connection signal="pressed" from="HBoxContainer/ScrollContainer/HBoxContainer/VBoxContainer/AddButton" to="." method="_on_AddButton_pressed"]
[connection signal="project_name_picked" from="SaveDialog" to="." method="save_project"]
[connection signal="song_name_picked" from="SaveDialog" to="." method="export_song"]
From 3c0477f53678c543604e6efa7f339f0197f67f2b Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Fri, 16 Dec 2022 21:40:49 +0200
Subject: [PATCH 08/18] Fix bug with `song.used_columns`
---
scenes/BoomBox.gd | 3 +--
scenes/main.tscn | 24 ++++++++++++------------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/scenes/BoomBox.gd b/scenes/BoomBox.gd
index 37067ef..4afc5a8 100644
--- a/scenes/BoomBox.gd
+++ b/scenes/BoomBox.gd
@@ -50,8 +50,7 @@ func _process(delta) -> void:
current_column += 1
time -= bar_length
-
- if current_column - 1 >= song.used_columns[-1] or single:
+ if current_column - 1 >= song.used_columns.max() or single:
is_playing = false
yield(get_tree().create_timer(bar_length), "timeout")
emit_signal("play_ended")
diff --git a/scenes/main.tscn b/scenes/main.tscn
index 027a5ca..c06060d 100644
--- a/scenes/main.tscn
+++ b/scenes/main.tscn
@@ -153,7 +153,7 @@ text = "BTN_PLAY"
[node name="BPMHbox" type="HBoxContainer" parent="HBoxToolBar"]
margin_left = 160.0
-margin_right = 298.0
+margin_right = 284.0
margin_bottom = 60.0
[node name="Label" type="Label" parent="HBoxToolBar/BPMHbox"]
@@ -165,7 +165,7 @@ text = "BPM"
[node name="BPMSpinBox" type="SpinBox" parent="HBoxToolBar/BPMHbox"]
margin_left = 59.0
-margin_right = 138.0
+margin_right = 124.0
margin_bottom = 60.0
theme = SubResource( 16 )
min_value = 50.0
@@ -174,14 +174,14 @@ value = 80.0
align = 1
[node name="Control" type="Control" parent="HBoxToolBar"]
-margin_left = 328.0
-margin_right = 328.0
+margin_left = 314.0
+margin_right = 314.0
margin_bottom = 60.0
size_flags_horizontal = 3
[node name="Export" type="Button" parent="HBoxToolBar"]
-margin_left = 358.0
-margin_right = 521.0
+margin_left = 344.0
+margin_right = 507.0
margin_bottom = 60.0
rect_min_size = Vector2( 100, 0 )
focus_neighbour_left = NodePath("../Play")
@@ -190,8 +190,8 @@ mouse_filter = 1
text = "BTN_EXPORT"
[node name="SaveProject" type="Button" parent="HBoxToolBar"]
-margin_left = 551.0
-margin_right = 801.0
+margin_left = 537.0
+margin_right = 787.0
margin_bottom = 60.0
rect_min_size = Vector2( 150, 0 )
focus_neighbour_left = NodePath("../Export")
@@ -200,8 +200,8 @@ mouse_filter = 1
text = "BTN_SAVE_PROJECT"
[node name="OpenProject" type="Button" parent="HBoxToolBar"]
-margin_left = 831.0
-margin_right = 1085.0
+margin_left = 817.0
+margin_right = 1071.0
margin_bottom = 60.0
rect_min_size = Vector2( 150, 0 )
focus_neighbour_left = NodePath("../SaveProject")
@@ -210,8 +210,8 @@ mouse_filter = 1
text = "BTN_OPEN_PROJECT"
[node name="More" type="MenuButton" parent="HBoxToolBar"]
-margin_left = 1115.0
-margin_right = 1175.0
+margin_left = 1101.0
+margin_right = 1161.0
margin_bottom = 60.0
rect_min_size = Vector2( 60, 60 )
focus_neighbour_left = NodePath("../OpenProject")
From 856819661a9297adadaf8f346110ab33e46c8356 Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Fri, 16 Dec 2022 21:48:55 +0200
Subject: [PATCH 09/18] Fix inconsistent scrolling to selected sound
---
scenes/dialogs/SoundDialog.gd | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scenes/dialogs/SoundDialog.gd b/scenes/dialogs/SoundDialog.gd
index b4a76ff..43d2126 100644
--- a/scenes/dialogs/SoundDialog.gd
+++ b/scenes/dialogs/SoundDialog.gd
@@ -6,6 +6,7 @@ var pressed_button_index = 0
var column
onready var button_container = $VBoxContainer/ScrollContainer/VBoxContainer
+onready var scroll_container = $VBoxContainer/ScrollContainer
onready var audio_player = $AudioStreamPlayer
onready var ok_button = $VBoxContainer/HBoxContainer/OkButton
onready var cancel_button = $VBoxContainer/HBoxContainer/CancelButton
@@ -104,6 +105,8 @@ func about_to_show():
$VBoxContainer/Label.text = tr("DIALOG_SOUND_TITLE") % \
[instrument_name, column.column_no + 1]
+ scroll_container.scroll_vertical = 0
+
# Set button states
var clear_button = get_node("VBoxContainer/HBoxContainer/ClearButton")
@@ -123,7 +126,6 @@ func about_to_show():
clear_button.disabled = true
ok_button.disabled = true
- $VBoxContainer/ScrollContainer.scroll_vertical = 0
.about_to_show()
From f5e49efb0970ba7b862edd3fae177aa1bf46d38f Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Sun, 19 Feb 2023 21:26:40 +0200
Subject: [PATCH 10/18] Fix icon import script
---
assets/themes/dark/import_icons.cmd | 2 +-
assets/themes/svg_import.py | 2 +-
assets/themes/white/import_icons.cmd | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/assets/themes/dark/import_icons.cmd b/assets/themes/dark/import_icons.cmd
index 54c3b80..8c797dc 100644
--- a/assets/themes/dark/import_icons.cmd
+++ b/assets/themes/dark/import_icons.cmd
@@ -1 +1 @@
-python -u "d:\Projects\Music-DJ\assets\themes\svg_import.py" --fill "#FFFFFF"
\ No newline at end of file
+python -u "..\svg_import.py" --fill "#FFFFFF"
\ No newline at end of file
diff --git a/assets/themes/svg_import.py b/assets/themes/svg_import.py
index 03a3e69..087b4f0 100644
--- a/assets/themes/svg_import.py
+++ b/assets/themes/svg_import.py
@@ -25,7 +25,7 @@
svg["viewBox"] = "0 0 24 24"
print(path + ": added viewbox")
- if svg["height"] != "36" or svg["height"] != "36":
+ if svg["height"] != "36" or svg["width"] != "36":
svg["height"] = "36"
svg["width"] = "36"
print(path + ": set dimentions")
diff --git a/assets/themes/white/import_icons.cmd b/assets/themes/white/import_icons.cmd
index a855f2b..d3ff7a4 100644
--- a/assets/themes/white/import_icons.cmd
+++ b/assets/themes/white/import_icons.cmd
@@ -1 +1 @@
-python -u "d:\Projects\Music-DJ\assets\themes\svg_import.py" --fill "#000000DE"
\ No newline at end of file
+python -u "..\svg_import.py" --fill "#000000DE"
\ No newline at end of file
From f85b8e8ba81f03e918b8cfcdb8700451108c29c1 Mon Sep 17 00:00:00 2001
From: pattlebass <49322676+pattlebass@users.noreply.github.com>
Date: Sun, 19 Feb 2023 21:33:25 +0200
Subject: [PATCH 11/18] Remove some scripts from gitignore
---
.gitignore | 6 +++++-
bin/.gdignore | 0
bin/Before Android export.md | 4 ++++
bin/after_export.cmd | 12 ++++++++++++
4 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 bin/.gdignore
create mode 100644 bin/Before Android export.md
create mode 100644 bin/after_export.cmd
diff --git a/.gitignore b/.gitignore
index 53eca96..f34e0f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,5 +16,9 @@ data_*/
android/build/
# Other
-bin/
+bin/*
+!bin/.gdignore
+!bin/after_export.cmd
+!bin/Before Android export.md
+
*.zip
\ No newline at end of file
diff --git a/bin/.gdignore b/bin/.gdignore
new file mode 100644
index 0000000..e69de29
diff --git a/bin/Before Android export.md b/bin/Before Android export.md
new file mode 100644
index 0000000..ad7b5f9
--- /dev/null
+++ b/bin/Before Android export.md
@@ -0,0 +1,4 @@
+Before exporting to Android add this to AndroidManifest.xml > permissions, after read external storage
+