summaryrefslogtreecommitdiff
path: root/scene/main/scene_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/scene_tree.cpp')
-rw-r--r--scene/main/scene_tree.cpp62
1 files changed, 37 insertions, 25 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index fefe4c9f0d..8bca76a794 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -82,12 +82,19 @@ bool SceneTreeTimer::is_process_always() {
return process_always;
}
+void SceneTreeTimer::set_ignore_time_scale(bool p_ignore) {
+ ignore_time_scale = p_ignore;
+}
+
+bool SceneTreeTimer::is_ignore_time_scale() {
+ return ignore_time_scale;
+}
+
void SceneTreeTimer::release_connections() {
List<Connection> connections;
get_all_signal_connections(&connections);
- for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
- Connection const &connection = E->get();
+ for (Connection &connection : connections) {
disconnect(connection.signal.get_name(), connection.callable);
}
}
@@ -169,8 +176,8 @@ void SceneTree::_flush_ugc() {
v[i] = E->get()[i];
}
- static_assert(VARIANT_ARG_MAX == 5, "This code needs to be updated if VARIANT_ARG_MAX != 5");
- call_group_flags(GROUP_CALL_REALTIME, E->key().group, E->key().call, v[0], v[1], v[2], v[3], v[4]);
+ static_assert(VARIANT_ARG_MAX == 8, "This code needs to be updated if VARIANT_ARG_MAX != 8");
+ call_group_flags(GROUP_CALL_REALTIME, E->key().group, E->key().call, v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
unique_group_calls.erase(E);
}
@@ -406,11 +413,11 @@ bool SceneTree::physics_process(float p_time) {
MainLoop::physics_process(p_time);
physics_process_time = p_time;
- emit_signal("physics_frame");
+ emit_signal(SNAME("physics_frame"));
- _notify_group_pause("physics_process_internal", Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
- call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_process_picking");
- _notify_group_pause("physics_process", Node::NOTIFICATION_PHYSICS_PROCESS);
+ _notify_group_pause(SNAME("physics_process_internal"), Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
+ call_group_flags(GROUP_CALL_REALTIME, SNAME("_picking_viewports"), SNAME("_process_picking"));
+ _notify_group_pause(SNAME("physics_process"), Node::NOTIFICATION_PHYSICS_PROCESS);
_flush_ugc();
MessageQueue::get_singleton()->flush(); //small little hack
@@ -436,14 +443,14 @@ bool SceneTree::process(float p_time) {
multiplayer->poll();
}
- emit_signal("process_frame");
+ emit_signal(SNAME("process_frame"));
MessageQueue::get_singleton()->flush(); //small little hack
flush_transform_notifications();
- _notify_group_pause("process_internal", Node::NOTIFICATION_INTERNAL_PROCESS);
- _notify_group_pause("process", Node::NOTIFICATION_PROCESS);
+ _notify_group_pause(SNAME("process_internal"), Node::NOTIFICATION_INTERNAL_PROCESS);
+ _notify_group_pause(SNAME("process"), Node::NOTIFICATION_PROCESS);
_flush_ugc();
MessageQueue::get_singleton()->flush(); //small little hack
@@ -466,12 +473,17 @@ bool SceneTree::process(float p_time) {
E = N;
continue;
}
+
float time_left = E->get()->get_time_left();
- time_left -= p_time;
+ if (E->get()->is_ignore_time_scale()) {
+ time_left -= Engine::get_singleton()->get_process_step();
+ } else {
+ time_left -= p_time;
+ }
E->get()->set_time_left(time_left);
if (time_left < 0) {
- E->get()->emit_signal("timeout");
+ E->get()->emit_signal(SNAME("timeout"));
timers.erase(E);
}
if (E == L) {
@@ -490,7 +502,7 @@ bool SceneTree::process(float p_time) {
if (Engine::get_singleton()->is_editor_hint()) {
//simple hack to reload fallback environment if it changed from editor
- String env_path = ProjectSettings::get_singleton()->get("rendering/environment/defaults/default_environment");
+ String env_path = ProjectSettings::get_singleton()->get(SNAME("rendering/environment/defaults/default_environment"));
env_path = env_path.strip_edges(); //user may have added a space or two
String cpath;
Ref<Environment> fallback = get_root()->get_world_3d()->get_fallback_environment();
@@ -559,8 +571,8 @@ void SceneTree::finalize() {
}
// cleanup timers
- for (List<Ref<SceneTreeTimer>>::Element *E = timers.front(); E; E = E->next()) {
- E->get()->release_connections();
+ for (Ref<SceneTreeTimer> E : timers) {
+ E->release_connections();
}
timers.clear();
}
@@ -927,8 +939,8 @@ Variant SceneTree::_call_group_flags(const Variant **p_args, int p_argcount, Cal
v[i] = *p_args[i + 3];
}
- static_assert(VARIANT_ARG_MAX == 5, "This code needs to be updated if VARIANT_ARG_MAX != 5");
- call_group_flags(flags, group, method, v[0], v[1], v[2], v[3], v[4]);
+ static_assert(VARIANT_ARG_MAX == 8, "This code needs to be updated if VARIANT_ARG_MAX != 8");
+ call_group_flags(flags, group, method, v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
return Variant();
}
@@ -947,8 +959,8 @@ Variant SceneTree::_call_group(const Variant **p_args, int p_argcount, Callable:
v[i] = *p_args[i + 2];
}
- static_assert(VARIANT_ARG_MAX == 5, "This code needs to be updated if VARIANT_ARG_MAX != 5");
- call_group_flags(0, group, method, v[0], v[1], v[2], v[3], v[4]);
+ static_assert(VARIANT_ARG_MAX == 8, "This code needs to be updated if VARIANT_ARG_MAX != 8");
+ call_group_flags(0, group, method, v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
return Variant();
}
@@ -1097,7 +1109,7 @@ Error SceneTree::change_scene_to(const Ref<PackedScene> &p_scene) {
ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE);
}
- call_deferred("_change_scene", new_scene);
+ call_deferred(SNAME("_change_scene"), new_scene);
return OK;
}
@@ -1134,8 +1146,8 @@ Array SceneTree::get_processed_tweens() {
ret.resize(tweens.size());
int i = 0;
- for (List<Ref<Tween>>::Element *E = tweens.front(); E; E = E->next()) {
- ret[i] = E->get();
+ for (Ref<Tween> E : tweens) {
+ ret[i] = E;
i++;
}
@@ -1390,11 +1402,11 @@ SceneTree::SceneTree() {
List<String> exts;
ResourceLoader::get_recognized_extensions_for_type("Environment", &exts);
String ext_hint;
- for (List<String>::Element *E = exts.front(); E; E = E->next()) {
+ for (String &E : exts) {
if (ext_hint != String()) {
ext_hint += ",";
}
- ext_hint += "*." + E->get();
+ ext_hint += "*." + E;
}
// Get path.
String env_path = GLOBAL_DEF("rendering/environment/defaults/default_environment", "");