You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-25 15:37:42 +00:00
Use Jolt Physics by default in newly created projects
This also adds infrastructure to make specific settings the default, but only in projects created after this point (so that existing projects are not affected). This can be used for progressive upgrades in the future. This applies to both the project creation dialog and creating projects through the command line using `touch project.godot`.
This commit is contained in:
@@ -907,7 +907,17 @@ void EditorNode::_notification(int p_what) {
|
||||
feature_profile_manager->notify_changed();
|
||||
|
||||
// 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()) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -7528,6 +7538,17 @@ void EditorNode::notify_settings_overrides_changed() {
|
||||
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() {
|
||||
DEV_ASSERT(!singleton);
|
||||
singleton = this;
|
||||
|
||||
Reference in New Issue
Block a user