mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2026-01-04 18:10:07 +03:00
Replace String comparisons with "", String() to is_empty()
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
This commit is contained in:
@@ -1328,7 +1328,7 @@ void VisualScriptEditor::_create_function_dialog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptEditor::_create_function() {
|
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;
|
selected = name;
|
||||||
Vector2 pos = _get_available_pos();
|
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);
|
String type = it->get_metadata(0);
|
||||||
|
|
||||||
if (type == String()) {
|
if (type.is_empty()) {
|
||||||
return Variant();
|
return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2622,7 +2622,7 @@ String VisualScriptEditor::get_name() {
|
|||||||
name = TTR("[unsaved]");
|
name = TTR("[unsaved]");
|
||||||
} else if (script->is_built_in()) {
|
} else if (script->is_built_in()) {
|
||||||
const String &script_name = script->get_name();
|
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,
|
// If the built-in script has a custom resource name defined,
|
||||||
// display the built-in script name as follows: `ResourceName (scene_file.tscn)`
|
// display the built-in script name as follows: `ResourceName (scene_file.tscn)`
|
||||||
name = vformat("%s (%s)", script_name, name.get_slice("::", 0));
|
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() {
|
void VisualScriptEditor::_change_base_type_callback() {
|
||||||
String bt = select_base_type->get_selected_type();
|
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->create_action(TTR("Change Base Type"));
|
||||||
undo_redo->add_do_method(script.ptr(), "set_instance_base_type", bt);
|
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());
|
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.type == Variant::OBJECT) {
|
||||||
if (tg.script.is_valid()) {
|
if (tg.script.is_valid()) {
|
||||||
new_connect_node_select->select_from_script(tg.script, "");
|
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);
|
new_connect_node_select->select_from_base_type(type_string);
|
||||||
} else {
|
} else {
|
||||||
new_connect_node_select->select_from_base_type(n->get_base_type());
|
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);
|
property_info = script->get_node(port_action_node)->get_output_value_port_info(port_action_output);
|
||||||
}
|
}
|
||||||
if (tg.type == Variant::OBJECT) {
|
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);
|
new_connect_node_select->select_from_action(property_info.hint_string);
|
||||||
} else {
|
} else {
|
||||||
new_connect_node_select->select_from_action("");
|
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;
|
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;
|
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);
|
vsfc->set_base_type(base_type);
|
||||||
}
|
}
|
||||||
if (p_text == "call" || p_text == "call_deferred") {
|
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;
|
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;
|
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);
|
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()) {
|
} 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;
|
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;
|
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);
|
vsp->set_base_type(base_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ void VisualScriptPropertySelector::_update_search() {
|
|||||||
String set_text = set_text_raw.capitalize();
|
String set_text = set_text_raw.capitalize();
|
||||||
String input = search_box->get_text().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);
|
TreeItem *item = search_options->create_item(category ? category : root);
|
||||||
item->set_text(0, get_text);
|
item->set_text(0, get_text);
|
||||||
item->set_metadata(0, F.name);
|
item->set_metadata(0, F.name);
|
||||||
@@ -188,7 +188,7 @@ void VisualScriptPropertySelector::_update_search() {
|
|||||||
item->set_metadata(2, connecting);
|
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);
|
TreeItem *item = search_options->create_item(category ? category : root);
|
||||||
item->set_text(0, set_text);
|
item->set_text(0, set_text);
|
||||||
item->set_metadata(0, F.name);
|
item->set_metadata(0, F.name);
|
||||||
@@ -252,7 +252,7 @@ void VisualScriptPropertySelector::_update_search() {
|
|||||||
String desc_raw = mi.name + desc_arguments;
|
String desc_raw = mi.name + desc_arguments;
|
||||||
String desc = desc_raw.capitalize().replace("( ", "(");
|
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 &&
|
name.findn(search_box->get_text()) == -1 &&
|
||||||
desc.findn(search_box->get_text()) == -1 &&
|
desc.findn(search_box->get_text()) == -1 &&
|
||||||
desc_raw.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) {
|
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);
|
TreeItem *item = search_options->create_item(root);
|
||||||
item->set_text(0, text);
|
item->set_text(0, text);
|
||||||
item->set_icon(0, vbc->get_theme_icon(SNAME("VisualScript"), SNAME("EditorIcons")));
|
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;
|
bool in_filter = false;
|
||||||
Vector<String> tx_filters = search_box->get_text().split(" ");
|
Vector<String> tx_filters = search_box->get_text().split(" ");
|
||||||
for (int i = 0; i < tx_filters.size(); i++) {
|
for (int i = 0; i < tx_filters.size(); i++) {
|
||||||
if (tx_filters[i] == "") {
|
if (tx_filters[i].is_empty()) {
|
||||||
in_filter = true;
|
in_filter = true;
|
||||||
} else {
|
} else {
|
||||||
in_filter = false;
|
in_filter = false;
|
||||||
@@ -451,7 +451,7 @@ void VisualScriptPropertySelector::_item_selected() {
|
|||||||
|
|
||||||
String at_class = class_type;
|
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);
|
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(at_class);
|
||||||
if (E) {
|
if (E) {
|
||||||
for (int i = 0; i < E->get().properties.size(); i++) {
|
for (int i = 0; i < E->get().properties.size(); i++) {
|
||||||
@@ -465,7 +465,7 @@ void VisualScriptPropertySelector::_item_selected() {
|
|||||||
}
|
}
|
||||||
at_class = class_type;
|
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);
|
Map<String, DocData::ClassDoc>::Element *C = dd->class_list.find(at_class);
|
||||||
if (C) {
|
if (C) {
|
||||||
for (int i = 0; i < C->get().methods.size(); i++) {
|
for (int i = 0; i < C->get().methods.size(); i++) {
|
||||||
@@ -521,7 +521,7 @@ void VisualScriptPropertySelector::_item_selected() {
|
|||||||
|
|
||||||
memdelete(names);
|
memdelete(names);
|
||||||
|
|
||||||
if (text == String()) {
|
if (text.is_empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1665,8 +1665,8 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
String err_func = p_method;
|
String err_func = p_method;
|
||||||
int err_line = current_node_id; // Not a line but it works as one.
|
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 (node && (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD || error_str.is_empty())) {
|
||||||
if (error_str != String()) {
|
if (!error_str.is_empty()) {
|
||||||
error_str += " ";
|
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++) {
|
for (int i = 0; i < node->input_port_count; i++) {
|
||||||
String name = node->get_base_node()->get_input_value_port_info(i).name;
|
String name = node->get_base_node()->get_input_value_port_info(i).name;
|
||||||
if (name == String()) {
|
if (name.is_empty()) {
|
||||||
name = "in_" + itos(i);
|
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++) {
|
for (int i = 0; i < node->output_port_count; i++) {
|
||||||
String name = node->get_base_node()->get_output_value_port_info(i).name;
|
String name = node->get_base_node()->get_output_value_port_info(i).name;
|
||||||
if (name == String()) {
|
if (name.is_empty()) {
|
||||||
name = "out_" + itos(i);
|
name = "out_" + itos(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -724,7 +724,7 @@ String VisualScriptTypeCast::get_caption() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String VisualScriptTypeCast::get_text() const {
|
String VisualScriptTypeCast::get_text() const {
|
||||||
if (script != String()) {
|
if (!script.is_empty()) {
|
||||||
return "Is " + script.get_file() + "?";
|
return "Is " + script.get_file() + "?";
|
||||||
} else {
|
} else {
|
||||||
return "Is " + base_type + "?";
|
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 {
|
VisualScriptTypeCast::TypeGuess VisualScriptTypeCast::guess_output_type(TypeGuess *p_inputs, int p_output) const {
|
||||||
TypeGuess tg;
|
TypeGuess tg;
|
||||||
tg.type = Variant::OBJECT;
|
tg.type = Variant::OBJECT;
|
||||||
if (script != String()) {
|
if (!script.is_empty()) {
|
||||||
tg.script = ResourceLoader::load(script);
|
tg.script = ResourceLoader::load(script);
|
||||||
}
|
}
|
||||||
//if (!tg.script.is_valid()) {
|
//if (!tg.script.is_valid()) {
|
||||||
@@ -793,7 +793,7 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (script != String()) {
|
if (!script.is_empty()) {
|
||||||
Ref<Script> obj_script = obj->get_script();
|
Ref<Script> obj_script = obj->get_script();
|
||||||
if (!obj_script.is_valid()) {
|
if (!obj_script.is_valid()) {
|
||||||
return 1; //well, definitely not the script because object we got has no script.
|
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;
|
String script_ext_hint;
|
||||||
for (const String &E : script_extensions) {
|
for (const String &E : script_extensions) {
|
||||||
if (script_ext_hint != String()) {
|
if (!script_ext_hint.is_empty()) {
|
||||||
script_ext_hint += ",";
|
script_ext_hint += ",";
|
||||||
}
|
}
|
||||||
script_ext_hint += "*." + E;
|
script_ext_hint += "*." + E;
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
|
|||||||
|
|
||||||
} else if (call_mode == CALL_MODE_INSTANCE) {
|
} else if (call_mode == CALL_MODE_INSTANCE) {
|
||||||
type = base_type;
|
type = base_type;
|
||||||
if (base_script != String()) {
|
if (!base_script.is_empty()) {
|
||||||
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
||||||
ScriptServer::edit_request_func(base_script); //make sure it's loaded
|
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;
|
property.hint = PROPERTY_HINT_ENUM;
|
||||||
String sl;
|
String sl;
|
||||||
for (const Engine::Singleton &E : names) {
|
for (const Engine::Singleton &E : names) {
|
||||||
if (sl != String()) {
|
if (!sl.is_empty()) {
|
||||||
sl += ",";
|
sl += ",";
|
||||||
}
|
}
|
||||||
sl += E.name;
|
sl += E.name;
|
||||||
@@ -580,7 +580,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
|
|||||||
property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE;
|
property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE;
|
||||||
property.hint_string = 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) {
|
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
||||||
ScriptServer::edit_request_func(base_script); //make sure it's loaded
|
ScriptServer::edit_request_func(base_script); //make sure it's loaded
|
||||||
}
|
}
|
||||||
@@ -684,7 +684,7 @@ void VisualScriptFunctionCall::_bind_methods() {
|
|||||||
|
|
||||||
String script_ext_hint;
|
String script_ext_hint;
|
||||||
for (const String &E : script_extensions) {
|
for (const String &E : script_extensions) {
|
||||||
if (script_ext_hint != String()) {
|
if (!script_ext_hint.is_empty()) {
|
||||||
script_ext_hint += ",";
|
script_ext_hint += ",";
|
||||||
}
|
}
|
||||||
script_ext_hint += "*." + E;
|
script_ext_hint += "*." + E;
|
||||||
@@ -1161,7 +1161,7 @@ void VisualScriptPropertySet::_update_cache() {
|
|||||||
}
|
}
|
||||||
} else if (call_mode == CALL_MODE_INSTANCE) {
|
} else if (call_mode == CALL_MODE_INSTANCE) {
|
||||||
type = base_type;
|
type = base_type;
|
||||||
if (base_script != String()) {
|
if (!base_script.is_empty()) {
|
||||||
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
||||||
ScriptServer::edit_request_func(base_script); //make sure it's loaded
|
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 = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
|
||||||
property.hint_string = 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) {
|
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
||||||
ScriptServer::edit_request_func(base_script); //make sure it's loaded
|
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 = PROPERTY_HINT_ENUM;
|
||||||
property.hint_string = options;
|
property.hint_string = options;
|
||||||
property.type = Variant::STRING;
|
property.type = Variant::STRING;
|
||||||
if (options == "") {
|
if (options.is_empty()) {
|
||||||
property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
|
property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1411,7 +1411,7 @@ void VisualScriptPropertySet::_bind_methods() {
|
|||||||
|
|
||||||
String script_ext_hint;
|
String script_ext_hint;
|
||||||
for (const String &E : script_extensions) {
|
for (const String &E : script_extensions) {
|
||||||
if (script_ext_hint != String()) {
|
if (!script_ext_hint.is_empty()) {
|
||||||
script_ext_hint += ",";
|
script_ext_hint += ",";
|
||||||
}
|
}
|
||||||
script_ext_hint += "*." + E;
|
script_ext_hint += "*." + E;
|
||||||
@@ -1847,7 +1847,7 @@ void VisualScriptPropertyGet::_update_cache() {
|
|||||||
}
|
}
|
||||||
} else if (call_mode == CALL_MODE_INSTANCE) {
|
} else if (call_mode == CALL_MODE_INSTANCE) {
|
||||||
type = base_type;
|
type = base_type;
|
||||||
if (base_script != String()) {
|
if (!base_script.is_empty()) {
|
||||||
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
||||||
ScriptServer::edit_request_func(base_script); //make sure it's loaded
|
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 = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
|
||||||
property.hint_string = 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) {
|
if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) {
|
||||||
ScriptServer::edit_request_func(base_script); //make sure it's loaded
|
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 = PROPERTY_HINT_ENUM;
|
||||||
property.hint_string = options;
|
property.hint_string = options;
|
||||||
property.type = Variant::STRING;
|
property.type = Variant::STRING;
|
||||||
if (options == "") {
|
if (options.is_empty()) {
|
||||||
property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
|
property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2113,7 +2113,7 @@ void VisualScriptPropertyGet::_bind_methods() {
|
|||||||
|
|
||||||
String script_ext_hint;
|
String script_ext_hint;
|
||||||
for (const String &E : script_extensions) {
|
for (const String &E : script_extensions) {
|
||||||
if (script_ext_hint != String()) {
|
if (!script_ext_hint.is_empty()) {
|
||||||
script_ext_hint += ",";
|
script_ext_hint += ",";
|
||||||
}
|
}
|
||||||
script_ext_hint += "." + E;
|
script_ext_hint += "." + E;
|
||||||
@@ -2324,7 +2324,7 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const {
|
|||||||
|
|
||||||
String ml;
|
String ml;
|
||||||
for (const StringName &E : sigs) {
|
for (const StringName &E : sigs) {
|
||||||
if (ml != String()) {
|
if (!ml.is_empty()) {
|
||||||
ml += ",";
|
ml += ",";
|
||||||
}
|
}
|
||||||
ml += E;
|
ml += E;
|
||||||
|
|||||||
@@ -1307,7 +1307,7 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const {
|
|||||||
|
|
||||||
String vhint;
|
String vhint;
|
||||||
for (const StringName &E : vars) {
|
for (const StringName &E : vars) {
|
||||||
if (vhint != String()) {
|
if (!vhint.is_empty()) {
|
||||||
vhint += ",";
|
vhint += ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1417,7 +1417,7 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const {
|
|||||||
|
|
||||||
String vhint;
|
String vhint;
|
||||||
for (const StringName &E : vars) {
|
for (const StringName &E : vars) {
|
||||||
if (vhint != String()) {
|
if (!vhint.is_empty()) {
|
||||||
vhint += ",";
|
vhint += ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,7 +1615,7 @@ PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const {
|
|||||||
pinfo.hint_string = preload->get_class();
|
pinfo.hint_string = preload->get_class();
|
||||||
if (preload->get_path().is_resource_file()) {
|
if (preload->get_path().is_resource_file()) {
|
||||||
pinfo.name = preload->get_path();
|
pinfo.name = preload->get_path();
|
||||||
} else if (preload->get_name() != String()) {
|
} else if (!preload->get_name().is_empty()) {
|
||||||
pinfo.name = preload->get_name();
|
pinfo.name = preload->get_name();
|
||||||
} else {
|
} else {
|
||||||
pinfo.name = preload->get_class();
|
pinfo.name = preload->get_class();
|
||||||
@@ -1994,7 +1994,7 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const
|
|||||||
|
|
||||||
property.hint_string = "";
|
property.hint_string = "";
|
||||||
for (const String &E : constants) {
|
for (const String &E : constants) {
|
||||||
if (property.hint_string != String()) {
|
if (!property.hint_string.is_empty()) {
|
||||||
property.hint_string += ",";
|
property.hint_string += ",";
|
||||||
}
|
}
|
||||||
property.hint_string += E;
|
property.hint_string += E;
|
||||||
@@ -2132,7 +2132,7 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) c
|
|||||||
}
|
}
|
||||||
property.hint_string = "";
|
property.hint_string = "";
|
||||||
for (const StringName &E : constants) {
|
for (const StringName &E : constants) {
|
||||||
if (property.hint_string != String()) {
|
if (!property.hint_string.is_empty()) {
|
||||||
property.hint_string += ",";
|
property.hint_string += ",";
|
||||||
}
|
}
|
||||||
property.hint_string += String(E);
|
property.hint_string += String(E);
|
||||||
@@ -2363,7 +2363,7 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con
|
|||||||
continue; //skip these, too simple named
|
continue; //skip these, too simple named
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cc != String()) {
|
if (!cc.is_empty()) {
|
||||||
cc += ",";
|
cc += ",";
|
||||||
}
|
}
|
||||||
cc += E.name;
|
cc += E.name;
|
||||||
@@ -3147,7 +3147,7 @@ String VisualScriptSubCall::get_caption() const {
|
|||||||
String VisualScriptSubCall::get_text() const {
|
String VisualScriptSubCall::get_text() const {
|
||||||
Ref<Script> script = get_script();
|
Ref<Script> script = get_script();
|
||||||
if (script.is_valid()) {
|
if (script.is_valid()) {
|
||||||
if (script->get_name() != String()) {
|
if (!script->get_name().is_empty()) {
|
||||||
return script->get_name();
|
return script->get_name();
|
||||||
}
|
}
|
||||||
if (script->get_path().is_resource_file()) {
|
if (script->get_path().is_resource_file()) {
|
||||||
@@ -3786,7 +3786,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const {
|
|||||||
al.sort();
|
al.sort();
|
||||||
|
|
||||||
for (int i = 0; i < al.size(); i++) {
|
for (int i = 0; i < al.size(); i++) {
|
||||||
if (actions != String()) {
|
if (!actions.is_empty()) {
|
||||||
actions += ",";
|
actions += ",";
|
||||||
}
|
}
|
||||||
actions += al[i];
|
actions += al[i];
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
|
|||||||
|
|
||||||
String ml;
|
String ml;
|
||||||
for (const String &E : mstring) {
|
for (const String &E : mstring) {
|
||||||
if (ml != String()) {
|
if (!ml.is_empty()) {
|
||||||
ml += ",";
|
ml += ",";
|
||||||
}
|
}
|
||||||
ml += E;
|
ml += E;
|
||||||
|
|||||||
Reference in New Issue
Block a user