diff options
Diffstat (limited to 'scene/3d/interpolated_camera.cpp')
-rw-r--r-- | scene/3d/interpolated_camera.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 36a6660bf9..157ae42571 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -29,12 +29,14 @@ /*************************************************************************/ #include "interpolated_camera.h" +#include "engine.h" + void InterpolatedCamera::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - if (get_tree()->is_editor_hint() && enabled) + if (Engine::get_singleton()->is_editor_hint() && enabled) set_fixed_process(false); } break; @@ -44,7 +46,7 @@ void InterpolatedCamera::_notification(int p_what) { break; if (has_node(target)) { - Spatial *node = get_node(target)->cast_to<Spatial>(); + Spatial *node = Object::cast_to<Spatial>(get_node(target)); if (!node) break; @@ -54,8 +56,8 @@ void InterpolatedCamera::_notification(int p_what) { local_transform = local_transform.interpolate_with(target_xform, delta); set_global_transform(local_transform); - if (node->cast_to<Camera>()) { - Camera *cam = node->cast_to<Camera>(); + if (Camera *cam = Object::cast_to<Camera>(node)) { + if (cam->get_projection() == get_projection()) { float new_near = Math::lerp(get_znear(), cam->get_znear(), delta); @@ -81,7 +83,7 @@ void InterpolatedCamera::_notification(int p_what) { void InterpolatedCamera::_set_target(const Object *p_target) { ERR_FAIL_NULL(p_target); - set_target(p_target->cast_to<Spatial>()); + set_target(Object::cast_to<Spatial>(p_target)); } void InterpolatedCamera::set_target(const Spatial *p_target) { @@ -106,7 +108,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) { return; enabled = p_enable; if (p_enable) { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; set_process(true); } else |