Skip to content

Preserve linked component materials and appearances (#7609) - #7616

Merged
bherbruck merged 4 commits into
tangency-labs:mainfrom
amolinari-autotex:fix/linked-body-properties-20261027
Oct 28, 2026
Merged

bherbruck merged 4 commits into
tangency-labs:mainfrom
amolinari-autotex:fix/linked-body-properties-20261027

Conversation

@amolinari-autotex

@amolinari-autotex amolinari-autotex commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7609.

Changes a default: no

Change

Insert Design keeps the source body's physical material and its design-owned material definition. A 10 mm steel cube now remains 1,000 mm³ and 7.85 g after insertion and cold reopen, instead of being measured as Default material at 1.29 g.

The transfer also keeps explicit body/component color, opacity and scalar PBR settings. It applies properties to the actual imported body names after collision resolution. Custom materials with conflicting names get separate definitions; equal density alone does not make differently named materials interchangeable.

Update Links propagates source-only material/appearance edits even when the geometry is unchanged. Last-inherited values and a compact custom-material fingerprint distinguish those edits from local assembly overrides, which remain intact. The baseline survives Save As and relink. Old links recover missing assignments on Update Links while keeping explicit assignments.

One pending-format note records the new link baseline. Full engineering cards remain in the design's material library, not duplicated per body. The two UI test-file edits only adapt DesignLink fixture constructors. A static path-safety test now handles Windows CRLF when finding its test-module boundary.

The kernel, geometry conversion, renderer, material catalogue and dependencies are unchanged.

Validation

  • The initial three regression tests failed before the fix with Default / 1.29 in place of the source material.
  • 29 focused engine/link tests pass, including eight new property regressions: insert/reopen and body-name collisions; source edits/local overrides and undo/redo; conflicting custom definitions; property-only density updates; body color/opacity/scalar PBR and face color/opacity; Save As/relink; old-link repair; distinct custom names with equal properties.
  • The cube's volume remains 1,000 mm³. Steel is 7.85 g; Aluminum and custom-density cases are also asserted. These are exact document/engine readbacks, not visual inference.
  • Formatting and git diff whitespace checks pass.
  • Engine Clippy passed with all warnings denied except dead_code, allowed for two pre-existing Windows warnings (slicers::Bus variants and mesh_convert::CHOSEN_PROGRAMS). This is not an unqualified strict-Clippy pass.

Commands were run through the existing supervised ci-profile environment with --locked:

cargo test -p solidcraft-engine --lib --profile ci --locked -- cmd::component_link:: cmd::design_link:: --skip jointed_linked_arms_stay_together_through_update_links --test-threads=1
cargo clippy -p solidcraft-engine --lib --tests --profile ci --locked -- -D warnings -A dead_code

The heavy joint matrix was explicitly skipped. Full workspace CI, wasm and UI test suites were not run. Appearance coverage verifies stored/evaluated properties through cold reopen. Native app captures below additionally show body/face colors and the physical-property readout. Scalar PBR preservation is verified by API readback; per-face PBR is not claimed.

Native app evidence

Captured from the exact published head 0a0af2def2739e84d69fb00f975d84e6d0e504ef, built through the existing supervised ci-profile environment (desktop app build passed). The test used isolated diagnostic app profiles and only a synthetic 10 × 10 × 10 mm cube.

  1. Create the cube, assign Steel, set an explicit blue body look (RGB 35,105,180; opacity 1; metallic 0.8, roughness 0.23, IOR 1.5) and an orange top-face look (RGB 235,95,35; opacity 0.65), then save the source design.
  2. Insert that file into a new design as a linked component and inspect Properties.
  3. Save the assembly, close the diagnostic app, start a fresh isolated app process, reopen the assembly and inspect Properties again.

Source, insertion and fresh-process reopen all report Steel / 7.85 g/cm³ / 7.85 g / 1,000 mm³, with a 10 × 10 × 10 mm bounding box. The window captures show the same blue sides and orange top. The API readback also retains the complete body PBR values and top-face opacity (0.649999976, within 1e-6 of 0.65).

Source design

Source: synthetic Steel cube, 7.850 g and 1000 mm³, blue body and orange top

Linked insertion

Fixed linked insertion: Steel, 7.850 g and 1000 mm³ with the source appearance retained

Saved assembly reopened in a fresh app process

Fresh-process reopen: linked Steel component retains 7.850 g, 1000 mm³ and appearance

These are actual unedited native app captures. The failure on official 0.24.0 is documented numerically in #7609; these images show the fixed source/insertion/reopen sequence. They do not claim a before/after renderer benchmark or per-face PBR coverage. The user's installed app, documents and profiles were not used.

Integration status

Rebased without conflicts onto main 9cba66c. Focused tests were repeated after integration on head 0a0af2def2739e84d69fb00f975d84e6d0e504ef: 29 passed, 0 failed (3.76 seconds). The earlier Clippy result is from the pre-rebase fix tree; the Git contents of this PR's eight changed files are identical before and after the rebase (checkout line endings were normalized).

Checked every page of the open issue/PR lists before publication. No equivalent linked-material fix was found. Related work is separate: #5674 optimizes Update Links, #5449 shares linked-design loading/path-state handling, and #3512 handles cross-design copy/paste. #5674 and #5449 overlap component_link.rs and should preserve the property transfer/baseline when integrating whichever lands second.

@github-actions github-actions Bot added area:doc timeline, components, parameters, naming area:ui desktop/web front end, dialogs, viewport labels Oct 27, 2026
@amolinari-autotex
amolinari-autotex marked this pull request as ready for review October 27, 2026 11:53
@bherbruck bherbruck added ready to merge reviewed, every ask addressed; merge once CI is green approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) and removed approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Oct 27, 2026
@bherbruck
bherbruck enabled auto-merge October 27, 2026 12:36
@bherbruck
bherbruck added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 27, 2026
@bherbruck
bherbruck added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 27, 2026
@bherbruck
bherbruck force-pushed the fix/linked-body-properties-20261027 branch from 0a0af2d to bea1c6c Compare October 27, 2026 19:57
@amolinari-autotex
amolinari-autotex force-pushed the fix/linked-body-properties-20261027 branch from bea1c6c to f67931b Compare October 28, 2026 09:16
@bherbruck
bherbruck added this pull request to the merge queue Oct 28, 2026
Merged via the queue into tangency-labs:main with commit 54f613e Oct 28, 2026
21 checks passed
flukejones added a commit to flukejones/solidcraft that referenced this pull request Nov 6, 2026
Extend tangency-labs#1386 imported components and tangency-labs#3221 source storage with verified exact STEP sharing, selected source bodies and compact sibling groups. Preserve part identities, appearances and independent-copy references while sharing preparation and display geometry. Reuse tangency-labs#7380 indexed world naming and retain tangency-labs#6406 placement reuse.

Retain tangency-labs#6527 placement checks and tangency-labs#5674 linked-design caching through shared source identities and cached fingerprints. Preserve tangency-labs#7616 inherited materials and appearances when links reuse cached geometry.

Use tangency-labs#7565's configurable payload limits and ZIP64 entries for shared sources.

Preserve tangency-labs#3512's borrowed cross-design copy source and tangency-labs#8316's copied joint identities when making a placement independent.

Keep tangency-labs#9116's saved placement ordering when grouping imported instances.

Carry StepSource through tangency-labs#9753's linked-design read helper.

Retain tangency-labs#10101's mirrored-part mesh reuse alongside shared imported sources.

Use tangency-labs#11351's native kernel API and tangency-labs#10274's staged opening for shared sources and selected bodies, retaining source cache identities.

Use tangency-labs#11496's record vectors and geometry traits for shared meshes and independent copies.

Related to:
- tangency-labs#1386
- tangency-labs#2814
- tangency-labs#3221
- tangency-labs#3512
- tangency-labs#7380
- tangency-labs#6406
- tangency-labs#6527
- tangency-labs#5674
- tangency-labs#7565
- tangency-labs#7616
- tangency-labs#8316
- tangency-labs#9116
- tangency-labs#9753
- tangency-labs#10101
- tangency-labs#10274
- tangency-labs#11351
- tangency-labs#11496

Co-authored-by: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) area:doc timeline, components, parameters, naming area:ui desktop/web front end, dialogs, viewport ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linked components lose physical materials when inserting a saved design

2 participants