Skip to content

Recalculate bounds when text scope changes#10369

Open
Infiland wants to merge 2 commits intoFacepunch:masterfrom
Infiland:issue-10300
Open

Recalculate bounds when text scope changes#10369
Infiland wants to merge 2 commits intoFacepunch:masterfrom
Infiland:issue-10300

Conversation

@Infiland
Copy link
Copy Markdown
Contributor

@Infiland Infiland commented Apr 5, 2026

Summary

Adding a 3d text object in a scene causes a crash after a few seconds. The crash is related to bounds where they did not recalculate previously.

Motivation & Context

Fixes #10300

Implementation Details

When updating text-related properties, replace the previous pattern match with a validity check (_so.IsValid()), assign the updated TextScope to the scene object, and call CalculateBounds(). This affects TextColor, FontSize, FontWeight, FontName and Text so that the scene object's bounds are kept in sync after scope changes.

Screenshots / Videos (if applicable)

-/-

Checklist

  • Code follows existing style and conventions
  • No unnecessary formatting or unrelated changes
  • Public APIs are documented (if applicable)
  • Unit tests added where applicable and all passing
  • I’m okay with this PR being rejected or requested to change 🙂

Fixes Facepunch#10300

When updating text-related properties, replace the previous pattern match with a validity check (_so.IsValid()), assign the updated TextScope to the scene object, and call CalculateBounds(). This affects TextColor, FontSize, FontWeight, FontName and Text so that the scene object's bounds are kept in sync after scope changes.
@aylaylay
Copy link
Copy Markdown
Contributor

aylaylay commented Apr 5, 2026

Shouldn't need to calculate bounds on TextColor change, the rest are fine

@Infiland
Copy link
Copy Markdown
Contributor Author

Infiland commented Apr 5, 2026

Shouldn't need to calculate bounds on TextColor change, the rest are fine

Done

@handsomematt handsomematt added the triaged triaged pull-requests are replicated on the internal sbox repo label Apr 5, 2026
@timmybo5
Copy link
Copy Markdown

timmybo5 commented Apr 7, 2026

Could this also fix #10162 ?

@Infiland
Copy link
Copy Markdown
Contributor Author

Infiland commented Apr 7, 2026

This PR only fixes bounds for 3D text scene objects, so it probably won't fix the UI scale clipping since that's a different code path. I can make a new PR for that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triaged triaged pull-requests are replicated on the internal sbox repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor crash when adding 3D text

4 participants