Skip to content
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

Attaching Control under Smoothing2D causes assert error: _SetProcessing(): Condition "!viewport" is true on set_as_top_level #32

Closed
hsandt opened this issue May 3, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@hsandt
Copy link

hsandt commented May 3, 2023

I know it's not common to attach a Control of a PhysicsBody2D, but I have a local HUD displaying life gauge near attached to my CharacterBody2D so it's convenient, and I need to smooth it or it will jitter relatively to my smoother character sprite.

(usually I'd use a Canvas Layer and manually move the gauge to match character, but it's more complex)

When you do so, you get a double assert error on start: _SetProcessing(): Condition "!viewport" is true on set_as_top_level:

Godot code:

func _SetProcessing():
	var bEnable = _TestFlags(SF_ENABLED)
	if _TestFlags(SF_INVISIBLE):
		bEnable = false

	set_process(bEnable)
	set_physics_process(bEnable)

	set_as_top_level(_TestFlags(SF_GLOBAL_OUT))  # here

Callstack:

E 0:00:01:0024 smoothing_2d.gd:110 @ _SetProcessing(): Condition "!viewport" is true.
<C++ Source> scene/gui/control.cpp:2984 @ _notification()
smoothing_2d.gd:110 @ _SetProcessing()
smoothing_2d.gd:57 @ @flags_setter()
smoothing_2d.gd:234 @ _ClearFlags()
smoothing_2d.gd:245 @ _ChangeFlags()
smoothing_2d.gd:121 @ _notification()

(this shows twice)

However, the Control is still smoothed correctly, although set_as_top_level failed, apparently because it's called again later.

@lawnjelly lawnjelly added the bug Something isn't working label May 5, 2023
@lawnjelly
Copy link
Owner

Could be fixed by #39, #40 , but will wait to here from OP before closing.

@hsandt
Copy link
Author

hsandt commented Oct 27, 2023

Indeed, error didn't appear as I was detaching Smoothing Node and reattaching it to an external parent node already in v1.0.3, but I also tested v1.2.1 disabling legacy toplevel and using global out with no Smoothing Node detachment at all, and it also works without error.

@hsandt hsandt closed this as completed Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants