diff options
61 files changed, 366 insertions, 298 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() {} diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml index 052b23a7ab..034b2e9629 100644 --- a/doc/classes/Camera3D.xml +++ b/doc/classes/Camera3D.xml @@ -189,7 +189,7 @@ <member name="environment" type="Environment" setter="set_environment" getter="get_environment"> The [Environment] to use for this camera. </member> - <member name="far" type="float" setter="set_zfar" getter="get_zfar" default="4000.0"> + <member name="far" type="float" setter="set_far" getter="get_far" default="4000.0"> The distance to the far culling boundary for this camera relative to its local Z axis. </member> <member name="fov" type="float" setter="set_fov" getter="get_fov" default="75.0"> @@ -209,7 +209,7 @@ <member name="keep_aspect" type="int" setter="set_keep_aspect_mode" getter="get_keep_aspect_mode" enum="Camera3D.KeepAspect" default="1"> The axis to lock during [member fov]/[member size] adjustments. Can be either [constant KEEP_WIDTH] or [constant KEEP_HEIGHT]. </member> - <member name="near" type="float" setter="set_znear" getter="get_znear" default="0.05"> + <member name="near" type="float" setter="set_near" getter="get_near" default="0.05"> The distance to the near culling boundary for this camera relative to its local Z axis. </member> <member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera3D.Projection" default="0"> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 9443abe684..c3db716d3a 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -454,13 +454,6 @@ Returns the position and size of the control relative to the top-left corner of the parent Control. See [member rect_position] and [member rect_size]. </description> </method> - <method name="get_rotation" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the rotation (in radians). - </description> - </method> <method name="get_theme_color" qualifiers="const"> <return type="Color"> </return> @@ -981,15 +974,6 @@ If [code]keep_offsets[/code] is [code]true[/code], control's anchors will be updated instead of offsets. </description> </method> - <method name="set_rotation"> - <return type="void"> - </return> - <argument index="0" name="radians" type="float"> - </argument> - <description> - Sets the rotation (in radians). - </description> - </method> <method name="set_size"> <return type="void"> </return> @@ -1117,7 +1101,10 @@ <member name="rect_position" type="Vector2" setter="_set_position" getter="get_position" default="Vector2( 0, 0 )"> The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by [member rect_pivot_offset]. </member> - <member name="rect_rotation" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees" default="0.0"> + <member name="rect_rotation" type="float" setter="set_rotation" getter="get_rotation" default="0.0"> + The node's rotation around its pivot, in radians. See [member rect_pivot_offset] to change the pivot's position. + </member> + <member name="rect_rotation_degrees" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees" default="0.0"> The node's rotation around its pivot, in degrees. See [member rect_pivot_offset] to change the pivot's position. </member> <member name="rect_scale" type="Vector2" setter="set_scale" getter="get_scale" default="Vector2( 1, 1 )"> diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index c7561449b9..5a61c05cee 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -47,7 +47,7 @@ Returns the editor's [EditorSettings] instance. </description> </method> - <method name="get_editor_viewport"> + <method name="get_editor_main_control"> <return type="Control"> </return> <description> diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index fab8512e4a..c079085fb3 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -41,7 +41,7 @@ <return type="int"> </return> <description> - Returns the total number of frames drawn. If the render loop is disabled with [code]--disable-render-loop[/code] via command line, this returns [code]0[/code]. See also [method get_idle_frames]. + Returns the total number of frames drawn. If the render loop is disabled with [code]--disable-render-loop[/code] via command line, this returns [code]0[/code]. See also [method get_process_frames]. </description> </method> <method name="get_frames_per_second" qualifiers="const"> @@ -51,11 +51,11 @@ Returns the frames per second of the running game. </description> </method> - <method name="get_idle_frames" qualifiers="const"> + <method name="get_process_frames" qualifiers="const"> <return type="int"> </return> <description> - Returns the total number of frames passed since engine initialization which is advanced on each [b]idle frame[/b], regardless of whether the render loop is enabled. See also [method get_frames_drawn]. + Returns the total number of frames passed since engine initialization which is advanced on each [b]process frame[/b], regardless of whether the render loop is enabled. See also [method get_frames_drawn]. </description> </method> <method name="get_license_info" qualifiers="const"> diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index b4afee7610..ed437aefd5 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -25,11 +25,11 @@ Clear all the added filters in the dialog. </description> </method> - <method name="deselect_items"> + <method name="deselect_all"> <return type="void"> </return> <description> - Clear currently selected items in the dialog. + Clear all currently selected items in the dialog. </description> </method> <method name="get_line_edit"> diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index c5884aa44a..2347627c31 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -288,7 +288,7 @@ Emitted when a GraphNode is selected. </description> </signal> - <signal name="node_unselected"> + <signal name="node_deselected"> <argument index="0" name="node" type="Node"> </argument> <description> diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index 0fd0fe7b3d..8542cdaca4 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -471,7 +471,7 @@ Sorts items in the list by their text. </description> </method> - <method name="unselect"> + <method name="deselect"> <return type="void"> </return> <argument index="0" name="idx" type="int"> @@ -480,7 +480,7 @@ Ensures the item associated with the specified index is not selected. </description> </method> - <method name="unselect_all"> + <method name="deselect_all"> <return type="void"> </return> <description> diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 75d57b040f..b28fe400e6 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -492,7 +492,7 @@ void CreateDialog::_favorite_selected() { } search_box->set_text(item->get_text(0).get_slicec(' ', 0)); - recent->unselect_all(); + recent->deselect_all(); _update_search(); } diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 80d7934938..6f0d537fa2 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -802,8 +802,8 @@ void ScriptEditorDebugger::_notification(int p_what) { msg.push_back(true); msg.push_back(cam->get_fov()); } - msg.push_back(cam->get_znear()); - msg.push_back(cam->get_zfar()); + msg.push_back(cam->get_near()); + msg.push_back(cam->get_far()); _put_msg("scene:override_camera_3D:transform", msg); } } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index a0876ffa3d..231c143c05 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -398,7 +398,7 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat Ref<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const { Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme(); ERR_FAIL_COND_V(theme.is_null(), Ref<ImageTexture>()); - if (EditorNode::get_singleton()->get_viewport()->is_layout_rtl()) { + if (EditorNode::get_singleton()->get_main_control()->is_layout_rtl()) { return theme->get_icon("PlayBackwards", "EditorIcons"); } else { return theme->get_icon("Play", "EditorIcons"); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 0719d3f018..55373c47a4 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -499,7 +499,7 @@ void EditorFileDialog::_multi_selected(int p_item, bool p_selected) { } void EditorFileDialog::_items_clear_selection() { - item_list->unselect_all(); + item_list->deselect_all(); // If nothing is selected, then block Open button. switch (mode) { @@ -595,7 +595,7 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) { // Right click on folder background. Deselect all files so that actions are applied on the current folder. for (int i = 0; i < item_list->get_item_count(); i++) { - item_list->unselect(i); + item_list->deselect(i); } item_menu->clear(); @@ -849,7 +849,7 @@ void EditorFileDialog::update_file_list() { } if (favorites->get_current() >= 0) { - favorites->unselect(favorites->get_current()); + favorites->deselect(favorites->get_current()); } favorite->set_pressed(false); @@ -1226,7 +1226,7 @@ void EditorFileDialog::_update_favorites() { if (setthis) { favorite->set_pressed(true); favorites->set_current(favorites->get_item_count() - 1); - recent->unselect_all(); + recent->deselect_all(); } } } diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp index 74f45fa628..71d369be1f 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -119,7 +119,7 @@ EditorLayoutsDialog::EditorLayoutsDialog() { name->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5); name->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5); name->connect("gui_input", callable_mp(this, &EditorLayoutsDialog::_line_gui_input)); - name->connect("focus_entered", callable_mp(layout_names, &ItemList::unselect_all)); + name->connect("focus_entered", callable_mp(layout_names, &ItemList::deselect_all)); } void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d883b6c909..4fb34f58bf 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2745,14 +2745,14 @@ void EditorNode::_screenshot(bool p_use_utc) { } void EditorNode::_save_screenshot(NodePath p_path) { - Control *editor_viewport = EditorInterface::get_singleton()->get_editor_viewport(); - ERR_FAIL_COND_MSG(!editor_viewport, "Cannot get editor viewport."); - Viewport *viewport = editor_viewport->get_viewport(); - ERR_FAIL_COND_MSG(!viewport, "Cannot get editor viewport."); + Control *editor_main_control = EditorInterface::get_singleton()->get_editor_main_control(); + ERR_FAIL_COND_MSG(!editor_main_control, "Cannot get editor main control."); + Viewport *viewport = editor_main_control->get_viewport(); + ERR_FAIL_COND_MSG(!viewport, "Cannot get editor main control viewport."); Ref<ViewportTexture> texture = viewport->get_texture(); - ERR_FAIL_COND_MSG(texture.is_null(), "Cannot get editor viewport texture."); + ERR_FAIL_COND_MSG(texture.is_null(), "Cannot get editor main control viewport texture."); Ref<Image> img = texture->get_data(); - ERR_FAIL_COND_MSG(img.is_null(), "Cannot get editor viewport texture image."); + ERR_FAIL_COND_MSG(img.is_null(), "Cannot get editor main control viewport texture image."); Error error = img->save_png(p_path); ERR_FAIL_COND_MSG(error != OK, "Cannot save screenshot to file '" + p_path + "'."); } @@ -2884,8 +2884,8 @@ void EditorNode::_update_file_menu_closed() { pop->set_item_disabled(pop->get_item_index(FILE_OPEN_PREV), false); } -Control *EditorNode::get_viewport() { - return viewport; +Control *EditorNode::get_main_control() { + return main_control; } void EditorNode::_editor_select(int p_which) { @@ -6041,10 +6041,10 @@ EditorNode::EditorNode() { scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); - viewport = memnew(VBoxContainer); - viewport->set_v_size_flags(Control::SIZE_EXPAND_FILL); - viewport->add_theme_constant_override("separation", 0); - scene_root_parent->add_child(viewport); + main_control = memnew(VBoxContainer); + main_control->set_v_size_flags(Control::SIZE_EXPAND_FILL); + main_control->add_theme_constant_override("separation", 0); + scene_root_parent->add_child(main_control); HBoxContainer *left_menu_hb = memnew(HBoxContainer); menu_hb->add_child(left_menu_hb); diff --git a/editor/editor_node.h b/editor/editor_node.h index a53ae6934f..9ebc0f522c 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -255,7 +255,7 @@ private: Control *vp_base; HBoxContainer *menu_hb; - Control *viewport; + Control *main_control; MenuButton *file_menu; MenuButton *project_menu; MenuButton *debug_menu; @@ -728,7 +728,7 @@ public: bool is_changing_scene() const; static EditorLog *get_log() { return singleton->log; } - Control *get_viewport(); + Control *get_main_control(); void set_edited_scene(Node *p_scene); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index a84f26193a..76912c8925 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -152,8 +152,8 @@ void EditorInterface::set_main_screen_editor(const String &p_name) { EditorNode::get_singleton()->select_editor_by_name(p_name); } -Control *EditorInterface::get_editor_viewport() { - return EditorNode::get_singleton()->get_viewport(); +Control *EditorInterface::get_editor_main_control() { + return EditorNode::get_singleton()->get_main_control(); } void EditorInterface::edit_resource(const Ref<Resource> &p_resource) { @@ -319,7 +319,7 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &EditorInterface::get_edited_scene_root); ClassDB::bind_method(D_METHOD("get_resource_previewer"), &EditorInterface::get_resource_previewer); ClassDB::bind_method(D_METHOD("get_resource_filesystem"), &EditorInterface::get_resource_file_system); - ClassDB::bind_method(D_METHOD("get_editor_viewport"), &EditorInterface::get_editor_viewport); + ClassDB::bind_method(D_METHOD("get_editor_main_control"), &EditorInterface::get_editor_main_control); ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews); ClassDB::bind_method(D_METHOD("select_file", "file"), &EditorInterface::select_file); ClassDB::bind_method(D_METHOD("get_selected_path"), &EditorInterface::get_selected_path); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 03908b43ca..1697b79216 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -69,7 +69,7 @@ protected: public: static EditorInterface *get_singleton() { return singleton; } - Control *get_editor_viewport(); + Control *get_editor_main_control(); void edit_resource(const Ref<Resource> &p_resource); void open_scene_from_path(const String &scene_path); void reload_scene_from_path(const String &scene_path); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 1efa38c181..e7a621eee6 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2447,7 +2447,7 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) { continue; } if (files->get_item_text(p_item) == "..") { - files->unselect(i); + files->deselect(i); continue; } paths.push_back(files->get_item_metadata(i)); diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 1d09ad8a4c..71ceff7fee 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -633,7 +633,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point, tcp = a; } - if (camp.distance_to(tcp) < p_camera->get_znear()) { + if (camp.distance_to(tcp) < p_camera->get_near()) { continue; } cp = tcp; @@ -1357,7 +1357,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { case Camera3D::PROJECTION_FRUSTUM: { float hsize = camera->get_size() / 2.0; - Vector3 side = Vector3(hsize, 0, -camera->get_znear()).normalized(); + Vector3 side = Vector3(hsize, 0, -camera->get_near()).normalized(); Vector3 nside = side; nside.x = -nside.x; Vector3 up = Vector3(0, side.x, 0); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index d92ee48247..c88c6f488e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2210,8 +2210,8 @@ void Node3DEditorViewport::set_freelook_active(bool active_now) { } void Node3DEditorViewport::scale_cursor_distance(real_t scale) { - real_t min_distance = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_distance = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t min_distance = MAX(camera->get_near() * 4, ZOOM_FREELOOK_MIN); + real_t max_distance = MIN(camera->get_far() / 4, ZOOM_FREELOOK_MAX); if (unlikely(min_distance > max_distance)) { cursor.distance = (min_distance + max_distance) / 2; } else { @@ -2223,8 +2223,8 @@ void Node3DEditorViewport::scale_cursor_distance(real_t scale) { } void Node3DEditorViewport::scale_freelook_speed(real_t scale) { - real_t min_speed = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_speed = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t min_speed = MAX(camera->get_near() * 4, ZOOM_FREELOOK_MIN); + real_t max_speed = MIN(camera->get_far() / 4, ZOOM_FREELOOK_MAX); if (unlikely(min_speed > max_speed)) { freelook_speed = (min_speed + max_speed) / 2; } else { @@ -2715,8 +2715,8 @@ void Node3DEditorViewport::_draw() { if (is_freelook_active()) { // Show speed - real_t min_speed = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_speed = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t min_speed = MAX(camera->get_near() * 4, ZOOM_FREELOOK_MIN); + real_t max_speed = MIN(camera->get_far() / 4, ZOOM_FREELOOK_MAX); real_t scale_length = (max_speed - min_speed); if (!Math::is_zero_approx(scale_length)) { @@ -2736,8 +2736,8 @@ void Node3DEditorViewport::_draw() { } else { // Show zoom - real_t min_distance = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_distance = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t min_distance = MAX(camera->get_near() * 4, ZOOM_FREELOOK_MIN); + real_t max_distance = MIN(camera->get_far() / 4, ZOOM_FREELOOK_MAX); real_t scale_length = (max_distance - min_distance); if (!Math::is_zero_approx(scale_length)) { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 7351136593..860b974632 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -262,7 +262,7 @@ Vector<int> TileMapEditor::get_selected_tiles() const { } void TileMapEditor::set_selected_tiles(Vector<int> p_tiles) { - palette->unselect_all(); + palette->deselect_all(); for (int i = p_tiles.size() - 1; i >= 0; i--) { int idx = palette->find_metadata(p_tiles[i]); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 4eb1b76d63..c0f2f25465 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -196,7 +196,7 @@ void ProjectExportDialog::_edit_preset(int p_index) { export_path->hide(); runnable->set_disabled(true); parameters->edit(nullptr); - presets->unselect_all(); + presets->deselect_all(); duplicate_preset->set_disabled(true); delete_preset->set_disabled(true); sections->hide(); diff --git a/main/main.cpp b/main/main.cpp index c492cfaad7..70fd45989d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2007,7 +2007,7 @@ bool Main::start() { script)); } - script_loop->set_init_script(script_res); + script_loop->set_initialize_script(script_res); main_loop = script_loop; } else { return false; @@ -2026,7 +2026,7 @@ bool Main::start() { DisplayServer::get_singleton()->alert("Error: Invalid MainLoop script base type: " + script_base); ERR_FAIL_V_MSG(false, vformat("The global class %s does not inherit from SceneTree or MainLoop.", main_loop_type)); } - script_loop->set_init_script(script_res); + script_loop->set_initialize_script(script_res); main_loop = script_loop; } } @@ -2422,7 +2422,7 @@ bool Main::is_iterating() { // For performance metrics. static uint64_t physics_process_max = 0; -static uint64_t idle_process_max = 0; +static uint64_t process_max = 0; bool Main::iteration() { //for now do not error on this @@ -2438,19 +2438,19 @@ bool Main::iteration() { uint64_t ticks_elapsed = ticks - last_ticks; int physics_fps = Engine::get_singleton()->get_iterations_per_second(); - float frame_slice = 1.0 / physics_fps; + float physics_step = 1.0 / physics_fps; float time_scale = Engine::get_singleton()->get_time_scale(); - MainFrameTime advance = main_timer_sync.advance(frame_slice, physics_fps); - double step = advance.idle_step; - double scaled_step = step * time_scale; + MainFrameTime advance = main_timer_sync.advance(physics_step, physics_fps); + double process_step = advance.process_step; + double scaled_step = process_step * time_scale; - Engine::get_singleton()->_frame_step = step; + Engine::get_singleton()->_process_step = process_step; Engine::get_singleton()->_physics_interpolation_fraction = advance.interpolation_fraction; uint64_t physics_process_ticks = 0; - uint64_t idle_process_ticks = 0; + uint64_t process_ticks = 0; frame += ticks_elapsed; @@ -2458,7 +2458,7 @@ bool Main::iteration() { static const int max_physics_steps = 8; if (fixed_fps == -1 && advance.physics_steps > max_physics_steps) { - step -= (advance.physics_steps - max_physics_steps) * frame_slice; + process_step -= (advance.physics_steps - max_physics_steps) * physics_step; advance.physics_steps = max_physics_steps; } @@ -2474,33 +2474,32 @@ bool Main::iteration() { PhysicsServer2D::get_singleton()->sync(); PhysicsServer2D::get_singleton()->flush_queries(); - if (OS::get_singleton()->get_main_loop()->iteration(frame_slice * time_scale)) { + if (OS::get_singleton()->get_main_loop()->physics_process(physics_step * time_scale)) { exit = true; break; } - NavigationServer3D::get_singleton_mut()->process(frame_slice * time_scale); + NavigationServer3D::get_singleton_mut()->process(physics_step * time_scale); message_queue->flush(); - PhysicsServer3D::get_singleton()->step(frame_slice * time_scale); + PhysicsServer3D::get_singleton()->step(physics_step * time_scale); PhysicsServer2D::get_singleton()->end_sync(); - PhysicsServer2D::get_singleton()->step(frame_slice * time_scale); + PhysicsServer2D::get_singleton()->step(physics_step * time_scale); message_queue->flush(); - physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - - physics_begin); // keep the largest one for reference + physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - physics_begin); // keep the largest one for reference physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - physics_begin, physics_process_max); Engine::get_singleton()->_physics_frames++; } Engine::get_singleton()->_in_physics = false; - uint64_t idle_begin = OS::get_singleton()->get_ticks_usec(); + uint64_t process_begin = OS::get_singleton()->get_ticks_usec(); - if (OS::get_singleton()->get_main_loop()->idle(step * time_scale)) { + if (OS::get_singleton()->get_main_loop()->process(process_step * time_scale)) { exit = true; } message_queue->flush(); @@ -2521,8 +2520,8 @@ bool Main::iteration() { } } - idle_process_ticks = OS::get_singleton()->get_ticks_usec() - idle_begin; - idle_process_max = MAX(idle_process_ticks, idle_process_max); + process_ticks = OS::get_singleton()->get_ticks_usec() - process_begin; + process_max = MAX(process_ticks, process_max); uint64_t frame_time = OS::get_singleton()->get_ticks_usec() - ticks; for (int i = 0; i < ScriptServer::get_language_count(); i++) { @@ -2532,11 +2531,11 @@ bool Main::iteration() { AudioServer::get_singleton()->update(); if (EngineDebugger::is_active()) { - EngineDebugger::get_singleton()->iteration(frame_time, idle_process_ticks, physics_process_ticks, frame_slice); + EngineDebugger::get_singleton()->iteration(frame_time, process_ticks, physics_process_ticks, physics_step); } frames++; - Engine::get_singleton()->_idle_frames++; + Engine::get_singleton()->_process_frames++; if (frame > 1000000) { if (editor || project_manager) { @@ -2548,9 +2547,9 @@ bool Main::iteration() { } Engine::get_singleton()->_fps = frames; - performance->set_process_time(USEC_TO_SEC(idle_process_max)); + performance->set_process_time(USEC_TO_SEC(process_max)); performance->set_physics_process_time(USEC_TO_SEC(physics_process_max)); - idle_process_max = 0; + process_max = 0; physics_process_max = 0; frame %= 1000000; diff --git a/main/main_timer_sync.cpp b/main/main_timer_sync.cpp index 5252ea005b..fcefd0095a 100644 --- a/main/main_timer_sync.cpp +++ b/main/main_timer_sync.cpp @@ -30,17 +30,17 @@ #include "main_timer_sync.h" -void MainFrameTime::clamp_idle(float min_idle_step, float max_idle_step) { - if (idle_step < min_idle_step) { - idle_step = min_idle_step; - } else if (idle_step > max_idle_step) { - idle_step = max_idle_step; +void MainFrameTime::clamp_process_step(float min_process_step, float max_process_step) { + if (process_step < min_process_step) { + process_step = min_process_step; + } else if (process_step > max_process_step) { + process_step = max_process_step; } } ///////////////////////////////// -// returns the fraction of p_frame_slice required for the timer to overshoot +// returns the fraction of p_physics_step required for the timer to overshoot // before advance_core considers changing the physics_steps return from // the typical values as defined by typical_physics_steps float MainTimerSync::get_physics_jitter_fix() { @@ -72,15 +72,15 @@ int MainTimerSync::get_average_physics_steps(float &p_min, float &p_max) { return CONTROL_STEPS; } -// advance physics clock by p_idle_step, return appropriate number of steps to simulate -MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_per_second, float p_idle_step) { +// advance physics clock by p_process_step, return appropriate number of steps to simulate +MainFrameTime MainTimerSync::advance_core(float p_physics_step, int p_physics_fps, float p_process_step) { MainFrameTime ret; - ret.idle_step = p_idle_step; + ret.process_step = p_process_step; // simple determination of number of physics iteration - time_accum += ret.idle_step; - ret.physics_steps = floor(time_accum * p_iterations_per_second); + time_accum += ret.process_step; + ret.physics_steps = floor(time_accum * p_physics_fps); int min_typical_steps = typical_physics_steps[0]; int max_typical_steps = min_typical_steps + 1; @@ -107,7 +107,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_ // try to keep it consistent with previous iterations if (ret.physics_steps < min_typical_steps) { - const int max_possible_steps = floor((time_accum)*p_iterations_per_second + get_physics_jitter_fix()); + const int max_possible_steps = floor((time_accum)*p_physics_fps + get_physics_jitter_fix()); if (max_possible_steps < min_typical_steps) { ret.physics_steps = max_possible_steps; update_typical = true; @@ -115,7 +115,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_ ret.physics_steps = min_typical_steps; } } else if (ret.physics_steps > max_typical_steps) { - const int min_possible_steps = floor((time_accum)*p_iterations_per_second - get_physics_jitter_fix()); + const int min_possible_steps = floor((time_accum)*p_physics_fps - get_physics_jitter_fix()); if (min_possible_steps > max_typical_steps) { ret.physics_steps = min_possible_steps; update_typical = true; @@ -124,7 +124,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_ } } - time_accum -= ret.physics_steps * p_frame_slice; + time_accum -= ret.physics_steps * p_physics_step; // keep track of accumulated step counts for (int i = CONTROL_STEPS - 2; i >= 0; --i) { @@ -146,52 +146,52 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_ } // calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero -MainFrameTime MainTimerSync::advance_checked(float p_frame_slice, int p_iterations_per_second, float p_idle_step) { +MainFrameTime MainTimerSync::advance_checked(float p_physics_step, int p_physics_fps, float p_process_step) { if (fixed_fps != -1) { - p_idle_step = 1.0 / fixed_fps; + p_process_step = 1.0 / fixed_fps; } // compensate for last deficit - p_idle_step += time_deficit; + p_process_step += time_deficit; - MainFrameTime ret = advance_core(p_frame_slice, p_iterations_per_second, p_idle_step); + MainFrameTime ret = advance_core(p_physics_step, p_physics_fps, p_process_step); - // we will do some clamping on ret.idle_step and need to sync those changes to time_accum, + // we will do some clamping on ret.process_step and need to sync those changes to time_accum, // that's easiest if we just remember their fixed difference now - const double idle_minus_accum = ret.idle_step - time_accum; + const double process_minus_accum = ret.process_step - time_accum; - // first, least important clamping: keep ret.idle_step consistent with typical_physics_steps. - // this smoothes out the idle steps and culls small but quick variations. + // first, least important clamping: keep ret.process_step consistent with typical_physics_steps. + // this smoothes out the process steps and culls small but quick variations. { float min_average_physics_steps, max_average_physics_steps; int consistent_steps = get_average_physics_steps(min_average_physics_steps, max_average_physics_steps); if (consistent_steps > 3) { - ret.clamp_idle(min_average_physics_steps * p_frame_slice, max_average_physics_steps * p_frame_slice); + ret.clamp_process_step(min_average_physics_steps * p_physics_step, max_average_physics_steps * p_physics_step); } } // second clamping: keep abs(time_deficit) < jitter_fix * frame_slise - float max_clock_deviation = get_physics_jitter_fix() * p_frame_slice; - ret.clamp_idle(p_idle_step - max_clock_deviation, p_idle_step + max_clock_deviation); + float max_clock_deviation = get_physics_jitter_fix() * p_physics_step; + ret.clamp_process_step(p_process_step - max_clock_deviation, p_process_step + max_clock_deviation); - // last clamping: make sure time_accum is between 0 and p_frame_slice for consistency between physics and idle - ret.clamp_idle(idle_minus_accum, idle_minus_accum + p_frame_slice); + // last clamping: make sure time_accum is between 0 and p_physics_step for consistency between physics and process + ret.clamp_process_step(process_minus_accum, process_minus_accum + p_physics_step); // restore time_accum - time_accum = ret.idle_step - idle_minus_accum; + time_accum = ret.process_step - process_minus_accum; // track deficit - time_deficit = p_idle_step - ret.idle_step; + time_deficit = p_process_step - ret.process_step; - // p_frame_slice is 1.0 / iterations_per_sec + // p_physics_step is 1.0 / iterations_per_sec // i.e. the time in seconds taken by a physics tick - ret.interpolation_fraction = time_accum / p_frame_slice; + ret.interpolation_fraction = time_accum / p_physics_step; return ret; } // determine wall clock step since last iteration -float MainTimerSync::get_cpu_idle_step() { +float MainTimerSync::get_cpu_process_step() { uint64_t cpu_ticks_elapsed = current_cpu_ticks_usec - last_cpu_ticks_usec; last_cpu_ticks_usec = current_cpu_ticks_usec; @@ -219,9 +219,9 @@ void MainTimerSync::set_fixed_fps(int p_fixed_fps) { fixed_fps = p_fixed_fps; } -// advance one frame, return timesteps to take -MainFrameTime MainTimerSync::advance(float p_frame_slice, int p_iterations_per_second) { - float cpu_idle_step = get_cpu_idle_step(); +// advance one physics frame, return timesteps to take +MainFrameTime MainTimerSync::advance(float p_physics_step, int p_physics_fps) { + float cpu_process_step = get_cpu_process_step(); - return advance_checked(p_frame_slice, p_iterations_per_second, cpu_idle_step); + return advance_checked(p_physics_step, p_physics_fps, cpu_process_step); } diff --git a/main/main_timer_sync.h b/main/main_timer_sync.h index f8497140cd..789e0c9d65 100644 --- a/main/main_timer_sync.h +++ b/main/main_timer_sync.h @@ -34,11 +34,11 @@ #include "core/config/engine.h" struct MainFrameTime { - float idle_step; // time to advance idles for (argument to process()) + float process_step; // delta time to advance during process() int physics_steps; // number of times to iterate the physics engine float interpolation_fraction; // fraction through the current physics tick - void clamp_idle(float min_idle_step, float max_idle_step); + void clamp_process_step(float min_process_step, float max_process_step); }; class MainTimerSync { @@ -49,7 +49,7 @@ class MainTimerSync { // logical game time since last physics timestep float time_accum = 0; - // current difference between wall clock time and reported sum of idle_steps + // current difference between wall clock time and reported sum of process_steps float time_deficit = 0; // number of frames back for keeping accumulated physics steps roughly constant. @@ -67,7 +67,7 @@ class MainTimerSync { int fixed_fps = 0; protected: - // returns the fraction of p_frame_slice required for the timer to overshoot + // returns the fraction of p_physics_step required for the timer to overshoot // before advance_core considers changing the physics_steps return from // the typical values as defined by typical_physics_steps float get_physics_jitter_fix(); @@ -76,14 +76,14 @@ protected: // return value: number of frames back this data is consistent int get_average_physics_steps(float &p_min, float &p_max); - // advance physics clock by p_idle_step, return appropriate number of steps to simulate - MainFrameTime advance_core(float p_frame_slice, int p_iterations_per_second, float p_idle_step); + // advance physics clock by p_process_step, return appropriate number of steps to simulate + MainFrameTime advance_core(float p_physics_step, int p_physics_fps, float p_process_step); // calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero - MainFrameTime advance_checked(float p_frame_slice, int p_iterations_per_second, float p_idle_step); + MainFrameTime advance_checked(float p_physics_step, int p_physics_fps, float p_process_step); // determine wall clock step since last iteration - float get_cpu_idle_step(); + float get_cpu_process_step(); public: MainTimerSync(); @@ -96,7 +96,7 @@ public: void set_fixed_fps(int p_fixed_fps); // advance one frame, return timesteps to take - MainFrameTime advance(float p_frame_slice, int p_iterations_per_second); + MainFrameTime advance(float p_physics_step, int p_physics_fps); }; #endif // MAIN_TIMER_SYNC_H diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 3adeaefbaf..5eaa1741ea 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -4888,12 +4888,12 @@ GLTFCameraIndex GLTFDocument::_convert_camera(Ref<GLTFState> state, Camera3D *p_ if (p_camera->get_projection() == Camera3D::Projection::PROJECTION_PERSPECTIVE) { c->set_perspective(true); c->set_fov_size(p_camera->get_fov()); - c->set_zfar(p_camera->get_zfar()); - c->set_znear(p_camera->get_znear()); + c->set_zfar(p_camera->get_far()); + c->set_znear(p_camera->get_near()); } else { c->set_fov_size(p_camera->get_fov()); - c->set_zfar(p_camera->get_zfar()); - c->set_znear(p_camera->get_znear()); + c->set_zfar(p_camera->get_far()); + c->set_znear(p_camera->get_near()); } GLTFCameraIndex camera_index = state->cameras.size(); state->cameras.push_back(c); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index d4fbecd60f..55cc0bfb9d 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -724,7 +724,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In return true; } else { selected_palette = -1; - mesh_library_palette->unselect_all(); + mesh_library_palette->deselect_all(); update_palette(); _update_cursor_instance(); return true; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index b90fb3ce6e..7260bca93a 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -139,7 +139,7 @@ MainLoop *OS_Android::get_main_loop() const { void OS_Android::main_loop_begin() { if (main_loop) - main_loop->init(); + main_loop->initialize(); } bool OS_Android::main_loop_iterate() { @@ -151,7 +151,7 @@ bool OS_Android::main_loop_iterate() { void OS_Android::main_loop_end() { if (main_loop) - main_loop->finish(); + main_loop->finalize(); } void OS_Android::main_loop_focusout() { diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index dac61f2d9d..7d95b493b0 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -149,7 +149,7 @@ void OSIPhone::set_main_loop(MainLoop *p_main_loop) { main_loop = p_main_loop; if (main_loop) { - main_loop->init(); + main_loop->initialize(); } } @@ -159,7 +159,7 @@ MainLoop *OSIPhone::get_main_loop() const { void OSIPhone::delete_main_loop() { if (main_loop) { - main_loop->finish(); + main_loop->finalize(); memdelete(main_loop); }; diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 0bdf8dbf2e..4bc3c9421e 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -246,7 +246,7 @@ void OS_LinuxBSD::run() { return; } - main_loop->init(); + main_loop->initialize(); //uint64_t last_ticks=get_ticks_usec(); @@ -263,7 +263,7 @@ void OS_LinuxBSD::run() { } }; - main_loop->finish(); + main_loop->finalize(); } void OS_LinuxBSD::disable_crash_handler() { diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 3c9dbcb432..c3e362bbe8 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -312,7 +312,7 @@ void OS_OSX::run() { if (!main_loop) return; - main_loop->init(); + main_loop->initialize(); bool quit = false; while (!force_quit && !quit) { @@ -329,7 +329,7 @@ void OS_OSX::run() { ERR_PRINT("NSException: " + String([exception reason].UTF8String)); } }; - main_loop->finish(); + main_loop->finalize(); } Error OS_OSX::move_to_trash(const String &p_path) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 451f3bf18c..bdc1f0973f 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -614,7 +614,7 @@ void OS_Windows::run() { if (!main_loop) return; - main_loop->init(); + main_loop->initialize(); while (!force_quit) { DisplayServer::get_singleton()->process_events(); // get rid of pending events @@ -622,7 +622,7 @@ void OS_Windows::run() { break; }; - main_loop->finish(); + main_loop->finalize(); } MainLoop *OS_Windows::get_main_loop() const { diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 178c5c8ff8..2e47f9f4a3 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -476,13 +476,13 @@ void Camera3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_fov"), &Camera3D::get_fov); ClassDB::bind_method(D_METHOD("get_frustum_offset"), &Camera3D::get_frustum_offset); ClassDB::bind_method(D_METHOD("get_size"), &Camera3D::get_size); - ClassDB::bind_method(D_METHOD("get_zfar"), &Camera3D::get_zfar); - ClassDB::bind_method(D_METHOD("get_znear"), &Camera3D::get_znear); + ClassDB::bind_method(D_METHOD("get_far"), &Camera3D::get_far); + ClassDB::bind_method(D_METHOD("get_near"), &Camera3D::get_near); ClassDB::bind_method(D_METHOD("set_fov"), &Camera3D::set_fov); ClassDB::bind_method(D_METHOD("set_frustum_offset"), &Camera3D::set_frustum_offset); ClassDB::bind_method(D_METHOD("set_size"), &Camera3D::set_size); - ClassDB::bind_method(D_METHOD("set_zfar"), &Camera3D::set_zfar); - ClassDB::bind_method(D_METHOD("set_znear"), &Camera3D::set_znear); + ClassDB::bind_method(D_METHOD("set_far"), &Camera3D::set_far); + ClassDB::bind_method(D_METHOD("set_near"), &Camera3D::set_near); ClassDB::bind_method(D_METHOD("get_projection"), &Camera3D::get_projection); ClassDB::bind_method(D_METHOD("set_projection"), &Camera3D::set_projection); ClassDB::bind_method(D_METHOD("set_h_offset", "ofs"), &Camera3D::set_h_offset); @@ -519,8 +519,8 @@ void Camera3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fov", PROPERTY_HINT_RANGE, "1,179,0.1"), "set_fov", "get_fov"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size", PROPERTY_HINT_RANGE, "0.1,16384,0.01"), "set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "frustum_offset"), "set_frustum_offset", "get_frustum_offset"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "near", PROPERTY_HINT_EXP_RANGE, "0.001,10,0.001,or_greater"), "set_znear", "get_znear"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "far", PROPERTY_HINT_EXP_RANGE, "0.01,4000,0.01,or_greater"), "set_zfar", "get_zfar"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "near", PROPERTY_HINT_EXP_RANGE, "0.001,10,0.001,or_greater"), "set_near", "get_near"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "far", PROPERTY_HINT_EXP_RANGE, "0.01,4000,0.01,or_greater"), "set_far", "get_far"); BIND_ENUM_CONSTANT(PROJECTION_PERSPECTIVE); BIND_ENUM_CONSTANT(PROJECTION_ORTHOGONAL); @@ -542,7 +542,7 @@ float Camera3D::get_size() const { return size; } -float Camera3D::get_znear() const { +float Camera3D::get_near() const { return near; } @@ -550,7 +550,7 @@ Vector2 Camera3D::get_frustum_offset() const { return frustum_offset; } -float Camera3D::get_zfar() const { +float Camera3D::get_far() const { return far; } @@ -572,8 +572,8 @@ void Camera3D::set_size(float p_size) { _change_notify("size"); } -void Camera3D::set_znear(float p_znear) { - near = p_znear; +void Camera3D::set_near(float p_near) { + near = p_near; _update_camera_mode(); } @@ -582,8 +582,8 @@ void Camera3D::set_frustum_offset(Vector2 p_offset) { _update_camera_mode(); } -void Camera3D::set_zfar(float p_zfar) { - far = p_zfar; +void Camera3D::set_far(float p_far) { + far = p_far; _update_camera_mode(); } diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h index 04cec92b14..8b99f78370 100644 --- a/scene/3d/camera_3d.h +++ b/scene/3d/camera_3d.h @@ -121,16 +121,16 @@ public: float get_fov() const; float get_size() const; - float get_zfar() const; - float get_znear() const; + float get_far() const; + float get_near() const; Vector2 get_frustum_offset() const; Projection get_projection() const; void set_fov(float p_fov); void set_size(float p_size); - void set_zfar(float p_zfar); - void set_znear(float p_znear); + void set_far(float p_far); + void set_near(float p_near); void set_frustum_offset(Vector2 p_offset); virtual Transform get_camera_transform() const; 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/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp index abcec289ca..47b0536843 100644 --- a/scene/3d/xr_nodes.cpp +++ b/scene/3d/xr_nodes.cpp @@ -91,9 +91,9 @@ Vector3 XRCamera3D::project_local_ray_normal(const Point2 &p_pos) const { Vector2 cpos = get_viewport()->get_camera_coords(p_pos); Vector3 ray; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); Vector2 screen_he = cm.get_viewport_half_extents(); - ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -get_znear()).normalized(); + ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -get_near()).normalized(); return ray; }; @@ -113,7 +113,7 @@ Point2 XRCamera3D::unproject_position(const Vector3 &p_pos) const { Size2 viewport_size = get_viewport()->get_visible_rect().size; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); Plane p(get_camera_transform().xform_inv(p_pos), 1.0); @@ -142,7 +142,7 @@ Vector3 XRCamera3D::project_position(const Point2 &p_point, float p_z_depth) con Size2 viewport_size = get_viewport()->get_visible_rect().size; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); Vector2 vp_he = cm.get_viewport_half_extents(); @@ -170,7 +170,7 @@ Vector<Plane> XRCamera3D::get_frustum() const { ERR_FAIL_COND_V(!is_inside_world(), Vector<Plane>()); Size2 viewport_size = get_viewport()->get_visible_rect().size; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); return cm.get_projection_planes(get_camera_transform()); }; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index bac7e56aac..78abacea42 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2913,7 +2913,8 @@ void Control::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_global_position", PROPERTY_HINT_NONE, "", 0), "_set_global_position", "get_global_position"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rect_rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_lesser,or_greater"), "set_rotation_degrees", "get_rotation_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rect_rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_rotation", "get_rotation"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rect_rotation_degrees", PROPERTY_HINT_RANGE, "-360,360,0.1,or_lesser,or_greater"), "set_rotation_degrees", "get_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_scale"), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_pivot_offset"), "set_pivot_offset", "get_pivot_offset"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rect_clip_content"), "set_clip_contents", "is_clipping_contents"); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 3da12c038a..fa29bedd62 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -136,7 +136,7 @@ void FileDialog::update_dir() { } // Deselect any item, to make "Select Current Folder" button text by default. - deselect_items(); + deselect_all(); } void FileDialog::_dir_entered(String p_dir) { @@ -172,7 +172,7 @@ void FileDialog::_post_popup() { // For open dir mode, deselect all items on file dialog open. if (mode == FILE_MODE_OPEN_DIR) { - deselect_items(); + deselect_all(); file_box->set_visible(false); } else { file_box->set_visible(true); @@ -318,7 +318,7 @@ void FileDialog::_go_up() { update_dir(); } -void FileDialog::deselect_items() { +void FileDialog::deselect_all() { // Clear currently selected items in file manager. tree->deselect_all(); @@ -808,7 +808,7 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_file_name"), &FileDialog::update_file_name); ClassDB::bind_method(D_METHOD("_update_dir"), &FileDialog::update_dir); ClassDB::bind_method(D_METHOD("_update_file_list"), &FileDialog::update_file_list); - ClassDB::bind_method(D_METHOD("deselect_items"), &FileDialog::deselect_items); + ClassDB::bind_method(D_METHOD("deselect_all"), &FileDialog::deselect_all); ClassDB::bind_method(D_METHOD("invalidate"), &FileDialog::invalidate); @@ -932,7 +932,7 @@ FileDialog::FileDialog() { tree->connect("multi_selected", callable_mp(this, &FileDialog::_tree_multi_selected), varray(), CONNECT_DEFERRED); tree->connect("cell_selected", callable_mp(this, &FileDialog::_tree_selected), varray(), CONNECT_DEFERRED); tree->connect("item_activated", callable_mp(this, &FileDialog::_tree_item_activated), varray()); - tree->connect("nothing_selected", callable_mp(this, &FileDialog::deselect_items)); + tree->connect("nothing_selected", callable_mp(this, &FileDialog::deselect_all)); dir->connect("text_entered", callable_mp(this, &FileDialog::_dir_entered)); file->connect("text_entered", callable_mp(this, &FileDialog::_file_entered)); filter->connect("item_selected", callable_mp(this, &FileDialog::_filter_selected)); diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 8003650668..3649a30756 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -170,7 +170,7 @@ public: void invalidate(); - void deselect_items(); + void deselect_all(); FileDialog(); ~FileDialog(); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index c010616aed..ce68aeeeed 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1081,13 +1081,13 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (!gn->is_selected() && box_selection_mode_additive) { emit_signal("node_selected", gn); } else if (gn->is_selected() && !box_selection_mode_additive) { - emit_signal("node_unselected", gn); + emit_signal("node_deselected", gn); } gn->set_selected(box_selection_mode_additive); } else { bool select = (previus_selected.find(gn) != nullptr); if (gn->is_selected() && !select) { - emit_signal("node_unselected", gn); + emit_signal("node_deselected", gn); } else if (!gn->is_selected() && select) { emit_signal("node_selected", gn); } @@ -1112,7 +1112,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { bool select = (previus_selected.find(gn) != nullptr); if (gn->is_selected() && !select) { - emit_signal("node_unselected", gn); + emit_signal("node_deselected", gn); } else if (!gn->is_selected() && select) { emit_signal("node_selected", gn); } @@ -1141,7 +1141,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { Rect2 r = gn->get_rect(); r.size *= zoom; if (r.has_point(b->get_position())) { - emit_signal("node_unselected", gn); + emit_signal("node_deselected", gn); gn->set_selected(false); } } @@ -1204,7 +1204,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { o_gn->set_selected(true); } else { if (o_gn->is_selected()) { - emit_signal("node_unselected", o_gn); + emit_signal("node_deselected", o_gn); } o_gn->set_selected(false); } @@ -1264,7 +1264,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { continue; } if (gn2->is_selected()) { - emit_signal("node_unselected", gn2); + emit_signal("node_deselected", gn2); } gn2->set_selected(false); } @@ -1628,7 +1628,7 @@ void GraphEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("copy_nodes_request")); ADD_SIGNAL(MethodInfo("paste_nodes_request")); ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); - ADD_SIGNAL(MethodInfo("node_unselected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); + ADD_SIGNAL(MethodInfo("node_deselected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING_NAME, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position"))); ADD_SIGNAL(MethodInfo("connection_from_empty", PropertyInfo(Variant::STRING_NAME, "to"), PropertyInfo(Variant::INT, "to_slot"), PropertyInfo(Variant::VECTOR2, "release_position"))); ADD_SIGNAL(MethodInfo("delete_nodes_request")); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 221e74d35b..30610c63b5 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -333,7 +333,7 @@ void ItemList::select(int p_idx, bool p_single) { update(); } -void ItemList::unselect(int p_idx) { +void ItemList::deselect(int p_idx) { ERR_FAIL_INDEX(p_idx, items.size()); if (select_mode != SELECT_MULTI) { @@ -345,7 +345,7 @@ void ItemList::unselect(int p_idx) { update(); } -void ItemList::unselect_all() { +void ItemList::deselect_all() { if (items.size() < 1) { return; } @@ -573,7 +573,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { int i = closest; if (select_mode == SELECT_MULTI && items[i].selected && mb->get_command()) { - unselect(i); + deselect(i); emit_signal("multi_selected", i, false); } else if (select_mode == SELECT_MULTI && mb->get_shift() && current >= 0 && current < items.size() && current != i) { @@ -759,7 +759,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { select(current, false); emit_signal("multi_selected", current, true); } else if (items[current].selected) { - unselect(current); + deselect(current); emit_signal("multi_selected", current, false); } } @@ -1519,8 +1519,8 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("get_item_tooltip", "idx"), &ItemList::get_item_tooltip); ClassDB::bind_method(D_METHOD("select", "idx", "single"), &ItemList::select, DEFVAL(true)); - ClassDB::bind_method(D_METHOD("unselect", "idx"), &ItemList::unselect); - ClassDB::bind_method(D_METHOD("unselect_all"), &ItemList::unselect_all); + ClassDB::bind_method(D_METHOD("deselect", "idx"), &ItemList::deselect); + ClassDB::bind_method(D_METHOD("deselect_all"), &ItemList::deselect_all); ClassDB::bind_method(D_METHOD("is_selected", "idx"), &ItemList::is_selected); ClassDB::bind_method(D_METHOD("get_selected_items"), &ItemList::get_selected_items); diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 9684ce0a32..281814e178 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -183,8 +183,8 @@ public: Color get_item_custom_fg_color(int p_idx) const; void select(int p_idx, bool p_single = true); - void unselect(int p_idx); - void unselect_all(); + void deselect(int p_idx); + void deselect_all(); bool is_selected(int p_idx) const; Vector<int> get_selected_items(); bool is_anything_selected(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index b0e5196cef..402d047ccd 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 9fbffb1246..58bc6099f6 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; diff --git a/tests/test_file_access.h b/tests/test_file_access.h index 0d5c9d79ce..a55d846360 100644 --- a/tests/test_file_access.h +++ b/tests/test_file_access.h @@ -32,11 +32,12 @@ #define TEST_FILE_ACCESS_H #include "core/os/file_access.h" +#include "test_utils.h" namespace TestFileAccess { TEST_CASE("[FileAccess] CSV read") { - FileAccess *f = FileAccess::open("tests/data/translations.csv", FileAccess::READ); + FileAccess *f = FileAccess::open(TestUtils::get_data_path("translations.csv"), FileAccess::READ); Vector<String> header = f->get_csv_line(); // Default delimiter: "," REQUIRE(header.size() == 3); diff --git a/tests/test_gui.cpp b/tests/test_gui.cpp index a4559687c8..a1a5ca0d4e 100644 --- a/tests/test_gui.cpp +++ b/tests/test_gui.cpp @@ -63,8 +63,8 @@ public: virtual void request_quit() { quit(); } - virtual void init() { - SceneTree::init(); + virtual void initialize() { + SceneTree::initialize(); Panel *frame = memnew(Panel); frame->set_anchor(SIDE_RIGHT, Control::ANCHOR_END); diff --git a/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp index d40df52f1b..47dce78e83 100644 --- a/tests/test_physics_2d.cpp +++ b/tests/test_physics_2d.cpp @@ -315,7 +315,7 @@ protected: } public: - virtual void init() override { + virtual void initialize() override { RenderingServer *vs = RenderingServer::get_singleton(); PhysicsServer2D *ps = PhysicsServer2D::get_singleton(); @@ -389,10 +389,10 @@ public: //_add_plane(Vector2(-1,0).normalized(),-600); } - virtual bool idle(float p_time) override { + virtual bool process(float p_time) override { return false; } - virtual void finish() override { + virtual void finalize() override { } TestPhysics2DMainLoop() {} diff --git a/tests/test_physics_3d.cpp b/tests/test_physics_3d.cpp index 5f84b2eb50..2a0c34320a 100644 --- a/tests/test_physics_3d.cpp +++ b/tests/test_physics_3d.cpp @@ -122,7 +122,7 @@ protected: ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_BOUNCE, p_bounce); } - void init_shapes() { + void initialize_shapes() { RenderingServer *vs = RenderingServer::get_singleton(); PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); @@ -269,9 +269,9 @@ public: virtual void request_quit() { quit = true; } - virtual void init() override { + virtual void initialize() override { ofs_x = ofs_y = 0; - init_shapes(); + initialize_shapes(); PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); space = ps->space_create(); @@ -310,7 +310,7 @@ public: test_fall(); quit = false; } - virtual bool iteration(float p_time) override { + virtual bool physics_process(float p_time) override { if (mover.is_valid()) { static float joy_speed = 10; PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); @@ -328,7 +328,7 @@ public: return quit; } - virtual void finish() override { + virtual void finalize() override { } void test_joint() { @@ -396,7 +396,7 @@ public: create_static_plane(Plane(Vector3(0, 1, 0), -1)); } - virtual bool idle(float p_time) override { + virtual bool process(float p_time) override { return false; } diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp new file mode 100644 index 0000000000..ad5ba94aea --- /dev/null +++ b/tests/test_utils.cpp @@ -0,0 +1,42 @@ +/*************************************************************************/ +/* test_utils.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "test_utils.h" + +#include "core/os/os.h" + +String TestUtils::get_data_path(const String &p_file) { + String data_path = "../tests/data"; + return get_executable_dir().plus_file(data_path.plus_file(p_file)); +} + +String TestUtils::get_executable_dir() { + return OS::get_singleton()->get_executable_path().get_base_dir(); +} diff --git a/tests/test_utils.h b/tests/test_utils.h new file mode 100644 index 0000000000..1f93860b7f --- /dev/null +++ b/tests/test_utils.h @@ -0,0 +1,42 @@ +/*************************************************************************/ +/* test_utils.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef TEST_UTILS_H +#define TEST_UTILS_H + +#include "core/string/ustring.h" + +namespace TestUtils { + +String get_data_path(const String &p_file); +String get_executable_dir(); +} // namespace TestUtils + +#endif // TEST_UTILS_H |