|
@@ -910,7 +910,17 @@ void EditorNode::_notification(int p_what) {
|
|
feature_profile_manager->notify_changed();
|
|
feature_profile_manager->notify_changed();
|
|
|
|
|
|
// Save the project after opening to mark it as last modified, except in headless mode.
|
|
// Save the project after opening to mark it as last modified, except in headless mode.
|
|
|
|
+ // Also use this opportunity to ensure default settings are applied to new projects created from the command line
|
|
|
|
+ // using `touch project.godot`.
|
|
if (DisplayServer::get_singleton()->window_can_draw()) {
|
|
if (DisplayServer::get_singleton()->window_can_draw()) {
|
|
|
|
+ const String project_settings_path = ProjectSettings::get_singleton()->get_resource_path().path_join("project.godot");
|
|
|
|
+ // Check the file's size in bytes as an optimization. If it's under 10 bytes, the file is assumed to be empty.
|
|
|
|
+ if (FileAccess::get_size(project_settings_path) < 10) {
|
|
|
|
+ const HashMap<String, Variant> initial_settings = get_initial_settings();
|
|
|
|
+ for (const KeyValue<String, Variant> &initial_setting : initial_settings) {
|
|
|
|
+ ProjectSettings::get_singleton()->set_setting(initial_setting.key, initial_setting.value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
ProjectSettings::get_singleton()->save();
|
|
ProjectSettings::get_singleton()->save();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -7531,6 +7541,17 @@ void EditorNode::notify_settings_overrides_changed() {
|
|
settings_overrides_changed = true;
|
|
settings_overrides_changed = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// Returns the list of project settings to add to new projects. This is used by the
|
|
|
|
+// project manager creation dialog, but also applies to empty `project.godot` files
|
|
|
|
+// to cover the command line workflow of creating projects using `touch project.godot`.
|
|
|
|
+//
|
|
|
|
+// This is used to set better defaults for new projects without affecting existing projects.
|
|
|
|
+HashMap<String, Variant> EditorNode::get_initial_settings() {
|
|
|
|
+ HashMap<String, Variant> settings;
|
|
|
|
+ settings["physics/3d/physics_engine"] = "Jolt Physics";
|
|
|
|
+ return settings;
|
|
|
|
+}
|
|
|
|
+
|
|
EditorNode::EditorNode() {
|
|
EditorNode::EditorNode() {
|
|
DEV_ASSERT(!singleton);
|
|
DEV_ASSERT(!singleton);
|
|
singleton = this;
|
|
singleton = this;
|