@@ -281,6 +281,16 @@ func update_status(message: String, level: StatusLevel = StatusLevel.INFO) -> vo
281
281
status_updated .emit (level , message )
282
282
283
283
284
+ func update_status_notes_dropped (dropped_amount : int ) -> void :
285
+ if dropped_amount <= 0 :
286
+ return
287
+
288
+ if dropped_amount == 1 :
289
+ update_status ("%d NOTE WAS REMOVED (CTRL + Z TO UNDO)" % [ dropped_amount ], Controller .StatusLevel .WARNING )
290
+ else :
291
+ update_status ("%d NOTES WERE REMOVED (CTRL + Z TO UNDO)" % [ dropped_amount ], Controller .StatusLevel .WARNING )
292
+
293
+
284
294
# Song editing.
285
295
286
296
func set_current_song (song : Song ) -> void :
@@ -672,6 +682,8 @@ func delete_instrument(instrument_index: int) -> void:
672
682
state_context .reset_patterns_affected .clear ()
673
683
state_context .shifted_patterns .clear ()
674
684
685
+ var total_affected_count := 0
686
+
675
687
# Validate instruments in available patterns.
676
688
677
689
# Note that we actually want the current pattern here, not the one that was current when we
@@ -683,10 +695,11 @@ func delete_instrument(instrument_index: int) -> void:
683
695
# If we deleted this instrument, set the pattern to the first available.
684
696
if pattern .instrument_idx == instrument_index :
685
697
state_context .reset_patterns_keys .push_back (pattern .key ) # When changing to a drumkit, this is reset.
686
-
698
+
687
699
var affected := pattern .change_instrument (0 , current_song .instruments [0 ])
688
700
state_context .reset_patterns .push_back (pattern_idx )
689
701
state_context .reset_patterns_affected .push_back (affected )
702
+ total_affected_count += affected .size ()
690
703
691
704
if pattern_idx == current_pattern_index :
692
705
current_pattern_affected = true
@@ -701,6 +714,9 @@ func delete_instrument(instrument_index: int) -> void:
701
714
702
715
song_instrument_changed .emit ()
703
716
717
+ if total_affected_count > 0 :
718
+ update_status_notes_dropped (total_affected_count )
719
+
704
720
# Properly signal that the instrument has changed for the currently edited pattern.
705
721
if current_pattern_affected :
706
722
refresh_current_pattern_instrument ()
@@ -786,18 +802,24 @@ func _set_current_instrument_by_voice(voice_data: VoiceManager.VoiceData) -> voi
786
802
state_context .reset_patterns_keys .clear ()
787
803
state_context .reset_patterns_affected .clear ()
788
804
805
+ var total_affected_count := 0
806
+
789
807
# Validate instruments in available patterns.
790
808
for pattern_idx in current_song .patterns .size ():
791
809
var pattern := current_song .patterns [pattern_idx ]
792
810
793
811
if pattern .instrument_idx == instrument_idx :
794
812
state_context .reset_patterns_keys .push_back (pattern .key ) # When changing to a drumkit, this is reset.
795
-
813
+
796
814
var affected := pattern .change_instrument (instrument_idx , instrument )
797
815
state_context .reset_patterns .push_back (pattern_idx )
798
816
state_context .reset_patterns_affected .push_back (affected )
799
-
817
+ total_affected_count += affected .size ()
818
+
800
819
song_instrument_changed .emit ()
820
+
821
+ if total_affected_count > 0 :
822
+ update_status_notes_dropped (total_affected_count )
801
823
)
802
824
song_state .add_undo_action (func () -> void :
803
825
current_song .instruments [instrument_idx ] = old_instrument
0 commit comments