-
-
Notifications
You must be signed in to change notification settings - Fork 23.4k
Fix janky scaling for controls with pivot offset. #111928
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
base: master
Are you sure you want to change the base?
Fix janky scaling for controls with pivot offset. #111928
Conversation
|
The video doesn't display what happens in the case that is referenced, can you please show how it compares when moving the pivot offset? |
|
Here's a video of the version without the workaround in which I change scale, rotate, and change the pivot offset, both with the new pivot offset ratio and the normal one. Bugpart2.mp4And here is the same messing around in the version with the janky scaling. BugPart3.mp4I see no difference between the two, except the fact that when you mess with the scale when having a pivot_offset in the old version, it jumps around. Hopefully this is what you meant, if not, let me know and I'll try again! |
|
You didn't change the offset gradually, which is what probably should cause flickering, so please check that |
|
My bad, here they are. "Old" version: BugPart4OldVersion.mp4"Fix" version: BugPart4NewVersion.mp4 |
|
I'm not sure what steps are required to replicate this but from the video I can't replicate the janky behavior, can you provide an MRP to test with or more detailed steps? You mention the video is recorded in 4.5, can you test it with |
|
Here is an MRP for Godot 4.5 stable, just select the texture rect in the scene, and gradually change its scale to see it jump around in place due to the "floor()" function call. Go to project settings and disable "snap_controls_to_pixels" and repeat the gradual scalling to see the "fixed" behavior. I did test it without my changes, and the issue was still there, but in any case, I'll provide here a video of the issue in the current master branch. BugPart5.mp4Let me know if I can provide any more info. |
|
Can confirm with that MRP, however the behavior when moving with the pivot offset tool (the 6th button in the menu) is still janky, when not using snapping, though less so than before |
|
Oh yeah, I didn't even remember about that tool, I'm guessing that looks "janky" because the pivot is snapping to the pixels, even though the controls aren't due to the disabled snap option, so when the pivot snaps to the pixel, it just moves the whole thing by "1 pixel" instead of gradually. Enabling the grid snap does the same thing but to the size of the grid sections. So I don't think there's a real issue in that case? But I could be wrong of course. |
With this "fix", I removed a workaround that was in the "Control::_update_canvas_item_transform()" function, that was making the scaling of a control node that has a pivot offset jump around, due to the "floor()" funciton being called on the position. I'll provide a video of the issue down below, which can also be "solved" by disabling "snap_controls_to_pixels" in the project settings, so the video is recorded in Godot 4.5, where I first found the issue.
I don't know what that workaround is for, after removing the line, I tried rotating, scaling and changing the pivot offset to check if there was any "flickering" as the comment above the workaround suggested, but I couldn't see anything. Maybe I'm wrong, and that workaround is very important, if that's the case, feel free to reject this pull request and I'll resign myself to disabling "snap_controls_to_pixels" as the solution.
Here is the video:
Bug.mp4
Thanks for your time, and sorry if this was unwanted.