mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Cleanup of raw nullptr checks with Ref
Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
This commit is contained in:
@@ -132,7 +132,7 @@ void SpriteBase3D::draw_texture_rect(Ref<Texture2D> p_texture, Rect2 p_dst_rect,
|
||||
|
||||
// Properly setup UVs for impostor textures (AtlasTexture).
|
||||
Ref<AtlasTexture> atlas_tex = p_texture;
|
||||
if (atlas_tex != nullptr) {
|
||||
if (atlas_tex.is_valid()) {
|
||||
src_tsize[0] = atlas_tex->get_atlas()->get_width();
|
||||
src_tsize[1] = atlas_tex->get_atlas()->get_height();
|
||||
}
|
||||
@@ -1324,7 +1324,7 @@ void AnimatedSprite3D::play(const StringName &p_name, float p_custom_scale, bool
|
||||
name = animation;
|
||||
}
|
||||
|
||||
ERR_FAIL_NULL_MSG(frames, vformat("There is no animation with name '%s'.", name));
|
||||
ERR_FAIL_COND_MSG(frames.is_null(), vformat("There is no animation with name '%s'.", name));
|
||||
ERR_FAIL_COND_MSG(!frames->get_animation_names().has(name), vformat("There is no animation with name '%s'.", name));
|
||||
|
||||
if (frames->get_frame_count(name) == 0) {
|
||||
@@ -1402,7 +1402,7 @@ void AnimatedSprite3D::set_animation(const StringName &p_name) {
|
||||
|
||||
emit_signal(SceneStringName(animation_changed));
|
||||
|
||||
if (frames == nullptr) {
|
||||
if (frames.is_null()) {
|
||||
animation = StringName();
|
||||
stop();
|
||||
ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
|
||||
|
||||
Reference in New Issue
Block a user