diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-01-28 15:06:54 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-01-28 15:07:22 +0100 |
commit | 7072b359b40f57e178e87b386acef5a6928e61fe (patch) | |
tree | 12dd2c6b157108cdc0689d814b3478d05e0a4487 /scene/2d/shape_cast_2d.cpp | |
parent | 38c6611b91f5ee7ded0c2c1d279ab7dcdc4f2f1c (diff) |
Improve some method bindings to use specific `Object` subtypes
This was made possible by changes to `VariantCaster` which now make
it possible to pass any `Object`-derived type as pointer.
Diffstat (limited to 'scene/2d/shape_cast_2d.cpp')
-rw-r--r-- | scene/2d/shape_cast_2d.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/scene/2d/shape_cast_2d.cpp b/scene/2d/shape_cast_2d.cpp index 10194861b4..24199c96b5 100644 --- a/scene/2d/shape_cast_2d.cpp +++ b/scene/2d/shape_cast_2d.cpp @@ -322,26 +322,18 @@ void ShapeCast2D::add_exception_rid(const RID &p_rid) { exclude.insert(p_rid); } -void ShapeCast2D::add_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object); - if (!co) { - return; - } - add_exception_rid(co->get_rid()); +void ShapeCast2D::add_exception(const CollisionObject2D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject2D."); + add_exception_rid(p_node->get_rid()); } void ShapeCast2D::remove_exception_rid(const RID &p_rid) { exclude.erase(p_rid); } -void ShapeCast2D::remove_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object); - if (!co) { - return; - } - remove_exception_rid(co->get_rid()); +void ShapeCast2D::remove_exception(const CollisionObject2D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject2D."); + remove_exception_rid(p_node->get_rid()); } void ShapeCast2D::clear_exceptions() { |