-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[godot] SpineSprite disappears when window is resized #2119
Comments
This sometimes will cause flickering for low end PC's as well (when launching a game that contains multiple sprites in the same screen) |
Any news on the issue? |
This is a major reason why we can't use Spine for our next project. Hope this gets addressed sometime in the future. |
I was able to stop SpineSprite from disappearing when the window is resizing by using this GDScript combination. func _ready() -> void:
self.get_tree().connect( 'screen_resized', self, '_on_scene_tree_screen_resized' )
func _on_scene_tree_screen_resized() -> void:
VisualServer.force_draw()
VisualServer.render_loop_enabled = false
yield( self.get_tree(), 'idle_frame' )
VisualServer.render_loop_enabled = true |
Huh, could you explain how this works? I've tried to fix this a couple of
times now, and still don't understand why it happens in the first place.
…On Fri, Feb 3, 2023, 16:00 DASilverStraw ***@***.***> wrote:
I was able to stop SpineSprite from disappearing when the window is
resizing by using this GDScript combination.
func _ready() -> void:
self.get_tree().connect( 'screen_resized', self, '_on_scene_tree_screen_resized' )
func _on_scene_tree_screen_resized() -> void:
VisualServer.force_draw()
VisualServer.render_loop_enabled = false
yield( self.get_tree(), 'idle_frame' )
VisualServer.render_loop_enabled = true
—
Reply to this email directly, view it on GitHub
<#2119 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD5QBHRLCBXTBPSIET4GH3WVUMRJANCNFSM537YKQ7Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Right, I understand what the code itself does. But I do not understand why
it is at all necessary.
Godot's own `Sprite` for example does not suffer this deficiency. However,
I went through its code and the code of the classes it subclasses and do
not find any such resizing related "hacks".
I can't generally apply this in the Spine Godot plugin either. I guess I'll
keep digging and asking on the Godot chat how to resolve this.
…On Fri, Feb 3, 2023 at 5:23 PM DASilverStraw ***@***.***> wrote:
This GDScript was arrived from research and testing different code
combinations.
Scene Tree class has a 'screen_resized' signal. Documentation reads:
emitted when the screen resolution (fullscreen) or window size (windowed)
changes.
I tried use 'size_changed' signal from Viewport class but there was black
fickering when the window resizes.
By turning off the render loop during screen resizing, the current frame
image doesn't get erased. It alone has issues of black unrendered areas and
image freezing during screen resize.
Yield is a co-routine for pausing the function until next frame when
render loop resumes.
Force draw is called every time the Scene Tree receives the
'screen_resized' signal. Force draw takes a swap buffer boolean argument
(default true). More buffers help with the amount of force draws. I tried
using multiple force draws in the function but that resulted in rapid
flickering of the image.
I combined both force drawing and pausing the render loop until the next
frame and it seem to work.
Screen resizing emit multiple signals. As long as the signals keep being
emitted, the render loop is paused and force draws take over. If the render
loop remain active while force draws are invoked, the render loop erases
the forcibly drawn image.
I hope this helps.
—
Reply to this email directly, view it on GitHub
<#2119 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD5QBES52IORG7UQ3Q7TW3WVUWIHANCNFSM537YKQ7Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The rendering of the debug options don't seem to be affected when resizing the window. |
Spend most of the day figuring this out and finally fixed it.
I've fixed this by creating a custom That fixes this issue and likely fixes other issues yet unseen/unnoticed related to "illegally" modifying the canvas item of child nodes outside their respective |
Confirmed on Windows.
The text was updated successfully, but these errors were encountered: