Skip to content

fix(truepbr): remove aggressive MATO clearing#2286

Merged
alandtse merged 1 commit into
community-shaders:devfrom
soda3000:dev-04-05-2026
May 6, 2026
Merged

fix(truepbr): remove aggressive MATO clearing#2286
alandtse merged 1 commit into
community-shaders:devfrom
soda3000:dev-04-05-2026

Conversation

@soda3000
Copy link
Copy Markdown
Contributor

@soda3000 soda3000 commented May 5, 2026

Previous PR#2046 included a broken commit (4d07fa0) that resulted in the original fix commit (e32cfb5) not functioning as expected. This change removes the problematic branch and restores the fix to functional state.

Summary by CodeRabbit

  • Bug Fixes
    • Improved physically-based rendering material handling during object cloning to prevent unintended data corruption and enhance performance by eliminating unnecessary clearing operations.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

📝 Walkthrough

Walkthrough

Modified TESObjectSTAT::Clone3D hook to change null pbrData handling: non-null case applies PBR material data with fork-before-write logic; null case now becomes a no-op instead of clearing previously-applied MATO from geometries.

Changes

PBR Material Data Cloning Behavior

Layer / File(s) Summary
Control Flow & Documentation
src/TruePBR.cpp (lines 1337–1344)
Inline documentation clarified to show null pbrData is now a no-op, while non-null case applies MATO to lighting-vertex-lit geometries.
Fork-Before-Write Logic
src/TruePBR.cpp (lines 1342–1387)
Preserved conditional cloning of BSLightingShaderMaterialPBR when target material is owned by a different ref and incoming MATO differs; applies material object data and updates ownership tracking.
Null Case Removal
src/TruePBR.cpp (lines 1387–1390)
Removed else branch that cleared MATO (ClearMaterialObjectData()) and reset ownership metadata when pbrData == nullptr.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • doodlum

Poem

🐰 Materials dance with brands new code,
Fork before we write our load,
Null now rests without a care,
No clearing brushes through the air!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The PR title clearly summarizes the main change: removing aggressive MATO clearing behavior from the TruePBR code. The title accurately reflects the primary modification documented in the raw summary and aligns with the PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

No actionable suggestions for changed features.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

✅ A pre-release build is available for this PR:
Download

@alandtse alandtse changed the title fix(truepbr): remove aggressive MATO clearing breaking previous fix fix(truepbr): remove aggressive MATO clearing May 6, 2026
@alandtse alandtse merged commit 6bd40c0 into community-shaders:dev May 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants