This is a thread for BrawlBox plugin scripts. v0.78 has a system that lets you write plugins in Python.
Just copy the text into Notepad and save it as a file with a .py extension in the Plugins folder alongside BrawlBox. Then you'll see it in BrawlBox under Plugins in the menu bar.
Batch convert files (pac <-> pcs)To .pcsTo .pacLZ77 to ExtendedLZ77 (2017-3-23 - now supports subnodes)
from BrawlBox.API import bboxapi
from BrawlLib.SSBB.ResourceNodes import *
import os
import shutil
def haslz77(node):
if node.Compression == "LZ77":
return True
if node.GetType().Name == "ARCNode":
for child in node.Children:
if haslz77(child):
return True
return False
def modifylz77(node):
if node.Compression == "LZ77":
node.Compression = "ExtendedLZ77"
if node.GetType().Name == "ARCNode":
for child in node.Children:
modifylz77(child)
return
dir = bboxapi.OpenFolderDialog()
if dir is not "":
include_subfolders = bboxapi.ShowYesNoPrompt("Include subfolders?", "Batch conversion")
ignore_ext = ".original-lz77"
for root, dirs, files in os.walk(dir):
for file in files:
if not file.lower().endswith(ignore_ext):
try:
node = NodeFactory.FromFile(None, os.path.join(root, file))
if node is None:
continue
if haslz77(node):
shutil.copyfile(os.path.join(root, file), os.path.join(root, file + ignore_ext))
node.Dispose()
node = NodeFactory.FromFile(None, os.path.join(root, file + ignore_ext));
modifylz77(node)
node.Export(os.path.join(root, file))
node.Dispose()
except:
bboxapi.ShowMessage("Cannot export " + file, "Error")
if not include_subfolders:
break