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

Add engine version number to resource, scene, and import files #4534

Open
lyuma opened this issue May 13, 2022 · 3 comments
Open

Add engine version number to resource, scene, and import files #4534

lyuma opened this issue May 13, 2022 · 3 comments

Comments

@lyuma
Copy link

lyuma commented May 13, 2022

Describe the project you are working on

Pipeline tools for Godot, as part of V-Sekai, to import assets and allow in-editor creation of Godot-native assets.

Describe the problem or limitation you are having in your project

When engine upgrades occur, there is a risk of default property values being changed.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Godot-native formats should include the engine version (major, minor, patch, extra) which produced the asset.

Currently, changes to default values in the engine will lose information since the old default value is not stored anywhere. Sometimes the new default value is desired, but other times, it will have a significant change to appearance that would cause existing assets to break. In this case, it may be helpful to know the last version of the engine the file was serialized on, in order to use older default values.

It may also be useful for project migration tools, such as [godotengine/godot#51950] to know the previous version of the editor in order to make a more accurate conversion.

There is a similar proposal here ( #4355 ) for project.godot itself, but there may be cases where the project and the assets are imported separately, such as via the Asset Lib

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The idea is to add the editor_version to files when saving them, and pass the data into resources when constructing it from serialized values. The information need only be saved once per file. Some optimization could be made to exclude this string from .pck files if size is a problem.

This includes .tres

[gd_resource type="Environment" load_steps=3 format=2 editor_version="4.0.alpha.custom_build [123456789]"]

and .tscn

[gd_scene load_steps=3 format=2 editor_version="4.0.999.stable"]

(there would need to be a change to .res and .scn to add editor version here, too.)

as well as *.import files:

[remap editor_version="4.0.alpha999"]

There's a question about whether it would be helpful for other Godot-native formats, such as shaders or GDScript, to include a line @editor_version("4.0.alpha.custom_build [123456789]") in case porting tools can use this information to upgrade scripts during engine changes, but I am more skeptical that this will provide enough value to be worth the clutter.

If it's simpler, it could also be added as a separate property under the first line, like:

[gd_scene load_steps=3 format=2]
editor_version="4.0.999.stable"

If this enhancement will not be used often, can it be worked around with a few lines of script?

A script would not be able to add this data into all resources and nodes, including built-in types.

Is there a reason why this should be core and not an add-on in the asset library?

it affects ResourceLoader and ResourceSaver, which are core.

@me2beats
Copy link

me2beats commented Jun 4, 2022

Are there cases when you don't want to have engine version in resource files?
For example you have a lot of resources and this line adds some megabytes and you don't want it

@Zireael07
Copy link

@me2beats: The engine version would be just a single line, and if size were an issue, it could be encoded not as string but as e.g. hex to make the size even less of an issue.

@akien-mga
Copy link
Member

We discussed this in a PR review meeting, and the amount of noise generated by including this information in all resources doesn't seem to be worth the described use case. VCS history will be a mess if all files change every time you open the project in a new build (which can happen several times per day if you compile from the master branch).

We could save less information (e.g. only major.minor) but that still changes all files to add information which in most situations is not really needed.

#4355 suggests to add this information only to project.godot, and this was actually done (at least partially) by godotengine/godot#31171, so I think this would be sufficient.

What could be useful to ensure that all files are tracking the same engine version as documented by project.godot would be a way to easily load and save all resources from the editor. When porting projects to new versions of the engine I often spend some time opening and save all scenes (and thus all dependent resources) to include all the non-destructive changes done by a newer Godot version (e.g. often removing some unmodified properties from text resources).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

5 participants