summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/doc_tools.cpp111
-rw-r--r--editor/editor_export.cpp14
-rw-r--r--editor/editor_help.cpp334
-rw-r--r--editor/editor_help.h2
-rw-r--r--editor/editor_help_search.cpp24
-rw-r--r--editor/editor_help_search.h16
-rw-r--r--editor/editor_node.cpp99
-rw-r--r--editor/editor_node.h12
-rw-r--r--editor/editor_resource_preview.cpp217
-rw-r--r--editor/editor_resource_preview.h9
-rw-r--r--editor/editor_spin_slider.cpp14
-rw-r--r--editor/editor_spin_slider.h1
-rw-r--r--editor/editor_toaster.cpp7
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp2
-rw-r--r--editor/project_manager.cpp7
16 files changed, 551 insertions, 320 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index beead74c53..61cc6dbd4a 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -57,25 +57,21 @@ void DocTools::merge_from(const DocTools &p_data) {
c.brief_description = cf.brief_description;
c.tutorials = cf.tutorials;
- for (int i = 0; i < c.methods.size(); i++) {
- DocData::MethodDoc &m = c.methods.write[i];
+ for (int i = 0; i < c.constructors.size(); i++) {
+ DocData::MethodDoc &m = c.constructors.write[i];
- for (int j = 0; j < cf.methods.size(); j++) {
- if (cf.methods[j].name != m.name) {
+ for (int j = 0; j < cf.constructors.size(); j++) {
+ if (cf.constructors[j].name != m.name) {
continue;
}
- const char *operator_prefix = "operator "; // Operators use a space at the end, making this prefix an invalid identifier (and differentiating from methods).
-
- if (cf.methods[j].name == c.name || cf.methods[j].name.begins_with(operator_prefix)) {
- // Since constructors and operators can repeat, we need to check the type of
+ {
+ // Since constructors can repeat, we need to check the type of
// the arguments so we make sure they are different.
-
- if (cf.methods[j].arguments.size() != m.arguments.size()) {
+ if (cf.constructors[j].arguments.size() != m.arguments.size()) {
continue;
}
-
- int arg_count = cf.methods[j].arguments.size();
+ int arg_count = cf.constructors[j].arguments.size();
Vector<bool> arg_used;
arg_used.resize(arg_count);
for (int l = 0; l < arg_count; ++l) {
@@ -85,7 +81,7 @@ void DocTools::merge_from(const DocTools &p_data) {
// have to check one by one so we make sure we have an exact match
for (int k = 0; k < arg_count; ++k) {
for (int l = 0; l < arg_count; ++l) {
- if (cf.methods[j].arguments[k].type == m.arguments[l].type && !arg_used[l]) {
+ if (cf.constructors[j].arguments[k].type == m.arguments[l].type && !arg_used[l]) {
arg_used.write[l] = true;
break;
}
@@ -102,6 +98,21 @@ void DocTools::merge_from(const DocTools &p_data) {
}
}
+ const DocData::MethodDoc &mf = cf.constructors[j];
+
+ m.description = mf.description;
+ break;
+ }
+ }
+
+ for (int i = 0; i < c.methods.size(); i++) {
+ DocData::MethodDoc &m = c.methods.write[i];
+
+ for (int j = 0; j < cf.methods.size(); j++) {
+ if (cf.methods[j].name != m.name) {
+ continue;
+ }
+
const DocData::MethodDoc &mf = cf.methods[j];
m.description = mf.description;
@@ -165,6 +176,54 @@ void DocTools::merge_from(const DocTools &p_data) {
}
}
+ for (int i = 0; i < c.operators.size(); i++) {
+ DocData::MethodDoc &m = c.operators.write[i];
+
+ for (int j = 0; j < cf.operators.size(); j++) {
+ if (cf.operators[j].name != m.name) {
+ continue;
+ }
+
+ {
+ // Since operators can repeat, we need to check the type of
+ // the arguments so we make sure they are different.
+ if (cf.operators[j].arguments.size() != m.arguments.size()) {
+ continue;
+ }
+ int arg_count = cf.operators[j].arguments.size();
+ Vector<bool> arg_used;
+ arg_used.resize(arg_count);
+ for (int l = 0; l < arg_count; ++l) {
+ arg_used.write[l] = false;
+ }
+ // also there is no guarantee that argument ordering will match, so we
+ // have to check one by one so we make sure we have an exact match
+ for (int k = 0; k < arg_count; ++k) {
+ for (int l = 0; l < arg_count; ++l) {
+ if (cf.operators[j].arguments[k].type == m.arguments[l].type && !arg_used[l]) {
+ arg_used.write[l] = true;
+ break;
+ }
+ }
+ }
+ bool not_the_same = false;
+ for (int l = 0; l < arg_count; ++l) {
+ if (!arg_used[l]) { // at least one of the arguments was different
+ not_the_same = true;
+ }
+ }
+ if (not_the_same) {
+ continue;
+ }
+ }
+
+ const DocData::MethodDoc &mf = cf.operators[j];
+
+ m.description = mf.description;
+ break;
+ }
+ }
+
#ifndef MODULE_MONO_ENABLED
// The Mono module defines some properties that we want to keep when
// re-generating docs with a non-Mono build, to prevent pointless diffs
@@ -650,11 +709,6 @@ void DocTools::generate(bool p_basic_types) {
DocData::MethodDoc method;
method.name = mi.name;
- if (method.name == cname) {
- method.qualifiers = "constructor";
- } else if (method.name.begins_with("operator")) {
- method.qualifiers = "operator";
- }
for (int j = 0; j < mi.arguments.size(); j++) {
PropertyInfo arginfo = mi.arguments[j];
@@ -694,7 +748,13 @@ void DocTools::generate(bool p_basic_types) {
method.qualifiers += "static";
}
- c.methods.push_back(method);
+ if (method.name == cname) {
+ c.constructors.push_back(method);
+ } else if (method.name.begins_with("operator")) {
+ c.operators.push_back(method);
+ } else {
+ c.methods.push_back(method);
+ }
}
List<PropertyInfo> properties;
@@ -916,7 +976,7 @@ static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> &
methods.push_back(method);
} else {
- ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + parser->get_node_name() + ".");
+ ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + parser->get_node_name() + ", expected " + element + ".");
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == section) {
@@ -1044,10 +1104,15 @@ Error DocTools::_load(Ref<XMLParser> parser) {
break; // End of <tutorials>.
}
}
+ } else if (name2 == "constructors") {
+ Error err2 = _parse_methods(parser, c.constructors);
+ ERR_FAIL_COND_V(err2, err2);
} else if (name2 == "methods") {
Error err2 = _parse_methods(parser, c.methods);
ERR_FAIL_COND_V(err2, err2);
-
+ } else if (name2 == "operators") {
+ Error err2 = _parse_methods(parser, c.operators);
+ ERR_FAIL_COND_V(err2, err2);
} else if (name2 == "signals") {
Error err2 = _parse_methods(parser, c.signals);
ERR_FAIL_COND_V(err2, err2);
@@ -1269,6 +1334,8 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
}
_write_string(f, 1, "</tutorials>");
+ _write_method_doc(f, "constructor", c.constructors);
+
_write_method_doc(f, "method", c.methods);
if (!c.properties.is_empty()) {
@@ -1344,6 +1411,8 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
_write_string(f, 1, "</theme_items>");
}
+ _write_method_doc(f, "operator", c.operators);
+
_write_string(f, 0, "</class>");
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 2010ee01db..372d01d89a 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -1491,12 +1491,15 @@ void EditorExport::add_export_preset(const Ref<EditorExportPreset> &p_preset, in
}
String EditorExportPlatform::test_etc2() const {
+ // String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name");
+ // bool etc_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc");
+ // bool etc2_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2");
String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name");
bool etc_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc");
bool etc2_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2");
- if (driver == "GLES2" && !etc_supported) {
- return TTR("Target platform requires 'ETC' texture compression for GLES2. Enable 'Import Etc' in Project Settings.");
+ if (driver == "OpenGL3" && !etc_supported) {
+ return TTR("Target platform requires 'ETC' texture compression for OpenGL. Enable 'Import Etc' in Project Settings.");
} else if (driver == "Vulkan" && !etc2_supported) {
// FIXME: Review if this is true for Vulkan.
return TTR("Target platform requires 'ETC2' texture compression for Vulkan. Enable 'Import Etc 2' in Project Settings.");
@@ -1508,9 +1511,12 @@ String EditorExportPlatform::test_etc2_or_pvrtc() const {
String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name");
bool etc2_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2");
bool pvrtc_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_pvrtc");
+ // String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name");
+ // bool etc2_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2");
+ // bool pvrtc_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_pvrtc");
- if (driver == "GLES2" && !pvrtc_supported) {
- return TTR("Target platform requires 'PVRTC' texture compression for GLES2. Enable 'Import Pvrtc' in Project Settings.");
+ if (driver == "OpenGL3" && !pvrtc_supported) {
+ return TTR("Target platform requires 'PVRTC' texture compression for OpenGL. Enable 'Import Pvrtc' in Project Settings.");
} else if (driver == "Vulkan" && !etc2_supported && !pvrtc_supported) {
// FIXME: Review if this is true for Vulkan.
return TTR("Target platform requires 'ETC2' or 'PVRTC' texture compression for Vulkan. Enable 'Import Etc 2' or 'Import Pvrtc' in Project Settings.");
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index c049db8ef6..8c3569df07 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -330,6 +330,153 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
return OK;
}
+void EditorHelp::_update_method_list(const Vector<DocData::MethodDoc> p_methods, bool &r_method_descrpitons) {
+ Ref<Font> doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts"));
+ class_desc->pop();
+ class_desc->pop();
+
+ class_desc->add_newline();
+ class_desc->push_font(doc_code_font);
+ class_desc->push_indent(1);
+ class_desc->push_table(2);
+ class_desc->set_table_column_expand(1, true);
+
+ bool any_previous = false;
+ for (int pass = 0; pass < 2; pass++) {
+ Vector<DocData::MethodDoc> m;
+
+ for (int i = 0; i < p_methods.size(); i++) {
+ const String &q = p_methods[i].qualifiers;
+ if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) {
+ m.push_back(p_methods[i]);
+ }
+ }
+
+ if (any_previous && !m.is_empty()) {
+ class_desc->push_cell();
+ class_desc->pop(); //cell
+ class_desc->push_cell();
+ class_desc->pop(); //cell
+ }
+
+ String group_prefix;
+ for (int i = 0; i < m.size(); i++) {
+ const String new_prefix = m[i].name.substr(0, 3);
+ bool is_new_group = false;
+
+ if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) {
+ is_new_group = i > 0;
+ group_prefix = new_prefix;
+ } else if (group_prefix != "" && new_prefix != group_prefix) {
+ is_new_group = true;
+ group_prefix = "";
+ }
+
+ if (is_new_group && pass == 1) {
+ class_desc->push_cell();
+ class_desc->pop(); //cell
+ class_desc->push_cell();
+ class_desc->pop(); //cell
+ }
+
+ if (m[i].description != "" || m[i].errors_returned.size() > 0) {
+ r_method_descrpitons = true;
+ }
+
+ _add_method(m[i], true);
+ }
+
+ any_previous = !m.is_empty();
+ }
+
+ class_desc->pop(); //table
+ class_desc->pop();
+ class_desc->pop(); // font
+ class_desc->add_newline();
+ class_desc->add_newline();
+}
+
+void EditorHelp::_update_method_descriptions(const DocData::ClassDoc p_classdoc, const Vector<DocData::MethodDoc> p_methods, const String &p_method_type) {
+ Ref<Font> doc_font = get_theme_font(SNAME("doc"), SNAME("EditorFonts"));
+ Ref<Font> doc_bold_font = get_theme_font(SNAME("doc_bold"), SNAME("EditorFonts"));
+ Ref<Font> doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts"));
+ String link_color_text = title_color.to_html(false);
+ class_desc->pop();
+ class_desc->pop();
+
+ class_desc->add_newline();
+ class_desc->add_newline();
+
+ for (int pass = 0; pass < 2; pass++) {
+ Vector<DocData::MethodDoc> methods_filtered;
+
+ for (int i = 0; i < p_methods.size(); i++) {
+ const String &q = p_methods[i].qualifiers;
+ if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) {
+ methods_filtered.push_back(p_methods[i]);
+ }
+ }
+
+ for (int i = 0; i < methods_filtered.size(); i++) {
+ class_desc->push_font(doc_code_font);
+ _add_method(methods_filtered[i], false);
+ class_desc->pop();
+
+ class_desc->add_newline();
+ class_desc->add_newline();
+
+ class_desc->push_color(text_color);
+ class_desc->push_font(doc_font);
+ class_desc->push_indent(1);
+ if (methods_filtered[i].errors_returned.size()) {
+ class_desc->append_text(TTR("Error codes returned:"));
+ class_desc->add_newline();
+ class_desc->push_list(0, RichTextLabel::LIST_DOTS, false);
+ for (int j = 0; j < methods_filtered[i].errors_returned.size(); j++) {
+ if (j > 0) {
+ class_desc->add_newline();
+ }
+ int val = methods_filtered[i].errors_returned[j];
+ String text = itos(val);
+ for (int k = 0; k < CoreConstants::get_global_constant_count(); k++) {
+ if (CoreConstants::get_global_constant_value(k) == val && CoreConstants::get_global_constant_enum(k) == SNAME("Error")) {
+ text = CoreConstants::get_global_constant_name(k);
+ break;
+ }
+ }
+
+ class_desc->push_bold();
+ class_desc->append_text(text);
+ class_desc->pop();
+ }
+ class_desc->pop();
+ class_desc->add_newline();
+ class_desc->add_newline();
+ }
+ if (!methods_filtered[i].description.strip_edges().is_empty()) {
+ _add_text(DTR(methods_filtered[i].description));
+ } else {
+ class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
+ class_desc->add_text(" ");
+ class_desc->push_color(comment_color);
+ if (p_classdoc.is_script_doc) {
+ class_desc->append_text(TTR("There is currently no description for this " + p_method_type + "."));
+ } else {
+ class_desc->append_text(TTR("There is currently no description for this " + p_method_type + ". Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
+ }
+ class_desc->pop();
+ }
+
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->add_newline();
+ class_desc->add_newline();
+ class_desc->add_newline();
+ }
+ }
+}
+
void EditorHelp::_update_doc() {
if (!doc->class_list.has(edited_class)) {
return;
@@ -622,7 +769,9 @@ void EditorHelp::_update_doc() {
}
// Methods overview
- bool method_descr = false;
+ bool constructor_descriptions = false;
+ bool method_descriptions = false;
+ bool operator_descriptions = false;
bool sort_methods = EditorSettings::get_singleton()->get("text_editor/help/sort_functions_alphabetically");
Vector<DocData::MethodDoc> methods;
@@ -640,81 +789,43 @@ void EditorHelp::_update_doc() {
methods.push_back(cd.methods[i]);
}
- if (methods.size()) {
+ if (!cd.constructors.is_empty()) {
if (sort_methods) {
- methods.sort();
+ cd.constructors.sort();
}
+ section_line.push_back(Pair<String, int>(TTR("Constructors"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text(TTR("Constructors"));
+ _update_method_list(cd.constructors, constructor_descriptions);
+ }
+
+ if (!methods.is_empty()) {
+ if (sort_methods) {
+ methods.sort();
+ }
section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Methods"));
- class_desc->pop();
- class_desc->pop();
-
- class_desc->add_newline();
- class_desc->push_font(doc_code_font);
- class_desc->push_indent(1);
- class_desc->push_table(2);
- class_desc->set_table_column_expand(1, true);
-
- bool any_previous = false;
- for (int pass = 0; pass < 2; pass++) {
- Vector<DocData::MethodDoc> m;
-
- for (int i = 0; i < methods.size(); i++) {
- const String &q = methods[i].qualifiers;
- if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) {
- m.push_back(methods[i]);
- }
- }
-
- if (any_previous && !m.is_empty()) {
- class_desc->push_cell();
- class_desc->pop(); //cell
- class_desc->push_cell();
- class_desc->pop(); //cell
- }
-
- String group_prefix;
- for (int i = 0; i < m.size(); i++) {
- const String new_prefix = m[i].name.substr(0, 3);
- bool is_new_group = false;
-
- if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) {
- is_new_group = i > 0;
- group_prefix = new_prefix;
- } else if (group_prefix != "" && new_prefix != group_prefix) {
- is_new_group = true;
- group_prefix = "";
- }
-
- if (is_new_group && pass == 1) {
- class_desc->push_cell();
- class_desc->pop(); //cell
- class_desc->push_cell();
- class_desc->pop(); //cell
- }
-
- if (m[i].description != "" || m[i].errors_returned.size() > 0) {
- method_descr = true;
- }
-
- _add_method(m[i], true);
- }
+ _update_method_list(methods, method_descriptions);
+ }
- any_previous = !m.is_empty();
+ if (!cd.operators.is_empty()) {
+ if (sort_methods) {
+ cd.operators.sort();
}
- class_desc->pop(); //table
- class_desc->pop();
- class_desc->pop(); // font
- class_desc->add_newline();
- class_desc->add_newline();
+ section_line.push_back(Pair<String, int>(TTR("Operators"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text(TTR("Operators"));
+ _update_method_list(cd.operators, operator_descriptions);
}
// Theme properties
- if (cd.theme_properties.size()) {
+ if (!cd.theme_properties.is_empty()) {
section_line.push_back(Pair<String, int>(TTR("Theme Properties"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
@@ -775,7 +886,7 @@ void EditorHelp::_update_doc() {
}
// Signals
- if (cd.signals.size()) {
+ if (!cd.signals.is_empty()) {
if (sort_methods) {
cd.signals.sort();
}
@@ -844,7 +955,7 @@ void EditorHelp::_update_doc() {
}
// Constants and enums
- if (cd.constants.size()) {
+ if (!cd.constants.is_empty()) {
Map<String, Vector<DocData::ConstantDoc>> enums;
Vector<DocData::ConstantDoc> constants;
@@ -1195,86 +1306,31 @@ void EditorHelp::_update_doc() {
}
}
+ // Constructor descriptions
+ if (constructor_descriptions) {
+ section_line.push_back(Pair<String, int>(TTR("Constructor Descriptions"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text(TTR("Constructor Descriptions"));
+ _update_method_descriptions(cd, cd.constructors, "constructor");
+ }
+
// Method descriptions
- if (method_descr) {
+ if (method_descriptions) {
section_line.push_back(Pair<String, int>(TTR("Method Descriptions"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Method Descriptions"));
- class_desc->pop();
- class_desc->pop();
-
- class_desc->add_newline();
- class_desc->add_newline();
-
- for (int pass = 0; pass < 2; pass++) {
- Vector<DocData::MethodDoc> methods_filtered;
-
- for (int i = 0; i < methods.size(); i++) {
- const String &q = methods[i].qualifiers;
- if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) {
- methods_filtered.push_back(methods[i]);
- }
- }
-
- for (int i = 0; i < methods_filtered.size(); i++) {
- class_desc->push_font(doc_code_font);
- _add_method(methods_filtered[i], false);
- class_desc->pop();
-
- class_desc->add_newline();
- class_desc->add_newline();
-
- class_desc->push_color(text_color);
- class_desc->push_font(doc_font);
- class_desc->push_indent(1);
- if (methods_filtered[i].errors_returned.size()) {
- class_desc->append_text(TTR("Error codes returned:"));
- class_desc->add_newline();
- class_desc->push_list(0, RichTextLabel::LIST_DOTS, false);
- for (int j = 0; j < methods_filtered[i].errors_returned.size(); j++) {
- if (j > 0) {
- class_desc->add_newline();
- }
- int val = methods_filtered[i].errors_returned[j];
- String text = itos(val);
- for (int k = 0; k < CoreConstants::get_global_constant_count(); k++) {
- if (CoreConstants::get_global_constant_value(k) == val && CoreConstants::get_global_constant_enum(k) == SNAME("Error")) {
- text = CoreConstants::get_global_constant_name(k);
- break;
- }
- }
-
- class_desc->push_bold();
- class_desc->append_text(text);
- class_desc->pop();
- }
- class_desc->pop();
- class_desc->add_newline();
- class_desc->add_newline();
- }
- if (!methods_filtered[i].description.strip_edges().is_empty()) {
- _add_text(DTR(methods_filtered[i].description));
- } else {
- class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
- class_desc->add_text(" ");
- class_desc->push_color(comment_color);
- if (cd.is_script_doc) {
- class_desc->append_text(TTR("There is currently no description for this method."));
- } else {
- class_desc->append_text(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
- }
- class_desc->pop();
- }
+ _update_method_descriptions(cd, methods, "method");
+ }
- class_desc->pop();
- class_desc->pop();
- class_desc->pop();
- class_desc->add_newline();
- class_desc->add_newline();
- class_desc->add_newline();
- }
- }
+ // Operator descriptions
+ if (operator_descriptions) {
+ section_line.push_back(Pair<String, int>(TTR("Operator Descriptions"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text(TTR("Operator Descriptions"));
+ _update_method_descriptions(cd, cd.operators, "operator");
}
scroll_locked = false;
}
diff --git a/editor/editor_help.h b/editor/editor_help.h
index 46605b6763..c0f3f66505 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -152,6 +152,8 @@ class EditorHelp : public VBoxContainer {
Error _goto_desc(const String &p_class, int p_vscr = -1);
//void _update_history_buttons();
+ void _update_method_list(const Vector<DocData::MethodDoc> p_methods, bool &r_method_descrpitons);
+ void _update_method_descriptions(const DocData::ClassDoc p_classdoc, const Vector<DocData::MethodDoc> p_methods, const String &p_method_type);
void _update_doc();
void _request_help(const String &p_string);
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index e56b10720d..8504745b03 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -226,7 +226,9 @@ EditorHelpSearch::EditorHelpSearch() {
filter_combo->add_item(TTR("Display All"), SEARCH_ALL);
filter_combo->add_separator();
filter_combo->add_item(TTR("Classes Only"), SEARCH_CLASSES);
+ filter_combo->add_item(TTR("Constructors Only"), SEARCH_CONSTRUCTORS);
filter_combo->add_item(TTR("Methods Only"), SEARCH_METHODS);
+ filter_combo->add_item(TTR("Operators Only"), SEARCH_OPERATORS);
filter_combo->add_item(TTR("Signals Only"), SEARCH_SIGNALS);
filter_combo->add_item(TTR("Constants Only"), SEARCH_CONSTANTS);
filter_combo->add_item(TTR("Properties Only"), SEARCH_PROPERTIES);
@@ -334,6 +336,17 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
// Match members if the term is long enough.
if (term.length() > 1) {
+ if (search_flags & SEARCH_CONSTRUCTORS) {
+ for (int i = 0; i < class_doc.constructors.size(); i++) {
+ String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.constructors[i].name : class_doc.constructors[i].name.to_lower();
+ if (method_name.find(term) > -1 ||
+ (term.begins_with(".") && method_name.begins_with(term.substr(1))) ||
+ (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) ||
+ (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) {
+ match.constructors.push_back(const_cast<DocData::MethodDoc *>(&class_doc.constructors[i]));
+ }
+ }
+ }
if (search_flags & SEARCH_METHODS) {
for (int i = 0; i < class_doc.methods.size(); i++) {
String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower();
@@ -345,6 +358,17 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
}
}
}
+ if (search_flags & SEARCH_OPERATORS) {
+ for (int i = 0; i < class_doc.operators.size(); i++) {
+ String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.operators[i].name : class_doc.operators[i].name.to_lower();
+ if (method_name.find(term) > -1 ||
+ (term.begins_with(".") && method_name.begins_with(term.substr(1))) ||
+ (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) ||
+ (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) {
+ match.operators.push_back(const_cast<DocData::MethodDoc *>(&class_doc.operators[i]));
+ }
+ }
+ }
if (search_flags & SEARCH_SIGNALS) {
for (int i = 0; i < class_doc.signals.size(); i++) {
if (_match_string(term, class_doc.signals[i].name)) {
diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h
index bc57c0e3c6..7285f76c01 100644
--- a/editor/editor_help_search.h
+++ b/editor/editor_help_search.h
@@ -43,12 +43,14 @@ class EditorHelpSearch : public ConfirmationDialog {
enum SearchFlags {
SEARCH_CLASSES = 1 << 0,
- SEARCH_METHODS = 1 << 1,
- SEARCH_SIGNALS = 1 << 2,
- SEARCH_CONSTANTS = 1 << 3,
- SEARCH_PROPERTIES = 1 << 4,
- SEARCH_THEME_ITEMS = 1 << 5,
- SEARCH_ALL = SEARCH_CLASSES | SEARCH_METHODS | SEARCH_SIGNALS | SEARCH_CONSTANTS | SEARCH_PROPERTIES | SEARCH_THEME_ITEMS,
+ SEARCH_CONSTRUCTORS = 1 << 1,
+ SEARCH_METHODS = 1 << 2,
+ SEARCH_OPERATORS = 1 << 3,
+ SEARCH_SIGNALS = 1 << 4,
+ SEARCH_CONSTANTS = 1 << 5,
+ SEARCH_PROPERTIES = 1 << 6,
+ SEARCH_THEME_ITEMS = 1 << 7,
+ SEARCH_ALL = SEARCH_CLASSES | SEARCH_CONSTRUCTORS | SEARCH_METHODS | SEARCH_OPERATORS | SEARCH_SIGNALS | SEARCH_CONSTANTS | SEARCH_PROPERTIES | SEARCH_THEME_ITEMS,
SEARCH_CASE_SENSITIVE = 1 << 29,
SEARCH_SHOW_HIERARCHY = 1 << 30
};
@@ -99,7 +101,9 @@ class EditorHelpSearch::Runner : public RefCounted {
struct ClassMatch {
DocData::ClassDoc *doc;
bool name = false;
+ Vector<DocData::MethodDoc *> constructors;
Vector<DocData::MethodDoc *> methods;
+ Vector<DocData::MethodDoc *> operators;
Vector<DocData::MethodDoc *> signals;
Vector<DocData::ConstantDoc *> constants;
Vector<DocData::PropertyDoc *> properties;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 288b6752ee..9edf0a24fc 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -589,6 +589,11 @@ void EditorNode::_notification(int p_what) {
settings_changed = false;
emit_signal(SNAME("project_settings_changed"));
}
+
+ ResourceImporterTexture::get_singleton()->update_imports();
+
+ // if using a main thread only renderer, we need to update the resource previews
+ EditorResourcePreview::get_singleton()->update();
} break;
case NOTIFICATION_ENTER_TREE: {
@@ -2903,8 +2908,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
OS::get_singleton()->shell_open("https://godotengine.org/donate");
} break;
- case SET_VIDEO_DRIVER_SAVE_AND_RESTART: {
- ProjectSettings::get_singleton()->set("rendering/driver/driver_name", video_driver_request);
+ // case SET_VIDEO_DRIVER_SAVE_AND_RESTART: {
+ // ProjectSettings::get_singleton()->set("rendering/driver/driver_name", video_driver_request);
+ // save_all_scenes();
+ // restart_editor();
+ // } break;
+ case SET_RENDERING_DRIVER_SAVE_AND_RESTART: {
+ ProjectSettings::get_singleton()->set("rendering/driver/driver_name", rendering_driver_request);
ProjectSettings::get_singleton()->save();
save_all_scenes();
@@ -5585,17 +5595,16 @@ void EditorNode::_bottom_panel_raise_toggled(bool p_pressed) {
top_split->set_visible(!p_pressed);
}
-void EditorNode::_update_video_driver_color() {
- // TODO: Probably should de-hardcode this and add to editor settings.
- if (video_driver->get_text() == "GLES2") {
- video_driver->add_theme_color_override("font_color", Color::hex(0x5586a4ff));
- } else if (video_driver->get_text() == "Vulkan") {
- video_driver->add_theme_color_override("font_color", theme_base->get_theme_color(SNAME("vulkan_color"), SNAME("Editor")));
+void EditorNode::_update_rendering_driver_color() {
+ if (rendering_driver->get_text() == "opengl3") {
+ rendering_driver->add_theme_color_override("font_color", Color::hex(0x5586a4ff));
+ } else if (rendering_driver->get_text() == "vulkan") {
+ rendering_driver->add_theme_color_override("font_color", theme_base->get_theme_color("vulkan_color", "Editor"));
}
}
-void EditorNode::_video_driver_selected(int p_which) {
- String driver = video_driver->get_item_metadata(p_which);
+void EditorNode::_rendering_driver_selected(int p_which) {
+ String driver = rendering_driver->get_item_metadata(p_which);
String current = ""; // OS::get_singleton()->get_video_driver_name(OS::get_singleton()->get_current_video_driver());
@@ -5603,10 +5612,10 @@ void EditorNode::_video_driver_selected(int p_which) {
return;
}
- video_driver_request = driver;
+ rendering_driver_request = driver;
video_restart_dialog->popup_centered();
- video_driver->select(video_driver_current);
- _update_video_driver_color();
+ rendering_driver->select(rendering_driver_current);
+ _update_rendering_driver_color();
}
void EditorNode::_resource_saved(RES p_resource, const String &p_path) {
@@ -6610,40 +6619,50 @@ EditorNode::EditorNode() {
HBoxContainer *right_menu_hb = memnew(HBoxContainer);
menu_hb->add_child(right_menu_hb);
- // Toggle for video driver
- video_driver = memnew(OptionButton);
- video_driver->set_focus_mode(Control::FOCUS_NONE);
- video_driver->connect("item_selected", callable_mp(this, &EditorNode::_video_driver_selected));
- video_driver->add_theme_font_override("font", gui_base->get_theme_font(SNAME("bold"), SNAME("EditorFonts")));
- video_driver->add_theme_font_size_override("font_size", gui_base->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts")));
- // TODO: Show again when OpenGL is ported.
- video_driver->set_visible(false);
- right_menu_hb->add_child(video_driver);
-
-#ifndef _MSC_VER
-#warning needs to be reimplemented
-#endif
-#if 0
- String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/driver/driver_name"].hint_string;
- String current_video_driver = OS::get_singleton()->get_video_driver_name(OS::get_singleton()->get_current_video_driver());
- video_driver_current = 0;
- for (int i = 0; i < video_drivers.get_slice_count(","); i++) {
- String driver = video_drivers.get_slice(",", i);
- video_driver->add_item(driver);
- video_driver->set_item_metadata(i, driver);
+ rendering_driver = memnew(OptionButton);
+
+ // Hide the renderer selection dropdown until OpenGL support is more mature.
+ // The renderer can still be changed in the project settings or using `--rendering-driver opengl3`.
+ rendering_driver->set_visible(false);
+
+ rendering_driver->set_flat(true);
+ rendering_driver->set_focus_mode(Control::FOCUS_NONE);
+ rendering_driver->connect("item_selected", callable_mp(this, &EditorNode::_rendering_driver_selected));
+ rendering_driver->add_theme_font_override("font", gui_base->get_theme_font("bold", "EditorFonts"));
+ rendering_driver->add_theme_font_size_override("font_size", gui_base->get_theme_font_size("bold_size", "EditorFonts"));
+
+ right_menu_hb->add_child(rendering_driver);
- if (current_video_driver == driver) {
- video_driver->select(i);
- video_driver_current = i;
+ // Only display the render drivers that are available for this display driver.
+ int display_driver_idx = OS::get_singleton()->get_display_driver_id();
+ Vector<String> render_drivers = DisplayServer::get_create_function_rendering_drivers(display_driver_idx);
+ String current_rendering_driver = OS::get_singleton()->get_current_rendering_driver_name();
+
+ // As we are doing string comparisons, keep in standard case to prevent problems with capitals
+ // "vulkan" in particular uses lowercase "v" in the code, and uppercase in the UI.
+ current_rendering_driver = current_rendering_driver.to_lower();
+
+ for (int i = 0; i < render_drivers.size(); i++) {
+ String driver = render_drivers[i];
+
+ // Add the driver to the UI.
+ rendering_driver->add_item(driver);
+ rendering_driver->set_item_metadata(i, driver);
+
+ // Lowercase for standard comparison.
+ driver = driver.to_lower();
+
+ if (current_rendering_driver == driver) {
+ rendering_driver->select(i);
+ rendering_driver_current = i;
}
}
+ _update_rendering_driver_color();
- _update_video_driver_color();
-#endif
video_restart_dialog = memnew(ConfirmationDialog);
video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor."));
video_restart_dialog->get_ok_button()->set_text(TTR("Save & Restart"));
- video_restart_dialog->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART));
+ video_restart_dialog->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SET_RENDERING_DRIVER_SAVE_AND_RESTART));
gui_base->add_child(video_restart_dialog);
progress_hb = memnew(BackgroundProgress);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 03e5146d98..98aa4b697c 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -206,7 +206,7 @@ private:
HELP_ABOUT,
HELP_SUPPORT_GODOT_DEVELOPMENT,
- SET_VIDEO_DRIVER_SAVE_AND_RESTART,
+ SET_RENDERING_DRIVER_SAVE_AND_RESTART,
GLOBAL_NEW_WINDOW,
GLOBAL_SCENE,
@@ -222,14 +222,14 @@ private:
Control *theme_base;
Control *gui_base;
VBoxContainer *main_vbox;
- OptionButton *video_driver;
+ OptionButton *rendering_driver;
ConfirmationDialog *video_restart_dialog;
- int video_driver_current;
- String video_driver_request;
- void _video_driver_selected(int);
- void _update_video_driver_color();
+ int rendering_driver_current;
+ String rendering_driver_request;
+ void _rendering_driver_selected(int);
+ void _update_rendering_driver_color();
// Split containers
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 8783fe4fc0..e9c0b40268 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -210,126 +210,130 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
}
}
-void EditorResourcePreview::_thread() {
- exited.clear();
- while (!exit.is_set()) {
- preview_sem.wait();
- preview_mutex.lock();
-
- if (queue.size()) {
- QueueItem item = queue.front()->get();
- queue.pop_front();
-
- if (cache.has(item.path)) {
- //already has it because someone loaded it, just let it know it's ready
- String path = item.path;
- if (item.resource.is_valid()) {
- path += ":" + itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below)
- }
-
- _preview_ready(path, cache[item.path].preview, cache[item.path].small_preview, item.id, item.function, item.userdata);
-
- preview_mutex.unlock();
- } else {
- preview_mutex.unlock();
+void EditorResourcePreview::_iterate() {
+ preview_mutex.lock();
+
+ if (queue.size()) {
+ QueueItem item = queue.front()->get();
+ queue.pop_front();
+
+ if (cache.has(item.path)) {
+ //already has it because someone loaded it, just let it know it's ready
+ String path = item.path;
+ if (item.resource.is_valid()) {
+ path += ":" + itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below)
+ }
- Ref<ImageTexture> texture;
- Ref<ImageTexture> small_texture;
+ _preview_ready(path, cache[item.path].preview, cache[item.path].small_preview, item.id, item.function, item.userdata);
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
+ preview_mutex.unlock();
+ } else {
+ preview_mutex.unlock();
- if (item.resource.is_valid()) {
- _generate_preview(texture, small_texture, item, String());
+ Ref<ImageTexture> texture;
+ Ref<ImageTexture> small_texture;
- //adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred
- _preview_ready(item.path + ":" + itos(item.resource->hash_edited_version()), texture, small_texture, item.id, item.function, item.userdata);
+ int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
+ thumbnail_size *= EDSCALE;
- } else {
- String temp_path = EditorPaths::get_singleton()->get_cache_dir();
- String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text();
- cache_base = temp_path.plus_file("resthumb-" + cache_base);
+ if (item.resource.is_valid()) {
+ _generate_preview(texture, small_texture, item, String());
- //does not have it, try to load a cached thumbnail
+ //adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred
+ _preview_ready(item.path + ":" + itos(item.resource->hash_edited_version()), texture, small_texture, item.id, item.function, item.userdata);
- String file = cache_base + ".txt";
- FileAccess *f = FileAccess::open(file, FileAccess::READ);
- if (!f) {
- // No cache found, generate
- _generate_preview(texture, small_texture, item, cache_base);
- } else {
- uint64_t modtime = FileAccess::get_modified_time(item.path);
- int tsize = f->get_line().to_int();
- bool has_small_texture = f->get_line().to_int();
- uint64_t last_modtime = f->get_line().to_int();
+ } else {
+ String temp_path = EditorPaths::get_singleton()->get_cache_dir();
+ String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text();
+ cache_base = temp_path.plus_file("resthumb-" + cache_base);
- bool cache_valid = true;
+ //does not have it, try to load a cached thumbnail
- if (tsize != thumbnail_size) {
+ String file = cache_base + ".txt";
+ FileAccess *f = FileAccess::open(file, FileAccess::READ);
+ if (!f) {
+ // No cache found, generate
+ _generate_preview(texture, small_texture, item, cache_base);
+ } else {
+ uint64_t modtime = FileAccess::get_modified_time(item.path);
+ int tsize = f->get_line().to_int();
+ bool has_small_texture = f->get_line().to_int();
+ uint64_t last_modtime = f->get_line().to_int();
+
+ bool cache_valid = true;
+
+ if (tsize != thumbnail_size) {
+ cache_valid = false;
+ memdelete(f);
+ } else if (last_modtime != modtime) {
+ String last_md5 = f->get_line();
+ String md5 = FileAccess::get_md5(item.path);
+ memdelete(f);
+
+ if (last_md5 != md5) {
cache_valid = false;
- memdelete(f);
- } else if (last_modtime != modtime) {
- String last_md5 = f->get_line();
- String md5 = FileAccess::get_md5(item.path);
- memdelete(f);
- if (last_md5 != md5) {
- cache_valid = false;
+ } else {
+ //update modified time
+ f = FileAccess::open(file, FileAccess::WRITE);
+ if (!f) {
+ // Not returning as this would leave the thread hanging and would require
+ // some proper cleanup/disabling of resource preview generation.
+ ERR_PRINT("Cannot create file '" + file + "'. Check user write permissions.");
} else {
- //update modified time
-
- f = FileAccess::open(file, FileAccess::WRITE);
- if (!f) {
- // Not returning as this would leave the thread hanging and would require
- // some proper cleanup/disabling of resource preview generation.
- ERR_PRINT("Cannot create file '" + file + "'. Check user write permissions.");
- } else {
- f->store_line(itos(thumbnail_size));
- f->store_line(itos(has_small_texture));
- f->store_line(itos(modtime));
- f->store_line(md5);
- memdelete(f);
- }
+ f->store_line(itos(thumbnail_size));
+ f->store_line(itos(has_small_texture));
+ f->store_line(itos(modtime));
+ f->store_line(md5);
+ memdelete(f);
}
- } else {
- memdelete(f);
}
+ } else {
+ memdelete(f);
+ }
- if (cache_valid) {
- Ref<Image> img;
- img.instantiate();
- Ref<Image> small_img;
- small_img.instantiate();
+ if (cache_valid) {
+ Ref<Image> img;
+ img.instantiate();
+ Ref<Image> small_img;
+ small_img.instantiate();
- if (img->load(cache_base + ".png") != OK) {
- cache_valid = false;
- } else {
- texture.instantiate();
- texture->create_from_image(img);
-
- if (has_small_texture) {
- if (small_img->load(cache_base + "_small.png") != OK) {
- cache_valid = false;
- } else {
- small_texture.instantiate();
- small_texture->create_from_image(small_img);
- }
+ if (img->load(cache_base + ".png") != OK) {
+ cache_valid = false;
+ } else {
+ texture.instantiate();
+ texture->create_from_image(img);
+
+ if (has_small_texture) {
+ if (small_img->load(cache_base + "_small.png") != OK) {
+ cache_valid = false;
+ } else {
+ small_texture.instantiate();
+ small_texture->create_from_image(small_img);
}
}
}
+ }
- if (!cache_valid) {
- _generate_preview(texture, small_texture, item, cache_base);
- }
+ if (!cache_valid) {
+ _generate_preview(texture, small_texture, item, cache_base);
}
- _preview_ready(item.path, texture, small_texture, item.id, item.function, item.userdata);
}
+ _preview_ready(item.path, texture, small_texture, item.id, item.function, item.userdata);
}
-
- } else {
- preview_mutex.unlock();
}
+
+ } else {
+ preview_mutex.unlock();
+ }
+}
+
+void EditorResourcePreview::_thread() {
+ exited.clear();
+ while (!exit.is_set()) {
+ preview_sem.wait();
+ _iterate();
}
exited.set();
}
@@ -429,8 +433,12 @@ void EditorResourcePreview::check_for_invalidation(const String &p_path) {
}
void EditorResourcePreview::start() {
- ERR_FAIL_COND_MSG(thread.is_started(), "Thread already started.");
- thread.start(_thread_func, this);
+ if (OS::get_singleton()->get_render_main_thread_mode() == OS::RENDER_ANY_THREAD) {
+ ERR_FAIL_COND_MSG(thread.is_started(), "Thread already started.");
+ thread.start(_thread_func, this);
+ } else {
+ _mainthread_only = true;
+ }
}
void EditorResourcePreview::stop() {
@@ -453,3 +461,18 @@ EditorResourcePreview::EditorResourcePreview() {
EditorResourcePreview::~EditorResourcePreview() {
stop();
}
+
+void EditorResourcePreview::update() {
+ if (!_mainthread_only) {
+ return;
+ }
+
+ if (!exit.is_set()) {
+ // no need to even lock the mutex if the size is zero
+ // there is no problem if queue.size() is wrong, even if
+ // there was a race condition.
+ if (queue.size()) {
+ _iterate();
+ }
+ }
+}
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index ea16c8fde0..9d1f269661 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -81,6 +81,11 @@ class EditorResourcePreview : public Node {
SafeFlag exit;
SafeFlag exited;
+ // when running from GLES, we want to run the previews
+ // in the main thread using an update, rather than create
+ // a separate thread
+ bool _mainthread_only = false;
+
struct Item {
Ref<Texture2D> preview;
Ref<Texture2D> small_preview;
@@ -98,6 +103,7 @@ class EditorResourcePreview : public Node {
static void _thread_func(void *ud);
void _thread();
+ void _iterate();
Vector<Ref<EditorResourcePreviewGenerator>> preview_generators;
@@ -119,6 +125,9 @@ public:
void start();
void stop();
+ // for single threaded mode
+ void update();
+
EditorResourcePreview();
~EditorResourcePreview();
};
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index ec90af1bcc..82b5ec5ca1 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -225,7 +225,8 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
set_value(last_value + real_step);
}
- value_input->set_text(get_text_value());
+ value_input_dirty = true;
+ set_process_internal(true);
} break;
case KEY_DOWN: {
_evaluate_input_text();
@@ -238,7 +239,8 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
set_value(last_value - real_step);
}
- value_input->set_text(get_text_value());
+ value_input_dirty = true;
+ set_process_internal(true);
} break;
}
}
@@ -424,6 +426,14 @@ void EditorSpinSlider::_notification(int p_what) {
_update_value_input_stylebox();
break;
+ case NOTIFICATION_INTERNAL_PROCESS:
+ if (value_input_dirty) {
+ value_input_dirty = false;
+ value_input->set_text(get_text_value());
+ }
+ set_process_internal(false);
+ break;
+
case NOTIFICATION_DRAW:
_draw_spin_slider();
break;
diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h
index 7e10764491..68448b3240 100644
--- a/editor/editor_spin_slider.h
+++ b/editor/editor_spin_slider.h
@@ -66,6 +66,7 @@ class EditorSpinSlider : public Range {
Popup *value_input_popup = nullptr;
LineEdit *value_input = nullptr;
bool value_input_just_closed = false;
+ bool value_input_dirty = false;
void _grabber_gui_input(const Ref<InputEvent> &p_event);
void _value_input_closed();
diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp
index 9de0ea40fe..22da12b59b 100644
--- a/editor/editor_toaster.cpp
+++ b/editor/editor_toaster.cpp
@@ -172,10 +172,11 @@ void EditorToaster::_error_handler(void *p_self, const char *p_func, const char
}
}
- if (p_type == ERR_HANDLER_WARNING) {
- EditorToaster::get_singleton()->popup_str(err_str, SEVERITY_WARNING, tooltip_str);
+ Severity severity = (p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR;
+ if (Thread::get_caller_id() != Thread::get_main_id()) {
+ EditorToaster::get_singleton()->call_deferred(SNAME("popup_str"), err_str, severity, tooltip_str);
} else {
- EditorToaster::get_singleton()->popup_str(err_str, SEVERITY_ERROR, tooltip_str);
+ EditorToaster::get_singleton()->popup_str(err_str, severity, tooltip_str);
}
}
}
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 84992892a4..b99ccc1012 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -4376,7 +4376,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
const int wireframe_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_WIREFRAME);
const int overdraw_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_OVERDRAW);
const int shadeless_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_SHADELESS);
- const String unsupported_tooltip = TTR("Not available when using the GLES2 renderer.");
+ const String unsupported_tooltip = TTR("Not available when using the OpenGL renderer.");
view_menu->get_popup()->set_item_disabled(normal_idx, true);
view_menu->get_popup()->set_item_tooltip(normal_idx, unsupported_tooltip);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 6d023b8a7d..9189c75162 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -1246,7 +1246,7 @@ void VisualShaderEditor::_update_options_menu() {
Color unsupported_color = get_theme_color(SNAME("error_color"), SNAME("Editor"));
Color supported_color = get_theme_color(SNAME("warning_color"), SNAME("Editor"));
- static bool low_driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name") == "GLES2";
+ static bool low_driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name") == "opengl3";
Map<String, TreeItem *> folders;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index e8fd3070c2..dc35e01a56 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -475,6 +475,13 @@ private:
}
ProjectSettings::CustomMap initial_settings;
initial_settings["rendering/vulkan/rendering/back_end"] = rasterizer_button_group->get_pressed_button()->get_meta(SNAME("driver_name"));
+ if (rasterizer_button_group->get_pressed_button()->get_meta("driver_name") == "Vulkan") {
+ initial_settings["rendering/driver/driver_name"] = "Vulkan";
+ } else {
+ initial_settings["rendering/driver/driver_name"] = "OpenGL3";
+ initial_settings["rendering/textures/vram_compression/import_etc2"] = false;
+ initial_settings["rendering/textures/vram_compression/import_etc"] = true;
+ }
initial_settings["application/config/name"] = project_name->get_text().strip_edges();
initial_settings["application/config/icon"] = "res://icon.png";
initial_settings["rendering/environment/defaults/default_environment"] = "res://default_env.tres";