diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2020-12-28 14:44:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-28 14:44:28 +0100 |
commit | e4c05723858dc6e644ebec4ea89fb6b562052fbd (patch) | |
tree | 0cf6145956861a4082673da3fc8e7fa9e97d7fab /core | |
parent | 891b1cdf2806dc6f454c536962d225c81c0021ca (diff) | |
parent | d9e9eb8d048bbec5941fa684a5e56d5edc5954d0 (diff) |
Merge pull request #44593 from madmiraal/rename-mainloop-methods
Rename MainLoop methods to match Node methods
Diffstat (limited to 'core')
-rw-r--r-- | core/config/engine.h | 10 | ||||
-rw-r--r-- | core/core_bind.cpp | 6 | ||||
-rw-r--r-- | core/core_bind.h | 2 | ||||
-rw-r--r-- | core/debugger/engine_debugger.cpp | 6 | ||||
-rw-r--r-- | core/debugger/engine_debugger.h | 6 | ||||
-rw-r--r-- | core/debugger/remote_debugger.cpp | 2 | ||||
-rw-r--r-- | core/input/input.cpp | 10 | ||||
-rw-r--r-- | core/input/input.h | 2 | ||||
-rw-r--r-- | core/os/main_loop.cpp | 24 | ||||
-rw-r--r-- | core/os/main_loop.h | 12 |
10 files changed, 40 insertions, 40 deletions
diff --git a/core/config/engine.h b/core/config/engine.h index 0d9aa02f28..c0fd64fcc4 100644 --- a/core/config/engine.h +++ b/core/config/engine.h @@ -50,7 +50,7 @@ private: uint64_t frames_drawn = 0; uint32_t _frame_delay = 0; uint64_t _frame_ticks = 0; - float _frame_step = 0; + float _process_step = 0; int ips = 60; float physics_jitter_fix = 0.5; @@ -62,7 +62,7 @@ private: bool abort_on_gpu_errors = false; bool use_validation_layers = false; - uint64_t _idle_frames = 0; + uint64_t _process_frames = 0; bool _in_physics = false; List<Singleton> singletons; @@ -89,10 +89,10 @@ public: uint64_t get_frames_drawn(); uint64_t get_physics_frames() const { return _physics_frames; } - uint64_t get_idle_frames() const { return _idle_frames; } + uint64_t get_process_frames() const { return _process_frames; } bool is_in_physics_frame() const { return _in_physics; } - uint64_t get_idle_frame_ticks() const { return _frame_ticks; } - float get_idle_frame_step() const { return _frame_step; } + uint64_t get_frame_ticks() const { return _frame_ticks; } + float get_process_step() const { return _process_step; } float get_physics_interpolation_fraction() const { return _physics_interpolation_fraction; } void set_time_scale(float p_scale); diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 259d899d39..d769bd28b6 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -2278,8 +2278,8 @@ uint64_t _Engine::get_physics_frames() const { return Engine::get_singleton()->get_physics_frames(); } -uint64_t _Engine::get_idle_frames() const { - return Engine::get_singleton()->get_idle_frames(); +uint64_t _Engine::get_process_frames() const { + return Engine::get_singleton()->get_process_frames(); } void _Engine::set_time_scale(float p_scale) { @@ -2358,7 +2358,7 @@ void _Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn); ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second); ClassDB::bind_method(D_METHOD("get_physics_frames"), &_Engine::get_physics_frames); - ClassDB::bind_method(D_METHOD("get_idle_frames"), &_Engine::get_idle_frames); + ClassDB::bind_method(D_METHOD("get_process_frames"), &_Engine::get_process_frames); ClassDB::bind_method(D_METHOD("get_main_loop"), &_Engine::get_main_loop); diff --git a/core/core_bind.h b/core/core_bind.h index f3a77a4fa6..08634339ae 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -635,7 +635,7 @@ public: float get_frames_per_second() const; uint64_t get_physics_frames() const; - uint64_t get_idle_frames() const; + uint64_t get_process_frames() const; int get_frames_drawn(); diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp index 5ef802957f..9fef2ee9ea 100644 --- a/core/debugger/engine_debugger.cpp +++ b/core/debugger/engine_debugger.cpp @@ -117,9 +117,9 @@ void EngineDebugger::line_poll() { poll_every++; } -void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_idle_ticks, uint64_t p_physics_ticks, float p_physics_frame_time) { +void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_process_ticks, uint64_t p_physics_ticks, float p_physics_frame_time) { frame_time = USEC_TO_SEC(p_frame_ticks); - idle_time = USEC_TO_SEC(p_idle_ticks); + process_time = USEC_TO_SEC(p_process_ticks); physics_time = USEC_TO_SEC(p_physics_ticks); physics_frame_time = p_physics_frame_time; // Notify tick to running profilers @@ -128,7 +128,7 @@ void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_idle_ticks, ui if (!p.active || !p.tick) { continue; } - p.tick(p.data, frame_time, idle_time, physics_time, physics_frame_time); + p.tick(p.data, frame_time, process_time, physics_time, physics_frame_time); } singleton->poll_events(true); } diff --git a/core/debugger/engine_debugger.h b/core/debugger/engine_debugger.h index 10f04bf97a..96fb494484 100644 --- a/core/debugger/engine_debugger.h +++ b/core/debugger/engine_debugger.h @@ -44,7 +44,7 @@ class ScriptDebugger; class EngineDebugger { public: typedef void (*ProfilingToggle)(void *p_user, bool p_enable, const Array &p_opts); - typedef void (*ProfilingTick)(void *p_user, float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time); + typedef void (*ProfilingTick)(void *p_user, float p_frame_time, float p_process_time, float p_physics_time, float p_physics_frame_time); typedef void (*ProfilingAdd)(void *p_user, const Array &p_arr); typedef Error (*CaptureFunc)(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured); @@ -86,7 +86,7 @@ public: private: float frame_time = 0.0; - float idle_time = 0.0; + float process_time = 0.0; float physics_time = 0.0; float physics_frame_time = 0.0; @@ -120,7 +120,7 @@ public: static void register_uri_handler(const String &p_protocol, CreatePeerFunc p_func); - void iteration(uint64_t p_frame_ticks, uint64_t p_idle_ticks, uint64_t p_physics_ticks, float p_physics_frame_time); + void iteration(uint64_t p_frame_ticks, uint64_t p_process_ticks, uint64_t p_physics_ticks, float p_physics_frame_time); void profiler_enable(const StringName &p_name, bool p_enabled, const Array &p_opts = Array()); Error capture_parse(const StringName &p_name, const String &p_msg, const Array &p_args, bool &r_captured); diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index 4e16bb0182..05307ebf4c 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -317,7 +317,7 @@ struct RemoteDebugger::ServersProfiler { void _send_frame_data(bool p_final) { DebuggerMarshalls::ServersProfilerFrame frame; - frame.frame_number = Engine::get_singleton()->get_idle_frames(); + frame.frame_number = Engine::get_singleton()->get_process_frames(); frame.frame_time = frame_time; frame.idle_time = idle_time; frame.physics_time = physics_time; diff --git a/core/input/input.cpp b/core/input/input.cpp index c49193562e..9759cd4888 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -247,7 +247,7 @@ bool Input::is_action_just_pressed(const StringName &p_action) const { if (Engine::get_singleton()->is_in_physics_frame()) { return E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames(); } else { - return E->get().pressed && E->get().idle_frame == Engine::get_singleton()->get_idle_frames(); + return E->get().pressed && E->get().process_frame == Engine::get_singleton()->get_process_frames(); } } @@ -260,7 +260,7 @@ bool Input::is_action_just_released(const StringName &p_action) const { if (Engine::get_singleton()->is_in_physics_frame()) { return !E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames(); } else { - return !E->get().pressed && E->get().idle_frame == Engine::get_singleton()->get_idle_frames(); + return !E->get().pressed && E->get().process_frame == Engine::get_singleton()->get_process_frames(); } } @@ -588,7 +588,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em if (!p_event->is_echo() && is_action_pressed(E->key()) != p_event->is_action_pressed(E->key())) { Action action; action.physics_frame = Engine::get_singleton()->get_physics_frames(); - action.idle_frame = Engine::get_singleton()->get_idle_frames(); + action.process_frame = Engine::get_singleton()->get_process_frames(); action.pressed = p_event->is_action_pressed(E->key()); action.strength = 0.0f; action.raw_strength = 0.0f; @@ -714,7 +714,7 @@ void Input::action_press(const StringName &p_action, float p_strength) { Action action; action.physics_frame = Engine::get_singleton()->get_physics_frames(); - action.idle_frame = Engine::get_singleton()->get_idle_frames(); + action.process_frame = Engine::get_singleton()->get_process_frames(); action.pressed = true; action.strength = p_strength; @@ -725,7 +725,7 @@ void Input::action_release(const StringName &p_action) { Action action; action.physics_frame = Engine::get_singleton()->get_physics_frames(); - action.idle_frame = Engine::get_singleton()->get_idle_frames(); + action.process_frame = Engine::get_singleton()->get_process_frames(); action.pressed = false; action.strength = 0.f; diff --git a/core/input/input.h b/core/input/input.h index 1b2df49ac0..39dc0bceff 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -114,7 +114,7 @@ private: struct Action { uint64_t physics_frame; - uint64_t idle_frame; + uint64_t process_frame; bool pressed; float strength; float raw_strength; diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 9252ba0840..0247b6a1d8 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -34,8 +34,8 @@ void MainLoop::_bind_methods() { BIND_VMETHOD(MethodInfo("_initialize")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "_iteration", PropertyInfo(Variant::FLOAT, "delta"))); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "_idle", PropertyInfo(Variant::FLOAT, "delta"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_physics_process", PropertyInfo(Variant::FLOAT, "delta"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_process", PropertyInfo(Variant::FLOAT, "delta"))); BIND_VMETHOD(MethodInfo("_finalize")); BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING); @@ -52,13 +52,13 @@ void MainLoop::_bind_methods() { ADD_SIGNAL(MethodInfo("on_request_permissions_result", PropertyInfo(Variant::STRING, "permission"), PropertyInfo(Variant::BOOL, "granted"))); }; -void MainLoop::set_init_script(const Ref<Script> &p_init_script) { - init_script = p_init_script; +void MainLoop::set_initialize_script(const Ref<Script> &p_initialize_script) { + initialize_script = p_initialize_script; } -void MainLoop::init() { - if (init_script.is_valid()) { - set_script(init_script); +void MainLoop::initialize() { + if (initialize_script.is_valid()) { + set_script(initialize_script); } if (get_script_instance()) { @@ -66,23 +66,23 @@ void MainLoop::init() { } } -bool MainLoop::iteration(float p_time) { +bool MainLoop::physics_process(float p_time) { if (get_script_instance()) { - return get_script_instance()->call("_iteration", p_time); + return get_script_instance()->call("_physics_process", p_time); } return false; } -bool MainLoop::idle(float p_time) { +bool MainLoop::process(float p_time) { if (get_script_instance()) { - return get_script_instance()->call("_idle", p_time); + return get_script_instance()->call("_process", p_time); } return false; } -void MainLoop::finish() { +void MainLoop::finalize() { if (get_script_instance()) { get_script_instance()->call("_finalize"); set_script(Variant()); //clear script diff --git a/core/os/main_loop.h b/core/os/main_loop.h index 7bc91fbb83..d48663b68a 100644 --- a/core/os/main_loop.h +++ b/core/os/main_loop.h @@ -39,7 +39,7 @@ class MainLoop : public Object { GDCLASS(MainLoop, Object); OBJ_CATEGORY("Main Loop"); - Ref<Script> init_script; + Ref<Script> initialize_script; protected: static void _bind_methods(); @@ -59,12 +59,12 @@ public: NOTIFICATION_TEXT_SERVER_CHANGED = 2018, }; - virtual void init(); - virtual bool iteration(float p_time); - virtual bool idle(float p_time); - virtual void finish(); + virtual void initialize(); + virtual bool physics_process(float p_time); + virtual bool process(float p_time); + virtual void finalize(); - void set_init_script(const Ref<Script> &p_init_script); + void set_initialize_script(const Ref<Script> &p_initialize_script); MainLoop() {} virtual ~MainLoop() {} |