diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2020-12-22 09:50:29 +0000 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2020-12-22 12:34:57 +0000 |
commit | d9e9eb8d048bbec5941fa684a5e56d5edc5954d0 (patch) | |
tree | f455ebfe310ddfa68e1927decc0c044c6f2de239 /scene | |
parent | 6532596d97d90474738283e0f2662719d10aaac0 (diff) |
Rename MainLoop methods to match Node methods
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/velocity_tracker_3d.cpp | 6 | ||||
-rw-r--r-- | scene/main/node.cpp | 42 | ||||
-rw-r--r-- | scene/main/node.h | 8 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 30 | ||||
-rw-r--r-- | scene/main/scene_tree.h | 12 |
5 files changed, 47 insertions, 51 deletions
diff --git a/scene/3d/velocity_tracker_3d.cpp b/scene/3d/velocity_tracker_3d.cpp index eba7d44c16..4ffa335775 100644 --- a/scene/3d/velocity_tracker_3d.cpp +++ b/scene/3d/velocity_tracker_3d.cpp @@ -45,7 +45,7 @@ void VelocityTracker3D::update_position(const Vector3 &p_position) { if (physics_step) { ph.frame = Engine::get_singleton()->get_physics_frames(); } else { - ph.frame = Engine::get_singleton()->get_idle_frame_ticks(); + ph.frame = Engine::get_singleton()->get_frame_ticks(); } if (position_history_len == 0 || position_history[0].frame != ph.frame) { //in same frame, use latest @@ -72,7 +72,7 @@ Vector3 VelocityTracker3D::get_tracked_linear_velocity() const { uint64_t base = Engine::get_singleton()->get_physics_frames(); base_time = float(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second(); } else { - uint64_t base = Engine::get_singleton()->get_idle_frame_ticks(); + uint64_t base = Engine::get_singleton()->get_frame_ticks(); base_time = double(base - position_history[0].frame) / 1000000.0; } } @@ -109,7 +109,7 @@ void VelocityTracker3D::reset(const Vector3 &p_new_pos) { if (physics_step) { ph.frame = Engine::get_singleton()->get_physics_frames(); } else { - ph.frame = Engine::get_singleton()->get_idle_frame_ticks(); + ph.frame = Engine::get_singleton()->get_frame_ticks(); } position_history.write[0] = ph; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index e2df2860ea..8e0ce54d0a 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -797,9 +797,9 @@ bool Node::can_process_notification(int p_what) const { case NOTIFICATION_PHYSICS_PROCESS: return data.physics_process; case NOTIFICATION_PROCESS: - return data.idle_process; + return data.process; case NOTIFICATION_INTERNAL_PROCESS: - return data.idle_process_internal; + return data.process_internal; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: return data.physics_process_internal; } @@ -845,50 +845,50 @@ float Node::get_physics_process_delta_time() const { float Node::get_process_delta_time() const { if (data.tree) { - return data.tree->get_idle_process_time(); + return data.tree->get_process_time(); } else { return 0; } } -void Node::set_process(bool p_idle_process) { - if (data.idle_process == p_idle_process) { +void Node::set_process(bool p_process) { + if (data.process == p_process) { return; } - data.idle_process = p_idle_process; + data.process = p_process; - if (data.idle_process) { - add_to_group("idle_process", false); + if (data.process) { + add_to_group("process", false); } else { - remove_from_group("idle_process"); + remove_from_group("process"); } - _change_notify("idle_process"); + _change_notify("process"); } bool Node::is_processing() const { - return data.idle_process; + return data.process; } -void Node::set_process_internal(bool p_idle_process_internal) { - if (data.idle_process_internal == p_idle_process_internal) { +void Node::set_process_internal(bool p_process_internal) { + if (data.process_internal == p_process_internal) { return; } - data.idle_process_internal = p_idle_process_internal; + data.process_internal = p_process_internal; - if (data.idle_process_internal) { - add_to_group("idle_process_internal", false); + if (data.process_internal) { + add_to_group("process_internal", false); } else { - remove_from_group("idle_process_internal"); + remove_from_group("process_internal"); } - _change_notify("idle_process_internal"); + _change_notify("process_internal"); } bool Node::is_processing_internal() const { - return data.idle_process_internal; + return data.process_internal; } void Node::set_process_priority(int p_priority) { @@ -900,11 +900,11 @@ void Node::set_process_priority(int p_priority) { } if (is_processing()) { - data.tree->make_group_changed("idle_process"); + data.tree->make_group_changed("process"); } if (is_processing_internal()) { - data.tree->make_group_changed("idle_process_internal"); + data.tree->make_group_changed("process_internal"); } if (is_physics_processing()) { diff --git a/scene/main/node.h b/scene/main/node.h index 5c178d401c..9df89fb51d 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -121,11 +121,11 @@ private: // Variables used to properly sort the node when processing, ignored otherwise. // TODO: Should move all the stuff below to bits. bool physics_process = false; - bool idle_process = false; + bool process = false; int process_priority = 0; bool physics_process_internal = false; - bool idle_process_internal = false; + bool process_internal = false; bool input = false; bool unhandled_input = false; @@ -339,14 +339,14 @@ public: float get_physics_process_delta_time() const; bool is_physics_processing() const; - void set_process(bool p_idle_process); + void set_process(bool p_process); float get_process_delta_time() const; bool is_processing() const; void set_physics_process_internal(bool p_process_internal); bool is_physics_processing_internal() const; - void set_process_internal(bool p_idle_process_internal); + void set_process_internal(bool p_process_internal); bool is_processing_internal() const; void set_process_priority(int p_priority); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 5cf3cbd382..abe700a529 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -390,20 +390,20 @@ void SceneTree::set_group(const StringName &p_group, const String &p_name, const set_group_flags(0, p_group, p_name, p_value); } -void SceneTree::init() { +void SceneTree::initialize() { initialized = true; root->_set_tree(this); - MainLoop::init(); + MainLoop::initialize(); } -bool SceneTree::iteration(float p_time) { +bool SceneTree::physics_process(float p_time) { root_lock++; current_frame++; flush_transform_notifications(); - MainLoop::iteration(p_time); + MainLoop::physics_process(p_time); physics_process_time = p_time; emit_signal("physics_frame"); @@ -422,29 +422,25 @@ bool SceneTree::iteration(float p_time) { return _quit; } -bool SceneTree::idle(float p_time) { - //print_line("ram: "+itos(OS::get_singleton()->get_static_memory_usage())+" sram: "+itos(OS::get_singleton()->get_dynamic_memory_usage())); - //print_line("node count: "+itos(get_node_count())); - //print_line("TEXTURE RAM: "+itos(RS::get_singleton()->get_render_info(RS::INFO_TEXTURE_MEM_USED))); - +bool SceneTree::process(float p_time) { root_lock++; - MainLoop::idle(p_time); + MainLoop::process(p_time); - idle_process_time = p_time; + process_time = p_time; if (multiplayer_poll) { multiplayer->poll(); } - emit_signal("idle_frame"); + emit_signal("process_frame"); MessageQueue::get_singleton()->flush(); //small little hack flush_transform_notifications(); - _notify_group_pause("idle_process_internal", Node::NOTIFICATION_INTERNAL_PROCESS); - _notify_group_pause("idle_process", Node::NOTIFICATION_PROCESS); + _notify_group_pause("process_internal", Node::NOTIFICATION_INTERNAL_PROCESS); + _notify_group_pause("process", Node::NOTIFICATION_PROCESS); _flush_ugc(); MessageQueue::get_singleton()->flush(); //small little hack @@ -516,14 +512,14 @@ bool SceneTree::idle(float p_time) { return _quit; } -void SceneTree::finish() { +void SceneTree::finalize() { _flush_delete_queue(); _flush_ugc(); initialized = false; - MainLoop::finish(); + MainLoop::finalize(); if (root) { root->_set_tree(nullptr); @@ -1265,7 +1261,7 @@ void SceneTree::_bind_methods() { ADD_SIGNAL(MethodInfo("node_renamed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); - ADD_SIGNAL(MethodInfo("idle_frame")); + ADD_SIGNAL(MethodInfo("process_frame")); ADD_SIGNAL(MethodInfo("physics_frame")); ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "screen"))); diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 9cf129d959..00d4b25e76 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -88,7 +88,7 @@ private: uint64_t tree_version = 1; float physics_process_time = 1.0; - float idle_process_time = 1.0; + float process_time = 1.0; bool accept_quit = true; bool quit_on_go_back = true; @@ -236,12 +236,12 @@ public: void flush_transform_notifications(); - virtual void init() override; + virtual void initialize() override; - virtual bool iteration(float p_time) override; - virtual bool idle(float p_time) override; + virtual bool physics_process(float p_time) override; + virtual bool process(float p_time) override; - virtual void finish() override; + virtual void finalize() override; void set_auto_accept_quit(bool p_enable); void set_quit_on_go_back(bool p_enable); @@ -249,7 +249,7 @@ public: void quit(int p_exit_code = -1); _FORCE_INLINE_ float get_physics_process_time() const { return physics_process_time; } - _FORCE_INLINE_ float get_idle_process_time() const { return idle_process_time; } + _FORCE_INLINE_ float get_process_time() const { return process_time; } #ifdef TOOLS_ENABLED bool is_node_being_edited(const Node *p_node) const; |