mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
This commit is contained in:
parent
0f95e9f8e6
commit
a1846b27ea
177 changed files with 517 additions and 519 deletions
|
@ -147,7 +147,7 @@ void BoneMapperItem::_notification(int p_what) {
|
|||
bone_map->connect("bone_map_updated", callable_mp(this, &BoneMapperItem::_update_property));
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
if (!bone_map.is_null() && bone_map->is_connected("bone_map_updated", callable_mp(this, &BoneMapperItem::_update_property))) {
|
||||
if (bone_map.is_valid() && bone_map->is_connected("bone_map_updated", callable_mp(this, &BoneMapperItem::_update_property))) {
|
||||
bone_map->disconnect("bone_map_updated", callable_mp(this, &BoneMapperItem::_update_property));
|
||||
}
|
||||
} break;
|
||||
|
@ -327,7 +327,7 @@ void BoneMapper::create_editor() {
|
|||
}
|
||||
|
||||
void BoneMapper::update_group_idx() {
|
||||
if (!bone_map->get_profile().is_valid()) {
|
||||
if (bone_map->get_profile().is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ void BoneMapper::recreate_editor() {
|
|||
profile_texture->set_texture(Ref<Texture2D>());
|
||||
}
|
||||
|
||||
if (!profile.is_valid()) {
|
||||
if (profile.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ void BoneMapper::_clear_mapping_current_group() {
|
|||
#ifdef MODULE_REGEX_ENABLED
|
||||
bool BoneMapper::is_match_with_bone_name(const String &p_bone_name, const String &p_word) {
|
||||
RegEx re = RegEx(p_word);
|
||||
return !re.search(p_bone_name.to_lower()).is_null();
|
||||
return re.search(p_bone_name.to_lower()).is_valid();
|
||||
}
|
||||
|
||||
int BoneMapper::search_bone_by_name(Skeleton3D *p_skeleton, const Vector<String> &p_picklist, BoneSegregation p_segregation, int p_parent, int p_child, int p_children_count) {
|
||||
|
@ -628,11 +628,11 @@ BoneMapper::BoneSegregation BoneMapper::guess_bone_segregation(const String &p_b
|
|||
|
||||
for (uint32_t i = 0; i < left_words.size(); i++) {
|
||||
RegEx re_l = RegEx(left_words[i]);
|
||||
if (!re_l.search(fixed_bn).is_null()) {
|
||||
if (re_l.search(fixed_bn).is_valid()) {
|
||||
return BONE_SEGREGATION_LEFT;
|
||||
}
|
||||
RegEx re_r = RegEx(right_words[i]);
|
||||
if (!re_r.search(fixed_bn).is_null()) {
|
||||
if (re_r.search(fixed_bn).is_valid()) {
|
||||
return BONE_SEGREGATION_RIGHT;
|
||||
}
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
|
|||
bool found = false;
|
||||
for (int i = 0; i < search_path.size(); i++) {
|
||||
RegEx re = RegEx("root");
|
||||
if (!re.search(skeleton->get_bone_name(search_path[i]).to_lower()).is_null()) {
|
||||
if (re.search(skeleton->get_bone_name(search_path[i]).to_lower()).is_valid()) {
|
||||
bone_idx = search_path[i]; // Name match is preferred.
|
||||
found = true;
|
||||
break;
|
||||
|
@ -948,7 +948,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
|
|||
Vector<String> finger_names;
|
||||
for (int i = 0; i < search_path.size(); i++) {
|
||||
String bn = skeleton->get_bone_name(search_path[i]);
|
||||
if (!finger_re.search(bn.to_lower()).is_null()) {
|
||||
if (finger_re.search(bn.to_lower()).is_valid()) {
|
||||
finger_names.push_back(bn);
|
||||
}
|
||||
}
|
||||
|
@ -1077,7 +1077,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
|
|||
Vector<String> finger_names;
|
||||
for (int i = 0; i < search_path.size(); i++) {
|
||||
String bn = skeleton->get_bone_name(search_path[i]);
|
||||
if (!finger_re.search(bn.to_lower()).is_null()) {
|
||||
if (finger_re.search(bn.to_lower()).is_valid()) {
|
||||
finger_names.push_back(bn);
|
||||
}
|
||||
}
|
||||
|
@ -1392,7 +1392,7 @@ void BoneMapper::_notification(int p_what) {
|
|||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
clear_items();
|
||||
if (!bone_map.is_null()) {
|
||||
if (bone_map.is_valid()) {
|
||||
if (bone_map->is_connected("bone_map_updated", callable_mp(this, &BoneMapper::_update_state))) {
|
||||
bone_map->disconnect("bone_map_updated", callable_mp(this, &BoneMapper::_update_state));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue