mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +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
|
@ -284,10 +284,10 @@ struct GDScriptUtilityFunctionsDefinitions {
|
|||
VALIDATE_ARG_CUSTOM(0, Variant::DICTIONARY, !d.has("@path"), RTR("Invalid instance dictionary format (missing @path)."));
|
||||
|
||||
Ref<Script> scr = ResourceLoader::load(d["@path"]);
|
||||
VALIDATE_ARG_CUSTOM(0, Variant::DICTIONARY, !scr.is_valid(), RTR("Invalid instance dictionary format (can't load script at @path)."));
|
||||
VALIDATE_ARG_CUSTOM(0, Variant::DICTIONARY, scr.is_null(), RTR("Invalid instance dictionary format (can't load script at @path)."));
|
||||
|
||||
Ref<GDScript> gdscr = scr;
|
||||
VALIDATE_ARG_CUSTOM(0, Variant::DICTIONARY, !gdscr.is_valid(), RTR("Invalid instance dictionary format (invalid script at @path)."));
|
||||
VALIDATE_ARG_CUSTOM(0, Variant::DICTIONARY, gdscr.is_null(), RTR("Invalid instance dictionary format (invalid script at @path)."));
|
||||
|
||||
NodePath sub;
|
||||
if (d.has("@subpath")) {
|
||||
|
@ -296,7 +296,7 @@ struct GDScriptUtilityFunctionsDefinitions {
|
|||
|
||||
for (int i = 0; i < sub.get_name_count(); i++) {
|
||||
gdscr = gdscr->subclasses[sub.get_name(i)];
|
||||
VALIDATE_ARG_CUSTOM(0, Variant::DICTIONARY, !gdscr.is_valid(), RTR("Invalid instance dictionary (invalid subclasses)."));
|
||||
VALIDATE_ARG_CUSTOM(0, Variant::DICTIONARY, gdscr.is_null(), RTR("Invalid instance dictionary (invalid subclasses)."));
|
||||
}
|
||||
|
||||
*r_ret = gdscr->_new(nullptr, -1 /* skip initializer */, r_error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue