diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-08-20 12:55:46 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-20 12:55:46 -0300 |
commit | 541fdffc0ab2115238fe9cedbf1c088b15f11fdf (patch) | |
tree | 187c5d0278e5075907fef8a86b4d00d6a0b7161a /scene/3d | |
parent | 831e21e89ba0275b43b6a351e538256b8ce715a3 (diff) | |
parent | 90b8a5b71ef79e0339826507c4b290f0c51b7cd2 (diff) |
Merge pull request #10319 from neikeq/pr-engine-editor-hint
Adds Engine::is_editor_hint() method
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/interpolated_camera.cpp | 6 | ||||
-rw-r--r-- | scene/3d/light.cpp | 3 | ||||
-rw-r--r-- | scene/3d/path.cpp | 6 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 6 | ||||
-rw-r--r-- | scene/3d/ray_cast.cpp | 8 | ||||
-rw-r--r-- | scene/3d/spatial.cpp | 7 | ||||
-rw-r--r-- | scene/3d/visibility_notifier.cpp | 6 |
8 files changed, 27 insertions, 17 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 6abc2caac8..e86a07c60f 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -215,7 +215,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { velocity_tracker->reset(get_global_transform().origin); AudioServer::get_singleton()->add_callback(_mix_audios, this); - if (autoplay && !get_tree()->is_editor_hint()) { + if (autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); } } diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 36a6660bf9..a481018890 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -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; @@ -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 diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 1304954cf3..b4a62138fb 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "light.h" +#include "engine.h" #include "project_settings.h" #include "scene/resources/surface_tool.h" @@ -150,7 +151,7 @@ void Light::_update_visibility() { #ifdef TOOLS_ENABLED if (editor_only) { - if (!get_tree()->is_editor_hint()) { + if (!Engine::get_singleton()->is_editor_hint()) { editor_ok = false; } else { editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root())); diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index f8df21004e..c40f73541e 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -28,11 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "path.h" + +#include "engine.h" #include "scene/scene_string_names.h" void Path::_notification(int p_what) { #if 0 - if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) { + if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && Engine::get_singleton()->is_editor_hint()) { //draw the curve!! for(int i=0;i<curve->get_point_count();i++) { @@ -53,7 +55,7 @@ void Path::_notification(int p_what) { void Path::_curve_changed() { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) update_gizmo(); } diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index dc8f72d77e..e1371e9ed6 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "physics_body.h" + +#include "engine.h" #include "method_bind_ext.gen.inc" #include "scene/scene_string_names.h" @@ -476,13 +478,13 @@ void RigidBody::_notification(int p_what) { #ifdef TOOLS_ENABLED if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { set_notify_local_transform(true); //used for warnings and only in editor } } if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { update_configuration_warning(); } } diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 67e7fb0e12..b0aab6cc4d 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -30,12 +30,14 @@ #include "ray_cast.h" #include "collision_object.h" +#include "engine.h" #include "mesh_instance.h" #include "servers/physics_server.h" + void RayCast::set_cast_to(const Vector3 &p_point) { cast_to = p_point; - if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) update_gizmo(); if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) _update_debug_shape(); @@ -94,7 +96,7 @@ Vector3 RayCast::get_collision_normal() const { void RayCast::set_enabled(bool p_enabled) { enabled = p_enabled; - if (is_inside_tree() && !get_tree()->is_editor_hint()) + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) set_fixed_process(p_enabled); if (!p_enabled) collided = false; @@ -118,7 +120,7 @@ void RayCast::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - if (enabled && !get_tree()->is_editor_hint()) { + if (enabled && !Engine::get_singleton()->is_editor_hint()) { set_fixed_process(true); if (get_tree()->is_debugging_collisions_hint()) diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 848b08eb8f..6498238e12 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "spatial.h" +#include "engine.h" #include "message_queue.h" #include "scene/main/viewport.h" #include "scene/scene_string_names.h" @@ -134,7 +135,7 @@ void Spatial::_notification(int p_what) { else data.C = NULL; - if (data.toplevel && !get_tree()->is_editor_hint()) { + if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) { if (data.parent) { data.local_transform = data.parent->get_global_transform() * get_transform(); @@ -178,7 +179,7 @@ void Spatial::_notification(int p_what) { get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0); } #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this); @@ -492,7 +493,7 @@ void Spatial::set_as_toplevel(bool p_enabled) { if (data.toplevel == p_enabled) return; - if (is_inside_tree() && !get_tree()->is_editor_hint()) { + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) { if (p_enabled) set_transform(get_global_transform()); diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index cc81a4cb56..2fea451fe7 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -29,11 +29,11 @@ /*************************************************************************/ #include "visibility_notifier.h" +#include "engine.h" #include "scene/3d/camera.h" #include "scene/3d/physics_body.h" #include "scene/animation/animation_player.h" #include "scene/scene_string_names.h" -#include "scene/scene_string_names.h" void VisibilityNotifier::_enter_camera(Camera *p_camera) { @@ -187,7 +187,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; Node *from = this; @@ -200,7 +200,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) { |