Merge branch 'main' into dev/option-unavailability-reasons

This commit is contained in:
SoftFever committed 2026-10-26 02:19:01 +08:00
commit 8efa90c763
306 files changed
+29908 -102284

No files matched your search

+85 -11
View File
@@ -1,6 +1,6 @@
---
name: orca-translations
description: Use when updating, filling, reviewing or fixing OrcaSlicer translations in localization/i18n — running scripts/run_gettext --full, translating empty or new msgids in the .po catalogs, AI translation passes and their "# AI Translated" / "# Needs human review" comments, plural forms, msgctxt homonyms, and keeping catalogs consistent with the localization glossary (OrcaSlicer_WIKI developer_reference/glossary), including adding new glossary terms. Also use for msgfmt or run_gettext failures, placeholder or line-break mismatches, and reviewing a translation PR against the glossary.
description: Use when updating, filling, reviewing or fixing OrcaSlicer translations in localization/i18n — running scripts/run_gettext --full, translating empty or new msgids in the .po catalogs, reviewing and fixing a language's existing translations for wrong meanings, competing terms and unnatural wording, AI translation passes and their "# AI Translated" / "# Needs human review" comments, plural forms, msgctxt homonyms, and keeping catalogs consistent with the localization glossary (OrcaSlicer_WIKI developer_reference/glossary), including adding new glossary terms. Also use for msgfmt or run_gettext failures, placeholder or line-break mismatches, and reviewing a translation PR against the glossary.
---
# OrcaSlicer translations
@@ -51,9 +51,10 @@ scripts\run_gettext.bat --full # Windows (PowerShell: & .\scripts\run_
```
It must exit 0. New msgids arrive empty, and removed ones become obsolete `#~` entries. A msgid that
comes back gets its old translation revived from `#~`, which is one reason never to purge obsolete
entries. It also compiles the `.mo` files (gitignored). The bundled Windows gettext may re-wrap a long
`#:` reference line. That churn is harmless.
comes back gets its old translation revived from `#~`, and `pending` offers obsolete entries as similar
earlier translations, so they stay until the translations are done and are purged in step 5. It also
compiles the `.mo` files (gitignored). The bundled Windows gettext may re-wrap a long `#:` reference
line. That churn is harmless.
Then take stock: `python3 $T status`.
@@ -112,22 +113,35 @@ For each language:
- `note`: the developer's `TRN` comment.
- `flags`: `c-format` or `boost-format`.
- `description`: present when a sense has to be chosen.
- `refs`, `code` and `nearby`: where the source uses the string, the lines around that use (for
short strings and placeholder strings), and the translations of the short strings used next to
it, such as the label a tooltip describes or the other items of a menu. The catalogs carry no
source references, so this is the only place the context shows. Read it before writing; the
rules file's *Context* says what to take from it.
- `similar`: earlier translations of similar English. `"human": true` marks a person's work: when
the English barely changed, patch that translation instead of translating again (see the rules).
3. Read every apply message:
- **REJECTED:** a hard rule broke. Fix the translation and apply the corrected items again.
- **WARNING:** something worth a second look, such as a glossary rendering not found, ending
punctuation, or snake_case. A glossary warning on an inflected form you checked is fine.
punctuation, or snake_case. A glossary warning is fine on an inflected form you checked, and
on a word the string uses in another sense than the row's description (the printer's `Model:` is
not the glossary's 3D *Model*).
Otherwise correct the translation (`apply --overwrite` replaces your own entry), or add a
`review` reason.
`apply` adds `# AI Translated` to every entry it writes, and `# Needs human review: <reason>` where an
item has `review`. On an `--overwrite`, `"review": ""` removes an earlier note. Never add either to a translation a person wrote. `--human` is for applying their
text.
text, and for a fix that keeps their words; it also drops a stale AI mark. `apply` rejects text that
strays from a person's translation more than the English change explains, unless the item says why
with `"rewrite": "<reason>"`.
**The work is large:** every new string, times every language. When subagents are available, give each
one a language or a few. Each agent only touches its own catalogs, so they can run
in parallel. Settle step 3 first. Give each agent the language list, this skill's path, the rules file,
and these instructions:
- Fill every empty entry.
- Fill every empty entry, reading each one's `code` and `nearby` first.
- Patch a person's earlier translation (`"human": true` in `similar`) instead of translating again, and
keep their words when fixing their entries.
- Don't add glossary rows.
- Report what it could not translate, the review notes it added, and any term it thinks the glossary
still lacks.
@@ -140,6 +154,8 @@ Add the terms they report yourself, then have the affected languages revisit the
python3 $T check --lang <L> --warnings # every AI-translated entry, plus msgfmt --check-format
```
- **Remove the obsolete entries:** `python3 $T purge-obsolete` drops every `#~` entry, with its
comments, from every catalog (`--lang L` for a pass limited to some languages).
- **Run the full gettext again.** It must exit 0 and leave the catalogs as the pass left them.
- **Run `python generate_glossary.py --check` in the wiki clone.**
- **Errors on entries you didn't write predate the pass.** Report them rather than fixing them in the
@@ -157,6 +173,61 @@ The catalogs (and `OrcaSlicer.pot`) and the glossary (`developer_reference/gloss
separate changes in separate repositories. The wiki change should land with, or before, the catalog
change. Commit or open PRs only when asked.
## Workflow: review and fix an existing catalog
When the user asks for more than a fill (review a language, fix its translations, a complete pass),
fill it first with the workflow above, then audit what the catalog already holds. The request is what
allows existing entries to change (rule 4). Work one language at a time, and stop to ask only about
established glossary terms (step 4); fix everything else directly.
1. **Save a copy of the catalog** in the scratch directory, to diff the audit against.
2. **Read the catalog area by area,** one pass each:
- the 3D view, navigation, camera and rendering;
- gizmos, CAD and mesh tools;
- printer hardware and the device tab;
- print-process settings and their tooltips;
- errors, warnings and dialogs.
The catalogs carry no `#:` references, so split them with `lookup --lang <L> . --file '<regex>'
--limit 0`, which keeps the entries used in matching source files (`Gizmos/`, `Device`,
`PrintConfig`), and add `--code` to see each use. Read every pair in an area: short labels in full,
with their code, and long tooltips at least for their terms. When subagents are available, give
each one an area, the rules file and the term decisions made so far, have it return findings rather
than edits, and merge them yourself.
3. **Look for:**
- **Competing renderings of one term.** For each recurring English term, list every rendering it
has (`lookup --lang <L> "<term>"`, then `lookup --msgstr` for each rendering found), and settle on
one per sense: the glossary's where it has a row, otherwise by the rules file's order of sources.
A recurring term the glossary lacks goes into it with `glossary-set`, as in step 3 of the fill.
- **Wrong meanings:** a word that means something else in context, the wrong sense of a homonym
(one `msgctxt` translated with another's word), a setting quoted differently from its own label.
A short msgid used in several places must fit every use `--code` lists; when no wording can,
report the missing `msgctxt`.
- **Sets that don't read as one:** the items of a menu, a choice or a toolbar in different
grammatical forms, or two items translated alike.
- **Broken entries:** a lost `\n`, text left over from another string, untranslated fragments,
a `msgstr` left identical to the English (a symbol, token or bare placeholder may be), typos.
`check --lang <L> --scope all --warnings` finds the mechanical ones.
- **Unnatural wording,** judged by the rules file's *Style*.
4. **Hold back changes to established glossary terms.** When the right fix changes a term the
glossary already fixes, leave those entries and the cell alone and keep a list. After the whole
audit, ask the user once: each term, the proposed rendering, why, and how many entries it touches,
with a recommendation. Apply the approved ones as in *Changing an established term*.
5. **Fix the rest** with `apply --overwrite`, from items `{"id": ..., "msgstr": ...}`.
- The patch rules for a person's translation still hold: change only what is wrong. When more than
a patch is needed, add `"rewrite": "<what was wrong>"`; it becomes the entry's review note.
- Entries you rewrite are marked `# AI Translated`; a patch that keeps a person's words goes in
with `--human`. Add `review` where unsure.
6. **Verify** as in step 5 of the fill workflow. Then compare every glossary cell for the language
with the final catalog (`check --scope all --warnings` reports renderings not found), and list the
disagreements left.
7. **Report:**
- the changes grouped by area, with representative before → after examples;
- the term decisions and the sources behind them;
- the review notes added;
- the source problems found;
- the glossary changes made, and the disagreements left.
## Rules
1. **Run the full gettext first.** Translate against the regenerated template, never a stale one.
@@ -166,12 +237,14 @@ change. Commit or open PRs only when asked.
3. **New recurring terms go into the glossary before the translations that use them.** Without a wiki
clone, stop and tell the user (step 3).
4. **Fill, don't rewrite.** A fill pass writes only empty and fuzzy entries.
- Existing translations, human or AI, change only on request (`--overwrite`).
- A glossary violation in a human translation is reported, not changed.
- Existing translations, human or AI, change only on request (`--overwrite`), as in the review
workflow.
- Outside that workflow, a glossary violation in a human translation is reported, not changed.
5. **Machine output is labelled.** Every AI translation gets `# AI Translated`; uncertain ones also get
`# Needs human review: <reason>`. Never use `fuzzy`.
6. **Never edit `msgid`, `msgctxt`, the header, or obsolete `#~` entries,** and never fix the English in
a translation. Report source problems (see the rules file).
a translation. Report source problems (see the rules file). Obsolete entries are only removed whole,
with `purge-obsolete` at the end of a pass.
7. **Write catalogs only through `po_tool.py` or gettext.** PO libraries such as polib reflow unrelated
entries, and hand edits skip the validation.
@@ -195,9 +268,10 @@ inherits the mistake, so fix both in the same change:
Review it for these:
- glossary compliance (`check --scope all --warnings` on the language, then read the hits);
- the sense of each changed short string where it is used (`lookup --code`);
- placeholders and line breaks (`check` errors);
- `# AI Translated` kept on text a person rewrote, or added to text a person wrote;
- purged obsolete entries;
- obsolete entries left in the catalogs, or removed other than by `purge-obsolete`;
- reflowed unrelated entries;
- plural forms short of `nplurals`.
@@ -11,7 +11,8 @@ can detect; everything else is on the translator.
A rejected entry is not written. Fix it and apply again.
- **Placeholders stay exactly as written:** `%s`, `%d`, `%.1f`, `%1$d`, `%1%`, `%%`. Never `%1 %`, never
`%` for `%%`. Plain printf placeholders keep their order; only positional ones (`%1$s`, `%1%`) may move.
`%` for `%%`. Plain printf placeholders keep their order; only positional ones (`%1$s`, `%1%`) may move,
and one the msgid repeats may appear just once.
A broken placeholder crashes the app.
- **Line breaks:** the same number of `\n`, with the same leading and trailing ones. Don't add breaks to fit
text, least of all in parameter names.
@@ -26,6 +27,26 @@ A rejected entry is not written. Fix it and apply again.
ja/ko/zh/th/vi, 3 for ru/cs/pl/lt, 4 for uk). Each form is really inflected for its quantity. Repeating
one sentence is a bug in Slavic and Baltic languages, but correct in Turkish and Hungarian.
## A person's translation: patch it, don't rewrite it
A translator's wording is kept unless it is wrong. Machine output never replaces it wholesale.
- **A reworded string:** `pending` lists earlier translations of similar English under `similar`, and
marks a person's work with `"human": true`. When the English barely changed, start from that
translation and change only what the English change requires: a renamed term, an added clause, a
period. Keep the translator's wording, word order, terms and line structure. If they already wrote what
the new English says, the translation does not change at all.
- **A fix in a person's translation:** for a check error (a line break, a space, placeholder order, a
missing clause), change only what the error needs. Keep the rest of their words, even where they differ
from the glossary or from how you would phrase it. Report such glossary differences instead.
- **Rewrite only what is plainly wrong:** another string's text, a cut-off sentence, a mistranslation.
Say why with `"rewrite": "<what was wrong>"` in the item; the reason becomes the review note.
- `apply` enforces this. It rejects text that strays further from a person's translation than the
English change explains (below 85% alike for a fix, or clearly less alike than the English for a
reworded string), unless the item carries `rewrite`.
- Apply a fix that keeps the person's words with `--human`, so the entry stays theirs. Text you wrote
gets the default `# AI Translated`.
## Mechanical: not detectable, still required
- Edit only `msgstr`. Never change `msgid`, `msgctxt`, the header or another entry's text.
@@ -36,6 +57,49 @@ A rejected entry is not written. Fix it and apply again.
control.
- Don't use `fuzzy` for uncertainty. Fuzzy entries are hidden, and users then see English.
## Context: know what the string is before choosing its words
English reuses one word for different things, and a string seen alone often reads several ways. Settle
what each entry is before translating it. `pending` gives every entry the context the source holds:
`refs` (where it is used), `code` (the lines around the use, for short strings and placeholder
strings) and `nearby` (the translated short strings used next to it). `lookup --code` shows the same
for existing entries. The catalogs themselves carry no source references.
- **What kind of text it is,** from `code`: a button or menu item is a command, a field label or column
header names a value, a checkbox states something that is on or off, and a tooltip, status line,
error or dialog title each have their own register. Keep a label as short as a label.
- **What it belongs to.** A setting's strings sit together in `PrintConfig.cpp`: `this->add("<key>", …)`,
then `label`, `category`, `tooltip`, `sidetext`. The tooltip describes that option, and quotes the
label exactly as `nearby` shows it translated. The items of one menu, choice or toolbar
(`enum_labels`, `Append`, an array of names) are a set: give them one grammatical form, and words that
tell them apart.
- **`msgctxt` separates homonyms.** `Back` in *Camera View* is the rear view, and `Back` in
*Navigation* is the go-back button. Translate each context on its own.
- **Overloaded English: translate the meaning.**
- *Flow ratio* is a multiplier, *Flow Rate* is throughput, and *Flow Dynamics* is pressure
compensation. These are three different terms.
- *Extruder* can mean the toolhead, the feeder motor ("High extruder current on filament swap") or
the nozzle ("all extruders must have the same diameter").
- *Home* is the homing move ("Please home all axes"), the home page, or the Home key (*Keyboard
Shortcut*), which takes the name printed on that language's keyboards. *Fill* is infill, gap fill,
or the paint tools' bucket and smart fill. *Normal* is the ordinary kind ("Normal support",
"Normal printing") or the surface normal ("Normal X", "Smooth normals"). *Model* is the 3D model,
or the printer model in "Model:". *Process* is the process preset, or an operation under way ("the
slicing process").
- The glossary's rows record the senses that recur (`Plate` versus `Bed / Build plate`, `Feature
(print)` versus `Feature (Design)`); the code tells which one a string means.
- **Check the meaning in the code** when the English leaves it open: read the call site, and further
in the file when `code` is not enough.
- See what each placeholder is filled with. A fallback string substituted into a sentence must
fit the slot it fills.
- Settle the semantics the English blurs: a ratio or a difference, which way a rotation turns,
which control a hint names.
- **A msgid used in several places** (`left` is a view name and a hotend; `Sphere` is a primitive
and a paint brush) needs a wording that fits every use. When none can, report the missing
`msgctxt` as a source problem.
- **When the context still leaves two readings,** take the likelier one and add a review note naming
the other.
## Choosing the words
- **The glossary is binding.** Use the language's rendering for every glossary term the `pending`
@@ -52,24 +116,63 @@ A rejected entry is not written. Fix it and apply again.
glossary page's *Kept in English* table.
- **Language specifics** on the glossary page (`po_tool.py glossary --lang L` prints them) override
general habits for that language.
- **Consistency beyond the glossary:** before translating a label, or a tooltip that names a setting,
run `lookup` for the setting name. Quote the label's existing translation exactly, so the tooltip and
the field match. Reuse obsolete (`#~`) entries as a translation memory.
- **`msgctxt` separates homonyms.** `Back` in *Camera View* is the rear view, and `Back` in
*Navigation* is the go-back button. Translate each context on its own.
- **Overloaded English: translate the meaning.**
- *Flow ratio* is a multiplier, *Flow Rate* is throughput, and *Flow Dynamics* is pressure
compensation. These are three different terms.
- *Extruder* can mean the toolhead, the feeder motor ("High extruder current on filament swap") or
the nozzle ("all extruders must have the same diameter").
- When a short label is ambiguous, grep `src/` for the msgid to see the widget it labels.
- **The catalog's existing words come next.** A tooltip or message that names a setting, a button or a
menu item quotes that control's translation exactly, so the text matches what the user sees. `nearby`
shows the controls next to the string; `lookup` finds the rest. For a recurring term the glossary
lacks, `lookup` the English and `lookup --msgstr` the rendering you intend, and use the one the
catalog already settled on in that sense. Reuse obsolete (`#~`) entries as a translation memory.
- **No settled term: look outside the catalog, in this order.**
1. **Other slicers' shipped catalogs** for the same language:
[BambuStudio](https://github.com/bambulab/BambuStudio) `bbl/i18n/<lang>/BambuStudio_<lang>.po`
and [PrusaSlicer](https://github.com/prusa3d/PrusaSlicer)
`resources/localization/<lang>/PrusaSlicer_<lang>.po` (a local clone, if there is one). Orca
shares much of its UI with both, so their translators have often rendered the same string
already. Their choice is evidence, not a rule: the glossary and Orca's own catalog win.
2. **The 3D-printing community in that language:** manuals, wikis and forums of printer vendors
(Bambu Lab, Prusa, Creality, Snapmaker) and their users. Take the term printers actually use,
a loanword where they use the loanword.
3. **Neighbouring fields,** when printing has no term of its own: CAD (SolidWorks, Fusion,
Onshape, AutoCAD), CNC/CAM and machining, then engineering and mathematics. General UI
vocabulary (*Settings*, *Preferences*, *Undo*, *Browse*, *Quit*, *Copy*, *Paste*) follows the
operating systems' own translations, which users already know.
4. **English,** when nothing is established: brand names, acronyms, file formats, G-code tokens,
variables, and Orca-specific feature names with no equivalent.
Translate paired terms as a pair, so they read as the two sides of one choice (direct drive and
Bowden, inner and outer wall). Name the sources a term came from in the report.
- **Each field keeps its own vocabulary.** 3D-view and CAD strings follow CAD software and drafting
standards: the standard view names, *isometric*, *orbit*, *pan* and *zoom*, *cut plane* versus
*section plane*, the primitive names. The camera of the 3D view (the viewpoint) and the printer's
camera (the device) are different things and take different words wherever the language has two.
- **A regional variant is its own language.** Never derive one from the other character by character
or word by word: zh_TW and zh_CN differ in vocabulary, not only in script. Start from the
variant's own glossary column and catalog. A converter (OpenCC `s2twp` for zh_CN → zh_TW) gives a
draft at most; review every entry it produced.
- **Boilerplate stays uniform.** `Failed to connect to …`, `Are you sure you want to …?` and
`If expressed as a %, it will be computed over …` each get one template in the language, even where
the English varies.
## Style
- **Localize, don't translate word-for-word.** Know what the string controls before translating it.
- **Localize, don't translate word-for-word.** Translate what the string means where it appears (see
*Context*), not each English word.
- **Write native UI text.** The result should read as if the app had been written in that language.
- Restructure the sentence instead of following English word order.
- Break up long noun chains.
- Drop passive and filler constructions the language doesn't use in UI text.
- Don't calque English idioms or compounds where the language has its own expression.
- Don't carry English Title Case over: capitalize as the language does (sentence case in most,
German nouns as German writes them).
- Use the language's own punctuation. Don't carry English marks over, such as ` — ` or straight
quotes where the language has its own. ASCII quotes around a literal value the user types or
the app matches stay as written.
- **Follow the catalog's conventions,** which a new entry must match:
- formal or informal address;
- full-width or half-width punctuation;
- spacing between scripts (CJK next to Latin letters or digits);
- the separator sibling labels use before their value;
- the verb form of buttons and menu commands (infinitive, imperative or noun);
- the form of a confirmation question.
- **Simplify developer phrasing** when the meaning survives. *"This option determines whether
OrcaSlicer should apply the retract reduction on infill"* reads better as *"Disable retractions while
printing infill."* Introduce nuances in following sentences, not in one packed clause.
@@ -77,14 +180,17 @@ A rejected entry is not written. Fix it and apply again.
descriptions is for human translators, who can confirm the extra content.
- **Write for both audiences:** professionals and people with a printer at home. Keep the established
terminology, used as plainly as the string allows.
- **Read the batch back without the English** before applying it, as a user of the app would see it.
Rewrite whatever reads like a translation, is ambiguous on its own, or uses a word differently from
the strings around it.
## When to add a review note
Add `"review": "<what to check>"` to an item when the translation is probable but unconfirmed. It
becomes `# Needs human review: …`, and the entry still ships. Typical reasons:
- The English is ambiguous out of context: "Tile" as a verb or a noun.
- A short label's role only shows in the app.
- The English stays ambiguous even with its code: "Tile" as a verb or a noun.
- A short label's role shows only in the running app, not in its code.
- Two established terms compete, or the glossary cell is unsettled.
- The string's grammar depends on a value substituted at runtime: `%zu %s` counts with no plural entry.
@@ -96,6 +202,7 @@ right for the whole row."*
Report these; don't work around them in a catalog.
- **The English is wrong.** Never "fix" it in the translation only.
- **A hint names a control that doesn't exist,** or a user-visible literal isn't wrapped in `_L`.
- **One msgid needs two translations.** The source needs `_L_CONTEXT` / `_u8L_CONTEXT` (a code change).
- **A literal `%` in a string xgettext flagged `possible-c-format`** fails `msgfmt`. The fix is a
`// xgettext:no-c-format, no-boost-format` comment above the string in the source, not `%%` in the
@@ -5,11 +5,14 @@ Standard library only. Edits a catalog in place, rewriting just the entries it
changes in the layout `msgmerge --no-wrap` writes, so every other byte stays put.
status [--lang L ...] per-catalog counts
pending --lang L [--offset N --limit N] [--out FILE] [--no-include-fuzzy] (adds similar earlier translations)
pending --lang L [--offset N --limit N] [--out FILE] [--no-include-fuzzy] (adds similar earlier
translations, where the source uses each msgid, and the translated labels near it)
apply --lang L --input FILE [--overwrite] [--dry-run] adds "# AI Translated"
check [--lang L ...] [--scope ai|all] [--warnings]
lookup --lang L PATTERN [--msgstr] existing translations with ids, obsolete ones included
glossary --lang L [TERM] the language's glossary column and notes
lookup --lang L PATTERN [--msgstr] [--code] [--file RX] existing translations with ids, obsolete
ones included; --file keeps those used in matching source files
purge-obsolete [--lang L ...] drop the obsolete (#~) entries, every catalog by default
glossary --lang L [TERM] the language's glossary column and notes
candidates [--min-count N] [--limit N] recurring untranslated phrases not in the glossary
glossary-set --term T [--description D] --set L=VALUE ... [--replace]
@@ -23,6 +26,7 @@ import hashlib
import json
import os
import re
import shutil
import subprocess
import sys
import tempfile
@@ -74,7 +78,7 @@ class Entry:
self.lines = lines
self.first_line = first_line # 0-based index in the file
self.obsolete = all(l.startswith("#~") for l in lines if not l.startswith("#") or l.startswith("#~"))
self.tcomments, self.xcomments, self.flags = [], [], []
self.tcomments, self.xcomments, self.flags, self.refs = [], [], [], []
self.fields = {} # keyword -> [value, start, end)
self.order = []
current = None
@@ -91,6 +95,8 @@ class Entry:
self.xcomments.append(line[2:].strip())
elif line.startswith("#,"):
self.flags += [f.strip() for f in line[2:].split(",") if f.strip()]
elif line.startswith("#:"):
self.refs += [(f, int(n)) for f, n in re.findall(r"(\S+):(\d+)", line[2:])]
elif line == "#" or line.startswith("# "):
self.tcomments.append(line[2:])
continue
@@ -177,6 +183,11 @@ class Entry:
while pos < len(lines) and (lines[pos] == "#" or lines[pos].startswith("# ")):
pos += 1
add = []
if not ai: # a person's words: drop a stale AI mark
lines = [l for l in lines if l != "# " + AI_TAG]
pos = 0
while pos < len(lines) and (lines[pos] == "#" or lines[pos].startswith("# ")):
pos += 1
if review is not None: # "" clears an earlier note, a reason replaces it
lines = [l for l in lines if not l.startswith("# " + REVIEW_TAG)]
pos = 0
@@ -248,6 +259,77 @@ def all_langs():
return sorted(d.name for d in I18N.iterdir() if (d / f"OrcaSlicer_{d.name}.po").exists() and d.name not in SKIP_LANGS)
# ---------------------------------------------------------------------------
# Source locations
class Sources:
"""Where the source uses each msgid. The catalogs are extracted with --no-location, so this runs
xgettext again over localization/i18n/list.txt with the keywords scripts/run_gettext.sh passes."""
def __init__(self):
self.refs = {} # (msgctxt, msgid) -> [(file, line)]
self.keys = {} # file -> [(line, key)]
self._lines = {}
xgettext = shutil.which("xgettext") or next((str(t) for t in [REPO / "tools" / "xgettext.exe"] if t.exists()), None)
keywords = sorted(set(re.findall(r"--keyword=\S+", (REPO / "scripts" / "run_gettext.sh").read_text(encoding="utf-8"))))
if not xgettext or not keywords:
print("note: xgettext not found; entries carry no source context", file=sys.stderr)
return
listed = (REPO / "localization" / "i18n" / "list.txt").read_text(encoding="utf-8").splitlines()
files = [f.strip() for f in listed if f.strip() and not f.startswith("#") and (REPO / f.strip()).is_file()]
with tempfile.TemporaryDirectory() as d:
lst, pot = Path(d) / "list.txt", Path(d) / "located.pot"
lst.write_text("\n".join(files) + "\n", encoding="utf-8")
r = subprocess.run([xgettext, *keywords, "--from-code=UTF-8", "--boost", "--no-wrap", "-f", str(lst), "-o", str(pot)],
cwd=REPO, capture_output=True, text=True)
if r.returncode or not pot.exists():
print(f"note: xgettext failed; entries carry no source context\n{r.stderr.strip()}", file=sys.stderr)
return
for e in Catalog(pot).active():
self.refs[e.key()] = e.refs
for f, n in e.refs:
self.keys.setdefault(f, []).append((n, e.key()))
def lines(self, f):
if f not in self._lines:
self._lines[f] = (REPO / f).read_text(encoding="utf-8", errors="replace").splitlines()
return self._lines[f]
def spread(self, key, n):
"""Up to n uses, from as many different places as possible, so a msgid that a gizmo and a
menu share shows both."""
picked = []
for place in (lambda f: f.rsplit("/", 1)[0], lambda f: f):
for f, line in self.refs.get(key, []):
if len(picked) < n and place(f) not in {place(p) for p, _ in picked}:
picked.append((f, line))
return picked
def code(self, key, n=3):
"""The lines around a msgid's uses: the widget or option it belongs to, and what fills its
placeholders."""
out = []
for f, line in self.spread(key, n):
lines = self.lines(f)
end = line # through the end of the statement, where the placeholder arguments are
while end < min(len(lines), line + 8) and ";" not in lines[end - 1]:
end += 1
around = [l.strip()[:160] for l in lines[max(line - 3, 0):end] if l.strip()]
out.append({"at": f"{f}:{line}", "code": "\n".join(around)})
return out
def nearby(self, key, translated, span=6, limit=4):
"""Translated short msgids used within a few lines of this one: the label a tooltip describes,
the other items of a menu or a choice. Their wording is what this one must agree with."""
dist = {}
for f, line in self.refs.get(key, []):
for n, k in self.keys.get(f, []):
if k != key and k in translated and len(k[1]) <= 80 and abs(n - line) <= span:
dist[k] = min(dist.get(k, span), abs(n - line))
return [dict({"msgctxt": k[0]} if k[0] else {}, msgid=k[1], msgstr=translated[k])
for k in sorted(dist, key=dist.get)[:limit]]
# ---------------------------------------------------------------------------
# Glossary
@@ -402,9 +484,9 @@ def validate(e, msgstrs, nplurals, glossary=None, lang=None):
b1, c1 = _placeholders(src, flags)
b2, c2 = _placeholders(s, flags)
positional = any("$" in p for p in c1)
c_bad = sorted(c1) != sorted(c2) if positional else c1 != c2
c_bad = set(c1) != set(c2) if positional else c1 != c2
bad = []
if sorted(b1) != sorted(b2):
if set(b1) != set(b2):
bad.append(f"boost placeholders {b1} -> {b2}")
if c_bad:
bad.append(f"printf placeholders {c1} -> {c2}" + ("" if positional else " (order must match)"))
@@ -504,15 +586,44 @@ def similar_entries(c, e, pool, cutoff=0.72):
sm = difflib.SequenceMatcher(autojunk=False)
sm.set_seq2(e.msgid)
best = []
for other, msgstr, obsolete in pool:
for other, msgstr, obsolete, human in pool:
sm.set_seq1(other)
if sm.real_quick_ratio() < cutoff or sm.quick_ratio() < cutoff:
continue
r = sm.ratio()
if r >= cutoff and other != e.msgid:
best.append((r, other, msgstr, obsolete))
best.append((r, other, msgstr, obsolete, human))
best.sort(key=lambda t: -t[0])
return [{"msgid": o, "msgstr": s, "obsolete": ob, "similarity": round(r, 2)} for r, o, s, ob in best[:2]]
return [dict({"msgid": o, "msgstr": s, "obsolete": ob, "similarity": round(r, 2)}, **({"human": True} if h else {}))
for r, o, s, ob, h in best[:2]]
def similar_pool(c):
return [(x.msgid, x.msgstrs()[0], x.obsolete, not x.ai) for x in c.entries
if not x.is_header and x.msgstrs() and x.msgstrs()[0] and not x.fuzzy and 8 < len(x.msgid) < 600]
def human_drift(e, strs, pool):
"""Why a translation strays from a person's text more than the English change explains, or None."""
import difflib
alike = lambda x, y: difflib.SequenceMatcher(None, x, y, autojunk=False).ratio()
new, old = "\n".join(strs), "\n".join(e.msgstrs())
if old.strip() and not e.ai:
r = alike(old, new)
if r < 0.85:
return (f"replaces a person's translation with text only {r:.0%} like it: keep their words and change "
f"only what the fix needs, or give \"rewrite\": \"<reason>\"")
return None
if old.strip() or len(e.msgid) <= 8:
return None
for s in similar_entries(None, e, pool, cutoff=0.85):
if s.get("human"):
r = alike(s["msgstr"], new)
if r < s["similarity"] - 0.1:
return (f"the English is {s['similarity']:.0%} like a string a person translated, but this translation is "
f"only {r:.0%} like theirs: patch their translation, or give \"rewrite\": \"<reason>\"")
break
return None
def cmd_pending(a):
@@ -520,8 +631,9 @@ def cmd_pending(a):
g = Glossary(a.wiki, langs=[a.lang])
todo = [e for e in c.active() if needs_translation(e, c.nplurals, a.include_fuzzy)]
batch = todo[a.offset:a.offset + a.limit] if a.limit else todo[a.offset:]
pool = [(x.msgid, x.msgstrs()[0], x.obsolete) for x in c.entries
if not x.is_header and x.msgstrs() and x.msgstrs()[0] and not x.fuzzy and 8 < len(x.msgid) < 600]
pool = similar_pool(c)
src = Sources()
translated = {e.key(): e.msgstrs()[0] for e in c.active() if e.msgstrs() and e.msgstrs()[0] and not e.fuzzy}
items = []
for e in batch:
item = {"id": e.id(), "msgctxt": e.msgctxt, "msgid": e.msgid}
@@ -539,6 +651,13 @@ def cmd_pending(a):
item["fuzzy"] = True
if e.msgstrs()[0]:
item["previous_translation"] = e.msgstrs()[0]
refs = src.refs.get(e.key(), [])
if refs:
item["refs"] = [f"{f}:{n}" for f, n in refs[:4]] + ([f"+{len(refs) - 4} more"] if len(refs) > 4 else [])
# Code only where it settles the meaning: short labels, and what fills the placeholders.
if len(e.msgid.split()) <= 8 or {"c-format", "boost-format"} & set(flags):
item["code"] = src.code(e.key()) or None
item["nearby"] = src.nearby(e.key(), translated) or None
if len(e.msgid) > 8:
sim = similar_entries(c, e, pool)
if sim:
@@ -561,6 +680,7 @@ def cmd_apply(a):
items = data["entries"] if isinstance(data, dict) else data
idx = c.index()
by_id = {c.entries[i].id(): i for i in idx.values()}
pool = similar_pool(c)
applied, skipped, rejected, warned = 0, 0, [], []
for it in items:
if "msgid" in it:
@@ -588,9 +708,16 @@ def cmd_apply(a):
if errors:
rejected.append((label, errors))
continue
drift = None if it.get("rewrite") else human_drift(e, strs, pool)
if drift:
rejected.append((label, [drift]))
continue
if warnings:
warned.append((label, warnings))
c.changes[i] = e.rewrite(strs, ai=not a.human, review=it.get("review"))
review = it.get("review")
if it.get("rewrite") and not review:
review = "Rewrote a person's translation: " + it["rewrite"]
c.changes[i] = e.rewrite(strs, ai=not a.human, review=review)
applied += 1
if not a.dry_run and c.changes:
c.save()
@@ -636,7 +763,7 @@ def cmd_check(a):
if msgfmt:
fd, mo = tempfile.mkstemp(suffix=".mo") # Windows msgfmt cannot write to "nul"
os.close(fd)
r = subprocess.run([msgfmt, "--check-format", "-o", mo, str(c.path)], capture_output=True, text=True)
r = subprocess.run([msgfmt, "--check-format", "--check-header", "-o", mo, str(c.path)], capture_output=True, text=True)
os.unlink(mo)
if r.returncode:
print(f"{lang}: msgfmt --check-format failed\n{r.stderr.strip()}")
@@ -648,9 +775,29 @@ def cmd_check(a):
return status
def cmd_purge_obsolete(a):
"""Drop the obsolete (#~) entries, with their comments and the blank line before each."""
for lang in a.lang or sorted(set(all_langs()) | SKIP_LANGS):
c = Catalog(catalog_path(lang))
# a block of comments alone also parses as obsolete, so require a #~ line
gone = [e for e in c.entries if e.obsolete and any(l.startswith("#~") for l in e.lines)]
drop = set()
for e in gone:
start = e.first_line
while start > 0 and c.lines[start - 1].strip() == "":
start -= 1
drop.update(range(start, e.first_line + len(e.lines)))
if drop:
c.lines = [l for i, l in enumerate(c.lines) if i not in drop]
c.save()
print(f"{lang}: {len(gone)} obsolete entries removed")
def cmd_lookup(a):
c = Catalog(catalog_path(a.lang))
rx = re.compile(a.pattern, re.I)
src = Sources() if a.code or a.file else None
in_files = re.compile(a.file) if a.file else None
n = 0
for e in c.entries:
strs = [s for s in e.msgstrs() if s]
@@ -659,11 +806,19 @@ def cmd_lookup(a):
texts = strs if a.msgstr else [e.msgid, e.msgid_plural or ""]
if not any(rx.search(t) for t in texts):
continue
if in_files and (e.obsolete or not any(in_files.search(f) for f, _ in src.refs.get(e.key(), []))):
continue
mark = "obsolete " if e.obsolete else f"{e.id()} " + ("AI " if e.ai else "")
ctx = f"[{e.msgctxt}] " if e.msgctxt else ""
print(f"{mark}{ctx}{json.dumps(e.msgid, ensure_ascii=False)}\n -> {json.dumps(strs[0] if len(strs) == 1 else strs, ensure_ascii=False)}")
if a.code and not e.obsolete:
refs, uses = src.refs.get(e.key(), []), src.code(e.key())
if len(refs) > len(uses):
print(" used in " + " ".join(f"{f}:{l}" for f, l in refs))
for use in uses:
print(f" {use['at']}\n" + "\n".join(" | " + l for l in use["code"].splitlines()))
n += 1
if n >= a.limit:
if a.limit and n >= a.limit:
print("... (limit reached)")
break
@@ -881,11 +1036,17 @@ def main():
s.add_argument("--no-glossary", action="store_true")
s.set_defaults(func=cmd_check)
s = sub.add_parser("purge-obsolete")
s.add_argument("--lang", action="append", help="default: every catalog")
s.set_defaults(func=cmd_purge_obsolete)
s = sub.add_parser("lookup")
s.add_argument("--lang", required=True)
s.add_argument("pattern")
s.add_argument("--msgstr", action="store_true", help="search the translations instead of the English")
s.add_argument("--limit", type=int, default=40)
s.add_argument("--code", action="store_true", help="show where the source uses each hit")
s.add_argument("--file", help="only entries used in source files matching this regex (e.g. 'Gizmos/')")
s.add_argument("--limit", type=int, default=40, help="0 for no limit")
s.set_defaults(func=cmd_lookup)
s = sub.add_parser("glossary")
@@ -867,6 +867,8 @@ append_shortcut_item(export_menu, Shortcut::ExportSlicedFile, true, _L("Export p
itself; never keep a raw pointer (`interface/wx/tipwin.h:20-110`).
- `wxRichToolTip` is not a window: each `ShowFor()` creates a new one, and the native MSW version
only applies to text controls (`interface/wx/richtooltip.h:70-192`).
- On Wayland, a GTK tooltip of a widget inside a shown popup maps as a grabbing `xdg_popup` and takes the
keyboard focus from the toplevel, which reports a deactivation → `references/popups-menus.md` §9.
| Static [source] | MSW | GTK | macOS |
|---|---|---|---|
@@ -372,7 +372,9 @@ form a chain of parents. Window icons come from the `.desktop` file. The full li
`references/mouse-keyboard-focus.md`;
- GL blending must keep destination alpha at 1 (d8369e5f75);
- GL post-init must retry until the surface is committed (d2c24fdabb) →
`references/webview-gl-aui-media.md`.
`references/webview-gl-aui-media.md`;
- a shown GTK tooltip is the topmost `xdg_popup`, so it must be hidden before a popup maps
(`PopupWindow::Show`) → `references/popups-menus.md` §9.
### XWayland (GTK3 X11 backend inside a Wayland session)
@@ -409,7 +411,8 @@ start there when looking for prior art. The sites below are exemplars, cited by
(`focus_left_popup(...)`) instead of hit-testing `wxGetMousePosition()`.
- `PopupWindow::Create`: on GTK it binds the top-level `wxEVT_ACTIVATE` to `topWindowActiavate` →
`DismissAndNotify()`, gated by the virtual `ShouldDismissOnTopWindowDeactivate()`, which `DropDown`
overrides for Wayland popup chains. On `__WXOSX__` with `wxPU_CONTAINS_CONTROLS`,
overrides for Wayland popup chains. `PopupWindow::Show` (GTK) hides visible GTK tooltips before mapping
on Wayland. On `__WXOSX__` with `wxPU_CONTAINS_CONTROLS`,
`PopupWindow::OnMouseEvent2` hit-tests children, re-dispatches mouse events and synthesises
enter/leave.
- `SidePopup::Popup` (`Widgets/SideMenuPopup.cpp`): on `__APPLE__` the menu is anchored flush against
@@ -633,7 +636,7 @@ headers. Rows marked [source] or "protocol" come from the implementation or from
| `wxBitmap(const wxCursor&)` | creates an invalid bitmap | `interface/wx/bitmap.h:393-395` | — |
| OpenGL | only EGL; `PreferGLX()` has no effect. Without EGL in the build, wxGTK's `wxGLCanvas` shows a fatal message and refuses to work [source: `src/gtk/glcanvas.cpp` `IsAvailable`]. The EGL surface is a subsurface over the canvas, ready only after map and a frame callback [source: `src/unix/glegl.cpp`] | `interface/wx/glcanvas.h:1094-1095` | `CLI::run` forces X11 when wx lacks EGL; overlays are drawn in GL/ImGui, never as wx children over the canvas → `references/webview-gl-aui-media.md` |
| AUI | the doc note "live resize is always used … for wxOSX and wxGTK3 when using Wayland" is obsolete: "As of wxWidgets 3.3.0 this function always returns false", and `wxAUI_MGR_LIVE_RESIZE` is in the default flags. Floating panes need global positions | `interface/wx/aui/framemanager.h:336-345` | `Plater::priv::priv` clears `wxAUI_MGR_ALLOW_FLOATING`; `sanitize_window_layout_for_wayland` strips floating state from the saved layout → `references/webview-gl-aui-media.md` §wxAuiManager |
| Popups | a GTK popup is an `xdg_popup` only for COMBO/DROPDOWN/POPUP_MENU hints, so wx creates popups with `GDK_WINDOW_TYPE_HINT_COMBO` [source]. A chained popup's parent must be the mapped popup, and mapping it with a grab deactivates the toplevel (Orca's comments in `DropDown::mouseMove`, `DropDown::ShouldDismissOnTopWindowDeactivate`) | `src/gtk/popupwin.cpp:110-114` | `DropDown` transient-for chain, `ShouldDismissOnTopWindowDeactivate` → `references/popups-menus.md` |
| Popups | a GTK popup is an `xdg_popup` only for COMBO/DROPDOWN/POPUP_MENU hints, so wx creates popups with `GDK_WINDOW_TYPE_HINT_COMBO` [source]. A chained popup's parent must be the mapped popup, and mapping it with a grab deactivates the toplevel (Orca's comments in `DropDown::mouseMove`, `DropDown::ShouldDismissOnTopWindowDeactivate`). A GTK tooltip of a widget in a shown popup maps as that popup's grabbing child and deactivates the toplevel the same way | `src/gtk/popupwin.cpp:110-114` | `DropDown` transient-for chain, `ShouldDismissOnTopWindowDeactivate`, the tooltip check in `PopupWindow::topWindowActiavate` → `references/popups-menus.md` |
| Fractional scale | arrives as an integer GDK scale | `docs/doxygen/overviews/high_dpi.md:348-351` | → `references/dpi-bitmaps-fonts.md` |
| Window decorations | some desktop environments draw a title bar on undecorated windows anyway | — | [Undecorated windows](#wayland-undecorated-top-level-windows-splash) |
| `wxWebViewChromium` | X11 only | `interface/wx/webview_chromium.h:133-146` | not built (`wxUSE_WEBVIEW_CHROMIUM` OFF) |
@@ -73,6 +73,14 @@ Contents: [Rules](#rules) · [1. Choosing the window kind](#1-choosing-the-windo
27. Build `MenuFactory` menus once. Pass `parent` to `append_menu_item` only for items that persist. (§16)
28. macOS: bind `wxID_EXIT` on `OSXGetAppleMenu()` to `Close()`, only insert into the Apple menu, and always
`Skip()` a frame's `wxEVT_ACTIVATE`. (§15)
29. On Wayland, a popup that can open while a GTK tooltip is shown hides every visible tooltip window before
it maps. `PopupWindow::Show` does it for every Orca popup; a popup outside `PopupWindow` opened from a
widget with a GTK tooltip must do it itself. Only a popup that cannot map while a GTK tooltip is visible,
such as one opened from the GL canvas (whose tooltips are ImGui), needs nothing. (§9)
30. On Wayland, a hook that dismisses a popup when its toplevel deactivates ignores the deactivation while a GTK
tooltip of a widget in that popup, or in a popup opened from it, is on screen: the tooltip has taken the
keyboard while the user is still on the popup. `PopupWindow::topWindowActiavate` does it for every Orca popup;
a popup outside `PopupWindow` with such a hook must do it itself. (§9)
## 1. Choosing the window kind
@@ -390,6 +398,10 @@ compensates for (§6).
on older GTK and GTK2. On hide: `gdk_seat_ungrab` + `gtk_grab_remove` (`popupcmn.cpp:335-403`).
`gdk_seat_ungrab` releases the *seat's* grab, whichever popup took it, so hiding a sub-popup also drops the
parent popup's pointer grab.
- The window is mapped before the grab is taken (`wxPopupWindow::Show` at `popupcmn.cpp:370`, the grab from
375). Under Wayland the popup itself therefore maps as an `xdg_popup` without an explicit grab, while GDK
records the grab seat on its window, and a popup mapped later as its transient child (a sub-dropdown, a GTK
tooltip of a widget inside it) inherits that seat and maps with `xdg_popup.grab` (§9).
- An outside press arrives at the grab widget. `gtk_popup_button_press` sends `wxEVT_KILL_FOCUS` to the popup
and **consumes the click** (`return TRUE`, `src/gtk/popupwin.cpp:28-58`). Presses older than the popup's
creation time are ignored (33-34).
@@ -439,6 +451,9 @@ class PopupWindow : public wxPopupTransientWindow {
public:
PopupWindow(wxWindow* parent, int style = wxBORDER_NONE);
bool Create(wxWindow* parent, int flags = wxBORDER_NONE);
#ifdef __WXGTK__
bool Show(bool show = true) override; // hides GTK tooltips first on Wayland (§9)
#endif
#ifdef __WXMSW__
void BindUnfocusEvent(); // opt-in
#endif
@@ -451,7 +466,7 @@ What it adds per platform:
| Port | Behaviour |
|---|---|
| GTK | `Create` binds `wxEVT_ACTIVATE` on `GetTopParent(parent)`. `topWindowActiavate` calls `event.Skip()`, then `DismissAndNotify()` if the toplevel deactivated, the popup is shown and `ShouldDismissOnTopWindowDeactivate()` returns true. This supplies the app/toplevel deactivation dismissal that stock wxGTK lacks. |
| GTK | `Create` binds `wxEVT_ACTIVATE` on `GetTopParent(parent)`. `topWindowActiavate` calls `event.Skip()`, then `DismissAndNotify()` if the toplevel deactivated, the popup is shown, `ShouldDismissOnTopWindowDeactivate()` returns true and, under Wayland, no GTK tooltip of the popup's own is on screen (§9). This supplies the app/toplevel deactivation dismissal that stock wxGTK lacks. Under Wayland, `Show(true)` on a hidden popup first hides every visible GTK tooltip window (§9). |
| MSW | Nothing automatic. `BindUnfocusEvent()` binds the toplevel's `wxEVT_ACTIVATE`/`wxEVT_ICONIZE`/`wxEVT_SHOW` to `Dismiss()` (no `OnDismiss`). It is for default-style popups: they are desktop children that Windows does not hide with the frame, and stock wx closes them on deactivation or minimizing only if a focus message reaches a wx window (§4, §5). `topWindowActivate` does **not** `Skip()`, so while the popup lives it swallows the frame's `wxEVT_ACTIVATE`, and with it `wxTopLevelWindowMSW::OnActivate`'s focus save and restore (`src/msw/toplevel.cpp:1326-1360`). |
| macOS | Only with `wxPU_CONTAINS_CONTROLS`: `OnMouseEvent2`, bound on the popup for `LEFT_DOWN/UP/DCLICK`, `MOTION` and `MOUSEWHEEL`, hit-tests the children (static `HitTest`) and re-dispatches the event to the deepest child under the cursor with `ProcessEventLocally`. On `MOTION` it synthesizes `ENTER`/`LEAVE` for the hovered target. This compensates for the capture rerouting in §5. |
@@ -721,6 +736,85 @@ fights the grab and focus model (§10). Two more [source] facts:
`DropDown::Popup`, applied when `!mainDropDown && m_widget`).
- **Rule:** Don't open a grabbing popup on hover on Linux if the opener must stay clickable.
Cite: `MainFrame` slice-button hover handlers (`#ifndef __linux__`).
- **Rule:** On Wayland, hide every visible GTK tooltip window right before mapping a popup that can open
while one is shown.
**Why:** A GTK3 tooltip is a `GTK_WINDOW_POPUP` with the `tooltip` type hint, placed with
`gdk_window_move_to_rect` (`gtktooltip.c:974-983`), so GDK Wayland maps it as an `xdg_popup` of the
hovered widget's toplevel (`should_map_as_popup`, `gdkwindow-wayland.c:3198-3199`). GDK refuses to map a
popup whose parent is not the last popup it mapped, warning "Tried to map a popup with a non-top most
parent" (`gdkwindow-wayland.c:3040-3046`), and the window stays invisible while wx believes it is shown.
GTK hides the tooltip on a button or key press, but only after the event has been propagated to the
widgets (`gtkmain.c:1949-1961`, `_gtk_tooltip_handle_event`). A dropdown opened from the click is therefore
mapped while the opener's tooltip is still up, and the click that opens it after the tooltip delay does
nothing. The same holds for a sub-dropdown opened on hover while the main dropdown shows an item tooltip.
GTK hides the current tooltip the same way before mapping its own menus (`gtk_menu_popup_internal`,
`gtkmenu.c:1837`), but through the private `_gtk_tooltip_hide_in_display` (`gtktooltip.c:1297`); apps have
no public call, so hide the window: `gtk_widget_hide` unmaps the `xdg_popup` at once, and GtkTooltip treats
the tooltip as no longer visible (`GTK_TOOLTIP_VISIBLE`, `gtktooltip.c:135`). Its own hide on the press
then returns early, before it times out browse mode (`gtk_tooltip_hide_tooltip`, `gtktooltip.c:1078`,
1092), so the next tooltip shows after the 60 ms browse delay instead of 500 ms. A tooltip GTK tries to
show while a popup is open fails to map with the same warning and stays hidden, unless its widget is in
the topmost popup (a dropdown's own item tooltip maps as that popup's child); that happens with or without
this step and is harmless. X11 has no popup stacking rule, so the step is gated on
`is_running_on_wayland()`. (Line numbers are GTK 3.24.52.)
```cpp
// Wrong: map the popup with the opener's tooltip still on top
drop.Popup(&drop);
// Right (wxGTK, Wayland): PopupWindow::Show does this before every map
GList* toplevels = gtk_window_list_toplevels();
for (GList* l = toplevels; l; l = l->next)
if (gtk_window_get_type_hint(GTK_WINDOW(l->data)) == GDK_WINDOW_TYPE_HINT_TOOLTIP && gtk_widget_get_visible(GTK_WIDGET(l->data)))
gtk_widget_hide(GTK_WIDGET(l->data));
g_list_free(toplevels);
```
Cite: `PopupWindow::Show` (#16595).
- **Rule:** On Wayland, don't dismiss a shown popup on a toplevel deactivation while a GTK tooltip of one of its
widgets is on screen.
**Why:** GTK makes a tooltip transient for the toplevel of the widget it describes (`gtktooltip.c:974`), which
for a widget inside a popup, or the popup itself (`DropDown` sets its item tooltips on itself), is the popup's
own `GtkWindow`. The popup's window holds the seat grab (§5), and `find_grab_input_seat` walks the transient
parents to it (`gdkwindow-wayland.c:3142-3147`), so GDK maps the tooltip with an explicit `xdg_popup.grab`
(3100); the walk passes through every popup in a chain, so a tooltip in a popup opened from inside another
popup grabs too. The compositor gives the keyboard to the topmost grabbing popup: KWin sends `wl_keyboard.leave`
for the main window and `enter` for the tooltip (observed with `WAYLAND_DEBUG=client`). wxGTK turns the
toplevel's focus-out into `wxEVT_ACTIVATE(false)` (`src/gtk/toplevel.cpp:192-205`), so a deactivation hook closes
the popup as the tooltip appears, and GDK warns "Tried to unmap the parent of a popup"
(`gdkwindow-wayland.c:3429`) because the tooltip is still mapped as its child. The focus returns to the toplevel
when the tooltip hides. Ask GDK whether the tooltip is mapped (`gdk_window_is_visible`): when the compositor
dismisses a tooltip, `xdg_popup_done` hides only its `GdkWindow` (`gdkwindow-wayland.c:2289`,
`gdkwindow.c:5684-5690`), and `gtk_widget_get_visible` stays TRUE until GTK hides the tooltip itself. Alt+Tab with
a tooltip showing still closes the popup (observed): the Alt press reaches the app, which hides the tooltip after
handling the key (`gtkmain.c:1949-1961`). X11 tooltips never take the focus, so the check is gated on
`is_running_on_wayland()`. (Line numbers are GTK 3.24.52.)
**Limit:** wxGTK sends `wxEVT_ACTIVATE(false)` only while it holds an active frame and then clears it
(`g_activeFrame`, `src/gtk/toplevel.cpp:196-202`), so a deactivation ignored this way is never repeated. If the
app loses the focus while the tooltip holds it, without Orca seeing a key or the pointer leave first (another
app's window taking the focus, a gesture), the popup stays open until the user returns, and the first click
closes it (observed with a dialog from another app). Closing that gap means waiting for the compositor to
reactivate the toplevel, which takes a timer or a blocking round trip.
```cpp
// Wrong: every toplevel deactivation dismisses, including the one the popup's own tooltip causes
if (!event.GetActive() && IsShown() && ShouldDismissOnTopWindowDeactivate())
DismissAndNotify();
// Right (wxGTK): Wayland only, skip it while a tooltip of this popup or of a popup opened from it is mapped
static bool own_tooltip_mapped(GtkWindow *popup)
{
bool mapped = false;
for_each_tooltip_window([popup, &mapped](GtkWindow *win) { // GDK_WINDOW_TYPE_HINT_TOOLTIP toplevels
GdkWindow *gdk_win = gtk_widget_get_window(GTK_WIDGET(win));
if (!gdk_win || !gdk_window_is_visible(gdk_win))
return;
for (GtkWindow *w = gtk_window_get_transient_for(win); w && !mapped; w = gtk_window_get_transient_for(w))
mapped = w == popup;
});
return mapped;
}
if (!event.GetActive() && IsShown() && ShouldDismissOnTopWindowDeactivate() &&
!(Slic3r::GUI::is_running_on_wayland() && own_tooltip_mapped(GTK_WINDOW(m_widget))))
DismissAndNotify();
```
Cite: `PopupWindow::topWindowActiavate` (#16800).
## 10. Frameless dialog instead of a popup
+108
View File
@@ -0,0 +1,108 @@
name: Approve PR checks
# The repository makes a maintainer approve workflow runs on pull requests from first-time
# contributors, and that setting covers every workflow at once. This approves the pending runs of
# Check profiles, Check locale and clang-tidy at the head of each open pull request from a fork, so
# they report without waiting; Build all and the other workflows still wait for a maintainer. It
# does not read the approval setting, so a stricter one does not hold these three back either.
#
# Its token can approve runs and pull_request_target needs no approval, so it must never check out
# or run pull request code. It reads run, pull request and git tree metadata only.
on:
# Approves the runs for a pull request's new head right away. No paths filter: clang_tidy.yml
# runs on every pull request into these branches.
pull_request_target:
branches:
- main
- release/*
# Looks at every pending run: one not listed yet when the job above looked, and all of them when
# pull_request_target is blocked by an Actions event policy.
schedule:
- cron: '7,17,27,37,47,57 * * * *'
workflow_dispatch:
permissions: {}
jobs:
approve:
name: Approve PR checks
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
actions: write # list and approve workflow runs
contents: read # compare commits and read git trees
pull-requests: read # list open pull requests
steps:
- name: Approve pending runs
# A failed job would leave a red check on the pull request, which blocks pr-merge-bot.
# The sweep retries and reports the failure instead.
continue-on-error: ${{ github.event_name == 'pull_request_target' }}
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
# Both empty for the sweep, which then considers every pending run.
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# The workflows approved here, found by file name.
workflows="check_profiles.yml check_locale.yml clang_tidy.yml"
# Prints the tree of a commit's .github/, or nothing if it has none; fails if the commit
# cannot be read.
github_tree() {
gh api "repos/${GH_REPO}/git/trees/$1" --jq '.tree[] | select(.path == ".github") | .sha'
}
# The approve endpoint is for pull requests from forks, so runs from this repository's own
# branches are left to a maintainer. Each workflow is listed on its own, so pending runs of
# other workflows cannot fill the endpoint's 1000-result window. A failed listing exits
# rather than passing for an empty one.
runs=$(for workflow in $workflows; do
gh api --paginate "repos/${GH_REPO}/actions/workflows/${workflow}/runs?event=pull_request&status=action_required&per_page=100${HEAD_SHA:+&head_sha=${HEAD_SHA}}" \
--jq '.workflow_runs[] | select(.head_repository.full_name != .repository.full_name) | [.id, .workflow_id, .head_sha, .name] | @tsv' \
|| exit 1
done)
if [ -z "$runs" ]; then
echo "No run of these workflows is waiting for approval."
exit 0
fi
# Runs for superseded commits and closed pull requests are left alone.
if [ -n "$PR_NUMBER" ]; then
open_heads=$(gh api "repos/${GH_REPO}/pulls/${PR_NUMBER}" --jq 'select(.state == "open") | .head.sha')
else
open_heads=$(gh api --paginate "repos/${GH_REPO}/pulls?state=open&per_page=100" --jq '.[].head.sha')
fi
failed=0
while IFS=$'\t' read -r run_id workflow_id sha name; do
grep -qx "$sha" <<< "$open_heads" || continue
# The approved run takes its workflow from the head merged into the base branch. A head
# whose .github/ is the one it branched from main with changes no workflow, so that
# merge runs only workflow code already on this repository's branches. A maintainer
# approves the rest.
if ! newest=$(gh api "repos/${GH_REPO}/actions/workflows/${workflow_id}/runs?event=pull_request&head_sha=${sha}&per_page=1" --jq '.workflow_runs[0].id') \
|| ! base=$(gh api "repos/${GH_REPO}/compare/main...${sha}" --jq .merge_base_commit.sha) \
|| ! head_tree=$(github_tree "$sha") || ! base_tree=$(github_tree "$base"); then
echo "::warning::Could not read the ${name} runs or the .github/ trees for ${sha}."
failed=1
continue
fi
# Reopening a pull request leaves an older run at the same head; only the newest runs.
[ "$newest" = "$run_id" ] || continue
if [ -z "$head_tree" ] || [ "$head_tree" != "$base_tree" ]; then
echo "::notice::Leaving ${name} run ${run_id} to a maintainer: ${sha} changes .github/."
continue
fi
if gh api -X POST "repos/${GH_REPO}/actions/runs/${run_id}/approve" > /dev/null; then
echo "Approved ${name} run ${run_id} for ${sha}."
# A maintainer or another run of this workflow may have approved it first.
elif ! conclusion=$(gh api "repos/${GH_REPO}/actions/runs/${run_id}" --jq .conclusion) \
|| [ "$conclusion" = action_required ]; then
echo "::warning::Could not approve ${name} run ${run_id} for ${sha}."
failed=1
else
echo "${name} run ${run_id} no longer waits for approval."
fi
done <<< "$runs"
exit "$failed"
+6 -1
View File
@@ -1,6 +1,8 @@
name: Check locale
on:
# approve_pr_checks.yml approves these runs for first-time contributors and finds this
# workflow by its file name.
pull_request:
branches:
- main
@@ -12,6 +14,9 @@ jobs:
check_translation:
name: Check translation
runs-on: ubuntu-latest
# approve_pr_checks.yml starts first-time contributors' runs without a maintainer looking
# at the pull request first. A run takes under a minute; this bounds one that msgfmt stalls on.
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v7
@@ -33,7 +38,7 @@ jobs:
if [ -f "$dir/OrcaSlicer_${lang}.po" ]; then
mkdir -p ./resources/i18n/${lang}/
msgfmt --check-format -o ./resources/i18n/${lang}/OrcaSlicer.mo $dir/OrcaSlicer_${lang}.po
msgfmt --check-format --check-header -o ./resources/i18n/${lang}/OrcaSlicer.mo $dir/OrcaSlicer_${lang}.po
# Check the exit status of the msgfmt command
if [ $? -ne 0 ]; then
echo "Error encountered with msgfmt command for language ${lang}."
+5
View File
@@ -1,5 +1,7 @@
name: Check profiles
on:
# approve_pr_checks.yml approves these runs for first-time contributors and finds this
# workflow by its file name.
pull_request:
# release/* is included because pr-merge-bot.yml lets delegates merge into
# it, and it gates on this workflow's result. Without it a delegated merge
@@ -37,6 +39,9 @@ jobs:
# delegated merge. Renaming it silently disables that gate.
name: Check profiles
runs-on: ubuntu-24.04
# approve_pr_checks.yml starts first-time contributors' runs without a maintainer looking
# at the pull request first. A run takes 2-6 minutes; this bounds a runaway one.
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v7
+7
View File
@@ -8,6 +8,9 @@ name: clang-tidy
# No paths filter: the job is a required check, and a workflow skipped by a
# paths filter leaves a required check pending forever. A PR with no C++
# changes finishes after the first step.
#
# approve_pr_checks.yml approves this workflow's runs for first-time
# contributors and finds it by its file name.
on:
pull_request:
branches:
@@ -36,6 +39,10 @@ jobs:
# that gate.
name: clang-tidy
runs-on: ${{ vars.SELF_HOSTED && 'orca-lnx-server' || 'ubuntu-24.04' }}
# approve_pr_checks.yml starts first-time contributors' runs without a
# maintainer looking at the pull request first. The deps-cache wait alone may
# take 100 minutes; this bounds a runaway run without cutting a real one.
timeout-minutes: 180
steps:
- name: Checkout
uses: actions/checkout@v7
+7 -1
View File
@@ -50,6 +50,12 @@ jobs:
'documentation'
];
const pr = context.payload.pull_request;
// First-time contributors also get a link to the contributing guide
const greeting = ['FIRST_TIME_CONTRIBUTOR', 'FIRST_TIMER'].includes(pr.author_association)
? `Hi @${pr.user.login}, thanks for contributing to OrcaSlicer! ` +
`[How to Contribute](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute) explains what reviewers need from a PR.\n\n` +
`You can`
: `Hi @${pr.user.login}, you can`;
const labelsList = `${allowedLabels
.slice(0, -1)
.map((label) => `\`${label}\``)
@@ -72,7 +78,7 @@ jobs:
repo: context.repo.repo,
issue_number: pr.number,
body:
`Hi @${pr.user.login}, you can manage the labels for this PR by \`/bot add-label\` and \`/bot remove-label\`\n\n` +
`${greeting} manage the labels for this PR by \`/bot add-label\` and \`/bot remove-label\`.\n\n` +
`Allowed labels are:\n${labelsList}\n\n` +
`Examples:\n${examplesText}`
});
+5 -1
View File
@@ -58,6 +58,10 @@ ctest --test-dir ./tests/fff_print -C Release
- Profile/format changes need version migration handling
- Dependencies built separately in `deps/build/`, then linked to main app
## Pull requests
Before opening a pull request or posting on GitHub, read [CONTRIBUTING.md](CONTRIBUTING.md), including its "If you are an AI agent" section.
## Code review focus areas
- Changes must not cause regressions in existing functionality, defaults, profiles, or project compatibility.
@@ -112,5 +116,5 @@ See `.claude/skills/orca-translations/references/source-audit.md` for the full c
### Verifying
- `scripts/run_gettext.bat --full` (Windows) regenerates the template, merges every catalog and compiles the `.mo` files. It must exit 0.
- Or check a single catalog with `msgfmt --check-format -o <out>.mo localization/i18n/<lang>/OrcaSlicer_<lang>.po`.
- Or check a single catalog with `msgfmt --check-format --check-header -o <out>.mo localization/i18n/<lang>/OrcaSlicer_<lang>.po`. Without `--check-header`, msgfmt skips the placeholder check in plural forms.
- Fuzzy entries are not shown to users. If you correct one, clear its `fuzzy` flag, otherwise the fix never ships.
+105
View File
@@ -0,0 +1,105 @@
# Contributing to OrcaSlicer
Thanks for wanting to help! OrcaSlicer is built by volunteers.
Review is the slowest part of getting a PR merged. A small group of reviewers works through hundreds of open PRs in their spare time. If a PR has what they need, it is reviewed sooner and is more likely to be merged. [How to Contribute](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute) on the wiki has the details for each kind of PR.
For questions about using OrcaSlicer, please ask on [Discord](https://discord.gg/P4VE9UY9gJ) or in [Discussions](https://github.com/OrcaSlicer/OrcaSlicer/discussions), not in an issue or PR.
Opening an issue? See [Opening an Issue](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#opening-an-issue).
## The short version
- Search open PRs and issues before you start. Someone may already be working on it.
- Keep each PR to one topic. Put changes that belong together in one PR, and unrelated changes in separate PRs. Focused PRs are reviewed and merged much faster.
- Don't open many PRs at once. If you already have several open, wait until some are merged.
- Explain why the change is needed, and show how you tested it. Add an automated test when the code can be tested.
- AI tools are welcome. You are still responsible for the change, so test it and make sure you understand it.
- Keep your PR up to date and reply to review comments.
## Write a description reviewers can use
Use the [PR template](.github/pull_request_template.md), and keep its "How to Download Pull Requests Artifacts" link as the last line. Testers use that link. In the template, answer these questions:
- **What does this change, and why is it needed?** If it fixes an issue, write `Fixes #1234` in the description, so GitHub closes the issue when the PR is merged. If it fixes only part of an issue, mention `#1234` without `Fixes`, so the issue stays open.
- **Are there related PRs or issues?** If another PR touches the same code or bug, explain how yours is different.
- **How did you test it?** Give the OS, the printer profile and the steps. Attach a project file if the result depends on a model or settings. Name any automated tests you added. The best test fails without your change and passes with it. See [tests/AGENTS.md](tests/AGENTS.md) for where a test goes.
- **What could you not test?** For example another OS, or a printer you don't own.
Use short, plain sentences, because many reviewers read English as a second language. Your own English is fine, and so is a translation tool.
## What each kind of PR needs
| Kind of PR | Label | Reviewers need to see |
|---|---|---|
| [Bug fix](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#bug-fixes) | `bug-fix`, `crash` | The cause, before and after, a test if possible |
| [Security fix](SECURITY.md) | `SECURITY` | A private report to the maintainers first |
| [New feature or setting](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#new-features-and-settings) | `enhancement`, `QoL` | Why users need it, that it is off by default, real results |
| [Performance](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#performance) | `optimization` | Measurements, and proof the output did not change |
| [Refactor](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#refactors) | `optimization` | That behavior and output did not change |
| [GUI change](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#gui-changes) | `UI/UX` | Screenshots before and after, on each platform you tested |
| [Printer profile](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#printer-profiles) | `profile` | The validator passing, the version bump, real print results |
| [Translation](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#translations) | `Localization` | Glossary terms used, placeholders unchanged |
| [Build, CI or dependencies](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#build-ci-and-dependencies) | `build`, `dependencies` | Which platforms you built on |
| [Tests](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#tests) | `test` | That the test fails when the behavior breaks |
| [Documentation](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#documentation) | `documentation` | That it matches the current code |
## Rules that are easy to miss
- **Don't reformat existing code or make unrelated edits.** `.clang-format` is for new files. In existing files, match the code around your change.
- **Include what you use.** Because of the precompiled header, a local build can succeed with a missing include. Run `scripts/run_clang_tidy.sh` (or `.ps1`) before you push.
- **New behavior is off by default.** When the new option is off, existing output must not change.
- **Keep old projects and profiles working.** Never change what an existing setting means. Add a new key, and convert old values in `handle_legacy`.
- **Write each UI message as one translatable string** with placeholders, never as joined fragments. See "Writing translatable strings in the source" in [AGENTS.md](AGENTS.md).
- **Only edit `msgstr` in translations.** Keep every placeholder and `\n` exactly as in the `msgid`.
- **Bump the vendor version when you change profiles.** Change `version` in `resources/profiles/<Vendor>.json` for every vendor you change, and run `scripts/check_profile.sh` (or `.bat`).
The code style and the full list of what reviewers check are in [AGENTS.md](AGENTS.md).
## Using AI tools
AI tools are welcome here, and many contributors and maintainers use them. Reviewers can only spend time on PRs that a person has already tested.
- **You are responsible for the change.** Before you ask for review, build the change, run it, and confirm that it works. Be ready to explain each change and why it is needed.
- **Keep it short and true.** AI tools tend to write long descriptions, and sometimes describe tests that never ran. Remove generated code that isn't needed, too. A short description of what you actually did helps more.
- **Read what you post.** Please don't paste a review comment into an AI tool and post its answer without checking it.
- **Don't let an agent open PRs or post comments on its own.** Read everything before it is posted.
- **Use the repository's skills.** `.claude/skills/` (also reachable as `.agents/skills/`) has instructions for AI tools on parts of OrcaSlicer. The top of each skill's `SKILL.md` describes when to use it. Some tools load them automatically. With others, point the tool to the skill that matches your change.
### If you are an AI agent
If you are an AI agent working for a contributor, please follow these steps:
1. Show the contributor this guide before you open a PR or post a comment.
2. Search open PRs for the same change before you start.
3. If the contributor already has several open PRs, wait until some are merged before you open another.
4. Before you change code, check `.claude/skills/` for a skill that matches the change, and follow it.
5. If the code can be tested, add an automated test, and check that it fails without the change and passes with it.
6. Ask the contributor to test the change by hand. For a bug fix, they should build the code without the change and reproduce the bug. Then they should build the branch and check that the bug is gone.
7. Write the PR description in the [PR template](.github/pull_request_template.md). A body passed with `gh pr create --body` replaces the template, so start from the template's text.
8. If you couldn't build or run something, say so in the PR.
## After you open the PR
- **Add labels.** A bot will comment with instructions. Reply with the labels from the table above, for example `/bot add-label bug-fix, UI/UX`.
- **Leave "Allow edits by maintainers" turned on**, so a reviewer can push small fixes directly.
- **Mark the PR ready for review when it's finished.** Draft PRs are not merged.
- **Push new commits to the same PR.** Please don't open a new PR for the same change.
- **Don't force-push once a reviewer has commented.** Add new commits instead, so reviewers can see what changed since they last looked. To fix merge conflicts, merge `main` into your branch. PRs are usually squash-merged, so extra commits are fine.
- **Reply to every review comment**, including automated ones. You don't have to agree, but please say why.
Reviewers are volunteers, and a first response can take a while. If you already have several PRs open, please wait until some are merged before you open more. Review comments on one PR often apply to the others too. While you wait, there are [other ways to help](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#other-ways-to-help).
## If your PR is closed
There are more PRs than reviewers can handle, so we may close a PR that doesn't meet this guide. For example, it may have no explanation of how it was tested, duplicate another PR, or look generated and untested. When we close a PR, we'll say why in a comment.
You're welcome to open a new PR once the change meets this guide. Please link the old PR in the description, so reviewers can see the earlier discussion. Thank you for the time you put into it.
## Security issues
Please don't report security problems in a public issue. See [SECURITY.md](SECURITY.md).
## Thank you
Thanks again for helping. We're glad you're here.
+7 -1
View File
@@ -54,7 +54,7 @@ while getopts ":dpa:snt:xbc:i:j:Tuh" opt; do
echo " -u: Build universal app only (requires existing arm64 and x86_64 app bundles)"
echo " -n: Nightly build"
echo " -t: Specify minimum version of the target platform, default is 12.0"
echo " -x: Use Ninja Multi-Config CMake generator, default is Xcode"
echo " -x: Use Ninja Multi-Config CMake generator, default is Xcode (requires ninja; install with 'brew install ninja')"
echo " -b: Build without reconfiguring CMake"
echo " -c: Set CMake build configuration, default is Release"
echo " -i: Add a prefix to ignore during CMake dependency discovery (repeatable), defaults to /opt/local:/usr/local:/opt/homebrew"
@@ -122,6 +122,12 @@ if [ -z "$CMAKE_IGNORE_PREFIX_PATH" ]; then
export CMAKE_IGNORE_PREFIX_PATH="/opt/local:/usr/local:/opt/homebrew"
fi
if [[ "$SLICER_CMAKE_GENERATOR" == Ninja* || "$DEPS_CMAKE_GENERATOR" == Ninja* ]] && ! command -v ninja >/dev/null 2>&1; then
echo "Error: Ninja is required when using the -x generator option."
echo "Install it with Homebrew: brew install ninja"
exit 1
fi
CMAKE_VERSION=$(cmake --version | head -1 | sed 's/[^0-9]*\([0-9]*\).*/\1/')
if [ "$CMAKE_VERSION" -ge 4 ] 2>/dev/null; then
export CMAKE_POLICY_VERSION_MINIMUM=3.10
-54
View File
@@ -1,54 +0,0 @@
From 893b8113f04d408cc6177c6de19c9889a48faa24 Mon Sep 17 00:00:00 2001
From: Zixu Wang <zixu_wang@apple.com>
Date: Thu, 18 Jan 2024 11:12:00 -0800
Subject: [PATCH] Fix unused platform check and configuration for macOS
In a similar manner as zlib (https://github.com/madler/zlib/pull/895),
libpng contains a header configuration that's no longer valid and
hasn't been exercised for the macOS target.
- The target OS conditional macros are misused. Specifically
`TARGET_OS_MAC` covers all Apple targets, including iOS, and it
should not be checked with `#if defined` as they would always be
defined (to either 1 or 0) on Apple platforms.
- `#include <fp.h>` no longer works for the macOS target and results
in a compilation failure. macOS ships all required functions in
`math.h`, and clients should use `math.h` instead.
This problem has not been noticed until a recent extension in clang
(https://github.com/llvm/llvm-project/pull/74676) exposed the issue
and broke libpng builds on Apple platforms. The failure can be
reproduced now by adding `#include <TargetConditionals.h>` before the
block.
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
---
AUTHORS | 2 ++
pngpriv.h | 14 ++------------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/3rdparty/libpng/pngpriv.h b/3rdparty/libpng/pngpriv.h
index 6c7280cf53..190eb85cbf 100644
--- a/3rdparty/libpng/pngpriv.h
+++ b/3rdparty/libpng/pngpriv.h
@@ -556,18 +556,8 @@
*/
# include <float.h>
-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
- /* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-# include <fp.h>
-# endif
-# else
-# include <math.h>
-# endif
+# include <math.h>
+
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
+4 -4
View File
@@ -25,8 +25,8 @@ orcaslicer_add_cmake_project(OpenCV
${_options}
URL https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz
URL_HASH SHA256=1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277
PATCH_COMMAND git apply ${OpenCV_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-vs.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch
DEPENDS ${JPEG_PKG}
PATCH_COMMAND git apply ${OpenCV_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-vs.patch
DEPENDS ${JPEG_PKG} ${PNG_PKG}
CMAKE_ARGS
-DBUILD_SHARED_LIBS=0
-DBUILD_PERE_TESTS=OFF
@@ -35,13 +35,13 @@ orcaslicer_add_cmake_project(OpenCV
-DBUILD_EXAMPLES=OFF
-DBUILD_JASPER=OFF
-DBUILD_JAVA=OFF
# Share Orca's libjpeg to avoid conflicting codec symbols in the application.
# Share Orca's libjpeg and libpng to avoid conflicting codec symbols in the application.
-DBUILD_JPEG=OFF
-DBUILD_PNG=OFF
-DBUILD_APPS_LIST=version
-DBUILD_opencv_apps=OFF
-DBUILD_opencv_java=OFF
-DBUILD_OPENEXR=OFF
-DBUILD_PNG=ON
-DBUILD_TBB=OFF
-DBUILD_WEBP=OFF
-DBUILD_ZLIB=OFF
-29
View File
@@ -1,29 +0,0 @@
--- a/pngpriv.h 2025-04-20 19:36:04.000000000
+++ b/pngpriv.h 2025-04-20 19:35:55.000000000
@@ -511,24 +511,14 @@
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
* DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
*/
# include <float.h>
-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
- /* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-# include <fp.h>
-# endif
-# else
-# include <math.h>
-# endif
+# include <math.h>
+
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
*/
# include <m68881.h>
# endif
+3 -40
View File
@@ -1,51 +1,14 @@
if (APPLE)
# Only disable NEON extension for Apple ARM builds, leave it enabled for Raspberry PI.
set(_disable_neon_extension "-DPNG_ARM_NEON=off")
elseif ("${DEPS_ARCH}" STREQUAL "arm64" AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
# libpng's CMake ignores PNG_ARM_NEON on Windows ARM64 and skips the NEON
# sources, but pngpriv.h enables NEON anyway.
set(_disable_neon_extension "-DCMAKE_C_FLAGS=/DWIN32 /D_WINDOWS /DPNG_ARM_NEON_OPT=0")
else ()
set(_disable_neon_extension "")
endif ()
if(APPLE AND IS_CROSS_COMPILE)
# TODO: check if it doesn't create problem when compiling from arm to x86_64
orcaslicer_add_cmake_project(PNG
GIT_REPOSITORY https://github.com/glennrp/libpng.git
GIT_TAG v1.6.35
orcaslicer_add_cmake_project(PNG
URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.59.zip
URL_HASH SHA256=6fd97a1e5e2ac55cec0a538a9800a351eb3844086736291844ebd12db72ba433
DEPENDS ${ZLIB_PKG}
PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/macos-arm64.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_STATIC=ON
-DPNG_PREFIX=prusaslicer_
-DPNG_TESTS=OFF
-DDISABLE_DEPENDENCY_TRACKING=OFF
${_disable_neon_extension}
)
else ()
set(_patch_step "")
if (APPLE)
set(_patch_step PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/PNG.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch)
endif ()
orcaslicer_add_cmake_project(PNG
# GIT_REPOSITORY https://github.com/glennrp/libpng.git
# GIT_TAG v1.6.35
URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.35.zip
URL_HASH SHA256=3d22d46c566b1761a0e15ea397589b3a5f36ac09b7c785382e6470156c04247f
DEPENDS ${ZLIB_PKG}
"${_patch_step}"
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_STATIC=ON
-DPNG_PREFIX=prusaslicer_
-DPNG_TESTS=OFF
-DDISABLE_DEPENDENCY_TRACKING=OFF
${_disable_neon_extension}
)
endif()
if (MSVC)
add_debug_dep(dep_PNG)
-26
View File
@@ -1,26 +0,0 @@
Common subdirectories: ../libpng-1.6.35-orig/arm and ./arm
Common subdirectories: ../libpng-1.6.35-orig/contrib and ./contrib
Common subdirectories: ../libpng-1.6.35-orig/intel and ./intel
Common subdirectories: ../libpng-1.6.35-orig/mips and ./mips
Only in ./: PNG.patch
diff -u ../libpng-1.6.35-orig/pngrutil.c ./pngrutil.c
--- ../libpng-1.6.35-orig/pngrutil.c 2018-07-15 20:58:00.000000000 +0200
+++ ./pngrutil.c 2021-03-24 15:59:38.687108444 +0100
@@ -422,13 +422,6 @@
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
}
-#if ZLIB_VERNUM >= 0x1290 && \
- defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
- if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
- /* Turn off validation of the ADLER32 checksum in IDAT chunks */
- ret = inflateValidate(&png_ptr->zstream, 0);
-#endif
-
if (ret == Z_OK)
png_ptr->zowner = owner;
Common subdirectories: ../libpng-1.6.35-orig/powerpc and ./powerpc
Common subdirectories: ../libpng-1.6.35-orig/projects and ./projects
Common subdirectories: ../libpng-1.6.35-orig/scripts and ./scripts
Common subdirectories: ../libpng-1.6.35-orig/tests and ./tests
-90
View File
@@ -1,90 +0,0 @@
Based on https://github.com/vespakoen/libpng to work around until
https://github.com/glennrp/libpng/pull/354 is resolved.
also added patch from PS2.4 (PNG.pach) in pngrutil.c
---
CMakeLists.txt | 28 ++++++++++++++++++++--------
pngrutil.c | 7 -------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4db9bb87d..9099d1edf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,10 +82,22 @@ option(PNG_HARDWARE_OPTIMIZATIONS "Enable Hardware Optimizations" ON)
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
+# CMake currently sets CMAKE_SYSTEM_PROCESSOR to one of x86_64 or arm64 on macOS,
+# based upon the OS architecture, not the target architecture. As such, we need
+# to check CMAKE_OSX_ARCHITECTURES to identify which hardware-specific flags to
+# enable. Note that this will fail if you attempt to build a universal binary in
+# a single cmake invokation.
+if (APPLE AND CMAKE_OSX_ARCHITECTURES)
+ set(TARGET_ARCH ${CMAKE_OSX_ARCHITECTURES})
+else()
+ set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
+endif()
+
+
if(PNG_HARDWARE_OPTIMIZATIONS)
# set definitions and sources for arm
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
+if(TARGET_ARCH MATCHES "^arm" OR
+ TARGET_ARCH MATCHES "^aarch64")
set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
check: (default) use internal checking code;
@@ -114,8 +126,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
endif()
# set definitions and sources for powerpc
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*" )
+if(TARGET_ARCH MATCHES "^powerpc*" OR
+ TARGET_ARCH MATCHES "^ppc64*" )
set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off)
set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations:
off: disable the optimizations.")
@@ -138,8 +150,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
endif()
# set definitions and sources for intel
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*" )
+if(TARGET_ARCH MATCHES "^i?86" OR
+ TARGET_ARCH MATCHES "^x86_64*" )
set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
off: disable the optimizations")
@@ -162,8 +174,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
endif()
# set definitions and sources for MIPS
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*" )
+if(TARGET_ARCH MATCHES "mipsel*" OR
+ TARGET_ARCH MATCHES "mips64el*" )
set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
off: disable the optimizations")
diff --git a/pngrutil.c b/pngrutil.c
index 7001f1976..91930f1f2 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -422,13 +422,6 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
}
-#if ZLIB_VERNUM >= 0x1290 && \
- defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
- if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
- /* Turn off validation of the ADLER32 checksum in IDAT chunks */
- ret = inflateValidate(&png_ptr->zstream, 0);
-#endif
-
if (ret == Z_OK)
png_ptr->zowner = owner;
--
2.33.0.windows.1
@@ -1,29 +0,0 @@
diff --git a/src/osx/cocoa/colour.mm b/src/osx/cocoa/colour.mm
index 31515d146f..86b33e94a2 100644
--- a/src/osx/cocoa/colour.mm
+++ b/src/osx/cocoa/colour.mm
@@ -125,3 +125,3 @@
wxOSXEffectiveAppearanceSetter helper;
- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] )
+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] )
return [colRGBA redComponent];
@@ -134,3 +134,3 @@
wxOSXEffectiveAppearanceSetter helper;
- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] )
+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] )
return [colRGBA greenComponent];
@@ -143,3 +143,3 @@
wxOSXEffectiveAppearanceSetter helper;
- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] )
+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] )
return [colRGBA blueComponent];
@@ -152,3 +152,3 @@
wxOSXEffectiveAppearanceSetter helper;
- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] )
+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] )
return [colRGBA alphaComponent];
@@ -160,3 +160,3 @@
{
- return [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] != nil;
+ return [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] != nil;
}
@@ -1,21 +0,0 @@
diff --git a/src/msw/webview_edge.cpp b/src/msw/webview_edge.cpp
index cf6f80e..91222db 100644
--- a/src/msw/webview_edge.cpp
+++ b/src/msw/webview_edge.cpp
@@ -555,7 +555,16 @@ void wxWebViewEdgeImpl::UpdateBounds()
RECT r;
wxCopyRectToRECT(m_ctrl->GetClientRect(), r);
if (m_webView)
+ {
m_webViewController->put_Bounds(r);
+ // WebView2 also folds the Windows text size into the rasterization scale, which zooms
+ // the page inside its fixed pixel bounds. Follow the monitor DPI only, as wx chrome does.
+ wxCOMPtr<ICoreWebView2Controller3> controller3;
+ if (SUCCEEDED(m_webViewController->QueryInterface(IID_PPV_ARGS(&controller3)))) {
+ controller3->put_ShouldDetectMonitorScaleChanges(FALSE);
+ controller3->put_RasterizationScale(m_ctrl->GetDPIScaleFactor());
+ }
+ }
}
HRESULT wxWebViewEdgeImpl::OnNavigationStarting(ICoreWebView2* WXUNUSED(sender), ICoreWebView2NavigationStartingEventArgs* args)
+1 -17
View File
@@ -29,28 +29,12 @@ else ()
set(_wx_precomp ON)
endif ()
set(_wx_patch_command "")
if (APPLE)
set(_wx_patch_command
${GIT_EXECUTABLE} checkout -f -- src/osx/cocoa/colour.mm
COMMAND ${GIT_EXECUTABLE} apply --verbose
${CMAKE_CURRENT_LIST_DIR}/0001-macos-use-srgb-colour-components.patch
)
elseif (MSVC)
set(_wx_patch_command
${GIT_EXECUTABLE} checkout -f -- src/msw/webview_edge.cpp
COMMAND ${GIT_EXECUTABLE} apply --verbose
${CMAKE_CURRENT_LIST_DIR}/0002-msw-webview2-monitor-dpi-rasterization.patch
)
endif ()
orcaslicer_add_cmake_project(
wxWidgets
GIT_REPOSITORY "https://github.com/OrcaSlicer/Orca-deps-wxWidgets"
GIT_TAG v3.3.2
GIT_TAG 5b7e8c0cde6b975d63613188d2ac6c1ab8769fbc
GIT_SHALLOW ON
GIT_SUBMODULES 3rdparty/catch 3rdparty/pcre 3rdparty/libwebp
PATCH_COMMAND ${_wx_patch_command}
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${JPEG_PKG}
CMAKE_ARGS
-DwxBUILD_PRECOMP=${_wx_precomp}
+280
View File
@@ -0,0 +1,280 @@
# Seam alignment on the loop — High Level Design
## Purpose and scope
SeamPlacer selects candidates, connects neighboring layers into strings, fits each string and
places the resulting seam on its own contour. Painted ranges are reconstructed separately for
green enforcers and red blockers. These stages do not alter candidate ranking.
String construction and fitting apply to Aligned, Aligned Back and Back (`spRear`).
Nearest and Random bypass this stage, but share the paint reconstruction rules.
## Concepts
- **Candidate (C).** The seam candidate chosen for a perimeter in a string. Candidates are the
polygon vertices plus points inserted near paint (see Painted ranges), so the chosen candidate
can move in discrete steps from layer to layer.
- **Fitted point (F).** The value of the string's fitted curve at the layer height. It need not
lie on the loop: where the loop size changes quickly between layers, as near the bottom of a
sphere, it lies up to a few millimeters off it.
- **Measured angle.** `local_ccw_angle` of a candidate. It is measured at polygon vertices on arms
at least one nozzle diameter long; inserted points have angle 0.
- **Blend.** `target = t·C + (1 − t)·F`. The angle weight `t = min(1, (|angle C| / 55°)^3)` pulls
the seam onto sharp corners; at 55° and above the seam is the candidate itself.
- **Enforced run.** The maximal sequence of consecutive Enforced candidates of the perimeter that
contains C, or the whole loop when every candidate is Enforced. With exact painted ranges it
follows its geometric bounds and surface proximity; otherwise it approximates the painted area with the candidate spacing.
## Painted ranges
The paint is a set of small triangles on the model surface. Its **contour** is the set of their
edges that belong to one painted triangle only, taken from the painted triangles with their T-joints
split (`get_facets_strict`), so that edges inside the painted area pair up. Each contour edge keeps
the direction from it into the paint. The contour is built once per object and stored in an AABB
tree.
Green and red paint use separate instances of the same contour and interval reconstruction.
An interval bounds paint membership but does not establish it: every classified candidate must
also lie within one line width of a triangle of the corresponding paint. A contour can leave the
painted surface between projected endpoints, especially at concavities and nearby surface folds.
The same proximity check used by the fallback prevents such a detour from acquiring synthetic
paint; exact interval bounds still exclude the fringe beyond the projected ends.
Red ranges classify candidates as Blocked, including the boundary itself (1 µm membership
tolerance), overriding green paint at an overlap. Inserted samples include both red ends, a
range midpoint, a gap midpoint and permitted guard samples up to 2 µm outside the red ends.
The guard distance is reduced to one quarter of a shorter gap; gaps at or below the membership
tolerance can remain closed. Candidate marks closer than 1 µm merge.
These adjacent permitted samples limit fitted and optimized movement to the geometric red
edge, with the small outward guard, rather than to a distant original gray vertex. Red ranges add
no penalty and do not change candidate ranking. Precise Seam modifiers apply after paint
classification and take priority over it.
Random placement samples an outgoing edge of its selected candidate. On loops with exact
green ranges, an Enforced candidate followed by a non-Enforced candidate contributes no outgoing
edge length: the endpoint belongs to the paint, but the following segment leaves the permitted run.
This also respects weak modifiers that retype part of a painted run as Blocked or Neutral.
On loops with exact red ranges, a permitted candidate followed by a Blocked candidate contributes no outgoing
edge length, so Random cannot sample toward the closed red boundary. A zero-length selected
edge keeps the candidate position.
The cumulative-length selection stops at the last viable edge and clamps its
remaining distance to that edge, preventing float rounding from overrunning the
candidate list or the permitted segment.
Exact green and red ends bound the seam center position without expanding the painted range
along the contour by the line width. A seam can therefore reach a red edge with no line-width
clearance. Paint can be extended to request a larger clearance; the boundary does not
guarantee that the finite-width extrusion or a seam blemish stays entirely outside red paint.
If boundary crossings cannot be paired, the corresponding color falls back to the line-width
proximity classification, including its possible fringe beyond the paint edge. The fallback is
independent for each color and loop. For red this includes paint not crossing the layer,
ambiguous contours and a completely red surface without boundary crossings. In the all-blocked case
best-effort placement still produces a seam; red paint does not suppress extrusion.
An exact red reconstruction does not suppress proximity-based green oversampling when green
boundaries remain uncertain.
On a layer, the contour edges crossing the slicing plane give the exact ends of the painted band.
Each crossing within the line width of the loop is moved to its closest loop point; the direction
into the paint, against the loop direction there, tells whether paint lies ahead or behind. At a
vertex the loop direction is the mean of the two edges, skipping edges shorter than 1 µm such as
the repeated closing point and the shared ends of extrusion paths, so the result does not depend on
where the loop starts. Along the loop, ends where paint begins and ends must alternate; each
pair bounds a **painted range**. Such a loop has **exact ends**:
- a vertex is Enforced if it lies in a range (within 1 µm);
- points are inserted at the range ends, at the range middle and every 0.2 mm from the range begin,
and one in the middle of each gap between ranges, so that ranges with no vertex between them stay
separate patches;
- the central candidate of the longest patch is the middle of its range, unless the patch has a
sharp corner, which keeps priority.
Before generating candidates, a fully painted closed surface is treated like an unpainted surface:
it imposes no choice of seam position. A loop on a partly painted object can also be normalized when
there are no exact range ends, no active Precise Seam modifier, no non-green facet bounding box in
the loop's XY box expanded by line width and its Z slab of the same reach, and every entire loop edge
is proven within paint reach. Neutral and blocked facets both prevent this local proof. Segment
coverage uses the triangle inequality at its midpoint and at most eight bisections; failure retains
the ordinary conservative paint treatment. This is a sufficient test, not a claim to recognize every
fully covered contour near unrelated surfaces.
A normalized loop keeps the original candidates, without paint oversampling, Enforced status,
central enforcer, extra fitting or positional weights, painted-corner blending or paint fixation. Sharp-angle and Precise Seam rules remain authoritative. Whole-surface painting and no
painting therefore feed identical candidates into alignment.
Otherwise, which includes paint not crossing the layer (a dot between layers, the top and bottom of
a band), ends that do not alternate and a contour running along the
loop, a point is Enforced if paint lies within the line width of it, and edges near paint get points
every 0.2 mm from their start vertex. Such a run reaches past the paint by up to the line width,
depending on the vertices, and its central candidate is the middle one by count; on a smooth band
both shift the seam off the middle of the paint.
## Seam strings
A string starts at a seam and is extended upward layer by layer while the next layer has a seam
within reach. After the upward search ends, the downward search begins at the layer immediately
below the start. This keeps a matching neighboring seam in the same aligned string.
## Geometric contour continuation
Seam strings resolve the next layer's boundary before comparing seam preferences.
Each perimeter retains whether it bounds material or a hole, its layer-local index,
and immutable candidate geometry. Occupancy does not participate in correspondence: the radius search skips occupied
members of the permitted set without expanding it to unrelated walls.
Each layer builds an AABB tree of contour bounds once. Nearby-contour queries,
fast bounds matching, material containment and boundary proximity use this index
before applying their exact predicates. Query results are sorted by the
original contour index, preserving deterministic tie-breaking. Index construction
checks cancellation between layers. The index avoids scanning unrelated contours
for each seed; overlapping global bounds can still require many exact checks.
Only closed extrusion loops provide a reliable boundary role. Open paths and
collection fallbacks retain unknown geometry rather than deriving a physical role
from an artificial closing edge. An unknown source, or an unknown path whose
bounding box intersects the local query box in either layer, leaves the radius
search unrestricted. This conservative box test also covers the material probes;
it may disable the filter even when the path's segments are farther away.
Reverse confirmation applies only to candidates that pass the applicable distance
and normal checks, plus material checks on the local path outside the noise band.
Unknown geometry encountered around such a candidate's foot during reverse confirmation
also leaves the entire radius search unrestricted, rather than discarding only
that candidate. A reliable reverse rejection still excludes the candidate.
Unknown paths outside these query boxes do not disable reliable correspondence.
Bounding-box extents within one nozzle diameter plus a quarter-diameter reserve
identify a potential fast match of the same boundary type. Acceptance also requires
a closest segment within one eighth of the source line width, consistent air-facing
normals, no competing near-coincident local boundary, and a reverse set containing
the source. Thus the inexpensive path certifies only a near-coincident wall, rather
than treating global bounds and the full search radius as sufficient evidence.
The fallback uses the caller's KD search radius, normally four seed-line widths,
for nearby boundaries of either type. With unchanged boundary type it finds the
nearest segment whose air-facing normal is compatible with the source, so the
opposite side of a thin contour cannot hide its facing side. Across a type change
the closest patch itself must agree; choosing another side can confuse translated annuli.
An open exterior wall can become a hole when a slit closes; boundary type alone
cannot reject that physical continuation. It checks air-facing
normals within 60 degrees and samples the connector between closest boundary points.
Away from boundary noise, the connector must lie in material of exactly one adjacent
layer, representing a swept wall rather than a crossing through shared material or
air. Three samples are a bounded heuristic, not a topological proof.
Each local candidate must map back to a set containing the source boundary. A candidate
is discarded only if another has both a distance advantage of at least a quarter of
the source line width and a normal-angle advantage of at least five degrees. Equal or
conflicting criteria retain multiple candidates; seam preferences choose within
this set. Air-facing normals and material checks distinguish wall sides without imposing
an invariant exterior/hole label across topology changes. They are geometric gates,
not numerical preference weights.
If no geometric candidate survives, the radius search is left unrestricted. Continuation
then follows seam preferences alone and can switch walls where geometry cannot resolve
the case. A nonempty geometric set is never
expanded because its contours are occupied or fail later seam preference checks.
Correspondence queries are cached per source vertex, direction and search radius
for alternative string starts. Geometry construction and the seed loop check
cancellation to keep large multi-island objects interruptible. Correspondence does not alter candidate
preference weights or their tolerance.
## Final position
For each member of a string:
1. **Sharp candidate** (`t = 1`): the seam is C. This is the cheapest check and comes first.
2. **Painted corner pull** (Enforced C only): `t = max(t, 0.4·k)` with the corner influence
`k ∈ [0, 1]` below. Retaining the pull near measured corners protects corners; fading it on
smooth contours reduces transmission of discrete candidate steps into the seam. If C's own angle
reaches `A1`, `k = 1` without a search.
3. **Place on the loop.** The target is mapped onto the loop, within the allowed arc around C.
### Corner influence
`k` is the largest contribution `a_j · w_j` among candidates `j` of the same perimeter within `R1`
of C along the loop, `d_j` being the distance along the loop:
- `a_j` rises smoothly from 0 at a measured angle of `A0` to 1 at `A1`, so weak bends count partly
and smooth contours not at all;
- `w_j` is 1 up to `R0` and falls smoothly to 0 at `R1`, so a corner entering or leaving the
neighborhood does not switch `t` abruptly.
`R0` is the larger of the perimeter's line width and the largest configured nozzle diameter: the
measured angle of a vertex reflects geometry within at least one nozzle diameter, so a candidate
inserted next to a corner usually still sees that corner. Within `R0` of a corner of at least
`A1`, `t` and the target are the same as with a fixed minimum of 0.4.
### Placing the target on the loop
The target is generally off the loop. Its closest loop point is a polygon vertex over a whole range
of target positions, so it snaps to vertices and steps between layers when the vertices differ from
layer to layer.
Instead the loop gets a continuous normal field. Each vertex has the normalized sum of the normals
of its two edges, taken to the nearest points at a different position, so that duplicated points
(shared ends of extrusion paths, a repeated closing point) get one normal. Along an edge the normal
blends linearly between its vertex normals. A **solution** is a loop point whose normal line passes
through the target; on each edge this is a quadratic equation in the edge parameter.
The seam is the solution closest to the target over the whole loop. If it lies outside the allowed
arc, the seam is the end of that arc closer to the solution, so a solution leaving the arc stays at
the end it leaves through. Without any solution, which takes a degenerate loop, the seam is C.
The search walks outward from C on both sides, the shorter walked side first. An edge farther from
the target than the best solution so far is skipped without solving.
Properties:
- On a regular polygon every normal line passes through the center. For a target other than the
center, the closest solution is the nearer of the two intersections of the loop with the line
through the center and the target, wherever the vertices are; the seam equals it when it lies
inside the allowed arc. With an even number of vertices the two intersections are symmetric about
the center, so the nearer one is on the ray from the center through the target.
- When the closest solution is unique and lies inside the allowed arc, the result depends on the
target and that arc only, not on which candidate inside the arc was chosen. A candidate step
therefore does not pass into the seam directly. At an exact distance tie, the first solution found
from C is kept.
- A selected solution varies continuously while its root branch remains nondegenerate, and so does
the seam when the solution leaves or enters the allowed arc. The seam may jump when the closest
solution changes (two solutions equally close, or the closest one disappearing together with
another where the target crosses the curve of centers of the normal field), or when a solution
outside the arc becomes equally close to both arc ends. Changes of the candidate types between
layers change the allowed arc.
### Allowed arc
- For an Enforced C on a loop with exact ends: the Enforced run itself, which ends at the paint.
- For another Enforced C: the Enforced run, extended past each open end by the oversampling distance
(0.2 mm) but never into a Blocked candidate. The run ends sit on candidates and move in sampling
steps between layers, and Rear tends to choose the candidate right at an end; without the
extension a target just past an end would copy those steps into the seam.
- For another C: the part of the loop between the Blocked candidates around it.
- For a Blocked C, or a loop with no limiting candidate: the whole loop.
## Numerical constants
| Constant | Value | Meaning |
| --- | --- | --- |
| Blend minimum near corners | 0.4 | Pull toward C on a painted corner |
| `A0`, `A1` | 15°, 30° | Measured angle where corner contribution starts and becomes full |
| `R0` | max(line width, largest nozzle diameter); 0.5 mm if both are zero | Full corner protection along the loop |
| `R1` | 2·`R0` | Corner influence ends |
| Run extension | 0.2 mm (`enforcer_oversampling_distance`); 0 with exact ends | How far the seam may go past an end of the Enforced run |
| Painted range tolerance | 1 µm (`enforced_end_tolerance`) | Loop positions this close are one point |
| Range end reach | line width | How far from the loop a contour crossing may lie |
| Coverage proof depth | 8 bisections per edge | Finite conservative proof for complete paint on a partly painted object |
| Solver threshold | 1e-12 | Absolute threshold on the equation coefficients that tells degenerate equations apart; not a distance tolerance |
## Constraints
Strong Precise Seam coordinates remain immutable. Angles of at least 55 degrees retain the
selected candidate. Ambiguous paint boundaries use the proximity fallback; an entirely
blocked perimeter still needs a printed seam. Mesh topology and candidate sampling can change
which first-approximation string is selected. Painting a verified complete perimeter introduces
no artificial center preference.
## Implementation and verification
`SeamPlacer.cpp` implements paint reconstruction, candidate selection, string traversal, fitting
and contour placement. `test_seam_placer.cpp` covers geometry, paint, string traversal and strong
Precise Seam invariants. `tests/libslic3r/test_seam_contour.cpp` independently checks
geometric correspondence, ambiguity and search-radius behavior.
+159
View File
@@ -0,0 +1,159 @@
# Translucent filaments
## Purpose
A filament color can carry an opacity (`#RRGGBBAA`, see [color-picker.md](color-picker.md)). Prepare
draws the parts of such a filament see-through, and Preview their toolpaths, so the inside of a
translucent part and whatever lies behind it show through. Both tabs aim at the same look: the
opacity of the plastic the view ray crosses, matte without realistic view and glossy with it.
## Where the opacity applies
- Only the views that color toolpaths by filament: Filament, Summary and Tool. The other views
color by feature or by a value, and stay opaque.
- Only extrusions. Travels, wipes and option markers stay opaque, and so do the layers that hold a
pause or a custom G-code, which these views draw grey.
- A filament keeps its color down to 10% opacity, the floor `adjust_color_for_rendering()` gives it in
Prepare too, so that a fully clear filament is still drawn. A near-black filament is lifted to a grey
that rises with its transparency: a dark translucent surface shows nothing through itself, so without
the lift its layers blend into one flat black.
- The "Translucent filaments" preference (`preview_translucent_filaments`, on by default) turns all
of it off: every filament is then drawn opaque, the legend swatches included. It applies to the
loaded preview at once, through `Viewer::set_translucent_filaments()`.
- The legend swatches carry the same opacity, drawn over the white and grey checkerboard of the
sidebar's clear filament swatch so that they read on the dark legend.
- The opacity is that of 0.4 mm of the filament. Each translucent segment raises it to the length
of the view ray through the centre of its diamond section, `1 - (1 - a)^(path / 0.4)`, so thin
layers stacked under the camera add up as one thick layer would, and a wall seen side on keeps
about the filament's opacity whatever the layer height.
## Data
`libvgcode::convert_filament_colors()` decodes the filament color strings into a
`libvgcode::PaletteWithAlpha`. libvgcode keeps one RGBA8 color per vertex, in a `GL_RGBA8` texture
buffer, or in RGBA8 2D textures on OpenGL ES. The color depends on the view type, while the alpha
comes from the filament alone. The viewer also notes whether any vertex is translucent.
## Rendering
A segment takes the alpha of its first vertex. While any vertex is translucent,
`update_enabled_entities()` sorts the enabled segments by opacity, the opaque ones first, keeping
the print order within each group; on OpenGL ES, each texture of the list is sorted on its own.
Each pass draws its own group, from an offset into the list. Without a translucent vertex, the list
is not sorted and the second pass is skipped, so the first draws exactly what it drew before.
1. The opaque segments, with depth writes.
2. The option markers.
3. The translucent segments, in premultiplied color blended with `GL_ONE, GL_ONE_MINUS_SRC_ALPHA`,
depth tested but without depth writes. Opaque toolpaths and objects hide the translucent ones
behind them, and a translucent segment hides nothing. Drawing the markers first keeps those
inside a translucent part behind its surface, instead of on top of it.
`Viewer::render()` draws the first two; `Viewer::render_translucent()` draws the third, which
`GLCanvas3D::_render_gcode_translucent()` calls after the SSAO pass. Drawn that late, the pass turns the
depth test on itself, as the passes before it may leave it off. The occlusion that pass reads
from depth would otherwise shade a translucent surface as the surface behind it, as it would the
centre of mass marker. FXAA still comes after. The sequential view markers and the IDEX/IQEX
toolhead boxes, which `GCodeViewer::render_scene()` draws after the toolpaths, are translucent but
write depth, so while there are translucent toolpaths they wait for them, in
`GCodeViewer::render_translucent_toolpaths()`. Drawn before, they would hide the translucent toolpaths
behind them, and the print would show a hole around the tool position.
A translucent segment takes its diffuse light in its own color, scaled by its opacity. In
realistic view, whatever its other options, with its "Glossy toolpaths" setting on, every segment,
opaque or translucent, takes instead of the tinted highlight of the default shading an untinted one
computed per fragment, not scaled by the opacity, so that the filaments look alike and a clear one
keeps its gloss instead of fading into the background. `GLCanvas3D::_render_gcode()` switches it
with `Viewer::set_gloss()`. Without realistic view, or with the setting off, a translucent filament
is matte and an opaque one keeps the default shading. The
highlight takes the normal of the rounded extrusion a segment stands for, an ellipse of its height
and width around its centre line, rather than that of its facets: it then runs smoothly across a
joint, where the facets of two segments would catch it apart, and it fades out towards the tip of a
path end, whose normal runs along the extrusion. There
is no Fresnel term: an extrusion seen end-on would turn into a bright opaque stripe.
Each segment reaches half a line width past its ends, to fill the outside of a turn or round off a
path end, so two segments of a path overlap at their joint. Depth hides that between opaque ones,
but blending would draw the joint twice, and the highlight of realistic view shows the caps sticking
out of an opaque one. A translucent segment, and a glossy one, is therefore cut in the fragment
shader at the bisector plane of each joint of its path, keeping 0.02 mm past it: the
faces each segment turns to the camera do not quite meet without their caps. A vertex where two
segments of a path meet carries 0.5 on top of its layer in the w of its position, which the shaders
otherwise read as an int. That includes the joints across the vertex repeated in place that starts
a new path wherever the flow, acceleration or jerk changes (`starts_path()` in
`LibVGCodeWrapper.cpp`), which real G-code has at most of its joints: the shader then takes the
neighbour one vertex further, and the caps the angle of the joint, which the vertex data leaves at 0
there.
The translucent segments are not sorted by depth. The opaque pass draws the last printed segments
first when looking down, to cut overdraw. The direct translucent pass, which only some cases fall
back to (see below), draws them the other way round, so the farthest layers blend first.
## Order independent blending
Blended in print order, the order shows even with a single translucent color, since its surfaces are
shaded apart. A layer's infill, printed after its walls, blends over the walls in front of it: seen
from the side, the dark bridge under a deck draws a sawtooth over the hull's outer wall, as if a piece
of it were missing. So on desktop OpenGL the translucent segments blend order independently, in
`ViewerImpl::render_translucent_segments()`. The nearest
translucent surface of each pixel is drawn over a weighted blended order independent transparency
(McGuire and Bavoil, 2013) of the others. The mean alone would not do: the walls of a painted object
lie a fraction of a millimetre apart, so its depth weights barely differ, and the more opaque and more
numerous surfaces of one filament would hide the other filament's outer wall in front of them.
1. The depth of the scene drawn so far is copied into a texture. The fragment shader discards a
translucent fragment behind it, as there is no depth buffer to test against.
2. The translucent segments are drawn once into an `R32F` target cleared to 1, keeping with `GL_MIN`
the `gl_FragCoord.z` of the nearest. The segments shaders draw it built with `DEPTH_ONLY`, the same
geometry and joint cut without the shading and its varyings, so the nearest fragment of the next
pass finds its own depth there exactly.
3. They are drawn again. The nearest fragment of a pixel goes, premultiplied, to an `RGBA16F` target
of its own. Every other one adds its premultiplied color, times a weight, to an `RGBA16F` target,
and `-log(1 - alpha)` to an `R16F` target, with `GL_ONE, GL_ONE`. The weight is the opacity times
`max((1 - z)^3, 0.01)`, z being the depth across the extrusions' bounding box, so nearer surfaces
count more. Its ceiling keeps thousands of stacked surfaces within half float range, and its floor
keeps far ones out of the subnormals. A translucent segment's opacity stays below 1, else the
shader would take it for an opaque one and add it unweighted.
4. A full screen pass draws the nearest surface over the weighted mean color of the others, with
their coverage `1 - exp(-sum)`, over the scene.
Swapping the drawing order changes the result by at most 2 levels out of 255, against up to 246 in
the direct pass. The targets are single-sampled whatever the canvas, about 26 bytes per pixel.
Multisampled ones would take twice the time and four times the memory for edges FXAA can smooth, and
against a single-sampled depth pass an edge sample could miss its nearest depth and count twice.
OpenGL ES, whose float targets are optional, takes the direct pass, as does a multisampled framebuffer
object, whose depth cannot be copied into a texture.
## Cost and side effects
Without depth writes, every translucent surface on screen is shaded, so the cost of the second
pass grows with the number of translucent surfaces stacked on screen. Order independent blending
draws the translucent segments twice and writes 18 bytes of float data per pixel instead of 4, between
a tenth and two fifths more than the direct pass.
In realistic view, a translucent segment casts into a share of the shadow map texels as large as
its opacity, in an ordered 4x4 pattern that the 5x5 filter of the receivers reads as a lighter
shadow. The pattern shifts with the segment, so layers stacked along the light add up: a 1 mm
translucent box at 35% casts a shadow about 60% as dark as an opaque one, a 10 mm box nearly a full
one.
## Prepare
Prepare draws a part as a closed mesh, which would show a single surface at the filament's opacity,
far fainter and darker than the print of that part in Preview. The object shaders therefore shade a
visible model part whose filament color is translucent as the view ray crossing two shells of the
part, the front and the back one, of two 0.45 mm walls each, with the opacity rule of Preview:
`1 - (1 - a)^(1.8 / 0.4 / cos)`, cos being that of the angle between the view and the normal,
floored at 0.25. A filament at 35% is then about 86% opaque face on, and nearly opaque at the
silhouette, where the ray grazes the walls. See `translucent_filament_color()` in `gouraud.fs` and
`phong.fs`.
Such a part is drawn in premultiplied color, blended with `GL_ONE, GL_ONE_MINUS_SRC_ALPHA`, so that
in realistic view its highlight is not dimmed by its opacity; without realistic view it takes no
highlight. `GLVolumeCollection::render()` switches this per volume, and only with a shader that has
the `translucent_filament` uniform, the GLSL 1.40 ones: with the GLSL 1.10 and ES shaders, such a
part blends as a plain transparent volume. Modifiers, negative volumes and opaque parts are drawn as
they were.
The wireframe overlay draws translucent filament parts too, with blending off, so their lines stay
solid.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Anker",
"version": "02.04.00.06",
"version": "02.04.00.07",
"force_update": "0",
"description": "Anker configurations",
"machine_model_list": [
@@ -6,7 +6,7 @@
"instantiation": "false",
"gcode_flavor": "marlin2",
"before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\n\n",
"file_start_gcode": ";TIME:{print_time_sec}s",
"file_start_gcode": ";TIME:{print_time_sec}s\n;Filament weight: {total_weight}g\n;Filament used: {used_filament}m\n;Layer height: {layer_height}\n;material_print_temperature_layer_0: {first_layer_temperature[0]}",
"machine_start_gcode": "M4899 T3 ; Enable v3 jerk and S-curve acceleration \nM104 S150 ; Set hotend temp to 150 degrees to prevent ooze\nM190 S{first_layer_bed_temperature[0]} ; set and wait for bed temp to stabilize\nM109 S{first_layer_temperature[0]} ; set final nozzle temp to stabilize\nG28 ;Home\n;LAYER_COUNT:{total_layer_count}",
"machine_end_gcode": "M104 S0\nM140 S0\n;Retract the filament\nG92 E1\nG1 E-1 F300\nG28 X0 Y0\nM18",
"change_filament_gcode": "M600",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Anycubic",
"version": "02.04.00.09",
"version": "02.04.00.10",
"force_update": "0",
"description": "Anycubic configurations",
"machine_model_list": [
@@ -108,7 +108,7 @@
],
"machine_start_gcode": "G90 ;Use absolute coordinates\nM83 ;Extruder relative mode\nM104 S[first_layer_temperature] ;Set extruder temp\nM140 S[first_layer_bed_temperature] ;Set bed temp\nM190 S[first_layer_bed_temperature] ;Wait for bed temp\nM109 S[first_layer_temperature] ;Wait for extruder temp\nG28 ;Move X/Y/Z to min endstops\nG1 Z0.28 ;Lift nozzle a bit\nG92 E0 ;Specify current extruder position as zero\nG1 Y3 F1800 ;Move Y to purge point\nG1 X60 E25 F500 ;Extrude 25mm of filament in a 5cm line\nG92 E0 ;Zero the extruded length again\nG1 E-2 F500 ;Retract a little\nG1 X70 F4000 ;Quickly wipe away from the filament line\nM117",
"machine_end_gcode": "M104 S0 ;Extruder off\nM140 S0 ;Heatbed off\nM107 ;Fan off\nG91 ;Relative positioning\nG1 E-5 F3000 ;Retract filament\nG1 Z+0.3 F3000 ;Lift print head\nG28 X0 F3000 ;Home X axis\nM84 ;Disable stepper motors",
"before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\n[layer_num] @ [layer_z]mm\nG92 E0",
"layer_change_gcode": ";AFTER_LAYER_CHANGE\n[layer_num] @ [layer_z]mm",
"before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\n;[layer_num] @ [layer_z]mm\nG92 E0",
"layer_change_gcode": ";AFTER_LAYER_CHANGE\n;[layer_num] @ [layer_z]mm",
"scan_first_layer": "0"
}
@@ -592,10 +592,18 @@
"name": "SUNLU PETG @base",
"sub_path": "filament/SUNLU/SUNLU PETG @base.json"
},
{
"name": "School House Spools Matte PETG @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools Matte PETG @base.json"
},
{
"name": "School House Spools PETG @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools PETG @base.json"
},
{
"name": "School House Spools Transparent PETG @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools Transparent PETG @base.json"
},
{
"name": "eSUN PETG @base",
"sub_path": "filament/eSUN/eSUN PETG @base.json"
@@ -1100,10 +1108,22 @@
"name": "SUNLU Wood PLA @base",
"sub_path": "filament/SUNLU/SUNLU Wood PLA @base.json"
},
{
"name": "School House Spools Marble PLA @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools Marble PLA @base.json"
},
{
"name": "School House Spools Matte PLA @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools Matte PLA @base.json"
},
{
"name": "School House Spools PLA @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools PLA @base.json"
},
{
"name": "School House Spools Silk PLA @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools Silk PLA @base.json"
},
{
"name": "Valment PLA @base",
"sub_path": "filament/Valment/Valment PLA @base.json"
@@ -1296,6 +1316,10 @@
"name": "Overture TPU @base",
"sub_path": "filament/Overture/Overture TPU @base.json"
},
{
"name": "School House Spools TPU 95A @base",
"sub_path": "filament/SchoolHouseSpools/School House Spools TPU 95A @base.json"
},
{
"name": "FusRock ABS-GF @BBL A1",
"sub_path": "filament/FusRock/BBL/FusRock ABS-GF @BBL A1.json"
@@ -2268,10 +2292,18 @@
"name": "SUNLU PETG @System",
"sub_path": "filament/SUNLU/SUNLU PETG @System.json"
},
{
"name": "School House Spools Matte PETG @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools Matte PETG @System.json"
},
{
"name": "School House Spools PETG @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools PETG @System.json"
},
{
"name": "School House Spools Transparent PETG @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools Transparent PETG @System.json"
},
{
"name": "eSUN PETG @System",
"sub_path": "filament/eSUN/eSUN PETG @System.json"
@@ -3824,10 +3856,22 @@
"name": "SUNLU Wood PLA @System",
"sub_path": "filament/SUNLU/SUNLU Wood PLA @System.json"
},
{
"name": "School House Spools Marble PLA @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools Marble PLA @System.json"
},
{
"name": "School House Spools Matte PLA @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools Matte PLA @System.json"
},
{
"name": "School House Spools PLA @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools PLA @System.json"
},
{
"name": "School House Spools Silk PLA @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools Silk PLA @System.json"
},
{
"name": "Valment PLA @System",
"sub_path": "filament/Valment/Valment PLA @System.json"
@@ -4228,6 +4272,10 @@
"name": "Overture TPU @System",
"sub_path": "filament/Overture/Overture TPU @System.json"
},
{
"name": "School House Spools TPU 95A @System",
"sub_path": "filament/SchoolHouseSpools/School House Spools TPU 95A @System.json"
},
{
"name": "Goofoo ABS @System",
"sub_path": "filament/Goofoo/Goofoo ABS @System.json"
@@ -0,0 +1,9 @@
{
"type": "filament",
"name": "School House Spools Marble PLA @System",
"inherits": "School House Spools Marble PLA @base",
"from": "system",
"setting_id": "gKoqhVeZCBn8YuPM",
"instantiation": "true",
"compatible_printers": []
}
@@ -0,0 +1,20 @@
{
"type": "filament",
"name": "School House Spools Marble PLA @base",
"inherits": "fdm_filament_pla",
"from": "system",
"filament_id": "OFEU6OJY",
"instantiation": "false",
"filament_cost": [
"17"
],
"filament_density": [
"1.22"
],
"filament_flow_ratio": [
"0.98"
],
"filament_vendor": [
"School House Spools"
]
}
@@ -0,0 +1,9 @@
{
"type": "filament",
"name": "School House Spools Matte PETG @System",
"inherits": "School House Spools Matte PETG @base",
"from": "system",
"setting_id": "gVrdOWAeve7Ytkvq",
"instantiation": "true",
"compatible_printers": []
}
@@ -0,0 +1,71 @@
{
"type": "filament",
"name": "School House Spools Matte PETG @base",
"inherits": "fdm_filament_pet",
"from": "system",
"filament_id": "OFiwOjce",
"instantiation": "false",
"cool_plate_temp": [
"0"
],
"cool_plate_temp_initial_layer": [
"0"
],
"eng_plate_temp": [
"70"
],
"eng_plate_temp_initial_layer": [
"70"
],
"fan_cooling_layer_time": [
"30"
],
"fan_max_speed": [
"40"
],
"fan_min_speed": [
"10"
],
"filament_cost": [
"15"
],
"filament_density": [
"1.25"
],
"filament_flow_ratio": [
"0.95"
],
"filament_max_volumetric_speed": [
"8"
],
"filament_vendor": [
"School House Spools"
],
"hot_plate_temp": [
"70"
],
"hot_plate_temp_initial_layer": [
"70"
],
"nozzle_temperature_range_high": [
"270"
],
"nozzle_temperature_range_low": [
"230"
],
"overhang_fan_speed": [
"90"
],
"overhang_fan_threshold": [
"10%"
],
"slow_down_layer_time": [
"12"
],
"textured_plate_temp": [
"70"
],
"textured_plate_temp_initial_layer": [
"70"
]
}
@@ -0,0 +1,9 @@
{
"type": "filament",
"name": "School House Spools Matte PLA @System",
"inherits": "School House Spools Matte PLA @base",
"from": "system",
"setting_id": "HlZ93lZcHerJYqK6",
"instantiation": "true",
"compatible_printers": []
}
@@ -0,0 +1,26 @@
{
"type": "filament",
"name": "School House Spools Matte PLA @base",
"inherits": "fdm_filament_pla",
"from": "system",
"filament_id": "OFJe1Nqi",
"instantiation": "false",
"filament_cost": [
"17"
],
"filament_density": [
"1.32"
],
"filament_flow_ratio": [
"0.98"
],
"filament_scarf_gap": [
"0%"
],
"filament_scarf_height": [
"5%"
],
"filament_vendor": [
"School House Spools"
]
}
@@ -0,0 +1,9 @@
{
"type": "filament",
"name": "School House Spools Silk PLA @System",
"inherits": "School House Spools Silk PLA @base",
"from": "system",
"setting_id": "9cH3rxwal3s5GCZi",
"instantiation": "true",
"compatible_printers": []
}
@@ -0,0 +1,33 @@
{
"type": "filament",
"name": "School House Spools Silk PLA @base",
"inherits": "fdm_filament_pla",
"from": "system",
"filament_id": "OFFUPLH1",
"instantiation": "false",
"description": "Fresh, sealed spools print fine as they are. Dry the filament again only after it has sat out in your environment for a while. For the highest gloss, set the outer wall speed to 40 to 60 mm/s when slicing.",
"filament_cost": [
"20"
],
"filament_density": [
"1.32"
],
"filament_flow_ratio": [
"0.98"
],
"filament_scarf_gap": [
"0%"
],
"filament_scarf_height": [
"5%"
],
"filament_vendor": [
"School House Spools"
],
"nozzle_temperature": [
"230"
],
"nozzle_temperature_initial_layer": [
"230"
]
}
@@ -0,0 +1,9 @@
{
"type": "filament",
"name": "School House Spools TPU 95A @System",
"inherits": "School House Spools TPU 95A @base",
"from": "system",
"setting_id": "DsCimJeIIAKpyMzY",
"instantiation": "true",
"compatible_printers": []
}
@@ -0,0 +1,24 @@
{
"type": "filament",
"name": "School House Spools TPU 95A @base",
"inherits": "fdm_filament_tpu",
"from": "system",
"filament_id": "OFChno4b",
"instantiation": "false",
"description": "This TPU is dried after extrusion and ships ready to print, so it does not need drying out of the box. Drying is optional if the spool has been sitting out for a while. It is soft and flexible, so it is not suited to automatic multi-material feeders.",
"filament_cost": [
"25"
],
"filament_density": [
"1.22"
],
"filament_vendor": [
"School House Spools"
],
"nozzle_temperature": [
"230"
],
"nozzle_temperature_initial_layer": [
"230"
]
}
@@ -0,0 +1,9 @@
{
"type": "filament",
"name": "School House Spools Transparent PETG @System",
"inherits": "School House Spools Transparent PETG @base",
"from": "system",
"setting_id": "gJW8Fi5DP81yKDcm",
"instantiation": "true",
"compatible_printers": []
}
@@ -0,0 +1,77 @@
{
"type": "filament",
"name": "School House Spools Transparent PETG @base",
"inherits": "fdm_filament_pet",
"from": "system",
"filament_id": "OFVt3PHa",
"instantiation": "false",
"cool_plate_temp": [
"0"
],
"cool_plate_temp_initial_layer": [
"0"
],
"eng_plate_temp": [
"70"
],
"eng_plate_temp_initial_layer": [
"70"
],
"fan_cooling_layer_time": [
"30"
],
"fan_max_speed": [
"30"
],
"fan_min_speed": [
"10"
],
"filament_cost": [
"17"
],
"filament_density": [
"1.25"
],
"filament_flow_ratio": [
"0.95"
],
"filament_max_volumetric_speed": [
"6"
],
"filament_vendor": [
"School House Spools"
],
"hot_plate_temp": [
"70"
],
"hot_plate_temp_initial_layer": [
"70"
],
"nozzle_temperature": [
"245"
],
"nozzle_temperature_initial_layer": [
"250"
],
"nozzle_temperature_range_high": [
"270"
],
"nozzle_temperature_range_low": [
"230"
],
"overhang_fan_speed": [
"90"
],
"overhang_fan_threshold": [
"10%"
],
"slow_down_layer_time": [
"12"
],
"textured_plate_temp": [
"70"
],
"textured_plate_temp_initial_layer": [
"70"
]
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Qidi",
"version": "02.04.00.17",
"version": "02.04.00.18",
"force_update": "0",
"description": "Qidi configurations",
"machine_model_list": [
@@ -57,7 +57,7 @@
"support_bottom_z_distance": "0.12",
"support_threshold_angle": "20",
"support_top_z_distance": "0.12",
"top_color_penetration_layers": "7",
"top_color_penetration_layers": "5",
"top_shell_layers": "5",
"top_shell_thickness": "0.6",
"top_surface_speed": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Snapmaker",
"version": "02.04.00.18",
"version": "02.04.00.19",
"force_update": "0",
"description": "Snapmaker configurations",
"machine_model_list": [
@@ -112,5 +112,7 @@
"600",
"100",
"600"
]
],
"top_color_penetration_layers": "7",
"bottom_color_penetration_layers": "5"
}
@@ -24,6 +24,7 @@
"Snapmaker A350 Dual QS+B Kit (0.2 nozzle)"
],
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"bridge_flow": "1",
"initial_layer_line_width": "0.25",
"initial_layer_print_height": "0.1",
@@ -35,6 +36,7 @@
"sparse_infill_line_width": "0.22",
"support_line_width": "0.22",
"top_shell_layers": "7",
"top_color_penetration_layers": "5",
"top_surface_line_width": "0.22",
"wall_loops": "4",
"initial_layer_speed": "40",
@@ -8,6 +8,7 @@
"Snapmaker Artisan (0.2 nozzle)"
],
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"bridge_flow": "1",
"initial_layer_line_width": "0.25",
"initial_layer_print_height": "0.1",
@@ -19,6 +20,7 @@
"sparse_infill_line_width": "0.22",
"support_line_width": "0.22",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"top_surface_line_width": "0.22",
"wall_loops": "4",
"initial_layer_infill_speed": "70",
@@ -9,6 +9,7 @@
"Snapmaker J1 (0.2 nozzle)"
],
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"bridge_flow": "1",
"initial_layer_line_width": "0.25",
"initial_layer_print_height": "0.1",
@@ -20,6 +21,7 @@
"sparse_infill_line_width": "0.22",
"support_line_width": "0.22",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"top_surface_line_width": "0.22",
"wall_loops": "4",
"initial_layer_infill_speed": "80",
@@ -91,5 +91,7 @@
"500",
"120",
"500"
]
],
"top_color_penetration_layers": "7",
"bottom_color_penetration_layers": "5"
}
@@ -24,6 +24,7 @@
"Snapmaker A350 Dual QS+B Kit (0.4 nozzle)"
],
"bottom_shell_layers": "7",
"bottom_color_penetration_layers": "3",
"bridge_flow": "1",
"elefant_foot_compensation": "0.15",
"ironing_flow": "8%",
@@ -31,6 +32,7 @@
"initial_layer_print_height": "0.1",
"support_threshold_angle": "15",
"top_shell_layers": "9",
"top_color_penetration_layers": "5",
"gap_infill_speed": "85",
"initial_layer_infill_speed": "65",
"inner_wall_speed": "120",
@@ -9,6 +9,7 @@
"Snapmaker Artisan (0.4 nozzle)"
],
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"bridge_flow": "1",
"elefant_foot_compensation": "0.15",
"ironing_flow": "8%",
@@ -16,6 +17,7 @@
"initial_layer_print_height": "0.1",
"support_threshold_angle": "15",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"initial_layer_infill_speed": "80",
"inner_wall_speed": "145",
"internal_solid_infill_speed": "150"
@@ -9,6 +9,7 @@
"Snapmaker J1 (0.4 nozzle)"
],
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"bridge_flow": "1",
"elefant_foot_compensation": "0.15",
"ironing_flow": "8%",
@@ -16,6 +17,7 @@
"initial_layer_print_height": "0.1",
"support_threshold_angle": "15",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"initial_layer_infill_speed": "80",
"inner_wall_speed": "145",
"internal_solid_infill_speed": "150"
@@ -93,5 +93,7 @@
"600",
"450",
"600"
]
],
"top_color_penetration_layers": "8",
"bottom_color_penetration_layers": "6"
}
@@ -112,5 +112,7 @@
"600",
"100",
"600"
]
],
"top_color_penetration_layers": "7",
"bottom_color_penetration_layers": "5"
}
@@ -134,5 +134,7 @@
"Direct Drive High Flow",
"Direct Drive Standard",
"Direct Drive High Flow"
]
],
"top_color_penetration_layers": "8",
"bottom_color_penetration_layers": "6"
}
@@ -91,5 +91,7 @@
"500",
"120",
"500"
]
],
"top_color_penetration_layers": "7",
"bottom_color_penetration_layers": "5"
}
@@ -112,5 +112,7 @@
"600",
"100",
"600"
]
],
"top_color_penetration_layers": "7",
"bottom_color_penetration_layers": "5"
}
@@ -27,7 +27,9 @@
"initial_layer_print_height": "0.1",
"wall_loops": "4",
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "7",
"top_color_penetration_layers": "5",
"bridge_flow": "1",
"line_width": "0.22",
"outer_wall_line_width": "0.22",
@@ -12,7 +12,9 @@
"initial_layer_print_height": "0.1",
"wall_loops": "4",
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "7",
"top_color_penetration_layers": "5",
"bridge_flow": "1",
"line_width": "0.22",
"outer_wall_line_width": "0.22",
@@ -12,7 +12,9 @@
"initial_layer_print_height": "0.1",
"wall_loops": "4",
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "7",
"top_color_penetration_layers": "5",
"bridge_flow": "1",
"line_width": "0.22",
"outer_wall_line_width": "0.22",
@@ -93,5 +93,7 @@
"500",
"120",
"500"
]
],
"top_color_penetration_layers": "7",
"bottom_color_penetration_layers": "5"
}
@@ -26,8 +26,10 @@
"layer_height": "0.12",
"initial_layer_print_height": "0.2",
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"elefant_foot_compensation": "0.15",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"top_shell_thickness": "0.6",
"bridge_flow": "1",
"support_threshold_angle": "20",
@@ -10,8 +10,10 @@
],
"layer_height": "0.12",
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"elefant_foot_compensation": "0.15",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"top_shell_thickness": "0.6",
"bridge_flow": "1",
"support_threshold_angle": "20",
@@ -10,8 +10,10 @@
],
"layer_height": "0.12",
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"elefant_foot_compensation": "0.15",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"top_shell_thickness": "0.6",
"bridge_flow": "1",
"support_threshold_angle": "20",
@@ -94,5 +94,7 @@
"500",
"200",
"500"
]
],
"top_color_penetration_layers": "8",
"bottom_color_penetration_layers": "6"
}
@@ -135,5 +135,7 @@
"Direct Drive High Flow",
"Direct Drive Standard",
"Direct Drive High Flow"
]
],
"top_color_penetration_layers": "8",
"bottom_color_penetration_layers": "6"
}
@@ -91,5 +91,7 @@
"500",
"120",
"500"
]
],
"top_color_penetration_layers": "6",
"bottom_color_penetration_layers": "4"
}
@@ -27,7 +27,9 @@
"initial_layer_print_height": "0.2",
"wall_loops": "4",
"bottom_shell_layers": "5",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "7",
"top_color_penetration_layers": "5",
"bridge_flow": "1",
"line_width": "0.22",
"outer_wall_line_width": "0.22",
@@ -11,7 +11,9 @@
"layer_height": "0.14",
"wall_loops": "4",
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"bridge_flow": "1",
"line_width": "0.22",
"outer_wall_line_width": "0.22",
@@ -11,7 +11,9 @@
"layer_height": "0.14",
"wall_loops": "4",
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"bridge_flow": "1",
"line_width": "0.22",
"outer_wall_line_width": "0.22",
@@ -91,5 +91,7 @@
"500",
"120",
"500"
]
],
"top_color_penetration_layers": "6",
"bottom_color_penetration_layers": "4"
}
@@ -135,5 +135,7 @@
"Direct Drive High Flow",
"Direct Drive Standard",
"Direct Drive High Flow"
]
],
"top_color_penetration_layers": "6",
"bottom_color_penetration_layers": "4"
}
@@ -27,6 +27,7 @@
"initial_layer_print_height": "0.2",
"elefant_foot_compensation": "0.15",
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"top_shell_thickness": "0.6",
"bridge_flow": "1",
"support_threshold_angle": "25",
@@ -41,5 +42,6 @@
"overhang_2_4_speed": "30",
"overhang_3_4_speed": "10",
"ironing_speed": "30",
"support_speed": "100"
"support_speed": "100",
"top_color_penetration_layers": "4"
}
@@ -11,7 +11,9 @@
"layer_height": "0.16",
"elefant_foot_compensation": "0.15",
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"top_shell_thickness": "0.6",
"bridge_flow": "1",
"support_threshold_angle": "25",
@@ -11,7 +11,9 @@
"layer_height": "0.16",
"elefant_foot_compensation": "0.15",
"bottom_shell_layers": "4",
"bottom_color_penetration_layers": "3",
"top_shell_layers": "5",
"top_color_penetration_layers": "5",
"top_shell_thickness": "0.6",
"bridge_flow": "1",
"support_threshold_angle": "25",
Loaded 100 of 306 files, more files were not shown because too many files have changed in this diff. Show more