-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Adding a sound to a SampleLibrary causes the whole list to appear in diff #6527
Comments
That's not really a bug, but a feature. The samples are listed alphabetically, which allows to enforce some consistency. Previously, this ordering was not enforced and the resources would get assigned a new ID every now and then based on whatever dark magic the filesystem timestamps did with Godot. |
Well, they are alphabetically ordered in this diff, and it could have made only one line to change, which is correct. However what's causing all the diffs is the fact every ID has changed. As far as I understand the goal of TSCN, I don't really care what the ID is as long as it's unique within the file, it should just not change and shift like that everytime one item is added. Another practical example: sometimes I make changes to a scene or resource, but I only want to commit part of it and leave the rest for further commits. But I often cannot do that because the other changes caused lots of other places to change as well, even if they could be left unchanged by setting correct IDs. Not to mention merging scenes :p |
But that's the point: they are ordered alphabetically, and their ID depends on the order. So the ID must change for all of them. Basically Godot reads the tscn, handles data internally, and then outputs a new tscn when you save. It doesn't (so far) read the previous file to try to keep the same arbitrary order as previously, it just creates a new file with the order it's designed to use. |
Will (biggest_id + 1) to create new ids solve this problem? |
As I mentioned right above, this would imply not saving scenes but merging the new scene state with the existing scene. So you'd get a different output when saving as a new scene and when overwriting an existing scene. |
Well, this is how Godot works, but it's not really how TSCN was advertised. It's meant to be human-readable and friendly to version control. However version control doesn't seem to be that true. In the current case of unstable IDs like now, it makes it more difficult to guarantee diffs will represent what actually changed. @hubbyist this would solve how you generate new IDs, but it won't guarantee to save objects with the same ID as before. Currently it's using the order in which items are serialized, which guarantees unicity, but not stability. |
Will making ids a property of resource and keeping track of them and using (biggest_id + 1) just work? Or will this complicate things further? After all they seem to me working as a sorting order rather than ids in the current situation. Maybe base64 encoded representation of file hash may work. But not sure about the performance impact. |
When reading a .tscn file, here is what I found: load_steps is also increased to match how many [sections] there are in the file. But I don't understand why, can't the parser already detect that amount? Next, I see IDs are the only way internal resources can be identified. However in the case of external resources, IDs are only indirections to avoid writing the path directly. Both can collision but it doesn't matters because they are differenciated with ExtResource or SubResource. External resources: Internal resources: The latter is actually better for external resources too, because it maintains IDs and it won't cause existing resources to be saved with lots of changes. It doesn't breaks compatibility, it relies on something Godot might already have (metadata) and as such, can be stripped in release builds because we use SCN to focus on performance instead of dev workflow. |
Would it help if we use the path's hash as id, instead of some sequential id? |
No longer relevant in master as SampleLibrary is no more. But is it still reproducible in 2.1? |
It still happens in 2.1.5 rc1. |
The 2.1 branch is no longer actively worked on by engine developers, unless critical fixes are needed for current games in production. As such we are now closing non-critical bug reports affecting only the 2.1 branch. Please comment if this was incorrectly triaged and is still relevant in 3.x versions. |
Random diffs due to adding or removing resources to a scene might still happen in master because I don't recall that this logic was ever changed. |
There were some changes done in 3.0, and though I believe not all cases might be fixed, it's probably better covered in a new issue about what happens in 3.1-alpha, if anything. |
Godot 2.1, Windows 10 64 bits
I added a sound to a SampleLibrary, but looking at my git diff I see the whole SampleLibrary list has been modified, and it's hard to see what I changed.
(and more)
Note: this is only one part of the diff, there are tons of other places I can see modifications that don't actually do anything besides swapping IDs or lines.
The text was updated successfully, but these errors were encountered: