summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/connections_dialog.cpp31
-rw-r--r--editor/editor_fonts.cpp12
-rw-r--r--editor/editor_settings.cpp23
-rw-r--r--editor/plugins/script_text_editor.cpp37
4 files changed, 64 insertions, 39 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 569ad0297e..6d3603f31b 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -363,7 +363,7 @@ ConnectDialog::ConnectDialog() {
tree->connect("node_selected", this, "_tree_node_selected");
tree->set_connect_to_script_mode(true);
- Node *mc = vbc_left->add_margin_child(TTR("Connect To Script:"), tree, true);
+ Node *mc = vbc_left->add_margin_child(TTR("Connect to Script:"), tree, true);
connect_to_label = Object::cast_to<Label>(vbc_left->get_child(mc->get_index() - 1));
error_label = memnew(Label);
@@ -413,7 +413,7 @@ ConnectDialog::ConnectDialog() {
vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true);
HBoxContainer *dstm_hb = memnew(HBoxContainer);
- vbc_left->add_margin_child("Method to Create:", dstm_hb);
+ vbc_left->add_margin_child("Receiver Method:", dstm_hb);
dst_method = memnew(LineEdit);
dst_method->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -489,8 +489,26 @@ void ConnectionsDock::_make_or_edit_connection() {
bool oshot = connect_dialog->get_oneshot();
cToMake.flags = CONNECT_PERSIST | (defer ? CONNECT_DEFERRED : 0) | (oshot ? CONNECT_ONESHOT : 0);
- // Conditions to add function, must have a script and must have a method.
- bool add_script_function = !target->get_script().is_null() && !ClassDB::has_method(target->get_class(), cToMake.method);
+ // Conditions to add function: must have a script and must not have the method already
+ // (in the class, the script itself, or inherited).
+ bool add_script_function = false;
+ Ref<Script> script = target->get_script();
+ if (!target->get_script().is_null() && !ClassDB::has_method(target->get_class(), cToMake.method)) {
+ // There is a chance that the method is inherited from another script.
+ bool found_inherited_function = false;
+ Ref<Script> inherited_script = script->get_base_script();
+ while (!inherited_script.is_null()) {
+ int line = inherited_script->get_language()->find_function(cToMake.method, inherited_script->get_source_code());
+ if (line != -1) {
+ found_inherited_function = true;
+ break;
+ }
+
+ inherited_script = inherited_script->get_base_script();
+ }
+
+ add_script_function = !found_inherited_function;
+ }
PoolStringArray script_function_args;
if (add_script_function) {
// Pick up args here before "it" is deleted by update_tree.
@@ -507,8 +525,7 @@ void ConnectionsDock::_make_or_edit_connection() {
_connect(cToMake);
}
- // IMPORTANT NOTE: _disconnect and _connect cause an update_tree,
- // which will delete the object "it" is pointing to.
+ // IMPORTANT NOTE: _disconnect and _connect cause an update_tree, which will delete the object "it" is pointing to.
it = NULL;
if (add_script_function) {
@@ -677,7 +694,7 @@ void ConnectionsDock::_open_connection_dialog(Connection cToEdit) {
if (src && dst) {
connect_dialog->set_title(TTR("Edit Connection:") + cToEdit.signal);
- connect_dialog->popup_centered_ratio();
+ connect_dialog->popup_centered();
connect_dialog->init(cToEdit, true);
}
}
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index cddabbc4e4..cf14cf3e00 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -206,7 +206,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
dfmono->set_font_ptr(_font_Hack_Regular, _font_Hack_Regular_size);
//dfd->set_force_autohinter(true); //just looks better..i think?
- int default_font_size = int(EditorSettings::get_singleton()->get("interface/editor/main_font_size")) * EDSCALE;
+ int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE;
// Default font
MAKE_DEFAULT_FONT(df, default_font_size);
@@ -221,9 +221,9 @@ void editor_register_fonts(Ref<Theme> p_theme) {
p_theme->set_font("title", "EditorFonts", df_title);
// Doc font
- MAKE_BOLD_FONT(df_doc_title, int(EDITOR_DEF("text_editor/help/help_title_font_size", 23)) * EDSCALE);
+ MAKE_BOLD_FONT(df_doc_title, int(EDITOR_GET("text_editor/help/help_title_font_size")) * EDSCALE);
- MAKE_DEFAULT_FONT(df_doc, int(EDITOR_DEF("text_editor/help/help_font_size", 15)) * EDSCALE);
+ MAKE_DEFAULT_FONT(df_doc, int(EDITOR_GET("text_editor/help/help_font_size")) * EDSCALE);
p_theme->set_font("doc", "EditorFonts", df_doc);
p_theme->set_font("doc_title", "EditorFonts", df_doc_title);
@@ -236,13 +236,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
p_theme->set_font("rulers", "EditorFonts", df_rulers);
// Code font
- MAKE_SOURCE_FONT(df_code, int(EditorSettings::get_singleton()->get("interface/editor/code_font_size")) * EDSCALE);
+ MAKE_SOURCE_FONT(df_code, int(EDITOR_GET("interface/editor/code_font_size")) * EDSCALE);
p_theme->set_font("source", "EditorFonts", df_code);
- MAKE_SOURCE_FONT(df_expression, (int(EditorSettings::get_singleton()->get("interface/editor/code_font_size")) - 1) * EDSCALE);
+ MAKE_SOURCE_FONT(df_expression, (int(EDITOR_GET("interface/editor/code_font_size")) - 1) * EDSCALE);
p_theme->set_font("expression", "EditorFonts", df_expression);
- MAKE_SOURCE_FONT(df_output_code, int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE);
+ MAKE_SOURCE_FONT(df_output_code, int(EDITOR_GET("run/output/font_size")) * EDSCALE);
p_theme->set_font("output_source", "EditorFonts", df_output_code);
MAKE_SOURCE_FONT(df_text_editor_status_code, default_font_size);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index a6746c6d25..58e3cc6fc1 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -320,19 +320,19 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/editor/custom_display_scale", 1.0f);
hints["interface/editor/custom_display_scale"] = PropertyInfo(Variant::REAL, "interface/editor/custom_display_scale", PROPERTY_HINT_RANGE, "0.5,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/main_font_size", 14);
- hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- _initial_set("interface/editor/code_font_size", 14);
- hints["interface/editor/code_font_size"] = PropertyInfo(Variant::INT, "interface/editor/code_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT);
+ hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "8,48,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/main_font_antialiased", true);
- _initial_set("interface/editor/code_font_antialiased", true);
_initial_set("interface/editor/main_font_hinting", 2);
hints["interface/editor/main_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/main_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT);
- _initial_set("interface/editor/code_font_hinting", 2);
- hints["interface/editor/code_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/code_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/main_font", "");
hints["interface/editor/main_font"] = PropertyInfo(Variant::STRING, "interface/editor/main_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/main_font_bold", "");
hints["interface/editor/main_font_bold"] = PropertyInfo(Variant::STRING, "interface/editor/main_font_bold", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT);
+ _initial_set("interface/editor/code_font_size", 14);
+ hints["interface/editor/code_font_size"] = PropertyInfo(Variant::INT, "interface/editor/code_font_size", PROPERTY_HINT_RANGE, "8,48,1", PROPERTY_USAGE_DEFAULT);
+ _initial_set("interface/editor/code_font_antialiased", true);
+ _initial_set("interface/editor/code_font_hinting", 2);
+ hints["interface/editor/code_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/code_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/code_font", "");
hints["interface/editor/code_font"] = PropertyInfo(Variant::STRING, "interface/editor/code_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/dim_editor_on_dialog_popup", true);
@@ -491,8 +491,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// Help
_initial_set("text_editor/help/show_help_index", true);
- _initial_set("text_editor/help_source_font_size", 14);
- hints["text_editor/help/help_source_font_size"] = PropertyInfo(Variant::REAL, "text_editor/help/help_source_font_size", PROPERTY_HINT_RANGE, "10, 50, 1");
+ _initial_set("text_editor/help/help_font_size", 15);
+ hints["text_editor/help/help_font_size"] = PropertyInfo(Variant::INT, "text_editor/help/help_font_size", PROPERTY_HINT_RANGE, "8,48,1");
+ _initial_set("text_editor/help/help_source_font_size", 14);
+ hints["text_editor/help/help_source_font_size"] = PropertyInfo(Variant::INT, "text_editor/help/help_source_font_size", PROPERTY_HINT_RANGE, "8,48,1");
+ _initial_set("text_editor/help/help_title_font_size", 23);
+ hints["text_editor/help/help_title_font_size"] = PropertyInfo(Variant::INT, "text_editor/help/help_title_font_size", PROPERTY_HINT_RANGE, "8,48,1");
/* Editors */
@@ -600,7 +604,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("run/auto_save/save_before_running", true);
// Output
- hints["run/output/font_size"] = PropertyInfo(Variant::INT, "run/output/font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT);
+ _initial_set("run/output/font_size", 13);
+ hints["run/output/font_size"] = PropertyInfo(Variant::INT, "run/output/font_size", PROPERTY_HINT_RANGE, "8,48,1");
_initial_set("run/output/always_clear_output_on_play", true);
_initial_set("run/output/always_open_output_on_play", true);
_initial_set("run/output/always_close_output_on_stop", false);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index cea65bb9b4..c7a438948d 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -882,26 +882,29 @@ void ScriptTextEditor::_update_connected_methods() {
continue;
}
- int line = script->get_language()->find_function(connection.method, text_edit->get_text());
- if (line < 0) {
- // There is a chance that the method is inherited from another script.
- bool found_inherited_function = false;
- Ref<Script> inherited_script = script->get_base_script();
- while (!inherited_script.is_null()) {
- line = inherited_script->get_language()->find_function(connection.method, inherited_script->get_source_code());
- if (line != -1) {
- found_inherited_function = true;
- break;
+ if (!ClassDB::has_method(script->get_instance_base_type(), connection.method)) {
+
+ int line = script->get_language()->find_function(connection.method, text_edit->get_text());
+ if (line < 0) {
+ // There is a chance that the method is inherited from another script.
+ bool found_inherited_function = false;
+ Ref<Script> inherited_script = script->get_base_script();
+ while (!inherited_script.is_null()) {
+ line = inherited_script->get_language()->find_function(connection.method, inherited_script->get_source_code());
+ if (line != -1) {
+ found_inherited_function = true;
+ break;
+ }
+
+ inherited_script = inherited_script->get_base_script();
}
- inherited_script = inherited_script->get_base_script();
- }
-
- if (!found_inherited_function) {
- missing_connections.push_back(connection);
+ if (!found_inherited_function) {
+ missing_connections.push_back(connection);
+ }
+ } else {
+ text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method);
}
- } else {
- text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method);
}
}
}