Skip to content

Commit 9ab957b

Browse files
committed
Add option to remember changes in datapack export
Moved 'Get extra notes' button to the Settings tab Added 'Remember changes' and 'Use default' options Data pack settings are now saved in the settings file Renamed some variables to include dat_ prefix Fixed wrong tooltips in visualizer type selector
1 parent 785f210 commit 9ab957b

File tree

12 files changed

+136
-61
lines changed

12 files changed

+136
-61
lines changed

Minecraft Note Block Studio.yyp

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/control_create/control_create.gml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -303,23 +303,7 @@ reset_schematic_export(0)
303303
block_color = 0
304304

305305
//Datapack
306-
dat_name = ""
307-
dat_namespace = ""
308-
dat_path = ""
309-
dat_source = "record"
310-
dat_usezip = 1
311-
dat_includelocked = 0
312-
dat_includeoutofrange = 0
313-
dat_enableradius = 0
314-
dat_radius = 16
315-
dat_radiusvalue = 0
316-
dat_enablelooping = 0
317-
vis_type = "Arc"
318-
glow = 1
319-
dat_yval = 100
320-
dat_xval = 0
321-
dat_zval = 0
322-
dat_visualizer = 0
306+
dat_reset(0)
323307

324308
//MP3
325309
mp3_includelocked = 0

scripts/dat_generate/dat_generate.gml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//dat_generate(functionpath, functiondir, objective)
2-
var o, s, functionpath, functiondir, objective, str, instrument, soundname, pitch, source, blockvolume, blockposition
2+
var o, s, a, b, i, functionpath, functiondir, objective, str, instrument, soundname, pitch, source, blockvolume, blockposition
33
o = obj_controller
44

55
source = o.dat_source
@@ -32,74 +32,74 @@ for (a = 0; a <= o.enda; a++) {
3232

3333
if o.dat_visualizer = 1 {
3434
// Visualizer Types
35-
if o.vis_type = "Arc" { // Arc
35+
if o.dat_vis_type = "Arc" { // Arc
3636
str += "summon minecraft:falling_block " + string(real((o.song_key[a, b]-45) * -1) + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(((o.song_ins[a, b]-100002) * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ string(block_get_namespaced_id(o.sch_exp_ins_block[o.song_ins[a, b]-100002], 0)) + "\"},"
37-
if o.glow = 1 {
37+
if o.dat_glow = 1 {
3838
str += "Tags:[\"" + string(o.song_ins[a, b]-100001) + "\"],Glowing:1,"
3939
}
4040
str += "Time:-120,DropItem:0,Motion:[0.0d,1.0d,1.0d]}" + br
41-
if o.glow = 1 {
41+
if o.dat_glow = 1 {
4242
str += "team join " + string(o.song_ins[a, b]-100001) + " @e[tag=" + string(o.song_ins[a, b]-100001) + "]" + br
4343
}
4444
}
4545

46-
if o.vis_type = "Fall" { // Fall
46+
if o.dat_vis_type = "Fall" { // Fall
4747
str += "summon minecraft:falling_block " + string(o.song_key[a, b]-45 + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(((o.song_ins[a, b]-100002) * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ string(block_get_namespaced_id(o.sch_exp_ins_block[o.song_ins[a, b]-100002], 0)) + "\"},"
48-
if o.glow = 1 {
48+
if o.dat_glow = 1 {
4949
str += "Tags:[\"" + string(o.song_ins[a, b]-100001) + "\"],Glowing:1,"
5050
}
5151
str += "Time:-80,DropItem:0,Motion:[0.0d,-1.3d,0.0d]}" + br
52-
if o.glow = 1 {
52+
if o.dat_glow = 1 {
5353
str += "team join " + string(o.song_ins[a, b]-100001) + " @e[tag=" + string(o.song_ins[a, b]-100001) + "]" + br
5454
}
5555
}
5656

57-
if o.vis_type = "Piano Roll" { // Piano Roll
57+
if o.dat_vis_type = "Piano Roll" { // Piano Roll
5858
str += "summon minecraft:falling_block " + string(real((o.song_key[a, b]-45) * -1) + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ string(block_get_namespaced_id(o.sch_exp_ins_block[o.song_ins[a, b]-100002], 0)) + "\"},"
59-
if o.glow = 1 {
59+
if o.dat_glow = 1 {
6060
str += "Tags:[\"" + string(o.song_ins[a, b]-100001) + "\"],Glowing:1,"
6161
}
6262
str += "Time:-50,DropItem:0,NoGravity:1,Motion:[0.0d,0.0d,2.5d]}" + br
63-
if o.glow = 1 {
63+
if o.dat_glow = 1 {
6464
str += "team join " + string(o.song_ins[a, b]-100001) + " @e[tag=" + string(o.song_ins[a, b]-100001) + "]" + br
6565
}
6666
str += "particle minecraft:note " + "-" + string(o.song_key[a, b]-45 + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(real(o.dat_zval)) + " " + "0.5 0 0.5 1 4 force @p" + br
6767
}
6868

69-
if o.vis_type = "Rise" { // Rise
69+
if o.dat_vis_type = "Rise" { // Rise
7070
str += "summon minecraft:falling_block " + string(o.song_key[a, b]-45 + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(((o.song_ins[a, b]-100002) * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ string(block_get_namespaced_id(o.sch_exp_ins_block[o.song_ins[a, b]-100002], 0)) + "\"},"
71-
if o.glow = 1 {
71+
if o.dat_glow = 1 {
7272
str += "Tags:[\"" + string(o.song_ins[a, b]-100001) + "\"],Glowing:1,"
7373
}
7474
str += "Time:-50,DropItem:0,Glowing:1,NoGravity:1,Motion:[0.0d,1.0d,0.0d]}" + br
75-
if o.glow = 1 {
75+
if o.dat_glow = 1 {
7676
str += "team join " + string(o.song_ins[a, b]-100001) + " @e[tag=" + string(o.song_ins[a, b]-100001) + "]" + br
7777
}
7878
}
7979

80-
if o.vis_type = "Bounce" { // Bounce
80+
if o.dat_vis_type = "Bounce" { // Bounce
8181
str += "summon minecraft:falling_block " + string(o.song_key[a, b]-45 + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(((o.song_ins[a, b]-100002) * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ string(block_get_namespaced_id(o.sch_exp_ins_block[o.song_ins[a, b]-100002], 0)) + "\"},"
82-
if o.glow = 1 {
82+
if o.dat_glow = 1 {
8383
str += "Tags:[\"" + string(o.song_ins[a, b]-100001) + "\"],Glowing:1,"
8484
}
8585
str += "Time:-80,DropItem:0,Motion:[0.0d,1.3d,0.0d]}" + br
86-
if o.glow = 1 {
86+
if o.dat_glow = 1 {
8787
str += "team join " + string(o.song_ins[a, b]-100001) + " @e[tag=" + string(o.song_ins[a, b]-100001) + "]" + br
8888
}
8989
}
90-
if o.vis_type = "Fountain" { // Fountain
90+
if o.dat_vis_type = "Fountain" { // Fountain
9191
str += "summon minecraft:falling_block " + string(o.song_key[a, b]-45 + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(((o.song_ins[a, b]-100002) * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ string(block_get_namespaced_id(o.sch_exp_ins_block[o.song_ins[a, b]-100002], 0)) + "\"},"
92-
if o.glow = 1 {
92+
if o.dat_glow = 1 {
9393
str += "Tags:[\"" + string(o.song_ins[a, b]-100001) + "\"],Glowing:1,"
9494
}
9595
if o.song_key[a, b] > 45 {
9696
str += "Time:-80,DropItem:0,Motion:[0.5d,1.5d,0.0d]}" + br
9797
} else str += "Time:-80,DropItem:0,Motion:[-0.5d,1.5d,0.0d]}" + br
98-
if o.glow = 1 {
98+
if o.dat_glow = 1 {
9999
str += "team join " + string(o.song_ins[a, b]-100001) + " @e[tag=" + string(o.song_ins[a, b]-100001) + "]" + br
100100
}
101101
}
102-
if o.vis_type = "Rittai Onkyou" { // Rittai Onkyou
102+
if o.dat_vis_type = "Rittai Onkyou" { // Rittai Onkyou
103103
str += "summon minecraft:falling_block " + string(blockposition * 48) + " " + string(90) + " " + string(blockvolume * 48) + " " +"{BlockState:{Name:\"minecraft:"+ string(block_get_namespaced_id(o.sch_exp_ins_block[o.song_ins[a, b]-100002], 0)) + "\"},Time:-80,DropItem:0,Motion:[0.0d,-1.3d,0.0d]}" + br
104104
+ "summon minecraft:falling_block " + string(blockposition * 48) + " " + string(90) + " " + string((blockvolume * 48) - 1) + " " +"{BlockState:{Name:\"minecraft:note_block\"},Time:-80,DropItem:0,Motion:[0.0d,-1.3d,0.0d]}" + br
105105
+ "particle minecraft:note " + string(blockposition * 48) + " " + string(90) + " " + string((blockvolume * 48) - 2) + " 0 0 0 1 1 force @p" + br

scripts/dat_getpath/dat_getpath.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//dat_getpath(opath)
22
//sanitize path input by removing consecutive slashes, slashes at beginning/end of path, and special characters
33

4+
var i
45
var opath = argument0
56
var path = ""
67
var char

scripts/dat_makefolders/dat_makefolders.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//create folder structure prior to creating the datapack files
33
//returns: functiondir
44

5+
var i
56
var path = argument0
67
var namespace = argument1
78

scripts/dat_preview/dat_preview.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ if (string_lettersdigits(name) = "") {
2121
}
2222
}
2323

24-
return string_maxwidth(preview, 510) + condstr(string_width(preview) > 510, "...")
24+
return string_maxwidth(preview, 350) + condstr(string_width(preview) > 350, "...")

scripts/dat_reset/dat_reset.gml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// dat_reset(mode)
2+
// Resets datapack preferences to default
3+
4+
if (!argument0) {
5+
selected_tab_dat = 0
6+
dat_remember = 1
7+
}
8+
dat_name = ""
9+
dat_namespace = ""
10+
dat_path = ""
11+
dat_source = "record"
12+
dat_usezip = 1
13+
dat_includelocked = 0
14+
dat_includeoutofrange = 0
15+
dat_enableradius = 0
16+
dat_radius = 16
17+
dat_radiusvalue = 0
18+
dat_enablelooping = 0
19+
dat_remember = 1
20+
dat_vis_type = "Arc"
21+
dat_glow = 1
22+
dat_yval = 100
23+
dat_xval = 0
24+
dat_zval = 0
25+
dat_visualizer = 0

scripts/dat_reset/dat_reset.yy

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/draw_window_datapack_export/draw_window_datapack_export.gml

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ nsel = -1
1515
menun = -1
1616
for (a = 0; a < 2; a += 1) {
1717
c = mouse_rectangle(x1 + b, y1 + 28, string_width(str[a]) + 12, 18)
18-
if (selected_tab_sch = a) {
18+
if (selected_tab_dat = a) {
1919
stabx = b - 2
2020
stabw = string_width(str[a]) + 15
2121
} else {
@@ -40,12 +40,12 @@ if (theme = 0) {
4040
draw_set_color(c_white)
4141
draw_rectangle(x1 + stabx + 1, y1 + 46, x1 + stabx + stabw - 1, y1 + 47, 0)
4242
draw_theme_color()
43-
draw_text(x1 + stabx + 8, y1 + 28, str[selected_tab_sch])
43+
draw_text(x1 + stabx + 8, y1 + 28, str[selected_tab_dat])
4444
} else if(theme = 1){
4545
draw_sprite(spr_tabbuttons, 12, x1 + stabx - 1, y1 + 26)
4646
draw_sprite_ext(spr_tabbuttons, 13, x1 + stabx + 1, y1 + 26, stabw / 2 - 1, 1, 0, -1, 1)
4747
draw_sprite(spr_tabbuttons, 14, x1 + stabx + stabw - 1, y1 + 26)
48-
draw_text(x1 + stabx + 8, y1 + 28, str[selected_tab_sch])
48+
draw_text(x1 + stabx + 8, y1 + 28, str[selected_tab_dat])
4949
}else{
5050
draw_set_color(c_dark)
5151
draw_rectangle(x1 + 6, y1 + 46, x1 + 494 + 50, y1 + 392, 0)
@@ -58,13 +58,13 @@ if (theme = 0) {
5858
draw_set_color(c_dark)
5959
draw_rectangle(x1 + stabx + 1, y1 + 46, x1 + stabx + stabw - 1, y1 + 47, 0)
6060
draw_theme_color()
61-
draw_text(x1 + stabx + 8, y1 + 28, str[selected_tab_sch])
61+
draw_text(x1 + stabx + 8, y1 + 28, str[selected_tab_dat])
6262
}
63-
if (nsel > -1) selected_tab_sch = nsel
64-
selected_tab_sch += keyboard_check_pressed(vk_right) - keyboard_check_pressed(vk_left)
65-
if (selected_tab_sch < 0) selected_tab_sch = 1
66-
if (selected_tab_sch > 1) selected_tab_sch = 0
67-
if (selected_tab_sch = 0) {
63+
if (nsel > -1) selected_tab_dat = nsel
64+
selected_tab_dat += keyboard_check_pressed(vk_right) - keyboard_check_pressed(vk_left)
65+
if (selected_tab_dat < 0) selected_tab_dat = 1
66+
if (selected_tab_dat > 1) selected_tab_dat = 0
67+
if (selected_tab_dat = 0) {
6868
draw_sprite(spr_datapack_exp, 2, x1 + 66, y1 + -40)
6969
draw_theme_color()
7070

@@ -139,27 +139,33 @@ if (selected_tab_sch = 0) {
139139
draw_text(x1 + 380, y1 + 333, "Loop start:")
140140
popup_set_window(x1 + 380, y1 + 329, 125, 21, "Tick the song will jump to at the end of playback")
141141
draw_theme_color()
142+
143+
//Get extra notes button
144+
if (draw_button2(x1 + 380, y1 + 362, 152, "Get extra notes pack", !dat_includeoutofrange)) {
145+
datapack_getextranotes()
146+
}
147+
142148
} else {
143149
if (draw_checkbox(x1 + 33, y1 + 55, dat_visualizer, "Enable visualizer", "NOTE: Please use a VOID world as falling blocks will pile up!")) dat_visualizer=!dat_visualizer
144150
//Type
145151
draw_sprite(spr_datapack_exp, 1, x1 + 125, y1 + 55)
146152
draw_text(x1 + 33, y1 + 75, "Visualizer Type")
147-
if (draw_radiobox(x1 + 33, y1 + 95, vis_type = "Arc", "Arc", "Controlled by Ambient/Environment slider")) vis_type = "Arc"
148-
if (draw_radiobox(x1 + 33, y1 + 115, vis_type = "Fall", "Fall", "Controlled by Blocks slider")) vis_type = "Fall"
149-
if (draw_radiobox(x1 + 33, y1 + 135, vis_type = "Rise", "Rise", "Controlled by Hostile Creatures slider")) vis_type = "Rise"
150-
if (draw_radiobox(x1 + 33, y1 + 155, vis_type = "Bounce", "Bounce", "Controlled by Master Volume slider")) vis_type = "Bounce"
151-
if (draw_radiobox(x1 + 33, y1 + 175, vis_type = "Piano Roll", "Piano Roll", "Controlled by Master Volume slider")) vis_type = "Piano Roll"
152-
if (draw_radiobox(x1 + 33, y1 + 195, vis_type = "Fountain", "Fountain", "Controlled by Master Volume slider")) vis_type = "Fountain"
153-
if (draw_radiobox(x1 + 33, y1 + 215, vis_type = "Rittai Onkyou", "Rittai Onkyou", "Controlled by Master Volume slider")) vis_type = "Rittai Onkyou"
154-
if (draw_checkbox(x1 + 33, y1 + 235, glow, "Add Glow", "Whether to add a glow to each instrument.")) glow=!glow
153+
if (draw_radiobox(x1 + 33, y1 + 95, dat_vis_type = "Arc", "Arc", "Use Arc visualizer.")) dat_vis_type = "Arc"
154+
if (draw_radiobox(x1 + 33, y1 + 115, dat_vis_type = "Fall", "Fall", "Use Fall visualizer.")) dat_vis_type = "Fall"
155+
if (draw_radiobox(x1 + 33, y1 + 135, dat_vis_type = "Rise", "Rise", "Use Rise visualizer.")) dat_vis_type = "Rise"
156+
if (draw_radiobox(x1 + 33, y1 + 155, dat_vis_type = "Bounce", "Bounce", "Use Bounce visualizer.")) dat_vis_type = "Bounce"
157+
if (draw_radiobox(x1 + 33, y1 + 175, dat_vis_type = "Piano Roll", "Piano Roll", "Use Piano Roll visualizer.")) dat_vis_type = "Piano Roll"
158+
if (draw_radiobox(x1 + 33, y1 + 195, dat_vis_type = "Fountain", "Fountain", "Use Fountain visualizer.")) dat_vis_type = "Fountain"
159+
if (draw_radiobox(x1 + 33, y1 + 215, dat_vis_type = "Rittai Onkyou", "Rittai Onkyou", "Use Rittai Onkyou visualizer.")) dat_vis_type = "Rittai Onkyou"
160+
if (draw_checkbox(x1 + 33, y1 + 235, dat_glow, "Add Glow", "Whether to add a dat_glow to each instrument.")) dat_glow=!dat_glow
155161
draw_text(x1 + 33, y1 + 255, "Spawn Height:")
156162
dat_yval = median(0, draw_dragvalue(11, x1 + 33, y1 + 275, dat_yval, 0.5), 256)
157163
draw_text(x1 + 33, y1 + 295, "Position In Map:")
158164
draw_text(x1 + 33, y1 + 318, "X Value:")
159165
dat_xval = draw_inputbox(23,x1 + 83, y1 + 315,40,dat_xval,"X value")
160166
draw_text(x1 + 33, y1 + 338, "Z Value:")
161167
dat_zval = draw_inputbox(24,x1 + 83, y1 + 335,40,dat_zval,"Z value")
162-
//Get extra notes button
168+
//Get note block textures button
163169
if (draw_button2(x1 + 13, y1 + 360, 152, "Get Note Block Textures")) {
164170
datapack_getinstextures()
165171
}
@@ -179,12 +185,15 @@ if (draw_button2(x1 + 470, y1 + 398, 72, "Export", false)) {
179185
}
180186
}
181187

188+
//Remember changes
189+
if (draw_checkbox(x1 + 12, y1 + 404, dat_remember, "Remember changes", "Whether to use these settings the\nnext time you export a data pack.") && wmenu = 0) dat_remember = !dat_remember
190+
191+
//Use default
192+
if (draw_button2(x1 + 310, y1 + 398, 72, "Use default") && wmenu = 0) {
193+
if (question("Are you sure?", "Confirm")) dat_reset(1)
194+
}
195+
182196
//Cancel button
183197
if (draw_button2(x1 + 390, y1 + 398, 72, "Cancel", false)) {
184198
window = 0
185199
}
186-
187-
//Get extra notes button
188-
if (draw_button2(x1 + 230, y1 + 398, 152, "Get extra notes pack", !dat_includeoutofrange)) {
189-
datapack_getextranotes()
190-
}

scripts/load_settings/load_settings.gml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,27 @@ sch_exp_layer3 = ini_read_real("branch_export", "layer3", sch_exp_laye
100100
sch_exp_range_start = ini_read_real("branch_export", "range_start", sch_exp_range_start)
101101
sch_exp_range_end = ini_read_real("branch_export", "range_end", sch_exp_range_end)
102102

103+
// Datapack export settings
104+
dat_name = ini_read_string("datapack_export", "name", dat_name)
105+
dat_namespace = ini_read_string("datapack_export", "namespace", dat_namespace)
106+
dat_path = ini_read_string("datapack_export", "path", dat_path)
107+
dat_source = ini_read_string("datapack_export", "source", dat_source)
108+
dat_usezip = ini_read_real( "datapack_export", "use_zip", dat_usezip)
109+
dat_includelocked = ini_read_real( "datapack_export", "locked", dat_includelocked)
110+
dat_includeoutofrange = ini_read_real( "datapack_export", "out_of_range", dat_includeoutofrange)
111+
dat_enableradius = ini_read_real( "datapack_export", "enable_radius", dat_enableradius)
112+
dat_radius = ini_read_real( "datapack_export", "radius", dat_radius)
113+
dat_enablelooping = ini_read_real( "datapack_export", "looping", dat_enablelooping)
114+
dat_visualizer = ini_read_real( "datapack_export", "visualizer", dat_visualizer)
115+
dat_vis_type = ini_read_string("datapack_export", "vis_type", dat_vis_type)
116+
dat_glow = ini_read_real( "datapack_export", "vis_glow", dat_glow)
117+
dat_xval = ini_read_real( "datapack_export", "vis_x", dat_xval)
118+
dat_yval = ini_read_real( "datapack_export", "vis_y", dat_yval)
119+
dat_zval = ini_read_real( "datapack_export", "vis_z", dat_zval)
120+
103121
// Keyboard keys
104122
for (a = 0; a < 88; a += 1) piano_key[a] = ini_read_real("piano_keys", "piano_key_" + string(a), piano_key[a])
123+
105124
// Warnings
106125
warning_octaves = ini_read_real("warnings", "octaves", warning_octaves)
107126
warning_instrument = ini_read_real("warnings", "instrument", warning_instrument)

0 commit comments

Comments
 (0)