diff options
54 files changed, 245 insertions, 277 deletions
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp index 5b5bfaecb5..5ac86798a6 100644 --- a/core/core_string_names.cpp +++ b/core/core_string_names.cpp @@ -35,7 +35,6 @@ CoreStringNames *CoreStringNames::singleton = nullptr; CoreStringNames::CoreStringNames() : _free(StaticCString::create("free")), changed(StaticCString::create("changed")), - _meta(StaticCString::create("__meta__")), _script(StaticCString::create("script")), script_changed(StaticCString::create("script_changed")), ___pdcdata(StaticCString::create("___pdcdata")), diff --git a/core/core_string_names.h b/core/core_string_names.h index 2cd4e335b2..6d4edabc68 100644 --- a/core/core_string_names.h +++ b/core/core_string_names.h @@ -52,7 +52,6 @@ public: StringName _free; StringName changed; - StringName _meta; StringName _script; StringName script_changed; StringName ___pdcdata; diff --git a/core/debugger/engine_profiler.cpp b/core/debugger/engine_profiler.cpp index 6235d19405..b99ee7dd5a 100644 --- a/core/debugger/engine_profiler.cpp +++ b/core/debugger/engine_profiler.cpp @@ -35,7 +35,7 @@ void EngineProfiler::_bind_methods() { GDVIRTUAL_BIND(_toggle, "enable", "options"); GDVIRTUAL_BIND(_add_frame, "data"); - GDVIRTUAL_BIND(_tick, "frame_time", "idle_time", "physics_time", "physics_frame_time"); + GDVIRTUAL_BIND(_tick, "frame_time", "process_time", "physics_time", "physics_frame_time"); } void EngineProfiler::toggle(bool p_enable, const Array &p_array) { @@ -46,8 +46,8 @@ void EngineProfiler::add(const Array &p_data) { GDVIRTUAL_CALL(_add_frame, p_data); } -void EngineProfiler::tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { - GDVIRTUAL_CALL(_tick, p_frame_time, p_idle_time, p_physics_time, p_physics_frame_time); +void EngineProfiler::tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { + GDVIRTUAL_CALL(_tick, p_frame_time, p_process_time, p_physics_time, p_physics_frame_time); } Error EngineProfiler::bind(const String &p_name) { @@ -60,8 +60,8 @@ Error EngineProfiler::bind(const String &p_name) { [](void *p_user, const Array &p_data) { static_cast<EngineProfiler *>(p_user)->add(p_data); }, - [](void *p_user, double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { - static_cast<EngineProfiler *>(p_user)->tick(p_frame_time, p_idle_time, p_physics_time, p_physics_frame_time); + [](void *p_user, double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { + static_cast<EngineProfiler *>(p_user)->tick(p_frame_time, p_process_time, p_physics_time, p_physics_frame_time); }); registration = p_name; EngineDebugger::register_profiler(p_name, prof); diff --git a/core/debugger/engine_profiler.h b/core/debugger/engine_profiler.h index ade280a7bb..e50924a1ed 100644 --- a/core/debugger/engine_profiler.h +++ b/core/debugger/engine_profiler.h @@ -48,7 +48,7 @@ protected: public: virtual void toggle(bool p_enable, const Array &p_opts); virtual void add(const Array &p_data); - virtual void tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time); + virtual void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time); Error bind(const String &p_name); Error unbind(); diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp index 131cbaed6c..4ed4c97c64 100644 --- a/core/debugger/local_debugger.cpp +++ b/core/debugger/local_debugger.cpp @@ -60,7 +60,7 @@ struct LocalDebugger::ScriptsProfiler { } } - void tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { + void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { frame_time = p_frame_time; _print_frame_data(false); } @@ -372,8 +372,8 @@ LocalDebugger::LocalDebugger() { static_cast<ScriptsProfiler *>(p_user)->toggle(p_enable, p_opts); }, nullptr, - [](void *p_user, double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { - static_cast<ScriptsProfiler *>(p_user)->tick(p_frame_time, p_idle_time, p_physics_time, p_physics_frame_time); + [](void *p_user, double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { + static_cast<ScriptsProfiler *>(p_user)->tick(p_frame_time, p_process_time, p_physics_time, p_physics_frame_time); }); register_profiler("scripts", scr_prof); } diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index c3506a7eea..5ee4e2c368 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -107,7 +107,7 @@ public: } } - void tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { + void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { uint64_t pt = OS::get_singleton()->get_ticks_msec(); if (pt - last_bandwidth_time > 200) { last_bandwidth_time = pt; @@ -130,7 +130,7 @@ class RemoteDebugger::PerformanceProfiler : public EngineProfiler { public: void toggle(bool p_enable, const Array &p_opts) {} void add(const Array &p_data) {} - void tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { + void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { if (!performance) { return; } diff --git a/core/extension/native_extension.cpp b/core/extension/native_extension.cpp index 441bdd2ac4..db1cbd53b4 100644 --- a/core/extension/native_extension.cpp +++ b/core/extension/native_extension.cpp @@ -74,7 +74,7 @@ public: virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { Variant ret; - GDExtensionClassInstancePtr extension_instance = p_object->_get_extension_instance(); + GDExtensionClassInstancePtr extension_instance = is_static() ? nullptr : p_object->_get_extension_instance(); GDNativeCallError ce{ GDNATIVE_CALL_OK, 0, 0 }; call_func(method_userdata, extension_instance, (const GDNativeVariantPtr *)p_args, p_arg_count, (GDNativeVariantPtr)&ret, &ce); r_error.error = Callable::CallError::Error(ce.error); @@ -91,6 +91,7 @@ public: virtual bool is_vararg() const override { return false; } + explicit NativeExtensionMethodBind(const GDNativeExtensionClassMethodInfo *p_method_info) { method_userdata = p_method_info->method_userdata; call_func = p_method_info->call_func; @@ -100,14 +101,24 @@ public: get_argument_metadata_func = p_method_info->get_argument_metadata_func; set_name(p_method_info->name); - vararg = p_method_info->method_flags & GDNATIVE_EXTENSION_METHOD_FLAG_VARARG; + set_hint_flags(p_method_info->method_flags); + vararg = p_method_info->method_flags & GDNATIVE_EXTENSION_METHOD_FLAG_VARARG; _set_returns(p_method_info->has_return_value); _set_const(p_method_info->method_flags & GDNATIVE_EXTENSION_METHOD_FLAG_CONST); + _set_static(p_method_info->method_flags & GDNATIVE_EXTENSION_METHOD_FLAG_STATIC); #ifdef DEBUG_METHODS_ENABLED _generate_argument_types(p_method_info->argument_count); #endif set_argument_count(p_method_info->argument_count); + + Vector<Variant> defargs; + defargs.resize(p_method_info->default_argument_count); + for (uint32_t i = 0; i < p_method_info->default_argument_count; i++) { + defargs.write[i] = *static_cast<Variant *>(p_method_info->default_arguments[i]); + } + + set_default_arguments(defargs); } }; diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 4212b43621..284b4294ea 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -47,7 +47,7 @@ int AStar3D::get_available_point_id() const { void AStar3D::add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale) { ERR_FAIL_COND_MSG(p_id < 0, vformat("Can't add a point with negative id: %d.", p_id)); - ERR_FAIL_COND_MSG(p_weight_scale < 1, vformat("Can't add a point with weight scale less than one: %f.", p_weight_scale)); + ERR_FAIL_COND_MSG(p_weight_scale < 0.0, vformat("Can't add a point with weight scale less than 0.0: %f.", p_weight_scale)); Point *found_pt; bool p_exists = points.lookup(p_id, found_pt); @@ -96,7 +96,7 @@ void AStar3D::set_point_weight_scale(int p_id, real_t p_weight_scale) { Point *p; bool p_exists = points.lookup(p_id, p); ERR_FAIL_COND_MSG(!p_exists, vformat("Can't set point's weight scale. Point with id: %d doesn't exist.", p_id)); - ERR_FAIL_COND_MSG(p_weight_scale < 1, vformat("Can't set point's weight scale less than one: %f.", p_weight_scale)); + ERR_FAIL_COND_MSG(p_weight_scale < 0.0, vformat("Can't set point's weight scale less than 0.0: %f.", p_weight_scale)); p->weight_scale = p_weight_scale; } diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index e79da748e9..e69bd88413 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -1620,6 +1620,27 @@ Variant::operator String() const { return stringify(0); } +String stringify_variant_clean(const Variant p_variant, int recursion_count) { + String s = p_variant.stringify(recursion_count); + + // Wrap strings in quotes to avoid ambiguity. + switch (p_variant.get_type()) { + case Variant::STRING: { + s = s.c_escape().quote(); + } break; + case Variant::STRING_NAME: { + s = "&" + s.c_escape().quote(); + } break; + case Variant::NODE_PATH: { + s = "^" + s.c_escape().quote(); + } break; + default: { + } break; + } + + return s; +} + template <class T> String stringify_vector(const T &vec, int recursion_count) { String str("["); @@ -1627,7 +1648,8 @@ String stringify_vector(const T &vec, int recursion_count) { if (i > 0) { str += ", "; } - str = str + Variant(vec[i]).stringify(recursion_count); + + str += stringify_variant_clean(vec[i], recursion_count); } str += "]"; return str; @@ -1691,8 +1713,8 @@ String Variant::stringify(int recursion_count) const { recursion_count++; for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { _VariantStrPair sp; - sp.key = E->get().stringify(recursion_count); - sp.value = d[E->get()].stringify(recursion_count); + sp.key = stringify_variant_clean(E->get(), recursion_count); + sp.value = stringify_variant_clean(d[E->get()], recursion_count); pairs.push_back(sp); } @@ -1741,8 +1763,7 @@ String Variant::stringify(int recursion_count) const { return "[...]"; } - String str = stringify_vector(arr, recursion_count); - return str; + return stringify_vector(arr, recursion_count); } break; case OBJECT: { diff --git a/doc/classes/AStar2D.xml b/doc/classes/AStar2D.xml index 4b65a64389..7a27568d30 100644 --- a/doc/classes/AStar2D.xml +++ b/doc/classes/AStar2D.xml @@ -33,7 +33,7 @@ <argument index="1" name="position" type="Vector2" /> <argument index="2" name="weight_scale" type="float" default="1.0" /> <description> - Adds a new point at the given position with the given identifier. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 1 or larger. + Adds a new point at the given position with the given identifier. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 0.0 or greater. The [code]weight_scale[/code] is multiplied by the result of [method _compute_cost] when determining the overall cost of traveling across a segment from a neighboring point to this point. Thus, all else being equal, the algorithm prefers points with lower [code]weight_scale[/code]s to form a path. [codeblocks] [gdscript] diff --git a/doc/classes/AStar3D.xml b/doc/classes/AStar3D.xml index 3087b9e363..33407c3e74 100644 --- a/doc/classes/AStar3D.xml +++ b/doc/classes/AStar3D.xml @@ -62,7 +62,7 @@ <argument index="1" name="position" type="Vector3" /> <argument index="2" name="weight_scale" type="float" default="1.0" /> <description> - Adds a new point at the given position with the given identifier. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 1 or larger. + Adds a new point at the given position with the given identifier. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 0.0 or greater. The [code]weight_scale[/code] is multiplied by the result of [method _compute_cost] when determining the overall cost of traveling across a segment from a neighboring point to this point. Thus, all else being equal, the algorithm prefers points with lower [code]weight_scale[/code]s to form a path. [codeblocks] [gdscript] diff --git a/doc/classes/EngineProfiler.xml b/doc/classes/EngineProfiler.xml index 45eb926108..752ecda867 100644 --- a/doc/classes/EngineProfiler.xml +++ b/doc/classes/EngineProfiler.xml @@ -20,11 +20,11 @@ <method name="_tick" qualifiers="virtual"> <return type="void" /> <argument index="0" name="frame_time" type="float" /> - <argument index="1" name="idle_time" type="float" /> + <argument index="1" name="process_time" type="float" /> <argument index="2" name="physics_time" type="float" /> <argument index="3" name="physics_frame_time" type="float" /> <description> - Called once every engine iteration when the profiler is active with information about the current frame. + Called once every engine iteration when the profiler is active with information about the current frame. All time values are in seconds. Lower values represent faster processing times and are therefore considered better. </description> </method> <method name="_toggle" qualifiers="virtual"> diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index edfd8daec1..83e7eba5e5 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -407,19 +407,26 @@ </member> </members> <signals> + <signal name="empty_clicked"> + <argument index="0" name="at_position" type="Vector2" /> + <argument index="1" name="mouse_button_index" type="int" /> + <description> + Triggered when any mouse click is issued within the rect of the list but on empty space. + </description> + </signal> <signal name="item_activated"> <argument index="0" name="index" type="int" /> <description> Triggered when specified list item is activated via double-clicking or by pressing [kbd]Enter[/kbd]. </description> </signal> - <signal name="item_rmb_selected"> + <signal name="item_clicked"> <argument index="0" name="index" type="int" /> <argument index="1" name="at_position" type="Vector2" /> + <argument index="2" name="mouse_button_index" type="int" /> <description> - Triggered when specified list item has been selected via right mouse clicking. + Triggered when specified list item has been clicked with any mouse button. The click position is also provided to allow appropriate popup of context menus at the correct location. - [member allow_rmb_select] must be enabled. </description> </signal> <signal name="item_selected"> @@ -436,18 +443,6 @@ Triggered when a multiple selection is altered on a list allowing multiple selection. </description> </signal> - <signal name="nothing_selected"> - <description> - Triggered when a left mouse click is issued within the rect of the list but on empty space. - </description> - </signal> - <signal name="rmb_clicked"> - <argument index="0" name="at_position" type="Vector2" /> - <description> - Triggered when a right mouse click is issued within the rect of the list but on empty space. - [member allow_rmb_select] must be enabled. - </description> - </signal> </signals> <constants> <constant name="ICON_MODE_TOP" value="0" enum="IconMode"> diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index 01be5ae4fe..99355de361 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -136,10 +136,9 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, b TreeItem *input_item = category->get_first_child(); if (input_item != nullptr) { - // has_type this should be always true, unless the tree structure has been misconfigured. - bool has_type = input_item->get_parent()->has_meta("__type"); - int input_type = input_item->get_parent()->get_meta("__type"); - if (!has_type) { + // input_type should always be > 0, unless the tree structure has been misconfigured. + int input_type = input_item->get_parent()->get_meta("__type", 0); + if (input_type == 0) { return; } diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h index 1a65e2e3d6..2aef654a2f 100644 --- a/editor/debugger/editor_profiler.h +++ b/editor/debugger/editor_profiler.h @@ -49,7 +49,7 @@ public: int frame_number = 0; float frame_time = 0; - float idle_time = 0; + float process_time = 0; float physics_time = 0; float physics_frame_time = 0; diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 1c8d66e4be..90679657ba 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -606,7 +606,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da metric.valid = true; metric.frame_number = frame.frame_number; metric.frame_time = frame.frame_time; - metric.idle_time = frame.idle_time; + metric.process_time = frame.process_time; metric.physics_time = frame.physics_time; metric.physics_frame_time = frame.physics_frame_time; @@ -627,10 +627,10 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da frame_time.items.push_back(item); - item.name = "Idle Time"; - item.total = metric.idle_time; + item.name = "Process Time"; + item.total = metric.process_time; item.self = item.total; - item.signature = "idle_time"; + item.signature = "process_time"; frame_time.items.push_back(item); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 35f40a159a..54655f53b5 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -271,7 +271,11 @@ DependencyEditor::DependencyEditor() { } ///////////////////////////////////// -void DependencyEditorOwners::_list_rmb_select(int p_item, const Vector2 &p_pos) { +void DependencyEditorOwners::_list_rmb_clicked(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index != MouseButton::RIGHT) { + return; + } + file_options->clear(); file_options->reset_size(); if (p_item >= 0) { @@ -352,7 +356,7 @@ DependencyEditorOwners::DependencyEditorOwners() { owners = memnew(ItemList); owners->set_select_mode(ItemList::SELECT_SINGLE); - owners->connect("item_rmb_selected", callable_mp(this, &DependencyEditorOwners::_list_rmb_select)); + owners->connect("item_clicked", callable_mp(this, &DependencyEditorOwners::_list_rmb_clicked)); owners->connect("item_activated", callable_mp(this, &DependencyEditorOwners::_select_file)); owners->set_allow_rmb_select(true); add_child(owners); diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h index d1dc470c79..ea86f98193 100644 --- a/editor/dependency_editor.h +++ b/editor/dependency_editor.h @@ -78,7 +78,7 @@ class DependencyEditorOwners : public AcceptDialog { void _fill_owners(EditorFileSystemDirectory *efsd); static void _bind_methods(); - void _list_rmb_select(int p_item, const Vector2 &p_pos); + void _list_rmb_clicked(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index); void _select_file(int p_idx); void _file_option(int p_option); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 0129a6453d..84d656fc20 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -529,7 +529,11 @@ void EditorFileDialog::_multi_selected(int p_item, bool p_selected) { get_ok_button()->set_disabled(_is_open_should_be_disabled()); } -void EditorFileDialog::_items_clear_selection() { +void EditorFileDialog::_items_clear_selection(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index != MouseButton::LEFT) { + return; + } + item_list->deselect_all(); // If nothing is selected, then block Open button. @@ -583,7 +587,11 @@ void EditorFileDialog::_item_dc_selected(int p_item) { } } -void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p_pos) { +void EditorFileDialog::_item_list_item_rmb_clicked(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index != MouseButton::RIGHT) { + return; + } + // Right click on specific file(s) or folder(s). item_menu->clear(); item_menu->reset_size(); @@ -624,12 +632,20 @@ 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. +void EditorFileDialog::_item_list_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index != MouseButton::RIGHT && p_mouse_button_index != MouseButton::LEFT) { + return; + } + + // Left or 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->deselect(i); } + if (p_mouse_button_index != MouseButton::RIGHT) { + return; + } + item_menu->clear(); item_menu->reset_size(); @@ -1753,8 +1769,8 @@ EditorFileDialog::EditorFileDialog() { item_list = memnew(ItemList); item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); - item_list->connect("item_rmb_selected", callable_mp(this, &EditorFileDialog::_item_list_item_rmb_selected)); - item_list->connect("rmb_clicked", callable_mp(this, &EditorFileDialog::_item_list_rmb_clicked)); + item_list->connect("item_clicked", callable_mp(this, &EditorFileDialog::_item_list_item_rmb_clicked)); + item_list->connect("empty_clicked", callable_mp(this, &EditorFileDialog::_item_list_empty_clicked)); item_list->set_allow_rmb_select(true); list_vb->add_child(item_list); @@ -1799,7 +1815,7 @@ EditorFileDialog::EditorFileDialog() { item_list->connect("item_selected", callable_mp(this, &EditorFileDialog::_item_selected), varray(), CONNECT_DEFERRED); item_list->connect("multi_selected", callable_mp(this, &EditorFileDialog::_multi_selected), varray(), CONNECT_DEFERRED); item_list->connect("item_activated", callable_mp(this, &EditorFileDialog::_item_dc_selected), varray()); - item_list->connect("nothing_selected", callable_mp(this, &EditorFileDialog::_items_clear_selection)); + item_list->connect("empty_clicked", callable_mp(this, &EditorFileDialog::_items_clear_selection)); dir->connect("text_submitted", callable_mp(this, &EditorFileDialog::_dir_submitted)); file->connect("text_submitted", callable_mp(this, &EditorFileDialog::_file_submitted)); filter->connect("item_selected", callable_mp(this, &EditorFileDialog::_filter_selected)); diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 0460576bc5..d9a58a5b7f 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -165,11 +165,11 @@ private: void _item_selected(int p_item); void _multi_selected(int p_item, bool p_selected); - void _items_clear_selection(); + void _items_clear_selection(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index); void _item_dc_selected(int p_item); - void _item_list_item_rmb_selected(int p_item, const Vector2 &p_pos); - void _item_list_rmb_clicked(const Vector2 &p_pos); + void _item_list_item_rmb_clicked(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index); + void _item_list_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index); void _item_menu_id_pressed(int p_option); void _select_drive(int p_idx); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 934948ac9e..194021669f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1882,7 +1882,7 @@ void EditorNode::_dialog_action(String p_file) { ProjectSettings::get_singleton()->save(); // TODO: Would be nice to show the project manager opened with the highlighted field. - if (pick_main_scene->has_meta("from_native") && (bool)pick_main_scene->get_meta("from_native")) { + if ((bool)pick_main_scene->get_meta("from_native", false)) { run_native->resume_run_native(); } else { _run(false, ""); // Automatically run the project. diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index dcbe91bd7f..ab029c1d30 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -576,7 +576,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p TreeItem *selected = shortcuts->get_selected(); // Only allow drag for events - if (!selected || !selected->has_meta("type") || selected->get_meta("type") != "event") { + if (!selected || (String)selected->get_meta("type", "") != "event") { return Variant(); } @@ -593,7 +593,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p bool EditorSettingsDialog::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { TreeItem *selected = shortcuts->get_selected(); TreeItem *item = shortcuts->get_item_at_position(p_point); - if (!selected || !item || item == selected || !item->has_meta("type") || item->get_meta("type") != "event") { + if (!selected || !item || item == selected || (String)item->get_meta("type", "") != "event") { return false; } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 41356c1d56..47c016803c 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2637,7 +2637,11 @@ void FileSystemDock::_tree_empty_selected() { tree->deselect_all(); } -void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) { +void FileSystemDock::_file_list_rmb_clicked(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index != MouseButton::RIGHT) { + return; + } + // Right click is pressed in the file list. Vector<String> paths; for (int i = 0; i < files->get_item_count(); i++) { @@ -3128,7 +3132,7 @@ FileSystemDock::FileSystemDock() { files->set_v_size_flags(SIZE_EXPAND_FILL); files->set_select_mode(ItemList::SELECT_MULTI); files->set_drag_forwarding(this); - files->connect("item_rmb_selected", callable_mp(this, &FileSystemDock::_file_list_rmb_select)); + files->connect("item_clicked", callable_mp(this, &FileSystemDock::_file_list_rmb_clicked)); files->connect("gui_input", callable_mp(this, &FileSystemDock::_file_list_gui_input)); files->connect("multi_selected", callable_mp(this, &FileSystemDock::_file_multi_selected)); files->connect("rmb_clicked", callable_mp(this, &FileSystemDock::_file_list_rmb_pressed)); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 736651c17c..f6c4e271bf 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -260,7 +260,7 @@ private: void _file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options = true); void _tree_rmb_select(const Vector2 &p_pos); void _tree_rmb_empty(const Vector2 &p_pos); - void _file_list_rmb_select(int p_item, const Vector2 &p_pos); + void _file_list_rmb_clicked(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index); void _file_list_rmb_pressed(const Vector2 &p_pos); void _tree_empty_selected(); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 34079d0a4b..06a84ff23c 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -715,13 +715,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< bool isroot = p_node == p_root; - String import_id; - - if (p_node->has_meta("import_id")) { - import_id = p_node->get_meta("import_id"); - } else { - import_id = "PATH:" + p_root->get_path_to(p_node); - } + String import_id = p_node->get_meta("import_id", "PATH:" + p_root->get_path_to(p_node)); Dictionary node_settings; if (p_node_data.has(import_id)) { @@ -763,12 +757,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< for (int i = 0; i < m->get_surface_count(); i++) { Ref<Material> mat = m->get_surface_material(i); if (mat.is_valid()) { - String mat_id; - if (mat->has_meta("import_id")) { - mat_id = mat->get_meta("import_id"); - } else { - mat_id = mat->get_name(); - } + String mat_id = mat->get_meta("import_id", mat->get_name()); if (!mat_id.is_empty() && p_material_data.has(mat_id)) { Dictionary matdata = p_material_data[mat_id]; @@ -1591,13 +1580,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m bool bake_lightmaps = p_light_bake_mode == LIGHT_BAKE_STATIC_LIGHTMAPS; String save_to_file; - String mesh_id; - - if (src_mesh_node->get_mesh()->has_meta("import_id")) { - mesh_id = src_mesh_node->get_mesh()->get_meta("import_id"); - } else { - mesh_id = src_mesh_node->get_mesh()->get_name(); - } + String mesh_id = src_mesh_node->get_mesh()->get_meta("import_id", src_mesh_node->get_mesh()->get_name()); if (!mesh_id.is_empty() && p_mesh_data.has(mesh_id)) { Dictionary mesh_settings = p_mesh_data[mesh_id]; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d237697597..c129d705c9 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -236,7 +236,7 @@ public: }; bool CanvasItemEditor::_is_node_locked(const Node *p_node) { - return p_node->has_meta("_edit_lock_") && p_node->get_meta("_edit_lock_"); + return p_node->get_meta("_edit_lock_", false); } bool CanvasItemEditor::_is_node_movable(const Node *p_node, bool p_popup_warning) { @@ -420,16 +420,14 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig } if (((is_snap_active && snap_guides && (p_modes & SNAP_GUIDES)) || (p_forced_modes & SNAP_GUIDES)) && fmod(rotation, (real_t)360.0) == 0.0) { - // Guides - if (EditorNode::get_singleton()->get_edited_scene() && EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_vertical_guides_")) { - Array vguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_vertical_guides_"); + // Guides. + if (Node *scene = EditorNode::get_singleton()->get_edited_scene()) { + Array vguides = scene->get_meta("_edit_vertical_guides_", Array()); for (int i = 0; i < vguides.size(); i++) { _snap_if_closer_float(p_target.x, output.x, snap_target[0], vguides[i], SNAP_TARGET_GUIDE); } - } - if (EditorNode::get_singleton()->get_edited_scene() && EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_horizontal_guides_")) { - Array hguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_horizontal_guides_"); + Array hguides = scene->get_meta("_edit_horizontal_guides_", Array()); for (int i = 0; i < hguides.size(); i++) { _snap_if_closer_float(p_target.y, output.y, snap_target[1], hguides[i], SNAP_TARGET_GUIDE); } @@ -681,7 +679,7 @@ void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_n Node *scene = EditorNode::get_singleton()->get_edited_scene(); bool editable = p_node == scene || p_node->get_owner() == scene || p_node == scene->get_deepest_editable_node(p_node); - bool lock_children = p_node->has_meta("_edit_group_") && p_node->get_meta("_edit_group_"); + bool lock_children = p_node->get_meta("_edit_group_", false); bool locked = _is_node_locked(p_node); if (!lock_children || !editable) { @@ -1000,14 +998,8 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve if (show_guides && show_rulers && EditorNode::get_singleton()->get_edited_scene()) { Transform2D xform = viewport_scrollable->get_transform() * transform; // Retrieve the guide lists - Array vguides; - if (EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_vertical_guides_")) { - vguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_vertical_guides_"); - } - Array hguides; - if (EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_horizontal_guides_")) { - hguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_horizontal_guides_"); - } + Array vguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_vertical_guides_", Array()); + Array hguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_horizontal_guides_", Array()); // Hover over guides real_t minimum = 1e20; @@ -1100,14 +1092,8 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve Transform2D xform = viewport_scrollable->get_transform() * transform; // Retrieve the guide lists - Array vguides; - if (EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_vertical_guides_")) { - vguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_vertical_guides_"); - } - Array hguides; - if (EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_horizontal_guides_")) { - hguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_horizontal_guides_"); - } + Array vguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_vertical_guides_", Array()); + Array hguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_horizontal_guides_", Array()); Point2 edited = snap_point(xform.affine_inverse().xform(b->get_position()), SNAP_GRID | SNAP_PIXEL | SNAP_OTHER_NODES); if (drag_type == DRAG_V_GUIDE) { @@ -2712,9 +2698,9 @@ void CanvasItemEditor::_draw_guides() { Color guide_color = EditorSettings::get_singleton()->get("editors/2d/guides_color"); Transform2D xform = viewport_scrollable->get_transform() * transform; - // Guides already there - if (EditorNode::get_singleton()->get_edited_scene() && EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_vertical_guides_")) { - Array vguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_vertical_guides_"); + // Guides already there. + if (Node *scene = EditorNode::get_singleton()->get_edited_scene()) { + Array vguides = scene->get_meta("_edit_vertical_guides_", Array()); for (int i = 0; i < vguides.size(); i++) { if (drag_type == DRAG_V_GUIDE && i == dragged_guide_index) { continue; @@ -2722,10 +2708,8 @@ void CanvasItemEditor::_draw_guides() { real_t x = xform.xform(Point2(vguides[i], 0)).x; viewport->draw_line(Point2(x, 0), Point2(x, viewport->get_size().y), guide_color, Math::round(EDSCALE)); } - } - if (EditorNode::get_singleton()->get_edited_scene() && EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_horizontal_guides_")) { - Array hguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_horizontal_guides_"); + Array hguides = scene->get_meta("_edit_horizontal_guides_", Array()); for (int i = 0; i < hguides.size(); i++) { if (drag_type == DRAG_H_GUIDE && i == dragged_guide_index) { continue; @@ -2735,7 +2719,7 @@ void CanvasItemEditor::_draw_guides() { } } - // Dragged guide + // Dragged guide. Color text_color = get_theme_color(SNAME("font_color"), SNAME("Editor")); Color outline_color = text_color.inverted(); const float outline_size = 2; diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index 5ca8216d4d..4ab03c123b 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -509,7 +509,7 @@ void ControlEditorToolbar::_set_anchors_and_offsets_to_keep_ratio() { undo_redo->add_do_method(control, "set_anchor", SIDE_BOTTOM, bottom_right_anchor.y, false, true); undo_redo->add_do_method(control, "set_meta", "_edit_use_anchors_", true); - const bool use_anchors = control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_"); + const bool use_anchors = control->get_meta("_edit_use_anchors_", false); undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state()); if (use_anchors) { undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", true); @@ -617,7 +617,7 @@ void ControlEditorToolbar::_button_toggle_anchor_mode(bool p_status) { } bool ControlEditorToolbar::_is_node_locked(const Node *p_node) { - return p_node->has_meta("_edit_lock_") && p_node->get_meta("_edit_lock_"); + return p_node->get_meta("_edit_lock_", false); } List<Control *> ControlEditorToolbar::_get_edited_controls(bool retrieve_locked, bool remove_controls_if_parent_in_selection) { @@ -798,7 +798,7 @@ void ControlEditorToolbar::_selection_changed() { } nb_valid_controls++; - if (control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_")) { + if (control->get_meta("_edit_use_anchors_", false)) { nb_anchors_mode++; } } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 23ff7fc7d6..d2af13d7fa 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1265,7 +1265,7 @@ void Node3DEditorViewport::_surface_focus_exit() { } bool Node3DEditorViewport ::_is_node_locked(const Node *p_node) { - return p_node->has_meta("_edit_lock_") && p_node->get_meta("_edit_lock_"); + return p_node->get_meta("_edit_lock_", false); } void Node3DEditorViewport::_list_select(Ref<InputEventMouseButton> b) { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 0d33a7bdc6..5240fdf836 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1950,11 +1950,11 @@ void ScriptEditor::_update_script_colors() { script_list->set_item_custom_bg_color(i, Color(0, 0, 0, 0)); if (script_temperature_enabled) { - if (!n->has_meta("__editor_pass")) { + int pass = n->get_meta("__editor_pass", -1); + if (pass < 0) { continue; } - int pass = n->get_meta("__editor_pass"); int h = edit_pass - pass; if (h > hist_size) { continue; diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index ba87eba9e0..ac90333e1d 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -443,7 +443,11 @@ void TileMapEditorTilesPlugin::_scenes_list_multi_selected(int p_index, bool p_s _update_selection_pattern_from_tileset_tiles_selection(); } -void TileMapEditorTilesPlugin::_scenes_list_nothing_selected() { +void TileMapEditorTilesPlugin::_scenes_list_lmb_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index != MouseButton::LEFT) { + return; + } + scene_tiles_list->deselect_all(); tile_set_selection.clear(); tile_map_selection.clear(); @@ -1508,6 +1512,11 @@ void TileMapEditorTilesPlugin::_fix_invalid_tiles_in_tile_map_selection() { tile_map_selection.erase(cell); } } +void TileMapEditorTilesPlugin::patterns_item_list_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index == MouseButton::LEFT) { + _update_selection_pattern_from_tileset_pattern_selection(); + } +} void TileMapEditorTilesPlugin::_update_selection_pattern_from_tilemap_selection() { TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id)); @@ -2221,7 +2230,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { scene_tiles_list->set_drag_forwarding(this); scene_tiles_list->set_select_mode(ItemList::SELECT_MULTI); scene_tiles_list->connect("multi_selected", callable_mp(this, &TileMapEditorTilesPlugin::_scenes_list_multi_selected)); - scene_tiles_list->connect("nothing_selected", callable_mp(this, &TileMapEditorTilesPlugin::_scenes_list_nothing_selected)); + scene_tiles_list->connect("empty_clicked", callable_mp(this, &TileMapEditorTilesPlugin::_scenes_list_lmb_empty_clicked)); scene_tiles_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); atlas_sources_split_container->add_child(scene_tiles_list); @@ -2251,7 +2260,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { patterns_item_list->connect("gui_input", callable_mp(this, &TileMapEditorTilesPlugin::_patterns_item_list_gui_input)); patterns_item_list->connect("item_selected", callable_mp(this, &TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection).unbind(1)); patterns_item_list->connect("item_activated", callable_mp(this, &TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection)); - patterns_item_list->connect("nothing_selected", callable_mp(this, &TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection)); + patterns_item_list->connect("empty_clicked", callable_mp(this, &TileMapEditorTilesPlugin::patterns_item_list_empty_clicked)); patterns_bottom_panel->add_child(patterns_item_list); patterns_help_label = memnew(Label); diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h index ec32c83d10..f265052200 100644 --- a/editor/plugins/tiles/tile_map_editor.h +++ b/editor/plugins/tiles/tile_map_editor.h @@ -144,6 +144,8 @@ private: void _update_fix_selected_and_hovered(); void _fix_invalid_tiles_in_tile_map_selection(); + void patterns_item_list_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index); + ///// Bottom panel common //// void _tab_changed(); @@ -187,7 +189,7 @@ private: void _update_scenes_collection_view(); void _scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, Variant p_ud); void _scenes_list_multi_selected(int p_index, bool p_selected); - void _scenes_list_nothing_selected(); + void _scenes_list_lmb_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index); ///// Bottom panel patterns //// VBoxContainer *patterns_bottom_panel = nullptr; diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp index 62f3bd6356..3fe13fd341 100644 --- a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp +++ b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp @@ -33,7 +33,11 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" -void TileProxiesManagerDialog::_right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list) { +void TileProxiesManagerDialog::_right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list, MouseButton p_mouse_button_index) { + if (p_mouse_button_index != MouseButton::RIGHT) { + return; + } + ItemList *item_list = Object::cast_to<ItemList>(p_item_list); popup_menu->reset_size(); popup_menu->set_position(get_position() + item_list->get_global_mouse_position()); @@ -336,7 +340,7 @@ TileProxiesManagerDialog::TileProxiesManagerDialog() { source_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); source_level_list->set_select_mode(ItemList::SELECT_MULTI); source_level_list->set_allow_rmb_select(true); - source_level_list->connect("item_rmb_selected", callable_mp(this, &TileProxiesManagerDialog::_right_clicked), varray(source_level_list)); + source_level_list->connect("item_clicked", callable_mp(this, &TileProxiesManagerDialog::_right_clicked), varray(source_level_list)); vbox_container->add_child(source_level_list); Label *coords_level_label = memnew(Label); @@ -347,7 +351,7 @@ TileProxiesManagerDialog::TileProxiesManagerDialog() { coords_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); coords_level_list->set_select_mode(ItemList::SELECT_MULTI); coords_level_list->set_allow_rmb_select(true); - coords_level_list->connect("item_rmb_selected", callable_mp(this, &TileProxiesManagerDialog::_right_clicked), varray(coords_level_list)); + coords_level_list->connect("item_clicked", callable_mp(this, &TileProxiesManagerDialog::_right_clicked), varray(coords_level_list)); vbox_container->add_child(coords_level_list); Label *alternative_level_label = memnew(Label); @@ -358,7 +362,7 @@ TileProxiesManagerDialog::TileProxiesManagerDialog() { alternative_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); alternative_level_list->set_select_mode(ItemList::SELECT_MULTI); alternative_level_list->set_allow_rmb_select(true); - alternative_level_list->connect("item_rmb_selected", callable_mp(this, &TileProxiesManagerDialog::_right_clicked), varray(alternative_level_list)); + alternative_level_list->connect("item_clicked", callable_mp(this, &TileProxiesManagerDialog::_right_clicked), varray(alternative_level_list)); vbox_container->add_child(alternative_level_list); popup_menu = memnew(PopupMenu); diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.h b/editor/plugins/tiles/tile_proxies_manager_dialog.h index 00866544be..44de708898 100644 --- a/editor/plugins/tiles/tile_proxies_manager_dialog.h +++ b/editor/plugins/tiles/tile_proxies_manager_dialog.h @@ -61,7 +61,7 @@ private: EditorPropertyInteger *alternative_to_property_editor = nullptr; PopupMenu *popup_menu = nullptr; - void _right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list); + void _right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list, MouseButton p_mouse_button_index); void _menu_id_pressed(int p_id); void _delete_selected_bindings(); void _update_lists(); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 0ddcb1788a..b385460232 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2318,24 +2318,6 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop continue; } - if (E.name == "__meta__") { - Dictionary metadata = n->get(E.name); - if (metadata.has("_editor_description_")) { - newnode->set_meta("_editor_description_", metadata["_editor_description_"]); - } - - if (Object::cast_to<CanvasItem>(newnode) || Object::cast_to<Node3D>(newnode)) { - if (metadata.has("_edit_group_") && metadata["_edit_group_"]) { - newnode->set_meta("_edit_group_", true); - } - if (metadata.has("_edit_lock_") && metadata["_edit_lock_"]) { - newnode->set_meta("_edit_lock_", true); - } - } - - continue; - } - if (default_oldnode->get(E.name) != n->get(E.name)) { newnode->set(E.name, n->get(E.name)); } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 2f5a4ba04c..b588c01bce 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -355,13 +355,11 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll } if (p_node->is_class("CanvasItem")) { - bool is_locked = p_node->has_meta("_edit_lock_"); //_edit_group_ - if (is_locked) { + if (p_node->has_meta("_edit_lock_")) { item->add_button(0, get_theme_icon(SNAME("Lock"), SNAME("EditorIcons")), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it.")); } - bool is_grouped = p_node->has_meta("_edit_group_"); - if (is_grouped) { + if (p_node->has_meta("_edit_group_")) { item->add_button(0, get_theme_icon(SNAME("Group"), SNAME("EditorIcons")), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable.")); } @@ -389,13 +387,11 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll p_node->connect("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed), varray(p_node)); } } else if (p_node->is_class("Node3D")) { - bool is_locked = p_node->has_meta("_edit_lock_"); - if (is_locked) { + if (p_node->has_meta("_edit_lock_")) { item->add_button(0, get_theme_icon(SNAME("Lock"), SNAME("EditorIcons")), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it.")); } - bool is_grouped = p_node->has_meta("_edit_group_"); - if (is_grouped) { + if (p_node->has_meta("_edit_group_")) { item->add_button(0, get_theme_icon(SNAME("Group"), SNAME("EditorIcons")), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable.")); } diff --git a/misc/dist/linux/org.godotengine.Godot.desktop b/misc/dist/linux/org.godotengine.Godot.desktop index 98c7ada430..79d3d89f41 100644 --- a/misc/dist/linux/org.godotengine.Godot.desktop +++ b/misc/dist/linux/org.godotengine.Godot.desktop @@ -1,8 +1,10 @@ [Desktop Entry] Name=Godot Engine GenericName=Libre game engine +GenericName[fr]=Moteur de jeu libre GenericName[zh_CN]=自由的游戏引擎 Comment=Multi-platform 2D and 3D game engine with a feature-rich editor +Comment[fr]=Moteur de jeu 2D et 3D multiplateforme avec un éditeur riche en fonctionnalités Comment[zh_CN]=多平台 2D 和 3D 游戏引擎,带有功能丰富的编辑器 Exec=godot %f Icon=godot diff --git a/modules/gdscript/tests/scripts/parser/features/advanced_expression_matching.out b/modules/gdscript/tests/scripts/parser/features/advanced_expression_matching.out index 67c7e28046..3cdafb04a9 100644 --- a/modules/gdscript/tests/scripts/parser/features/advanced_expression_matching.out +++ b/modules/gdscript/tests/scripts/parser/features/advanced_expression_matching.out @@ -10,5 +10,5 @@ wildcard [1,2,[1,{1:2,2:var z,..}]] 3 [1,2,[1,{1:2,2:var z,..}]] -[1, 3, 5, 123] +[1, 3, 5, "123"] wildcard diff --git a/modules/gdscript/tests/scripts/parser/features/dictionary.out b/modules/gdscript/tests/scripts/parser/features/dictionary.out index 54083c1afc..5f999f573a 100644 --- a/modules/gdscript/tests/scripts/parser/features/dictionary.out +++ b/modules/gdscript/tests/scripts/parser/features/dictionary.out @@ -7,8 +7,8 @@ null false empty array zero Vector2i -{22:{4:[nesting, arrays]}} -{4:[nesting, arrays]} -[nesting, arrays] +{22:{4:["nesting", "arrays"]}} +{4:["nesting", "arrays"]} +["nesting", "arrays"] nesting arrays diff --git a/modules/gdscript/tests/scripts/parser/features/dictionary_lua_style.out b/modules/gdscript/tests/scripts/parser/features/dictionary_lua_style.out index 5b0ea9df43..5143d040a9 100644 --- a/modules/gdscript/tests/scripts/parser/features/dictionary_lua_style.out +++ b/modules/gdscript/tests/scripts/parser/features/dictionary_lua_style.out @@ -1,2 +1,2 @@ GDTEST_OK -{a:1, b:2, with spaces:3, 2:4} +{"a":1, "b":2, "with spaces":3, "2":4} diff --git a/modules/gdscript/tests/scripts/parser/features/dictionary_mixed_syntax.out b/modules/gdscript/tests/scripts/parser/features/dictionary_mixed_syntax.out index 62be807a1f..dd28609850 100644 --- a/modules/gdscript/tests/scripts/parser/features/dictionary_mixed_syntax.out +++ b/modules/gdscript/tests/scripts/parser/features/dictionary_mixed_syntax.out @@ -1,2 +1,2 @@ GDTEST_OK -{hello:{world:{is:beautiful}}} +{"hello":{"world":{"is":"beautiful"}}} diff --git a/modules/gdscript/tests/scripts/parser/features/nested_dictionary.out b/modules/gdscript/tests/scripts/parser/features/nested_dictionary.out index 4009160439..8b8c33202f 100644 --- a/modules/gdscript/tests/scripts/parser/features/nested_dictionary.out +++ b/modules/gdscript/tests/scripts/parser/features/nested_dictionary.out @@ -1,5 +1,5 @@ GDTEST_OK -{8:{key:value}} -{key:value} +{8:{"key":"value"}} +{"key":"value"} value value diff --git a/modules/gdscript/tests/scripts/runtime/features/stringify.out b/modules/gdscript/tests/scripts/runtime/features/stringify.out index 7670fc0128..d4468737a5 100644 --- a/modules/gdscript/tests/scripts/runtime/features/stringify.out +++ b/modules/gdscript/tests/scripts/runtime/features/stringify.out @@ -21,14 +21,14 @@ hello/world RID(0) Node::get_name Node::[signal]property_list_changed -{hello:123} -[hello, 123] +{"hello":123} +["hello", 123] [255, 0, 1] [-1, 0, 1] [-1, 0, 1] [-1, 0, 1] [-1, 0, 1] -[hello, world] +["hello", "world"] [(1, 1), (0, 0)] [(1, 1, 1), (0, 0, 0)] [(1, 0, 0, 1), (0, 0, 1, 1), (0, 1, 0, 1)] diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index 68968325dd..2f613768ee 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -957,7 +957,7 @@ void GridMapEditor::update_grid() { } void GridMapEditor::_draw_grids(const Vector3 &cell_size) { - Vector3 edited_floor = node->has_meta("_editor_floor_") ? node->get_meta("_editor_floor_") : Variant(); + Vector3 edited_floor = node->get_meta("_editor_floor_", Vector3()); for (int i = 0; i < 3; i++) { RS::get_singleton()->mesh_clear(grid[i]); diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs index bfc807c01a..ebdaca0ce8 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs @@ -334,8 +334,13 @@ namespace GodotTools.Build } } - private void IssuesListRmbSelected(int index, Vector2 atPosition) + private void IssuesListClicked(int index, Vector2 atPosition, int mouseButtonIndex) { + if (mouseButtonIndex != (int)MouseButton.Right) + { + return; + } + _ = index; // Unused _issuesListContextMenu.Clear(); @@ -375,7 +380,7 @@ namespace GodotTools.Build }; _issuesList.ItemActivated += IssueActivated; _issuesList.AllowRmbSelect = true; - _issuesList.ItemRmbSelected += IssuesListRmbSelected; + _issuesList.ItemClicked += IssuesListClicked; hsc.AddChild(_issuesList); _issuesListContextMenu = new PopupMenu(); diff --git a/modules/visual_script/editor/visual_script_property_selector.cpp b/modules/visual_script/editor/visual_script_property_selector.cpp index 07929e5c0e..c8549ddb53 100644 --- a/modules/visual_script/editor/visual_script_property_selector.cpp +++ b/modules/visual_script/editor/visual_script_property_selector.cpp @@ -109,11 +109,7 @@ void VisualScriptPropertySelector::_confirmed() { } void VisualScriptPropertySelector::_item_selected() { - if (results_tree->get_selected()->has_meta("description")) { - help_bit->set_text(results_tree->get_selected()->get_meta("description")); - } else { - help_bit->set_text("No description available"); - } + help_bit->set_text(results_tree->get_selected()->get_meta("description", "No description available")); } void VisualScriptPropertySelector::_hide_requested() { diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index e31550b203..7028fead9a 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -930,6 +930,9 @@ void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const { get_variable_list(&vars); for (const StringName &E : vars) { + if (!variables[E]._export) { + continue; + } PropertyInfo pi = variables[E].info; pi.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE; p_list->push_back(pi); diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 77c1c20499..17b573b776 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -100,7 +100,7 @@ public: } } - void tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { + void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { uint64_t pt = OS::get_singleton()->get_ticks_msec(); if (pt - last_profile_time > 100) { last_profile_time = pt; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 59cb097b34..dddeec5610 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1501,7 +1501,7 @@ void Control::_set_layout_mode(LayoutMode p_mode) { bool list_changed = false; if (p_mode == LayoutMode::LAYOUT_MODE_POSITION || p_mode == LayoutMode::LAYOUT_MODE_ANCHORS) { - if (has_meta("_edit_layout_mode") && (int)get_meta("_edit_layout_mode") != (int)p_mode) { + if ((int)get_meta("_edit_layout_mode", p_mode) != (int)p_mode) { list_changed = true; } @@ -1646,7 +1646,7 @@ void Control::_set_anchors_layout_preset(int p_preset) { int Control::_get_anchors_layout_preset() const { // If the custom preset was selected by user, use it. - if (has_meta("_edit_use_custom_anchors") && (bool)get_meta("_edit_use_custom_anchors")) { + if ((bool)get_meta("_edit_use_custom_anchors", false)) { return -1; } diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 05a5ac75d1..8b22f3722a 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -606,7 +606,7 @@ void ItemList::gui_input(const Ref<InputEvent> &p_event) { return; } - if (mb.is_valid() && (mb->get_button_index() == MouseButton::LEFT || (allow_rmb_select && mb->get_button_index() == MouseButton::RIGHT)) && mb->is_pressed()) { + if (mb.is_valid() && mb->is_pressed()) { search_string = ""; //any mousepress cancels Vector2 pos = mb->get_position(); Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg")); @@ -631,7 +631,7 @@ void ItemList::gui_input(const Ref<InputEvent> &p_event) { } } - if (closest != -1) { + if (closest != -1 && (mb->get_button_index() == MouseButton::LEFT || (allow_rmb_select && mb->get_button_index() == MouseButton::RIGHT))) { int i = closest; if (select_mode == SELECT_MULTI && items[i].selected && mb->is_command_pressed()) { @@ -654,59 +654,38 @@ void ItemList::gui_input(const Ref<InputEvent> &p_event) { emit_signal(SNAME("multi_selected"), j, true); } } + emit_signal(SNAME("item_clicked"), i, get_local_mouse_position(), mb->get_button_index()); - if (mb->get_button_index() == MouseButton::RIGHT) { - if (!CAN_SELECT(i)) { - return; - } - emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position()); - } } else { if (!mb->is_double_click() && !mb->is_command_pressed() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == MouseButton::LEFT) { defer_select_single = i; return; } - if (items[i].selected && mb->get_button_index() == MouseButton::RIGHT) { - if (!CAN_SELECT(i)) { - return; - } - emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position()); - } else { - if (!CAN_SELECT(i)) { - return; - } - - bool selected = items[i].selected; - + if (!items[i].selected || allow_reselect) { select(i, select_mode == SELECT_SINGLE || !mb->is_command_pressed()); - if (!selected || allow_reselect) { - if (select_mode == SELECT_SINGLE) { - emit_signal(SNAME("item_selected"), i); - } else { - emit_signal(SNAME("multi_selected"), i, true); - } + if (select_mode == SELECT_SINGLE) { + emit_signal(SNAME("item_selected"), i); + } else { + emit_signal(SNAME("multi_selected"), i, true); } + } - if (mb->get_button_index() == MouseButton::RIGHT) { - emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position()); - } else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_double_click()) { - emit_signal(SNAME("item_activated"), i); - } + emit_signal(SNAME("item_clicked"), i, get_local_mouse_position(), mb->get_button_index()); + + if (mb->get_button_index() == MouseButton::LEFT && mb->is_double_click()) { + emit_signal(SNAME("item_activated"), i); } } return; + } else if (closest != -1) { + emit_signal(SNAME("item_clicked"), closest, get_local_mouse_position(), mb->get_button_index()); + } else { + // Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting. + emit_signal(SNAME("empty_clicked"), get_local_mouse_position(), mb->get_button_index()); } - if (mb->get_button_index() == MouseButton::RIGHT) { - emit_signal(SNAME("rmb_clicked"), mb->get_position()); - - return; - } - - // Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting. - emit_signal(SNAME("nothing_selected")); } if (mb.is_valid() && mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed()) { scroll_bar->set_value(scroll_bar->get_value() - scroll_bar->get_page() * mb->get_factor() / 8); @@ -1797,11 +1776,10 @@ void ItemList::_bind_methods() { BIND_ENUM_CONSTANT(SELECT_MULTI); ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index"))); - ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "at_position"))); + ADD_SIGNAL(MethodInfo("empty_clicked", PropertyInfo(Variant::VECTOR2, "at_position"), PropertyInfo(Variant::INT, "mouse_button_index"))); + ADD_SIGNAL(MethodInfo("item_clicked", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "at_position"), PropertyInfo(Variant::INT, "mouse_button_index"))); ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "selected"))); ADD_SIGNAL(MethodInfo("item_activated", PropertyInfo(Variant::INT, "index"))); - ADD_SIGNAL(MethodInfo("rmb_clicked", PropertyInfo(Variant::VECTOR2, "at_position"))); - ADD_SIGNAL(MethodInfo("nothing_selected")); GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec", 2000); ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/incremental_search_max_interval_msec", PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater")); // No negative numbers diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 3a3a84b481..8299d73b68 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -523,7 +523,7 @@ void TabContainer::move_child_notify(Node *p_child) { Control *c = Object::cast_to<Control>(p_child); if (c && !c->is_set_as_top_level()) { int old_idx = -1; - String tab_name = c->has_meta("_tab_name") ? String(c->get_meta("_tab_name")) : String(c->get_name()); + String tab_name = String(c->get_meta("_tab_name", c->get_name())); // Find the previous tab index of the control. for (int i = 0; i < get_tab_count(); i++) { @@ -556,9 +556,7 @@ void TabContainer::remove_child_notify(Node *p_child) { update(); } - if (p_child->has_meta("_tab_name")) { - p_child->remove_meta("_tab_name"); - } + p_child->remove_meta("_tab_name"); p_child->disconnect("renamed", callable_mp(this, &TabContainer::_refresh_tab_names)); // TabBar won't emit the "tab_changed" signal when not inside the tree. @@ -679,9 +677,7 @@ void TabContainer::set_tab_title(int p_tab, const String &p_title) { tab_bar->set_tab_title(p_tab, p_title); if (p_title == child->get_name()) { - if (child->has_meta("_tab_name")) { - child->remove_meta("_tab_name"); - } + child->remove_meta("_tab_name"); } else { child->set_meta("_tab_name", p_title); } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f549b3dde2..8961b5ba54 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2012,35 +2012,28 @@ Node *Node::get_deepest_editable_node(Node *p_start_node) const { #ifdef TOOLS_ENABLED void Node::set_property_pinned(const String &p_property, bool p_pinned) { bool current_pinned = false; - bool has_pinned = has_meta("_edit_pinned_properties_"); - Array pinned; - String psa = get_property_store_alias(p_property); - if (has_pinned) { - pinned = get_meta("_edit_pinned_properties_"); - current_pinned = pinned.has(psa); - } + Array pinned = get_meta("_edit_pinned_properties_", Array()); + StringName psa = get_property_store_alias(p_property); + current_pinned = pinned.has(psa); if (current_pinned != p_pinned) { if (p_pinned) { pinned.append(psa); - if (!has_pinned) { - set_meta("_edit_pinned_properties_", pinned); - } } else { pinned.erase(psa); - if (pinned.is_empty()) { - remove_meta("_edit_pinned_properties_"); - } } } + + if (pinned.is_empty()) { + remove_meta("_edit_pinned_properties_"); + } else { + set_meta("_edit_pinned_properties_", pinned); + } } bool Node::is_property_pinned(const StringName &p_property) const { - if (!has_meta("_edit_pinned_properties_")) { - return false; - } - Array pinned = get_meta("_edit_pinned_properties_"); - String psa = get_property_store_alias(p_property); + Array pinned = get_meta("_edit_pinned_properties_", Array()); + StringName psa = get_property_store_alias(p_property); return pinned.has(psa); } diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index f7504974d2..d649942188 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -49,10 +49,7 @@ bool SceneState::can_instantiate() const { } static Array _sanitize_node_pinned_properties(Node *p_node) { - if (!p_node->has_meta("_edit_pinned_properties_")) { - return Array(); - } - Array pinned = p_node->get_meta("_edit_pinned_properties_"); + Array pinned = p_node->get_meta("_edit_pinned_properties_", Array()); if (pinned.is_empty()) { return Array(); } @@ -525,29 +522,19 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map continue; } - Variant forced_value; - if (E.name == META_PROPERTY_MISSING_RESOURCES) { - continue; //ignore this property when packing + continue; // Ignore this property when packing. } - // If instance or inheriting, not saving if property requested so, or it's meta - if (states_stack.size()) { + // If instance or inheriting, not saving if property requested so. + if (!states_stack.is_empty()) { if ((E.usage & PROPERTY_USAGE_NO_INSTANCE_STATE)) { continue; } - // Meta is normally not saved in instances/inherited (see GH-12838), but we need to save the pinned list - if (E.name == "__meta__") { - if (pinned_props.size()) { - Dictionary meta_override; - meta_override["_edit_pinned_properties_"] = pinned_props; - forced_value = meta_override; - } - } } StringName name = E.name; - Variant value = forced_value.get_type() == Variant::NIL ? p_node->get(name) : forced_value; + Variant value = p_node->get(name); if (E.type == Variant::OBJECT && missing_resource_properties.has(E.name)) { // Was this missing resource overriden? If so do not save the old value. @@ -557,7 +544,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map } } - if (!pinned_props.has(name) && forced_value.get_type() == Variant::NIL) { + if (!pinned_props.has(name)) { bool is_valid_default = false; Variant default_value = PropertyUtils::get_property_default_value(p_node, name, &is_valid_default, &states_stack, true); if (is_valid_default && !PropertyUtils::is_property_value_different(value, default_value)) { diff --git a/servers/debugger/servers_debugger.cpp b/servers/debugger/servers_debugger.cpp index d1391937d9..02703cacbf 100644 --- a/servers/debugger/servers_debugger.cpp +++ b/servers/debugger/servers_debugger.cpp @@ -89,7 +89,7 @@ Array ServersDebugger::ServersProfilerFrame::serialize() { Array arr; arr.push_back(frame_number); arr.push_back(frame_time); - arr.push_back(idle_time); + arr.push_back(process_time); arr.push_back(physics_time); arr.push_back(physics_frame_time); arr.push_back(script_time); @@ -120,7 +120,7 @@ bool ServersDebugger::ServersProfilerFrame::deserialize(const Array &p_arr) { CHECK_SIZE(p_arr, 7, "ServersProfilerFrame"); frame_number = p_arr[0]; frame_time = p_arr[1]; - idle_time = p_arr[2]; + process_time = p_arr[2]; physics_time = p_arr[3]; physics_frame_time = p_arr[4]; script_time = p_arr[5]; @@ -281,7 +281,7 @@ class ServersDebugger::ServersProfiler : public EngineProfiler { ScriptsProfiler scripts_profiler; double frame_time = 0; - double idle_time = 0; + double process_time = 0; double physics_time = 0; double physics_frame_time = 0; @@ -289,7 +289,7 @@ class ServersDebugger::ServersProfiler : public EngineProfiler { ServersDebugger::ServersProfilerFrame frame; frame.frame_number = Engine::get_singleton()->get_process_frames(); frame.frame_time = frame_time; - frame.idle_time = idle_time; + frame.process_time = process_time; frame.physics_time = physics_time; frame.physics_frame_time = physics_frame_time; Map<StringName, ServerInfo>::Element *E = server_data.front(); @@ -340,9 +340,9 @@ public: srv.functions.push_back(fi); } - void tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { + void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { frame_time = p_frame_time; - idle_time = p_idle_time; + process_time = p_process_time; physics_time = p_physics_time; physics_frame_time = p_physics_frame_time; _send_frame_data(false); @@ -366,7 +366,7 @@ public: void add(const Array &p_data) {} - void tick(double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time) { + void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { Vector<RS::FrameProfileArea> profile_areas = RS::get_singleton()->get_frame_profile(); ServersDebugger::VisualProfilerFrame frame; if (!profile_areas.size()) { diff --git a/servers/debugger/servers_debugger.h b/servers/debugger/servers_debugger.h index d1c55dc690..f949c436e7 100644 --- a/servers/debugger/servers_debugger.h +++ b/servers/debugger/servers_debugger.h @@ -85,7 +85,7 @@ public: struct ServersProfilerFrame { int frame_number = 0; double frame_time = 0; - double idle_time = 0; + double process_time = 0; double physics_time = 0; double physics_frame_time = 0; double script_time = 0; |