godot icon indicating copy to clipboard operation
godot copied to clipboard

External shaders saved to `.gdshader` files are not converted by the project upgrade tool

Open Calinou opened this issue 2 years ago • 2 comments

Godot version

4.0.beta7

System information

Fedora 36, AMD Radeon RX 6900 XT

Issue description

External shaders saved to .gdshader files are not converted by the 3to4 conversion tool. By contrast, shaders that are built-in to a scene are converted by this tool.

Both built-in and external scripts are correctly converted by 3to4.

Steps to reproduce

  • Create a Godot 3.x project with a built-in shader on a node, and an external shader on another. In both files, use syntax that will be converted, such as uniform sampler2D some_texture : hint_albedo where hint_albedo will be converted by source_color.
  • Upgrade the project using the tool in the Godot 4.0 project manager.
  • Notice how the built-in shader is updated, but not the external shader.

Minimal reproduction project

Before conversion (3.x): test_project_3.zip

After conversion (4.0): test_project_4.zip

Calinou avatar Dec 05 '22 09:12 Calinou

I am also getting no materials in the material slot (now surface material override), so they all have to be manually reloaded. Not sure if this has been reported or not?

fracteed avatar Dec 06 '22 04:12 fracteed

I am also getting no materials in the material slot (now surface material override), so they all have to be manually reloaded. Not sure if this has been reported or not?

Please open a separate issue for this, with MRPs pre-conversion and post-conversion included.

Calinou avatar Dec 06 '22 15:12 Calinou

CC @qarmin How complex would it be to run the upgrader tool over .gdshader files as well?

clayjohn avatar Jan 26 '23 19:01 clayjohn

If I remember correctly, conversions already runs on .shader files and convert them to .gdshader with some simple renames - https://github.com/godotengine/godot/blob/44c0bfc94d81e758b39a8ee43df5915d64200ed6/editor/project_converter_3_to_4.cpp#L1400-L1416

So problem is with extension .gdshader.

If this extension is valid in 3.x, then should be added to files that will be checked for conversion here - https://github.com/godotengine/godot/blob/44c0bfc94d81e758b39a8ee43df5915d64200ed6/editor/project_converter_3_to_4.cpp#L2391

qarmin avatar Jan 26 '23 20:01 qarmin

Looks like the .gdshader extension is allows in 3.x, so this should be a simple fix https://github.com/godotengine/godot/pull/49983

clayjohn avatar Jan 26 '23 20:01 clayjohn