Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Add error messages for collision exception functions #73851

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions scene/2d/ray_cast_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ void RayCast2D::add_exception_rid(const RID &p_rid) {
void RayCast2D::add_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
add_exception_rid(co->get_rid());
}

Expand All @@ -269,9 +267,7 @@ void RayCast2D::remove_exception_rid(const RID &p_rid) {
void RayCast2D::remove_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
remove_exception_rid(co->get_rid());
}

Expand Down
8 changes: 2 additions & 6 deletions scene/2d/shape_cast_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@ void ShapeCast2D::add_exception_rid(const RID &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;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
add_exception_rid(co->get_rid());
}

Expand All @@ -336,9 +334,7 @@ void ShapeCast2D::remove_exception_rid(const RID &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;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
remove_exception_rid(co->get_rid());
}

Expand Down
8 changes: 2 additions & 6 deletions scene/3d/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,7 @@ void ClippedCamera::add_exception_rid(const RID &p_rid) {
void ClippedCamera::add_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
add_exception_rid(co->get_rid());
}

Expand All @@ -810,9 +808,7 @@ void ClippedCamera::remove_exception_rid(const RID &p_rid) {
void ClippedCamera::remove_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
remove_exception_rid(co->get_rid());
}

Expand Down
8 changes: 2 additions & 6 deletions scene/3d/ray_cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ void RayCast::add_exception_rid(const RID &p_rid) {
void RayCast::add_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
add_exception_rid(co->get_rid());
}

Expand All @@ -248,9 +246,7 @@ void RayCast::remove_exception_rid(const RID &p_rid) {
void RayCast::remove_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
remove_exception_rid(co->get_rid());
}

Expand Down
8 changes: 2 additions & 6 deletions scene/3d/shape_cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,7 @@ void ShapeCast::add_exception_rid(const RID &p_rid) {
void ShapeCast::add_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
add_exception_rid(co->get_rid());
}

Expand All @@ -440,9 +438,7 @@ void ShapeCast::remove_exception_rid(const RID &p_rid) {
void ShapeCast::remove_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co) {
return;
}
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
remove_exception_rid(co->get_rid());
}

Expand Down