-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Cleanup tiles outside the texture #77986
Cleanup tiles outside the texture #77986
Conversation
Hmm, sorry but I don't think this is the correct way to solve the bug. The whole API was meant to automatically remove tiles that are outside the texture (basically, if you reduce the texture size, tiles get deleted). You can have a look to So the bug should likely be instead of fixing it that way. |
This bug happens when a texture is updated externally. I thought that user might want to avoid data loss, hence the option. I'll try to make it automatic. Still, there could be some corner cases where you might end up with invalid outside tiles and right now there is no way to remove them other than editing the tileset manually (which might be binary). I think the option is useful anyway. |
I guess we should connect to the I'd rather not show the option if we can, a "fix bug" button isn't really the best IMO... But I guess, that, if this happens again for whatever reason, we should probably run this function internally from time to time (like when opening the atlas editor or something like that). |
bfde195
to
846695e
Compare
Ok I removed the option. The editor will do a sweep of invalid tiles when setting tileset + it connects to texture's |
Ah, that's was not what I really meant, sorry. Part of this should likely be done in the TileSetAtlasSource code itself, not in the editor. A bit like how it is already done to updated the padded texture:
That being said, it likely would make it quite difficult for the editor to save the tiles before the texture is reduced in size (for undo-redo). Which might be a big problem. I could manage to save tiles before deletion when the source itself was modified, but for sub-resources, I have no clue if that is possible. So, in the end, I wonder if we should not modify the editor so that an atlas can have tiles outside of it's texture, and users would be able to clean them manually. But that's a lot of work... I guess I can only see those solutions:
|
But the tile cleanup is a costly operation and the problem is editor-only. |
Not really. If you modify the texture in game code, the tiles outside the texture will still be there, while they are not really supposed to. That's why the I am thinking that maybe a solution would be the following:
|
846695e
to
50185ad
Compare
Done requested changes. The user is notified by the toaster: godot.windows.editor.dev.x86_64_MpMikqsP0Q.mp4I didn't do the |
50185ad
to
996ae81
Compare
7ad3662
to
4b685df
Compare
cc @groud could you give it a review? |
The message should not be spawned by the Toaster, but displayed as a warning sign with a tooltip somewhere in the atlas editor (maybe in the toolbar ?). Because the toaster messages will disappear after a little while.
Part of the role of With your changes, |
so whats up? will it merged? |
@Isenther If it is approved. See the comment directly above yours. |
You mean the warning should be displayed permanently until you clear the tiles?
Not sure which code do you mean exactly. |
This can be removed:
|
What about my other question? >_> |
Yes |
4b685df
to
52588aa
Compare
tool_advanced_menu_button->get_popup()->connect("id_pressed", callable_mp(this, &TileSetAtlasSourceEditor::_menu_option)); | ||
tool_settings->add_child(tool_advanced_menu_button); | ||
|
||
outside_tiles_warning_label = memnew(Label); | ||
outside_tiles_warning_label->set_text(TTR("The current atlas source has tiles outside the texture.") + " (?)"); | ||
outside_tiles_warning_label->set_tooltip_text(TTR("You can clear it using \"Remove Tiles Outside the Texture\" option in 3 dots menu.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's technically called a "kebab menu", but I don't know how widespread this term is for neophytes. So "3 dots" might be fine.
outside_tiles_warning_label->set_tooltip_text(TTR("You can clear it using \"Remove Tiles Outside the Texture\" option in 3 dots menu.")); | |
outside_tiles_warning_label->set_tooltip_text(TTR("You can clear it using the \"Remove Tiles Outside the Texture\" option in the 3 dots menu.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could possibly also do this if we want to make sure translators don't mistakenly translate this differently in the menu and in the tooltip. But on the other hand it makes the sentence slightly harder to understand when translating.
outside_tiles_warning_label->set_tooltip_text(TTR("You can clear it using \"Remove Tiles Outside the Texture\" option in 3 dots menu.")); | |
outside_tiles_warning_label->set_tooltip_text(vformat(TTR("You can clear it using the \"%s\" option in the 3 dots menu."), TTR("Remove Tiles Outside the Texture"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's technically called a "kebab menu", but I don't know how widespread this term is for neophytes. So "3 dots" might be fine.
There is a vertical ellipsis unicode character: ⋮
I could use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use U"..."
for Unicode strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also did the vformat change for the option name, but it still has a risk of the text not being updated if the option is renamed.
At first I tried using the full text, but then moved half of it into the tooltip. Now it's actually small. |
52588aa
to
52d41cc
Compare
Thanks! |
Closes #61296