diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-03-23 11:08:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-23 11:08:44 +0100 |
commit | 8cfca7726ffa6b4093d3036f7a16be26efc4ad29 (patch) | |
tree | 66989b523374f0c63981553378107175113e3557 /scene | |
parent | 74382dbfbb15c19bd1302e7eb6e0f8943ad43b14 (diff) | |
parent | f78c7353ea43af668b53adb0a4b8ceb871673398 (diff) |
Merge pull request #17571 from kubecz3k/cam-disable
a way to ensure that camera is disabled
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/camera.cpp | 9 | ||||
-rw-r--r-- | scene/3d/camera.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 6998b34cfd..9de189c158 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -201,7 +201,7 @@ void Camera::make_current() { //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,camera_group,"_camera_make_current",this); } -void Camera::clear_current() { +void Camera::clear_current(bool p_enable_next) { current = false; if (!is_inside_tree()) @@ -209,7 +209,10 @@ void Camera::clear_current() { if (get_viewport()->get_camera() == this) { get_viewport()->_camera_set(NULL); - get_viewport()->_camera_make_next_current(this); + + if (p_enable_next) { + get_viewport()->_camera_make_next_current(this); + } } } @@ -439,7 +442,7 @@ void Camera::_bind_methods() { ClassDB::bind_method(D_METHOD("set_perspective", "fov", "z_near", "z_far"), &Camera::set_perspective); ClassDB::bind_method(D_METHOD("set_orthogonal", "size", "z_near", "z_far"), &Camera::set_orthogonal); ClassDB::bind_method(D_METHOD("make_current"), &Camera::make_current); - ClassDB::bind_method(D_METHOD("clear_current"), &Camera::clear_current); + ClassDB::bind_method(D_METHOD("clear_current", "enable_next"), &Camera::clear_current, DEFVAL(true)); ClassDB::bind_method(D_METHOD("set_current"), &Camera::set_current); ClassDB::bind_method(D_METHOD("is_current"), &Camera::is_current); ClassDB::bind_method(D_METHOD("get_camera_transform"), &Camera::get_camera_transform); diff --git a/scene/3d/camera.h b/scene/3d/camera.h index e2679870de..109bf3adc6 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -113,7 +113,7 @@ public: void set_projection(Camera::Projection p_mode); void make_current(); - void clear_current(); + void clear_current(bool p_enable_next = true); void set_current(bool p_current); bool is_current() const; |