summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJakub Grzesik <kubecz3k@gmail.com>2018-03-16 19:10:26 +0100
committerJakub Grzesik <kubecz3k@gmail.com>2018-03-17 10:57:04 +0100
commitf78c7353ea43af668b53adb0a4b8ceb871673398 (patch)
tree325c461b0e87778fe789fd0c68d7a0117f134c90 /scene
parente06a56eac8c1fbf36e985697d3b6b1a66ec8ac0e (diff)
a way to ensure that camera is disabled
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/camera.cpp9
-rw-r--r--scene/3d/camera.h2
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;