| 
									
										
										
										
											2023-01-05 13:25:55 +01:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*  project_settings_editor.cpp                                           */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*                         This file is part of:                          */ | 
					
						
							|  |  |  | /*                             GODOT ENGINE                               */ | 
					
						
							|  |  |  | /*                        https://godotengine.org                         */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | 
					
						
							|  |  |  | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining  */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the        */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including    */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,    */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to     */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to  */ | 
					
						
							|  |  |  | /* the following conditions:                                              */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be         */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.        */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							| 
									
										
										
										
											2018-01-05 00:50:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-19 17:00:46 -03:00
										 |  |  | #include "project_settings_editor.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-16 08:04:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-07 19:33:38 -03:00
										 |  |  | #include "core/config/project_settings.h"
 | 
					
						
							| 
									
										
										
										
											2024-11-12 09:43:29 -08:00
										 |  |  | #include "core/input/input_map.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-26 17:46:49 +02:00
										 |  |  | #include "editor/editor_node.h"
 | 
					
						
							| 
									
										
										
										
											2023-08-13 02:33:39 +02:00
										 |  |  | #include "editor/editor_string_names.h"
 | 
					
						
							| 
									
										
										
										
											2022-03-25 18:06:46 +01:00
										 |  |  | #include "editor/editor_undo_redo_manager.h"
 | 
					
						
							| 
									
										
										
										
											2023-04-12 21:02:28 +02:00
										 |  |  | #include "editor/export/editor_export.h"
 | 
					
						
							| 
									
										
										
										
											2025-05-28 09:18:32 +08:00
										 |  |  | #include "editor/gui/editor_variant_type_selectors.h"
 | 
					
						
							| 
									
										
										
										
											2025-06-10 16:47:26 +02:00
										 |  |  | #include "editor/inspector/editor_inspector.h"
 | 
					
						
							|  |  |  | #include "editor/settings/editor_settings.h"
 | 
					
						
							| 
									
										
										
										
											2024-01-15 13:14:55 +01:00
										 |  |  | #include "editor/themes/editor_scale.h"
 | 
					
						
							| 
									
										
										
										
											2022-10-05 22:42:12 +10:00
										 |  |  | #include "scene/gui/check_button.h"
 | 
					
						
							| 
									
										
											  
											
												Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
											
										 
											2022-06-17 00:55:19 +02:00
										 |  |  | #include "servers/movie_writer/movie_writer.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-02 18:56:33 +01:00
										 |  |  | void ProjectSettingsEditor::connect_filesystem_dock_signals(FileSystemDock *p_fs_dock) { | 
					
						
							|  |  |  | 	localization_editor->connect_filesystem_dock_signals(p_fs_dock); | 
					
						
							| 
									
										
										
										
											2022-05-12 15:20:12 +07:00
										 |  |  | 	group_settings->connect_filesystem_dock_signals(p_fs_dock); | 
					
						
							| 
									
										
										
										
											2022-01-02 18:56:33 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 18:10:05 +08:00
										 |  |  | void ProjectSettingsEditor::popup_project_settings(bool p_clear_filter) { | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	// Restore valid window bounds or pop up at default size.
 | 
					
						
							|  |  |  | 	Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "project_settings", Rect2()); | 
					
						
							|  |  |  | 	if (saved_size != Rect2()) { | 
					
						
							|  |  |  | 		popup(saved_size); | 
					
						
							|  |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2024-04-23 20:09:41 -04:00
										 |  |  | 		popup_centered_clamped(Size2(1200, 700) * EDSCALE, 0.8); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	_add_feature_overrides(); | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	general_settings_inspector->update_category_list(); | 
					
						
							| 
									
										
										
										
											2022-01-11 15:59:52 +02:00
										 |  |  | 	set_process_shortcut_input(true); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	localization_editor->update_translations(); | 
					
						
							|  |  |  | 	autoload_settings->update_autoload(); | 
					
						
							| 
									
										
										
										
											2022-05-12 15:20:12 +07:00
										 |  |  | 	group_settings->update_groups(); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	plugin_settings->update_plugins(); | 
					
						
							| 
									
										
										
										
											2021-02-23 14:17:42 -03:00
										 |  |  | 	import_defaults_editor->clear(); | 
					
						
							| 
									
										
										
										
											2023-03-10 18:10:05 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (p_clear_filter) { | 
					
						
							|  |  |  | 		search_box->clear(); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2023-09-25 01:09:29 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	_focus_current_search_box(); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-04-28 15:53:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | void ProjectSettingsEditor::popup_for_override(const String &p_override) { | 
					
						
							|  |  |  | 	popup_project_settings(); | 
					
						
							|  |  |  | 	tab_container->set_current_tab(0); | 
					
						
							|  |  |  | 	general_settings_inspector->set_current_section(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX + p_override.get_slicec('/', 0)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-01 13:23:04 +02:00
										 |  |  | void ProjectSettingsEditor::set_filter(const String &p_filter) { | 
					
						
							|  |  |  | 	search_box->set_text(p_filter); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::queue_save() { | 
					
						
							| 
									
										
										
										
											2025-03-08 16:26:52 +02:00
										 |  |  | 	settings_changed = true; | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	timer->start(); | 
					
						
							| 
									
										
										
										
											2019-10-06 17:13:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-08 16:26:52 +02:00
										 |  |  | void ProjectSettingsEditor::_save() { | 
					
						
							|  |  |  | 	settings_changed = false; | 
					
						
							|  |  |  | 	if (ps) { | 
					
						
							|  |  |  | 		ps->save(); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | 	if (pending_override_notify) { | 
					
						
							|  |  |  | 		pending_override_notify = false; | 
					
						
							|  |  |  | 		EditorNode::get_singleton()->notify_settings_overrides_changed(); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2025-03-08 16:26:52 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::set_plugins_page() { | 
					
						
							| 
									
										
										
										
											2022-03-04 19:16:33 -03:00
										 |  |  | 	tab_container->set_current_tab(tab_container->get_tab_idx_from_control(plugin_settings)); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-06 18:51:30 +08:00
										 |  |  | void ProjectSettingsEditor::set_general_page(const String &p_category) { | 
					
						
							|  |  |  | 	tab_container->set_current_tab(tab_container->get_tab_idx_from_control(general_editor)); | 
					
						
							|  |  |  | 	general_settings_inspector->set_current_section(p_category); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | void ProjectSettingsEditor::update_plugins() { | 
					
						
							|  |  |  | 	plugin_settings->update_plugins(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-24 01:30:16 -04:00
										 |  |  | void ProjectSettingsEditor::init_autoloads() { | 
					
						
							|  |  |  | 	autoload_settings->init_autoloads(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::_setting_edited(const String &p_name) { | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | 	const String full_name = general_settings_inspector->get_full_item_path(p_name); | 
					
						
							|  |  |  | 	if (full_name.begins_with(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX)) { | 
					
						
							|  |  |  | 		EditorSettings::get_singleton()->mark_setting_changed(full_name.trim_prefix(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX)); | 
					
						
							|  |  |  | 		pending_override_notify = true; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	queue_save(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | void ProjectSettingsEditor::_update_advanced(bool p_is_advanced) { | 
					
						
							|  |  |  | 	custom_properties->set_visible(p_is_advanced); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | void ProjectSettingsEditor::_on_category_changed(const String &p_new_category) { | 
					
						
							|  |  |  | 	general_settings_inspector->get_inspector()->set_use_deletable_properties(p_new_category.begins_with(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_on_editor_override_deleted(const String &p_setting) { | 
					
						
							|  |  |  | 	const String full_name = general_settings_inspector->get_full_item_path(p_setting); | 
					
						
							|  |  |  | 	ERR_FAIL_COND(!full_name.begins_with(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ProjectSettings::get_singleton()->set_setting(full_name, Variant()); | 
					
						
							|  |  |  | 	EditorSettings::get_singleton()->mark_setting_changed(full_name.trim_prefix(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX)); | 
					
						
							|  |  |  | 	pending_override_notify = true; | 
					
						
							|  |  |  | 	_save(); | 
					
						
							|  |  |  | 	general_settings_inspector->update_category_list(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | void ProjectSettingsEditor::_advanced_toggled(bool p_button_pressed) { | 
					
						
							| 
									
										
										
										
											2024-09-05 18:52:44 +02:00
										 |  |  | 	EditorSettings::get_singleton()->set("_project_settings_advanced_mode", p_button_pressed); | 
					
						
							|  |  |  | 	EditorSettings::get_singleton()->save(); | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	_update_advanced(p_button_pressed); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::_setting_selected(const String &p_path) { | 
					
						
							| 
									
										
										
										
											2021-12-09 03:42:46 -06:00
										 |  |  | 	if (p_path.is_empty()) { | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	property_box->set_text(general_settings_inspector->get_current_section() + "/" + p_path); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	_update_property_box(); // set_text doesn't trigger text_changed
 | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::_add_setting() { | 
					
						
							|  |  |  | 	String setting = _get_setting_name(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	// Initialize the property with the default value for the given type.
 | 
					
						
							|  |  |  | 	Callable::CallError ce; | 
					
						
							| 
									
										
										
										
											2020-11-09 00:19:09 -03:00
										 |  |  | 	Variant value; | 
					
						
							| 
									
										
										
										
											2025-05-28 09:18:32 +08:00
										 |  |  | 	Variant::construct(type_box->get_selected_type(), value, nullptr, 0, ce); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 23:53:16 +01:00
										 |  |  | 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	undo_redo->create_action(TTR("Add Project Setting")); | 
					
						
							|  |  |  | 	undo_redo->add_do_property(ps, setting, value); | 
					
						
							|  |  |  | 	undo_redo->add_undo_property(ps, setting, ps->has_setting(setting) ? ps->get(setting) : Variant()); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	undo_redo->add_do_method(general_settings_inspector, "update_category_list"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(general_settings_inspector, "update_category_list"); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	undo_redo->add_do_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->commit_action(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-16 17:16:07 +01:00
										 |  |  | 	general_settings_inspector->set_current_section(setting.get_slicec('/', 1)); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	add_button->release_focus(); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | void ProjectSettingsEditor::_delete_setting() { | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	String setting = _get_setting_name(); | 
					
						
							|  |  |  | 	Variant value = ps->get(setting); | 
					
						
							|  |  |  | 	int order = ps->get_order(setting); | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 23:53:16 +01:00
										 |  |  | 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	undo_redo->create_action(TTR("Delete Item")); | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	undo_redo->add_do_method(ps, "clear", setting); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ps, "set", setting, value); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ps, "set_order", setting, order); | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	undo_redo->add_do_method(general_settings_inspector, "update_category_list"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(general_settings_inspector, "update_category_list"); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	undo_redo->add_do_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "queue_save"); | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	undo_redo->commit_action(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	property_box->clear(); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	del_button->release_focus(); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | void ProjectSettingsEditor::_property_box_changed(const String &p_text) { | 
					
						
							|  |  |  | 	_update_property_box(); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::_feature_selected(int p_index) { | 
					
						
							| 
									
										
										
										
											2025-04-12 11:28:29 +02:00
										 |  |  | 	const String property = property_box->get_text().strip_edges().get_slicec('.', 0); | 
					
						
							|  |  |  | 	if (p_index == FEATURE_ALL) { | 
					
						
							|  |  |  | 		property_box->set_text(property); | 
					
						
							|  |  |  | 	} else if (p_index == FEATURE_CUSTOM) { | 
					
						
							|  |  |  | 		property_box->set_text(property + ".custom"); | 
					
						
							|  |  |  | 		const int len = property.length() + 1; | 
					
						
							|  |  |  | 		property_box->select(len); | 
					
						
							|  |  |  | 		property_box->set_caret_column(len); | 
					
						
							|  |  |  | 		property_box->grab_focus(); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		property_box->set_text(property + "." + feature_box->get_item_text(p_index)); | 
					
						
							|  |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	_update_property_box(); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | void ProjectSettingsEditor::_update_property_box() { | 
					
						
							|  |  |  | 	const String setting = _get_setting_name(); | 
					
						
							| 
									
										
										
										
											2025-04-12 11:28:29 +02:00
										 |  |  | 	int slices = setting.get_slice_count("."); | 
					
						
							|  |  |  | 	const String name = setting.get_slicec('.', 0); | 
					
						
							|  |  |  | 	const String feature = setting.get_slicec('.', 1); | 
					
						
							|  |  |  | 	bool feature_invalid = slices > 2 || (slices == 2 && feature.is_empty()); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	add_button->set_disabled(true); | 
					
						
							|  |  |  | 	del_button->set_disabled(true); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-12 11:28:29 +02:00
										 |  |  | 	if (feature.is_empty() || feature_invalid) { | 
					
						
							|  |  |  | 		feature_box->select(FEATURE_ALL); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		bool is_custom = true; | 
					
						
							|  |  |  | 		for (int i = FEATURE_FIRST; i < feature_box->get_item_count(); i++) { | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 			if (feature == feature_box->get_item_text(i)) { | 
					
						
							| 
									
										
										
										
											2025-04-12 11:28:29 +02:00
										 |  |  | 				is_custom = false; | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 				feature_box->select(i); | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2025-04-12 11:28:29 +02:00
										 |  |  | 		if (is_custom) { | 
					
						
							|  |  |  | 			feature_box->select(FEATURE_CUSTOM); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-09 03:42:46 -06:00
										 |  |  | 	if (property_box->get_text().is_empty()) { | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	if (ps->has_setting(setting)) { | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | 		del_button->set_disabled(ps->is_builtin_setting(setting) || setting.begins_with(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX)); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 		_select_type(ps->get_setting(setting).get_type()); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		if (ps->has_setting(name)) { | 
					
						
							|  |  |  | 			_select_type(ps->get_setting(name).get_type()); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 			type_box->select(0); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | 		if (feature_invalid || name.begins_with(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX)) { | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 		const Vector<String> names = name.split("/"); | 
					
						
							|  |  |  | 		for (int i = 0; i < names.size(); i++) { | 
					
						
							| 
									
										
										
										
											2024-08-23 14:30:51 +08:00
										 |  |  | 			if (!names[i].is_valid_ascii_identifier()) { | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 				return; | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		add_button->set_disabled(false); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | void ProjectSettingsEditor::_select_type(Variant::Type p_type) { | 
					
						
							|  |  |  | 	type_box->select(type_box->get_item_index(p_type)); | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-11 15:59:52 +02:00
										 |  |  | void ProjectSettingsEditor::shortcut_input(const Ref<InputEvent> &p_event) { | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	const Ref<InputEventKey> k = p_event; | 
					
						
							|  |  |  | 	if (k.is_valid() && k->is_pressed()) { | 
					
						
							|  |  |  | 		bool handled = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (ED_IS_SHORTCUT("ui_undo", p_event)) { | 
					
						
							| 
									
										
										
										
											2024-07-03 15:14:51 +02:00
										 |  |  | 			EditorNode::get_singleton()->undo(); | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 			handled = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (ED_IS_SHORTCUT("ui_redo", p_event)) { | 
					
						
							| 
									
										
										
										
											2024-07-03 15:14:51 +02:00
										 |  |  | 			EditorNode::get_singleton()->redo(); | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 			handled = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-30 20:11:21 +02:00
										 |  |  | 		if (ED_IS_SHORTCUT("editor/open_search", p_event)) { | 
					
						
							| 
									
										
										
										
											2023-09-25 01:09:29 -03:00
										 |  |  | 			_focus_current_search_box(); | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 			handled = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-30 20:11:21 +02:00
										 |  |  | 		if (ED_IS_SHORTCUT("file_dialog/focus_path", p_event)) { | 
					
						
							|  |  |  | 			_focus_current_path_box(); | 
					
						
							|  |  |  | 			handled = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 		if (handled) { | 
					
						
							|  |  |  | 			set_input_as_handled(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | String ProjectSettingsEditor::_get_setting_name() const { | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	String name = property_box->get_text().strip_edges(); | 
					
						
							| 
									
										
										
										
											2024-12-05 17:56:08 +01:00
										 |  |  | 	if (!name.begins_with("_") && !name.contains_char('/')) { | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 		name = "global/" + name; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return name; | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::_add_feature_overrides() { | 
					
						
							| 
									
										
										
										
											2022-05-19 17:00:06 +02:00
										 |  |  | 	HashSet<String> presets; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	presets.insert("bptc"); | 
					
						
							|  |  |  | 	presets.insert("s3tc"); | 
					
						
							|  |  |  | 	presets.insert("etc2"); | 
					
						
							| 
									
										
										
										
											2022-10-26 18:23:09 +02:00
										 |  |  | 	presets.insert("editor"); | 
					
						
							| 
									
										
										
										
											2023-12-02 18:55:27 +01:00
										 |  |  | 	presets.insert("editor_hint"); | 
					
						
							|  |  |  | 	presets.insert("editor_runtime"); | 
					
						
							| 
									
										
										
										
											2022-10-26 18:23:09 +02:00
										 |  |  | 	presets.insert("template_debug"); | 
					
						
							|  |  |  | 	presets.insert("template_release"); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	presets.insert("debug"); | 
					
						
							|  |  |  | 	presets.insert("release"); | 
					
						
							| 
									
										
										
										
											2022-10-26 18:23:09 +02:00
										 |  |  | 	presets.insert("template"); | 
					
						
							| 
									
										
										
										
											2022-12-03 18:17:04 +01:00
										 |  |  | 	presets.insert("double"); | 
					
						
							|  |  |  | 	presets.insert("single"); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	presets.insert("32"); | 
					
						
							|  |  |  | 	presets.insert("64"); | 
					
						
							| 
									
										
											  
											
												Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
											
										 
											2022-06-17 00:55:19 +02:00
										 |  |  | 	presets.insert("movie"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	EditorExport *ee = EditorExport::get_singleton(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for (int i = 0; i < ee->get_export_platform_count(); i++) { | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 		List<String> p; | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 		ee->get_export_platform(i)->get_platform_features(&p); | 
					
						
							| 
									
										
										
										
											2021-07-24 15:46:25 +02:00
										 |  |  | 		for (const String &E : p) { | 
					
						
							| 
									
										
										
										
											2021-07-15 23:45:57 -04:00
										 |  |  | 			presets.insert(E); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	for (int i = 0; i < ee->get_export_preset_count(); i++) { | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 		List<String> p; | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 		ee->get_export_preset(i)->get_platform()->get_preset_features(ee->get_export_preset(i), &p); | 
					
						
							| 
									
										
										
										
											2021-07-24 15:46:25 +02:00
										 |  |  | 		for (const String &E : p) { | 
					
						
							| 
									
										
										
										
											2021-07-15 23:45:57 -04:00
										 |  |  | 			presets.insert(E); | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 		String custom = ee->get_export_preset(i)->get_custom_features(); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 		Vector<String> custom_list = custom.split(","); | 
					
						
							|  |  |  | 		for (int j = 0; j < custom_list.size(); j++) { | 
					
						
							|  |  |  | 			String f = custom_list[j].strip_edges(); | 
					
						
							| 
									
										
										
										
											2021-12-09 03:42:46 -06:00
										 |  |  | 			if (!f.is_empty()) { | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 				presets.insert(f); | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	feature_box->clear(); | 
					
						
							| 
									
										
										
										
											2025-05-28 14:49:24 +08:00
										 |  |  | 	feature_box->add_item(TTRC("All"), FEATURE_ALL); // So it is always on top.
 | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	feature_box->set_item_auto_translate_mode(-1, AUTO_TRANSLATE_MODE_ALWAYS); | 
					
						
							|  |  |  | 	feature_box->add_item(TTRC("Custom"), FEATURE_CUSTOM); | 
					
						
							|  |  |  | 	feature_box->set_item_auto_translate_mode(-1, AUTO_TRANSLATE_MODE_ALWAYS); | 
					
						
							| 
									
										
										
										
											2025-04-12 11:28:29 +02:00
										 |  |  | 	feature_box->add_separator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int id = FEATURE_FIRST; | 
					
						
							| 
									
										
										
										
											2022-05-18 17:43:40 -06:00
										 |  |  | 	for (const String &E : presets) { | 
					
						
							|  |  |  | 		feature_box->add_item(E, id++); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-25 01:09:29 -03:00
										 |  |  | void ProjectSettingsEditor::_tabs_tab_changed(int p_tab) { | 
					
						
							|  |  |  | 	_focus_current_search_box(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_focus_current_search_box() { | 
					
						
							|  |  |  | 	Control *tab = tab_container->get_current_tab_control(); | 
					
						
							|  |  |  | 	LineEdit *current_search_box = nullptr; | 
					
						
							|  |  |  | 	if (tab == general_editor) { | 
					
						
							|  |  |  | 		current_search_box = search_box; | 
					
						
							|  |  |  | 	} else if (tab == action_map_editor) { | 
					
						
							|  |  |  | 		current_search_box = action_map_editor->get_search_box(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (current_search_box) { | 
					
						
							|  |  |  | 		current_search_box->grab_focus(); | 
					
						
							|  |  |  | 		current_search_box->select_all(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-30 20:11:21 +02:00
										 |  |  | void ProjectSettingsEditor::_focus_current_path_box() { | 
					
						
							|  |  |  | 	Control *tab = tab_container->get_current_tab_control(); | 
					
						
							|  |  |  | 	LineEdit *current_path_box = nullptr; | 
					
						
							|  |  |  | 	if (tab == general_editor) { | 
					
						
							|  |  |  | 		current_path_box = property_box; | 
					
						
							|  |  |  | 	} else if (tab == action_map_editor) { | 
					
						
							|  |  |  | 		current_path_box = action_map_editor->get_path_box(); | 
					
						
							|  |  |  | 	} else if (tab == autoload_settings) { | 
					
						
							|  |  |  | 		current_path_box = autoload_settings->get_path_box(); | 
					
						
							|  |  |  | 	} else if (tab == shaders_global_shader_uniforms_editor) { | 
					
						
							|  |  |  | 		current_path_box = shaders_global_shader_uniforms_editor->get_name_box(); | 
					
						
							|  |  |  | 	} else if (tab == group_settings) { | 
					
						
							|  |  |  | 		current_path_box = group_settings->get_name_box(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (current_path_box) { | 
					
						
							|  |  |  | 		current_path_box->grab_focus(); | 
					
						
							|  |  |  | 		current_path_box->select_all(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | void ProjectSettingsEditor::_editor_restart() { | 
					
						
							| 
									
										
										
										
											2021-02-26 13:33:08 +01:00
										 |  |  | 	ProjectSettings::get_singleton()->save(); | 
					
						
							| 
									
										
										
										
											2019-01-25 17:23:56 -03:00
										 |  |  | 	EditorNode::get_singleton()->save_all_scenes(); | 
					
						
							|  |  |  | 	EditorNode::get_singleton()->restart_editor(); | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_editor_restart_request() { | 
					
						
							|  |  |  | 	restart_container->show(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_editor_restart_close() { | 
					
						
							|  |  |  | 	restart_container->hide(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | void ProjectSettingsEditor::_action_added(const String &p_name) { | 
					
						
							|  |  |  | 	String name = "input/" + p_name; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-28 17:08:06 +00:00
										 |  |  | 	ERR_FAIL_COND_MSG(ProjectSettings::get_singleton()->has_setting(name), | 
					
						
							|  |  |  | 			"An action with this name already exists."); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Dictionary action; | 
					
						
							|  |  |  | 	action["events"] = Array(); | 
					
						
							| 
									
										
										
										
											2024-11-12 09:43:29 -08:00
										 |  |  | 	action["deadzone"] = InputMap::DEFAULT_DEADZONE; | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 23:53:16 +01:00
										 |  |  | 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 	undo_redo->create_action(TTR("Add Input Action")); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, action); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->commit_action(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_action_edited(const String &p_name, const Dictionary &p_action) { | 
					
						
							|  |  |  | 	const String property_name = "input/" + p_name; | 
					
						
							| 
									
										
										
										
											2022-10-18 16:43:37 +02:00
										 |  |  | 	Dictionary old_val = GLOBAL_GET(property_name); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 23:53:16 +01:00
										 |  |  | 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 	if (old_val["deadzone"] != p_action["deadzone"]) { | 
					
						
							|  |  |  | 		// Deadzone Changed
 | 
					
						
							|  |  |  | 		undo_redo->create_action(TTR("Change Action deadzone")); | 
					
						
							|  |  |  | 		undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", property_name, p_action); | 
					
						
							|  |  |  | 		undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", property_name, old_val); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		// Events changed
 | 
					
						
							| 
									
										
										
										
											2023-01-13 21:36:44 +10:00
										 |  |  | 		undo_redo->create_action(TTR("Change Input Action Event(s)")); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 		undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", property_name, p_action); | 
					
						
							|  |  |  | 		undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", property_name, old_val); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->commit_action(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_action_removed(const String &p_name) { | 
					
						
							|  |  |  | 	const String property_name = "input/" + p_name; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-18 16:43:37 +02:00
										 |  |  | 	Dictionary old_val = GLOBAL_GET(property_name); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 	int order = ProjectSettings::get_singleton()->get_order(property_name); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 23:53:16 +01:00
										 |  |  | 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 	undo_redo->create_action(TTR("Erase Input Action")); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", property_name); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", property_name, old_val); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", property_name, order); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->commit_action(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_action_renamed(const String &p_old_name, const String &p_new_name) { | 
					
						
							|  |  |  | 	const String old_property_name = "input/" + p_old_name; | 
					
						
							|  |  |  | 	const String new_property_name = "input/" + p_new_name; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-28 17:08:06 +00:00
										 |  |  | 	ERR_FAIL_COND_MSG(ProjectSettings::get_singleton()->has_setting(new_property_name), | 
					
						
							|  |  |  | 			"An action with this name already exists."); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	int order = ProjectSettings::get_singleton()->get_order(old_property_name); | 
					
						
							| 
									
										
										
										
											2022-10-18 16:43:37 +02:00
										 |  |  | 	Dictionary action = GLOBAL_GET(old_property_name); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 23:53:16 +01:00
										 |  |  | 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | 
					
						
							| 
									
										
										
										
											2023-02-13 11:27:12 +08:00
										 |  |  | 	undo_redo->create_action(TTR("Rename Input Action")); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 	// Do: clear old, set new
 | 
					
						
							|  |  |  | 	undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", old_property_name); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", new_property_name, action); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", new_property_name, order); | 
					
						
							|  |  |  | 	// Undo: clear new, set old
 | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", new_property_name); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", old_property_name, action); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", old_property_name, order); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->commit_action(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_action_reordered(const String &p_action_name, const String &p_relative_to, bool p_before) { | 
					
						
							|  |  |  | 	const String action_name = "input/" + p_action_name; | 
					
						
							|  |  |  | 	const String target_name = "input/" + p_relative_to; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// It is much easier to rebuild the custom "input" properties rather than messing around with the "order" values of them.
 | 
					
						
							|  |  |  | 	Variant action_value = ps->get(action_name); | 
					
						
							|  |  |  | 	Variant target_value = ps->get(target_name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	List<PropertyInfo> props; | 
					
						
							| 
									
										
										
										
											2022-05-08 10:09:19 +02:00
										 |  |  | 	HashMap<String, Variant> action_values; | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 	ProjectSettings::get_singleton()->get_property_list(&props); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 23:53:16 +01:00
										 |  |  | 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 	undo_redo->create_action(TTR("Update Input Action Order")); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-24 15:46:25 +02:00
										 |  |  | 	for (const PropertyInfo &prop : props) { | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 		// Skip builtins and non-inputs
 | 
					
						
							| 
									
										
										
										
											2023-05-12 16:15:16 -03:00
										 |  |  | 		// Order matters here, checking for "input/" filters out properties that aren't settings and produce errors in is_builtin_setting().
 | 
					
						
							|  |  |  | 		if (!prop.name.begins_with("input/") || ProjectSettings::get_singleton()->is_builtin_setting(prop.name)) { | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 			continue; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		action_values.insert(prop.name, ps->get(prop.name)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", prop.name); | 
					
						
							|  |  |  | 		undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", prop.name); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-08 10:09:19 +02:00
										 |  |  | 	for (const KeyValue<String, Variant> &E : action_values) { | 
					
						
							|  |  |  | 		String name = E.key; | 
					
						
							|  |  |  | 		const Variant &value = E.value; | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if (name == target_name) { | 
					
						
							|  |  |  | 			if (p_before) { | 
					
						
							|  |  |  | 				// Insert before target
 | 
					
						
							|  |  |  | 				undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", action_name, action_value); | 
					
						
							|  |  |  | 				undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", target_name, target_value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", target_name, target_value); | 
					
						
							|  |  |  | 				undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", action_name, action_value); | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				// Insert after target
 | 
					
						
							|  |  |  | 				undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", target_name, target_value); | 
					
						
							|  |  |  | 				undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", action_name, action_value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", action_name, action_value); | 
					
						
							|  |  |  | 				undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", target_name, target_value); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		} else if (name != action_name) { | 
					
						
							|  |  |  | 			undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, value); | 
					
						
							|  |  |  | 			undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, value); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "_update_action_map_editor"); | 
					
						
							|  |  |  | 	undo_redo->add_do_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->add_undo_method(this, "queue_save"); | 
					
						
							|  |  |  | 	undo_redo->commit_action(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProjectSettingsEditor::_update_action_map_editor() { | 
					
						
							|  |  |  | 	Vector<ActionMapEditor::ActionInfo> actions; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	List<PropertyInfo> props; | 
					
						
							|  |  |  | 	ProjectSettings::get_singleton()->get_property_list(&props); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-13 02:33:39 +02:00
										 |  |  | 	const Ref<Texture2D> builtin_icon = get_editor_theme_icon(SNAME("PinPressed")); | 
					
						
							| 
									
										
										
										
											2021-07-24 15:46:25 +02:00
										 |  |  | 	for (const PropertyInfo &E : props) { | 
					
						
							| 
									
										
										
										
											2021-07-15 23:45:57 -04:00
										 |  |  | 		const String property_name = E.name; | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if (!property_name.begins_with("input/")) { | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Strip the "input/" from the left.
 | 
					
						
							|  |  |  | 		String display_name = property_name.substr(String("input/").size() - 1); | 
					
						
							| 
									
										
										
										
											2022-10-18 16:43:37 +02:00
										 |  |  | 		Dictionary action = GLOBAL_GET(property_name); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		ActionMapEditor::ActionInfo action_info; | 
					
						
							|  |  |  | 		action_info.action = action; | 
					
						
							|  |  |  | 		action_info.editable = true; | 
					
						
							|  |  |  | 		action_info.name = display_name; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(property_name) != nullptr; | 
					
						
							|  |  |  | 		if (is_builtin_input) { | 
					
						
							|  |  |  | 			action_info.editable = false; | 
					
						
							|  |  |  | 			action_info.icon = builtin_icon; | 
					
						
							| 
									
										
										
										
											2023-01-13 21:36:44 +10:00
										 |  |  | 			action_info.has_initial = true; | 
					
						
							|  |  |  | 			action_info.action_initial = ProjectSettings::get_singleton()->property_get_revert(property_name); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		actions.push_back(action_info); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	action_map_editor->update_action_list(actions); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-29 11:04:31 +02:00
										 |  |  | void ProjectSettingsEditor::_update_theme() { | 
					
						
							| 
									
										
										
										
											2024-10-09 15:21:47 -07:00
										 |  |  | 	add_button->set_button_icon(get_editor_theme_icon(SNAME("Add"))); | 
					
						
							|  |  |  | 	del_button->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); | 
					
						
							| 
									
										
										
										
											2023-08-13 02:33:39 +02:00
										 |  |  | 	search_box->set_right_icon(get_editor_theme_icon(SNAME("Search"))); | 
					
						
							| 
									
										
										
										
											2024-10-09 15:21:47 -07:00
										 |  |  | 	restart_close_button->set_button_icon(get_editor_theme_icon(SNAME("Close"))); | 
					
						
							| 
									
										
										
										
											2024-05-14 15:50:53 +02:00
										 |  |  | 	restart_container->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree"))); | 
					
						
							| 
									
										
										
										
											2023-08-13 02:33:39 +02:00
										 |  |  | 	restart_icon->set_texture(get_editor_theme_icon(SNAME("StatusWarning"))); | 
					
						
							| 
									
										
										
										
											2024-05-14 15:57:29 +02:00
										 |  |  | 	restart_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor))); | 
					
						
							| 
									
										
										
										
											2022-08-29 11:04:31 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::_notification(int p_what) { | 
					
						
							|  |  |  | 	switch (p_what) { | 
					
						
							|  |  |  | 		case NOTIFICATION_VISIBILITY_CHANGED: { | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | 			if (is_visible()) { | 
					
						
							|  |  |  | 				HashMap<String, PropertyInfo> editor_settings_info; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				List<PropertyInfo> infos; | 
					
						
							|  |  |  | 				EditorSettings::get_singleton()->get_property_list(&infos); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				for (const PropertyInfo &pi : infos) { | 
					
						
							|  |  |  | 					editor_settings_info[pi.name] = pi; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				ProjectSettings::get_singleton()->editor_settings_info = editor_settings_info; | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 				EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", Rect2(get_position(), get_size())); | 
					
						
							| 
									
										
										
										
											2025-03-08 16:26:52 +02:00
										 |  |  | 				if (settings_changed) { | 
					
						
							|  |  |  | 					timer->stop(); | 
					
						
							|  |  |  | 					_save(); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} break; | 
					
						
							| 
									
										
										
										
											2022-02-16 09:17:55 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 		case NOTIFICATION_ENTER_TREE: { | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 			general_settings_inspector->edit(ps); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 			_update_action_map_editor(); | 
					
						
							| 
									
										
										
										
											2022-08-29 11:04:31 +02:00
										 |  |  | 			_update_theme(); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 		} break; | 
					
						
							| 
									
										
										
										
											2022-02-16 09:17:55 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-24 18:16:05 -06:00
										 |  |  | 		case NOTIFICATION_THEME_CHANGED: { | 
					
						
							| 
									
										
										
										
											2022-08-29 11:04:31 +02:00
										 |  |  | 			_update_theme(); | 
					
						
							| 
									
										
										
										
											2022-01-24 18:16:05 -06:00
										 |  |  | 		} break; | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | void ProjectSettingsEditor::_bind_methods() { | 
					
						
							|  |  |  | 	ClassDB::bind_method(D_METHOD("queue_save"), &ProjectSettingsEditor::queue_save); | 
					
						
							| 
									
										
										
										
											2020-10-01 23:04:57 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	ClassDB::bind_method(D_METHOD("_update_action_map_editor"), &ProjectSettingsEditor::_update_action_map_editor); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-19 17:00:46 -03:00
										 |  |  | ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	singleton = this; | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	set_title(TTRC("Project Settings (project.godot)")); | 
					
						
							| 
									
										
										
										
											2023-03-19 12:26:22 -04:00
										 |  |  | 	set_clamp_to_embedder(true); | 
					
						
							| 
									
										
										
										
											2020-03-06 14:00:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	ps = ProjectSettings::get_singleton(); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	data = p_data; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	tab_container = memnew(TabContainer); | 
					
						
							| 
									
										
										
										
											2019-01-26 15:41:36 -03:00
										 |  |  | 	tab_container->set_use_hidden_tabs_for_min_size(true); | 
					
						
							| 
									
										
										
										
											2022-05-26 21:12:09 -05:00
										 |  |  | 	tab_container->set_theme_type_variation("TabContainerOdd"); | 
					
						
							| 
									
										
										
										
											2023-09-25 01:09:29 -03:00
										 |  |  | 	tab_container->connect("tab_changed", callable_mp(this, &ProjectSettingsEditor::_tabs_tab_changed)); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	add_child(tab_container); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-06 18:51:30 +08:00
										 |  |  | 	general_editor = memnew(VBoxContainer); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	general_editor->set_name(TTRC("General")); | 
					
						
							| 
									
										
										
										
											2021-11-24 20:58:47 -06:00
										 |  |  | 	general_editor->set_alignment(BoxContainer::ALIGNMENT_BEGIN); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	general_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); | 
					
						
							|  |  |  | 	tab_container->add_child(general_editor); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	HBoxContainer *search_bar = memnew(HBoxContainer); | 
					
						
							|  |  |  | 	general_editor->add_child(search_bar); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	search_box = memnew(LineEdit); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	search_box->set_placeholder(TTRC("Filter Settings")); | 
					
						
							| 
									
										
										
										
											2025-03-21 09:55:22 +02:00
										 |  |  | 	search_box->set_accessibility_name(TTRC("Filter Settings")); | 
					
						
							| 
									
										
										
										
											2022-01-16 10:59:02 +03:00
										 |  |  | 	search_box->set_clear_button_enabled(true); | 
					
						
							| 
									
										
										
										
											2025-05-05 22:19:33 -04:00
										 |  |  | 	search_box->set_virtual_keyboard_show_on_focus(false); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); | 
					
						
							|  |  |  | 	search_bar->add_child(search_box); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	advanced = memnew(CheckButton); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	advanced->set_text(TTRC("Advanced Settings")); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	search_bar->add_child(advanced); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	custom_properties = memnew(HBoxContainer); | 
					
						
							|  |  |  | 	general_editor->add_child(custom_properties); | 
					
						
							| 
									
										
										
										
											2016-01-23 16:05:27 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	property_box = memnew(LineEdit); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	property_box->set_placeholder(TTRC("Select a Setting or Type its Name")); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	property_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); | 
					
						
							| 
									
										
										
										
											2024-05-14 11:42:00 +02:00
										 |  |  | 	property_box->connect(SceneStringName(text_changed), callable_mp(this, &ProjectSettingsEditor::_property_box_changed)); | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	custom_properties->add_child(property_box); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	feature_box = memnew(OptionButton); | 
					
						
							|  |  |  | 	feature_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE); | 
					
						
							| 
									
										
										
										
											2025-03-21 09:55:22 +02:00
										 |  |  | 	feature_box->set_accessibility_name(TTRC("Feature")); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	feature_box->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); | 
					
						
							| 
									
										
										
										
											2024-05-14 14:21:31 +02:00
										 |  |  | 	feature_box->connect(SceneStringName(item_selected), callable_mp(this, &ProjectSettingsEditor::_feature_selected)); | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	custom_properties->add_child(feature_box); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-28 09:18:32 +08:00
										 |  |  | 	type_box = memnew(EditorVariantTypeOptionButton); | 
					
						
							|  |  |  | 	type_box->populate({ Variant::NIL, Variant::OBJECT }); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	type_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE); | 
					
						
							| 
									
										
										
										
											2025-03-21 09:55:22 +02:00
										 |  |  | 	type_box->set_accessibility_name(TTRC("Type")); | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	custom_properties->add_child(type_box); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	add_button = memnew(Button); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	add_button->set_text(TTRC("Add")); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	add_button->set_disabled(true); | 
					
						
							| 
									
										
										
										
											2024-05-14 09:40:21 +02:00
										 |  |  | 	add_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectSettingsEditor::_add_setting)); | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	custom_properties->add_child(add_button); | 
					
						
							| 
									
										
										
										
											2015-11-21 13:42:15 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	del_button = memnew(Button); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	del_button->set_text(TTRC("Delete")); | 
					
						
							| 
									
										
										
										
											2021-05-03 20:07:24 +03:00
										 |  |  | 	del_button->set_disabled(true); | 
					
						
							| 
									
										
										
										
											2024-05-14 09:40:21 +02:00
										 |  |  | 	del_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectSettingsEditor::_delete_setting)); | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	custom_properties->add_child(del_button); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	general_settings_inspector = memnew(SectionedInspector); | 
					
						
							|  |  |  | 	general_settings_inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL); | 
					
						
							|  |  |  | 	general_settings_inspector->register_search_box(search_box); | 
					
						
							| 
									
										
										
										
											2024-09-21 21:11:58 +08:00
										 |  |  | 	general_settings_inspector->register_advanced_toggle(advanced); | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | 	general_settings_inspector->connect("category_changed", callable_mp(this, &ProjectSettingsEditor::_on_category_changed)); | 
					
						
							| 
									
										
										
										
											2022-03-18 01:16:25 +08:00
										 |  |  | 	general_settings_inspector->get_inspector()->set_use_filter(true); | 
					
						
							| 
									
										
										
										
											2025-05-06 13:59:56 +02:00
										 |  |  | 	general_settings_inspector->get_inspector()->set_mark_unsaved(false); | 
					
						
							| 
									
										
										
										
											2025-06-18 09:38:07 +08:00
										 |  |  | 	general_settings_inspector->get_inspector()->remap_doc_property_class(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX, "EditorSettings"); | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	general_settings_inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected)); | 
					
						
							|  |  |  | 	general_settings_inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited)); | 
					
						
							| 
									
										
										
										
											2022-11-21 20:07:15 +01:00
										 |  |  | 	general_settings_inspector->get_inspector()->connect("property_deleted", callable_mp(this, &ProjectSettingsEditor::_on_editor_override_deleted)); | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	general_settings_inspector->get_inspector()->connect("restart_requested", callable_mp(this, &ProjectSettingsEditor::_editor_restart_request)); | 
					
						
							|  |  |  | 	general_editor->add_child(general_settings_inspector); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-01 19:08:01 +05:30
										 |  |  | 	if (EDITOR_GET("interface/touchscreen/enable_touch_optimizations")) { | 
					
						
							|  |  |  | 		general_settings_inspector->set_touch_dragger_enabled(true); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_container = memnew(PanelContainer); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	general_editor->add_child(restart_container); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	HBoxContainer *restart_hb = memnew(HBoxContainer); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	restart_container->hide(); | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_container->add_child(restart_hb); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_icon = memnew(TextureRect); | 
					
						
							| 
									
										
										
										
											2020-03-06 14:00:16 -03:00
										 |  |  | 	restart_icon->set_v_size_flags(Control::SIZE_SHRINK_CENTER); | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_hb->add_child(restart_icon); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_label = memnew(Label); | 
					
						
							| 
									
										
										
										
											2025-04-22 11:57:16 +03:00
										 |  |  | 	restart_label->set_focus_mode(Control::FOCUS_ACCESSIBILITY); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	restart_label->set_text(TTRC("Changed settings will be applied to the editor after restarting.")); | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_hb->add_child(restart_label); | 
					
						
							|  |  |  | 	restart_hb->add_spacer(); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	Button *restart_button = memnew(Button); | 
					
						
							| 
									
										
										
										
											2024-05-14 09:40:21 +02:00
										 |  |  | 	restart_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectSettingsEditor::_editor_restart)); | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_hb->add_child(restart_button); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	restart_button->set_text(TTRC("Save & Restart")); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-19 20:49:04 +02:00
										 |  |  | 	restart_close_button = memnew(Button); | 
					
						
							|  |  |  | 	restart_close_button->set_flat(true); | 
					
						
							| 
									
										
										
										
											2024-05-14 09:40:21 +02:00
										 |  |  | 	restart_close_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectSettingsEditor::_editor_restart_close)); | 
					
						
							| 
									
										
										
										
											2025-03-21 09:55:22 +02:00
										 |  |  | 	restart_close_button->set_accessibility_name(TTRC("Close")); | 
					
						
							| 
									
										
										
										
											2018-07-19 18:58:15 -03:00
										 |  |  | 	restart_hb->add_child(restart_close_button); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	action_map_editor = memnew(ActionMapEditor); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	action_map_editor->set_name(TTRC("Input Map")); | 
					
						
							| 
									
										
										
										
											2022-02-01 00:19:01 +01:00
										 |  |  | 	action_map_editor->connect("action_added", callable_mp(this, &ProjectSettingsEditor::_action_added)); | 
					
						
							|  |  |  | 	action_map_editor->connect("action_edited", callable_mp(this, &ProjectSettingsEditor::_action_edited)); | 
					
						
							|  |  |  | 	action_map_editor->connect("action_removed", callable_mp(this, &ProjectSettingsEditor::_action_removed)); | 
					
						
							|  |  |  | 	action_map_editor->connect("action_renamed", callable_mp(this, &ProjectSettingsEditor::_action_renamed)); | 
					
						
							|  |  |  | 	action_map_editor->connect("action_reordered", callable_mp(this, &ProjectSettingsEditor::_action_reordered)); | 
					
						
							|  |  |  | 	tab_container->add_child(action_map_editor); | 
					
						
							| 
									
										
										
										
											2017-10-17 18:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	localization_editor = memnew(LocalizationEditor); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	localization_editor->set_name(TTRC("Localization")); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	localization_editor->connect("localization_changed", callable_mp(this, &ProjectSettingsEditor::queue_save)); | 
					
						
							| 
									
										
										
										
											2020-07-11 00:52:52 +02:00
										 |  |  | 	tab_container->add_child(localization_editor); | 
					
						
							| 
									
										
										
										
											2020-06-19 11:56:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-04 21:23:43 +02:00
										 |  |  | 	TabContainer *globals_container = memnew(TabContainer); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	globals_container->set_name(TTRC("Globals")); | 
					
						
							| 
									
										
										
										
											2024-06-04 21:23:43 +02:00
										 |  |  | 	tab_container->add_child(globals_container); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 21:49:44 -02:00
										 |  |  | 	autoload_settings = memnew(EditorAutoloadSettings); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	autoload_settings->set_name(TTRC("Autoload")); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	autoload_settings->connect("autoload_changed", callable_mp(this, &ProjectSettingsEditor::queue_save)); | 
					
						
							| 
									
										
										
										
											2024-06-04 21:23:43 +02:00
										 |  |  | 	globals_container->add_child(autoload_settings); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-03 18:56:43 +02:00
										 |  |  | 	shaders_global_shader_uniforms_editor = memnew(ShaderGlobalsEditor); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	shaders_global_shader_uniforms_editor->set_name(TTRC("Shader Globals")); | 
					
						
							| 
									
										
										
										
											2022-04-03 18:56:43 +02:00
										 |  |  | 	shaders_global_shader_uniforms_editor->connect("globals_changed", callable_mp(this, &ProjectSettingsEditor::queue_save)); | 
					
						
							| 
									
										
										
										
											2024-06-04 21:23:43 +02:00
										 |  |  | 	globals_container->add_child(shaders_global_shader_uniforms_editor); | 
					
						
							| 
									
										
										
										
											2020-04-16 23:52:00 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-12 15:20:12 +07:00
										 |  |  | 	group_settings = memnew(GroupSettingsEditor); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	group_settings->set_name(TTRC("Groups")); | 
					
						
							| 
									
										
										
										
											2022-05-12 15:20:12 +07:00
										 |  |  | 	group_settings->connect("group_changed", callable_mp(this, &ProjectSettingsEditor::queue_save)); | 
					
						
							| 
									
										
										
										
											2024-06-04 21:23:43 +02:00
										 |  |  | 	globals_container->add_child(group_settings); | 
					
						
							| 
									
										
										
										
											2022-05-12 15:20:12 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 21:49:44 -02:00
										 |  |  | 	plugin_settings = memnew(EditorPluginSettings); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	plugin_settings->set_name(TTRC("Plugins")); | 
					
						
							| 
									
										
										
										
											2017-12-07 21:49:44 -02:00
										 |  |  | 	tab_container->add_child(plugin_settings); | 
					
						
							| 
									
										
										
										
											2016-02-27 23:10:44 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	timer = memnew(Timer); | 
					
						
							| 
									
										
										
										
											2018-07-03 20:33:06 +03:00
										 |  |  | 	timer->set_wait_time(1.5); | 
					
						
							| 
									
										
										
										
											2025-03-08 16:26:52 +02:00
										 |  |  | 	timer->connect("timeout", callable_mp(this, &ProjectSettingsEditor::_save)); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	timer->set_one_shot(true); | 
					
						
							|  |  |  | 	add_child(timer); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	set_ok_button_text(TTRC("Close")); | 
					
						
							| 
									
										
										
										
											2020-07-15 18:33:34 +02:00
										 |  |  | 	set_hide_on_ok(true); | 
					
						
							| 
									
										
										
										
											2021-02-17 13:44:49 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-05 18:52:44 +02:00
										 |  |  | 	bool use_advanced = EDITOR_DEF("_project_settings_advanced_mode", false); | 
					
						
							| 
									
										
										
										
											2021-02-17 13:44:49 -03:00
										 |  |  | 	if (use_advanced) { | 
					
						
							| 
									
										
										
										
											2024-09-21 21:11:58 +08:00
										 |  |  | 		advanced->set_pressed(true); | 
					
						
							| 
									
										
										
										
											2021-02-17 13:44:49 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2025-02-21 16:07:01 +01:00
										 |  |  | 	advanced->connect(SceneStringName(toggled), callable_mp(this, &ProjectSettingsEditor::_advanced_toggled)); | 
					
						
							| 
									
										
										
										
											2021-02-17 13:44:49 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-24 15:16:02 -04:00
										 |  |  | 	_update_advanced(use_advanced); | 
					
						
							| 
									
										
										
										
											2021-02-23 14:17:42 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	import_defaults_editor = memnew(ImportDefaultsEditor); | 
					
						
							| 
									
										
										
										
											2025-05-10 18:28:06 +02:00
										 |  |  | 	import_defaults_editor->set_name(TTRC("Import Defaults")); | 
					
						
							| 
									
										
										
										
											2021-02-23 14:17:42 -03:00
										 |  |  | 	tab_container->add_child(import_defaults_editor); | 
					
						
							| 
									
										
											  
											
												Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
											
										 
											2022-06-17 00:55:19 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	MovieWriter::set_extensions_hint(); // ensure extensions are properly displayed.
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } |