summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/scene_main_loop.cpp18
-rw-r--r--scene/main/scene_main_loop.h7
-rw-r--r--scene/main/timer.cpp5
3 files changed, 29 insertions, 1 deletions
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index bcdc50c880..cbaa76e0ca 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -968,6 +968,18 @@ void SceneMainLoop::set_screen_stretch(StretchMode p_mode,StretchAspect p_aspect
}
+#ifdef TOOLS_ENABLED
+void SceneMainLoop::set_edited_scene_root(Node *p_node) {
+ edited_scene_root=p_node;
+}
+
+Node *SceneMainLoop::get_edited_scene_root() const {
+
+ return edited_scene_root;
+}
+#endif
+
+
void SceneMainLoop::_bind_methods() {
@@ -983,6 +995,10 @@ void SceneMainLoop::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_editor_hint","enable"),&SceneMainLoop::set_editor_hint);
ObjectTypeDB::bind_method(_MD("is_editor_hint"),&SceneMainLoop::is_editor_hint);
+#ifdef TOOLS_ENABLED
+ ObjectTypeDB::bind_method(_MD("set_edited_scene_root","scene"),&SceneMainLoop::set_edited_scene_root);
+ ObjectTypeDB::bind_method(_MD("get_edited_scene_root"),&SceneMainLoop::get_edited_scene_root);
+#endif
ObjectTypeDB::bind_method(_MD("set_pause","enable"),&SceneMainLoop::set_pause);
ObjectTypeDB::bind_method(_MD("is_paused"),&SceneMainLoop::is_paused);
@@ -1069,6 +1085,8 @@ SceneMainLoop::SceneMainLoop() {
root->set_physics_object_picking(GLOBAL_DEF("physics/enable_object_picking",true));
+ edited_scene_root=NULL;
+
ADD_SIGNAL( MethodInfo("idle_frame"));
ADD_SIGNAL( MethodInfo("fixed_frame"));
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index 493644d2bc..63a6468a73 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -102,6 +102,9 @@ private:
int64_t current_frame;
int node_count;
+#ifdef TOOLS_ENABLED
+ Node *edited_scene_root;
+#endif
struct UGCall {
StringName group;
@@ -223,6 +226,10 @@ public:
void set_screen_stretch(StretchMode p_mode,StretchAspect p_aspect,const Size2 p_minsize);
+#ifdef TOOLS_ENABLED
+ void set_edited_scene_root(Node *p_node);
+ Node *get_edited_scene_root() const;
+#endif
SceneMainLoop();
~SceneMainLoop();
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index 25d1c8530e..deef9d5876 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -36,8 +36,11 @@ void Timer::_notification(int p_what) {
case NOTIFICATION_READY: {
- if (autostart)
+ if (autostart) {
+ if (get_scene()->is_editor_hint() && get_scene()->get_edited_scene_root() && (get_scene()->get_edited_scene_root()==this || get_scene()->get_edited_scene_root()->is_a_parent_of(this)))
+ break;
start();
+ }
} break;
case NOTIFICATION_PROCESS: {