Remove joint freeing logic from physics servers
Since joint resources are created by joint nodes and also they take care of freeing them, the physics server doesn't need to free bodies' joints explicitly. The logic for clearing the constraints map/set is still relevant as there may be collision pairs and in their case its the server itself the one creating them and therefore releasing them.
This commit is contained in:
parent
d8584682f0
commit
fbeb27b01d
2 changed files with 0 additions and 28 deletions
|
@ -233,14 +233,7 @@ void PhysicsServerSW::area_set_space(RID p_area, RID p_space) {
|
|||
if (area->get_space() == space)
|
||||
return; //pointless
|
||||
|
||||
for (Set<ConstraintSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) {
|
||||
RID self = E->get()->get_self();
|
||||
if (!self.is_valid())
|
||||
continue;
|
||||
free(self);
|
||||
}
|
||||
area->clear_constraints();
|
||||
|
||||
area->set_space(space);
|
||||
};
|
||||
|
||||
|
@ -494,14 +487,7 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {
|
|||
if (body->get_space() == space)
|
||||
return; //pointless
|
||||
|
||||
for (Map<ConstraintSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) {
|
||||
RID self = E->key()->get_self();
|
||||
if (!self.is_valid())
|
||||
continue;
|
||||
free(self);
|
||||
}
|
||||
body->clear_constraint_map();
|
||||
|
||||
body->set_space(space);
|
||||
};
|
||||
|
||||
|
|
|
@ -296,14 +296,7 @@ void Physics2DServerSW::area_set_space(RID p_area, RID p_space) {
|
|||
if (area->get_space() == space)
|
||||
return; //pointless
|
||||
|
||||
for (Set<Constraint2DSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) {
|
||||
RID self = E->get()->get_self();
|
||||
if (!self.is_valid())
|
||||
continue;
|
||||
free(self);
|
||||
}
|
||||
area->clear_constraints();
|
||||
|
||||
area->set_space(space);
|
||||
};
|
||||
|
||||
|
@ -548,14 +541,7 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
|
|||
if (body->get_space() == space)
|
||||
return; //pointless
|
||||
|
||||
for (Map<Constraint2DSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) {
|
||||
RID self = E->key()->get_self();
|
||||
if (!self.is_valid())
|
||||
continue;
|
||||
free(self);
|
||||
}
|
||||
body->clear_constraint_map();
|
||||
|
||||
body->set_space(space);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue