Skip to content

Commit

Permalink
Add notification for when camera resizes
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverHerb committed Sep 22, 2024
1 parent 28b42b0 commit c84423e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions scene/3d/camera_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ void Camera3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_cull_mask_value", "layer_number", "value"), &Camera3D::set_cull_mask_value);
ClassDB::bind_method(D_METHOD("get_cull_mask_value", "layer_number"), &Camera3D::get_cull_mask_value);

BIND_CONSTANT(NOTIFICATION_SIZE_CHANGED);

//ClassDB::bind_method(D_METHOD("_camera_make_current"),&Camera::_camera_make_current );

ADD_PROPERTY(PropertyInfo(Variant::INT, "keep_aspect", PROPERTY_HINT_ENUM, "Keep Width,Keep Height"), "set_keep_aspect_mode", "get_keep_aspect_mode");
Expand Down Expand Up @@ -756,6 +758,7 @@ void Camera3D::set_size(real_t p_size) {
ERR_FAIL_COND(p_size <= CMP_EPSILON);
size = p_size;
_update_camera_mode();
notification(NOTIFICATION_SIZE_CHANGED);
}

void Camera3D::set_near(real_t p_near) {
Expand Down
3 changes: 2 additions & 1 deletion scene/3d/camera_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class Camera3D : public Node3D {
public:
enum {
NOTIFICATION_BECAME_CURRENT = 50,
NOTIFICATION_LOST_CURRENT = 51
NOTIFICATION_LOST_CURRENT = 51,
NOTIFICATION_SIZE_CHANGED = 52
};

void set_perspective(real_t p_fovy_degrees, real_t p_z_near, real_t p_z_far);
Expand Down

0 comments on commit c84423e

Please sign in to comment.