Skip to content

Commit 7788142

Browse files
committed
Change directory structure in atom package
1 parent 952ed82 commit 7788142

2 files changed

Lines changed: 126 additions & 74 deletions

File tree

Tools/Modules/Lua/Shaderfuse/maintenance_functions.lua

Lines changed: 110 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,14 @@ function create_package_fuses(repositorypath)
456456
local currentCategory=''
457457
local descriptionIndent=''
458458

459-
-- locla decribe = {}
460-
-- local deploy_all = {} -- on all platforms
461-
-- local deploy_mac = {} -- on macOS
462-
-- local deploy_win = {} -- on Windoes
459+
local describe = {}
460+
local deploy_common = {} -- on all platforms
461+
local deploy_windows = {} -- on Windoes
462+
local deploy_mac = {} -- on macOS
463+
464+
local num_common = 0
465+
local num_windows = 0
466+
local num_mac = 0
463467

464468
for _, fuse in ipairs(fuses.list) do
465469

@@ -469,49 +473,35 @@ function create_package_fuses(repositorypath)
469473

470474
if not util.has_error() then
471475

472-
if fuse.Category ~= currentCategory then
473-
474-
if currentCategory~='' then
475-
OurPackageDescription=OurPackageDescription
476-
..descriptionIndent..' </ul>\n'
477-
..descriptionIndent..'</p>\n'
478-
end
479-
480-
currentCategory=fuse.Category
481-
482-
OurPackageDescription=OurPackageDescription..
483-
descriptionIndent..'<p>\n'..
484-
descriptionIndent..''..currentCategory..' Shaders:\n'..
485-
descriptionIndent..'<ul>\n'
486-
487-
end
488-
476+
local info = ''
489477

490478
if fuse.Compatibility.Windows_CUDA then
491479
if fuse.Compatibility.macOS_Metal then
492-
OurPackageDescription=OurPackageDescription..descriptionIndent..' <li><strong style="color:#c0a050; ">'..fuse.Name..'</strong></li>\n'
493-
OurDeployments=OurDeployments
494-
..' "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.fuse", "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.png",\n'
480+
num_common = num_common + 1
481+
table.insert(deploy_common,fuse.Shadertoy.ID)
495482
else
496-
OurPackageDescription=OurPackageDescription..descriptionIndent..' <li><strong style="color:#c0a050; ">'..fuse.Name..'</strong> (Windows only)</li>\n'
497-
OurDeployments_windows=OurDeployments_windows
498-
..' "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.fuse", "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.png",\n'
499-
patch_atom_for_platform=patch_atom_for_platform
500-
..'mv "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.fuse" "Windows/Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.fuse" \n'
501-
..'mv "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.png" "Windows/Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.png" \n'
483+
info = ' (Windows only)'
484+
num_windows = num_windows + 1
485+
table.insert(deploy_windows,fuse.Shadertoy.ID)
502486
end
503487
else
504488
if fuse.Compatibility.macOS_Metal then
505-
OurPackageDescription=OurPackageDescription..descriptionIndent..' <li><strong style="color:#c0a050; ">'..fuse.Name..'</strong> (Mac only)</li>\n'
506-
OurDeployments_mac=OurDeployments_mac
507-
..' "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.fuse", "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.png",\n'
508-
patch_atom_for_platform=patch_atom_for_platform
509-
..'mv "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.fuse" "Mac/Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.fuse" \n'
510-
..'mv "Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.png" "Mac/Fuses/Shaderfuse_wsl/'..fuse.Shadertoy.ID..'.png" \n'
489+
info = ' (Mac only)'
490+
num_mac = num_mac + 1
491+
table.insert(deploy_mac,fuse.Shadertoy.ID)
511492
else
512-
-- we should not get here
493+
info = 'err'
494+
print(fuse.Shadertoy.ID .. "is compatible to nothing?!?!!")
513495
end
514496
end
497+
498+
if describe[fuse.Category] == nil then
499+
describe[fuse.Category] = {}
500+
end
501+
502+
if info ~= 'err' then
503+
table.insert(describe[fuse.Category],{ Name = fuse.Name, Info = info, ID = fuse.Shadertoy.ID })
504+
end
515505
end
516506
end
517507

@@ -538,18 +528,37 @@ function create_package_fuses(repositorypath)
538528

539529
handle:write(' Description = [[<center><br />')
540530
handle:write(image.logo_html())
541-
handle:write('<br /><br />\n')
531+
handle:write('\n<br /><font color="#ffff60">')
532+
533+
534+
handle:write("v".. YourPackageVersion .. " including " .. num_common .. " Toys")
535+
if num_windows > 0 then
536+
handle:write(" +" .. num_windows .. " on Windows")
537+
end
538+
if num_mac > 0 then
539+
handle:write(" +" .. num_mac .. " on Mac")
540+
end
541+
542542

543543
handle:write(
544-
[[At the moment <font color="#ff6060">THIS PACKAGE IS MAC AND WINDOWS ONLY</font>,<br />but if you have some dev skills you are very welcome to checkout the repo and test on Linux.<br />&nbsp;<br />
544+
[[</font><br /><br />For the time being <font color="#ff6060">THIS PACKAGE IS MAC AND WINDOWS ONLY</font>,<br />but if you have some dev skills you are very welcome to checkout the repo and test on Linux.<br />&nbsp;<br />
545545
The package <font color="white">]].. YourPackageName ..[[</font> adds some Fuses that utilize DCTL to implement various Shaders as found on <a href="https://www.shadertoy.com/">Shadertoy.com</a>.<br />
546546
See our repository on <a href="https://github.com/nmbr73/Shaderfuse">GitHub</a> for some insights and to maybe constribute to this project?!?<br />
547547
Find tons of example videos on what you can do with it on JiPi's <a href="https://www.youtube.com/c/JiPi_YT/videos">YouTube Channel</a>.<br />
548548
Please note that - unless stated otherwise - all these Fuses fall under Creative Commond 'CC BY-NC-SA 3.0 unported'.<br />
549549
For most shaders this regrettably means that in particular <font color="#ff6060">ANY COMMERCIAL USE IS STRICTLIY PROHIBITED!</font>
550550
</center>]].."\n")
551551

552-
handle:write(OurPackageDescription)
552+
for c, l in pairs(describe) do
553+
handle:write('<p>'.. c ..' Shaders:\n<ul>\n')
554+
555+
for _, f in pairs(l) do
556+
handle:write(' <li><strong style="color:#c0a050; ">'.. f.Name ..
557+
'</strong> <a href="https://nmbr73.github.io/Shaderfuse/'.. c .. '/' .. f.Name ..'">'.. f.ID .. '</a> '.. f.Info ..'</li>\n')
558+
end
559+
560+
handle:write('</ul>\n</p>\n')
561+
end
553562

554563
handle:write([[
555564
<p>
@@ -596,44 +605,74 @@ Find these and even more videos on our <a href="https://www.youtube.com/playlist
596605
end
597606

598607

599-
handle:write([[
600-
Deploy = {
601-
]].. OurDeployments ..[[
602-
603-
Windows = {
604-
"Scripts/Comp/Shaderfuse Browser.lua",
605-
]] .. OurDeployments_windows .. [[
606-
},
607-
608-
Mac = {
609-
"Scripts/Comp/Shaderfuse Browser.lua",
610-
]] .. OurDeployments_mac .. [[
611-
},
612-
613-
-- Use the installers if you are brave enough to
614-
-- test the Fuses on Linux.
615-
-- Find a ZIP including all available installers on
616-
-- https://nmbr73.github.io/Shaderfuse/#installer
617-
--
618-
-- Linux = {
619-
-- "Scripts/Comp/Shaderfuse Browser.lua",
620-
-- },
621-
},
622-
}]])
608+
handle:write(' Deploy = {\n')
609+
for _, id in pairs(deploy_common) do handle:write(' "Fuses/Shaderfuse_wsl/'.. id ..'.fuse", "Fuses/Shaderfuse_wsl/'.. id ..'.png",\n') end
610+
handle:write('\n Windows = {\n "Scripts/Comp/Shaderfuse Browser.lua",\n')
611+
for _, id in pairs(deploy_windows) do handle:write(' "Fuses/Shaderfuse_wsl/'.. id ..'.fuse", "Fuses/Shaderfuse_wsl/'.. id ..'.png",\n') end
612+
handle:write(' },\n\n Mac = {\n "Scripts/Comp/Shaderfuse Browser.lua",\n')
613+
for _, id in pairs(deploy_mac) do handle:write(' "Fuses/Shaderfuse_wsl/'.. id ..'.fuse", "Fuses/Shaderfuse_wsl/'.. id ..'.png",\n') end
614+
handle:write([[ },
615+
616+
-- Use the installers if you are brave enough to
617+
-- test the Fuses on Linux.
618+
-- Find a ZIP including all available installers on
619+
-- https://nmbr73.github.io/Shaderfuse/#installer
620+
--
621+
-- Linux = {
622+
-- "Scripts/Comp/Shaderfuse Browser.lua",
623+
-- },
624+
},
625+
}]])
623626

624627
handle:close()
625628

626-
if patch_atom_for_platform ~= '' then
627-
handle = io.open(TargetFilepath..'/atomize.sh',"wb")
629+
handle = io.open(TargetFilepath..'/atomize.sh',"wb")
630+
631+
if not handle then
632+
print("dang! failed to write atomize.sh file!")
633+
return false
634+
end
635+
636+
if num_windows > 0 then
637+
handle:write('mkdir -p Windows/Fuses/Shaderfuse_wsl/\n')
638+
for _, id in pairs(deploy_windows) do
639+
handle:write('mv Fuses/Shaderfuse_wsl/'.. id ..'.fuse Windows/Fuses/Shaderfuse_wsl/'.. id ..'.fuse\n')
640+
handle:write('mv Fuses/Shaderfuse_wsl/'.. id ..'.png Windows/Fuses/Shaderfuse_wsl/'.. id ..'.png\n')
641+
end
642+
end
628643

629-
if not handle then
630-
print("dang! failed to write file!")
631-
return false
644+
645+
if num_mac > 0 then
646+
handle:write('mkdir -p Mac/Fuses/Shaderfuse_wsl/\n')
647+
for _, id in pairs(deploy_mac) do
648+
handle:write('mv Fuses/Shaderfuse_wsl/'.. id ..'.fuse Mac/Fuses/Shaderfuse_wsl/'.. id ..'.fuse\n')
649+
handle:write('mv Fuses/Shaderfuse_wsl/'.. id ..'.png Mac/Fuses/Shaderfuse_wsl/'.. id ..'.png\n')
632650
end
633-
handle:write(patch_atom_for_platform)
634-
handle:close()
635651
end
636652

653+
handle:close()
654+
655+
656+
657+
658+
handle = io.open(TargetFilepath..'/detomize.sh',"wb")
659+
660+
if not handle then
661+
print("dang! failed to write detomize.sh file!")
662+
return false
663+
end
664+
665+
if num_windows > 0 then
666+
handle:write('mv Windows/Fuses/Shaderfuse_wsl/* Fuses/Shaderfuse_wsl/\n')
667+
end
668+
669+
if num_mac > 0 then
670+
handle:write('mv Mac/Fuses/Shaderfuse_wsl/* Fuses/Shaderfuse_wsl/\n')
671+
end
672+
673+
674+
675+
handle:close()
637676
return true
638677

639678
end

build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,22 @@ function do_atom {
4747
cd ../..
4848

4949

50-
# cd "atom/${ATOM_URI}"
51-
# [ -f ../atomize.sh ] && sh ../atomize.sh
52-
# cd ../..
50+
cd "atom/${ATOM_URI}"
51+
mkdir -p Windows/Scripts/Comp
52+
mkdir -p Mac/Scripts/Comp
53+
cp "../../Tools/Scripts/Comp/Shaderfuse/User Menu/Browser.lua" "Windows/Scripts/Comp/Shaderfuse Browser.lua"
54+
cp "../../Tools/Scripts/Comp/Shaderfuse/User Menu/Browser.lua" "Mac/Scripts/Comp/Shaderfuse Browser.lua"
55+
56+
[ -f ../atomize.sh ] && sh ../atomize.sh
57+
58+
zip -r "../${ATOM_URI}.zip" Fuses Windows Mac "${ATOM_URI}.atom"
59+
60+
[ -f ../detomize.sh ] && sh ../detomize.sh
61+
62+
rm -rf Windows
63+
rm -rf Mac
64+
65+
cd ../..
5366

5467
}
5568

0 commit comments

Comments
 (0)