Fix missing clear for some `set_exclude*` query parameter methods

This commit is contained in:
A Thousand Ships 2023-09-21 13:30:57 +02:00
parent 59139df16e
commit 95eafcba4c
2 changed files with 4 additions and 0 deletions

View File

@ -476,6 +476,7 @@ TypedArray<RID> PhysicsTestMotionParameters2D::get_exclude_bodies() const {
} }
void PhysicsTestMotionParameters2D::set_exclude_bodies(const TypedArray<RID> &p_exclude) { void PhysicsTestMotionParameters2D::set_exclude_bodies(const TypedArray<RID> &p_exclude) {
parameters.exclude_bodies.clear();
for (int i = 0; i < p_exclude.size(); i++) { for (int i = 0; i < p_exclude.size(); i++) {
parameters.exclude_bodies.insert(p_exclude[i]); parameters.exclude_bodies.insert(p_exclude[i]);
} }
@ -494,6 +495,7 @@ TypedArray<uint64_t> PhysicsTestMotionParameters2D::get_exclude_objects() const
} }
void PhysicsTestMotionParameters2D::set_exclude_objects(const TypedArray<uint64_t> &p_exclude) { void PhysicsTestMotionParameters2D::set_exclude_objects(const TypedArray<uint64_t> &p_exclude) {
parameters.exclude_objects.clear();
for (int i = 0; i < p_exclude.size(); ++i) { for (int i = 0; i < p_exclude.size(); ++i) {
ObjectID object_id = p_exclude[i]; ObjectID object_id = p_exclude[i];
ERR_CONTINUE(object_id.is_null()); ERR_CONTINUE(object_id.is_null());

View File

@ -501,6 +501,7 @@ TypedArray<RID> PhysicsTestMotionParameters3D::get_exclude_bodies() const {
} }
void PhysicsTestMotionParameters3D::set_exclude_bodies(const TypedArray<RID> &p_exclude) { void PhysicsTestMotionParameters3D::set_exclude_bodies(const TypedArray<RID> &p_exclude) {
parameters.exclude_bodies.clear();
for (int i = 0; i < p_exclude.size(); i++) { for (int i = 0; i < p_exclude.size(); i++) {
parameters.exclude_bodies.insert(p_exclude[i]); parameters.exclude_bodies.insert(p_exclude[i]);
} }
@ -519,6 +520,7 @@ TypedArray<uint64_t> PhysicsTestMotionParameters3D::get_exclude_objects() const
} }
void PhysicsTestMotionParameters3D::set_exclude_objects(const TypedArray<uint64_t> &p_exclude) { void PhysicsTestMotionParameters3D::set_exclude_objects(const TypedArray<uint64_t> &p_exclude) {
parameters.exclude_objects.clear();
for (int i = 0; i < p_exclude.size(); ++i) { for (int i = 0; i < p_exclude.size(); ++i) {
ObjectID object_id = p_exclude[i]; ObjectID object_id = p_exclude[i];
ERR_CONTINUE(object_id.is_null()); ERR_CONTINUE(object_id.is_null());