Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

check_marks: spelling variants (- _ . and spaces, squashed joins), binary files (zip members, zlib, our formats); fixtures and starter meshes use today's names; Bridge fixtures store a neutral header; discord.py uses marks_in

islandmed4d99bb2d7055
diff --git a/assets/starter/bust.sfproj.z b/assets/starter/bust.sfproj.z
index 62528c27..c60be88e 100644
Binary files a/assets/starter/bust.sfproj.z and b/assets/starter/bust.sfproj.z differ
diff --git a/assets/starter/capsule.sfproj.z b/assets/starter/capsule.sfproj.z
index 66b11a03..c70e44f3 100644
Binary files a/assets/starter/capsule.sfproj.z and b/assets/starter/capsule.sfproj.z differ
diff --git a/assets/starter/creature-head.sfproj.z b/assets/starter/creature-head.sfproj.z
index f71ea74a..f1174a6c 100644
Binary files a/assets/starter/creature-head.sfproj.z and b/assets/starter/creature-head.sfproj.z differ
diff --git a/assets/starter/cylinder.sfproj.z b/assets/starter/cylinder.sfproj.z
index a7ca2ee9..97b9412a 100644
Binary files a/assets/starter/cylinder.sfproj.z and b/assets/starter/cylinder.sfproj.z differ
diff --git a/assets/starter/ear.sfproj.z b/assets/starter/ear.sfproj.z
index f3caacc6..b284f76e 100644
Binary files a/assets/starter/ear.sfproj.z and b/assets/starter/ear.sfproj.z differ
diff --git a/assets/starter/eye.sfproj.z b/assets/starter/eye.sfproj.z
index 0b433538..d7027e63 100644
Binary files a/assets/starter/eye.sfproj.z and b/assets/starter/eye.sfproj.z differ
diff --git a/assets/starter/foot.sfproj.z b/assets/starter/foot.sfproj.z
index c7ac6c35..9946e794 100644
Binary files a/assets/starter/foot.sfproj.z and b/assets/starter/foot.sfproj.z differ
diff --git a/assets/starter/full-body.sfproj.z b/assets/starter/full-body.sfproj.z
index d0f790d9..2c1c2153 100644
Binary files a/assets/starter/full-body.sfproj.z and b/assets/starter/full-body.sfproj.z differ
diff --git a/assets/starter/hand.sfproj.z b/assets/starter/hand.sfproj.z
index 8fe8654e..aad74894 100644
Binary files a/assets/starter/hand.sfproj.z and b/assets/starter/hand.sfproj.z differ
diff --git a/assets/starter/human-head.sfproj.z b/assets/starter/human-head.sfproj.z
index fd4825bf..d08412ee 100644
Binary files a/assets/starter/human-head.sfproj.z and b/assets/starter/human-head.sfproj.z differ
diff --git a/assets/starter/ring.sfproj.z b/assets/starter/ring.sfproj.z
index 97978563..ebce34d0 100644
Binary files a/assets/starter/ring.sfproj.z and b/assets/starter/ring.sfproj.z differ
diff --git a/assets/starter/rounded-box.sfproj.z b/assets/starter/rounded-box.sfproj.z
index b484f1ec..dcd2e5f5 100644
Binary files a/assets/starter/rounded-box.sfproj.z and b/assets/starter/rounded-box.sfproj.z differ
diff --git a/assets/starter/stylised-head.sfproj.z b/assets/starter/stylised-head.sfproj.z
index e6d3c325..ff4a9024 100644
Binary files a/assets/starter/stylised-head.sfproj.z and b/assets/starter/stylised-head.sfproj.z differ
diff --git a/assets/starter/torso.sfproj.z b/assets/starter/torso.sfproj.z
index 3870db5c..91a0edeb 100644
Binary files a/assets/starter/torso.sfproj.z and b/assets/starter/torso.sfproj.z differ
diff --git a/docs/legal/trademarks.md b/docs/legal/trademarks.md
index 9ad44b6e..7acdb119 100644
--- a/docs/legal/trademarks.md
+++ b/docs/legal/trademarks.md
@@ -33,8 +33,12 @@ every pull request and push to main must pass).
## The patterns
-`tools/check_marks.py` reads this block (case-insensitive regular expressions, one per line). Add a mark here; never
-add an exception elsewhere.
+`tools/check_marks.py` reads this block (case-insensitive regular expressions, one per line). A space in a pattern
+also matches a hyphen, underscore, dot or several spaces, and words joined by `-` `_` `.` are also read squashed, so
+spelling variants hit too. It reads binary files as well: zip archives and zlib streams member by member, and the
+strings of SculptForge's own formats (projects, brushes, packs, Bridge files). Bridge test files are stored with a
+neutral header that the UI test's `copy` replaces with the format's bytes. Add a mark here; never add an exception
+elsewhere.
<!-- marks:begin -->
z ?brush
diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cpp
index 0e26cc52..ac1a4086 100644
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@ -58,7 +58,9 @@
// input_style STYLE classic, sculptforge (the default), blender or maya, as Preferences > Input sets it
// copy SRC DST copy a file or folder (SRC relative to the script's folder, DST to the working
// directory), e.g. to stage what another program would write (the Blender bridge);
-// $LIBRARY in DST (and in env values) is the test's Library library folder
+// $LIBRARY in DST (and in env values) is the test's Library library folder; a
+// Bridge file stored with the fixture header gets the format's bytes back (the
+// repository never holds them, docs/legal/trademarks.md)
// support_card first_run [test_mode] the full membership card's launch decision (Support.h)
// member_card MOMENT [days=N] [sculpt_seconds=S] a good moment for the small membership card (sculpted, render,
// updated, challenge, none); member_sign_in ok|fail ends the GitHub sign-in it started
@@ -293,6 +295,7 @@
#include "core/SelectionSets.h"
#include "core/ThreadPool.h"
#include "core/Timeline.h"
+#include "io/BridgeProtocol.h"
#include "link/AiLink.h"
#include "link/HttpServer.h"
@@ -309,15 +312,44 @@
#include <filesystem>
#include <fstream>
#include <future>
+#include <iterator>
#include <map>
#include <memory>
#include <set>
#include <sstream>
+#include <string_view>
+#include <vector>
namespace sf {
namespace {
+// copy: Bridge files under `dst` stored with the fixture header and name prefix get the format's own bytes back.
+void restoreBridgeFixtures(const std::filesystem::path& dst) {
+ namespace fs = std::filesystem;
+ static constexpr std::string_view kFixtureHeader = "SFBRIDGE FIXTURE HEADER 01", kFixturePrefix = "SFOBJCT_";
+ static_assert(kFixtureHeader.size() == sizeof(bridgefile::kHeader) - 1 &&
+ kFixturePrefix.size() == sizeof(bridgefile::kNamePrefix) - 1);
+ std::error_code ec;
+ std::vector<fs::path> files;
+ if (fs::is_regular_file(dst, ec)) files.push_back(dst);
+ else
+ for (fs::recursive_directory_iterator it(dst, ec), end; !ec && it != end; it.increment(ec))
+ if (it->is_regular_file(ec)) files.push_back(it->path());
+ for (const fs::path& p : files) {
+ std::string bytes;
+ {
+ std::ifstream in(p, std::ios::binary);
+ bytes.assign(std::istreambuf_iterator<char>(in), std::istreambuf_iterator<char>());
+ }
+ if (bytes.compare(0, kFixtureHeader.size(), kFixtureHeader) != 0) continue;
+ bytes.replace(0, kFixtureHeader.size(), bridgefile::kHeader);
+ if (const size_t at = bytes.find(kFixturePrefix); at != std::string::npos)
+ bytes.replace(at, kFixturePrefix.size(), bridgefile::kNamePrefix);
+ std::ofstream(p, std::ios::binary | std::ios::trunc).write(bytes.data(), std::streamsize(bytes.size()));
+ }
+}
+
// ai_client: the scripted AI tool's connection and what it has received (a reader thread fills `lines`).
struct AiTestClient {
link::AiLinkConn conn;
@@ -1806,6 +1838,7 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& e
if (dst.has_parent_path()) fs::create_directories(dst.parent_path(), ec);
fs::copy(src, dst, fs::copy_options::recursive | fs::copy_options::overwrite_existing, ec);
if (ec) SDL_Log("copy %s: %s", src.string().c_str(), ec.message().c_str());
+ restoreBridgeFixtures(dst);
});
} else if (verb == "ai_client") {
if (!need(1)) return false;
diff --git a/src/core/Sculpt.cpp b/src/core/Sculpt.cpp
index 8f45894a..215ecc01 100644
--- a/src/core/Sculpt.cpp
+++ b/src/core/Sculpt.cpp
@@ -61,7 +61,7 @@ bool brushFromName(std::string_view name, BrushType& out) {
auto squash = [](std::string_view s) {
std::string r;
for (unsigned char c : s)
- if (c != ' ' && c != '_' && c != '-') r += char(std::tolower(c));
+ if (c != ' ' && c != '_' && c != '-' && c != '.') r += char(std::tolower(c));
return r;
};
std::string want = squash(name);
diff --git a/tests/data/levels_layers_v4.sfproj b/tests/data/levels_layers_v4.sfproj
index 835eb9a8..f82e12d7 100644
Binary files a/tests/data/levels_layers_v4.sfproj and b/tests/data/levels_layers_v4.sfproj differ
diff --git a/tests/data/levels_layers_v4_top.sfproj b/tests/data/levels_layers_v4_top.sfproj
index 212ef933..a31b6ddb 100644
Binary files a/tests/data/levels_layers_v4_top.sfproj and b/tests/data/levels_layers_v4_top.sfproj differ
diff --git a/tests/data/levels_v5_plane.sfproj b/tests/data/levels_v5_plane.sfproj
index 721fba67..e0fd8566 100644
Binary files a/tests/data/levels_v5_plane.sfproj and b/tests/data/levels_v5_plane.sfproj differ
diff --git a/tests/data/levels_v5_plane_top.sfproj b/tests/data/levels_v5_plane_top.sfproj
index fb355b8c..8d8da4bc 100644
Binary files a/tests/data/levels_v5_plane_top.sfproj and b/tests/data/levels_v5_plane_top.sfproj differ
diff --git a/tests/data/levels_v5_sphere.sfproj b/tests/data/levels_v5_sphere.sfproj
index 2519ec6e..00eee6b5 100644
Binary files a/tests/data/levels_v5_sphere.sfproj and b/tests/data/levels_v5_sphere.sfproj differ
diff --git a/tests/data/levels_v5_sphere_top.sfproj b/tests/data/levels_v5_sphere_top.sfproj
index 2a567c04..45c9602f 100644
Binary files a/tests/data/levels_v5_sphere_top.sfproj and b/tests/data/levels_v5_sphere_top.sfproj differ
diff --git a/tests/test_legacy_names.cpp b/tests/test_legacy_names.cpp
index cd60072c..861b7ce9 100644
--- a/tests/test_legacy_names.cpp
+++ b/tests/test_legacy_names.cpp
@@ -74,6 +74,13 @@ TEST(legacy_names_read_old_files_and_scripts) {
BrushType t = BrushType::Standard;
CHECK(brushFromName(old.at("sharpcrease"), t) && t == BrushType::SharpCrease);
CHECK(brushFromName(capitalised(old.at("clayblock")), t) && t == BrushType::ClayBlock);
+ // ... spelled with a space, hyphen, underscore or dot between its words, in any case.
+ const std::string clay = old.at("clayblock");
+ for (const char* sep : {" ", " ", "-", "_", "."}) {
+ t = BrushType::Standard;
+ CHECK(brushFromName(capitalised(clay.substr(0, 4)) + sep + capitalised(clay.substr(4)), t) &&
+ t == BrushType::ClayBlock);
+ }
// JSON keys (projects, ui.json); values stay as they are.
Json j = Json::object();
diff --git a/tests/ui/data/blender/divide/r1_000.Bridge b/tests/ui/data/blender/divide/r1_000.Bridge
index 0db902a2..a6b49d7d 100644
Binary files a/tests/ui/data/blender/divide/r1_000.Bridge and b/tests/ui/data/blender/divide/r1_000.Bridge differ
diff --git a/tests/ui/data/blender/divide/r1_001.Bridge b/tests/ui/data/blender/divide/r1_001.Bridge
index 2b3b0140..d39aabbc 100644
Binary files a/tests/ui/data/blender/divide/r1_001.Bridge and b/tests/ui/data/blender/divide/r1_001.Bridge differ
diff --git a/tests/ui/data/blender/send1/r1_000.Bridge b/tests/ui/data/blender/send1/r1_000.Bridge
index 4a01d641..a3fad4a1 100644
Binary files a/tests/ui/data/blender/send1/r1_000.Bridge and b/tests/ui/data/blender/send1/r1_000.Bridge differ
diff --git a/tests/ui/data/blender/send1/r1_001.Bridge b/tests/ui/data/blender/send1/r1_001.Bridge
index a2650e14..bad8ccf4 100644
Binary files a/tests/ui/data/blender/send1/r1_001.Bridge and b/tests/ui/data/blender/send1/r1_001.Bridge differ
diff --git a/tests/ui/data/blender/send2/r2_000.Bridge b/tests/ui/data/blender/send2/r2_000.Bridge
index a992faca..50eb6ca3 100644
Binary files a/tests/ui/data/blender/send2/r2_000.Bridge and b/tests/ui/data/blender/send2/r2_000.Bridge differ
diff --git a/tests/ui/data/blender/send2/r2_001.Bridge b/tests/ui/data/blender/send2/r2_001.Bridge
index 3b931a52..7a8f2984 100644
Binary files a/tests/ui/data/blender/send2/r2_001.Bridge and b/tests/ui/data/blender/send2/r2_001.Bridge differ
diff --git a/tests/ui/data/rose_litsphere.sfproj b/tests/ui/data/rose_litsphere.sfproj
index 8b04b973..f8e9c500 100644
Binary files a/tests/ui/data/rose_litsphere.sfproj and b/tests/ui/data/rose_litsphere.sfproj differ
diff --git a/tools/check_marks.py b/tools/check_marks.py
index 7fec6ed6..8a43de99 100644
--- a/tools/check_marks.py
+++ b/tools/check_marks.py
@@ -1,22 +1,33 @@
#!/usr/bin/env python3
"""Fails when a third-party sculpting-app trademark appears anywhere in the repository (docs/legal/trademarks.md).
-Every git-tracked text file and every tracked path is scanned, case-insensitively, for the patterns listed in
-docs/legal/trademarks.md, the one file allowed to spell them (this script doesn't). No other exceptions.
+Every git-tracked file and path is scanned, case-insensitively, for the patterns listed in docs/legal/trademarks.md,
+the one file allowed to spell them (this script doesn't). No other exceptions. A space in a pattern also matches a
+hyphen, underscore, dot or several spaces, and words joined by - _ . are also read squashed ("a-b_c" as "abc"), so
+spelling variants hit too. Binary files: zip archives member by member (names and contents, zlib-compressed ones
+unpacked first) and the strings in SculptForge's own formats; images, video and fonts are not read.
+discord.py (the coordinator's posts) uses marks_in() from here, so the two can't disagree.
check_marks.py check the repository (ctest: marks; CI job "Trademarks")
check_marks.py --count print matches per pattern and per top-level folder
check_marks.py --self-test
"""
+import io
import re
import subprocess
import sys
+import zipfile
+import zlib
from collections import Counter
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
TRADEMARKS = "docs/legal/trademarks.md"
SKIP_PREFIXES = ("third_party/",) # vendored code, as its authors wrote it
+SEPARATOR = r"(?:[ \t]+|[-_.])" # what a space in a pattern stands for
+# Binary files of SculptForge's own formats, read as their printable strings (zip archives are read whatever the name).
+OWN_BINARY = (".sfproj", ".sfbrush", ".sfmaterial", ".sfpack", ".sfmacro", ".bridge", ".z", ".bin", ".json")
+MIN_STRING = 4 # shortest printable run read from a binary file
def load_marks(text=None):
@@ -28,17 +39,33 @@ def load_marks(text=None):
for name in ("marks", "labels"): # the marks, then their interface's exact labels (#117)
if f"<!-- {name}:begin -->" in text:
block = text.split(f"<!-- {name}:begin -->", 1)[1].split(f"<!-- {name}:end -->", 1)[0]
- marks += [line.strip() for line in block.splitlines() if line.strip()]
+ lines = [line.strip() for line in block.splitlines() if line.strip()]
+ # A mark's space also stands for - _ . or several spaces; a label's stays a space (ids like draw_size).
+ marks += [m.replace(" ", SEPARATOR) for m in lines] if name == "marks" else lines
if not marks:
raise SystemExit(f"check_marks: no patterns in {TRADEMARKS}")
return re.compile("|".join(f"(?:{m})" for m in marks), re.IGNORECASE)
-def old_words(text=None):
- """(old, today) pairs from the table of old words in docs/legal/trademarks.md."""
+def fnv1a64(word):
+ """src/core/LegacyNames.h's hash: FNV-1a 64 of the lower-cased bytes."""
+ h = 0xCBF29CE484222325
+ for b in word.lower().encode():
+ h = ((h ^ b) * 0x100000001B3) & 0xFFFFFFFFFFFFFFFF
+ return h
+
+
+def squash(word):
+ """A name as LegacyNames.h and brush lookup compare it: lower case, no spaces, hyphens, underscores or dots."""
+ return re.sub(r"[\s_.\-]+", "", word).lower()
+
+
+def old_words(text=None, hashes=False):
+ """(old, today) pairs from the table of old words in docs/legal/trademarks.md ((old, today, hash) with hashes)."""
if text is None:
text = (ROOT / TRADEMARKS).read_text(encoding="utf-8")
- return re.findall(r"^\| W\d+ \| `([^`]+)` \| `([^`]+)` \|", text, re.M)
+ rows = re.findall(r"^\| W\d+ \| `([^`]+)` \| `([^`]+)` \| `0x([0-9A-F]+)` \|", text, re.M)
+ return [(o, t, int(h, 16)) for o, t, h in rows] if hashes else [(o, t) for o, t, _ in rows]
def tracked_files():
@@ -50,14 +77,56 @@ def tracked_files():
return [p for p in r.stdout.decode("utf-8").split("\0") if p and not p.startswith(SKIP_PREFIXES)]
-def read_text(path):
+def is_binary(data):
+ return b"\0" in data[:8192]
+
+
+def binary_strings(data):
+ """The printable ASCII runs in binary data, one per line."""
+ return "\n".join(m.decode("ascii") for m in re.findall(rb"[\x20-\x7e]{%d,}" % MIN_STRING, data))
+
+
+def texts_in(name, data, depth=0):
+ """(where, text) for what a file holds that a person or program could read as words: the text of a text file;
+ for a zip archive each member's name and contents; for a zlib stream what it unpacks to; for SculptForge's
+ other binary formats their strings. Media files give nothing."""
+ if not is_binary(data):
+ return [(name, data.decode("utf-8", errors="replace"))]
+ if depth > 2:
+ return []
+ if data[:4] == b"PK\x03\x04":
+ try:
+ z = zipfile.ZipFile(io.BytesIO(data))
+ out = [(name, "\n".join(z.namelist()))]
+ for member in z.namelist():
+ out += texts_in(f"{name}!{member}", z.read(member), depth + 1)
+ return out
+ except (zipfile.BadZipFile, OSError, RuntimeError, NotImplementedError, zlib.error):
+ pass
+ if data[:1] == b"\x78":
+ try:
+ return texts_in(name, zlib.decompress(data), depth + 1)
+ except zlib.error:
+ pass
+ if name.lower().endswith(OWN_BINARY):
+ return [(name, binary_strings(data))]
+ return []
+
+
+def read_texts(path):
try:
data = (ROOT / path).read_bytes()
except OSError:
- return None # deleted in the working tree
- if b"\0" in data[:8192]:
- return None # binary
- return data.decode("utf-8", errors="replace")
+ return [] # deleted in the working tree
+ return texts_in(path, data)
+
+
+# Words joined by hyphens, underscores or dots, read squashed as well ("a-b_c" as "abc").
+JOINED = re.compile(r"[A-Za-z0-9]+(?:[-_.][A-Za-z0-9]+)+")
+
+
+def has_mark(line, mark_re):
+ return bool(mark_re.search(line)) or any(mark_re.search(squash(m.group(0))) for m in JOINED.finditer(line))
# A string literal that goes on in the next one ("...Store "\n "Config..."): C, C++ and Python join them.
@@ -67,7 +136,7 @@ LITERAL_BREAK = re.compile(r'"[ \t]*\r?\n[ \t]*"')
def problems_in(text, mark_re):
"""(line, snippet) for every line with a mark, and for a mark split across adjacent string literals."""
lines = text.splitlines()
- found = [(n, line.strip()) for n, line in enumerate(lines, 1) if mark_re.search(line)]
+ found = [(n, line.strip()) for n, line in enumerate(lines, 1) if has_mark(line, mark_re)]
joined, starts, pos = [], [], 0 # the text with the breaks taken out, and where each piece began
for m in LITERAL_BREAK.finditer(text):
joined.append(text[pos:m.start()])
@@ -90,28 +159,30 @@ def problems_in(text, mark_re):
return sorted(found)
+def marks_in(text, mark_re=None):
+ """(line, snippet) for every line of `text` with a mark: what this check and discord.py refuse."""
+ return problems_in(text, mark_re or load_marks())
+
+
def scan(mark_re):
errors = []
for path in tracked_files():
if path == TRADEMARKS:
continue
- if mark_re.search(path):
+ if has_mark(path, mark_re):
errors.append(f"{path}: the file name has a mark")
- text = read_text(path)
- if text is None:
- continue
- for n, snippet in problems_in(text, mark_re):
- errors.append(f"{path}:{n}: {snippet[:160]}")
+ for where, text in read_texts(path):
+ for n, snippet in problems_in(text, mark_re):
+ errors.append(f"{where}:{n}: {snippet[:160]}")
return errors
def count(mark_re):
per_mark, per_dir = Counter(), Counter()
for path in tracked_files():
- text = read_text(path)
- if text is None or path == TRADEMARKS:
+ if path == TRADEMARKS:
continue
- for m in mark_re.finditer(text):
+ for m in (m for _, text in read_texts(path) for m in mark_re.finditer(text)):
per_mark[m.group(0).lower().replace(" ", "")] += 1
per_dir[path.split("/", 1)[0] if "/" in path else "(root)"] += 1
print(f"total {sum(per_mark.values())}")
@@ -125,9 +196,35 @@ def self_test():
mark_re = load_marks()
words = old_words()
assert len(words) >= 12, "the table of old words in docs/legal/trademarks.md is missing"
- for old, today in words:
+ for old, today, h in old_words(hashes=True):
assert mark_re.search(old) and mark_re.search("x." + old.upper() + " count"), old
- assert not mark_re.search(today), today
+ assert not has_mark(today, mark_re) and not has_mark(today.title(), mark_re), today
+ assert fnv1a64(squash(old)) == h, f"{old}: the hash in the table isn't LegacyNames.h's"
+ # Spelling variants of every multi-word mark: spaced, hyphenated, underscored, dotted, camelCase, upper case.
+ # (pairs, as the labels below, because this file is scanned too)
+ for a, b in (("cl", "ay buildup"), ("da", "m standard"), ("po", "ly paint"), ("su", "b tool"), ("li", "ght box"),
+ ("ma", "t cap"), ("z", " brush"), ("z", " remesher"), ("dy", "na mesh"), ("po", "ly group"),
+ ("z", " sphere"), ("fi", "ber mesh")):
+ a, b = (a + b).split(" ")
+ for v in (f"{a} {b}", f"{a} {b}", f"{a}-{b}", f"{a}_{b}", f"{a}.{b}", a.title() + b.title(),
+ a + b.title(), f"{a.title()} {b.title()}", f"{a}-{b}".upper(), f"the {a.title()}-{b.title()} brush"):
+ assert has_mark(v, mark_re), v
+ assert marks_in("ok\n" + v, mark_re) == [(2, v)], v
+ for a, b in (("pi", "xo-logic"), ("Scu", "lpt_Ris"), ("mu", "d.box"), ("na", "no-mesh"), ("spo", "t-light")):
+ assert has_mark(a + b, mark_re), a + b # one-word marks split anywhere
+ # Squashing doesn't invent marks out of ordinary text.
+ assert not has_mark("set max on the slider; go zone; lit-sphere, clay-block, sharp_crease, vertex.paint", mark_re)
+ # Binary files: zip members (names and contents), zlib streams, strings of our formats; not media.
+ zbuf = io.BytesIO()
+ with zipfile.ZipFile(zbuf, "w") as z:
+ z.writestr("manifest.json", '{"name": "Clay ' + 'Buildup"}')
+ z.writestr("parts/0/positions.bin", b"\0\1\2")
+ zipped = zbuf.getvalue()
+ hits = lambda name, data: [w for w, t in texts_in(name, data) if problems_in(t, mark_re)]
+ assert hits("a.sfproj", zipped) == ["a.sfproj!manifest.json"]
+ assert hits("a.sfproj.z", zlib.compress(zipped)) == ["a.sfproj.z!manifest.json"]
+ assert hits("a.Bridge", b"\0\0" + b"dam_" + b"standard\0\1") == ["a.Bridge"]
+ assert hits("a.png", b"\0\0" + b"dam_" + b"standard\0\1") == []
assert not mark_re.search("Lit Sphere, Part, Face group, Library, Vertex Paint, Bridge, Forge Spheres, Classic")
assert not mark_re.search("immediate dimmed trimmed Gozo, format capability, parts_list, bridge_send")
# their labels (#117), split here because this file is scanned too