Create a SVG default project icon in new projects

This allows the icon's scale to be changed using the `svg/scale`
import option, including to scales greater than the default 128×128.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
This commit is contained in:
Hugo Locurcio
2022-08-19 22:48:45 +02:00
parent fafd15014f
commit 7849331ec5
4 changed files with 20 additions and 12 deletions

View File

@ -483,12 +483,20 @@ private:
project_features.sort();
initial_settings["application/config/features"] = project_features;
initial_settings["application/config/name"] = project_name->get_text().strip_edges();
initial_settings["application/config/icon"] = "res://icon.png";
initial_settings["application/config/icon"] = "res://icon.svg";
if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("project.godot"), initial_settings, Vector<String>(), false) != OK) {
set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
} else {
ResourceSaver::save(create_unscaled_default_project_icon(), dir.plus_file("icon.png"));
// Store default project icon in SVG format.
Error err;
Ref<FileAccess> fa_icon = FileAccess::open(dir.plus_file("icon.svg"), FileAccess::WRITE, &err);
fa_icon->store_string(get_default_project_icon());
if (err != OK) {
set_message(TTR("Couldn't create icon.svg in project path."), MESSAGE_ERROR);
}
EditorVCSInterface::create_vcs_metadata_files(EditorVCSInterface::VCSMetadata(vcs_metadata_selection->get_selected()), dir);
}
} else if (mode == MODE_INSTALL) {