feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -50,10 +50,12 @@
|
|||
#include "editor/editor_property_name_processor.h"
|
||||
#include "editor/editor_translation.h"
|
||||
#include "editor/engine_update_label.h"
|
||||
#include "modules/regex/regex.h"
|
||||
#include "scene/gui/color_picker.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/animation.h"
|
||||
|
||||
// PRIVATE METHODS
|
||||
|
||||
|
|
@ -67,7 +69,18 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
|
|||
bool changed = _set_only(p_name, p_value);
|
||||
if (changed && initialized) {
|
||||
changed_settings.insert(p_name);
|
||||
if (p_name == SNAME("text_editor/external/exec_path")) {
|
||||
const StringName exec_args_name = "text_editor/external/exec_flags";
|
||||
const String exec_args_value = _guess_exec_args_for_extenal_editor(p_value);
|
||||
if (!exec_args_value.is_empty() && _set_only(exec_args_name, exec_args_value)) {
|
||||
changed_settings.insert(exec_args_name);
|
||||
}
|
||||
}
|
||||
emit_signal(SNAME("settings_changed"));
|
||||
|
||||
if (p_name == SNAME("interface/editor/editor_language")) {
|
||||
setup_language();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -182,6 +195,11 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
} else if (p_name == "builtin_action_overrides") {
|
||||
Array actions_arr;
|
||||
for (const KeyValue<String, List<Ref<InputEvent>>> &action_override : builtin_action_overrides) {
|
||||
const List<Ref<InputEvent>> *defaults = InputMap::get_singleton()->get_builtins().getptr(action_override.key);
|
||||
if (!defaults) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<Ref<InputEvent>> events = action_override.value;
|
||||
|
||||
Dictionary action_dict;
|
||||
|
|
@ -197,8 +215,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
}
|
||||
|
||||
Array defaults_arr;
|
||||
List<Ref<InputEvent>> defaults = InputMap::get_singleton()->get_builtins()[action_override.key];
|
||||
for (const Ref<InputEvent> &default_input_event : defaults) {
|
||||
for (const Ref<InputEvent> &default_input_event : *defaults) {
|
||||
if (default_input_event.is_valid()) {
|
||||
defaults_arr.append(default_input_event);
|
||||
}
|
||||
|
|
@ -389,7 +406,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
for (const String &locale : get_editor_locales()) {
|
||||
// Skip locales which we can't render properly (see above comment).
|
||||
// Test against language code without regional variants (e.g. ur_PK).
|
||||
String lang_code = locale.get_slice("_", 0);
|
||||
String lang_code = locale.get_slicec('_', 0);
|
||||
if (locales_to_skip.has(lang_code)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -431,6 +448,20 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
}
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/editor_screen", EditorSettings::InitialScreen::INITIAL_SCREEN_AUTO, ed_screen_hints)
|
||||
|
||||
#ifdef WINDOWS_ENABLED
|
||||
String tablet_hints = "Use Project Settings:-1";
|
||||
for (int i = 0; i < DisplayServer::get_singleton()->tablet_get_driver_count(); i++) {
|
||||
String drv_name = DisplayServer::get_singleton()->tablet_get_driver_name(i);
|
||||
if (EditorPropertyNameProcessor::get_singleton()) {
|
||||
drv_name = EditorPropertyNameProcessor::get_singleton()->process_name(drv_name, EditorPropertyNameProcessor::STYLE_CAPITALIZED); // Note: EditorPropertyNameProcessor is not available when doctool is used, but this value is not part of docs.
|
||||
}
|
||||
tablet_hints += vformat(",%s:%d", drv_name, i);
|
||||
}
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/tablet_driver", -1, tablet_hints);
|
||||
#else
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/tablet_driver", -1, "Default:-1");
|
||||
#endif
|
||||
|
||||
String project_manager_screen_hints = "Screen With Mouse Pointer:-4,Screen With Keyboard Focus:-3,Primary Screen:-2";
|
||||
for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) {
|
||||
project_manager_screen_hints += ",Screen " + itos(i + 1) + ":" + itos(i);
|
||||
|
|
@ -439,7 +470,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
|
||||
{
|
||||
EngineUpdateLabel::UpdateMode default_update_mode = EngineUpdateLabel::UpdateMode::NEWEST_UNSTABLE;
|
||||
if (String(VERSION_STATUS) == String("stable")) {
|
||||
if (String(GODOT_VERSION_STATUS) == String("stable")) {
|
||||
default_update_mode = EngineUpdateLabel::UpdateMode::NEWEST_STABLE;
|
||||
}
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "network/connection/engine_version_update_mode", int(default_update_mode), "Disable Update Checks,Check Newest Preview,Check Newest Stable,Check Newest Patch"); // Uses EngineUpdateLabel::UpdateMode.
|
||||
|
|
@ -553,6 +584,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/touchscreen/scale_gizmo_handles", has_touchscreen_ui ? 3 : 1, "1,5,1")
|
||||
set_restart_if_changed("interface/touchscreen/scale_gizmo_handles", true);
|
||||
|
||||
// Only available in the Android editor.
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_touch_actions_panel", true, "")
|
||||
set_restart_if_changed("interface/touchscreen/enable_touch_actions_panel", true);
|
||||
|
||||
// Disable some touchscreen settings by default for the XR Editor.
|
||||
bool is_native_touchscreen = has_touchscreen_ui && !OS::get_singleton()->has_feature("xr_editor");
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_long_press_as_right_click", is_native_touchscreen, "")
|
||||
|
|
@ -626,6 +661,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
_initial_set("docks/scene_tree/auto_expand_to_selected", true);
|
||||
_initial_set("docks/scene_tree/center_node_on_reparent", false);
|
||||
_initial_set("docks/scene_tree/hide_filtered_out_parents", true);
|
||||
_initial_set("docks/scene_tree/accessibility_warnings", false);
|
||||
|
||||
// FileSystem
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "docks/filesystem/thumbnail_size", 64, "32,128,16")
|
||||
|
|
@ -710,6 +746,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
_initial_set("text_editor/behavior/files/auto_reload_scripts_on_external_change", false);
|
||||
_initial_set("text_editor/behavior/files/auto_reload_and_parse_scripts_on_save", true);
|
||||
_initial_set("text_editor/behavior/files/open_dominant_script_on_scene_change", false, true);
|
||||
_initial_set("text_editor/behavior/files/drop_preload_resources_as_uid", true, true);
|
||||
|
||||
// Behavior: Documentation
|
||||
_initial_set("text_editor/behavior/documentation/enable_tooltips", true, true);
|
||||
|
|
@ -765,7 +802,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/secondary_grid_color", Color(0.38, 0.38, 0.38, 0.5), "")
|
||||
|
||||
// Use a similar color to the 2D editor selection.
|
||||
EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/selection_box_color", Color(1.0, 0.5, 0), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
|
||||
EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/selection_box_color", Color(1.0, 0.5, 0), "", PROPERTY_USAGE_DEFAULT)
|
||||
EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/active_selection_box_color", Color(1.5, 0.75, 0, 1.0), "", PROPERTY_USAGE_DEFAULT)
|
||||
EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d_gizmos/gizmo_colors/instantiated", Color(0.7, 0.7, 0.7, 0.6), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
|
||||
EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
|
||||
EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d_gizmos/gizmo_colors/aabb", Color(0.28, 0.8, 0.82), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
|
||||
|
|
@ -845,7 +883,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/freelook/freelook_navigation_scheme", 0, "Default,Partially Axis-Locked (id Tech),Fully Axis-Locked (Minecraft)")
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/freelook/freelook_sensitivity", 0.25, "0.01,2,0.001")
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/freelook/freelook_inertia", 0.0, "0,1,0.001")
|
||||
EDITOR_SETTING_BASIC(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/freelook/freelook_base_speed", 5.0, "0,10,0.01")
|
||||
EDITOR_SETTING_BASIC(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/freelook/freelook_base_speed", 5.0, "0,10,0.01,or_greater")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/freelook/freelook_activation_modifier", 0, "None,Shift,Alt,Meta,Ctrl")
|
||||
_initial_set("editors/3d/freelook/freelook_speed_zoom_link", false);
|
||||
|
||||
|
|
@ -894,6 +932,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/polygon_editor/auto_bake_delay", 1.5, "-1.0,10.0,0.01");
|
||||
|
||||
// Animation
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/animation/default_animation_step", Animation::DEFAULT_STEP, "0.0,10.0,0.00000001");
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/animation/default_fps_mode", 0, "Seconds,FPS");
|
||||
_initial_set("editors/animation/default_fps_compatibility", true);
|
||||
_initial_set("editors/animation/autorename_animation_tracks", true);
|
||||
_initial_set("editors/animation/confirm_insert_track", true, true);
|
||||
_initial_set("editors/animation/default_create_bezier_tracks", false, true);
|
||||
|
|
@ -984,6 +1025,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
|
||||
EDITOR_SETTING_BASIC(Variant::BOOL, PROPERTY_HINT_NONE, "debugger/auto_switch_to_remote_scene_tree", false, "")
|
||||
EDITOR_SETTING_BASIC(Variant::BOOL, PROPERTY_HINT_NONE, "debugger/auto_switch_to_stack_trace", true, "")
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "debugger/max_node_selection", 20, "1,100,1")
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "debugger/profiler_frame_history_size", 3600, "60,10000,1")
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "debugger/profiler_frame_max_functions", 64, "16,512,1")
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "debugger/profiler_target_fps", 60, "1,1000,1")
|
||||
|
|
@ -1074,6 +1116,7 @@ void EditorSettings::_load_godot2_text_editor_theme() {
|
|||
_initial_set("text_editor/theme/highlighting/function_color", Color(0.4, 0.64, 0.81), true);
|
||||
_initial_set("text_editor/theme/highlighting/member_variable_color", Color(0.9, 0.31, 0.35), true);
|
||||
_initial_set("text_editor/theme/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4), true);
|
||||
_initial_set("text_editor/theme/highlighting/warning_color", Color(1.0, 0.8, 0.4, 0.1), true);
|
||||
_initial_set("text_editor/theme/highlighting/bookmark_color", Color(0.08, 0.49, 0.98));
|
||||
_initial_set("text_editor/theme/highlighting/breakpoint_color", Color(0.9, 0.29, 0.3));
|
||||
_initial_set("text_editor/theme/highlighting/executing_line_color", Color(0.98, 0.89, 0.27));
|
||||
|
|
@ -1107,6 +1150,40 @@ void EditorSettings::_load_default_visual_shader_editor_theme() {
|
|||
_initial_set("editors/visual_editors/category_colors/particle_color", Color(0.12, 0.358, 0.8));
|
||||
}
|
||||
|
||||
String EditorSettings::_guess_exec_args_for_extenal_editor(const String &p_path) {
|
||||
Ref<RegEx> regex;
|
||||
regex.instantiate();
|
||||
|
||||
const String editor_pattern = R"([\\/]((?:jetbrains\s*)?rider(?:\s*(eap|\d{4}\.\d+|\d{4}\.\d+\s*dev)?)?|visual\s*studio\s*code|subl(ime\s*text)?|sublime_text|(g)?vim|emacs|atom|geany|kate|code|(vs)?codium)(?:\.app|\.exe|\.bat|\.sh)?)";
|
||||
regex->compile(editor_pattern);
|
||||
Ref<RegExMatch> editor_match = regex->search(p_path.to_lower());
|
||||
|
||||
if (editor_match.is_null()) {
|
||||
return String();
|
||||
}
|
||||
|
||||
const String editor = editor_match->get_string(1).to_lower();
|
||||
String new_exec_flags = "{file}";
|
||||
|
||||
if (editor.begins_with("rider")) {
|
||||
new_exec_flags = "{project} --line {line} {file}";
|
||||
} else if (editor == "subl" || editor == "sublime text" || editor == "sublime_text") {
|
||||
new_exec_flags = "{project} {file}:{line}:{column}";
|
||||
} else if (editor == "vim" || editor == "gvim") {
|
||||
new_exec_flags = "\"+call cursor({line}, {col})\" {file}";
|
||||
} else if (editor == "emacs") {
|
||||
new_exec_flags = "emacs +{line}:{col} {file}";
|
||||
} else if (editor == "atom") {
|
||||
new_exec_flags = "{file}:{line}";
|
||||
} else if (editor == "geany" || editor == "kate") {
|
||||
new_exec_flags = "{file} --line {line} --column {col}";
|
||||
} else if (editor == "code" || editor == "visual studio code" || editor == "codium" || editor == "vscodium") {
|
||||
new_exec_flags = "{project} --goto {file}:{line}:{col}";
|
||||
}
|
||||
|
||||
return new_exec_flags;
|
||||
}
|
||||
|
||||
bool EditorSettings::_save_text_editor_theme(const String &p_file) {
|
||||
String theme_section = "color_theme";
|
||||
Ref<ConfigFile> cf = memnew(ConfigFile); // hex is better?
|
||||
|
|
@ -1153,16 +1230,16 @@ EditorSettings *EditorSettings::get_singleton() {
|
|||
|
||||
String EditorSettings::get_existing_settings_path() {
|
||||
const String config_dir = EditorPaths::get_singleton()->get_config_dir();
|
||||
int minor = VERSION_MINOR;
|
||||
int minor = GODOT_VERSION_MINOR;
|
||||
String filename;
|
||||
|
||||
do {
|
||||
if (VERSION_MAJOR == 4 && minor < 3) {
|
||||
if (GODOT_VERSION_MAJOR == 4 && minor < 3) {
|
||||
// Minor version is used since 4.3, so special case to load older settings.
|
||||
filename = vformat("editor_settings-%d.tres", VERSION_MAJOR);
|
||||
filename = vformat("editor_settings-%d.tres", GODOT_VERSION_MAJOR);
|
||||
minor = -1;
|
||||
} else {
|
||||
filename = vformat("editor_settings-%d.%d.tres", VERSION_MAJOR, minor);
|
||||
filename = vformat("editor_settings-%d.%d.tres", GODOT_VERSION_MAJOR, minor);
|
||||
minor--;
|
||||
}
|
||||
} while (minor >= 0 && !FileAccess::exists(config_dir.path_join(filename)));
|
||||
|
|
@ -1170,7 +1247,7 @@ String EditorSettings::get_existing_settings_path() {
|
|||
}
|
||||
|
||||
String EditorSettings::get_newest_settings_path() {
|
||||
const String config_file_name = vformat("editor_settings-%d.%d.tres", VERSION_MAJOR, VERSION_MINOR);
|
||||
const String config_file_name = vformat("editor_settings-%d.%d.tres", GODOT_VERSION_MAJOR, GODOT_VERSION_MINOR);
|
||||
return EditorPaths::get_singleton()->get_config_dir().path_join(config_file_name);
|
||||
}
|
||||
|
||||
|
|
@ -1255,9 +1332,9 @@ fail:
|
|||
|
||||
void EditorSettings::setup_language() {
|
||||
String lang = get("interface/editor/editor_language");
|
||||
TranslationServer::get_singleton()->set_locale(lang);
|
||||
|
||||
if (lang == "en") {
|
||||
TranslationServer::get_singleton()->set_locale(lang);
|
||||
return; // Default, nothing to do.
|
||||
}
|
||||
// Load editor translation for configured/detected locale.
|
||||
|
|
@ -1269,6 +1346,8 @@ void EditorSettings::setup_language() {
|
|||
|
||||
// Load extractable translation for projects.
|
||||
load_extractable_translations(lang);
|
||||
|
||||
TranslationServer::get_singleton()->set_locale(lang);
|
||||
}
|
||||
|
||||
void EditorSettings::setup_network() {
|
||||
|
|
@ -1748,7 +1827,7 @@ String EditorSettings::get_editor_layouts_config() const {
|
|||
return EditorPaths::get_singleton()->get_config_dir().path_join("editor_layouts.cfg");
|
||||
}
|
||||
|
||||
float EditorSettings::get_auto_display_scale() const {
|
||||
float EditorSettings::get_auto_display_scale() {
|
||||
#ifdef LINUXBSD_ENABLED
|
||||
if (DisplayServer::get_singleton()->get_name() == "Wayland") {
|
||||
float main_window_scale = DisplayServer::get_singleton()->screen_get_scale(DisplayServer::SCREEN_OF_MAIN_WINDOW);
|
||||
|
|
@ -2058,7 +2137,6 @@ void EditorSettings::notify_changes() {
|
|||
root->propagate_notification(NOTIFICATION_EDITOR_SETTINGS_CHANGED);
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void EditorSettings::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
const String pf = p_function;
|
||||
if (p_idx == 0) {
|
||||
|
|
@ -2085,7 +2163,6 @@ void EditorSettings::get_argument_options(const StringName &p_function, int p_id
|
|||
}
|
||||
Object::get_argument_options(p_function, p_idx, r_options);
|
||||
}
|
||||
#endif
|
||||
|
||||
void EditorSettings::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("has_setting", "name"), &EditorSettings::has_setting);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue