Skip to content

FTI - Change SceneTree global setting to static #107886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025

Conversation

lawnjelly
Copy link
Member

Also fixup FTI configuration warnings so that they only output when the project is using FTI.

@BastiaanOlij noticed that some FTI configuration warnings were firing when FTI was off in the project.
This happened because checking whether FTI was on in the editor was previously unsupported (as it was hard coded to OFF).

I had also been long term intending to swap using a local variable for global on / off in SceneTree to a static, the reason being that it would no longer be necessary to check is_inside_tree() and access the variable via a pointer, for what is likely to be a bottleneck check (and the global setting hardly ever changes, so a static makes sense here).

So I take the opportunity to swap both the global setting to a static, and add an extra one for checking the on / off setting within the editor (while not actually enabled the FTI functionality).

This enables us to check the project global setting before issuing configuration warnings, without having to use e.g. GET_GLOBAL_CACHED(), which isn't a particularly good way of doing this here due to the string duplication.

Notes

  • Also applicable to 3.x.
  • I also want to actually get an MRP for the scene tree that caused this warning, just in case there is some pattern used in XR that won't well with the FTI, but that is a separate issue.

Also fixup FTI configuration warnings so that they only output when the project is using FTI.
@@ -216,7 +216,7 @@ void Light2D::_notification(int p_what) {
} break;

case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: {
if (is_visible_in_tree() && is_physics_interpolated()) {
if (is_visible_in_tree() && is_physics_interpolated_and_enabled()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few misc cases like this in the PR.

is_physics_interpolated_and_enabled() is now cheaper as a result of doing the static change (as there's no pointer lookup etc), so it makes sense to check the full version in a few more places.

@BastiaanOlij
Copy link
Contributor

@lawnjelly this is the demo project I was using to create the documentation I mentioned about yesterday.
godotengine/godot-demo-projects#1218

Copy link
Contributor

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, makes sense that we only provide warnings for potential misconfiguration for FTI only if its enabled.

@lawnjelly
Copy link
Member Author

Approvals also welcome for #107889 which is the same, so I can merge in 3.x.

@Repiteo Repiteo merged commit b93719c into godotengine:master Jun 24, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jun 24, 2025

Thanks!

@lawnjelly lawnjelly deleted the fti_global_setting_static branch June 24, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants