summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp3
-rw-r--r--editor/editor_audio_buses.cpp1
-rw-r--r--editor/editor_autoload_settings.cpp41
-rw-r--r--editor/editor_autoload_settings.h5
-rw-r--r--editor/editor_export.cpp2
-rw-r--r--editor/editor_feature_profile.cpp6
-rw-r--r--editor/editor_file_system.cpp10
-rw-r--r--editor/editor_help_search.cpp2
-rw-r--r--editor/editor_inspector.cpp2
-rw-r--r--editor/editor_node.cpp6
-rw-r--r--editor/editor_plugin_settings.cpp12
-rw-r--r--editor/editor_profiler.cpp67
-rw-r--r--editor/editor_resource_preview.cpp2
-rw-r--r--editor/editor_sectioned_inspector.cpp6
-rw-r--r--editor/editor_settings.cpp8
-rw-r--r--editor/editor_themes.cpp105
-rw-r--r--editor/editor_vcs_interface.cpp2
-rw-r--r--editor/export_template_manager.cpp2
-rw-r--r--editor/filesystem_dock.cpp22
-rw-r--r--editor/import/editor_import_collada.cpp14
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp5
-rw-r--r--editor/import/resource_importer_obj.cpp4
-rw-r--r--editor/plugin_config_dialog.cpp14
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp5
-rw-r--r--editor/plugins/script_editor_plugin.cpp6
-rw-r--r--editor/plugins/shader_editor_plugin.cpp4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp11
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp35
-rw-r--r--editor/project_export.cpp2
-rw-r--r--editor/project_manager.cpp27
-rw-r--r--editor/rename_dialog.cpp53
-rw-r--r--editor/rename_dialog.h2
-rw-r--r--editor/scene_tree_dock.cpp2
-rw-r--r--editor/script_create_dialog.cpp10
-rw-r--r--editor/script_editor_debugger.cpp50
-rw-r--r--editor/script_editor_debugger.h1
37 files changed, 343 insertions, 208 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 4f684c7bdc..e05ace53da 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -277,7 +277,8 @@ void FindReplaceBar::_replace_all() {
}
text_edit->set_v_scroll(vsval);
- set_error(vformat(TTR("Replaced %d occurrence(s)."), rc));
+ matches_label->add_color_override("font_color", rc > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
+ matches_label->set_text(vformat(TTR("%d replaced."), rc));
text_edit->call_deferred("connect", "text_changed", this, "_editor_text_changed");
results_count = -1;
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 3f773c646a..0a60aabd2d 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -856,7 +856,6 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
HBoxContainer *audioprev_hbc = memnew(HBoxContainer);
audioprev_hbc->set_v_size_flags(SIZE_EXPAND_FILL);
audioprev_hbc->set_h_size_flags(SIZE_EXPAND_FILL);
- audioprev_hbc->set_mouse_filter(MOUSE_FILTER_PASS);
audio_value_preview_box->add_child(audioprev_hbc);
audio_value_preview_label = memnew(Label);
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 46a54969e0..dba8c2ec8c 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -120,6 +120,7 @@ void EditorAutoloadSettings::_autoload_add() {
autoload_add_path->get_line_edit()->set_text("");
autoload_add_name->set_text("");
+ add_autoload->set_disabled(true);
}
void EditorAutoloadSettings::_autoload_selected() {
@@ -312,7 +313,34 @@ void EditorAutoloadSettings::_autoload_open(const String &fpath) {
void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
- autoload_add_name->set_text(p_path.get_file().get_basename());
+ // Convert the file name to PascalCase, which is the convention for classes in GDScript.
+ const String class_name = p_path.get_file().get_basename().capitalize().replace(" ", "");
+
+ // If the name collides with a built-in class, prefix the name to make it possible to add without having to edit the name.
+ // The prefix is subjective, but it provides better UX than leaving the Add button disabled :)
+ const String prefix = ClassDB::class_exists(class_name) ? "Global" : "";
+
+ autoload_add_name->set_text(prefix + class_name);
+ add_autoload->set_disabled(false);
+}
+
+void EditorAutoloadSettings::_autoload_text_entered(const String p_name) {
+
+ if (autoload_add_path->get_line_edit()->get_text() != "" && _autoload_name_is_valid(p_name, NULL)) {
+ _autoload_add();
+ }
+}
+
+void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) {
+
+ add_autoload->set_disabled(
+ p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), NULL));
+}
+
+void EditorAutoloadSettings::_autoload_text_changed(const String p_name) {
+
+ add_autoload->set_disabled(
+ autoload_add_path->get_line_edit()->get_text() == "" || !_autoload_name_is_valid(p_name, NULL));
}
Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {
@@ -424,7 +452,7 @@ void EditorAutoloadSettings::update_autoload() {
item->set_editable(2, true);
item->set_text(2, TTR("Enable"));
item->set_checked(2, info.is_singleton);
- item->add_button(3, get_icon("FileList", "EditorIcons"), BUTTON_OPEN);
+ item->add_button(3, get_icon("Load", "EditorIcons"), BUTTON_OPEN);
item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
item->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_DELETE);
@@ -713,7 +741,9 @@ void EditorAutoloadSettings::_bind_methods() {
ClassDB::bind_method("_autoload_edited", &EditorAutoloadSettings::_autoload_edited);
ClassDB::bind_method("_autoload_button_pressed", &EditorAutoloadSettings::_autoload_button_pressed);
ClassDB::bind_method("_autoload_activated", &EditorAutoloadSettings::_autoload_activated);
+ ClassDB::bind_method("_autoload_path_text_changed", &EditorAutoloadSettings::_autoload_path_text_changed);
ClassDB::bind_method("_autoload_text_entered", &EditorAutoloadSettings::_autoload_text_entered);
+ ClassDB::bind_method("_autoload_text_changed", &EditorAutoloadSettings::_autoload_text_changed);
ClassDB::bind_method("_autoload_open", &EditorAutoloadSettings::_autoload_open);
ClassDB::bind_method("_autoload_file_callback", &EditorAutoloadSettings::_autoload_file_callback);
@@ -806,6 +836,8 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL);
autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE);
autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback");
+ autoload_add_path->get_line_edit()->connect("text_changed", this, "_autoload_path_text_changed");
+
hbc->add_child(autoload_add_path);
l = memnew(Label);
@@ -815,11 +847,14 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
autoload_add_name = memnew(LineEdit);
autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL);
autoload_add_name->connect("text_entered", this, "_autoload_text_entered");
+ autoload_add_name->connect("text_changed", this, "_autoload_text_changed");
hbc->add_child(autoload_add_name);
- Button *add_autoload = memnew(Button);
+ add_autoload = memnew(Button);
add_autoload->set_text(TTR("Add"));
add_autoload->connect("pressed", this, "_autoload_add");
+ // The button will be enabled once a valid name is entered (either automatically or manually).
+ add_autoload->set_disabled(true);
hbc->add_child(add_autoload);
tree = memnew(Tree);
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index e1a04644aa..653a1b0a78 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -76,6 +76,7 @@ class EditorAutoloadSettings : public VBoxContainer {
Tree *tree;
EditorLineEditFileChooser *autoload_add_path;
LineEdit *autoload_add_name;
+ Button *add_autoload;
bool _autoload_name_is_valid(const String &p_name, String *r_error = NULL);
@@ -84,7 +85,9 @@ class EditorAutoloadSettings : public VBoxContainer {
void _autoload_edited();
void _autoload_button_pressed(Object *p_item, int p_column, int p_button);
void _autoload_activated();
- void _autoload_text_entered(String) { _autoload_add(); }
+ void _autoload_path_text_changed(const String p_path);
+ void _autoload_text_entered(const String p_name);
+ void _autoload_text_changed(const String p_name);
void _autoload_open(const String &fpath);
void _autoload_file_callback(const String &p_path);
Node *_create_autoload(const String &p_path);
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index d66b386f93..3d8ea0b040 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -748,7 +748,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
config.instance();
Error err = config->load(path + ".import");
if (err != OK) {
- ERR_PRINTS("Could not parse: '" + path + "', not exported.");
+ ERR_PRINT("Could not parse: '" + path + "', not exported.");
continue;
}
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index a4a7a0cd45..559a0ef0ea 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -192,14 +192,14 @@ Error EditorFeatureProfile::load_from_file(const String &p_path) {
Variant v;
err = JSON::parse(text, v, err_str, err_line);
if (err != OK) {
- ERR_PRINTS("Error parsing '" + p_path + "' on line " + itos(err_line) + ": " + err_str);
+ ERR_PRINT("Error parsing '" + p_path + "' on line " + itos(err_line) + ": " + err_str);
return ERR_PARSE_ERROR;
}
Dictionary json = v;
if (!json.has("type") || String(json["type"]) != "feature_profile") {
- ERR_PRINTS("Error parsing '" + p_path + "', it's not a feature profile.");
+ ERR_PRINT("Error parsing '" + p_path + "', it's not a feature profile.");
return ERR_PARSE_ERROR;
}
@@ -298,7 +298,7 @@ void EditorFeatureProfileManager::_notification(int p_what) {
current.instance();
Error err = current->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(current_profile + ".profile"));
if (err != OK) {
- ERR_PRINTS("Error loading default feature profile: " + current_profile);
+ ERR_PRINT("Error loading default feature profile: " + current_profile);
current_profile = String();
current.unref();
}
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 5abb3c4ec2..04fe6e5ce6 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -387,7 +387,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
- ERR_PRINTS("ResourceFormatImporter::load - '" + p_path + ".import:" + itos(lines) + "' error '" + error_text + "'.");
+ ERR_PRINT("ResourceFormatImporter::load - '" + p_path + ".import:" + itos(lines) + "' error '" + error_text + "'.");
memdelete(f);
return false; //parse error, try reimport manually (Avoid reimport loop on broken file)
}
@@ -435,7 +435,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
- ERR_PRINTS("ResourceFormatImporter::load - '" + p_path + ".import.md5:" + itos(lines) + "' error '" + error_text + "'.");
+ ERR_PRINT("ResourceFormatImporter::load - '" + p_path + ".import.md5:" + itos(lines) + "' error '" + error_text + "'.");
memdelete(md5s);
return false; // parse error
}
@@ -734,7 +734,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
da->change_dir("..");
}
} else {
- ERR_PRINTS("Cannot go into subdir '" + E->get() + "'.");
+ ERR_PRINT("Cannot go into subdir '" + E->get() + "'.");
}
p_progress.update(idx, total);
@@ -1114,7 +1114,7 @@ void EditorFileSystem::_notification(int p_what) {
Thread::wait_to_finish(thread);
memdelete(thread);
thread = NULL;
- WARN_PRINTS("Scan thread aborted...");
+ WARN_PRINT("Scan thread aborted...");
set_process(false);
}
@@ -1780,7 +1780,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
Error err = importer->import(p_file, base_path, params, &import_variants, &gen_files, &metadata);
if (err != OK) {
- ERR_PRINTS("Error importing '" + p_file + "'.");
+ ERR_PRINT("Error importing '" + p_file + "'.");
}
//as import is complete, save the .import file
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 700d9b692b..80981e8fa1 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -307,7 +307,7 @@ bool EditorHelpSearch::Runner::_slice() {
case PHASE_MAX:
return true;
default:
- WARN_PRINTS("Invalid or unhandled phase in EditorHelpSearch::Runner, aborting search.");
+ WARN_PRINT("Invalid or unhandled phase in EditorHelpSearch::Runner, aborting search.");
return true;
};
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 56da7d93fa..7c1e58862e 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1596,7 +1596,7 @@ void EditorInspector::update_tree() {
if (capitalize_paths)
cat = cat.capitalize();
- if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name))
+ if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name) && property_prefix.to_lower().find(filter.to_lower()) == -1)
continue;
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index dd15910d09..7d0601e8db 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2732,7 +2732,7 @@ void EditorNode::_tool_menu_option(int p_idx) {
handler->call(callback, (const Variant **)&ud, 1, ce);
if (ce.error != Variant::CallError::CALL_OK) {
String err = Variant::get_call_error_text(handler, callback, (const Variant **)&ud, 1, ce);
- ERR_PRINTS("Error calling function from tool menu: " + err);
+ ERR_PRINT("Error calling function from tool menu: " + err);
}
} // else it's a submenu so don't do anything.
} break;
@@ -3042,7 +3042,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
}
ps->set("editor_plugins/enabled", enabled_plugins);
ps->save();
- WARN_PRINTS("Addon '" + p_addon + "' failed to load. No directory found. Removing from enabled plugins.");
+ WARN_PRINT("Addon '" + p_addon + "' failed to load. No directory found. Removing from enabled plugins.");
return;
}
Error err = cf->load(addon_path);
@@ -3988,7 +3988,7 @@ void EditorNode::show_warning(const String &p_text, const String &p_title) {
warning->set_title(p_title);
warning->popup_centered_minsize();
} else {
- WARN_PRINTS(p_title + " " + p_text);
+ WARN_PRINT(p_title + " " + p_text);
}
}
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index b81a996956..16decf5c04 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -96,28 +96,28 @@ void EditorPluginSettings::update_plugins() {
Error err2 = cf->load(path);
if (err2 != OK) {
- WARN_PRINTS("Can't load plugin config: " + path);
+ WARN_PRINT("Can't load plugin config: " + path);
} else {
bool key_missing = false;
if (!cf->has_section_key("plugin", "name")) {
- WARN_PRINTS("Plugin config misses \"plugin/name\" key: " + path);
+ WARN_PRINT("Plugin config misses \"plugin/name\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "author")) {
- WARN_PRINTS("Plugin config misses \"plugin/author\" key: " + path);
+ WARN_PRINT("Plugin config misses \"plugin/author\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "version")) {
- WARN_PRINTS("Plugin config misses \"plugin/version\" key: " + path);
+ WARN_PRINT("Plugin config misses \"plugin/version\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "description")) {
- WARN_PRINTS("Plugin config misses \"plugin/description\" key: " + path);
+ WARN_PRINT("Plugin config misses \"plugin/description\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "script")) {
- WARN_PRINTS("Plugin config misses \"plugin/script\" key: " + path);
+ WARN_PRINT("Plugin config misses \"plugin/script\" key: " + path);
key_missing = true;
}
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 4807f8839c..e5a9c4d699 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -102,26 +102,28 @@ void EditorProfiler::clear() {
}
static String _get_percent_txt(float p_value, float p_total) {
- if (p_total == 0)
+ if (p_total == 0) {
p_total = 0.00001;
+ }
+
return String::num((p_value / p_total) * 100, 1) + "%";
}
String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_calls) {
- int dmode = display_mode->get_selected();
+ const int dmode = display_mode->get_selected();
if (dmode == DISPLAY_FRAME_TIME) {
- return rtos(p_time);
+ return rtos(p_time * 1000).pad_decimals(2) + " ms";
} else if (dmode == DISPLAY_AVERAGE_TIME) {
- if (p_calls == 0)
- return "0";
- else
- return rtos(p_time / p_calls);
+ if (p_calls == 0) {
+ return "0.00 ms";
+ } else {
+ return rtos((p_time / p_calls) * 1000).pad_decimals(2) + " ms";
+ }
} else if (dmode == DISPLAY_FRAME_PERCENT) {
return _get_percent_txt(p_time, m.frame_time);
} else if (dmode == DISPLAY_PHYSICS_FRAME_PERCENT) {
-
return _get_percent_txt(p_time, m.physics_frame_time);
}
@@ -163,12 +165,10 @@ void EditorProfiler::_item_edited() {
void EditorProfiler::_update_plot() {
- int w = graph->get_size().width;
- int h = graph->get_size().height;
-
+ const int w = graph->get_size().width;
+ const int h = graph->get_size().height;
bool reset_texture = false;
-
- int desired_len = w * h * 4;
+ const int desired_len = w * h * 4;
if (graph_image.size() != desired_len) {
reset_texture = true;
@@ -176,18 +176,19 @@ void EditorProfiler::_update_plot() {
}
PoolVector<uint8_t>::Write wr = graph_image.write();
+ const Color background_color = get_color("dark_color_2", "Editor");
- //clear
+ // Clear the previous frame and set the background color.
for (int i = 0; i < desired_len; i += 4) {
- wr[i + 0] = 0;
- wr[i + 1] = 0;
- wr[i + 2] = 0;
+ wr[i + 0] = Math::fast_ftoi(background_color.r * 255);
+ wr[i + 1] = Math::fast_ftoi(background_color.g * 255);
+ wr[i + 2] = Math::fast_ftoi(background_color.b * 255);
wr[i + 3] = 255;
}
//find highest value
- bool use_self = display_time->get_selected() == DISPLAY_SELF_TIME;
+ const bool use_self = display_time->get_selected() == DISPLAY_SELF_TIME;
float highest = 0;
for (int i = 0; i < frame_metrics.size(); i++) {
@@ -319,21 +320,23 @@ void EditorProfiler::_update_plot() {
for (int j = 0; j < h * 4; j += 4) {
- int a = column[j + 3];
+ const int a = column[j + 3];
if (a > 0) {
column[j + 0] /= a;
column[j + 1] /= a;
column[j + 2] /= a;
}
- uint8_t r = uint8_t(column[j + 0]);
- uint8_t g = uint8_t(column[j + 1]);
- uint8_t b = uint8_t(column[j + 2]);
+ const uint8_t red = uint8_t(column[j + 0]);
+ const uint8_t green = uint8_t(column[j + 1]);
+ const uint8_t blue = uint8_t(column[j + 2]);
+ const bool is_filled = red >= 1 || green >= 1 || blue >= 1;
+ const int widx = ((j >> 2) * w + i) * 4;
- int widx = ((j >> 2) * w + i) * 4;
- wr[widx + 0] = r;
- wr[widx + 1] = g;
- wr[widx + 2] = b;
+ // If the pixel isn't filled by any profiler line, apply the background color instead.
+ wr[widx + 0] = is_filled ? red : Math::fast_ftoi(background_color.r * 255);
+ wr[widx + 1] = is_filled ? green : Math::fast_ftoi(background_color.g * 255);
+ wr[widx + 2] = is_filled ? blue : Math::fast_ftoi(background_color.b * 255);
wr[widx + 3] = 255;
}
}
@@ -729,7 +732,7 @@ EditorProfiler::EditorProfiler() {
h_split->set_v_size_flags(SIZE_EXPAND_FILL);
variables = memnew(Tree);
- variables->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
+ variables->set_custom_minimum_size(Size2(320, 0) * EDSCALE);
variables->set_hide_folding(true);
h_split->add_child(variables);
variables->set_hide_root(true);
@@ -737,10 +740,10 @@ EditorProfiler::EditorProfiler() {
variables->set_column_titles_visible(true);
variables->set_column_title(0, TTR("Name"));
variables->set_column_expand(0, true);
- variables->set_column_min_width(0, 60);
+ variables->set_column_min_width(0, 60 * EDSCALE);
variables->set_column_title(1, TTR("Time"));
variables->set_column_expand(1, false);
- variables->set_column_min_width(1, 60 * EDSCALE);
+ variables->set_column_min_width(1, 100 * EDSCALE);
variables->set_column_title(2, TTR("Calls"));
variables->set_column_expand(2, false);
variables->set_column_min_width(2, 60 * EDSCALE);
@@ -749,7 +752,6 @@ EditorProfiler::EditorProfiler() {
graph = memnew(TextureRect);
graph->set_expand(true);
graph->set_mouse_filter(MOUSE_FILTER_STOP);
- //graph->set_ignore_mouse(false);
graph->connect("draw", this, "_graph_tex_draw");
graph->connect("gui_input", this, "_graph_tex_input");
graph->connect("mouse_exited", this, "_graph_tex_mouse_exit");
@@ -760,13 +762,10 @@ EditorProfiler::EditorProfiler() {
int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024);
frame_metrics.resize(metric_size);
last_metric = -1;
- //cursor_metric=-1;
hover_metric = -1;
EDITOR_DEF("debugger/profiler_frame_max_functions", 64);
- //display_mode=DISPLAY_FRAME_TIME;
-
frame_delay = memnew(Timer);
frame_delay->set_wait_time(0.1);
frame_delay->set_one_shot(true);
@@ -784,6 +783,4 @@ EditorProfiler::EditorProfiler() {
seeking = false;
graph_height = 1;
-
- //activate->set_disabled(true);
}
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index f63d4884e2..1f2a02c9a0 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -297,7 +297,7 @@ void EditorResourcePreview::_thread() {
if (!f) {
// Not returning as this would leave the thread hanging and would require
// some proper cleanup/disabling of resource preview generation.
- ERR_PRINTS("Cannot create file '" + file + "'. Check user write permissions.");
+ ERR_PRINT("Cannot create file '" + file + "'. Check user write permissions.");
} else {
f->store_line(itos(thumbnail_size));
f->store_line(itos(has_small_texture));
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index 28825b45e1..2090c12c91 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -245,6 +245,9 @@ void SectionedInspector::update_category_list() {
if (pi.name.find(":") != -1 || pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path" || pi.name == "resource_local_to_scene" || pi.name.begins_with("_global_script"))
continue;
+ if (!filter.empty() && !filter.is_subsequence_ofi(pi.name) && !filter.is_subsequence_ofi(pi.name.replace("/", " ").capitalize()))
+ continue;
+
int sp = pi.name.find("/");
if (sp == -1)
pi.name = "global/" + pi.name;
@@ -252,9 +255,6 @@ void SectionedInspector::update_category_list() {
Vector<String> sectionarr = pi.name.split("/");
String metasection;
- if (!filter.empty() && !filter.is_subsequence_ofi(sectionarr[sectionarr.size() - 1].capitalize()))
- continue;
-
int sc = MIN(2, sectionarr.size() - 1);
for (int i = 0; i < sc; i++) {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 92e3f61ca5..715ce6bea7 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -148,7 +148,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
const VariantContainer *v = props.getptr(p_name);
if (!v) {
- WARN_PRINTS("EditorSettings::_get - Property not found: " + String(p_name));
+ WARN_PRINT("EditorSettings::_get - Property not found: " + String(p_name));
return false;
}
r_ret = v->variant;
@@ -794,13 +794,13 @@ void EditorSettings::create() {
self_contained = true;
Error err = extra_config->load(exe_path + "/._sc_");
if (err != OK) {
- ERR_PRINTS("Can't load config from path '" + exe_path + "/._sc_'.");
+ ERR_PRINT("Can't load config from path '" + exe_path + "/._sc_'.");
}
} else if (d->file_exists(exe_path + "/_sc_")) {
self_contained = true;
Error err = extra_config->load(exe_path + "/_sc_");
if (err != OK) {
- ERR_PRINTS("Can't load config from path '" + exe_path + "/_sc_'.");
+ ERR_PRINT("Can't load config from path '" + exe_path + "/_sc_'.");
}
}
memdelete(d);
@@ -1056,7 +1056,7 @@ void EditorSettings::save() {
Error err = ResourceSaver::save(singleton->config_file_path, singleton);
if (err != OK) {
- ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path);
+ ERR_PRINT("Error saving editor settings to " + singleton->config_file_path);
} else {
print_verbose("EditorSettings: Save OK!");
}
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 621f531687..28bc20a957 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -35,7 +35,11 @@
#include "editor_icons.gen.h"
#include "editor_scale.h"
#include "editor_settings.h"
+
+#include "modules/modules_enabled.gen.h"
+#ifdef MODULE_SVG_ENABLED
#include "modules/svg/image_loader_svg.h"
+#endif
static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> p_texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) {
Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
@@ -89,7 +93,11 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float
// dumb gizmo check
bool is_gizmo = String(editor_icons_names[p_index]).begins_with("Gizmo");
- ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, true, p_convert_color);
+ // Upsample icon generation only if the editor scale isn't an integer multiplier.
+ // Generating upsampled icons is slower, and the benefit is hardly visible
+ // with integer editor scales.
+ const bool upsample = !Math::is_equal_approx(Math::round(p_scale), p_scale);
+ ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, upsample, p_convert_color);
if ((p_scale - (float)((int)p_scale)) > 0.0 || is_gizmo || p_force_filter)
icon->create_from_image(img); // in this case filter really helps
@@ -105,8 +113,16 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float
void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = true, int p_thumb_size = 32, bool p_only_thumbs = false) {
-#ifdef SVG_ENABLED
+#ifdef MODULE_SVG_ENABLED
+ // The default icon theme is designed to be used for a dark theme.
+ // This dictionary stores color codes to convert to other colors
+ // for better readability on a light theme.
Dictionary dark_icon_color_dictionary;
+
+ // The names of the icons to never convert, even if one of their colors
+ // are contained in the dictionary above.
+ Set<StringName> exceptions;
+
if (!p_dark_theme) {
// convert color: FROM TO
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e0e0e0", "#5a5a5a"); // common icon color
@@ -172,9 +188,31 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#69ec9a", "#2ce573"); // VS rid
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#79f3e8", "#12d5c3"); // VS object
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#77edb1", "#57e99f"); // VS dict
+
+ exceptions.insert("EditorPivot");
+ exceptions.insert("EditorHandle");
+ exceptions.insert("Editor3DHandle");
+ exceptions.insert("Godot");
+ exceptions.insert("PanoramaSky");
+ exceptions.insert("ProceduralSky");
+ exceptions.insert("EditorControlAnchor");
+ exceptions.insert("DefaultProjectIcon");
+ exceptions.insert("GuiCloseCustomizable");
+ exceptions.insert("GuiGraphNodePort");
+ exceptions.insert("GuiResizer");
+ exceptions.insert("ZoomMore");
+ exceptions.insert("ZoomLess");
+ exceptions.insert("ZoomReset");
+ exceptions.insert("LockViewport");
+ exceptions.insert("GroupViewport");
+ exceptions.insert("StatusError");
+ exceptions.insert("StatusSuccess");
+ exceptions.insert("StatusWarning");
+ exceptions.insert("NodeWarning");
+ exceptions.insert("OverbrightIndicator");
}
- // these ones should be converted even if we are using a dark theme
+ // These ones should be converted even if we are using a dark theme.
const Color error_color = p_theme->get_color("error_color", "Editor");
const Color success_color = p_theme->get_color("success_color", "Editor");
const Color warning_color = p_theme->get_color("warning_color", "Editor");
@@ -182,65 +220,44 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
dark_icon_color_dictionary[Color::html("#45ff8b")] = success_color;
dark_icon_color_dictionary[Color::html("#dbab09")] = warning_color;
- List<String> exceptions;
- exceptions.push_back("EditorPivot");
- exceptions.push_back("EditorHandle");
- exceptions.push_back("Editor3DHandle");
- exceptions.push_back("Godot");
- exceptions.push_back("PanoramaSky");
- exceptions.push_back("ProceduralSky");
- exceptions.push_back("EditorControlAnchor");
- exceptions.push_back("DefaultProjectIcon");
- exceptions.push_back("GuiCloseCustomizable");
- exceptions.push_back("GuiGraphNodePort");
- exceptions.push_back("GuiResizer");
- exceptions.push_back("ZoomMore");
- exceptions.push_back("ZoomLess");
- exceptions.push_back("ZoomReset");
- exceptions.push_back("LockViewport");
- exceptions.push_back("GroupViewport");
- exceptions.push_back("StatusError");
- exceptions.push_back("StatusSuccess");
- exceptions.push_back("StatusWarning");
- exceptions.push_back("NodeWarning");
- exceptions.push_back("OverbrightIndicator");
-
ImageLoaderSVG::set_convert_colors(&dark_icon_color_dictionary);
- // generate icons
- if (!p_only_thumbs)
+ // Generate icons.
+ if (!p_only_thumbs) {
for (int i = 0; i < editor_icons_count; i++) {
- List<String>::Element *is_exception = exceptions.find(editor_icons_names[i]);
- if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception);
+ const int is_exception = exceptions.has(editor_icons_names[i]);
+ const Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception);
+
p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon);
}
+ }
- // generate thumb files with the given thumb size
- bool force_filter = p_thumb_size != 64 && p_thumb_size != 32; // we don't need filter with original resolution
+ // Generate thumbnail icons with the given thumbnail size.
+ // We don't need filtering when generating at one of the default resolutions.
+ const bool force_filter = p_thumb_size != 64 && p_thumb_size != 32;
if (p_thumb_size >= 64) {
- float scale = (float)p_thumb_size / 64.0 * EDSCALE;
+ const float scale = (float)p_thumb_size / 64.0 * EDSCALE;
for (int i = 0; i < editor_bg_thumbs_count; i++) {
- int index = editor_bg_thumbs_indices[i];
- List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]);
- if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+ const int index = editor_bg_thumbs_indices[i];
+ const int is_exception = exceptions.has(editor_icons_names[index]);
+ const Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+
p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon);
}
} else {
- float scale = (float)p_thumb_size / 32.0 * EDSCALE;
+ const float scale = (float)p_thumb_size / 32.0 * EDSCALE;
for (int i = 0; i < editor_md_thumbs_count; i++) {
- int index = editor_md_thumbs_indices[i];
- List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]);
- if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+ const int index = editor_md_thumbs_indices[i];
+ const bool is_exception = exceptions.has(editor_icons_names[index]);
+ const Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+
p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon);
}
}
ImageLoaderSVG::set_convert_colors(NULL);
#else
- print_line("SVG support disabled, editor icons won't be rendered.");
+ WARN_PRINT("SVG support disabled, editor icons won't be rendered.");
#endif
}
diff --git a/editor/editor_vcs_interface.cpp b/editor/editor_vcs_interface.cpp
index 0562c3ba43..c420cf44e7 100644
--- a/editor/editor_vcs_interface.cpp
+++ b/editor/editor_vcs_interface.cpp
@@ -63,7 +63,7 @@ void EditorVCSInterface::_bind_methods() {
bool EditorVCSInterface::_initialize(String p_project_root_path) {
- WARN_PRINT("Selected VCS addon does not implement an initialization function. This warning will be suppressed.")
+ WARN_PRINT("Selected VCS addon does not implement an initialization function. This warning will be suppressed.");
return true;
}
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index cb636f8cdc..7ed6688154 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -638,7 +638,7 @@ Error ExportTemplateManager::install_android_template() {
FileAccess::set_unix_permissions(to_write, (info.external_fa >> 16) & 0x01FF);
#endif
} else {
- ERR_PRINTS("Can't uncompress file: " + to_write);
+ ERR_PRINT("Can't uncompress file: " + to_write);
}
}
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 62effb406d..5041441ac3 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1413,17 +1413,13 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
if (!can_move) {
// Ask to do something.
overwrite_dialog->popup_centered_minsize();
- overwrite_dialog->grab_focus();
return;
}
}
// Check groups.
for (int i = 0; i < to_move.size(); i++) {
-
- print_line("is group: " + to_move[i].path + ": " + itos(EditorFileSystem::get_singleton()->is_group_file(to_move[i].path)));
if (to_move[i].is_file && EditorFileSystem::get_singleton()->is_group_file(to_move[i].path)) {
- print_line("move to: " + p_to_path.plus_file(to_move[i].path.get_file()));
EditorFileSystem::get_singleton()->move_group_file(to_move[i].path, p_to_path.plus_file(to_move[i].path.get_file()));
}
}
@@ -1442,7 +1438,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
if (is_moved) {
int current_tab = editor->get_current_tab();
- _save_scenes_after_move(file_renames); //save scenes before updating
+ _save_scenes_after_move(file_renames); // Save scenes before updating.
_update_dependencies_after_move(file_renames);
_update_resource_paths_after_move(file_renames);
_update_project_settings_after_move(file_renames);
@@ -1948,7 +1944,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
return false;
// Attempting to move a folder into itself will fail later,
- // rather than bring up a message don't try to do it in the first place
+ // rather than bring up a message don't try to do it in the first place.
to_dir = to_dir.ends_with("/") ? to_dir : (to_dir + "/");
Vector<String> fnames = drag_data["files"];
for (int i = 0; i < fnames.size(); ++i) {
@@ -2050,11 +2046,15 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
Vector<String> fnames = drag_data["files"];
to_move.clear();
for (int i = 0; i < fnames.size(); i++) {
- to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/")));
+ if (fnames[i].get_base_dir() != to_dir) {
+ to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/")));
+ }
+ }
+ if (!to_move.empty()) {
+ _move_operation_confirm(to_dir);
}
- _move_operation_confirm(to_dir);
} else if (favorite) {
- // Add the files from favorites
+ // Add the files from favorites.
Vector<String> fnames = drag_data["files"];
Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < fnames.size(); i++) {
@@ -2103,6 +2103,10 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
// We drop on a folder.
target = fpath;
return;
+ } else {
+ // We drop on the folder that the target file is in.
+ target = fpath.get_base_dir();
+ return;
}
} else {
if (ti->get_parent() != tree->get_root()->get_children()) {
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index b3f97714ae..e2d8dc8962 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -892,7 +892,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
material = material_cache[target];
} else if (p.material != "") {
- WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + p.material);
+ WARN_PRINT("Collada: Unreferenced material in geometry instance: " + p.material);
}
}
@@ -1210,7 +1210,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mesh_cache[meshid] = mesh;
} else {
- WARN_PRINTS("Collada: Will not import geometry: " + meshid);
+ WARN_PRINT("Collada: Will not import geometry: " + meshid);
}
}
@@ -1237,7 +1237,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mi->set_surface_material(i, material);
} else if (matname != "") {
- WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + matname);
+ WARN_PRINT("Collada: Unreferenced material in geometry instance: " + matname);
}
}
}
@@ -1408,7 +1408,7 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im
node = node_name_map[at.target];
} else {
- WARN_PRINTS("Collada: Couldn't find node: " + at.target);
+ WARN_PRINT("Collada: Couldn't find node: " + at.target);
continue;
}
} else {
@@ -1588,7 +1588,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
if (xform_idx == -1) {
- WARN_PRINTS("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param + ".");
+ WARN_PRINT("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param + ".");
continue;
}
@@ -1666,7 +1666,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Collada::Node *cn = collada.state.scene_map[E->key()];
if (cn->ignore_anim) {
- WARN_PRINTS("Collada: Ignoring animation on node: " + path);
+ WARN_PRINT("Collada: Ignoring animation on node: " + path);
continue;
}
@@ -1735,7 +1735,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
//matrix
WARN_PRINT("Collada: Value keys for matrices not supported.");
} else {
- WARN_PRINTS("Collada: Unexpected amount of value keys: " + itos(data.size()));
+ WARN_PRINT("Collada: Unexpected amount of value keys: " + itos(data.size()));
}
animation->track_insert_key(track, time, value);
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 2f9135c52c..d4664e1bb9 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "editor_scene_importer_gltf.h"
+
#include "core/crypto/crypto_core.h"
#include "core/io/json.h"
#include "core/math/disjoint_set.h"
@@ -233,7 +234,7 @@ Error EditorSceneImporterGLTF::_parse_scenes(GLTFState &state) {
if (state.json.has("scene")) {
loaded_scene = state.json["scene"];
} else {
- WARN_PRINT("The load-time scene is not defined in the glTF2 file. Picking the first scene.")
+ WARN_PRINT("The load-time scene is not defined in the glTF2 file. Picking the first scene.");
}
if (scenes.size()) {
@@ -2438,7 +2439,7 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
track->weight_tracks.write[k] = cf;
}
} else {
- WARN_PRINTS("Invalid path '" + path + "'.");
+ WARN_PRINT("Invalid path '" + path + "'.");
}
}
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index b1ed59a2db..bdd6a197f8 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -63,7 +63,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
material_map[current_name] = current;
} else if (l.begins_with("Ka ")) {
//uv
- WARN_PRINTS("OBJ: Ambient light for material '" + current_name + "' is ignored in PBR");
+ WARN_PRINT("OBJ: Ambient light for material '" + current_name + "' is ignored in PBR");
} else if (l.begins_with("Kd ")) {
//normal
@@ -119,7 +119,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
} else if (l.begins_with("map_Ka ")) {
//uv
- WARN_PRINTS("OBJ: Ambient light texture for material '" + current_name + "' is ignored in PBR");
+ WARN_PRINT("OBJ: Ambient light texture for material '" + current_name + "' is ignored in PBR");
} else if (l.begins_with("map_Kd ")) {
//normal
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 07b87633a9..1506ba319c 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -35,9 +35,13 @@
#include "editor/editor_plugin.h"
#include "editor/editor_scale.h"
#include "editor/project_settings_editor.h"
-#include "modules/gdscript/gdscript.h"
#include "scene/gui/grid_container.h"
+#include "modules/modules_enabled.gen.h"
+#ifdef MODULE_GDSCRIPT_ENABLED
+#include "modules/gdscript/gdscript.h"
+#endif
+
void PluginConfigDialog::_clear_fields() {
name_edit->set_text("");
subfolder_edit->set_text("");
@@ -75,6 +79,9 @@ void PluginConfigDialog::_on_confirmed() {
// TODO Use script templates. Right now, this code won't add the 'tool' annotation to other languages.
// TODO Better support script languages with named classes (has_named_classes).
+ // FIXME: It's hacky to have hardcoded access to the GDScript module here.
+ // The editor code should not have to know what languages are enabled.
+#ifdef MODULE_GDSCRIPT_ENABLED
if (lang_name == GDScriptLanguage::get_singleton()->get_name()) {
// Hard-coded GDScript template to keep usability until we use script templates.
Ref<Script> gdscript = memnew(GDScript);
@@ -95,12 +102,15 @@ void PluginConfigDialog::_on_confirmed() {
ResourceSaver::save(script_path, gdscript);
script = gdscript;
} else {
+#endif
String script_path = path.plus_file(script_edit->get_text());
String class_name = script_path.get_file().get_basename();
script = ScriptServer::get_language(lang_idx)->get_template(class_name, "EditorPlugin");
script->set_path(script_path);
ResourceSaver::save(script_path, script);
+#ifdef MODULE_GDSCRIPT_ENABLED
}
+#endif
emit_signal("plugin_ready", script.operator->(), active_edit->is_pressed() ? subfolder_edit->get_text() : "");
} else {
@@ -229,9 +239,11 @@ PluginConfigDialog::PluginConfigDialog() {
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
ScriptLanguage *lang = ScriptServer::get_language(i);
script_option_edit->add_item(lang->get_name());
+#ifdef MODULE_GDSCRIPT_ENABLED
if (lang == GDScriptLanguage::get_singleton()) {
default_lang = i;
}
+#endif
}
script_option_edit->select(default_lang);
grid->add_child(script_option_edit);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 4f73a5eaea..2428bf82d4 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -139,8 +139,6 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
set_custom_minimum_size(Size2(250, 100) * EDSCALE);
set_h_size_flags(SIZE_EXPAND_FILL);
-
- set_mouse_filter(MOUSE_FILTER_PASS);
}
//////////////////////////////////////////////////////////////////////////////
@@ -812,7 +810,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
_image_update(p_code == HTTPClient::RESPONSE_NOT_MODIFIED, true, p_data, p_queue_id);
} else {
- WARN_PRINTS("Error getting image file from URL: " + image_queue[p_queue_id].image_url);
+ WARN_PRINT("Error getting image file from URL: " + image_queue[p_queue_id].image_url);
Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target);
if (obj) {
obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("FileBrokenBigThumb", "EditorIcons"));
@@ -1455,7 +1453,6 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
library_scroll->add_child(library_vb_border);
library_vb_border->add_style_override("panel", border2);
library_vb_border->set_h_size_flags(SIZE_EXPAND_FILL);
- library_vb_border->set_mouse_filter(MOUSE_FILTER_PASS);
library_vb = memnew(VBoxContainer);
library_vb->set_h_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index f13abd47a9..1da47196f8 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -3209,7 +3209,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_list = memnew(ItemList);
scripts_vbox->add_child(script_list);
- script_list->set_custom_minimum_size(Size2(150, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
+ script_list->set_custom_minimum_size(Size2(150, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
script_list->set_v_size_flags(SIZE_EXPAND_FILL);
script_split->set_split_offset(140);
_sort_list_on_update = true;
@@ -3254,14 +3254,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
overview_vbox->add_child(members_overview);
members_overview->set_allow_reselect(true);
- members_overview->set_custom_minimum_size(Size2(0, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
+ members_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
members_overview->set_v_size_flags(SIZE_EXPAND_FILL);
members_overview->set_allow_rmb_select(true);
help_overview = memnew(ItemList);
overview_vbox->add_child(help_overview);
help_overview->set_allow_reselect(true);
- help_overview->set_custom_minimum_size(Size2(0, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
+ help_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
help_overview->set_v_size_flags(SIZE_EXPAND_FILL);
tab_container = memnew(TabContainer);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index c24a666c55..a19f0b4975 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -369,6 +369,7 @@ void ShaderEditor::_editor_settings_changed() {
shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type"));
shader_editor->get_text_edit()->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs"));
+ shader_editor->get_text_edit()->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/indent/draw_spaces"));
shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_numbers"));
shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences"));
@@ -381,6 +382,9 @@ void ShaderEditor::_editor_settings_changed() {
shader_editor->get_text_edit()->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/navigation/v_scroll_speed"));
shader_editor->get_text_edit()->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/navigation/show_minimap"));
shader_editor->get_text_edit()->set_minimap_width((int)EditorSettings::get_singleton()->get("text_editor/navigation/minimap_width") * EDSCALE);
+ shader_editor->get_text_edit()->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guideline"));
+ shader_editor->get_text_edit()->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_column"));
+ shader_editor->get_text_edit()->set_breakpoint_gutter_enabled(false);
}
void ShaderEditor::_bind_methods() {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 507ea0b83d..94aef60f1f 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -546,6 +546,17 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
edit_draw->update();
}
}
+
+ Ref<InputEventMagnifyGesture> magnify_gesture = p_input;
+ if (magnify_gesture.is_valid()) {
+ _zoom_on_position(draw_zoom * magnify_gesture->get_factor(), magnify_gesture->get_position());
+ }
+
+ Ref<InputEventPanGesture> pan_gesture = p_input;
+ if (pan_gesture.is_valid()) {
+ hscroll->set_value(hscroll->get_value() + hscroll->get_page() * pan_gesture->get_delta().x / 8);
+ vscroll->set_value(vscroll->get_value() + vscroll->get_page() * pan_gesture->get_delta().y / 8);
+ }
}
void TextureRegionEditor::_scroll_changed(float) {
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index c53fc7e6c5..3622ca8d61 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -203,7 +203,7 @@ void VersionControlEditorPlugin::_refresh_stage_area() {
}
} else {
- WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu.")
+ WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu.");
}
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index e334d4b093..fb095692bc 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -556,6 +556,7 @@ void VisualShaderEditor::_update_graph() {
}
Ref<VisualShaderNodeUniform> uniform = vsnode;
+ Ref<VisualShaderNodeScalarUniform> scalar_uniform = vsnode;
if (uniform.is_valid()) {
graph->add_child(node);
_update_created_node(node);
@@ -570,7 +571,9 @@ void VisualShaderEditor::_update_graph() {
//shortcut
VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0);
node->set_slot(0, false, VisualShaderNode::PORT_TYPE_SCALAR, Color(), true, port_right, type_color[port_right]);
- continue;
+ if (!scalar_uniform.is_valid()) {
+ continue;
+ }
}
port_offset++;
}
@@ -582,11 +585,16 @@ void VisualShaderEditor::_update_graph() {
}
}
- if (custom_editor && vsnode->get_output_port_count() > 0 && vsnode->get_output_port_name(0) == "" && (vsnode->get_input_port_count() == 0 || vsnode->get_input_port_name(0) == "")) {
+ if (custom_editor && !scalar_uniform.is_valid() && vsnode->get_output_port_count() > 0 && vsnode->get_output_port_name(0) == "" && (vsnode->get_input_port_count() == 0 || vsnode->get_input_port_name(0) == "")) {
//will be embedded in first port
} else if (custom_editor) {
+
port_offset++;
node->add_child(custom_editor);
+ if (scalar_uniform.is_valid()) {
+ custom_editor->call_deferred("_show_prop_names", true);
+ continue;
+ }
custom_editor = NULL;
}
@@ -2972,6 +2980,13 @@ public:
bool updating;
Ref<VisualShaderNode> node;
Vector<EditorProperty *> properties;
+ Vector<Label *> prop_names;
+
+ void _show_prop_names(bool p_show) {
+ for (int i = 0; i < prop_names.size(); i++) {
+ prop_names[i]->set_visible(p_show);
+ }
+ }
void setup(Ref<Resource> p_parent_resource, Vector<EditorProperty *> p_properties, const Vector<StringName> &p_names, Ref<VisualShaderNode> p_node) {
parent_resource = p_parent_resource;
@@ -2981,7 +2996,20 @@ public:
for (int i = 0; i < p_properties.size(); i++) {
- add_child(p_properties[i]);
+ HBoxContainer *hbox = memnew(HBoxContainer);
+ hbox->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_child(hbox);
+
+ Label *prop_name = memnew(Label);
+ String prop_name_str = p_names[i];
+ prop_name_str = prop_name_str.capitalize() + ":";
+ prop_name->set_text(prop_name_str);
+ prop_name->set_visible(false);
+ hbox->add_child(prop_name);
+ prop_names.push_back(prop_name);
+
+ p_properties[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ hbox->add_child(p_properties[i]);
bool res_prop = Object::cast_to<EditorPropertyResource>(p_properties[i]);
if (res_prop) {
@@ -3003,6 +3031,7 @@ public:
ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request);
ClassDB::bind_method("_resource_selected", &VisualShaderNodePluginDefaultEditor::_resource_selected);
ClassDB::bind_method("_open_inspector", &VisualShaderNodePluginDefaultEditor::_open_inspector);
+ ClassDB::bind_method("_show_prop_names", &VisualShaderNodePluginDefaultEditor::_show_prop_names);
}
};
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 8245264e0d..3c8fef6233 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -974,7 +974,7 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
error_dialog->set_text(vformat(TTR("Failed to export the project for platform '%s'.\nThis might be due to a configuration issue in the export preset or your export settings."), platform->get_name()));
}
- ERR_PRINTS(vformat("Failed to export the project for platform '%s'.", platform->get_name()));
+ ERR_PRINT(vformat("Failed to export the project for platform '%s'.", platform->get_name()));
error_dialog->show();
error_dialog->popup_centered_minsize(Size2(300, 80));
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 30e31cb530..ee434aaac2 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -163,7 +163,7 @@ private:
}
if (valid_path == "") {
- set_message(TTR("The path does not exist."), MESSAGE_ERROR);
+ set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -177,7 +177,7 @@ private:
}
if (valid_install_path == "") {
- set_message(TTR("The path does not exist."), MESSAGE_ERROR, INSTALL_PATH);
+ set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -195,7 +195,7 @@ private:
unzFile pkg = unzOpen2(valid_path.utf8().get_data(), &io);
if (!pkg) {
- set_message(TTR("Error opening package file, not in ZIP format."), MESSAGE_ERROR);
+ set_message(TTR("Error opening package file (it's not in ZIP format)."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
unzClose(pkg);
@@ -216,7 +216,7 @@ private:
}
if (ret == UNZ_END_OF_LIST_OF_FILE) {
- set_message(TTR("Invalid '.zip' project file, does not contain a 'project.godot' file."), MESSAGE_ERROR);
+ set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
unzClose(pkg);
@@ -230,7 +230,11 @@ private:
bool is_empty = true;
String n = d->get_next();
while (n != String()) {
- if (n != "." && n != "..") {
+ if (!n.begins_with(".")) {
+ // Allow `.`, `..` (reserved current/parent folder names)
+ // and hidden files/folders to be present.
+ // For instance, this lets users initialize a Git repository
+ // and still be able to create a project in the directory afterwards.
is_empty = false;
break;
}
@@ -247,7 +251,7 @@ private:
}
} else {
- set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR);
+ set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
memdelete(d);
install_path_container->hide();
get_ok()->set_disabled(true);
@@ -256,7 +260,7 @@ private:
} else if (valid_path.ends_with("zip")) {
- set_message(TTR("Directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH);
+ set_message(TTR("This directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -269,7 +273,11 @@ private:
bool is_empty = true;
String n = d->get_next();
while (n != String()) {
- if (n != "." && n != "..") { // i don't know if this is enough to guarantee an empty dir
+ if (!n.begins_with(".")) {
+ // Allow `.`, `..` (reserved current/parent folder names)
+ // and hidden files/folders to be present.
+ // For instance, this lets users initialize a Git repository
+ // and still be able to create a project in the directory afterwards.
is_empty = false;
break;
}
@@ -332,7 +340,7 @@ private:
install_path_container->show();
get_ok()->set_disabled(false);
} else {
- set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR);
+ set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
get_ok()->set_disabled(true);
return;
}
@@ -1316,6 +1324,7 @@ void ProjectList::create_project_item_control(int p_index) {
// The project icon may not be loaded by the time the control is displayed,
// so use a loading placeholder.
tf->set_texture(get_icon("ProjectIconLoading", "EditorIcons"));
+ tf->set_v_size_flags(SIZE_SHRINK_CENTER);
if (item.missing) {
tf->set_modulate(Color(1, 1, 1, 0.5));
}
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 32fcdab4c6..317be309a3 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -109,9 +109,13 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
const int feature_min_height = 160 * EDSCALE;
- CheckButton *chk_collapse_features = memnew(CheckButton);
- chk_collapse_features->set_text(TTR("Advanced Options"));
- vbc->add_child(chk_collapse_features);
+ cbut_regex = memnew(CheckButton);
+ cbut_regex->set_text(TTR("Use Regular Expressions"));
+ vbc->add_child(cbut_regex);
+
+ CheckButton *cbut_collapse_features = memnew(CheckButton);
+ cbut_collapse_features->set_text(TTR("Advanced Options"));
+ vbc->add_child(cbut_collapse_features);
tabc_features = memnew(TabContainer);
tabc_features->set_tab_align(TabContainer::ALIGN_LEFT);
@@ -195,7 +199,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
grd_substitute->add_child(but_insert_count);
chk_per_level_counter = memnew(CheckBox);
- chk_per_level_counter->set_text(TTR("Per Level counter"));
+ chk_per_level_counter->set_text(TTR("Per-level Counter"));
chk_per_level_counter->set_tooltip(TTR("If set the counter restarts for each group of child nodes"));
vbc_substitute->add_child(chk_per_level_counter);
@@ -233,18 +237,6 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
spn_count_padding->set_step(1);
hbc_count_options->add_child(spn_count_padding);
- // ---- Tab RegEx
-
- VBoxContainer *vbc_regex = memnew(VBoxContainer);
- vbc_regex->set_h_size_flags(SIZE_EXPAND_FILL);
- vbc_regex->set_name(TTR("Regular Expressions"));
- vbc_regex->set_custom_minimum_size(Size2(0, feature_min_height));
- tabc_features->add_child(vbc_regex);
-
- cbut_regex = memnew(CheckBox);
- cbut_regex->set_text(TTR("Regular Expressions"));
- vbc_regex->add_child(cbut_regex);
-
// ---- Tab Process
VBoxContainer *vbc_process = memnew(VBoxContainer);
@@ -268,8 +260,8 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
opt_style = memnew(OptionButton);
opt_style->add_item(TTR("Keep"));
- opt_style->add_item(TTR("CamelCase to under_scored"));
- opt_style->add_item(TTR("under_scored to CamelCase"));
+ opt_style->add_item(TTR("PascalCase to snake_case"));
+ opt_style->add_item(TTR("snake_case to PascalCase"));
hbc_style->add_child(opt_style);
// ------ Case
@@ -299,7 +291,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
lbl_preview = memnew(Label);
lbl_preview->set_text("");
- lbl_preview->add_color_override("font_color", Color(1, 0.5f, 0, 1));
+ lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
vbc->add_child(lbl_preview);
// ---- Dialog related
@@ -314,7 +306,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// ---- Connections
- chk_collapse_features->connect("toggled", this, "_features_toggled");
+ cbut_collapse_features->connect("toggled", this, "_features_toggled");
// Substitite Buttons
@@ -414,9 +406,12 @@ void RenameDialog::_update_preview(String new_text) {
lbl_preview->set_text(new_name);
if (new_name == preview_node->get_name()) {
- lbl_preview->add_color_override("font_color", Color(0, 0.5f, 0.25f, 1));
+ // New name is identical to the old one. Don't color it as much to avoid distracting the user.
+ const Color accent_color = EditorNode::get_singleton()->get_gui_base()->get_color("accent_color", "Editor");
+ const Color text_color = EditorNode::get_singleton()->get_gui_base()->get_color("default_color", "RichTextLabel");
+ lbl_preview->add_color_override("font_color", accent_color.linear_interpolate(text_color, 0.5));
} else {
- lbl_preview->add_color_override("font_color", Color(0, 1, 0.5f, 1));
+ lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor"));
}
}
@@ -501,9 +496,9 @@ void RenameDialog::_error_handler(void *p_self, const char *p_func, const char *
}
self->has_errors = true;
- self->lbl_preview_title->set_text(TTR("Error"));
- self->lbl_preview->add_color_override("font_color", Color(1, 0.25f, 0, 1));
- self->lbl_preview->set_text(err_str);
+ self->lbl_preview_title->set_text(TTR("Regular Expression Error"));
+ self->lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
+ self->lbl_preview->set_text(vformat(TTR("At character %s"), err_str));
}
String RenameDialog::_regex(const String &pattern, const String &subject, const String &replacement) {
@@ -520,18 +515,18 @@ String RenameDialog::_postprocess(const String &subject) {
String result = subject;
if (style_id == 1) {
+ // PascalCase to snake_case
- // CamelCase to Under_Line
result = result.camelcase_to_underscore(true);
result = _regex("_+", result, "_");
} else if (style_id == 2) {
+ // snake_case to PascalCase
- // Under_Line to CamelCase
RegEx pattern("_+(.?)");
Array matches = pattern.search_all(result);
- // _ name would become empty. Ignore
+ // The name `_` would become empty; ignore it.
if (matches.size() && result != "_") {
String buffer;
int start = 0;
@@ -617,7 +612,7 @@ void RenameDialog::rename() {
const String &new_name = to_rename[i].second;
if (!n) {
- ERR_PRINTS("Skipping missing node: " + to_rename[i].first.get_concatenated_subnames());
+ ERR_PRINT("Skipping missing node: " + to_rename[i].first.get_concatenated_subnames());
continue;
}
diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h
index 692e56f1a4..2825cb2cd2 100644
--- a/editor/rename_dialog.h
+++ b/editor/rename_dialog.h
@@ -75,7 +75,7 @@ class RenameDialog : public ConfirmationDialog {
TabContainer *tabc_features;
CheckBox *cbut_substitute;
- CheckBox *cbut_regex;
+ CheckButton *cbut_regex;
CheckBox *cbut_process;
CheckBox *chk_per_level_counter;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index dca6087f8b..7410a998ad 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -981,7 +981,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (!new_node) {
new_node = memnew(Node);
- ERR_PRINTS("Creating root from favorite '" + selected_favorite_root + "' failed. Creating 'Node' instead.");
+ ERR_PRINT("Creating root from favorite '" + selected_favorite_root + "' failed. Creating 'Node' instead.");
}
} else {
switch (p_tool) {
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 35d5fe5f70..c4627e6627 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -84,7 +84,9 @@ void ScriptCreateDialog::_path_hbox_sorted() {
int filename_start_pos = initial_bp.find_last("/") + 1;
int filename_end_pos = initial_bp.length();
- file_path->select(filename_start_pos, filename_end_pos);
+ if (!is_built_in) {
+ file_path->select(filename_start_pos, filename_end_pos);
+ }
// First set cursor to the end of line to scroll LineEdit view
// to the right and then set the actual cursor position.
@@ -575,6 +577,10 @@ void ScriptCreateDialog::_browse_class_in_tree() {
void ScriptCreateDialog::_path_changed(const String &p_path) {
+ if (is_built_in) {
+ return;
+ }
+
is_path_valid = false;
is_new_script_created = true;
@@ -644,7 +650,7 @@ void ScriptCreateDialog::_update_dialog() {
}
if (script_ok) {
- _msg_script_valid(true, TTR("Script is valid."));
+ _msg_script_valid(true, TTR("Script path/name is valid."));
}
// Does script have named classes?
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 71a946b256..34547717fd 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -338,7 +338,7 @@ void ScriptEditorDebugger::_file_selected(const String &p_file) {
FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
if (err != OK) {
- ERR_PRINTS("Failed to open " + p_file);
+ ERR_PRINT("Failed to open " + p_file);
return;
}
Vector<String> line;
@@ -484,8 +484,10 @@ int ScriptEditorDebugger::_update_scene_tree(TreeItem *parent, const Array &node
void ScriptEditorDebugger::_video_mem_request() {
- ERR_FAIL_COND(connection.is_null());
- ERR_FAIL_COND(!connection->is_connected_to_host());
+ if (connection.is_null() || !connection->is_connected_to_host()) {
+ // Video RAM usage is only available while a project is being debugged.
+ return;
+ }
Array msg;
msg.push_back("request_video_mem");
@@ -806,25 +808,25 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
p.write[i] = arr[i];
if (i < perf_items.size()) {
- float v = p[i];
- String vs = rtos(v);
- String tt = vs;
+ const float value = p[i];
+ String label = rtos(value);
+ String tooltip = label;
switch (Performance::MonitorType((int)perf_items[i]->get_metadata(1))) {
case Performance::MONITOR_TYPE_MEMORY: {
- vs = String::humanize_size(v);
- tt = vs;
+ label = String::humanize_size(value);
+ tooltip = label;
} break;
case Performance::MONITOR_TYPE_TIME: {
- tt += " seconds";
- vs += " s";
+ label = rtos(value * 1000).pad_decimals(2) + " ms";
+ tooltip = label;
} break;
default: {
- tt += " " + perf_items[i]->get_text(0);
+ tooltip += " " + perf_items[i]->get_text(0);
} break;
}
- perf_items[i]->set_text(1, vs);
- perf_items[i]->set_tooltip(1, tt);
+ perf_items[i]->set_text(1, label);
+ perf_items[i]->set_tooltip(1, tooltip);
if (p[i] > perf_max[i])
perf_max.write[i] = p[i];
}
@@ -1323,6 +1325,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
inspect_scene_tree->clear();
le_set->set_disabled(true);
le_clear->set_disabled(false);
+ vmem_refresh->set_disabled(false);
error_tree->clear();
error_count = 0;
warning_count = 0;
@@ -1523,6 +1526,7 @@ void ScriptEditorDebugger::stop() {
le_clear->set_disabled(false);
le_set->set_disabled(true);
profiler->set_enabled(true);
+ vmem_refresh->set_disabled(true);
inspect_scene_tree->clear();
inspector->edit(NULL);
@@ -1622,6 +1626,7 @@ void ScriptEditorDebugger::_output_clear() {
void ScriptEditorDebugger::_export_csv() {
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_dialog_mode = SAVE_CSV;
file_dialog->popup_centered_ratio();
}
@@ -2187,6 +2192,13 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
}
}
+void ScriptEditorDebugger::_tab_changed(int p_tab) {
+ if (tabs->get_tab_title(p_tab) == TTR("Video RAM")) {
+ // "Video RAM" tab was clicked, refresh the data it's dislaying when entering the tab.
+ _video_mem_request();
+ }
+}
+
void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_stack_dump_frame_selected"), &ScriptEditorDebugger::_stack_dump_frame_selected);
@@ -2218,6 +2230,7 @@ void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_error_tree_item_rmb_selected"), &ScriptEditorDebugger::_error_tree_item_rmb_selected);
ClassDB::bind_method(D_METHOD("_item_menu_id_pressed"), &ScriptEditorDebugger::_item_menu_id_pressed);
+ ClassDB::bind_method(D_METHOD("_tab_changed"), &ScriptEditorDebugger::_tab_changed);
ClassDB::bind_method(D_METHOD("_paused"), &ScriptEditorDebugger::_paused);
@@ -2258,13 +2271,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
+ tabs->connect("tab_changed", this, "_tab_changed");
add_child(tabs);
{ //debugger
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_name(TTR("Debugger"));
- //tabs->add_child(vbc);
Control *dbg = vbc;
HBoxContainer *hbc = memnew(HBoxContainer);
@@ -2522,6 +2535,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
vmem_total->set_custom_minimum_size(Size2(100, 0) * EDSCALE);
vmem_hb->add_child(vmem_total);
vmem_refresh = memnew(ToolButton);
+ vmem_refresh->set_disabled(true);
vmem_hb->add_child(vmem_refresh);
vmem_vb->add_child(vmem_hb);
vmem_refresh->connect("pressed", this, "_video_mem_request");
@@ -2534,20 +2548,20 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
vmmc->set_v_size_flags(SIZE_EXPAND_FILL);
vmem_vb->add_child(vmmc);
- vmem_vb->set_name(TTR("Video Mem"));
+ vmem_vb->set_name(TTR("Video RAM"));
vmem_tree->set_columns(4);
vmem_tree->set_column_titles_visible(true);
vmem_tree->set_column_title(0, TTR("Resource Path"));
vmem_tree->set_column_expand(0, true);
vmem_tree->set_column_expand(1, false);
vmem_tree->set_column_title(1, TTR("Type"));
- vmem_tree->set_column_min_width(1, 100);
+ vmem_tree->set_column_min_width(1, 100 * EDSCALE);
vmem_tree->set_column_expand(2, false);
vmem_tree->set_column_title(2, TTR("Format"));
- vmem_tree->set_column_min_width(2, 150);
+ vmem_tree->set_column_min_width(2, 150 * EDSCALE);
vmem_tree->set_column_expand(3, false);
vmem_tree->set_column_title(3, TTR("Usage"));
- vmem_tree->set_column_min_width(3, 80);
+ vmem_tree->set_column_min_width(3, 80 * EDSCALE);
vmem_tree->set_hide_root(true);
tabs->add_child(vmem_vb);
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index 7d91e247b6..589a011bff 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -226,6 +226,7 @@ private:
void _error_tree_item_rmb_selected(const Vector2 &p_pos);
void _item_menu_id_pressed(int p_option);
+ void _tab_changed(int p_tab);
void _export_csv();