The problem that the icon of the Windows version exported by Godot is not replaced

question

Use Godot Editor to export the Windows version of the project. Although the rcedit tool and the self-made Windows program icon are set , the icon of the exported project executable file has not been replaced.
rceidt
windows_native_icon

Investigation process and resolution

Open the project executable file with Visual Studio and you can confirm that the icon name used by the program is "GODOT_ICON".
The string "GODOT_ICON" only appears in the godot\platform\windows\godot_res.rc file:
Insert image description here
This confirms that Godot did not use the rcedit tool to replace Godot's default icon with the set custom icon when exporting the Windows version.
Continue to investigate the reason why Godot does not call the rcedit tool.
The string "Rcedit" only appears in godot\platform\windows\export\export.cpp:

Error EditorExportPlatformWindows::modify_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
    
    
	if (p_preset->get("application/modify_resources")) {
    
    
		_rcedit_add_data(p_preset, p_path);
	}
	return OK;
}

Error EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
    
    
...
		add_message(EXPORT_MESSAGE_WARNING, TTR("Resources Modification"), TTR("Could not start rcedit executable. Configure rcedit path in the Editor Settings (Export > Windows > Rcedit), or disable \"Application > Modify Resources\" in the export preset."));
...

bool EditorExportPlatformWindows::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
    
    
...
	if (p_preset->get("application/modify_resources") && rcedit_path.empty()) {
    
    
		err += TTR("The rcedit tool must be configured in the Editor Settings (Export > Windows > Rcedit) to change the icon or app information data.") + "\n";
	}

This information explains: In addition to configuring the rcedit tool, you must also ensure that the "Application > Modify Resources" (application/modify_resources) switch is turned on.
Find the application/modify_resources switch:
windows_export
By the way, change the value of the "Application->Icon" attribute below.

After modification, export again and check in the resource manager: the program icon is not updated; use Visual Studio to open the exe file and check that the program icon has indeed been changed, indicating that the previous modifications have indeed taken effect.
Considering that the program icon displayed by the resource manager may be cached, log out and log in again. This time, select a different way of "View" in the pop-up menu of the resource manager. In addition to "Extra Large Icon" and "Large Icon", other viewing methods The icon display has been updated.
Considering that oversized icons and large icons may take longer to cache, ignore them for now. Watch it again after nap, done!

Guess you like

Origin blog.csdn.net/feiyunw/article/details/127670120