codecs: JPEG / MPEG-1/2 yield hooks (per MCU row, per slice), banded Mpeg2.toRgba with RGB clamp table; build.py: reserved child names pass (work from the userspace session)
This commit is contained in:
1 parent
551fd937b9
commit
05eedbc8cf
10 files changed
+246
-14
No files matched your search
@@ -310,10 +310,35 @@ def files(root, ext=".luau"):
|
||||
yield os.path.join(d, f)
|
||||
|
||||
|
||||
# Module names that are also properties of a ModuleScript: `script.Parent.Video.Source` reads the Video ModuleScript's
|
||||
# Source property (its code) instead of the child module named Source, so those path parts become :FindFirstChild.
|
||||
RESERVED_CHILD_NAMES = {"Source", "Name", "ClassName", "Archivable", "LinkedSource", "Capabilities", "Sandboxed", "Tags"}
|
||||
REQUIRE_PATH = re.compile(r"require\((script(?:\.Parent)*)((?:\.[A-Za-z_]\w*)+)\)")
|
||||
|
||||
|
||||
def pass_reserved_children(src):
|
||||
def sub(m):
|
||||
parts = m.group(2).split(".")[1:]
|
||||
if not any(p in RESERVED_CHILD_NAMES for p in parts):
|
||||
return m.group(0)
|
||||
out = m.group(1)
|
||||
for p in parts:
|
||||
out += ':FindFirstChild("%s")' % p if p in RESERVED_CHILD_NAMES else "." + p
|
||||
return "require(%s)" % out
|
||||
return REQUIRE_PATH.sub(sub, src)
|
||||
|
||||
|
||||
def build_roblox():
|
||||
out = os.path.join(BUILD, "roblox", "Formats")
|
||||
shutil.rmtree(os.path.join(BUILD, "roblox"), ignore_errors=True)
|
||||
darklua(ROBLOX_RULES, os.path.relpath(SRC, ROOT), os.path.relpath(out, ROOT), ROOT)
|
||||
for f in files(out):
|
||||
with open(f) as fh:
|
||||
src = fh.read()
|
||||
fixed = pass_reserved_children(src)
|
||||
if fixed != src:
|
||||
with open(f, "w") as fh:
|
||||
fh.write(fixed)
|
||||
n = sum(1 for _ in files(out))
|
||||
print("build: roblox %3d modules -> %s" % (n, os.path.relpath(out, ROOT)))
|
||||
|
||||
|
||||
Reference in new issue
Block a user