Merge pull request #113282 from dsnopek/required-ptr-get-out-there

Use `RequiredParam`/`RequiredResult` in some high value places
This commit is contained in:
Thaddeus Crews
2025-12-02 20:42:53 -06:00
79 changed files with 372 additions and 321 deletions

View File

@@ -235,7 +235,7 @@ Vector2 GodotPhysicsDirectBodyState2D::get_contact_impulse(int p_contact_idx) co
return body->contacts[p_contact_idx].impulse;
}
PhysicsDirectSpaceState2D *GodotPhysicsDirectBodyState2D::get_space_state() {
RequiredResult<PhysicsDirectSpaceState2D> GodotPhysicsDirectBodyState2D::get_space_state() {
return body->get_space()->get_direct_state();
}

View File

@@ -101,7 +101,7 @@ public:
virtual Vector2 get_contact_collider_velocity_at_position(int p_contact_idx) const override;
virtual Vector2 get_contact_impulse(int p_contact_idx) const override;
virtual PhysicsDirectSpaceState2D *get_space_state() override;
virtual RequiredResult<PhysicsDirectSpaceState2D> get_space_state() override;
virtual real_t get_step() const override;
};

View File

@@ -244,7 +244,7 @@ Vector3 GodotPhysicsDirectBodyState3D::get_contact_collider_velocity_at_position
return body->contacts[p_contact_idx].collider_velocity_at_pos;
}
PhysicsDirectSpaceState3D *GodotPhysicsDirectBodyState3D::get_space_state() {
RequiredResult<PhysicsDirectSpaceState3D> GodotPhysicsDirectBodyState3D::get_space_state() {
return body->get_space()->get_direct_state();
}

View File

@@ -104,7 +104,7 @@ public:
virtual int get_contact_collider_shape(int p_contact_idx) const override;
virtual Vector3 get_contact_collider_velocity_at_position(int p_contact_idx) const override;
virtual PhysicsDirectSpaceState3D *get_space_state() override;
virtual RequiredResult<PhysicsDirectSpaceState3D> get_space_state() override;
virtual real_t get_step() const override;
};

View File

@@ -976,9 +976,10 @@ RID GodotPhysicsServer3D::soft_body_create() {
return rid;
}
void GodotPhysicsServer3D::soft_body_update_rendering_server(RID p_body, PhysicsServer3DRenderingServerHandler *p_rendering_server_handler) {
void GodotPhysicsServer3D::soft_body_update_rendering_server(RID p_body, RequiredParam<PhysicsServer3DRenderingServerHandler> rp_rendering_server_handler) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
ERR_FAIL_NULL(soft_body);
EXTRACT_PARAM_OR_FAIL(p_rendering_server_handler, rp_rendering_server_handler);
soft_body->update_rendering_server(p_rendering_server_handler);
}

View File

@@ -263,7 +263,7 @@ public:
virtual RID soft_body_create() override;
virtual void soft_body_update_rendering_server(RID p_body, PhysicsServer3DRenderingServerHandler *p_rendering_server_handler) override;
virtual void soft_body_update_rendering_server(RID p_body, RequiredParam<PhysicsServer3DRenderingServerHandler> p_rendering_server_handler) override;
virtual void soft_body_set_space(RID p_body, RID p_space) override;
virtual RID soft_body_get_space(RID p_body) const override;

View File

@@ -985,9 +985,10 @@ RID JoltPhysicsServer3D::soft_body_create() {
return rid;
}
void JoltPhysicsServer3D::soft_body_update_rendering_server(RID p_body, PhysicsServer3DRenderingServerHandler *p_rendering_server_handler) {
void JoltPhysicsServer3D::soft_body_update_rendering_server(RID p_body, RequiredParam<PhysicsServer3DRenderingServerHandler> rp_rendering_server_handler) {
JoltSoftBody3D *body = soft_body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
EXTRACT_PARAM_OR_FAIL(p_rendering_server_handler, rp_rendering_server_handler);
return body->update_rendering_server(p_rendering_server_handler);
}

View File

@@ -300,7 +300,7 @@ public:
virtual RID soft_body_create() override;
virtual void soft_body_update_rendering_server(RID p_body, PhysicsServer3DRenderingServerHandler *p_rendering_server_handler) override;
virtual void soft_body_update_rendering_server(RID p_body, RequiredParam<PhysicsServer3DRenderingServerHandler> p_rendering_server_handler) override;
virtual void soft_body_set_space(RID p_body, RID p_space) override;
virtual RID soft_body_get_space(RID p_body) const override;

View File

@@ -256,6 +256,6 @@ void JoltPhysicsDirectBodyState3D::integrate_forces() {
set_angular_velocity(angular_velocity);
}
PhysicsDirectSpaceState3D *JoltPhysicsDirectBodyState3D::get_space_state() {
RequiredResult<PhysicsDirectSpaceState3D> JoltPhysicsDirectBodyState3D::get_space_state() {
return body->get_space()->get_direct_state();
}

View File

@@ -115,5 +115,5 @@ public:
virtual void integrate_forces() override;
virtual PhysicsDirectSpaceState3D *get_space_state() override;
virtual RequiredResult<PhysicsDirectSpaceState3D> get_space_state() override;
};