summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/space_bullet.cpp4
-rw-r--r--modules/fbx/data/fbx_material.cpp8
-rw-r--r--modules/fbx/fbx_parser/FBXMeshGeometry.cpp2
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp4
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp2
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp7
-rw-r--r--modules/gdnative/pluginscript/register_types.cpp6
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp6
-rw-r--r--modules/gdscript/gdscript.cpp22
-rw-r--r--modules/gdscript/gdscript_cache.cpp6
-rw-r--r--modules/gdscript/gdscript_compiler.cpp8
-rw-r--r--modules/gdscript/gdscript_editor.cpp5
-rw-r--r--modules/gdscript/gdscript_parser.cpp4
-rw-r--r--modules/gdscript/gdscript_vm.cpp20
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp3
-rw-r--r--modules/gdscript/tests/gdscript_test_runner.cpp2
-rw-r--r--modules/glslang/register_types.cpp2
-rw-r--r--modules/gltf/gltf_animation.h4
-rw-r--r--modules/gltf/gltf_document.cpp24
-rw-r--r--modules/gltf/gltf_document.h2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp10
-rw-r--r--modules/hdr/image_loader_hdr.cpp2
-rw-r--r--modules/mbedtls/crypto_mbedtls.cpp2
-rw-r--r--modules/mono/editor/code_completion.cpp2
-rw-r--r--modules/text_server_adv/text_server_adv.cpp126
-rw-r--r--modules/text_server_adv/text_server_adv.h4
-rw-r--r--modules/text_server_fb/text_server_fb.cpp112
-rw-r--r--modules/text_server_fb/text_server_fb.h4
-rw-r--r--modules/visual_script/editor/visual_script_editor.cpp30
-rw-r--r--modules/visual_script/editor/visual_script_property_selector.cpp16
-rw-r--r--modules/visual_script/visual_script.cpp8
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp8
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp26
-rw-r--r--modules/visual_script/visual_script_nodes.cpp16
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp2
-rw-r--r--modules/websocket/wsl_server.cpp6
37 files changed, 255 insertions, 262 deletions
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 7aa3815c94..0c7e5eccf0 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -426,8 +426,6 @@ void SpaceBullet::set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_va
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
- case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
- case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
default:
WARN_PRINT("This set parameter (" + itos(p_param) + ") is ignored, the SpaceBullet doesn't support it.");
break;
@@ -442,8 +440,6 @@ real_t SpaceBullet::get_param(PhysicsServer3D::SpaceParameter p_param) {
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
- case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
- case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
default:
WARN_PRINT("The SpaceBullet doesn't support this get parameter (" + itos(p_param) + "), 0 is returned.");
return 0.f;
diff --git a/modules/fbx/data/fbx_material.cpp b/modules/fbx/data/fbx_material.cpp
index 86baec4244..26c9ef8d54 100644
--- a/modules/fbx/data/fbx_material.cpp
+++ b/modules/fbx/data/fbx_material.cpp
@@ -60,7 +60,7 @@ String find_file(const String &p_base, const String &p_file_to_find) {
dir.list_dir_begin();
String n = dir.get_next();
- while (n != String()) {
+ while (!n.is_empty()) {
if (n == "." || n == "..") {
n = dir.get_next();
continue;
@@ -68,7 +68,7 @@ String find_file(const String &p_base, const String &p_file_to_find) {
if (dir.current_is_dir()) {
// Don't use `path_to` or the returned path will be wrong.
const String f = find_file(p_base + "/" + n, p_file_to_find);
- if (f != "") {
+ if (!f.is_empty()) {
return f;
}
} else if (n == p_file_to_find) {
@@ -119,7 +119,7 @@ String FBXMaterial::find_texture_path_by_filename(const String p_filename, const
dir.open("res://");
dir.list_dir_begin();
String n = dir.get_next();
- while (n != String()) {
+ while (!n.is_empty()) {
if (n == "." || n == "..") {
n = dir.get_next();
continue;
@@ -136,7 +136,7 @@ String FBXMaterial::find_texture_path_by_filename(const String p_filename, const
lower_n.find("picture") >= 0) {
// Don't use `path_to` or the returned path will be wrong.
const String f = find_file(String("res://") + n, p_filename);
- if (f != "") {
+ if (!f.is_empty()) {
return f;
}
}
diff --git a/modules/fbx/fbx_parser/FBXMeshGeometry.cpp b/modules/fbx/fbx_parser/FBXMeshGeometry.cpp
index 2cc25a0690..2bb634ea56 100644
--- a/modules/fbx/fbx_parser/FBXMeshGeometry.cpp
+++ b/modules/fbx/fbx_parser/FBXMeshGeometry.cpp
@@ -368,7 +368,7 @@ MeshGeometry::MappingData<T> MeshGeometry::resolve_vertex_data_array(
// UVIndex, MaterialIndex, NormalIndex, etc..
std::string indexDataElementName;
- if (indexOverride != "") {
+ if (!indexOverride.empty()) {
// Colors should become ColorIndex
indexDataElementName = indexOverride;
} else {
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 9dad13a615..df3c37f730 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -110,7 +110,7 @@ void GDNativeLibraryEditor::_update_tree() {
TreeItem *new_arch = tree->create_item(platform);
new_arch->set_text(0, TTR("Double click to create a new entry"));
- new_arch->set_text_align(0, TreeItem::ALIGN_CENTER);
+ new_arch->set_text_alignment(0, HORIZONTAL_ALIGNMENT_CENTER);
new_arch->set_custom_color(0, get_theme_color(SNAME("accent_color"), SNAME("Editor")));
new_arch->set_expand_right(0, true);
new_arch->set_metadata(1, E->key());
@@ -335,7 +335,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
hbox->add_child(label);
filter = memnew(MenuButton);
filter->set_h_size_flags(SIZE_EXPAND_FILL);
- filter->set_text_align(filter->ALIGN_LEFT);
+ filter->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
hbox->add_child(filter);
PopupMenu *filter_list = filter->get_popup();
filter_list->set_hide_on_checkable_item_selection(false);
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 598f7c7ad0..ae16c22849 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -397,7 +397,7 @@ List<ClassAPI> generate_c_api_classes() {
arg_type = "Variant";
} else if (arg_info.type == Variant::OBJECT) {
arg_type = arg_info.class_name;
- if (arg_type == "") {
+ if (arg_type.is_empty()) {
arg_type = Variant::get_type_name(arg_info.type);
}
} else {
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 368eb67fa6..075977b60f 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -682,7 +682,7 @@ void NativeScriptInstance::get_property_list(List<PropertyInfo> *p_properties) c
ERR_CONTINUE(info.type < 0 || info.type >= Variant::VARIANT_MAX);
info.name = d["name"];
- ERR_CONTINUE(info.name == "");
+ ERR_CONTINUE(info.name.is_empty());
if (d.has("hint")) {
info.hint = PropertyHint(d["hint"].operator int64_t());
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index 04a293ddbd..5bda9e1d53 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -232,8 +232,7 @@ bool PluginScript::instance_has(const Object *p_this) const {
}
bool PluginScript::has_source_code() const {
- bool has = _source != "";
- return has;
+ return !_source.is_empty();
}
String PluginScript::get_source_code() const {
@@ -257,11 +256,11 @@ Error PluginScript::reload(bool p_keep_state) {
_valid = false;
String basedir = _path;
- if (basedir == "") {
+ if (basedir.is_empty()) {
basedir = get_path();
}
- if (basedir != "") {
+ if (!basedir.is_empty()) {
basedir = basedir.get_base_dir();
}
diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp
index 7faacfdcb9..c4fbff69f0 100644
--- a/modules/gdnative/pluginscript/register_types.cpp
+++ b/modules/gdnative/pluginscript/register_types.cpp
@@ -44,9 +44,9 @@
static List<PluginScriptLanguage *> pluginscript_languages;
static Error _check_language_desc(const godot_pluginscript_language_desc *desc) {
- ERR_FAIL_COND_V(!desc->name || desc->name == String(), ERR_BUG);
- ERR_FAIL_COND_V(!desc->type || desc->type == String(), ERR_BUG);
- ERR_FAIL_COND_V(!desc->extension || desc->extension == String(), ERR_BUG);
+ ERR_FAIL_COND_V(!desc->name, ERR_BUG);
+ ERR_FAIL_COND_V(!desc->type, ERR_BUG);
+ ERR_FAIL_COND_V(!desc->extension, ERR_BUG);
ERR_FAIL_COND_V(!desc->recognized_extensions || !desc->recognized_extensions[0], ERR_BUG);
ERR_FAIL_COND_V(!desc->init, ERR_BUG);
ERR_FAIL_COND_V(!desc->finish, ERR_BUG);
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index 6529154e5c..4f711dfd1e 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -413,7 +413,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
previous_column = j;
// ignore if just whitespace
- if (text != "") {
+ if (!text.is_empty()) {
previous_text = text;
}
}
@@ -509,7 +509,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
for (const String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
- add_color_region(beg, end, comment_color, end == "");
+ add_color_region(beg, end, comment_color, end.is_empty());
}
/* Strings */
@@ -519,7 +519,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
for (const String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
- add_color_region(beg, end, string_color, end == "");
+ add_color_region(beg, end, string_color, end.is_empty());
}
const Ref<Script> script = _get_edited_resource();
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index b76c2c0437..4822e411ce 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -389,7 +389,7 @@ bool GDScript::instance_has(const Object *p_this) const {
}
bool GDScript::has_source_code() const {
- return source != "";
+ return !source.is_empty();
}
String GDScript::get_source_code() const {
@@ -458,7 +458,7 @@ void GDScript::_update_doc() {
doc.is_script_doc = true;
if (base.is_valid() && base->is_valid()) {
- if (base->doc.name != String()) {
+ if (!base->doc.name.is_empty()) {
doc.inherits = base->doc.name;
} else {
doc.inherits = base->get_instance_base_type();
@@ -472,7 +472,7 @@ void GDScript::_update_doc() {
doc.tutorials = doc_tutorials;
for (const KeyValue<String, DocData::EnumDoc> &E : doc_enums) {
- if (E.value.description != "") {
+ if (!E.value.description.is_empty()) {
doc.enums[E.key] = E.value.description;
}
}
@@ -616,11 +616,11 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
String basedir = path;
- if (basedir == "") {
+ if (basedir.is_empty()) {
basedir = get_path();
}
- if (basedir != "") {
+ if (!basedir.is_empty()) {
basedir = basedir.get_base_dir();
}
@@ -642,7 +642,7 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
path = c->extends_path;
if (path.is_relative_path()) {
String base = get_path();
- if (base == "" || base.is_relative_path()) {
+ if (base.is_empty() || base.is_relative_path()) {
ERR_PRINT(("Could not resolve relative path for parent class: " + path).utf8().get_data());
} else {
path = base.get_base_dir().plus_file(path);
@@ -656,7 +656,7 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
}
}
- if (path != "") {
+ if (!path.is_empty()) {
if (path != get_path()) {
Ref<GDScript> bf = ResourceLoader::load(path);
@@ -809,11 +809,11 @@ Error GDScript::reload(bool p_keep_state) {
String basedir = path;
- if (basedir == "") {
+ if (basedir.is_empty()) {
basedir = get_path();
}
- if (basedir != "") {
+ if (!basedir.is_empty()) {
basedir = basedir.get_base_dir();
}
@@ -1122,7 +1122,7 @@ String GDScript::_get_gdscript_reference_class_name(const GDScript *p_gdscript)
String class_name;
while (p_gdscript) {
- if (class_name == "") {
+ if (class_name.is_empty()) {
class_name = p_gdscript->get_script_class_name();
} else {
class_name = p_gdscript->get_script_class_name() + "." + class_name;
@@ -1433,7 +1433,7 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
pinfo.type = Variant::Type(d["type"].operator int());
ERR_CONTINUE(pinfo.type < 0 || pinfo.type >= Variant::VARIANT_MAX);
pinfo.name = d["name"];
- ERR_CONTINUE(pinfo.name == "");
+ ERR_CONTINUE(pinfo.name.is_empty());
if (d.has("hint")) {
pinfo.hint = PropertyHint(d["hint"].operator int());
}
diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp
index bb0d9e9e9b..b91677d25c 100644
--- a/modules/gdscript/gdscript_cache.cpp
+++ b/modules/gdscript/gdscript_cache.cpp
@@ -117,7 +117,7 @@ void GDScriptCache::remove_script(const String &p_path) {
Ref<GDScriptParserRef> GDScriptCache::get_parser(const String &p_path, GDScriptParserRef::Status p_status, Error &r_error, const String &p_owner) {
MutexLock lock(singleton->lock);
Ref<GDScriptParserRef> ref;
- if (p_owner != String()) {
+ if (!p_owner.is_empty()) {
singleton->dependencies[p_owner].insert(p_path);
}
if (singleton->parser_map.has(p_path)) {
@@ -163,7 +163,7 @@ String GDScriptCache::get_source_code(const String &p_path) {
Ref<GDScript> GDScriptCache::get_shallow_script(const String &p_path, const String &p_owner) {
MutexLock lock(singleton->lock);
- if (p_owner != String()) {
+ if (!p_owner.is_empty()) {
singleton->dependencies[p_owner].insert(p_path);
}
if (singleton->full_gdscript_cache.has(p_path)) {
@@ -186,7 +186,7 @@ Ref<GDScript> GDScriptCache::get_shallow_script(const String &p_path, const Stri
Ref<GDScript> GDScriptCache::get_full_script(const String &p_path, Error &r_error, const String &p_owner) {
MutexLock lock(singleton->lock);
- if (p_owner != String()) {
+ if (!p_owner.is_empty()) {
singleton->dependencies[p_owner].insert(p_path);
}
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index ab0fe5c37d..bba664c328 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -65,7 +65,7 @@ bool GDScriptCompiler::_is_class_member_property(GDScript *owner, const StringNa
}
void GDScriptCompiler::_set_error(const String &p_error, const GDScriptParser::Node *p_node) {
- if (error != "") {
+ if (!error.is_empty()) {
return;
}
@@ -2020,7 +2020,7 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_
if (EngineDebugger::is_active()) {
String signature;
// Path.
- if (p_script->get_path() != String()) {
+ if (!p_script->get_path().is_empty()) {
signature += p_script->get_path();
}
// Location.
@@ -2158,7 +2158,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
p_script->tool = parser->is_tool();
p_script->name = p_class->identifier ? p_class->identifier->name : "";
- if (p_script->name != "") {
+ if (!p_script->name.is_empty()) {
if (ClassDB::class_exists(p_script->name) && ClassDB::is_class_exposed(p_script->name)) {
_set_error("The class '" + p_script->name + "' shadows a native class", p_class);
return ERR_ALREADY_EXISTS;
@@ -2287,7 +2287,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
p_script->constants.insert(name, constant->initializer->reduced_value);
#ifdef TOOLS_ENABLED
p_script->member_lines[name] = constant->start_line;
- if (constant->doc_description != String()) {
+ if (!constant->doc_description.is_empty()) {
p_script->doc_constants[name] = constant->doc_description;
}
#endif
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 71d2699c2e..ec01c19295 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1365,7 +1365,7 @@ static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context,
String arg1 = args[0];
if (arg1.begins_with("/root/")) {
String which = arg1.get_slice("/", 2);
- if (which != "") {
+ if (!which.is_empty()) {
// Try singletons first
if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(which)) {
r_type = _type_from_variant(GDScriptLanguage::get_singleton()->get_named_globals_map()[which]);
@@ -2753,7 +2753,7 @@ void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_t
}
String st = l.substr(tc, l.length()).strip_edges();
- if (st == "" || st.begins_with("#")) {
+ if (st.is_empty() || st.begins_with("#")) {
continue; //ignore!
}
@@ -2810,6 +2810,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
r_result.type = ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION;
r_result.location = base_type.class_type->get_member(p_symbol).get_line();
r_result.class_path = base_type.script_path;
+ r_result.script = GDScriptCache::get_shallow_script(r_result.class_path);
return OK;
}
base_type = base_type.class_type->base_type;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index fd6bd545c9..98a93a1a53 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3100,7 +3100,7 @@ void GDScriptParser::get_class_doc_comment(int p_line, String &p_brief, String &
if (!comments.has(p_line)) {
return;
}
- ERR_FAIL_COND(p_brief != "" || p_desc != "" || p_tutorials.size() != 0);
+ ERR_FAIL_COND(!p_brief.is_empty() || !p_desc.is_empty() || p_tutorials.size() != 0);
int line = p_line;
bool in_codeblock = false;
@@ -3132,7 +3132,7 @@ void GDScriptParser::get_class_doc_comment(int p_line, String &p_brief, String &
String striped_line = doc_line.strip_edges();
// Set the read mode.
- if (striped_line.begins_with("@desc:") && p_desc == "") {
+ if (striped_line.begins_with("@desc:") && p_desc.is_empty()) {
mode = DESC;
striped_line = striped_line.trim_prefix("@desc:");
in_codeblock = _in_codeblock(doc_line, in_codeblock);
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index 6dd8c3e0dd..be9e5df2b0 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -755,7 +755,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (!valid) {
String v = index->operator String();
- if (v != "") {
+ if (!v.is_empty()) {
v = "'" + v + "'";
} else {
v = "of type '" + _get_var_type(index) + "'";
@@ -785,7 +785,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (!valid) {
String v = index->operator String();
- if (v != "") {
+ if (!v.is_empty()) {
v = "'" + v + "'";
} else {
v = "of type '" + _get_var_type(index) + "'";
@@ -817,7 +817,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (oob) {
String v = index->operator String();
- if (v != "") {
+ if (!v.is_empty()) {
v = "'" + v + "'";
} else {
v = "of type '" + _get_var_type(index) + "'";
@@ -848,7 +848,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (!valid) {
String v = index->operator String();
- if (v != "") {
+ if (!v.is_empty()) {
v = "'" + v + "'";
} else {
v = "of type '" + _get_var_type(index) + "'";
@@ -884,7 +884,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (!valid) {
String v = key->operator String();
- if (v != "") {
+ if (!v.is_empty()) {
v = "'" + v + "'";
} else {
v = "of type '" + _get_var_type(key) + "'";
@@ -917,7 +917,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (oob) {
String v = index->operator String();
- if (v != "") {
+ if (!v.is_empty()) {
v = "'" + v + "'";
} else {
v = "of type '" + _get_var_type(index) + "'";
@@ -3295,20 +3295,20 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
//error
// function, file, line, error, explanation
String err_file;
- if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && p_instance->script->path != "") {
+ if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && !p_instance->script->path.is_empty()) {
err_file = p_instance->script->path;
} else if (script) {
err_file = script->path;
}
- if (err_file == "") {
+ if (err_file.is_empty()) {
err_file = "<built-in>";
}
String err_func = name;
- if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && p_instance->script->name != "") {
+ if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && !p_instance->script->name.is_empty()) {
err_func = p_instance->script->name + "." + err_func;
}
int err_line = line;
- if (err_text == "") {
+ if (err_text.is_empty()) {
err_text = "Internal script error! Opcode: " + itos(last_opcode) + " (please report).";
}
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index 92ce71f395..d2e033d7de 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -428,9 +428,6 @@ GDScriptTextDocument::~GDScriptTextDocument() {
void GDScriptTextDocument::sync_script_content(const String &p_path, const String &p_content) {
String path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(p_path);
- if (!path.begins_with("res://")) {
- return;
- }
GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_script(path, p_content);
EditorFileSystem::get_singleton()->update_file(path);
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp
index d2e71efee7..21883b3c6e 100644
--- a/modules/gdscript/tests/gdscript_test_runner.cpp
+++ b/modules/gdscript/tests/gdscript_test_runner.cpp
@@ -267,7 +267,7 @@ bool GDScriptTestRunner::generate_class_index() {
String base_type;
String class_name = GDScriptLanguage::get_singleton()->get_global_class_name(test.get_source_file(), &base_type);
- if (class_name == String()) {
+ if (class_name.is_empty()) {
continue;
}
ERR_FAIL_COND_V_MSG(ScriptServer::is_global_class(class_name), false,
diff --git a/modules/glslang/register_types.cpp b/modules/glslang/register_types.cpp
index dd545ff431..69bf59f848 100644
--- a/modules/glslang/register_types.cpp
+++ b/modules/glslang/register_types.cpp
@@ -120,7 +120,7 @@ static Vector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_stage
preamble += "#define has_VK_KHR_multiview 1\n";
}
- if (preamble != "") {
+ if (!preamble.empty()) {
shader.setPreamble(preamble.c_str());
}
diff --git a/modules/gltf/gltf_animation.h b/modules/gltf/gltf_animation.h
index be0ed2d4c6..763494cb8d 100644
--- a/modules/gltf/gltf_animation.h
+++ b/modules/gltf/gltf_animation.h
@@ -50,7 +50,7 @@ public:
template <class T>
struct Channel {
Interpolation interpolation;
- Vector<float> times;
+ Vector<real_t> times;
Vector<T> values;
};
@@ -58,7 +58,7 @@ public:
Channel<Vector3> position_track;
Channel<Quaternion> rotation_track;
Channel<Vector3> scale_track;
- Vector<Channel<float>> weight_tracks;
+ Vector<Channel<real_t>> weight_tracks;
};
public:
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index dbf6b6e1af..1c1ee5cd10 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -4606,7 +4606,7 @@ Error GLTFDocument::_parse_lights(Ref<GLTFState> state) {
light->outer_cone_angle = spot["outerConeAngle"];
ERR_CONTINUE_MSG(light->inner_cone_angle >= light->outer_cone_angle, "The inner angle must be smaller than the outer angle.");
} else if (type != "point" && type != "directional") {
- ERR_CONTINUE_MSG(ERR_PARSE_ERROR, "Light type is unknown.");
+ ERR_CONTINUE_MSG(true, "Light type is unknown.");
}
state->lights.push_back(light);
@@ -4804,7 +4804,7 @@ Error GLTFDocument::_serialize_animations(Ref<GLTFState> state) {
bool last = false;
Vector<real_t> weight_track;
while (true) {
- float weight = _interpolate_track<float>(track.weight_tracks[track_idx].times,
+ float weight = _interpolate_track<real_t>(track.weight_tracks[track_idx].times,
track.weight_tracks[track_idx].values,
time,
track.weight_tracks[track_idx].interpolation);
@@ -4828,7 +4828,7 @@ Error GLTFDocument::_serialize_animations(Ref<GLTFState> state) {
int32_t weight_tracks_size = track.weight_tracks.size();
all_track_values.resize(weight_tracks_size * values_size);
for (int k = 0; k < track.weight_tracks.size(); k++) {
- Vector<float> wdata = track.weight_tracks[k].values;
+ Vector<real_t> wdata = track.weight_tracks[k].values;
for (int l = 0; l < wdata.size(); l++) {
int32_t index = l * weight_tracks_size + k;
ERR_BREAK(index >= all_track_values.size());
@@ -4979,10 +4979,10 @@ Error GLTFDocument::_parse_animations(Ref<GLTFState> state) {
const int wlen = weights.size() / wc;
for (int k = 0; k < wc; k++) { //separate tracks, having them together is not such a good idea
- GLTFAnimation::Channel<float> cf;
+ GLTFAnimation::Channel<real_t> cf;
cf.interpolation = interp;
cf.times = Variant(times);
- Vector<float> wdata;
+ Vector<real_t> wdata;
wdata.resize(wlen);
for (int l = 0; l < wlen; l++) {
wdata.write[l] = weights[l * wc + k];
@@ -5772,7 +5772,7 @@ struct EditorSceneFormatImporterGLTFInterpolate<Quaternion> {
};
template <class T>
-T GLTFDocument::_interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values, const float p_time, const GLTFAnimation::Interpolation p_interp) {
+T GLTFDocument::_interpolate_track(const Vector<real_t> &p_times, const Vector<T> &p_values, const float p_time, const GLTFAnimation::Interpolation p_interp) {
ERR_FAIL_COND_V(!p_values.size(), T());
if (p_times.size() != (p_values.size() / (p_interp == GLTFAnimation::INTERP_CUBIC_SPLINE ? 3 : 1))) {
ERR_PRINT_ONCE("The interpolated values are not corresponding to its times.");
@@ -6052,7 +6052,7 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
double time = 0.0;
bool last = false;
while (true) {
- float blend = _interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, gltf_interp);
+ real_t blend = _interpolate_track<real_t>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, gltf_interp);
animation->blend_shape_track_insert_key(track_idx, time, blend);
if (last) {
break;
@@ -6246,7 +6246,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> state
}
Animation::TrackType track_type = p_animation->track_get_type(p_track_i);
int32_t key_count = p_animation->track_get_key_count(p_track_i);
- Vector<float> times;
+ Vector<real_t> times;
times.resize(key_count);
String path = p_animation->track_get_path(p_track_i);
for (int32_t key_i = 0; key_i < key_count; key_i++) {
@@ -6352,7 +6352,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> state
if (path.find("/scale") != -1) {
const int32_t keys = p_animation->track_get_key_time(p_track_i, key_count - 1) * BAKE_FPS;
if (!p_track.scale_track.times.size()) {
- Vector<float> new_times;
+ Vector<real_t> new_times;
new_times.resize(keys);
for (int32_t key_i = 0; key_i < keys; key_i++) {
new_times.write[key_i] = key_i / BAKE_FPS;
@@ -6382,7 +6382,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> state
} else if (path.find("/position") != -1) {
const int32_t keys = p_animation->track_get_key_time(p_track_i, key_count - 1) * BAKE_FPS;
if (!p_track.position_track.times.size()) {
- Vector<float> new_times;
+ Vector<real_t> new_times;
new_times.resize(keys);
for (int32_t key_i = 0; key_i < keys; key_i++) {
new_times.write[key_i] = key_i / BAKE_FPS;
@@ -6503,7 +6503,7 @@ void GLTFDocument::_convert_animation(Ref<GLTFState> state, AnimationPlayer *ap,
NodePath shape_path = String(path) + ":" + shape_name;
int32_t shape_track_i = animation->find_track(shape_path, Animation::TYPE_BLEND_SHAPE);
if (shape_track_i == -1) {
- GLTFAnimation::Channel<float> weight;
+ GLTFAnimation::Channel<real_t> weight;
weight.interpolation = GLTFAnimation::INTERP_LINEAR;
weight.times.push_back(0.0f);
weight.times.push_back(0.0f);
@@ -6522,7 +6522,7 @@ void GLTFDocument::_convert_animation(Ref<GLTFState> state, AnimationPlayer *ap,
gltf_interpolation = GLTFAnimation::INTERP_CUBIC_SPLINE;
}
int32_t key_count = animation->track_get_key_count(shape_track_i);
- GLTFAnimation::Channel<float> weight;
+ GLTFAnimation::Channel<real_t> weight;
weight.interpolation = gltf_interpolation;
weight.times.resize(key_count);
for (int32_t time_i = 0; time_i < key_count; time_i++) {
diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h
index 27a1f64bca..f8d9521733 100644
--- a/modules/gltf/gltf_document.h
+++ b/modules/gltf/gltf_document.h
@@ -293,7 +293,7 @@ private:
Node3D *_generate_spatial(Ref<GLTFState> state, Node *parent_node, const GLTFNodeIndex node_index);
void _assign_scene_names(Ref<GLTFState> state);
template <class T>
- T _interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values,
+ T _interpolate_track(const Vector<real_t> &p_times, const Vector<T> &p_values,
const float p_time,
const GLTFAnimation::Interpolation p_interp);
GLTFAccessorIndex _encode_accessor_as_quaternions(Ref<GLTFState> state,
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index d827ce2fb0..c2169c6335 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -885,11 +885,11 @@ void GridMapEditor::update_palette() {
String name = mesh_library->get_item_name(id);
Ref<Texture2D> preview = mesh_library->get_item_preview(id);
- if (name == "") {
+ if (name.is_empty()) {
name = "#" + itos(id);
}
- if (filter != "" && !filter.is_subsequence_ofi(name)) {
+ if (!filter.is_empty() && !filter.is_subsequence_ofi(name)) {
continue;
}
@@ -1163,7 +1163,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
spatial_editor_hb = memnew(HBoxContainer);
spatial_editor_hb->set_h_size_flags(SIZE_EXPAND_FILL);
- spatial_editor_hb->set_alignment(BoxContainer::ALIGN_END);
+ spatial_editor_hb->set_alignment(BoxContainer::ALIGNMENT_END);
Node3DEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb);
spin_box_label = memnew(Label);
@@ -1280,8 +1280,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
info_message = memnew(Label);
info_message->set_text(TTR("Give a MeshLibrary resource to this GridMap to use its meshes."));
- info_message->set_valign(Label::VALIGN_CENTER);
- info_message->set_align(Label::ALIGN_CENTER);
+ info_message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ info_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
info_message->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
info_message->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp
index 32a31aa764..ea28d0c0c8 100644
--- a/modules/hdr/image_loader_hdr.cpp
+++ b/modules/hdr/image_loader_hdr.cpp
@@ -41,7 +41,7 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
while (true) {
String line = f->get_line();
ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_UNRECOGNIZED);
- if (line == "") { // empty line indicates end of header
+ if (line.is_empty()) { // empty line indicates end of header
break;
}
if (line.begins_with("FORMAT=")) { // leave option to implement other commands
diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp
index 2522f1bb11..9d985e16d4 100644
--- a/modules/mbedtls/crypto_mbedtls.cpp
+++ b/modules/mbedtls/crypto_mbedtls.cpp
@@ -310,7 +310,7 @@ void CryptoMbedTLS::load_default_certificates(String p_path) {
default_certs = memnew(X509CertificateMbedTLS);
ERR_FAIL_COND(default_certs == nullptr);
- if (p_path != "") {
+ if (!p_path.is_empty()) {
// Use certs defined in project settings.
default_certs->load(p_path);
}
diff --git a/modules/mono/editor/code_completion.cpp b/modules/mono/editor/code_completion.cpp
index 7433c865f5..61d0890288 100644
--- a/modules/mono/editor/code_completion.cpp
+++ b/modules/mono/editor/code_completion.cpp
@@ -155,7 +155,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
dir_access->list_dir_begin();
String filename = dir_access->get_next();
- while (filename != "") {
+ while (!filename.is_empty()) {
if (filename == "." || filename == "..") {
filename = dir_access->get_next();
continue;
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index f480c86088..e2908a8a66 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -3144,7 +3144,7 @@ bool TextServerAdvanced::shaped_text_add_string(RID p_shaped, const String &p_te
return true;
}
-bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) {
+bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) {
_THREAD_SAFE_METHOD_
ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -3174,7 +3174,7 @@ bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, con
return true;
}
-bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) {
+bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
ShapedTextData *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -3242,56 +3242,56 @@ bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key,
for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : sd->objects) {
if ((E.value.pos >= sd->start) && (E.value.pos < sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -3433,56 +3433,56 @@ RID TextServerAdvanced::shaped_text_substr(RID p_shaped, int p_start, int p_leng
for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : new_sd->objects) {
if ((E.value.pos >= new_sd->start) && (E.value.pos < new_sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -4263,7 +4263,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int32_t p_star
}
hb_buffer_set_script(p_sd->hb_buffer, p_script);
- if (p_sd->spans[p_span].language != String()) {
+ if (!p_sd->spans[p_span].language.is_empty()) {
hb_language_t lang = hb_language_from_string(p_sd->spans[p_span].language.ascii().get_data(), -1);
hb_buffer_set_language(p_sd->hb_buffer, lang);
}
@@ -4579,56 +4579,56 @@ bool TextServerAdvanced::shaped_text_shape(RID p_shaped) {
float full_descent = sd->descent;
for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : sd->objects) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -4971,12 +4971,12 @@ void TextServerAdvanced::_insert_num_systems_lang() {
}
String TextServerAdvanced::format_number(const String &p_string, const String &p_language) const {
- const StringName lang = (p_language == "") ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
+ const StringName lang = (p_language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
String res = p_string;
for (int i = 0; i < num_systems.size(); i++) {
if (num_systems[i].lang.has(lang)) {
- if (num_systems[i].digits == String()) {
+ if (num_systems[i].digits.is_empty()) {
return p_string;
}
res.replace("e", num_systems[i].exp);
@@ -4996,12 +4996,12 @@ String TextServerAdvanced::format_number(const String &p_string, const String &p
}
String TextServerAdvanced::parse_number(const String &p_string, const String &p_language) const {
- const StringName lang = (p_language == "") ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
+ const StringName lang = (p_language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
String res = p_string;
for (int i = 0; i < num_systems.size(); i++) {
if (num_systems[i].lang.has(lang)) {
- if (num_systems[i].digits == String()) {
+ if (num_systems[i].digits.is_empty()) {
return p_string;
}
res.replace(num_systems[i].exp, "e");
@@ -5024,11 +5024,11 @@ String TextServerAdvanced::parse_number(const String &p_string, const String &p_
}
String TextServerAdvanced::percent_sign(const String &p_language) const {
- const StringName lang = (p_language == "") ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
+ const StringName lang = (p_language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
for (int i = 0; i < num_systems.size(); i++) {
if (num_systems[i].lang.has(lang)) {
- if (num_systems[i].percent_sign == String()) {
+ if (num_systems[i].percent_sign.is_empty()) {
return "%";
}
return num_systems[i].percent_sign;
diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h
index 5eaff67a6e..414db8c7ea 100644
--- a/modules/text_server_adv/text_server_adv.h
+++ b/modules/text_server_adv/text_server_adv.h
@@ -476,8 +476,8 @@ public:
virtual bool shaped_text_get_preserve_control(RID p_shaped) const override;
virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") override;
- virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) override;
- virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) override;
+ virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override;
+ virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override;
virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override;
virtual RID shaped_text_get_parent(RID p_shaped) const override;
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index 5c06051211..97a53143cf 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -2247,7 +2247,7 @@ bool TextServerFallback::shaped_text_add_string(RID p_shaped, const String &p_te
return true;
}
-bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) {
+bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) {
ShapedTextData *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -2278,7 +2278,7 @@ bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, con
return true;
}
-bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) {
+bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
ShapedTextData *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -2346,56 +2346,56 @@ bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key,
for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : sd->objects) {
if ((E.value.pos >= sd->start) && (E.value.pos < sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -2498,56 +2498,56 @@ RID TextServerFallback::shaped_text_substr(RID p_shaped, int p_start, int p_leng
for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : new_sd->objects) {
if ((E.value.pos >= new_sd->start) && (E.value.pos < new_sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -3052,56 +3052,56 @@ bool TextServerFallback::shaped_text_shape(RID p_shaped) {
float full_descent = sd->descent;
for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : sd->objects) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h
index 67b08d1eac..f2b33c2afb 100644
--- a/modules/text_server_fb/text_server_fb.h
+++ b/modules/text_server_fb/text_server_fb.h
@@ -387,8 +387,8 @@ public:
virtual bool shaped_text_get_preserve_control(RID p_shaped) const override;
virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") override;
- virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) override;
- virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) override;
+ virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override;
+ virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override;
virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override;
virtual RID shaped_text_get_parent(RID p_shaped) const override;
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp
index 349537521c..9deea79ea6 100644
--- a/modules/visual_script/editor/visual_script_editor.cpp
+++ b/modules/visual_script/editor/visual_script_editor.cpp
@@ -779,7 +779,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
for (int i = 0; i < node->get_output_sequence_port_count(); i++) {
Label *text2 = memnew(Label);
text2->set_text(node->get_output_sequence_port_text(i));
- text2->set_align(Label::ALIGN_RIGHT);
+ text2->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
gnode->add_child(text2);
gnode->set_slot(slot_idx, false, 0, Color(), true, TYPE_SEQUENCE, mono_color, seq_port, seq_port);
slot_idx++;
@@ -900,7 +900,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
if (i < mixed_seq_ports) {
Label *text2 = memnew(Label);
text2->set_text(node->get_output_sequence_port_text(i));
- text2->set_align(Label::ALIGN_RIGHT);
+ text2->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
hbc->add_child(text2);
}
@@ -1328,7 +1328,7 @@ void VisualScriptEditor::_create_function_dialog() {
}
void VisualScriptEditor::_create_function() {
- String name = _validate_name((func_name_box->get_text() == "") ? "new_func" : func_name_box->get_text());
+ String name = _validate_name((func_name_box->get_text().is_empty()) ? "new_func" : func_name_box->get_text());
selected = name;
Vector2 pos = _get_available_pos();
@@ -2094,7 +2094,7 @@ Variant VisualScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
String type = it->get_metadata(0);
- if (type == String()) {
+ if (type.is_empty()) {
return Variant();
}
@@ -2622,7 +2622,7 @@ String VisualScriptEditor::get_name() {
name = TTR("[unsaved]");
} else if (script->is_built_in()) {
const String &script_name = script->get_name();
- if (script_name != "") {
+ if (!script_name.is_empty()) {
// If the built-in script has a custom resource name defined,
// display the built-in script name as follows: `ResourceName (scene_file.tscn)`
name = vformat("%s (%s)", script_name, name.get_slice("::", 0));
@@ -2842,7 +2842,7 @@ void VisualScriptEditor::clear_edit_menu() {
void VisualScriptEditor::_change_base_type_callback() {
String bt = select_base_type->get_selected_type();
- ERR_FAIL_COND(bt == String());
+ ERR_FAIL_COND(bt.is_empty());
undo_redo->create_action(TTR("Change Base Type"));
undo_redo->add_do_method(script.ptr(), "set_instance_base_type", bt);
undo_redo->add_undo_method(script.ptr(), "set_instance_base_type", script->get_instance_base_type());
@@ -3213,7 +3213,7 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
if (tg.type == Variant::OBJECT) {
if (tg.script.is_valid()) {
new_connect_node_select->select_from_script(tg.script, "");
- } else if (type_string != String()) {
+ } else if (!type_string.is_empty()) {
new_connect_node_select->select_from_base_type(type_string);
} else {
new_connect_node_select->select_from_base_type(n->get_base_type());
@@ -3237,7 +3237,7 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
property_info = script->get_node(port_action_node)->get_output_value_port_info(port_action_output);
}
if (tg.type == Variant::OBJECT) {
- if (property_info.type == Variant::OBJECT && property_info.hint_string != String()) {
+ if (property_info.type == Variant::OBJECT && !property_info.hint_string.is_empty()) {
new_connect_node_select->select_from_action(property_info.hint_string);
} else {
new_connect_node_select->select_from_action("");
@@ -3462,7 +3462,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
PropertyHint hint = script->get_node(port_action_node)->get_output_value_port_info(port_action_output).hint;
String base_type = script->get_node(port_action_node)->get_output_value_port_info(port_action_output).hint_string;
- if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
+ if (!base_type.is_empty() && hint == PROPERTY_HINT_TYPE_STRING) {
vsfc->set_base_type(base_type);
}
if (p_text == "call" || p_text == "call_deferred") {
@@ -3497,7 +3497,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
PropertyHint hint = script->get_node(port_action_node)->get_output_value_port_info(port_action_output).hint;
String base_type = script->get_node(port_action_node)->get_output_value_port_info(port_action_output).hint_string;
- if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
+ if (!base_type.is_empty() && hint == PROPERTY_HINT_TYPE_STRING) {
vsp->set_base_type(base_type);
}
}
@@ -3526,7 +3526,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
} else if (script->get_node(port_action_node).is_valid()) {
PropertyHint hint = script->get_node(port_action_node)->get_output_value_port_info(port_action_output).hint;
String base_type = script->get_node(port_action_node)->get_output_value_port_info(port_action_output).hint_string;
- if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
+ if (!base_type.is_empty() && hint == PROPERTY_HINT_TYPE_STRING) {
vsp->set_base_type(base_type);
}
}
@@ -4476,8 +4476,8 @@ VisualScriptEditor::VisualScriptEditor() {
select_func_text = memnew(Label);
select_func_text->set_text(TTR("Select or create a function to edit its graph."));
- select_func_text->set_align(Label::ALIGN_CENTER);
- select_func_text->set_valign(Label::VALIGN_CENTER);
+ select_func_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ select_func_text->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
select_func_text->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(select_func_text);
@@ -4485,8 +4485,8 @@ VisualScriptEditor::VisualScriptEditor() {
hint_text->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -100);
hint_text->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0);
hint_text->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0);
- hint_text->set_align(Label::ALIGN_CENTER);
- hint_text->set_valign(Label::VALIGN_CENTER);
+ hint_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ hint_text->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
graph->add_child(hint_text);
hint_text_timer = memnew(Timer);
diff --git a/modules/visual_script/editor/visual_script_property_selector.cpp b/modules/visual_script/editor/visual_script_property_selector.cpp
index 02307b712c..9fa35d4453 100644
--- a/modules/visual_script/editor/visual_script_property_selector.cpp
+++ b/modules/visual_script/editor/visual_script_property_selector.cpp
@@ -175,7 +175,7 @@ void VisualScriptPropertySelector::_update_search() {
String set_text = set_text_raw.capitalize();
String input = search_box->get_text().capitalize();
- if (input == String() || get_text_raw.findn(input) != -1 || get_text.findn(input) != -1) {
+ if (input.is_empty() || get_text_raw.findn(input) != -1 || get_text.findn(input) != -1) {
TreeItem *item = search_options->create_item(category ? category : root);
item->set_text(0, get_text);
item->set_metadata(0, F.name);
@@ -188,7 +188,7 @@ void VisualScriptPropertySelector::_update_search() {
item->set_metadata(2, connecting);
}
- if (input == String() || set_text_raw.findn(input) != -1 || set_text.findn(input) != -1) {
+ if (input.is_empty() || set_text_raw.findn(input) != -1 || set_text.findn(input) != -1) {
TreeItem *item = search_options->create_item(category ? category : root);
item->set_text(0, set_text);
item->set_metadata(0, F.name);
@@ -252,7 +252,7 @@ void VisualScriptPropertySelector::_update_search() {
String desc_raw = mi.name + desc_arguments;
String desc = desc_raw.capitalize().replace("( ", "(");
- if (search_box->get_text() != String() &&
+ if (!search_box->get_text().is_empty() &&
name.findn(search_box->get_text()) == -1 &&
desc.findn(search_box->get_text()) == -1 &&
desc_raw.findn(search_box->get_text()) == -1) {
@@ -322,7 +322,7 @@ void VisualScriptPropertySelector::_update_search() {
}
void VisualScriptPropertySelector::create_visualscript_item(const String &name, TreeItem *const root, const String &search_input, const String &text) {
- if (search_input == String() || text.findn(search_input) != -1) {
+ if (search_input.is_empty() || text.findn(search_input) != -1) {
TreeItem *item = search_options->create_item(root);
item->set_text(0, text);
item->set_icon(0, vbc->get_theme_icon(SNAME("VisualScript"), SNAME("EditorIcons")));
@@ -352,7 +352,7 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
bool in_filter = false;
Vector<String> tx_filters = search_box->get_text().split(" ");
for (int i = 0; i < tx_filters.size(); i++) {
- if (tx_filters[i] == "") {
+ if (tx_filters[i].is_empty()) {
in_filter = true;
} else {
in_filter = false;
@@ -451,7 +451,7 @@ void VisualScriptPropertySelector::_item_selected() {
String at_class = class_type;
- while (at_class != String()) {
+ while (!at_class.is_empty()) {
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(at_class);
if (E) {
for (int i = 0; i < E->get().properties.size(); i++) {
@@ -465,7 +465,7 @@ void VisualScriptPropertySelector::_item_selected() {
}
at_class = class_type;
- while (at_class != String()) {
+ while (!at_class.is_empty()) {
Map<String, DocData::ClassDoc>::Element *C = dd->class_list.find(at_class);
if (C) {
for (int i = 0; i < C->get().methods.size(); i++) {
@@ -521,7 +521,7 @@ void VisualScriptPropertySelector::_item_selected() {
memdelete(names);
- if (text == String()) {
+ if (text.is_empty()) {
return;
}
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 34d8c0b1e6..63bd9bbee4 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1665,8 +1665,8 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
String err_func = p_method;
int err_line = current_node_id; // Not a line but it works as one.
- if (node && (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD || error_str == String())) {
- if (error_str != String()) {
+ if (node && (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD || error_str.is_empty())) {
+ if (!error_str.is_empty()) {
error_str += " ";
}
@@ -2379,7 +2379,7 @@ void VisualScriptLanguage::debug_get_stack_level_locals(int p_level, List<String
for (int i = 0; i < node->input_port_count; i++) {
String name = node->get_base_node()->get_input_value_port_info(i).name;
- if (name == String()) {
+ if (name.is_empty()) {
name = "in_" + itos(i);
}
@@ -2399,7 +2399,7 @@ void VisualScriptLanguage::debug_get_stack_level_locals(int p_level, List<String
for (int i = 0; i < node->output_port_count; i++) {
String name = node->get_base_node()->get_output_value_port_info(i).name;
- if (name == String()) {
+ if (name.is_empty()) {
name = "out_" + itos(i);
}
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 62a4f465cb..278d806595 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -724,7 +724,7 @@ String VisualScriptTypeCast::get_caption() const {
}
String VisualScriptTypeCast::get_text() const {
- if (script != String()) {
+ if (!script.is_empty()) {
return "Is " + script.get_file() + "?";
} else {
return "Is " + base_type + "?";
@@ -762,7 +762,7 @@ String VisualScriptTypeCast::get_base_script() const {
VisualScriptTypeCast::TypeGuess VisualScriptTypeCast::guess_output_type(TypeGuess *p_inputs, int p_output) const {
TypeGuess tg;
tg.type = Variant::OBJECT;
- if (script != String()) {
+ if (!script.is_empty()) {
tg.script = ResourceLoader::load(script);
}
//if (!tg.script.is_valid()) {
@@ -793,7 +793,7 @@ public:
return 0;
}
- if (script != String()) {
+ if (!script.is_empty()) {
Ref<Script> obj_script = obj->get_script();
if (!obj_script.is_valid()) {
return 1; //well, definitely not the script because object we got has no script.
@@ -853,7 +853,7 @@ void VisualScriptTypeCast::_bind_methods() {
String script_ext_hint;
for (const String &E : script_extensions) {
- if (script_ext_hint != String()) {
+ if (!script_ext_hint.is_empty()) {
script_ext_hint += ",";
}
script_ext_hint += "*." + E;
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index a2ad38bf01..651464dfdb 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -370,7 +370,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
} else if (call_mode == CALL_MODE_INSTANCE) {
type = base_type;
- if (base_script != String()) {
+ if (!base_script.is_empty()) {
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
ScriptServer::edit_request_func(base_script); //make sure it's loaded
}
@@ -539,7 +539,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
property.hint = PROPERTY_HINT_ENUM;
String sl;
for (const Engine::Singleton &E : names) {
- if (sl != String()) {
+ if (!sl.is_empty()) {
sl += ",";
}
sl += E.name;
@@ -580,7 +580,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE;
property.hint_string = base_type;
- if (base_script != String()) {
+ if (!base_script.is_empty()) {
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
ScriptServer::edit_request_func(base_script); //make sure it's loaded
}
@@ -684,7 +684,7 @@ void VisualScriptFunctionCall::_bind_methods() {
String script_ext_hint;
for (const String &E : script_extensions) {
- if (script_ext_hint != String()) {
+ if (!script_ext_hint.is_empty()) {
script_ext_hint += ",";
}
script_ext_hint += "*." + E;
@@ -1161,7 +1161,7 @@ void VisualScriptPropertySet::_update_cache() {
}
} else if (call_mode == CALL_MODE_INSTANCE) {
type = base_type;
- if (base_script != String()) {
+ if (!base_script.is_empty()) {
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
ScriptServer::edit_request_func(base_script); //make sure it's loaded
}
@@ -1321,7 +1321,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
property.hint_string = base_type;
- if (base_script != String()) {
+ if (!base_script.is_empty()) {
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
ScriptServer::edit_request_func(base_script); //make sure it's loaded
}
@@ -1361,7 +1361,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
property.hint = PROPERTY_HINT_ENUM;
property.hint_string = options;
property.type = Variant::STRING;
- if (options == "") {
+ if (options.is_empty()) {
property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
}
}
@@ -1411,7 +1411,7 @@ void VisualScriptPropertySet::_bind_methods() {
String script_ext_hint;
for (const String &E : script_extensions) {
- if (script_ext_hint != String()) {
+ if (!script_ext_hint.is_empty()) {
script_ext_hint += ",";
}
script_ext_hint += "*." + E;
@@ -1847,7 +1847,7 @@ void VisualScriptPropertyGet::_update_cache() {
}
} else if (call_mode == CALL_MODE_INSTANCE) {
type = base_type;
- if (base_script != String()) {
+ if (!base_script.is_empty()) {
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
ScriptServer::edit_request_func(base_script); //make sure it's loaded
}
@@ -2027,7 +2027,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
property.hint_string = base_type;
- if (base_script != String()) {
+ if (!base_script.is_empty()) {
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
ScriptServer::edit_request_func(base_script); //make sure it's loaded
}
@@ -2066,7 +2066,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
property.hint = PROPERTY_HINT_ENUM;
property.hint_string = options;
property.type = Variant::STRING;
- if (options == "") {
+ if (options.is_empty()) {
property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
}
}
@@ -2113,7 +2113,7 @@ void VisualScriptPropertyGet::_bind_methods() {
String script_ext_hint;
for (const String &E : script_extensions) {
- if (script_ext_hint != String()) {
+ if (!script_ext_hint.is_empty()) {
script_ext_hint += ",";
}
script_ext_hint += "." + E;
@@ -2324,7 +2324,7 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const {
String ml;
for (const StringName &E : sigs) {
- if (ml != String()) {
+ if (!ml.is_empty()) {
ml += ",";
}
ml += E;
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index b0af030981..bb4c83bd24 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1307,7 +1307,7 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const {
String vhint;
for (const StringName &E : vars) {
- if (vhint != String()) {
+ if (!vhint.is_empty()) {
vhint += ",";
}
@@ -1417,7 +1417,7 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const {
String vhint;
for (const StringName &E : vars) {
- if (vhint != String()) {
+ if (!vhint.is_empty()) {
vhint += ",";
}
@@ -1615,7 +1615,7 @@ PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const {
pinfo.hint_string = preload->get_class();
if (preload->get_path().is_resource_file()) {
pinfo.name = preload->get_path();
- } else if (preload->get_name() != String()) {
+ } else if (!preload->get_name().is_empty()) {
pinfo.name = preload->get_name();
} else {
pinfo.name = preload->get_class();
@@ -1994,7 +1994,7 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const
property.hint_string = "";
for (const String &E : constants) {
- if (property.hint_string != String()) {
+ if (!property.hint_string.is_empty()) {
property.hint_string += ",";
}
property.hint_string += E;
@@ -2132,7 +2132,7 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) c
}
property.hint_string = "";
for (const StringName &E : constants) {
- if (property.hint_string != String()) {
+ if (!property.hint_string.is_empty()) {
property.hint_string += ",";
}
property.hint_string += String(E);
@@ -2363,7 +2363,7 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con
continue; //skip these, too simple named
}
- if (cc != String()) {
+ if (!cc.is_empty()) {
cc += ",";
}
cc += E.name;
@@ -3147,7 +3147,7 @@ String VisualScriptSubCall::get_caption() const {
String VisualScriptSubCall::get_text() const {
Ref<Script> script = get_script();
if (script.is_valid()) {
- if (script->get_name() != String()) {
+ if (!script->get_name().is_empty()) {
return script->get_name();
}
if (script->get_path().is_resource_file()) {
@@ -3786,7 +3786,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const {
al.sort();
for (int i = 0; i < al.size(); i++) {
- if (actions != String()) {
+ if (!actions.is_empty()) {
actions += ",";
}
actions += al[i];
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index 4b89c9ccd0..c5d17e5a11 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -449,7 +449,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
String ml;
for (const String &E : mstring) {
- if (ml != String()) {
+ if (!ml.is_empty()) {
ml += ",";
}
ml += E;
diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp
index 514b2d055f..a3d0d3554f 100644
--- a/modules/websocket/wsl_server.cpp
+++ b/modules/websocket/wsl_server.cpp
@@ -83,11 +83,11 @@ bool WSLServer::PendingPeer::_parse_request(const Vector<String> p_protocols, St
break;
}
// Found a protocol
- if (protocol != "") {
+ if (!protocol.is_empty()) {
break;
}
}
- if (protocol == "") { // Invalid protocol(s) requested
+ if (protocol.is_empty()) { // Invalid protocol(s) requested
return false;
}
} else if (p_protocols.size() > 0) { // No protocol requested, but we need one
@@ -138,7 +138,7 @@ Error WSLServer::PendingPeer::do_handshake(const Vector<String> p_protocols, uin
s += "Upgrade: websocket\r\n";
s += "Connection: Upgrade\r\n";
s += "Sec-WebSocket-Accept: " + WSLPeer::compute_key_response(key) + "\r\n";
- if (protocol != "") {
+ if (!protocol.is_empty()) {
s += "Sec-WebSocket-Protocol: " + protocol + "\r\n";
}
s += "\r\n";