Skip to content

Commit ca4aa97

Browse files
committed
Improve Heavy console with ANSI colour, font weight and command logging
1 parent 6f38358 commit ca4aa97

File tree

17 files changed

+982
-454
lines changed

17 files changed

+982
-454
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ file(GLOB plugdata_resources
176176
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/InterVariable.ttf
177177
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/InterRegular.ttf
178178
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/RobotoMono-Regular.ttf
179+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/RobotoMono-Bold.ttf
179180
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Icons/plugdata_large_logo.png
180181
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Icons/plugdata_logo.png
181182
# Generated resources
85.6 KB
Binary file not shown.

Resources/Scripts/package_resources.py

Lines changed: 80 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def existsAsFile(path):
7575
def existsAsDir(path):
7676
return os.path.isdir(path)
7777

78+
7879
def makeArchive(name, root_dir, base_dir):
7980
archive_path = os.path.abspath(name)
8081
preset = 9 | lzma.PRESET_EXTREME # max compression
@@ -83,6 +84,7 @@ def makeArchive(name, root_dir, base_dir):
8384
full_path = os.path.join(root_dir, base_dir)
8485
tar.add(full_path, arcname=base_dir)
8586

87+
8688
def split(a, n):
8789
k, m = divmod(len(a), n)
8890
return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n))
@@ -163,12 +165,15 @@ def generate_binary_data(output_dir, file_list):
163165
header.write("namespace BinaryData\n{\n")
164166
for data in file_data:
165167
header.write(f" extern const char* {data['var_name']};\n")
166-
header.write(f" const int {data['var_name']}Size = {data['size']};\n")
168+
header.write(f" const int {data['var_name']}Size = {
169+
data['size']};\n")
167170

168-
header.write("\n const int namedResourceListSize = {};\n".format(len(file_data)))
171+
header.write(
172+
"\n const int namedResourceListSize = {};\n".format(len(file_data)))
169173
header.write(" extern const char* namedResourceList[];\n")
170174
header.write(" extern const char* originalFilenames[];\n")
171-
header.write(" const char* getNamedResource (const char* resourceNameUTF8, int& dataSizeInBytes);\n")
175+
header.write(
176+
" const char* getNamedResource (const char* resourceNameUTF8, int& dataSizeInBytes);\n")
172177
header.write("}\n")
173178

174179
with open(output_dir + "/BinaryData.cpp", "w") as source:
@@ -180,16 +185,19 @@ def generate_binary_data(output_dir, file_list):
180185
source.write(f" \"{data['var_name']}\",\n")
181186
source.write(" };\n\n")
182187

183-
source.write("const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)\n")
188+
source.write(
189+
"const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)\n")
184190
source.write("{\n")
185191
source.write(" unsigned int hash = 0;\n")
186192
source.write(" if (resourceNameUTF8 != nullptr)\n")
187193
source.write(" while (*resourceNameUTF8 != 0)\n")
188-
source.write(" hash = 31 * hash + (unsigned int) *resourceNameUTF8++;\n\n")
194+
source.write(
195+
" hash = 31 * hash + (unsigned int) *resourceNameUTF8++;\n\n")
189196

190197
source.write(" switch (hash)\n {\n")
191198
for data in file_data:
192-
source.write(f" case 0x{data['hash']:08x}: numBytes = {data['size']}; return {data['var_name']};\n")
199+
source.write(f" case 0x{data['hash']:08x}: numBytes = {
200+
data['size']}; return {data['var_name']};\n")
193201
source.write(" default: break;\n")
194202
source.write(" }\n\n")
195203

@@ -203,8 +211,10 @@ def generate_binary_data(output_dir, file_list):
203211
cpp_filename = output_dir + "/BinaryData_" + data["index"] + ".cpp"
204212
with open(cpp_filename, "w") as cpp_file:
205213
cpp_file.write("namespace BinaryData\n{\n")
206-
cpp_file.write(f"//================== {data['filename']} ==================\n")
207-
cpp_file.write(f"static const unsigned char {data['temp_name']}[] =\n{{\n")
214+
cpp_file.write(
215+
f"//================== {data['filename']} ==================\n")
216+
cpp_file.write(f"static const unsigned char {
217+
data['temp_name']}[] =\n{{\n")
208218

209219
chunk_size = 64
210220
for i in range(0, len(data['binary']), chunk_size):
@@ -214,7 +224,8 @@ def generate_binary_data(output_dir, file_list):
214224
cpp_file.write(f" {hex_values}\n")
215225

216226
cpp_file.write("};\n\n")
217-
cpp_file.write(f"const char* {data['var_name']} = (const char*) {data['temp_name']};\n")
227+
cpp_file.write(
228+
f"const char* {data['var_name']} = (const char*) {data['temp_name']};\n")
218229
cpp_file.write("}\n")
219230

220231

@@ -236,12 +247,18 @@ def generate_binary_data(output_dir, file_list):
236247
globCopy(project_root + "/Libraries/pure-data/extra/*.pd", "./Abstractions")
237248
globCopy(project_root + "/Libraries/pure-data/extra/**/*-help.pd", "./Abstractions")
238249

239-
globCopy(project_root + "/Libraries/pd-else/Abstractions/Control/*.pd", "./Abstractions/else")
240-
globCopy(project_root + "/Libraries/pd-else/Abstractions/Audio/*.pd", "./Abstractions/else")
241-
globCopy(project_root + "/Libraries/pd-else/Abstractions/Extra/*.pd", "./Abstractions/else")
242-
globCopy(project_root + "/Libraries/pd-else/Source/Control/*.pd_lua", "./Abstractions/else")
243-
globCopy(project_root + "/Libraries/pd-else/Source/Audio/*.pd_lua", "./Abstractions/else")
244-
globCopy(project_root + "/Libraries/pd-else/Abstractions/Extra/*.pd_lua", "./Abstractions/else")
250+
globCopy(project_root + "/Libraries/pd-else/Abstractions/Control/*.pd",
251+
"./Abstractions/else")
252+
globCopy(project_root + "/Libraries/pd-else/Abstractions/Audio/*.pd",
253+
"./Abstractions/else")
254+
globCopy(project_root + "/Libraries/pd-else/Abstractions/Extra/*.pd",
255+
"./Abstractions/else")
256+
globCopy(project_root + "/Libraries/pd-else/Source/Control/*.pd_lua",
257+
"./Abstractions/else")
258+
globCopy(project_root + "/Libraries/pd-else/Source/Audio/*.pd_lua",
259+
"./Abstractions/else")
260+
globCopy(project_root + "/Libraries/pd-else/Abstractions/Extra/*.pd_lua",
261+
"./Abstractions/else")
245262
copyFile(project_root + "/Resources/Patches/lua.pd_lua", "./Abstractions/else")
246263
copyFile(project_root + "/Resources/Patches/playhead.pd", "./Abstractions")
247264
copyFile(project_root + "/Resources/Patches/param.pd", "./Abstractions")
@@ -250,21 +267,33 @@ def generate_binary_data(output_dir, file_list):
250267
# copyFile("../../Patches/beat.pd", "./Abstractions")
251268

252269
globMove("Abstractions/*-help.pd", "./Documentation/5.reference")
253-
copyDir(project_root + "/Libraries/pd-else/Documentation/Help-files/", "./Documentation/9.else")
254-
copyFile(project_root + "/Libraries/pd-else/Documentation/Extra-files/f2s~-help.pd", "./Documentation/9.else")
270+
copyDir(project_root + "/Libraries/pd-else/Documentation/Help-files/",
271+
"./Documentation/9.else")
272+
copyFile(project_root + "/Libraries/pd-else/Documentation/Extra-files/f2s~-help.pd",
273+
"./Documentation/9.else")
255274

256275
# copyFile("../../Patches/beat-help.pd", "./Documentation/5.reference")
257-
copyFile(project_root + "/Resources/Patches/param-help.pd", "./Documentation/5.reference")
258-
copyFile(project_root + "/Resources/Patches/playhead-help.pd", "./Documentation/5.reference")
259-
copyFile(project_root + "/Resources/Patches/daw_storage-help.pd", "./Documentation/5.reference")
260-
copyFile(project_root + "/Resources/Patches/plugin_latency-help.pd", "./Documentation/5.reference")
261-
262-
globCopy(project_root + "/Libraries/pd-cyclone/cyclone_objects/abstractions/*.pd", "./Abstractions/cyclone")
263-
copyDir(project_root + "/Libraries/pd-cyclone/documentation/help_files", "./Documentation/10.cyclone")
264-
globCopy(project_root + "/Libraries/pd-cyclone/documentation/extra_files/*", "./Documentation/10.cyclone/")
265-
moveFile(project_root + "/Libraries/pd-cyclone/documentation/extra_files/All_about_cyclone.pd", "./Abstractions/cyclone/") # help files want to find this here
266-
moveFile("./Documentation/10.cyclone/dsponoff~.pd", "./Abstractions/cyclone/dsponoff~.pd")
267-
copyDir(project_root + "/Libraries/pd-else/Documentation/Live-Electronics-Tutorial/", "./Documentation/12.live-electronics-tutorial")
276+
copyFile(project_root + "/Resources/Patches/param-help.pd",
277+
"./Documentation/5.reference")
278+
copyFile(project_root + "/Resources/Patches/playhead-help.pd",
279+
"./Documentation/5.reference")
280+
copyFile(project_root + "/Resources/Patches/daw_storage-help.pd",
281+
"./Documentation/5.reference")
282+
copyFile(project_root + "/Resources/Patches/plugin_latency-help.pd",
283+
"./Documentation/5.reference")
284+
285+
globCopy(project_root + "/Libraries/pd-cyclone/cyclone_objects/abstractions/*.pd",
286+
"./Abstractions/cyclone")
287+
copyDir(project_root + "/Libraries/pd-cyclone/documentation/help_files",
288+
"./Documentation/10.cyclone")
289+
globCopy(project_root + "/Libraries/pd-cyclone/documentation/extra_files/*",
290+
"./Documentation/10.cyclone/")
291+
moveFile(project_root + "/Libraries/pd-cyclone/documentation/extra_files/All_about_cyclone.pd",
292+
"./Abstractions/cyclone/") # help files want to find this here
293+
moveFile("./Documentation/10.cyclone/dsponoff~.pd",
294+
"./Abstractions/cyclone/dsponoff~.pd")
295+
copyDir(project_root + "/Libraries/pd-else/Documentation/Live-Electronics-Tutorial/",
296+
"./Documentation/12.live-electronics-tutorial")
268297

269298
makeDir("Documentation/11.heavylib")
270299
copyDir(project_root + "/Libraries/heavylib", "./Abstractions/heavylib")
@@ -280,15 +309,21 @@ def generate_binary_data(output_dir, file_list):
280309
copyFile(project_root + "/Libraries/pd-else/Documentation/README.pdf", "Extra/else")
281310
copyDir(project_root + "/Libraries/pd-else/Source/Audio/sfz~/sfz", "Extra/else/sfz")
282311
copyDir(project_root + "/Resources/Patches/Presets", "./Extra/Presets")
283-
convert_merda.process(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/")
284-
globCopy(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/*.pd", "./Extra/else")
285-
copyDir(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/brane-presets", "./Extra/else/brane-presets")
312+
convert_merda.process(
313+
project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/")
314+
globCopy(project_root +
315+
"/Libraries/pd-else/Abstractions/Merda/Modules/*.pd", "./Extra/else")
316+
copyDir(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/brane-presets",
317+
"./Extra/else/brane-presets")
286318
globCopy(project_root + "/Libraries/pure-data/doc/sound/*", "Extra/else")
287319

288320
# Our folder is called "Documentation" instead of "doc", which makes some file paths in default helpfiles invalid
289-
replaceTextInFolder("Documentation/5.reference", "../doc/5.reference/", "../Documentation/5.reference/")
290-
replaceTextInFolder("Documentation/5.reference", "../doc/sound/", "../Documentation/sound/")
291-
replaceTextInFolder("Abstractions/cyclone", "All_objects", "All_cyclone_objects")
321+
replaceTextInFolder("Documentation/5.reference",
322+
"../doc/5.reference/", "../Documentation/5.reference/")
323+
replaceTextInFolder("Documentation/5.reference",
324+
"../doc/sound/", "../Documentation/sound/")
325+
replaceTextInFolder("Abstractions/cyclone",
326+
"All_objects", "All_cyclone_objects")
292327

293328
# pd-lua
294329
makeDir("Extra/pdlua")
@@ -308,9 +343,12 @@ def generate_binary_data(output_dir, file_list):
308343
makeDir("Abstractions/Gem")
309344

310345
copyDir(project_root + "/Libraries/Gem/help", "Documentation/14.gem")
311-
copyDir(project_root + "/Libraries/Gem/examples", "Documentation/14.gem/examples")
312-
copyDir(project_root + "/Libraries/Gem/doc", "Documentation/14.gem/examples/Documentation")
313-
globCopy(project_root + "/Libraries/Gem/abstractions/*.pd", "Abstractions/Gem/")
346+
copyDir(project_root + "/Libraries/Gem/examples",
347+
"Documentation/14.gem/examples")
348+
copyDir(project_root + "/Libraries/Gem/doc",
349+
"Documentation/14.gem/examples/Documentation")
350+
globCopy(project_root + "/Libraries/Gem/abstractions/*.pd",
351+
"Abstractions/Gem/")
314352
globMove("Abstractions/Gem/*-help.pd", "Documentation/14.gem/")
315353

316354
makeDir("Extra/Gem") # user can put plugins and resources in here
@@ -325,11 +363,13 @@ def generate_binary_data(output_dir, file_list):
325363
makeArchive("Filesystem", "./", "./plugdata_version")
326364

327365
with zipfile.ZipFile(output_dir + "/InterUnicode.ttf.zip", 'w', compression=zipfile.ZIP_DEFLATED, compresslevel=9) as zipf:
328-
zipf.write(project_root + "/Resources/Fonts/InterUnicode.ttf", arcname="InterUnicode.ttf")
366+
zipf.write(project_root + "/Resources/Fonts/InterUnicode.ttf",
367+
arcname="InterUnicode.ttf")
329368

330369
removeDir(output_dir + "/plugdata_version")
331370

332-
splitFile(output_dir + "/InterUnicode.ttf.zip", output_dir + "/InterUnicode_%i", 3)
371+
splitFile(output_dir + "/InterUnicode.ttf.zip",
372+
output_dir + "/InterUnicode_%i", 3)
333373

334374
splitFile("./Filesystem", output_dir + "/Filesystem_%i", 8)
335375
removeFile("./Filesystem")
@@ -342,6 +382,7 @@ def generate_binary_data(output_dir, file_list):
342382
project_root + "/Resources/Fonts/InterVariable.ttf",
343383
project_root + "/Resources/Fonts/InterRegular.ttf",
344384
project_root + "/Resources/Fonts/RobotoMono-Regular.ttf",
385+
project_root + "/Resources/Fonts/RobotoMono-Bold.ttf",
345386
project_root + "/Resources/Icons/plugdata_large_logo.png",
346387
project_root + "/Resources/Icons/plugdata_logo.png",
347388
"Documentation.bin",

0 commit comments

Comments
 (0)